@needle-tools/engine 4.7.2 → 4.7.3-next.65e7878

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.
@@ -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__"] = "Mon Aug 04 2025 16:09:39 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 = "Mon Aug 04 2025 16:09:39 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
  /**
@@ -29692,7 +29692,7 @@ function qb(o, t) {
29692
29692
  const a = document.createElement("img");
29693
29693
  return a.id = "button", s.appendChild(a), o.domElement.shadowRoot.appendChild(i), s;
29694
29694
  }
29695
- var eE = Object.defineProperty, At = (o, t, e, i) => {
29695
+ var eE = Object.defineProperty, Et = (o, t, e, i) => {
29696
29696
  for (var n = void 0, s = o.length - 1, a; s >= 0; s--)
29697
29697
  (a = o[s]) && (n = a(t, e, n) || n);
29698
29698
  return n && eE(t, e, n), n;
@@ -29706,16 +29706,16 @@ class Rl {
29706
29706
  r(this, "callToActionURL");
29707
29707
  }
29708
29708
  }
29709
- At([
29709
+ Et([
29710
29710
  p()
29711
29711
  ], Rl.prototype, "callToAction");
29712
- At([
29712
+ Et([
29713
29713
  p()
29714
29714
  ], Rl.prototype, "checkoutTitle");
29715
- At([
29715
+ Et([
29716
29716
  p()
29717
29717
  ], Rl.prototype, "checkoutSubtitle");
29718
- At([
29718
+ Et([
29719
29719
  p()
29720
29720
  ], Rl.prototype, "callToActionURL");
29721
29721
  var Is;
@@ -29957,43 +29957,43 @@ const xi = (Is = class extends B {
29957
29957
  return i.parentNode || this.context.menu.appendChild(i), i;
29958
29958
  }
29959
29959
  }, r(Is, "invertForwardMatrix", new re().makeRotationY(Math.PI)), r(Is, "invertForwardQuaternion", new W().setFromEuler(new Ft(0, Math.PI, 0))), Is);
29960
- At([
29960
+ Et([
29961
29961
  p(D)
29962
29962
  ], xi.prototype, "objectToExport");
29963
- At([
29963
+ Et([
29964
29964
  p()
29965
29965
  ], xi.prototype, "autoExportAnimations");
29966
- At([
29966
+ Et([
29967
29967
  p()
29968
29968
  ], xi.prototype, "autoExportAudioSources");
29969
- At([
29969
+ Et([
29970
29970
  p()
29971
29971
  ], xi.prototype, "exportFileName");
29972
- At([
29972
+ Et([
29973
29973
  p(URL)
29974
29974
  ], xi.prototype, "customUsdzFile");
29975
- At([
29975
+ Et([
29976
29976
  p(Rl)
29977
29977
  ], xi.prototype, "customBranding");
29978
- At([
29978
+ Et([
29979
29979
  p()
29980
29980
  ], xi.prototype, "anchoringType");
29981
- At([
29981
+ Et([
29982
29982
  p()
29983
29983
  ], xi.prototype, "maxTextureSize");
29984
- At([
29984
+ Et([
29985
29985
  p()
29986
29986
  ], xi.prototype, "planeAnchoringAlignment");
29987
- At([
29987
+ Et([
29988
29988
  p()
29989
29989
  ], xi.prototype, "interactive");
29990
- At([
29990
+ Et([
29991
29991
  p()
29992
29992
  ], xi.prototype, "physics");
29993
- At([
29993
+ Et([
29994
29994
  p()
29995
29995
  ], xi.prototype, "allowCreateQuicklookButton");
29996
- At([
29996
+ Et([
29997
29997
  p()
29998
29998
  ], xi.prototype, "quickLookCompatible");
29999
29999
  let Vs = xi;
@@ -34657,7 +34657,7 @@ var mA = Object.defineProperty, Ot = (o, t, e, i) => {
34657
34657
  (a = o[s]) && (n = a(t, e, n) || n);
34658
34658
  return n && mA(t, e, n), n;
34659
34659
  };
34660
- const Lt = S("debugsceneswitcher"), gA = S("sceneswitcher:clearscene"), Dd = "scene";
34660
+ const It = S("debugsceneswitcher"), gA = S("sceneswitcher:clearscene"), Dd = "scene";
34661
34661
  Fy(Dd);
34662
34662
  const po = Promise.resolve(!1);
34663
34663
  class lt extends B {
@@ -34696,7 +34696,7 @@ class lt extends B {
34696
34696
  const s = e == null ? void 0 : e.state;
34697
34697
  if (s && s.startsWith(this.guid)) {
34698
34698
  const a = s.substr(this.guid.length + 2);
34699
- Lt && console.log("PopState", a), await this.trySelectSceneFromValue(a);
34699
+ It && console.log("PopState", a), await this.trySelectSceneFromValue(a);
34700
34700
  }
34701
34701
  }
34702
34702
  } finally {
@@ -34772,7 +34772,7 @@ class lt extends B {
34772
34772
  this.scenes === void 0 && (this.scenes = []);
34773
34773
  for (const e of this.scenes)
34774
34774
  e && !e.hasUrl && e.asset instanceof D ? C.remove(e.asset) : e instanceof D && C.remove(e);
34775
- Lt && console.log("SceneSwitcher", this);
34775
+ It && console.log("SceneSwitcher", this);
34776
34776
  }
34777
34777
  /** @internal */
