baselode 0.1.4 → 0.1.6

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