@needle-tools/engine 4.7.2 → 4.7.3-next.1603bb0

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.
Files changed (28) hide show
  1. package/dist/{needle-engine.bundle-CnzaSk8v.min.js → needle-engine.bundle-6bPQlS1q.min.js} +23 -23
  2. package/dist/{needle-engine.bundle-DALjvqho.js → needle-engine.bundle-CL5SiInU.js} +89 -76
  3. package/dist/{needle-engine.bundle-RNpCdQTu.umd.cjs → needle-engine.bundle-Dm9L7JpU.umd.cjs} +26 -26
  4. package/dist/needle-engine.d.ts +15 -15
  5. package/dist/needle-engine.js +2 -2
  6. package/dist/needle-engine.min.js +1 -1
  7. package/dist/needle-engine.umd.cjs +1 -1
  8. package/dist/{postprocessing-TkXiVrjY.min.js → postprocessing-BzY0H7ry.min.js} +8 -8
  9. package/dist/{postprocessing-CNCT892s.umd.cjs → postprocessing-Dw2OCMp4.umd.cjs} +8 -8
  10. package/dist/{postprocessing-qvgDnYKK.js → postprocessing-vKBVFpSz.js} +9 -9
  11. package/lib/engine-components/OrbitControls.d.ts +12 -0
  12. package/lib/engine-components/OrbitControls.js +14 -0
  13. package/lib/engine-components/OrbitControls.js.map +1 -1
  14. package/lib/engine-components/Skybox.d.ts +1 -0
  15. package/lib/engine-components/Skybox.js +13 -17
  16. package/lib/engine-components/Skybox.js.map +1 -1
  17. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  18. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  19. package/lib/engine-components/postprocessing/Volume.d.ts +3 -1
  20. package/lib/engine-components/postprocessing/Volume.js +2 -0
  21. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  22. package/package.json +2 -2
  23. package/plugins/vite/logger.client.js +68 -30
  24. package/plugins/vite/logger.js +5 -5
  25. package/src/engine-components/OrbitControls.ts +16 -0
  26. package/src/engine-components/Skybox.ts +14 -20
  27. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  28. package/src/engine-components/postprocessing/Volume.ts +2 -1