34778
34778
  async onEnable() {
@@ -34859,7 +34859,7 @@ class lt extends B {
34859
34859
  */
34860
34860
  select(e) {
34861
34861
  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") {
34862
+ 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
34863
  const l = (n = this.scenes) == null ? void 0 : n.find((c) => c.url === e);
34864
34864
  if (!l) {
34865
34865
  const c = le.getOrCreate(this.sourceId ?? "", e, this.context);
@@ -34928,7 +34928,7 @@ class lt extends B {
34928
34928
  async __unloadCurrentScene() {
34929
34929
  const e = this._currentScene;
34930
34930
  if (this._currentScene = void 0, e) {
34931
- Lt && console.log("UNLOAD", e.url, "HasURL?: " + e.hasUrl);
34931
+ It && console.log("UNLOAD", e.url, "HasURL?: " + e.hasUrl);
34932
34932
  const i = this.tryGetSceneEventListener(e.asset);
34933
34933
  if (i != null && i.sceneClosing) {
34934
34934
  const n = i.sceneClosing();
@@ -34947,7 +34947,7 @@ class lt extends B {
34947
34947
  const h = new CustomEvent("loadscene-start", { detail: { scene: e, switcher: this, index: i } });
34948
34948
  this.dispatchEvent(h), (s = this.sceneLoadingStart) == null || s.invoke(h.detail), await this.onStartLoading(), await e.loadAssetAsync((u, f) => {
34949
34949
  var m;
34950
- if (Lt) {
34950
+ if (It) {
34951
34951
  const g = f.loaded / f.total, _ = "[" + "=".repeat(Math.floor(g * 20)) + "-".repeat(20 - Math.floor(g * 20)) + "]";
34952
34952
  console.debug(`[SceneSwitcher] Download ${(g * 100).toFixed(1)} % ${_}`, e.url);
34953
34953
  }
@@ -34955,11 +34955,11 @@ class lt extends B {
34955
34955
  }).catch(console.error), await this.onEndLoading();
34956
34956
  const d = new CustomEvent("loadscene-finished", { detail: { scene: e, switcher: this, index: i } });
34957
34957
  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;
34958
+ return It && console.warn("Adding loaded scene prevented:", e, d), !1;
34959
34959
  if (!e.asset)
34960
- return Lt && console.warn("Failed loading scene:", e), !1;
34960
+ return It && console.warn("Failed loading scene:", e), !1;
34961
34961
  if (this._currentIndex === i) {
34962
- if (Lt && console.log("ADD", e.url), this._currentScene = e, gA) {
34962
+ if (It && console.log("ADD", e.url), this._currentScene = e, gA) {
34963
34963
  const m = ((a = this.context.mainCameraComponent) == null ? void 0 : a.gameObject) || this.context.mainCamera;
34964
34964
  m == null || m.removeFromParent();
34965
34965
  const g = this.gameObject.removeFromParent();
@@ -34967,7 +34967,7 @@ class lt extends B {
34967
34967
  }
34968
34968
  if (C.add(e.asset, this.gameObject), this.useSceneLighting && this.context.sceneLighting.enable(e), this.useSceneBackground) {
34969
34969
  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);
34970
+ m ? (m.mapping = Ns, this.context.scene.background = m) : It && console.warn("SceneSwitcher: Can't find skybox for scene " + e.url);
34971
34971
  }
34972
34972
  if (this.useHistory && i >= 0) {
34973
34973
  let m = i.toString();
@@ -35027,7 +35027,7 @@ class lt extends B {
35027
35027
  async onStartLoading() {
35028
35028
  var e, i;
35029
35029
  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);
35030
+ It && console.log("Add loading scene", this.loadingScene.url, this.loadingScene.asset);
35031
35031
  const n = this.loadingScene.asset;
35032
35032
  C.add(n, this.gameObject);
35033
35033
  const s = this.tryGetSceneEventListener(n);
@@ -35047,7 +35047,7 @@ class lt extends B {
35047
35047
  async onEndLoading() {
35048
35048
  var e;
35049
35049
  if (this._isCurrentlyLoading = !1, (e = this.loadingScene) != null && e.asset) {
35050
- Lt && console.log("Remove loading scene", this.loadingScene.url);
35050
+ It && console.log("Remove loading scene", this.loadingScene.url);
35051
35051
  const i = this.loadingScene.asset, n = this.tryGetSceneEventListener(i);
35052
35052
  if (typeof (n == null ? void 0 : n.sceneClosing) == "function") {
35053
35053
  const s = n.sceneClosing();
@@ -35163,10 +35163,10 @@ class yA {
35163
35163
  */
35164
35164
  begin(t) {
35165
35165
  if (this._isRunning) return;
35166
- Lt && console.log("Preload begin", { delay: t }), this._isRunning = !0;
35166
+ It && console.log("Preload begin", { delay: t }), this._isRunning = !0;
35167
35167
  let e = -10, i, n;
35168
35168
  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) {
35169
+ if (this.allLoaded() && (It && console.log("All scenes (pre-)loaded"), this.stop()), !this._isRunning) {
35170
35170
  clearInterval(l);
35171
35171
  return;
35172
35172
  }
@@ -35179,7 +35179,7 @@ class yA {
35179
35179
  const d = c ? e + i : e - i;
35180
35180
  if (!(d < 0) && !(d < 0 || d >= s.length) && !this._loadTasks.some((u) => u.index === d)) {
35181
35181
  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);
35182
+ 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
35183
  }
35184
35184
  }, 200);
35185
35185
  }
@@ -35229,7 +35229,7 @@ class _A {
35229
35229
  * Asynchronously loads the asset and removes this task from the active tasks list when complete
35230
35230
  */
35231
35231
  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));
35232
+ 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
35233
  const t = this.tasks.indexOf(this);
35234
35234
  t >= 0 && this.tasks.splice(t, 1);
35235
35235
  }
@@ -36248,7 +36248,7 @@ var RA = Object.defineProperty, Ih = (o, t, e, i) => {
36248
36248
  (a = o[s]) && (n = a(t, e, n) || n);
36249
36249
  return n && RA(t, e, n), n;
36250
36250
  };
36251
- const Et = S("debugskybox");
36251
+ const Lt = S("debugskybox");
36252
36252
  Fy("background-image");
36253
36253
  Fy("environment-image");
36254
36254
  function n0(o, t, e, i, n) {
@@ -36257,22 +36257,22 @@ function n0(o, t, e, i, n) {
36257
36257
  const s = new zy();
36258
36258
  s.allowDrop = !1, s.allowNetworking = !1, s.background = e, s.environment = i, C.addComponent(o.scene, s);
36259
36259
  const a = (l) => {
36260
- typeof l == "string" && (Et && console.log(n, "CHANGED TO", l), s.setSkybox(l));
36260
+ typeof l == "string" && (Lt && console.log(n, "CHANGED TO", l), s.setSkybox(l));
36261
36261
  };
36262
36262
  return x1(o.domElement, n, a), s.addEventListener("destroy", () => {
36263
- Et && console.log("Destroyed attribute remote skybox", n), S1(o.domElement, n, a);
36263
+ Lt && console.log("Destroyed attribute remote skybox", n), S1(o.domElement, n, a);
36264
36264
  }), s.setSkybox(t);
36265
36265
  }
36266
36266
  const bu = new Array();
36267
36267
  fe.registerCallback(me.ContextCreationStart, (o) => {
36268
36268
  const t = o.context, e = t.domElement.getAttribute("background-image"), i = t.domElement.getAttribute("environment-image");
36269
36269
  if (e) {
36270
- Et && console.log("Creating remote skybox to load " + e);
36270
+ Lt && console.log("Creating remote skybox to load " + e);
36271
36271
  const n = n0(t, e, !0, !1, "background-image");
36272
36272
  n && bu.push(n);
36273
36273
  }
36274
36274
  if (i) {
36275
- Et && console.log("Creating remote environment to load " + i);
36275
+ Lt && console.log("Creating remote environment to load " + i);
36276
36276
  const n = n0(t, i, !1, !0, "environment-image");
36277
36277
  n && bu.push(n);
36278
36278
  }
@@ -36285,11 +36285,11 @@ function Tx() {
36285
36285
  }
36286
36286
  function s0(o) {
36287
36287
  const e = Tx().find((i) => i.src === o);
36288
- return e ? (Et && console.log("Skybox: Found previously loaded texture for " + o), e.texture) : null;
36288
+ return e ? (Lt && console.log("Skybox: Found previously loaded texture for " + o), e.texture) : null;
36289
36289
  }
36290
36290
  async function TA(o) {
36291
36291
  const t = await o;
36292
- xv(t, !0), Ie(t);
36292
+ t && (xv(t, !0), Ie(t));
36293
36293
  }
36294
36294
  function EA(o, t) {
36295
36295
  const e = Tx();
@@ -36312,6 +36312,7 @@ const Yr = class extends B {
36312
36312
  r(this, "_prevLoadedEnvironment");
36313
36313
  r(this, "_prevEnvironment", null);
36314
36314
  r(this, "_prevBackground", null);
36315
+ r(this, "validProtocols", ["file:", "blob:", "data:"]);
36315
36316
  r(this, "validTextureTypes", [".ktx2", ".hdr", ".exr", ".jpg", ".jpeg", ".png"]);
36316
36317
  r(this, "onDragOverEvent", (e) => {
36317
36318
  if (this.allowDrop && e.dataTransfer)
@@ -36322,11 +36323,11 @@ const Yr = class extends B {
36322
36323
  var i, n, s, a;
36323
36324
  if (this.allowDrop && e.dataTransfer) {
36324
36325
  for (const l of e.dataTransfer.types)
36325
- if (Et && console.log(l), l === "text/uri-list") {
36326
+ if (Lt && console.log(l), l === "text/uri-list") {
36326
36327
  const c = e.dataTransfer.getData(l);
36327
- Et && console.log(l, c);
36328
+ Lt && console.log(l, c);
36328
36329
  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) {
36330
+ 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
36331
  const d = "https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/" + h + "_1k.exr";
36331
36332
  console.log(`[Remote Skybox] Setting skybox from url: ${d}`), e.preventDefault(), this.setSkybox(d);
36332
36333
  break;
@@ -36349,7 +36350,7 @@ const Yr = class extends B {
36349
36350
  }
36350
36351
  } else if (l == "Files") {
36351
36352
  const c = e.dataTransfer.files.item(0);
36352
- if (Et && console.log(l, c), !c) continue;
36353
+ if (Lt && console.log(l, c), !c) continue;
36353
36354
  if (!this.isValidTextureType(c.name)) {
36354
36355
  console.warn(`[RemoteSkybox]: File "${c.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);
36355
36356
  return;
@@ -36374,7 +36375,7 @@ const Yr = class extends B {
36374
36375
  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
36376
  }
36376
36377
  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.`));
36378
+ 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
36379
  }
36379
36380
  /**
36380
36381
  * Set the skybox from a given url
@@ -36383,23 +36384,18 @@ const Yr = class extends B {
36383
36384
  * @returns Whether the skybox was successfully set
36384
36385
  */
36385
36386
  async setSkybox(e, i) {
36386
- var a;
36387
+ var a, l;
36387
36388
  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)
36389
+ 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
36390
  return this.apply(), !0;
36395
- (a = this._prevLoadedEnvironment) == null || a.dispose(), this._prevLoadedEnvironment = void 0, this._prevUrl = e;
36391
+ (l = this._prevLoadedEnvironment) == null || l.dispose(), this._prevLoadedEnvironment = void 0, this._prevUrl = e;
36396
36392
  const n = await this.loadTexture(e, i);
36397
36393
  if (!n)
36398
- return Et && console.warn("RemoteSkybox: Failed to load texture from url", e), !1;
36394
+ return Lt && console.warn("RemoteSkybox: Failed to load texture from url", e), !1;
36399
36395
  if (!this.enabled)
36400
- return Et && console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"), !1;
36396
+ return Lt && console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"), !1;
36401
36397
  if (this._prevUrl !== e)
36402
- return Et && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1;
36398
+ return Lt && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1;
36403
36399
  this.url = e;
36404
36400
  const s = e.lastIndexOf("/");
36405
36401
  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 +36407,7 @@ const Yr = class extends B {
36411
36407
  const n = s0(i);
36412
36408
  if (n) {
36413
36409
  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 _;
36410
+ 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
36411
  }
36416
36412
  const s = i.endsWith(".exr"), a = i.endsWith(".hdr"), l = i.endsWith(".ktx2");
36417
36413
  if (s)
@@ -36425,14 +36421,14 @@ const Yr = class extends B {
36425
36421
  }
36426
36422
  } else
36427
36423
  this._loader instanceof $a || (this._loader = new $a());
36428
- Et && console.log("Loading skybox: " + e);
36429
- const c = this._loader.loadAsync(e);
36424
+ Lt && console.log("Loading skybox: " + e);
36425
+ const c = this._loader.loadAsync(e).catch((_) => (console.warn("RemoteSkybox: Failed to load texture from url:", e), null));
36430
36426
  return EA(i, c), await c;
36431
36427
  }
36432
36428
  apply() {
36433
36429
  var i;
36434
36430
  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));
36431
+ 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
36432
  }
36437
36433
  isRemoteTexture(e) {
36438
36434
  return e.startsWith("http://") || e.startsWith("https://");
@@ -36440,6 +36436,8 @@ const Yr = class extends B {
36440
36436
  isValidTextureType(e) {
36441
36437
  for (const i of this.validTextureTypes)
36442
36438
  if (e.endsWith(i)) return !0;
36439
+ for (const i of this.validProtocols)
36440
+ if (e.startsWith(i)) return !0;
36443
36441
  return !1;
36444
36442
  }
36445
36443
  registerDropEvents() {