baselode 0.1.3 → 0.1.5

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,107 +1,110 @@
1
1
  import Z from "papaparse";
2
- import { jsx as q, jsxs as Ne } from "react/jsx-runtime";
3
- import { useRef as ot, useState as K, useEffect as oe, useMemo as ve } from "react";
4
- import xe from "plotly.js-dist-min";
5
- import * as x from "three";
6
- import { OrbitControls as It } from "three/examples/jsm/controls/OrbitControls";
7
- import { FlyControls as At } from "three/examples/jsm/controls/FlyControls";
8
- import { ViewportGizmo as St } from "three-viewport-gizmo";
9
- const z = "hole_id", ee = "latitude", te = "longitude", he = "elevation", O = "azimuth", k = "dip", B = "from", R = "to", Ve = "mid", re = "project_id", ie = "easting", se = "northing", it = "crs", H = "depth", st = "alpha", at = "beta", Et = "strike", Qn = {
2
+ import { jsx as L, jsxs as Q } from "react/jsx-runtime";
3
+ import { useRef as dt, useState as K, useEffect as ae, useMemo as Oe } from "react";
4
+ import Ee from "plotly.js-dist-min";
5
+ import * as _ from "three";
6
+ import { OrbitControls as Bt } from "three/examples/jsm/controls/OrbitControls";
7
+ import { FlyControls as Gt } from "three/examples/jsm/controls/FlyControls";
8
+ import { ViewportGizmo as Ut } from "three-viewport-gizmo";
9
+ import { EffectComposer as Yt } from "three/examples/jsm/postprocessing/EffectComposer.js";
10
+ import { RenderPass as qt } from "three/examples/jsm/postprocessing/RenderPass.js";
11
+ import { OutlinePass as Xt } from "three/examples/jsm/postprocessing/OutlinePass.js";
12
+ const v = "hole_id", te = "latitude", ne = "longitude", _e = "elevation", B = "azimuth", G = "dip", q = "from", U = "to", je = "mid", ie = "project_id", ce = "easting", ue = "northing", mt = "crs", Y = "depth", ft = "alpha", ht = "beta", Wt = "strike", Rr = {
10
13
  // A unique hole identifier across the entire dataset and all future data sets
11
- [z]: "string",
14
+ [v]: "string",
12
15
  // The hole ID from the original collar source
13
16
  datasource_hole_id: "string",
14
17
  // The project ID or project code from the original collar source, if available
15
- [re]: "string",
18
+ [ie]: "string",
16
19
  // The latitude of the collar, in decimal degrees (WGS84)
17
- [ee]: "number",
18
- // The longitude of the collar, in decimal degrees (WGS84)
19
20
  [te]: "number",
21
+ // The longitude of the collar, in decimal degrees (WGS84)
22
+ [ne]: "number",
20
23
  // The elevation of the collar, in meters above sea level (WGS84)
21
- [he]: "number",
24
+ [_e]: "number",
22
25
  // The easting coordinate of the collar, in meters (projected CRS)
23
- [ie]: "number",
26
+ [ce]: "number",
24
27
  // The northing coordinate of the collar, in meters (projected CRS)
25
- [se]: "number",
28
+ [ue]: "number",
26
29
  // The coordinate reference system of the collar coordinates for easting/northing, as an EPSG code or proj string
27
- [it]: "string"
28
- }, er = {
30
+ [mt]: "string"
31
+ }, Br = {
29
32
  // The unique hole id that maps to the collar and any other data tables
30
- [z]: "string",
33
+ [v]: "string",
31
34
  // The depth along the hole where the survey measurement was taken / started
32
- [H]: "number",
35
+ [Y]: "number",
33
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)
34
- [R]: "number",
37
+ [U]: "number",
35
38
  // The azimuth of the hole at the survey depth, in degrees from north
36
- [O]: "number",
39
+ [B]: "number",
37
40
  // The dip of the hole at the survey depth, in degrees from horizontal (negative values indicate downward inclination)
38
- [k]: "number"
39
- }, tr = {
41
+ [G]: "number"
42
+ }, Gr = {
40
43
  // The unique hole id that maps to the collar and any other data tables
41
- [z]: "string",
44
+ [v]: "string",
42
45
  // The depth along the hole where the assay interval starts
43
- [B]: "number",
46
+ [q]: "number",
44
47
  // The depth along the hole where the assay interval ends
45
- [R]: "number",
48
+ [U]: "number",
46
49
  // The midpoint depth of the assay interval
47
- [Ve]: "number"
50
+ [je]: "number"
48
51
  // assay value columns are variable and not standardized here.
49
52
  // Assays may be flattened (one column per assay type) or long (one row per assay type with an additional 'assay_type' column)
50
- }, nr = {
51
- [z]: "string",
52
- [H]: "number",
53
- [k]: "number",
54
- [O]: "number",
55
- [st]: "number",
56
- [at]: "number",
53
+ }, Ur = {
54
+ [v]: "string",
55
+ [Y]: "number",
56
+ [G]: "number",
57
+ [B]: "number",
58
+ [ft]: "number",
59
+ [ht]: "number",
57
60
  comments: "string"
58
- }, vt = {
59
- [z]: ["hole_id", "holeid", "hole id", "hole-id"],
61
+ }, Zt = {
62
+ [v]: ["hole_id", "holeid", "hole id", "hole-id"],
60
63
  datasource_hole_id: ["datasource_hole_id", "datasourceholeid", "datasource hole id", "datasource-hole-id", "company_hole_id", "companyholeid", "company hole id", "company-hole-id"],
61
- [re]: ["project_id", "projectid", "project id", "project-id", "project_code", "projectcode", "project code", "project-code", "companyId", "company_id", "companyid", "company id", "company-id", "dataset", "project"],
62
- [ee]: ["latitude", "lat"],
63
- [te]: ["longitude", "lon"],
64
- [he]: ["elevation", "rl", "elev", "z"],
65
- [ie]: ["easting", "x"],
66
- [se]: ["northing", "y"],
67
- [it]: ["crs", "epsg", "projection"],
68
- [B]: ["from", "depth_from", "from_depth", "samp_from", "sample_from", "sampfrom", "fromdepth"],
69
- [R]: ["to", "depth_to", "to_depth", "samp_to", "sample_to", "sampto", "todepth"],
70
- [O]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdrn", "dipdir_calc", "dipdirect_calc"],
71
- [k]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
72
- [st]: ["alpha", "alpha_angle", "alpha_angle_deg", "alpha_2"],
73
- [at]: ["beta", "beta_angle", "beta_angle_deg", "beta_2"],
74
- [H]: ["depth", "survey_depth", "surveydepth"],
75
- [Et]: ["strike", "str"]
76
- }, lt = {};
77
- for (const [e, t] of Object.entries(vt))
64
+ [ie]: ["project_id", "projectid", "project id", "project-id", "project_code", "projectcode", "project code", "project-code", "companyId", "company_id", "companyid", "company id", "company-id", "dataset", "project"],
65
+ [te]: ["latitude", "lat"],
66
+ [ne]: ["longitude", "lon"],
67
+ [_e]: ["elevation", "rl", "elev", "z"],
68
+ [ce]: ["easting", "x"],
69
+ [ue]: ["northing", "y"],
70
+ [mt]: ["crs", "epsg", "projection"],
71
+ [q]: ["from", "depth_from", "from_depth", "samp_from", "sample_from", "sampfrom", "fromdepth"],
72
+ [U]: ["to", "depth_to", "to_depth", "samp_to", "sample_to", "sampto", "todepth"],
73
+ [B]: ["azimuth", "az", "dip_direction", "dipdir", "dip direction", "dipdrn", "dipdirection", "dip_dir", "computed_plane_azimuth", "calc_dipdir", "calc_dipdir_deg", "dipdrn", "dipdir_calc", "dipdirect_calc"],
74
+ [G]: ["dip", "computed_plane_dip", "calc_dip", "calc_dip_deg", "dip_calc"],
75
+ [ft]: ["alpha", "alpha_angle", "alpha_angle_deg", "alpha_2"],
76
+ [ht]: ["beta", "beta_angle", "beta_angle_deg", "beta_2"],
77
+ [Y]: ["depth", "survey_depth", "surveydepth"],
78
+ [Wt]: ["strike", "str"]
79
+ }, pt = {};
80
+ for (const [e, t] of Object.entries(Zt))
78
81
  for (const n of t) {
79
82
  const r = n.toLowerCase().trim();
80
- lt[r] = e;
83
+ pt[r] = e;
81
84
  }
