@nebula-spatial/viewer 0.5.15 → 0.5.16

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.
@@ -1,9 +1,9 @@
1
1
  var Cn = Object.defineProperty;
2
2
  var On = (n, t, e) => t in n ? Cn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var K = (n, t, e) => On(n, typeof t != "symbol" ? t + "" : t, e);
3
+ var Z = (n, t, e) => On(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { Vector3 as U, Box3 as st, Matrix4 as mt, BufferAttribute as bn, Line3 as ct, Plane as An, Vector2 as ht, Triangle as Et, BackSide as Fn, DoubleSide as _n, REVISION as Sn, Ray as zn, FrontSide as He, Mesh as $t, LineSegments as Ve, LineLoop as Bn, Line as Tn, Points as Pn, Sphere as Vn, BatchedMesh as jn, LineBasicMaterial as $n, MeshBasicMaterial as kn, WireframeGeometry as qn, EdgesGeometry as we } from "three";
5
5
  import { disposeModelResources as Jn } from "./resources-CHhCm2f7.js";
6
- import { t as Lt, u as We, v as Hn, w as Wn, x as Yn, U as Xn, p as Gn } from "./index-YdnQRm_T.js";
6
+ import { t as Lt, u as We, v as Hn, w as Wn, x as Yn, U as Xn, p as Gn } from "./index-D9-UMnkK.js";
7
7
  const Zn = /* @__PURE__ */ new Set([
8
8
  "E_MJCF_INCLUDE_CYCLE",
9
9
  "E_MJCF_PARSE",
@@ -298,10 +298,10 @@ function ii(n, t, e, i, s) {
298
298
  if (M[R] !== r.mjtTrn.mjTRN_JOINT.value || v[R * 2] !== T) continue;
299
299
  const j = Number(o.actuator_gear[R * 6]);
300
300
  if (!Number.isFinite(j)) continue;
301
- const q = o.actuator_biastype[R] === r.mjtBias.mjBIAS_AFFINE.value, et = o.actuator_gaintype[R] === r.mjtGain.mjGAIN_FIXED.value, C = q ? -Number(L == null ? void 0 : L[R * 10 + 1]) + 0 : void 0, Z = q ? -Number(L == null ? void 0 : L[R * 10 + 2]) + 0 : void 0, Ut = Number(o.actuator_gainprm[R * 10]), lt = {
302
- type: et && q && C != null && C > 0 && Ut === C ? "position" : et && q && C === 0 && Z != null && Z > 0 && Ut === Z ? "velocity" : et && o.actuator_biastype[R] === r.mjtBias.mjBIAS_NONE.value ? "motor" : "general",
301
+ const q = o.actuator_biastype[R] === r.mjtBias.mjBIAS_AFFINE.value, et = o.actuator_gaintype[R] === r.mjtGain.mjGAIN_FIXED.value, C = q ? -Number(L == null ? void 0 : L[R * 10 + 1]) + 0 : void 0, K = q ? -Number(L == null ? void 0 : L[R * 10 + 2]) + 0 : void 0, Ut = Number(o.actuator_gainprm[R * 10]), lt = {
302
+ type: et && q && C != null && C > 0 && Ut === C ? "position" : et && q && C === 0 && K != null && K > 0 && Ut === K ? "velocity" : et && o.actuator_biastype[R] === r.mjtBias.mjBIAS_NONE.value ? "motor" : "general",
303
303
  ...Number.isFinite(C) ? { stiffness: C * j * j } : {},
304
- ...Number.isFinite(Z) ? { damping: Z * j * j } : {}
304
+ ...Number.isFinite(K) ? { damping: K * j * j } : {}
305
305
  }, kt = o.actuator(R);
306
306
  let qt;
307
307
  try {
@@ -323,7 +323,7 @@ function ii(n, t, e, i, s) {
323
323
  if (!v) continue;
324
324
  const N = o.jnt_bodyid[T], L = o.body_parentid[N], R = o.jnt(T);
325
325
  try {
326
- const j = (h = s == null ? void 0 : s.mimics) == null ? void 0 : h.get(v), q = p(T), et = Number((A = o.body_mass) == null ? void 0 : A[N]), C = (B = s == null ? void 0 : s.metadata) == null ? void 0 : B.get(v), Z = ((b = s == null ? void 0 : s.limits) == null ? void 0 : b.get(v)) ?? (R.limited ? { lower: o.jnt_range[T * 2], upper: o.jnt_range[T * 2 + 1] } : void 0);
326
+ const j = (h = s == null ? void 0 : s.mimics) == null ? void 0 : h.get(v), q = p(T), et = Number((A = o.body_mass) == null ? void 0 : A[N]), C = (B = s == null ? void 0 : s.metadata) == null ? void 0 : B.get(v), K = ((b = s == null ? void 0 : s.limits) == null ? void 0 : b.get(v)) ?? (R.limited ? { lower: o.jnt_range[T * 2], upper: o.jnt_range[T * 2 + 1] } : void 0);
327
327
  c.push({
328
328
  id: v,
329
329
  name: v.split("/").pop() || v,
@@ -333,7 +333,7 @@ function ii(n, t, e, i, s) {
333
333
  axis: Array.from(o.jnt_axis.slice(T * 3, T * 3 + 3)),
334
334
  unit: M ? "rad" : "m",
335
335
  defaultValue: a.qpos[o.jnt_qposadr[T]],
336
- ...Z ? { limits: Z } : {},
336
+ ...K ? { limits: K } : {},
337
337
  ...(C == null ? void 0 : C.movingMass) != null ? { movingMass: C.movingMass } : Number.isFinite(et) && et > 0 ? { movingMass: et } : {},
338
338
  ...C != null && C.drive ? { drive: C.drive } : q.drive ? { drive: q.drive } : {},
339
339
  ...(C == null ? void 0 : C.maxEffort) != null ? { maxEffort: C.maxEffort } : q.maxEffort != null ? { maxEffort: q.maxEffort } : {},
@@ -1441,9 +1441,9 @@ it.prototype.intersectsTriangle = /* @__PURE__ */ function() {
1441
1441
  return !1;
1442
1442
  s.copy(A.normal), o.copy(B.normal);
1443
1443
  const et = s.cross(o);
1444
- let C = 0, Z = Math.abs(et.x);
1444
+ let C = 0, K = Math.abs(et.x);
1445
1445
  const Ut = Math.abs(et.y);
1446
- Ut > Z && (Z = Ut, C = 1), Math.abs(et.z) > Z && (C = 2);
1446
+ Ut > K && (K = Ut, C = 1), Math.abs(et.z) > K && (C = 2);
1447
1447
  const lt = Ii[C], kt = this.a[lt], qt = this.b[lt], Jt = this.c[lt], Ht = y.a[lt], Wt = y.b[lt], Dn = y.c[lt];
1448
1448
  if (S(this, kt, qt, Jt, M, v, b, T, x, f, a))
1449
1449
  return u(this, y, w, E);
@@ -2459,11 +2459,11 @@ function cs(n) {
2459
2459
  }
2460
2460
  class Us {
2461
2461
  constructor(t, e, i = {}) {
2462
- K(this, "root");
2463
- K(this, "bodies", /* @__PURE__ */ new Map());
2464
- K(this, "links", /* @__PURE__ */ new Map());
2465
- K(this, "raycastAcceleration");
2466
- K(this, "disposed", !1);
2462
+ Z(this, "root");
2463
+ Z(this, "bodies", /* @__PURE__ */ new Map());
2464
+ Z(this, "links", /* @__PURE__ */ new Map());
2465
+ Z(this, "raycastAcceleration");
2466
+ Z(this, "disposed", !1);
2467
2467
  this.runtime = t, this.root = e.root, this.raycastAcceleration = i.accelerateRaycast === !1 ? null : os([this.root]);
2468
2468
  const s = t.mujoco, o = t.model;
2469
2469
  for (const [r, a] of e.bindings) {
@@ -2575,30 +2575,40 @@ function wn(n) {
2575
2575
  }
2576
2576
  class Rs {
2577
2577
  constructor(t) {
2578
- K(this, "entries", /* @__PURE__ */ new Map());
2579
- K(this, "objectUrls", /* @__PURE__ */ new Map());
2580
- K(this, "objectUrlPaths", /* @__PURE__ */ new Map());
2578
+ Z(this, "entries", /* @__PURE__ */ new Map());
2579
+ Z(this, "manifestPaths", /* @__PURE__ */ new Set());
2580
+ Z(this, "objectUrls", /* @__PURE__ */ new Map());
2581
+ Z(this, "objectUrlPaths", /* @__PURE__ */ new Map());
2581
2582
  /**
2582
2583
  * Reads that already failed, so a missing resource is not requested again by
2583
2584
  * the visual adapter after the reference prefetch has recorded it.
2584
2585
  */
2585
- K(this, "failures", /* @__PURE__ */ new Map());
2586
- K(this, "pending", /* @__PURE__ */ new Map());
2587
- K(this, "disposed", !1);
2586
+ Z(this, "failures", /* @__PURE__ */ new Map());
2587
+ Z(this, "pending", /* @__PURE__ */ new Map());
2588
+ Z(this, "disposed", !1);
2588
2589
  this.source = t;
2590
+ for (const i of t.resourcePaths ?? []) {
2591
+ const s = H(i);
2592
+ s && this.manifestPaths.add(s);
2593
+ }
2589
2594
  const e = t.original;
2590
2595
  if (ys(e))
2591
2596
  for (const i of e.files) this.entries.set(H(i.path), i.file);
2592
2597
  else typeof Blob < "u" && e instanceof Blob ? this.entries.set(t.entryPath ?? t.filename ?? "asset", e) : e instanceof ArrayBuffer ? this.entries.set(t.entryPath ?? t.filename ?? "asset", new Blob([e])) : typeof e == "object" && e !== null && "kind" in e && e.kind === "buffer" && this.entries.set(t.entryPath ?? t.filename ?? "asset", new Blob([e.buffer]));
2593
2598
  }
2594
2599
  paths() {
2595
- return [...this.entries.keys()];
2600
+ return [.../* @__PURE__ */ new Set([...this.entries.keys(), ...this.manifestPaths])];
2596
2601
  }
2597
2602
  hasLocalFiles() {
2598
2603
  return this.entries.size > 0;
2599
2604
  }
2600
2605
  put(t, e) {
2601
- this.entries.set(H(t), e);
2606
+ const i = H(t);
2607
+ this.entries.set(i, e), this.manifestPaths.add(i);
2608
+ }
2609
+ hasBlob(t) {
2610
+ const e = this.find(t);
2611
+ return e !== null && this.entries.has(e);
2602
2612
  }
2603
2613
  relativePaths(t = "", e = !1) {
2604
2614
  return [...this.relativeEntries(t, e)].map(([i]) => i);
@@ -2745,7 +2755,7 @@ class Rs {
2745
2755
  }
2746
2756
  objectUrlIfPresent(t, e = "") {
2747
2757
  const i = this.findTexture(t, e);
2748
- return i ? this.objectUrl(i) : null;
2758
+ return i && this.entries.has(i) ? this.objectUrl(i) : null;
2749
2759
  }
2750
2760
  findPresent(t, e = "") {
2751
2761
  if (Nt(t)) {
@@ -2788,7 +2798,7 @@ class Rs {
2788
2798
  for (const t of this.pending.values()) t.controller.abort();
2789
2799
  this.pending.clear();
2790
2800
  for (const t of this.objectUrls.values()) URL.revokeObjectURL(t);
2791
- this.objectUrls.clear(), this.objectUrlPaths.clear(), this.entries.clear(), this.failures.clear();
2801
+ this.objectUrls.clear(), this.objectUrlPaths.clear(), this.entries.clear(), this.manifestPaths.clear(), this.failures.clear();
2792
2802
  }
2793
2803
  }
2794
2804
  async function Ds(n, t) {