baselode 0.1.6 → 0.1.9

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/baselode.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import K from "papaparse";
2
2
  import { jsx as $, jsxs as Q } from "react/jsx-runtime";
3
- import { useRef as pt, useState as J, useEffect as me, useMemo as He } from "react";
3
+ import { useRef as pt, useState as J, useEffect as me, useMemo as we } from "react";
4
4
  import Pe from "plotly.js-dist-min";
5
- import * as N from "three";
5
+ import * as y from "three";
6
6
  import { OrbitControls as Xt } from "three/examples/jsm/controls/OrbitControls";
7
7
  import { FlyControls as Wt } from "three/examples/jsm/controls/FlyControls";
8
8
  import { ViewportGizmo as Zt } from "three-viewport-gizmo";
9
9
  import { EffectComposer as Kt } from "three/examples/jsm/postprocessing/EffectComposer.js";
10
10
  import { RenderPass as Jt } from "three/examples/jsm/postprocessing/RenderPass.js";
11
11
  import { OutlinePass as Qt } from "three/examples/jsm/postprocessing/OutlinePass.js";
12
- const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", R = "azimuth", B = "dip", S = "from", D = "to", Ee = "mid", ae = "project_id", de = "easting", fe = "northing", bt = "crs", q = "depth", gt = "alpha", yt = "beta", en = "strike", oe = "geology_code", ie = "geology_description", Wr = {
12
+ const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", B = "azimuth", R = "dip", S = "from", D = "to", Ee = "mid", ae = "project_id", de = "easting", fe = "northing", bt = "crs", q = "depth", gt = "alpha", yt = "beta", en = "strike", oe = "geology_code", ie = "geology_description", Zr = {
13
13
  // A unique hole identifier across the entire dataset and all future data sets
14
14
  [z]: "string",
15
15
  // The hole ID from the original collar source
@@ -28,7 +28,7 @@ const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", R = "a
28
28
  [fe]: "number",
29
29
  // The coordinate reference system of the collar coordinates for easting/northing, as an EPSG code or proj string
30
30
  [bt]: "string"
31
- }, Zr = {
31
+ }, Kr = {
32
32
  // The unique hole id that maps to the collar and any other data tables
33
33
  [z]: "string",
34
34
  // The depth along the hole where the survey measurement was taken / started
@@ -36,10 +36,10 @@ const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", R = "a
36
36
  // The depth along the hole where the survey measurement ended, if applicable (some surveys are point measurements and may not have a 'to' depth)
37
37
  [D]: "number",
38
38
  // The azimuth of the hole at the survey depth, in degrees from north
39
- [R]: "number",
39
+ [B]: "number",
40
40
  // The dip of the hole at the survey depth, in degrees from horizontal (negative values indicate downward inclination)
41
- [B]: "number"
42
- }, Kr = {
41
+ [R]: "number"
42
+ }, Jr = {
43
43
  // The unique hole id that maps to the collar and any other data tables
44
44
  [z]: "string",
45
45
  // The depth along the hole where the assay interval starts
@@ -57,11 +57,11 @@ const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", R = "a
57
57
  [Ee]: "number",
58
58
  [oe]: "string",
59
59
  [ie]: "string"
60
- }, Jr = {
60
+ }, Qr = {
61
61
  [z]: "string",
62
62
  [q]: "number",
63
- [B]: "number",
64
63
  [R]: "number",
64
+ [B]: "number",
65
65
  [gt]: "number",
66
66
  [yt]: "number",
67
67
  comments: "string"
@@ -98,8 +98,8 @@ const z = "hole_id", te = "latitude", ne = "longitude", Me = "elevation", R = "a
98
98
  "description",
99
99
  "comments"
100
100
  ],
101
- [R]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdir_calc", "dipdirect_calc"],
102
- [B]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
101
+ [B]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdir_calc", "dipdirect_calc"],
102
+ [R]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
103
103
  [gt]: ["alpha", "alpha_angle", "alpha_angle_deg", "alpha_2"],
104
104
  [yt]: ["beta", "beta_angle", "beta_angle_deg", "beta_2"],
105
105
  declination: ["declination", "dec"],
@@ -130,7 +130,7 @@ function he(e, t = null, n = null) {
130
130
  }
131
131
  return o;
132
132
  }
133
- function Qr(e, t = null, n = null) {
133
+ function eo(e, t = null, n = null) {
134
134
  return e.map((r) => he(r, t, n));
135
135
  }
136
136
  const rn = /* @__PURE__ */ new Set([
@@ -165,25 +165,25 @@ const rn = /* @__PURE__ */ new Set([
165
165
  "todepth",
166
166
  "comment",
167
167
  "z"
168
- ]), Be = "[baselode:data]";
168
+ ]), Re = "[baselode:data]";
169
169
  function on(e, t = "Unknown error") {
170
170
  if (e instanceof Error) return e;
171
171
  const n = typeof e == "string" && e.trim() ? e : t;
172
172
  return new Error(n);
173
173
  }
174
- function w(e, t, n = "Operation failed") {
174
+ function H(e, t, n = "Operation failed") {
175
175
  const r = on(t, n), o = new Error(`${e}: ${r.message}`);
176
176
  return o.cause = r, o;
177
177
  }
178
- function eo(e, t) {
178
+ function to(e, t) {
179
179
  if (t !== void 0) {
180
- console.warn(`${Be} ${e}`, t);
180
+ console.warn(`${Re} ${e}`, t);
181
181
  return;
182
182
  }
183
- console.warn(`${Be} ${e}`);
183
+ console.warn(`${Re} ${e}`);
184
184
  }
185
- function to(e) {
186
- console.info(`${Be} ${e}`);
185
+ function no(e) {
186
+ console.info(`${Re} ${e}`);
187
187
  }
188
188
  const Te = (e, t = null) => he(e, null, t);
189
189
  function sn(e) {
@@ -216,7 +216,7 @@ function zt(e, t) {
216
216
  r.push(u), r.push({ ...u, z: l });
217
217
  }), { id: e, project: (o = n[0]) == null ? void 0 : o.project, points: r };
218
218
  }
219
- function no(e, t = null) {
219
+ function ro(e, t = null) {
220
220
  return new Promise((n, r) => {
221
221
  const o = /* @__PURE__ */ new Set();
222
222
  K.parse(e, {
@@ -228,7 +228,7 @@ function no(e, t = null) {
228
228
  l !== void 0 && `${l}`.trim() !== "" && o.add(`${l}`.trim());
229
229
  },
230
230
  complete: () => n(Array.from(o)),
231
- error: (i) => r(w("parseAssayHoleIds", i))
231
+ error: (i) => r(H("parseAssayHoleIds", i))
232
232
  });
233
233
  });
234
234
  }
@@ -254,7 +254,7 @@ function an(e, t = null) {
254
254
  }
255
255
  },
256
256
  complete: () => n(Array.from(o.values())),
257
- error: (i) => r(w("parseAssayHoleIdsWithAssays", i))
257
+ error: (i) => r(H("parseAssayHoleIdsWithAssays", i))
258
258
  });
259
259
  });
260
260
  }
@@ -262,7 +262,7 @@ function cn(e, t, n = null, r = null) {
262
262
  return new Promise((o, i) => {
263
263
  const s = `${t}`.trim();
264
264
  if (!s) {
265
- i(w("parseAssayHole", new Error("Missing hole id")));
265
+ i(H("parseAssayHole", new Error("Missing hole id")));
266
266
  return;
267
267
  }
268
268
  const l = [];
@@ -282,7 +282,7 @@ function cn(e, t, n = null, r = null) {
282
282
  const c = zt(s, l);
283
283
  o(c);
284
284
  },
285
- error: (c) => i(w("parseAssayHole", c))
285
+ error: (c) => i(H("parseAssayHole", c))
286
286
  });
287
287
  });
288
288
  }
@@ -301,17 +301,17 @@ function un(e, t = null, n = null) {
301
301
  const l = Array.from(s.entries()).map(([c, a]) => zt(c, a));
302
302
  r({ holes: l });
303
303
  },
304
- error: (i) => o(w("parseAssaysCSV", i))
304
+ error: (i) => o(H("parseAssaysCSV", i))
305
305
  });
306
306
  });
307
307
  }
