@spiffcommerce/preview 5.3.12 → 5.3.14-0

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,21 +2,21 @@ import { ArcRotateCamera as pe } from "@babylonjs/core/Cameras/arcRotateCamera";
2
2
  import { Engine as fe } 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";
5
+ import { SceneLoader as B } from "@babylonjs/core/Loading/sceneLoader";
6
6
  import { CubeTexture as ie } from "@babylonjs/core/Materials/Textures/cubeTexture";
7
7
  import { Color4 as b, Color3 as w } from "@babylonjs/core/Maths/math.color";
8
8
  import { Vector3 as p, Quaternion as y, Vector2 as ne, Matrix as se } from "@babylonjs/core/Maths/math.vector";
9
9
  import { DracoCompression as Me } from "@babylonjs/core/Meshes/Compression/dracoCompression";
10
10
  import { Observable as C } from "@babylonjs/core/Misc/observable";
11
11
  import { Tools as xe } from "@babylonjs/core/Misc/tools";
12
- import { Scene as Pe } from "@babylonjs/core/scene";
13
- import { GLTF2 as Ae } from "@babylonjs/loaders/glTF";
14
- import { PBRMaterial as B } from "@babylonjs/core/Materials/PBR/pbrMaterial";
12
+ import { Scene as Ae } from "@babylonjs/core/scene";
13
+ import { GLTF2 as Pe } from "@babylonjs/loaders/glTF";
14
+ import { PBRMaterial as D } from "@babylonjs/core/Materials/PBR/pbrMaterial";
15
15
  import { MirrorTexture as Re } from "@babylonjs/core/Materials/Textures/mirrorTexture";
16
16
  import { Color3 as Te, Vector3 as re, Plane as Ee } from "@babylonjs/core/Maths/math";
17
17
  import { ReflectionProbe as Oe } from "@babylonjs/core/Probes/reflectionProbe";
18
18
  import { GlowLayer as Le } from "@babylonjs/core/Layers/glowLayer";
19
- import { ActionManager as R } from "@babylonjs/core/Actions/actionManager";
19
+ import { ActionManager as T } from "@babylonjs/core/Actions/actionManager";
20
20
  import { ExecuteCodeAction as ae } from "@babylonjs/core/Actions/directActions";
21
21
  import { Mesh as Ie } from "@babylonjs/core/Meshes/mesh";
22
22
  import { TransformNode as Fe } from "@babylonjs/core/Meshes/transformNode";
@@ -29,7 +29,7 @@ import { AssetsManager as Ve } from "@babylonjs/core/Misc/assetsManager";
29
29
  import { ColorCurves as oe } from "@babylonjs/core/Materials/colorCurves";
30
30
  import { ImageProcessingConfiguration as P } from "@babylonjs/core/Materials/imageProcessingConfiguration";
31
31
  import { DefaultRenderingPipeline as qe } from "@babylonjs/core/PostProcesses/RenderPipeline";
32
- import { DepthOfFieldEffectBlurLevel as T } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
32
+ import { DepthOfFieldEffectBlurLevel as E } from "@babylonjs/core/PostProcesses/depthOfFieldEffect";
33
33
  import "@babylonjs/core/Rendering/depthRendererSceneComponent";
34
34
  import "@babylonjs/core/Engines/Extensions/engine.views";
35
35
  import "@babylonjs/core/Meshes/instancedMesh";