82
- function ze(e) {
85
+ function ve(e) {
83
86
  return (e || "").toString().trim().toLowerCase().replace(/\s+/g, "_");
84
87
  }
85
- function ue(e, t = null, n = null) {
86
- const r = { ...lt };
88
+ function pe(e, t = null, n = null) {
89
+ const r = { ...pt };
87
90
  if (n) {
88
91
  for (const [i, s] of Object.entries(n))
89
92
  if (i != null && s != null) {
90
- const l = ze(i), u = ze(s);
91
- r[l] = u;
93
+ const c = ve(i), u = ve(s);
94
+ r[c] = u;
92
95
  }
93
96
  }
94
97
  const o = {};
95
98
  for (const [i, s] of Object.entries(e)) {
96
- const l = ze(i), u = r[l] || l;
99
+ const c = ve(i), u = r[c] || c;
97
100
  o[u] = s;
98
101
  }
99
102
  return o;
100
103
  }
101
- function rr(e, t = null, n = null) {
102
- return e.map((r) => ue(r, t, n));
104
+ function Yr(e, t = null, n = null) {
105
+ return e.map((r) => pe(r, t, n));
103
106
  }
104
- const Pt = /* @__PURE__ */ new Set([
107
+ const Kt = /* @__PURE__ */ new Set([
105
108
  "hole_id",
106
109
  "holeid",
107
110
  "id",
@@ -133,34 +136,34 @@ const Pt = /* @__PURE__ */ new Set([
133
136
  "todepth",
134
137
  "comment",
135
138
  "z"
136
- ]), Fe = "[baselode:data]";
137
- function Dt(e, t = "Unknown error") {
139
+ ]), we = "[baselode:data]";
140
+ function Jt(e, t = "Unknown error") {
138
141
  if (e instanceof Error) return e;
139
142
  const n = typeof e == "string" && e.trim() ? e : t;
140
143
  return new Error(n);
141
144
  }
142
- function $(e, t, n = "Operation failed") {
143
- const r = Dt(t, n), o = new Error(`${e}: ${r.message}`);
145
+ function w(e, t, n = "Operation failed") {
146
+ const r = Jt(t, n), o = new Error(`${e}: ${r.message}`);
144
147
  return o.cause = r, o;
145
148
  }
146
- function or(e, t) {
149
+ function qr(e, t) {
147
150
  if (t !== void 0) {
148
- console.warn(`${Fe} ${e}`, t);
151
+ console.warn(`${we} ${e}`, t);
149
152
  return;
150
153
  }
151
- console.warn(`${Fe} ${e}`);
154
+ console.warn(`${we} ${e}`);
152
155
  }
153
- function ir(e) {
154
- console.info(`${Fe} ${e}`);
156
+ function Xr(e) {
157
+ console.info(`${we} ${e}`);
155
158
  }
156
- const Se = (e, t = null) => ue(e, null, t);
157
- function Lt(e) {
158
- return { holeId: e[z] };
159
+ const Ce = (e, t = null) => pe(e, null, t);
160
+ function Qt(e) {
161
+ return { holeId: e[v] };
159
162
  }
160
- function ct(e, t = null) {
161
- const n = e[z], r = n !== void 0 ? `${n}`.trim() : "";
163
+ function bt(e, t = null) {
164
+ const n = e[v], r = n !== void 0 ? `${n}`.trim() : "";
162
165
  if (!r) return null;
163
- const o = e[re] || e.project || e.project_code, i = Number(e[B]), s = Number(e[R]);
166
+ const o = e[ie] || e.project || e.project_code, i = Number(e[q]), s = Number(e[U]);
164
167
  return !Number.isFinite(i) || !Number.isFinite(s) || s <= i ? null : {
165
168
  holeId: r,
166
169
  project: o,
@@ -169,22 +172,22 @@ function ct(e, t = null) {
169
172
  ...e
170
173
  };
171
174
  }
172
- function ut(e, t) {
175
+ function yt(e, t) {
173
176
  var o;
174
177
  const n = t.sort((i, s) => i.from - s.from), r = [];
175
178
  return n.forEach((i) => {
176
- const { from: s, to: l, project: u, ...a } = i, c = {
179
+ const { from: s, to: c, project: u, ...l } = i, a = {
177
180
  z: s,
178
181
  from: s,
179
- to: l,
180
- [z]: e,
181
- [re]: u,
182
- ...a
182
+ to: c,
183
+ [v]: e,
184
+ [ie]: u,
185
+ ...l
183
186
  };
184
- r.push(c), r.push({ ...c, z: l });
187
+ r.push(a), r.push({ ...a, z: c });
185
188
  }), { id: e, project: (o = n[0]) == null ? void 0 : o.project, points: r };
186
189
  }
187
- function sr(e, t = null) {
190
+ function Wr(e, t = null) {
188
191
  return new Promise((n, r) => {
189
192
  const o = /* @__PURE__ */ new Set();
190
193
  Z.parse(e, {
@@ -192,18 +195,18 @@ function sr(e, t = null) {
192
195
  dynamicTyping: !0,
193
196
  skipEmptyLines: !0,
194
197
  step: (i) => {
195
- const l = Se(i.data, t)[z];
196
- l !== void 0 && `${l}`.trim() !== "" && o.add(`${l}`.trim());
198
+ const c = Ce(i.data, t)[v];
199
+ c !== void 0 && `${c}`.trim() !== "" && o.add(`${c}`.trim());
197
200
  },
198
201
  complete: () => n(Array.from(o)),
199
- error: (i) => r($("parseAssayHoleIds", i))
202
+ error: (i) => r(w("parseAssayHoleIds", i))
200
203
  });
201
204
  });
202
205
  }
203
- function Tt(e) {
204
- return Object.entries(e || {}).some(([t, n]) => !(Pt.has(t) || n == null || typeof n == "string" && n.trim() === ""));
206
+ function en(e) {
207
+ return Object.entries(e || {}).some(([t, n]) => !(Kt.has(t) || n == null || typeof n == "string" && n.trim() === ""));
205
208
  }
206
- function Ft(e, t = null) {
209
+ function tn(e, t = null) {
207
210
  return new Promise((n, r) => {
208
211
  const o = /* @__PURE__ */ new Map();
209
212
  Z.parse(e, {
@@ -211,50 +214,50 @@ function Ft(e, t = null) {
211
214
  dynamicTyping: !0,
212
215
  skipEmptyLines: !0,
213
216
  step: (i) => {
214
- const s = Se(i.data, t);
215
- if (!Tt(s)) return;
216
- const u = Lt(s).holeId;
217
+ const s = Ce(i.data, t);
218
+ if (!en(s)) return;
219
+ const u = Qt(s).holeId;
217
220
  if (u !== void 0 && `${u}`.trim() !== "") {
218
- const a = `${u}`.trim();
219
- o.has(a) || o.set(a, {
220
- holeId: a
221
+ const l = `${u}`.trim();
222
+ o.has(l) || o.set(l, {
223
+ holeId: l
221
224
  });
222
225
  }
223
226
  },
224
227
  complete: () => n(Array.from(o.values())),
225
- error: (i) => r($("parseAssayHoleIdsWithAssays", i))
228
+ error: (i) => r(w("parseAssayHoleIdsWithAssays", i))
226
229
  });
227
230
  });
228
231
  }
229
- function Ot(e, t, n = null, r = null) {
232
+ function nn(e, t, n = null, r = null) {
230
233
  return new Promise((o, i) => {
231
234
  const s = `${t}`.trim();
232
235
  if (!s) {
233
- i($("parseAssayHole", new Error("Missing hole id")));
236
+ i(w("parseAssayHole", new Error("Missing hole id")));
234
237
  return;
235
238
  }
236
- const l = [];
239
+ const c = [];
237
240
  Z.parse(e, {
238
241
  header: !0,
239
242
  dynamicTyping: !0,
240
243
  skipEmptyLines: !0,
241
244
  step: (u) => {
242
- const a = Se(u.data, r), c = ct(a, r);
243
- c && `${c.holeId}`.trim() === s && l.push(c);
245
+ const l = Ce(u.data, r), a = bt(l, r);
246
+ a && `${a.holeId}`.trim() === s && c.push(a);
244
247
  },
245
248
  complete: () => {
246
- if (!l.length) {
249
+ if (!c.length) {
247
250
  o(null);
248
251
  return;
249
252
  }
250
- const u = ut(s, l);
253
+ const u = yt(s, c);
251
254
  o(u);
252
255
  },
253
- error: (u) => i($("parseAssayHole", u))
256
+ error: (u) => i(w("parseAssayHole", u))
254
257
  });
255
258
  });
256
259
  }
257
- function kt(e, t = null, n = null) {
260
+ function rn(e, t = null, n = null) {
258
261
  return new Promise((r, o) => {
259
262
  Z.parse(e, {
260
263
  header: !0,
@@ -263,23 +266,23 @@ function kt(e, t = null, n = null) {
263
266
  complete: (i) => {
264
267
  const s = /* @__PURE__ */ new Map();
265
268
  i.data.forEach((u) => {
266
- const a = Se(u, n), c = ct(a, n);
267
- c && (s.has(c.holeId) || s.set(c.holeId, []), s.get(c.holeId).push(c));
269
+ const l = Ce(u, n), a = bt(l, n);
270
+ a && (s.has(a.holeId) || s.set(a.holeId, []), s.get(a.holeId).push(a));
268
271
  });
269
- const l = Array.from(s.entries()).map(([u, a]) => ut(u, a));
270
- r({ holes: l });
272
+ const c = Array.from(s.entries()).map(([u, l]) => yt(u, l));
273
+ r({ holes: c });
271
274
  },
272
- error: (i) => o($("parseAssaysCSV", i))
275
+ error: (i) => o(w("parseAssaysCSV", i))
273
276
  });
274
277
  });
275
278
  }
276
- function ar(e = {}) {
279
+ function Zr(e = {}) {
277
280
  const t = {};
278
281
  return Object.entries(e || {}).forEach(([n, r]) => {
279
- n && (t[ze(n)] = r);
282
+ n && (t[ve(n)] = r);
280
283
  }), t;
281
284
  }
282
- function lr(e = {}, t = [], n) {
285
+ function Kr(e = {}, t = [], n) {
283
286
  for (const r of t) {
284
287
  const o = e[r];
285
288
  if (o != null && `${o}`.trim() !== "")
@@ -287,8 +290,8 @@ function lr(e = {}, t = [], n) {
287
290
  }
288
291
  return n;
289
292
  }
290
- const Vt = 4;
291
- function mt(e = [], t = "") {
293
+ const on = 4;
294
+ function gt(e = [], t = "") {
292
295
  if (!e.length) return [];
293
296
  if (!t) return e;
294
297
  const n = e.findIndex((i) => i === t);
@@ -296,7 +299,7 @@ function mt(e = [], t = "") {
296
299
  const r = e[n], o = e.filter((i, s) => s !== n);
297
300
  return [r, ...o];
298
301
  }
299
- function Me({
302
+ function Se({
300
303
  property: e = "",
301
304
  chartType: t = "",
302
305
  categoricalProps: n = [],
@@ -305,18 +308,18 @@ function Me({
305
308
  } = {}) {
306
309
  return e ? r.includes(e) ? "comment" : n.includes(e) ? "categorical" : e === "dip" ? "tadpole" : !t || t === "categorical" || t === "comment" || t === "tadpole" ? o : t : t || o;
307
310
  }
308
- function dt({
311
+ function _t({
309
312
  holeIds: e = [],
310
313
  focusedHoleId: t = "",
311
- plotCount: n = Vt,
314
+ plotCount: n = on,
312
315
  defaultProp: r = "",
313
316
  categoricalProps: o = [],
314
317
  commentProps: i = [],
315
318
  numericDefaultChartType: s = "markers+line"
316
319
  } = {}) {
317
- const l = mt(e, t);
318
- return Array.from({ length: n }).map((u, a) => {
319
- const c = l[a] || e[a] || "", m = Me({
320
+ const c = gt(e, t);
321
+ return Array.from({ length: n }).map((u, l) => {
322
+ const a = c[l] || e[l] || "", d = Se({
320
323
  property: r,
321
324
  chartType: "",
322
325
  categoricalProps: o,
@@ -324,30 +327,30 @@ function dt({
324
327
  numericDefaultChartType: s
325
328
  });
326
329
  return {
327
- holeId: c,
330
+ holeId: a,
328
331
  property: r,
329
- chartType: m
332
+ chartType: d
330
333
  };
331
334
  });
332
335
  }
333
- const ye = "numeric", _e = "categorical", pe = "comment", Ce = "hidden", Oe = "tadpole", Ue = {
334
- [ye]: [
336
+ const ze = "numeric", Ae = "categorical", Ne = "comment", Pe = "hidden", He = "tadpole", Ze = {
337
+ [ze]: [
335
338
  { value: "bar", label: "Bars" },
336
339
  { value: "markers", label: "Markers" },
337
340
  { value: "markers+line", label: "Markers + Line" },
338
341
  { value: "line", label: "Line only" }
339
342
  ],
340
- [_e]: [
343
+ [Ae]: [
341
344
  { value: "categorical", label: "Categorical bands" }
342
345
  ],
343
- [pe]: [
346
+ [Ne]: [
344
347
  { value: "comment", label: "Comments" }
345
348
  ],
346
- [Oe]: [
349
+ [He]: [
347
350
  { value: "tadpole", label: "Tadpole" }
348
351
  ],
349
- [Ce]: []
350
- }, Ye = /* @__PURE__ */ new Set([
352
+ [Pe]: []
353
+ }, Ke = /* @__PURE__ */ new Set([
351
354
  // Hole identifiers
352
355
  "hole_id",
353
356
  "holeid",
@@ -402,7 +405,7 @@ const ye = "numeric", _e = "categorical", pe = "comment", Ce = "hidden", Oe = "t
402
405
  "data_source",
403
406
  "_hole_key",
404
407
  "_hole_id_key"
405
- ]), wt = /* @__PURE__ */ new Set([
408
+ ]), sn = /* @__PURE__ */ new Set([
406
409
  "comments",
407
410
  "comment",
408
411
  "notes",
@@ -414,50 +417,50 @@ const ye = "numeric", _e = "categorical", pe = "comment", Ce = "hidden", Oe = "t
414
417
  "struct_comment",
415
418
  "structcomment"
416
419
  ]);
417
- function Rt(e) {
420
+ function ln(e) {
418
421
  if (!(e != null && e.length))
419
422
  return { byType: {}, numericCols: [], categoricalCols: [], commentCols: [] };
420
423
  const t = new Set(e.flatMap((r) => Object.keys(r || {}))), n = {};
421
424
  for (const r of t) {
422
425
  const o = r.toLowerCase().trim();
423
- if (Ye.has(o) || Ye.has(r)) {
424
- n[r] = Ce;
426
+ if (Ke.has(o) || Ke.has(r)) {
427
+ n[r] = Pe;
425
428
  continue;
426
429
  }
427
- if (wt.has(o)) {
428
- const l = e.some((u) => {
429
- const a = u[r];
430
- return a != null && String(a).trim() !== "" && String(a) !== "null";
430
+ if (sn.has(o)) {
431
+ const c = e.some((u) => {
432
+ const l = u[r];
433
+ return l != null && String(l).trim() !== "" && String(l) !== "null";
431
434
  });
432
- n[r] = l ? pe : Ce;
435
+ n[r] = c ? Ne : Pe;
433
436
  continue;
434
437
  }
435
438
  let i = !1, s = !1;
436
- for (const l of e) {
437
- const u = l[r];
439
+ for (const c of e) {
440
+ const u = c[r];
438
441
  if (!(u == null || typeof u == "string" && u.trim() === "") && (s = !0, typeof u == "number" && Number.isFinite(u))) {
439
442
  i = !0;
440
443
  break;
441
444
  }
442
445
  }
443
- s ? i ? n[r] = ye : n[r] = _e : n[r] = Ce;
446
+ s ? i ? n[r] = ze : n[r] = Ae : n[r] = Pe;
444
447
  }
445
448
  return {
446
449
  byType: n,
447
- numericCols: Object.entries(n).filter(([, r]) => r === ye).map(([r]) => r),
448
- categoricalCols: Object.entries(n).filter(([, r]) => r === _e).map(([r]) => r),
449
- commentCols: Object.entries(n).filter(([, r]) => r === pe).map(([r]) => r)
450
+ numericCols: Object.entries(n).filter(([, r]) => r === ze).map(([r]) => r),
451
+ categoricalCols: Object.entries(n).filter(([, r]) => r === Ae).map(([r]) => r),
452
+ commentCols: Object.entries(n).filter(([, r]) => r === Ne).map(([r]) => r)
450
453
  };
451
454
  }
452
- function we(e) {
453
- return Ue[e] ?? Ue[ye];
455
+ function Re(e) {
456
+ return Ze[e] ?? Ze[ze];
454
457
  }
455
- function cr(e) {
456
- const t = we(e);
457
- return t.length ? e === ye ? "line" : t[0].value : "markers+line";
458
+ function Jr(e) {
459
+ const t = Re(e);
460
+ return t.length ? e === ze ? "line" : t[0].value : "markers+line";
458
461
  }
459
- function Ie(e = []) {
460
- const t = e.flatMap((l) => l.points || []), { numericCols: n, categoricalCols: r, commentCols: o, byType: i } = Rt(t), s = n[0] || r[0] || "";
462
+ function De(e = []) {
463
+ const t = e.flatMap((c) => c.points || []), { numericCols: n, categoricalCols: r, commentCols: o, byType: i } = ln(t), s = n[0] || r[0] || "";
461
464
  return {
462
465
  numericProps: n,
463
466
  categoricalProps: r,
@@ -466,16 +469,16 @@ function Ie(e = []) {
466
469
  defaultProp: s
467
470
  };
468
471
  }
469
- async function $t(e, t = null) {
470
- return await Ft(e);
472
+ async function an(e, t = null) {
473
+ return await tn(e);
471
474
  }
472
- async function Ht(e, t, n = null) {
473
- return await Ot(e, t);
475
+ async function cn(e, t, n = null) {
476
+ return await nn(e, t);
474
477
  }
475
- function jt(e = [], t = "") {
478
+ function un(e = [], t = "") {
476
479
  if (!e.length) return null;
477
- const { numericProps: n, categoricalProps: r, commentProps: o, columnMeta: i, defaultProp: s } = Ie(e), l = e.map((a) => a.id || a.holeId).filter(Boolean), u = dt({
478
- holeIds: l,
480
+ const { numericProps: n, categoricalProps: r, commentProps: o, columnMeta: i, defaultProp: s } = De(e), c = e.map((l) => l.id || l.holeId).filter(Boolean), u = _t({
481
+ holeIds: c,
479
482
  focusedHoleId: t,
480
483
  plotCount: 4,
481
484
  defaultProp: s,
@@ -493,145 +496,145 @@ function jt(e = [], t = "") {
493
496
  traceConfigs: u
494
497
  };
495
498
  }
496
- async function ur(e, t = "", n = null) {
497
- const { holes: r } = await kt(e, n), o = jt(r, t);
499
+ async function Qr(e, t = "", n = null) {
500
+ const { holes: r } = await rn(e, n), o = un(r, t);
498
501
  if (!o) throw new Error("No valid assay intervals found.");
499
502
  return o;
500
503
  }
501
- function mr(e, t = null) {
504
+ function eo(e, t = null) {
502
505
  return new Promise((n, r) => {
503
506
  Z.parse(e, {
504
507
  header: !0,
505
508
  dynamicTyping: !0,
506
509
  skipEmptyLines: !0,
507
510
  complete: (o) => {
508
- const i = o.data.map((s) => Gt(s, t)).filter((s) => s[z] && Number.isFinite(s[H]) && Number.isFinite(s[k]) && Number.isFinite(s[O]));
511
+ const i = o.data.map((s) => dn(s, t)).filter((s) => s[v] && Number.isFinite(s[Y]) && Number.isFinite(s[G]) && Number.isFinite(s[B]));
509
512
  n(i);
510
513
  },
511
- error: (o) => r($("parseSurveyCSV", o))
514
+ error: (o) => r(w("parseSurveyCSV", o))
512
515
  });
513
516
  });
514
517
  }
515
- function Gt(e, t = null) {
516
- const n = ue(e, null, t), r = n[z], o = n[re] || n.project || n.project_code, i = fe(n[ee]), s = fe(n[te]), l = fe(n[H]), u = fe(n[k]), a = fe(n[O]), c = fe(n.maxdepth);
518
+ function dn(e, t = null) {
519
+ const n = pe(e, null, t), r = n[v], o = n[ie] || n.project || n.project_code, i = ge(n[te]), s = ge(n[ne]), c = ge(n[Y]), u = ge(n[G]), l = ge(n[B]), a = ge(n.maxdepth);
517
520
  return {
518
521
  raw: n,
519
- [z]: r,
520
- [re]: o,
521
- [ee]: i,
522
- [te]: s,
523
- [H]: l,
524
- [k]: u,
525
- [O]: a,
526
- maxdepth: c,
522
+ [v]: r,
523
+ [ie]: o,
524
+ [te]: i,
525
+ [ne]: s,
526
+ [Y]: c,
527
+ [G]: u,
528
+ [B]: l,
529
+ maxdepth: a,
527
530
  // Legacy field names for backwards compatibility
528
531
  project_code: o,
529
532
  latitude: i,
530
533
  longitude: s,
531
- surveydepth: l
534
+ surveydepth: c
532
535
  };
533
536
  }
534
- const fe = (e) => {
537
+ const ge = (e) => {
535
538
  const t = Number(e);
536
539
  return Number.isFinite(t) ? t : void 0;
537
540
  };
538
- function dr(e, t) {
539
- var a, c, m, d;
541
+ function to(e, t) {
542
+ var l, a, d, m;
540
543
  const n = /* @__PURE__ */ new Map();
541
544
  e.forEach((f) => {
542
- const y = (f[z] || f.holeId || f.id || "").toString().trim();
543
- if (!y) return;
544
- const p = y.toLowerCase();
545
+ const b = (f[v] || f.holeId || f.id || "").toString().trim();
546
+ if (!b) return;
547
+ const p = b.toLowerCase();
545
548
  n.has(p) || n.set(p, f);
546
549
  });
547
- const r = ((a = e[0]) == null ? void 0 : a.lat) ?? ((c = e[0]) == null ? void 0 : c[ee]) ?? 0, o = ((m = e[0]) == null ? void 0 : m.lng) ?? ((d = e[0]) == null ? void 0 : d[te]) ?? 0, i = 111132, s = 111320 * Math.cos(r * Math.PI / 180), l = /* @__PURE__ */ new Map();
550
+ const r = ((l = e[0]) == null ? void 0 : l.lat) ?? ((a = e[0]) == null ? void 0 : a[te]) ?? 0, o = ((d = e[0]) == null ? void 0 : d.lng) ?? ((m = e[0]) == null ? void 0 : m[ne]) ?? 0, i = 111132, s = 111320 * Math.cos(r * Math.PI / 180), c = /* @__PURE__ */ new Map();
548
551
  t.forEach((f) => {
549
- const y = (f[z] || "").toString().trim();
550
- if (!y) return;
551
- const p = y.toLowerCase();
552
- l.has(p) || l.set(p, []), l.get(p).push(f);
552
+ const b = (f[v] || "").toString().trim();
553
+ if (!b) return;
554
+ const p = b.toLowerCase();
555
+ c.has(p) || c.set(p, []), c.get(p).push(f);
553
556
  });
554
557
  const u = [];
555
- return l.forEach((f, y) => {
556
- const p = n.get(y);
558
+ return c.forEach((f, b) => {
559
+ const p = n.get(b);
557
560
  if (!p) return;
558
- const h = f.filter((D) => Number.isFinite(D[H] ?? D.surveydepth)).sort((D, G) => (D[H] ?? D.surveydepth) - (G[H] ?? G.surveydepth));
561
+ const h = f.filter((O) => Number.isFinite(O[Y] ?? O.surveydepth)).sort((O, $) => (O[Y] ?? O.surveydepth) - ($[Y] ?? $.surveydepth));
559
562
  if (!h.length) return;
560
- const g = p.lat ?? p[ee], b = p.lng ?? p[te], _ = 111132, I = 111320 * Math.cos(g * Math.PI / 180), N = (b - o) * s, P = (g - r) * i, E = [];
561
- let M = 0, F = 0, j = 0;
562
- for (let D = 0; D < h.length; D += 1) {
563
- const G = h[D], U = h[D - 1], S = G[H] ?? G.surveydepth, C = G[O] ?? G.azimuth, v = G[k] ?? G.dip;
564
- if (!U) {
565
- E.push({
566
- x: N + M,
567
- y: P + F,
563
+ const N = p.lat ?? p[te], y = p.lng ?? p[ne], E = 111132, M = 111320 * Math.cos(N * Math.PI / 180), z = (y - o) * s, P = (N - r) * i, D = [];
564
+ let x = 0, V = 0, H = 0;
565
+ for (let O = 0; O < h.length; O += 1) {
566
+ const $ = h[O], j = h[O - 1], S = $[Y] ?? $.surveydepth, I = $[B] ?? $.azimuth, g = $[G] ?? $.dip;
567
+ if (!j) {
568
+ D.push({
569
+ x: z + x,
570
+ y: P + V,
568
571
  z: 0,
569
572
  md: S,
570
- azimuth: C,
571
- dip: v
573
+ azimuth: I,
574
+ dip: g
572
575
  });
573
576
  continue;
574
577
  }
575
- const L = U[H] ?? U.surveydepth, A = U[O] ?? U.azimuth, V = U[k] ?? U.dip, w = S - L;
576
- if (w <= 0) continue;
577
- const T = qe(V), Y = qe(v), X = ke(A), le = ke(C), be = Math.acos(
578
- Math.sin(T) * Math.sin(Y) * Math.cos(X - le) + Math.cos(T) * Math.cos(Y)
579
- ), me = be > 1e-6 ? 2 / be * Math.tan(be / 2) : 1, Ee = 0.5 * w * (Math.sin(T) * Math.cos(X) + Math.sin(Y) * Math.cos(le)) * me, de = 0.5 * w * (Math.sin(T) * Math.sin(X) + Math.sin(Y) * Math.sin(le)) * me, Ct = 0.5 * w * (Math.cos(T) + Math.cos(Y)) * me;
580
- M += Ee, F += de, j += Ct, E.push({
581
- x: N + M,
582
- y: P + F,
583
- z: -j,
578
+ const k = j[Y] ?? j.surveydepth, A = j[B] ?? j.azimuth, T = j[G] ?? j.dip, F = S - k;
579
+ if (F <= 0) continue;
580
+ const C = Je(T), R = Je(g), X = $e(A), re = $e(I), me = Math.acos(
581
+ Math.sin(C) * Math.sin(R) * Math.cos(X - re) + Math.cos(C) * Math.cos(R)
582
+ ), se = me > 1e-6 ? 2 / me * Math.tan(me / 2) : 1, Me = 0.5 * F * (Math.sin(C) * Math.cos(X) + Math.sin(R) * Math.cos(re)) * se, le = 0.5 * F * (Math.sin(C) * Math.sin(X) + Math.sin(R) * Math.sin(re)) * se, Le = 0.5 * F * (Math.cos(C) + Math.cos(R)) * se;
583
+ x += Me, V += le, H += Le, D.push({
584
+ x: z + x,
585
+ y: P + V,
586
+ z: -H,
584
587
  // render with z up; depth down
585
588
  md: S,
586
- azimuth: C,
587
- dip: v
589
+ azimuth: I,
590
+ dip: g
588
591
  });
589
592
  }
590
- const W = E.map((D) => ({
591
- ...D,
592
- lat: g + D.y / _,
593
- lng: b + D.x / I
593
+ const W = D.map((O) => ({
594
+ ...O,
595
+ lat: N + O.y / E,
596
+ lng: y + O.x / M
594
597
  }));
595
598
  u.push({
596
- id: p[z] || p.holeId || y,
597
- project: p[re] || p.project_id || p.project || "",
599
+ id: p[v] || p.holeId || b,
600
+ project: p[ie] || p.project_id || p.project || "",
598
601
  points: W,
599
602
  collar: p
600
603
  });
601
604
  }), u;
602
605
  }
603
- const ke = (e) => e * Math.PI / 180, qe = (e) => {
606
+ const $e = (e) => e * Math.PI / 180, Je = (e) => {
604
607
  const t = Number(e), n = 90 + (Number.isFinite(t) ? t : 0), r = Math.min(180, Math.max(0, n));
605
- return ke(r);
608
+ return $e(r);
606
609
  };
607
- function Q(e, t = void 0) {
610
+ function ee(e, t = void 0) {
608
611
  const n = Number(e);
609
612
  return Number.isFinite(n) ? n : t;
610
613
  }
611
- function Xe(e) {
614
+ function Qe(e) {
612
615
  return e == null ? "" : `${e}`.trim();
613
616
  }
614
- function Ae(e = [], t = null) {
615
- const n = t || "hole_id", o = [n, "hole_id", "holeId", "id"].find((i) => e.some((s) => Xe(s == null ? void 0 : s[i])));
617
+ function ke(e = [], t = null) {
618
+ const n = t || "hole_id", o = [n, "hole_id", "holeId", "id"].find((i) => e.some((s) => Qe(s == null ? void 0 : s[i])));
616
619
  if (!o)
617
- throw $("canonicalizeHoleIdRows", new Error(`hole id column '${n}' not found`));
620
+ throw w("canonicalizeHoleIdRows", new Error(`hole id column '${n}' not found`));
618
621
  return {
619
622
  aliasCol: o,
620
623
  rows: e.map((i) => ({
621
624
  ...i,
622
- hole_id: Xe(i == null ? void 0 : i[o])
625
+ hole_id: Qe(i == null ? void 0 : i[o])
623
626
  }))
624
627
  };
625
628
  }
626
- function Ze(e) {
629
+ function et(e) {
627
630
  return Number(e) * Math.PI / 180;
628
631
  }
629
- function Pe(e, t) {
630
- const n = Ze(e), r = Ze(t), o = Math.cos(r) * Math.sin(n), i = Math.cos(r) * Math.cos(n), s = Math.sin(r) * -1;
632
+ function Te(e, t) {
633
+ const n = et(e), r = et(t), o = Math.cos(r) * Math.sin(n), i = Math.cos(r) * Math.cos(n), s = Math.sin(r) * -1;
631
634
  return { ca: o, cb: i, cc: s };
632
635
  }
633
- function Bt(e, t, n, r, o, i = "minimum_curvature") {
634
- const s = Pe(t, n), l = Pe(r, o);
636
+ function mn(e, t, n, r, o, i = "minimum_curvature") {
637
+ const s = Te(t, n), c = Te(r, o);
635
638
  if (i === "tangential")
636
639
  return {
637
640
  dx: e * s.ca,
@@ -641,126 +644,126 @@ function Bt(e, t, n, r, o, i = "minimum_curvature") {
641
644
  dip: n
642
645
  };
643
646
  if (i === "balanced_tangential") {
644
- const m = 0.5 * (t + r), d = 0.5 * (n + o), f = Pe(m, d);
647
+ const d = 0.5 * (t + r), m = 0.5 * (n + o), f = Te(d, m);
645
648
  return {
646
649
  dx: e * f.ca,
647
650
  dy: e * f.cb,
648
651
  dz: e * f.cc,
649
- azimuth: m,
650
- dip: d
652
+ azimuth: d,
653
+ dip: m
651
654
  };
652
655
  }
653
- const u = s.ca * l.ca + s.cb * l.cb + s.cc * l.cc, a = Math.acos(Math.max(-1, Math.min(1, u))), c = a > 1e-6 ? 2 * Math.tan(a / 2) / a : 1;
656
+ const u = s.ca * c.ca + s.cb * c.cb + s.cc * c.cc, l = Math.acos(Math.max(-1, Math.min(1, u))), a = l > 1e-6 ? 2 * Math.tan(l / 2) / l : 1;
654
657
  return {
655
- dx: 0.5 * e * (s.ca + l.ca) * c,
656
- dy: 0.5 * e * (s.cb + l.cb) * c,
657
- dz: 0.5 * e * (s.cc + l.cc) * c,
658
+ dx: 0.5 * e * (s.ca + c.ca) * a,
659
+ dy: 0.5 * e * (s.cb + c.cb) * a,
660
+ dz: 0.5 * e * (s.cc + c.cc) * a,
658
661
  azimuth: r,
659
662
  dip: o
660
663
  };
661
664
  }
662
- function Re(e = [], t = [], n = {}) {
665
+ function Be(e = [], t = [], n = {}) {
663
666
  const {
664
667
  step: r = 1,
665
668
  holeIdCol: o = null,
666
669
  method: i = "minimum_curvature"
667
- } = n, s = Number.isFinite(Number(r)) && Number(r) > 0 ? Number(r) : 1, l = Ae(e, o), u = Ae(t, o || l.aliasCol);
668
- if (!l.rows.length || !u.rows.length) return [];
669
- const a = /* @__PURE__ */ new Map();
670
- l.rows.forEach((d) => {
671
- !d.hole_id || a.has(d.hole_id) || a.set(d.hole_id, d);
670
+ } = n, s = Number.isFinite(Number(r)) && Number(r) > 0 ? Number(r) : 1, c = ke(e, o), u = ke(t, o || c.aliasCol);
671
+ if (!c.rows.length || !u.rows.length) return [];
672
+ const l = /* @__PURE__ */ new Map();
673
+ c.rows.forEach((m) => {
674
+ !m.hole_id || l.has(m.hole_id) || l.set(m.hole_id, m);
672
675
  });
673
- const c = /* @__PURE__ */ new Map();
674
- u.rows.forEach((d) => {
675
- d.hole_id && (c.has(d.hole_id) || c.set(d.hole_id, []), c.get(d.hole_id).push(d));
676
+ const a = /* @__PURE__ */ new Map();
677
+ u.rows.forEach((m) => {
678
+ m.hole_id && (a.has(m.hole_id) || a.set(m.hole_id, []), a.get(m.hole_id).push(m));
676
679
  });
677
- const m = [];
678
- return c.forEach((d, f) => {
679
- const y = a.get(f);
680
- if (!y) return;
681
- const p = [...d].map((E) => ({
682
- ...E,
683
- from: Q(E.from),
684
- azimuth: Q(E.azimuth),
685
- dip: Q(E.dip)
686
- })).filter((E) => Number.isFinite(E.from) && Number.isFinite(E.azimuth) && Number.isFinite(E.dip)).sort((E, M) => E.from - M.from);
680
+ const d = [];
681
+ return a.forEach((m, f) => {
682
+ const b = l.get(f);
683
+ if (!b) return;
684
+ const p = [...m].map((D) => ({
685
+ ...D,
686
+ from: ee(D.from),
687
+ azimuth: ee(D.azimuth),
688
+ dip: ee(D.dip)
689
+ })).filter((D) => Number.isFinite(D.from) && Number.isFinite(D.azimuth) && Number.isFinite(D.dip)).sort((D, x) => D.from - x.from);
687
690
  if (!p.length) return;
688
- let h = Q(y.x, 0), g = Q(y.y, 0), b = Q(y.z, 0), _ = p[0].from;
689
- const I = p[0].azimuth, N = p[0].dip, P = {
691
+ let h = ee(b.x, 0), N = ee(b.y, 0), y = ee(b.z, 0), E = p[0].from;
692
+ const M = p[0].azimuth, z = p[0].dip, P = {
690
693
  hole_id: f,
691
- md: _,
694
+ md: E,
692
695
  x: h,
693
- y: g,
694
- z: b,
695
- azimuth: I,
696
- dip: N
696
+ y: N,
697
+ z: y,
698
+ azimuth: M,
699
+ dip: z
697
700
  };
698
- l.aliasCol !== "hole_id" && y[l.aliasCol] !== void 0 && (P[l.aliasCol] = y[l.aliasCol]), m.push(P);
699
- for (let E = 0; E < p.length - 1; E += 1) {
700
- const M = p[E], F = p[E + 1], j = M.from, D = F.from - j;
701
- if (D <= 0) continue;
702
- const G = Math.max(1, Math.ceil(D / s)), U = D / G;
703
- for (let S = 0; S < G; S += 1) {
704
- _ += U;
705
- const C = (_ - j) / D, v = M.azimuth + C * (F.azimuth - M.azimuth), L = M.dip + C * (F.dip - M.dip), A = Bt(U, M.azimuth, M.dip, F.azimuth, F.dip, i);
706
- h += A.dx, g += A.dy, b += A.dz;
707
- const V = {
701
+ c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (P[c.aliasCol] = b[c.aliasCol]), d.push(P);
702
+ for (let D = 0; D < p.length - 1; D += 1) {
703
+ const x = p[D], V = p[D + 1], H = x.from, O = V.from - H;
704
+ if (O <= 0) continue;
705
+ const $ = Math.max(1, Math.ceil(O / s)), j = O / $;
706
+ for (let S = 0; S < $; S += 1) {
707
+ E += j;
708
+ const I = (E - H) / O, g = x.azimuth + I * (V.azimuth - x.azimuth), k = x.dip + I * (V.dip - x.dip), A = mn(j, x.azimuth, x.dip, V.azimuth, V.dip, i);
709
+ h += A.dx, N += A.dy, y += A.dz;
710
+ const T = {
708
711
  hole_id: f,
709
- md: _,
712
+ md: E,
710
713
  x: h,
711
- y: g,
712
- z: b,
713
- azimuth: i === "minimum_curvature" ? v : A.azimuth,
714
- dip: i === "minimum_curvature" ? L : A.dip
714
+ y: N,
715
+ z: y,
716
+ azimuth: i === "minimum_curvature" ? g : A.azimuth,
717
+ dip: i === "minimum_curvature" ? k : A.dip
715
718
  };
716
- l.aliasCol !== "hole_id" && y[l.aliasCol] !== void 0 && (V[l.aliasCol] = y[l.aliasCol]), m.push(V);
719
+ c.aliasCol !== "hole_id" && b[c.aliasCol] !== void 0 && (T[c.aliasCol] = b[c.aliasCol]), d.push(T);
717
720
  }
718
721
  }
719
- }), m;
722
+ }), d;
720
723
  }
721
- function Ut(e, t, n = {}) {
722
- return Re(e, t, { ...n, method: "minimum_curvature" });
724
+ function fn(e, t, n = {}) {
725
+ return Be(e, t, { ...n, method: "minimum_curvature" });
723
726
  }
724
- function fr(e, t, n = {}) {
725
- return Re(e, t, { ...n, method: "tangential" });
727
+ function no(e, t, n = {}) {
728
+ return Be(e, t, { ...n, method: "tangential" });
726
729
  }
727
- function hr(e, t, n = {}) {
728
- return Re(e, t, { ...n, method: "balanced_tangential" });
730
+ function ro(e, t, n = {}) {
731
+ return Be(e, t, { ...n, method: "balanced_tangential" });
729
732
  }
730
- function pr(e, t, n = {}) {
731
- return Ut(e, t, n);
733
+ function oo(e, t, n = {}) {
734
+ return fn(e, t, n);
732
735
  }
733
- function Yt(e, t) {
736
+ function hn(e, t) {
734
737
  if (!e.length || !Number.isFinite(t)) return null;
735
738
  let n = null, r = 1 / 0;
736
739
  for (let o = 0; o < e.length; o += 1) {
737
- const i = e[o], s = Q(i.md);
740
+ const i = e[o], s = ee(i.md);
738
741
  if (!Number.isFinite(s)) continue;
739
- const l = Math.abs(s - t);
740
- l < r && (r = l, n = i);
742
+ const c = Math.abs(s - t);
743
+ c < r && (r = c, n = i);
741
744
  }
742
745
  return n;
743
746
  }
744
- function yr(e = [], t = [], n = {}) {
745
- const r = n.holeIdCol || "hole_id", o = Ae(e, r), i = Ae(t, r);
747
+ function io(e = [], t = [], n = {}) {
748
+ const r = n.holeIdCol || "hole_id", o = ke(e, r), i = ke(t, r);
746
749
  if (!o.rows.length || !i.rows.length) return [...o.rows];
747
750
  const s = /* @__PURE__ */ new Map();
748
- return i.rows.forEach((l) => {
749
- l.hole_id && (s.has(l.hole_id) || s.set(l.hole_id, []), s.get(l.hole_id).push(l));
750
- }), s.forEach((l, u) => {
751
- s.set(u, [...l].sort((a, c) => Q(a.md, 0) - Q(c.md, 0)));
752
- }), o.rows.map((l) => {
753
- const u = Q(l.from), a = Q(l.to), c = Number.isFinite(u) && Number.isFinite(a) ? 0.5 * (u + a) : void 0;
754
- if (!l.hole_id || !Number.isFinite(c)) return { ...l };
755
- const m = Yt(s.get(l.hole_id) || [], c);
756
- if (!m) return { ...l };
757
- const d = { ...l };
751
+ return i.rows.forEach((c) => {
752
+ c.hole_id && (s.has(c.hole_id) || s.set(c.hole_id, []), s.get(c.hole_id).push(c));
753
+ }), s.forEach((c, u) => {
754
+ s.set(u, [...c].sort((l, a) => ee(l.md, 0) - ee(a.md, 0)));
755
+ }), o.rows.map((c) => {
756
+ const u = ee(c.from), l = ee(c.to), a = Number.isFinite(u) && Number.isFinite(l) ? 0.5 * (u + l) : void 0;
757
+ if (!c.hole_id || !Number.isFinite(a)) return { ...c };
758
+ const d = hn(s.get(c.hole_id) || [], a);
759
+ if (!d) return { ...c };
760
+ const m = { ...c };
758
761
  return ["md", "x", "y", "z", "azimuth", "dip"].forEach((f) => {
759
- m[f] !== void 0 && (Object.prototype.hasOwnProperty.call(d, f) ? d[`${f}_trace`] = m[f] : d[f] = m[f]);
760
- }), d;
762
+ d[f] !== void 0 && (Object.prototype.hasOwnProperty.call(m, f) ? m[`${f}_trace`] = d[f] : m[f] = d[f]);
763
+ }), m;
761
764
  });
762
765
  }
763
- function br(e, t = null) {
766
+ function so(e, t = null) {
764
767
  return new Promise((n, r) => {
765
768
  Z.parse(e, {
766
769
  header: !0,
@@ -768,51 +771,51 @@ function br(e, t = null) {
768
771
  skipEmptyLines: !0,
769
772
  complete: (o) => {
770
773
  const i = /* @__PURE__ */ new Map();
771
- o.data.forEach((l, u) => {
772
- const a = ue(l, null, t), c = a[z], m = c !== void 0 ? `${c}`.trim() : "", d = a[ie] ?? a.x, f = a[se] ?? a.y, y = a[he] ?? a.z, p = a.order ?? u;
773
- !m || d === null || d === void 0 || f === null || f === void 0 || y === null || y === void 0 || (i.has(m) || i.set(m, []), i.get(m).push({
774
- ...a,
775
- holeId: m,
774
+ o.data.forEach((c, u) => {
775
+ const l = pe(c, null, t), a = l[v], d = a !== void 0 ? `${a}`.trim() : "", m = l[ce] ?? l.x, f = l[ue] ?? l.y, b = l[_e] ?? l.z, p = l.order ?? u;
776
+ !d || m === null || m === void 0 || f === null || f === void 0 || b === null || b === void 0 || (i.has(d) || i.set(d, []), i.get(d).push({
777
+ ...l,
778
+ holeId: d,
776
779
  order: p,
777
- x: Number(d) ?? 0,
780
+ x: Number(m) ?? 0,
778
781
  y: Number(f) ?? 0,
779
- z: Number(y) ?? 0
782
+ z: Number(b) ?? 0
780
783
  }));
781
784
  });
782
- const s = Array.from(i.entries()).map(([l, u]) => ({
783
- id: l,
784
- points: u.sort((a, c) => a.order - c.order).map((a) => ({
785
- ...a,
786
- x: Number(a.x) || 0,
787
- y: Number(a.y) || 0,
788
- z: Number(a.z) || 0
785
+ const s = Array.from(i.entries()).map(([c, u]) => ({
786
+ id: c,
787
+ points: u.sort((l, a) => l.order - a.order).map((l) => ({
788
+ ...l,
789
+ x: Number(l.x) || 0,
790
+ y: Number(l.y) || 0,
791
+ z: Number(l.z) || 0
789
792
  }))
790
793
  }));
791
794
  n({ holes: s });
792
795
  },
793
- error: (o) => r($("parseDrillholesCSV", o))
796
+ error: (o) => r(w("parseDrillholesCSV", o))
794
797
  });
795
798
  });
796
799
  }
797
- function ge(e) {
800
+ function xe(e) {
798
801
  return e ? Array.isArray(e) ? [...e] : [] : [];
799
802
  }
800
803
  function J(e) {
801
804
  const t = Number(e);
802
805
  return Number.isFinite(t) ? t : void 0;
803
806
  }
804
- function ft(e = [], t = []) {
807
+ function Nt(e = [], t = []) {
805
808
  const n = [...e];
806
809
  return n.sort((r, o) => {
807
810
  for (let i = 0; i < t.length; i += 1) {
808
- const s = t[i], l = r == null ? void 0 : r[s], u = o == null ? void 0 : o[s];
809
- if (l !== u)
810
- return l == null ? 1 : u == null ? -1 : typeof l == "number" && typeof u == "number" ? l - u : `${l}`.localeCompare(`${u}`);
811
+ const s = t[i], c = r == null ? void 0 : r[s], u = o == null ? void 0 : o[s];
812
+ if (c !== u)
813
+ return c == null ? 1 : u == null ? -1 : typeof c == "number" && typeof u == "number" ? c - u : `${c}`.localeCompare(`${u}`);
811
814
  }
812
815
  return 0;
813
816
  }), n;
814
817
  }
815
- function qt(e, t = {}) {
818
+ function pn(e, t = {}) {
816
819
  return new Promise((n, r) => {
817
820
  Z.parse(e, {
818
821
  header: !0,
@@ -820,14 +823,14 @@ function qt(e, t = {}) {
820
823
  skipEmptyLines: !0,
821
824
  ...t,
822
825
  complete: (o) => n(Array.isArray(o == null ? void 0 : o.data) ? o.data : []),
823
- error: (o) => r($("loadTable(csv)", o))
826
+ error: (o) => r(w("loadTable(csv)", o))
824
827
  });
825
828
  });
826
829
  }
827
- function Xt(e = [], t = null, n = null) {
828
- return e.map((r) => ue(r, t, n));
830
+ function bn(e = [], t = null, n = null) {
831
+ return e.map((r) => pe(r, t, n));
829
832
  }
830
- async function $e(e, t = {}) {
833
+ async function Ge(e, t = {}) {
831
834
  const {
832
835
  kind: n = "csv",
833
836
  columnMap: r = null,
@@ -836,97 +839,97 @@ async function $e(e, t = {}) {
836
839
  } = t;
837
840
  let s;
838
841
  if (Array.isArray(e))
839
- s = ge(e);
842
+ s = xe(e);
840
843
  else if (n === "csv")
841
- s = await qt(e, i);
842
- else throw n === "parquet" || n === "sql" ? $("loadTable", new Error(`Unsupported kind in JS runtime: ${n}`)) : $("loadTable", new Error(`Unsupported kind: ${n}`));
843
- return Xt(s, r, o);
844
+ s = await pn(e, i);
845
+ else throw n === "parquet" || n === "sql" ? w("loadTable", new Error(`Unsupported kind in JS runtime: ${n}`)) : w("loadTable", new Error(`Unsupported kind: ${n}`));
846
+ return bn(s, r, o);
844
847
  }
845
- async function gr(e, t = {}) {
848
+ async function lo(e, t = {}) {
846
849
  const {
847
850
  crs: n = null,
848
851
  sourceColumnMap: r = null,
849
852
  keepAll: o = !0,
850
853
  ...i
851
- } = t, s = await $e(e, { ...i, sourceColumnMap: r });
852
- if (!s.some((d) => z in d))
853
- throw $("loadCollars", new Error(`Collar table missing column: ${z}`));
854
- const u = s.some((d) => ie in d && se in d), a = s.some((d) => ee in d && te in d);
855
- if (!u && !a)
856
- throw $("loadCollars", new Error("Collar table missing coordinate columns (need easting/northing or latitude/longitude)"));
857
- const c = s.map((d) => {
858
- const f = { ...d };
859
- if (z in f) {
860
- const y = f[z];
861
- f[z] = y == null ? "" : `${y}`.trim();
854
+ } = t, s = await Ge(e, { ...i, sourceColumnMap: r });
855
+ if (!s.some((m) => v in m))
856
+ throw w("loadCollars", new Error(`Collar table missing column: ${v}`));
857
+ const u = s.some((m) => ce in m && ue in m), l = s.some((m) => te in m && ne in m);
858
+ if (!u && !l)
859
+ throw w("loadCollars", new Error("Collar table missing coordinate columns (need easting/northing or latitude/longitude)"));
860
+ const a = s.map((m) => {
861
+ const f = { ...m };
862
+ if (v in f) {
863
+ const b = f[v];
864
+ f[v] = b == null ? "" : `${b}`.trim();
862
865
  }
863
- return ee in f && (f[ee] = J(f[ee])), te in f && (f[te] = J(f[te])), he in f && (f[he] = J(f[he])), ie in f && (f[ie] = J(f[ie])), se in f && (f[se] = J(f[se])), !("datasource_hole_id" in f) && z in f && (f.datasource_hole_id = f[z]), f;
866
+ return te in f && (f[te] = J(f[te])), ne in f && (f[ne] = J(f[ne])), _e in f && (f[_e] = J(f[_e])), ce in f && (f[ce] = J(f[ce])), ue in f && (f[ue] = J(f[ue])), !("datasource_hole_id" in f) && v in f && (f.datasource_hole_id = f[v]), f;
864
867
  });
865
- if (!c.every((d) => !(!d[z] || a && (!Number.isFinite(d[ee]) || !Number.isFinite(d[te])) || u && !a && (!Number.isFinite(d[ie]) || !Number.isFinite(d[se])))))
866
- throw $("loadCollars", new Error("Collar table has missing required values"));
867
- return c;
868
+ if (!a.every((m) => !(!m[v] || l && (!Number.isFinite(m[te]) || !Number.isFinite(m[ne])) || u && !l && (!Number.isFinite(m[ce]) || !Number.isFinite(m[ue])))))
869
+ throw w("loadCollars", new Error("Collar table has missing required values"));
870
+ return a;
868
871
  }
869
- async function _r(e, t = {}) {
872
+ async function ao(e, t = {}) {
870
873
  const {
871
874
  sourceColumnMap: n = null,
872
875
  keepAll: r = !0,
873
876
  ...o
874
- } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, H, O, k];
875
- for (const a of s)
876
- if (!i.some((m) => a in m))
877
- throw $("loadSurveys", new Error(`Survey table missing column: ${a}`));
878
- const l = i.map((a) => {
879
- const c = { ...a };
880
- if (z in c) {
881
- const m = c[z];
882
- c[z] = m == null ? "" : `${m}`.trim();
877
+ } = t, i = await Ge(e, { ...o, sourceColumnMap: n }), s = [v, Y, B, G];
878
+ for (const l of s)
879
+ if (!i.some((d) => l in d))
880
+ throw w("loadSurveys", new Error(`Survey table missing column: ${l}`));
881
+ const c = i.map((l) => {
882
+ const a = { ...l };
883
+ if (v in a) {
884
+ const d = a[v];
885
+ a[v] = d == null ? "" : `${d}`.trim();
883
886
  }
884
- return H in c && (c[H] = J(c[H])), R in c && (c[R] = J(c[R])), O in c && (c[O] = J(c[O])), k in c && (c[k] = J(c[k])), c;
887
+ return Y in a && (a[Y] = J(a[Y])), U in a && (a[U] = J(a[U])), B in a && (a[B] = J(a[B])), G in a && (a[G] = J(a[G])), a;
885
888
  });
886
- if (!l.every((a) => !(!a[z] || !Number.isFinite(a[H]) || !Number.isFinite(a[O]) || !Number.isFinite(a[k]))))
887
- throw $("loadSurveys", new Error("Survey table has missing required values"));
888
- return ft(l, [z, H]);
889
+ if (!c.every((l) => !(!l[v] || !Number.isFinite(l[Y]) || !Number.isFinite(l[B]) || !Number.isFinite(l[G]))))
890
+ throw w("loadSurveys", new Error("Survey table has missing required values"));
891
+ return Nt(c, [v, Y]);
889
892
  }
890
- async function xr(e, t = {}) {
893
+ async function co(e, t = {}) {
891
894
  const {
892
895
  sourceColumnMap: n = null,
893
896
  keepAll: r = !0,
894
897
  ...o
895
- } = t, i = await $e(e, { ...o, sourceColumnMap: n }), s = [z, B, R];
896
- for (const a of s)
897
- if (!i.some((m) => a in m))
898
- throw $("loadAssays", new Error(`Assay table missing column: ${a}`));
899
- const l = i.map((a) => {
900
- const c = { ...a };
901
- if (z in c) {
902
- const m = c[z];
903
- c[z] = m == null ? "" : `${m}`.trim();
898
+ } = t, i = await Ge(e, { ...o, sourceColumnMap: n }), s = [v, q, U];
899
+ for (const l of s)
900
+ if (!i.some((d) => l in d))
901
+ throw w("loadAssays", new Error(`Assay table missing column: ${l}`));
902
+ const c = i.map((l) => {
903
+ const a = { ...l };
904
+ if (v in a) {
905
+ const d = a[v];
906
+ a[v] = d == null ? "" : `${d}`.trim();
904
907
  }
905
- return B in c && (c[B] = J(c[B])), R in c && (c[R] = J(c[R])), B in c && R in c && Number.isFinite(c[B]) && Number.isFinite(c[R]) && (c[Ve] = 0.5 * (c[B] + c[R])), c;
908
+ return q in a && (a[q] = J(a[q])), U in a && (a[U] = J(a[U])), q in a && U in a && Number.isFinite(a[q]) && Number.isFinite(a[U]) && (a[je] = 0.5 * (a[q] + a[U])), a;
906
909
  });
907
- if (!l.every((a) => !(!a[z] || !Number.isFinite(a[B]) || !Number.isFinite(a[R]))))
908
- throw $("loadAssays", new Error("Assay table has missing required values"));
909
- return ft(l, [z, B, R]);
910
+ if (!c.every((l) => !(!l[v] || !Number.isFinite(l[q]) || !Number.isFinite(l[U]))))
911
+ throw w("loadAssays", new Error("Assay table has missing required values"));
912
+ return Nt(c, [v, q, U]);
910
913
  }
911
- function Nr(e = [], t = [], n = {}) {
912
- const r = Array.isArray(n.onCols) && n.onCols.length ? n.onCols : [z];
914
+ function uo(e = [], t = [], n = {}) {
915
+ const r = Array.isArray(n.onCols) && n.onCols.length ? n.onCols : [v];
913
916
  if (!t.length) return [...e];
914
- const o = (s) => r.map((l) => `${(s == null ? void 0 : s[l]) ?? ""}`).join("|"), i = /* @__PURE__ */ new Map();
917
+ const o = (s) => r.map((c) => `${(s == null ? void 0 : s[c]) ?? ""}`).join("|"), i = /* @__PURE__ */ new Map();
915
918
  return t.forEach((s) => {
916
919
  i.set(o(s), s);
917
920
  }), e.map((s) => {
918
- const l = i.get(o(s));
919
- if (!l) return { ...s };
921
+ const c = i.get(o(s));
922
+ if (!c) return { ...s };
920
923
  const u = { ...s };
921
- return Object.entries(l).forEach(([a, c]) => {
922
- r.includes(a) || (Object.prototype.hasOwnProperty.call(u, a) ? u[`${a}_trace`] = c : u[a] = c);
924
+ return Object.entries(c).forEach(([l, a]) => {
925
+ r.includes(l) || (Object.prototype.hasOwnProperty.call(u, l) ? u[`${l}_trace`] = a : u[l] = a);
923
926
  }), u;
924
927
  });
925
928
  }
926
- function zr(e = [], t = null) {
927
- return t == null ? [...e] : e.length ? e.some((r) => re in r) ? e.filter((r) => (r == null ? void 0 : r[re]) === t) : [...e] : [];
929
+ function mo(e = [], t = null) {
930
+ return t == null ? [...e] : e.length ? e.some((r) => ie in r) ? e.filter((r) => (r == null ? void 0 : r[ie]) === t) : [...e] : [];
928
931
  }
929
- function Mr(e = [], t = []) {
932
+ function fo(e = [], t = []) {
930
933
  return e.map((n) => {
931
934
  const r = { ...n };
932
935
  return t.forEach((o) => {
@@ -936,7 +939,7 @@ function Mr(e = [], t = []) {
936
939
  }), r;
937
940
  });
938
941
  }
939
- function Cr({
942
+ function ho({
940
943
  collars: e = [],
941
944
  surveys: t = [],
942
945
  assays: n = [],
@@ -944,99 +947,153 @@ function Cr({
944
947
  metadata: o = {}
945
948
  } = {}) {
946
949
  return {
947
- collars: ge(e),
948
- surveys: ge(t),
949
- assays: ge(n),
950
- structures: ge(r),
950
+ collars: xe(e),
951
+ surveys: xe(t),
952
+ assays: xe(n),
953
+ structures: xe(r),
951
954
  metadata: o || {}
952
955
  };
953
956
  }
954
- function Ir(e) {
957
+ const zt = ["x", "y", "z", "dx", "dy", "dz"], yn = {
958
+ x: ["x", "easting", "center_x", "xc", "xcentre", "xcenter", "x_centre", "x_center", "cx"],
959
+ y: ["y", "northing", "center_y", "yc", "ycentre", "ycenter", "y_centre", "y_center", "cy"],
960
+ z: ["z", "elevation", "center_z", "zc", "zcentre", "zcenter", "z_centre", "z_center", "cz"],
961
+ dx: ["dx", "size_x", "sx", "sizex", "dim_x", "block_size_x"],
962
+ dy: ["dy", "size_y", "sy", "sizey", "dim_y", "block_size_y"],
963
+ dz: ["dz", "size_z", "sz", "sizez", "dim_z", "block_size_z"]
964
+ }, Mt = {};
965
+ Object.entries(yn).forEach(([e, t]) => {
966
+ t.forEach((n) => {
967
+ Mt[n.toLowerCase()] = e;
968
+ });
969
+ });
970
+ function gn(e) {
971
+ const t = {};
972
+ return Object.entries(e).forEach(([n, r]) => {
973
+ const o = Mt[n.toLowerCase().trim()] || n;
974
+ t[o] = r;
975
+ }), t;
976
+ }
977
+ function po(e) {
955
978
  return new Promise((t, n) => {
956
979
  Z.parse(e, {
957
980
  header: !0,
958
981
  dynamicTyping: !0,
982
+ skipEmptyLines: !0,
959
983
  complete: (r) => {
960
- const o = r.data.filter(
961
- (l) => l.center_x !== null && l.center_y !== null && l.center_z !== null
962
- ), i = ["center_x", "center_y", "center_z", "size_x", "size_y", "size_z"], s = Object.keys(o[0] || {}).filter(
963
- (l) => !i.includes(l)
984
+ const i = (r.data || []).map(gn).filter(
985
+ (c) => c.x !== null && c.y !== null && c.z !== null
986
+ ), s = Object.keys(i[0] || {}).filter(
987
+ (c) => !zt.includes(c)
964
988
  );
965
- t({ data: o, properties: s });
989
+ t({ data: i, properties: s });
966
990
  },
967
991
  error: (r) => {
968
- n($("parseBlockModelCSV", r));
992
+ n(w("parseBlockModelCSV", r));
969
993
  }
970
994
  });
971
995
  });
972
996
  }
973
- function Ar(e, t) {
997
+ function bo(e) {
998
+ if (typeof e == "string")
999
+ try {
1000
+ return JSON.parse(e);
1001
+ } catch (t) {
1002
+ throw w("loadBlockModelMetadata", t);
1003
+ }
1004
+ if (e && typeof e == "object") return e;
1005
+ throw w("loadBlockModelMetadata", new Error("Invalid metadata source"));
1006
+ }
1007
+ function _n(e, t) {
974
1008
  const n = e.map((i) => i[t]).filter((i) => i != null);
975
- if (n.every((i) => typeof i == "number")) {
1009
+ if (n.length > 0 && n.every((i) => typeof i == "number")) {
976
1010
  const i = Math.min(...n), s = Math.max(...n);
977
1011
  return { type: "numeric", min: i, max: s, values: n };
978
1012
  }
979
1013
  return { type: "categorical", categories: [...new Set(n)], values: n };
980
1014
  }
981
- function Zt(e, t, n) {
1015
+ function yo(e) {
1016
+ if (!e || e.length === 0) return {};
1017
+ const t = Object.keys(e[0]).filter(
1018
+ (r) => !zt.includes(r)
1019
+ ), n = {};
1020
+ return t.forEach((r) => {
1021
+ n[r] = _n(e, r);
1022
+ }), n;
1023
+ }
1024
+ function Nn(e, t) {
1025
+ return !t || typeof t != "object" ? e : e.filter(
1026
+ (n) => Object.entries(t).every(([r, o]) => {
1027
+ const i = n[r];
1028
+ return o == null ? !0 : typeof o != "object" || Array.isArray(o) ? i === o : !("gt" in o && !(i > o.gt) || "gte" in o && !(i >= o.gte) || "lt" in o && !(i < o.lt) || "lte" in o && !(i <= o.lte) || "eq" in o && i !== o.eq || "ne" in o && i === o.ne || "in" in o && !o.in.includes(i));
1029
+ })
1030
+ );
1031
+ }
1032
+ function go(e, t = null) {
1033
+ return (t ? Nn(e, t) : e).reduce((r, o) => {
1034
+ const i = Number(o.dx) || 0, s = Number(o.dy) || 0, c = Number(o.dz) || 0;
1035
+ return r + i * s * c;
1036
+ }, 0);
1037
+ }
1038
+ function zn(e, t, n) {
982
1039
  if (!t) return new n.Color("#888888");
983
1040
  if (t.type === "numeric") {
984
- const i = t.max - t.min, l = (1 - (i === 0 ? 0.5 : (e - t.min) / i)) * 240;
985
- return new n.Color().setHSL(l / 360, 0.8, 0.5);
1041
+ const i = t.max - t.min, c = (1 - (i === 0 ? 0.5 : (e - t.min) / i)) * 240;
1042
+ return new n.Color().setHSL(c / 360, 0.8, 0.5);
986
1043
  }
987
1044
  const o = t.categories.indexOf(e) / Math.max(t.categories.length, 1) * 360;
988
1045
  return new n.Color().setHSL(o / 360, 0.7, 0.5);
989
1046
  }
990
- const He = (e, t = null) => ue(e, null, t);
991
- function Wt(e) {
1047
+ const Ue = (e, t = null) => pe(e, null, t);
1048
+ function Mn(e) {
992
1049
  if (!e.length) return null;
993
- const t = e[0], n = B in t && R in t, r = H in t && !n;
1050
+ const t = e[0], n = q in t && U in t, r = Y in t && !n;
994
1051
  return n ? "interval" : r ? "point" : null;
995
1052
  }
996
- function ne(e) {
1053
+ function oe(e) {
997
1054
  const t = Number(e);
998
1055
  return Number.isFinite(t) ? t : null;
999
1056
  }
1000
- function ht(e) {
1001
- const t = e[z] !== void 0 ? `${e[z]}`.trim() : "";
1057
+ function xt(e) {
1058
+ const t = e[v] !== void 0 ? `${e[v]}`.trim() : "";
1002
1059
  if (!t) return null;
1003
- const n = ne(e[H]);
1060
+ const n = oe(e[Y]);
1004
1061
  return n === null ? null : {
1005
- [z]: t,
1006
- [H]: n,
1007
- [k]: ne(e[k]),
1008
- [O]: ne(e[O]),
1062
+ [v]: t,
1063
+ [Y]: n,
1064
+ [G]: oe(e[G]),
1065
+ [B]: oe(e[B]),
1009
1066
  comments: e.comments != null ? `${e.comments}` : null,
1010
1067
  ...e
1011
1068
  };
1012
1069
  }
1013
- function pt(e) {
1014
- const t = e[z] !== void 0 ? `${e[z]}`.trim() : "";
1070
+ function It(e) {
1071
+ const t = e[v] !== void 0 ? `${e[v]}`.trim() : "";
1015
1072
  if (!t) return null;
1016
- const n = ne(e[B]), r = ne(e[R]);
1073
+ const n = oe(e[q]), r = oe(e[U]);
1017
1074
  if (n === null || r === null || r <= n) return null;
1018
1075
  const o = 0.5 * (n + r);
1019
1076
  return {
1020
- [z]: t,
1021
- [B]: n,
1022
- [R]: r,
1077
+ [v]: t,
1078
+ [q]: n,
1079
+ [U]: r,
1023
1080
  mid: o,
1024
- [k]: ne(e[k]),
1025
- [O]: ne(e[O]),
1081
+ [G]: oe(e[G]),
1082
+ [B]: oe(e[B]),
1026
1083
  classification: e.classification != null ? `${e.classification}` : null,
1027
1084
  comments: e.comments != null ? `${e.comments}` : null,
1028
1085
  ...e
1029
1086
  };
1030
1087
  }
1031
- function Sr(e) {
1088
+ function _o(e) {
1032
1089
  const t = [], n = [];
1033
1090
  for (const r of e) {
1034
- const o = [], i = ne(r[k]), s = ne(r[O]);
1091
+ const o = [], i = oe(r[G]), s = oe(r[B]);
1035
1092
  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);
1036
1093
  }
1037
1094
  return { valid: t, errors: n };
1038
1095
  }
1039
- function Er(e, t = null) {
1096
+ function No(e, t = null) {
1040
1097
  return new Promise((n, r) => {
1041
1098
  const o = {
1042
1099
  header: !0,
@@ -1044,19 +1101,19 @@ function Er(e, t = null) {
1044
1101
  skipEmptyLines: !0,
1045
1102
  complete: (i) => {
1046
1103
  const s = [];
1047
- for (const l of i.data) {
1048
- const u = He(l, t), a = ht(u);
1049
- a && s.push(a);
1104
+ for (const c of i.data) {
1105
+ const u = Ue(c, t), l = xt(u);
1106
+ l && s.push(l);
1050
1107
  }
1051
1108
  n(s);
1052
1109
  },
1053
- error: (i) => r($("parseStructuralPointsCSV", i))
1110
+ error: (i) => r(w("parseStructuralPointsCSV", i))
1054
1111
  };
1055
1112
  typeof e == "string" && !e.startsWith("data:") && e.includes(`
1056
1113
  `) ? Z.parse(e, o) : Z.parse(e, o);
1057
1114
  });
1058
1115
  }
1059
- function vr(e, t = null) {
1116
+ function zo(e, t = null) {
1060
1117
  return new Promise((n, r) => {
1061
1118
  Z.parse(e, {
1062
1119
  header: !0,
@@ -1065,16 +1122,16 @@ function vr(e, t = null) {
1065
1122
  complete: (o) => {
1066
1123
  const i = [];
1067
1124
  for (const s of o.data) {
1068
- const l = He(s, t), u = pt(l);
1125
+ const c = Ue(s, t), u = It(c);
1069
1126
  u && i.push(u);
1070
1127
  }
1071
1128
  n(i);
1072
1129
  },
1073
- error: (o) => r($("parseStructuralIntervalsCSV", o))
1130
+ error: (o) => r(w("parseStructuralIntervalsCSV", o))
1074
1131
  });
1075
1132
  });
1076
1133
  }
1077
- function Kt(e, t = z) {
1134
+ function xn(e, t = v) {
1078
1135
  const n = /* @__PURE__ */ new Map();
1079
1136
  for (const r of e) {
1080
1137
  const o = r[t] != null ? String(r[t]).trim() : "";
@@ -1082,33 +1139,33 @@ function Kt(e, t = z) {
1082
1139
  }
1083
1140
  return Array.from(n.values());
1084
1141
  }
1085
- function Jt(e, t = null) {
1142
+ function In(e, t = null) {
1086
1143
  return new Promise((n, r) => {
1087
1144
  Z.parse(e, {
1088
1145
  header: !0,
1089
1146
  dynamicTyping: !0,
1090
1147
  skipEmptyLines: !0,
1091
1148
  complete: (o) => {
1092
- const i = o.data.map((u) => He(u, t)), s = Wt(i);
1149
+ const i = o.data.map((u) => Ue(u, t)), s = Mn(i);
1093
1150
  if (!s) {
1094
- r($(
1151
+ r(w(
1095
1152
  "parseStructuralCSV",
1096
1153
  new Error("Structural CSV requires either 'depth' (point) or 'from'/'to' (interval) columns")
1097
1154
  ));
1098
1155
  return;
1099
1156
  }
1100
- const l = [];
1157
+ const c = [];
1101
1158
  for (const u of i) {
1102
- const a = s === "interval" ? pt(u) : ht(u);
1103
- a && l.push(a);
1159
+ const l = s === "interval" ? It(u) : xt(u);
1160
+ l && c.push(l);
1104
1161
  }
1105
- n({ schema: s, rows: l });
1162
+ n({ schema: s, rows: c });
1106
1163
  },
1107
- error: (o) => r($("parseStructuralCSV", o))
1164
+ error: (o) => r(w("parseStructuralCSV", o))
1108
1165
  });
1109
1166
  });
1110
1167
  }
1111
- function Qt(e) {
1168
+ function An(e) {
1112
1169
  return new Promise((t) => {
1113
1170
  Z.parse(e, {
1114
1171
  header: !0,
@@ -1117,113 +1174,113 @@ function Qt(e) {
1117
1174
  complete: (n) => {
1118
1175
  const r = /* @__PURE__ */ new Map();
1119
1176
  for (const i of n.data) {
1120
- const s = ue(i), l = s[z] != null ? `${s[z]}`.trim() : "";
1121
- if (!l) continue;
1122
- const u = Number(s[B]), a = Number(s[R]);
1123
- if (!Number.isFinite(u) || !Number.isFinite(a) || a <= u) continue;
1124
- const c = (u + a) / 2, { [k]: m, [O]: d, ...f } = s, y = {
1177
+ const s = pe(i), c = s[v] != null ? `${s[v]}`.trim() : "";
1178
+ if (!c) continue;
1179
+ const u = Number(s[q]), l = Number(s[U]);
1180
+ if (!Number.isFinite(u) || !Number.isFinite(l) || l <= u) continue;
1181
+ const a = (u + l) / 2, { [G]: d, [B]: m, ...f } = s, b = {
1125
1182
  ...f,
1126
- [z]: l,
1127
- [B]: u,
1128
- [R]: a,
1129
- [Ve]: c,
1130
- [H]: c,
1183
+ [v]: c,
1184
+ [q]: u,
1185
+ [U]: l,
1186
+ [je]: a,
1187
+ [Y]: a,
1131
1188
  // unified depth field for y-axis rendering
1132
1189
  _source: "assay"
1133
1190
  };
1134
- r.has(l) || r.set(l, []), r.get(l).push(y);
1191
+ r.has(c) || r.set(c, []), r.get(c).push(b);
1135
1192
  }
1136
1193
  const o = Array.from(r.entries()).map(([i, s]) => ({
1137
1194
  holeId: i,
1138
- points: s.sort((l, u) => l[B] - u[B])
1195
+ points: s.sort((c, u) => c[q] - u[q])
1139
1196
  }));
1140
1197
  t(o);
1141
1198
  }
1142
1199
  });
1143
1200
  });
1144
1201
  }
1145
- async function Pr({ assayCsv: e, structuralCsv: t } = {}) {
1202
+ async function Mo({ assayCsv: e, structuralCsv: t } = {}) {
1146
1203
  const [n, r] = await Promise.all([
1147
- e ? Qt(e) : Promise.resolve([]),
1148
- t ? Jt(t).then(
1149
- ({ rows: i }) => Kt(i.map((s) => ({ ...s, _source: "structural" })))
1204
+ e ? An(e) : Promise.resolve([]),
1205
+ t ? In(t).then(
1206
+ ({ rows: i }) => xn(i.map((s) => ({ ...s, _source: "structural" })))
1150
1207
  ) : Promise.resolve([])
1151
1208
  ]), o = new Map(n.map((i) => [i.holeId, { ...i, points: [...i.points] }]));
1152
1209
  for (const i of r) {
1153
1210
  const s = i.holeId;
1154
1211
  if (s)
1155
1212
  if (o.has(s)) {
1156
- const l = o.get(s);
1157
- o.set(s, { ...l, points: [...l.points, ...i.points || []] });
1213
+ const c = o.get(s);
1214
+ o.set(s, { ...c, points: [...c.points, ...i.points || []] });
1158
1215
  } else
1159
1216
  o.set(s, i);
1160
1217
  }
1161
1218
  return { holes: Array.from(o.values()) };
1162
1219
  }
1163
- function en(e, t) {
1220
+ function En(e, t) {
1164
1221
  if (!e || e.length === 0 || !Number.isFinite(t)) return null;
1165
1222
  const n = e.length;
1166
1223
  if (n === 1) {
1167
- const b = e[0];
1168
- return { x: Number(b.x), y: Number(b.y), z: Number(b.z), dx: 0, dy: 0, dz: -1 };
1224
+ const y = e[0];
1225
+ return { x: Number(y.x), y: Number(y.y), z: Number(y.z), dx: 0, dy: 0, dz: -1 };
1169
1226
  }
1170
1227
  let r = -1;
1171
- for (let b = 0; b < n - 1; b++) {
1172
- const _ = Number(e[b].md), I = Number(e[b + 1].md);
1173
- if (t >= _ && t <= I) {
1174
- r = b;
1228
+ for (let y = 0; y < n - 1; y++) {
1229
+ const E = Number(e[y].md), M = Number(e[y + 1].md);
1230
+ if (t >= E && t <= M) {
1231
+ r = y;
1175
1232
  break;
1176
1233
  }
1177
1234
  }
1178
1235
  let o, i, s;
1179
1236
  if (r === -1) {
1180
1237
  t < Number(e[0].md) ? (o = e[0], i = e[1]) : (o = e[n - 2], i = e[n - 1]);
1181
- const b = Number(o.md), I = Number(i.md) - b;
1182
- s = I > 0 ? (t - b) / I : t < b ? 0 : 1;
1238
+ const y = Number(o.md), M = Number(i.md) - y;
1239
+ s = M > 0 ? (t - y) / M : t < y ? 0 : 1;
1183
1240
  } else {
1184
1241
  o = e[r], i = e[r + 1];
1185
- const b = Number(o.md), I = Number(i.md) - b;
1186
- s = I > 0 ? (t - b) / I : 0;
1187
- }
1188
- const l = Number(o.x) + s * (Number(i.x) - Number(o.x)), u = Number(o.y) + s * (Number(i.y) - Number(o.y)), a = Number(o.z) + s * (Number(i.z) - Number(o.z));
1189
- let c, m, d;
1190
- const f = Number(o.azimuth), y = Number(o.dip), p = Number(i.azimuth), h = Number(i.dip);
1191
- if (Number.isFinite(f) && Number.isFinite(y)) {
1192
- const b = Number.isFinite(p) && Number.isFinite(h) ? f + s * (p - f) : f, _ = Number.isFinite(p) && Number.isFinite(h) ? y + s * (h - y) : y, I = b * Math.PI / 180, N = _ * Math.PI / 180;
1193
- c = Math.cos(N) * Math.sin(I), m = Math.cos(N) * Math.cos(I), d = -Math.sin(N);
1242
+ const y = Number(o.md), M = Number(i.md) - y;
1243
+ s = M > 0 ? (t - y) / M : 0;
1244
+ }
1245
+ const c = Number(o.x) + s * (Number(i.x) - Number(o.x)), u = Number(o.y) + s * (Number(i.y) - Number(o.y)), l = Number(o.z) + s * (Number(i.z) - Number(o.z));
1246
+ let a, d, m;
1247
+ const f = Number(o.azimuth), b = Number(o.dip), p = Number(i.azimuth), h = Number(i.dip);
1248
+ if (Number.isFinite(f) && Number.isFinite(b)) {
1249
+ const y = Number.isFinite(p) && Number.isFinite(h) ? f + s * (p - f) : f, E = Number.isFinite(p) && Number.isFinite(h) ? b + s * (h - b) : b, M = y * Math.PI / 180, z = E * Math.PI / 180;
1250
+ a = Math.cos(z) * Math.sin(M), d = Math.cos(z) * Math.cos(M), m = -Math.sin(z);
1194
1251
  } else {
1195
- const b = Number(i.x) - Number(o.x), _ = Number(i.y) - Number(o.y), I = Number(i.z) - Number(o.z), N = Math.sqrt(b * b + _ * _ + I * I);
1196
- if (N < 1e-10) return { x: l, y: u, z: a, dx: 0, dy: 0, dz: -1 };
1197
- c = b / N, m = _ / N, d = I / N;
1198
- }
1199
- const g = Math.sqrt(c * c + m * m + d * d);
1200
- return g < 1e-10 ? { x: l, y: u, z: a, dx: 0, dy: 0, dz: -1 } : { x: l, y: u, z: a, dx: c / g, dy: m / g, dz: d / g };
1201
- }
1202
- function tn(e, t, n, r = {}) {
1203
- const { betaZeroAxis: o = "B", betaHandedness: i = 1 } = r, { dx: s, dy: l, dz: u } = n, a = [s, l, u];
1204
- let c = [0, 0, 1];
1205
- const m = a[0] * c[0] + a[1] * c[1] + a[2] * c[2];
1206
- Math.abs(m) > 0.99 && (c = [0, 1, 0]);
1207
- const d = [
1208
- c[1] * a[2] - c[2] * a[1],
1209
- c[2] * a[0] - c[0] * a[2],
1210
- c[0] * a[1] - c[1] * a[0]
1211
- ], f = Math.sqrt(d[0] ** 2 + d[1] ** 2 + d[2] ** 2), y = f > 1e-10 ? [d[0] / f, d[1] / f, d[2] / f] : [1, 0, 0], p = [
1212
- a[1] * y[2] - a[2] * y[1],
1213
- a[2] * y[0] - a[0] * y[2],
1214
- a[0] * y[1] - a[1] * y[0]
1215
- ], h = Math.sqrt(p[0] ** 2 + p[1] ** 2 + p[2] ** 2), g = h > 1e-10 ? [p[0] / h, p[1] / h, p[2] / h] : [0, 1, 0], b = o === "R" ? y : g, _ = t * Math.PI / 180 * i, I = Math.cos(_), N = Math.sin(_), P = b[0] * a[0] + b[1] * a[1] + b[2] * a[2], E = [
1216
- a[1] * b[2] - a[2] * b[1],
1217
- a[2] * b[0] - a[0] * b[2],
1218
- a[0] * b[1] - a[1] * b[0]
1219
- ], M = [
1220
- b[0] * I + E[0] * N + a[0] * P * (1 - I),
1221
- b[1] * I + E[1] * N + a[1] * P * (1 - I),
1222
- b[2] * I + E[2] * N + a[2] * P * (1 - I)
1223
- ], F = (90 - e) * Math.PI / 180, j = Math.cos(F), W = Math.sin(F), D = j * M[0] + W * a[0], G = j * M[1] + W * a[1], U = j * M[2] + W * a[2], S = Math.sqrt(D * D + G * G + U * U);
1224
- return S < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: D / S, ny: G / S, nz: U / S };
1225
- }
1226
- function nn(e, t, n = {}) {
1252
+ const y = Number(i.x) - Number(o.x), E = Number(i.y) - Number(o.y), M = Number(i.z) - Number(o.z), z = Math.sqrt(y * y + E * E + M * M);
1253
+ if (z < 1e-10) return { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 };
1254
+ a = y / z, d = E / z, m = M / z;
1255
+ }
1256
+ const N = Math.sqrt(a * a + d * d + m * m);
1257
+ return N < 1e-10 ? { x: c, y: u, z: l, dx: 0, dy: 0, dz: -1 } : { x: c, y: u, z: l, dx: a / N, dy: d / N, dz: m / N };
1258
+ }
1259
+ function vn(e, t, n, r = {}) {
1260
+ const { betaZeroAxis: o = "B", betaHandedness: i = 1 } = r, { dx: s, dy: c, dz: u } = n, l = [s, c, u];
1261
+ let a = [0, 0, 1];
1262
+ const d = l[0] * a[0] + l[1] * a[1] + l[2] * a[2];
1263
+ Math.abs(d) > 0.99 && (a = [0, 1, 0]);
1264
+ const m = [
1265
+ a[1] * l[2] - a[2] * l[1],
1266
+ a[2] * l[0] - a[0] * l[2],
1267
+ a[0] * l[1] - a[1] * l[0]
1268
+ ], f = Math.sqrt(m[0] ** 2 + m[1] ** 2 + m[2] ** 2), b = f > 1e-10 ? [m[0] / f, m[1] / f, m[2] / f] : [1, 0, 0], p = [
1269
+ l[1] * b[2] - l[2] * b[1],
1270
+ l[2] * b[0] - l[0] * b[2],
1271
+ l[0] * b[1] - l[1] * b[0]
1272
+ ], h = Math.sqrt(p[0] ** 2 + p[1] ** 2 + p[2] ** 2), N = h > 1e-10 ? [p[0] / h, p[1] / h, p[2] / h] : [0, 1, 0], y = o === "R" ? b : N, E = t * Math.PI / 180 * i, M = Math.cos(E), z = Math.sin(E), P = y[0] * l[0] + y[1] * l[1] + y[2] * l[2], D = [
1273
+ l[1] * y[2] - l[2] * y[1],
1274
+ l[2] * y[0] - l[0] * y[2],
1275
+ l[0] * y[1] - l[1] * y[0]
1276
+ ], x = [
1277
+ y[0] * M + D[0] * z + l[0] * P * (1 - M),
1278
+ y[1] * M + D[1] * z + l[1] * P * (1 - M),
1279
+ y[2] * M + D[2] * z + l[2] * P * (1 - M)
1280
+ ], V = (90 - e) * Math.PI / 180, H = Math.cos(V), W = Math.sin(V), O = H * x[0] + W * l[0], $ = H * x[1] + W * l[1], j = H * x[2] + W * l[2], S = Math.sqrt(O * O + $ * $ + j * j);
1281
+ return S < 1e-10 ? { nx: 0, ny: 0, nz: 1 } : { nx: O / S, ny: $ / S, nz: j / S };
1282
+ }
1283
+ function Sn(e, t, n = {}) {
1227
1284
  if (!(e != null && e.length) || !(t != null && t.length)) return [];
1228
1285
  const r = /* @__PURE__ */ new Map();
1229
1286
  for (const i of t) {
@@ -1231,69 +1288,69 @@ function nn(e, t, n = {}) {
1231
1288
  s && (r.has(s) || r.set(s, []), r.get(s).push(i));
1232
1289
  }
1233
1290
  for (const [, i] of r)
1234
- i.sort((s, l) => Number(s.md) - Number(l.md));
1291
+ i.sort((s, c) => Number(s.md) - Number(c.md));
1235
1292
  const o = [];
1236
1293
  for (const i of e) {
1237
1294
  const s = i.hole_id != null ? `${i.hole_id}`.trim().toLowerCase() : "";
1238
1295
  if (!s) continue;
1239
- const l = r.get(s);
1240
- if (!l || l.length === 0) continue;
1296
+ const c = r.get(s);
1297
+ if (!c || c.length === 0) continue;
1241
1298
  const u = i.depth != null ? Number(i.depth) : i.mid != null ? Number(i.mid) : null;
1242
1299
  if (!Number.isFinite(u)) continue;
1243
- const a = en(l, u);
1244
- if (!a) continue;
1245
- const { x: c, y: m, z: d, dx: f, dy: y, dz: p } = a;
1246
- let h, g, b;
1247
- const _ = i.alpha != null ? Number(i.alpha) : null, I = i.beta != null ? Number(i.beta) : null;
1248
- if (Number.isFinite(_)) {
1249
- const N = Number.isFinite(I) ? I : 0, P = tn(_, N, { dx: f, dy: y, dz: p }, n);
1250
- h = P.nx, g = P.ny, b = P.nz;
1300
+ const l = En(c, u);
1301
+ if (!l) continue;
1302
+ const { x: a, y: d, z: m, dx: f, dy: b, dz: p } = l;
1303
+ let h, N, y;
1304
+ const E = i.alpha != null ? Number(i.alpha) : null, M = i.beta != null ? Number(i.beta) : null;
1305
+ if (Number.isFinite(E)) {
1306
+ const z = Number.isFinite(M) ? M : 0, P = vn(E, z, { dx: f, dy: b, dz: p }, n);
1307
+ h = P.nx, N = P.ny, y = P.nz;
1251
1308
  } else {
1252
- const N = i.dip != null ? Number(i.dip) : null, P = i.azimuth != null ? Number(i.azimuth) : null;
1253
- if (!Number.isFinite(N) || !Number.isFinite(P)) continue;
1254
- const E = N * Math.PI / 180, M = P * Math.PI / 180;
1255
- h = Math.sin(M) * Math.sin(E), g = Math.cos(M) * Math.sin(E), b = Math.cos(E);
1309
+ const z = i.dip != null ? Number(i.dip) : null, P = i.azimuth != null ? Number(i.azimuth) : null;
1310
+ if (!Number.isFinite(z) || !Number.isFinite(P)) continue;
1311
+ const D = z * Math.PI / 180, x = P * Math.PI / 180;
1312
+ h = Math.sin(x) * Math.sin(D), N = Math.cos(x) * Math.sin(D), y = Math.cos(D);
1256
1313
  }
1257
- o.push({ ...i, x: c, y: m, z: d, nx: h, ny: g, nz: b });
1314
+ o.push({ ...i, x: a, y: d, z: m, nx: h, ny: N, nz: y });
1258
1315
  }
1259
1316
  return o;
1260
1317
  }
1261
- const We = "#8b1e3f", rn = "#a8324f", on = "#6b7280", sn = { l: 4, r: 4, t: 4, b: 4 }, Ke = 10, Je = 12;
1262
- function Qe(e) {
1318
+ const tt = "#8b1e3f", Pn = "#a8324f", Dn = "#6b7280", kn = { l: 4, r: 4, t: 4, b: 4 }, nt = 10, rt = 12;
1319
+ function ot(e) {
1263
1320
  return e ? typeof e == "string" ? { text: e } : e : {};
1264
1321
  }
1265
- function yt(e = {}) {
1266
- const t = Qe(e.xaxis && e.xaxis.title), n = Qe(e.yaxis && e.yaxis.title);
1322
+ function At(e = {}) {
1323
+ const t = ot(e.xaxis && e.xaxis.title), n = ot(e.yaxis && e.yaxis.title);
1267
1324
  return {
1268
1325
  ...e,
1269
- margin: sn,
1326
+ margin: kn,
1270
1327
  autosize: !0,
1271
1328
  width: void 0,
1272
1329
  xaxis: {
1273
1330
  ...e.xaxis || {},
1274
1331
  tickfont: {
1275
1332
  ...e.xaxis && e.xaxis.tickfont || {},
1276
- size: Ke
1333
+ size: nt
1277
1334
  },
1278
1335
  title: {
1279
1336
  ...t,
1280
- font: { ...t.font || {}, size: Je }
1337
+ font: { ...t.font || {}, size: rt }
1281
1338
  }
1282
1339
  },
1283
1340
  yaxis: {
1284
1341
  ...e.yaxis || {},
1285
1342
  tickfont: {
1286
1343
  ...e.yaxis && e.yaxis.tickfont || {},
1287
- size: Ke
1344
+ size: nt
1288
1345
  },
1289
1346
  title: {
1290
1347
  ...n,
1291
- font: { ...n.font || {}, size: Je }
1348
+ font: { ...n.font || {}, size: rt }
1292
1349
  }
1293
1350
  }
1294
1351
  };
1295
1352
  }
1296
- function an(e, t) {
1353
+ function Cn(e, t) {
1297
1354
  var r;
1298
1355
  if (!e || !t) return !1;
1299
1356
  const n = e.points || [];
@@ -1304,115 +1361,115 @@ function an(e, t) {
1304
1361
  }
1305
1362
  return !1;
1306
1363
  }
1307
- function ln(e, t, n) {
1364
+ function Ln(e, t, n) {
1308
1365
  if (!e || !t) return [];
1309
1366
  const r = (e == null ? void 0 : e.points) || [], o = [], i = /* @__PURE__ */ new Set();
1310
1367
  return r.forEach((s) => {
1311
- let l = Number(
1368
+ let c = Number(
1312
1369
  s.from ?? s.samp_from ?? s.sample_from ?? s.fromdepth ?? s.from_depth ?? s.depth_from
1313
1370
  ), u = Number(
1314
1371
  s.to ?? s.samp_to ?? s.sample_to ?? s.todepth ?? s.to_depth ?? s.depth_to
1315
1372
  );
1316
- if (!Number.isFinite(l) || !Number.isFinite(u)) {
1373
+ if (!Number.isFinite(c) || !Number.isFinite(u)) {
1317
1374
  const f = Number(s.depth ?? s.md);
1318
- Number.isFinite(f) && (l = f, u = f);
1375
+ Number.isFinite(f) && (c = f, u = f);
1319
1376
  }
1320
- const a = s == null ? void 0 : s[t];
1321
- if (!Number.isFinite(l) || !Number.isFinite(u) || u < l || a == null || a === "" || n && typeof a == "string" && /^(nan|null|none)$/i.test(a.trim())) return;
1322
- const c = `${t}:${l}-${u}`;
1323
- if (i.has(c)) return;
1324
- i.add(c);
1325
- const m = (l + u) / 2, d = n ? a : Number(a);
1326
- !n && !Number.isFinite(d) || o.push({
1327
- z: m,
1328
- val: d,
1329
- from: l,
1377
+ const l = s == null ? void 0 : s[t];
1378
+ if (!Number.isFinite(c) || !Number.isFinite(u) || u < c || l == null || l === "" || n && typeof l == "string" && /^(nan|null|none)$/i.test(l.trim())) return;
1379
+ const a = `${t}:${c}-${u}`;
1380
+ if (i.has(a)) return;
1381
+ i.add(a);
1382
+ const d = (c + u) / 2, m = n ? l : Number(l);
1383
+ !n && !Number.isFinite(m) || o.push({
1384
+ z: d,
1385
+ val: m,
1386
+ from: c,
1330
1387
  to: u,
1331
- errorPlus: u - m,
1332
- errorMinus: m - l
1388
+ errorPlus: u - d,
1389
+ errorMinus: d - c
1333
1390
  });
1334
- }), o.sort((s, l) => l.z - s.z);
1391
+ }), o.sort((s, c) => c.z - s.z);
1335
1392
  }
1336
- function cn(e, t) {
1393
+ function On(e, t) {
1337
1394
  if (!e.length) return { data: [], layout: {} };
1338
- const n = [...e].sort((c, m) => m.z - c.z), r = [];
1339
- for (let c = 0; c < n.length; c += 1) {
1340
- const m = n[c], d = n[c + 1], f = m.z, y = d ? d.z : m.z - 20;
1341
- if (y === f) continue;
1342
- const p = m.val == null ? "" : String(m.val).trim();
1343
- !p || /^(nan|null|none)$/i.test(p) || r.push({ y0: f, y1: y, category: p, fromVal: m.from, toVal: m.to });
1344
- }
1345
- const o = ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7", "#9c755f", "#bab0ac", "#d4a6c8", "#86bcb6"], i = [...new Set(r.map((c) => c.category))], s = Object.fromEntries(
1346
- i.map((c, m) => [c, o[m % o.length]])
1347
- ), l = r.map((c) => ({
1395
+ const n = [...e].sort((a, d) => d.z - a.z), r = [];
1396
+ for (let a = 0; a < n.length; a += 1) {
1397
+ const d = n[a], m = n[a + 1], f = d.z, b = m ? m.z : d.z - 20;
1398
+ if (b === f) continue;
1399
+ const p = d.val == null ? "" : String(d.val).trim();
1400
+ !p || /^(nan|null|none)$/i.test(p) || r.push({ y0: f, y1: b, category: p, fromVal: d.from, toVal: d.to });
1401
+ }
1402
+ const o = ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7", "#9c755f", "#bab0ac", "#d4a6c8", "#86bcb6"], i = [...new Set(r.map((a) => a.category))], s = Object.fromEntries(
1403
+ i.map((a, d) => [a, o[d % o.length]])
1404
+ ), c = r.map((a) => ({
1348
1405
  type: "rect",
1349
1406
  xref: "x",
1350
1407
  yref: "y",
1351
1408
  x0: 0,
1352
1409
  x1: 1,
1353
- y0: c.y0,
1354
- y1: c.y1,
1355
- fillcolor: s[c.category],
1410
+ y0: a.y0,
1411
+ y1: a.y1,
1412
+ fillcolor: s[a.category],
1356
1413
  line: { width: 0 }
1357
1414
  }));
1358
1415
  return { data: [{
1359
1416
  x: r.map(() => 0.5),
1360
- y: r.map((c) => (c.y0 + c.y1) / 2),
1417
+ y: r.map((a) => (a.y0 + a.y1) / 2),
1361
1418
  mode: "text",
1362
- text: r.map((c) => c.category),
1419
+ text: r.map((a) => a.category),
1363
1420
  textposition: "middle center",
1364
1421
  showlegend: !1,
1365
1422
  hoverinfo: "text",
1366
- customdata: r.map((c) => [Math.min(c.fromVal, c.toVal), Math.max(c.fromVal, c.toVal)]),
1423
+ customdata: r.map((a) => [Math.min(a.fromVal, a.toVal), Math.max(a.fromVal, a.toVal)]),
1367
1424
  hovertemplate: "Category: %{text}<br>from: %{customdata[0]} to: %{customdata[1]}<extra></extra>"
1368
- }], layout: yt({
1425
+ }], layout: At({
1369
1426
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
1370
1427
  yaxis: { title: "Depth (m)", autorange: "reversed", zeroline: !1 },
1371
- shapes: l,
1428
+ shapes: c,
1372
1429
  showlegend: !1,
1373
1430
  title: t || void 0
1374
1431
  }) };
1375
1432
  }
1376
- function un(e, t, n) {
1433
+ function Tn(e, t, n) {
1377
1434
  if (!e.length) return { data: [], layout: {} };
1378
1435
  const r = n === "bar", o = n === "markers", i = n === "line", s = {
1379
- x: e.map((c) => c.val),
1380
- y: e.map((c) => c.z),
1436
+ x: e.map((a) => a.val),
1437
+ y: e.map((a) => a.z),
1381
1438
  hovertemplate: `${t}: %{x}<br>from: %{customdata[0]} to: %{customdata[1]}<extra></extra>`,
1382
- customdata: e.map((c) => [Math.min(c.from, c.to), Math.max(c.from, c.to)])
1383
- }, l = {
1439
+ customdata: e.map((a) => [Math.min(a.from, a.to), Math.max(a.from, a.to)])
1440
+ }, c = {
1384
1441
  type: "data",
1385
1442
  symmetric: !1,
1386
- array: e.map((c) => c.errorPlus),
1387
- arrayminus: e.map((c) => c.errorMinus),
1443
+ array: e.map((a) => a.errorPlus),
1444
+ arrayminus: e.map((a) => a.errorMinus),
1388
1445
  thickness: 1.5,
1389
1446
  width: 2,
1390
- color: on
1447
+ color: Dn
1391
1448
  };
1392
1449
  return { data: [r ? {
1393
1450
  ...s,
1394
1451
  type: "bar",
1395
1452
  orientation: "h",
1396
- marker: { color: We },
1397
- error_y: l
1453
+ marker: { color: tt },
1454
+ error_y: c
1398
1455
  } : {
1399
1456
  ...s,
1400
1457
  type: "scatter",
1401
1458
  mode: o ? "markers" : i ? "lines" : "lines+markers",
1402
- line: { color: We, width: 2 },
1403
- marker: { size: 7, color: rn },
1404
- error_y: i ? void 0 : l
1405
- }], layout: yt({
1459
+ line: { color: tt, width: 2 },
1460
+ marker: { size: 7, color: Pn },
1461
+ error_y: i ? void 0 : c
1462
+ }], layout: At({
1406
1463
  xaxis: { title: t, zeroline: !1 },
1407
1464
  yaxis: { title: "Depth (m)", autorange: "reversed", zeroline: !1 },
1408
1465
  barmode: "overlay",
1409
1466
  showlegend: !1
1410
1467
  }) };
1411
1468
  }
1412
- function mn({ points: e, isCategorical: t, property: n, chartType: r }) {
1413
- return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? cn(e, n) : un(e, n, r);
1469
+ function Fn({ points: e, isCategorical: t, property: n, chartType: r }) {
1470
+ return !e || !e.length || !n ? { data: [], layout: {} } : t || r === "categorical" ? On(e, n) : Tn(e, n, r);
1414
1471
  }
1415
- const bt = [
1472
+ const Et = [
1416
1473
  "#0f172a",
1417
1474
  "#1e3a5f",
1418
1475
  "#7c3aed",
@@ -1423,24 +1480,24 @@ const bt = [
1423
1480
  "#db2777",
1424
1481
  "#65a30d",
1425
1482
  "#9333ea"
1426
- ], dn = { l: 4, r: 4, t: 4, b: 4 }, et = 10, tt = 12;
1427
- function gt(e = {}) {
1483
+ ], Vn = { l: 4, r: 4, t: 4, b: 4 }, it = 10, st = 12;
1484
+ function vt(e = {}) {
1428
1485
  return {
1429
1486
  ...e,
1430
- margin: dn,
1487
+ margin: Vn,
1431
1488
  autosize: !0,
1432
1489
  width: void 0,
1433
1490
  xaxis: {
1434
1491
  ...e.xaxis || {},
1435
1492
  tickfont: {
1436
1493
  ...e.xaxis && e.xaxis.tickfont || {},
1437
- size: et
1494
+ size: it
1438
1495
  },
1439
1496
  title: {
1440
1497
  ...e.xaxis && e.xaxis.title || {},
1441
1498
  font: {
1442
1499
  ...e.xaxis && e.xaxis.title && e.xaxis.title.font || {},
1443
- size: tt
1500
+ size: st
1444
1501
  }
1445
1502
  }
1446
1503
  },
@@ -1448,66 +1505,66 @@ function gt(e = {}) {
1448
1505
  ...e.yaxis || {},
1449
1506
  tickfont: {
1450
1507
  ...e.yaxis && e.yaxis.tickfont || {},
1451
- size: et
1508
+ size: it
1452
1509
  },
1453
1510
  title: {
1454
1511
  ...e.yaxis && e.yaxis.title || {},
1455
1512
  font: {
1456
1513
  ...e.yaxis && e.yaxis.title && e.yaxis.title.font || {},
1457
- size: tt
1514
+ size: st
1458
1515
  }
1459
1516
  }
1460
1517
  }
1461
1518
  };
1462
1519
  }
1463
- function fn(e, {
1520
+ function wn(e, {
1464
1521
  tailScale: t = 5,
1465
1522
  colorBy: n = null,
1466
- palette: r = bt,
1467
- depthCol: o = H,
1468
- dipCol: i = k,
1469
- azCol: s = O
1523
+ palette: r = Et,
1524
+ depthCol: o = Y,
1525
+ dipCol: i = G,
1526
+ azCol: s = B
1470
1527
  } = {}) {
1471
- const l = e.filter(
1472
- (y) => y[o] != null && y[i] != null && y[s] != null
1528
+ const c = e.filter(
1529
+ (b) => b[o] != null && b[i] != null && b[s] != null
1473
1530
  );
1474
- if (!l.length)
1531
+ if (!c.length)
1475
1532
  return { data: [], layout: {} };
1476
1533
  const u = {};
1477
- n && [...new Set(l.map((p) => p[n]).filter((p) => p != null))].sort().forEach((p, h) => {
1534
+ n && [...new Set(c.map((p) => p[n]).filter((p) => p != null))].sort().forEach((p, h) => {
1478
1535
  u[p] = r[h % r.length];
1479
1536
  });
1480
- const a = /* @__PURE__ */ new Map(), c = [];
1481
- for (const y of l) {
1482
- const p = Number(y[o]), h = Number(y[i]), g = Number(y[s]), b = n ? y[n] ?? "_default" : "_default", _ = n ? u[b] ?? "#0f172a" : "#0f172a";
1483
- a.has(b) || a.set(b, { xs: [], ys: [], dips: [], azs: [], color: _ });
1484
- const I = a.get(b);
1485
- I.xs.push(h), I.ys.push(p), I.dips.push(h), I.azs.push(g);
1486
- const N = g * Math.PI / 180, P = t * (Math.abs(h) / 90), E = Math.sin(N) * P, M = Math.cos(N) * P;
1487
- c.push({
1537
+ const l = /* @__PURE__ */ new Map(), a = [];
1538
+ for (const b of c) {
1539
+ const p = Number(b[o]), h = Number(b[i]), N = Number(b[s]), y = n ? b[n] ?? "_default" : "_default", E = n ? u[y] ?? "#0f172a" : "#0f172a";
1540
+ l.has(y) || l.set(y, { xs: [], ys: [], dips: [], azs: [], color: E });
1541
+ const M = l.get(y);
1542
+ M.xs.push(h), M.ys.push(p), M.dips.push(h), M.azs.push(N);
1543
+ const z = N * Math.PI / 180, P = t * (Math.abs(h) / 90), D = Math.sin(z) * P, x = Math.cos(z) * P;
1544
+ a.push({
1488
1545
  type: "line",
1489
1546
  x0: h,
1490
1547
  y0: p,
1491
- x1: h + E,
1492
- y1: p + M,
1493
- line: { color: _, width: 2 }
1548
+ x1: h + D,
1549
+ y1: p + x,
1550
+ line: { color: E, width: 2 }
1494
1551
  });
1495
1552
  }
1496
- const m = [], d = n && a.size > 1;
1497
- for (const [y, p] of a.entries())
1498
- m.push({
1553
+ const d = [], m = n && l.size > 1;
1554
+ for (const [b, p] of l.entries())
1555
+ d.push({
1499
1556
  type: "scatter",
1500
1557
  x: p.xs,
1501
1558
  y: p.ys,
1502
1559
  mode: "markers",
1503
- name: y !== "_default" ? String(y) : void 0,
1560
+ name: b !== "_default" ? String(b) : void 0,
1504
1561
  marker: { size: 8, color: p.color },
1505
- showlegend: d && y !== "_default",
1506
- customdata: p.dips.map((h, g) => [h, p.azs[g]]),
1562
+ showlegend: m && b !== "_default",
1563
+ customdata: p.dips.map((h, N) => [h, p.azs[N]]),
1507
1564
  hovertemplate: "Depth: %{y}<br>Dip: %{customdata[0]}<br>Az: %{customdata[1]}<extra></extra>"
1508
1565
  });
1509
- return { data: m, layout: {
1510
- shapes: c,
1566
+ return { data: d, layout: {
1567
+ shapes: a,
1511
1568
  height: 400,
1512
1569
  margin: { l: 40, r: 10, t: 10, b: 40 },
1513
1570
  xaxis: {
@@ -1518,46 +1575,46 @@ function fn(e, {
1518
1575
  tickvals: [-90, -60, -30, 0, 30, 60, 90]
1519
1576
  },
1520
1577
  yaxis: { title: "Depth (m)", autorange: "reversed" },
1521
- showlegend: !!d
1578
+ showlegend: !!m
1522
1579
  } };
1523
1580
  }
1524
- function Dr(e, {
1581
+ function xo(e, {
1525
1582
  labelCol: t = "structure_type",
1526
- palette: n = bt,
1527
- fromCol: r = B,
1528
- toCol: o = R
1583
+ palette: n = Et,
1584
+ fromCol: r = q,
1585
+ toCol: o = U
1529
1586
  } = {}) {
1530
- const i = e.filter((m) => m[r] != null && m[o] != null && Number(m[o]) > Number(m[r])).filter((m) => {
1531
- const d = m[t];
1532
- if (d == null) return !1;
1533
- const f = String(d).trim();
1587
+ const i = e.filter((d) => d[r] != null && d[o] != null && Number(d[o]) > Number(d[r])).filter((d) => {
1588
+ const m = d[t];
1589
+ if (m == null) return !1;
1590
+ const f = String(m).trim();
1534
1591
  return f !== "" && !/^(nan|null|none)$/i.test(f);
1535
- }).map((m) => ({ from: Number(m[r]), to: Number(m[o]), label: String(m[t]).trim() })).sort((m, d) => m.from - d.from);
1592
+ }).map((d) => ({ from: Number(d[r]), to: Number(d[o]), label: String(d[t]).trim() })).sort((d, m) => d.from - m.from);
1536
1593
  if (!i.length)
1537
1594
  return { data: [], layout: {} };
1538
- const s = [], l = [], u = [];
1539
- return i.forEach((m, d) => {
1595
+ const s = [], c = [], u = [];
1596
+ return i.forEach((d, m) => {
1540
1597
  s.push({
1541
1598
  type: "rect",
1542
1599
  xref: "x",
1543
1600
  yref: "y",
1544
1601
  x0: 0,
1545
1602
  x1: 1,
1546
- y0: m.from,
1547
- y1: m.to,
1548
- fillcolor: n[d % n.length],
1603
+ y0: d.from,
1604
+ y1: d.to,
1605
+ fillcolor: n[m % n.length],
1549
1606
  line: { width: 0 }
1550
- }), l.push(0.5 * (m.from + m.to)), u.push(m.label);
1607
+ }), c.push(0.5 * (d.from + d.to)), u.push(d.label);
1551
1608
  }), { data: [{
1552
1609
  type: "scatter",
1553
1610
  x: Array(u.length).fill(0.5),
1554
- y: l,
1611
+ y: c,
1555
1612
  mode: "text",
1556
1613
  text: u,
1557
1614
  textposition: "middle center",
1558
1615
  showlegend: !1,
1559
1616
  hoverinfo: "text"
1560
- }], layout: gt({
1617
+ }], layout: vt({
1561
1618
  shapes: s,
1562
1619
  height: 400,
1563
1620
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
@@ -1565,7 +1622,7 @@ function Dr(e, {
1565
1622
  showlegend: !1
1566
1623
  }) };
1567
1624
  }
1568
- function hn(e, t) {
1625
+ function Hn(e, t) {
1569
1626
  if (!e) return "";
1570
1627
  const n = String(e).trim().split(/\s+/), r = [];
1571
1628
  let o = "";
@@ -1573,25 +1630,25 @@ function hn(e, t) {
1573
1630
  o && o.length + 1 + i.length > t ? (r.push(o), o = i) : o = o ? `${o} ${i}` : i;
1574
1631
  return o && r.push(o), r.join("<br>");
1575
1632
  }
1576
- function pn(e, {
1633
+ function $n(e, {
1577
1634
  commentCol: t = "comments",
1578
- fromCol: n = B,
1579
- toCol: r = R,
1635
+ fromCol: n = q,
1636
+ toCol: r = U,
1580
1637
  bgColor: o = "#f1f5f9",
1581
1638
  borderColor: i = "#cbd5e1",
1582
1639
  textColor: s = "#1e293b",
1583
- charsPerLine: l = 18
1640
+ charsPerLine: c = 18
1584
1641
  } = {}) {
1585
1642
  const u = e.filter((h) => h[n] != null && h[r] != null && Number(h[r]) > Number(h[n])).map((h) => {
1586
- const g = h[t], b = g != null && String(g).trim() !== "" && String(g) !== "null" ? String(g).trim() : "";
1587
- return { from: Number(h[n]), to: Number(h[r]), comment: b };
1588
- }).sort((h, g) => h.from - g.from);
1643
+ const N = h[t], y = N != null && String(N).trim() !== "" && String(N) !== "null" ? String(N).trim() : "";
1644
+ return { from: Number(h[n]), to: Number(h[r]), comment: y };
1645
+ }).sort((h, N) => h.from - N.from);
1589
1646
  if (!u.length)
1590
1647
  return { data: [], layout: {} };
1591
- const a = [], c = [], m = [], d = [], f = [];
1648
+ const l = [], a = [], d = [], m = [], f = [];
1592
1649
  for (const h of u) {
1593
- const g = 0.5 * (h.from + h.to), b = !!h.comment;
1594
- a.push({
1650
+ const N = 0.5 * (h.from + h.to), y = !!h.comment;
1651
+ l.push({
1595
1652
  type: "rect",
1596
1653
  xref: "x",
1597
1654
  yref: "y",
@@ -1599,149 +1656,149 @@ function pn(e, {
1599
1656
  x1: 1,
1600
1657
  y0: h.from,
1601
1658
  y1: h.to,
1602
- fillcolor: b ? o : "rgba(0,0,0,0)",
1659
+ fillcolor: y ? o : "rgba(0,0,0,0)",
1603
1660
  line: { color: i, width: 1 }
1604
- }), b && (c.push(0.5), m.push(g), d.push(hn(h.comment, l)), f.push(`${h.from}–${h.to} m: ${h.comment}`));
1661
+ }), y && (a.push(0.5), d.push(N), m.push(Hn(h.comment, c)), f.push(`${h.from}–${h.to} m: ${h.comment}`));
1605
1662
  }
1606
- return { data: c.length ? [{
1663
+ return { data: a.length ? [{
1607
1664
  type: "scatter",
1608
- x: c,
1609
- y: m,
1665
+ x: a,
1666
+ y: d,
1610
1667
  mode: "text",
1611
- text: d,
1668
+ text: m,
1612
1669
  textposition: "middle center",
1613
1670
  textfont: { color: s, size: 10 },
1614
1671
  hovertext: f,
1615
1672
  hoverinfo: "text",
1616
1673
  showlegend: !1
1617
- }] : [], layout: gt({
1618
- shapes: a,
1674
+ }] : [], layout: vt({
1675
+ shapes: l,
1619
1676
  height: 400,
1620
1677
  xaxis: { range: [0, 1], visible: !1, fixedrange: !0 },
1621
1678
  yaxis: { title: "Depth (m)", autorange: "reversed" },
1622
1679
  showlegend: !1
1623
1680
  }) };
1624
1681
  }
1625
- function Lr(e, {
1682
+ function Io(e, {
1626
1683
  symbolSize: t = 10,
1627
1684
  xCol: n = "easting",
1628
1685
  yCol: r = "northing"
1629
1686
  } = {}) {
1630
- const o = e[n] != null ? Number(e[n]) : null, i = e[r] != null ? Number(e[r]) : null, s = e[k] != null ? Number(e[k]) : null, l = e[O] != null ? Number(e[O]) : null;
1631
- if (o === null || i === null || s === null || l === null) return null;
1632
- const u = (l - 90 + 360) % 360, a = u * Math.PI / 180, c = l * Math.PI / 180, m = t * Math.sin(a), d = t * Math.cos(a), f = t * 0.4 * (s / 90), y = f * Math.sin(c), p = f * Math.cos(c);
1687
+ const o = e[n] != null ? Number(e[n]) : null, i = e[r] != null ? Number(e[r]) : null, s = e[G] != null ? Number(e[G]) : null, c = e[B] != null ? Number(e[B]) : null;
1688
+ if (o === null || i === null || s === null || c === null) return null;
1689
+ const u = (c - 90 + 360) % 360, l = u * Math.PI / 180, a = c * Math.PI / 180, d = t * Math.sin(l), m = t * Math.cos(l), f = t * 0.4 * (s / 90), b = f * Math.sin(a), p = f * Math.cos(a);
1633
1690
  return {
1634
1691
  strike: u,
1635
1692
  dipValue: s,
1636
1693
  x: o,
1637
1694
  y: i,
1638
- strikeX0: o - m,
1639
- strikeY0: i - d,
1640
- strikeX1: o + m,
1641
- strikeY1: i + d,
1642
- tickX1: o + y,
1695
+ strikeX0: o - d,
1696
+ strikeY0: i - m,
1697
+ strikeX1: o + d,
1698
+ strikeY1: i + m,
1699
+ tickX1: o + b,
1643
1700
  tickY1: i + p
1644
1701
  };
1645
1702
  }
1646
- const _t = "markers+line";
1647
- function yn(e, t) {
1703
+ const St = "markers+line";
1704
+ function jn(e, t) {
1648
1705
  var r;
1649
- const n = we(e);
1650
- return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || _t;
1651
- }
1652
- function Tr({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1653
- const i = ot(null), s = t == null ? void 0 : t.hole, l = (t == null ? void 0 : t.points) || [], u = (e == null ? void 0 : e.property) || "", a = (e == null ? void 0 : e.chartType) || _t, c = (e == null ? void 0 : e.holeId) || "", m = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? pe : t != null && t.isCategorical ? _e : ye), d = we(m), f = yn(m, a), [y, p] = K("");
1654
- return oe(() => {
1655
- const h = m === pe, g = m === Oe;
1656
- if (!s || !u || !h && !g && l.length === 0) return;
1657
- const b = i.current;
1658
- if (!b) return;
1659
- let _;
1706
+ const n = Re(e);
1707
+ return n.some((o) => o.value === t) ? t : ((r = n[0]) == null ? void 0 : r.value) || St;
1708
+ }
1709
+ function Ao({ config: e, graph: t, holeOptions: n = [], propertyOptions: r = [], onConfigChange: o }) {
1710
+ const i = dt(null), s = t == null ? void 0 : t.hole, c = (t == null ? void 0 : t.points) || [], u = (e == null ? void 0 : e.property) || "", l = (e == null ? void 0 : e.chartType) || St, a = (e == null ? void 0 : e.holeId) || "", d = (t == null ? void 0 : t.displayType) || (t != null && t.isComment ? Ne : t != null && t.isCategorical ? Ae : ze), m = Re(d), f = jn(d, l), [b, p] = K("");
1711
+ return ae(() => {
1712
+ const h = d === Ne, N = d === He;
1713
+ if (!s || !u || !h && !N && c.length === 0) return;
1714
+ const y = i.current;
1715
+ if (!y) return;
1716
+ let E;
1660
1717
  try {
1661
- h ? _ = pn(l, { commentCol: u, fromCol: "from", toCol: "to" }) : g ? _ = fn(l) : _ = mn({
1662
- points: l,
1663
- isCategorical: m === _e,
1718
+ h ? E = $n(c, { commentCol: u, fromCol: "from", toCol: "to" }) : N ? E = wn(c) : E = Fn({
1719
+ points: c,
1720
+ isCategorical: d === Ae,
1664
1721
  property: u,
1665
1722
  chartType: f
1666
1723
  });
1667
- } catch (N) {
1668
- console.error("Plot build error", N), p((N == null ? void 0 : N.message) || "Plot build error");
1724
+ } catch (z) {
1725
+ console.error("Plot build error", z), p((z == null ? void 0 : z.message) || "Plot build error");
1669
1726
  return;
1670
1727
  }
1671
- if ((!(_ != null && _.data) || _.data.length === 0) && !h)
1728
+ if ((!(E != null && E.data) || E.data.length === 0) && !h)
1672
1729
  return;
1673
- const I = {
1730
+ const M = {
1674
1731
  displayModeBar: !0,
1675
1732
  responsive: !0,
1676
1733
  useResizeHandler: !0,
1677
1734
  modeBarButtonsToRemove: ["select2d", "lasso2d", "zoom2d", "zoomIn2d", "zoomOut2d", "autoScale2d"]
1678
1735
  };
1679
1736
  try {
1680
- p(""), xe.react(b, _.data, _.layout, I), requestAnimationFrame(() => {
1681
- b && b.parentElement && xe.Plots.resize(b);
1737
+ p(""), Ee.react(y, E.data, E.layout, M), requestAnimationFrame(() => {
1738
+ y && y.parentElement && Ee.Plots.resize(y);
1682
1739
  });
1683
- } catch (N) {
1684
- console.error("Plot render error", N), p((N == null ? void 0 : N.message) || "Plot render error");
1740
+ } catch (z) {
1741
+ console.error("Plot render error", z), p((z == null ? void 0 : z.message) || "Plot render error");
1685
1742
  }
1686
1743
  return () => {
1687
- if (b)
1744
+ if (y)
1688
1745
  try {
1689
- xe.purge(b);
1690
- } catch (N) {
1691
- console.warn("Plot purge error", N);
1746
+ Ee.purge(y);
1747
+ } catch (z) {
1748
+ console.warn("Plot purge error", z);
1692
1749
  }
1693
1750
  };
1694
- }, [s, u, f, m, l]), oe(() => {
1751
+ }, [s, u, f, d, c]), ae(() => {
1695
1752
  const h = i.current;
1696
1753
  if (!h || typeof ResizeObserver > "u") return;
1697
- const g = new ResizeObserver(() => {
1754
+ const N = new ResizeObserver(() => {
1698
1755
  try {
1699
- h && h.data && xe.Plots.resize(h);
1700
- } catch (b) {
1701
- console.warn("Plot resize error", b);
1756
+ h && h.data && Ee.Plots.resize(h);
1757
+ } catch (y) {
1758
+ console.warn("Plot resize error", y);
1702
1759
  }
1703
1760
  });
1704
- return g.observe(h), () => g.disconnect();
1705
- }, []), !s || !u ? /* @__PURE__ */ q("div", { className: "plot-card empty", children: /* @__PURE__ */ q("div", { className: "placeholder", children: e != null && e.holeId ? t != null && t.loading ? `Loading ${e.holeId}...` : "Select a property" : "Loading demo data..." }) }) : m !== pe && m !== Oe && l.length === 0 ? /* @__PURE__ */ q("div", { className: "plot-card empty", children: /* @__PURE__ */ q("div", { className: "placeholder", children: "No data" }) }) : y ? /* @__PURE__ */ q("div", { className: "plot-card empty", children: /* @__PURE__ */ Ne("div", { className: "placeholder", children: [
1761
+ return N.observe(h), () => N.disconnect();
1762
+ }, []), !s || !u ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: e != null && e.holeId ? t != null && t.loading ? `Loading ${e.holeId}...` : "Select a property" : "Loading demo data..." }) }) : d !== Ne && d !== He && c.length === 0 ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ L("div", { className: "placeholder", children: "No data" }) }) : b ? /* @__PURE__ */ L("div", { className: "plot-card empty", children: /* @__PURE__ */ Q("div", { className: "placeholder", children: [
1706
1763
  "Plot error: ",
1707
- y
1708
- ] }) }) : /* @__PURE__ */ Ne("div", { className: "plot-card", children: [
1709
- /* @__PURE__ */ q("div", { className: "plot-title", children: /* @__PURE__ */ q(
1764
+ b
1765
+ ] }) }) : /* @__PURE__ */ Q("div", { className: "plot-card", children: [
1766
+ /* @__PURE__ */ L("div", { className: "plot-title", children: /* @__PURE__ */ L(
1710
1767
  "select",
1711
1768
  {
1712
1769
  className: "plot-select",
1713
- value: c,
1770
+ value: a,
1714
1771
  onChange: (h) => o && o({ holeId: h.target.value }),
1715
1772
  children: n.map((h) => {
1716
- const g = typeof h == "string" ? h : h.holeId, b = typeof h == "string" ? h : h.label || h.holeId;
1717
- return /* @__PURE__ */ q("option", { value: g, children: b }, g);
1773
+ const N = typeof h == "string" ? h : h.holeId, y = typeof h == "string" ? h : h.label || h.holeId;
1774
+ return /* @__PURE__ */ L("option", { value: N, children: y }, N);
1718
1775
  })
1719
1776
  }
1720
1777
  ) }),
1721
- /* @__PURE__ */ Ne("div", { className: "plot-controls column", children: [
1722
- r.length > 0 && /* @__PURE__ */ q(
1778
+ /* @__PURE__ */ Q("div", { className: "plot-controls column", children: [
1779
+ r.length > 0 && /* @__PURE__ */ L(
1723
1780
  "select",
1724
1781
  {
1725
1782
  className: "plot-select",
1726
1783
  value: u,
1727
1784
  onChange: (h) => o && o({ property: h.target.value }),
1728
- children: r.map((h) => /* @__PURE__ */ q("option", { value: h, children: h }, h))
1785
+ children: r.map((h) => /* @__PURE__ */ L("option", { value: h, children: h }, h))
1729
1786
  }
1730
1787
  ),
1731
- d.length > 1 && /* @__PURE__ */ q(
1788
+ m.length > 1 && /* @__PURE__ */ L(
1732
1789
  "select",
1733
1790
  {
1734
1791
  className: "plot-select",
1735
1792
  value: f,
1736
1793
  onChange: (h) => o && o({ chartType: h.target.value }),
1737
- children: d.map((h) => /* @__PURE__ */ q("option", { value: h.value, children: h.label }, h.value))
1794
+ children: m.map((h) => /* @__PURE__ */ L("option", { value: h.value, children: h.label }, h.value))
1738
1795
  }
1739
1796
  )
1740
1797
  ] }),
1741
- /* @__PURE__ */ q("div", { className: "plotly-chart", ref: i })
1798
+ /* @__PURE__ */ L("div", { className: "plotly-chart", ref: i })
1742
1799
  ] });
1743
1800
  }
1744
- function nt(e, t) {
1801
+ function lt(e, t) {
1745
1802
  if (!(t != null && t.length)) return e;
1746
1803
  const n = new Map(e.map((r) => [r.id || r.holeId, { ...r }]));
1747
1804
  for (const r of t) {
@@ -1755,157 +1812,157 @@ function nt(e, t) {
1755
1812
  }
1756
1813
  return Array.from(n.values());
1757
1814
  }
1758
- function bn(e, t) {
1815
+ function Rn(e, t) {
1759
1816
  if (!e || !t) return [];
1760
1817
  const n = /* @__PURE__ */ new Set(), r = [];
1761
1818
  for (const o of e.points || []) {
1762
1819
  const i = Number(o.from ?? o.samp_from ?? o.depth_from ?? o.from_depth), s = Number(o.to ?? o.samp_to ?? o.depth_to ?? o.to_depth);
1763
1820
  if (!Number.isFinite(i) || !Number.isFinite(s) || s <= i) continue;
1764
- const l = `${i}-${s}`;
1765
- n.has(l) || (n.add(l), r.push({ from: i, to: s, [t]: o[t] ?? "" }));
1821
+ const c = `${i}-${s}`;
1822
+ n.has(c) || (n.add(c), r.push({ from: i, to: s, [t]: o[t] ?? "" }));
1766
1823
  }
1767
1824
  return r;
1768
1825
  }
1769
- function Fr({
1826
+ function Eo({
1770
1827
  initialFocusedHoleId: e = "",
1771
1828
  sourceFile: t = null,
1772
1829
  extraHoles: n = [],
1773
1830
  plotCount: r = 4
1774
1831
  } = {}) {
1775
- const [o, i] = K([]), [s, l] = K([]), [u, a] = K([]), [c, m] = K([]), [d, f] = K([]), [y, p] = K({}), [h, g] = K(""), [b, _] = K([]), [I, N] = K(""), [P, E] = K(e || ""), [M, F] = K([]), j = ot(null);
1776
- oe(() => {
1777
- !t || j.current === t || (j.current = t, $t(t).then((S) => {
1832
+ const [o, i] = K([]), [s, c] = K([]), [u, l] = K([]), [a, d] = K([]), [m, f] = K([]), [b, p] = K({}), [h, N] = K(""), [y, E] = K([]), [M, z] = K(""), [P, D] = K(e || ""), [x, V] = K([]), H = dt(null);
1833
+ ae(() => {
1834
+ !t || H.current === t || (H.current = t, an(t).then((S) => {
1778
1835
  if (!S) return;
1779
- const C = Array.from(new Map(S.map((v) => [v.holeId, v])).values());
1780
- l(C), _(dt({
1781
- holeIds: C.map((v) => v.holeId),
1836
+ const I = Array.from(new Map(S.map((g) => [g.holeId, g])).values());
1837
+ c(I), E(_t({
1838
+ holeIds: I.map((g) => g.holeId),
1782
1839
  focusedHoleId: P,
1783
1840
  plotCount: r,
1784
1841
  defaultProp: "",
1785
- categoricalProps: c,
1786
- commentProps: d,
1842
+ categoricalProps: a,
1843
+ commentProps: m,
1787
1844
  numericDefaultChartType: "markers+line"
1788
1845
  }));
1789
1846
  }).catch((S) => {
1790
1847
  console.info("Assay metadata load skipped:", S.message);
1791
1848
  }));
1792
- }, [t, P, r, c, d]), oe(() => {
1849
+ }, [t, P, r, a, m]), ae(() => {
1793
1850
  if (!(n != null && n.length)) return;
1794
- const S = n.map((C) => ({ holeId: C.id || C.holeId })).filter((C) => C.holeId);
1795
- l((C) => {
1796
- const v = new Set(C.map((A) => A.holeId)), L = S.filter((A) => !v.has(A.holeId));
1797
- return L.length ? [...C, ...L] : C;
1851
+ const S = n.map((I) => ({ holeId: I.id || I.holeId })).filter((I) => I.holeId);
1852
+ c((I) => {
1853
+ const g = new Set(I.map((A) => A.holeId)), k = S.filter((A) => !g.has(A.holeId));
1854
+ return k.length ? [...I, ...k] : I;
1798
1855
  });
1799
- }, [n]), oe(() => {
1800
- N((S) => S && S.startsWith("Loading data for hole") ? S : "");
1801
- }, [b]), oe(() => {
1856
+ }, [n]), ae(() => {
1857
+ z((S) => S && S.startsWith("Loading data for hole") ? S : "");
1858
+ }, [y]), ae(() => {
1802
1859
  if (!s.length) {
1803
- _([]);
1860
+ E([]);
1804
1861
  return;
1805
1862
  }
1806
- const S = mt(s.map((C) => C.holeId), P);
1807
- _((C) => Array.from({ length: r }).map((L, A) => {
1863
+ const S = gt(s.map((I) => I.holeId), P);
1864
+ E((I) => Array.from({ length: r }).map((k, A) => {
1808
1865
  var X;
1809
- const V = C[A] || {}, w = s.some((le) => le.holeId === V.holeId) ? V.holeId : S[A] || ((X = s[A]) == null ? void 0 : X.holeId) || "", T = V.property || h, Y = Me({
1810
- property: T,
1811
- chartType: V.chartType,
1812
- categoricalProps: c,
1813
- commentProps: d,
1866
+ const T = I[A] || {}, F = s.some((re) => re.holeId === T.holeId) ? T.holeId : S[A] || ((X = s[A]) == null ? void 0 : X.holeId) || "", C = T.property || h, R = Se({
1867
+ property: C,
1868
+ chartType: T.chartType,
1869
+ categoricalProps: a,
1870
+ commentProps: m,
1814
1871
  numericDefaultChartType: "markers+line"
1815
1872
  });
1816
- return { holeId: w, property: T, chartType: Y };
1873
+ return { holeId: F, property: C, chartType: R };
1817
1874
  }));
1818
- }, [s, P, h, c, d, r]), oe(() => {
1875
+ }, [s, P, h, a, m, r]), ae(() => {
1819
1876
  if (!t) return;
1820
- b.map((C) => C.holeId).filter(Boolean).forEach((C) => {
1821
- const v = o.some((A) => (A.id || A.holeId) === C), L = M.includes(C);
1822
- v || L || (F((A) => [...A, C]), Ht(t, C).then((A) => {
1823
- F((V) => V.filter((w) => w !== C)), A && i((V) => {
1824
- const w = nt(
1825
- [...V.filter((Y) => (Y.id || Y.holeId) !== C), A],
1877
+ y.map((I) => I.holeId).filter(Boolean).forEach((I) => {
1878
+ const g = o.some((A) => (A.id || A.holeId) === I), k = x.includes(I);
1879
+ g || k || (V((A) => [...A, I]), cn(t, I).then((A) => {
1880
+ V((T) => T.filter((F) => F !== I)), A && i((T) => {
1881
+ const F = lt(
1882
+ [...T.filter((R) => (R.id || R.holeId) !== I), A],
1826
1883
  n
1827
- ), T = Ie(w);
1828
- return a(T.numericProps), m(T.categoricalProps), f(T.commentProps), p(T.columnMeta), !h && T.defaultProp && (g(T.defaultProp), _((Y) => Y.map((X) => ({
1884
+ ), C = De(F);
1885
+ return l(C.numericProps), d(C.categoricalProps), f(C.commentProps), p(C.columnMeta), !h && C.defaultProp && (N(C.defaultProp), E((R) => R.map((X) => ({
1829
1886
  ...X,
1830
- property: X.property || T.defaultProp,
1831
- chartType: Me({
1832
- property: X.property || T.defaultProp,
1887
+ property: X.property || C.defaultProp,
1888
+ chartType: Se({
1889
+ property: X.property || C.defaultProp,
1833
1890
  chartType: X.chartType,
1834
- categoricalProps: T.categoricalProps,
1835
- commentProps: T.commentProps,
1891
+ categoricalProps: C.categoricalProps,
1892
+ commentProps: C.commentProps,
1836
1893
  numericDefaultChartType: "markers+line"
1837
1894
  })
1838
- })))), w;
1895
+ })))), F;
1839
1896
  });
1840
1897
  }).catch((A) => {
1841
- console.error(A), F((V) => V.filter((w) => w !== C)), N(A.message || `Error loading hole ${C}`);
1898
+ console.error(A), V((T) => T.filter((F) => F !== I)), z(A.message || `Error loading hole ${I}`);
1842
1899
  }));
1843
1900
  });
1844
- }, [b, t, o, M, h, n]), oe(() => {
1901
+ }, [y, t, o, x, h, n]), ae(() => {
1845
1902
  n != null && n.length && i((S) => {
1846
1903
  if (!S.length) {
1847
- const L = Ie(n);
1848
- return a(L.numericProps), m(L.categoricalProps), f(L.commentProps), p(L.columnMeta), !h && L.defaultProp && g(L.defaultProp), n;
1904
+ const k = De(n);
1905
+ return l(k.numericProps), d(k.categoricalProps), f(k.commentProps), p(k.columnMeta), !h && k.defaultProp && N(k.defaultProp), n;
1849
1906
  }
1850
- const C = nt(S, n), v = Ie(C);
1851
- return a(v.numericProps), m(v.categoricalProps), f(v.commentProps), p(v.columnMeta), !h && v.defaultProp && g(v.defaultProp), C;
1907
+ const I = lt(S, n), g = De(I);
1908
+ return l(g.numericProps), d(g.categoricalProps), f(g.commentProps), p(g.columnMeta), !h && g.defaultProp && N(g.defaultProp), I;
1852
1909
  });
1853
1910
  }, [n]);
1854
- const W = ve(
1855
- () => [...u, ...c, ...d],
1856
- [u, c, d]
1857
- ), D = ve(
1858
- () => s.map((S) => ({ holeId: S.holeId, label: S.holeId })).sort((S, C) => S.label.localeCompare(C.label)),
1911
+ const W = Oe(
1912
+ () => [...u, ...a, ...m],
1913
+ [u, a, m]
1914
+ ), O = Oe(
1915
+ () => s.map((S) => ({ holeId: S.holeId, label: S.holeId })).sort((S, I) => S.label.localeCompare(I.label)),
1859
1916
  [s]
1860
- ), G = ve(() => {
1861
- const S = [...u, ...c, ...d];
1862
- return Array.from({ length: r }).map((C, v) => {
1863
- const L = b[v] || {}, A = o.find((de) => (de.id || de.holeId) === L.holeId) || null, V = A ? S.filter((de) => an(A, de)) : S;
1864
- let w = L.property || h;
1865
- A && !V.includes(w) && (w = V[0] || w);
1866
- const T = d.includes(w), Y = !T && c.includes(w), X = !T && !Y && w === "dip", le = T ? "comment" : X ? "tadpole" : Y ? "categorical" : "numeric", be = X ? "tadpole" : L.chartType || (T ? "comment" : Y ? "categorical" : "markers+line"), me = L.holeId || (A == null ? void 0 : A.id) || (A == null ? void 0 : A.holeId) || "", Ee = X ? (A == null ? void 0 : A.points) || [] : T ? bn(A, w) : ln(A, w, Y);
1917
+ ), $ = Oe(() => {
1918
+ const S = [...u, ...a, ...m];
1919
+ return Array.from({ length: r }).map((I, g) => {
1920
+ const k = y[g] || {}, A = o.find((le) => (le.id || le.holeId) === k.holeId) || null, T = A ? S.filter((le) => Cn(A, le)) : S;
1921
+ let F = k.property || h;
1922
+ A && !T.includes(F) && (F = T[0] || F);
1923
+ const C = m.includes(F), R = !C && a.includes(F), X = !C && !R && F === "dip", re = C ? "comment" : X ? "tadpole" : R ? "categorical" : "numeric", me = X ? "tadpole" : k.chartType || (C ? "comment" : R ? "categorical" : "markers+line"), se = k.holeId || (A == null ? void 0 : A.id) || (A == null ? void 0 : A.holeId) || "", Me = X ? (A == null ? void 0 : A.points) || [] : C ? Rn(A, F) : Ln(A, F, R);
1867
1924
  return {
1868
- config: { holeId: me, property: w, chartType: be },
1925
+ config: { holeId: se, property: F, chartType: me },
1869
1926
  hole: A,
1870
- loading: M.includes(L.holeId),
1871
- isCategorical: Y,
1872
- isComment: T,
1927
+ loading: x.includes(k.holeId),
1928
+ isCategorical: R,
1929
+ isComment: C,
1873
1930
  isTadpole: X,
1874
- displayType: le,
1875
- points: Ee,
1876
- propertyOptions: V,
1877
- label: me
1931
+ displayType: re,
1932
+ points: Me,
1933
+ propertyOptions: T,
1934
+ label: se
1878
1935
  };
1879
1936
  });
1880
- }, [b, o, h, c, d, M, r, u]), U = (S, C) => {
1881
- _((v) => {
1882
- const L = [...v], V = { ...L[S] || {}, ...C };
1883
- return C.property && (V.chartType = Me({
1884
- property: C.property,
1885
- chartType: V.chartType,
1886
- categoricalProps: c,
1887
- commentProps: d,
1937
+ }, [y, o, h, a, m, x, r, u]), j = (S, I) => {
1938
+ E((g) => {
1939
+ const k = [...g], T = { ...k[S] || {}, ...I };
1940
+ return I.property && (T.chartType = Se({
1941
+ property: I.property,
1942
+ chartType: T.chartType,
1943
+ categoricalProps: a,
1944
+ commentProps: m,
1888
1945
  numericDefaultChartType: "markers+line"
1889
- })), L[S] = V, L;
1946
+ })), k[S] = T, k;
1890
1947
  });
1891
1948
  };
1892
1949
  return {
1893
- error: I,
1950
+ error: M,
1894
1951
  focusedHoleId: P,
1895
- setFocusedHoleId: E,
1896
- setError: N,
1952
+ setFocusedHoleId: D,
1953
+ setError: z,
1897
1954
  holeCount: s.length,
1898
1955
  numericProps: u,
1899
- categoricalProps: c,
1900
- commentProps: d,
1901
- columnMeta: y,
1956
+ categoricalProps: a,
1957
+ commentProps: m,
1958
+ columnMeta: b,
1902
1959
  propertyOptions: W,
1903
- labeledHoleOptions: D,
1904
- traceGraphs: G,
1905
- handleConfigChange: U
1960
+ labeledHoleOptions: O,
1961
+ traceGraphs: $,
1962
+ handleConfigChange: j
1906
1963
  };
1907
1964
  }
1908
- const gn = [
1965
+ const Bn = [
1909
1966
  "#313695",
1910
1967
  "#4575b4",
1911
1968
  "#74add1",
@@ -1917,8 +1974,8 @@ const gn = [
1917
1974
  "#d73027",
1918
1975
  "#a50026"
1919
1976
  ];
1920
- function _n(e = [], t = gn) {
1921
- const n = e.filter((a) => Number.isFinite(a));
1977
+ function Gn(e = [], t = Bn) {
1978
+ const n = e.filter((l) => Number.isFinite(l));
1922
1979
  if (!n.length)
1923
1980
  return {
1924
1981
  min: null,
@@ -1927,10 +1984,10 @@ function _n(e = [], t = gn) {
1927
1984
  bins: [],
1928
1985
  colors: t
1929
1986
  };
1930
- const r = n.slice().sort((a, c) => a - c), o = r[0], i = r[r.length - 1], s = t.length;
1987
+ const r = n.slice().sort((l, a) => l - a), o = r[0], i = r[r.length - 1], s = t.length;
1931
1988
  if (i === o) {
1932
- const a = t.map((c, m) => ({
1933
- index: m,
1989
+ const l = t.map((a, d) => ({
1990
+ index: d,
1934
1991
  min: o,
1935
1992
  max: i,
1936
1993
  label: `${o}`
@@ -1939,32 +1996,32 @@ function _n(e = [], t = gn) {
1939
1996
  min: o,
1940
1997
  max: i,
1941
1998
  step: 0,
1942
- bins: a,
1999
+ bins: l,
1943
2000
  colors: t
1944
2001
  };
1945
2002
  }
1946
- const l = t.map((a, c) => {
1947
- const m = c / s, d = (c + 1) / s, f = Math.floor(m * r.length), y = Math.min(r.length - 1, Math.floor(d * r.length)), p = r[f], h = c === s - 1 ? i : r[y];
2003
+ const c = t.map((l, a) => {
2004
+ const d = a / s, m = (a + 1) / s, f = Math.floor(d * r.length), b = Math.min(r.length - 1, Math.floor(m * r.length)), p = r[f], h = a === s - 1 ? i : r[b];
1948
2005
  return {
1949
- index: c,
2006
+ index: a,
1950
2007
  min: p,
1951
2008
  max: h,
1952
- label: xn(p, h)
2009
+ label: Un(p, h)
1953
2010
  };
1954
2011
  }), u = (i - o) / s;
1955
2012
  return {
1956
2013
  min: o,
1957
2014
  max: i,
1958
2015
  step: u,
1959
- bins: l,
2016
+ bins: c,
1960
2017
  colors: t
1961
2018
  };
1962
2019
  }
1963
- function xn(e, t) {
2020
+ function Un(e, t) {
1964
2021
  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";
1965
2022
  return `${n(e)} – ${n(t)}`;
1966
2023
  }
1967
- function xt(e, t) {
2024
+ function Pt(e, t) {
1968
2025
  if (!Number.isFinite(e) || !t || !Array.isArray(t.bins) || !t.bins.length)
1969
2026
  return -1;
1970
2027
  if (t.max === t.min)
@@ -1976,43 +2033,43 @@ function xt(e, t) {
1976
2033
  }
1977
2034
  return -1;
1978
2035
  }
1979
- function Nn(e, t, n = "#8b1e3f") {
1980
- const r = xt(e, t);
2036
+ function Yn(e, t, n = "#8b1e3f") {
2037
+ const r = Pt(e, t);
1981
2038
  return r < 0 ? n : t.colors[r] || n;
1982
2039
  }
1983
- function Nt(e) {
2040
+ function Dt(e) {
1984
2041
  return Array.isArray(e) ? e : [];
1985
2042
  }
1986
- function De(e) {
2043
+ function Fe(e) {
1987
2044
  const t = Number(e);
1988
2045
  return Number.isFinite(t) ? t : void 0;
1989
2046
  }
1990
- function zt(e = {}) {
2047
+ function kt(e = {}) {
1991
2048
  return {
1992
2049
  ...e,
1993
- x: De(e.x),
1994
- y: De(e.y),
1995
- z: De(e.z)
2050
+ x: Fe(e.x),
2051
+ y: Fe(e.y),
2052
+ z: Fe(e.z)
1996
2053
  };
1997
2054
  }
1998
- function zn(e = [], t = [0, 0], n = 0) {
1999
- const [r, o] = t, i = Number(n) * Math.PI / 180, s = Math.cos(i), l = Math.sin(i);
2000
- return Nt(e).map(zt).map((u) => {
2055
+ function qn(e = [], t = [0, 0], n = 0) {
2056
+ const [r, o] = t, i = Number(n) * Math.PI / 180, s = Math.cos(i), c = Math.sin(i);
2057
+ return Dt(e).map(kt).map((u) => {
2001
2058
  if (!Number.isFinite(u.x) || !Number.isFinite(u.y)) return { ...u };
2002
- const a = u.x - r, c = u.y - o;
2059
+ const l = u.x - r, a = u.y - o;
2003
2060
  return {
2004
2061
  ...u,
2005
- along: a * l + c * s,
2006
- across: a * s - c * l
2062
+ along: l * c + a * s,
2063
+ across: l * s - a * c
2007
2064
  };
2008
2065
  });
2009
2066
  }
2010
- function Mn(e = [], t = [0, 0], n = 0, r = 50) {
2011
- const o = zn(e, t, n), i = 0.5 * Number(r || 0);
2067
+ function Xn(e = [], t = [0, 0], n = 0, r = 50) {
2068
+ const o = qn(e, t, n), i = 0.5 * Number(r || 0);
2012
2069
  return !Number.isFinite(i) || i <= 0 ? o : o.filter((s) => Number.isFinite(s.across) && Math.abs(s.across) <= i);
2013
2070
  }
2014
- function Or(e = [], t = null, n = null) {
2015
- let r = Nt(e).map(zt);
2071
+ function vo(e = [], t = null, n = null) {
2072
+ let r = Dt(e).map(kt);
2016
2073
  if (Array.isArray(t) && t.length === 2) {
2017
2074
  const [o, i] = t;
2018
2075
  r = r.filter((s) => Number.isFinite(s.z) && s.z <= Number(o) && s.z >= Number(i));
@@ -2022,46 +2079,46 @@ function Or(e = [], t = null, n = null) {
2022
2079
  color_value: o == null ? void 0 : o[n]
2023
2080
  }))), r;
2024
2081
  }
2025
- function kr(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2026
- let i = Mn(e, t, n, r);
2082
+ function So(e = [], t = [0, 0], n = 0, r = 50, o = null) {
2083
+ let i = Xn(e, t, n, r);
2027
2084
  return o && (i = i.map((s) => ({
2028
2085
  ...s,
2029
2086
  color_value: s == null ? void 0 : s[o]
2030
2087
  }))), i;
2031
2088
  }
2032
- function je(e) {
2089
+ function Ye(e) {
2033
2090
  return Array.isArray(e) ? e : [];
2034
2091
  }
2035
- function Ge(e = {}) {
2092
+ function qe(e = {}) {
2036
2093
  return e.hole_id ?? e.holeId ?? e.id;
2037
2094
  }
2038
- function ce(e, t = void 0) {
2095
+ function he(e, t = void 0) {
2039
2096
  const n = Number(e);
2040
2097
  return Number.isFinite(n) ? n : t;
2041
2098
  }
2042
- function Vr(e = [], t = null) {
2099
+ function Po(e = [], t = null) {
2043
2100
  const n = /* @__PURE__ */ new Map();
2044
- je(e).forEach((o) => {
2045
- const i = Ge(o);
2101
+ Ye(e).forEach((o) => {
2102
+ const i = qe(o);
2046
2103
  if (i == null || `${i}`.trim() === "") return;
2047
2104
  const s = `${i}`;
2048
2105
  n.has(s) || n.set(s, []), n.get(s).push(o);
2049
2106
  });
2050
2107
  const r = [];
2051
2108
  return n.forEach((o, i) => {
2052
- const s = [...o].sort((u, a) => ce(u.md, 0) - ce(a.md, 0)), l = {
2109
+ const s = [...o].sort((u, l) => he(u.md, 0) - he(l.md, 0)), c = {
2053
2110
  hole_id: i,
2054
- x: s.map((u) => ce(u.x, 0)),
2055
- y: s.map((u) => ce(u.y, 0)),
2056
- z: s.map((u) => ce(u.z, 0)),
2111
+ x: s.map((u) => he(u.x, 0)),
2112
+ y: s.map((u) => he(u.y, 0)),
2113
+ z: s.map((u) => he(u.z, 0)),
2057
2114
  color: null
2058
2115
  };
2059
- t && (l.color = s.map((u) => u == null ? void 0 : u[t])), r.push(l);
2116
+ t && (c.color = s.map((u) => u == null ? void 0 : u[t])), r.push(c);
2060
2117
  }), r;
2061
2118
  }
2062
- function wr(e = [], t = 1, n = null) {
2063
- return je(e).map((r) => ({
2064
- hole_id: Ge(r),
2119
+ function Do(e = [], t = 1, n = null) {
2120
+ return Ye(e).map((r) => ({
2121
+ hole_id: qe(r),
2065
2122
  from: r == null ? void 0 : r.from,
2066
2123
  to: r == null ? void 0 : r.to,
2067
2124
  radius: t,
@@ -2069,14 +2126,21 @@ function wr(e = [], t = 1, n = null) {
2069
2126
  value: n ? r == null ? void 0 : r[n] : null
2070
2127
  }));
2071
2128
  }
2072
- function Rr(e = [], t = null) {
2073
- return t ? je(e).filter((n) => Object.prototype.hasOwnProperty.call(n || {}, t)).map((n) => ({
2074
- hole_id: Ge(n),
2129
+ function ko(e = [], t = null) {
2130
+ return t ? Ye(e).filter((n) => Object.prototype.hasOwnProperty.call(n || {}, t)).map((n) => ({
2131
+ hole_id: qe(n),
2075
2132
  label: n == null ? void 0 : n[t],
2076
- depth: 0.5 * (ce(n == null ? void 0 : n.from, 0) + ce(n == null ? void 0 : n.to, 0))
2133
+ depth: 0.5 * (he(n == null ? void 0 : n.from, 0) + he(n == null ? void 0 : n.to, 0))
2077
2134
  })) : [];
2078
2135
  }
2079
- const Cn = {
2136
+ function be(e) {
2137
+ e.selectables = [
2138
+ ...e.blocks,
2139
+ ...e.drillMeshes,
2140
+ ...e.structuralMeshes
2141
+ ];
2142
+ }
2143
+ const Wn = {
2080
2144
  bedding: "#2563eb",
2081
2145
  foliation: "#16a34a",
2082
2146
  joint: "#9333ea",
@@ -2085,13 +2149,13 @@ const Cn = {
2085
2149
  "shear zone": "#0ea5e9",
2086
2150
  "fault zone": "#ef4444"
2087
2151
  };
2088
- function In(e, t) {
2089
- const n = t || Cn, r = (e || "").toLowerCase().trim(), o = n[r] || "#888888";
2090
- return new x.Color(o).getHex();
2152
+ function Zn(e, t) {
2153
+ const n = t || Wn, r = (e || "").toLowerCase().trim(), o = n[r] || "#888888";
2154
+ return new _.Color(o).getHex();
2091
2155
  }
2092
- function An(e, t) {
2156
+ function Kn(e, t) {
2093
2157
  const n = e * Math.PI / 180, r = t * Math.PI / 180;
2094
- return new x.Vector3(
2158
+ return new _.Vector3(
2095
2159
  Math.sin(r) * Math.sin(n),
2096
2160
  // East component
2097
2161
  Math.cos(r) * Math.sin(n),
@@ -2100,60 +2164,83 @@ function An(e, t) {
2100
2164
  // Up component
2101
2165
  ).normalize();
2102
2166
  }
2103
- function Sn(e, t = {}) {
2167
+ function Jn(e, t = {}) {
2104
2168
  const {
2105
2169
  radius: n = 5,
2106
2170
  discThickness: r = 0.2,
2107
2171
  opacity: o = 0.7,
2108
2172
  segments: i = 32,
2109
2173
  colorMap: s = null
2110
- } = t, l = new x.Group(), u = new x.Vector3(0, 1, 0);
2111
- for (const a of e) {
2112
- const c = 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;
2113
- if (c == null || m == null || d == null || !Number.isFinite(c) || !Number.isFinite(m) || !Number.isFinite(d)) continue;
2114
- const f = a[k] != null ? Number(a[k]) : null, y = a[O] != null ? Number(a[O]) : null;
2174
+ } = t, c = new _.Group(), u = new _.Vector3(0, 1, 0);
2175
+ for (const l of e) {
2176
+ const a = l.x != null ? l.x : l.easting != null ? l.easting : null, d = l.y != null ? l.y : l.northing != null ? l.northing : null, m = l.z != null ? l.z : l.elevation != null ? l.elevation : null;
2177
+ if (a == null || d == null || m == null || !Number.isFinite(a) || !Number.isFinite(d) || !Number.isFinite(m)) continue;
2178
+ const f = l[G] != null ? Number(l[G]) : null, b = l[B] != null ? Number(l[B]) : null;
2115
2179
  let p;
2116
- if (a.nx != null && Number.isFinite(a.nx) && a.ny != null && Number.isFinite(a.ny) && a.nz != null && Number.isFinite(a.nz))
2117
- p = new x.Vector3(a.nx, a.ny, a.nz).normalize();
2180
+ if (l.nx != null && Number.isFinite(l.nx) && l.ny != null && Number.isFinite(l.ny) && l.nz != null && Number.isFinite(l.nz))
2181
+ p = new _.Vector3(l.nx, l.ny, l.nz).normalize();
2118
2182
  else {
2119
- if (f == null || y == null || !Number.isFinite(f) || !Number.isFinite(y)) continue;
2120
- p = An(f, y);
2183
+ if (f == null || b == null || !Number.isFinite(f) || !Number.isFinite(b)) continue;
2184
+ p = Kn(f, b);
2121
2185
  }
2122
- const h = new x.CylinderGeometry(n, n, r, i, 1, !1), g = new x.MeshStandardMaterial({
2123
- color: In(a.structure_type, s),
2186
+ const h = new _.CylinderGeometry(n, n, r, i, 1, !1), N = new _.MeshStandardMaterial({
2187
+ color: Zn(l.structure_type, s),
2124
2188
  transparent: !0,
2125
2189
  opacity: o,
2126
- side: x.DoubleSide
2127
- }), b = new x.Mesh(h, g);
2128
- b.position.set(c, m, d), b.quaternion.setFromUnitVectors(u, p), b.userData = {
2190
+ side: _.DoubleSide
2191
+ }), y = new _.Mesh(h, N);
2192
+ y.position.set(a, d, m), y.quaternion.setFromUnitVectors(u, p), y.userData = {
2129
2193
  type: "structure",
2130
- hole_id: a.hole_id,
2131
- depth: a.depth ?? a.mid,
2132
- structure_type: a.structure_type,
2194
+ hole_id: l.hole_id,
2195
+ depth: l.depth ?? l.mid,
2196
+ structure_type: l.structure_type,
2133
2197
  dip: f,
2134
- azimuth: y,
2135
- comments: a.comments
2136
- }, l.add(b);
2198
+ azimuth: b,
2199
+ comments: l.comments
2200
+ }, c.add(y);
2137
2201
  }
2138
- return l;
2202
+ return c;
2139
2203
  }
2140
- function Be(e) {
2141
- var n, r, o, i, s, l, u, a, c;
2204
+ function Qn(e, t, n, r = {}) {
2205
+ if (!e.scene || (Ct(e), !(t != null && t.length) || !(n != null && n.length))) return;
2206
+ const { maxDiscs: o = 3e3 } = r;
2207
+ let i = t;
2208
+ if (i.length > o) {
2209
+ const u = i.length / o, l = [];
2210
+ for (let a = 0; a < o; a++)
2211
+ l.push(i[Math.floor(a * u)]);
2212
+ i = l;
2213
+ }
2214
+ const s = n.flatMap((u) => (u.points || []).map((l) => ({ ...l, hole_id: u.id }))), c = Sn(i, s, r);
2215
+ c.length && (e.structuralGroup = Jn(c, r), e.scene.add(e.structuralGroup), e.structuralGroup.traverse((u) => {
2216
+ u.isMesh && e.structuralMeshes.push(u);
2217
+ }), be(e));
2218
+ }
2219
+ function Ct(e) {
2220
+ e.structuralGroup && (e.scene.remove(e.structuralGroup), e.structuralGroup.traverse((t) => {
2221
+ t.isMesh && (t.geometry.dispose(), t.material.dispose());
2222
+ }), e.structuralGroup = null), e.structuralMeshes = [], be(e);
2223
+ }
2224
+ function er(e, t) {
2225
+ e.structuralGroup && (e.structuralGroup.visible = !!t);
2226
+ }
2227
+ function Xe(e) {
2228
+ var n, r, o, i, s, c, u, l, a;
2142
2229
  if (!e) return "";
2143
- const t = (m) => Number.isFinite(m) ? m.toFixed(3) : "nan";
2230
+ const t = (d) => Number.isFinite(d) ? d.toFixed(3) : "nan";
2144
2231
  return [
2145
2232
  t((n = e.camera) == null ? void 0 : n.x),
2146
2233
  t((r = e.camera) == null ? void 0 : r.y),
2147
2234
  t((o = e.camera) == null ? void 0 : o.z),
2148
2235
  t((i = e.target) == null ? void 0 : i.x),
2149
2236
  t((s = e.target) == null ? void 0 : s.y),
2150
- t((l = e.target) == null ? void 0 : l.z),
2237
+ t((c = e.target) == null ? void 0 : c.z),
2151
2238
  t((u = e.up) == null ? void 0 : u.x),
2152
- t((a = e.up) == null ? void 0 : a.y),
2153
- t((c = e.up) == null ? void 0 : c.z)
2239
+ t((l = e.up) == null ? void 0 : l.y),
2240
+ t((a = e.up) == null ? void 0 : a.z)
2154
2241
  ].join("|");
2155
2242
  }
2156
- function Mt(e) {
2243
+ function Lt(e) {
2157
2244
  return !e.camera || !e.controls ? null : {
2158
2245
  camera: {
2159
2246
  x: e.camera.position.x,
@@ -2172,37 +2259,37 @@ function Mt(e) {
2172
2259
  }
2173
2260
  };
2174
2261
  }
2175
- function En(e, t) {
2262
+ function tr(e, t) {
2176
2263
  if (!e.camera || !e.controls || !t) return !1;
2177
2264
  const n = t.camera || {}, r = t.target || {}, o = t.up || {};
2178
- return [n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z].every(Number.isFinite) ? (e.camera.position.set(n.x, n.y, n.z), e.controls.target.set(r.x, r.y, r.z), e.camera.up.set(o.x, o.y, o.z), e.camera.lookAt(r.x, r.y, r.z), e.controls.update(), e._lastViewSignature = Be(t), !0) : !1;
2265
+ return [n.x, n.y, n.z, r.x, r.y, r.z, o.x, o.y, o.z].every(Number.isFinite) ? (e.camera.position.set(n.x, n.y, n.z), e.controls.target.set(r.x, r.y, r.z), e.camera.up.set(o.x, o.y, o.z), e.camera.lookAt(r.x, r.y, r.z), e.controls.update(), e._lastViewSignature = Xe(t), !0) : !1;
2179
2266
  }
2180
- function vn(e) {
2267
+ function nr(e) {
2181
2268
  if (!e.viewChangeHandler) return;
2182
2269
  const t = Date.now();
2183
2270
  if (t - e._lastViewEmitMs < 250) return;
2184
- const n = Mt(e);
2271
+ const n = Lt(e);
2185
2272
  if (!n) return;
2186
- const r = Be(n);
2273
+ const r = Xe(n);
2187
2274
  r !== e._lastViewSignature && (e._lastViewSignature = r, e._lastViewEmitMs = t, e.viewChangeHandler(n));
2188
2275
  }
2189
- function Le(e, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s }) {
2190
- const l = (t + n) / 2, u = (r + o) / 2, a = (i + s) / 2, c = n - t, m = o - r, d = s - i, y = Math.max(c, m, d, 1) * 2;
2191
- e.controls.target.set(l, u, a), e.camera.position.set(l + y, u + y, a + y), e.camera.lookAt(l, u, a), e.controls.update();
2276
+ function We(e, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s }) {
2277
+ const c = (t + n) / 2, u = (r + o) / 2, l = (i + s) / 2, a = n - t, d = o - r, m = s - i, b = Math.max(a, d, m, 1) * 2;
2278
+ e.controls.target.set(c, u, l), e.camera.position.set(c + b, u + b, l + b), e.camera.lookAt(c, u, l), e.controls.update();
2192
2279
  }
2193
- function Pn(e, t = 1e3) {
2280
+ function rr(e, t = 1e3) {
2194
2281
  !e.camera || !e.controls || (e.controls.target.set(0, 0, 0), e.camera.position.set(t, t, t), e.camera.lookAt(0, 0, 0), e.controls.update());
2195
2282
  }
2196
- function Dn(e, t = 2e3) {
2283
+ function or(e, t = 2e3) {
2197
2284
  !e.camera || !e.controls || (e.controls.target.set(0, 0, 0), e.camera.position.set(0, 0, t), e.camera.up.set(0, 1, 0), e.camera.lookAt(0, 0, 0), e.controls.update());
2198
2285
  }
2199
- function Ln(e, t = 0, n = 0) {
2286
+ function ir(e, t = 0, n = 0) {
2200
2287
  e.controls && typeof e.controls.pan == "function" && (e.controls.pan(t, n), e.controls.update());
2201
2288
  }
2202
- function Tn(e, t = 1.1) {
2289
+ function sr(e, t = 1.1) {
2203
2290
  !e.controls || typeof e.controls.dollyIn != "function" || typeof e.controls.dollyOut != "function" || (t > 1 ? e.controls.dollyOut(t) : e.controls.dollyIn(1 / t), e.controls.update());
2204
2291
  }
2205
- function Fn(e, t = 1.2) {
2292
+ function lr(e, t = 1.2) {
2206
2293
  if (!e.lastBounds) return;
2207
2294
  const {
2208
2295
  minX: n,
@@ -2210,17 +2297,17 @@ function Fn(e, t = 1.2) {
2210
2297
  minY: o,
2211
2298
  maxY: i,
2212
2299
  minZ: s,
2213
- maxZ: l
2214
- } = e.lastBounds, u = (r - n) * t, a = (i - o) * t, c = (l - s) * t, m = (n + r) / 2, d = (o + i) / 2, f = (s + l) / 2, p = Math.max(u, a, c, 1) * 2;
2215
- e.controls.target.set(m, d, f), e.camera.position.set(m + p, d + p, f + p), e.camera.lookAt(m, d, f), e.controls.update();
2300
+ maxZ: c
2301
+ } = e.lastBounds, u = (r - n) * t, l = (i - o) * t, a = (c - s) * t, d = (n + r) / 2, m = (o + i) / 2, f = (s + c) / 2, p = Math.max(u, l, a, 1) * 2;
2302
+ e.controls.target.set(d, m, f), e.camera.position.set(d + p, m + p, f + p), e.camera.lookAt(d, m, f), e.controls.update();
2216
2303
  }
2217
- const On = 1, kn = 120;
2218
- function Vn(e, t) {
2304
+ const ar = 1, cr = 120;
2305
+ function ur(e, t) {
2219
2306
  if (!e.camera || !e.controls || !Number.isFinite(t)) return !1;
2220
- const n = Math.min(kn, Math.max(On, t)), r = e.controls.target, o = e.camera.position.distanceTo(r), i = e.camera.fov * Math.PI / 180, s = 2 * o * Math.tan(i / 2), l = n * Math.PI / 180, u = s / (2 * Math.tan(l / 2)), a = e.camera.position.clone().sub(r).normalize();
2221
- return e.camera.position.copy(r).addScaledVector(a, u), e.camera.fov = n, e.camera.updateProjectionMatrix(), e.controls.update(), !0;
2307
+ const n = Math.min(cr, Math.max(ar, t)), r = e.controls.target, o = e.camera.position.distanceTo(r), i = e.camera.fov * Math.PI / 180, s = 2 * o * Math.tan(i / 2), c = n * Math.PI / 180, u = s / (2 * Math.tan(c / 2)), l = e.camera.position.clone().sub(r).normalize();
2308
+ return e.camera.position.copy(r).addScaledVector(l, u), e.camera.fov = n, e.camera.updateProjectionMatrix(), e.controls.update(), !0;
2222
2309
  }
2223
- function wn(e, t = "orbit") {
2310
+ function dr(e, t = "orbit") {
2224
2311
  if (e.controlMode = t === "fly" ? "fly" : "orbit", e.controlMode === "fly")
2225
2312
  e.controls && (e.controls.enabled = !1), e.flyControls && (e.flyControls.enabled = !0);
2226
2313
  else if (e.flyControls && (e.flyControls.enabled = !1), e.controls) {
@@ -2229,39 +2316,57 @@ function wn(e, t = "orbit") {
2229
2316
  e.controls.target.copy(n), e.controls.update();
2230
2317
  }
2231
2318
  }
2232
- const ae = "#9ca3af";
2233
- function rt(e, t) {
2319
+ const at = "#ffffbb", mr = 2, fr = 1.5, hr = 1;
2320
+ function pr(e) {
2321
+ const { renderer: t, scene: n, camera: r, container: o } = e;
2322
+ if (!t || !n || !r) return;
2323
+ const i = (o == null ? void 0 : o.clientWidth) || t.domElement.clientWidth || 1, s = (o == null ? void 0 : o.clientHeight) || t.domElement.clientHeight || 1, c = new Yt(t), u = new qt(n, r);
2324
+ c.addPass(u);
2325
+ const l = new _.Vector2(i, s), a = new Xt(l, n, r);
2326
+ a.visibleEdgeColor.set(at), a.hiddenEdgeColor.set(at), a.edgeStrength = mr, a.edgeThickness = fr, a.edgeGlow = hr, a.pulsePeriod = 0, a.selectedObjects = [], c.addPass(a), c.setSize(i, s), e._composer = c, e._outlinePass = a;
2327
+ }
2328
+ function br(e, t, n) {
2329
+ !e._composer || !e._outlinePass || (e._composer.setSize(t, n), e._outlinePass.resolution.set(t, n));
2330
+ }
2331
+ function Ie(e, t) {
2332
+ e._outlinePass && (e._outlinePass.selectedObjects = t ? [t] : [], e._selectedObject = t || null);
2333
+ }
2334
+ function ct(e) {
2335
+ e._composer && (e._composer.dispose(), e._composer = null), e._outlinePass = null, e._selectedObject = null, e.selectables = [];
2336
+ }
2337
+ const de = "#9ca3af";
2338
+ function ut(e, t) {
2234
2339
  const n = Number(e == null ? void 0 : e.md), r = Number(t == null ? void 0 : t.md);
2235
2340
  if (!Number.isFinite(n) || !Number.isFinite(r)) return null;
2236
2341
  const o = Math.min(n, r), i = Math.max(n, r);
2237
2342
  return i <= o ? null : { segStart: o, segEnd: i };
2238
2343
  }
2239
- function Rn(e, t, n) {
2344
+ function yr(e, t, n) {
2240
2345
  let r = 0, o = 0;
2241
2346
  for (let s = 0; s < e.length; s += 1) {
2242
- const l = e[s], u = Number(l == null ? void 0 : l.from), a = Number(l == null ? void 0 : l.to), c = Number(l == null ? void 0 : l.value);
2243
- if (!Number.isFinite(u) || !Number.isFinite(a) || !Number.isFinite(c) || a <= u) continue;
2244
- const m = Math.max(t, u), f = Math.min(n, a) - m;
2245
- f <= 0 || (r += c * f, o += f);
2347
+ const c = e[s], u = Number(c == null ? void 0 : c.from), l = Number(c == null ? void 0 : c.to), a = Number(c == null ? void 0 : c.value);
2348
+ if (!Number.isFinite(u) || !Number.isFinite(l) || !Number.isFinite(a) || l <= u) continue;
2349
+ const d = Math.max(t, u), f = Math.min(n, l) - d;
2350
+ f <= 0 || (r += a * f, o += f);
2246
2351
  }
2247
2352
  if (o <= 0) return null;
2248
2353
  const i = r / o;
2249
2354
  return Number.isFinite(i) ? i : null;
2250
2355
  }
2251
- function $n(e, t) {
2252
- if (!Number.isFinite(e)) return new x.Color(ae);
2253
- if (xt(e, t) < 0) return new x.Color(ae);
2254
- const r = Nn(e, t, ae);
2255
- return new x.Color(r);
2356
+ function gr(e, t) {
2357
+ if (!Number.isFinite(e)) return new _.Color(de);
2358
+ if (Pt(e, t) < 0) return new _.Color(de);
2359
+ const r = Yn(e, t, de);
2360
+ return new _.Color(r);
2256
2361
  }
2257
- function Hn(e = {}) {
2362
+ function _r(e = {}) {
2258
2363
  return {
2259
2364
  preserveView: !!e.preserveView,
2260
2365
  assayIntervalsByHole: e.assayIntervalsByHole || null,
2261
2366
  selectedAssayVariable: e.selectedAssayVariable || ""
2262
2367
  };
2263
2368
  }
2264
- function jn(e, t) {
2369
+ function Nr(e, t) {
2265
2370
  if (!e || !t) return [];
2266
2371
  const n = [];
2267
2372
  return Object.values(e).forEach((r) => {
@@ -2271,282 +2376,404 @@ function jn(e, t) {
2271
2376
  });
2272
2377
  }), n;
2273
2378
  }
2274
- function Te(e) {
2379
+ function Ve(e) {
2275
2380
  return {
2276
2381
  holeId: e.id,
2277
2382
  project: e.project
2278
2383
  };
2279
2384
  }
2280
- class $r {
2385
+ function zr(e) {
2386
+ return `${e ?? ""}`.trim().toLowerCase();
2387
+ }
2388
+ function Mr(e, t) {
2389
+ const n = `${e ?? ""}:${t ?? 0}`, r = xr(n), o = (t ?? 0) % 14 / 14, i = (r * 0.15 + o * 0.85) % 1, s = new _.Color();
2390
+ return s.setHSL(i, 1, 0.5), s;
2391
+ }
2392
+ function xr(e) {
2393
+ const t = `${e ?? ""}`;
2394
+ let n = 2166136261;
2395
+ for (let r = 0; r < t.length; r += 1)
2396
+ n ^= t.charCodeAt(r), n = Math.imul(n, 16777619);
2397
+ return (n >>> 0) / 4294967295;
2398
+ }
2399
+ function Ir(e, t) {
2400
+ if (!t || !e) return [];
2401
+ const n = e.id || e.holeId;
2402
+ if (!n) return [];
2403
+ const r = t[n];
2404
+ if (Array.isArray(r) && r.length) return r;
2405
+ const o = zr(n);
2406
+ if (o) {
2407
+ const i = t[o];
2408
+ if (Array.isArray(i) && i.length) return i;
2409
+ }
2410
+ return [];
2411
+ }
2412
+ function Ar({ selectedAssayVariable: e, assayIntervals: t, assayScale: n, holeId: r, segmentIndex: o, p1: i, p2: s }) {
2413
+ if (!e)
2414
+ return Mr(r, o);
2415
+ if (e === "__HAS_ASSAY__") {
2416
+ if (!(t != null && t.length)) return new _.Color(de);
2417
+ const l = ut(i, s);
2418
+ return l ? t.some((d) => {
2419
+ const m = Number(d == null ? void 0 : d.from), f = Number(d == null ? void 0 : d.to);
2420
+ if (!Number.isFinite(m) || !Number.isFinite(f)) return !1;
2421
+ const b = Math.max(l.segStart, m);
2422
+ return Math.min(l.segEnd, f) > b;
2423
+ }) ? new _.Color("#ff8c42") : new _.Color(de) : new _.Color(de);
2424
+ }
2425
+ if (!(t != null && t.length)) return new _.Color(de);
2426
+ const c = ut(i, s);
2427
+ if (!c) return new _.Color(de);
2428
+ const u = yr(t, c.segStart, c.segEnd);
2429
+ return gr(u, n);
2430
+ }
2431
+ function Er(e, t, n = {}) {
2432
+ if (!e.scene || (Ot(e), !t || t.length === 0)) return;
2433
+ const { preserveView: r, assayIntervalsByHole: o, selectedAssayVariable: i } = _r(n), s = Nr(o, i), c = Gn(s);
2434
+ let u = 1 / 0, l = -1 / 0, a = 1 / 0, d = -1 / 0, m = 1 / 0, f = -1 / 0;
2435
+ const b = new _.Vector3(), p = new _.Vector3(0, 1, 0);
2436
+ t.forEach((h, N) => {
2437
+ const E = N * 137.5 % 360 / 360, M = new _.Color().setHSL(E, 0.75, 0.55), z = (h.points || []).map((x) => {
2438
+ u = Math.min(u, x.x), l = Math.max(l, x.x), a = Math.min(a, x.y), d = Math.max(d, x.y), m = Math.min(m, x.z), f = Math.max(f, x.z);
2439
+ const V = new _.Vector3(x.x, x.y, x.z);
2440
+ return V.md = x.md, V;
2441
+ });
2442
+ if (z.length < 2) {
2443
+ if (z.length === 1) {
2444
+ const x = new _.SphereGeometry(5, 12, 12), V = new _.MeshLambertMaterial({
2445
+ color: M,
2446
+ emissive: M,
2447
+ emissiveIntensity: 0.2
2448
+ }), H = new _.Mesh(x, V);
2449
+ H.position.copy(z[0]), H.userData = Ve(h), e.scene.add(H), e.drillLines.push(H), e.drillMeshes.push(H);
2450
+ }
2451
+ return;
2452
+ }
2453
+ const P = new _.Group();
2454
+ P.userData = Ve(h);
2455
+ const D = i ? Ir(h, o) : [];
2456
+ for (let x = 0; x < z.length - 1; x += 1) {
2457
+ const V = z[x], H = z[x + 1], W = b.subVectors(H, V), O = W.length();
2458
+ if (O <= 1e-3) continue;
2459
+ const $ = 2.2, j = new _.CylinderGeometry($, $, O, 6, 1, !0), S = Ar({
2460
+ selectedAssayVariable: i,
2461
+ assayIntervals: D,
2462
+ assayScale: c,
2463
+ holeId: h.id,
2464
+ segmentIndex: x,
2465
+ p1: V,
2466
+ p2: H
2467
+ }), I = new _.MeshLambertMaterial({
2468
+ color: S,
2469
+ flatShading: !0,
2470
+ emissive: S,
2471
+ emissiveIntensity: 0.15
2472
+ }), g = new _.Mesh(j, I);
2473
+ g.position.copy(V.clone().addScaledVector(W, 0.5)), g.quaternion.setFromUnitVectors(p, W.clone().normalize()), g.userData = Ve(h), P.add(g), e.drillMeshes.push(g);
2474
+ }
2475
+ e.scene.add(P), e.drillLines.push(P);
2476
+ }), e.camera && e.controls && (e.lastBounds = { minX: u, maxX: l, minY: a, maxY: d, minZ: m, maxZ: f }, r || We(e, { minX: u, maxX: l, minY: a, maxY: d, minZ: m, maxZ: f })), be(e);
2477
+ }
2478
+ function Ot(e) {
2479
+ e.drillLines.forEach((t) => {
2480
+ e.scene.remove(t), t.isGroup ? t.traverse((n) => {
2481
+ n.isMesh && (n.geometry.dispose(), n.material.dispose());
2482
+ }) : t.isMesh && (t.geometry.dispose(), t.material.dispose());
2483
+ }), e.drillLines = [], e.drillMeshes = [], be(e);
2484
+ }
2485
+ const vr = [
2486
+ { normal: [1, 0, 0], neibDir: [1, 0, 0], verts: [[1, -1, -1], [1, 1, -1], [1, 1, 1], [1, -1, 1]] },
2487
+ { normal: [-1, 0, 0], neibDir: [-1, 0, 0], verts: [[-1, -1, 1], [-1, 1, 1], [-1, 1, -1], [-1, -1, -1]] },
2488
+ { normal: [0, 1, 0], neibDir: [0, 1, 0], verts: [[-1, 1, 1], [1, 1, 1], [1, 1, -1], [-1, 1, -1]] },
2489
+ { normal: [0, -1, 0], neibDir: [0, -1, 0], verts: [[1, -1, 1], [-1, -1, 1], [-1, -1, -1], [1, -1, -1]] },
2490
+ { normal: [0, 0, 1], neibDir: [0, 0, 1], verts: [[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]] },
2491
+ { normal: [0, 0, -1], neibDir: [0, 0, -1], verts: [[1, -1, -1], [-1, -1, -1], [-1, 1, -1], [1, 1, -1]] }
2492
+ ];
2493
+ function Sr(e, t, n, r, o = {}) {
2494
+ if (!e.scene || (Tt(e), !t || !n || !r)) return;
2495
+ const { autoCenter: i = !0, opacity: s = 1 } = o;
2496
+ let c = 1 / 0, u = -1 / 0, l = 1 / 0, a = -1 / 0, d = 1 / 0, m = -1 / 0;
2497
+ t.forEach((g) => {
2498
+ const k = Number(g.x ?? g.center_x ?? 0), A = Number(g.y ?? g.center_y ?? 0), T = Number(g.z ?? g.center_z ?? 0), F = Number(g.dx ?? g.size_x ?? 1), C = Number(g.dy ?? g.size_y ?? 1), R = Number(g.dz ?? g.size_z ?? 1);
2499
+ c = Math.min(c, k - F / 2), u = Math.max(u, k + F / 2), l = Math.min(l, A - C / 2), a = Math.max(a, A + C / 2), d = Math.min(d, T - R / 2), m = Math.max(m, T + R / 2);
2500
+ });
2501
+ let f = 0, b = 0, p = 0;
2502
+ o.offset ? (f = Number(o.offset.x ?? 0), b = Number(o.offset.y ?? 0), p = Number(o.offset.z ?? 0)) : i && (f = -((c + u) / 2), b = -((l + a) / 2), p = -((d + m) / 2));
2503
+ const h = c + f, N = u + f, y = l + b, E = a + b, M = d + p, z = m + p, P = (g, k, A) => `${Math.round(g)},${Math.round(k)},${Math.round(A)}`, D = new Set(
2504
+ t.map((g) => P(Number(g.x ?? 0), Number(g.y ?? 0), Number(g.z ?? 0)))
2505
+ ), x = [], V = [], H = [], W = [], O = [];
2506
+ let $ = 0;
2507
+ if (t.forEach((g) => {
2508
+ const k = Number(g.x ?? g.center_x ?? 0), A = Number(g.y ?? g.center_y ?? 0), T = Number(g.z ?? g.center_z ?? 0), F = Number(g.dx ?? g.size_x ?? 1), C = Number(g.dy ?? g.size_y ?? 1), R = Number(g.dz ?? g.size_z ?? 1), X = k + f, re = A + b, me = T + p, se = zn(g[n], r, _), { r: Me, g: le, b: Le } = se;
2509
+ vr.forEach((fe) => {
2510
+ const Vt = k + fe.neibDir[0] * F, wt = A + fe.neibDir[1] * C, Ht = T + fe.neibDir[2] * R;
2511
+ if (D.has(P(Vt, wt, Ht))) return;
2512
+ const ye = $;
2513
+ fe.verts.forEach(([$t, jt, Rt]) => {
2514
+ x.push(X + $t * F / 2, re + jt * C / 2, me + Rt * R / 2), V.push(fe.normal[0], fe.normal[1], fe.normal[2]), H.push(Me, le, Le), $++;
2515
+ }), W.push(ye, ye + 1, ye + 2, ye, ye + 2, ye + 3), O.push(g);
2516
+ });
2517
+ }), x.length === 0) return;
2518
+ const j = new _.BufferGeometry();
2519
+ j.setAttribute("position", new _.Float32BufferAttribute(x, 3)), j.setAttribute("normal", new _.Float32BufferAttribute(V, 3)), j.setAttribute("color", new _.Float32BufferAttribute(H, 3)), j.setIndex(W);
2520
+ const S = new _.MeshLambertMaterial({
2521
+ vertexColors: !0,
2522
+ transparent: s < 1,
2523
+ opacity: s,
2524
+ side: _.DoubleSide
2525
+ }), I = new _.Mesh(j, S);
2526
+ I.userData._isMergedBlocks = !0, I.userData._quadToBlock = O, I.userData._offset = { x: f, y: b, z: p }, e.scene.add(I), e.blocks.push(I), be(e), e.camera && e.controls && (e.lastBounds = { minX: h, maxX: N, minY: y, maxY: E, minZ: M, maxZ: z }, We(e, { minX: h, maxX: N, minY: y, maxY: E, minZ: M, maxZ: z }));
2527
+ }
2528
+ function Tt(e) {
2529
+ var t;
2530
+ e.blocks.forEach((n) => {
2531
+ e.scene.remove(n), n.geometry.dispose(), n.material.dispose();
2532
+ }), e.blocks = [], e._blockHighlightMesh && ((t = e.scene) == null || t.remove(e._blockHighlightMesh), e._blockHighlightMesh.geometry.dispose(), e._blockHighlightMesh.material.dispose(), e._blockHighlightMesh = null), be(e);
2533
+ }
2534
+ function Pr(e, t) {
2535
+ const n = Math.max(0, Math.min(1, Number(t)));
2536
+ e.blocks.forEach((r) => {
2537
+ r.material && (r.material.opacity = n, r.material.transparent = n < 1, r.material.needsUpdate = !0);
2538
+ });
2539
+ }
2540
+ function Dr(e, t, n) {
2541
+ 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, c = Number(t.y ?? t.center_y ?? 0) + o, u = Number(t.z ?? t.center_z ?? 0) + i, l = Number(t.dx ?? t.size_x ?? 1), a = Number(t.dy ?? t.size_y ?? 1), d = Number(t.dz ?? t.size_z ?? 1);
2542
+ if (!e._blockHighlightMesh) {
2543
+ const m = new _.BoxGeometry(1, 1, 1), f = new _.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1 });
2544
+ e._blockHighlightMesh = new _.Mesh(m, f), e.scene.add(e._blockHighlightMesh);
2545
+ }
2546
+ return e._blockHighlightMesh.position.set(s, c, u), e._blockHighlightMesh.scale.set(l, a, d), e._blockHighlightMesh;
2547
+ }
2548
+ function Ft(e) {
2549
+ var o, i;
2550
+ if (!e._outlinePass || e.selectables.length === 0) {
2551
+ e._outlinePass && Ie(e, null);
2552
+ return;
2553
+ }
2554
+ const t = e.raycaster.intersectObjects(e.selectables, !0);
2555
+ if (t.length === 0) {
2556
+ Ie(e, null);
2557
+ return;
2558
+ }
2559
+ const n = t[0], r = n.object;
2560
+ if ((o = r == null ? void 0 : r.userData) != null && o._isMergedBlocks) {
2561
+ const s = Math.floor(n.faceIndex / 2), c = (i = r.userData._quadToBlock) == null ? void 0 : i[s];
2562
+ if (c) {
2563
+ Ie(e, Dr(e, c, r.userData._offset));
2564
+ return;
2565
+ }
2566
+ }
2567
+ Ie(e, r);
2568
+ }
2569
+ function kr(e) {
2570
+ const t = e.renderer;
2571
+ t && (e.handleCanvasClick = (n) => {
2572
+ var f, b, p, h, N, y, E;
2573
+ if (n.button !== 0) return;
2574
+ if ((f = e.gizmo) != null && f.domElement) {
2575
+ const M = e.gizmo.domElement.getBoundingClientRect();
2576
+ if (n.clientX >= M.left && n.clientX <= M.right && n.clientY >= M.top && n.clientY <= M.bottom)
2577
+ return;
2578
+ }
2579
+ const r = t.domElement.getBoundingClientRect(), o = n.clientX - r.left, i = n.clientY - r.top;
2580
+ if (e.pointer.x = o / r.width * 2 - 1, e.pointer.y = -(i / r.height * 2) + 1, e.raycaster.setFromCamera(e.pointer, e.camera), Ft(e), e.blocks.length > 0) {
2581
+ const M = e.raycaster.intersectObjects(e.blocks, !1);
2582
+ if (M.length > 0) {
2583
+ const z = M[0], P = z.object;
2584
+ if ((b = P == null ? void 0 : P.userData) != null && b._isMergedBlocks && e.blockClickHandler) {
2585
+ const D = Math.floor(z.faceIndex / 2), x = P.userData._quadToBlock[D];
2586
+ x && e.blockClickHandler(x);
2587
+ }
2588
+ return;
2589
+ }
2590
+ }
2591
+ const s = e.raycaster.intersectObjects(e.drillMeshes, !0), c = e.raycaster.intersectObjects(e.structuralMeshes, !0), u = ((p = s[0]) == null ? void 0 : p.distance) ?? 1 / 0;
2592
+ if ((((h = c[0]) == null ? void 0 : h.distance) ?? 1 / 0) < u && c.length > 0) {
2593
+ const M = c[0].object;
2594
+ e.drillholeClickHandler && e.drillholeClickHandler({ type: "structure", ...M.userData });
2595
+ return;
2596
+ }
2597
+ if (s.length === 0) return;
2598
+ let a = s[0].object;
2599
+ for (; a && a.parent && !((N = a.userData) != null && N.holeId); )
2600
+ a = a.parent;
2601
+ const d = (y = a == null ? void 0 : a.userData) == null ? void 0 : y.holeId, m = (E = a == null ? void 0 : a.userData) == null ? void 0 : E.project;
2602
+ d && e.drillholeClickHandler && e.drillholeClickHandler({ holeId: d, project: m });
2603
+ }, t.domElement.addEventListener("click", e.handleCanvasClick));
2604
+ }
2605
+ class Co {
2281
2606
  constructor() {
2282
- 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 x.Clock(), this.handleCanvasClick = null, this.raycaster = new x.Raycaster(), this.pointer = new x.Vector2(), this.drillholeClickHandler = null, this.controlMode = "orbit", this._tmpDir = new x.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0;
2607
+ 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 _.Clock(), this.handleCanvasClick = null, this.raycaster = new _.Raycaster(), this.pointer = new _.Vector2(), this.drillholeClickHandler = null, this.blockClickHandler = null, this.controlMode = "orbit", this._tmpDir = new _.Vector3(), this.viewChangeHandler = null, this._lastViewSignature = "", this._lastViewEmitMs = 0, this.selectables = [], this._selectedObject = null, this._composer = null, this._blockHighlightMesh = null, this._outlinePass = null;
2283
2608
  }
2284
2609
  init(t) {
2285
2610
  if (!t) return;
2286
2611
  this.container = t;
2287
2612
  const n = t.clientWidth, r = t.clientHeight;
2288
- this.scene = new x.Scene(), this.scene.background = new x.Color(16777215), this.camera = new x.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 x.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2289
- const o = new x.AmbientLight(16777215, 0.5);
2613
+ this.scene = new _.Scene(), this.scene.background = new _.Color(16777215), this.camera = new _.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 _.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(n, r), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.autoClear = !1, t.appendChild(this.renderer.domElement);
2614
+ const o = new _.AmbientLight(16777215, 0.5);
2290
2615
  this.scene.add(o);
2291
- const i = new x.DirectionalLight(16777215, 0.6);
2616
+ const i = new _.DirectionalLight(16777215, 0.6);
2292
2617
  i.position.set(10, 10, 5), this.scene.add(i);
2293
- const s = new x.AxesHelper(20);
2294
- this.scene.add(s), this.controls = new It(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 = {
2295
- LEFT: x.MOUSE.PAN,
2296
- MIDDLE: x.MOUSE.DOLLY,
2297
- RIGHT: x.MOUSE.ROTATE
2618
+ const s = new _.AxesHelper(20);
2619
+ this.scene.add(s), this.controls = new Bt(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 = {
2620
+ LEFT: _.MOUSE.PAN,
2621
+ MIDDLE: _.MOUSE.DOLLY,
2622
+ RIGHT: _.MOUSE.ROTATE
2298
2623
  }, this.controls.touches = {
2299
- ONE: x.TOUCH.ROTATE,
2300
- TWO: x.TOUCH.PAN
2301
- }, this.controls.maxPolarAngle = Math.PI, this.flyControls = new At(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 St(this.camera, this.renderer, {
2624
+ ONE: _.TOUCH.ROTATE,
2625
+ TWO: _.TOUCH.PAN
2626
+ }, this.controls.maxPolarAngle = Math.PI, this.flyControls = new Gt(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 Ut(this.camera, this.renderer, {
2302
2627
  container: this.container,
2303
2628
  placement: "top-right",
2304
2629
  size: 110,
2305
2630
  offset: { top: 12, right: 12 },
2306
2631
  animated: !0,
2307
2632
  speed: 1.5
2308
- }), this.gizmo.attachControls(this.controls), this._attachCanvasClickHandler();
2309
- const l = () => {
2310
- var a;
2311
- this.frameId = requestAnimationFrame(l);
2633
+ }), this.gizmo.attachControls(this.controls), kr(this), pr(this);
2634
+ const c = () => {
2635
+ var l;
2636
+ this.frameId = requestAnimationFrame(c);
2312
2637
  const u = this.clock.getDelta();
2313
- this.renderer.clear(), this.controlMode === "fly" && ((a = this.flyControls) != null && a.enabled) ? this.flyControls.update(u) : this.controls && this.controls.update(), this._emitViewChangeIfNeeded(), this.renderer.render(this.scene, this.camera), this.gizmo && this.gizmo.render();
2638
+ this.renderer.clear(), this.controlMode === "fly" && ((l = this.flyControls) != null && l.enabled) ? this.flyControls.update(u) : this.controls && this.controls.update(), this._emitViewChangeIfNeeded(), this._composer ? this._composer.render(u) : this.renderer.render(this.scene, this.camera), this.gizmo && this.gizmo.render();
2314
2639
  };
2315
- l();
2640
+ c();
2316
2641
  }
2642
+ resize() {
2643
+ if (!this.container || !this.camera || !this.renderer) return;
2644
+ const t = this.container.clientWidth, n = this.container.clientHeight;
2645
+ this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update(), br(this, t, n);
2646
+ }
2647
+ dispose() {
2648
+ 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, Tt(this), Ot(this), Ct(this), ct(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));
2649
+ }
2650
+ // ---------------------------------------------------------------------------
2651
+ // Data renderers — delegate to domain modules
2652
+ // ---------------------------------------------------------------------------
2653
+ setDrillholes(t, n = {}) {
2654
+ Er(this, t, n);
2655
+ }
2656
+ /**
2657
+ * Render block model data as a single merged mesh of exterior faces only.
2658
+ * @param {Array<Object>} data - Block rows (canonical column names)
2659
+ * @param {string} selectedProperty - Attribute column used for colouring
2660
+ * @param {Object} stats - Property statistics
2661
+ * @param {Object} [options]
2662
+ */
2663
+ setBlocks(t, n, r, o = {}) {
2664
+ Sr(this, t, n, r, o);
2665
+ }
2666
+ /**
2667
+ * Update the opacity of all currently rendered blocks.
2668
+ * @param {number} opacity - New opacity value between 0 and 1
2669
+ */
2670
+ setBlockOpacity(t) {
2671
+ Pr(this, t);
2672
+ }
2673
+ setStructuralDiscs(t, n, r = {}) {
2674
+ Qn(this, t, n, r);
2675
+ }
2676
+ setStructuralDiscsVisible(t) {
2677
+ er(this, t);
2678
+ }
2679
+ // ---------------------------------------------------------------------------
2680
+ // Click handlers
2681
+ // ---------------------------------------------------------------------------
2682
+ setDrillholeClickHandler(t) {
2683
+ this.drillholeClickHandler = t;
2684
+ }
2685
+ /**
2686
+ * Register a click handler for block selection.
2687
+ * @param {Function|null} handler - Callback ``(blockData) => void``, or null to clear
2688
+ */
2689
+ setBlockClickHandler(t) {
2690
+ this.blockClickHandler = typeof t == "function" ? t : null;
2691
+ }
2692
+ // ---------------------------------------------------------------------------
2693
+ // Camera controls — delegate to baselode3dCameraControls
2694
+ // ---------------------------------------------------------------------------
2317
2695
  setViewChangeHandler(t) {
2318
2696
  this.viewChangeHandler = typeof t == "function" ? t : null;
2319
2697
  }
2320
2698
  getViewState() {
2321
- return Mt(this);
2699
+ return Lt(this);
2322
2700
  }
2323
2701
  setViewState(t) {
2324
- return En(this, t);
2702
+ return tr(this, t);
2325
2703
  }
2326
2704
  _buildViewSignature(t) {
2327
- return Be(t);
2705
+ return Xe(t);
2328
2706
  }
2329
2707
  _emitViewChangeIfNeeded() {
2330
- vn(this);
2331
- }
2332
- _attachCanvasClickHandler() {
2333
- const t = this.renderer;
2334
- t && (this.handleCanvasClick = (n) => {
2335
- var f, y, p, h, g, b;
2336
- if (n.button !== 0) return;
2337
- if ((f = this.gizmo) != null && f.domElement) {
2338
- const _ = this.gizmo.domElement.getBoundingClientRect();
2339
- if (n.clientX >= _.left && n.clientX <= _.right && n.clientY >= _.top && n.clientY <= _.bottom)
2340
- return;
2341
- }
2342
- const r = t.domElement.getBoundingClientRect(), o = n.clientX - r.left, i = n.clientY - r.top;
2343
- this.pointer.x = o / r.width * 2 - 1, this.pointer.y = -(i / r.height * 2) + 1, this.raycaster.setFromCamera(this.pointer, this.camera);
2344
- const s = this.raycaster.intersectObjects(this.drillMeshes, !0), l = this.raycaster.intersectObjects(this.structuralMeshes, !0), u = ((y = s[0]) == null ? void 0 : y.distance) ?? 1 / 0;
2345
- if ((((p = l[0]) == null ? void 0 : p.distance) ?? 1 / 0) < u && l.length > 0) {
2346
- const _ = l[0].object;
2347
- this.drillholeClickHandler && this.drillholeClickHandler({ type: "structure", ..._.userData });
2348
- return;
2349
- }
2350
- if (s.length === 0) return;
2351
- let c = s[0].object;
2352
- for (; c && c.parent && !((h = c.userData) != null && h.holeId); )
2353
- c = c.parent;
2354
- const m = (g = c == null ? void 0 : c.userData) == null ? void 0 : g.holeId, d = (b = c == null ? void 0 : c.userData) == null ? void 0 : b.project;
2355
- m && this.drillholeClickHandler && this.drillholeClickHandler({ holeId: m, project: d });
2356
- }, t.domElement.addEventListener("click", this.handleCanvasClick));
2357
- }
2358
- resize() {
2359
- if (!this.container || !this.camera || !this.renderer) return;
2360
- const t = this.container.clientWidth, n = this.container.clientHeight;
2361
- this.camera.aspect = t / n, this.camera.updateProjectionMatrix(), this.renderer.setSize(t, n), this.gizmo && this.gizmo.update();
2362
- }
2363
- setBlocks(t, n, r) {
2364
- if (!this.scene || (this._clearBlocks(), !t || !n || !r)) return;
2365
- let o = 1 / 0, i = -1 / 0, s = 1 / 0, l = -1 / 0, u = 1 / 0, a = -1 / 0;
2366
- t.forEach((c) => {
2367
- const {
2368
- center_x: m = 0,
2369
- center_y: d = 0,
2370
- center_z: f = 0,
2371
- size_x: y = 1,
2372
- size_y: p = 1,
2373
- size_z: h = 1
2374
- } = c;
2375
- o = Math.min(o, m - y / 2), i = Math.max(i, m + y / 2), s = Math.min(s, d - p / 2), l = Math.max(l, d + p / 2), u = Math.min(u, f - h / 2), a = Math.max(a, f + h / 2);
2376
- const g = new x.BoxGeometry(y, p, h), b = Zt(c[n], r, x), _ = new x.MeshStandardMaterial({
2377
- color: b,
2378
- transparent: !0,
2379
- opacity: 0.7,
2380
- side: x.DoubleSide
2381
- }), I = new x.Mesh(g, _);
2382
- I.position.set(m, d, f), this.scene.add(I), this.blocks.push(I);
2383
- }), this.camera && this.controls && (this.lastBounds = { minX: o, maxX: i, minY: s, maxY: l, minZ: u, maxZ: a }, Le(this, { minX: o, maxX: i, minY: s, maxY: l, minZ: u, maxZ: a }));
2384
- }
2385
- setDrillholes(t, n = {}) {
2386
- if (!this.scene || (this._clearDrillholes(), !t || t.length === 0)) return;
2387
- const { preserveView: r, assayIntervalsByHole: o, selectedAssayVariable: i } = Hn(n), s = jn(o, i), l = _n(s);
2388
- let u = 1 / 0, a = -1 / 0, c = 1 / 0, m = -1 / 0, d = 1 / 0, f = -1 / 0;
2389
- const y = new x.Vector3(), p = new x.Vector3(0, 1, 0);
2390
- t.forEach((h, g) => {
2391
- const _ = g * 137.5 % 360 / 360, I = new x.Color().setHSL(_, 0.75, 0.55), N = (h.points || []).map((M) => {
2392
- u = Math.min(u, M.x), a = Math.max(a, M.x), c = Math.min(c, M.y), m = Math.max(m, M.y), d = Math.min(d, M.z), f = Math.max(f, M.z);
2393
- const F = new x.Vector3(M.x, M.y, M.z);
2394
- return F.md = M.md, F;
2395
- });
2396
- if (N.length < 2) {
2397
- if (N.length === 1) {
2398
- const M = new x.SphereGeometry(5, 12, 12), F = new x.MeshLambertMaterial({
2399
- color: I,
2400
- emissive: I,
2401
- emissiveIntensity: 0.2
2402
- }), j = new x.Mesh(M, F);
2403
- j.position.copy(N[0]), j.userData = Te(h), this.scene.add(j), this.drillLines.push(j), this.drillMeshes.push(j);
2404
- }
2405
- return;
2406
- }
2407
- const P = new x.Group();
2408
- P.userData = Te(h);
2409
- const E = i ? this._resolveAssayIntervalsForHole(h, o) : [];
2410
- for (let M = 0; M < N.length - 1; M += 1) {
2411
- const F = N[M], j = N[M + 1], W = y.subVectors(j, F), D = W.length();
2412
- if (D <= 1e-3) continue;
2413
- const G = 2.2, U = new x.CylinderGeometry(G, G, D, 6, 1, !0), S = this._getSegmentColor({
2414
- selectedAssayVariable: i,
2415
- assayIntervals: E,
2416
- assayScale: l,
2417
- holeId: h.id,
2418
- segmentIndex: M,
2419
- p1: F,
2420
- p2: j
2421
- }), C = new x.MeshLambertMaterial({
2422
- color: S,
2423
- flatShading: !0,
2424
- emissive: S,
2425
- emissiveIntensity: 0.15
2426
- }), v = new x.Mesh(U, C);
2427
- v.position.copy(F.clone().addScaledVector(W, 0.5)), v.quaternion.setFromUnitVectors(p, W.clone().normalize()), v.userData = Te(h), P.add(v), this.drillMeshes.push(v);
2428
- }
2429
- this.scene.add(P), this.drillLines.push(P);
2430
- }), this.camera && this.controls && (this.lastBounds = { minX: u, maxX: a, minY: c, maxY: m, minZ: d, maxZ: f }, r || Le(this, { minX: u, maxX: a, minY: c, maxY: m, minZ: d, maxZ: f }));
2431
- }
2432
- _getSegmentColor({ selectedAssayVariable: t, assayIntervals: n, assayScale: r, holeId: o, segmentIndex: i, p1: s, p2: l }) {
2433
- if (!t)
2434
- return Bn(o, i);
2435
- if (t === "__HAS_ASSAY__") {
2436
- if (!(n != null && n.length)) return new x.Color(ae);
2437
- const c = rt(s, l);
2438
- return c ? n.some((d) => {
2439
- const f = Number(d == null ? void 0 : d.from), y = Number(d == null ? void 0 : d.to);
2440
- if (!Number.isFinite(f) || !Number.isFinite(y)) return !1;
2441
- const p = Math.max(c.segStart, f);
2442
- return Math.min(c.segEnd, y) > p;
2443
- }) ? new x.Color("#ff8c42") : new x.Color(ae) : new x.Color(ae);
2444
- }
2445
- if (!(n != null && n.length)) return new x.Color(ae);
2446
- const u = rt(s, l);
2447
- if (!u) return new x.Color(ae);
2448
- const a = Rn(n, u.segStart, u.segEnd);
2449
- return $n(a, r);
2450
- }
2451
- _resolveAssayIntervalsForHole(t, n) {
2452
- if (!n || !t) return [];
2453
- const r = t.id || t.holeId;
2454
- if (!r) return [];
2455
- const o = n[r];
2456
- if (Array.isArray(o) && o.length) return o;
2457
- const i = Gn(r);
2458
- if (i) {
2459
- const s = n[i];
2460
- if (Array.isArray(s) && s.length) return s;
2461
- }
2462
- return [];
2708
+ nr(this);
2463
2709
  }
2464
2710
  _fitCameraToBounds({ minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s }) {
2465
- Le(this, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s });
2711
+ We(this, { minX: t, maxX: n, minY: r, maxY: o, minZ: i, maxZ: s });
2466
2712
  }
2467
2713
  recenterCameraToOrigin(t = 1e3) {
2468
- Pn(this, t);
2714
+ rr(this, t);
2469
2715
  }
2470
2716
  lookDown(t = 2e3) {
2471
- Dn(this, t);
2717
+ or(this, t);
2472
2718
  }
2473
2719
  pan(t = 0, n = 0) {
2474
- Ln(this, t, n);
2720
+ ir(this, t, n);
2475
2721
  }
2476
2722
  dolly(t = 1.1) {
2477
- Tn(this, t);
2723
+ sr(this, t);
2478
2724
  }
2479
2725
  focusOnLastBounds(t = 1.2) {
2480
- Fn(this, t);
2481
- }
2482
- _clearBlocks() {
2483
- this.blocks.forEach((t) => {
2484
- this.scene.remove(t), t.geometry.dispose(), t.material.dispose();
2485
- }), this.blocks = [];
2486
- }
2487
- setStructuralDiscs(t, n, r = {}) {
2488
- if (!this.scene || (this._clearStructuralDiscs(), !(t != null && t.length) || !(n != null && n.length))) return;
2489
- const { maxDiscs: o = 3e3 } = r;
2490
- let i = t;
2491
- if (i.length > o) {
2492
- const u = i.length / o, a = [];
2493
- for (let c = 0; c < o; c++)
2494
- a.push(i[Math.floor(c * u)]);
2495
- i = a;
2496
- }
2497
- const s = n.flatMap((u) => (u.points || []).map((a) => ({ ...a, hole_id: u.id }))), l = nn(i, s, r);
2498
- l.length && (this.structuralGroup = Sn(l, r), this.scene.add(this.structuralGroup), this.structuralGroup.traverse((u) => {
2499
- u.isMesh && this.structuralMeshes.push(u);
2500
- }));
2726
+ lr(this, t);
2501
2727
  }
2502
2728
  /**
2503
2729
  * Change the camera field-of-view while keeping the visible scene the same apparent size.
2504
- * FOV is clamped to [FOV_MIN_DEG, FOV_MAX_DEG]. Delegates to setFov in baselode3dCameraControls.
2505
2730
  * @param {number} fovDeg - Desired FOV in degrees
2506
2731
  */
2507
2732
  setCameraFov(t) {
2508
- Vn(this, t);
2733
+ ur(this, t);
2509
2734
  }
2510
- setStructuralDiscsVisible(t) {
2511
- this.structuralGroup && (this.structuralGroup.visible = !!t);
2735
+ setControlMode(t = "orbit") {
2736
+ dr(this, t);
2512
2737
  }
2513
- _clearStructuralDiscs() {
2514
- this.structuralGroup && (this.scene.remove(this.structuralGroup), this.structuralGroup.traverse((t) => {
2515
- t.isMesh && (t.geometry.dispose(), t.material.dispose());
2516
- }), this.structuralGroup = null), this.structuralMeshes = [];
2738
+ // ---------------------------------------------------------------------------
2739
+ // Selection glow public API
2740
+ // ---------------------------------------------------------------------------
2741
+ _syncSelectables() {
2742
+ be(this);
2517
2743
  }
2518
- _clearDrillholes() {
2519
- this.drillLines.forEach((t) => {
2520
- this.scene.remove(t), t.isGroup ? t.traverse((n) => {
2521
- n.isMesh && (n.geometry.dispose(), n.material.dispose());
2522
- }) : t.isMesh && (t.geometry.dispose(), t.material.dispose());
2523
- }), this.drillLines = [], this.drillMeshes = [];
2744
+ /**
2745
+ * Register the objects that are candidates for click-select glow.
2746
+ * @param {THREE.Object3D[]} objects
2747
+ */
2748
+ setSelectableObjects(t) {
2749
+ this.selectables = Array.isArray(t) ? t.slice() : [];
2524
2750
  }
2525
- dispose() {
2526
- 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, this._clearBlocks(), this._clearDrillholes(), this._clearStructuralDiscs(), 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));
2751
+ /**
2752
+ * Programmatically select an object (or pass null to clear).
2753
+ * @param {THREE.Object3D|null} object
2754
+ */
2755
+ selectObject(t) {
2756
+ Ie(this, t || null);
2527
2757
  }
2528
- setDrillholeClickHandler(t) {
2529
- this.drillholeClickHandler = t;
2758
+ /**
2759
+ * Return the currently selected object, or null if nothing is selected.
2760
+ * @returns {THREE.Object3D|null}
2761
+ */
2762
+ getSelectedObject() {
2763
+ return this._selectedObject || null;
2530
2764
  }
2531
- setControlMode(t = "orbit") {
2532
- wn(this, t);
2765
+ /**
2766
+ * Dispose the effect composer and all GPU resources used by the selection glow.
2767
+ */
2768
+ disposeGlow() {
2769
+ ct(this);
2770
+ }
2771
+ /** @private */
2772
+ _updateSelectionFromPointer() {
2773
+ Ft(this);
2533
2774
  }
2534
2775
  }
2535
- function Gn(e) {
2536
- return `${e ?? ""}`.trim().toLowerCase();
2537
- }
2538
- function Bn(e, t) {
2539
- const n = `${e ?? ""}:${t ?? 0}`, r = Un(n), o = (t ?? 0) % 14 / 14, i = (r * 0.15 + o * 0.85) % 1, s = new x.Color();
2540
- return s.setHSL(i, 1, 0.5), s;
2541
- }
2542
- function Un(e) {
2543
- const t = `${e ?? ""}`;
2544
- let n = 2166136261;
2545
- for (let r = 0; r < t.length; r += 1)
2546
- n ^= t.charCodeAt(r), n = Math.imul(n, 16777619);
2547
- return (n >>> 0) / 4294967295;
2548
- }
2549
- function Hr({
2776
+ function Lo({
2550
2777
  controlMode: e = "orbit",
2551
2778
  onToggleFly: t = () => {
2552
2779
  },
@@ -2557,134 +2784,225 @@ function Hr({
2557
2784
  onFit: o = () => {
2558
2785
  }
2559
2786
  }) {
2560
- return /* @__PURE__ */ Ne("div", { className: "baselode-3d-controls", children: [
2561
- /* @__PURE__ */ q("button", { type: "button", className: "ghost-button", onClick: n, children: "Recenter to (0,0,0)" }),
2562
- /* @__PURE__ */ q("button", { type: "button", className: "ghost-button", onClick: r, children: "Look down" }),
2563
- /* @__PURE__ */ q("button", { type: "button", className: "ghost-button", onClick: o, children: "Fit to scene" }),
2564
- /* @__PURE__ */ q("button", { type: "button", className: "ghost-button", onClick: t, children: e === "orbit" ? "Enable fly controls" : "Disable fly controls" })
2787
+ return /* @__PURE__ */ Q("div", { className: "baselode-3d-controls", children: [
2788
+ /* @__PURE__ */ L("button", { type: "button", className: "ghost-button", onClick: n, children: "Recenter to (0,0,0)" }),
2789
+ /* @__PURE__ */ L("button", { type: "button", className: "ghost-button", onClick: r, children: "Look down" }),
2790
+ /* @__PURE__ */ L("button", { type: "button", className: "ghost-button", onClick: o, children: "Fit to scene" }),
2791
+ /* @__PURE__ */ L("button", { type: "button", className: "ghost-button", onClick: t, children: e === "orbit" ? "Enable fly controls" : "Disable fly controls" })
2792
+ ] });
2793
+ }
2794
+ function Oo({
2795
+ properties: e = [],
2796
+ selectedProperty: t = "",
2797
+ onPropertyChange: n = () => {
2798
+ },
2799
+ opacity: r = 0.85,
2800
+ onOpacityChange: o = () => {
2801
+ },
2802
+ propertyStats: i = null,
2803
+ clickedBlock: s = null,
2804
+ onPopupClose: c = () => {
2805
+ }
2806
+ }) {
2807
+ var u, l;
2808
+ return /* @__PURE__ */ Q("div", { className: "bm-widget", children: [
2809
+ /* @__PURE__ */ L("label", { className: "bm-widget__label", htmlFor: "bm-property-select", children: "Color by" }),
2810
+ /* @__PURE__ */ Q(
2811
+ "select",
2812
+ {
2813
+ id: "bm-property-select",
2814
+ className: "bm-widget__select",
2815
+ value: t,
2816
+ onChange: (a) => n(a.target.value),
2817
+ children: [
2818
+ e.length === 0 && /* @__PURE__ */ L("option", { value: "", children: "— no attributes —" }),
2819
+ e.map((a) => /* @__PURE__ */ L("option", { value: a, children: a }, a))
2820
+ ]
2821
+ }
2822
+ ),
2823
+ i && i.type === "numeric" && /* @__PURE__ */ Q("div", { className: "bm-widget__scale", children: [
2824
+ /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--min", children: ((u = i.min) == null ? void 0 : u.toFixed(2)) ?? "—" }),
2825
+ /* @__PURE__ */ L("div", { className: "bm-widget__scale-bar" }),
2826
+ /* @__PURE__ */ L("span", { className: "bm-widget__scale-label bm-widget__scale-label--max", children: ((l = i.max) == null ? void 0 : l.toFixed(2)) ?? "—" })
2827
+ ] }),
2828
+ i && i.type === "categorical" && /* @__PURE__ */ L("div", { className: "bm-widget__categories", children: (i.categories || []).map((a, d) => {
2829
+ const m = Math.round(d / Math.max(i.categories.length, 1) * 360);
2830
+ return /* @__PURE__ */ L(
2831
+ "span",
2832
+ {
2833
+ className: "bm-widget__category-chip",
2834
+ style: { background: `hsl(${m},70%,50%)` },
2835
+ children: a
2836
+ },
2837
+ a
2838
+ );
2839
+ }) }),
2840
+ /* @__PURE__ */ Q("label", { className: "bm-widget__label", htmlFor: "bm-opacity-slider", children: [
2841
+ "Opacity (",
2842
+ Math.round(r * 100),
2843
+ "%)"
2844
+ ] }),
2845
+ /* @__PURE__ */ L(
2846
+ "input",
2847
+ {
2848
+ id: "bm-opacity-slider",
2849
+ type: "range",
2850
+ className: "bm-widget__slider",
2851
+ min: "0",
2852
+ max: "1",
2853
+ step: "0.01",
2854
+ value: r,
2855
+ onChange: (a) => o(parseFloat(a.target.value))
2856
+ }
2857
+ ),
2858
+ s && /* @__PURE__ */ Q("div", { className: "bm-widget__popup", children: [
2859
+ /* @__PURE__ */ Q("div", { className: "bm-widget__popup-header", children: [
2860
+ /* @__PURE__ */ L("span", { children: "Block attributes" }),
2861
+ /* @__PURE__ */ L(
2862
+ "button",
2863
+ {
2864
+ type: "button",
2865
+ className: "bm-widget__popup-close",
2866
+ onClick: c,
2867
+ "aria-label": "Close",
2868
+ children: "×"
2869
+ }
2870
+ )
2871
+ ] }),
2872
+ /* @__PURE__ */ L("table", { className: "bm-widget__popup-table", children: /* @__PURE__ */ L("tbody", { children: Object.entries(s).map(([a, d]) => /* @__PURE__ */ Q("tr", { children: [
2873
+ /* @__PURE__ */ L("th", { children: a }),
2874
+ /* @__PURE__ */ L("td", { children: d == null ? "—" : String(d) })
2875
+ ] }, a)) }) })
2876
+ ] })
2565
2877
  ] });
2566
2878
  }
2567
2879
  export {
2568
- gn as ASSAY_COLOR_PALETTE_10,
2569
- Pt as ASSAY_NON_VALUE_FIELDS,
2570
- O as AZIMUTH,
2571
- tr as BASELODE_DATA_MODEL_DRILL_ASSAY,
2572
- Qn as BASELODE_DATA_MODEL_DRILL_COLLAR,
2573
- er as BASELODE_DATA_MODEL_DRILL_SURVEY,
2574
- nr as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
2575
- Hr as Baselode3DControls,
2576
- $r as Baselode3DScene,
2577
- Ue as CHART_OPTIONS,
2578
- wt as COMMENT_COLUMN_NAMES,
2579
- it as CRS,
2580
- vt as DEFAULT_COLUMN_MAP,
2581
- H as DEPTH,
2582
- k as DIP,
2583
- _e as DISPLAY_CATEGORICAL,
2584
- pe as DISPLAY_COMMENT,
2585
- Ce as DISPLAY_HIDDEN,
2586
- ye as DISPLAY_NUMERIC,
2587
- Oe as DISPLAY_TADPOLE,
2588
- ie as EASTING,
2589
- he as ELEVATION,
2590
- on as ERROR_COLOR,
2591
- kn as FOV_MAX_DEG,
2592
- On as FOV_MIN_DEG,
2593
- B as FROM,
2594
- Ye as HIDDEN_COLUMNS,
2595
- z as HOLE_ID,
2596
- ee as LATITUDE,
2597
- te as LONGITUDE,
2598
- Ve as MID,
2599
- se as NORTHING,
2600
- We as NUMERIC_LINE_COLOR,
2601
- rn as NUMERIC_MARKER_COLOR,
2602
- re as PROJECT_ID,
2603
- Et as STRIKE,
2604
- R as TO,
2605
- Tr as TracePlot,
2606
- tn as alphaBetaToNormal,
2607
- Rr as annotationsFromIntervals,
2608
- Cr as assembleDataset,
2609
- yr as attachAssayPositions,
2610
- hr as balancedTangentialDesurvey,
2611
- jt as buildAssayState,
2612
- pn as buildCommentsConfig,
2613
- _n as buildEqualRangeColorScale,
2614
- ln as buildIntervalPoints,
2615
- mn as buildPlotConfig,
2616
- Lr as buildStrikeDipSymbol,
2617
- Sn as buildStructuralDiscs,
2618
- Dr as buildStructuralStripConfig,
2619
- fn as buildTadpoleConfig,
2620
- pr as buildTraces,
2621
- Be as buildViewSignature,
2622
- Ar as calculatePropertyStats,
2623
- Rt as classifyColumns,
2624
- Mr as coerceNumeric,
2625
- nn as computeStructuralPositions,
2626
- cr as defaultChartType,
2627
- Ie as deriveAssayProps,
2628
- dr as desurveyTraces,
2629
- An as dipAzimuthToNormal,
2630
- Tn as dolly,
2631
- vn as emitViewChangeIfNeeded,
2632
- zr as filterByProject,
2633
- Le as fitCameraToBounds,
2634
- Fn as focusOnLastBounds,
2635
- we as getChartOptions,
2636
- Zt as getColorForValue,
2637
- xt as getEqualRangeBinIndex,
2638
- Nn as getEqualRangeColor,
2639
- Mt as getViewState,
2640
- Kt as groupRowsByHole,
2641
- an as holeHasData,
2642
- en as interpolateTrace,
2643
- wr as intervalsAsTubes,
2644
- Nr as joinAssaysToTraces,
2645
- ur as loadAssayFile,
2646
- Ht as loadAssayHole,
2647
- $t as loadAssayMetadata,
2648
- xr as loadAssays,
2649
- gr as loadCollars,
2650
- _r as loadSurveys,
2651
- $e as loadTable,
2652
- ir as logDataInfo,
2653
- or as logDataWarning,
2654
- Dn as lookDown,
2655
- Ut as minimumCurvatureDesurvey,
2656
- ar as normalizeCsvRow,
2657
- ze as normalizeFieldName,
2658
- Ln as pan,
2659
- Qt as parseAssayCsvTextToHoles,
2660
- Ot as parseAssayHole,
2661
- sr as parseAssayHoleIds,
2662
- Ft as parseAssayHoleIdsWithAssays,
2663
- kt as parseAssaysCSV,
2664
- Ir as parseBlockModelCSV,
2665
- br as parseDrillholesCSV,
2666
- Jt as parseStructuralCSV,
2667
- vr as parseStructuralIntervalsCSV,
2668
- Er as parseStructuralPointsCSV,
2669
- mr as parseSurveyCSV,
2670
- Pr as parseUnifiedDataset,
2671
- lr as pickFirstPresent,
2672
- Or as planView,
2673
- zn as projectTraceToSection,
2674
- Pn as recenterCameraToOrigin,
2675
- mt as reorderHoleIds,
2676
- kr as sectionView,
2677
- Mn as sectionWindow,
2678
- wn as setControlMode,
2679
- Vn as setFov,
2680
- En as setViewState,
2681
- ue as standardizeColumns,
2682
- rr as standardizeRowArray,
2683
- fr as tangentialDesurvey,
2684
- Dt as toError,
2685
- Vr as tracesAsSegments,
2686
- Fr as useDrillholeTraceGrid,
2687
- Sr as validateStructuralPoints,
2688
- $ as withDataErrorContext
2880
+ Bn as ASSAY_COLOR_PALETTE_10,
2881
+ Kt as ASSAY_NON_VALUE_FIELDS,
2882
+ B as AZIMUTH,
2883
+ Gr as BASELODE_DATA_MODEL_DRILL_ASSAY,
2884
+ Rr as BASELODE_DATA_MODEL_DRILL_COLLAR,
2885
+ Br as BASELODE_DATA_MODEL_DRILL_SURVEY,
2886
+ Ur as BASELODE_DATA_MODEL_STRUCTURAL_POINT,
2887
+ Lo as Baselode3DControls,
2888
+ Co as Baselode3DScene,
2889
+ Oo as BlockModelWidget,
2890
+ Ze as CHART_OPTIONS,
2891
+ sn as COMMENT_COLUMN_NAMES,
2892
+ mt as CRS,
2893
+ Zt as DEFAULT_COLUMN_MAP,
2894
+ Y as DEPTH,
2895
+ G as DIP,
2896
+ Ae as DISPLAY_CATEGORICAL,
2897
+ Ne as DISPLAY_COMMENT,
2898
+ Pe as DISPLAY_HIDDEN,
2899
+ ze as DISPLAY_NUMERIC,
2900
+ He as DISPLAY_TADPOLE,
2901
+ ce as EASTING,
2902
+ _e as ELEVATION,
2903
+ Dn as ERROR_COLOR,
2904
+ cr as FOV_MAX_DEG,
2905
+ ar as FOV_MIN_DEG,
2906
+ q as FROM,
2907
+ Ke as HIDDEN_COLUMNS,
2908
+ v as HOLE_ID,
2909
+ te as LATITUDE,
2910
+ ne as LONGITUDE,
2911
+ je as MID,
2912
+ ue as NORTHING,
2913
+ tt as NUMERIC_LINE_COLOR,
2914
+ Pn as NUMERIC_MARKER_COLOR,
2915
+ ie as PROJECT_ID,
2916
+ Wt as STRIKE,
2917
+ U as TO,
2918
+ Ao as TracePlot,
2919
+ vn as alphaBetaToNormal,
2920
+ ko as annotationsFromIntervals,
2921
+ ho as assembleDataset,
2922
+ io as attachAssayPositions,
2923
+ ro as balancedTangentialDesurvey,
2924
+ un as buildAssayState,
2925
+ $n as buildCommentsConfig,
2926
+ Gn as buildEqualRangeColorScale,
2927
+ Ln as buildIntervalPoints,
2928
+ Fn as buildPlotConfig,
2929
+ Io as buildStrikeDipSymbol,
2930
+ Jn as buildStructuralDiscs,
2931
+ xo as buildStructuralStripConfig,
2932
+ wn as buildTadpoleConfig,
2933
+ oo as buildTraces,
2934
+ Xe as buildViewSignature,
2935
+ go as calculateBlockVolume,
2936
+ _n as calculatePropertyStats,
2937
+ ln as classifyColumns,
2938
+ fo as coerceNumeric,
2939
+ Sn as computeStructuralPositions,
2940
+ Jr as defaultChartType,
2941
+ De as deriveAssayProps,
2942
+ to as desurveyTraces,
2943
+ Kn as dipAzimuthToNormal,
2944
+ sr as dolly,
2945
+ nr as emitViewChangeIfNeeded,
2946
+ Nn as filterBlocks,
2947
+ mo as filterByProject,
2948
+ We as fitCameraToBounds,
2949
+ lr as focusOnLastBounds,
2950
+ yo as getBlockStats,
2951
+ Re as getChartOptions,
2952
+ zn as getColorForValue,
2953
+ Pt as getEqualRangeBinIndex,
2954
+ Yn as getEqualRangeColor,
2955
+ Lt as getViewState,
2956
+ xn as groupRowsByHole,
2957
+ Cn as holeHasData,
2958
+ En as interpolateTrace,
2959
+ Do as intervalsAsTubes,
2960
+ uo as joinAssaysToTraces,
2961
+ Qr as loadAssayFile,
2962
+ cn as loadAssayHole,
2963
+ an as loadAssayMetadata,
2964
+ co as loadAssays,
2965
+ bo as loadBlockModelMetadata,
2966
+ lo as loadCollars,
2967
+ ao as loadSurveys,
2968
+ Ge as loadTable,
2969
+ Xr as logDataInfo,
2970
+ qr as logDataWarning,
2971
+ or as lookDown,
2972
+ fn as minimumCurvatureDesurvey,
2973
+ gn as normalizeBlockRow,
2974
+ Zr as normalizeCsvRow,
2975
+ ve as normalizeFieldName,
2976
+ ir as pan,
2977
+ An as parseAssayCsvTextToHoles,
2978
+ nn as parseAssayHole,
2979
+ Wr as parseAssayHoleIds,
2980
+ tn as parseAssayHoleIdsWithAssays,
2981
+ rn as parseAssaysCSV,
2982
+ po as parseBlockModelCSV,
2983
+ so as parseDrillholesCSV,
2984
+ In as parseStructuralCSV,
2985
+ zo as parseStructuralIntervalsCSV,
2986
+ No as parseStructuralPointsCSV,
2987
+ eo as parseSurveyCSV,
2988
+ Mo as parseUnifiedDataset,
2989
+ Kr as pickFirstPresent,
2990
+ vo as planView,
2991
+ qn as projectTraceToSection,
2992
+ rr as recenterCameraToOrigin,
2993
+ gt as reorderHoleIds,
2994
+ So as sectionView,
2995
+ Xn as sectionWindow,
2996
+ dr as setControlMode,
2997
+ ur as setFov,
2998
+ tr as setViewState,
2999
+ pe as standardizeColumns,
3000
+ Yr as standardizeRowArray,
3001
+ no as tangentialDesurvey,
3002
+ Jt as toError,
3003
+ Po as tracesAsSegments,
3004
+ Eo as useDrillholeTraceGrid,
3005
+ _o as validateStructuralPoints,
3006
+ w as withDataErrorContext
2689
3007
  };
2690
3008
  //# sourceMappingURL=baselode.js.map