baselode 0.1.9 → 0.1.11

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