@@ -40,7 +40,7 @@ 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__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(I || {}), F = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(F || {});
43
+ var F = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(F || {}), S = /* @__PURE__ */ ((n) => (n.None = "None", n.RemoveWhenSelected = "RemoveWhenSelected", n.ApplyWhenSelected = "ApplyWhenSelected", n))(S || {});
44
44
  class le {
45
45
  constructor(e) {
46
46
  this.getSceneClearColor = () => {
@@ -97,7 +97,7 @@ class le {
97
97
  * Configuration related to the camera used to view and interact with the scene.
98
98
  */
99
99
  get camera() {
100
- var e, t, i, s, r, o, a, h, c, l, u, m, g;
100
+ var e, t, i, s, r, o, a, l, d, h, u, m, g;
101
101
  return {
102
102
  autoOrientation: ((e = this.customOptions) == null ? void 0 : e.disableAutomaticOrientation) ?? !0,
103
103
  autoRotation: {
@@ -108,10 +108,10 @@ class le {
108
108
  min: {
109
109
  alpha: (s = this.customOptions) != null && s.lowerAlphaLimitDeg ? ((r = this.customOptions) == null ? void 0 : r.lowerAlphaLimitDeg) * Math.PI / 180 : void 0,
110
110
  beta: (o = this.customOptions) != null && o.lowerBetaLimitDeg ? ((a = this.customOptions) == null ? void 0 : a.lowerBetaLimitDeg) * Math.PI / 180 : void 0,
111
- radius: (h = this.customOptions) == null ? void 0 : h.minZoomOverride
111
+ radius: (l = this.customOptions) == null ? void 0 : l.minZoomOverride
112
112
  },
113
113
  max: {
114
- alpha: (c = this.customOptions) != null && c.upperAlphaLimitDeg ? ((l = this.customOptions) == null ? void 0 : l.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
114
+ alpha: (d = this.customOptions) != null && d.upperAlphaLimitDeg ? ((h = this.customOptions) == null ? void 0 : h.upperAlphaLimitDeg) * Math.PI / 180 : void 0,
115
115
  beta: (u = this.customOptions) != null && u.upperBetaLimitDeg ? ((m = this.customOptions) == null ? void 0 : m.upperBetaLimitDeg) * Math.PI / 180 : void 0,
116
116
  radius: (g = this.customOptions) == null ? void 0 : g.maxZoomOverride
117
117
  }
@@ -182,7 +182,7 @@ class x {
182
182
  }
183
183
  }
184
184
  }
185
- const Ge = 128, d = {
185
+ const Ne = 128, c = {
186
186
  antiAliasing: {
187
187
  samples: 4,
188
188
  fxaaEnabled: !1
@@ -239,7 +239,7 @@ const Ge = 128, d = {
239
239
  weight: 1
240
240
  }
241
241
  };
242
- class Ne {
242
+ class Ge {
243
243
  constructor(e) {
244
244
  this.name = "glbPostProcessor", this.enabled = !0, this.loader = e;
245
245
  }
@@ -283,7 +283,7 @@ class Ne {
283
283
  * @param babylonMaterial An instance of a material representation in babylon.
284
284
  */
285
285
  enableMaterialExtrasIfRequired(e, t) {
286
- if (!(!e.extras || !(t instanceof B))) {
286
+ if (!(!e.extras || !(t instanceof D))) {
287
287
  if (e.extras.sheen) {
288
288
  const i = t;
289
289
  i.sheen.isEnabled = !0, i.sheen.intensity = e.extras.sheen;
@@ -328,32 +328,32 @@ class Ne {
328
328
  const a = r.material;
329
329
  if (!a)
330
330
  return;
331
- const h = new Re(
331
+ const l = new Re(
332
332
  "mirror",
333
333
  x.getMirrorTextureResolution(),
334
334
  e,
335
335
  !0
336
336
  );
337
- h.renderList = t(e);
338
- const c = r.getVerticesData("normal");
339
- if (!c)
337
+ l.renderList = t(e);
338
+ const d = r.getVerticesData("normal");
339
+ if (!d)
340
340
  throw new Error(
341
341
  "Mirror attribute specified on: " + r.name + "But no normals exist to generate a mirror from!"
342
342
  );
343
343
  r.computeWorldMatrix(!0);
344
- const l = r.getWorldMatrix(), u = re.TransformNormal(
345
- new re(c[0], c[1], c[2]),
346
- l
344
+ const h = r.getWorldMatrix(), u = re.TransformNormal(
345
+ new re(d[0], d[1], d[2]),
346
+ h
347
347
  ).normalize(), m = Ee.FromPositionAndNormal(
348
348
  r.position,
349
349
  u.scale(-1)
350
350
  );
351
- h.mirrorPlane = m, h.level = o, a.reflectionTexture = h;
351
+ l.mirrorPlane = m, l.level = o, a.reflectionTexture = l;
352
352
  }
353
353
  function s(r) {
354
354
  const o = r.material, a = new Oe(
355
355
  "probe-" + o.name,
356
- Ge,
356
+ Ne,
357
357
  e
358
358
  );
359
359
  a.attachToMesh(r), a.renderList && a.renderList.push(...t(e)), o.reflectionTexture = a.cubeTexture;
@@ -387,47 +387,54 @@ class _e {
387
387
  }
388
388
  }
389
389
  const he = /* @__PURE__ */ new Map();
390
- async function be(n, e, t) {
391
- const i = he.get(n);
392
- if (i && i.scene.uid === e.uid)
393
- return i;
390
+ async function He(n, e) {
391
+ if (e)
392
+ return e(n).then(
393
+ (t) => new File([t], n, { type: "model/gltf-binary" })
394
+ );
395
+ }
396
+ async function be(n, e, t, i) {
397
+ const s = he.get(n);
398
+ if (s && s.scene.uid === e.uid)
399
+ return s;
394
400
  {
395
- const s = await S.LoadAssetContainerAsync(
401
+ const r = await He(n, i), o = await B.LoadAssetContainerAsync(
396
402
  n,
397
- void 0,
403
+ r,
398
404
  e,
399
- t
405
+ t,
406
+ ".glb"
400
407
  );
401
- return he.set(n, s), s;
408
+ return he.set(n, o), o;
402
409
  }
403
410
  }
404
- S.OnPluginActivatedObservable.add((n) => {
411
+ B.OnPluginActivatedObservable.add((n) => {
405
412
  n.name === "gltf" && (n.animationStartMode = Se.NONE);
406
413
  });
407
- function He(n, e, t, i, s = "") {
414
+ function Ke(n, e, t, i, s = "") {
408
415
  t.forEach((r) => {
409
- const o = r.getID(), a = r.getName(), h = x.getDynamicTextureResolution();
410
- n.filter((l) => l.name === s + a).forEach((l) => {
416
+ const o = r.getID(), a = r.getName(), l = x.getDynamicTextureResolution();
417
+ n.filter((h) => h.name === s + a).forEach((h) => {
411
418
  const u = i.get(o), m = !1;
412
419
  if (u)
413
- ce(l, u), u.update(m);
420
+ ce(h, u), u.update(m);
414
421
  else {
415
- const g = Ke(
422
+ const g = Ue(
416
423
  a,
417
424
  e,
418
- h.width,
419
- h.height
425
+ l.width,
426
+ l.height
420
427
  );
421
428
  i.set(o, g), r.setStaticContext(
422
429
  g.getContext()
423
- ), ce(l, g), g.onLoadObservable.addOnce(() => {
430
+ ), ce(h, g), g.onLoadObservable.addOnce(() => {
424
431
  g.update(m);
425
432
  });
426
433
  }
427
434
  });
428
435
  });
429
436
  }
430
- function Ke(n, e, t, i) {
437
+ function Ue(n, e, t, i) {
431
438
  const s = new Be(
432
439
  n,
433
440
  { width: t, height: i },
@@ -439,7 +446,7 @@ function Ke(n, e, t, i) {
439
446
  return r && (r.fillStyle = "#f5f5f5", r.fillRect(0, 0, t, i), s.update()), s;
440
447
  }
441
448
  function ce(n, e) {
442
- if (n instanceof B) {
449
+ if (n instanceof D) {
443
450
  const t = n, i = t.albedoTexture;
444
451
  i ? (e.wrapU = i.wrapU, e.wrapV = i.wrapV) : (e.wrapU = 1, e.wrapV = 1), t.albedoTexture = e;
445
452
  } else {
@@ -447,7 +454,7 @@ function ce(n, e) {
447
454
  i && (e.wrapU = i.wrapU, e.wrapV = i.wrapV), t.diffuseTexture = e;
448
455
  }
449
456
  }
450
- function Ue() {
457
+ function We() {
451
458
  const n = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
452
459
  return n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n();
453
460
  }
@@ -456,39 +463,39 @@ function ue(n) {
456
463
  return n.targetedAnimations.map((t) => t.animation.framePerSecond).reduce((t, i) => t + i, 0) / n.targetedAnimations.length || 0;
457
464
  }
458
465
  function ve(n, e, t, i, s, r) {
459
- const o = s ? n.filter((l) => l.name === s) : n;
466
+ const o = s ? n.filter((h) => h.name === s) : n;
460
467
  if (o.length === 0) {
461
468
  console.warn(`No animations found for name: ${s}`);
462
469
  return;
463
470
  }
464
471
  let a = 0;
465
- const h = () => {
472
+ const l = () => {
466
473
  a++, a === o.length && r && r();
467
- }, c = (l, u, m, g, f) => {
468
- l.stop(), l.start(u, m, g, f), r && (u == !1 || u === void 0 && !l.loopAnimation ? l.onAnimationGroupEndObservable.addOnce(() => {
469
- h();
470
- }) : l.onAnimationLoopObservable.addOnce(() => {
471
- h();
474
+ }, d = (h, u, m, g, f) => {
475
+ h.stop(), h.start(u, m, g, f), r && (u == !1 || u === void 0 && !h.loopAnimation ? h.onAnimationGroupEndObservable.addOnce(() => {
476
+ l();
477
+ }) : h.onAnimationLoopObservable.addOnce(() => {
478
+ l();
472
479
  }));
473
480
  };
474
481
  if (i !== void 0 && t !== void 0 && i === t) {
475
- o.forEach((l) => {
476
- const u = ue(l), m = i * u;
477
- c(l, !1, de, m, m);
482
+ o.forEach((h) => {
483
+ const u = ue(h), m = i * u;
484
+ d(h, !1, de, m, m);
478
485
  });
479
486
  return;
480
487
  }
481
- o.forEach((l) => {
482
- const u = ue(l), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
483
- c(l, e, de, m, g);
488
+ o.forEach((h) => {
489
+ const u = ue(h), m = i !== void 0 ? i * u : void 0, g = t !== void 0 ? t * u : void 0;
490
+ d(h, e, de, m, g);
484
491
  });
485
492
  }
486
- function We(n, e, t) {
493
+ function Ye(n, e, t) {
487
494
  return new Promise((i) => {
488
- n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Ye(e.alpha, 0, 2 * Math.PI));
495
+ n.stopAnimation(e), e.animations = [], Math.abs(e.alpha) > 2 * Math.PI && (e.alpha = Qe(e.alpha, 0, 2 * Math.PI));
489
496
  const s = [], r = t.target, o = 0, a = r ? 1 : 0;
490
497
  if (t.target && Object.keys(t.target).length > 0 && s.push(
491
- A(
498
+ R(
492
499
  "cameraTargetLerp",
493
500
  "target",
494
501
  new p().copyFrom(e.target),
@@ -501,7 +508,7 @@ function We(n, e, t) {
501
508
  o
502
509
  )
503
510
  ), s.push(
504
- A(
511
+ R(
505
512
  "cameraAlphaLerp",
506
513
  "alpha",
507
514
  e.alpha,
@@ -510,7 +517,7 @@ function We(n, e, t) {
510
517
  a
511
518
  )
512
519
  ), s.push(
513
- A(
520
+ R(
514
521
  "cameraBetaLerp",
515
522
  "beta",
516
523
  e.beta,
@@ -519,20 +526,20 @@ function We(n, e, t) {
519
526
  a
520
527
  )
521
528
  ), t.radius !== void 0) {
522
- const l = Math.max(0.01, t.radius);
529
+ const h = Math.max(0.01, t.radius);
523
530
  s.push(
524
- A(
531
+ R(
525
532
  "cameraRadiusLerp",
526
533
  "radius",
527
534
  e.radius,
528
- l,
535
+ h,
529
536
  v.ANIMATIONTYPE_FLOAT,
530
537
  a
531
538
  )
532
539
  );
533
540
  }
534
541
  e.animations.push(...s);
535
- const c = e.useAutoRotationBehavior;
542
+ const d = e.useAutoRotationBehavior;
536
543
  e.disableAutoRotationBehavior(), n.beginAnimation(
537
544
  e,
538
545
  0,
@@ -540,7 +547,7 @@ function We(n, e, t) {
540
547
  !1,
541
548
  1,
542
549
  () => {
543
- e.animations = [], c && e.enableAutoRotationBehavior(), i();
550
+ e.animations = [], d && e.enableAutoRotationBehavior(), i();
544
551
  }
545
552
  );
546
553
  });
@@ -548,30 +555,30 @@ function We(n, e, t) {
548
555
  function me(n) {
549
556
  return n * Math.PI / 180;
550
557
  }
551
- function A(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
558
+ function R(n, e, t, i, s, r = 0, o = v.ANIMATIONLOOPMODE_CONSTANT) {
552
559
  const a = new ke();
553
560
  a.setEasingMode(ze.EASINGMODE_EASEINOUT);
554
- const h = new v(
561
+ const l = new v(
555
562
  n,
556
563
  e,
557
564
  M,
558
565
  s,
559
566
  o
560
- ), c = [];
561
- return r > 0 && c.push({ frame: 0, value: t }), c.push({ frame: M * r, value: t }), c.push({
567
+ ), d = [];
568
+ return r > 0 && d.push({ frame: 0, value: t }), d.push({ frame: M * r, value: t }), d.push({
562
569
  frame: M * (r + 1),
563
570
  value: i
564
- }), h.setKeys(c), h.setEasingFunction(a), h;
571
+ }), l.setKeys(d), l.setEasingFunction(a), l;
565
572
  }
566
- function Ye(n, e, t) {
573
+ function Qe(n, e, t) {
567
574
  return n < e ? n = t - (e - n) % (t - e) : n = e + (n - e) % (t - e);
568
575
  }
569
- function Qe(n, e) {
570
- n.forEach((t) => {
571
- t.goToFrame(e);
576
+ function Ze(n, e, t) {
577
+ n.forEach((i) => {
578
+ t && i.name !== t || i.goToFrame(e);
572
579
  });
573
580
  }
574
- const Ze = {
581
+ const $e = {
575
582
  albedoTexture: "albedoMap",
576
583
  bumpTexture: "normalMap",
577
584
  ambientTexture: "ambientMap",
@@ -581,7 +588,7 @@ const Ze = {
581
588
  refractionTexture: "refractionMap",
582
589
  reflectionTexture: "reflectionMap"
583
590
  };
584
- function $e(n, e, t, i) {
591
+ function je(n, e, t, i) {
585
592
  [
586
593
  "albedoTexture",
587
594
  "bumpTexture",
@@ -592,17 +599,17 @@ function $e(n, e, t, i) {
592
599
  "refractionTexture",
593
600
  "reflectionTexture"
594
601
  ].forEach((r) => {
595
- je(
602
+ Xe(
596
603
  r,
597
604
  n,
598
605
  e,
599
606
  t,
600
607
  i
601
608
  );
602
- }), et(n, e);
609
+ }), tt(n, e);
603
610
  }
604
- function je(n, e, t, i, s) {
605
- const r = Ze[n];
611
+ function Xe(n, e, t, i, s) {
612
+ const r = $e[n];
606
613
  if (!r)
607
614
  throw new Error("Unexpected texture name encountered.");
608
615
  const o = e[r], a = o == null ? void 0 : o.fileLink;
@@ -620,22 +627,22 @@ function je(n, e, t, i, s) {
620
627
  !1,
621
628
  !0,
622
629
  !1
623
- ) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Xe(n, t));
630
+ ) : i.addTextureTask(n, a, !1, !1) : i.addTextureTask(n, a, !1, !1) : s && t[n] && (t[n] && t[n].dispose(), t[n] = null, Je(n, t));
624
631
  }
625
- function Xe(n, e) {
632
+ function Je(n, e) {
626
633
  n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !0), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !1, e.useMetallnessFromMetallicTextureBlue = !1), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !1, e.subSurface.refractionIntensity = 1), n === "reflectionTexture" && (e.environmentIntensity = 1), n === "emissiveTexture" && (e.emissiveIntensity = 0, e.emissiveColor = new w(0, 0, 0), e.reflectionTexture);
627
634
  }
628
- function Je(n, e, t, i) {
635
+ function et(n, e, t, i) {
629
636
  if (!e) {
630
637
  console.error("Failed to apply texture to material: material is null.");
631
638
  return;
632
639
  }
633
640
  n === "opacityTexture" && (e.useAlphaFromAlbedoTexture = !1), n === "metallicTexture" && (e.useRoughnessFromMetallicTextureAlpha = !1, e.useRoughnessFromMetallicTextureGreen = !0, e.useMetallnessFromMetallicTextureBlue = !0), n === "refractionTexture" && (e.subSurface.isRefractionEnabled = !0, e.subSurface.refractionIntensity = t.refractionIntensity || 1), n === "reflectionTexture" && (e.environmentIntensity = t.reflectionIntensity || 1, i.isCube && (i.rotationY = t.reflectionRotation ? t.reflectionRotation * Math.PI / 180 : 0)), e[n] = i, n === "emissiveTexture" && (e.emissiveColor = new w(1, 1, 1), e.emissiveIntensity = 1);
634
641
  }
635
- function et(n, e) {
636
- n.clearCoat && (n.clearCoat === F.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === F.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
642
+ function tt(n, e) {
643
+ n.clearCoat && (n.clearCoat === S.RemoveWhenSelected ? (e.clearCoat.isEnabled = !1, e.clearCoat.indexOfRefraction = 1.5) : n.clearCoat === S.ApplyWhenSelected && (e.clearCoat.isEnabled = !0, e.clearCoat.indexOfRefraction = n.clearCoatIOR || e.clearCoat.indexOfRefraction));
637
644
  }
638
- class tt {
645
+ class it {
639
646
  constructor(e, t, i) {
640
647
  this.materialVariantMap = /* @__PURE__ */ new Map(), this.keysThatRemovedBaseModel = [], this.loadedContainerForKey = /* @__PURE__ */ new Map(), this.loadedMaterialsForKey = /* @__PURE__ */ new Map(), this.scene = e, this.renameClonedAsset = t, this.setBaseModelEnabled = i;
641
648
  }
@@ -655,30 +662,30 @@ class tt {
655
662
  ...o,
656
663
  ...t
657
664
  });
658
- const a = this.renameClonedAsset(e), h = this.scene.materials.filter(
659
- (l) => l.name === a
665
+ const a = this.renameClonedAsset(e), l = this.scene.materials.filter(
666
+ (h) => h.name === a
660
667
  );
661
- if (h.length === 0) {
668
+ if (l.length === 0) {
662
669
  r();
663
670
  return;
664
671
  }
665
- const c = new Ve(this.scene);
666
- c.useDefaultLoadingScreen = !1, h.forEach(
667
- (l) => $e(
672
+ const d = new Ve(this.scene);
673
+ d.useDefaultLoadingScreen = !1, l.forEach(
674
+ (h) => je(
668
675
  t,
669
- l,
670
- c,
676
+ h,
677
+ d,
671
678
  s
672
679
  )
673
- ), c.onProgress = (l, u, m) => {
674
- i && i(l / u * 100, 100, m.name);
675
- }, c.onFinish = (l) => {
676
- l.forEach((u) => {
680
+ ), d.onProgress = (h, u, m) => {
681
+ i && i(h / u * 100, 100, m.name);
682
+ }, d.onFinish = (h) => {
683
+ h.forEach((u) => {
677
684
  const m = u;
678
685
  i && i(100, 100, u.name), this.scene.materials.filter(
679
686
  (f) => f.name === a
680
687
  ).forEach(
681
- (f) => Je(
688
+ (f) => et(
682
689
  u.name,
683
690
  f,
684
691
  t,
@@ -686,7 +693,7 @@ class tt {
686
693
  )
687
694
  );
688
695
  }), r();
689
- }, c.loadAsync();
696
+ }, d.loadAsync();
690
697
  });
691
698
  }
692
699
  /**
@@ -698,38 +705,45 @@ class tt {
698
705
  * @param lastPlayedAnimation The last played animation, this is used to ensure the animation is played on the new model.
699
706
  * @param getCurrentFrame A function that returns the current frame of the animation.
700
707
  * @param getAnimationIsPlaying A function that returns whether the animation is currently playing.
708
+ * @param loadModel A function that loads a model from a given URL.
701
709
  */
702
- async applyModel(e, t, i, s, r, o, a) {
703
- var u;
710
+ async applyModel(e, t, i, s, r, o, a, l) {
711
+ var m;
704
712
  if (i && t && !this.keysThatRemovedBaseModel.includes(e) && this.keysThatRemovedBaseModel.push(e), !i)
705
- 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(
706
- (m) => m !== e
713
+ 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(
714
+ (g) => g !== e
707
715
  ), Promise.resolve(void 0);
708
- const c = (await be(i, this.scene, s)).instantiateModelsToScene(
716
+ const h = (await be(
717
+ i,
718
+ this.scene,
719
+ s,
720
+ l
721
+ )).instantiateModelsToScene(
709
722
  this.renameClonedAsset,
710
723
  !0
711
724
  );
712
725
  if (this.loadedContainerForKey.has(e) && (this.loadedContainerForKey.get(e).dispose(), this.loadedContainerForKey.delete(e), this.loadedMaterialsForKey.delete(e)), r) {
713
- const m = o && o();
726
+ const g = o && o(), f = r.name ? this.renameClonedAsset(r.name) : void 0;
714
727
  if (ve(
715
- c.animationGroups,
728
+ h.animationGroups,
716
729
  r.loop,
717
730
  r.to,
718
731
  r.from,
719
- r.name
720
- ), m != null) {
721
- const g = a && a() || !0;
722
- Qe(
723
- c.animationGroups,
724
- m + (g ? 2 : 0)
732
+ f
733
+ ), g != null) {
734
+ const A = a && a() || !0;
735
+ Ze(
736
+ h.animationGroups,
737
+ g + (A ? 2 : 0),
738
+ f
725
739
  );
726
740
  }
727
741
  }
728
- t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, c), this.loadedMaterialsForKey.set(e, we(c));
729
- const l = [];
730
- return this.materialVariantMap.forEach(async (m, g) => {
731
- l.push(this.applyMaterial(g, m));
732
- }), await Promise.all(l), c;
742
+ t && await this.setBaseModelEnabled(!1), this.loadedContainerForKey.set(e, h), this.loadedMaterialsForKey.set(e, we(h));
743
+ const u = [];
744
+ return this.materialVariantMap.forEach(async (g, f) => {
745
+ u.push(this.applyMaterial(f, g));
746
+ }), await Promise.all(u), h;
733
747
  }
734
748
  dispose() {
735
749
  this.loadedContainerForKey.forEach((e) => e == null ? void 0 : e.dispose()), this.loadedContainerForKey.clear(), this.loadedMaterialsForKey.forEach(
@@ -770,7 +784,7 @@ function ge(n, e = "") {
770
784
  from: t.from
771
785
  }));
772
786
  }
773
- class it {
787
+ class nt {
774
788
  constructor(e) {
775
789
  this.metadata = /* @__PURE__ */ new Map(), this.materialSelectedObservable = new C(), this.materialDeselectedObservable = new C(), this.materialVariantObservable = new C(), this.modelVariantObservable = new C(), this.materialReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.modelReadyToLoadCallbacks = /* @__PURE__ */ new Map(), this.dynamicTextures = /* @__PURE__ */ new Map(), this.queuedMaterialChanges = /* @__PURE__ */ new Map(), this.materialChangesInProgress = [], this.queuedModelChanges = /* @__PURE__ */ new Map(), this.modelChangesInProgress = [], this.isExecutingAnimation = !1, this.animations = [], this.initialized = !1, this.materials = [];
776
790
  const {
@@ -780,12 +794,13 @@ class it {
780
794
  progressHandler: r,
781
795
  scene: o
782
796
  } = e;
783
- this.enablePicking = t, this.contextService = i.contextService, this.id = Ue(), this.previewService = s, this.scene = o, this.variantManager = new tt(
797
+ this.enablePicking = t, this.contextService = i.contextService, this.id = We(), this.previewService = s, this.scene = o, this.variantManager = new it(
784
798
  o,
785
799
  this.renameClonedAsset.bind(this),
786
800
  this.setBaseModelEnabled.bind(this)
787
801
  ), this.transformRoot = new Fe("root", this.scene);
788
802
  const a = async () => {
803
+ var l;
789
804
  if (!i.model)
790
805
  throw new Error(
791
806
  "Model container constructed with no URL. This is currently unsupported."
@@ -793,7 +808,8 @@ class it {
793
808
  return this.assetContainer = await be(
794
809
  i.model,
795
810
  o,
796
- r
811
+ r,
812
+ (l = this.previewService.getCurrentConfiguration()) == null ? void 0 : l.loadModel
797
813
  ), await this.instantiate(), this;
798
814
  };
799
815
  this.importPromise = a();
@@ -836,11 +852,11 @@ class it {
836
852
  await this.variantManager.applyMaterial(
837
853
  e,
838
854
  i,
839
- (o, a, h) => {
855
+ (o, a, l) => {
840
856
  this.materialVariantObservable.notifyObservers({
841
857
  remainingCount: o,
842
858
  totalCount: a,
843
- taskName: h
859
+ taskName: l
844
860
  });
845
861
  },
846
862
  s
@@ -886,20 +902,24 @@ class it {
886
902
  );
887
903
  return;
888
904
  }
889
- const s = () => this.variantManager.applyModel(
890
- e,
891
- i,
892
- t == null ? void 0 : t.model,
893
- (a) => {
894
- this.modelVariantObservable.notifyObservers({
895
- ...a,
896
- key: e
897
- });
898
- },
899
- this.lastPlayedAnimation,
900
- this.getCurrentAnimationFrame.bind(this),
901
- this.getAnimationIsPlaying.bind(this)
902
- );
905
+ const s = () => {
906
+ var a;
907
+ return this.variantManager.applyModel(
908
+ e,
909
+ i,
910
+ t == null ? void 0 : t.model,
911
+ (l) => {
912
+ this.modelVariantObservable.notifyObservers({
913
+ ...l,
914
+ key: e
915
+ });
916
+ },
917
+ this.lastPlayedAnimation,
918
+ this.getCurrentAnimationFrame.bind(this),
919
+ this.getAnimationIsPlaying.bind(this),
920
+ (a = this.previewService.getCurrentConfiguration()) == null ? void 0 : a.loadModel
921
+ );
922
+ };
903
923
  if (this.modelChangesInProgress.includes(e)) {
904
924
  this.queuedModelChanges.set(e, s);
905
925
  return;
@@ -908,10 +928,10 @@ class it {
908
928
  this.modelChangesInProgress.push(e);
909
929
  let a = await s();
910
930
  if (this.queuedModelChanges.has(e)) {
911
- const h = this.queuedModelChanges.get(e);
912
- if (!h)
931
+ const l = this.queuedModelChanges.get(e);
932
+ if (!l)
913
933
  throw new Error("Queued change resolved undefined");
914
- a = await h(), this.queuedModelChanges.delete(e);
934
+ a = await l(), this.queuedModelChanges.delete(e);
915
935
  }
916
936
  return this.modelChangesInProgress.splice(
917
937
  this.modelChangesInProgress.indexOf(e),
@@ -1024,15 +1044,15 @@ class it {
1024
1044
  attachPickingHandler(e) {
1025
1045
  e.rootNodes.forEach((t) => {
1026
1046
  t.getChildMeshes(!1).forEach((i) => {
1027
- i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new R(this.scene)), i.actionManager.registerAction(
1028
- new ae(R.OnPointerOverTrigger, (s) => {
1047
+ i.name === "targetcube_t" || i.name === "backgroundShell" || (i.actionManager || (i.actionManager = new T(this.scene)), i.actionManager.registerAction(
1048
+ new ae(T.OnPointerOverTrigger, (s) => {
1029
1049
  s.meshUnderPointer && i.material && this.materialSelectedObservable.notifyObservers({
1030
1050
  id: i.material.id,
1031
1051
  name: this.stripIdFromName(i.material.name)
1032
1052
  });
1033
1053
  })
1034
1054
  ), i.actionManager.registerAction(
1035
- new ae(R.OnPointerOutTrigger, () => {
1055
+ new ae(T.OnPointerOutTrigger, () => {
1036
1056
  i.material && this.materialDeselectedObservable.notifyObservers({
1037
1057
  id: i.material.id,
1038
1058
  name: this.stripIdFromName(i.material.name)
@@ -1061,7 +1081,7 @@ class it {
1061
1081
  return this.modelReadyToLoadCallbacks.size;
1062
1082
  }
1063
1083
  configureGlowLayer() {
1064
- const e = (i) => i instanceof B && i.emissiveTexture !== null;
1084
+ const e = (i) => i instanceof D && i.emissiveTexture !== null;
1065
1085
  this.materials.some(e) || this.variantManager.getAllMaterials().some(e) ? this.previewService.getGlowLayerManager().includeMeshes(this.getAllMeshes()) : this.previewService.getGlowLayerManager().removeMeshes(this.getAllMeshes());
1066
1086
  }
1067
1087
  configureModelInstance(e) {
@@ -1074,7 +1094,7 @@ class it {
1074
1094
  this.transformRoot.position = p.Zero(), this.transformRoot.rotationQuaternion = y.Identity(), this.transformRoot.scaling = p.One();
1075
1095
  for (const o of e.rootNodes)
1076
1096
  o.parent = this.transformRoot;
1077
- this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), He(
1097
+ this.transformRoot.position = t, this.transformRoot.rotationQuaternion = i, this.transformRoot.scaling = s, this.canvasPanels = ((r = this.contextService) == null ? void 0 : r.getAll()) || /* @__PURE__ */ new Map(), Ke(
1078
1098
  this.materials.concat(this.variantManager.getAllMaterials()),
1079
1099
  this.scene,
1080
1100
  this.canvasPanels,
@@ -1177,8 +1197,8 @@ class it {
1177
1197
  }
1178
1198
  //#endregion
1179
1199
  }
1180
- class D extends pe {
1181
- constructor(e, t, i, s, r, o, a, h) {
1200
+ class k extends pe {
1201
+ constructor(e, t, i, s, r, o, a, l) {
1182
1202
  super(
1183
1203
  e,
1184
1204
  t,
@@ -1186,7 +1206,7 @@ class D extends pe {
1186
1206
  s,
1187
1207
  r,
1188
1208
  o,
1189
- h
1209
+ l
1190
1210
  ), this.lastFocus = new p(0, 0, 0), this._isRunningFramingBehavior = !1, this.panDenominator = 1, 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(
1191
1211
  a.camera.autoRotation.idleTimeMs
1192
1212
  ));
@@ -1220,7 +1240,7 @@ class D extends pe {
1220
1240
  this.useFramingBehavior = !0;
1221
1241
  const e = this.getFramingBehavior();
1222
1242
  e.attach(this), e.framingTime = 0, e.elevationReturnTime = -1, e.zoomStopsAnimation = !1, this.lowerRadiusLimit = null;
1223
- const t = E(this._scene);
1243
+ const t = O(this._scene);
1224
1244
  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;
1225
1245
  }
1226
1246
  /**
@@ -1234,7 +1254,7 @@ class D extends pe {
1234
1254
  i.framingTime = t || 800;
1235
1255
  const s = () => {
1236
1256
  this.isRunningFramingBehavior = !1;
1237
- }, r = E(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
1257
+ }, r = O(this._scene), o = r.max.subtract(r.min), a = r.min.add(o.scale(0.5));
1238
1258
  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(
1239
1259
  r.min,
1240
1260
  r.max,
@@ -1269,7 +1289,7 @@ class D extends pe {
1269
1289
  * @param assignActive If true the camera will be assigned as the active camera on the scene.
1270
1290
  */
1271
1291
  static create(e, t, i) {
1272
- const s = E(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new D(
1292
+ const s = O(e), r = s.max.subtract(s.min), o = s.min.add(r.scale(0.5)), a = new k(
1273
1293
  "ProductCamera",
1274
1294
  -(Math.PI / 2),
1275
1295
  Math.PI / 2,
@@ -1283,7 +1303,7 @@ class D extends pe {
1283
1303
  }), i && (e.activeCamera = a), a;
1284
1304
  }
1285
1305
  }
1286
- function E(n) {
1306
+ function O(n) {
1287
1307
  if (n.meshes.length === 0)
1288
1308
  return {
1289
1309
  min: new p(-1, -1, -1),
@@ -1292,7 +1312,7 @@ function E(n) {
1292
1312
  const e = n.meshes.filter((t) => t.name.toLowerCase().endsWith("_t") || t.name.toLowerCase().includes("_t_"));
1293
1313
  return n.getWorldExtends((t) => t.isVisible && t.isEnabled() && (e.length === 0 || e.includes(t)));
1294
1314
  }
1295
- class nt {
1315
+ class st {
1296
1316
  constructor(e, t = !1, i = void 0) {
1297
1317
  this.renderingPipeline = new qe(
1298
1318
  "default",
@@ -1301,7 +1321,7 @@ class nt {
1301
1321
  i ? [i] : void 0,
1302
1322
  !1
1303
1323
  // Disable automatic build
1304
- ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(d));
1324
+ ), this.renderingPipeline.isSupported && (this.renderingPipeline.prepare(), this.setConfiguration(c));
1305
1325
  }
1306
1326
  dispose() {
1307
1327
  this.renderingPipeline.dispose();
@@ -1310,28 +1330,28 @@ class nt {
1310
1330
  return this.currentConfiguration;
1311
1331
  }
1312
1332
  setConfiguration(e) {
1313
- var t, i, s, r, o, a, h, c, l, u, m, g, f, k, z, V, q, G, N, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
1333
+ var t, i, s, r, o, a, l, d, h, u, m, g, f, A, z, V, q, N, G, _, H, K, U, W, Y, Q, Z, $, j, X, J, ee, te;
1314
1334
  if (this.renderingPipeline.isSupported) {
1315
- 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 = ((s = e.bloom) == null ? void 0 : s.enabled) ?? d.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.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 = ((c = e.chromaticAberration) == null ? void 0 : c.enabled) ?? d.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((l = e.chromaticAberration) == null ? void 0 : l.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 ne(
1335
+ if (this.renderingPipeline.samples = ((t = e.antiAliasing) == null ? void 0 : t.samples) ?? c.antiAliasing.samples, this.renderingPipeline.fxaaEnabled = ((i = e.antiAliasing) == null ? void 0 : i.fxaaEnabled) ?? c.antiAliasing.fxaaEnabled, this.renderingPipeline.bloomEnabled = ((s = e.bloom) == null ? void 0 : s.enabled) ?? c.bloom.enabled, this.renderingPipeline.bloomKernel = ((r = e.bloom) == null ? void 0 : r.kernel) ?? c.bloom.kernel, this.renderingPipeline.bloomScale = ((o = e.bloom) == null ? void 0 : o.scale) ?? c.bloom.scale, this.renderingPipeline.bloomThreshold = ((a = e.bloom) == null ? void 0 : a.threshold) ?? c.bloom.threshold, this.renderingPipeline.bloomWeight = ((l = e.bloom) == null ? void 0 : l.weight) ?? c.bloom.weight, this.renderingPipeline.chromaticAberrationEnabled = ((d = e.chromaticAberration) == null ? void 0 : d.enabled) ?? c.chromaticAberration.enabled, this.renderingPipeline.chromaticAberration.aberrationAmount = ((h = e.chromaticAberration) == null ? void 0 : h.aberrationAmount) ?? c.chromaticAberration.aberrationAmount, this.renderingPipeline.chromaticAberration.radialIntensity = ((u = e.chromaticAberration) == null ? void 0 : u.radialIntensity) ?? c.chromaticAberration.radialIntensity, this.renderingPipeline.chromaticAberration.direction = (m = e.chromaticAberration) != null && m.direction ? new ne(
1316
1336
  e.chromaticAberration.direction.x,
1317
1337
  e.chromaticAberration.direction.y
1318
1338
  ) : new ne(
1319
- d.chromaticAberration.direction.x,
1320
- d.chromaticAberration.direction.y
1321
- ), 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 oe(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? d.depthOfField.enabled, e.depthOfField)
1322
- switch (e.depthOfField.blurLevel ?? d.depthOfField.blurLevel) {
1339
+ c.chromaticAberration.direction.x,
1340
+ c.chromaticAberration.direction.y
1341
+ ), this.renderingPipeline.imageProcessing.colorCurvesEnabled = ((g = e.colorCurves) == null ? void 0 : g.enabled) ?? c.colorCurves.enabled, this.renderingPipeline.imageProcessing.colorCurves = e.colorCurves ? this.updateColorCurve(e.colorCurves) : new oe(), this.renderingPipeline.depthOfFieldEnabled = ((f = e.depthOfField) == null ? void 0 : f.enabled) ?? c.depthOfField.enabled, e.depthOfField)
1342
+ switch (e.depthOfField.blurLevel ?? c.depthOfField.blurLevel) {
1323
1343
  case "Low":
1324
- this.renderingPipeline.depthOfFieldBlurLevel = T.Low;
1344
+ this.renderingPipeline.depthOfFieldBlurLevel = E.Low;
1325
1345
  break;
1326
1346
  case "Medium":
1327
- this.renderingPipeline.depthOfFieldBlurLevel = T.Medium;
1347
+ this.renderingPipeline.depthOfFieldBlurLevel = E.Medium;
1328
1348
  break;
1329
1349
  case "High":
1330
- this.renderingPipeline.depthOfFieldBlurLevel = T.High;
1350
+ this.renderingPipeline.depthOfFieldBlurLevel = E.High;
1331
1351
  break;
1332
1352
  }
1333
- if (this.renderingPipeline.depthOfField.focalLength = ((k = e.depthOfField) == null ? void 0 : k.focalLength) ?? d.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? d.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? d.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? d.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((G = e.grain) == null ? void 0 : G.enabled) ?? d.grain.enabled, this.renderingPipeline.grain.animated = ((N = e.grain) == null ? void 0 : N.animated) ?? d.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? d.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? d.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? d.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? d.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1334
- switch (e.misc.toneMappingType ?? d.misc.toneMappingType) {
1353
+ if (this.renderingPipeline.depthOfField.focalLength = ((A = e.depthOfField) == null ? void 0 : A.focalLength) ?? c.depthOfField.focalLength, this.renderingPipeline.depthOfField.fStop = ((z = e.depthOfField) == null ? void 0 : z.fStop) ?? c.depthOfField.fStop, this.renderingPipeline.depthOfField.focusDistance = ((V = e.depthOfField) == null ? void 0 : V.focusDistance) ?? c.depthOfField.focusDistance, this.renderingPipeline.depthOfField.lensSize = ((q = e.depthOfField) == null ? void 0 : q.lensSize) ?? c.depthOfField.lensSize, this.renderingPipeline.grainEnabled = ((N = e.grain) == null ? void 0 : N.enabled) ?? c.grain.enabled, this.renderingPipeline.grain.animated = ((G = e.grain) == null ? void 0 : G.animated) ?? c.grain.animated, this.renderingPipeline.grain.intensity = ((_ = e.grain) == null ? void 0 : _.intensity) ?? c.grain.intensity, this.renderingPipeline.imageProcessing.contrast = ((H = e.misc) == null ? void 0 : H.contrast) ?? c.misc.contrast, this.renderingPipeline.imageProcessing.exposure = ((K = e.misc) == null ? void 0 : K.exposure) ?? c.misc.exposure, this.renderingPipeline.imageProcessing.toneMappingEnabled = ((U = e.misc) == null ? void 0 : U.toneMappingEnabled) ?? c.misc.toneMappingEnabled, this.renderingPipeline.imageProcessing.toneMappingEnabled)
1354
+ switch (e.misc.toneMappingType ?? c.misc.toneMappingType) {
1335
1355
  case "Standard":
1336
1356
  this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_STANDARD;
1337
1357
  break;
@@ -1339,8 +1359,8 @@ class nt {
1339
1359
  this.renderingPipeline.imageProcessing.toneMappingType = P.TONEMAPPING_ACES;
1340
1360
  break;
1341
1361
  }
1342
- if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.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, ($ = e.vignette) != null && $.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)
1343
- switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? d.vignette.blendMode) {
1362
+ if (this.renderingPipeline.sharpenEnabled = ((W = e.sharpen) == null ? void 0 : W.enabled) ?? c.sharpen.enabled, this.renderingPipeline.sharpen.colorAmount = ((Y = e.sharpen) == null ? void 0 : Y.colorAmount) ?? c.sharpen.colorAmount, this.renderingPipeline.sharpen.edgeAmount = ((Q = e.sharpen) == null ? void 0 : Q.edgeAmount) ?? c.sharpen.edgeAmount, this.renderingPipeline.imageProcessing.vignetteEnabled = ((Z = e.vignette) == null ? void 0 : Z.enabled) ?? c.vignette.enabled, ($ = e.vignette) != null && $.center ? (this.renderingPipeline.imageProcessing.vignetteCenterX = e.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = e.vignette.center.y) : (this.renderingPipeline.imageProcessing.vignetteCenterX = c.vignette.center.x, this.renderingPipeline.imageProcessing.vignetteCenterY = c.vignette.center.y), e.vignette)
1363
+ switch (((j = e.vignette) == null ? void 0 : j.blendMode) ?? c.vignette.blendMode) {
1344
1364
  case "Multiply":
1345
1365
  this.renderingPipeline.imageProcessing.vignetteBlendMode = P.VIGNETTEMODE_MULTIPLY;
1346
1366
  break;
@@ -1354,11 +1374,11 @@ class nt {
1354
1374
  e.vignette.colorRgba.b,
1355
1375
  e.vignette.colorRgba.a
1356
1376
  ) : (J = e.vignette) != null && J.colorHex ? this.renderingPipeline.imageProcessing.vignetteColor = b.FromHexString(e.vignette.colorHex) : this.renderingPipeline.imageProcessing.vignetteColor = new b(
1357
- d.vignette.colorRgba.r,
1358
- d.vignette.colorRgba.g,
1359
- d.vignette.colorRgba.b,
1360
- d.vignette.colorRgba.a
1361
- ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? d.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? d.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1377
+ c.vignette.colorRgba.r,
1378
+ c.vignette.colorRgba.g,
1379
+ c.vignette.colorRgba.b,
1380
+ c.vignette.colorRgba.a
1381
+ ), this.renderingPipeline.imageProcessing.vignetteStretch = ((ee = e.vignette) == null ? void 0 : ee.stretch) ?? c.vignette.stretch, this.renderingPipeline.imageProcessing.vignetteWeight = ((te = e.vignette) == null ? void 0 : te.weight) ?? c.vignette.weight, this.renderingPipeline.prepare(), this.currentConfiguration = e;
1362
1382
  }
1363
1383
  }
1364
1384
  updateColorCurve(e) {
@@ -1366,32 +1386,32 @@ class nt {
1366
1386
  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;
1367
1387
  }
1368
1388
  }
1369
- Ae.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1370
- return new Ne(n);
1389
+ Pe.GLTFLoader.RegisterExtension("glbPostProcessor", function(n) {
1390
+ return new Ge(n);
1371
1391
  });
1372
- S.OnPluginActivatedObservable.add((n) => {
1392
+ B.OnPluginActivatedObservable.add((n) => {
1373
1393
  if (n.name === "gltf") {
1374
1394
  const e = n;
1375
1395
  e.transparencyAsCoverage = !0;
1376
1396
  }
1377
1397
  });
1378
- function O(n) {
1398
+ function L(n) {
1379
1399
  return new p(n.x, n.y, n.z);
1380
1400
  }
1381
- function L(n) {
1401
+ function I(n) {
1382
1402
  return { x: n.x, y: n.y, z: n.z };
1383
1403
  }
1384
- class Wt {
1404
+ class Yt {
1385
1405
  constructor(e) {
1386
- var h;
1406
+ var l;
1387
1407
  this.focusLostNotified = !1, this.focusLostObservable = new C(), this.modelLoadEventCallbacks = [], this.modelContainers = /* @__PURE__ */ new Map(), this.plugins = [], this.initComplete = !1, this.isAnimatingCamera = !1, this.renderLoop = () => {
1388
1408
  if (!this.engine.views)
1389
1409
  return;
1390
- this.modelContainers.forEach((l) => {
1391
- l.updateDynamicTextures();
1410
+ this.modelContainers.forEach((h) => {
1411
+ h.updateDynamicTextures();
1392
1412
  }), this.scene.render(), this.camera.isRunningFramingBehavior && this.camera.getFramingBehavior().isUserIsMoving && (this.camera.isRunningFramingBehavior = !1);
1393
- const c = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1394
- !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, c) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
1413
+ const d = Math.max((this.camera.lowerRadiusLimit ?? 1) * 0.01, 1e-3);
1414
+ !this.camera.isRunningFramingBehavior && !this.camera.target.equalsWithEpsilon(this.camera.lastFocus, d) && !this.focusLostNotified && (this.focusLostObservable.notifyObservers(void 0), this.focusLostNotified = !0), this.screenshotPrepareResolve && (this.screenshotPrepareResolve(), this.screenshotPrepareResolve = void 0);
1395
1415
  }, this.configuration = new le(e);
1396
1416
  const i = (() => {
1397
1417
  if (!(e != null && e.noRender))
@@ -1416,7 +1436,7 @@ class Wt {
1416
1436
  stencil: this.configuration.highlights.enabled,
1417
1437
  forceSRGBBufferSupportState: !0
1418
1438
  }) : new Ce();
1419
- console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Pe(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = D.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new nt(
1439
+ console.log = r, o.hideLoadingUI(), window.addEventListener("resize", this.fireResizeEvent.bind(this)), this.engine = o, this.scene = new Ae(o), this.scene.autoClear = !0, this.scene.autoClearDepthAndStencil = !0, this.camera = k.create(this.scene, this.configuration), this.scene.activeCamera = this.camera, this.renderingPipeline = new st(
1420
1440
  this.scene,
1421
1441
  !1,
1422
1442
  this.camera
@@ -1425,14 +1445,14 @@ class Wt {
1425
1445
  this.configuration.scene.environment.file,
1426
1446
  this.scene
1427
1447
  );
1428
- 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(
1448
+ 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(
1429
1449
  this.configuration.options.renderingPipelineConfiguration
1430
1450
  ) : (this.scene.imageProcessingConfiguration.exposure = this.configuration.lighting.exposure, this.scene.imageProcessingConfiguration.contrast = this.configuration.lighting.contrast), this.glowLayerManager = new _e(
1431
1451
  this.scene,
1432
1452
  this.configuration.emissiveGlowIntensity
1433
- ), this.initPromise = new Promise((c) => {
1453
+ ), this.initPromise = new Promise((d) => {
1434
1454
  this.scene.onReadyObservable.addOnce(() => {
1435
- this.initComplete = !0, c();
1455
+ this.initComplete = !0, d();
1436
1456
  });
1437
1457
  }), this.engine.runRenderLoop(this.renderLoop);
1438
1458
  }
@@ -1464,7 +1484,7 @@ class Wt {
1464
1484
  }
1465
1485
  registerView(e) {
1466
1486
  const t = e.height, i = e.width;
1467
- 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);
1487
+ 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);
1468
1488
  }
1469
1489
  getNumViewports() {
1470
1490
  var e;
@@ -1482,7 +1502,7 @@ class Wt {
1482
1502
  let t = () => {
1483
1503
  };
1484
1504
  const i = async () => {
1485
- this.isAnimatingCamera = !0, await We(
1505
+ this.isAnimatingCamera = !0, await Ye(
1486
1506
  this.scene,
1487
1507
  this.scene.activeCamera,
1488
1508
  e
@@ -1518,7 +1538,7 @@ class Wt {
1518
1538
  throw new Error(
1519
1539
  "No views attached, camera state requires a view to attach controls onto."
1520
1540
  );
1521
- e === I.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1541
+ e === F.Orbit ? this.reattachControls(this.engine.views[0].target, 2) : this.reattachControls(this.engine.views[0].target, 0);
1522
1542
  }
1523
1543
  animateToLastCameraFocus() {
1524
1544
  let e = () => {
@@ -1581,8 +1601,8 @@ class Wt {
1581
1601
  const t = e.camera.limits.min.alpha, i = e.camera.limits.max.alpha, s = e.camera.limits.min.beta, r = e.camera.limits.max.beta;
1582
1602
  if (t === void 0 || i === void 0 || s === void 0 || r === void 0)
1583
1603
  return !0;
1584
- const o = [t, i], a = [s, r], h = o.every((l) => l === t), c = a.every((l) => l === s);
1585
- return !h && !c;
1604
+ const o = [t, i], a = [s, r], l = o.every((h) => h === t), d = a.every((h) => h === s);
1605
+ return !l && !d;
1586
1606
  }
1587
1607
  fireResizeEvent() {
1588
1608
  this.getNumViewports() > 0 && this.engine.resize();
@@ -1601,8 +1621,8 @@ class Wt {
1601
1621
  );
1602
1622
  o && o.getBindedMeshes().forEach(
1603
1623
  (a) => {
1604
- var h;
1605
- return (h = this.highlightLayer) == null ? void 0 : h.addMesh(
1624
+ var l;
1625
+ return (l = this.highlightLayer) == null ? void 0 : l.addMesh(
1606
1626
  a,
1607
1627
  i || w.FromHexString("#fcba03")
1608
1628
  );
@@ -1614,7 +1634,7 @@ class Wt {
1614
1634
  this.renderingPipeline && this.renderingPipeline.setConfiguration(e);
1615
1635
  }
1616
1636
  loadModel(e, t) {
1617
- const i = new it({
1637
+ const i = new nt({
1618
1638
  enablePicking: this.configuration.highlights.enabled,
1619
1639
  modelDetails: e,
1620
1640
  scene: this.scene,
@@ -1670,16 +1690,16 @@ class Wt {
1670
1690
  */
1671
1691
  flipTransform(e, t, i) {
1672
1692
  const s = se.Compose(
1673
- O(i || { x: 1, y: 1, z: 1 }),
1693
+ L(i || { x: 1, y: 1, z: 1 }),
1674
1694
  y.FromEulerVector(
1675
- O(t || { x: 0, y: 0, z: 0 })
1695
+ L(t || { x: 0, y: 0, z: 0 })
1676
1696
  ),
1677
- O(e || { x: 0, y: 0, z: 0 })
1678
- ), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), h = y.Identity(), c = p.Zero();
1679
- return o.decompose(c, h, a), h.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1680
- position: L(a),
1681
- rotation: L(h.toEulerAngles()),
1682
- scale: L(c)
1697
+ L(e || { x: 0, y: 0, z: 0 })
1698
+ ), r = se.RotationAxis(p.Up(), Math.PI), o = s.multiply(r), a = p.Zero(), l = y.Identity(), d = p.Zero();
1699
+ return o.decompose(d, l, a), l.multiplyInPlace(y.FromEulerAngles(0, Math.PI, 0)), {
1700
+ position: I(a),
1701
+ rotation: I(l.toEulerAngles()),
1702
+ scale: I(d)
1683
1703
  };
1684
1704
  }
1685
1705
  updatePreviewOptions(e) {
@@ -1709,10 +1729,10 @@ class Wt {
1709
1729
  }
1710
1730
  }
1711
1731
  export {
1712
- F as MaterialEffectMode,
1713
- I as ProductCameraRig,
1714
- Ge as REFLECTION_PROBE_RESOLUTION,
1732
+ S as MaterialEffectMode,
1733
+ F as ProductCameraRig,
1734
+ Ne as REFLECTION_PROBE_RESOLUTION,
1715
1735
  x as RenderingConfiguration,
1716
- Wt as SpiffCommerce3DPreviewService,
1717
- d as renderingPipelineDefaults
1736
+ Yt as SpiffCommerce3DPreviewService,
1737
+ c as renderingPipelineDefaults
1718
1738
  };