bravais 0.2.0 → 0.2.1

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/bravais.js CHANGED
@@ -1,15 +1,21 @@
1
- import { ACESFilmicToneMapping as e, AlwaysStencilFunc as t, AmbientLight as n, Box3 as r, BoxGeometry as i, BufferGeometry as a, CanvasTexture as o, Color as s, ConeGeometry as c, Controls as l, CylinderGeometry as u, DataTexture as d, DirectionalLight as f, DoubleSide as p, EqualStencilFunc as m, Float32BufferAttribute as h, FloatType as g, Fog as ee, Group as _, InstancedMesh as v, LineBasicMaterial as y, LineSegments as b, LinearFilter as x, LinearMipmapLinearFilter as te, MOUSE as S, MathUtils as ne, Matrix4 as C, Mesh as w, MeshStandardMaterial as T, NearestFilter as E, NotEqualStencilFunc as D, Object3D as O, OrthographicCamera as k, PlaneGeometry as re, Quaternion as A, RGBAFormat as ie, ReplaceStencilOp as ae, SRGBColorSpace as oe, Scene as se, SphereGeometry as ce, Sprite as le, SpriteMaterial as ue, Vector2 as j, Vector3 as M, WebGLRenderer as N } from "three";
2
- //#region src/cif/tokenizer.ts
3
- var P = class extends Error {
1
+ import { ACESFilmicToneMapping as e, AlwaysStencilFunc as t, AmbientLight as n, Box3 as r, BoxGeometry as i, BufferGeometry as a, CanvasTexture as o, Color as s, ConeGeometry as c, Controls as l, CylinderGeometry as u, DataTexture as d, DirectionalLight as f, DoubleSide as p, EqualStencilFunc as m, Float32BufferAttribute as h, FloatType as g, Fog as ee, Group as _, InstancedMesh as v, LineBasicMaterial as y, LineSegments as b, LinearFilter as x, LinearMipmapLinearFilter as te, MOUSE as S, MathUtils as ne, Matrix4 as re, Mesh as C, MeshStandardMaterial as w, NearestFilter as T, NotEqualStencilFunc as ie, Object3D as E, OrthographicCamera as D, PlaneGeometry as ae, Quaternion as O, RGBAFormat as oe, ReplaceStencilOp as se, SRGBColorSpace as ce, Scene as le, SphereGeometry as ue, Sprite as de, SpriteMaterial as fe, Vector2 as k, Vector3 as A, WebGLRenderer as j } from "three";
2
+ //#region src/cif/errors.ts
3
+ var M = class extends Error {
4
4
  line;
5
5
  constructor(e, t) {
6
6
  super(`CIF line ${t}: ${e}`), this.name = "CifSyntaxError", this.line = t;
7
7
  }
8
+ }, N = class extends Error {
9
+ constructor(e) {
10
+ super(e), this.name = "CifStructureError";
11
+ }
8
12
  };
9
- function F(e) {
13
+ //#endregion
14
+ //#region src/cif/tokenizer.ts
15
+ function P(e) {
10
16
  return e === " " || e === " " || e === "\r" || e === "\n";
11
17
  }
12
- function de(e, t) {
18
+ function pe(e, t) {
13
19
  let n = e.toLowerCase();
14
20
  return e.startsWith("_") ? {
15
21
  kind: "tag",
@@ -37,7 +43,7 @@ function de(e, t) {
37
43
  line: t
38
44
  };
39
45
  }
40
- function fe(e) {
46
+ function me(e) {
41
47
  let t = [], n = e.split(/\r\n|\r|\n/), r = 0;
42
48
  for (; r < n.length;) {
43
49
  let e = n[r] ?? "", i = r + 1;
@@ -54,7 +60,7 @@ function fe(e) {
54
60
  }
55
61
  a.push(e), r += 1;
56
62
  }
57
- if (!o) throw new P("unterminated text field", i);
63
+ if (!o) throw new M("unterminated text field", i);
58
64
  t.push({
59
65
  kind: "value",
60
66
  text: a.join("\n"),
@@ -65,7 +71,7 @@ function fe(e) {
65
71
  let a = 0;
66
72
  for (; a < e.length;) {
67
73
  let n = e.charAt(a);
68
- if (F(n)) {
74
+ if (P(n)) {
69
75
  a += 1;
70
76
  continue;
71
77
  }
@@ -74,15 +80,15 @@ function fe(e) {
74
80
  let r = a + 1;
75
81
  for (; r < e.length;) {
76
82
  let t = e.indexOf(n, r);
77
- if (t === -1) throw new P("unterminated quoted string", i);
83
+ if (t === -1) throw new M("unterminated quoted string", i);
78
84
  let a = e.charAt(t + 1);
79
- if (t + 1 >= e.length || F(a)) {
85
+ if (t + 1 >= e.length || P(a)) {
80
86
  r = t;
81
87
  break;
82
88
  }
83
89
  r = t + 1;
84
90
  }
85
- if (r >= e.length) throw new P("unterminated quoted string", i);
91
+ if (r >= e.length) throw new M("unterminated quoted string", i);
86
92
  t.push({
87
93
  kind: "value",
88
94
  text: e.slice(a + 1, r),
@@ -91,8 +97,8 @@ function fe(e) {
91
97
  continue;
92
98
  }
93
99
  let r = a;
94
- for (; r < e.length && !F(e.charAt(r));) r += 1;
95
- t.push(de(e.slice(a, r), i)), a = r;
100
+ for (; r < e.length && !P(e.charAt(r));) r += 1;
101
+ t.push(pe(e.slice(a, r), i)), a = r;
96
102
  }
97
103
  r += 1;
98
104
  }
@@ -100,10 +106,10 @@ function fe(e) {
100
106
  }
101
107
  //#endregion
102
108
  //#region src/cif/parser.ts
103
- function pe(e) {
109
+ function he(e) {
104
110
  return typeof e == "string" ? [e] : e;
105
111
  }
106
- var me = class {
112
+ var ge = class {
107
113
  name;
108
114
  items = /* @__PURE__ */ new Map();
109
115
  loops = [];
@@ -111,41 +117,41 @@ var me = class {
111
117
  this.name = e;
112
118
  }
113
119
  get(e) {
114
- for (let t of pe(e)) {
120
+ for (let t of he(e)) {
115
121
  let e = this.items.get(t.toLowerCase());
116
122
  if (e !== void 0) return e;
117
123
  }
118
124
  return null;
119
125
  }
120
126
  findLoop(e) {
121
- for (let t of pe(e)) {
127
+ for (let t of he(e)) {
122
128
  let e = t.toLowerCase(), n = this.loops.find((t) => t.tags.includes(e));
123
129
  if (n) return n;
124
130
  }
125
131
  return null;
126
132
  }
127
133
  };
128
- function I(e, t) {
129
- for (let n of pe(t)) {
134
+ function F(e, t) {
135
+ for (let n of he(t)) {
130
136
  let t = e.tags.indexOf(n.toLowerCase());
131
137
  if (t !== -1) return e.rows.map((e) => e[t] ?? "?");
132
138
  }
133
139
  return null;
134
140
  }
135
- function L(e) {
141
+ function I(e) {
136
142
  return e === "?" || e === ".";
137
143
  }
138
- function R(e) {
139
- if (e == null || L(e)) return null;
144
+ function L(e) {
145
+ if (e == null || I(e)) return null;
140
146
  let t = e.replace(/\(\d+\)$/, "").trim();
141
147
  return /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(t) ? Number(t) : null;
142
148
  }
143
- function he(e) {
149
+ function _e(e) {
144
150
  return e === void 0 || e.kind !== "value";
145
151
  }
146
- function ge(e) {
147
- let t = fe(e), n = [], r = null, i = 0, a = 0, o = (e) => {
148
- if (r || (r = new me(""), n.push(r)), a > 0) throw new P(`unexpected ${e.kind} inside a save frame`, e.line);
152
+ function ve(e) {
153
+ let t = me(e), n = [], r = null, i = 0, a = 0, o = (e) => {
154
+ if (r || (r = new ge(""), n.push(r)), a > 0) throw new M(`unexpected ${e.kind} inside a save frame`, e.line);
149
155
  return r;
150
156
  };
151
157
  for (; i < t.length;) {
@@ -153,7 +159,7 @@ function ge(e) {
153
159
  if (!e) break;
154
160
  switch (e.kind) {
155
161
  case "data":
156
- r = new me(e.text), n.push(r), a = 0, i += 1;
162
+ r = new ge(e.text), n.push(r), a = 0, i += 1;
157
163
  break;
158
164
  case "save":
159
165
  a = e.text === "" ? Math.max(0, a - 1) : a + 1, i += 1;
@@ -167,18 +173,18 @@ function ge(e) {
167
173
  break;
168
174
  }
169
175
  let n = o(e), r = t[i + 1];
170
- if (!r || r.kind !== "value") throw new P(`tag ${e.text} has no value`, e.line);
176
+ if (!r || r.kind !== "value") throw new M(`tag ${e.text} has no value`, e.line);
171
177
  n.items.set(e.text.toLowerCase(), r.text), i += 2;
172
178
  break;
173
179
  }
174
180
  case "loop": {
175
181
  let n = [];
176
182
  for (i += 1; t[i]?.kind === "tag";) n.push(t[i].text.toLowerCase()), i += 1;
177
- if (n.length === 0) throw new P("loop_ without tags", e.line);
183
+ if (n.length === 0) throw new M("loop_ without tags", e.line);
178
184
  let r = [];
179
- for (; !he(t[i]);) r.push(t[i].text), i += 1;
185
+ for (; !_e(t[i]);) r.push(t[i].text), i += 1;
180
186
  if (a > 0) break;
181
- if (r.length % n.length !== 0) throw new P(`loop with ${n.length} tags has ${r.length} values`, e.line);
187
+ if (r.length % n.length !== 0) throw new M(`loop with ${n.length} tags has ${r.length} values`, e.line);
182
188
  let s = [];
183
189
  for (let e = 0; e < r.length; e += n.length) s.push(r.slice(e, e + n.length));
184
190
  o(e).loops.push({
@@ -187,60 +193,60 @@ function ge(e) {
187
193
  });
188
194
  break;
189
195
  }
190
- case "value": throw new P(`unexpected value ${JSON.stringify(e.text)}`, e.line);
196
+ case "value": throw new M(`unexpected value ${JSON.stringify(e.text)}`, e.line);
191
197
  }
192
198
  }
193
199
  return { blocks: n };
194
200
  }
195
201
  //#endregion
196
202
  //#region src/structure/elements.ts
197
- var _e = /* @__PURE__ */ "H.He.Li.Be.B.C.N.O.F.Ne.Na.Mg.Al.Si.P.S.Cl.Ar.K.Ca.Sc.Ti.V.Cr.Mn.Fe.Co.Ni.Cu.Zn.Ga.Ge.As.Se.Br.Kr.Rb.Sr.Y.Zr.Nb.Mo.Tc.Ru.Rh.Pd.Ag.Cd.In.Sn.Sb.Te.I.Xe.Cs.Ba.La.Ce.Pr.Nd.Pm.Sm.Eu.Gd.Tb.Dy.Ho.Er.Tm.Yb.Lu.Hf.Ta.W.Re.Os.Ir.Pt.Au.Hg.Tl.Pb.Bi.Po.At.Rn.Fr.Ra.Ac.Th.Pa.U.Np.Pu.Am.Cm.Bk.Cf.Es.Fm.Md.No.Lr.Rf.Db.Sg.Bh.Hs.Mt.Ds.Rg.Cn.Nh.Fl.Mc.Lv.Ts.Og".split("."), ve = new Set(_e);
198
- function ye(e) {
199
- return ve.has(e) || e === "D";
203
+ var ye = /* @__PURE__ */ "H.He.Li.Be.B.C.N.O.F.Ne.Na.Mg.Al.Si.P.S.Cl.Ar.K.Ca.Sc.Ti.V.Cr.Mn.Fe.Co.Ni.Cu.Zn.Ga.Ge.As.Se.Br.Kr.Rb.Sr.Y.Zr.Nb.Mo.Tc.Ru.Rh.Pd.Ag.Cd.In.Sn.Sb.Te.I.Xe.Cs.Ba.La.Ce.Pr.Nd.Pm.Sm.Eu.Gd.Tb.Dy.Ho.Er.Tm.Yb.Lu.Hf.Ta.W.Re.Os.Ir.Pt.Au.Hg.Tl.Pb.Bi.Po.At.Rn.Fr.Ra.Ac.Th.Pa.U.Np.Pu.Am.Cm.Bk.Cf.Es.Fm.Md.No.Lr.Rf.Db.Sg.Bh.Hs.Mt.Ds.Rg.Cn.Nh.Fl.Mc.Lv.Ts.Og".split("."), be = new Set(ye), xe = "D";
204
+ function Se(e) {
205
+ return be.has(e) || e === xe;
200
206
  }
201
- function be(e) {
207
+ function Ce(e) {
202
208
  return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
203
209
  }
204
- function xe(e) {
210
+ function we(e) {
205
211
  let t = e.match(/^[A-Za-z]{1,2}/)?.[0];
206
212
  if (!t) return null;
207
- let n = be(t);
208
- if (t.length === 2 && ye(n)) return n;
213
+ let n = Ce(t);
214
+ if (t.length === 2 && Se(n)) return n;
209
215
  let r = t.charAt(0).toUpperCase();
210
- return ye(r) ? r : null;
216
+ return Se(r) ? r : null;
211
217
  }
212
- function Se(e) {
213
- return e === "D" ? "H" : e;
218
+ function Te(e) {
219
+ return e === xe ? "H" : e;
214
220
  }
215
221
  //#endregion
216
222
  //#region src/structure/fractional.ts
217
- var Ce = .001, we = 1e-9;
218
- function z(e, t = we) {
223
+ var Ee = .001, De = 1e-9;
224
+ function R(e, t = De) {
219
225
  let n = e - Math.floor(e);
220
226
  return n >= 1 - t ? 0 : n;
221
227
  }
222
- function Te(e) {
228
+ function Oe(e) {
223
229
  return [
224
- z(e[0]),
225
- z(e[1]),
226
- z(e[2])
230
+ R(e[0]),
231
+ R(e[1]),
232
+ R(e[2])
227
233
  ];
228
234
  }
229
- function Ee(e, t, n) {
235
+ function ke(e, t, n) {
230
236
  for (let r = 0; r < 3; r += 1) {
231
237
  let i = Math.abs(e[r] - t[r]);
232
238
  if (i -= Math.round(i), Math.abs(i) > n) return !1;
233
239
  }
234
240
  return !0;
235
241
  }
236
- var B = 100;
237
- function De(e) {
238
- return Math.floor(z(e) * B) % B;
242
+ var z = 100;
243
+ function B(e) {
244
+ return Math.floor(R(e) * z) % z;
239
245
  }
240
- function Oe(e, t, n) {
241
- return (e * B + t) * B + n;
246
+ function Ae(e, t, n) {
247
+ return (e * z + t) * z + n;
242
248
  }
243
- var ke = class {
249
+ var je = class {
244
250
  tolerance;
245
251
  buckets = /* @__PURE__ */ new Map();
246
252
  positions = [];
@@ -250,25 +256,25 @@ var ke = class {
250
256
  add(e) {
251
257
  let t = this.positions.length;
252
258
  this.positions.push(e);
253
- let n = Oe(De(e[0]), De(e[1]), De(e[2])), r = this.buckets.get(n);
259
+ let n = Ae(B(e[0]), B(e[1]), B(e[2])), r = this.buckets.get(n);
254
260
  return r ? r.push(t) : this.buckets.set(n, [t]), t;
255
261
  }
256
262
  near(e) {
257
- let t = Te(e), [n, r, i] = t.map(De), a = [];
263
+ let t = Oe(e), [n, r, i] = t.map(B), a = [];
258
264
  for (let e = -1; e <= 1; e += 1) {
259
- let o = (n + e + B) % B;
265
+ let o = (n + e + z) % z;
260
266
  for (let e = -1; e <= 1; e += 1) {
261
- let n = (r + e + B) % B;
267
+ let n = (r + e + z) % z;
262
268
  for (let e = -1; e <= 1; e += 1) {
263
- let r = (i + e + B) % B;
264
- for (let e of this.buckets.get(Oe(o, n, r)) ?? []) Ee(this.positions[e], t, this.tolerance) && a.push(e);
269
+ let r = (i + e + z) % z;
270
+ for (let e of this.buckets.get(Ae(o, n, r)) ?? []) ke(this.positions[e], t, this.tolerance) && a.push(e);
265
271
  }
266
272
  }
267
273
  }
268
274
  return a.sort((e, t) => e - t);
269
275
  }
270
276
  };
271
- function Ae(e, t) {
277
+ function Me(e, t) {
272
278
  let n = e.rotation, [r, i, a] = t, o = e.translation;
273
279
  return [
274
280
  (n[0] ?? 0) * r + (n[1] ?? 0) * i + (n[2] ?? 0) * a + o[0],
@@ -279,11 +285,11 @@ function Ae(e, t) {
279
285
  //#endregion
280
286
  //#region src/structure/lattice.ts
281
287
  var V = Math.PI / 180;
282
- function je(e, t, n) {
288
+ function Ne(e, t, n) {
283
289
  return Math.min(n, Math.max(t, e));
284
290
  }
285
- function Me(e) {
286
- let { a: t, b: n, c: r } = e, i = e.alpha * V, a = e.beta * V, o = e.gamma * V, s = Math.cos(i), c = Math.cos(a), l = Math.cos(o), u = Math.sin(i), d = Math.sin(a), f = Math.acos(je((s * c - l) / (u * d), -1, 1)), p = [
291
+ function Pe(e) {
292
+ let { a: t, b: n, c: r } = e, i = e.alpha * V, a = e.beta * V, o = e.gamma * V, s = Math.cos(i), c = Math.cos(a), l = Math.cos(o), u = Math.sin(i), d = Math.sin(a), f = Math.acos(Ne((s * c - l) / (u * d), -1, 1)), p = [
287
293
  t * d,
288
294
  0,
289
295
  t * c
@@ -305,8 +311,8 @@ function Me(e) {
305
311
  ]
306
312
  };
307
313
  }
308
- function Ne(e) {
309
- let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(je((e[0] * t[0] + e[1] * t[1] + e[2] * t[2]) / (i(e) * i(t)), -1, 1)) / V;
314
+ function Fe(e) {
315
+ let [t, n, r] = e, i = (e) => Math.hypot(e[0], e[1], e[2]), a = (e, t) => Math.acos(Ne((e[0] * t[0] + e[1] * t[1] + e[2] * t[2]) / (i(e) * i(t)), -1, 1)) / V;
310
316
  return {
311
317
  a: i(t),
312
318
  b: i(n),
@@ -317,7 +323,7 @@ function Ne(e) {
317
323
  vectors: e
318
324
  };
319
325
  }
320
- function Pe(e, t) {
326
+ function Ie(e, t) {
321
327
  let [n, r, i] = e.vectors, [a, o, s] = t;
322
328
  return [
323
329
  a * n[0] + o * r[0] + s * i[0],
@@ -325,49 +331,45 @@ function Pe(e, t) {
325
331
  a * n[2] + o * r[2] + s * i[2]
326
332
  ];
327
333
  }
328
- function Fe(e, t) {
334
+ function Le(e, t) {
329
335
  let n = e[0] - t[0], r = e[1] - t[1], i = e[2] - t[2];
330
336
  return Math.sqrt(n * n + r * r + i * i);
331
337
  }
332
338
  //#endregion
333
- //#region src/cif/errors.ts
334
- var H = class extends Error {
335
- constructor(e) {
336
- super(e), this.name = "CifStructureError";
337
- }
338
- }, Ie = [
339
+ //#region src/cif/symmetry-operations.ts
340
+ var Re = [
339
341
  "x",
340
342
  "y",
341
343
  "z"
342
344
  ];
343
- function Le(e) {
345
+ function ze(e) {
344
346
  if (e === "" || e === "+") return 1;
345
347
  if (e === "-") return -1;
346
348
  let t = e.match(/^([+-]?\d+)\/(\d+)$/), n = t ? Number(t[1]) / Number(t[2]) : Number(e);
347
- if (!Number.isFinite(n)) throw new H(`Cannot read the number ${JSON.stringify(e)} in a symmetry operator.`);
349
+ if (!Number.isFinite(n)) throw new N(`Cannot read the number ${JSON.stringify(e)} in a symmetry operation.`);
348
350
  return n;
349
351
  }
350
- function Re(e) {
352
+ function Be(e) {
351
353
  let t = e.split(",").map((e) => e.toLowerCase().replace(/[^xyz0-9./+-]/g, ""));
352
- if (t.length !== 3) throw new H(`A symmetry operator needs three components: ${JSON.stringify(e)}.`);
354
+ if (t.length !== 3) throw new N(`A symmetry operation needs three components: ${JSON.stringify(e)}.`);
353
355
  let n = [], r = [];
354
356
  for (let i of t) {
355
357
  let t = i.match(/[+-]?[^+-]+/g);
356
- if (!t || t.join("") !== i) throw new H(`Cannot read the symmetry operator ${JSON.stringify(e)}.`);
358
+ if (!t || t.join("") !== i) throw new N(`Cannot read the symmetry operation ${JSON.stringify(e)}.`);
357
359
  let a = [
358
360
  0,
359
361
  0,
360
362
  0
361
363
  ], o = 0;
362
364
  for (let e of t) {
363
- let t = Ie.findIndex((t) => e.includes(t));
364
- if (t === -1) o += Le(e);
365
+ let t = Re.findIndex((t) => e.includes(t));
366
+ if (t === -1) o += ze(e);
365
367
  else {
366
- let n = Le(e.replace(Ie[t], "").replace(/\*$/, ""));
368
+ let n = ze(e.replace(Re[t], "").replace(/\*$/, ""));
367
369
  a[t] = (a[t] ?? 0) + n;
368
370
  }
369
371
  }
370
- n.push(...a), r.push(z(o));
372
+ n.push(...a), r.push(R(o));
371
373
  }
372
374
  return {
373
375
  rotation: n,
@@ -376,42 +378,42 @@ function Re(e) {
376
378
  }
377
379
  //#endregion
378
380
  //#region src/cif/structure.ts
379
- var ze = 1e-4, Be = ["_space_group_symop_operation_xyz", "_symmetry_equiv_pos_as_xyz"], Ve = ["_space_group_it_number", "_symmetry_int_tables_number"], He = [
381
+ var Ve = 1e-4, He = ["_space_group_symop_operation_xyz", "_symmetry_equiv_pos_as_xyz"], Ue = ["_space_group_it_number", "_symmetry_int_tables_number"], We = [
380
382
  "_space_group_name_h-m_alt",
381
383
  "_symmetry_space_group_name_h-m",
382
384
  "_space_group_name_h-m_full"
383
- ], Ue = ["_space_group_name_hall", "_symmetry_space_group_name_hall"];
384
- function U(e, t) {
385
- let n = R(e.get(t));
386
- if (n === null) throw new H(`${e.name || "The CIF"} has no usable ${t}.`);
385
+ ], Ge = ["_space_group_name_hall", "_symmetry_space_group_name_hall"];
386
+ function H(e, t) {
387
+ let n = L(e.get(t));
388
+ if (n === null) throw new N(`${e.name || "The CIF"} has no usable ${t}.`);
387
389
  return n;
388
390
  }
389
- function We(e, t, n) {
391
+ function Ke(e, t, n) {
390
392
  let r = e.find((e) => e.element === t);
391
393
  r ? r.occupancy += n : e.push({
392
394
  element: t,
393
395
  occupancy: n
394
396
  }), e.sort((e, t) => t.occupancy - e.occupancy);
395
397
  }
396
- function Ge(e) {
398
+ function qe(e) {
397
399
  for (let t of e) {
398
400
  let e = t.species.reduce((e, t) => e + t.occupancy, 0);
399
401
  if (e > 1.000001) for (let n of t.species) n.occupancy /= e;
400
402
  }
401
403
  }
402
- function Ke(e) {
404
+ function Je(e) {
403
405
  let t = e.findLoop("_atom_site_fract_x");
404
- if (!t) throw new H(`${e.name || "The CIF"} has no atom sites.`);
405
- let n = I(t, "_atom_site_fract_x") ?? [], r = I(t, "_atom_site_fract_y") ?? [], i = I(t, "_atom_site_fract_z") ?? [], a = I(t, "_atom_site_label"), o = I(t, "_atom_site_type_symbol"), s = I(t, "_atom_site_occupancy"), c = [], l = new ke(ze);
406
+ if (!t) throw new N(`${e.name || "The CIF"} has no atom sites.`);
407
+ let n = F(t, "_atom_site_fract_x") ?? [], r = F(t, "_atom_site_fract_y") ?? [], i = F(t, "_atom_site_fract_z") ?? [], a = F(t, "_atom_site_label"), o = F(t, "_atom_site_type_symbol"), s = F(t, "_atom_site_occupancy"), c = [], l = new je(Ve);
406
408
  for (let e = 0; e < t.rows.length; e += 1) {
407
- let t = R(n[e]), u = R(r[e]), d = R(i[e]);
409
+ let t = L(n[e]), u = L(r[e]), d = L(i[e]);
408
410
  if (t === null || u === null || d === null) continue;
409
- let f = a?.[e] ?? o?.[e] ?? `site${e + 1}`, p = o?.[e], m = (p && !L(p) ? xe(p) : null) ?? xe(f);
410
- if (!m) throw new H(`Atom site ${JSON.stringify(f)} names no element (type symbol ${JSON.stringify(p ?? "")}).`);
411
- let h = R(s?.[e]) ?? 1, g = [
412
- z(t),
413
- z(u),
414
- z(d)
411
+ let f = a?.[e] ?? o?.[e] ?? `site${e + 1}`, p = o?.[e], m = (p && !I(p) ? we(p) : null) ?? we(f);
412
+ if (!m) throw new N(`Atom site ${JSON.stringify(f)} names no element (type symbol ${JSON.stringify(p ?? "")}).`);
413
+ let h = L(s?.[e]) ?? 1, g = [
414
+ R(t),
415
+ R(u),
416
+ R(d)
415
417
  ], [ee] = l.near(g);
416
418
  ee === void 0 ? (l.add(g), c.push({
417
419
  label: f,
@@ -420,55 +422,55 @@ function Ke(e) {
420
422
  occupancy: h
421
423
  }],
422
424
  fractional: g
423
- })) : We(c[ee].species, m, h);
425
+ })) : Ke(c[ee].species, m, h);
424
426
  }
425
- if (c.length === 0) throw new H(`${e.name || "The CIF"} has no atom sites with coordinates.`);
426
- return Ge(c), c;
427
+ if (c.length === 0) throw new N(`${e.name || "The CIF"} has no atom sites with coordinates.`);
428
+ return qe(c), c;
427
429
  }
428
- function qe(e) {
429
- let t = e.findLoop(Be);
430
+ function Ye(e) {
431
+ let t = e.findLoop(He);
430
432
  if (!t) {
431
- let t = e.get(Be);
432
- return t === null ? null : [Re(t)];
433
+ let t = e.get(He);
434
+ return t === null ? null : [Be(t)];
433
435
  }
434
- let n = (I(t, Be) ?? []).filter((e) => !L(e)).map(Re);
436
+ let n = (F(t, He) ?? []).filter((e) => !I(e)).map(Be);
435
437
  return n.length > 0 ? n : null;
436
438
  }
437
- function Je(e) {
438
- let t = e.get(Ve), n = t === null ? null : R(t), r = e.get(He), i = e.get(Ue);
439
+ function Xe(e) {
440
+ let t = L(e.get(Ue)), n = e.get(We), r = e.get(Ge);
439
441
  return {
440
- number: n !== null && Number.isInteger(n) && n >= 1 && n <= 230 ? n : null,
441
- symbol: r !== null && !L(r) ? r.trim() : null,
442
- hallSymbol: i !== null && !L(i) ? i.trim() : null
442
+ number: t !== null && Number.isInteger(t) && t >= 1 && t <= 230 ? t : null,
443
+ symbol: n !== null && !I(n) ? n.trim() : null,
444
+ hallSymbol: r !== null && !I(r) ? r.trim() : null
443
445
  };
444
446
  }
445
- function Ye(e) {
447
+ function Ze(e) {
446
448
  return e.findLoop("_atom_site_fract_x") !== null;
447
449
  }
448
- function Xe(e) {
450
+ function Qe(e) {
449
451
  return {
450
- lattice: Me({
451
- a: U(e, "_cell_length_a"),
452
- b: U(e, "_cell_length_b"),
453
- c: U(e, "_cell_length_c"),
454
- alpha: U(e, "_cell_angle_alpha"),
455
- beta: U(e, "_cell_angle_beta"),
456
- gamma: U(e, "_cell_angle_gamma")
452
+ lattice: Pe({
453
+ a: H(e, "_cell_length_a"),
454
+ b: H(e, "_cell_length_b"),
455
+ c: H(e, "_cell_length_c"),
456
+ alpha: H(e, "_cell_angle_alpha"),
457
+ beta: H(e, "_cell_angle_beta"),
458
+ gamma: H(e, "_cell_angle_gamma")
457
459
  }),
458
- sites: Ke(e),
459
- operations: qe(e),
460
- spaceGroup: Je(e)
460
+ sites: Je(e),
461
+ operations: Ye(e),
462
+ spaceGroup: Xe(e)
461
463
  };
462
464
  }
463
465
  //#endregion
464
466
  //#region src/structure/closure.ts
465
- function Ze(e, t) {
466
- let n = new ke(Ce);
467
+ function $e(e, t) {
468
+ let n = new je(Ee);
467
469
  for (let t of e) n.add(t.fractional);
468
470
  let r = !1, i = !0;
469
471
  return e.forEach((e, a) => {
470
472
  for (let o of t) {
471
- let t = n.near(Ae(o, e.fractional));
473
+ let t = n.near(Me(o, e.fractional));
472
474
  t.some((e) => e !== a) && (r = !0), t.length === 0 && (i = !1);
473
475
  }
474
476
  }), {
@@ -478,7 +480,7 @@ function Ze(e, t) {
478
480
  }
479
481
  //#endregion
480
482
  //#region src/structure/types.ts
481
- var Qe = {
483
+ var et = {
482
484
  rotation: [
483
485
  1,
484
486
  0,
@@ -495,29 +497,29 @@ var Qe = {
495
497
  0,
496
498
  0
497
499
  ]
498
- }, $e = null, et = null;
499
- function tt() {
500
- return et ||= import("./moyo-wasm.js").then(async (e) => {
501
- await e.instantiate(), $e = e;
500
+ }, tt = null, nt = null;
501
+ function rt() {
502
+ return nt ||= import("./moyo-wasm.js").then(async (e) => {
503
+ await e.instantiate(), tt = e;
502
504
  }).catch((e) => {
503
- throw et = null, e;
504
- }), et;
505
+ throw nt = null, e;
506
+ }), nt;
505
507
  }
506
- function W() {
507
- if (!$e) throw Error("moyo is not loaded yet; await ensureMoyo() first.");
508
- return $e;
508
+ function U() {
509
+ if (!tt) throw Error("moyo is not loaded yet; await ensureMoyo() first.");
510
+ return tt;
509
511
  }
510
512
  //#endregion
511
513
  //#region src/symmetry/moyo.ts
512
- var nt = class extends Error {
514
+ var it = class extends Error {
513
515
  constructor(e) {
514
516
  super(e), this.name = "SpaceGroupLookupError";
515
517
  }
516
- }, G = null;
517
- function rt() {
518
- return tt();
518
+ }, W = null;
519
+ function at() {
520
+ return rt();
519
521
  }
520
- function it(e) {
522
+ function ot(e) {
521
523
  let t = e.rotation;
522
524
  return {
523
525
  rotation: [
@@ -538,119 +540,119 @@ function it(e) {
538
540
  ]
539
541
  };
540
542
  }
541
- function at() {
542
- if (!G) {
543
- G = [];
544
- for (let e = 1; e <= 230; e += 1) G.push(...W().hall_symbol_entries_from_number(e));
543
+ function st() {
544
+ if (!W) {
545
+ W = [];
546
+ for (let e = 1; e <= 230; e += 1) W.push(...U().hall_symbol_entries_from_number(e));
545
547
  }
546
- return G;
548
+ return W;
547
549
  }
548
- function K(e) {
550
+ function G(e) {
549
551
  return e.replace(/[\s_]/g, "").toLowerCase();
550
552
  }
551
- function ot(e) {
553
+ function ct(e) {
552
554
  let t = e.trim(), n = t.match(/^(.*?)\s*:\s*(\S+)$/);
553
555
  if (n && n[1] && n[2]) return {
554
- base: K(n[1]),
556
+ base: G(n[1]),
555
557
  setting: n[2].toLowerCase()
556
558
  };
557
559
  let r = t.match(/^(.*\S)\s+([HRhr])$/);
558
560
  return r && r[1] && r[2] ? {
559
- base: K(r[1]),
561
+ base: G(r[1]),
560
562
  setting: r[2].toLowerCase()
561
563
  } : {
562
- base: K(t),
564
+ base: G(t),
563
565
  setting: null
564
566
  };
565
567
  }
566
- function st(e) {
568
+ function lt(e) {
567
569
  let t = e[0];
568
570
  if (!t) return e;
569
- let n = W().space_group_type(t.number).hall_number;
571
+ let n = U().space_group_type(t.number).hall_number;
570
572
  return [...e].sort((e, t) => Number(t.hall_number === n) - Number(e.hall_number === n));
571
573
  }
572
- function ct(e) {
573
- let t = at().filter((t) => e.number === null || t.number === e.number);
574
+ function ut(e) {
575
+ let t = st().filter((t) => e.number === null || t.number === e.number);
574
576
  if (e.hallSymbol) {
575
- let n = K(e.hallSymbol), r = t.filter((e) => K(e.hall_symbol) === n);
577
+ let n = G(e.hallSymbol), r = t.filter((e) => G(e.hall_symbol) === n);
576
578
  if (r.length > 0) return r;
577
579
  }
578
580
  if (e.symbol) {
579
- let { base: n, setting: r } = ot(e.symbol), i = t.filter((e) => K(e.hm_short) === n || K(e.hm_full) === n);
581
+ let { base: n, setting: r } = ct(e.symbol), i = t.filter((e) => G(e.hm_short) === n || G(e.hm_full) === n);
580
582
  if (r) {
581
583
  let e = i.filter((e) => e.setting.toLowerCase() === r);
582
584
  if (e.length > 0) return e;
583
585
  }
584
- return st(i);
586
+ return lt(i);
585
587
  }
586
588
  return [];
587
589
  }
588
- function lt(e) {
590
+ function dt(e) {
589
591
  return [
590
592
  e.hallSymbol,
591
593
  e.symbol,
592
594
  e.number
593
595
  ].filter((e) => e !== null).join(" / ");
594
596
  }
595
- async function ut(e) {
596
- await rt();
597
- let { operations_from_number: t } = W();
597
+ async function ft(e) {
598
+ await at();
599
+ let { operations_from_number: t } = U();
598
600
  if (e.hallSymbol || e.symbol) {
599
- let n = ct(e);
600
- if (n.length === 0) throw new nt(`Space group ${lt(e)} is not in the symmetry table.`);
601
+ let n = ut(e);
602
+ if (n.length === 0) throw new it(`Space group ${dt(e)} is not in the symmetry table.`);
601
603
  return n.map((e) => ({
602
604
  setting: e.setting,
603
605
  operations: t(e.number, {
604
606
  type: "HallNumber",
605
607
  value: e.hall_number
606
- }, !1).map(it)
608
+ }, !1).map(ot)
607
609
  }));
608
610
  }
609
- if (e.number === null) throw new nt("The CIF names no space group.");
611
+ if (e.number === null) throw new it("The CIF names no space group.");
610
612
  return [{
611
613
  setting: "",
612
- operations: t(e.number, { type: "Spglib" }, !1).map(it)
614
+ operations: t(e.number, { type: "Spglib" }, !1).map(ot)
613
615
  }];
614
616
  }
615
- async function dt(e) {
616
- let [t] = await ut(e);
617
+ async function pt(e) {
618
+ let [t] = await ft(e);
617
619
  return t.operations;
618
620
  }
619
621
  //#endregion
620
622
  //#region src/symmetry/resolve.ts
621
- var ft = .001, pt = .01;
622
- function mt() {
623
- return new H("The symmetry does not fit the listed atoms: they are already expanded, yet the operations generate positions the file does not list.");
623
+ var mt = .001, ht = .01;
624
+ function gt() {
625
+ return new N("The symmetry does not fit the listed atoms: they are already expanded, yet the operations generate positions the file does not list.");
624
626
  }
625
- function ht(e, t) {
626
- let n = Ze(e, t);
627
- if (n.preExpanded && !n.closed) throw mt();
627
+ function _t(e, t) {
628
+ let n = $e(e, t);
629
+ if (n.preExpanded && !n.closed) throw gt();
628
630
  }
629
- function gt({ a: e, b: t, c: n, alpha: r, beta: i, gamma: a }) {
630
- let o = (e, t) => Math.abs(e - t) <= ft * Math.max(e, t), s = (e, t) => Math.abs(e - t) <= pt;
631
+ function vt({ a: e, b: t, c: n, alpha: r, beta: i, gamma: a }) {
632
+ let o = (e, t) => Math.abs(e - t) <= mt * Math.max(e, t), s = (e, t) => Math.abs(e - t) <= ht;
631
633
  return o(e, t) && o(t, n) && s(r, i) && s(i, a) && !s(r, 90) ? "R" : o(e, t) && s(r, 90) && s(i, 90) && s(a, 120) ? "H" : null;
632
634
  }
633
- async function _t(e) {
634
- if (e.operations) return ht(e.sites, e.operations), e.operations;
635
+ async function yt(e) {
636
+ if (e.operations) return _t(e.sites, e.operations), e.operations;
635
637
  let { spaceGroup: t } = e;
636
- if (t.hallSymbol === null && t.symbol === null && t.number === null) return [Qe];
637
- let n = await ut(t);
638
+ if (t.hallSymbol === null && t.symbol === null && t.number === null) return [et];
639
+ let n = await ft(t);
638
640
  if (n.length === 1) {
639
641
  let [t] = n;
640
- return ht(e.sites, t.operations), t.operations;
642
+ return _t(e.sites, t.operations), t.operations;
641
643
  }
642
- let r = n.map((t) => Ze(e.sites, t.operations)), i = n.find((e, t) => r[t].preExpanded && r[t].closed);
644
+ let r = n.map((t) => $e(e.sites, t.operations)), i = n.find((e, t) => r[t].preExpanded && r[t].closed);
643
645
  if (i) return i.operations;
644
- if (r.some((e) => e.preExpanded)) throw mt();
645
- let a = gt(e.lattice);
646
+ if (r.some((e) => e.preExpanded)) throw gt();
647
+ let a = vt(e.lattice);
646
648
  return ((a === null ? void 0 : n.find((e) => e.setting.toUpperCase() === a)) ?? n[0]).operations;
647
649
  }
648
650
  //#endregion
649
651
  //#region src/structure/expand.ts
650
- function vt(e) {
651
- let t = [], n = new ke(Ce);
652
+ function bt(e) {
653
+ let t = [], n = new je(Ee);
652
654
  for (let r of e.sites) for (let i of e.operations) {
653
- let e = Te(Ae(i, r.fractional));
655
+ let e = Oe(Me(i, r.fractional));
654
656
  n.near(e).length === 0 && (n.add(e), t.push({
655
657
  label: r.label,
656
658
  species: r.species,
@@ -660,17 +662,17 @@ function vt(e) {
660
662
  return {
661
663
  ...e,
662
664
  sites: t,
663
- operations: [Qe]
665
+ operations: [et]
664
666
  };
665
667
  }
666
668
  //#endregion
667
669
  //#region src/symmetry/dataset.ts
668
- var yt = .01, bt = class extends Error {
670
+ var xt = .01, St = class extends Error {
669
671
  constructor(e) {
670
672
  super(e), this.name = "SymmetryAnalysisError";
671
673
  }
672
674
  };
673
- function xt(e) {
675
+ function Ct(e) {
674
676
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
675
677
  return {
676
678
  numbers: e.map((e) => {
@@ -680,7 +682,7 @@ function xt(e) {
680
682
  speciesByLabel: n
681
683
  };
682
684
  }
683
- function St(e, t, n) {
685
+ function wt(e, t, n) {
684
686
  let r = e.std_cell.lattice.basis, i = [
685
687
  [
686
688
  r[0],
@@ -702,13 +704,13 @@ function St(e, t, n) {
702
704
  return a.set(s, c), {
703
705
  label: `${s}${c}`,
704
706
  species: o,
705
- fractional: Te(n)
707
+ fractional: Oe(n)
706
708
  };
707
709
  });
708
710
  return {
709
- lattice: Ne(i),
711
+ lattice: Fe(i),
710
712
  sites: o,
711
- operations: [Qe],
713
+ operations: [et],
712
714
  spaceGroup: {
713
715
  number: e.number,
714
716
  symbol: e.hm_symbol,
@@ -716,9 +718,9 @@ function St(e, t, n) {
716
718
  }
717
719
  };
718
720
  }
719
- async function Ct(e, t = {}) {
720
- await rt();
721
- let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } = W(), a = vt(e), { numbers: o, speciesByLabel: s } = xt(a.sites), [c, l, u] = a.lattice.vectors, d = {
721
+ async function Tt(e, t = {}) {
722
+ await at();
723
+ let { analyze_cell: n, hall_symbol_entry: r, space_group_type: i } = U(), a = bt(e), { numbers: o, speciesByLabel: s } = Ct(a.sites), [c, l, u] = a.lattice.vectors, d = {
722
724
  lattice: { basis: [
723
725
  ...c,
724
726
  ...l,
@@ -728,11 +730,11 @@ async function Ct(e, t = {}) {
728
730
  numbers: o
729
731
  }, f;
730
732
  try {
731
- f = n(JSON.stringify(d), t.symprec ?? yt, "Standard");
733
+ f = n(JSON.stringify(d), t.symprec ?? xt, "Standard");
732
734
  } catch (e) {
733
- throw new bt(`moyo could not analyse the structure: ${e instanceof Error ? e.message : String(e)}`);
735
+ throw new St(`moyo could not analyse the structure: ${e instanceof Error ? e.message : String(e)}`);
734
736
  }
735
- let p = r(f.hall_number), m = i(f.number), h = St(f, s, p);
737
+ let p = r(f.hall_number), m = i(f.number), h = wt(f, s, p);
736
738
  return {
737
739
  number: f.number,
738
740
  symbol: f.hm_symbol,
@@ -741,7 +743,7 @@ async function Ct(e, t = {}) {
741
743
  hallNumber: f.hall_number,
742
744
  setting: p.setting,
743
745
  crystalSystem: m.crystal_system,
744
- operations: f.operations.map(it),
746
+ operations: f.operations.map(ot),
745
747
  wyckoffs: f.wyckoffs,
746
748
  siteSymmetries: f.site_symmetry_symbols,
747
749
  structure: a,
@@ -750,34 +752,34 @@ async function Ct(e, t = {}) {
750
752
  }
751
753
  //#endregion
752
754
  //#region src/symmetry/symbol.ts
753
- var wt = "₀₁₂₃₄₅₆₇₈₉", Tt = "̅";
754
- function Et(e) {
755
- return wt[Number(e)] ?? e;
755
+ var Et = "₀₁₂₃₄₅₆₇₈₉", Dt = "̅";
756
+ function Ot(e) {
757
+ return Et[Number(e)] ?? e;
756
758
  }
757
- function Dt(e) {
759
+ function kt(e) {
758
760
  let t = e.trim(), n = t.indexOf(":"), r = n === -1 ? t : t.slice(0, n).trim(), i = n === -1 ? "" : ` ${t.slice(n)}`, a = r.split(/\s+/);
759
- return a.map((e) => a.length > 1 ? e.replace(/^([2346])([1-5])(?=$|\/)/, (e, t, n) => Number(n) < Number(t) ? t + Et(n) : e) : e).join("").replace(/(\d)_(\d)/g, (e, t, n) => t + Et(n)).replace(/-(\d)/g, (e, t) => t + Tt) + i;
761
+ return a.map((e) => a.length > 1 ? e.replace(/^([2346])([1-5])(?=$|\/)/, (e, t, n) => Number(n) < Number(t) ? t + Ot(n) : e) : e).join("").replace(/(\d)_(\d)/g, (e, t, n) => t + Ot(n)).replace(/-(\d)/g, (e, t) => t + Dt) + i;
760
762
  }
761
763
  //#endregion
762
764
  //#region src/structure/bonds.ts
763
- var Ot = {
765
+ var At = {
764
766
  source: "VESTA bond-search cutoffs (K. Momma and F. Izumi), as distributed in pymatgen's vesta_cutoffs.yaml (MIT). Where VESTA lists a pair twice (H-O, D-O), the shorter cutoff is kept.",
765
767
  pairs: /* @__PURE__ */ JSON.parse("{\"Ac-Br\":3.22726,\"Ac-Cl\":3.08646,\"Ac-F\":2.58646,\"Ac-O\":2.7326,\"Ag-As\":2.45642,\"Ag-Br\":2.37642,\"Ag-Cl\":3.05939,\"Ag-F\":2.76939,\"Ag-H\":1.65642,\"Ag-I\":2.53642,\"Ag-N\":2.00642,\"Ag-O\":2.81139,\"Ag-P\":2.37642,\"Ag-S\":3.08839,\"Ag-Se\":2.41642,\"Ag-Te\":2.66642,\"Al-As\":2.75646,\"Al-Br\":2.65646,\"Al-Cl\":2.48846,\"Al-F\":2.00146,\"Al-H\":1.90646,\"Al-I\":2.86646,\"Al-N\":2.24646,\"Al-O\":2.1074,\"Al-P\":2.69646,\"Al-S\":2.66646,\"Al-Se\":2.72646,\"Al-Te\":2.93646,\"Am-Br\":3.22944,\"Am-Cl\":3.08945,\"Am-F\":2.61945,\"Am-O\":2.71649,\"As-Au\":2.26998,\"As-B\":2.42646,\"As-Ba\":3.69,\"As-Be\":2.60649,\"As-Bi\":2.87642,\"As-Br\":2.80646,\"As-C\":2.38646,\"As-Ca\":3.48295,\"As-Cd\":3.29295,\"As-Ce\":3.08644,\"As-Cl\":2.61646,\"As-Co\":2.43642,\"As-Cr\":2.49642,\"As-Cs\":4.15942,\"As-Cu\":2.71895,\"As-Dy\":3.14,\"As-Er\":3.18,\"As-Eu\":2.93898,\"As-F\":2.15646,\"As-Fe\":2.50642,\"As-Ga\":2.38998,\"As-Gd\":3.18,\"As-Ge\":2.47998,\"As-Hf\":2.71642,\"As-Hg\":2.65642,\"As-Ho\":2.87898,\"As-I\":3.03646,\"As-In\":2.66642,\"As-Ir\":2.58998,\"As-K\":3.94942,\"As-La\":3.51293,\"As-Lu\":3.19649,\"As-Mg\":3.09293,\"As-Mn\":2.51642,\"As-Mo\":2.62701,\"As-Na\":3.64942,\"As-Nb\":2.69642,\"As-Ni\":2.28998,\"As-O\":2.24546,\"As-P\":2.29998,\"As-Pb\":3.02644,\"As-Pd\":2.34998,\"As-Pr\":3.35649,\"As-Pt\":2.30998,\"As-Rb\":4.04645,\"As-Re\":2.61998,\"As-Rh\":2.41998,\"As-Ru\":2.40998,\"As-S\":2.84649,\"As-Sb\":2.64998,\"As-Sc\":3.04291,\"As-Se\":2.98649,\"As-Si\":2.66002,\"As-Sm\":3.30649,\"As-Sn\":2.77642,\"As-Sr\":3.62295,\"As-Ta\":2.70642,\"As-Tb\":3.26649,\"As-Te\":3.10646,\"As-Th\":3.40649,\"As-Ti\":2.87642,\"As-Tl\":3.09644,\"As-Tm\":3.22649,\"As-U\":3.02644,\"As-V\":2.54642,\"As-W\":2.58998,\"As-Y\":3.24649,\"As-Yb\":3.19649,\"As-Zn\":2.95293,\"As-Zr\":3.07004,\"Au-Br\":2.77646,\"Au-Cl\":2.88295,\"Au-F\":2.34646,\"Au-H\":1.41998,\"Au-I\":3.21295,\"Au-N\":2.3826,\"Au-O\":2.34646,\"Au-P\":2.18998,\"Au-S\":2.8326,\"Au-Se\":2.22998,\"Au-Te\":2.45998,\"B-B\":1.85846,\"B-Br\":2.33646,\"B-Cl\":2.19646,\"B-F\":1.76646,\"B-H\":1.59646,\"B-I\":2.55646,\"B-N\":1.93846,\"B-O\":1.82746,\"B-P\":2.37646,\"B-S\":2.27646,\"B-Se\":2.40646,\"B-Te\":2.65646,\"Ba-Br\":3.74295,\"Ba-Cl\":3.55295,\"Ba-F\":3.05095,\"Ba-H\":3.08295,\"Ba-I\":3.99295,\"Ba-N\":3.33295,\"Ba-O\":3.14795,\"Ba-P\":3.48295,\"Ba-S\":3.66195,\"Ba-Se\":3.74295,\"Ba-Te\":3.94295,\"Be-Br\":2.50649,\"Be-Cl\":2.36649,\"Be-F\":1.88749,\"Be-H\":1.71649,\"Be-I\":2.70649,\"Be-N\":2.10649,\"Be-O\":1.98749,\"Be-P\":2.55649,\"Be-S\":2.43649,\"Be-Se\":2.57649,\"Be-Te\":2.81649,\"Bi-Br\":3.17993,\"Bi-Cl\":3.04291,\"Bi-F\":2.55291,\"Bi-H\":2.12642,\"Bi-I\":3.38291,\"Bi-N\":2.56329,\"Bi-O\":2.6608,\"Bi-P\":2.78642,\"Bi-S\":3.13291,\"Bi-Se\":3.24329,\"Bi-Te\":3.02642,\"Bk-Br\":3.15233,\"Bk-Cl\":3.02291,\"Bk-F\":2.54233,\"Bk-O\":2.64329,\"Br-C\":2.26002,\"Br-Ca\":3.36995,\"Br-Cd\":3.21295,\"Br-Ce\":3.40452,\"Br-Cf\":3.14233,\"Br-Cl\":2.33296,\"Br-Co\":2.33642,\"Br-Cr\":2.97293,\"Br-Cs\":4.06942,\"Br-Cu\":2.89295,\"Br-Dy\":3.16945,\"Br-Er\":3.14945,\"Br-Eu\":3.46549,\"Br-F\":2.20646,\"Br-Fe\":2.8952,\"Br-Ga\":2.6426,\"Br-Gd\":3.19945,\"Br-Ge\":2.34998,\"Br-Hf\":2.62642,\"Br-Hg\":3.09293,\"Br-Ho\":3.20159,\"Br-In\":3.05329,\"Br-Ir\":2.49998,\"Br-K\":3.8513,\"Br-La\":3.43293,\"Br-Li\":3.11654,\"Br-Lu\":3.11945,\"Br-Mg\":2.99293,\"Br-Mn\":3.05293,\"Br-Mo\":2.8535,\"Br-Na\":3.57715,\"Br-Nb\":3.07646,\"Br-Nd\":3.37293,\"Br-Ni\":2.80649,\"Br-Np\":3.21233,\"Br-O\":2.35646,\"Br-Os\":2.72002,\"Br-P\":2.44293,\"Br-Pa\":3.18437,\"Br-Pb\":3.62451,\"Br-Pd\":2.80649,\"Br-Pm\":3.18233,\"Br-Pr\":3.27649,\"Br-Pt\":2.94191,\"Br-Pu\":3.19233,\"Br-Rb\":4.05498,\"Br-Re\":2.70002,\"Br-Rh\":2.7126,\"Br-Ru\":2.30998,\"Br-S\":2.21998,\"Br-Sb\":2.96646,\"Br-Sc\":2.94291,\"Br-Se\":2.78002,\"Br-Si\":2.55002,\"Br-Sm\":3.26649,\"Br-Sn\":3.2152,\"Br-Sr\":3.54295,\"Br-Ta\":2.60642,\"Br-Tb\":3.18649,\"Br-Te\":2.90002,\"Br-Th\":3.31945,\"Br-Ti\":3.20293,\"Br-Tl\":3.80942,\"Br-Tm\":3.13945,\"Br-U\":3.39452,\"Br-V\":2.87329,\"Br-W\":2.49998,\"Br-Y\":3.15649,\"Br-Yb\":3.12945,\"Br-Zn\":2.86293,\"Br-Zr\":2.98004,\"C-C\":1.89002,\"C-Cl\":2.11002,\"C-Co\":2.19691,\"C-Cu\":2.32649,\"C-F\":1.76002,\"C-Fe\":2.25191,\"C-H\":1.2,\"C-I\":2.16998,\"C-N\":1.79202,\"C-O\":1.97249,\"C-P\":1.93998,\"C-Pd\":2.33649,\"C-Pt\":2.36649,\"C-S\":2.15002,\"C-Se\":2.01998,\"C-Si\":2.23302,\"C-Te\":2.25998,\"Ca-Cl\":3.23295,\"Ca-F\":2.70495,\"Ca-H\":2.69295,\"Ca-I\":3.58295,\"Ca-N\":3.00295,\"Ca-O\":2.83062,\"Ca-P\":3.41295,\"Ca-S\":3.31295,\"Ca-Se\":3.42295,\"Ca-Te\":3.62295,\"Cd-Cl\":3.09295,\"Cd-F\":2.67395,\"Cd-H\":2.52295,\"Cd-I\":3.46295,\"Cd-N\":2.82295,\"Cd-O\":2.76695,\"Cd-P\":3.20295,\"Cd-S\":3.16695,\"Cd-Se\":3.26295,\"Cd-Te\":3.45295,\"Ce-Cl\":3.25293,\"Ce-F\":2.75452,\"Ce-H\":2.34644,\"Ce-I\":3.62452,\"Ce-N\":2.78549,\"Ce-O\":2.86393,\"Ce-P\":3.00644,\"Ce-S\":3.36293,\"Ce-Se\":3.04644,\"Ce-Te\":3.22644,\"Cf-Cl\":3.01291,\"Cf-F\":2.53233,\"Cf-O\":2.63291,\"Cl-Cl\":2.14296,\"Cl-Cm\":3.18291,\"Cl-Co\":2.74593,\"Cl-Cr\":2.80293,\"Cl-Cs\":3.91042,\"Cl-Cu\":2.75295,\"Cl-D\":1.5,\"Cl-Dy\":3.01945,\"Cl-Er\":2.99944,\"Cl-Eu\":3.32549,\"Cl-F\":2.14646,\"Cl-Fe\":2.86293,\"Cl-Ga\":2.52646,\"Cl-Gd\":3.06349,\"Cl-Ge\":2.49002,\"Cl-H\":1.5,\"Cl-Hf\":2.75646,\"Cl-Hg\":3.24939,\"Cl-Ho\":3.05159,\"Cl-I\":3.33295,\"Cl-In\":3.52939,\"Cl-Ir\":2.56746,\"Cl-K\":3.65976,\"Cl-La\":3.33452,\"Cl-Li\":2.91814,\"Cl-Lu\":2.96944,\"Cl-Mg\":2.79293,\"Cl-Mn\":2.84593,\"Cl-Mo\":2.80447,\"Cl-N\":2.20646,\"Cl-NH\":3.48195,\"Cl-Na\":3.39412,\"Cl-Nb\":2.76291,\"Cl-Nd\":3.22493,\"Cl-Ni\":2.62649,\"Cl-Np\":3.07233,\"Cl-O\":2.16646,\"Cl-Os\":2.54002,\"Cl-P\":2.28746,\"Cl-Pa\":3.01437,\"Cl-Pb\":3.39295,\"Cl-Pd\":2.65649,\"Cl-Pm\":3.41233,\"Cl-Pr\":3.12749,\"Cl-Pt\":2.75646,\"Cl-Pu\":3.05233,\"Cl-Rb\":3.86664,\"Cl-Re\":3.44712,\"Cl-Rh\":2.62646,\"Cl-Ru\":2.70646,\"Cl-S\":2.37002,\"Cl-Sb\":2.80646,\"Cl-Sc\":2.92291,\"Cl-Se\":2.57002,\"Cl-Si\":2.38002,\"Cl-Sm\":3.08749,\"Cl-Sn\":3.13111,\"Cl-Sr\":3.37295,\"Cl-Ta\":2.6739,\"Cl-Tb\":3.04349,\"Cl-Tc\":2.56002,\"Cl-Te\":2.73906,\"Cl-Th\":3.15945,\"Cl-Ti\":3.02293,\"Cl-Tl\":3.72942,\"Cl-Tm\":2.98944,\"Cl-U\":3.24452,\"Cl-V\":3.15293,\"Cl-W\":2.47,\"Cl-Y\":3.00649,\"Cl-Yb\":2.98249,\"Cl-Zn\":2.72293,\"Cl-Zr\":3.33651,\"Cm-F\":2.68291,\"Cm-O\":2.79291,\"Co-F\":2.35293,\"Co-H\":1.9278,\"Co-I\":2.52878,\"Co-In\":3.13629,\"Co-N\":2.36293,\"Co-O\":2.40493,\"Co-P\":2.36642,\"Co-S\":2.65293,\"Co-Se\":2.39642,\"Co-Te\":2.61642,\"Cr-F\":2.45293,\"Cr-H\":1.67642,\"Cr-I\":3.19293,\"Cr-N\":2.5152,\"Cr-O\":2.44293,\"Cr-P\":2.42642,\"Cr-S\":2.72491,\"Cr-Se\":2.44642,\"Cr-Te\":2.67642,\"Cs-F\":3.49942,\"Cs-H\":3.55942,\"Cs-I\":4.40942,\"Cs-N\":3.94942,\"Cs-O\":3.53642,\"Cs-P\":3.64194,\"Cs-S\":4.24942,\"Cs-Se\":4.21655,\"Cs-Te\":4.4631,\"Cu-F\":2.46295,\"Cu-H\":1.81649,\"Cu-I\":3.01795,\"Cu-N\":2.49295,\"Cu-O\":2.47295,\"Cu-P\":2.65649,\"Cu-S\":2.76095,\"Cu-Se\":2.76295,\"Cu-Te\":2.87649,\"D-F\":1.1,\"D-N\":1.2,\"D-O\":1.2,\"Dy-F\":2.52944,\"Dy-H\":2.09,\"Dy-I\":3.39945,\"Dy-N\":2.38,\"Dy-O\":2.65651,\"Dy-P\":2.77,\"Dy-S\":2.823,\"Dy-Se\":2.81,\"Dy-Te\":3.22,\"Er-F\":2.51049,\"Er-H\":2.06,\"Er-I\":3.38945,\"Er-N\":2.36,\"Er-O\":2.63651,\"Er-P\":2.75,\"Er-S\":3.27651,\"Er-Se\":3.18649,\"Er-Te\":3.22,\"Es-O\":2.70139,\"Eu-F\":2.83549,\"Eu-H\":2.18898,\"Eu-I\":3.69549,\"Eu-N\":2.95549,\"Eu-O\":2.94249,\"Eu-P\":2.85898,\"Eu-S\":3.37949,\"Eu-Se\":2.89898,\"Eu-Te\":3.08898,\"F-Fe\":2.36293,\"F-Ga\":2.14646,\"F-Gd\":3.15651,\"F-Ge\":2.01002,\"F-H\":1.1,\"F-Hf\":3.18291,\"F-Hg\":2.88293,\"F-Ho\":2.56159,\"F-I\":3.18295,\"F-In\":2.35491,\"F-Ir\":2.15002,\"F-K\":3.11142,\"F-Kr\":2.67549,\"F-La\":2.79293,\"F-Li\":2.34276,\"F-Lu\":2.48249,\"F-Mg\":2.29093,\"F-Mn\":2.41093,\"F-Mo\":2.2998,\"F-N\":1.82646,\"F-NH\":2.99195,\"F-Na\":2.80398,\"F-Nb\":2.35646,\"F-Nd\":2.73452,\"F-Ni\":2.20249,\"F-Np\":2.59233,\"F-Os\":2.07746,\"F-P\":2.01002,\"F-Pa\":2.54437,\"F-Pb\":2.92045,\"F-Pd\":2.34649,\"F-Pm\":2.55233,\"F-Po\":2.83646,\"F-Pr\":2.62945,\"F-Pt\":2.54002,\"F-Pu\":2.58233,\"F-Rb\":3.37645,\"F-Re\":2.16002,\"F-Rh\":2.16646,\"F-Ru\":2.57646,\"F-S\":1.95002,\"F-Sb\":2.35646,\"F-Sc\":2.32291,\"F-Se\":2.08002,\"F-Si\":1.93002,\"F-Sm\":2.60649,\"F-Sn\":2.63793,\"F-Sr\":2.88195,\"F-Ta\":2.2539,\"F-Tb\":2.54249,\"F-Tc\":2.24219,\"F-Te\":2.22002,\"F-Th\":2.68945,\"F-Ti\":2.86293,\"F-Tl\":3.26942,\"F-Tm\":2.51649,\"F-U\":2.80293,\"F-V\":2.87293,\"F-W\":2.03,\"F-Xe\":2.62649,\"F-Y\":2.51049,\"F-Yb\":2.50649,\"F-Zn\":2.38293,\"F-Zr\":2.99651,\"Fe-H\":1.68642,\"Fe-I\":3.1552,\"Fe-N\":2.48193,\"Fe-O\":2.44693,\"Fe-P\":2.42642,\"Fe-S\":2.83793,\"Fe-Se\":2.43642,\"Fe-Te\":2.68642,\"Ga-H\":1.55998,\"Ga-I\":2.91646,\"Ga-N\":1.96,\"Ga-O\":2.18646,\"Ga-P\":2.46998,\"Ga-S\":2.61946,\"Ga-Se\":3.41295,\"Ga-Te\":2.58998,\"Gd-H\":2.13,\"Gd-I\":3.41945,\"Gd-N\":2.42,\"Gd-O\":2.76651,\"Gd-P\":2.81,\"Gd-S\":3.13649,\"Gd-Se\":2.85,\"Gd-Te\":3.24,\"Ge-Ge\":2.6,\"Ge-H\":1.59998,\"Ge-I\":2.54998,\"Ge-N\":1.92998,\"Ge-O\":2.09802,\"Ge-P\":2.36998,\"Ge-S\":2.56702,\"Ge-Se\":2.70002,\"Ge-Te\":2.60998,\"H-Hf\":1.93642,\"H-Hg\":1.86642,\"H-Ho\":2.11898,\"H-In\":1.87642,\"H-Ir\":1.80998,\"H-K\":3.21942,\"H-La\":2.77293,\"H-Lu\":2.42649,\"H-Mg\":2.24293,\"H-Mn\":1.70642,\"H-Mo\":1.83701,\"H-N\":1.2,\"H-Na\":2.79942,\"H-Nb\":1.90642,\"H-Ni\":1.44998,\"H-O\":1.2,\"H-P\":1.45998,\"H-Pb\":2.27644,\"H-Pd\":1.51998,\"H-Pr\":2.62649,\"H-Pt\":1.44998,\"H-Rb\":3.43645,\"H-Re\":1.79998,\"H-Rh\":1.59998,\"H-Ru\":1.65998,\"H-S\":1.42998,\"H-Sb\":2.81998,\"H-Sc\":2.24291,\"H-Se\":1.58998,\"H-Si\":1.82002,\"H-Sm\":2.56649,\"H-Sn\":2.00642,\"H-Sr\":2.87295,\"H-Ta\":1.91642,\"H-Tb\":2.51649,\"H-Te\":1.87998,\"H-Th\":2.67649,\"H-Ti\":1.76642,\"H-Tl\":2.35644,\"H-Tm\":2.45649,\"H-U\":2.27644,\"H-V\":1.73642,\"H-W\":1.80998,\"H-Y\":2.46649,\"H-Yb\":2.42649,\"H-Zn\":2.13293,\"H-Zr\":2.29004,\"Hf-I\":2.83642,\"Hf-N\":2.24642,\"Hf-O\":2.37946,\"Hf-P\":2.63642,\"Hf-S\":2.64642,\"Hf-Se\":2.67642,\"Hf-Te\":2.87642,\"Hg-Hg\":3.1952,\"Hg-I\":3.33293,\"Hg-N\":2.17642,\"Hg-O\":2.86939,\"Hg-P\":2.57642,\"Hg-S\":3.42093,\"Hg-Se\":2.82642,\"Hg-Te\":2.76642,\"Ho-I\":3.44159,\"Ho-N\":2.41898,\"Ho-O\":2.67047,\"Ho-P\":2.79898,\"Ho-S\":3.13547,\"Ho-Se\":2.84898,\"Ho-Te\":3.03898,\"I-I\":2.4,\"I-In\":3.19291,\"I-Ir\":2.70998,\"I-K\":4.11717,\"I-La\":3.64293,\"I-Li\":3.37676,\"I-Lu\":3.36945,\"I-Mg\":3.17293,\"I-Mn\":3.23293,\"I-Mo\":2.74701,\"I-Na\":3.88251,\"I-Nb\":3.1439,\"I-Nd\":3.59452,\"I-Ni\":3.00649,\"I-Np\":3.44233,\"I-O\":2.47646,\"I-P\":2.44998,\"I-Pb\":3.69562,\"I-Pd\":2.96649,\"I-Pr\":3.49649,\"I-Pt\":2.41998,\"I-Pu\":3.43233,\"I-Rb\":4.33462,\"I-Re\":2.65998,\"I-Rh\":2.52998,\"I-Ru\":2.52998,\"I-S\":2.40998,\"I-Sb\":3.21646,\"I-Sc\":3.15291,\"I-Se\":2.58998,\"I-Si\":2.76002,\"I-Sm\":3.44649,\"I-Sn\":3.52293,\"I-Sr\":3.74295,\"I-Ta\":2.81642,\"I-Tb\":3.40945,\"I-Te\":3.13702,\"I-Th\":3.56649,\"I-Ti\":3.08291,\"I-Tl\":3.94142,\"I-Tm\":3.37945,\"I-U\":3.62452,\"I-V\":2.66642,\"I-W\":2.70998,\"I-Y\":3.37649,\"I-Yb\":3.37945,\"I-Zn\":3.07293,\"I-Zr\":3.19004,\"In-Mn\":3.14729,\"In-N\":2.18642,\"In-O\":2.46491,\"In-P\":2.68642,\"In-S\":2.93291,\"In-Se\":2.62642,\"In-Te\":2.84642,\"Ir-N\":2.10998,\"Ir-O\":2.27746,\"Ir-P\":2.50998,\"Ir-S\":2.42998,\"Ir-Se\":2.55998,\"Ir-Te\":2.75998,\"K-N\":3.41942,\"K-O\":3.25142,\"K-P\":3.44942,\"K-S\":3.79285,\"K-Se\":4.00186,\"K-Te\":4.23284,\"La-N\":3.05293,\"La-O\":2.90983,\"La-P\":3.32293,\"La-S\":3.35593,\"La-Se\":3.45293,\"La-Te\":3.65293,\"Li-N\":2.66213,\"Li-O\":2.60087,\"Li-S\":3.02481,\"Li-Se\":3.2433,\"Li-Te\":3.42496,\"Lu-N\":2.71649,\"Lu-O\":2.57749,\"Lu-P\":3.11649,\"Lu-S\":3.03649,\"Lu-Se\":3.16649,\"Lu-Te\":3.35649,\"Mg-N\":2.56293,\"Mg-O\":2.41824,\"Mg-P\":3.00293,\"Mg-S\":2.89293,\"Mg-Se\":3.03293,\"Mg-Te\":3.24293,\"Mn-N\":2.56193,\"Mn-O\":2.51652,\"Mn-P\":2.39642,\"Mn-S\":2.93293,\"Mn-Se\":2.47642,\"Mn-Te\":2.70642,\"Mo-N\":2.4735,\"Mo-O\":2.3475,\"Mo-P\":2.54701,\"Mo-S\":2.80067,\"Mo-Se\":2.59701,\"Mo-Te\":2.79701,\"N-N\":1.8826,\"N-Na\":3.12942,\"N-Nb\":2.46046,\"N-Nd\":3.01293,\"N-Ni\":2.30649,\"N-O\":1.81746,\"N-P\":1.97146,\"N-Pb\":3.0967,\"N-Pd\":2.40451,\"N-Pr\":2.90649,\"N-Pt\":2.41649,\"N-Rb\":3.79645,\"N-Re\":2.10998,\"N-Rh\":2.2626,\"N-Ru\":2.2626,\"N-S\":2.28849,\"N-Sb\":2.56446,\"N-Sc\":2.54291,\"N-Se\":2.1,\"N-Si\":2.12002,\"N-Sm\":3.02351,\"N-Sn\":2.7152,\"N-Sr\":3.09295,\"N-Ta\":2.16642,\"N-Tb\":2.80649,\"N-Te\":2.16998,\"N-Th\":2.94649,\"N-Ti\":2.08642,\"N-Tl\":2.59644,\"N-Tm\":2.74649,\"N-U\":2.78649,\"N-V\":2.38329,\"N-W\":2.10998,\"N-Y\":2.77649,\"N-Yb\":2.84851,\"N-Zn\":2.43293,\"N-Zr\":2.65004,\"NH-O\":3.08895,\"Na-O\":2.95693,\"Na-P\":3.47942,\"Na-S\":3.57685,\"Na-Se\":3.71593,\"Na-Te\":3.95459,\"Nb-O\":2.45329,\"Nb-P\":2.61642,\"Nb-S\":2.74,\"Nb-Se\":2.66642,\"Nb-Te\":2.85642,\"Nd-O\":2.8587,\"Nd-S\":3.42712,\"Nd-Se\":3.42293,\"Nd-Te\":3.60293,\"Ni-O\":2.28149,\"Ni-P\":2.31998,\"Ni-S\":2.58649,\"Ni-Se\":2.18998,\"Ni-Te\":2.47998,\"Np-O\":2.63646,\"Np-S\":3.2,\"O-O\":1.7,\"O-Os\":2.23,\"O-P\":2.08646,\"O-Pa\":2.63383,\"O-Pb\":3.04096,\"O-Pd\":2.39849,\"O-Po\":2.64646,\"O-Pr\":2.74449,\"O-Pt\":2.40649,\"O-Pu\":2.68329,\"O-Rb\":3.43945,\"O-Re\":2.3426,\"O-Rh\":2.24946,\"O-Ru\":2.22646,\"O-S\":1.8,\"O-Sb\":2.45237,\"O-Sc\":2.42029,\"O-Se\":2.16102,\"O-Si\":1.99002,\"O-Sm\":2.88251,\"O-Sn\":2.82146,\"O-Sr\":2.98095,\"O-Ta\":2.74646,\"O-Tb\":2.65549,\"O-Tc\":2.22446,\"O-Te\":2.3334,\"O-Th\":2.77349,\"O-Ti\":2.35391,\"O-Tl\":3.36945,\"O-Tm\":2.60649,\"O-U\":2.94295,\"O-V\":2.84939,\"O-W\":2.20102,\"O-Xe\":2.63451,\"O-Y\":2.62549,\"O-Yb\":2.74551,\"O-Zn\":2.41693,\"O-Zr\":3.09651,\"Os-S\":2.56002,\"P-P\":2.48381,\"P-Pb\":2.94644,\"P-Pd\":2.46998,\"P-Pr\":3.28649,\"P-Pt\":2.23998,\"P-Rb\":3.50645,\"P-Re\":2.50998,\"P-Rh\":2.43998,\"P-Ru\":2.33998,\"P-S\":2.57646,\"P-Sb\":2.56998,\"P-Sc\":2.96291,\"P-Se\":2.69646,\"P-Si\":2.58002,\"P-Sm\":3.23649,\"P-Sn\":2.60642,\"P-Sr\":3.43295,\"P-Ta\":2.62642,\"P-Tb\":3.19649,\"P-Te\":2.56998,\"P-Th\":3.33649,\"P-Ti\":2.51642,\"P-Tl\":3.01644,\"P-Tm\":3.13649,\"P-U\":2.94644,\"P-V\":2.46642,\"P-W\":2.50998,\"P-Y\":3.17649,\"P-Yb\":3.13649,\"P-Zn\":2.86293,\"P-Zr\":3.02004,\"Pb-S\":3.40395,\"Pb-Se\":3.55295,\"Pb-Te\":3.14644,\"Pd-S\":2.69649,\"Pd-Se\":2.26998,\"Pd-Te\":2.52998,\"Pr-S\":3.20649,\"Pr-Se\":3.32649,\"Pr-Te\":3.50649,\"Pt-S\":2.76649,\"Pt-Se\":2.23998,\"Pt-Te\":2.49998,\"Pu-S\":3.3,\"Rb-S\":3.97645,\"Rb-Se\":4.13773,\"Rb-Te\":4.28802,\"Re-S\":2.61998,\"Re-Se\":2.54998,\"Re-Te\":2.74998,\"Rh-S\":2.19998,\"Rh-Se\":2.37998,\"Rh-Te\":2.59998,\"Ru-S\":2.6426,\"Ru-Se\":2.69451,\"Ru-Te\":2.58998,\"S-S\":2.2,\"S-Sb\":3.05,\"S-Sc\":2.88391,\"S-Se\":2.81649,\"S-Si\":2.47602,\"S-Sm\":3.15649,\"S-Sn\":3.15293,\"S-Sr\":3.51295,\"S-Ta\":2.8439,\"S-Tb\":3.11649,\"S-Te\":2.79002,\"S-Th\":3.24649,\"S-Ti\":2.74646,\"S-Tl\":3.66442,\"S-Tm\":3.05649,\"S-U\":3.25293,\"S-V\":2.82293,\"S-W\":2.43998,\"S-Y\":3.08649,\"S-Yb\":3.03649,\"S-Zn\":2.80293,\"S-Zr\":2.91004,\"Sb-Se\":3.05646,\"Sb-Te\":2.82998,\"Sc-Se\":3.00291,\"Sc-Te\":3.20291,\"Se-Se\":2.93649,\"Se-Si\":2.61002,\"Se-Sm\":3.27649,\"Se-Sn\":2.96646,\"Se-Sr\":3.58295,\"Se-Ta\":2.66642,\"Se-Tb\":3.23649,\"Se-Te\":2.57998,\"Se-Th\":3.36649,\"Se-Ti\":2.53642,\"Se-Tl\":3.00644,\"Se-Tm\":3.18649,\"Se-U\":3.00644,\"Se-V\":2.48642,\"Se-W\":2.55998,\"Se-Y\":3.21649,\"Se-Yb\":3.16649,\"Se-Zn\":2.93293,\"Se-Zr\":3.03004,\"Si-Si\":2.6,\"Si-Te\":2.84002,\"Sm-Te\":3.46649,\"Sn-Te\":2.91642,\"Sr-Te\":3.73295,\"Ta-Te\":2.85642,\"Tb-Te\":3.42649,\"Te-Te\":2.80998,\"Te-Th\":3.54649,\"Te-Ti\":2.95642,\"Te-Tl\":3.23644,\"Te-Tm\":3.37649,\"Te-U\":3.16644,\"Te-V\":2.72642,\"Te-W\":2.75998,\"Te-Y\":3.40649,\"Te-Yb\":3.36649,\"Te-Zn\":3.16293,\"Te-Zr\":3.17004}")
766
- }.pairs, kt = .4;
767
- function At(e, t) {
768
- return Ot[e < t ? `${e}-${t}` : `${t}-${e}`] ?? null;
768
+ }.pairs, jt = .4;
769
+ function Mt(e, t) {
770
+ return At[e < t ? `${e}-${t}` : `${t}-${e}`] ?? null;
769
771
  }
770
- function jt(e) {
772
+ function Nt(e) {
771
773
  let t = /* @__PURE__ */ new Map(), n = e.map((e) => {
772
774
  let n = t.get(e.element);
773
775
  return n === void 0 && (n = t.size, t.set(e.element, n)), n;
774
776
  }), r = [...t.keys()], i = new Float64Array(r.length * r.length), a = 0;
775
777
  if (r.forEach((e, t) => {
776
778
  r.forEach((n, o) => {
777
- let s = At(e, n) ?? 0;
779
+ let s = Mt(e, n) ?? 0;
778
780
  i[t * r.length + o] = s, a = Math.max(a, s);
779
781
  });
780
- }), a < kt) return [];
782
+ }), a < jt) return [];
781
783
  let o = e.map((e) => e.position.map((e) => Math.floor(e / a) | 0)), s = [
782
784
  Infinity,
783
785
  Infinity,
@@ -799,9 +801,9 @@ function jt(e) {
799
801
  m.length = 0;
800
802
  for (let r = -1; r <= 1; r += 1) for (let o = -1; o <= 1; o += 1) for (let p = -1; p <= 1; p += 1) for (let h of f.get(d(s + r, c + o, l + p)) ?? []) {
801
803
  let r = i[u + n[h]];
802
- if (h <= a || r < kt) continue;
803
- let o = Fe(t.position, e[h].position);
804
- o >= kt && o <= r && m.push({
804
+ if (h <= a || r < jt) continue;
805
+ let o = Le(t.position, e[h].position);
806
+ o >= jt && o <= r && m.push({
805
807
  start: a,
806
808
  end: h,
807
809
  length: o
@@ -812,11 +814,11 @@ function jt(e) {
812
814
  }
813
815
  //#endregion
814
816
  //#region src/structure/images.ts
815
- var Mt = 1e-4;
816
- function Nt(e, t) {
817
+ var Pt = 1e-4;
818
+ function Ft(e, t) {
817
819
  let n = [];
818
820
  return e.forEach((e, r) => {
819
- let i = e.fractional.map((e) => z(e, Mt));
821
+ let i = e.fractional.map((e) => R(e, Pt));
820
822
  if (n.push({
821
823
  siteIndex: r,
822
824
  fractional: i,
@@ -826,7 +828,7 @@ function Nt(e, t) {
826
828
  0,
827
829
  1,
828
830
  2
829
- ].filter((e) => i[e] < Mt), o = 1 << a.length;
831
+ ].filter((e) => i[e] < Pt), o = 1 << a.length;
830
832
  for (let e = 1; e < o; e += 1) {
831
833
  let t = [
832
834
  i[0],
@@ -845,25 +847,23 @@ function Nt(e, t) {
845
847
  }
846
848
  //#endregion
847
849
  //#region src/scene/build.ts
848
- function Pt(e) {
850
+ function It(e) {
849
851
  let t = [];
850
852
  for (let n of e.sites) for (let e of n.species) {
851
- let n = Se(e.element);
853
+ let n = Te(e.element);
852
854
  t.includes(n) || t.push(n);
853
855
  }
854
856
  return t;
855
857
  }
856
- function Ft(e, t = {}) {
857
- let n = Nt(e.sites, t.imageAtoms ?? !0).map((t) => {
858
- let n = e.sites[t.siteIndex];
859
- if (!n) throw Error(`Site ${t.siteIndex} is missing.`);
860
- let r = n.species[0];
858
+ function Lt(e, t = {}) {
859
+ let n = Ft(e.sites, t.imageAtoms ?? !0).map((t) => {
860
+ let n = e.sites[t.siteIndex], r = n.species[0];
861
861
  if (!r) throw Error(`Site ${n.label} has no species.`);
862
862
  return {
863
863
  siteIndex: t.siteIndex,
864
864
  element: r.element,
865
865
  species: n.species,
866
- position: Pe(e.lattice, t.fractional),
866
+ position: Ie(e.lattice, t.fractional),
867
867
  fractional: t.fractional,
868
868
  isImage: t.isImage
869
869
  };
@@ -871,20 +871,20 @@ function Ft(e, t = {}) {
871
871
  return {
872
872
  cell: e.lattice.vectors,
873
873
  atoms: n,
874
- bonds: jt(n),
875
- elements: Pt(e)
874
+ bonds: Nt(n),
875
+ elements: It(e)
876
876
  };
877
877
  }
878
878
  //#endregion
879
879
  //#region node_modules/three/examples/jsm/controls/TrackballControls.js
880
- var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt = 1e-6, q = {
880
+ var Rt = { type: "change" }, zt = { type: "start" }, Bt = { type: "end" }, K = 1e-6, q = {
881
881
  NONE: -1,
882
882
  ROTATE: 0,
883
883
  ZOOM: 1,
884
884
  PAN: 2,
885
885
  TOUCH_ROTATE: 3,
886
886
  TOUCH_ZOOM_PAN: 4
887
- }, Bt = new j(), J = new j(), Vt = new M(), Ht = new M(), Ut = new M(), Y = new A(), Wt = new M(), Gt = new M(), Kt = new M(), qt = new M(), Jt = class extends l {
887
+ }, Vt = new k(), J = new k(), Ht = new A(), Ut = new A(), Wt = new A(), Y = new O(), Gt = new A(), Kt = new A(), qt = new A(), Jt = new A(), Yt = class extends l {
888
888
  constructor(e, t = null) {
889
889
  super(e, t), this.screen = {
890
890
  left: 0,
@@ -899,7 +899,7 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
899
899
  LEFT: S.ROTATE,
900
900
  MIDDLE: S.DOLLY,
901
901
  RIGHT: S.PAN
902
- }, this.target = new M(), this.state = q.NONE, this.keyState = q.NONE, this._lastPosition = new M(), this._lastUp = new M(), this._lastZoom = 1, this._touchZoomDistanceStart = 0, this._touchZoomDistanceEnd = 0, this._touchRollAngle = 0, this._touchRollPointerIds = "", this._lastAngle = 0, this._lastRollAngle = 0, this._eye = new M(), this._movePrev = new j(), this._moveCurr = new j(), this._lastAxis = new M(), this._zoomStart = new j(), this._zoomEnd = new j(), this._panStart = new j(), this._panEnd = new j(), this._pointers = [], this._pointerPositions = {}, this._onPointerMove = Xt.bind(this), this._onPointerDown = Yt.bind(this), this._onPointerUp = Zt.bind(this), this._onPointerCancel = Qt.bind(this), this._onContextMenu = on.bind(this), this._onMouseWheel = an.bind(this), this._onKeyDown = en.bind(this), this._onKeyUp = $t.bind(this), this._onTouchStart = sn.bind(this), this._onTouchMove = cn.bind(this), this._onTouchEnd = ln.bind(this), this._onMouseDown = tn.bind(this), this._onMouseMove = nn.bind(this), this._onMouseUp = rn.bind(this), this._target0 = this.target.clone(), this._position0 = this.object.position.clone(), this._up0 = this.object.up.clone(), this._zoom0 = this.object.zoom, t !== null && (this.connect(t), this.handleResize()), this.update();
902
+ }, this.target = new A(), this.state = q.NONE, this.keyState = q.NONE, this._lastPosition = new A(), this._lastUp = new A(), this._lastZoom = 1, this._touchZoomDistanceStart = 0, this._touchZoomDistanceEnd = 0, this._touchRollAngle = 0, this._touchRollPointerIds = "", this._lastAngle = 0, this._lastRollAngle = 0, this._eye = new A(), this._movePrev = new k(), this._moveCurr = new k(), this._lastAxis = new A(), this._zoomStart = new k(), this._zoomEnd = new k(), this._panStart = new k(), this._panEnd = new k(), this._pointers = [], this._pointerPositions = {}, this._onPointerMove = Zt.bind(this), this._onPointerDown = Xt.bind(this), this._onPointerUp = Qt.bind(this), this._onPointerCancel = $t.bind(this), this._onContextMenu = sn.bind(this), this._onMouseWheel = on.bind(this), this._onKeyDown = tn.bind(this), this._onKeyUp = en.bind(this), this._onTouchStart = cn.bind(this), this._onTouchMove = ln.bind(this), this._onTouchEnd = un.bind(this), this._onMouseDown = nn.bind(this), this._onMouseMove = rn.bind(this), this._onMouseUp = an.bind(this), this._target0 = this.target.clone(), this._position0 = this.object.position.clone(), this._up0 = this.object.up.clone(), this._zoom0 = this.object.zoom, t !== null && (this.connect(t), this.handleResize()), this.update();
903
903
  }
904
904
  connect(e) {
905
905
  super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "none";
@@ -917,16 +917,16 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
917
917
  update() {
918
918
  if (this._eye.subVectors(this.object.position, this.target), this.noRotate || (this._rotateCamera(), this.multiTouchRoll === !0 && this._rollCamera()), this.noZoom || this._zoomCamera(), this.noPan || this._panCamera(), this.object.position.addVectors(this.target, this._eye), this.object.isPerspectiveCamera) {
919
919
  this._checkDistances(), this.object.lookAt(this.target);
920
- let e = this._lastPosition.distanceToSquared(this.object.position) > zt, t = this._lastUp.distanceToSquared(this.object.up) > zt;
921
- (e || t) && (this.dispatchEvent(It), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up));
920
+ let e = this._lastPosition.distanceToSquared(this.object.position) > K, t = this._lastUp.distanceToSquared(this.object.up) > K;
921
+ (e || t) && (this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up));
922
922
  } else if (this.object.isOrthographicCamera) {
923
923
  this.object.lookAt(this.target);
924
- let e = this._lastPosition.distanceToSquared(this.object.position) > zt, t = this._lastUp.distanceToSquared(this.object.up) > zt, n = this._lastZoom !== this.object.zoom;
925
- (e || t || n) && (this.dispatchEvent(It), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom);
924
+ let e = this._lastPosition.distanceToSquared(this.object.position) > K, t = this._lastUp.distanceToSquared(this.object.up) > K, n = this._lastZoom !== this.object.zoom;
925
+ (e || t || n) && (this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom);
926
926
  } else console.warn("THREE.TrackballControls: Unsupported camera type.");
927
927
  }
928
928
  reset() {
929
- this.state = q.NONE, this.keyState = q.NONE, this.target.copy(this._target0), this.object.position.copy(this._position0), this.object.up.copy(this._up0), this.object.zoom = this._zoom0, this.object.updateProjectionMatrix(), this._eye.subVectors(this.object.position, this.target), this.object.lookAt(this.target), this.dispatchEvent(It), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom;
929
+ this.state = q.NONE, this.keyState = q.NONE, this.target.copy(this._target0), this.object.position.copy(this._position0), this.object.up.copy(this._up0), this.object.zoom = this._zoom0, this.object.updateProjectionMatrix(), this._eye.subVectors(this.object.position, this.target), this.object.lookAt(this.target), this.dispatchEvent(Rt), this._lastPosition.copy(this.object.position), this._lastUp.copy(this.object.up), this._lastZoom = this.object.zoom;
930
930
  }
931
931
  _panCamera() {
932
932
  if (J.copy(this._panEnd).sub(this._panStart), J.lengthSq()) {
@@ -934,20 +934,20 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
934
934
  let e = (this.object.right - this.object.left) / this.object.zoom / this.domElement.clientWidth, t = (this.object.top - this.object.bottom) / this.object.zoom / this.domElement.clientWidth;
935
935
  J.x *= e, J.y *= t;
936
936
  }
937
- J.multiplyScalar(this._eye.length() * this.panSpeed), Ht.copy(this._eye).cross(this.object.up).setLength(J.x), Ht.add(Vt.copy(this.object.up).setLength(J.y)), this.object.position.add(Ht), this.target.add(Ht), this.staticMoving ? this._panStart.copy(this._panEnd) : this._panStart.add(J.subVectors(this._panEnd, this._panStart).multiplyScalar(this.dynamicDampingFactor));
937
+ J.multiplyScalar(this._eye.length() * this.panSpeed), Ut.copy(this._eye).cross(this.object.up).setLength(J.x), Ut.add(Ht.copy(this.object.up).setLength(J.y)), this.object.position.add(Ut), this.target.add(Ut), this.staticMoving ? this._panStart.copy(this._panEnd) : this._panStart.add(J.subVectors(this._panEnd, this._panStart).multiplyScalar(this.dynamicDampingFactor));
938
938
  }
939
939
  }
940
940
  _rotateCamera() {
941
- qt.set(this._moveCurr.x - this._movePrev.x, this._moveCurr.y - this._movePrev.y, 0);
942
- let e = qt.length();
943
- e ? (this._eye.copy(this.object.position).sub(this.target), Wt.copy(this._eye).normalize(), Gt.copy(this.object.up).normalize(), Kt.crossVectors(Gt, Wt).normalize(), Gt.setLength(this._moveCurr.y - this._movePrev.y), Kt.setLength(this._moveCurr.x - this._movePrev.x), qt.copy(Gt.add(Kt)), Ut.crossVectors(qt, this._eye).normalize(), e *= this.rotateSpeed, Y.setFromAxisAngle(Ut, e), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y), this._lastAxis.copy(Ut), this._lastAngle = e) : !this.staticMoving && this._lastAngle && (this._lastAngle *= Math.sqrt(1 - this.dynamicDampingFactor), this._eye.copy(this.object.position).sub(this.target), Y.setFromAxisAngle(this._lastAxis, this._lastAngle), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y)), this._movePrev.copy(this._moveCurr);
941
+ Jt.set(this._moveCurr.x - this._movePrev.x, this._moveCurr.y - this._movePrev.y, 0);
942
+ let e = Jt.length();
943
+ e ? (this._eye.copy(this.object.position).sub(this.target), Gt.copy(this._eye).normalize(), Kt.copy(this.object.up).normalize(), qt.crossVectors(Kt, Gt).normalize(), Kt.setLength(this._moveCurr.y - this._movePrev.y), qt.setLength(this._moveCurr.x - this._movePrev.x), Jt.copy(Kt.add(qt)), Wt.crossVectors(Jt, this._eye).normalize(), e *= this.rotateSpeed, Y.setFromAxisAngle(Wt, e), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y), this._lastAxis.copy(Wt), this._lastAngle = e) : !this.staticMoving && this._lastAngle && (this._lastAngle *= Math.sqrt(1 - this.dynamicDampingFactor), this._eye.copy(this.object.position).sub(this.target), Y.setFromAxisAngle(this._lastAxis, this._lastAngle), this._eye.applyQuaternion(Y), this.object.up.applyQuaternion(Y)), this._movePrev.copy(this._moveCurr);
944
944
  }
945
945
  _rollCamera() {
946
946
  let e = this._getTouchRollAngle();
947
947
  if (e) this._lastRollAngle = e * this.rollSpeed;
948
948
  else if (!this.staticMoving && this._lastRollAngle) this._lastRollAngle *= Math.sqrt(1 - this.dynamicDampingFactor);
949
949
  else return;
950
- Wt.copy(this._eye).normalize(), Y.setFromAxisAngle(Wt, this._lastRollAngle), this.object.up.applyQuaternion(Y);
950
+ Gt.copy(this._eye).normalize(), Y.setFromAxisAngle(Gt, this._lastRollAngle), this.object.up.applyQuaternion(Y);
951
951
  }
952
952
  _getTouchRollAngle() {
953
953
  let e = this._pointers[0], t = this._pointers[1];
@@ -962,10 +962,10 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
962
962
  this.state === q.TOUCH_ZOOM_PAN ? (e = this._touchZoomDistanceStart / this._touchZoomDistanceEnd, this._touchZoomDistanceStart = this._touchZoomDistanceEnd, this.object.isPerspectiveCamera ? this._eye.multiplyScalar(e) : this.object.isOrthographicCamera ? (this.object.zoom = ne.clamp(this.object.zoom / e, this.minZoom, this.maxZoom), this._lastZoom !== this.object.zoom && this.object.updateProjectionMatrix()) : console.warn("THREE.TrackballControls: Unsupported camera type")) : (e = 1 + (this._zoomEnd.y - this._zoomStart.y) * this.zoomSpeed, e !== 1 && e > 0 && (this.object.isPerspectiveCamera ? this._eye.multiplyScalar(e) : this.object.isOrthographicCamera ? (this.object.zoom = ne.clamp(this.object.zoom / e, this.minZoom, this.maxZoom), this._lastZoom !== this.object.zoom && this.object.updateProjectionMatrix()) : console.warn("THREE.TrackballControls: Unsupported camera type")), this.staticMoving ? this._zoomStart.copy(this._zoomEnd) : this._zoomStart.y += (this._zoomEnd.y - this._zoomStart.y) * this.dynamicDampingFactor);
963
963
  }
964
964
  _getMouseOnScreen(e, t) {
965
- return Bt.set((e - this.screen.left) / this.screen.width, (t - this.screen.top) / this.screen.height), Bt;
965
+ return Vt.set((e - this.screen.left) / this.screen.width, (t - this.screen.top) / this.screen.height), Vt;
966
966
  }
967
967
  _getMouseOnCircle(e, t) {
968
- return Bt.set((e - this.screen.width * .5 - this.screen.left) / (this.screen.width * .5), (this.screen.height + 2 * (this.screen.top - t)) / this.screen.width), Bt;
968
+ return Vt.set((e - this.screen.width * .5 - this.screen.left) / (this.screen.width * .5), (this.screen.height + 2 * (this.screen.top - t)) / this.screen.width), Vt;
969
969
  }
970
970
  _addPointer(e) {
971
971
  this._pointers.push(e);
@@ -979,7 +979,7 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
979
979
  }
980
980
  _trackPointer(e) {
981
981
  let t = this._pointerPositions[e.pointerId];
982
- t === void 0 && (t = new j(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
982
+ t === void 0 && (t = new k(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
983
983
  }
984
984
  _getSecondPointerPosition(e) {
985
985
  let t = e.pointerId === this._pointers[0].pointerId ? this._pointers[1] : this._pointers[0];
@@ -989,25 +989,25 @@ var It = { type: "change" }, Lt = { type: "start" }, Rt = { type: "end" }, zt =
989
989
  (!this.noZoom || !this.noPan) && (this._eye.lengthSq() > this.maxDistance * this.maxDistance && (this.object.position.addVectors(this.target, this._eye.setLength(this.maxDistance)), this._zoomStart.copy(this._zoomEnd)), this._eye.lengthSq() < this.minDistance * this.minDistance && (this.object.position.addVectors(this.target, this._eye.setLength(this.minDistance)), this._zoomStart.copy(this._zoomEnd)));
990
990
  }
991
991
  };
992
- function Yt(e) {
992
+ function Xt(e) {
993
993
  this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e));
994
994
  }
995
- function Xt(e) {
995
+ function Zt(e) {
996
996
  this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
997
997
  }
998
- function Zt(e) {
998
+ function Qt(e) {
999
999
  this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchEnd(e) : this._onMouseUp(), this._removePointer(e), this._pointers.length === 0 && (this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp)));
1000
1000
  }
1001
- function Qt(e) {
1001
+ function $t(e) {
1002
1002
  this._removePointer(e);
1003
1003
  }
1004
- function $t() {
1004
+ function en() {
1005
1005
  this.enabled !== !1 && (this.keyState = q.NONE, window.addEventListener("keydown", this._onKeyDown));
1006
1006
  }
1007
- function en(e) {
1007
+ function tn(e) {
1008
1008
  this.enabled !== !1 && (window.removeEventListener("keydown", this._onKeyDown), this.keyState === q.NONE && (e.code === this.keys[q.ROTATE] && !this.noRotate ? this.keyState = q.ROTATE : e.code === this.keys[q.ZOOM] && !this.noZoom ? this.keyState = q.ZOOM : e.code === this.keys[q.PAN] && !this.noPan && (this.keyState = q.PAN)));
1009
1009
  }
1010
- function tn(e) {
1010
+ function nn(e) {
1011
1011
  let t;
1012
1012
  switch (e.button) {
1013
1013
  case 0:
@@ -1034,16 +1034,16 @@ function tn(e) {
1034
1034
  default: this.state = q.NONE;
1035
1035
  }
1036
1036
  let n = this.keyState === q.NONE ? this.state : this.keyState;
1037
- n === q.ROTATE && !this.noRotate ? (this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)), this._movePrev.copy(this._moveCurr)) : n === q.ZOOM && !this.noZoom ? (this._zoomStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._zoomEnd.copy(this._zoomStart)) : n === q.PAN && !this.noPan && (this._panStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._panEnd.copy(this._panStart)), this.dispatchEvent(Lt);
1037
+ n === q.ROTATE && !this.noRotate ? (this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)), this._movePrev.copy(this._moveCurr)) : n === q.ZOOM && !this.noZoom ? (this._zoomStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._zoomEnd.copy(this._zoomStart)) : n === q.PAN && !this.noPan && (this._panStart.copy(this._getMouseOnScreen(e.pageX, e.pageY)), this._panEnd.copy(this._panStart)), this.dispatchEvent(zt);
1038
1038
  }
1039
- function nn(e) {
1039
+ function rn(e) {
1040
1040
  let t = this.keyState === q.NONE ? this.state : this.keyState;
1041
1041
  t === q.ROTATE && !this.noRotate ? this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY)) : t === q.ZOOM && !this.noZoom ? this._zoomEnd.copy(this._getMouseOnScreen(e.pageX, e.pageY)) : t === q.PAN && !this.noPan && this._panEnd.copy(this._getMouseOnScreen(e.pageX, e.pageY));
1042
1042
  }
1043
- function rn() {
1044
- this.state = q.NONE, this.dispatchEvent(Rt);
1043
+ function an() {
1044
+ this.state = q.NONE, this.dispatchEvent(Bt);
1045
1045
  }
1046
- function an(e) {
1046
+ function on(e) {
1047
1047
  if (this.enabled !== !1 && this.noZoom !== !0) {
1048
1048
  switch (e.preventDefault(), e.deltaMode) {
1049
1049
  case 2:
@@ -1054,13 +1054,13 @@ function an(e) {
1054
1054
  break;
1055
1055
  default: this._zoomStart.y -= e.deltaY * 25e-5;
1056
1056
  }
1057
- this.dispatchEvent(Lt), this.dispatchEvent(Rt);
1057
+ this.dispatchEvent(zt), this.dispatchEvent(Bt);
1058
1058
  }
1059
1059
  }
1060
- function on(e) {
1060
+ function sn(e) {
1061
1061
  this.enabled !== !1 && e.preventDefault();
1062
1062
  }
1063
- function sn(e) {
1063
+ function cn(e) {
1064
1064
  switch (this._trackPointer(e), this._pointers.length) {
1065
1065
  case 1:
1066
1066
  this.state = q.TOUCH_ROTATE, this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX, this._pointers[0].pageY)), this._movePrev.copy(this._moveCurr);
@@ -1072,9 +1072,9 @@ function sn(e) {
1072
1072
  let n = (this._pointers[0].pageX + this._pointers[1].pageX) / 2, r = (this._pointers[0].pageY + this._pointers[1].pageY) / 2;
1073
1073
  this._panStart.copy(this._getMouseOnScreen(n, r)), this._panEnd.copy(this._panStart);
1074
1074
  }
1075
- this.dispatchEvent(Lt);
1075
+ this.dispatchEvent(zt);
1076
1076
  }
1077
- function cn(e) {
1077
+ function ln(e) {
1078
1078
  switch (this._trackPointer(e), this._pointers.length) {
1079
1079
  case 1:
1080
1080
  this._moveCurr.copy(this._getMouseOnCircle(e.pageX, e.pageY));
@@ -1086,7 +1086,7 @@ function cn(e) {
1086
1086
  this._panEnd.copy(this._getMouseOnScreen(i, a));
1087
1087
  }
1088
1088
  }
1089
- function ln(e) {
1089
+ function un(e) {
1090
1090
  switch (this._pointers.length) {
1091
1091
  case 0:
1092
1092
  this.state = q.NONE;
@@ -1102,43 +1102,43 @@ function ln(e) {
1102
1102
  break;
1103
1103
  }
1104
1104
  }
1105
- this.dispatchEvent(Rt);
1105
+ this.dispatchEvent(Bt);
1106
1106
  }
1107
1107
  //#endregion
1108
1108
  //#region src/render/camera.ts
1109
- var un = 1 / 3, dn = 1 / 6, fn = 2, pn = 1e-12, mn = new M(0, 0, -1), hn = new M(0, 1, 0);
1110
- function gn(e, t) {
1109
+ var dn = 1 / 3, fn = 1 / 6, pn = 2, mn = 1e-12, hn = new A(0, 0, -1), gn = new A(0, 1, 0);
1110
+ function _n(e, t) {
1111
1111
  let n = e.clone().sub(t.clone().multiplyScalar(e.dot(t)));
1112
- return n.lengthSq() < pn ? null : n.normalize();
1112
+ return n.lengthSq() < mn ? null : n.normalize();
1113
1113
  }
1114
- function _n(e) {
1114
+ function vn(e) {
1115
1115
  for (let t of [
1116
- new M(0, 0, 1),
1117
- new M(0, 1, 0),
1118
- new M(1, 0, 0)
1116
+ new A(0, 0, 1),
1117
+ new A(0, 1, 0),
1118
+ new A(1, 0, 0)
1119
1119
  ]) {
1120
- let n = gn(t, e);
1120
+ let n = _n(t, e);
1121
1121
  if (n) return n;
1122
1122
  }
1123
- return new M(0, 1, 0);
1123
+ return new A(0, 1, 0);
1124
1124
  }
1125
- function vn(e) {
1126
- let t = new M(...e[0]), n = new M(...e[1]), r = new M(...e[2]).normalize(), i = gn(t, r) ?? gn(n, r) ?? _n(r), a = r.clone().cross(i).normalize(), o = i.clone().add(a.multiplyScalar(un)).add(r.clone().multiplyScalar(dn)).normalize();
1125
+ function yn(e) {
1126
+ let t = new A(...e[0]), n = new A(...e[1]), r = new A(...e[2]).normalize(), i = _n(t, r) ?? _n(n, r) ?? vn(r), a = r.clone().cross(i).normalize(), o = i.clone().add(a.multiplyScalar(dn)).add(r.clone().multiplyScalar(fn)).normalize();
1127
1127
  return {
1128
1128
  outward: o,
1129
- up: gn(r, o) ?? _n(o)
1129
+ up: _n(r, o) ?? vn(o)
1130
1130
  };
1131
1131
  }
1132
- function yn(e) {
1133
- return Math.max(4, e * 4);
1134
- }
1135
1132
  function bn(e) {
1136
- let { outward: t, up: n } = vn(e), r = n.clone().cross(t).normalize(), i = t.clone().cross(r).normalize(), a = new C().makeBasis(r, i, t);
1137
- return new A().setFromRotationMatrix(a).normalize();
1133
+ return Math.max(4, e * 4);
1138
1134
  }
1139
1135
  function xn(e) {
1136
+ let { outward: t, up: n } = yn(e), r = n.clone().cross(t).normalize(), i = t.clone().cross(r).normalize(), a = new re().makeBasis(r, i, t);
1137
+ return new O().setFromRotationMatrix(a).normalize();
1138
+ }
1139
+ function Sn(e) {
1140
1140
  return {
1141
- quaternion: Cn(bn(e)),
1141
+ quaternion: wn(xn(e)),
1142
1142
  target: [
1143
1143
  0,
1144
1144
  0,
@@ -1147,11 +1147,11 @@ function xn(e) {
1147
1147
  scale: 1
1148
1148
  };
1149
1149
  }
1150
- function Sn(e, t, n, r) {
1151
- let i = new A(...t.quaternion).normalize(), a = new M(...t.target), o = mn.clone().applyQuaternion(i);
1152
- e.position.copy(a).sub(o.multiplyScalar(n)), e.up.copy(hn.clone().applyQuaternion(i)), e.quaternion.copy(i), e.near = .01, e.far = Math.max(1e3, n + r * 8), e.updateProjectionMatrix();
1150
+ function Cn(e, t, n, r) {
1151
+ let i = new O(...t.quaternion).normalize(), a = new A(...t.target), o = hn.clone().applyQuaternion(i);
1152
+ e.position.copy(a).sub(o.multiplyScalar(n)), e.up.copy(gn.clone().applyQuaternion(i)), e.quaternion.copy(i), e.near = .01, e.far = Math.max(1e3, n + r * 8), e.updateProjectionMatrix();
1153
1153
  }
1154
- function Cn(e) {
1154
+ function wn(e) {
1155
1155
  return [
1156
1156
  e.x,
1157
1157
  e.y,
@@ -1159,10 +1159,10 @@ function Cn(e) {
1159
1159
  e.w
1160
1160
  ];
1161
1161
  }
1162
- function wn(e, t) {
1163
- let n = new M(1, 0, 0).applyQuaternion(t), r = new M(0, 1, 0).applyQuaternion(t), i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
1162
+ function Tn(e, t) {
1163
+ let n = new A(1, 0, 0).applyQuaternion(t), r = new A(0, 1, 0).applyQuaternion(t), i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
1164
1164
  for (let t of [e.min.x, e.max.x]) for (let c of [e.min.y, e.max.y]) for (let l of [e.min.z, e.max.z]) {
1165
- let e = new M(t, c, l), u = e.dot(n), d = e.dot(r);
1165
+ let e = new A(t, c, l), u = e.dot(n), d = e.dot(r);
1166
1166
  i = Math.min(i, u), a = Math.max(a, u), o = Math.min(o, d), s = Math.max(s, d);
1167
1167
  }
1168
1168
  return {
@@ -1170,31 +1170,31 @@ function wn(e, t) {
1170
1170
  height: Math.max(1, s - o)
1171
1171
  };
1172
1172
  }
1173
- function Tn(e, t, n, r) {
1174
- let i = wn(e, t), a = Math.sqrt(Math.max(1, n) * Math.max(1, r)), o = Math.sqrt(i.width * i.height);
1175
- return Math.max(.01, a / (o * fn));
1173
+ function En(e, t, n, r) {
1174
+ let i = Tn(e, t), a = Math.sqrt(Math.max(1, n) * Math.max(1, r)), o = Math.sqrt(i.width * i.height);
1175
+ return Math.max(.01, a / (o * pn));
1176
1176
  }
1177
- function En(e, t, n) {
1177
+ function Dn(e, t, n) {
1178
1178
  e.left = -t / 2, e.right = t / 2, e.top = n / 2, e.bottom = -n / 2, e.updateProjectionMatrix();
1179
1179
  }
1180
1180
  //#endregion
1181
1181
  //#region src/render/materials.ts
1182
- var Dn = .1, On = .6, kn = .8, An = 2.2, jn = [
1182
+ var On = .1, kn = .6, An = .8, jn = 2.2, Mn = [
1183
1183
  .3,
1184
1184
  .2,
1185
1185
  0
1186
- ], Mn = "#fafafa", Nn = "#444444", Pn = "#f2f2f2", Fn = .3, In = "6.28318530718";
1187
- function Ln(e, t) {
1186
+ ], Nn = "#fafafa", Pn = "#444444", Fn = "#f2f2f2", In = .3, Ln = "6.28318530718";
1187
+ function Rn(e, t) {
1188
1188
  return t.reduce((e, [t, n]) => {
1189
1189
  if (!e.includes(t)) throw Error(`bravais cannot draw with this three.js: its shader has no ${t}.`);
1190
1190
  return e.replace(t, n);
1191
1191
  }, e);
1192
1192
  }
1193
- function Rn(e) {
1194
- return Ln(e, [["#include <common>", "#include <common>\nflat varying int vSectorSite;\nflat varying vec3 vSphereCenter;\nflat varying float vSphereRadius;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vSpherePoint;"], ["#include <project_vertex>", "mat4 sphereMatrix = modelViewMatrix * instanceMatrix;\nvSphereCenter = sphereMatrix[3].xyz;\nvSphereRadius = length(sphereMatrix[0].xyz);\nvSpherePoint = vSphereCenter + vec3(position.xy * vSphereRadius, 0.0);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvSectorSite = gl_InstanceID;\nvec4 mvPosition = vec4(vSpherePoint, 1.0);\ngl_Position = projectionMatrix * mvPosition;"]]);
1195
- }
1196
1193
  function zn(e) {
1197
- return Ln(e, [
1194
+ return Rn(e, [["#include <common>", "#include <common>\nflat varying int vSectorSite;\nflat varying vec3 vSphereCenter;\nflat varying float vSphereRadius;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vSpherePoint;"], ["#include <project_vertex>", "mat4 sphereMatrix = modelViewMatrix * instanceMatrix;\nvSphereCenter = sphereMatrix[3].xyz;\nvSphereRadius = length(sphereMatrix[0].xyz);\nvSpherePoint = vSphereCenter + vec3(position.xy * vSphereRadius, 0.0);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvSectorSite = gl_InstanceID;\nvec4 mvPosition = vec4(vSpherePoint, 1.0);\ngl_Position = projectionMatrix * mvPosition;"]]);
1195
+ }
1196
+ function Bn(e) {
1197
+ return Rn(e, [
1198
1198
  ["#include <common>", "#include <common>\nuniform sampler2D sectorTexture;\nuniform float vacancyOpacity;\nflat varying int vSectorSite;\nflat varying vec3 vSphereCenter;\nflat varying float vSphereRadius;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vSpherePoint;"],
1199
1199
  ["#include <clipping_planes_fragment>", "// Where the view ray meets the sphere. The outline is smoothed over one\n// pixel through the alpha: sample coverage, or blending in a see-through layer.\nvec2 sphereOffset = vSpherePoint.xy - vSphereCenter.xy;\nfloat sphereDistance = length(sphereOffset);\nfloat sphereCoverage = clamp(\n (vSphereRadius - sphereDistance) / max(fwidth(sphereDistance), 1e-6) + 0.5,\n 0.0,\n 1.0\n);\nif (sphereCoverage <= 0.0) {\n discard;\n}\nfloat sphereHeight = sqrt(\n max(0.0, vSphereRadius * vSphereRadius - dot(sphereOffset, sphereOffset))\n);\nvec3 sphereNormal = vec3(sphereOffset, sphereHeight) / vSphereRadius;\nfloat sphereZ = vSphereCenter.z + sphereHeight;\ngl_FragDepth = (vDepthCoefficients.x * sphereZ + vDepthCoefficients.y) * 0.5 + 0.5;\n#include <clipping_planes_fragment>"],
1200
1200
  ["#include <color_fragment>", `#include <color_fragment>
@@ -1202,7 +1202,7 @@ function zn(e) {
1202
1202
  // A pie chart facing the viewer, like VESTA's occupancy pies: the instance
1203
1203
  // colour fills the first sector from 12 o'clock clockwise, then each
1204
1204
  // texel's colour from its stop on.
1205
- float sectorAngle = fract(atan(sphereOffset.x, sphereOffset.y) / ${In});
1205
+ float sectorAngle = fract(atan(sphereOffset.x, sphereOffset.y) / ${Ln});
1206
1206
  vec3 sectorColor = vColor.rgb;
1207
1207
  float sectorOpacity = 1.0;
1208
1208
  int sectorRow = vSectorSite / 256;
@@ -1222,53 +1222,53 @@ function zn(e) {
1222
1222
  ["#include <normal_fragment_begin>", "#include <normal_fragment_begin>\nnormal = sphereNormal;\nnonPerturbedNormal = normal;"]
1223
1223
  ]);
1224
1224
  }
1225
- function Bn(e, t, n) {
1226
- let r = e < 1 || n, i = new T({
1225
+ function Vn(e, t, n) {
1226
+ let r = e < 1 || n, i = new w({
1227
1227
  color: "#ffffff",
1228
- metalness: Dn,
1229
- roughness: On,
1228
+ metalness: On,
1229
+ roughness: kn,
1230
1230
  opacity: e,
1231
1231
  transparent: r,
1232
1232
  alphaToCoverage: !r
1233
1233
  });
1234
1234
  return i.onBeforeCompile = (e) => {
1235
- e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value: Fn }, e.vertexShader = Rn(e.vertexShader), e.fragmentShader = zn(e.fragmentShader);
1235
+ e.uniforms.sectorTexture = { value: t }, e.uniforms.vacancyOpacity = { value: In }, e.vertexShader = zn(e.vertexShader), e.fragmentShader = Bn(e.fragmentShader);
1236
1236
  }, i.customProgramCacheKey = () => "bravais-atom-spheres", i;
1237
1237
  }
1238
- function Vn(e) {
1239
- return Ln(e, [["#include <common>", "#include <common>\nuniform float capRadius;\nflat varying vec3 vTubeCenter;\nflat varying vec3 vTubeAxis;\nflat varying vec3 vAtomCenter;\nflat varying float vTubeRadius;\nflat varying float vTubeHalfLength;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vBoxPoint;"], ["#include <project_vertex>", "mat4 tubeMatrix = modelViewMatrix * instanceMatrix;\nfloat tubeLength = max(length(tubeMatrix[1].xyz), 1e-6);\nvTubeRadius = length(tubeMatrix[0].xyz);\nvTubeHalfLength = tubeLength * 0.5;\nvTubeCenter = tubeMatrix[3].xyz;\nvTubeAxis = tubeMatrix[1].xyz / tubeLength;\nfloat rim = sqrt(max(0.0, capRadius * capRadius - vTubeRadius * vTubeRadius));\nvAtomCenter = vTubeCenter - vTubeAxis * (rim + vTubeHalfLength);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvec4 mvPosition = tubeMatrix * vec4(position, 1.0);\nvBoxPoint = mvPosition.xyz;\ngl_Position = projectionMatrix * mvPosition;"]]);
1240
- }
1241
1238
  function Hn(e) {
1242
- return Ln(e, [
1239
+ return Rn(e, [["#include <common>", "#include <common>\nuniform float capRadius;\nflat varying vec3 vTubeCenter;\nflat varying vec3 vTubeAxis;\nflat varying vec3 vAtomCenter;\nflat varying float vTubeRadius;\nflat varying float vTubeHalfLength;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vBoxPoint;"], ["#include <project_vertex>", "mat4 tubeMatrix = modelViewMatrix * instanceMatrix;\nfloat tubeLength = max(length(tubeMatrix[1].xyz), 1e-6);\nvTubeRadius = length(tubeMatrix[0].xyz);\nvTubeHalfLength = tubeLength * 0.5;\nvTubeCenter = tubeMatrix[3].xyz;\nvTubeAxis = tubeMatrix[1].xyz / tubeLength;\nfloat rim = sqrt(max(0.0, capRadius * capRadius - vTubeRadius * vTubeRadius));\nvAtomCenter = vTubeCenter - vTubeAxis * (rim + vTubeHalfLength);\nvDepthCoefficients = vec2(projectionMatrix[2][2], projectionMatrix[3][2]);\nvec4 mvPosition = tubeMatrix * vec4(position, 1.0);\nvBoxPoint = mvPosition.xyz;\ngl_Position = projectionMatrix * mvPosition;"]]);
1240
+ }
1241
+ function Un(e) {
1242
+ return Rn(e, [
1243
1243
  ["#include <common>", "#include <common>\nuniform float capRadius;\nflat varying vec3 vTubeCenter;\nflat varying vec3 vTubeAxis;\nflat varying vec3 vAtomCenter;\nflat varying float vTubeRadius;\nflat varying float vTubeHalfLength;\nflat varying vec2 vDepthCoefficients;\nvarying vec3 vBoxPoint;"],
1244
1244
  ["#include <clipping_planes_fragment>", "// The view ray through this pixel runs down view z. The tube's surface is\n// the nearest of: the wall outside the atom's sphere, the sphere's far side\n// inside the tube (the cut face) and the midpoint disc. Along the ray,\n// q(z) = p(z) - centre has q.a = k + (z - cz) a.z and |q|^2 = u + (z - cz)^2.\nvec2 tubePixel = vBoxPoint.xy;\nvec2 tubeOffset = tubePixel - vTubeCenter.xy;\nfloat tubeK = dot(tubeOffset, vTubeAxis.xy);\nfloat tubeU = dot(tubeOffset, tubeOffset);\nfloat axisZ = vTubeAxis.z;\nfloat quadA = 1.0 - axisZ * axisZ;\nfloat quadB = -2.0 * tubeK * axisZ;\nfloat quadC = tubeU - tubeK * tubeK - vTubeRadius * vTubeRadius;\nfloat tubeRadius2 = vTubeRadius * vTubeRadius;\n// The ray's closest approach to the axis, for the outline's coverage.\nfloat axisDistance2 = tubeU - tubeK * tubeK;\nif (quadA > 1e-6) {\n axisDistance2 -= quadB * quadB / (4.0 * quadA);\n}\nfloat axisDistance = sqrt(max(0.0, axisDistance2));\nfloat tubeCoverage = clamp(\n (vTubeRadius - axisDistance) / max(fwidth(axisDistance), 1e-6) + 0.5,\n 0.0,\n 1.0\n);\nif (tubeCoverage <= 0.0) {\n discard;\n}\nfloat tubeHitZ = -1e30;\nvec3 tubeNormal = vec3(0.0, 0.0, 1.0);\nif (quadA > 1e-6) {\n float discriminant = quadB * quadB - 4.0 * quadA * quadC;\n if (discriminant >= 0.0) {\n float z = vTubeCenter.z + (-quadB + sqrt(discriminant)) / (2.0 * quadA);\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n float s = dot(d, vTubeAxis);\n if (abs(s) <= vTubeHalfLength && distance(vec3(tubePixel, z), vAtomCenter) >= capRadius) {\n tubeHitZ = z;\n tubeNormal = (d - s * vTubeAxis) / vTubeRadius;\n }\n }\n}\nif (axisZ > 1e-6) {\n float z = vTubeCenter.z + (vTubeHalfLength - tubeK) / axisZ;\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n if (dot(d, d) - vTubeHalfLength * vTubeHalfLength <= tubeRadius2 && z > tubeHitZ &&\n distance(vec3(tubePixel, z), vAtomCenter) >= capRadius) {\n tubeHitZ = z;\n tubeNormal = vTubeAxis;\n }\n}\n{\n vec2 m = tubePixel - vAtomCenter.xy;\n float inside = capRadius * capRadius - dot(m, m);\n if (inside >= 0.0) {\n float z = vAtomCenter.z - sqrt(inside);\n vec3 d = vec3(tubePixel, z) - vTubeCenter;\n float s = dot(d, vTubeAxis);\n if (abs(s) <= vTubeHalfLength && dot(d, d) - s * s <= tubeRadius2 && z > tubeHitZ) {\n tubeHitZ = z;\n tubeNormal = (vAtomCenter - vec3(tubePixel, z)) / capRadius;\n }\n }\n}\nif (tubeHitZ < -1e29) {\n discard;\n}\ngl_FragDepth = (vDepthCoefficients.x * tubeHitZ + vDepthCoefficients.y) * 0.5 + 0.5;\n#include <clipping_planes_fragment>"],
1245
1245
  ["#include <color_fragment>", "#include <color_fragment>\ndiffuseColor.a *= tubeCoverage;"],
1246
1246
  ["#include <normal_fragment_begin>", "#include <normal_fragment_begin>\nnormal = tubeNormal;\nnonPerturbedNormal = normal;"]
1247
1247
  ]);
1248
1248
  }
1249
- function Un(e, t) {
1250
- let n = e < 1, r = new T({
1249
+ function Wn(e, t) {
1250
+ let n = e < 1, r = new w({
1251
1251
  color: "#ffffff",
1252
- metalness: Dn,
1253
- roughness: On,
1252
+ metalness: On,
1253
+ roughness: kn,
1254
1254
  opacity: e,
1255
1255
  transparent: n,
1256
1256
  alphaToCoverage: !n
1257
1257
  });
1258
1258
  return r.onBeforeCompile = (e) => {
1259
- e.uniforms.capRadius = { value: t }, e.vertexShader = Vn(e.vertexShader), e.fragmentShader = Hn(e.fragmentShader);
1259
+ e.uniforms.capRadius = { value: t }, e.vertexShader = Hn(e.vertexShader), e.fragmentShader = Un(e.fragmentShader);
1260
1260
  }, r.customProgramCacheKey = () => "bravais-bond-tubes", r;
1261
1261
  }
1262
- function Wn(e) {
1262
+ function Gn(e) {
1263
1263
  return new y({
1264
- color: Nn,
1264
+ color: Pn,
1265
1265
  opacity: e,
1266
1266
  transparent: !0,
1267
1267
  fog: !1
1268
1268
  });
1269
1269
  }
1270
- function Gn(e, n) {
1271
- return new T({
1270
+ function Kn(e, n) {
1271
+ return new w({
1272
1272
  color: e,
1273
1273
  metalness: 0,
1274
1274
  roughness: .8,
@@ -1276,35 +1276,32 @@ function Gn(e, n) {
1276
1276
  stencilWrite: !0,
1277
1277
  stencilRef: n,
1278
1278
  stencilFunc: t,
1279
- stencilZPass: ae
1279
+ stencilZPass: se
1280
1280
  });
1281
1281
  }
1282
1282
  //#endregion
1283
1283
  //#region src/render/gizmo.ts
1284
- var Kn = {
1284
+ var qn = {
1285
1285
  a: "#d27686",
1286
1286
  b: "#80c393",
1287
1287
  c: "#75a4dd"
1288
- }, qn = .82, Jn = .055, Yn = .24, Xn = .13, Zn = .13, Qn = 1.3, $n = .5, er = 128, tr = "#2a2a2a", nr = "#ffffff", rr = 3.2, ir = new M(0, 1, 0);
1289
- function ar(e, t) {
1288
+ }, Jn = .82, Yn = .055, Xn = .24, Zn = .13, Qn = .13, $n = 1.3, er = .5, tr = 128, nr = "#2a2a2a", rr = "#ffffff", ir = 3.2, ar = new A(0, 1, 0);
1289
+ function or(e, t) {
1290
1290
  let n = document.createElement("canvas");
1291
- n.width = er, n.height = er;
1291
+ n.width = tr, n.height = tr;
1292
1292
  let r = n.getContext("2d");
1293
- if (r) {
1294
- let i = er * .68;
1295
- r.clearRect(0, 0, n.width, n.height), r.font = `italic 600 ${i}px ${t}`, r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#ffffff", r.fillText(e, n.width / 2, n.height / 2);
1296
- }
1293
+ r && (r.font = `italic 600 ${tr * .68}px ${t}`, r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#ffffff", r.fillText(e, n.width / 2, n.height / 2));
1297
1294
  let i = new o(n);
1298
- return i.colorSpace = oe, i.premultiplyAlpha = !0, i.magFilter = x, i.minFilter = te, i;
1295
+ return i.colorSpace = ce, i.premultiplyAlpha = !0, i.magFilter = x, i.minFilter = te, i;
1299
1296
  }
1300
- function or(e, t, n) {
1301
- let r = new _(), i = Gn(e, 1), a = new w(new u(Jn, Jn, qn, 24), i);
1302
- a.position.y = qn / 2;
1303
- let o = new w(new c(Xn, Yn, 32), i);
1297
+ function sr(e, t, n) {
1298
+ let r = new _(), i = Kn(e, 1), a = new C(new u(Yn, Yn, Jn, 24), i);
1299
+ a.position.y = Jn / 2;
1300
+ let o = new C(new c(Zn, Xn, 32), i);
1304
1301
  o.position.y = .94, r.add(a, o);
1305
- let s = ar(t, n), l = [[tr, D], [nr, m]];
1302
+ let s = or(t, n), l = [[nr, ie], [rr, m]];
1306
1303
  for (let [e, t] of l) {
1307
- let n = new le(new ue({
1304
+ let n = new de(new fe({
1308
1305
  map: s,
1309
1306
  color: e,
1310
1307
  depthTest: !1,
@@ -1314,49 +1311,46 @@ function or(e, t, n) {
1314
1311
  stencilRef: 1,
1315
1312
  stencilFunc: t
1316
1313
  }));
1317
- n.scale.set($n, $n, 1), n.position.y = Qn, n.renderOrder = 10, r.add(n);
1314
+ n.scale.set(er, er, 1), n.position.y = $n, n.renderOrder = 10, r.add(n);
1318
1315
  }
1319
1316
  return r;
1320
1317
  }
1321
- var sr = class {
1322
- scene = new se();
1323
- camera = new k(-1, 1, 1, -1, .1, 20);
1318
+ var cr = class {
1319
+ scene = new le();
1320
+ camera = new D(-3.2 / 2, ir / 2, ir / 2, -3.2 / 2, .1, 20);
1324
1321
  axes = new _();
1325
1322
  arrows;
1326
1323
  headlight = new f("#ffffff", 1.78);
1327
- inverse = new A();
1328
- direction = new M();
1324
+ direction = new A();
1329
1325
  constructor(e) {
1330
1326
  this.camera.position.set(0, 0, 5), this.camera.lookAt(0, 0, 0), this.scene.add(new n("#ffffff", .68)), this.headlight.position.set(1.6, 1.1, 5), this.scene.add(this.headlight), this.arrows = [
1331
1327
  "a",
1332
1328
  "b",
1333
1329
  "c"
1334
- ].map((t) => or(Kn[t], t, e));
1335
- let t = new w(new ce(Zn, 32, 16), Gn("#f3f2ee", 0));
1330
+ ].map((t) => sr(qn[t], t, e));
1331
+ let t = new C(new ue(Qn, 32, 16), Kn("#f3f2ee", 0));
1336
1332
  this.axes.add(...this.arrows, t), this.scene.add(this.axes);
1337
1333
  }
1338
1334
  setCell(e) {
1339
1335
  this.arrows.forEach((t, n) => {
1340
- t.quaternion.setFromUnitVectors(ir, this.direction.set(...e[n]).normalize());
1336
+ t.quaternion.setFromUnitVectors(ar, this.direction.set(...e[n]).normalize());
1341
1337
  });
1342
1338
  }
1343
1339
  render(e, t, n) {
1344
- this.axes.quaternion.copy(this.inverse.copy(t).invert());
1345
- let r = rr / 2;
1346
- this.camera.left = -1.6, this.camera.right = r, this.camera.top = r, this.camera.bottom = -1.6, this.camera.updateProjectionMatrix();
1347
- let i = e.autoClear;
1348
- e.autoClear = !1, e.setViewport(0, 0, n, n), e.setScissor(0, 0, n, n), e.setScissorTest(!0), e.clear(!1, !0, !0), e.render(this.scene, this.camera), e.setScissorTest(!1), e.autoClear = i;
1340
+ this.axes.quaternion.copy(t).invert();
1341
+ let r = e.autoClear;
1342
+ e.autoClear = !1, e.setViewport(0, 0, n, n), e.setScissor(0, 0, n, n), e.setScissorTest(!0), e.clear(!1, !0, !0), e.render(this.scene, this.camera), e.setScissorTest(!1), e.autoClear = r;
1349
1343
  }
1350
1344
  dispose() {
1351
1345
  this.axes.traverse((e) => {
1352
- if (e instanceof w || e instanceof le) {
1346
+ if (e instanceof C || e instanceof de) {
1353
1347
  e.geometry.dispose();
1354
1348
  let t = e.material;
1355
1349
  "map" in t && t.map && t.map.dispose(), t.dispose();
1356
1350
  }
1357
1351
  }), this.axes.clear();
1358
1352
  }
1359
- }, cr = {
1353
+ }, lr = {
1360
1354
  source: "VESTA's element colours, softened.",
1361
1355
  elements: {
1362
1356
  H: "#f2c0c0",
@@ -1460,21 +1454,21 @@ var sr = class {
1460
1454
  };
1461
1455
  //#endregion
1462
1456
  //#region src/render/oklab.ts
1463
- function lr(e) {
1457
+ function ur(e) {
1464
1458
  return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
1465
1459
  }
1466
- function ur(e) {
1460
+ function dr(e) {
1467
1461
  return e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055;
1468
1462
  }
1469
- function dr(e) {
1470
- let t = Number.parseInt(e.slice(1), 16), n = lr((t >> 16 & 255) / 255), r = lr((t >> 8 & 255) / 255), i = lr((t & 255) / 255), a = Math.cbrt(.4122214708 * n + .5363325363 * r + .0514459929 * i), o = Math.cbrt(.2119034982 * n + .6806995451 * r + .1073969566 * i), s = Math.cbrt(.0883024619 * n + .2817188376 * r + .6299787005 * i);
1463
+ function fr(e) {
1464
+ let t = Number.parseInt(e.slice(1), 16), n = ur((t >> 16 & 255) / 255), r = ur((t >> 8 & 255) / 255), i = ur((t & 255) / 255), a = Math.cbrt(.4122214708 * n + .5363325363 * r + .0514459929 * i), o = Math.cbrt(.2119034982 * n + .6806995451 * r + .1073969566 * i), s = Math.cbrt(.0883024619 * n + .2817188376 * r + .6299787005 * i);
1471
1465
  return {
1472
1466
  L: .2104542553 * a + .793617785 * o - .0040720468 * s,
1473
1467
  a: 1.9779984951 * a - 2.428592205 * o + .4505937099 * s,
1474
1468
  b: .0259040371 * a + .7827717662 * o - .808675766 * s
1475
1469
  };
1476
1470
  }
1477
- function fr(e) {
1471
+ function pr(e) {
1478
1472
  let t = (e.L + .3963377774 * e.a + .2158037573 * e.b) ** 3, n = (e.L - .1055613458 * e.a - .0638541728 * e.b) ** 3, r = (e.L - .0894841775 * e.a - 1.291485548 * e.b) ** 3;
1479
1473
  return [
1480
1474
  4.0767416621 * t - 3.3077115913 * n + .2309699292 * r,
@@ -1482,16 +1476,16 @@ function fr(e) {
1482
1476
  -.0041960863 * t - .7034186147 * n + 1.707614701 * r
1483
1477
  ];
1484
1478
  }
1485
- function pr(e) {
1486
- return fr(e).every((e) => e >= -1e-4 && e <= 1.0001);
1487
- }
1488
1479
  function mr(e) {
1489
- return `#${fr(e).map((e) => {
1490
- let t = ur(Math.min(1, Math.max(0, e)));
1480
+ return pr(e).every((e) => e >= -1e-4 && e <= 1.0001);
1481
+ }
1482
+ function hr(e) {
1483
+ return `#${pr(e).map((e) => {
1484
+ let t = dr(Math.min(1, Math.max(0, e)));
1491
1485
  return Math.round(t * 255).toString(16).padStart(2, "0");
1492
1486
  }).join("")}`;
1493
1487
  }
1494
- function hr(e) {
1488
+ function gr(e) {
1495
1489
  let t = Math.hypot(e.a, e.b), n = (Math.atan2(e.b, e.a) * 180 / Math.PI + 360) % 360;
1496
1490
  return {
1497
1491
  L: e.L,
@@ -1499,7 +1493,7 @@ function hr(e) {
1499
1493
  h: n
1500
1494
  };
1501
1495
  }
1502
- function gr(e) {
1496
+ function X(e) {
1503
1497
  let t = e.h * Math.PI / 180;
1504
1498
  return {
1505
1499
  L: e.L,
@@ -1508,11 +1502,11 @@ function gr(e) {
1508
1502
  };
1509
1503
  }
1510
1504
  function _r(e) {
1511
- if (pr(gr(e))) return e;
1505
+ if (mr(X(e))) return e;
1512
1506
  let t = 0, n = e.C;
1513
1507
  for (let r = 0; r < 24; r += 1) {
1514
1508
  let r = (t + n) / 2;
1515
- pr(gr({
1509
+ mr(X({
1516
1510
  ...e,
1517
1511
  C: r
1518
1512
  })) ? t = r : n = r;
@@ -1524,11 +1518,11 @@ function _r(e) {
1524
1518
  }
1525
1519
  //#endregion
1526
1520
  //#region src/render/palette.ts
1527
- var vr = cr.elements, yr = {
1521
+ var vr = lr.elements, yr = {
1528
1522
  Cr: "#6d87c9",
1529
1523
  V: "#bf4b62",
1530
1524
  F: "#9bd7d0"
1531
- }, br = /* @__PURE__ */ "O.Li.Na.K.Mg.Ca.Sr.Ba.Al.Si.Ti.Mn.Fe.Co.Ni.Cu.Zn.V.Cr.Ga.Ge.Y.Zr.Nb.Mo.Ru.Ag.Cd.In.Sn.Sb.La.Ce.Nd.Sm.Gd.Ta.W.Pt.Au.Pb.Bi.H.C.N.F.P.S.Cl.Se.Te.I.Br.B.Sc.Rb.Cs.Hf.Re.Ir.Pd.Rh.Os.Pr.Eu.Tb.Dy.Ho.Er.Tm.Yb.Lu.Th.U".split("."), xr = new Map(br.map((e, t) => [e, t])), Sr = .1, Cr = .7, X = {
1525
+ }, br = /* @__PURE__ */ "O.Li.Na.K.Mg.Ca.Sr.Ba.Al.Si.Ti.Mn.Fe.Co.Ni.Cu.Zn.V.Cr.Ga.Ge.Y.Zr.Nb.Mo.Ru.Ag.Cd.In.Sn.Sb.La.Ce.Nd.Sm.Gd.Ta.W.Pt.Au.Pb.Bi.H.C.N.F.P.S.Cl.Se.Te.I.Br.B.Sc.Rb.Cs.Hf.Re.Ir.Pd.Rh.Os.Pr.Eu.Tb.Dy.Ho.Er.Tm.Yb.Lu.Th.U".split("."), xr = new Map(br.map((e, t) => [e, t])), Sr = .1, Cr = .7, Z = {
1532
1526
  minL: .45,
1533
1527
  maxL: .88,
1534
1528
  maxC: .2
@@ -1596,8 +1590,8 @@ function Rr(e) {
1596
1590
  }
1597
1591
  function zr(e) {
1598
1592
  let t = Rr(e);
1599
- if (t) return hr(dr(t));
1600
- let n = _e.indexOf(e) + 1;
1593
+ if (t) return gr(fr(t));
1594
+ let n = ye.indexOf(e) + 1;
1601
1595
  return {
1602
1596
  L: .68,
1603
1597
  C: .12,
@@ -1607,13 +1601,13 @@ function zr(e) {
1607
1601
  function Br(e) {
1608
1602
  let t = xr.get(e);
1609
1603
  if (t !== void 0) return t;
1610
- let n = _e.indexOf(e);
1611
- return br.length + (n >= 0 ? n : _e.length);
1604
+ let n = ye.indexOf(e);
1605
+ return br.length + (n >= 0 ? n : ye.length);
1612
1606
  }
1613
1607
  function Vr(e) {
1614
1608
  return _r({
1615
- L: Math.min(X.maxL, Math.max(X.minL, e.L)),
1616
- C: Math.min(X.maxC, Math.max(0, e.C)),
1609
+ L: Math.min(Z.maxL, Math.max(Z.minL, e.L)),
1610
+ C: Math.min(Z.maxC, Math.max(0, e.C)),
1617
1611
  h: (e.h % 360 + 360) % 360
1618
1612
  });
1619
1613
  }
@@ -1625,10 +1619,8 @@ function Hr(e, t) {
1625
1619
  }).C;
1626
1620
  }
1627
1621
  function Ur(e, t) {
1628
- let n = Vr(e);
1629
1622
  return {
1630
- lch: n,
1631
- lab: gr(n),
1623
+ lab: X(Vr(e)),
1632
1624
  cost: t
1633
1625
  };
1634
1626
  }
@@ -1651,7 +1643,7 @@ function Wr(e) {
1651
1643
  }
1652
1644
  let n = e.C / Math.max(1e-6, Hr(e.L, e.h));
1653
1645
  for (let r of Dr) for (let i of Or) for (let a of kr) {
1654
- let o = Math.min(X.maxL, Math.max(X.minL, e.L + i)), s = e.h + r, c = Math.min(1, Math.max(.1, n + a)) * Hr(o, s), l = Math.abs(r) / jr + Math.abs(i) / Mr + Math.abs(a) / Nr;
1646
+ let o = Math.min(Z.maxL, Math.max(Z.minL, e.L + i)), s = e.h + r, c = Math.min(1, Math.max(.1, n + a)) * Hr(o, s), l = Math.abs(r) / jr + Math.abs(i) / Mr + Math.abs(a) / Nr;
1655
1647
  t.push(Ur({
1656
1648
  L: o,
1657
1649
  C: c,
@@ -1660,11 +1652,11 @@ function Wr(e) {
1660
1652
  }
1661
1653
  return t.sort((e, t) => e.cost - t.cost);
1662
1654
  }
1663
- var Z = /* @__PURE__ */ new Map();
1655
+ var Q = /* @__PURE__ */ new Map();
1664
1656
  function Gr(e, t) {
1665
- let n = [...Z.values()].map((e) => e.lab), r = (e) => n.reduce((t, n) => Math.min(t, Ir(e, n)), Infinity), i = gr(t);
1657
+ let n = [...Q.values()].map((e) => e.lab), r = (e) => n.reduce((t, n) => Math.min(t, Ir(e, n)), Infinity), i = X(t);
1666
1658
  if (r(i) >= Sr) return {
1667
- hex: e ?? mr(i),
1659
+ hex: e ?? hr(i),
1668
1660
  lab: i
1669
1661
  };
1670
1662
  let a = null, o = -Infinity, s = Infinity, c = null, l = -Infinity;
@@ -1676,27 +1668,26 @@ function Gr(e, t) {
1676
1668
  }
1677
1669
  let u = a ?? c ?? {
1678
1670
  lab: i,
1679
- lch: t,
1680
1671
  cost: 0
1681
1672
  };
1682
1673
  return {
1683
- hex: mr(u.lab),
1674
+ hex: hr(u.lab),
1684
1675
  lab: u.lab
1685
1676
  };
1686
1677
  }
1687
1678
  function Kr(e) {
1688
- let t = [...new Set(e)].filter((e) => !Z.has(e)).sort((e, t) => Br(e) - Br(t));
1689
- for (let e of t) Z.set(e, Gr(Rr(e), zr(e)));
1679
+ let t = [...new Set(e)].filter((e) => !Q.has(e)).sort((e, t) => Br(e) - Br(t));
1680
+ for (let e of t) Q.set(e, Gr(Rr(e), zr(e)));
1690
1681
  }
1691
1682
  function qr(e) {
1692
- let t = Z.get(e);
1693
- return t ? t.hex : (Kr([e]), Z.get(e).hex);
1683
+ let t = Q.get(e);
1684
+ return t ? t.hex : (Kr([e]), Q.get(e).hex);
1694
1685
  }
1695
1686
  function Jr() {
1696
- return [...Z].map(([e, t]) => [e, t.hex]);
1687
+ return [...Q].map(([e, t]) => [e, t.hex]);
1697
1688
  }
1698
1689
  function Yr() {
1699
- Z.clear();
1690
+ Q.clear();
1700
1691
  }
1701
1692
  //#endregion
1702
1693
  //#region src/render/legend.ts
@@ -1726,11 +1717,11 @@ var ei = class {
1726
1717
  }
1727
1718
  this.element.hidden = e.length === 0;
1728
1719
  }
1729
- }, Q = .4, $ = .1, ti = .398, ni = Math.sqrt(ti * ti - $ * $), ri = new M(0, 1, 0);
1730
- function ii(e) {
1731
- let [t, n, r] = e.map((e) => new M(...e));
1720
+ }, $ = .4, ti = .1, ni = .398, ri = Math.sqrt(ni * ni - ti * ti), ii = new A(0, 1, 0);
1721
+ function ai(e) {
1722
+ let [t, n, r] = e.map((e) => new A(...e));
1732
1723
  return [
1733
- new M(),
1724
+ new A(),
1734
1725
  t.clone(),
1735
1726
  n.clone(),
1736
1727
  r.clone(),
@@ -1740,7 +1731,7 @@ function ii(e) {
1740
1731
  t.clone().add(n).add(r)
1741
1732
  ];
1742
1733
  }
1743
- function ai(e) {
1734
+ function oi(e) {
1744
1735
  let [t, n, r] = e;
1745
1736
  return [
1746
1737
  (t[0] + n[0] + r[0]) / 2,
@@ -1748,7 +1739,7 @@ function ai(e) {
1748
1739
  (t[2] + n[2] + r[2]) / 2
1749
1740
  ];
1750
1741
  }
1751
- var oi = [
1742
+ var si = [
1752
1743
  [0, 1],
1753
1744
  [0, 2],
1754
1745
  [0, 3],
@@ -1762,107 +1753,106 @@ var oi = [
1762
1753
  [5, 7],
1763
1754
  [6, 7]
1764
1755
  ];
1765
- function si(e, t) {
1766
- let n = ii(e), r = [];
1767
- for (let [e, t] of oi) {
1756
+ function ci(e, t) {
1757
+ let n = ai(e), r = [];
1758
+ for (let [e, t] of si) {
1768
1759
  let i = n[e], a = n[t];
1769
1760
  r.push(i.x, i.y, i.z, a.x, a.y, a.z);
1770
1761
  }
1771
1762
  let i = new a();
1772
- return i.setAttribute("position", new h(r, 3)), new b(i, Wn(t));
1763
+ return i.setAttribute("position", new h(r, 3)), new b(i, Gn(t));
1773
1764
  }
1774
- function ci(e) {
1775
- let t = 2048, n = Math.max(1, Math.ceil(e.length / 256)), r = new Float32Array(t * n * 4).fill(1), i = new s(Pn), a = new s(), o = !1;
1765
+ function li(e) {
1766
+ let t = 2048, n = Math.max(1, Math.ceil(e.length / 256)), r = new Float32Array(t * n * 4).fill(1), i = new s(Fn), a = new s(), o = !1;
1776
1767
  e.forEach((e, n) => {
1777
1768
  let s = Math.floor(n / 256), c = n % 256 * 8, l = (s * t + c) * 4, u = 0, d = Math.min(1, e.species[0]?.occupancy ?? 1);
1778
1769
  for (let t of e.species.slice(1)) u < 7 && (a.set(qr(t.element)).toArray(r, l), r[l + 3] = d, l += 4, u += 1), d = Math.min(1, d + t.occupancy);
1779
1770
  d < 1 - 1e-6 && (i.toArray(r, l), r[l + 3] = d + 2, o = !0);
1780
1771
  });
1781
- let c = new d(r, t, n, ie, g);
1782
- return c.magFilter = E, c.minFilter = E, c.generateMipmaps = !1, c.needsUpdate = !0, {
1772
+ let c = new d(r, t, n, oe, g);
1773
+ return c.magFilter = T, c.minFilter = T, c.generateMipmaps = !1, c.needsUpdate = !0, {
1783
1774
  texture: c,
1784
1775
  hasVacancies: o
1785
1776
  };
1786
1777
  }
1787
- function li() {
1778
+ function ui() {
1788
1779
  let e = /* @__PURE__ */ new Map();
1789
1780
  return (t) => {
1790
1781
  let n = e.get(t);
1791
1782
  return n || (n = new s(qr(t)), e.set(t, n)), n;
1792
1783
  };
1793
1784
  }
1794
- function ui(e, t, n = li()) {
1795
- let r = new re(2, 2), i = ci(e), a = new v(r, Bn(t, i.texture, i.hasVacancies), e.length), o = new C();
1785
+ function di(e, t, n = ui()) {
1786
+ let r = new ae(2, 2), i = li(e), a = new v(r, Vn(t, i.texture, i.hasVacancies), e.length), o = new re();
1796
1787
  return e.forEach((e, t) => {
1797
- o.makeScale(Q, Q, Q), o.setPosition(e.position[0], e.position[1], e.position[2]), a.setMatrixAt(t, o), a.setColorAt(t, n(e.element));
1788
+ o.makeScale($, $, $), o.setPosition(e.position[0], e.position[1], e.position[2]), a.setMatrixAt(t, o), a.setColorAt(t, n(e.element));
1798
1789
  }), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a.userData.sectorTexture = i.texture, a;
1799
1790
  }
1800
- function di(e, t, n = li()) {
1791
+ function fi(e, t, n = ui()) {
1801
1792
  if (e.bonds.length === 0) return null;
1802
- let r = new i(2, 1, 2), a = new v(r, Un(t, ti), e.bonds.length * 2), o = new O(), s = new M(), c = new M(), l = new M(), u = new A();
1793
+ let r = new i(2, 1, 2), a = new v(r, Wn(t, ni), e.bonds.length * 2), o = new E(), s = new A(), c = new A(), l = new A(), u = new O();
1803
1794
  return e.bonds.forEach((t, r) => {
1804
1795
  let i = e.atoms[t.start], d = e.atoms[t.end];
1805
1796
  s.set(...i.position), c.set(...d.position), l.subVectors(c, s);
1806
1797
  let f = l.length() / 2;
1807
- l.normalize(), u.setFromUnitVectors(ri, l);
1798
+ l.normalize(), u.setFromUnitVectors(ii, l);
1808
1799
  let p = [[
1809
1800
  0,
1810
1801
  i,
1811
- ni,
1802
+ ri,
1812
1803
  f
1813
1804
  ], [
1814
1805
  1,
1815
1806
  d,
1816
1807
  f,
1817
- 2 * f - ni
1808
+ 2 * f - ri
1818
1809
  ]];
1819
1810
  for (let [e, t, i, c] of p) {
1820
1811
  let d = Math.max(0, c - i);
1821
- o.position.copy(s).addScaledVector(l, i + d / 2), o.quaternion.copy(u), o.scale.set($, d, $), o.updateMatrix(), a.setMatrixAt(r * 2 + e, o.matrix), a.setColorAt(r * 2 + e, n(t.element));
1812
+ o.position.copy(s).addScaledVector(l, i + d / 2), o.quaternion.copy(u), o.scale.set(ti, d, ti), o.updateMatrix(), a.setMatrixAt(r * 2 + e, o.matrix), a.setColorAt(r * 2 + e, n(t.element));
1822
1813
  }
1823
1814
  }), a.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.instanceColor.needsUpdate = !0), a;
1824
1815
  }
1825
- function fi(e) {
1816
+ function pi(e) {
1826
1817
  let t = e[0];
1827
1818
  if (!t) throw Error("A scene model needs at least one layer.");
1828
1819
  Kr(e.flatMap((e) => [...e.scene.elements, ...e.scene.atoms.map((e) => e.element)]));
1829
- let n = ai(t.scene.cell), i = new _();
1820
+ let n = oi(t.scene.cell), i = new _();
1830
1821
  i.position.set(-n[0], -n[1], -n[2]);
1831
- let a = new r(), o = [], s = 1, c = [], l = new M(...n), u = new M(), d = new M();
1822
+ let a = new r(), o = [], s = 1, c = [], l = new A(...n), u = new A(), d = new A();
1832
1823
  for (let t of e) {
1833
- for (let e of ii(t.scene.cell)) a.expandByPoint(e.sub(l));
1834
- for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(d.copy(u).addScalar(Q)), a.expandByPoint(d.copy(u).subScalar(Q));
1824
+ for (let e of ai(t.scene.cell)) a.expandByPoint(e.sub(l));
1825
+ for (let e of t.scene.atoms) u.set(...e.position).sub(l), a.expandByPoint(d.copy(u).addScalar($)), a.expandByPoint(d.copy(u).subScalar($));
1835
1826
  for (let e of t.scene.cell) s = Math.max(s, Math.hypot(...e));
1836
1827
  let e = t.opacity ?? 1;
1837
1828
  if (e <= 0) continue;
1838
- let n = ui(t.scene.atoms, e);
1829
+ let n = di(t.scene.atoms, e);
1839
1830
  i.add(n), c.push(n);
1840
- let r = di(t.scene, e);
1831
+ let r = fi(t.scene, e);
1841
1832
  r && (i.add(r), c.push(r));
1842
- let f = si(t.scene.cell, e);
1833
+ let f = ci(t.scene.cell, e);
1843
1834
  i.add(f), c.push(f);
1844
1835
  for (let e of t.scene.elements) o.includes(e) || o.push(e);
1845
1836
  }
1846
1837
  return {
1847
1838
  group: i,
1848
1839
  cell: t.scene.cell,
1849
- center: n,
1850
1840
  bounds: a,
1851
1841
  span: s,
1852
1842
  elements: o,
1853
1843
  dispose() {
1854
- pi(c), i.clear();
1844
+ mi(c), i.clear();
1855
1845
  }
1856
1846
  };
1857
1847
  }
1858
- function pi(e) {
1848
+ function mi(e) {
1859
1849
  for (let t of e) {
1860
1850
  t.geometry.dispose();
1861
1851
  let e = t.userData.sectorTexture;
1862
1852
  e instanceof d && e.dispose();
1863
1853
  }
1864
1854
  }
1865
- var mi = {
1855
+ var hi = {
1866
1856
  cell: [
1867
1857
  [
1868
1858
  1,
@@ -1906,124 +1896,124 @@ var mi = {
1906
1896
  }],
1907
1897
  elements: []
1908
1898
  };
1909
- function hi() {
1899
+ function gi() {
1910
1900
  let e = new s("#ffffff"), t = [];
1911
- for (let n of [1, .5]) t.push(ui(mi.atoms, n, () => e), di(mi, n, () => e));
1912
- t.push(si(mi.cell, 1));
1901
+ for (let n of [1, .5]) t.push(di(hi.atoms, n, () => e), fi(hi, n, () => e));
1902
+ t.push(ci(hi.cell, 1));
1913
1903
  let n = new _();
1914
1904
  return n.add(...t), {
1915
1905
  group: n,
1916
- dispose: () => pi(t)
1906
+ dispose: () => mi(t)
1917
1907
  };
1918
1908
  }
1919
1909
  //#endregion
1920
1910
  //#region src/render/stage.ts
1921
- function gi(t = {}) {
1922
- let r = new N({
1911
+ function _i(t = {}) {
1912
+ let r = new j({
1923
1913
  antialias: !0,
1924
1914
  alpha: !0,
1925
1915
  stencil: t.stencil ?? !1
1926
1916
  });
1927
- r.setClearColor(Mn, 1), r.toneMapping = e;
1928
- let i = new se(), a = new k(-1, 1, 1, -1, .01, 1e3), o = new f("#ffffff", An);
1929
- i.add(new n("#ffffff", kn), o, o.target);
1930
- let s = new M();
1917
+ r.setClearColor(Nn, 1), r.toneMapping = e;
1918
+ let i = new le(), a = new D(-1, 1, 1, -1, .01, 1e3), o = new f("#ffffff", jn);
1919
+ i.add(new n("#ffffff", An), o, o.target);
1920
+ let s = new A();
1931
1921
  return {
1932
1922
  renderer: r,
1933
1923
  scene: i,
1934
1924
  camera: a,
1935
1925
  updateHeadlight() {
1936
1926
  let e = Math.max(a.position.length(), 4);
1937
- s.set(...jn).multiplyScalar(e).applyQuaternion(a.quaternion), o.position.copy(a.position).add(s);
1927
+ s.set(...Mn).multiplyScalar(e).applyQuaternion(a.quaternion), o.position.copy(a.position).add(s);
1938
1928
  }
1939
1929
  };
1940
1930
  }
1941
1931
  //#endregion
1942
1932
  //#region src/render/viewer.ts
1943
- var _i = .4, vi = .4, yi = .4, bi = 2, xi = 1.2, Si = .2, Ci = 1500, wi = .2, Ti = 5, Ei = 3, Di = 1e-5, Oi = 4, ki = .35, Ai = 110, ji = 180;
1944
- function Mi(e, t, n) {
1945
- let r = new M(0, 0, 1).applyQuaternion(n), i = 0, a = 0, o = new M();
1933
+ var vi = .4, yi = .4, bi = .4, xi = 2, Si = 1.2, Ci = .2, wi = 1500, Ti = .2, Ei = 5, Di = 3, Oi = 1e-5, ki = 4, Ai = .35, ji = 110, Mi = 180;
1934
+ function Ni(e, t, n) {
1935
+ let r = new A(0, 0, 1).applyQuaternion(n), i = 0, a = 0, o = new A();
1946
1936
  for (let t of [e.bounds.min.x, e.bounds.max.x]) for (let n of [e.bounds.min.y, e.bounds.max.y]) for (let s of [e.bounds.min.z, e.bounds.max.z]) {
1947
1937
  let e = o.set(t, n, s).dot(r);
1948
1938
  i = Math.max(i, e), a = Math.min(a, e);
1949
1939
  }
1950
- let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s * yi, d = l - u, f = t + (d + (Math.max(d, c - u) - d) * vi), p = f + (t + c - f) / _i;
1951
- return new ee(Mn, f, p);
1940
+ let s = Math.max(1, e.span), c = Math.max(.01 * s, -a), l = Math.min(c, -i), u = s * bi, d = l - u, f = t + (d + (Math.max(d, c - u) - d) * yi), p = f + (t + c - f) / vi;
1941
+ return new ee(Nn, f, p);
1952
1942
  }
1953
- function Ni(e, t = {}) {
1943
+ function Pi(e, t = {}) {
1954
1944
  let n = e.ownerDocument;
1955
1945
  Qr(n), e.classList.add("bravais-viewer");
1956
- let { renderer: r, scene: i, camera: a, updateHeadlight: o } = gi({ stencil: !0 });
1946
+ let { renderer: r, scene: i, camera: a, updateHeadlight: o } = _i({ stencil: !0 });
1957
1947
  r.setPixelRatio(n.defaultView?.devicePixelRatio ?? 1), r.domElement.className = "bravais-canvas", e.appendChild(r.domElement);
1958
1948
  let s = t.legend === !1 ? null : new ei(n);
1959
1949
  s && e.appendChild(s.element);
1960
- let c = n.defaultView?.getComputedStyle(e).fontFamily ?? "sans-serif", l = t.gizmo === !1 ? null : new sr(c), u = new Jt(a, r.domElement);
1961
- u.rotateSpeed = bi, u.zoomSpeed = xi, u.dynamicDampingFactor = Si, u.staticMoving = !1, u.noPan = !0, u.mouseButtons.LEFT = S.ROTATE, u.mouseButtons.MIDDLE = S.DOLLY, u.mouseButtons.RIGHT = null;
1962
- let d = null, f = null, p = 4, m = 1, h = 1, g = 1, _ = null, v = !1, y = 0, b = !1, x = 0, te = !1, ne = new j(), C = new A(), w = 0, T = new M(), E = /* @__PURE__ */ new Set();
1963
- function D() {
1950
+ let c = n.defaultView?.getComputedStyle(e).fontFamily ?? "sans-serif", l = t.gizmo === !1 ? null : new cr(c), u = new Yt(a, r.domElement);
1951
+ u.rotateSpeed = xi, u.zoomSpeed = Si, u.dynamicDampingFactor = Ci, u.staticMoving = !1, u.noPan = !0, u.mouseButtons.LEFT = S.ROTATE, u.mouseButtons.MIDDLE = S.DOLLY, u.mouseButtons.RIGHT = null;
1952
+ let d = null, f = null, p = 4, m = 1, h = 1, g = 1, _ = null, v = !1, y = 0, b = !1, x = 0, te = !1, ne = new k(), re = new O(), C = 0, w = new A(), T = /* @__PURE__ */ new Set();
1953
+ function ie() {
1964
1954
  x = 0, te = !1;
1965
- for (let e of E) e();
1955
+ for (let e of T) e();
1966
1956
  }
1967
- function O() {
1957
+ function E() {
1968
1958
  if (!f && (o(), r.setViewport(0, 0, h, g), r.render(i, a), l && d)) {
1969
- let e = Math.round(Math.min(ji, Math.max(Ai, Math.min(h, g) * ki)));
1959
+ let e = Math.round(Math.min(Mi, Math.max(ji, Math.min(h, g) * Ai)));
1970
1960
  l.render(r, a.quaternion, e);
1971
1961
  }
1972
1962
  }
1973
- function k() {
1963
+ function D() {
1974
1964
  let t = e.getBoundingClientRect();
1975
1965
  h = Math.max(1, Math.round(t.width)), g = Math.max(1, Math.round(t.height));
1976
1966
  let n = r.getSize(ne);
1977
- (n.x !== h || n.y !== g) && r.setSize(h, g, !1), En(a, h, g), u.handleResize(), u.rotateSpeed = h / Ci * bi;
1978
- }
1979
- function re(e) {
1980
- d && (m = Tn(d.bounds, e, h, g), u.minZoom = m * wi, u.maxZoom = m * Ti);
1967
+ (n.x !== h || n.y !== g) && r.setSize(h, g, !1), Dn(a, h, g), u.handleResize(), u.rotateSpeed = h / wi * xi;
1981
1968
  }
1982
- function ie() {
1983
- let e = C.angleTo(a.quaternion) > Di || Math.abs(w - a.zoom) > Di * m || T.distanceToSquared(u.target) > Di;
1984
- return C.copy(a.quaternion), w = a.zoom, T.copy(u.target), e;
1985
- }
1986
- function ae() {
1987
- _ = null, u.update(), ie() ? (y = 0, O(), x += 1, te = !0, x >= Oi && D()) : y += 1, b || y < Ei ? _ = requestAnimationFrame(ae) : (v = !1, te && D());
1969
+ function ae(e) {
1970
+ d && (m = En(d.bounds, e, h, g), u.minZoom = m * Ti, u.maxZoom = m * Ei);
1988
1971
  }
1989
1972
  function oe() {
1990
- y = 0, v || (v = !0, _ = requestAnimationFrame(ae));
1973
+ let e = re.angleTo(a.quaternion) > Oi || Math.abs(C - a.zoom) > Oi * m || w.distanceToSquared(u.target) > Oi;
1974
+ return re.copy(a.quaternion), C = a.zoom, w.copy(u.target), e;
1991
1975
  }
1992
1976
  function se() {
1977
+ _ = null, u.update(), oe() ? (y = 0, E(), x += 1, te = !0, x >= ki && ie()) : y += 1, b || y < Di ? _ = requestAnimationFrame(se) : (v = !1, te && ie());
1978
+ }
1979
+ function ce() {
1980
+ y = 0, v || (v = !0, _ = requestAnimationFrame(se));
1981
+ }
1982
+ function le() {
1993
1983
  _ !== null && (cancelAnimationFrame(_), _ = null), v = !1;
1994
1984
  }
1995
1985
  u.addEventListener("start", () => {
1996
- b = !0, oe();
1986
+ b = !0, ce();
1997
1987
  }), u.addEventListener("end", () => {
1998
- b = !1, oe();
1999
- }), u.addEventListener("change", oe);
2000
- function ce() {
1988
+ b = !1, ce();
1989
+ }), u.addEventListener("change", ce);
1990
+ function ue() {
2001
1991
  let e = m > 0 ? a.zoom / m : 1;
2002
- k(), re(a.quaternion), a.zoom = m * e, a.updateProjectionMatrix(), O();
2003
- }
2004
- let le = typeof ResizeObserver > "u" ? null : new ResizeObserver(ce);
2005
- le?.observe(e), k();
2006
- let ue = hi();
2007
- i.add(ue.group), i.fog = new ee(Mn, 1, 2);
2008
- let N = Promise.all([r.compileAsync(i, a), l && r.compileAsync(l.scene, l.camera)]);
2009
- i.remove(ue.group), i.fog = null, ue.dispose(), f = N;
2010
- let P = () => {
2011
- f === N && (f = null, O());
1992
+ D(), ae(a.quaternion), a.zoom = m * e, a.updateProjectionMatrix(), E();
1993
+ }
1994
+ let de = typeof ResizeObserver > "u" ? null : new ResizeObserver(ue);
1995
+ de?.observe(e), D();
1996
+ let fe = gi();
1997
+ i.add(fe.group), i.fog = new ee(Nn, 1, 2);
1998
+ let j = Promise.all([r.compileAsync(i, a), l && r.compileAsync(l.scene, l.camera)]);
1999
+ i.remove(fe.group), i.fog = null, fe.dispose(), f = j;
2000
+ let M = () => {
2001
+ f === j && (f = null, E());
2012
2002
  };
2013
- N.then(P, P);
2014
- function F(e) {
2015
- d && (Sn(a, e, p, d.span), u.target.set(...e.target), re(a.quaternion), a.zoom = m * e.scale, a.updateProjectionMatrix(), u.update(), ie());
2003
+ j.then(M, M);
2004
+ function N(e) {
2005
+ d && (Cn(a, e, p, d.span), u.target.set(...e.target), ae(a.quaternion), a.zoom = m * e.scale, a.updateProjectionMatrix(), u.update(), oe());
2016
2006
  }
2017
- let de = {
2007
+ let P = {
2018
2008
  setLayers(e, t = null) {
2019
- de.clear(), e.length !== 0 && (d = fi(e), i.add(d.group), p = yn(d.span), i.fog = Mi(d, p, bn(d.cell)), s?.setElements(d.elements), l?.setCell(d.cell), k(), F(t ?? xn(d.cell)), O());
2009
+ P.clear(), e.length !== 0 && (d = pi(e), i.add(d.group), p = bn(d.span), i.fog = Ni(d, p, xn(d.cell)), s?.setElements(d.elements), l?.setCell(d.cell), D(), N(t ?? Sn(d.cell)), E());
2020
2010
  },
2021
2011
  clear() {
2022
- se(), d &&= (i.remove(d.group), d.dispose(), null), i.fog = null, s?.setElements([]), r.setViewport(0, 0, h, g), r.clear();
2012
+ le(), d &&= (i.remove(d.group), d.dispose(), null), i.fog = null, s?.setElements([]), r.setViewport(0, 0, h, g), r.clear();
2023
2013
  },
2024
2014
  getView() {
2025
2015
  return d ? {
2026
- quaternion: Cn(a.quaternion),
2016
+ quaternion: wn(a.quaternion),
2027
2017
  target: [
2028
2018
  u.target.x,
2029
2019
  u.target.y,
@@ -2033,32 +2023,32 @@ function Ni(e, t = {}) {
2033
2023
  } : null;
2034
2024
  },
2035
2025
  setView(e) {
2036
- F(e), O();
2026
+ N(e), E();
2037
2027
  },
2038
2028
  resetView() {
2039
- d && F(xn(d.cell)), O(), D();
2029
+ d && N(Sn(d.cell)), E(), ie();
2040
2030
  },
2041
- resize: ce,
2042
- render: O,
2031
+ resize: ue,
2032
+ render: E,
2043
2033
  onInteraction(e) {
2044
- return E.add(e), () => E.delete(e);
2034
+ return T.add(e), () => T.delete(e);
2045
2035
  },
2046
2036
  dispose() {
2047
- de.clear(), f = null, b = !1, le?.disconnect(), u.dispose(), l?.dispose(), r.dispose(), r.domElement.remove(), s?.element.remove(), e.classList.remove("bravais-viewer");
2037
+ P.clear(), f = null, de?.disconnect(), u.dispose(), l?.dispose(), r.dispose(), r.domElement.remove(), s?.element.remove(), e.classList.remove("bravais-viewer");
2048
2038
  }
2049
2039
  };
2050
- return de;
2040
+ return P;
2051
2041
  }
2052
2042
  //#endregion
2053
2043
  //#region src/render/thumbnails.ts
2054
- function Pi() {
2055
- let { renderer: e, scene: t, camera: n, updateHeadlight: r } = gi(), i = /* @__PURE__ */ new Map(), a = hi();
2044
+ function Fi() {
2045
+ let { renderer: e, scene: t, camera: n, updateHeadlight: r } = _i(), i = /* @__PURE__ */ new Map(), a = gi();
2056
2046
  t.add(a.group), e.compile(t, n), t.remove(a.group), a.dispose();
2057
2047
  function o(e, t) {
2058
2048
  let n = i.get(e);
2059
2049
  if (n && n.layers === t) return n.model;
2060
2050
  n?.model.dispose();
2061
- let r = fi(t);
2051
+ let r = pi(t);
2062
2052
  return i.set(e, {
2063
2053
  layers: t,
2064
2054
  model: r
@@ -2069,9 +2059,9 @@ function Pi() {
2069
2059
  let l = c.getContext("2d");
2070
2060
  if (!l || a.length === 0) return;
2071
2061
  let u = o(i, a), d = Math.max(1, c.width), f = Math.max(1, c.height);
2072
- (e.domElement.width !== d || e.domElement.height !== f) && e.setSize(d, f, !1), En(n, d, f);
2073
- let p = yn(u.span), m = s ?? xn(u.cell);
2074
- Sn(n, m, p, u.span), n.zoom = Tn(u.bounds, new A(...m.quaternion), d, f) * m.scale, n.updateProjectionMatrix(), r(), t.add(u.group), e.render(t, n), t.remove(u.group), l.clearRect(0, 0, d, f), l.drawImage(e.domElement, 0, 0, d, f);
2062
+ (e.domElement.width !== d || e.domElement.height !== f) && e.setSize(d, f, !1), Dn(n, d, f);
2063
+ let p = bn(u.span), m = s ?? Sn(u.cell);
2064
+ Cn(n, m, p, u.span), n.zoom = En(u.bounds, new O(...m.quaternion), d, f) * m.scale, n.updateProjectionMatrix(), r(), t.add(u.group), e.render(t, n), t.remove(u.group), l.clearRect(0, 0, d, f), l.drawImage(e.domElement, 0, 0, d, f);
2075
2065
  },
2076
2066
  release(e) {
2077
2067
  i.get(e)?.model.dispose(), i.delete(e);
@@ -2084,18 +2074,18 @@ function Pi() {
2084
2074
  }
2085
2075
  //#endregion
2086
2076
  //#region src/index.ts
2087
- async function Fi(e) {
2088
- let t = ge(e), n = t.blocks.find(Ye) ?? t.blocks[0];
2089
- if (!n) throw new H("The CIF has no data block.");
2090
- let r = Xe(n);
2077
+ async function Ii(e) {
2078
+ let t = ve(e), n = t.blocks.find(Ze) ?? t.blocks[0];
2079
+ if (!n) throw new N("The CIF has no data block.");
2080
+ let r = Qe(n);
2091
2081
  return {
2092
2082
  lattice: r.lattice,
2093
2083
  sites: r.sites,
2094
- operations: await _t(r),
2084
+ operations: await yt(r),
2095
2085
  spaceGroup: r.spaceGroup
2096
2086
  };
2097
2087
  }
2098
2088
  //#endregion
2099
- export { H as CifStructureError, P as CifSyntaxError, nt as SpaceGroupLookupError, bt as SymmetryAnalysisError, Ft as buildScene, Pi as createThumbnailRenderer, Ni as createViewer, qr as elementColor, Jr as elementColorAssignments, Kr as ensureElementColors, rt as ensureMoyo, vt as expandStructure, Me as latticeFromParameters, Ne as latticeFromVectors, dt as operationsForSpaceGroup, ge as parseCif, Xe as parseCifStructure, Re as parseSymmetryOperator, Fi as readCif, Yr as resetElementColors, Pt as structureElements, Ct as symmetryDataset, Dt as typesetSymbol };
2089
+ export { N as CifStructureError, M as CifSyntaxError, it as SpaceGroupLookupError, St as SymmetryAnalysisError, Lt as buildScene, Fi as createThumbnailRenderer, Pi as createViewer, qr as elementColor, Jr as elementColorAssignments, Kr as ensureElementColors, at as ensureMoyo, bt as expandStructure, Pe as latticeFromParameters, Fe as latticeFromVectors, pt as operationsForSpaceGroup, ve as parseCif, Qe as parseCifStructure, Be as parseSymmetryOperation, Ii as readCif, Yr as resetElementColors, It as structureElements, Tt as symmetryDataset, kt as typesetSymbol };
2100
2090
 
2101
2091
  //# sourceMappingURL=bravais.js.map