@spiffcommerce/preview 5.7.9-5 → 5.7.9-7

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/index.esm.js CHANGED
@@ -2,23 +2,23 @@ import { ArcRotateCamera as fe } from "@babylonjs/core/Cameras/arcRotateCamera";
2
2
  import { Engine as be } from "@babylonjs/core/Engines/engine";
3
3
  import { NullEngine as Ce } from "@babylonjs/core/Engines/nullEngine";
4
4
  import { HighlightLayer as ye } from "@babylonjs/core/Layers/highlightLayer";
5
- import { SceneLoader as S } from "@babylonjs/core/Loading/sceneLoader";
6
- import { CubeTexture as ne } from "@babylonjs/core/Materials/Textures/cubeTexture";
5
+ import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
6
+ import { CubeTexture as se } from "@babylonjs/core/Materials/Textures/cubeTexture";
7
7
  import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
8
- import { Vector3 as p, Quaternion as y, Vector2 as se, Matrix as re } from "@babylonjs/core/Maths/math.vector";
9
- import { DracoCompression as Ae } from "@babylonjs/core/Meshes/Compression/dracoCompression";
8
+ import { Vector3 as p, Quaternion as y, Vector2 as re, Matrix as ae } from "@babylonjs/core/Maths/math.vector";
9
+ import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
10
10
  import { Observable as C } from "@babylonjs/core/Misc/observable";
11
- import { Tools as Me } from "@babylonjs/core/Misc/tools";
11
+ import { Tools as Ae } from "@babylonjs/core/Misc/tools";
12
12
  import { Scene as xe } from "@babylonjs/core/scene";
13
13
  import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
14
14
  import { GLTFLoaderAnimationStartMode as Re } from "@babylonjs/loaders/glTF/glTFFileLoader";
15
- import { PBRMaterial as B } from "@babylonjs/core/Materials/PBR/pbrMaterial";
15
+ import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
16
16
  import { MirrorTexture as Ee } from "@babylonjs/core/Materials/Textures/mirrorTexture";
17
- import { Color3 as Te, Vector3 as ae, Plane as Oe } from "@babylonjs/core/Maths/math";
17
+ import { Color3 as Te, Vector3 as oe, Plane as Oe } from "@babylonjs/core/Maths/math";
18
18
  import { ReflectionProbe as Le } from "@babylonjs/core/Probes/reflectionProbe";
19
19
  import { GlowLayer as Ie } from "@babylonjs/core/Layers/glowLayer";
20
20
  import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
21
- import { ExecuteCodeAction as oe } from "@babylonjs/core/Actions/directActions";
21
+ import { ExecuteCodeAction as le } from "@babylonjs/core/Actions/directActions";
22
22
  import { Mesh as Fe } from "@babylonjs/core/Meshes/mesh";
23
23
  import { TransformNode as Se } from "@babylonjs/core/Meshes/transformNode";
24
24
  import { DynamicTexture as Be } from "@babylonjs/core/Materials/Textures/dynamicTexture";
@@ -26,7 +26,7 @@ import { Texture as De } from "@babylonjs/core/Materials/Textures/texture";
26
26
  import { Animation as v } from "@babylonjs/core/Animations/animation";
27
27
  import { QuadraticEase as ke, EasingFunction as ze } from "@babylonjs/core/Animations/easing";
28
28
  import { AssetsManager as Ne } from "@babylonjs/core/Misc/assetsManager";
29
- import { ColorCurves as le } from "@babylonjs/core/Materials/colorCurves";
29
+ import { ColorCurves as he } from "@babylonjs/core/Materials/colorCurves";
30
30
  import { ImageProcessingConfiguration as x } from "@babylonjs/core/Materials/imageProcessingConfiguration";
31
31
  import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
32
32
  import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
@@ -40,29 +40,35 @@ import "@babylonjs/core/Animations/animatable";
40
40
  import "@babylonjs/core/Misc/screenshotTools";
41
41
  import "@babylonjs/core/Rendering/boundingBoxRenderer";
42
42
  import "@babylonjs/loaders/glTF/2.0/Extensions";