308
- function ro(e = {}) {
308
+ function oo(e = {}) {
309
309
  const t = {};
310
310
  return Object.entries(e || {}).forEach(([n, r]) => {
311
311
  n && (t[Ce(n)] = r);
312
312
  }), t;
313
313
  }
314
- function oo(e = {}, t = [], n) {
314
+ function io(e = {}, t = [], n) {
315
315
  for (const r of t) {
316
316
  const o = e[r];
317
317
  if (o != null && `${o}`.trim() !== "")
@@ -328,7 +328,7 @@ function Mt(e = [], t = "") {
328
328
  const r = e[n], o = e.filter((i, s) => s !== n);
329
329
  return [r, ...o];
330
330
  }
331
- function Oe({
331
+ function ke({
332
332
  property: e = "",
333
333
  chartType: t = "",
334
334
  categoricalProps: n = [],
@@ -348,7 +348,7 @@ function xt({
348
348
  } = {}) {
349
349
  const l = Mt(e, t);
350
350
  return Array.from({ length: n }).map((c, a) => {
351
- const u = l[a] || e[a] || "", m = Oe({
351
+ const u = l[a] || e[a] || "", m = ke({
352
352
  property: r,
353
353
  chartType: "",
354
354
  categoricalProps: o,
@@ -362,7 +362,7 @@ function xt({
362
362
  };
363
363
  });
364
364
  }
365
- const Ie = "numeric", Se = "categorical", xe = "comment", ke = "hidden", Ge = "tadpole", Qe = {
365
+ const Ie = "numeric", Se = "categorical", xe = "comment", Oe = "hidden", Ge = "tadpole", Qe = {
366
366
  [Ie]: [
367
367
  { value: "bar", label: "Bars" },
368
368
  { value: "markers", label: "Markers" },
@@ -378,7 +378,7 @@ const Ie = "numeric", Se = "categorical", xe = "comment", ke = "hidden", Ge = "t
378
378
  [Ge]: [
379
379
  { value: "tadpole", label: "Tadpole" }
380
380
  ],
381
- [ke]: []
381
+ [Oe]: []
382
382
  }, et = /* @__PURE__ */ new Set([
383
383
  // Hole identifiers
384
384
  "hole_id",
@@ -454,7 +454,7 @@ function fn(e) {
454
454
  for (const r of t) {
455
455
  const o = r.toLowerCase().trim();
456
456
  if (et.has(o) || et.has(r)) {
457
- n[r] = ke;
457
+ n[r] = Oe;
458
458
  continue;
459
459
  }
460
460
  if (dn.has(o)) {
@@ -462,7 +462,7 @@ function fn(e) {
462
462
  const a = c[r];
463
463
  return a != null && String(a).trim() !== "" && String(a) !== "null";
464
464
  });
465
- n[r] = l ? xe : ke;
465
+ n[r] = l ? xe : Oe;
466
466
  continue;
467
467
  }
468
468
  let i = !1, s = !1;
@@ -473,7 +473,7 @@ function fn(e) {
473
473
  break;
474
474
  }
475
475
  }
476
- s ? i ? n[r] = Ie : n[r] = Se : n[r] = ke;
476
+ s ? i ? n[r] = Ie : n[r] = Se : n[r] = Oe;
477
477
  }
478
478
  return {
479
479
  byType: n,
@@ -482,11 +482,11 @@ function fn(e) {
482
482
  commentCols: Object.entries(n).filter(([, r]) => r === xe).map(([r]) => r)
483
483
  };
484
484
  }
485
- function Ue(e) {
485
+ function Ye(e) {
486
486
  return Qe[e] ?? Qe[Ie];
487
487
  }
488
- function io(e) {
489
- const t = Ue(e);
488
+ function so(e) {
489
+ const t = Ye(e);
490
490
  return t.length ? e === Ie ? "line" : t[0].value : "markers+line";
491
491
  }
492
492
  function Le(e = []) {
@@ -526,27 +526,27 @@ function bn(e = [], t = "") {
526
526
  traceConfigs: c
527
527
  };
528
528
  }
529
- async function so(e, t = "", n = null) {
529
+ async function lo(e, t = "", n = null) {
530
530
  const { holes: r } = await un(e, n), o = bn(r, t);
531
531
  if (!o) throw new Error("No valid assay intervals found.");
532
532
  return o;
533
533
  }
534
- function lo(e, t = null) {
534
+ function ao(e, t = null) {
535
535
  return new Promise((n, r) => {
536
536
  K.parse(e, {
537
537
  header: !0,
538
538
  dynamicTyping: !0,
539
539
  skipEmptyLines: !0,
540
540
  complete: (o) => {
541
- const i = o.data.map((s) => gn(s, t)).filter((s) => s[z] && Number.isFinite(s[q]) && Number.isFinite(s[B]) && Number.isFinite(s[R]));
541
+ const i = o.data.map((s) => gn(s, t)).filter((s) => s[z] && Number.isFinite(s[q]) && Number.isFinite(s[R]) && Number.isFinite(s[B]));
542
542
  n(i);
543
543
  },
544
- error: (o) => r(w("parseSurveyCSV", o))
544
+ error: (o) => r(H("parseSurveyCSV", o))
545
545
  });
546
546
  });
547
547
  }
548
548
  function gn(e, t = null) {
549
- const n = he(e, null, t), r = n[z], o = n[ae] || n.project || n.project_code, i = Ne(n[te]), s = Ne(n[ne]), l = Ne(n[q]), c = Ne(n[B]), a = Ne(n[R]), u = Ne(n.maxdepth);
549
+ const n = he(e, null, t), r = n[z], o = n[ae] || n.project || n.project_code, i = Ne(n[te]), s = Ne(n[ne]), l = Ne(n[q]), c = Ne(n[R]), a = Ne(n[B]), u = Ne(n.maxdepth);
550
550
  return {
551
551
  raw: n,
552
552
  [z]: r,
@@ -554,8 +554,8 @@ function gn(e, t = null) {
554
554
  [te]: i,
555
555
  [ne]: s,
556
556
  [q]: l,
557
- [B]: c,
558
- [R]: a,
557
+ [R]: c,
558
+ [B]: a,
559
559
  maxdepth: u,
560
560
  // Legacy field names for backwards compatibility
561
561
  project_code: o,
@@ -568,7 +568,7 @@ const Ne = (e) => {
568
568
  const t = Number(e);
569
569
  return Number.isFinite(t) ? t : void 0;
570
570
  };
571
- function ao(e, t) {
571
+ function co(e, t) {
572
572
  var a, u, m, d;
573
573
  const n = /* @__PURE__ */ new Map();
574
574
  e.forEach((f) => {
@@ -588,41 +588,41 @@ function ao(e, t) {
588
588
  return l.forEach((f, p) => {
589
589
  const b = n.get(p);
590
590
  if (!b) return;
591
- const h = f.filter((F) => Number.isFinite(F[q] ?? F.surveydepth)).sort((F, Y) => (F[q] ?? F.surveydepth) - (Y[q] ?? Y.surveydepth));
591
+ const h = f.filter((F) => Number.isFinite(F[q] ?? F.surveydepth)).sort((F, U) => (F[q] ?? F.surveydepth) - (U[q] ?? U.surveydepth));
592
592
  if (!h.length) return;
593
- const _ = b.lat ?? b[te], g = b.lng ?? b[ne], v = 111132, M = 111320 * Math.cos(_ * Math.PI / 180), E = (g - o) * s, P = (_ - r) * i, C = [];
594
- let L = 0, k = 0, G = 0;
593
+ const N = b.lat ?? b[te], g = b.lng ?? b[ne], v = 111132, M = 111320 * Math.cos(N * Math.PI / 180), E = (g - o) * s, P = (N - r) * i, C = [];
594
+ let L = 0, O = 0, G = 0;
595
595
  for (let F = 0; F < h.length; F += 1) {
596
- const Y = h[F], j = h[F - 1], A = Y[q] ?? Y.surveydepth, x = Y[R] ?? Y.azimuth, y = Y[B] ?? Y.dip;
596
+ const U = h[F], j = h[F - 1], A = U[q] ?? U.surveydepth, x = U[B] ?? U.azimuth, _ = U[R] ?? U.dip;
597
597
  if (!j) {
598
598
  C.push({
599
599
  x: E + L,
600
- y: P + k,
600
+ y: P + O,
601
601
  z: 0,
602
602
  md: A,
603
603
  azimuth: x,
604
- dip: y
604
+ dip: _
605
605
  });
606
606
  continue;
607
607
  }
608
- const O = j[q] ?? j.surveydepth, I = j[R] ?? j.azimuth, V = j[B] ?? j.dip, H = A - O;
609
- if (H <= 0) continue;
610
- const T = tt(V), U = tt(y), W = Ye(I), re = Ye(x), pe = Math.acos(
611
- Math.sin(T) * Math.sin(U) * Math.cos(W - re) + Math.cos(T) * Math.cos(U)
612
- ), ce = pe > 1e-6 ? 2 / pe * Math.tan(pe / 2) : 1, ve = 0.5 * H * (Math.sin(T) * Math.cos(W) + Math.sin(U) * Math.cos(re)) * ce, ue = 0.5 * H * (Math.sin(T) * Math.sin(W) + Math.sin(U) * Math.sin(re)) * ce, Ve = 0.5 * H * (Math.cos(T) + Math.cos(U)) * ce;
613
- L += ve, k += ue, G += Ve, C.push({
608
+ const k = j[q] ?? j.surveydepth, I = j[B] ?? j.azimuth, V = j[R] ?? j.dip, w = A - k;
609
+ if (w <= 0) continue;
610
+ const T = tt(V), Y = tt(_), W = Ue(I), re = Ue(x), pe = Math.acos(
611
+ Math.sin(T) * Math.sin(Y) * Math.cos(W - re) + Math.cos(T) * Math.cos(Y)
612
+ ), ce = pe > 1e-6 ? 2 / pe * Math.tan(pe / 2) : 1, ve = 0.5 * w * (Math.sin(T) * Math.cos(W) + Math.sin(Y) * Math.cos(re)) * ce, ue = 0.5 * w * (Math.sin(T) * Math.sin(W) + Math.sin(Y) * Math.sin(re)) * ce, Ve = 0.5 * w * (Math.cos(T) + Math.cos(Y)) * ce;
613
+ L += ve, O += ue, G += Ve, C.push({
614
614
  x: E + L,
615
- y: P + k,
615
+ y: P + O,
616
616
  z: -G,
617
617
  // render with z up; depth down
618
618
  md: A,
619
619
  azimuth: x,
620
- dip: y
620
+ dip: _
621
621
  });
622
622
  }
623
623
  const X = C.map((F) => ({
624
624
  ...F,
625
- lat: _ + F.y / v,
625
+ lat: N + F.y / v,
626
626
  lng: g + F.x / M
627
627
  }));
628
628
  c.push({
@@ -633,9 +633,9 @@ function ao(e, t) {
633
633
  });
634
634
  }), c;
635
635
  }
636
- const Ye = (e) => e * Math.PI / 180, tt = (e) => {
636
+ const Ue = (e) => e * Math.PI / 180, tt = (e) => {
637
637
  const t = Number(e), n = 90 + (Number.isFinite(t) ? t : 0), r = Math.min(180, Math.max(0, n));
638
- return Ye(r);
638
+ return Ue(r);
639
639
  };
640
640
  function ee(e, t = void 0) {
641
641
  const n = Number(e);
@@ -647,7 +647,7 @@ function nt(e) {
647
647
  function Fe(e = [], t = null) {
648
648
  const n = t || "hole_id", o = [n, "hole_id", "holeId", "id"].find((i) => e.some((s) => nt(s == null ? void 0 : s[i])));
649
649
  if (!o)
650
- throw w("canonicalizeHoleIdRows", new Error(`hole id column '${n}' not found`));
650
+ throw H("canonicalizeHoleIdRows", new Error(`hole id column '${n}' not found`));
651
651
  return {
652
652
  aliasCol: o,
653
653
  rows: e.map((i) => ({
@@ -659,12 +659,12 @@ function Fe(e = [], t = null) {
659
659
  function rt(e) {
660
660
  return Number(e) * Math.PI / 180;
661
661
  }
662
- function we(e, t) {
662
+ function He(e, t) {
663
663
  const n = rt(e), r = rt(t), o = Math.cos(r) * Math.sin(n), i = Math.cos(r) * Math.cos(n), s = Math.sin(r) * -1;
664
664
  return { ca: o, cb: i, cc: s };
665
665
  }
666
666
  function yn(e, t, n, r, o, i = "minimum_curvature") {
667
- const s = we(t, n), l = we(r, o);
667
+ const s = He(t, n), l = He(r, o);
668
668
  if (i === "tangential")
669
669
  return {
670
670
  dx: e * s.ca,
@@ -674,7 +674,7 @@ function yn(e, t, n, r, o, i = "minimum_curvature") {
674
674
  dip: n
675
675
  };
676
676
  if (i === "balanced_tangential") {
677
- const m = 0.5 * (t + r), d = 0.5 * (n + o), f = we(m, d);
677
+ const m = 0.5 * (t + r), d = 0.5 * (n + o), f = He(m, d);
678
678
  return {
679
679
  dx: e * f.ca,
680
680
  dy: e * f.cb,
@@ -718,33 +718,33 @@ function qe(e = [], t = [], n = {}) {
718
718
  dip: ee(C.dip)
719
719
  })).filter((C) => Number.isFinite(C.from) && Number.isFinite(C.azimuth) && Number.isFinite(C.dip)).sort((C, L) => C.from - L.from);
720
720
  if (!b.length) return;
721
- let h = ee(p.x, 0), _ = ee(p.y, 0), g = ee(p.z, 0), v = b[0].from;
721
+ let h = ee(p.x, 0), N = ee(p.y, 0), g = ee(p.z, 0), v = b[0].from;
722
722
  const M = b[0].azimuth, E = b[0].dip, P = {
723
723
  hole_id: f,
724
724
  md: v,
725
725
  x: h,
726
- y: _,
726
+ y: N,
727
727
  z: g,
728
728
  azimuth: M,
729
729
  dip: E
730
730
  };
731
731
  l.aliasCol !== "hole_id" && p[l.aliasCol] !== void 0 && (P[l.aliasCol] = p[l.aliasCol]), m.push(P);
732
732
  for (let C = 0; C < b.length - 1; C += 1) {
733
- const L = b[C], k = b[C + 1], G = L.from, F = k.from - G;
733
+ const L = b[C], O = b[C + 1], G = L.from, F = O.from - G;
734
734
  if (F <= 0) continue;
735
- const Y = Math.max(1, Math.ceil(F / s)), j = F / Y;
736
- for (let A = 0; A < Y; A += 1) {
735
+ const U = Math.max(1, Math.ceil(F / s)), j = F / U;
736
+ for (let A = 0; A < U; A += 1) {
737
737
  v += j;
738
- const x = (v - G) / F, y = L.azimuth + x * (k.azimuth - L.azimuth), O = L.dip + x * (k.dip - L.dip), I = yn(j, L.azimuth, L.dip, k.azimuth, k.dip, i);
739
- h += I.dx, _ += I.dy, g += I.dz;
738
+ const x = (v - G) / F, _ = L.azimuth + x * (O.azimuth - L.azimuth), k = L.dip + x * (O.dip - L.dip), I = yn(j, L.azimuth, L.dip, O.azimuth, O.dip, i);
739
+ h += I.dx, N += I.dy, g += I.dz;
740
740
  const V = {
741
741
  hole_id: f,
742
742
  md: v,
743
743
  x: h,
744
- y: _,
744
+ y: N,
745
745
  z: g,
746
- azimuth: i === "minimum_curvature" ? y : I.azimuth,
747
- dip: i === "minimum_curvature" ? O : I.dip
746
+ azimuth: i === "minimum_curvature" ? _ : I.azimuth,
747
+ dip: i === "minimum_curvature" ? k : I.dip
748
748
  };
749
749
  l.aliasCol !== "hole_id" && p[l.aliasCol] !== void 0 && (V[l.aliasCol] = p[l.aliasCol]), m.push(V);
750
750
  }
@@ -754,13 +754,13 @@ function qe(e = [], t = [], n = {}) {
754
754
  function _n(e, t, n = {}) {
755
755
  return qe(e, t, { ...n, method: "minimum_curvature" });
756
756
  }
757
- function co(e, t, n = {}) {
757
+ function uo(e, t, n = {}) {
758
758
  return qe(e, t, { ...n, method: "tangential" });
759
759
  }
760
- function uo(e, t, n = {}) {
760
+ function mo(e, t, n = {}) {
761
761
  return qe(e, t, { ...n, method: "balanced_tangential" });
762
762
  }
763
- function mo(e, t, n = {}) {
763
+ function fo(e, t, n = {}) {
764
764
  return _n(e, t, n);
765
765
  }
766
766
  function Nn(e, t) {
@@ -774,7 +774,7 @@ function Nn(e, t) {
774
774
  }
775
775
  return n;
776
776
  }
777
- function fo(e = [], t = [], n = {}) {
777
+ function ho(e = [], t = [], n = {}) {
778
778
  const r = n.holeIdCol || "hole_id", o = Fe(e, r), i = Fe(t, r);
779
779
  if (!o.rows.length || !i.rows.length) return [...o.rows];
780
780
  const s = /* @__PURE__ */ new Map();
@@ -793,7 +793,7 @@ function fo(e = [], t = [], n = {}) {
793
793
  }), d;
794
794
  });
795
795
  }
796
- function ho(e, t = null) {
796
+ function po(e, t = null) {
797
797
  return new Promise((n, r) => {
798
798
  K.parse(e, {
799
799
  header: !0,
@@ -823,7 +823,7 @@ function ho(e, t = null) {
823
823
  }));
824
824
  n({ holes: s });
825
825
  },
826
- error: (o) => r(w("parseDrillholesCSV", o))
826
+ error: (o) => r(H("parseDrillholesCSV", o))
827
827
  });
828
828
  });
829
829
  }
@@ -853,7 +853,7 @@ function zn(e = [], t = "Intervals") {
853
853
  if (!i || !Number.isFinite(s) || !Number.isFinite(l)) return;
854
854
  const c = r.get(i);
855
855
  if (Number.isFinite(c) && s < c)
856
- throw w(
856
+ throw H(
857
857
  "validateNoOverlappingIntervals",
858
858
  new Error(`${t} intervals overlap for hole '${i}': from=${s} is less than previous to=${c}`)
859
859
  );
@@ -868,7 +868,7 @@ function Mn(e, t = {}) {
868
868
  skipEmptyLines: !0,
869
869
  ...t,
870
870
  complete: (o) => n(Array.isArray(o == null ? void 0 : o.data) ? o.data : []),
871
- error: (o) => r(w("loadTable(csv)", o))
871
+ error: (o) => r(H("loadTable(csv)", o))
872
872
  });
873
873
  });
874
874
  }
@@ -887,10 +887,10 @@ async function $e(e, t = {}) {
887
887
  s = ze(e);
888
888
  else if (n === "csv")
889
889
  s = await Mn(e, i);
890
- else throw n === "parquet" || n === "sql" ? w("loadTable", new Error(`Unsupported kind in JS runtime: ${n}`)) : w("loadTable", new Error(`Unsupported kind: ${n}`));
890
+ else throw n === "parquet" || n === "sql" ? H("loadTable", new Error(`Unsupported kind in JS runtime: ${n}`)) : H("loadTable", new Error(`Unsupported kind: ${n}`));
891
891
  return xn(s, r, o);
892
892
  }
893
- async function po(e, t = {}) {
893
+ async function bo(e, t = {}) {
894
894
  const {
895
895
  crs: n = null,
896
896
  sourceColumnMap: r = null,
@@ -898,10 +898,10 @@ async function po(e, t = {}) {
898
898
  ...i
899
899
  } = t, s = await $e(e, { ...i, sourceColumnMap: r });
900
900
  if (!s.some((d) => z in d))
901
- throw w("loadCollars", new Error(`Collar table missing column: ${z}`));
901
+ throw H("loadCollars", new Error(`Collar table missing column: ${z}`));
902
902
  const c = s.some((d) => de in d && fe in d), a = s.some((d) => te in d && ne in d);
903
903
  if (!c && !a)
904
- throw w("loadCollars", new Error("Collar table missing coordinate columns (need easting/northing or latitude/longitude)"));
904
+ throw H("loadCollars", new Error("Collar table missing coordinate columns (need easting/northing or latitude/longitude)"));
905
905
  const u = s.map((d) => {
906
906
  const f = { ...d };
907
907
  if (z in f) {
@@ -911,31 +911,31 @@ async function po(e, t = {}) {
911
911
  return te in f && (f[te] = Z(f[te])), ne in f && (f[ne] = Z(f[ne])), Me in f && (f[Me] = Z(f[Me])), de in f && (f[de] = Z(f[de])), fe in f && (f[fe] = Z(f[fe])), !("datasource_hole_id" in f) && z in f && (f.datasource_hole_id = f[z]), f;
912
912
  });
913
913
  if (!u.every((d) => !(!d[z] || a && (!Number.isFinite(d[te]) || !Number.isFinite(d[ne])) || c && !a && (!Number.isFinite(d[de]) || !Number.isFinite(d[fe])))))
914
- throw w("loadCollars", new Error("Collar table has missing required values"));
914
+ throw H("loadCollars", new Error("Collar table has missing required values"));
915
915
  return u;
916
916
  }
917
- async function bo(e, t = {}) {
917
+ async function go(e, t = {}) {
918
918
  const {
919
919
  sourceColumnMap: n = null,
920
920
  keepAll: r = !0,
921
921
  ...o
922
- } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, q, R, B];
922
+ } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, q, B, R];
923
923
  for (const a of s)
924
924
  if (!i.some((m) => a in m))
925
- throw w("loadSurveys", new Error(`Survey table missing column: ${a}`));
925
+ throw H("loadSurveys", new Error(`Survey table missing column: ${a}`));
926
926
  const l = i.map((a) => {
927
927
  const u = { ...a };
928
928
  if (z in u) {
929
929
  const m = u[z];
930
930
  u[z] = m == null ? "" : `${m}`.trim();
931
931
  }
932
- return q in u && (u[q] = Z(u[q])), D in u && (u[D] = Z(u[D])), R in u && (u[R] = Z(u[R])), B in u && (u[B] = Z(u[B])), u;
932
+ return q in u && (u[q] = Z(u[q])), D in u && (u[D] = Z(u[D])), B in u && (u[B] = Z(u[B])), R in u && (u[R] = Z(u[R])), u;
933
933
  });
934
- if (!l.every((a) => !(!a[z] || !Number.isFinite(a[q]) || !Number.isFinite(a[R]) || !Number.isFinite(a[B]))))
935
- throw w("loadSurveys", new Error("Survey table has missing required values"));
934
+ if (!l.every((a) => !(!a[z] || !Number.isFinite(a[q]) || !Number.isFinite(a[B]) || !Number.isFinite(a[R]))))
935
+ throw H("loadSurveys", new Error("Survey table has missing required values"));
936
936
  return De(l, [z, q]);
937
937
  }
938
- async function go(e, t = {}) {
938
+ async function yo(e, t = {}) {
939
939
  const {
940
940
  sourceColumnMap: n = null,
941
941
  keepAll: r = !0,
@@ -943,7 +943,7 @@ async function go(e, t = {}) {
943
943
  } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, S, D];
944
944
  for (const a of s)
945
945
  if (!i.some((m) => a in m))
946
- throw w("loadAssays", new Error(`Assay table missing column: ${a}`));
946
+ throw H("loadAssays", new Error(`Assay table missing column: ${a}`));
947
947
  const l = i.map((a) => {
948
948
  const u = { ...a };
949
949
  if (z in u) {
@@ -953,10 +953,10 @@ async function go(e, t = {}) {
953
953
  return S in u && (u[S] = Z(u[S])), D in u && (u[D] = Z(u[D])), S in u && D in u && Number.isFinite(u[S]) && Number.isFinite(u[D]) && (u[Ee] = 0.5 * (u[S] + u[D])), u;
954
954
  });
955
955
  if (!l.every((a) => !(!a[z] || !Number.isFinite(a[S]) || !Number.isFinite(a[D]) || !(a[D] > a[S]))))
956
- throw w("loadAssays", new Error("Assay table has missing required values"));
956
+ throw H("loadAssays", new Error("Assay table has missing required values"));
957
957
  return De(l, [z, S, D]);
958
958
  }
959
- async function yo(e, t = {}) {
959
+ async function _o(e, t = {}) {
960
960
  const {
961
961
  sourceColumnMap: n = null,
962
962
  keepAll: r = !0,
@@ -964,7 +964,7 @@ async function yo(e, t = {}) {
964
964
  } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, S, D];
965
965
  for (const u of s)
966
966
  if (!i.some((d) => u in d))
967
- throw w("loadGeology", new Error(`Geology table missing column: ${u}`));
967
+ throw H("loadGeology", new Error(`Geology table missing column: ${u}`));
968
968
  const l = i.map((u) => {
969
969
  const m = { ...u };
970
970
  if (z in m) {
@@ -976,12 +976,12 @@ async function yo(e, t = {}) {
976
976
  return !d && f && (m[oe] = m[ie]), d && !f && (m[ie] = m[oe]), m;
977
977
  });
978
978
  if (!l.every((u) => !(!u[z] || !Number.isFinite(u[S]) || !Number.isFinite(u[D]) || !(u[D] > u[S]))))
979
- throw w("loadGeology", new Error("Geology table has missing or invalid interval values"));
979
+ throw H("loadGeology", new Error("Geology table has missing or invalid interval values"));
980
980
  if (!l.some((u) => {
981
981
  const m = u[oe], d = u[ie];
982
982
  return m != null && `${m}`.trim() !== "" || d != null && `${d}`.trim() !== "";
983
983
  }))
984
- throw w("loadGeology", new Error(`Geology table missing categorical columns: ${oe} or ${ie}`));
984
+ throw H("loadGeology", new Error(`Geology table missing categorical columns: ${oe} or ${ie}`));
985
985
  if (zn(l, "Geology"), !r) {
986
986
  const u = new Set(Object.keys(tn));
987
987
  return De(
@@ -991,7 +991,7 @@ async function yo(e, t = {}) {
991
991
  }
992
992
  return De(l, [z, S, D]);
993
993
  }
994
- function _o(e = [], t = [], n = {}) {
994
+ function No(e = [], t = [], n = {}) {
995
995
  const r = Array.isArray(n.onCols) && n.onCols.length ? n.onCols : [z];
996
996
  if (!t.length) return [...e];
997
997
  const o = (s) => r.map((l) => `${(s == null ? void 0 : s[l]) ?? ""}`).join("|"), i = /* @__PURE__ */ new Map();
@@ -1006,10 +1006,10 @@ function _o(e = [], t = [], n = {}) {
1006
1006
  }), c;
1007
1007
  });
1008
1008
  }
1009
- function No(e = [], t = null) {
1009
+ function zo(e = [], t = null) {
1010
1010
  return t == null ? [...e] : e.length ? e.some((r) => ae in r) ? e.filter((r) => (r == null ? void 0 : r[ae]) === t) : [...e] : [];
1011
1011
  }
1012
- function zo(e = [], t = []) {
1012
+ function Mo(e = [], t = []) {
1013
1013
  return e.map((n) => {
1014
1014
  const r = { ...n };
1015
1015
  return t.forEach((o) => {
@@ -1019,7 +1019,7 @@ function zo(e = [], t = []) {
1019
1019
  }), r;
1020
1020
  });
1021
1021
  }
1022
- function Mo({
1022
+ function xo({
1023
1023
  collars: e = [],
1024
1024
  surveys: t = [],
1025
1025
  assays: n = [],
@@ -1056,7 +1056,7 @@ function En(e) {
1056
1056
  t[o] = r;
1057
1057
  }), t;
1058
1058
  }
1059
- function xo(e) {
1059
+ function Io(e) {
1060
1060
  return new Promise((t, n) => {
1061
1061
  K.parse(e, {
1062
1062
  header: !0,
@@ -1071,20 +1071,20 @@ function xo(e) {
1071
1071
  t({ data: i, properties: s });
1072
1072
  },
1073
1073
  error: (r) => {
1074
- n(w("parseBlockModelCSV", r));
1074
+ n(H("parseBlockModelCSV", r));
1075
1075
  }
1076
1076
  });
1077
1077
  });
1078
1078
  }
1079
- function Io(e) {
1079
+ function Eo(e) {
1080
1080
  if (typeof e == "string")
1081
1081
  try {
1082
1082
  return JSON.parse(e);
1083
1083
  } catch (t) {
1084
- throw w("loadBlockModelMetadata", t);
1084
+ throw H("loadBlockModelMetadata", t);
1085
1085
  }
1086
1086
  if (e && typeof e == "object") return e;
1087
- throw w("loadBlockModelMetadata", new Error("Invalid metadata source"));
1087
+ throw H("loadBlockModelMetadata", new Error("Invalid metadata source"));
1088
1088
  }
1089
1089
  function vn(e, t) {
1090
1090
  const n = e.map((i) => i[t]).filter((i) => i != null);
@@ -1094,7 +1094,7 @@ function vn(e, t) {
1094
1094
  }
1095
1095
  return { type: "categorical", categories: [...new Set(n)], values: n };
1096
1096
  }
1097
- function Eo(e) {
1097
+ function vo(e) {
1098
1098
  if (!e || e.length === 0) return {};
1099
1099
  const t = Object.keys(e[0]).filter(
1100
1100
  (r) => !It.includes(r)
@@ -1111,7 +1111,7 @@ function An(e, t) {
1111
1111
  })
1112
1112
  );
1113
1113
  }
1114
- function vo(e, t = null) {
1114
+ function Ao(e, t = null) {
1115
1115
  return (t ? An(e, t) : e).reduce((r, o) => {
1116
1116
  const i = Number(o.dx) || 0, s = Number(o.dy) || 0, l = Number(o.dz) || 0;
1117
1117
  return r + i * s * l;
@@ -1143,8 +1143,8 @@ function vt(e) {
1143
1143
  return n === null ? null : {
1144
1144
  [z]: t,
1145
1145
  [q]: n,
1146
- [B]: le(e[B]),
1147
1146
  [R]: le(e[R]),
1147
+ [B]: le(e[B]),
1148
1148
  comments: e.comments != null ? `${e.comments}` : null,
1149
1149
  ...e
1150
1150
  };
@@ -1160,22 +1160,22 @@ function At(e) {
1160
1160
  [S]: n,
1161
1161
  [D]: r,
1162
1162
  mid: o,
1163
- [B]: le(e[B]),
1164
1163
  [R]: le(e[R]),
1164
+ [B]: le(e[B]),
1165
1165
  classification: e.classification != null ? `${e.classification}` : null,
1166
1166
  comments: e.comments != null ? `${e.comments}` : null,
1167
1167
  ...e
1168
1168
  };
1169
1169
  }
1170
- function Ao(e) {
1170
+ function So(e) {
1171
1171
  const t = [], n = [];
1172
1172
  for (const r of e) {
1173
- const o = [], i = le(r[B]), s = le(r[R]);
1173
+ const o = [], i = le(r[R]), s = le(r[B]);
1174
1174
  i !== null && (i < 0 || i > 90) && o.push(`dip ${i} out of range [0, 90]`), s !== null && (s < 0 || s >= 360) && o.push(`azimuth ${s} out of range [0, 360)`), o.length ? n.push({ row: r, message: o.join("; ") }) : t.push(r);
1175
1175
  }
1176
1176
  return { valid: t, errors: n };
1177
1177
  }
1178
- function So(e, t = null) {
1178
+ function Do(e, t = null) {
1179
1179
  return new Promise((n, r) => {
1180
1180
  const o = {
1181
1181
  header: !0,
@@ -1189,13 +1189,13 @@ function So(e, t = null) {
1189
1189
  }
1190
1190
  n(s);
1191
1191
  },
1192
- error: (i) => r(w("parseStructuralPointsCSV", i))
1192
+ error: (i) => r(H("parseStructuralPointsCSV", i))
1193
1193
  };
1194
1194
  typeof e == "string" && !e.startsWith("data:") && e.includes(`
1195
1195
  `) ? K.parse(e, o) : K.parse(e, o);
1196
1196
  });
1197
1197
  }
1198
- function Do(e, t = null) {
1198
+ function Po(e, t = null) {
1199
1199
  return new Promise((n, r) => {
1200
1200
  K.parse(e, {
1201
1201
  header: !0,
@@ -1209,7 +1209,7 @@ function Do(e, t = null) {
1209
1209
  }
1210
1210
  n(i);
1211
1211
  },
1212
- error: (o) => r(w("parseStructuralIntervalsCSV", o))
1212
+ error: (o) => r(H("parseStructuralIntervalsCSV", o))
1213
1213
  });
1214
1214
  });
1215
1215
  }
@@ -1230,7 +1230,7 @@ function Cn(e, t = null) {
1230
1230
  complete: (o) => {
1231
1231
  const i = o.data.map((c) => Xe(c, t)), s = Dn(i);
1232
1232
  if (!s) {
1233
- r(w(
1233
+ r(H(
1234
1234
  "parseStructuralCSV",
1235
1235
  new Error("Structural CSV requires either 'depth' (point) or 'from'/'to' (interval) columns")
1236
1236
  ));
@@ -1243,11 +1243,11 @@ function Cn(e, t = null) {
1243
1243
  }
1244
1244
  n({ schema: s, rows: l });
1245
1245
  },
1246
- error: (o) => r(w("parseStructuralCSV", o))
1246
+ error: (o) => r(H("parseStructuralCSV", o))
1247
1247
  });
1248
1248
  });
1249
1249
  }
1250
- function On(e) {
1250
+ function kn(e) {
1251
1251
  return new Promise((t) => {
1252
1252
  K.parse(e, {
1253
1253
  header: !0,
@@ -1260,7 +1260,7 @@ function On(e) {
1260
1260
  if (!l) continue;
1261
1261
  const c = Number(s[S]), a = Number(s[D]);
1262
1262
  if (!Number.isFinite(c) || !Number.isFinite(a) || a <= c) continue;
1263
- const u = (c + a) / 2, { [B]: m, [R]: d, ...f } = s, p = {
1263
+ const u = (c + a) / 2, { [R]: m, [B]: d, ...f } = s, p = {
1264
1264
  ...f,
1265
1265
  [z]: l,
1266
1266
  [S]: c,
@@ -1281,7 +1281,7 @@ function On(e) {
1281
1281
  });
1282
1282
  });
1283
1283
  }
1284
- function kn(e) {
1284
+ function On(e) {
1285
1285
  return new Promise((t) => {
1286
1286
  K.parse(e, {
1287
1287
  header: !0,
@@ -1294,7 +1294,7 @@ function kn(e) {
1294
1294
  if (!s) continue;
1295
1295
  const l = Number(i[S]), c = Number(i[D]);
1296
1296
  if (!Number.isFinite(l) || !Number.isFinite(c) || c <= l) continue;
1297
- const a = (l + c) / 2, { [B]: u, [R]: m, ...d } = i, f = {
1297
+ const a = (l + c) / 2, { [R]: u, [B]: m, ...d } = i, f = {
1298
1298
  ...d,
1299
1299
  [z]: s,
1300
1300
  [S]: l,
@@ -1315,13 +1315,13 @@ function kn(e) {
1315
1315
  });
1316
1316
  });
1317
1317
  }
1318
- async function Po({ assayCsv: e, structuralCsv: t, geologyCsv: n } = {}) {
1318
+ async function Co({ assayCsv: e, structuralCsv: t, geologyCsv: n } = {}) {
1319
1319
  const [r, o, i] = await Promise.all([
1320
- e ? On(e) : Promise.resolve([]),
1320
+ e ? kn(e) : Promise.resolve([]),
1321
1321
  t ? Cn(t).then(
1322
1322
  ({ rows: l }) => Pn(l.map((c) => ({ ...c, _source: "structural" })))
1323
1323
  ) : Promise.resolve([]),
1324
- n ? kn(n).then(({ holes: l }) => l) : Promise.resolve([])
1324
+ n ? On(n).then(({ holes: l }) => l) : Promise.resolve([])
1325
1325
  ]), s = new Map(r.map((l) => [l.holeId, { ...l, points: [...l.points] }]));
1326
1326
  for (const l of [...o, ...i]) {
1327
1327
  const c = l.holeId;
@@ -1370,8 +1370,8 @@ function Ln(e, t) {
1370
1370
  if (E < 1e-10) return { x: l, y: c, z: a, dx: 0, dy: 0, dz: -1 };
1371
1371
  u = g / E, m = v / E, d = M / E;
1372
1372
  }
1373
- const _ = Math.sqrt(u * u + m * m + d * d);
1374
- return _ < 1e-10 ? { x: l, y: c, z: a, dx: 0, dy: 0, dz: -1 } : { x: l, y: c, z: a, dx: u / _, dy: m / _, dz: d / _ };
1373
+ const N = Math.sqrt(u * u + m * m + d * d);
1374
+ return N < 1e-10 ? { x: l, y: c, z: a, dx: 0, dy: 0, dz: -1 } : { x: l, y: c, z: a, dx: u / N, dy: m / N, dz: d / N };
1375
1375
  }
1376
1376
  function Fn(e, t, n, r = {}) {
1377
1377
  const { betaZeroAxis: o = "B", betaHandedness: i = 1 } = r, { dx: s, dy: l, dz: c } = n, a = [s, l, c];
@@ -1386,7 +1386,7 @@ function Fn(e, t, n, r = {}) {
1386
1386
  a[1] * p[2] - a[2] * p[1],
1387
1387
  a[2] * p[0] - a[0] * p[2],
1388
1388
  a[0] * p[1] - a[1] * p[0]
1389
- ], h = Math.sqrt(b[0] ** 2 + b[1] ** 2 + b[2] ** 2), _ = h > 1e-10 ? [b[0] / h, b[1] / h, b[2] / h] : [0, 1, 0], g = o === "R" ? p : _, v = t * Math.PI / 180 * i, M = Math.cos(v), E = Math.sin(v), P = g[0] * a[0] + g[1] * a[1] + g[2] * a[2], C = [
1389
+ ], h = Math.sqrt(b[0] ** 2 + b[1] ** 2 + b[2] ** 2), N = h > 1e-10 ? [b[0] / h, b[1] / h, b[2] / h] : [0, 1, 0], g = o === "R" ? p : N, v = t * Math.PI / 180 * i, M = Math.cos(v), E = Math.sin(v), P = g[0] * a[0] + g[1] * a[1] + g[2] * a[2], C = [
1390
1390
  a[1] * g[2] - a[2] * g[1],
1391
1391
  a[2] * g[0] - a[0] * g[2],
1392
1392
  a[0] * g[1] - a[1] * g[0]
@@ -1394,8 +1394,8 @@ function Fn(e, t, n, r = {}) {
1394
1394
  g[0] * M + C[0] * E + a[0] * P * (1 - M),
1395
1395
  g[1] * M + C[1] * E + a[1] * P * (1 - M),
1396
1396
  g[2] * M + C[2] * E + a[2] * P * (1 - M)
1397
- ], k = (90 - e) * Math.PI / 180, G = Math.cos(k), X = Math.sin(k), F = G * L[0] + X * a[0], Y = G * L[1] + X * a[1], j = G * L[2] + X * a[2], A = Math.sqrt(F * F + Y * Y + j * j);
1398
- return A < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: F / A, ny: Y / A, nz: j / A };
1397
+ ], O = (90 - e) * Math.PI / 180, G = Math.cos(O), X = Math.sin(O), F = G * L[0] + X * a[0], U = G * L[1] + X * a[1], j = G * L[2] + X * a[2], A = Math.sqrt(F * F + U * U + j * j);
1398
+ return A < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: F / A, ny: U / A, nz: j / A };
1399
1399
  }
1400
1400
  function Tn(e, t, n = {}) {
1401
1401
  if (!(e != null && e.length) || !(t != null && t.length)) return [];
@@ -1417,22 +1417,22 @@ function Tn(e, t, n = {}) {
1417
1417
  const a = Ln(l, c);
1418
1418
  if (!a) continue;
1419
1419
  const { x: u, y: m, z: d, dx: f, dy: p, dz: b } = a;
1420
- let h, _, g;
1420
+ let h, N, g;
1421
1421
  const v = i.alpha != null ? Number(i.alpha) : null, M = i.beta != null ? Number(i.beta) : null;
1422
1422
  if (Number.isFinite(v)) {
1423
1423
  const E = Number.isFinite(M) ? M : 0, P = Fn(v, E, { dx: f, dy: p, dz: b }, n);
1424
- h = P.nx, _ = P.ny, g = P.nz;
1424
+ h = P.nx, N = P.ny, g = P.nz;
1425
1425
  } else {
1426
1426
  const E = i.dip != null ? Number(i.dip) : null, P = i.azimuth != null ? Number(i.azimuth) : null;
1427
1427
  if (!Number.isFinite(E) || !Number.isFinite(P)) continue;
1428
1428
  const C = E * Math.PI / 180, L = P * Math.PI / 180;
1429
- h = Math.sin(L) * Math.sin(C), _ = Math.cos(L) * Math.sin(C), g = Math.cos(C);
1429
+ h = Math.sin(L) * Math.sin(C), N = Math.cos(L) * Math.sin(C), g = Math.cos(C);
1430
1430
  }
1431
- o.push({ ...i, x: u, y: m, z: d, nx: h, ny: _, nz: g });
1431
+ o.push({ ...i, x: u, y: m, z: d, nx: h, ny: N, nz: g });
1432
1432
  }
1433
1433
  return o;
1434
1434
  }
1435
- const ot = "#8b1e3f", $n = "#a8324f", Vn = "#6b7280", Hn = { l: 42, r: 4, t: 4, b: 30 }, it = 10, st = 12;
1435
+ const ot = "#8b1e3f", $n = "#a8324f", Vn = "#6b7280", wn = { l: 42, r: 4, t: 4, b: 30 }, it = 10, st = 12;
1436
1436
  function lt(e) {
1437
1437
  return e ? typeof e == "string" ? { text: e } : e : {};
1438
1438
  }
@@ -1440,7 +1440,7 @@ function St(e = {}) {
1440
1440
  const t = lt(e.xaxis && e.xaxis.title), n = lt(e.yaxis && e.yaxis.title);
1441
1441
  return {
1442
1442
  ...e,
1443
- margin: Hn,
1443
+ margin: wn,
1444
1444
  autosize: !0,
1445
1445
  width: void 0,
1446
1446
  xaxis: {
@@ -1468,7 +1468,7 @@ function St(e = {}) {
1468
1468
  }
1469
1469
  };
1470
1470
  }
1471
- function wn(e, t) {
1471
+ function Hn(e, t) {
1472
1472
  var r;
1473
1473
  if (!e || !t) return !1;
1474
1474
  const n = e.points || [];
@@ -1508,7 +1508,7 @@ function jn(e, t, n) {
1508
1508
  });
1509
1509
  }), o.sort((s, l) => l.z - s.z);
1510
1510
  }
1511
- function Rn(e, t) {
1511
+ function Bn(e, t) {
1512
1512
  if (!e.length) return { data: [], layout: {} };
1513
1513
  const n = e.filter((c) => Number.isFinite(c == null ? void 0 : c.from) && Number.isFinite(c == null ? void 0 : c.to) && c.to > c.from).map((c) => ({ ...c, category: `${(c == null ? void 0 : c.val) ?? ""}`.trim() })).filter((c) => c.category !== "" && !/^(nan|null|none)$/i.test(c.category)).sort((c, a) => c.from - a.from || c.to - a.to);
1514
1514
  if (!n.length) return { data: [], layout: {} };
@@ -1565,7 +1565,7 @@ function Rn(e, t) {
1565
1565
  title: t || void 0
1566
1566
  }) };
1567
1567
  }
1568
- function Bn(e, t, n) {
1568
+ function Rn(e, t, n) {
1569
1569
  if (!e.length) return { data: [], layout: {} };
1570
1570
  const r = n === "bar", o = n === "markers", i = n === "line", s = {
1571
1571
  x: e.map((u) => u.val),
@@ -1602,9 +1602,9 @@ function Bn(e, t, n) {
1602
1602
  }) };
1603
1603
  }
1604
1604
  function Dt({ points: e, isCategorical: t, property: n, chartType: r }) {
1605
- return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? Rn(e, n) : Bn(e, n, r);
1605
+ return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? Bn(e, n) : Rn(e, n, r);
1606
1606
  }
1607
- function Co(e = [], {
1607
+ function ko(e = [], {
1608
1608
  fromCol: t = "from",
1609
1609
  toCol: n = "to",
1610
1610
  categoryCol: r = "geology_code"
@@ -1678,13 +1678,13 @@ function Ct(e = {}) {
1678
1678
  }
1679
1679
  };
1680
1680
  }
1681
- function Yn(e, {
1681
+ function Un(e, {
1682
1682
  tailScale: t = 5,
1683
1683
  colorBy: n = null,
1684
1684
  palette: r = Pt,
1685
1685
  depthCol: o = q,
1686
- dipCol: i = B,
1687
- azCol: s = R
1686
+ dipCol: i = R,
1687
+ azCol: s = B
1688
1688
  } = {}) {
1689
1689
  const l = e.filter(
1690
1690
  (p) => p[o] != null && p[i] != null && p[s] != null
@@ -1697,11 +1697,11 @@ function Yn(e, {
1697
1697
  });
1698
1698
  const a = /* @__PURE__ */ new Map(), u = [];
1699
1699
  for (const p of l) {
1700
- const b = Number(p[o]), h = Number(p[i]), _ = Number(p[s]), g = n ? p[n] ?? "_default" : "_default", v = n ? c[g] ?? "#0f172a" : "#0f172a";
1700
+ const b = Number(p[o]), h = Number(p[i]), N = Number(p[s]), g = n ? p[n] ?? "_default" : "_default", v = n ? c[g] ?? "#0f172a" : "#0f172a";
1701
1701
  a.has(g) || a.set(g, { xs: [], ys: [], dips: [], azs: [], color: v });
1702
1702
  const M = a.get(g);
1703
- M.xs.push(h), M.ys.push(b), M.dips.push(h), M.azs.push(_);
1704
- const E = _ * Math.PI / 180, P = t * (Math.abs(h) / 90), C = Math.sin(E) * P, L = Math.cos(E) * P;
1703
+ M.xs.push(h), M.ys.push(b), M.dips.push(h), M.azs.push(N);
1704
+ const E = N * Math.PI / 180, P = t * (Math.abs(h) / 90), C = Math.sin(E) * P, L = Math.cos(E) * P;
1705
1705
  u.push({
1706
1706
  type: "line",
1707
1707
  x0: h,
@@ -1721,7 +1721,7 @@ function Yn(e, {
1721
1721
  name: p !== "_default" ? String(p) : void 0,
1722
1722
  marker: { size: 8, color: b.color },
1723
1723
  showlegend: d && p !== "_default",
1724
- customdata: b.dips.map((h, _) => [h, b.azs[_]]),
1724
+ customdata: b.dips.map((h, N) => [h, b.azs[N]]),
1725
1725
  hovertemplate: "Depth: %{y}<br>Dip: %{customdata[0]}<br>Az: %{customdata[1]}<extra></extra>"
1726
1726
  });
1727
1727
  return { data: m, layout: {
@@ -1792,7 +1792,7 @@ function ut(e, t) {
1792
1792
  o && o.length + 1 + i.length > t ? (r.push(o), o = i) : o = o ? `${o} ${i}` : i;
1793
1793
  return o && r.push(o), r.join("<br>");
1794
1794
  }
1795
- function Un(e, {
1795
+ function Yn(e, {
1796
1796
  commentCol: t = "comments",
1797
1797
  fromCol: n = S,
1798
1798
  toCol: r = D,
@@ -1802,14 +1802,14 @@ function Un(e, {
1802
1802
  charsPerLine: l = 18
1803
1803
  } = {}) {
1804
1804
  const c = e.filter((h) => h[n] != null && h[r] != null && Number(h[r]) > Number(h[n])).map((h) => {
1805
- const _ = h[t], g = _ != null && String(_).trim() !== "" && String(_) !== "null" ? String(_).trim() : "";
1805
+ const N = h[t], g = N != null && String(N).trim() !== "" && String(N) !== "null" ? String(N).trim() : "";
1806
1806
  return { from: Number(h[n]), to: Number(h[r]), comment: g };
1807
- }).sort((h, _) => h.from - _.from);
1807
+ }).sort((h, N) => h.from - N.from);
1808
1808
  if (!c.length)
1809
1809
  return { data: [], layout: {} };
1810
1810
  const a = [], u = [], m = [], d = [], f = [];
1811
1811
  for (const h of c) {
1812
- const _ = 0.5 * (h.from + h.to), g = !!h.comment;
1812
+ const N = 0.5 * (h.from + h.to), g = !!h.comment;
1813
1813
  a.push({
1814
1814
  type: "rect",
1815
1815
  xref: "x",
@@ -1821,7 +1821,7 @@ function Un(e, {
1821
1821
  fillcolor: g ? o : "rgba(0,0,0,0)",
1822
1822
  line: { color: i, width: 1 },
1823
1823
  layer: "below"
1824
- }), g && (u.push(0.5), m.push(_), d.push(ut(h.comment, l)), f.push(`${h.from.toFixed(3)}–${h.to.toFixed(3)} m<br>${ut(h.comment, 40)}`));
1824
+ }), g && (u.push(0.5), m.push(N), d.push(ut(h.comment, l)), f.push(`${h.from.toFixed(3)}–${h.to.toFixed(3)} m<br>${ut(h.comment, 40)}`));
1825
1825
  }
1826
1826
  return { data: u.length ? [{
1827
1827
  type: "scatter",
@@ -1842,12 +1842,12 @@ function Un(e, {
1842
1842
  showlegend: !1
1843
1843
  }) };
1844
1844
  }
1845
- function ko(e, {
1845
+ function Lo(e, {
1846
1846
  symbolSize: t = 10,
1847
1847
  xCol: n = "easting",
1848
1848
  yCol: r = "northing"
1849
1849
  } = {}) {
1850
- const o = e[n] != null ? Number(e[n]) : null, i = e[r] != null ? Number(e[r]) : null, s = e[B] != null ? Number(e[B]) : null, l = e[R] != null ? Number(e[R]) : null;
1850
+ const o = e[n] != null ? Number(e[n]) : null, i = e[r] != null ? Number(e[r]) : null, s = e[R] != null ? Number(e[R]) : null, l = e[B] != null ? Number(e[B]) : null;
1851
1851
  if (o === null || i === null || s === null || l === null) return null;
1852
1852
  const c = (l - 90 + 360) % 360, a = c * Math.PI / 180, u = l * Math.PI / 180, m = t * Math.sin(a), d = t * Math.cos(a), f = t * 0.4 * (s / 90), p = f * Math.sin(u), b = f * Math.cos(u);
1853
1853
  return {
@@ -1863,22 +1863,22 @@ function ko(e, {
1863
1863
  tickY1: i + b
1864
1864
  };
1865
1865
  }
1866
- const Ot = "markers+line";
1866
+ const kt = "markers+line";
1867
1867
  function qn(e, t) {
1868
1868
  var r;
1869
- const n = Ue(e);
1870
- return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || Ot;
1869
+ const n = Ye(e);
1870
+ return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || kt;
1871
1871
  }
1872
- function Lo({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1873
- const i = pt(null), s = t == null ? void 0 : t.hole, l = (t == null ? void 0 : t.points) || [], c = (e == null ? void 0 : e.property) || "", a = (e == null ? void 0 : e.chartType) || Ot, u = (e == null ? void 0 : e.holeId) || "", m = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? xe : t != null && t.isCategorical ? Se : Ie), d = Ue(m), f = qn(m, a), [p, b] = J("");
1872
+ function Fo({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1873
+ const i = pt(null), s = t == null ? void 0 : t.hole, l = (t == null ? void 0 : t.points) || [], c = (e == null ? void 0 : e.property) || "", a = (e == null ? void 0 : e.chartType) || kt, u = (e == null ? void 0 : e.holeId) || "", m = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? xe : t != null && t.isCategorical ? Se : Ie), d = Ye(m), f = qn(m, a), [p, b] = J("");
1874
1874
  return me(() => {
1875
- const h = m === xe, _ = m === Ge;
1876
- if (!s || !c || !h && !_ && l.length === 0) return;
1875
+ const h = m === xe, N = m === Ge;
1876
+ if (!s || !c || !h && !N && l.length === 0) return;
1877
1877
  const g = i.current;
1878
1878
  if (!g) return;
1879
1879
  let v;
1880
1880
  try {
1881
- h ? v = Un(l, { commentCol: c, fromCol: "from", toCol: "to" }) : _ ? v = Yn(l) : v = Dt({
1881
+ h ? v = Yn(l, { commentCol: c, fromCol: "from", toCol: "to" }) : N ? v = Un(l) : v = Dt({
1882
1882
  points: l,
1883
1883
  isCategorical: m === Se,
1884
1884
  property: c,
@@ -1914,14 +1914,14 @@ function Lo({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [],
1914
1914
  }, [s, c, f, m, l]), me(() => {
1915
1915
  const h = i.current;
1916
1916
  if (!h || typeof ResizeObserver > "u") return;
1917
- const _ = new ResizeObserver(() => {
1917
+ const N = new ResizeObserver(() => {
1918
1918
  try {
1919
1919
  h && h.data && Pe.Plots.resize(h);
1920
1920
  } catch (g) {
1921
1921
  console.warn("Plot resize error", g);
1922
1922
  }
1923
1923
  });
1924
- return _.observe(h), () => _.disconnect();
1924
+ return N.observe(h), () => N.disconnect();
1925
1925
  }, []), !s || !c ? /* @__PURE__ */ $("div", { className: "plot-card empty", children: /* @__PURE__ */ $("div", { className: "placeholder", children: e != null && e.holeId ? t != null && t.loading ? `Loading ${e.holeId}...` : "Select a property" : "Loading demo data..." }) }) : m !== xe && m !== Ge && l.length === 0 ? /* @__PURE__ */ $("div", { className: "plot-card empty", children: /* @__PURE__ */ $("div", { className: "placeholder", children: "No data" }) }) : p ? /* @__PURE__ */ $("div", { className: "plot-card empty", children: /* @__PURE__ */ Q("div", { className: "placeholder", children: [
1926
1926
  "Plot error: ",
1927
1927
  p
@@ -1933,8 +1933,8 @@ function Lo({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [],
1933
1933
  value: u,
1934
1934
  onChange: (h) => o && o({ holeId: h.target.value }),
1935
1935
  children: n.map((h) => {
1936
- const _ = typeof h == "string" ? h : h.holeId, g = typeof h == "string" ? h : h.label || h.holeId;
1937
- return /* @__PURE__ */ $("option", { value: _, children: g }, _);
1936
+ const N = typeof h == "string" ? h : h.holeId, g = typeof h == "string" ? h : h.label || h.holeId;
1937
+ return /* @__PURE__ */ $("option", { value: N, children: g }, N);
1938
1938
  })
1939
1939
  }
1940
1940
  ) }),
@@ -1986,19 +1986,19 @@ function Xn(e, t) {
1986
1986
  }
1987
1987
  return r;
1988
1988
  }
1989
- function Fo({
1989
+ function To({
1990
1990
  initialFocusedHoleId: e = "",
1991
1991
  sourceFile: t = null,
1992
1992
  extraHoles: n = [],
1993
1993
  plotCount: r = 4
1994
1994
  } = {}) {
1995
- const [o, i] = J([]), [s, l] = J([]), [c, a] = J([]), [u, m] = J([]), [d, f] = J([]), [p, b] = J({}), [h, _] = J(""), [g, v] = J([]), [M, E] = J(""), [P, C] = J(e || ""), [L, k] = J([]), G = pt(null);
1995
+ const [o, i] = J([]), [s, l] = J([]), [c, a] = J([]), [u, m] = J([]), [d, f] = J([]), [p, b] = J({}), [h, N] = J(""), [g, v] = J([]), [M, E] = J(""), [P, C] = J(e || ""), [L, O] = J([]), G = pt(null);
1996
1996
  me(() => {
1997
1997
  !t || G.current === t || (G.current = t, hn(t).then((A) => {
1998
1998
  if (!A) return;
1999
- const x = Array.from(new Map(A.map((y) => [y.holeId, y])).values());
1999
+ const x = Array.from(new Map(A.map((_) => [_.holeId, _])).values());
2000
2000
  l(x), v(xt({
2001
- holeIds: x.map((y) => y.holeId),
2001
+ holeIds: x.map((_) => _.holeId),
2002
2002
  focusedHoleId: P,
2003
2003
  plotCount: r,
2004
2004
  defaultProp: "",
@@ -2013,8 +2013,8 @@ function Fo({
2013
2013
  if (!(n != null && n.length)) return;
2014
2014
  const A = n.map((x) => ({ holeId: x.id || x.holeId })).filter((x) => x.holeId);
2015
2015
  l((x) => {
2016
- const y = new Set(x.map((I) => I.holeId)), O = A.filter((I) => !y.has(I.holeId));
2017
- return O.length ? [...x, ...O] : x;
2016
+ const _ = new Set(x.map((I) => I.holeId)), k = A.filter((I) => !_.has(I.holeId));
2017
+ return k.length ? [...x, ...k] : x;
2018
2018
  });
2019
2019
  }, [n]), me(() => {
2020
2020
  E((A) => A && A.startsWith("Loading ") && A.includes(" for hole ") ? A : "");
@@ -2024,71 +2024,71 @@ function Fo({
2024
2024
  return;
2025
2025
  }
2026
2026
  const A = Mt(s.map((x) => x.holeId), P);
2027
- v((x) => Array.from({ length: r }).map((O, I) => {
2027
+ v((x) => Array.from({ length: r }).map((k, I) => {
2028
2028
  var W;
2029
- const V = x[I] || {}, H = s.some((re) => re.holeId === V.holeId) ? V.holeId : A[I] || ((W = s[I]) == null ? void 0 : W.holeId) || "", T = V.property || h, U = Oe({
2029
+ const V = x[I] || {}, w = s.some((re) => re.holeId === V.holeId) ? V.holeId : A[I] || ((W = s[I]) == null ? void 0 : W.holeId) || "", T = V.property || h, Y = ke({
2030
2030
  property: T,
2031
2031
  chartType: V.chartType,
2032
2032
  categoricalProps: u,
2033
2033
  commentProps: d,
2034
2034
  numericDefaultChartType: "markers+line"
2035
2035
  });
2036
- return { holeId: H, property: T, chartType: U };
2036
+ return { holeId: w, property: T, chartType: Y };
2037
2037
  }));
2038
2038
  }, [s, P, h, u, d, r]), me(() => {
2039
2039
  if (!t) return;
2040
2040
  g.map((x) => x.holeId).filter(Boolean).forEach((x) => {
2041
- const y = o.some((I) => (I.id || I.holeId) === x), O = L.includes(x);
2042
- y || O || (k((I) => [...I, x]), pn(t, x).then((I) => {
2043
- k((V) => V.filter((H) => H !== x)), I && i((V) => {
2044
- const H = mt(
2045
- [...V.filter((U) => (U.id || U.holeId) !== x), I],
2041
+ const _ = o.some((I) => (I.id || I.holeId) === x), k = L.includes(x);
2042
+ _ || k || (O((I) => [...I, x]), pn(t, x).then((I) => {
2043
+ O((V) => V.filter((w) => w !== x)), I && i((V) => {
2044
+ const w = mt(
2045
+ [...V.filter((Y) => (Y.id || Y.holeId) !== x), I],
2046
2046
  n
2047
- ), T = Le(H);
2048
- return a(T.numericProps), m(T.categoricalProps), f(T.commentProps), b(T.columnMeta), !h && T.defaultProp && (_(T.defaultProp), v((U) => U.map((W) => ({
2047
+ ), T = Le(w);
2048
+ return a(T.numericProps), m(T.categoricalProps), f(T.commentProps), b(T.columnMeta), !h && T.defaultProp && (N(T.defaultProp), v((Y) => Y.map((W) => ({
2049
2049
  ...W,
2050
2050
  property: W.property || T.defaultProp,
2051
- chartType: Oe({
2051
+ chartType: ke({
2052
2052
  property: W.property || T.defaultProp,
2053
2053
  chartType: W.chartType,
2054
2054
  categoricalProps: T.categoricalProps,
2055
2055
  commentProps: T.commentProps,
2056
2056
  numericDefaultChartType: "markers+line"
2057
2057
  })
2058
- })))), H;
2058
+ })))), w;
2059
2059
  });
2060
2060
  }).catch((I) => {
2061
- console.error(I), k((V) => V.filter((H) => H !== x)), E(I.message || `Error loading hole ${x}`);
2061
+ console.error(I), O((V) => V.filter((w) => w !== x)), E(I.message || `Error loading hole ${x}`);
2062
2062
  }));
2063
2063
  });
2064
2064
  }, [g, t, o, L, h, n]), me(() => {
2065
2065
  n != null && n.length && i((A) => {
2066
2066
  if (!A.length) {
2067
- const O = Le(n);
2068
- return a(O.numericProps), m(O.categoricalProps), f(O.commentProps), b(O.columnMeta), !h && O.defaultProp && _(O.defaultProp), n;
2067
+ const k = Le(n);
2068
+ return a(k.numericProps), m(k.categoricalProps), f(k.commentProps), b(k.columnMeta), !h && k.defaultProp && N(k.defaultProp), n;
2069
2069
  }
2070
- const x = mt(A, n), y = Le(x);
2071
- return a(y.numericProps), m(y.categoricalProps), f(y.commentProps), b(y.columnMeta), !h && y.defaultProp && _(y.defaultProp), x;
2070
+ const x = mt(A, n), _ = Le(x);
2071
+ return a(_.numericProps), m(_.categoricalProps), f(_.commentProps), b(_.columnMeta), !h && _.defaultProp && N(_.defaultProp), x;
2072
2072
  });
2073
2073
  }, [n]);
2074
- const X = He(
2074
+ const X = we(
2075
2075
  () => [...c, ...u, ...d],
2076
2076
  [c, u, d]
2077
- ), F = He(
2077
+ ), F = we(
2078
2078
  () => s.map((A) => ({ holeId: A.holeId, label: A.holeId })).sort((A, x) => A.label.localeCompare(x.label)),
2079
2079
  [s]
2080
- ), Y = He(() => {
2080
+ ), U = we(() => {
2081
2081
  const A = [...c, ...u, ...d];
2082
- return Array.from({ length: r }).map((x, y) => {
2083
- const O = g[y] || {}, I = o.find((ue) => (ue.id || ue.holeId) === O.holeId) || null, V = I ? A.filter((ue) => wn(I, ue)) : A;
2084
- let H = O.property || h;
2085
- I && !V.includes(H) && (H = V[0] || H);
2086
- const T = d.includes(H), U = !T && u.includes(H), W = !T && !U && H === "dip", re = T ? "comment" : W ? "tadpole" : U ? "categorical" : "numeric", pe = W ? "tadpole" : O.chartType || (T ? "comment" : U ? "categorical" : "markers+line"), ce = O.holeId || (I == null ? void 0 : I.id) || (I == null ? void 0 : I.holeId) || "", ve = W ? (I == null ? void 0 : I.points) || [] : T ? Xn(I, H) : jn(I, H, U);
2082
+ return Array.from({ length: r }).map((x, _) => {
2083
+ const k = g[_] || {}, I = o.find((ue) => (ue.id || ue.holeId) === k.holeId) || null, V = I ? A.filter((ue) => Hn(I, ue)) : A;
2084
+ let w = k.property || h;
2085
+ I && !V.includes(w) && (w = V[0] || w);
2086
+ const T = d.includes(w), Y = !T && u.includes(w), W = !T && !Y && w === "dip", re = T ? "comment" : W ? "tadpole" : Y ? "categorical" : "numeric", pe = W ? "tadpole" : k.chartType || (T ? "comment" : Y ? "categorical" : "markers+line"), ce = k.holeId || (I == null ? void 0 : I.id) || (I == null ? void 0 : I.holeId) || "", ve = W ? (I == null ? void 0 : I.points) || [] : T ? Xn(I, w) : jn(I, w, Y);
2087
2087
  return {
2088
- config: { holeId: ce, property: H, chartType: pe },
2088
+ config: { holeId: ce, property: w, chartType: pe },
2089
2089
  hole: I,
2090
- loading: L.includes(O.holeId),
2091
- isCategorical: U,
2090
+ loading: L.includes(k.holeId),
2091
+ isCategorical: Y,
2092
2092
  isComment: T,
2093
2093
  isTadpole: W,
2094
2094
  displayType: re,
@@ -2098,15 +2098,15 @@ function Fo({
2098
2098
  };
2099
2099
  });
2100
2100
  }, [g, o, h, u, d, L, r, c]), j = (A, x) => {
2101
- v((y) => {
2102
- const O = [...y], V = { ...O[A] || {}, ...x };
2103
- return x.property && (V.chartType = Oe({
2101
+ v((_) => {
2102
+ const k = [..._], V = { ...k[A] || {}, ...x };
2103
+ return x.property && (V.chartType = ke({
2104
2104
  property: x.property,
2105
2105
  chartType: V.chartType,
2106
2106
  categoricalProps: u,
2107
2107
  commentProps: d,
2108
2108
  numericDefaultChartType: "markers+line"
2109
- })), O[A] = V, O;
2109
+ })), k[A] = V, k;
2110
2110
  });
2111
2111
  };
2112
2112
  return {
@@ -2121,7 +2121,7 @@ function Fo({
2121
2121
  columnMeta: p,
2122
2122
  propertyOptions: X,
2123
2123
  labeledHoleOptions: F,
2124
- traceGraphs: Y,
2124
+ traceGraphs: U,
2125
2125
  handleConfigChange: j
2126
2126
  };
2127
2127
  }
@@ -2184,7 +2184,7 @@ function Kn(e, t) {
2184
2184
  const n = (r) => Number.isFinite(r) ? Math.abs(r) >= 1e3 ? r.toFixed(0) : Math.abs(r) >= 10 ? r.toFixed(1) : Math.abs(r) >= 0.1 ? r.toFixed(2) : r.toFixed(3) : "n/a";
2185
2185
  return `${n(e)} – ${n(t)}`;
2186
2186
  }
2187
- function kt(e, t) {
2187
+ function Ot(e, t) {
2188
2188
  if (!Number.isFinite(e) || !t || !Array.isArray(t.bins) || !t.bins.length)
2189
2189
  return -1;
2190
2190
  if (t.max === t.min)
@@ -2197,7 +2197,7 @@ function kt(e, t) {
2197
2197
  return -1;
2198
2198
  }
2199
2199
  function Jn(e, t, n = "#8b1e3f") {
2200
- const r = kt(e, t);
2200
+ const r = Ot(e, t);
2201
2201
  return r < 0 ? n : t.colors[r] || n;
2202
2202
  }
2203
2203
  function Lt(e) {
@@ -2231,7 +2231,7 @@ function er(e = [], t = [0, 0], n = 0, r = 50) {
2231
2231
  const o = Qn(e, t, n), i = 0.5 * Number(r || 0);
2232
2232
  return !Number.isFinite(i) || i <= 0 ? o : o.filter((s) => Number.isFinite(s.across) && Math.abs(s.across) <= i);
2233
2233
  }
2234
- function To(e = [], t = null, n = null) {
2234
+ function $o(e = [], t = null, n = null) {
2235
2235
  let r = Lt(e).map(Ft);
2236
2236
  if (Array.isArray(t) && t.length === 2) {
2237
2237
  const [o, i] = t;
@@ -2242,7 +2242,7 @@ function To(e = [], t = null, n = null) {
2242
2242
  color_value: o == null ? void 0 : o[n]
2243
2243
  }))), r;
2244
2244
  }
2245
- function $o(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2245
+ function Vo(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2246
2246
  let i = er(e, t, n, r);
2247
2247
  return o && (i = i.map((s) => ({
2248
2248
  ...s,
@@ -2259,7 +2259,7 @@ function ge(e, t = void 0) {
2259
2259
  const n = Number(e);
2260
2260
  return Number.isFinite(n) ? n : t;
2261
2261
  }
2262
- function Vo(e = [], t = null) {
2262
+ function wo(e = [], t = null) {
2263
2263
  const n = /* @__PURE__ */ new Map();
2264
2264
  We(e).forEach((o) => {
2265
2265
  const i = Ze(o);
@@ -2289,7 +2289,7 @@ function Ho(e = [], t = 1, n = null) {
2289
2289
  value: n ? r == null ? void 0 : r[n] : null
2290
2290
  }));
2291
2291
  }
2292
- function wo(e = [], t = null) {
2292
+ function jo(e = [], t = null) {
2293
2293
  return t ? We(e).filter((n) => Object.prototype.hasOwnProperty.call(n || {}, t)).map((n) => ({
2294
2294
  hole_id: Ze(n),
2295
2295
  label: n == null ? void 0 : n[t],
@@ -2314,11 +2314,11 @@ const tr = {
2314
2314
  };
2315
2315
  function nr(e, t) {
2316
2316
  const n = t || tr, r = (e || "").toLowerCase().trim(), o = n[r] || "#888888";
2317
- return new N.Color(o).getHex();
2317
+ return new y.Color(o).getHex();
2318
2318
  }
2319
2319
  function rr(e, t) {
2320
2320
  const n = e * Math.PI / 180, r = t * Math.PI / 180;
2321
- return new N.Vector3(
2321
+ return new y.Vector3(
2322
2322
  Math.sin(r) * Math.sin(n),
2323
2323
  // East component
2324
2324
  Math.cos(r) * Math.sin(n),
@@ -2334,24 +2334,24 @@ function or(e, t = {}) {
2334
2334
  opacity: o = 0.7,
2335
2335
  segments: i = 32,
2336
2336
  colorMap: s = null
2337
- } = t, l = new N.Group(), c = new N.Vector3(0, 1, 0);
2337
+ } = t, l = new y.Group(), c = new y.Vector3(0, 1, 0);
2338
2338
  for (const a of e) {
2339
2339
  const u = a.x != null ? a.x : a.easting != null ? a.easting : null, m = a.y != null ? a.y : a.northing != null ? a.northing : null, d = a.z != null ? a.z : a.elevation != null ? a.elevation : null;
2340
2340
  if (u == null || m == null || d == null || !Number.isFinite(u) || !Number.isFinite(m) || !Number.isFinite(d)) continue;
2341
- const f = a[B] != null ? Number(a[B]) : null, p = a[R] != null ? Number(a[R]) : null;
2341
+ const f = a[R] != null ? Number(a[R]) : null, p = a[B] != null ? Number(a[B]) : null;
2342
2342
  let b;
2343
2343
  if (a.nx != null && Number.isFinite(a.nx) && a.ny != null && Number.isFinite(a.ny) && a.nz != null && Number.isFinite(a.nz))
2344
- b = new N.Vector3(a.nx, a.ny, a.nz).normalize();
2344
+ b = new y.Vector3(a.nx, a.ny, a.nz).normalize();
2345
2345
  else {
2346
2346
  if (f == null || p == null || !Number.isFinite(f) || !Number.isFinite(p)) continue;
2347
2347
  b = rr(f, p);
2348
2348
  }
2349
- const h = new N.CylinderGeometry(n, n, r, i, 1, !1), _ = new N.MeshStandardMaterial({
2349
+ const h = new y.CylinderGeometry(n, n, r, i, 1, !1), N = new y.MeshStandardMaterial({
2350
2350
  color: nr(a.structure_type, s),
2351
2351
  transparent: !0,
2352
2352
  opacity: o,
2353
- side: N.DoubleSide
2354
- }), g = new N.Mesh(h, _);
2353
+ side: y.DoubleSide
2354
+ }), g = new y.Mesh(h, N);
2355
2355
  g.position.set(u, m, d), g.quaternion.setFromUnitVectors(c, b), g.userData = {
2356
2356
  type: "structure",
2357
2357
  hole_id: a.hole_id,
@@ -2499,15 +2499,15 @@ function yr(e, t, n) {
2499
2499
  return Number.isFinite(i) ? i : null;
2500
2500
  }
2501
2501
  function _r(e, t) {
2502
- if (!Number.isFinite(e)) return new N.Color(se);
2503
- if (kt(e, t) < 0) return new N.Color(se);
2502
+ if (!Number.isFinite(e)) return new y.Color(se);
2503
+ if (Ot(e, t) < 0) return new y.Color(se);
2504
2504
  const r = Jn(e, t, se);
2505
- return new N.Color(r);
2505
+ return new y.Color(r);
2506
2506
  }
2507
2507
  function Nr(e) {
2508
2508
  if (!e || !String(e).trim()) return se;
2509
2509
  const t = Vt(String(e).toLowerCase().trim());
2510
- return "#" + new N.Color().setHSL(t, 0.7, 0.5).getHexString();
2510
+ return "#" + new y.Color().setHSL(t, 0.7, 0.5).getHexString();
2511
2511
  }
2512
2512
  function zr(e = {}) {
2513
2513
  return {
@@ -2527,7 +2527,7 @@ function Mr(e, t) {
2527
2527
  });
2528
2528
  }), n;
2529
2529
  }
2530
- function Re(e) {
2530
+ function Be(e) {
2531
2531
  return {
2532
2532
  holeId: e.id,
2533
2533
  project: e.project
@@ -2537,7 +2537,7 @@ function xr(e) {
2537
2537
  return `${e ?? ""}`.trim().toLowerCase();
2538
2538
  }
2539
2539
  function Ir(e, t) {
2540
- const n = `${e ?? ""}:${t ?? 0}`, r = Vt(n), o = (t ?? 0) % 14 / 14, i = (r * 0.15 + o * 0.85) % 1, s = new N.Color();
2540
+ const n = `${e ?? ""}:${t ?? 0}`, r = Vt(n), o = (t ?? 0) % 14 / 14, i = (r * 0.15 + o * 0.85) % 1, s = new y.Color();
2541
2541
  return s.setHSL(i, 1, 0.5), s;
2542
2542
  }
2543
2543
  function Vt(e) {
@@ -2574,74 +2574,74 @@ function Ar({ selectedAssayVariable: e, assayIntervals: t, assayScale: n, holeId
2574
2574
  if (!e)
2575
2575
  return Ir(r, o);
2576
2576
  if (e === "__HAS_ASSAY__") {
2577
- if (!(t != null && t.length)) return new N.Color(se);
2577
+ if (!(t != null && t.length)) return new y.Color(se);
2578
2578
  const u = dt(i, s);
2579
2579
  return u ? t.some((d) => {
2580
2580
  const f = Number(d == null ? void 0 : d.from), p = Number(d == null ? void 0 : d.to);
2581
2581
  if (!Number.isFinite(f) || !Number.isFinite(p)) return !1;
2582
2582
  const b = Math.max(u.segStart, f);
2583
2583
  return Math.min(u.segEnd, p) > b;
2584
- }) ? new N.Color("#ff8c42") : new N.Color(se) : new N.Color(se);
2584
+ }) ? new y.Color("#ff8c42") : new y.Color(se) : new y.Color(se);
2585
2585
  }
2586
- if (!(t != null && t.length)) return new N.Color(se);
2586
+ if (!(t != null && t.length)) return new y.Color(se);
2587
2587
  const c = dt(i, s);
2588
- if (!c) return new N.Color(se);
2588
+ if (!c) return new y.Color(se);
2589
2589
  if (l) {
2590
2590
  const u = Er(t, c.segStart, c.segEnd);
2591
- return new N.Color(Nr(u));
2591
+ return new y.Color(Nr(u));
2592
2592
  }
2593
2593
  const a = yr(t, c.segStart, c.segEnd);
2594
2594
  return _r(a, n);
2595
2595
  }
2596
2596
  function Sr(e, t, n = {}) {
2597
- if (!e.scene || (Ht(e), !t || t.length === 0)) return;
2597
+ if (!e.scene || (wt(e), !t || t.length === 0)) return;
2598
2598
  const { preserveView: r, assayIntervalsByHole: o, selectedAssayVariable: i, isCategoricalVariable: s } = zr(n), l = s ? [] : Mr(o, i), c = Zn(l);
2599
2599
  let a = 1 / 0, u = -1 / 0, m = 1 / 0, d = -1 / 0, f = 1 / 0, p = -1 / 0;
2600
- const b = new N.Vector3(), h = new N.Vector3(0, 1, 0);
2601
- t.forEach((_, g) => {
2602
- const M = g * 137.5 % 360 / 360, E = new N.Color().setHSL(M, 0.75, 0.55), P = (_.points || []).map((k) => {
2603
- a = Math.min(a, k.x), u = Math.max(u, k.x), m = Math.min(m, k.y), d = Math.max(d, k.y), f = Math.min(f, k.z), p = Math.max(p, k.z);
2604
- const G = new N.Vector3(k.x, k.y, k.z);
2605
- return G.md = k.md, G;
2600
+ const b = new y.Vector3(), h = new y.Vector3(0, 1, 0);
2601
+ t.forEach((N, g) => {
2602
+ const M = g * 137.5 % 360 / 360, E = new y.Color().setHSL(M, 0.75, 0.55), P = (N.points || []).map((O) => {
2603
+ a = Math.min(a, O.x), u = Math.max(u, O.x), m = Math.min(m, O.y), d = Math.max(d, O.y), f = Math.min(f, O.z), p = Math.max(p, O.z);
2604
+ const G = new y.Vector3(O.x, O.y, O.z);
2605
+ return G.md = O.md, G;
2606
2606
  });
2607
2607
  if (P.length < 2) {
2608
2608
  if (P.length === 1) {
2609
- const k = new N.SphereGeometry(5, 12, 12), G = new N.MeshLambertMaterial({
2609
+ const O = new y.SphereGeometry(5, 12, 12), G = new y.MeshLambertMaterial({
2610
2610
  color: E,
2611
2611
  emissive: E,
2612
2612
  emissiveIntensity: 0.2
2613
- }), X = new N.Mesh(k, G);
2614
- X.position.copy(P[0]), X.userData = Re(_), e.scene.add(X), e.drillLines.push(X), e.drillMeshes.push(X);
2613
+ }), X = new y.Mesh(O, G);
2614
+ X.position.copy(P[0]), X.userData = Be(N), e.scene.add(X), e.drillLines.push(X), e.drillMeshes.push(X);
2615
2615
  }
2616
2616
  return;
2617
2617
  }
2618
- const C = new N.Group();
2619
- C.userData = Re(_);
2620
- const L = i ? vr(_, o) : [];
2621
- for (let k = 0; k < P.length - 1; k += 1) {
2622
- const G = P[k], X = P[k + 1], F = b.subVectors(X, G), Y = F.length();
2623
- if (Y <= 1e-3) continue;
2624
- const j = 2.2, A = new N.CylinderGeometry(j, j, Y, 6, 1, !0), x = Ar({
2618
+ const C = new y.Group();
2619
+ C.userData = Be(N);
2620
+ const L = i ? vr(N, o) : [];
2621
+ for (let O = 0; O < P.length - 1; O += 1) {
2622
+ const G = P[O], X = P[O + 1], F = b.subVectors(X, G), U = F.length();
2623
+ if (U <= 1e-3) continue;
2624
+ const j = 2.2, A = new y.CylinderGeometry(j, j, U, 6, 1, !0), x = Ar({
2625
2625
  selectedAssayVariable: i,
2626
2626
  assayIntervals: L,
2627
2627
  assayScale: c,
2628
- holeId: _.id,
2629
- segmentIndex: k,
2628
+ holeId: N.id,
2629
+ segmentIndex: O,
2630
2630
  p1: G,
2631
2631
  p2: X,
2632
2632
  isCategorical: s
2633
- }), y = new N.MeshLambertMaterial({
2633
+ }), _ = new y.MeshLambertMaterial({
2634
2634
  color: x,
2635
2635
  flatShading: !0,
2636
2636
  emissive: x,
2637
2637
  emissiveIntensity: 0.15
2638
- }), O = new N.Mesh(A, y);
2639
- O.position.copy(G.clone().addScaledVector(F, 0.5)), O.quaternion.setFromUnitVectors(h, F.clone().normalize()), O.userData = Re(_), C.add(O), e.drillMeshes.push(O);
2638
+ }), k = new y.Mesh(A, _);
2639
+ k.position.copy(G.clone().addScaledVector(F, 0.5)), k.quaternion.setFromUnitVectors(h, F.clone().normalize()), k.userData = Be(N), C.add(k), e.drillMeshes.push(k);
2640
2640
  }
2641
2641
  e.scene.add(C), e.drillLines.push(C);
2642
2642
  }), e.camera && e.controls && (e.lastBounds = { minX: a, maxX: u, minY: m, maxY: d, minZ: f, maxZ: p }, r || Je(e, { minX: a, maxX: u, minY: m, maxY: d, minZ: f, maxZ: p })), ye(e);
2643
2643
  }
2644
- function Ht(e) {
2644
+ function wt(e) {
2645
2645
  e.drillLines.forEach((t) => {
2646
2646
  e.scene.remove(t), t.isGroup ? t.traverse((n) => {
2647
2647
  n.isMesh && (n.geometry.dispose(), n.material.dispose());
@@ -2649,15 +2649,15 @@ function Ht(e) {
2649
2649
  }), e.drillLines = [], e.drillMeshes = [], ye(e);
2650
2650
  }
2651
2651
  const ft = "#ffffbb", Dr = 2, Pr = 1.5, Cr = 1;
2652
- function Or(e) {
2652
+ function kr(e) {
2653
2653
  const { renderer: t, scene: n, camera: r, container: o } = e;
2654
2654
  if (!t || !n || !r) return;
2655
2655
  const i = (o == null ? void 0 : o.clientWidth) || t.domElement.clientWidth || 1, s = (o == null ? void 0 : o.clientHeight) || t.domElement.clientHeight || 1, l = new Kt(t), c = new Jt(n, r);
2656
2656
  l.addPass(c);
2657
- const a = new N.Vector2(i, s), u = new Qt(a, n, r);
2657
+ const a = new y.Vector2(i, s), u = new Qt(a, n, r);
2658
2658
  u.visibleEdgeColor.set(ft), u.hiddenEdgeColor.set(ft), u.edgeStrength = Dr, u.edgeThickness = Pr, u.edgeGlow = Cr, u.pulsePeriod = 0, u.selectedObjects = [], l.addPass(u), l.setSize(i, s), e._composer = l, e._outlinePass = u;
2659
2659
  }
2660
- function kr(e, t, n) {
2660
+ function Or(e, t, n) {
2661
2661
  !e._composer || !e._outlinePass || (e._composer.setSize(t, n), e._outlinePass.resolution.set(t, n));
2662
2662
  }
2663
2663
  function Ae(e, t) {
@@ -2675,41 +2675,41 @@ const Lr = [
2675
2675
  { normal: [0, 0, -1], neibDir: [0, 0, -1], verts: [[1, -1, -1], [-1, -1, -1], [-1, 1, -1], [1, 1, -1]] }
2676
2676
  ];
2677
2677
  function Fr(e, t, n, r, o = {}) {
2678
- if (!e.scene || (wt(e), !t || !n || !r)) return;
2678
+ if (!e.scene || (Ht(e), !t || !n || !r)) return;
2679
2679
  const { autoCenter: i = !0, opacity: s = 1 } = o;
2680
2680
  let l = 1 / 0, c = -1 / 0, a = 1 / 0, u = -1 / 0, m = 1 / 0, d = -1 / 0;
2681
- t.forEach((y) => {
2682
- const O = Number(y.x ?? y.center_x ?? 0), I = Number(y.y ?? y.center_y ?? 0), V = Number(y.z ?? y.center_z ?? 0), H = Number(y.dx ?? y.size_x ?? 1), T = Number(y.dy ?? y.size_y ?? 1), U = Number(y.dz ?? y.size_z ?? 1);
2683
- l = Math.min(l, O - H / 2), c = Math.max(c, O + H / 2), a = Math.min(a, I - T / 2), u = Math.max(u, I + T / 2), m = Math.min(m, V - U / 2), d = Math.max(d, V + U / 2);
2681
+ t.forEach((_) => {
2682
+ const k = Number(_.x ?? _.center_x ?? 0), I = Number(_.y ?? _.center_y ?? 0), V = Number(_.z ?? _.center_z ?? 0), w = Number(_.dx ?? _.size_x ?? 1), T = Number(_.dy ?? _.size_y ?? 1), Y = Number(_.dz ?? _.size_z ?? 1);
2683
+ l = Math.min(l, k - w / 2), c = Math.max(c, k + w / 2), a = Math.min(a, I - T / 2), u = Math.max(u, I + T / 2), m = Math.min(m, V - Y / 2), d = Math.max(d, V + Y / 2);
2684
2684
  });
2685
2685
  let f = 0, p = 0, b = 0;
2686
2686
  o.offset ? (f = Number(o.offset.x ?? 0), p = Number(o.offset.y ?? 0), b = Number(o.offset.z ?? 0)) : i && (f = -((l + c) / 2), p = -((a + u) / 2), b = -((m + d) / 2));
2687
- const h = l + f, _ = c + f, g = a + p, v = u + p, M = m + b, E = d + b, P = (y, O, I) => `${Math.round(y)},${Math.round(O)},${Math.round(I)}`, C = new Set(
2688
- t.map((y) => P(Number(y.x ?? 0), Number(y.y ?? 0), Number(y.z ?? 0)))
2689
- ), L = [], k = [], G = [], X = [], F = [];
2690
- let Y = 0;
2691
- if (t.forEach((y) => {
2692
- const O = Number(y.x ?? y.center_x ?? 0), I = Number(y.y ?? y.center_y ?? 0), V = Number(y.z ?? y.center_z ?? 0), H = Number(y.dx ?? y.size_x ?? 1), T = Number(y.dy ?? y.size_y ?? 1), U = Number(y.dz ?? y.size_z ?? 1), W = O + f, re = I + p, pe = V + b, ce = Sn(y[n], r, N), { r: ve, g: ue, b: Ve } = ce;
2687
+ const h = l + f, N = c + f, g = a + p, v = u + p, M = m + b, E = d + b, P = (_, k, I) => `${Math.round(_)},${Math.round(k)},${Math.round(I)}`, C = new Set(
2688
+ t.map((_) => P(Number(_.x ?? 0), Number(_.y ?? 0), Number(_.z ?? 0)))
2689
+ ), L = [], O = [], G = [], X = [], F = [];
2690
+ let U = 0;
2691
+ if (t.forEach((_) => {
2692
+ const k = Number(_.x ?? _.center_x ?? 0), I = Number(_.y ?? _.center_y ?? 0), V = Number(_.z ?? _.center_z ?? 0), w = Number(_.dx ?? _.size_x ?? 1), T = Number(_.dy ?? _.size_y ?? 1), Y = Number(_.dz ?? _.size_z ?? 1), W = k + f, re = I + p, pe = V + b, ce = Sn(_[n], r, y), { r: ve, g: ue, b: Ve } = ce;
2693
2693
  Lr.forEach((be) => {
2694
- const Rt = O + be.neibDir[0] * H, Bt = I + be.neibDir[1] * T, Gt = V + be.neibDir[2] * U;
2695
- if (C.has(P(Rt, Bt, Gt))) return;
2696
- const _e = Y;
2697
- be.verts.forEach(([Yt, Ut, qt]) => {
2698
- L.push(W + Yt * H / 2, re + Ut * T / 2, pe + qt * U / 2), k.push(be.normal[0], be.normal[1], be.normal[2]), G.push(ve, ue, Ve), Y++;
2699
- }), X.push(_e, _e + 1, _e + 2, _e, _e + 2, _e + 3), F.push(y);
2694
+ const Bt = k + be.neibDir[0] * w, Rt = I + be.neibDir[1] * T, Gt = V + be.neibDir[2] * Y;
2695
+ if (C.has(P(Bt, Rt, Gt))) return;
2696
+ const _e = U;
2697
+ be.verts.forEach(([Ut, Yt, qt]) => {
2698
+ L.push(W + Ut * w / 2, re + Yt * T / 2, pe + qt * Y / 2), O.push(be.normal[0], be.normal[1], be.normal[2]), G.push(ve, ue, Ve), U++;
2699
+ }), X.push(_e, _e + 1, _e + 2, _e, _e + 2, _e + 3), F.push(_);
2700
2700
  });
2701
2701
  }), L.length === 0) return;
2702
- const j = new N.BufferGeometry();
2703
- j.setAttribute("position", new N.Float32BufferAttribute(L, 3)), j.setAttribute("normal", new N.Float32BufferAttribute(k, 3)), j.setAttribute("color", new N.Float32BufferAttribute(G, 3)), j.setIndex(X);
2704
- const A = new N.MeshLambertMaterial({
2702
+ const j = new y.BufferGeometry();
2703
+ j.setAttribute("position", new y.Float32BufferAttribute(L, 3)), j.setAttribute("normal", new y.Float32BufferAttribute(O, 3)), j.setAttribute("color", new y.Float32BufferAttribute(G, 3)), j.setIndex(X);
2704
+ const A = new y.MeshLambertMaterial({
2705
2705
  vertexColors: !0,
2706
2706
  transparent: s < 1,
2707
2707
  opacity: s,
2708
- side: N.DoubleSide
2709
- }), x = new N.Mesh(j, A);
2710
- x.userData._isMergedBlocks = !0, x.userData._quadToBlock = F, x.userData._offset = { x: f, y: p, z: b }, e.scene.add(x), e.blocks.push(x), ye(e), e.camera && e.controls && (e.lastBounds = { minX: h, maxX: _, minY: g, maxY: v, minZ: M, maxZ: E }, Je(e, { minX: h, maxX: _, minY: g, maxY: v, minZ: M, maxZ: E }));
2708
+ side: y.DoubleSide
2709
+ }), x = new y.Mesh(j, A);
2710
+ x.userData._isMergedBlocks = !0, x.userData._quadToBlock = F, x.userData._offset = { x: f, y: p, z: b }, e.scene.add(x), e.blocks.push(x), ye(e), e.camera && e.controls && (e.lastBounds = { minX: h, maxX: N, minY: g, maxY: v, minZ: M, maxZ: E }, Je(e, { minX: h, maxX: N, minY: g, maxY: v, minZ: M, maxZ: E }));
2711
2711
  }
2712
- function wt(e) {
2712
+ function Ht(e) {
2713
2713
  var t;
2714
2714
  e.blocks.forEach((n) => {
2715
2715
  e.scene.remove(n), n.geometry.dispose(), n.material.dispose();
@@ -2724,8 +2724,8 @@ function Tr(e, t) {
2724
2724
  function $r(e, t, n) {
2725
2725
  const r = (n == null ? void 0 : n.x) ?? 0, o = (n == null ? void 0 : n.y) ?? 0, i = (n == null ? void 0 : n.z) ?? 0, s = Number(t.x ?? t.center_x ?? 0) + r, l = Number(t.y ?? t.center_y ?? 0) + o, c = Number(t.z ?? t.center_z ?? 0) + i, a = Number(t.dx ?? t.size_x ?? 1), u = Number(t.dy ?? t.size_y ?? 1), m = Number(t.dz ?? t.size_z ?? 1);
2726
2726
  if (!e._blockHighlightMesh) {
2727
- const d = new N.BoxGeometry(1, 1, 1), f = new N.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1 });
2728
- e._blockHighlightMesh = new N.Mesh(d, f), e.scene.add(e._blockHighlightMesh);
2727
+ const d = new y.BoxGeometry(1, 1, 1), f = new y.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1 });
2728
+ e._blockHighlightMesh = new y.Mesh(d, f), e.scene.add(e._blockHighlightMesh);
2729
2729
  }
2730
2730
  return e._blockHighlightMesh.position.set(s, l, c), e._blockHighlightMesh.scale.set(a, u, m), e._blockHighlightMesh;
2731
2731
  }
@@ -2753,7 +2753,7 @@ function jt(e) {
2753
2753
  function Vr(e) {
2754
2754
  const t = e.renderer;
2755
2755
  t && (e.handleCanvasClick = (n) => {
2756
- var f, p, b, h, _, g, v;
2756
+ var f, p, b, h, N, g, v;
2757
2757
  if (n.button !== 0) return;
2758
2758
  if ((f = e.gizmo) != null && f.domElement) {
2759
2759
  const M = e.gizmo.domElement.getBoundingClientRect();
@@ -2780,33 +2780,33 @@ function Vr(e) {
2780
2780
  }
2781
2781
  if (s.length === 0) return;
2782
2782
  let u = s[0].object;
2783
- for (; u && u.parent && !((_ = u.userData) != null && _.holeId); )
2783
+ for (; u && u.parent && !((N = u.userData) != null && N.holeId); )
2784
2784
  u = u.parent;
2785
2785
  const m = (g = u == null ? void 0 : u.userData) == null ? void 0 : g.holeId, d = (v = u == null ? void 0 : u.userData) == null ? void 0 : v.project;
2786
2786
  m && e.drillholeClickHandler && e.drillholeClickHandler({ holeId: m, project: d });
2787
2787
  }, t.domElement.addEventListener("click", e.handleCanvasClick));
2788
2788
  }
2789
- class jo {
2789
+ class Bo {
2790
2790
  constructor() {
2791
- this.container = null, this.scene = null, this.camera = null, this.renderer = null, this.controls = null, this.flyControls = null, this.gizmo = null, this.blocks = [], this.drillLines = [], this.drillMeshes = [], this.structuralGroup = null, this.structuralMeshes = [], this.frameId = null, this.clock = new N.Clock(), this.handleCanvasClick = null, this.raycaster = new N.Raycaster(), this.pointer = new N.Vector2(), this.drillholeClickHandler = null, this.blockClickHandler = null, this.controlMode = "orbit", this._tmpDir = new N.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0, this.selectables = [], this._selectedObject = null, this._composer = null, this._blockHighlightMesh = null, this._outlinePass = null;
2791
+ this.container = null, this.scene = null, this.camera = null, this.renderer = null, this.controls = null, this.flyControls = null, this.gizmo = null, this.blocks = [], this.drillLines = [], this.drillMeshes = [], this.structuralGroup = null, this.structuralMeshes = [], this.frameId = null, this.clock = new y.Clock(), this.handleCanvasClick = null, this.raycaster = new y.Raycaster(), this.pointer = new y.Vector2(), this.drillholeClickHandler = null, this.blockClickHandler = null, this.controlMode = "orbit", this._tmpDir = new y.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0, this.selectables = [], this._selectedObject = null, this._composer = null, this._blockHighlightMesh = null, this._outlinePass = null;
2792
2792
  }
2793
2793
  init(t) {
2794
2794
  if (!t) return;
2795
2795
  this.container = t;
2796
2796
  const n = t.clientWidth, r = t.clientHeight;
2797
- this.scene = new N.Scene(), this.scene.background = new N.Color(16777215), this.camera = new N.PerspectiveCamera(28, n / r, 1e-3, 1e5), this.camera.up.set(0, 0, 1), this.camera.position.set(50, 50, 50), this.camera.lookAt(0, 0, 0), this.renderer = new N.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2798
- const o = new N.AmbientLight(16777215, 0.5);
2797
+ this.scene = new y.Scene(), this.scene.background = new y.Color(16777215), this.camera = new y.PerspectiveCamera(28, n / r, 1e-3, 1e5), this.camera.up.set(0, 0, 1), this.camera.position.set(50, 50, 50), this.camera.lookAt(0, 0, 0), this.renderer = new y.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2798
+ const o = new y.AmbientLight(16777215, 1.2);
2799
2799
  this.scene.add(o);
2800
- const i = new N.DirectionalLight(16777215, 0.6);
2800
+ const i = new y.DirectionalLight(16777215, 1.5);
2801
2801
  i.position.set(10, 10, 5), this.scene.add(i);
2802
- const s = new N.AxesHelper(20);
2802
+ const s = new y.AxesHelper(20);
2803
2803
  this.scene.add(s), this.controls = new Xt(this.camera, this.renderer.domElement), this.controls.enableDamping = !1, this.controls.screenSpacePanning = !0, this.controls.enableZoom = !0, this.controls.zoomSpeed = 1.2, this.controls.minDistance = 3e-3, this.controls.maxDistance = 4e4, this.controls.mouseButtons = {
2804
- LEFT: N.MOUSE.PAN,
2805
- MIDDLE: N.MOUSE.DOLLY,
2806
- RIGHT: N.MOUSE.ROTATE
2804
+ LEFT: y.MOUSE.PAN,
2805
+ MIDDLE: y.MOUSE.DOLLY,
2806
+ RIGHT: y.MOUSE.ROTATE
2807
2807
  }, this.controls.touches = {
2808
- ONE: N.TOUCH.ROTATE,
2809
- TWO: N.TOUCH.PAN
2808
+ ONE: y.TOUCH.ROTATE,
2809
+ TWO: y.TOUCH.PAN
2810
2810
  }, this.controls.maxPolarAngle = Math.PI, this.flyControls = new Wt(this.camera, this.renderer.domElement), this.flyControls.movementSpeed = 2e3, this.flyControls.rollSpeed = Math.PI / 12, this.flyControls.dragToLook = !0, this.flyControls.enabled = !1, this.gizmo = new Zt(this.camera, this.renderer, {
2811
2811
  container: this.container,
2812
2812
  placement: "top-right",
@@ -2814,7 +2814,7 @@ class jo {
2814
2814
  offset: { top: 12, right: 12 },
2815
2815
  animated: !0,
2816
2816
  speed: 1.5
2817
- }), this.gizmo.attachControls(this.controls), Vr(this), Or(this);
2817
+ }), this.gizmo.attachControls(this.controls), Vr(this), kr(this);
2818
2818
  const l = () => {
2819
2819
  var a;
2820
2820
  this.frameId = requestAnimationFrame(l);
@@ -2826,10 +2826,10 @@ class jo {
2826
2826
  resize() {
2827
2827
  if (!this.container || !this.camera || !this.renderer) return;
2828
2828
  const t = this.container.clientWidth, n = this.container.clientHeight;
2829
- this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update(), kr(this, t, n);
2829
+ this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update(), Or(this, t, n);
2830
2830
  }
2831
2831
  dispose() {
2832
- this.frameId && cancelAnimationFrame(this.frameId), this.renderer && this.handleCanvasClick && this.renderer.domElement.removeEventListener("click", this.handleCanvasClick), this.gizmo && (this.gizmo.dispose(), this.gizmo = null), this.viewChangeHandler = null, wt(this), Ht(this), Tt(this), ht(this), this.controls && this.controls.dispose(), this.flyControls && this.flyControls.dispose(), this.renderer && (this.renderer.dispose(), this.container && this.renderer.domElement && this.container.removeChild(this.renderer.domElement));
2832
+ this.frameId && cancelAnimationFrame(this.frameId), this.renderer && this.handleCanvasClick && this.renderer.domElement.removeEventListener("click", this.handleCanvasClick), this.gizmo && (this.gizmo.dispose(), this.gizmo = null), this.viewChangeHandler = null, Ht(this), wt(this), Tt(this), ht(this), this.controls && this.controls.dispose(), this.flyControls && this.flyControls.dispose(), this.renderer && (this.renderer.dispose(), this.container && this.renderer.domElement && this.container.removeChild(this.renderer.domElement));
2833
2833
  }
2834
2834
  // ---------------------------------------------------------------------------
2835
2835
  // Data renderers — delegate to domain modules
@@ -2975,7 +2975,7 @@ function Ro({
2975
2975
  /* @__PURE__ */ $("button", { type: "button", className: "ghost-button", onClick: t, children: e === "orbit" ? "Enable fly controls" : "Disable fly controls" })
2976
2976
  ] });
2977
2977
  }
2978
- function Bo({
2978
+ function Go({
2979
2979
  properties: e = [],
2980
2980
  selectedProperty: t = "",
2981
2981
  onPropertyChange: n = () => {
@@ -3060,27 +3060,84 @@ function Bo({
3060
3060
  ] })
3061
3061
  ] });
3062
3062
  }
3063
+ function Uo(e) {
3064
+ const t = typeof e == "string" ? JSON.parse(e) : e;
3065
+ if (t.schema_version !== "1.0")
3066
+ throw new Error(
3067
+ `Unsupported schema_version: ${JSON.stringify(t.schema_version)}. Expected "1.0".`
3068
+ );
3069
+ if (!Array.isArray(t.blocks))
3070
+ throw new Error('"blocks" must be a JSON array.');
3071
+ const n = t.blocks.map((r, o) => {
3072
+ if (r.id == null) throw new Error(`Block at index ${o} is missing required field "id".`);
3073
+ if (r.name == null) throw new Error(`Block "${r.id}" is missing required field "name".`);
3074
+ if (!Array.isArray(r.vertices)) throw new Error(`Block "${r.id}" is missing required field "vertices".`);
3075
+ if (!Array.isArray(r.triangles)) throw new Error(`Block "${r.id}" is missing required field "triangles".`);
3076
+ return {
3077
+ id: r.id,
3078
+ name: r.name,
3079
+ vertices: r.vertices,
3080
+ triangles: r.triangles,
3081
+ attributes: r.attributes ?? {},
3082
+ material: r.material ?? {}
3083
+ };
3084
+ });
3085
+ return {
3086
+ schema_version: t.schema_version,
3087
+ units: t.units ?? "",
3088
+ blocks: n
3089
+ };
3090
+ }
3091
+ function wr(e) {
3092
+ const t = new y.BufferGeometry(), n = new Float32Array(e.vertices.length * 3);
3093
+ e.vertices.forEach(([o, i, s], l) => {
3094
+ n[l * 3] = o, n[l * 3 + 1] = i, n[l * 3 + 2] = s;
3095
+ }), t.setAttribute("position", new y.BufferAttribute(n, 3));
3096
+ const r = new Uint32Array(e.triangles.length * 3);
3097
+ return e.triangles.forEach(([o, i, s], l) => {
3098
+ r[l * 3] = o, r[l * 3 + 1] = i, r[l * 3 + 2] = s;
3099
+ }), t.setIndex(new y.BufferAttribute(r, 1)), t;
3100
+ }
3101
+ function Yo(e, t, n = {}) {
3102
+ const { defaultOpacity: r = 1 } = n, o = new y.Group();
3103
+ return t.blocks.forEach((i) => {
3104
+ var b, h;
3105
+ const s = wr(i), l = ((b = i.material) == null ? void 0 : b.color) ?? "#888888", c = ((h = i.material) == null ? void 0 : h.opacity) ?? r, a = c < 1, u = new y.MeshStandardMaterial({
3106
+ color: new y.Color(l),
3107
+ opacity: c,
3108
+ transparent: a,
3109
+ side: y.DoubleSide,
3110
+ flatShading: !0
3111
+ }), m = new y.Mesh(s, u);
3112
+ m.userData = {
3113
+ id: i.id,
3114
+ attributes: i.attributes
3115
+ };
3116
+ const d = new y.EdgesGeometry(s, 15), f = new y.LineBasicMaterial({ color: "#ffffbb", linewidth: 1 }), p = new y.LineSegments(d, f);
3117
+ p.visible = !1, m.add(p), o.add(m);
3118
+ }), e.add(o), o;
3119
+ }
3063
3120
  export {
3064
3121
  Wn as ASSAY_COLOR_PALETTE_10,
3065
3122
  rn as ASSAY_NON_VALUE_FIELDS,
3066
- R as AZIMUTH,
3067
- Kr as BASELODE_DATA_MODEL_DRILL_ASSAY,
3068
- Wr as BASELODE_DATA_MODEL_DRILL_COLLAR,
3123
+ B as AZIMUTH,
3124
+ Jr as BASELODE_DATA_MODEL_DRILL_ASSAY,
3125
+ Zr as BASELODE_DATA_MODEL_DRILL_COLLAR,
3069
3126
  tn as BASELODE_DATA_MODEL_DRILL_GEOLOGY,
3070
- Zr as BASELODE_DATA_MODEL_DRILL_SURVEY,
3071
- Jr as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
3127
+ Kr as BASELODE_DATA_MODEL_DRILL_SURVEY,
3128
+ Qr as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
3072
3129
  Ro as Baselode3DControls,
3073
- jo as Baselode3DScene,
3074
- Bo as BlockModelWidget,
3130
+ Bo as Baselode3DScene,
3131
+ Go as BlockModelWidget,
3075
3132
  Qe as CHART_OPTIONS,
3076
3133
  dn as COMMENT_COLUMN_NAMES,
3077
3134
  bt as CRS,
3078
3135
  nn as DEFAULT_COLUMN_MAP,
3079
3136
  q as DEPTH,
3080
- B as DIP,
3137
+ R as DIP,
3081
3138
  Se as DISPLAY_CATEGORICAL,
3082
3139
  xe as DISPLAY_COMMENT,
3083
- ke as DISPLAY_HIDDEN,
3140
+ Oe as DISPLAY_HIDDEN,
3084
3141
  Ie as DISPLAY_NUMERIC,
3085
3142
  Ge as DISPLAY_TADPOLE,
3086
3143
  de as EASTING,
@@ -3102,98 +3159,101 @@ export {
3102
3159
  ae as PROJECT_ID,
3103
3160
  en as STRIKE,
3104
3161
  D as TO,
3105
- Lo as TracePlot,
3162
+ Fo as TracePlot,
3163
+ Yo as addGradeBlocksToScene,
3106
3164
  Fn as alphaBetaToNormal,
3107
- wo as annotationsFromIntervals,
3108
- Mo as assembleDataset,
3109
- fo as attachAssayPositions,
3110
- uo as balancedTangentialDesurvey,
3165
+ jo as annotationsFromIntervals,
3166
+ xo as assembleDataset,
3167
+ ho as attachAssayPositions,
3168
+ mo as balancedTangentialDesurvey,
3111
3169
  bn as buildAssayState,
3112
- Co as buildCategoricalStripLogConfig,
3113
- Un as buildCommentsConfig,
3170
+ ko as buildCategoricalStripLogConfig,
3171
+ Yn as buildCommentsConfig,
3114
3172
  Zn as buildEqualRangeColorScale,
3115
3173
  jn as buildIntervalPoints,
3116
3174
  Dt as buildPlotConfig,
3117
- ko as buildStrikeDipSymbol,
3175
+ Lo as buildStrikeDipSymbol,
3118
3176
  or as buildStructuralDiscs,
3119
3177
  Oo as buildStructuralStripConfig,
3120
- Yn as buildTadpoleConfig,
3121
- mo as buildTraces,
3178
+ Un as buildTadpoleConfig,
3179
+ fo as buildTraces,
3122
3180
  Ke as buildViewSignature,
3123
- vo as calculateBlockVolume,
3181
+ Ao as calculateBlockVolume,
3124
3182
  vn as calculatePropertyStats,
3125
3183
  fn as classifyColumns,
3126
- zo as coerceNumeric,
3184
+ Mo as coerceNumeric,
3127
3185
  Tn as computeStructuralPositions,
3128
- io as defaultChartType,
3186
+ so as defaultChartType,
3129
3187
  Le as deriveAssayProps,
3130
- ao as desurveyTraces,
3188
+ co as desurveyTraces,
3131
3189
  rr as dipAzimuthToNormal,
3132
3190
  dr as dolly,
3133
3191
  ar as emitViewChangeIfNeeded,
3134
3192
  An as filterBlocks,
3135
- No as filterByProject,
3193
+ zo as filterByProject,
3136
3194
  Je as fitCameraToBounds,
3137
3195
  fr as focusOnLastBounds,
3138
- Eo as getBlockStats,
3196
+ vo as getBlockStats,
3139
3197
  Nr as getCategoryHexColor,
3140
- Ue as getChartOptions,
3198
+ Ye as getChartOptions,
3141
3199
  Sn as getColorForValue,
3142
- kt as getEqualRangeBinIndex,
3200
+ Ot as getEqualRangeBinIndex,
3143
3201
  Jn as getEqualRangeColor,
3144
3202
  $t as getViewState,
3203
+ wr as gradeBlockToThreeGeometry,
3145
3204
  Pn as groupRowsByHole,
3146
- wn as holeHasData,
3205
+ Hn as holeHasData,
3147
3206
  Ln as interpolateTrace,
3148
3207
  Ho as intervalsAsTubes,
3149
- _o as joinAssaysToTraces,
3150
- so as loadAssayFile,
3208
+ No as joinAssaysToTraces,
3209
+ lo as loadAssayFile,
3151
3210
  pn as loadAssayHole,
3152
3211
  hn as loadAssayMetadata,
3153
- go as loadAssays,
3154
- Io as loadBlockModelMetadata,
3155
- po as loadCollars,
3156
- yo as loadGeology,
3157
- bo as loadSurveys,
3212
+ yo as loadAssays,
3213
+ Eo as loadBlockModelMetadata,
3214
+ bo as loadCollars,
3215
+ _o as loadGeology,
3216
+ Uo as loadGradeBlocksFromJson,
3217
+ go as loadSurveys,
3158
3218
  $e as loadTable,
3159
- to as logDataInfo,
3160
- eo as logDataWarning,
3219
+ no as logDataInfo,
3220
+ to as logDataWarning,
3161
3221
  ur as lookDown,
3162
3222
  _n as minimumCurvatureDesurvey,
3163
3223
  En as normalizeBlockRow,
3164
- ro as normalizeCsvRow,
3224
+ oo as normalizeCsvRow,
3165
3225
  Ce as normalizeFieldName,
3166
3226
  mr as pan,
3167
- On as parseAssayCsvTextToHoles,
3227
+ kn as parseAssayCsvTextToHoles,
3168
3228
  cn as parseAssayHole,
3169
- no as parseAssayHoleIds,
3229
+ ro as parseAssayHoleIds,
3170
3230
  an as parseAssayHoleIdsWithAssays,
3171
3231
  un as parseAssaysCSV,
3172
- xo as parseBlockModelCSV,
3173
- ho as parseDrillholesCSV,
3174
- kn as parseGeologyCsvText,
3232
+ Io as parseBlockModelCSV,
3233
+ po as parseDrillholesCSV,
3234
+ On as parseGeologyCsvText,
3175
3235
  Cn as parseStructuralCSV,
3176
- Do as parseStructuralIntervalsCSV,
3177
- So as parseStructuralPointsCSV,
3178
- lo as parseSurveyCSV,
3179
- Po as parseUnifiedDataset,
3180
- oo as pickFirstPresent,
3181
- To as planView,
3236
+ Po as parseStructuralIntervalsCSV,
3237
+ Do as parseStructuralPointsCSV,
3238
+ ao as parseSurveyCSV,
3239
+ Co as parseUnifiedDataset,
3240
+ io as pickFirstPresent,
3241
+ $o as planView,
3182
3242
  Qn as projectTraceToSection,
3183
3243
  cr as recenterCameraToOrigin,
3184
3244
  Mt as reorderHoleIds,
3185
- $o as sectionView,
3245
+ Vo as sectionView,
3186
3246
  er as sectionWindow,
3187
3247
  gr as setControlMode,
3188
3248
  br as setFov,
3189
3249
  lr as setViewState,
3190
3250
  he as standardizeColumns,
3191
- Qr as standardizeRowArray,
3192
- co as tangentialDesurvey,
3251
+ eo as standardizeRowArray,
3252
+ uo as tangentialDesurvey,
3193
3253
  on as toError,
3194
- Vo as tracesAsSegments,
3195
- Fo as useDrillholeTraceGrid,
3196
- Ao as validateStructuralPoints,
3197
- w as withDataErrorContext
3254
+ wo as tracesAsSegments,
3255
+ To as useDrillholeTraceGrid,
3256
+ So as validateStructuralPoints,
3257
+ H as withDataErrorContext
3198
3258
  };
3199
3259
  //# sourceMappingURL=baselode.js.map