@@ -10,7 +10,7 @@ import { createLoaders as Cg, getRaycastMesh as T0, LODsManager as fa, NEEDLE_pr
10
10
  import { GroundedSkybox as tl, Font as kC, TextGeometry as MC, FontLoader as RC, GLTFLoader as Xs, TransformControlsGizmo as E0, EXRLoader as Ud, RGBELoader as hm, Stats as TC, nodeFrame as EC, OrbitControls as A0, PositionalAudioHelper as AC, HorizontalBlurShader as IC, VerticalBlurShader as LC, GLTFExporter as I0, strToU8 as L0, zipSync as DC, XRControllerModelFactory as jC, XRHandMeshModel as BC, Line2 as FC, LineGeometry as zC, LineMaterial as UC, KTX2Loader as NC, TransformControls as $C, InteractiveGroup as WC, HTMLMesh as VC, VertexNormalsHelper as HC, OBJLoader as Pg, FBXLoader as D0, mergeVertices as GC } from "./three-examples-tvuhV8Ne.js";
11
11
  import { fetchProfile as qC, MotionController as XC, $70d766613f57b014$export$2e2bcd8739ae039 as r_, ByteBuffer as QC, v5 as a_, md5 as l_, SIZE_PREFIX_LENGTH as j0, Builder as Og, createNoise4D as YC, Matrix4 as Yf, BatchedParticleRenderer as KC, ParticleSystem as ZC, RenderMode as Ps, ConstantColor as JC, Vector4 as e1, ConstantValue as t1, TrailParticle as c_, WorkerBase as i1, MeshBVH as n1 } from "./vendor-BmYIgaS1.js";
12
12
  import { __webpack_exports__default as Ee, __webpack_exports__Text as B0, __webpack_exports__Block as F0, __webpack_exports__update as s1, SimpleStateBehavior as o1, __webpack_exports__Inline as Kf, __webpack_exports__FontLibrary as h_, ThreeMeshUI as d_ } from "./three-mesh-ui-CxuWt7m-.js";
13
- import { EffectAttribute as r1 } from "./postprocessing-qvgDnYKK.js";
13
+ import { EffectAttribute as r1 } from "./postprocessing-vKBVFpSz.js";
14
14
  const Zf = /* @__PURE__ */ new Map();
15
15
  function bi(o = ((t) => (t = globalThis.location) == null ? void 0 : t.hostname)()) {
16
16
  if (Zf.has(o)) return Zf.get(o);
@@ -1804,11 +1804,11 @@ Go('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"]
1804
1804
  Go('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');
1805
1805
  Go('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');
1806
1806
  Go('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
1807
- Go('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.2";');
1807
+ Go('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3-alpha";');
1808
1808
  Go('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
1809
- Go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Aug 04 2025 15:10:31 GMT+0000 (Coordinated Universal Time)";');
1809
+ Go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025 09:23:38 GMT+0000 (Coordinated Universal Time)";');
1810
1810
  Go('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
1811
- const ts = "4.7.2", Eg = "undefined", av = "Mon Aug 04 2025 15:10:31 GMT+0000 (Coordinated Universal Time)";
1811
+ const ts = "4.7.3-alpha", Eg = "undefined", av = "Wed Aug 06 2025 09:23:38 GMT+0000 (Coordinated Universal Time)";
1812
1812
  rv && console.log(`Engine version: ${ts} (generator: ${Eg})
1813
1813
  Project built at ${av}`);
1814
1814
  const hc = NEEDLE_PUBLIC_KEY, Fo = "needle_isActiveInHierarchy", Sa = "builtin_components", vd = "needle_editor_guid";
@@ -5477,7 +5477,7 @@ class qP {
5477
5477
  }
5478
5478
  }
5479
5479
  }
5480
- const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947848, dp = 32, pi = class pi {
5480
+ const At = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947848, dp = 32, pi = class pi {
5481
5481
  constructor() {
5482
5482
  }
5483
5483
  /**
@@ -5520,7 +5520,7 @@ const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947
5520
5520
  static DrawRay(t, e, i = yn, n = 0, s = !0) {
5521
5521
  if (!pi.enabled) return;
5522
5522
  const a = Le.getLine(n), l = a.geometry.getAttribute("position");
5523
- l.setXYZ(0, t.x, t.y, t.z), It.set(e.x, e.y, e.z).multiplyScalar(999999999), l.setXYZ(1, t.x + It.x, t.y + It.y, t.z + It.z), l.needsUpdate = !0, a.material.color.set(i), a.material.depthTest = s, a.material.depthWrite = !1;
5523
+ l.setXYZ(0, t.x, t.y, t.z), At.set(e.x, e.y, e.z).multiplyScalar(999999999), l.setXYZ(1, t.x + At.x, t.y + At.y, t.z + At.z), l.needsUpdate = !0, a.material.color.set(i), a.material.depthTest = s, a.material.depthWrite = !1;
5524
5524
  }
5525
5525
  /**
5526
5526
  * Draw a line gizmo in the scene
@@ -5534,7 +5534,7 @@ const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947
5534
5534
  static DrawDirection(t, e, i = yn, n = 0, s = !0, a = 1) {
5535
5535
  if (!pi.enabled) return;
5536
5536
  const l = Le.getLine(n), c = l.geometry.getAttribute("position");
5537
- c.setXYZ(0, t.x, t.y, t.z), e.w !== void 0 ? (It.set(0, 0, -a), $_.set(e.x, e.y, e.z, e.w), It.applyQuaternion($_)) : (It.set(e.x, e.y, e.z), It.multiplyScalar(a)), c.setXYZ(1, t.x + It.x, t.y + It.y, t.z + It.z), c.needsUpdate = !0, l.material.color.set(i), l.material.depthTest = s, l.material.depthWrite = !1;
5537
+ c.setXYZ(0, t.x, t.y, t.z), e.w !== void 0 ? (At.set(0, 0, -a), $_.set(e.x, e.y, e.z, e.w), At.applyQuaternion($_)) : (At.set(e.x, e.y, e.z), At.multiplyScalar(a)), c.setXYZ(1, t.x + At.x, t.y + At.y, t.z + At.z), c.needsUpdate = !0, l.material.color.set(i), l.material.depthTest = s, l.material.depthWrite = !1;
5538
5538
  }
5539
5539
  /**
5540
5540
  * Draw a line gizmo in the scene
@@ -5561,7 +5561,7 @@ const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947
5561
5561
  static DrawCircle(t, e, i, n = yn, s = 0, a = !0) {
5562
5562
  if (!pi.enabled) return;
5563
5563
  const l = Le.getCircle(s);
5564
- l.position.set(t.x, t.y, t.z), l.scale.set(i, i, i), l.quaternion.setFromUnitVectors(this._up, It.set(e.x, e.y, e.z).normalize()), l.material.color.set(n), l.material.depthTest = a, l.material.depthWrite = !1, l.material.fog = !1;
5564
+ l.position.set(t.x, t.y, t.z), l.scale.set(i, i, i), l.quaternion.setFromUnitVectors(this._up, At.set(e.x, e.y, e.z).normalize()), l.material.color.set(n), l.material.depthTest = a, l.material.depthWrite = !1, l.material.fog = !1;
5565
5565
  }
5566
5566
  /**
5567
5567
  * Draw a 3D wiremesh sphere gizmo in the scene
@@ -5612,7 +5612,7 @@ const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947
5612
5612
  static DrawWireBox3(t, e = yn, i = 0, n = !0) {
5613
5613
  if (!pi.enabled) return;
5614
5614
  const s = Le.getBox(i);
5615
- s.position.copy(t.getCenter(It)), s.scale.copy(t.getSize(It)), s.material.color.set(e), s.material.depthTest = n, s.material.wireframe = !0, s.material.depthWrite = !1, s.material.fog = !1;
5615
+ s.position.copy(t.getCenter(At)), s.scale.copy(t.getSize(At)), s.material.color.set(e), s.material.depthTest = n, s.material.wireframe = !0, s.material.depthWrite = !1, s.material.fog = !1;
5616
5616
  }
5617
5617
  /**
5618
5618
  * Draw an arrow gizmo in the scene
@@ -5626,8 +5626,8 @@ const It = new w(), N_ = new w(), $_ = new W(), XP = S("debuggizmos"), yn = 8947
5626
5626
  static DrawArrow(t, e, i = yn, n = 0, s = !0, a = !1) {
5627
5627
  if (!pi.enabled) return;
5628
5628
  const l = Le.getArrowHead(n);
5629
- l.position.set(e.x, e.y, e.z), l.quaternion.setFromUnitVectors(this._up.set(0, 1, 0), It.set(e.x, e.y, e.z).sub(N_.set(t.x, t.y, t.z)).normalize());
5630
- const h = It.set(e.x, e.y, e.z).sub(N_.set(t.x, t.y, t.z)).length() * 0.1;
5629
+ l.position.set(e.x, e.y, e.z), l.quaternion.setFromUnitVectors(this._up.set(0, 1, 0), At.set(e.x, e.y, e.z).sub(N_.set(t.x, t.y, t.z)).normalize());
5630
+ const h = At.set(e.x, e.y, e.z).sub(N_.set(t.x, t.y, t.z)).length() * 0.1;
5631
5631
  l.scale.set(h, h, h), l.material.color.set(i), l.material.depthTest = s, l.material.wireframe = a, this.DrawLine(t, e, i, n, s);
5632
5632
  }
5633
5633
  /**
@@ -14510,7 +14510,7 @@ var j;
14510
14510
  t.ready = i;
14511
14511
  async function n() {
14512
14512
  if (t.MODULE) return t.MODULE;
14513
- const s = await import("./postprocessing-qvgDnYKK.js").then((a) => a.index);
14513
+ const s = await import("./postprocessing-vKBVFpSz.js").then((a) => a.index);
14514
14514
  return t.MODULE = s, t.MAYBEMODULE = s, e.forEach((a) => a(s)), e.length = 0, s;
14515
14515
  }
14516
14516
  t.load = n;
@@ -14525,7 +14525,7 @@ var j;
14525
14525
  t.ready = i;
14526
14526
  async function n() {
14527
14527
  if (t.MODULE) return t.MODULE;
14528
- const s = await import("./postprocessing-qvgDnYKK.js").then((a) => a.N8AO);
14528
+ const s = await import("./postprocessing-vKBVFpSz.js").then((a) => a.N8AO);
14529
14529
  return t.MODULE = s, t.MAYBEMODULE = s, e.forEach((a) => a(s)), e.length = 0, s;
14530
14530
  }
14531
14531
  t.load = n;
@@ -16352,6 +16352,21 @@ class xe extends B {
16352
16352
  var i;
16353
16353
  (i = this._controls) == null || i._rotateLeft(e);
16354
16354
  }
16355
+ /**
16356
+ * Rotate the camera up (or down) by the specified angle in radians.
16357
+ * For positive angles the camera will rotate up, for negative angles it will rotate down.
16358
+ * Tip: Use Mathf to convert between degrees and radians.
16359
+ * @param angleInRadians The angle in radians to rotate the camera up
16360
+ * @example
16361
+ * ```typescript
16362
+ * // Rotate the camera up by 0.1 radians
16363
+ * orbitControls.rotateUp(0.1);
16364
+ * ```
16365
+ */
16366
+ rotateUp(e) {
16367
+ var i;
16368
+ (i = this._controls) == null || i._rotateUp(e);
16369
+ }
16355
16370
  /**
16356
16371
  * Pan the camera by the specified amount in the x and y direction in pixels.
16357
16372
  * @param dx The amount to pan the camera in the x direction in pixels.
@@ -29692,7 +29707,7 @@ function qb(o, t) {
29692
29707
  const a = document.createElement("img");
29693
29708
  return a.id = "button", s.appendChild(a), o.domElement.shadowRoot.appendChild(i), s;
29694
29709
  }
29695
- var eE = Object.defineProperty, At = (o, t, e, i) => {
29710
+ var eE = Object.defineProperty, Et = (o, t, e, i) => {
29696
29711
  for (var n = void 0, s = o.length - 1, a; s >= 0; s--)
29697
29712
  (a = o[s]) && (n = a(t, e, n) || n);
29698
29713
  return n && eE(t, e, n), n;
@@ -29706,16 +29721,16 @@ class Rl {
29706
29721
  r(this, "callToActionURL");
29707
29722
  }
29708
29723
  }
29709
- At([
29724
+ Et([
29710
29725
  p()
29711
29726
  ], Rl.prototype, "callToAction");
29712
- At([
29727
+ Et([
29713
29728
  p()
29714
29729
  ], Rl.prototype, "checkoutTitle");
29715
- At([
29730
+ Et([
29716
29731
  p()
29717
29732
  ], Rl.prototype, "checkoutSubtitle");
29718
- At([
29733
+ Et([
29719
29734
  p()
29720
29735
  ], Rl.prototype, "callToActionURL");
29721
29736
  var Is;
@@ -29957,43 +29972,43 @@ const xi = (Is = class extends B {
29957
29972
  return i.parentNode || this.context.menu.appendChild(i), i;
29958
29973
  }
29959
29974
  }, r(Is, "invertForwardMatrix", new re().makeRotationY(Math.PI)), r(Is, "invertForwardQuaternion", new W().setFromEuler(new Ft(0, Math.PI, 0))), Is);
29960
- At([
29975
+ Et([
29961
29976
  p(D)
29962
29977
  ], xi.prototype, "objectToExport");
29963
- At([
29978
+ Et([
29964
29979
  p()
29965
29980
  ], xi.prototype, "autoExportAnimations");
29966
- At([
29981
+ Et([
29967
29982
  p()
29968
29983
  ], xi.prototype, "autoExportAudioSources");
29969
- At([
29984
+ Et([
29970
29985
  p()
29971
29986
  ], xi.prototype, "exportFileName");
29972
- At([
29987
+ Et([
29973
29988
  p(URL)
29974
29989
  ], xi.prototype, "customUsdzFile");
29975
- At([
29990
+ Et([
29976
29991
  p(Rl)
29977
29992
  ], xi.prototype, "customBranding");
29978
- At([
29993
+ Et([
29979
29994
  p()
29980
29995
  ], xi.prototype, "anchoringType");
29981
- At([
29996
+ Et([
29982
29997
  p()
29983
29998
  ], xi.prototype, "maxTextureSize");
29984
- At([
29999
+ Et([
29985
30000
  p()
29986
30001
  ], xi.prototype, "planeAnchoringAlignment");
29987
- At([
30002
+ Et([
29988
30003
  p()
29989
30004
  ], xi.prototype, "interactive");
29990
- At([
30005
+ Et([
29991
30006
  p()
29992
30007
  ], xi.prototype, "physics");
29993
- At([
30008
+ Et([
29994
30009
  p()
29995
30010
  ], xi.prototype, "allowCreateQuicklookButton");
29996
- At([
30011
+ Et([
29997
30012
  p()
29998
30013
  ], xi.prototype, "quickLookCompatible");
29999
30014
  let Vs = xi;
@@ -34407,7 +34422,7 @@ class Sx {
34407
34422
  }
34408
34423
  ws && console.log("[PostProcessing] Passes →", [...a.passes], `
34409
34424
  ---------------------------------
34410
- • ` + a.passes.map((u) => u.name).join(`
34425
+ • ` + a.passes.map((u) => u.name || u.constructor.name + "*").join(`
34411
34426
  • `) + `
34412
34427
  `), ws && this._onCreateEffectsDebug(this._composer, s);
34413
34428
  }
@@ -34494,7 +34509,7 @@ class Eh extends B {
34494
34509
  */
34495
34510
  addEffect(e) {
34496
34511
  let i = e;
34497
- return i instanceof ft || (i = new _u(i)), i.gameObject === void 0 && this.gameObject.addComponent(i), this._effects.includes(i) || (this._effects.push(i), this._isDirty = !0), e;
34512
+ return i instanceof ft || (i = new _u(i), typeof e.order == "number" && (i.order = e.order)), i.gameObject === void 0 && this.gameObject.addComponent(i), this._effects.includes(i) || (this._effects.push(i), this._isDirty = !0), e;
34498
34513
  }
34499
34514
  /**
34500
34515
  * Remove a post processing effect from the stack and schedules the effect stack to be re-created.
@@ -34657,7 +34672,7 @@ var mA = Object.defineProperty, Ot = (o, t, e, i) => {
34657
34672
  (a = o[s]) && (n = a(t, e, n) || n);
34658
34673
  return n && mA(t, e, n), n;
34659
34674
  };
34660
- const Lt = S("debugsceneswitcher"), gA = S("sceneswitcher:clearscene"), Dd = "scene";
34675
+ const It = S("debugsceneswitcher"), gA = S("sceneswitcher:clearscene"), Dd = "scene";
34661
34676
  Fy(Dd);
34662
34677
  const po = Promise.resolve(!1);
34663
34678
  class lt extends B {
@@ -34696,7 +34711,7 @@ class lt extends B {
34696
34711
  const s = e == null ? void 0 : e.state;
34697
34712
  if (s && s.startsWith(this.guid)) {
34698
34713
  const a = s.substr(this.guid.length + 2);
34699
- Lt && console.log("PopState", a), await this.trySelectSceneFromValue(a);
34714
+ It && console.log("PopState", a), await this.trySelectSceneFromValue(a);
34700
34715
  }
34701
34716
  }
34702
34717
  } finally {
@@ -34772,7 +34787,7 @@ class lt extends B {
34772
34787
  this.scenes === void 0 && (this.scenes = []);
34773
34788
  for (const e of this.scenes)
34774
34789
  e && !e.hasUrl && e.asset instanceof D ? C.remove(e.asset) : e instanceof D && C.remove(e);
34775
- Lt && console.log("SceneSwitcher", this);
34790
+ It && console.log("SceneSwitcher", this);
34776
34791
  }
34777
34792
  /** @internal */
34778
34793
  async onEnable() {
@@ -34859,7 +34874,7 @@ class lt extends B {
34859
34874
  */
34860
34875
  select(e) {
34861
34876
  var n, s, a;
34862
- if (Lt && console.log("select", e), typeof e == "object" && console.warn('Switching to "' + e + '" might not work. Please either use an index or a AssetReference (not a scene reference)'), typeof e == "string") {
34877
+ if (It && console.log("select", e), typeof e == "object" && console.warn('Switching to "' + e + '" might not work. Please either use an index or a AssetReference (not a scene reference)'), typeof e == "string") {
34863
34878
  const l = (n = this.scenes) == null ? void 0 : n.find((c) => c.url === e);
34864
34879
  if (!l) {
34865
34880
  const c = le.getOrCreate(this.sourceId ?? "", e, this.context);
@@ -34928,7 +34943,7 @@ class lt extends B {
34928
34943
  async __unloadCurrentScene() {
34929
34944
  const e = this._currentScene;
34930
34945
  if (this._currentScene = void 0, e) {
34931
- Lt && console.log("UNLOAD", e.url, "HasURL?: " + e.hasUrl);
34946
+ It && console.log("UNLOAD", e.url, "HasURL?: " + e.hasUrl);
34932
34947
  const i = this.tryGetSceneEventListener(e.asset);
34933
34948
  if (i != null && i.sceneClosing) {
34934
34949
  const n = i.sceneClosing();
@@ -34947,7 +34962,7 @@ class lt extends B {
34947
34962
  const h = new CustomEvent("loadscene-start", { detail: { scene: e, switcher: this, index: i } });
34948
34963
  this.dispatchEvent(h), (s = this.sceneLoadingStart) == null || s.invoke(h.detail), await this.onStartLoading(), await e.loadAssetAsync((u, f) => {
34949
34964
  var m;
34950
- if (Lt) {
34965
+ if (It) {
34951
34966
  const g = f.loaded / f.total, _ = "[" + "=".repeat(Math.floor(g * 20)) + "-".repeat(20 - Math.floor(g * 20)) + "]";
34952
34967
  console.debug(`[SceneSwitcher] Download ${(g * 100).toFixed(1)} % ${_}`, e.url);
34953
34968
  }
@@ -34955,11 +34970,11 @@ class lt extends B {
34955
34970
  }).catch(console.error), await this.onEndLoading();
34956
34971
  const d = new CustomEvent("loadscene-finished", { detail: { scene: e, switcher: this, index: i } });
34957
34972
  if (this.dispatchEvent(d), this._currentLoadingProgress = void 0, this._currentlyLoadingScene = void 0, d.defaultPrevented)
34958
- return Lt && console.warn("Adding loaded scene prevented:", e, d), !1;
34973
+ return It && console.warn("Adding loaded scene prevented:", e, d), !1;
34959
34974
  if (!e.asset)
34960
- return Lt && console.warn("Failed loading scene:", e), !1;
34975
+ return It && console.warn("Failed loading scene:", e), !1;
34961
34976
  if (this._currentIndex === i) {
34962
- if (Lt && console.log("ADD", e.url), this._currentScene = e, gA) {
34977
+ if (It && console.log("ADD", e.url), this._currentScene = e, gA) {
34963
34978
  const m = ((a = this.context.mainCameraComponent) == null ? void 0 : a.gameObject) || this.context.mainCamera;
34964
34979
  m == null || m.removeFromParent();
34965
34980
  const g = this.gameObject.removeFromParent();
@@ -34967,7 +34982,7 @@ class lt extends B {
34967
34982
  }
34968
34983
  if (C.add(e.asset, this.gameObject), this.useSceneLighting && this.context.sceneLighting.enable(e), this.useSceneBackground) {
34969
34984
  const m = this.context.lightmaps.tryGetSkybox(e.url);
34970
- m ? (m.mapping = Ns, this.context.scene.background = m) : Lt && console.warn("SceneSwitcher: Can't find skybox for scene " + e.url);
34985
+ m ? (m.mapping = Ns, this.context.scene.background = m) : It && console.warn("SceneSwitcher: Can't find skybox for scene " + e.url);
34971
34986
  }
34972
34987
  if (this.useHistory && i >= 0) {
34973
34988
  let m = i.toString();
@@ -35027,7 +35042,7 @@ class lt extends B {
35027
35042
  async onStartLoading() {
35028
35043
  var e, i;
35029
35044
  if (this._isCurrentlyLoading = !0, this.loadingScene && (this._lastLoadingScene !== this.loadingScene && (this._loadingScenePromise = void 0), this._lastLoadingScene = this.loadingScene, this._loadingScenePromise || (this._loadingScenePromise = (e = this.loadingScene) == null ? void 0 : e.loadAssetAsync().then((n) => n != null)), await this._loadingScenePromise, this._isCurrentlyLoading && ((i = this.loadingScene) != null && i.asset))) {
35030
- Lt && console.log("Add loading scene", this.loadingScene.url, this.loadingScene.asset);
35045
+ It && console.log("Add loading scene", this.loadingScene.url, this.loadingScene.asset);
35031
35046
  const n = this.loadingScene.asset;
35032
35047
  C.add(n, this.gameObject);
35033
35048
  const s = this.tryGetSceneEventListener(n);
@@ -35047,7 +35062,7 @@ class lt extends B {
35047
35062
  async onEndLoading() {
35048
35063
  var e;
35049
35064
  if (this._isCurrentlyLoading = !1, (e = this.loadingScene) != null && e.asset) {
35050
- Lt && console.log("Remove loading scene", this.loadingScene.url);
35065
+ It && console.log("Remove loading scene", this.loadingScene.url);
35051
35066
  const i = this.loadingScene.asset, n = this.tryGetSceneEventListener(i);
35052
35067
  if (typeof (n == null ? void 0 : n.sceneClosing) == "function") {
35053
35068
  const s = n.sceneClosing();
@@ -35163,10 +35178,10 @@ class yA {
35163
35178
  */
35164
35179
  begin(t) {
35165
35180
  if (this._isRunning) return;
35166
- Lt && console.log("Preload begin", { delay: t }), this._isRunning = !0;
35181
+ It && console.log("Preload begin", { delay: t }), this._isRunning = !0;
35167
35182
  let e = -10, i, n;
35168
35183
  const s = this._switcher.scenes, a = Date.now() + t, l = setInterval(() => {
35169
- if (this.allLoaded() && (Lt && console.log("All scenes (pre-)loaded"), this.stop()), !this._isRunning) {
35184
+ if (this.allLoaded() && (It && console.log("All scenes (pre-)loaded"), this.stop()), !this._isRunning) {
35170
35185
  clearInterval(l);
35171
35186
  return;
35172
35187
  }
@@ -35179,7 +35194,7 @@ class yA {
35179
35194
  const d = c ? e + i : e - i;
35180
35195
  if (!(d < 0) && !(d < 0 || d >= s.length) && !this._loadTasks.some((u) => u.index === d)) {
35181
35196
  const u = s[d];
35182
- Lt && console.log("Preload scene", { roomIndex: d, searchForward: c, lastRoom: e, currentIndex: this._switcher.currentIndex, tasks: this._loadTasks.length }, u == null ? void 0 : u.url), new _A(d, u, this._loadTasks);
35197
+ It && console.log("Preload scene", { roomIndex: d, searchForward: c, lastRoom: e, currentIndex: this._switcher.currentIndex, tasks: this._loadTasks.length }, u == null ? void 0 : u.url), new _A(d, u, this._loadTasks);
35183
35198
  }
35184
35199
  }, 200);
35185
35200
  }
@@ -35229,7 +35244,7 @@ class _A {
35229
35244
  * Asynchronously loads the asset and removes this task from the active tasks list when complete
35230
35245
  */
35231
35246
  async awaitLoading() {
35232
- this.asset && !this.asset.isLoaded() && (Lt && console.log("Preload start: " + this.asset.url, this.index), await this.asset.preload(), Lt && console.log("Preload finished: " + this.asset.url, this.index));
35247
+ this.asset && !this.asset.isLoaded() && (It && console.log("Preload start: " + this.asset.url, this.index), await this.asset.preload(), It && console.log("Preload finished: " + this.asset.url, this.index));
35233
35248
  const t = this.tasks.indexOf(this);
35234
35249
  t >= 0 && this.tasks.splice(t, 1);
35235
35250
  }
@@ -36248,7 +36263,7 @@ var RA = Object.defineProperty, Ih = (o, t, e, i) => {
36248
36263
  (a = o[s]) && (n = a(t, e, n) || n);
36249
36264
  return n && RA(t, e, n), n;
36250
36265
  };
36251
- const Et = S("debugskybox");
36266
+ const Lt = S("debugskybox");
36252
36267
  Fy("background-image");
36253
36268
  Fy("environment-image");
36254
36269
  function n0(o, t, e, i, n) {
@@ -36257,22 +36272,22 @@ function n0(o, t, e, i, n) {
36257
36272
  const s = new zy();
36258
36273
  s.allowDrop = !1, s.allowNetworking = !1, s.background = e, s.environment = i, C.addComponent(o.scene, s);
36259
36274
  const a = (l) => {
36260
- typeof l == "string" && (Et && console.log(n, "CHANGED TO", l), s.setSkybox(l));
36275
+ typeof l == "string" && (Lt && console.log(n, "CHANGED TO", l), s.setSkybox(l));
36261
36276
  };
36262
36277
  return x1(o.domElement, n, a), s.addEventListener("destroy", () => {
36263
- Et && console.log("Destroyed attribute remote skybox", n), S1(o.domElement, n, a);
36278
+ Lt && console.log("Destroyed attribute remote skybox", n), S1(o.domElement, n, a);
36264
36279
  }), s.setSkybox(t);
36265
36280
  }
36266
36281
  const bu = new Array();
36267
36282
  fe.registerCallback(me.ContextCreationStart, (o) => {
36268
36283
  const t = o.context, e = t.domElement.getAttribute("background-image"), i = t.domElement.getAttribute("environment-image");
36269
36284
  if (e) {
36270
- Et && console.log("Creating remote skybox to load " + e);
36285
+ Lt && console.log("Creating remote skybox to load " + e);
36271
36286
  const n = n0(t, e, !0, !1, "background-image");
36272
36287
  n && bu.push(n);
36273
36288
  }
36274
36289
  if (i) {
36275
- Et && console.log("Creating remote environment to load " + i);
36290
+ Lt && console.log("Creating remote environment to load " + i);
36276
36291
  const n = n0(t, i, !1, !0, "environment-image");
36277
36292
  n && bu.push(n);
36278
36293
  }
@@ -36285,11 +36300,11 @@ function Tx() {
36285
36300
  }
36286
36301
  function s0(o) {
36287
36302
  const e = Tx().find((i) => i.src === o);
36288
- return e ? (Et && console.log("Skybox: Found previously loaded texture for " + o), e.texture) : null;
36303
+ return e ? (Lt && console.log("Skybox: Found previously loaded texture for " + o), e.texture) : null;
36289
36304
  }
36290
36305
  async function TA(o) {
36291
36306
  const t = await o;
36292
- xv(t, !0), Ie(t);
36307
+ t && (xv(t, !0), Ie(t));
36293
36308
  }
36294
36309
  function EA(o, t) {
36295
36310
  const e = Tx();
@@ -36312,6 +36327,7 @@ const Yr = class extends B {
36312
36327
  r(this, "_prevLoadedEnvironment");
36313
36328
  r(this, "_prevEnvironment", null);
36314
36329
  r(this, "_prevBackground", null);
36330
+ r(this, "validProtocols", ["file:", "blob:", "data:"]);
36315
36331
  r(this, "validTextureTypes", [".ktx2", ".hdr", ".exr", ".jpg", ".jpeg", ".png"]);
36316
36332
  r(this, "onDragOverEvent", (e) => {
36317
36333
  if (this.allowDrop && e.dataTransfer)
@@ -36322,11 +36338,11 @@ const Yr = class extends B {
36322
36338
  var i, n, s, a;
36323
36339
  if (this.allowDrop && e.dataTransfer) {
36324
36340
  for (const l of e.dataTransfer.types)
36325
- if (Et && console.log(l), l === "text/uri-list") {
36341
+ if (Lt && console.log(l), l === "text/uri-list") {
36326
36342
  const c = e.dataTransfer.getData(l);
36327
- Et && console.log(l, c);
36343
+ Lt && console.log(l, c);
36328
36344
  let h = (n = (i = new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(c)) == null ? void 0 : i.groups) == null ? void 0 : n.name;
36329
- if (h || (h = (a = (s = new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(c)) == null ? void 0 : s.groups) == null ? void 0 : a.name), Et && console.log(h), h) {
36345
+ if (h || (h = (a = (s = new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(c)) == null ? void 0 : s.groups) == null ? void 0 : a.name), Lt && console.log(h), h) {
36330
36346
  const d = "https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/" + h + "_1k.exr";
36331
36347
  console.log(`[Remote Skybox] Setting skybox from url: ${d}`), e.preventDefault(), this.setSkybox(d);
36332
36348
  break;
@@ -36349,7 +36365,7 @@ const Yr = class extends B {
36349
36365
  }
36350
36366
  } else if (l == "Files") {
36351
36367
  const c = e.dataTransfer.files.item(0);
36352
- if (Et && console.log(l, c), !c) continue;
36368
+ if (Lt && console.log(l, c), !c) continue;
36353
36369
  if (!this.isValidTextureType(c.name)) {
36354
36370
  console.warn(`[RemoteSkybox]: File "${c.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);
36355
36371
  return;
@@ -36374,7 +36390,7 @@ const Yr = class extends B {
36374
36390
  this.context.scene.environment === this._prevLoadedEnvironment && (this.context.scene.environment = this._prevEnvironment, Ai.backgroundShouldBeTransparent(this.context) || (this.context.scene.background = this._prevBackground), this._prevLoadedEnvironment = void 0), this.unregisterDropEvents(), (e = this.context.mainCameraComponent) == null || e.applyClearFlags();
36375
36391
  }
36376
36392
  urlChangedSyncField() {
36377
- this.allowNetworking && this.url && (this.isRemoteTexture(this.url) ? this.setSkybox(this.url) : Et && console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`));
36393
+ this.allowNetworking && this.url && (this.isRemoteTexture(this.url) ? this.setSkybox(this.url) : Lt && console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`));
36378
36394
  }
36379
36395
  /**
36380
36396
  * Set the skybox from a given url
@@ -36383,23 +36399,18 @@ const Yr = class extends B {
36383
36399
  * @returns Whether the skybox was successfully set
36384
36400
  */
36385
36401
  async setSkybox(e, i) {
36386
- var a;
36402
+ var a, l;
36387
36403
  if (!this.activeAndEnabled || (e = AA(e, this.environment, this.background), !e)) return !1;
36388
- try {
36389
- e.startsWith("/") || e.startsWith(".") ? new URL(e, window.location.href) : new URL(e);
36390
- } catch {
36391
- return Et && console.warn("RemoteSkybox: Invalid URL", e, this.name), !1;
36392
- }
36393
- if (i ?? (i = e), this.isValidTextureType(i) || console.warn("Potentially invalid skybox url", i, "on", this.name), Et && console.log("Set remote skybox url: " + e), this._prevUrl === e && this._prevLoadedEnvironment)
36404
+ if (i ?? (i = e), this.isValidTextureType(i) || console.warn('Potentially invalid skybox URL: "' + i + '" on ' + (this.name || ((a = this.gameObject) == null ? void 0 : a.name) || "context")), Lt && console.log("Set remote skybox url: " + e), this._prevUrl === e && this._prevLoadedEnvironment)
36394
36405
  return this.apply(), !0;
36395
- (a = this._prevLoadedEnvironment) == null || a.dispose(), this._prevLoadedEnvironment = void 0, this._prevUrl = e;
36406
+ (l = this._prevLoadedEnvironment) == null || l.dispose(), this._prevLoadedEnvironment = void 0, this._prevUrl = e;
36396
36407
  const n = await this.loadTexture(e, i);
36397
36408
  if (!n)
36398
- return Et && console.warn("RemoteSkybox: Failed to load texture from url", e), !1;
36409
+ return Lt && console.warn("RemoteSkybox: Failed to load texture from url", e), !1;
36399
36410
  if (!this.enabled)
36400
- return Et && console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"), !1;
36411
+ return Lt && console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"), !1;
36401
36412
  if (this._prevUrl !== e)
36402
- return Et && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1;
36413
+ return Lt && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1;
36403
36414
  this.url = e;
36404
36415
  const s = e.lastIndexOf("/");
36405
36416
  return n.name = e.substring(s >= 0 ? s + 1 : 0), this._loader instanceof $a && (n.colorSpace = qs), this._prevLoadedEnvironment = n, this.apply(), !0;
@@ -36411,7 +36422,7 @@ const Yr = class extends B {
36411
36422
  const n = s0(i);
36412
36423
  if (n) {
36413
36424
  const _ = await n;
36414
- if (((u = (d = _.source) == null ? void 0 : d.data) == null ? void 0 : u.length) > 0 || (g = (m = (f = _.source) == null ? void 0 : f.data) == null ? void 0 : m.data) != null && g.length) return _;
36425
+ if (((u = (d = _ == null ? void 0 : _.source) == null ? void 0 : d.data) == null ? void 0 : u.length) > 0 || (g = (m = (f = _ == null ? void 0 : _.source) == null ? void 0 : f.data) == null ? void 0 : m.data) != null && g.length) return _;
36415
36426
  }
36416
36427
  const s = i.endsWith(".exr"), a = i.endsWith(".hdr"), l = i.endsWith(".ktx2");
36417
36428
  if (s)
@@ -36425,14 +36436,14 @@ const Yr = class extends B {
36425
36436
  }
36426
36437
  } else
36427
36438
  this._loader instanceof $a || (this._loader = new $a());
36428
- Et && console.log("Loading skybox: " + e);
36429
- const c = this._loader.loadAsync(e);
36439
+ Lt && console.log("Loading skybox: " + e);
36440
+ const c = this._loader.loadAsync(e).catch((_) => (console.warn("RemoteSkybox: Failed to load texture from url:", e), null));
36430
36441
  return EA(i, c), await c;
36431
36442
  }
36432
36443
  apply() {
36433
36444
  var i;
36434
36445
  const e = this._prevLoadedEnvironment;
36435
- e && (e instanceof pC || e instanceof mC || (e.mapping = gC, e.needsUpdate = !0), this.context.scene.background !== e && (this._prevBackground = this.context.scene.background), this.context.scene.environment !== e && (this._prevEnvironment = this.context.scene.environment), Et && console.log("Set remote skybox", this.url, !Ai.backgroundShouldBeTransparent(this.context)), this.environment && (this.context.scene.environment = e), this.background && !Ai.backgroundShouldBeTransparent(this.context) && (this.context.scene.background = e), ((i = this.context.mainCameraComponent) == null ? void 0 : i.backgroundBlurriness) !== void 0 && (this.context.scene.backgroundBlurriness = this.context.mainCameraComponent.backgroundBlurriness));
36446
+ e && (e instanceof pC || e instanceof mC || (e.mapping = gC, e.needsUpdate = !0), this.context.scene.background !== e && (this._prevBackground = this.context.scene.background), this.context.scene.environment !== e && (this._prevEnvironment = this.context.scene.environment), Lt && console.log("Set remote skybox", this.url, !Ai.backgroundShouldBeTransparent(this.context)), this.environment && (this.context.scene.environment = e), this.background && !Ai.backgroundShouldBeTransparent(this.context) && (this.context.scene.background = e), ((i = this.context.mainCameraComponent) == null ? void 0 : i.backgroundBlurriness) !== void 0 && (this.context.scene.backgroundBlurriness = this.context.mainCameraComponent.backgroundBlurriness));
36436
36447
  }
36437
36448
  isRemoteTexture(e) {
36438
36449
  return e.startsWith("http://") || e.startsWith("https://");
@@ -36440,6 +36451,8 @@ const Yr = class extends B {
36440
36451
  isValidTextureType(e) {
36441
36452
  for (const i of this.validTextureTypes)
36442
36453
  if (e.endsWith(i)) return !0;
36454
+ for (const i of this.validProtocols)
36455
+ if (e.startsWith(i)) return !0;
36443
36456
  return !1;
36444
36457
  }
36445
36458
  registerDropEvents() {