43
- var I = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(I || {}), F = /* @__PURE__ */ ((r) => (r.None = "None", r.RemoveWhenSelected = "RemoveWhenSelected", r.ApplyWhenSelected = "ApplyWhenSelected", r))(F || {});
44
- const he = /* @__PURE__ */ new Map();
45
- async function D(r, e, t) {
46
- const i = await he.get(r);
43
+ var F = /* @__PURE__ */ ((s) => (s[s.Orbit = 0] = "Orbit", s[s.Pan = 1] = "Pan", s))(F || {}), S = /* @__PURE__ */ ((s) => (s.None = "None", s.RemoveWhenSelected = "RemoveWhenSelected", s.ApplyWhenSelected = "ApplyWhenSelected", s))(S || {});
44
+ const T = /* @__PURE__ */ new Map();
45
+ async function k(s, e, t) {
46
+ console.log(
47
+ `asset cache currently has ${T.size} entries, seeking ${s} for scene ${e.uid}`
48
+ );
49
+ const i = await T.get(s);
47
50
  if (i && i.scene.uid === e.uid)
48
51
  return i;
49
- const n = S.LoadAssetContainerAsync(
50
- r,
52
+ console.log(
53
+ `existing container belonged to scene ${i == null ? void 0 : i.scene.uid}`
54
+ );
55
+ const r = B.LoadAssetContainerAsync(
56
+ s,
51
57
  void 0,
52
58
  e,
53
59
  t
54
60
  );
55
- return he.set(r, n), n;
61
+ return T.set(s, r), r;
56
62
  }
57
- S.OnPluginActivatedObservable.add((r) => {
58
- r.name === "gltf" && (r.animationStartMode = Re.NONE);
63
+ B.OnPluginActivatedObservable.add((s) => {
64
+ s.name === "gltf" && (s.animationStartMode = Re.NONE);
59
65
  });
60
66
  class ce {
61
67
  constructor(e) {
62
68
  this.getSceneClearColor = () => {
63
- var i, n, s, o;
64
- const t = (i = this.customOptions) != null && i.transparentBackground || (n = this.customOptions) != null && n.backgroundImage ? 0 : 1;
65
- if (this.customOptions && ((s = this.customOptions) != null && s.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
69
+ var i, r, n, o;
70
+ const t = (i = this.customOptions) != null && i.transparentBackground || (r = this.customOptions) != null && r.backgroundImage ? 0 : 1;
71
+ if (this.customOptions && ((n = this.customOptions) != null && n.transparentBackground) || (o = this.customOptions) != null && o.backgroundImage)
66
72
  return new b(0, 0, 0, t).toLinearSpace();
67
73
  if (this.customOptions && this.customOptions.backgroundColor) {
68
74
  const a = w.FromHexString(
@@ -77,11 +83,11 @@ class ce {
77
83
  }
78
84
  return new b(0.98, 0.98, 0.98, t).toLinearSpace();
79
85
  }, this.highlightColorFromConfig = () => this.customOptions && this.customOptions.highlightColor ? this.hexToColor4(this.customOptions.highlightColor) : new b(0.98, 0.98, 0.98, 1).toLinearSpace(), this.hexToColor4 = (t, i = 1) => {
80
- const n = w.FromHexString(t);
86
+ const r = w.FromHexString(t);
81
87
  return new b(
82
- n.r,
83
- n.g,
84
- n.b,
88
+ r.r,
89
+ r.g,
90
+ r.b,
85
91
  i
86
92
  ).toLinearSpace();
87
93
  }, this.customOptions = e;
@@ -97,14 +103,14 @@ class ce {
97
103
  * Configuration related to the scene
98
104
  */
99
105
  get scene() {
100
- var e, t, i, n, s;
106
+ var e, t, i, r, n;
101
107
  return {
102
108
  clearColor: this.getSceneClearColor(),
103
109
  transparentBackground: ((e = this.customOptions) == null ? void 0 : e.transparentBackground) || ((t = this.customOptions) == null ? void 0 : t.backgroundImage),
104
110
  environment: {
105
111
  file: ((i = this.customOptions) == null ? void 0 : i.environmentFile) ?? "assets/model-viewer/default.env",
106
- intensity: ((n = this.customOptions) == null ? void 0 : n.environmentIntensity) ?? 1,
107
- rotationY: (((s = this.customOptions) == null ? void 0 : s.environmentRotationY) ?? 0) * (Math.PI / 180)
112
+ intensity: ((r = this.customOptions) == null ? void 0 : r.environmentIntensity) ?? 1,
113
+ rotationY: (((n = this.customOptions) == null ? void 0 : n.environmentRotationY) ?? 0) * (Math.PI / 180)
108
114
  // Convert to radians
109
115
  }
110
116
  };
@@ -113,7 +119,7 @@ class ce {
113
119
  * Configuration related to the camera used to view and interact with the scene.
114
120
  */
115
121
  get camera() {
116
- var e, t, i, n, s, o, a, l, h, c, u, m, g;
122
+ var e, t, i, r, n, o, a, h, l, c, m, u, g;
117
123
  return {
118
124
  autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
119
125
  autoRotation: {
@@ -122,13 +128,13 @@ class ce {
122
128
  },
123
129
  limits: {
124
130
  min: {
125
- alpha: (n = this.customOptions) != null && n.lowerAlphaLimitDeg ? ((s = this.customOptions) == null ? void 0 : s.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
131
+ alpha: (r = this.customOptions) != null && r.lowerAlphaLimitDeg ? ((n = this.customOptions) == null ? void 0 : n.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
126
132
  beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
127
- radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
133
+ radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
128
134
  },
129
135
  max: {
130
- alpha: (h = this.customOptions) != null && h.upperAlphaLimitDeg ? ((c = this.customOptions) == null ? void 0 : c.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
131
- beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
136
+ alpha: (l = this.customOptions) != null && l.upperAlphaLimitDeg ? ((c = this.customOptions) == null ? void 0 : c.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
137
+ beta: (m = this.customOptions) != null && m.upperBetaLimitDeg ? ((u = this.customOptions) == null ? void 0 : u.upperBetaLimitDeg) * Math.PI / 180 : void 0,
132
138
  radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
133
139
  }
134
140
  }
@@ -146,10 +152,10 @@ class ce {
146
152
  };
147
153
  }
148
154
  get lighting() {
149
- var e, t, i, n;
155
+ var e, t, i, r;
150
156
  return {
151
157
  exposure: ((t = (e = this.customOptions) == null ? void 0 : e.lighting) == null ? void 0 : t.exposure) ?? 0.9,
152
- contrast: ((n = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : n.contrast) ?? 1.6
158
+ contrast: ((r = (i = this.customOptions) == null ? void 0 : i.lighting) == null ? void 0 : r.contrast) ?? 1.6
153
159
  };
154
160
  }
155
161
  get emissiveGlowIntensity() {
@@ -157,12 +163,12 @@ class ce {
157
163
  return ((e = this.customOptions) == null ? void 0 : e.emissiveGlowIntensity) ?? 0.5;
158
164
  }
159
165
  }
160
- class M {
166
+ class A {
161
167
  /**
162
168
  * Returns the resolution expected for generated textures.
163
169
  */
164
170
  static getDynamicTextureResolution() {
165
- return this.getIsMobile() || !M.offscreenRenderingSupported() ? {
171
+ return this.getIsMobile() || !A.offscreenRenderingSupported() ? {
166
172
  width: 1024,
167
173
  height: 1024
168
174
  } : {
@@ -270,11 +276,11 @@ class _e {
270
276
  return this.loader.loadNodeAsync(
271
277
  e,
272
278
  t,
273
- function(n) {
274
- t.extras && Object.keys(t.extras).forEach((s) => {
275
- const o = t.extras[s];
276
- n.metadata[s] = o;
277
- }), i(n);
279
+ function(r) {
280
+ t.extras && Object.keys(t.extras).forEach((n) => {
281
+ const o = t.extras[n];
282
+ r.metadata[n] = o;
283
+ }), i(r);
278
284
  }
279
285
  );
280
286
  }
@@ -299,7 +305,7 @@ class _e {
299
305
  * @param babylonMaterial An instance of a material representation in babylon.
300
306
  */
301
307
  enableMaterialExtrasIfRequired(e, t) {
302
- if (!(!e.extras || !(t instanceof B))) {
308
+ if (!(!e.extras || !(t instanceof D))) {
303
309
  if (e.extras.sheen) {
304
310
  const i = t;
305
311
  i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
@@ -332,51 +338,51 @@ class _e {
332
338
  * @param scene The scene to parse.
333
339
  */
334
340
  applyReflections(e) {
335
- function t(s) {
341
+ function t(n) {
336
342
  const o = [];
337
- return s.transformNodes.forEach((a) => {
343
+ return n.transformNodes.forEach((a) => {
338
344
  a.metadata && a.metadata.reflective && o.push(...a.getChildMeshes());
339
- }), s.meshes.forEach((a) => {
345
+ }), n.meshes.forEach((a) => {
340
346
  a.metadata && a.metadata.reflective && !o.includes(a) && o.push(a);
341
347
  }), o;
342
348
  }
343
- function i(s, o = 1) {
344
- const a = s.material;
349
+ function i(n, o = 1) {
350
+ const a = n.material;
345
351
  if (!a)
346
352
  return;
347
- const l = new Ee(
353
+ const h = new Ee(
348
354
  "mirror",
349
- M.getMirrorTextureResolution(),
355
+ A.getMirrorTextureResolution(),
350
356
  e,
351
357
  !0
352
358
  );
353
- l.renderList = t(e);
354
- const h = s.getVerticesData("normal");
355
- if (!h)
359
+ h.renderList = t(e);
360
+ const l = n.getVerticesData("normal");
361
+ if (!l)
356
362
  throw new Error(
357
- "Mirror attribute specified on: " + s.name + "But no normals exist to generate a mirror from!"
363
+ "Mirror attribute specified on: " + n.name + "But no normals exist to generate a mirror from!"
358
364
  );
359
- s.computeWorldMatrix(!0);
360
- const c = s.getWorldMatrix(), u = ae.TransformNormal(
361
- new ae(h[0], h[1], h[2]),
365
+ n.computeWorldMatrix(!0);
366
+ const c = n.getWorldMatrix(), m = oe.TransformNormal(
367
+ new oe(l[0], l[1], l[2]),
362
368
  c
363
- ).normalize(), m = Oe.FromPositionAndNormal(
364
- s.position,
365
- u.scale(-1)
369
+ ).normalize(), u = Oe.FromPositionAndNormal(
370
+ n.position,
371
+ m.scale(-1)
366
372
  );
367
- l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
373
+ h.mirrorPlane = u, h.level = o, a.reflectionTexture = h;
368
374
  }
369
- function n(s) {
370
- const o = s.material, a = new Le(
375
+ function r(n) {
376
+ const o = n.material, a = new Le(
371
377
  "probe-" + o.name,
372
378
  Ve,
373
379
  e
374
380
  );
375
- a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(s), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
381
+ a.cubeTexture.name = "reflection-probe-cube-texture", a.attachToMesh(n), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
376
382
  }
377
- e.meshes.forEach((s) => {
378
- const o = s.metadata;
379
- o && (o.mirrorTexture && i(s, o.mirrorTexture), o.reflectionProbe && n(s));
383
+ e.meshes.forEach((n) => {
384
+ const o = n.metadata;
385
+ o && (o.mirrorTexture && i(n, o.mirrorTexture), o.reflectionProbe && r(n));
380
386
  });
381
387
  }
382
388
  }
@@ -402,112 +408,99 @@ class Ge {
402
408
  }
403
409
  }
404
410
  }
405
- function He(r, e, t, i, n = "") {
406
- t.forEach((s) => {
407
- const o = s.getID(), a = s.getName(), l = M.getDynamicTextureResolution();
408
- r.filter((c) => c.name === n + a).forEach((c) => {
409
- console.log(`attaching textures to material ${c.name}`);
410
- const u = i.get(o), m = !1;
411
- if (u)
412
- de(c, u), console.log(`applying current texture ${u.name}`), u.update(m);
411
+ function He(s, e, t, i, r = "") {
412
+ t.forEach((n) => {
413
+ const o = n.getID(), a = n.getName(), h = A.getDynamicTextureResolution();
414
+ s.filter((c) => c.name === r + a).forEach((c) => {
415
+ const m = i.get(o), u = !1;
416
+ if (m)
417
+ de(c, m), m.update(u);
413
418
  else {
414
419
  const g = Ke(
415
420
  a,
416
421
  e,
417
- l.width,
418
- l.height
422
+ h.width,
423
+ h.height
419
424
  );
420
- console.log(`created new texture ${g.name}`), i.set(o, g), s.setStaticContext(
425
+ i.set(o, g), n.setStaticContext(
421
426
  g.getContext()
422
427
  ), de(c, g), g.onLoadObservable.addOnce(() => {
423
- g.update(m);
428
+ g.update(u);
424
429
  });
425
430
  }
426
431
  });
427
432
  }), Ue(e);
428
433
  }
429
- const Ue = (r) => {
430
- const e = () => r.textures.reduce((i, n) => {
431
- var o, a;
432
- return !r.meshes.some(
433
- (l) => l.material && l.material.hasTexture(n)
434
- ) && !((o = n == null ? void 0 : n.url) != null && o.includes("data:")) && !((a = n == null ? void 0 : n.url) != null && a.endsWith(".env")) && i.push(n), i;
435
- }, []), t = () => r.materials.reduce((i, n) => (n.getBindedMeshes().length == 0 && i.push(n), i), []);
436
- e().forEach((i) => {
437
- try {
438
- console.log(`disposing texture ${i.name} (${i.url})`), i.dispose();
439
- } catch {
440
- console.log(`Failed to dispose texture ${i.name}`);
441
- }
442
- }), t().forEach((i) => {
434
+ const Ue = (s) => {
435
+ (() => s.materials.reduce((t, i) => (i.getBindedMeshes().length == 0 && t.push(i), t), []))().forEach((t) => {
443
436
  try {
444
- console.log(`disposing material ${i.name}`), i.dispose(!0, !0);
437
+ console.log(`disposing material ${t.name}`), t.dispose(!0, !0);
445
438
  } catch {
446
- console.log(`Failed to dispose material ${i.name}`);
439
+ console.log(`Failed to dispose material ${t.name}`);
447
440
  }
448
441
  });
449
442
  };
450
- function Ke(r, e, t, i) {
451
- const n = new Be(
452
- r,
443
+ function Ke(s, e, t, i) {
444
+ const r = new Be(
445
+ s,
453
446
  { width: t, height: i },
454
447
  e,
455
- M.shouldMipMap(),
448
+ A.shouldMipMap(),
456
449
  De.TRILINEAR_SAMPLINGMODE,
457
450
  be.TEXTUREFORMAT_RGBA
458
- ), s = n.getContext();
459
- return s && (s.fillStyle = "#f5f5f5", s.fillRect(0, 0, t, i), n.update()), n;
451
+ ), n = r.getContext();
452
+ return n && (n.fillStyle = "#f5f5f5", n.fillRect(0, 0, t, i), r.update()), r;
460
453
  }
461
- function de(r, e) {
462
- if (r instanceof B) {
463
- const t = r, i = t.albedoTexture;
454
+ function de(s, e) {
455
+ if (s instanceof D) {
456
+ const t = s, i = t.albedoTexture;
464
457
  i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
465
458
  } else {
466
- const t = r, i = t.diffuseTexture;
459
+ const t = s, i = t.diffuseTexture;
467
460
  i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
468
461
  }
469
462
  }
470
463
  function We() {
471
- const r = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
472
- return r() + r() + "-" + r() + "-" + r() + "-" + r() + "-" + r() + r() + r();
464
+ const s = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
465
+ return s() + s() + "-" + s() + "-" + s() + "-" + s() + "-" + s() + s() + s();
473
466
  }
474
- const A = 60, ue = 1;
475
- function me(r) {
476
- return r.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / r.targetedAnimations.length || 0;
467
+ const M = 60, ue = 1;
468
+ function me(s) {
469
+ return s.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / s.targetedAnimations.length || 0;
477
470
  }
478
- function ve(r, e, t, i, n, s) {
479
- const o = n ? r.filter((c) => c.name === n) : r;
471
+ function ve(s, e, t, i, r, n) {
472
+ const o = r ? s.filter((c) => c.name === r) : s;
480
473
  if (o.length === 0) {
481
- console.warn(`No animations found for name: ${n}`);
474
+ console.warn(`No animations found for name: ${r}`);
482
475
  return;
483
476
  }
484
477
  let a = 0;
485
- const l = () => {
486
- a++, a === o.length && s && s();
487
- }, h = (c, u, m, g, f) => {
488
- c.stop(), c.start(u, m, g, f), s && (u == !1 || u === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
489
- l();
478
+ const h = () => {
479
+ a++, a === o.length && n && n();
480
+ }, l = (c, m, u, g, f) => {
481
+ c.stop(), c.start(m, u, g, f), n && (m == !1 || m === void 0 && !c.loopAnimation ? c.onAnimationGroupEndObservable.addOnce(() => {
482
+ h();
490
483
  }) : c.onAnimationLoopObservable.addOnce(() => {
491
- l();
484
+ h();
492
485
  }));
493
486
  };
494
487
  if (i !== void 0 && t !== void 0 && i === t) {
495
488
  o.forEach((c) => {
496
- const u = me(c), m = i * u;
497
- h(c, !1, ue, m, m);
489
+ const m = me(c), u = i * m;
490
+ l(c, !1, ue, u, u);
498
491
  });
499
492
  return;
500
493
  }
501
494
  o.forEach((c) => {
502
- const u = me(c), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
503
- h(c, e, ue, m, g);
495
+ const m = me(c), u = i !== void 0 ? i * m : void 0, g = t !== void 0 ? t * m : void 0;
496
+ l(c, e, ue, u, g);
504
497
  });
505
498
  }
506
- function $e(r, e, t) {
499
+ function Ye(s, e, t) {
507
500
  return new Promise((i) => {
508
- r.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
509
- const n = [], s = t.target, o = 0, a = s ? 1 : 0;
510
- if (t.target && Object.keys(t.target).length > 0 && n.push(
501
+ s.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = $e(e.alpha, 0, 2 * Math.PI));
502
+ const r = [], n = t.target, o = 0, a = n ? 1 : 0;
503
+ if (t.target && Object.keys(t.target).length > 0 && r.push(
511
504
  P(
512
505
  "cameraTargetLerp",
513
506
  "target",
@@ -520,7 +513,7 @@ function $e(r, e, t) {
520
513
  v.ANIMATIONTYPE_VECTOR3,
521
514
  o
522
515
  )
523
- ), n.push(
516
+ ), r.push(
524
517
  P(
525
518
  "cameraAlphaLerp",
526
519
  "alpha",
@@ -529,7 +522,7 @@ function $e(r, e, t) {
529
522
  v.ANIMATIONTYPE_FLOAT,
530
523
  a
531
524
  )
532
- ), n.push(
525
+ ), r.push(
533
526
  P(
534
527
  "cameraBetaLerp",
535
528
  "beta",
@@ -540,7 +533,7 @@ function $e(r, e, t) {
540
533
  )
541
534
  ), t.radius !== void 0) {
542
535
  const c = Math.max(0.01, t.radius);
543
- n.push(
536
+ r.push(
544
537
  P(
545
538
  "cameraRadiusLerp",
546
539
  "radius",
@@ -551,43 +544,43 @@ function $e(r, e, t) {
551
544
  )
552
545
  );
553
546
  }
554
- e.animations.push(...n);
555
- const h = e.useAutoRotationBehavior;
556
- e.disableAutoRotationBehavior(), r.beginAnimation(
547
+ e.animations.push(...r);
548
+ const l = e.useAutoRotationBehavior;
549
+ e.disableAutoRotationBehavior(), s.beginAnimation(
557
550
  e,
558
551
  0,
559
- s ? A * 2 : A,
552
+ n ? M * 2 : M,
560
553
  !1,
561
554
  1,
562
555
  () => {
563
- e.animations = [], h && e.enableAutoRotationBehavior(), i();
556
+ e.animations = [], l && e.enableAutoRotationBehavior(), i();
564
557
  }
565
558
  );
566
559
  });
567
560
  }
568
- function ge(r) {
569
- return r * Math.PI / 180;
561
+ function ge(s) {
562
+ return s * Math.PI / 180;
570
563
  }
571
- function P(r, e, t, i, n, s = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
564
+ function P(s, e, t, i, r, n = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
572
565
  const a = new ke();
573
566
  a.setEasingMode(ze.EASINGMODE_EASEINOUT);
574
- const l = new v(
575
- r,
567
+ const h = new v(
568
+ s,
576
569
  e,
577
- A,
578
- n,
570
+ M,
571
+ r,
579
572
  o
580
- ), h = [];
581
- return s > 0 && h.push({ frame: 0, value: t }), h.push({ frame: A * s, value: t }), h.push({
582
- frame: A * (s + 1),
573
+ ), l = [];
574
+ return n > 0 && l.push({ frame: 0, value: t }), l.push({ frame: M * n, value: t }), l.push({
575
+ frame: M * (n + 1),
583
576
  value: i
584
- }), l.setKeys(h), l.setEasingFunction(a), l;
577
+ }), h.setKeys(l), h.setEasingFunction(a), h;
585
578
  }
586
- function Ye(r, e, t) {
587
- return r < e ? r = t - (e - r) % (t - e) : r = e + (r - e) % (t - e);
579
+ function $e(s, e, t) {
580
+ return s < e ? s = t - (e - s) % (t - e) : s = e + (s - e) % (t - e);
588
581
  }
589
- function Qe(r, e, t) {
590
- r.forEach((i) => {
582
+ function Qe(s, e, t) {
583
+ s.forEach((i) => {
591
584
  t && i.name !== t || i.goToFrame(e);
592
585
  });
593
586
  }
@@ -601,7 +594,7 @@ const Ze = {
601
594
  refractionTexture: "refractionMap",
602
595
  reflectionTexture: "reflectionMap"
603
596
  };
604
- function je(r, e, t, i) {
597
+ function je(s, e, t, i) {
605
598
  [
606
599
  "albedoTexture",
607
600
  "bumpTexture",
@@ -611,49 +604,49 @@ function je(r, e, t, i) {
611
604
  "metallicTexture",
612
605
  "refractionTexture",
613
606
  "reflectionTexture"
614
- ].forEach((s) => {
607
+ ].forEach((n) => {
615
608
  Xe(
609
+ n,
616
610
  s,
617
- r,
618
611
  e,
619
612
  t,
620
613
  i
621
614
  );
622
- }), tt(r, e);
615
+ }), tt(s, e);
623
616
  }
624
- function Xe(r, e, t, i, n) {
625
- const s = Ze[r];
626
- if (!s)
617
+ function Xe(s, e, t, i, r) {
618
+ const n = Ze[s];
619
+ if (!n)
627
620
  throw new Error("Unexpected texture name encountered.");
628
- const o = e[s], a = o == null ? void 0 : o.fileLink;
629
- a ? r === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
630
- r,
621
+ const o = e[n], a = o == null ? void 0 : o.fileLink;
622
+ a ? s === "reflectionTexture" ? a.endsWith(".env") || a.endsWith(".dds") ? i.addCubeTextureTask(
623
+ s,
631
624
  a,
632
625
  void 0,
633
626
  !1,
634
627
  void 0,
635
628
  !0
636
629
  ) : a.endsWith(".hdr") ? i.addHDRCubeTextureTask(
637
- r,
630
+ s,
638
631
  a,
639
632
  128,
640
633
  !1,
641
634
  !0,
642
635
  !1
643
- ) : i.addTextureTask(r, a, !1, !1) : i.addTextureTask(r, a, !1, !1) : n && t[r] && (t[r] && t[r].dispose(), t[r] = null, Je(r, t));
636
+ ) : i.addTextureTask(s, a, !1, !1) : i.addTextureTask(s, a, !1, !1) : r && t[s] && (t[s] && t[s].dispose(), t[s] = null, Je(s, t));
644
637
  }
645
- function Je(r, e) {
646
- r === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), r === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), r === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), r === "reflectionTexture" && (e.environmentIntensity = 1), r === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
638
+ function Je(s, e) {
639
+ s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), s === "reflectionTexture" && (e.environmentIntensity = 1), s === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
647
640
  }
648
- function et(r, e, t, i) {
641
+ function et(s, e, t, i) {
649
642
  if (!e) {
650
643
  console.error("Failed to apply texture to material: material is null.");
651
644
  return;
652
645
  }
653
- r === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), r === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), r === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), r === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[r] = i, r === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
646
+ s === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), s === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), s === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), s === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[s] = i, s === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
654
647
  }
655
- function tt(r, e) {
656
- r.clearCoat && (r.clearCoat === F.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : r.clearCoat === F.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = r.clearCoatIOR || e.clearCoat.indexOfRefraction));
648
+ function tt(s, e) {
649
+ s.clearCoat && (s.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : s.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = s.clearCoatIOR || e.clearCoat.indexOfRefraction));
657
650
  }
658
651
  class it {
659
652
  constructor(e, t, i) {
@@ -668,45 +661,45 @@ class it {
668
661
  * instead remove material textures when they aren't defined. this is useful for material editor applications
669
662
  * where we want to undo changes are remove effects from display.
670
663
  */
671
- async applyMaterial(e, t, i, n) {
672
- return new Promise((s) => {
664
+ async applyMaterial(e, t, i, r) {
665
+ return new Promise((n) => {
673
666
  const o = this.materialVariantMap.get(e);
674
667
  this.materialVariantMap.set(e, {
675
668
  ...o,
676
669
  ...t
677
670
  });
678
- const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
671
+ const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
679
672
  (c) => c.name === a
680
673
  );
681
- if (l.length === 0) {
682
- s();
674
+ if (h.length === 0) {
675
+ n();
683
676
  return;
684
677
  }
685
- const h = new Ne(this.scene);
686
- h.useDefaultLoadingScreen = !1, l.forEach(
678
+ const l = new Ne(this.scene);
679
+ l.useDefaultLoadingScreen = !1, h.forEach(
687
680
  (c) => je(
688
681
  t,
689
682
  c,
690
- h,
691
- n
683
+ l,
684
+ r
692
685
  )
693
- ), h.onProgress = (c, u, m) => {
694
- i && i(c / u * 100, 100, m.name);
695
- }, h.onFinish = (c) => {
696
- c.forEach((u) => {
697
- const m = u;
698
- i && i(100, 100, u.name), this.scene.materials.filter(
686
+ ), l.onProgress = (c, m, u) => {
687
+ i && i(c / m * 100, 100, u.name);
688
+ }, l.onFinish = (c) => {
689
+ c.forEach((m) => {
690
+ const u = m;
691
+ i && i(100, 100, m.name), this.scene.materials.filter(
699
692
  (f) => f.name === a
700
693
  ).forEach((f) => {
701
- console.log(`asset manager applying texture ${u.name}`), et(
702
- u.name,
694
+ et(
695
+ m.name,
703
696
  f,
704
697
  t,
705
- m.texture
698
+ u.texture
706
699
  );
707
700
  });
708
- }), s();
709
- }, h.loadAsync();
701
+ }), n();
702
+ }, l.loadAsync();
710
703
  });
711
704
  }
712
705
  /**
@@ -719,38 +712,38 @@ class it {
719
712
  * @param getCurrentFrame A function that returns the current frame of the animation.
720
713
  * @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
721
714
  */
722
- async applyModel(e, t, i, n, s, o, a) {
723
- var u;
715
+ async applyModel(e, t, i, r, n, o, a) {
716
+ var m;
724
717
  if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
725
- return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (u = this.loadedContainerForKey.get(e)) == null || u.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
726
- (m) => m !== e
718
+ return this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.length === 1 && await this.setBaseModelEnabled(!0), (m = this.loadedContainerForKey.get(e)) == null || m.dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e), this.keysThatRemovedBaseModel = this.keysThatRemovedBaseModel.filter(
719
+ (u) => u !== e
727
720
  ), Promise.resolve(void 0);
728
- const h = (await D(i, this.scene, n)).instantiateModelsToScene(
721
+ const l = (await k(i, this.scene, r)).instantiateModelsToScene(
729
722
  this.renameClonedAsset,
730
723
  !0
731
724
  );
732
- if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), s) {
733
- const m = o && o(), g = s.name ? this.renameClonedAsset(s.name) : void 0;
725
+ if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), n) {
726
+ const u = o && o(), g = n.name ? this.renameClonedAsset(n.name) : void 0;
734
727
  if (ve(
735
- h.animationGroups,
736
- s.loop,
737
- s.to,
738
- s.from,
728
+ l.animationGroups,
729
+ n.loop,
730
+ n.to,
731
+ n.from,
739
732
  g
740
- ), m != null) {
733
+ ), u != null) {
741
734
  const f = a && a() || !0;
742
735
  Qe(
743
- h.animationGroups,
744
- m + (f ? 2 : 0),
736
+ l.animationGroups,
737
+ u + (f ? 2 : 0),
745
738
  g
746
739
  );
747
740
  }
748
741
  }
749
- t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
742
+ t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, l), this.loadedMaterialsForKey.set(e, we(l));
750
743
  const c = [];
751
- return this.materialVariantMap.forEach(async (m, g) => {
752
- c.push(this.applyMaterial(g, m));
753
- }), await Promise.all(c), h;
744
+ return this.materialVariantMap.forEach(async (u, g) => {
745
+ c.push(this.applyMaterial(g, u));
746
+ }), await Promise.all(c), l;
754
747
  }
755
748
  dispose() {
756
749
  this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
@@ -772,19 +765,19 @@ class it {
772
765
  }), e;
773
766
  }
774
767
  }
775
- function we(r) {
768
+ function we(s) {
776
769
  const e = [];
777
- return r.rootNodes.forEach((t) => {
770
+ return s.rootNodes.forEach((t) => {
778
771
  t.getChildMeshes().forEach((i) => {
779
- i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((n) => {
780
- const s = n.getMaterial(!1);
781
- s && !e.includes(s) && e.push(s);
772
+ i.material && !e.includes(i.material) && e.push(i.material), i.subMeshes && i.subMeshes.forEach((r) => {
773
+ const n = r.getMaterial(!1);
774
+ n && !e.includes(n) && e.push(n);
782
775
  });
783
776
  });
784
777
  }), e;
785
778
  }
786
- function pe(r, e = "") {
787
- return r.map((t) => ({
779
+ function pe(s, e = "") {
780
+ return s.map((t) => ({
788
781
  name: t.name.substring(e.length),
789
782
  loop: t.loopAnimation,
790
783
  to: t.to,
@@ -797,11 +790,11 @@ class nt {
797
790
  const {
798
791
  enablePicking: t,
799
792
  modelDetails: i,
800
- previewService: n,
801
- progressHandler: s,
793
+ previewService: r,
794
+ progressHandler: n,
802
795
  scene: o
803
796
  } = e;
804
- this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = n, this.scene = o, this.variantManager = new it(
797
+ this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = r, this.scene = o, this.variantManager = new it(
805
798
  o,
806
799
  this.renameClonedAsset.bind(this),
807
800
  this.setBaseModelEnabled.bind(this)
@@ -811,16 +804,16 @@ class nt {
811
804
  throw new Error(
812
805
  "Model container constructed with no URL. This is currently unsupported."
813
806
  );
814
- return this.assetContainer = await D(
807
+ return this.assetContainer = await k(
815
808
  i.model,
816
809
  o,
817
- s
810
+ n
818
811
  ), await this.instantiate(), this;
819
812
  };
820
813
  this.importPromise = a();
821
814
  }
822
815
  //#region Interface implementation
823
- async applyMaterialVariant(e, t, i, n) {
816
+ async applyMaterialVariant(e, t, i, r) {
824
817
  if (!this.initialized) {
825
818
  if (this.materialReadyToLoadCallbacks.has(e)) {
826
819
  const o = this.materialReadyToLoadCallbacks.get(e);
@@ -831,7 +824,7 @@ class nt {
831
824
  e,
832
825
  t,
833
826
  i,
834
- n
827
+ r
835
828
  )
836
829
  );
837
830
  } else {
@@ -847,41 +840,41 @@ class nt {
847
840
  e,
848
841
  t,
849
842
  i,
850
- n
843
+ r
851
844
  )
852
845
  );
853
846
  }
854
847
  return;
855
848
  }
856
- const s = async () => {
849
+ const n = async () => {
857
850
  await this.variantManager.applyMaterial(
858
851
  e,
859
852
  i,
860
- (o, a, l) => {
853
+ (o, a, h) => {
861
854
  this.materialVariantObservable.notifyObservers({
862
855
  remainingCount: o,
863
856
  totalCount: a,
864
- taskName: l
857
+ taskName: h
865
858
  });
866
859
  },
867
- n
860
+ r
868
861
  );
869
862
  };
870
863
  if (this.materialChangesInProgress.includes(e)) {
871
864
  if (this.queuedMaterialChanges.has(e)) {
872
865
  const o = this.queuedMaterialChanges.get(e);
873
- o == null || o.set(t, s);
866
+ o == null || o.set(t, n);
874
867
  } else {
875
868
  this.queuedMaterialChanges.set(
876
869
  e,
877
870
  /* @__PURE__ */ new Map()
878
871
  );
879
872
  const o = this.queuedMaterialChanges.get(e);
880
- o == null || o.set(t, s);
873
+ o == null || o.set(t, n);
881
874
  }
882
875
  return;
883
876
  }
884
- if (this.materialChangesInProgress.push(e), await s(), this.queuedMaterialChanges.has(e)) {
877
+ if (this.materialChangesInProgress.push(e), await n(), this.queuedMaterialChanges.has(e)) {
885
878
  const o = this.queuedMaterialChanges.get(e);
886
879
  if (!o)
887
880
  throw new Error("Target material is undefined");
@@ -907,7 +900,7 @@ class nt {
907
900
  );
908
901
  return;
909
902
  }
910
- const n = () => this.variantManager.applyModel(
903
+ const r = () => this.variantManager.applyModel(
911
904
  e,
912
905
  i,
913
906
  t == null ? void 0 : t.model,
@@ -922,17 +915,17 @@ class nt {
922
915
  this.getAnimationIsPlaying.bind(this)
923
916
  );
924
917
  if (this.modelChangesInProgress.includes(e)) {
925
- this.queuedModelChanges.set(e, n);
918
+ this.queuedModelChanges.set(e, r);
926
919
  return;
927
920
  }
928
921
  const o = await (async () => {
929
922
  this.modelChangesInProgress.push(e);
930
- let a = await n();
923
+ let a = await r();
931
924
  if (this.queuedModelChanges.has(e)) {
932
- const l = this.queuedModelChanges.get(e);
933
- if (!l)
925
+ const h = this.queuedModelChanges.get(e);
926
+ if (!h)
934
927
  throw new Error("Queued change resolved undefined");
935
- a = await l(), this.queuedModelChanges.delete(e);
928
+ a = await h(), this.queuedModelChanges.delete(e);
936
929
  }
937
930
  return this.modelChangesInProgress.splice(
938
931
  this.modelChangesInProgress.indexOf(e),
@@ -951,24 +944,24 @@ class nt {
951
944
  let t = () => {
952
945
  };
953
946
  const i = async () => {
954
- this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((n) => {
947
+ this.lastPlayedAnimation = e, this.isExecutingAnimation = !0, await new Promise((r) => {
955
948
  var o;
956
- const s = [
949
+ const n = [
957
950
  ...((o = this.modelInstance) == null ? void 0 : o.animationGroups) || [],
958
951
  ...this.variantManager.getAnimationGroups()
959
952
  ];
960
953
  ve(
961
- s,
954
+ n,
962
955
  e.loop,
963
956
  e.to,
964
957
  e.from,
965
958
  e.name ? this.renameClonedAsset(e.name) : void 0,
966
- n
959
+ r
967
960
  );
968
961
  }), this.isExecutingAnimation = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
969
962
  };
970
- return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((n) => {
971
- t = n;
963
+ return this.isExecutingAnimation ? (this.queuedAnimationFunction = i, new Promise((r) => {
964
+ t = r;
972
965
  })) : i();
973
966
  }
974
967
  getAnimations(e) {
@@ -978,7 +971,7 @@ class nt {
978
971
  this.variantManager.getAnimationGroups(),
979
972
  this.renameClonedAsset("")
980
973
  ) : []
981
- ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, n) => n.indexOf(n.find((s) => s.name === t.name)) == i);
974
+ ].map((t, i) => ({ ...t, name: t.name || `UNNAMED_ANIMATION_${i}` })).filter((t, i, r) => r.indexOf(r.find((n) => n.name === t.name)) == i);
982
975
  }
983
976
  getId() {
984
977
  return this.id;
@@ -1046,14 +1039,14 @@ class nt {
1046
1039
  e.rootNodes.forEach((t) => {
1047
1040
  t.getChildMeshes(!1).forEach((i) => {
1048
1041
  i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
1049
- new oe(R.OnPointerOverTrigger, (n) => {
1050
- n.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
1042
+ new le(R.OnPointerOverTrigger, (r) => {
1043
+ r.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
1051
1044
  id: i.material.id,
1052
1045
  name: this.stripIdFromName(i.material.name)
1053
1046
  });
1054
1047
  })
1055
1048
  ), i.actionManager.registerAction(
1056
- new oe(R.OnPointerOutTrigger, () => {
1049
+ new le(R.OnPointerOutTrigger, () => {
1057
1050
  i.material && this.materialDeselectedObservable.notifyObservers({
1058
1051
  id: i.material.id,
1059
1052
  name: this.stripIdFromName(i.material.name)
@@ -1082,23 +1075,23 @@ class nt {
1082
1075
  return this.modelReadyToLoadCallbacks.size;
1083
1076
  }
1084
1077
  configureGlowLayer() {
1085
- const e = (i) => i instanceof B && i.emissiveTexture !== null;
1078
+ const e = (i) => i instanceof D && i.emissiveTexture !== null;
1086
1079
  this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
1087
1080
  }
1088
1081
  configureModelInstance(e) {
1089
- var s;
1082
+ var n;
1090
1083
  if (!this.transformRoot)
1091
1084
  throw new Error(
1092
1085
  "Transform disposed! This should never happen unless there is a race condition present!"
1093
1086
  );
1094
- const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, n = this.transformRoot.scaling;
1087
+ const t = this.transformRoot.position, i = this.transformRoot.rotationQuaternion, r = this.transformRoot.scaling;
1095
1088
  this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
1096
1089
  for (const o of e.rootNodes) {
1097
1090
  o.parent = this.transformRoot;
1098
1091
  for (const a of o.getChildMeshes(!1))
1099
1092
  a.alwaysSelectAsActiveMesh = !0;
1100
1093
  }
1101
- this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = n, this.canvasPanels = ((s = this.contextService) == null ? void 0 : s.getAll()) || /* @__PURE__ */ new Map(), He(
1094
+ this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = r, this.canvasPanels = ((n = this.contextService) == null ? void 0 : n.getAll()) || /* @__PURE__ */ new Map(), He(
1102
1095
  this.materials.concat(this.variantManager.getAllMaterials()),
1103
1096
  this.scene,
1104
1097
  this.canvasPanels,
@@ -1142,8 +1135,8 @@ class nt {
1142
1135
  var e;
1143
1136
  (e = this.canvasPanels) == null || e.forEach(
1144
1137
  (t, i) => {
1145
- const n = this.dynamicTextures.get(i);
1146
- n && t.getStaticContextDirty() && n.isReady() && (n.update(!1), t.setStaticContextDirty(!1));
1138
+ const r = this.dynamicTextures.get(i);
1139
+ r && t.getStaticContextDirty() && r.isReady() && (r.update(!1), t.setStaticContextDirty(!1));
1147
1140
  }
1148
1141
  );
1149
1142
  }
@@ -1201,16 +1194,16 @@ class nt {
1201
1194
  }
1202
1195
  //#endregion
1203
1196
  }
1204
- class k extends fe {
1205
- constructor(e, t, i, n, s, o, a, l) {
1197
+ class z extends fe {
1198
+ constructor(e, t, i, r, n, o, a, h) {
1206
1199
  super(
1207
1200
  e,
1208
1201
  t,
1209
1202
  i,
1203
+ r,
1210
1204
  n,
1211
- s,
1212
1205
  o,
1213
- l
1206
+ h
1214
1207
  ), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, this.panEnabled = !0, this.minZ = 0.01, this.updateRadiusBounds(this.radius), this.enableFramingBehavior(), this.wheelDeltaPercentage = 0.01, this.pinchDeltaPercentage = 5e-3, this.useNaturalPinchZoom = !0, a.camera.autoOrientation && (this.alpha += Math.PI), a && (a.camera.limits.min.beta && (this.lowerBetaLimit = a.camera.limits.min.beta), a.camera.limits.max.beta && (this.upperBetaLimit = a.camera.limits.max.beta), a.camera.limits.min.alpha && (this.lowerAlphaLimit = a.camera.limits.min.alpha), a.camera.limits.max.alpha && (this.upperAlphaLimit = a.camera.limits.max.alpha), a.camera.limits.min.radius && (this.lowerRadiusLimit = a.camera.limits.min.radius), a.camera.limits.max.radius && (this.upperRadiusLimit = a.camera.limits.max.radius), a.camera.autoRotation.enabled && this.enableAutoRotationBehavior(
1215
1208
  a.camera.autoRotation.idleTimeMs
1216
1209
  ));
@@ -1252,7 +1245,7 @@ class k extends fe {
1252
1245
  this.useFramingBehavior = !0;
1253
1246
  const e = this.getFramingBehavior();
1254
1247
  e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
1255
- const t = T(this._scene);
1248
+ const t = O(this._scene);
1256
1249
  return e.zoomOnBoundingInfo(t.min, t.max), this.wheelPrecision = 100 / this.radius, this.lowerRadiusLimit === null && (this.lowerRadiusLimit = 0.1), this.lastFocus.copyFrom(this.target), e;
1257
1250
  }
1258
1251
  /**
@@ -1264,14 +1257,14 @@ class k extends fe {
1264
1257
  this._isRunningFramingBehavior = !0, this.framingBehaviourCallback = e;
1265
1258
  const i = this.getFramingBehavior();
1266
1259
  i.framingTime = t || 800;
1267
- const n = () => {
1260
+ const r = () => {
1268
1261
  this.isRunningFramingBehavior = !1;
1269
- }, s = T(this._scene), o = s.max.subtract(s.min), a = s.min.add(o.scale(0.5));
1262
+ }, n = O(this._scene), o = n.max.subtract(n.min), a = n.min.add(o.scale(0.5));
1270
1263
  this.updateRadiusBounds(o.length() * 1.5), this.wheelPrecision = 100 / this.radius, this.panningInertia = 0, this.panningOriginTarget.copyFrom(a), this.panDenominator = o.length(), this.lastFocus.copyFrom(a), i.zoomOnBoundingInfo(
1271
- s.min,
1272
- s.max,
1264
+ n.min,
1265
+ n.max,
1273
1266
  void 0,
1274
- n
1267
+ r
1275
1268
  ), i.framingTime = 0;
1276
1269
  }
1277
1270
  /**
@@ -1302,31 +1295,31 @@ class k extends fe {
1302
1295
  * @param disablePan If true the camera will not allow panning.
1303
1296
  */
1304
1297
  static create(e, t, i) {
1305
- var l;
1306
- const n = T(e), s = n.max.subtract(n.min), o = n.min.add(s.scale(0.5)), a = new k(
1298
+ var h;
1299
+ const r = O(e), n = r.max.subtract(r.min), o = r.min.add(n.scale(0.5)), a = new z(
1307
1300
  "ProductCamera",
1308
1301
  -(Math.PI / 2),
1309
1302
  Math.PI / 2,
1310
- s.length() * 1.5,
1303
+ n.length() * 1.5,
1311
1304
  o,
1312
1305
  e,
1313
1306
  t
1314
1307
  );
1315
1308
  return a.setPanEnabled(
1316
- ((l = t.options) == null ? void 0 : l.noPan) !== void 0 ? !t.options.noPan : !0
1317
- ), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = s.length(), a.onAfterCheckInputsObservable.addOnce(() => {
1309
+ ((h = t.options) == null ? void 0 : h.noPan) !== void 0 ? !t.options.noPan : !0
1310
+ ), a.panningInertia = 0, a.panningOriginTarget.copyFrom(o), a.panDenominator = n.length(), a.onAfterCheckInputsObservable.addOnce(() => {
1318
1311
  a.setPanEnabled(a.panEnabled);
1319
1312
  }), i && (e.activeCamera = a), a;
1320
1313
  }
1321
1314
  }
1322
- function T(r) {
1323
- if (r.meshes.length === 0)
1315
+ function O(s) {
1316
+ if (s.meshes.length === 0)
1324
1317
  return {
1325
1318
  min: new p(-1, -1, -1),
1326
1319
  max: new p(1, 1, 1)
1327
1320
  };
1328
- const e = r.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1329
- return r.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1321
+ const e = s.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1322
+ return s.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1330
1323
  }
1331
1324
  class st {
1332
1325
  constructor(e, t = !1, i = void 0) {
@@ -1346,15 +1339,15 @@ class st {
1346
1339
  return this.currentConfiguration;
1347
1340
  }
1348
1341
  setConfiguration(e) {
1349
- var t, i, n, s, o, a, l, h, c, u, m, g, f, z, N, q, V, _, G, H, U, K, W, $, Y, Q, Z, j, X, J, ee, te, ie;
1342
+ var t, i, r, n, o, a, h, l, c, m, u, g, f, N, q, V, _, G, H, U, K, W, Y, $, Q, Z, j, X, J, ee, te, ie, ne;
1350
1343
  if (this.renderingPipeline.isSupported) {
1351
- if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((n = e.bloom) == null ? void 0 : n.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((s = e.bloom) == null ? void 0 : s.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((h = e.chromaticAberration) == null ? void 0 : h.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new se(
1344
+ if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? d.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? d.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((r = e.bloom) == null ? void 0 : r.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((n = e.bloom) == null ? void 0 : n.kernel) ?? d.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? d.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? d.bloom.threshold, this.renderingPipeline.bloomWeight = ((h = e.bloom) == null ? void 0 : h.weight) ?? d.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((l = e.chromaticAberration) == null ? void 0 : l.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((c = e.chromaticAberration) == null ? void 0 : c.aberrationAmount) ?? d.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((m = e.chromaticAberration) == null ? void 0 : m.radialIntensity) ?? d.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (u = e.chromaticAberration) != null && u.direction ? new re(
1352
1345
  e.chromaticAberration.direction.x,
1353
1346
  e.chromaticAberration.direction.y
1354
- ) : new se(
1347
+ ) : new re(
1355
1348
  d.chromaticAberration.direction.x,
1356
1349
  d.chromaticAberration.direction.y
1357
- ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new le(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
1350
+ ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? d.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new he(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
1358
1351
  switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
1359
1352
  case "Low":
1360
1353
  this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
@@ -1366,7 +1359,7 @@ class st {
1366
1359
  this.renderingPipeline.depthOfFieldBlurLevel = E.High;
1367
1360
  break;
1368
1361
  }
1369
- if (this.renderingPipeline.depthOfField.focalLength = ((z = e.depthOfField) == null ? void 0 : z.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((N = e.depthOfField) == null ? void 0 : N.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((q = e.depthOfField) == null ? void 0 : q.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((V = e.depthOfField) == null ? void 0 : V.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((_ = e.grain) == null ? void 0 : _.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((H = e.grain) == null ? void 0 : H.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((U = e.misc) == null ? void 0 : U.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((W = e.misc) == null ? void 0 : W.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1362
+ if (this.renderingPipeline.depthOfField.focalLength = ((N = e.depthOfField) == null ? void 0 : N.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((q = e.depthOfField) == null ? void 0 : q.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((_ = e.depthOfField) == null ? void 0 : _.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((H = e.grain) == null ? void 0 : H.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((U = e.grain) == null ? void 0 : U.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((K = e.misc) == null ? void 0 : K.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((W = e.misc) == null ? void 0 : W.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((Y = e.misc) == null ? void 0 : Y.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1370
1363
  switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
1371
1364
  case "Standard":
1372
1365
  this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_STANDARD;
@@ -1375,8 +1368,8 @@ class st {
1375
1368
  this.renderingPipeline.imageProcessing.toneMappingType = x.TONEMAPPING_ACES;
1376
1369
  break;
1377
1370
  }
1378
- if (this.renderingPipeline.sharpenEnabled = (($ = e.sharpen) == null ? void 0 : $.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? d.vignette.enabled, (j = e.vignette) != null && j.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
1379
- switch (((X = e.vignette) == null ? void 0 : X.blendMode) ?? d.vignette.blendMode) {
1371
+ if (this.renderingPipeline.sharpenEnabled = (($ = e.sharpen) == null ? void 0 : $.enabled) ?? d.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Q = e.sharpen) == null ? void 0 : Q.colorAmount) ?? d.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Z = e.sharpen) == null ? void 0 : Z.edgeAmount) ?? d.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((j = e.vignette) == null ? void 0 : j.enabled) ?? d.vignette.enabled, (X = e.vignette) != null && X.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = d.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = d.vignette.center.y), e.vignette)
1372
+ switch (((J = e.vignette) == null ? void 0 : J.blendMode) ?? d.vignette.blendMode) {
1380
1373
  case "Multiply":
1381
1374
  this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_MULTIPLY;
1382
1375
  break;
@@ -1384,57 +1377,57 @@ class st {
1384
1377
  this.renderingPipeline.imageProcessing.vignetteBlendMode = x.VIGNETTEMODE_OPAQUE;
1385
1378
  break;
1386
1379
  }
1387
- (J = e.vignette) != null && J.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
1380
+ (ee = e.vignette) != null && ee.colorRgba ? this.renderingPipeline.imageProcessing.vignetteColor = new b(
1388
1381
  e.vignette.colorRgba.r,
1389
1382
  e.vignette.colorRgba.g,
1390
1383
  e.vignette.colorRgba.b,
1391
1384
  e.vignette.colorRgba.a
1392
- ) : (ee = e.vignette) != null && ee.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
1385
+ ) : (te = e.vignette) != null && te.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
1393
1386
  d.vignette.colorRgba.r,
1394
1387
  d.vignette.colorRgba.g,
1395
1388
  d.vignette.colorRgba.b,
1396
1389
  d.vignette.colorRgba.a
1397
- ), this.renderingPipeline.imageProcessing.vignetteStretch = ((te = e.vignette) == null ? void 0 : te.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ie = e.vignette) == null ? void 0 : ie.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1390
+ ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ie = e.vignette) == null ? void 0 : ie.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((ne = e.vignette) == null ? void 0 : ne.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1398
1391
  }
1399
1392
  }
1400
1393
  updateColorCurve(e) {
1401
- const t = new le();
1394
+ const t = new he();
1402
1395
  return t.globalDensity = e.globalDensity ?? t.globalDensity, t.globalExposure = e.globalExposure ?? t.globalExposure, t.globalHue = e.globalHue ?? t.globalHue, t.globalSaturation = e.globalSaturation ?? t.globalSaturation, t.highlightsDensity = e.highlightsDensity ?? t.highlightsDensity, t.highlightsExposure = e.highlightsExposure ?? t.highlightsExposure, t.highlightsHue = e.highlightsHue ?? t.highlightsHue, t.highlightsSaturation = e.highlightsSaturation ?? t.highlightsSaturation, t.midtonesDensity = e.midtonesDensity ?? t.midtonesDensity, t.midtonesExposure = e.midtonesExposure ?? t.midtonesExposure, t.midtonesHue = e.midtonesHue ?? t.midtonesHue, t.midtonesSaturation = e.midtonesSaturation ?? t.midtonesSaturation, t.shadowsDensity = e.shadowsDensity ?? t.shadowsDensity, t.shadowsExposure = e.shadowsExposure ?? t.shadowsExposure, t.shadowsHue = e.shadowsHue ?? t.shadowsHue, t.shadowsSaturation = e.shadowsSaturation ?? t.shadowsSaturation, t;
1403
1396
  }
1404
1397
  }
1405
- Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(r) {
1406
- return new _e(r);
1398
+ Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(s) {
1399
+ return new _e(s);
1407
1400
  });
1408
- S.OnPluginActivatedObservable.add((r) => {
1409
- if (r.name === "gltf") {
1410
- const e = r;
1401
+ B.OnPluginActivatedObservable.add((s) => {
1402
+ if (s.name === "gltf") {
1403
+ const e = s;
1411
1404
  e.transparencyAsCoverage = !0;
1412
1405
  }
1413
1406
  });
1414
- function O(r) {
1415
- return new p(r.x, r.y, r.z);
1407
+ function L(s) {
1408
+ return new p(s.x, s.y, s.z);
1416
1409
  }
1417
- function L(r) {
1418
- return { x: r.x, y: r.y, z: r.z };
1410
+ function I(s) {
1411
+ return { x: s.x, y: s.y, z: s.z };
1419
1412
  }
1420
- class $t {
1413
+ class Yt {
1421
1414
  constructor(e) {
1422
- var l;
1415
+ var h;
1423
1416
  this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
1424
1417
  if (!this.engine.views)
1425
1418
  return;
1426
- this.modelContainers.forEach((u) => {
1427
- u.updateDynamicTextures();
1419
+ this.modelContainers.forEach((m) => {
1420
+ m.updateDynamicTextures();
1428
1421
  }), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0;
1429
- const h = this.engine.getRenderingCanvas();
1430
- if (h)
1431
- if (h.getContext("webgl2") ?? h.getContext("webgl")) {
1432
- const u = this.configuration.scene.clearColor, m = h.getContext("webgl2") ?? h.getContext("webgl");
1433
- m.clearDepth(1), m.depthFunc(m.LEQUAL), m.clearStencil(0), m.clearColor(u.r, u.g, u.b, u.a), m.clear(
1434
- m.COLOR_BUFFER_BIT | m.DEPTH_BUFFER_BIT | m.STENCIL_BUFFER_BIT
1422
+ const l = this.engine.getRenderingCanvas();
1423
+ if (l)
1424
+ if (l.getContext("webgl2") ?? l.getContext("webgl")) {
1425
+ const m = this.configuration.scene.clearColor, u = l.getContext("webgl2") ?? l.getContext("webgl");
1426
+ u.clearDepth(1), u.depthFunc(u.LEQUAL), u.clearStencil(0), u.clearColor(m.r, m.g, m.b, m.a), u.clear(
1427
+ u.COLOR_BUFFER_BIT | u.DEPTH_BUFFER_BIT | u.STENCIL_BUFFER_BIT
1435
1428
  );
1436
1429
  } else
1437
- h.getContext("2d") ? h.getContext("2d").clearRect(0, 0, h.width, h.height) : console.error(
1430
+ l.getContext("2d") ? l.getContext("2d").clearRect(0, 0, l.width, l.height) : console.error(
1438
1431
  "SpiffCommerce: Failed to get any context on the rendering canvas."
1439
1432
  );
1440
1433
  this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
@@ -1444,15 +1437,15 @@ class $t {
1444
1437
  const i = (() => {
1445
1438
  if (!(e != null && e.noRender))
1446
1439
  return this.configuration.createCanvas();
1447
- })(), n = "1.5.6";
1448
- Ae.Configuration = {
1440
+ })(), r = "1.5.6";
1441
+ Me.Configuration = {
1449
1442
  decoder: {
1450
- wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_wasm_wrapper_gltf.js`,
1451
- wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_decoder_gltf.wasm`,
1452
- fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${n}/draco_decoder_gltf.js`
1443
+ wasmUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_wasm_wrapper_gltf.js`,
1444
+ wasmBinaryUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.wasm`,
1445
+ fallbackUrl: `https://www.gstatic.com/draco/versioned/decoders/${r}/draco_decoder_gltf.js`
1453
1446
  }
1454
1447
  }, i && (i.getContext("webgl2") || i.getContext("webgl"));
1455
- const s = console.log;
1448
+ const n = console.log;
1456
1449
  console.log = () => {
1457
1450
  };
1458
1451
  const o = i ? new be(i, !0, {
@@ -1464,23 +1457,23 @@ class $t {
1464
1457
  stencil: this.configuration.highlights.enabled,
1465
1458
  forceSRGBBufferSupportState: !0
1466
1459
  }) : new Ce();
1467
- console.log = s, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
1460
+ console.log = n, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new xe(o), this.camera = z.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
1468
1461
  this.scene,
1469
1462
  !1,
1470
1463
  this.camera
1471
1464
  ), this.scene.clearColor = this.configuration.scene.clearColor;
1472
- const a = ne.CreateFromPrefilteredData(
1465
+ const a = se.CreateFromPrefilteredData(
1473
1466
  this.configuration.scene.environment.file,
1474
1467
  this.scene
1475
1468
  );
1476
- a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (l = this.configuration.options) != null && l.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1469
+ a.name = "initial-environment-cube", a.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = a, this.scene.environmentIntensity = this.configuration.scene.environment.intensity, (h = this.configuration.options) != null && h.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1477
1470
  this.configuration.options.renderingPipelineConfiguration
1478
1471
  ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new Ge(
1479
1472
  this.scene,
1480
1473
  this.configuration.emissiveGlowIntensity
1481
- ), this.initPromise = new Promise((h) => {
1474
+ ), this.initPromise = new Promise((l) => {
1482
1475
  this.scene.onReadyObservable.addOnce(() => {
1483
- this.initComplete = !0, h();
1476
+ this.initComplete = !0, l();
1484
1477
  });
1485
1478
  }), this.engine.runRenderLoop(this.renderLoop);
1486
1479
  }
@@ -1512,7 +1505,7 @@ class $t {
1512
1505
  }
1513
1506
  registerView(e) {
1514
1507
  const t = e.height, i = e.width;
1515
- this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(I.Pan), this.reattachControls(e);
1508
+ this.engine.registerView(e, void 0, !0), e.setAttribute("height", t.toString()), e.setAttribute("width", i.toString()), this.orbitEnabled() || this.setCameraState(F.Pan), this.reattachControls(e);
1516
1509
  }
1517
1510
  getNumViewports() {
1518
1511
  var e;
@@ -1525,19 +1518,19 @@ class $t {
1525
1518
  this.plugins.forEach((e) => e.dispose(!0)), this.renderingPipeline.dispose(), this.engine && this.engine.dispose(), window.removeEventListener("resize", this.fireResizeEvent);
1526
1519
  }
1527
1520
  executeCameraAnimation(e) {
1528
- if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((n) => n.getIsInitialized()))
1521
+ if (!this.camera || this.scene.activeCamera !== this.camera || this.getAllModels().length === 0 || !this.getAllModels().some((r) => r.getIsInitialized()))
1529
1522
  return this.queuedCameraAnimation = e, Promise.resolve();
1530
1523
  let t = () => {
1531
1524
  };
1532
1525
  const i = async () => {
1533
- this.isAnimatingCamera = !0, await $e(
1526
+ this.isAnimatingCamera = !0, await Ye(
1534
1527
  this.scene,
1535
1528
  this.scene.activeCamera,
1536
1529
  e
1537
1530
  ), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, t();
1538
1531
  };
1539
- return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((n) => {
1540
- t = n;
1532
+ return this.isAnimatingCamera ? (this.queuedAnimationFunction = i, new Promise((r) => {
1533
+ t = r;
1541
1534
  })) : i();
1542
1535
  }
1543
1536
  getCameraPose() {
@@ -1566,7 +1559,7 @@ class $t {
1566
1559
  throw new Error(
1567
1560
  "No views attached, camera state requires a view to attach controls onto."
1568
1561
  );
1569
- e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1562
+ e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1570
1563
  }
1571
1564
  animateToLastCameraFocus() {
1572
1565
  let e = () => {
@@ -1574,13 +1567,13 @@ class $t {
1574
1567
  const t = async () => {
1575
1568
  this.isAnimatingCamera = !0, await new Promise((i) => {
1576
1569
  this.focusLostNotified = !1;
1577
- const n = () => {
1578
- const s = this.configuration;
1570
+ const r = () => {
1571
+ const n = this.configuration;
1579
1572
  this.camera.rerunFramingBehavior(() => {
1580
- s.camera.limits.min.radius && (this.camera.lowerRadiusLimit = s.camera.limits.min.radius), s.camera.limits.max.radius && (this.camera.upperRadiusLimit = s.camera.limits.max.radius), i();
1573
+ n.camera.limits.min.radius && (this.camera.lowerRadiusLimit = n.camera.limits.min.radius), n.camera.limits.max.radius && (this.camera.upperRadiusLimit = n.camera.limits.max.radius), i();
1581
1574
  });
1582
1575
  };
1583
- this.scene.onAfterRenderObservable.addOnce(n);
1576
+ this.scene.onAfterRenderObservable.addOnce(r);
1584
1577
  }), this.isAnimatingCamera = !1, this.queuedAnimationFunction && this.queuedAnimationFunction(), this.queuedAnimationFunction = void 0, e();
1585
1578
  };
1586
1579
  return this.isAnimatingCamera ? (this.queuedAnimationFunction = t, new Promise((i) => {
@@ -1611,9 +1604,9 @@ class $t {
1611
1604
  this.scene
1612
1605
  );
1613
1606
  try {
1614
- const n = t.latDeg * Math.PI / 180, s = t.lonDeg * Math.PI / 180;
1615
- i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = s, i.beta = n, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
1616
- const o = await Me.CreateScreenshotUsingRenderTargetAsync(
1607
+ const r = t.latDeg * Math.PI / 180, n = t.lonDeg * Math.PI / 180;
1608
+ i.target = t.target ? new p(t.target.x, t.target.y, t.target.z) : p.Zero(), i.alpha = n, i.beta = r, i.radius = t.radius || this.camera.radius, i.minZ = 0.01, this.scene.render();
1609
+ const o = await Ae.CreateScreenshotUsingRenderTargetAsync(
1617
1610
  this.engine,
1618
1611
  i,
1619
1612
  e,
@@ -1630,31 +1623,31 @@ class $t {
1630
1623
  const e = this.configuration;
1631
1624
  if (!e)
1632
1625
  return !0;
1633
- const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, n = e.camera.limits.min.beta, s = e.camera.limits.max.beta;
1634
- if (t === void 0 || i === void 0 || n === void 0 || s === void 0)
1626
+ const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, r = e.camera.limits.min.beta, n = e.camera.limits.max.beta;
1627
+ if (t === void 0 || i === void 0 || r === void 0 || n === void 0)
1635
1628
  return !0;
1636
- const o = [t, i], a = [n, s], l = o.every((c) => c === t), h = a.every((c) => c === n);
1637
- return !l && !h;
1629
+ const o = [t, i], a = [r, n], h = o.every((c) => c === t), l = a.every((c) => c === r);
1630
+ return !h && !l;
1638
1631
  }
1639
1632
  fireResizeEvent() {
1640
1633
  this.getNumViewports() > 0 && this.engine.resize();
1641
1634
  }
1642
1635
  setHighlights(e, t) {
1643
- var n;
1644
- e.length === 0 && ((n = this.highlightLayer) == null || n.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
1636
+ var r;
1637
+ e.length === 0 && ((r = this.highlightLayer) == null || r.dispose(), this.highlightLayer = void 0), this.highlightLayer || (this.highlightLayer = new ye("highlights", this.scene, {
1645
1638
  isStroke: !0,
1646
1639
  blurVerticalSize: 0.85,
1647
1640
  blurHorizontalSize: 0.85
1648
1641
  }), this.highlightLayer.innerGlow = !0, this.highlightLayer.outerGlow = !1), this.highlightLayer.removeAllMeshes();
1649
1642
  const i = t ? new w(t[0], t[1], t[2]).toLinearSpace() : void 0;
1650
- e.forEach((s) => {
1643
+ e.forEach((n) => {
1651
1644
  const o = this.scene.materials.find(
1652
- (a) => a.name === s.name && a.id === s.id
1645
+ (a) => a.name === n.name && a.id === n.id
1653
1646
  );
1654
1647
  o && o.getBindedMeshes().forEach(
1655
1648
  (a) => {
1656
- var l;
1657
- return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
1649
+ var h;
1650
+ return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
1658
1651
  a,
1659
1652
  i || w.FromHexString("#fcba03")
1660
1653
  );
@@ -1666,14 +1659,14 @@ class $t {
1666
1659
  this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
1667
1660
  }
1668
1661
  loadModel(e, t) {
1669
- const { refocusCamera: i = !0, progressHandler: n } = t ?? {}, s = new nt({
1662
+ const { refocusCamera: i = !0, progressHandler: r } = t ?? {}, n = new nt({
1670
1663
  enablePicking: this.configuration.highlights.enabled,
1671
1664
  modelDetails: e,
1672
1665
  scene: this.scene,
1673
1666
  previewService: this,
1674
- progressHandler: n
1667
+ progressHandler: r
1675
1668
  });
1676
- return s.getInitializationPromise().then(() => {
1669
+ return n.getInitializationPromise().then(() => {
1677
1670
  if (this.modelContainers.size <= 1 && i) {
1678
1671
  const o = this.queuedCameraAnimation;
1679
1672
  this.forceStopCameraAnimations(), this.camera.rerunFramingBehavior(() => {
@@ -1682,17 +1675,17 @@ class $t {
1682
1675
  });
1683
1676
  }, 1);
1684
1677
  }
1685
- }), this.configuration.highlights.enabled && (s.registerMaterialSelectedCallback((o) => {
1678
+ }), this.configuration.highlights.enabled && (n.registerMaterialSelectedCallback((o) => {
1686
1679
  this.setHighlights([o]);
1687
- }), s.registerMaterialDeselectedCallback(() => {
1680
+ }), n.registerMaterialDeselectedCallback(() => {
1688
1681
  this.setHighlights([]);
1689
- })), this.modelContainers.set(s.getId(), s), this.triggerModelLoadEvent({
1682
+ })), this.modelContainers.set(n.getId(), n), this.triggerModelLoadEvent({
1690
1683
  eventType: "load",
1691
- modelContainer: s
1692
- }), s;
1684
+ modelContainer: n
1685
+ }), n;
1693
1686
  }
1694
1687
  async preloadModel(e) {
1695
- await D(e, this.scene);
1688
+ await k(e, this.scene);
1696
1689
  }
1697
1690
  getAllModels() {
1698
1691
  return Array.from(this.modelContainers.values());
@@ -1709,7 +1702,7 @@ class $t {
1709
1702
  }
1710
1703
  unregisterPlugin(e) {
1711
1704
  const t = this.plugins.indexOf(e);
1712
- t > -1 && this.plugins.splice(t, 1).forEach((n) => n.dispose(!1));
1705
+ t > -1 && this.plugins.splice(t, 1).forEach((r) => r.dispose(!1));
1713
1706
  }
1714
1707
  getGlowLayerManager() {
1715
1708
  return this.glowLayerManager;
@@ -1727,31 +1720,31 @@ class $t {
1727
1720
  * Flips a transform around the origin.
1728
1721
  */
1729
1722
  flipTransform(e, t, i) {
1730
- const n = re.Compose(
1731
- O(i || { x: 1, y: 1, z: 1 }),
1723
+ const r = ae.Compose(
1724
+ L(i || { x: 1, y: 1, z: 1 }),
1732
1725
  y.FromEulerVector(
1733
- O(t || { x: 0, y: 0, z: 0 })
1726
+ L(t || { x: 0, y: 0, z: 0 })
1734
1727
  ),
1735
- O(e || { x: 0, y: 0, z: 0 })
1736
- ), s = re.RotationAxis(p.Up(), Math.PI), o = n.multiply(s), a = p.Zero(), l = y.Identity(), h = p.Zero();
1737
- return o.decompose(h, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1738
- position: L(a),
1739
- rotation: L(l.toEulerAngles()),
1740
- scale: L(h)
1728
+ L(e || { x: 0, y: 0, z: 0 })
1729
+ ), n = ae.RotationAxis(p.Up(), Math.PI), o = r.multiply(n), a = p.Zero(), h = y.Identity(), l = p.Zero();
1730
+ return o.decompose(l, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1731
+ position: I(a),
1732
+ rotation: I(h.toEulerAngles()),
1733
+ scale: I(l)
1741
1734
  };
1742
1735
  }
1743
1736
  updatePreviewOptions(e) {
1744
- var n, s;
1737
+ var r, n;
1745
1738
  const t = new ce(e);
1746
1739
  this.configuration.highlights.enabled !== t.highlights.enabled && this.engine.setStencilBuffer(t.highlights.enabled), this.scene.clearColor = t.scene.clearColor;
1747
1740
  let i = this.scene.environmentTexture;
1748
- this.configuration.scene.environment.file !== t.scene.environment.file && (i = ne.CreateFromPrefilteredData(
1741
+ this.configuration.scene.environment.file !== t.scene.environment.file && (i = se.CreateFromPrefilteredData(
1749
1742
  t.scene.environment.file,
1750
1743
  this.scene
1751
- ), i.name = "updated-environment-cube", i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (n = t.options) != null && n.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1744
+ ), i.name = "updated-environment-cube", i.rotationY = this.configuration.scene.environment.rotationY, this.scene.environmentTexture = i), i.rotationY = t.scene.environment.rotationY, this.scene.environmentIntensity = t.scene.environment.intensity, (r = t.options) != null && r.renderingPipelineConfiguration ? this.renderingPipeline.setConfiguration(
1752
1745
  t.options.renderingPipelineConfiguration
1753
1746
  ) : (this.scene.imageProcessingConfiguration.exposure = t.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = t.lighting.contrast), this.glowLayerManager.setIntensity(t.emissiveGlowIntensity), this.camera.updateConfiguration(t), this.camera.setPanEnabled(
1754
- ((s = t.options) == null ? void 0 : s.noPan) !== void 0 ? !t.options.noPan : !0
1747
+ ((n = t.options) == null ? void 0 : n.noPan) !== void 0 ? !t.options.noPan : !0
1755
1748
  ), this.configuration = t;
1756
1749
  }
1757
1750
  /**
@@ -1769,10 +1762,10 @@ class $t {
1769
1762
  }
1770
1763
  }
1771
1764
  export {
1772
- F as MaterialEffectMode,
1773
- I as ProductCameraRig,
1765
+ S as MaterialEffectMode,
1766
+ F as ProductCameraRig,
1774
1767
  Ve as REFLECTION_PROBE_RESOLUTION,
1775
- M as RenderingConfiguration,
1776
- $t as SpiffCommerce3DPreviewService,
1768
+ A as RenderingConfiguration,
1769
+ Yt as SpiffCommerce3DPreviewService,
1777
1770
  d as renderingPipelineDefaults
1778
1771
  };