@limrun/ui 0.22.1 → 0.22.3
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/README.md +13 -7
- package/dist/{BufferGeometryUtils-B2-bJqFj.js → BufferGeometryUtils-CMbyl1DL.js} +1 -1
- package/dist/{BufferGeometryUtils-BcXIkYhS.mjs → BufferGeometryUtils-DEy5W2hb.mjs} +1 -1
- package/dist/{GLTFLoader-BQvr_TBF.mjs → GLTFLoader-B3xbM8m1.mjs} +2 -2
- package/dist/{GLTFLoader-CsxjkQ8a.js → GLTFLoader-CfPNHfJQ.js} +1 -1
- package/dist/components/macbook-geometry.d.ts +5 -5
- package/dist/components/model-source.d.ts +4 -1
- package/dist/components/remote-control.d.ts +3 -2
- package/dist/{duo-frame-CyoWZakh.mjs → duo-frame-BCmB9_5p.mjs} +4 -4
- package/dist/{duo-frame-B04_gIge.js → duo-frame-Bm0hprn9.js} +2 -2
- package/dist/{duo-view-DJEQ3Q74.mjs → duo-view-C07GD_5E.mjs} +2 -2
- package/dist/{duo-view-BHwnQmx_.js → duo-view-tUJbbWoS.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +1 -1
- package/dist/macbook-frame-BxJfxUcU.js +2 -0
- package/dist/macbook-frame-Dm6ko0j9.mjs +340 -0
- package/dist/macbook-model-B4t8BSHX.js +1 -0
- package/dist/macbook-model-BYrio_FY.mjs +4 -0
- package/dist/{model-source-BAZAKTcr.mjs → model-source-CN_i4mVy.mjs} +57 -47
- package/dist/{model-source-DbYJQWkh.js → model-source-D3_k9qRK.js} +1 -1
- package/dist/{remote-control-PGtDEDgm.mjs → remote-control-BX6dzHtt.mjs} +686 -720
- package/dist/remote-control-CEVcOPQZ.js +1 -0
- package/package.json +1 -1
- package/dist/macbook-frame-Be0dCliH.js +0 -3
- package/dist/macbook-frame-DzwIHHCA.mjs +0 -344
- package/dist/macbook-model-BiMxLpmf.mjs +0 -4
- package/dist/macbook-model-BpUdvtlU.js +0 -1
- package/dist/remote-control-Db6ssV0S.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as Ao, useRef as hr, useCallback as wo } from "react";
|
|
2
|
-
const Za = "183", nh = 0, Co = 1, ih = 2, Vs = 1, sh = 2, Vi = 3, Un = 0, Pe = 1, gn = 2, Mn = 0, xi = 1, Ro = 2, Po = 3, Lo = 4, rh = 5, qn = 100, ah = 101, oh = 102, lh = 103, ch = 104, hh = 200, uh = 201, fh = 202, dh = 203, Kr = 204, $r = 205, ph = 206, mh = 207, gh = 208, _h = 209, xh = 210, vh = 211, Mh = 212, Sh = 213, yh = 214, jr = 0, Qr = 1, ta = 2, Mi = 3, ea = 4, na = 5, ia = 6, sa = 7, tc = 0, bh = 1, Eh = 2, en = 0, ec = 1, nc = 2, ic = 3, Ka = 4, sc = 5, rc = 6, ac = 7, Io = "attached", Th = "detached", oc = 300, Kn = 301, Si = 302, ks = 303, ur = 304, er = 306, ra = 1e3, _n = 1001, aa = 1002, ye = 1003, Ah = 1004, os = 1005, Me = 1006, fr = 1007, Jn = 1008, Fe = 1009, lc = 1010, cc = 1011, Yi = 1012, $a = 1013, sn = 1014, Oe = 1015, yn = 1016, ja = 1017, Qa = 1018, Ji = 1020, hc = 35902, uc = 35899, fc = 1021, dc = 1022, Be = 1023, bn = 1026, Zn = 1027, to = 1028, eo = 1029, yi = 1030, no = 1031, io = 1033, Gs = 33776, Hs = 33777, Ws = 33778, Xs = 33779, oa = 35840, la = 35841, ca = 35842, ha = 35843, ua = 36196, fa = 37492, da = 37496, pa = 37488, ma = 37489, ga = 37490, _a = 37491, xa = 37808, va = 37809, Ma = 37810, Sa = 37811, ya = 37812, ba = 37813, Ea = 37814, Ta = 37815, Aa = 37816, wa = 37817, Ca = 37818, Ra = 37819, Pa = 37820, La = 37821, Ia = 36492, Da = 36494, Na = 36495, Ua = 36283, Fa = 36284, Oa = 36285, Ba = 36286, Ys = 2300, za = 2301, dr = 2302, Do = 2303, No = 2400, Uo = 2401, Fo = 2402, wh = 2500,
|
|
2
|
+
const Za = "183", nh = 0, Co = 1, ih = 2, Vs = 1, sh = 2, Vi = 3, Un = 0, Pe = 1, gn = 2, Mn = 0, xi = 1, Ro = 2, Po = 3, Lo = 4, rh = 5, qn = 100, ah = 101, oh = 102, lh = 103, ch = 104, hh = 200, uh = 201, fh = 202, dh = 203, Kr = 204, $r = 205, ph = 206, mh = 207, gh = 208, _h = 209, xh = 210, vh = 211, Mh = 212, Sh = 213, yh = 214, jr = 0, Qr = 1, ta = 2, Mi = 3, ea = 4, na = 5, ia = 6, sa = 7, tc = 0, bh = 1, Eh = 2, en = 0, ec = 1, nc = 2, ic = 3, Ka = 4, sc = 5, rc = 6, ac = 7, Io = "attached", Th = "detached", oc = 300, Kn = 301, Si = 302, ks = 303, ur = 304, er = 306, ra = 1e3, _n = 1001, aa = 1002, ye = 1003, Ah = 1004, os = 1005, Me = 1006, fr = 1007, Jn = 1008, Fe = 1009, lc = 1010, cc = 1011, Yi = 1012, $a = 1013, sn = 1014, Oe = 1015, yn = 1016, ja = 1017, Qa = 1018, Ji = 1020, hc = 35902, uc = 35899, fc = 1021, dc = 1022, Be = 1023, bn = 1026, Zn = 1027, to = 1028, eo = 1029, yi = 1030, no = 1031, io = 1033, Gs = 33776, Hs = 33777, Ws = 33778, Xs = 33779, oa = 35840, la = 35841, ca = 35842, ha = 35843, ua = 36196, fa = 37492, da = 37496, pa = 37488, ma = 37489, ga = 37490, _a = 37491, xa = 37808, va = 37809, Ma = 37810, Sa = 37811, ya = 37812, ba = 37813, Ea = 37814, Ta = 37815, Aa = 37816, wa = 37817, Ca = 37818, Ra = 37819, Pa = 37820, La = 37821, Ia = 36492, Da = 36494, Na = 36495, Ua = 36283, Fa = 36284, Oa = 36285, Ba = 36286, Ys = 2300, za = 2301, dr = 2302, Do = 2303, No = 2400, Uo = 2401, Fo = 2402, wh = 2500, Y_ = 0, J_ = 1, Z_ = 2, Ch = 3200, pc = 0, Rh = 1, Dn = "", Ne = "srgb", bi = "srgb-linear", Js = "linear", te = "srgb", ni = 7680, Oo = 519, Ph = 512, Lh = 513, Ih = 514, so = 515, Dh = 516, Nh = 517, ro = 518, Uh = 519, Va = 35044, K_ = 35048, Bo = "300 es", tn = 2e3, Zi = 2001;
|
|
3
3
|
function Fh(i) {
|
|
4
4
|
for (let t = i.length - 1; t >= 0; --t)
|
|
5
5
|
if (i[t] >= 65535) return !0;
|
|
@@ -8031,7 +8031,7 @@ class Re extends wi {
|
|
|
8031
8031
|
this.dispatchEvent({ type: "dispose" });
|
|
8032
8032
|
}
|
|
8033
8033
|
}
|
|
8034
|
-
class
|
|
8034
|
+
class $_ {
|
|
8035
8035
|
/**
|
|
8036
8036
|
* Constructs a new interleaved buffer.
|
|
8037
8037
|
*
|
|
@@ -8994,7 +8994,7 @@ function Es(i, t, e, n, s, r, a, o, c, l) {
|
|
|
8994
8994
|
return h;
|
|
8995
8995
|
}
|
|
8996
8996
|
const el = /* @__PURE__ */ new D(), nl = /* @__PURE__ */ new ce(), il = /* @__PURE__ */ new ce(), bu = /* @__PURE__ */ new D(), sl = /* @__PURE__ */ new Jt(), Ts = /* @__PURE__ */ new D(), Ur = /* @__PURE__ */ new En(), rl = /* @__PURE__ */ new Jt(), Fr = /* @__PURE__ */ new es();
|
|
8997
|
-
class
|
|
8997
|
+
class j_ extends Ge {
|
|
8998
8998
|
/**
|
|
8999
8999
|
* Constructs a new skinned mesh.
|
|
9000
9000
|
*
|
|
@@ -9290,7 +9290,7 @@ class ol extends ke {
|
|
|
9290
9290
|
}
|
|
9291
9291
|
}
|
|
9292
9292
|
const di = /* @__PURE__ */ new Jt(), ll = /* @__PURE__ */ new Jt(), As = [], cl = /* @__PURE__ */ new Fn(), Au = /* @__PURE__ */ new Jt(), Ui = /* @__PURE__ */ new Ge(), Fi = /* @__PURE__ */ new En();
|
|
9293
|
-
class
|
|
9293
|
+
class Q_ extends Ge {
|
|
9294
9294
|
/**
|
|
9295
9295
|
* Constructs a new instanced mesh.
|
|
9296
9296
|
*
|
|
@@ -9887,7 +9887,7 @@ function Rs(i, t, e, n, s, r, a) {
|
|
|
9887
9887
|
};
|
|
9888
9888
|
}
|
|
9889
9889
|
const fl = /* @__PURE__ */ new D(), dl = /* @__PURE__ */ new D();
|
|
9890
|
-
class
|
|
9890
|
+
class t0 extends bc {
|
|
9891
9891
|
/**
|
|
9892
9892
|
* Constructs a new line segments.
|
|
9893
9893
|
*
|
|
@@ -9909,7 +9909,7 @@ class Q_ extends bc {
|
|
|
9909
9909
|
return this;
|
|
9910
9910
|
}
|
|
9911
9911
|
}
|
|
9912
|
-
class
|
|
9912
|
+
class e0 extends bc {
|
|
9913
9913
|
/**
|
|
9914
9914
|
* Constructs a new line loop.
|
|
9915
9915
|
*
|
|
@@ -9938,7 +9938,7 @@ class Lu extends Qn {
|
|
|
9938
9938
|
}
|
|
9939
9939
|
}
|
|
9940
9940
|
const pl = /* @__PURE__ */ new Jt(), ka = /* @__PURE__ */ new es(), Ps = /* @__PURE__ */ new En(), Ls = /* @__PURE__ */ new D();
|
|
9941
|
-
class
|
|
9941
|
+
class n0 extends fe {
|
|
9942
9942
|
/**
|
|
9943
9943
|
* Constructs a new point cloud.
|
|
9944
9944
|
*
|
|
@@ -10011,7 +10011,7 @@ function ml(i, t, e, n, s, r, a) {
|
|
|
10011
10011
|
});
|
|
10012
10012
|
}
|
|
10013
10013
|
}
|
|
10014
|
-
class
|
|
10014
|
+
class i0 extends be {
|
|
10015
10015
|
/**
|
|
10016
10016
|
* Constructs a new video texture.
|
|
10017
10017
|
*
|
|
@@ -12273,7 +12273,7 @@ class vf extends Qn {
|
|
|
12273
12273
|
return super.copy(t), this.defines = { STANDARD: "" }, this.color.copy(t.color), this.roughness = t.roughness, this.metalness = t.metalness, this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalMapType = t.normalMapType, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.roughnessMap = t.roughnessMap, this.metalnessMap = t.metalnessMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapRotation.copy(t.envMapRotation), this.envMapIntensity = t.envMapIntensity, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.flatShading = t.flatShading, this.fog = t.fog, this;
|
|
12274
12274
|
}
|
|
12275
12275
|
}
|
|
12276
|
-
class
|
|
12276
|
+
class s0 extends vf {
|
|
12277
12277
|
/**
|
|
12278
12278
|
* Constructs a new mesh physical material.
|
|
12279
12279
|
*
|
|
@@ -13092,7 +13092,7 @@ class tr extends Ze {
|
|
|
13092
13092
|
}
|
|
13093
13093
|
}
|
|
13094
13094
|
tr.prototype.ValueTypeName = "vector";
|
|
13095
|
-
class
|
|
13095
|
+
class r0 {
|
|
13096
13096
|
/**
|
|
13097
13097
|
* Constructs a new animation clip.
|
|
13098
13098
|
*
|
|
@@ -13618,7 +13618,7 @@ class If extends Error {
|
|
|
13618
13618
|
super(t), this.response = e;
|
|
13619
13619
|
}
|
|
13620
13620
|
}
|
|
13621
|
-
class
|
|
13621
|
+
class a0 extends ss {
|
|
13622
13622
|
/**
|
|
13623
13623
|
* Constructs a new file loader.
|
|
13624
13624
|
*
|
|
@@ -13820,7 +13820,7 @@ class Df extends ss {
|
|
|
13820
13820
|
return o.addEventListener("load", c, !1), o.addEventListener("error", l, !1), t.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), vn.add(`image:${t}`, o), r.manager.itemStart(t), o.src = t, o;
|
|
13821
13821
|
}
|
|
13822
13822
|
}
|
|
13823
|
-
class
|
|
13823
|
+
class o0 extends ss {
|
|
13824
13824
|
/**
|
|
13825
13825
|
* Constructs a new texture loader.
|
|
13826
13826
|
*
|
|
@@ -14241,7 +14241,7 @@ class Uf extends fo {
|
|
|
14241
14241
|
return super.copy(t), this.focus = t.focus, this;
|
|
14242
14242
|
}
|
|
14243
14243
|
}
|
|
14244
|
-
class
|
|
14244
|
+
class l0 extends rr {
|
|
14245
14245
|
/**
|
|
14246
14246
|
* Constructs a new spot light.
|
|
14247
14247
|
*
|
|
@@ -14286,7 +14286,7 @@ class Ff extends fo {
|
|
|
14286
14286
|
super(new Ue(90, 1, 0.5, 500)), this.isPointLightShadow = !0;
|
|
14287
14287
|
}
|
|
14288
14288
|
}
|
|
14289
|
-
class
|
|
14289
|
+
class c0 extends rr {
|
|
14290
14290
|
/**
|
|
14291
14291
|
* Constructs a new point light.
|
|
14292
14292
|
*
|
|
@@ -14414,7 +14414,7 @@ class wl extends rr {
|
|
|
14414
14414
|
return e.object.shadow = this.shadow.toJSON(), e.object.target = this.target.uuid, e;
|
|
14415
14415
|
}
|
|
14416
14416
|
}
|
|
14417
|
-
class
|
|
14417
|
+
class h0 {
|
|
14418
14418
|
/**
|
|
14419
14419
|
* Extracts the base URL from the given URL.
|
|
14420
14420
|
*
|
|
@@ -14439,7 +14439,7 @@ class c0 {
|
|
|
14439
14439
|
}
|
|
14440
14440
|
}
|
|
14441
14441
|
const Hr = /* @__PURE__ */ new WeakMap();
|
|
14442
|
-
class
|
|
14442
|
+
class u0 extends ss {
|
|
14443
14443
|
/**
|
|
14444
14444
|
* Constructs a new image bitmap loader.
|
|
14445
14445
|
*
|
|
@@ -14926,7 +14926,7 @@ ae.prototype.SetterByBindingTypeAndVersioning = [
|
|
|
14926
14926
|
]
|
|
14927
14927
|
];
|
|
14928
14928
|
const Cl = /* @__PURE__ */ new Jt();
|
|
14929
|
-
class
|
|
14929
|
+
class f0 {
|
|
14930
14930
|
/**
|
|
14931
14931
|
* Constructs a new raycaster.
|
|
14932
14932
|
*
|
|
@@ -15038,7 +15038,7 @@ function Xa(i, t, e, n) {
|
|
|
15038
15038
|
}
|
|
15039
15039
|
}
|
|
15040
15040
|
const Pl = /* @__PURE__ */ new ht();
|
|
15041
|
-
class
|
|
15041
|
+
class d0 {
|
|
15042
15042
|
/**
|
|
15043
15043
|
* Constructs a new bounding box.
|
|
15044
15044
|
*
|
|
@@ -25894,7 +25894,7 @@ function H_(i) {
|
|
|
25894
25894
|
const r = new qa(i), a = r.fromEquirectangular(s);
|
|
25895
25895
|
return s.dispose(), r.dispose(), a;
|
|
25896
25896
|
}
|
|
25897
|
-
function
|
|
25897
|
+
function p0(i) {
|
|
25898
25898
|
const { container: t, videos: e, lighting: n } = i;
|
|
25899
25899
|
let s;
|
|
25900
25900
|
try {
|
|
@@ -25948,7 +25948,7 @@ function d0(i) {
|
|
|
25948
25948
|
}
|
|
25949
25949
|
};
|
|
25950
25950
|
}
|
|
25951
|
-
function
|
|
25951
|
+
function m0(i) {
|
|
25952
25952
|
const [t, e] = Ao(i), [n, s] = Ao(!1), r = hr(t);
|
|
25953
25953
|
r.current = t;
|
|
25954
25954
|
const a = hr(n);
|
|
@@ -25966,28 +25966,38 @@ function p0(i) {
|
|
|
25966
25966
|
);
|
|
25967
25967
|
return { view: t, viewRef: r, chooseView: c, locked: n, lockedRef: a, setLocked: s, orbit: o, drag: l };
|
|
25968
25968
|
}
|
|
25969
|
-
|
|
25969
|
+
const W_ = {
|
|
25970
|
+
supported: typeof WebAssembly == "object",
|
|
25971
|
+
async decodeGltfBufferAsync(i, t, e, n, s) {
|
|
25972
|
+
const { MeshoptDecoder: r } = await import("./meshopt_decoder.module-C4Z_evpr.mjs");
|
|
25973
|
+
await r.ready;
|
|
25974
|
+
const a = new Uint8Array(i * t);
|
|
25975
|
+
return r.decodeGltfBuffer(a, i, t, e, n, s), a;
|
|
25976
|
+
}
|
|
25977
|
+
};
|
|
25978
|
+
function X_(i) {
|
|
25970
25979
|
const t = i.indexOf(","), e = i.slice(0, t), n = i.slice(t + 1);
|
|
25971
25980
|
if (!e.endsWith(";base64")) return new TextEncoder().encode(decodeURIComponent(n)).buffer;
|
|
25972
25981
|
const s = atob(n), r = new Uint8Array(s.length);
|
|
25973
25982
|
for (let a = 0; a < s.length; a++) r[a] = s.charCodeAt(a);
|
|
25974
25983
|
return r.buffer;
|
|
25975
25984
|
}
|
|
25976
|
-
async function
|
|
25985
|
+
async function g0(i, t) {
|
|
25986
|
+
i.setMeshoptDecoder(W_);
|
|
25977
25987
|
const e = typeof t == "string" ? t : await t();
|
|
25978
|
-
return e.startsWith("data:") ? i.parseAsync(
|
|
25988
|
+
return e.startsWith("data:") ? i.parseAsync(X_(e), "") : i.loadAsync(e);
|
|
25979
25989
|
}
|
|
25980
25990
|
export {
|
|
25981
|
-
|
|
25991
|
+
j_ as $,
|
|
25982
25992
|
Jn as A,
|
|
25983
25993
|
Re as B,
|
|
25984
25994
|
Zt as C,
|
|
25985
25995
|
gn as D,
|
|
25986
25996
|
fr as E,
|
|
25987
|
-
|
|
25997
|
+
a0 as F,
|
|
25988
25998
|
hs as G,
|
|
25989
25999
|
Ah as H,
|
|
25990
|
-
|
|
26000
|
+
$_ as I,
|
|
25991
26001
|
ye as J,
|
|
25992
26002
|
ra as K,
|
|
25993
26003
|
Me as L,
|
|
@@ -25996,24 +26006,24 @@ export {
|
|
|
25996
26006
|
fe as O,
|
|
25997
26007
|
Ue as P,
|
|
25998
26008
|
jn as Q,
|
|
25999
|
-
|
|
26009
|
+
f0 as R,
|
|
26000
26010
|
Ne as S,
|
|
26001
26011
|
be as T,
|
|
26002
26012
|
aa as U,
|
|
26003
|
-
|
|
26013
|
+
i0 as V,
|
|
26004
26014
|
_n as W,
|
|
26005
26015
|
Lu as X,
|
|
26006
26016
|
Qn as Y,
|
|
26007
26017
|
Pu as Z,
|
|
26008
26018
|
ae as _,
|
|
26009
26019
|
Mc as a,
|
|
26010
|
-
|
|
26020
|
+
t0 as a0,
|
|
26011
26021
|
bc as a1,
|
|
26012
|
-
|
|
26013
|
-
|
|
26022
|
+
e0 as a2,
|
|
26023
|
+
n0 as a3,
|
|
26014
26024
|
po as a4,
|
|
26015
26025
|
yc as a5,
|
|
26016
|
-
|
|
26026
|
+
r0 as a6,
|
|
26017
26027
|
Eu as a7,
|
|
26018
26028
|
Ys as a8,
|
|
26019
26029
|
za as a9,
|
|
@@ -26028,34 +26038,34 @@ export {
|
|
|
26028
26038
|
wc as ai,
|
|
26029
26039
|
Ic as aj,
|
|
26030
26040
|
Bc as ak,
|
|
26031
|
-
|
|
26041
|
+
K_ as al,
|
|
26032
26042
|
Wt as am,
|
|
26033
26043
|
Oc as an,
|
|
26034
26044
|
Ac as ao,
|
|
26035
|
-
|
|
26045
|
+
d0 as ap,
|
|
26036
26046
|
Ge as b,
|
|
26037
|
-
|
|
26047
|
+
p0 as c,
|
|
26038
26048
|
D as d,
|
|
26039
26049
|
vf as e,
|
|
26040
|
-
|
|
26050
|
+
s0 as f,
|
|
26041
26051
|
Fn as g,
|
|
26042
26052
|
ht as h,
|
|
26043
26053
|
iu as i,
|
|
26044
26054
|
ke as j,
|
|
26045
|
-
|
|
26046
|
-
|
|
26047
|
-
|
|
26048
|
-
|
|
26055
|
+
Y_ as k,
|
|
26056
|
+
g0 as l,
|
|
26057
|
+
Z_ as m,
|
|
26058
|
+
J_ as n,
|
|
26049
26059
|
ss as o,
|
|
26050
|
-
|
|
26060
|
+
h0 as p,
|
|
26051
26061
|
bi as q,
|
|
26052
|
-
|
|
26053
|
-
|
|
26062
|
+
l0 as r,
|
|
26063
|
+
c0 as s,
|
|
26054
26064
|
wl as t,
|
|
26055
|
-
|
|
26065
|
+
m0 as u,
|
|
26056
26066
|
Jt as v,
|
|
26057
|
-
|
|
26067
|
+
Q_ as w,
|
|
26058
26068
|
ol as x,
|
|
26059
|
-
|
|
26060
|
-
|
|
26069
|
+
o0 as y,
|
|
26070
|
+
u0 as z
|
|
26061
26071
|
};
|
|
@@ -4046,4 +4046,4 @@ void main() {
|
|
|
4046
4046
|
|
|
4047
4047
|
}
|
|
4048
4048
|
|
|
4049
|
-
}`;class t0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new Dc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new ln({vertexShader:j_,fragmentShader:Q_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ve(new cs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class e0 extends Ci{constructor(t,e){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,f=null,u=null,d=null,g=null;const v=typeof XRWebGLBinding<"u",m=new t0,p={},S=e.getContextAttributes();let b=null,y=null;const C=[],w=[],P=new ct;let x=null;const T=new Le;T.viewport=new ce;const H=new Le;H.viewport=new ce;const R=[T,H],U=new nd;let O=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getTargetRaySpace()},this.getControllerGrip=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getGripSpace()},this.getHand=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getHandSpace()};function B(J){const st=w.indexOf(J.inputSource);if(st===-1)return;const at=C[st];at!==void 0&&(at.update(J.inputSource,J.frame,l||a),at.dispatchEvent({type:J.type,data:J.inputSource}))}function F(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",z);for(let J=0;J<C.length;J++){const st=w[J];st!==null&&(w[J]=null,C[J].disconnect(st))}O=null,G=null,m.reset();for(const J in p)delete p[J];t.setRenderTarget(b),d=null,u=null,f=null,r=null,y=null,ie.stop(),n.isPresenting=!1,t.setPixelRatio(x),t.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,n.isPresenting===!0&&Rt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&Rt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(J){l=J},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){return f===null&&v&&(f=new XRWebGLBinding(r,e)),f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(J){if(r=J,r!==null){if(b=t.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",F),r.addEventListener("inputsourceschange",z),S.xrCompatible!==!0&&await e.makeXRCompatible(),x=t.getPixelRatio(),t.getSize(P),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let at=null,Nt=null,It=null;S.depth&&(It=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,at=S.stencil?jn:Tn,Nt=S.stencil?tr:an);const zt={colorFormat:e.RGBA8,depthFormat:It,scaleFactor:s};f=this.getBinding(),u=f.createProjectionLayer(zt),r.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),y=new sn(u.textureWidth,u.textureHeight,{format:Be,type:Fe,depthTexture:new rr(u.textureWidth,u.textureHeight,Nt,void 0,void 0,void 0,void 0,void 0,void 0,at),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const at={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,e,at),r.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new sn(d.framebufferWidth,d.framebufferHeight,{format:Be,type:Fe,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),ie.setContext(r),ie.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function z(J){for(let st=0;st<J.removed.length;st++){const at=J.removed[st],Nt=w.indexOf(at);Nt>=0&&(w[Nt]=null,C[Nt].disconnect(at))}for(let st=0;st<J.added.length;st++){const at=J.added[st];let Nt=w.indexOf(at);if(Nt===-1){for(let zt=0;zt<C.length;zt++)if(zt>=w.length){w.push(at),Nt=zt;break}else if(w[zt]===null){w[zt]=at,Nt=zt;break}if(Nt===-1)break}const It=C[Nt];It&&It.connect(at)}}const nt=new D,j=new D;function mt(J,st,at){nt.setFromMatrixPosition(st.matrixWorld),j.setFromMatrixPosition(at.matrixWorld);const Nt=nt.distanceTo(j),It=st.projectionMatrix.elements,zt=at.projectionMatrix.elements,re=It[14]/(It[10]-1),kt=It[14]/(It[10]+1),K=(It[9]+1)/It[5],tt=(It[9]-1)/It[5],$=(It[8]-1)/It[0],ut=(zt[8]+1)/zt[0],A=re*$,Dt=re*ut,xt=Nt/(-$+ut),Ut=xt*-$;if(st.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(Ut),J.translateZ(xt),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),It[10]===-1)J.projectionMatrix.copy(st.projectionMatrix),J.projectionMatrixInverse.copy(st.projectionMatrixInverse);else{const ot=re+xt,E=kt+xt,_=A-Ut,I=Dt+(Nt-Ut),X=K*kt/E*ot,Z=tt*kt/E*ot;J.projectionMatrix.makePerspective(_,I,X,Z,ot,E),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function _t(J,st){st===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(st.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(r===null)return;let st=J.near,at=J.far;m.texture!==null&&(m.depthNear>0&&(st=m.depthNear),m.depthFar>0&&(at=m.depthFar)),U.near=H.near=T.near=st,U.far=H.far=T.far=at,(O!==U.near||G!==U.far)&&(r.updateRenderState({depthNear:U.near,depthFar:U.far}),O=U.near,G=U.far),U.layers.mask=J.layers.mask|6,T.layers.mask=U.layers.mask&-5,H.layers.mask=U.layers.mask&-3;const Nt=J.parent,It=U.cameras;_t(U,Nt);for(let zt=0;zt<It.length;zt++)_t(It[zt],Nt);It.length===2?mt(U,T,H):U.projectionMatrix.copy(T.projectionMatrix),gt(J,U,Nt)};function gt(J,st,at){at===null?J.matrix.copy(st.matrixWorld):(J.matrix.copy(at.matrixWorld),J.matrix.invert(),J.matrix.multiply(st.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(st.projectionMatrix),J.projectionMatrixInverse.copy(st.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Ti*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(u===null&&d===null))return c},this.setFoveation=function(J){c=J,u!==null&&(u.fixedFoveation=J),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=J)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(U)},this.getCameraTexture=function(J){return p[J]};let Bt=null;function jt(J,st){if(h=st.getViewerPose(l||a),g=st,h!==null){const at=h.views;d!==null&&(t.setRenderTargetFramebuffer(y,d.framebuffer),t.setRenderTarget(y));let Nt=!1;at.length!==U.cameras.length&&(U.cameras.length=0,Nt=!0);for(let kt=0;kt<at.length;kt++){const K=at[kt];let tt=null;if(d!==null)tt=d.getViewport(K);else{const ut=f.getViewSubImage(u,K);tt=ut.viewport,kt===0&&(t.setRenderTargetTextures(y,ut.colorTexture,ut.depthStencilTexture),t.setRenderTarget(y))}let $=R[kt];$===void 0&&($=new Le,$.layers.enable(kt),$.viewport=new ce,R[kt]=$),$.matrix.fromArray(K.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(K.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(tt.x,tt.y,tt.width,tt.height),kt===0&&(U.matrix.copy($.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),Nt===!0&&U.cameras.push($)}const It=r.enabledFeatures;if(It&&It.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&v){f=n.getBinding();const kt=f.getDepthInformation(at[0]);kt&&kt.isValid&&kt.texture&&m.init(kt,r.renderState)}if(It&&It.includes("camera-access")&&v){t.state.unbindTexture(),f=n.getBinding();for(let kt=0;kt<at.length;kt++){const K=at[kt].camera;if(K){let tt=p[K];tt||(tt=new Dc,p[K]=tt);const $=f.getCameraImage(K);tt.sourceTexture=$}}}}for(let at=0;at<C.length;at++){const Nt=w[at],It=C[at];Nt!==null&&It!==void 0&&It.update(Nt,st,l||a)}Bt&&Bt(J,st),st.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:st}),g=null}const ie=new Yc;ie.setAnimationLoop(jt),this.setAnimationLoop=function(J){Bt=J},this.dispose=function(){}}}const Jn=new on,n0=new Jt;function i0(i,t){function e(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Gc(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,S,b,y){p.isMeshBasicMaterial?s(m,p):p.isMeshLambertMaterial?(s(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(s(m,p),f(m,p)):p.isMeshPhongMaterial?(s(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(s(m,p),u(m,p),p.isMeshPhysicalMaterial&&d(m,p,y)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),v(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?c(m,p,S,b):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,e(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Ie&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,e(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Ie&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,e(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,e(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const S=t.get(p),b=S.envMap,y=S.envMapRotation;b&&(m.envMap.value=b,Jn.copy(y),Jn.x*=-1,Jn.y*=-1,Jn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Jn.y*=-1,Jn.z*=-1),m.envMapRotation.value.setFromMatrix4(n0.makeRotationFromEuler(Jn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,S,b){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*S,m.scale.value=b*.5,p.map&&(m.map.value=p.map,e(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function f(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function u(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,S){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ie&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=S.texture,m.transmissionSamplerSize.value.set(S.width,S.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function v(m,p){const S=t.get(p).light;m.referencePosition.value.setFromMatrixPosition(S.matrixWorld),m.nearDistance.value=S.shadow.camera.near,m.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function r0(i,t,e,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(S,b){const y=b.program;n.uniformBlockBinding(S,y)}function l(S,b){let y=r[S.id];y===void 0&&(g(S),y=h(S),r[S.id]=y,S.addEventListener("dispose",m));const C=b.program;n.updateUBOMapping(S,C);const w=t.render.frame;s[S.id]!==w&&(u(S),s[S.id]=w)}function h(S){const b=f();S.__bindingPointIndex=b;const y=i.createBuffer(),C=S.__size,w=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,C,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,b,y),y}function f(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return Ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(S){const b=r[S.id],y=S.uniforms,C=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,b);for(let w=0,P=y.length;w<P;w++){const x=Array.isArray(y[w])?y[w]:[y[w]];for(let T=0,H=x.length;T<H;T++){const R=x[T];if(d(R,w,T,C)===!0){const U=R.__offset,O=Array.isArray(R.value)?R.value:[R.value];let G=0;for(let B=0;B<O.length;B++){const F=O[B],z=v(F);typeof F=="number"||typeof F=="boolean"?(R.__data[0]=F,i.bufferSubData(i.UNIFORM_BUFFER,U+G,R.__data)):F.isMatrix3?(R.__data[0]=F.elements[0],R.__data[1]=F.elements[1],R.__data[2]=F.elements[2],R.__data[3]=0,R.__data[4]=F.elements[3],R.__data[5]=F.elements[4],R.__data[6]=F.elements[5],R.__data[7]=0,R.__data[8]=F.elements[6],R.__data[9]=F.elements[7],R.__data[10]=F.elements[8],R.__data[11]=0):(F.toArray(R.__data,G),G+=z.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,U,R.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(S,b,y,C){const w=S.value,P=b+"_"+y;if(C[P]===void 0)return typeof w=="number"||typeof w=="boolean"?C[P]=w:C[P]=w.clone(),!0;{const x=C[P];if(typeof w=="number"||typeof w=="boolean"){if(x!==w)return C[P]=w,!0}else if(x.equals(w)===!1)return x.copy(w),!0}return!1}function g(S){const b=S.uniforms;let y=0;const C=16;for(let P=0,x=b.length;P<x;P++){const T=Array.isArray(b[P])?b[P]:[b[P]];for(let H=0,R=T.length;H<R;H++){const U=T[H],O=Array.isArray(U.value)?U.value:[U.value];for(let G=0,B=O.length;G<B;G++){const F=O[G],z=v(F),nt=y%C,j=nt%z.boundary,mt=nt+j;y+=j,mt!==0&&C-mt<z.storage&&(y+=C-mt),U.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=y,y+=z.storage}}}const w=y%C;return w>0&&(y+=C-w),S.__size=y,S.__cache={},this}function v(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?Rt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Rt("WebGLRenderer: Unsupported uniform value type.",S),b}function m(S){const b=S.target;b.removeEventListener("dispose",m);const y=a.indexOf(b.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function p(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:c,update:l,dispose:p}}const s0=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let je=null;function a0(){return je===null&&(je=new ls(s0,16,16,Ei,En),je.name="DFG_LUT",je.minFilter=ge,je.magFilter=ge,je.wrapS=en,je.wrapT=en,je.generateMipmaps=!1,je.needsUpdate=!0),je}class o0{constructor(t={}){const{canvas:e=Xh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:u=!1,outputBufferType:d=Fe}=t;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const v=d,m=new Set([ao,so,ro]),p=new Set([Fe,an,Qi,tr,eo,no]),S=new Uint32Array(4),b=new Int32Array(4);let y=null,C=null;const w=[],P=[];let x=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=rn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let H=!1;this._outputColorSpace=Pe;let R=0,U=0,O=null,G=-1,B=null;const F=new ce,z=new ce;let nt=null;const j=new Zt(0);let mt=0,_t=e.width,gt=e.height,Bt=1,jt=null,ie=null;const J=new ce(0,0,_t,gt),st=new ce(0,0,_t,gt);let at=!1;const Nt=new go;let It=!1,zt=!1;const re=new Jt,kt=new D,K=new ce,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $=!1;function ut(){return O===null?Bt:1}let A=n;function Dt(M,N){return e.getContext(M,N)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ja}`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",Vt,!1),e.addEventListener("webglcontextcreationerror",le,!1),A===null){const N="webgl2";if(A=Dt(N,M),A===null)throw Dt(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw Ot("WebGLRenderer: "+M.message),M}let xt,Ut,ot,E,_,I,X,Z,q,yt,lt,Pt,Ft,Q,it,bt,Tt,vt,Xt,L,ht,rt,St;function et(){xt=new og(A),xt.init(),ht=new $_(A,xt),Ut=new Qm(A,xt,t,ht),ot=new Z_(A,xt),Ut.reversedDepthBuffer&&u&&ot.buffers.depth.setReversed(!0),E=new hg(A),_=new U_,I=new K_(A,xt,ot,_,Ut,ht,E),X=new ag(T),Z=new md(A),rt=new $m(A,Z),q=new lg(A,Z,E,rt),yt=new fg(A,q,Z,rt,E),vt=new ug(A,Ut,I),it=new tg(_),lt=new N_(T,X,xt,Ut,rt,it),Pt=new i0(T,_),Ft=new O_,Q=new H_(xt),Tt=new Km(T,X,ot,yt,g,c),bt=new J_(T,yt,Ut),St=new r0(A,E,Ut,ot),Xt=new jm(A,xt,E),L=new cg(A,xt,E),E.programs=lt.programs,T.capabilities=Ut,T.extensions=xt,T.properties=_,T.renderLists=Ft,T.shadowMap=bt,T.state=ot,T.info=E}et(),v!==Fe&&(x=new pg(v,e.width,e.height,r,s));const Y=new e0(T,A);this.xr=Y,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const M=xt.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=xt.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return Bt},this.setPixelRatio=function(M){M!==void 0&&(Bt=M,this.setSize(_t,gt,!1))},this.getSize=function(M){return M.set(_t,gt)},this.setSize=function(M,N,W=!0){if(Y.isPresenting){Rt("WebGLRenderer: Can't change size while VR device is presenting.");return}_t=M,gt=N,e.width=Math.floor(M*Bt),e.height=Math.floor(N*Bt),W===!0&&(e.style.width=M+"px",e.style.height=N+"px"),x!==null&&x.setSize(e.width,e.height),this.setViewport(0,0,M,N)},this.getDrawingBufferSize=function(M){return M.set(_t*Bt,gt*Bt).floor()},this.setDrawingBufferSize=function(M,N,W){_t=M,gt=N,Bt=W,e.width=Math.floor(M*W),e.height=Math.floor(N*W),this.setViewport(0,0,M,N)},this.setEffects=function(M){if(v===Fe){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let N=0;N<M.length;N++)if(M[N].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}x.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(F)},this.getViewport=function(M){return M.copy(J)},this.setViewport=function(M,N,W,k){M.isVector4?J.set(M.x,M.y,M.z,M.w):J.set(M,N,W,k),ot.viewport(F.copy(J).multiplyScalar(Bt).round())},this.getScissor=function(M){return M.copy(st)},this.setScissor=function(M,N,W,k){M.isVector4?st.set(M.x,M.y,M.z,M.w):st.set(M,N,W,k),ot.scissor(z.copy(st).multiplyScalar(Bt).round())},this.getScissorTest=function(){return at},this.setScissorTest=function(M){ot.setScissorTest(at=M)},this.setOpaqueSort=function(M){jt=M},this.setTransparentSort=function(M){ie=M},this.getClearColor=function(M){return M.copy(Tt.getClearColor())},this.setClearColor=function(){Tt.setClearColor(...arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){Tt.setClearAlpha(...arguments)},this.clear=function(M=!0,N=!0,W=!0){let k=0;if(M){let V=!1;if(O!==null){const dt=O.texture.format;V=m.has(dt)}if(V){const dt=O.texture.type,Mt=p.has(dt),pt=Tt.getClearColor(),At=Tt.getClearAlpha(),Ct=pt.r,Gt=pt.g,qt=pt.b;Mt?(S[0]=Ct,S[1]=Gt,S[2]=qt,S[3]=At,A.clearBufferuiv(A.COLOR,0,S)):(b[0]=Ct,b[1]=Gt,b[2]=qt,b[3]=At,A.clearBufferiv(A.COLOR,0,b))}else k|=A.COLOR_BUFFER_BIT}N&&(k|=A.DEPTH_BUFFER_BIT),W&&(k|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k!==0&&A.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",Vt,!1),e.removeEventListener("webglcontextcreationerror",le,!1),Tt.dispose(),Ft.dispose(),Q.dispose(),_.dispose(),X.dispose(),yt.dispose(),rt.dispose(),St.dispose(),lt.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",Ro),Y.removeEventListener("sessionend",Po),Vn.stop()};function Et(M){M.preventDefault(),is("WebGLRenderer: Context Lost."),H=!0}function Vt(){is("WebGLRenderer: Context Restored."),H=!1;const M=E.autoReset,N=bt.enabled,W=bt.autoUpdate,k=bt.needsUpdate,V=bt.type;et(),E.autoReset=M,bt.enabled=N,bt.autoUpdate=W,bt.needsUpdate=k,bt.type=V}function le(M){Ot("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Qt(M){const N=M.target;N.removeEventListener("dispose",Qt),un(N)}function un(M){fn(M),_.remove(M)}function fn(M){const N=_.get(M).programs;N!==void 0&&(N.forEach(function(W){lt.releaseProgram(W)}),M.isShaderMaterial&<.releaseShaderCache(M))}this.renderBufferDirect=function(M,N,W,k,V,dt){N===null&&(N=tt);const Mt=V.isMesh&&V.matrixWorld.determinant()<0,pt=th(M,N,W,k,V);ot.setMaterial(k,Mt);let At=W.index,Ct=1;if(k.wireframe===!0){if(At=q.getWireframeAttribute(W),At===void 0)return;Ct=2}const Gt=W.drawRange,qt=W.attributes.position;let Lt=Gt.start*Ct,se=(Gt.start+Gt.count)*Ct;dt!==null&&(Lt=Math.max(Lt,dt.start*Ct),se=Math.min(se,(dt.start+dt.count)*Ct)),At!==null?(Lt=Math.max(Lt,0),se=Math.min(se,At.count)):qt!=null&&(Lt=Math.max(Lt,0),se=Math.min(se,qt.count));const pe=se-Lt;if(pe<0||pe===1/0)return;rt.setup(V,k,pt,W,At);let fe,ae=Xt;if(At!==null&&(fe=Z.get(At),ae=L,ae.setIndex(fe)),V.isMesh)k.wireframe===!0?(ot.setLineWidth(k.wireframeLinewidth*ut()),ae.setMode(A.LINES)):ae.setMode(A.TRIANGLES);else if(V.isLine){let Ee=k.linewidth;Ee===void 0&&(Ee=1),ot.setLineWidth(Ee*ut()),V.isLineSegments?ae.setMode(A.LINES):V.isLineLoop?ae.setMode(A.LINE_LOOP):ae.setMode(A.LINE_STRIP)}else V.isPoints?ae.setMode(A.POINTS):V.isSprite&&ae.setMode(A.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)rs("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ae.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(xt.get("WEBGL_multi_draw"))ae.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const Ee=V._multiDrawStarts,wt=V._multiDrawCounts,De=V._multiDrawCount,$t=At?Z.get(At).bytesPerElement:1,He=_.get(k).currentProgram.getUniforms();for(let Ke=0;Ke<De;Ke++)He.setValue(A,"_gl_DrawID",Ke),ae.render(Ee[Ke]/$t,wt[Ke])}else if(V.isInstancedMesh)ae.renderInstances(Lt,pe,V.count);else if(W.isInstancedBufferGeometry){const Ee=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,wt=Math.min(W.instanceCount,Ee);ae.renderInstances(Lt,pe,wt)}else ae.render(Lt,pe)};function Co(M,N,W){M.transparent===!0&&M.side===tn&&M.forceSinglePass===!1?(M.side=Ie,M.needsUpdate=!0,dr(M,N,W),M.side=bn,M.needsUpdate=!0,dr(M,N,W),M.side=tn):dr(M,N,W)}this.compile=function(M,N,W=null){W===null&&(W=M),C=Q.get(W),C.init(N),P.push(C),W.traverseVisible(function(V){V.isLight&&V.layers.test(N.layers)&&(C.pushLight(V),V.castShadow&&C.pushShadow(V))}),M!==W&&M.traverseVisible(function(V){V.isLight&&V.layers.test(N.layers)&&(C.pushLight(V),V.castShadow&&C.pushShadow(V))}),C.setupLights();const k=new Set;return M.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const dt=V.material;if(dt)if(Array.isArray(dt))for(let Mt=0;Mt<dt.length;Mt++){const pt=dt[Mt];Co(pt,W,V),k.add(pt)}else Co(dt,W,V),k.add(dt)}),C=P.pop(),k},this.compileAsync=function(M,N,W=null){const k=this.compile(M,N,W);return new Promise(V=>{function dt(){if(k.forEach(function(Mt){_.get(Mt).currentProgram.isReady()&&k.delete(Mt)}),k.size===0){V(M);return}setTimeout(dt,10)}xt.get("KHR_parallel_shader_compile")!==null?dt():setTimeout(dt,10)})};let ps=null;function Qc(M){ps&&ps(M)}function Ro(){Vn.stop()}function Po(){Vn.start()}const Vn=new Yc;Vn.setAnimationLoop(Qc),typeof self<"u"&&Vn.setContext(self),this.setAnimationLoop=function(M){ps=M,Y.setAnimationLoop(M),M===null?Vn.stop():Vn.start()},Y.addEventListener("sessionstart",Ro),Y.addEventListener("sessionend",Po),this.render=function(M,N){if(N!==void 0&&N.isCamera!==!0){Ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(H===!0)return;const W=Y.enabled===!0&&Y.isPresenting===!0,k=x!==null&&(O===null||W)&&x.begin(T,O);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(x===null||x.isCompositing()===!1)&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(N),N=Y.getCamera()),M.isScene===!0&&M.onBeforeRender(T,M,N,O),C=Q.get(M,P.length),C.init(N),P.push(C),re.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Nt.setFromProjectionMatrix(re,nn,N.reversedDepth),zt=this.localClippingEnabled,It=it.init(this.clippingPlanes,zt),y=Ft.get(M,w.length),y.init(),w.push(y),Y.enabled===!0&&Y.isPresenting===!0){const Mt=T.xr.getDepthSensingMesh();Mt!==null&&ms(Mt,N,-1/0,T.sortObjects)}ms(M,N,0,T.sortObjects),y.finish(),T.sortObjects===!0&&y.sort(jt,ie),$=Y.enabled===!1||Y.isPresenting===!1||Y.hasDepthSensing()===!1,$&&Tt.addToRenderList(y,M),this.info.render.frame++,It===!0&&it.beginShadows();const V=C.state.shadowsArray;if(bt.render(V,M,N),It===!0&&it.endShadows(),this.info.autoReset===!0&&this.info.reset(),(k&&x.hasRenderPass())===!1){const Mt=y.opaque,pt=y.transmissive;if(C.setupLights(),N.isArrayCamera){const At=N.cameras;if(pt.length>0)for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct];Io(Mt,pt,M,qt)}$&&Tt.render(M);for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct];Lo(y,M,qt,qt.viewport)}}else pt.length>0&&Io(Mt,pt,M,N),$&&Tt.render(M),Lo(y,M,N)}O!==null&&U===0&&(I.updateMultisampleRenderTarget(O),I.updateRenderTargetMipmap(O)),k&&x.end(T),M.isScene===!0&&M.onAfterRender(T,M,N),rt.resetDefaultState(),G=-1,B=null,P.pop(),P.length>0?(C=P[P.length-1],It===!0&&it.setGlobalState(T.clippingPlanes,C.state.camera)):C=null,w.pop(),w.length>0?y=w[w.length-1]:y=null};function ms(M,N,W,k){if(M.visible===!1)return;if(M.layers.test(N.layers)){if(M.isGroup)W=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(N);else if(M.isLight)C.pushLight(M),M.castShadow&&C.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Nt.intersectsSprite(M)){k&&K.setFromMatrixPosition(M.matrixWorld).applyMatrix4(re);const Mt=yt.update(M),pt=M.material;pt.visible&&y.push(M,Mt,pt,W,K.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Nt.intersectsObject(M))){const Mt=yt.update(M),pt=M.material;if(k&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),K.copy(M.boundingSphere.center)):(Mt.boundingSphere===null&&Mt.computeBoundingSphere(),K.copy(Mt.boundingSphere.center)),K.applyMatrix4(M.matrixWorld).applyMatrix4(re)),Array.isArray(pt)){const At=Mt.groups;for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct],Lt=pt[qt.materialIndex];Lt&&Lt.visible&&y.push(M,Mt,Lt,W,K.z,qt)}}else pt.visible&&y.push(M,Mt,pt,W,K.z,null)}}const dt=M.children;for(let Mt=0,pt=dt.length;Mt<pt;Mt++)ms(dt[Mt],N,W,k)}function Lo(M,N,W,k){const{opaque:V,transmissive:dt,transparent:Mt}=M;C.setupLightsView(W),It===!0&&it.setGlobalState(T.clippingPlanes,W),k&&ot.viewport(F.copy(k)),V.length>0&&fr(V,N,W),dt.length>0&&fr(dt,N,W),Mt.length>0&&fr(Mt,N,W),ot.buffers.depth.setTest(!0),ot.buffers.depth.setMask(!0),ot.buffers.color.setMask(!0),ot.setPolygonOffset(!1)}function Io(M,N,W,k){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(C.state.transmissionRenderTarget[k.id]===void 0){const Lt=xt.has("EXT_color_buffer_half_float")||xt.has("EXT_color_buffer_float");C.state.transmissionRenderTarget[k.id]=new sn(1,1,{generateMipmaps:!0,type:Lt?En:Fe,minFilter:Fn,samples:Math.max(4,Ut.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace})}const dt=C.state.transmissionRenderTarget[k.id],Mt=k.viewport||F;dt.setSize(Mt.z*T.transmissionResolutionScale,Mt.w*T.transmissionResolutionScale);const pt=T.getRenderTarget(),At=T.getActiveCubeFace(),Ct=T.getActiveMipmapLevel();T.setRenderTarget(dt),T.getClearColor(j),mt=T.getClearAlpha(),mt<1&&T.setClearColor(16777215,.5),T.clear(),$&&Tt.render(W);const Gt=T.toneMapping;T.toneMapping=rn;const qt=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),C.setupLightsView(k),It===!0&&it.setGlobalState(T.clippingPlanes,k),fr(M,W,k),I.updateMultisampleRenderTarget(dt),I.updateRenderTargetMipmap(dt),xt.has("WEBGL_multisampled_render_to_texture")===!1){let Lt=!1;for(let se=0,pe=N.length;se<pe;se++){const fe=N[se],{object:ae,geometry:Ee,material:wt,group:De}=fe;if(wt.side===tn&&ae.layers.test(k.layers)){const $t=wt.side;wt.side=Ie,wt.needsUpdate=!0,Do(ae,W,k,Ee,wt,De),wt.side=$t,wt.needsUpdate=!0,Lt=!0}}Lt===!0&&(I.updateMultisampleRenderTarget(dt),I.updateRenderTargetMipmap(dt))}T.setRenderTarget(pt,At,Ct),T.setClearColor(j,mt),qt!==void 0&&(k.viewport=qt),T.toneMapping=Gt}function fr(M,N,W){const k=N.isScene===!0?N.overrideMaterial:null;for(let V=0,dt=M.length;V<dt;V++){const Mt=M[V],{object:pt,geometry:At,group:Ct}=Mt;let Gt=Mt.material;Gt.allowOverride===!0&&k!==null&&(Gt=k),pt.layers.test(W.layers)&&Do(pt,N,W,At,Gt,Ct)}}function Do(M,N,W,k,V,dt){M.onBeforeRender(T,N,W,k,V,dt),M.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),V.onBeforeRender(T,N,W,k,M,dt),V.transparent===!0&&V.side===tn&&V.forceSinglePass===!1?(V.side=Ie,V.needsUpdate=!0,T.renderBufferDirect(W,N,k,V,M,dt),V.side=bn,V.needsUpdate=!0,T.renderBufferDirect(W,N,k,V,M,dt),V.side=tn):T.renderBufferDirect(W,N,k,V,M,dt),M.onAfterRender(T,N,W,k,V,dt)}function dr(M,N,W){N.isScene!==!0&&(N=tt);const k=_.get(M),V=C.state.lights,dt=C.state.shadowsArray,Mt=V.state.version,pt=lt.getParameters(M,V.state,dt,N,W),At=lt.getProgramCacheKey(pt);let Ct=k.programs;k.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?N.environment:null,k.fog=N.fog;const Gt=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;k.envMap=X.get(M.envMap||k.environment,Gt),k.envMapRotation=k.environment!==null&&M.envMap===null?N.environmentRotation:M.envMapRotation,Ct===void 0&&(M.addEventListener("dispose",Qt),Ct=new Map,k.programs=Ct);let qt=Ct.get(At);if(qt!==void 0){if(k.currentProgram===qt&&k.lightsStateVersion===Mt)return Uo(M,pt),qt}else pt.uniforms=lt.getUniforms(M),M.onBeforeCompile(pt,T),qt=lt.acquireProgram(pt,At),Ct.set(At,qt),k.uniforms=pt.uniforms;const Lt=k.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Lt.clippingPlanes=it.uniform),Uo(M,pt),k.needsLights=nh(M),k.lightsStateVersion=Mt,k.needsLights&&(Lt.ambientLightColor.value=V.state.ambient,Lt.lightProbe.value=V.state.probe,Lt.directionalLights.value=V.state.directional,Lt.directionalLightShadows.value=V.state.directionalShadow,Lt.spotLights.value=V.state.spot,Lt.spotLightShadows.value=V.state.spotShadow,Lt.rectAreaLights.value=V.state.rectArea,Lt.ltc_1.value=V.state.rectAreaLTC1,Lt.ltc_2.value=V.state.rectAreaLTC2,Lt.pointLights.value=V.state.point,Lt.pointLightShadows.value=V.state.pointShadow,Lt.hemisphereLights.value=V.state.hemi,Lt.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Lt.spotLightMatrix.value=V.state.spotLightMatrix,Lt.spotLightMap.value=V.state.spotLightMap,Lt.pointShadowMatrix.value=V.state.pointShadowMatrix),k.currentProgram=qt,k.uniformsList=null,qt}function No(M){if(M.uniformsList===null){const N=M.currentProgram.getUniforms();M.uniformsList=jr.seqWithValue(N.seq,M.uniforms)}return M.uniformsList}function Uo(M,N){const W=_.get(M);W.outputColorSpace=N.outputColorSpace,W.batching=N.batching,W.batchingColor=N.batchingColor,W.instancing=N.instancing,W.instancingColor=N.instancingColor,W.instancingMorph=N.instancingMorph,W.skinning=N.skinning,W.morphTargets=N.morphTargets,W.morphNormals=N.morphNormals,W.morphColors=N.morphColors,W.morphTargetsCount=N.morphTargetsCount,W.numClippingPlanes=N.numClippingPlanes,W.numIntersection=N.numClipIntersection,W.vertexAlphas=N.vertexAlphas,W.vertexTangents=N.vertexTangents,W.toneMapping=N.toneMapping}function th(M,N,W,k,V){N.isScene!==!0&&(N=tt),I.resetTextureUnits();const dt=N.fog,Mt=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?N.environment:null,pt=O===null?T.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:ti,At=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ct=X.get(k.envMap||Mt,At),Gt=k.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,qt=!!W.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Lt=!!W.morphAttributes.position,se=!!W.morphAttributes.normal,pe=!!W.morphAttributes.color;let fe=rn;k.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(fe=T.toneMapping);const ae=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Ee=ae!==void 0?ae.length:0,wt=_.get(k),De=C.state.lights;if(It===!0&&(zt===!0||M!==B)){const ve=M===B&&k.id===G;it.setState(k,M,ve)}let $t=!1;k.version===wt.__version?(wt.needsLights&&wt.lightsStateVersion!==De.state.version||wt.outputColorSpace!==pt||V.isBatchedMesh&&wt.batching===!1||!V.isBatchedMesh&&wt.batching===!0||V.isBatchedMesh&&wt.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&wt.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&wt.instancing===!1||!V.isInstancedMesh&&wt.instancing===!0||V.isSkinnedMesh&&wt.skinning===!1||!V.isSkinnedMesh&&wt.skinning===!0||V.isInstancedMesh&&wt.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&wt.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&wt.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&wt.instancingMorph===!1&&V.morphTexture!==null||wt.envMap!==Ct||k.fog===!0&&wt.fog!==dt||wt.numClippingPlanes!==void 0&&(wt.numClippingPlanes!==it.numPlanes||wt.numIntersection!==it.numIntersection)||wt.vertexAlphas!==Gt||wt.vertexTangents!==qt||wt.morphTargets!==Lt||wt.morphNormals!==se||wt.morphColors!==pe||wt.toneMapping!==fe||wt.morphTargetsCount!==Ee)&&($t=!0):($t=!0,wt.__version=k.version);let He=wt.currentProgram;$t===!0&&(He=dr(k,N,V));let Ke=!1,kn=!1,ni=!1;const oe=He.getUniforms(),be=wt.uniforms;if(ot.useProgram(He.program)&&(Ke=!0,kn=!0,ni=!0),k.id!==G&&(G=k.id,kn=!0),Ke||B!==M){ot.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),oe.setValue(A,"projectionMatrix",M.projectionMatrix),oe.setValue(A,"viewMatrix",M.matrixWorldInverse);const Cn=oe.map.cameraPosition;Cn!==void 0&&Cn.setValue(A,kt.setFromMatrixPosition(M.matrixWorld)),Ut.logarithmicDepthBuffer&&oe.setValue(A,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&oe.setValue(A,"isOrthographic",M.isOrthographicCamera===!0),B!==M&&(B=M,kn=!0,ni=!0)}if(wt.needsLights&&(De.state.directionalShadowMap.length>0&&oe.setValue(A,"directionalShadowMap",De.state.directionalShadowMap,I),De.state.spotShadowMap.length>0&&oe.setValue(A,"spotShadowMap",De.state.spotShadowMap,I),De.state.pointShadowMap.length>0&&oe.setValue(A,"pointShadowMap",De.state.pointShadowMap,I)),V.isSkinnedMesh){oe.setOptional(A,V,"bindMatrix"),oe.setOptional(A,V,"bindMatrixInverse");const ve=V.skeleton;ve&&(ve.boneTexture===null&&ve.computeBoneTexture(),oe.setValue(A,"boneTexture",ve.boneTexture,I))}V.isBatchedMesh&&(oe.setOptional(A,V,"batchingTexture"),oe.setValue(A,"batchingTexture",V._matricesTexture,I),oe.setOptional(A,V,"batchingIdTexture"),oe.setValue(A,"batchingIdTexture",V._indirectTexture,I),oe.setOptional(A,V,"batchingColorTexture"),V._colorsTexture!==null&&oe.setValue(A,"batchingColorTexture",V._colorsTexture,I));const wn=W.morphAttributes;if((wn.position!==void 0||wn.normal!==void 0||wn.color!==void 0)&&vt.update(V,W,He),(kn||wt.receiveShadow!==V.receiveShadow)&&(wt.receiveShadow=V.receiveShadow,oe.setValue(A,"receiveShadow",V.receiveShadow)),(k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&N.environment!==null&&(be.envMapIntensity.value=N.environmentIntensity),be.dfgLUT!==void 0&&(be.dfgLUT.value=a0()),kn&&(oe.setValue(A,"toneMappingExposure",T.toneMappingExposure),wt.needsLights&&eh(be,ni),dt&&k.fog===!0&&Pt.refreshFogUniforms(be,dt),Pt.refreshMaterialUniforms(be,k,Bt,gt,C.state.transmissionRenderTarget[M.id]),jr.upload(A,No(wt),be,I)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(jr.upload(A,No(wt),be,I),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&oe.setValue(A,"center",V.center),oe.setValue(A,"modelViewMatrix",V.modelViewMatrix),oe.setValue(A,"normalMatrix",V.normalMatrix),oe.setValue(A,"modelMatrix",V.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const ve=k.uniformsGroups;for(let Cn=0,ii=ve.length;Cn<ii;Cn++){const Fo=ve[Cn];St.update(Fo,He),St.bind(Fo,He)}}return He}function eh(M,N){M.ambientLightColor.needsUpdate=N,M.lightProbe.needsUpdate=N,M.directionalLights.needsUpdate=N,M.directionalLightShadows.needsUpdate=N,M.pointLights.needsUpdate=N,M.pointLightShadows.needsUpdate=N,M.spotLights.needsUpdate=N,M.spotLightShadows.needsUpdate=N,M.rectAreaLights.needsUpdate=N,M.hemisphereLights.needsUpdate=N}function nh(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(M,N,W){const k=_.get(M);k.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),_.get(M.texture).__webglTexture=N,_.get(M.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:W,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,N){const W=_.get(M);W.__webglFramebuffer=N,W.__useDefaultFramebuffer=N===void 0};const ih=A.createFramebuffer();this.setRenderTarget=function(M,N=0,W=0){O=M,R=N,U=W;let k=null,V=!1,dt=!1;if(M){const pt=_.get(M);if(pt.__useDefaultFramebuffer!==void 0){ot.bindFramebuffer(A.FRAMEBUFFER,pt.__webglFramebuffer),F.copy(M.viewport),z.copy(M.scissor),nt=M.scissorTest,ot.viewport(F),ot.scissor(z),ot.setScissorTest(nt),G=-1;return}else if(pt.__webglFramebuffer===void 0)I.setupRenderTarget(M);else if(pt.__hasExternalTextures)I.rebindTextures(M,_.get(M.texture).__webglTexture,_.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Gt=M.depthTexture;if(pt.__boundDepthTexture!==Gt){if(Gt!==null&&_.has(Gt)&&(M.width!==Gt.image.width||M.height!==Gt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");I.setupDepthRenderbuffer(M)}}const At=M.texture;(At.isData3DTexture||At.isDataArrayTexture||At.isCompressedArrayTexture)&&(dt=!0);const Ct=_.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ct[N])?k=Ct[N][W]:k=Ct[N],V=!0):M.samples>0&&I.useMultisampledRTT(M)===!1?k=_.get(M).__webglMultisampledFramebuffer:Array.isArray(Ct)?k=Ct[W]:k=Ct,F.copy(M.viewport),z.copy(M.scissor),nt=M.scissorTest}else F.copy(J).multiplyScalar(Bt).floor(),z.copy(st).multiplyScalar(Bt).floor(),nt=at;if(W!==0&&(k=ih),ot.bindFramebuffer(A.FRAMEBUFFER,k)&&ot.drawBuffers(M,k),ot.viewport(F),ot.scissor(z),ot.setScissorTest(nt),V){const pt=_.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+N,pt.__webglTexture,W)}else if(dt){const pt=N;for(let At=0;At<M.textures.length;At++){const Ct=_.get(M.textures[At]);A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0+At,Ct.__webglTexture,W,pt)}}else if(M!==null&&W!==0){const pt=_.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,pt.__webglTexture,W)}G=-1},this.readRenderTargetPixels=function(M,N,W,k,V,dt,Mt,pt=0){if(!(M&&M.isWebGLRenderTarget)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let At=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Mt!==void 0&&(At=At[Mt]),At){ot.bindFramebuffer(A.FRAMEBUFFER,At);try{const Ct=M.textures[pt],Gt=Ct.format,qt=Ct.type;if(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+pt),!Ut.textureFormatReadable(Gt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ut.textureTypeReadable(qt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=M.width-k&&W>=0&&W<=M.height-V&&A.readPixels(N,W,k,V,ht.convert(Gt),ht.convert(qt),dt)}finally{const Ct=O!==null?_.get(O).__webglFramebuffer:null;ot.bindFramebuffer(A.FRAMEBUFFER,Ct)}}},this.readRenderTargetPixelsAsync=async function(M,N,W,k,V,dt,Mt,pt=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let At=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Mt!==void 0&&(At=At[Mt]),At)if(N>=0&&N<=M.width-k&&W>=0&&W<=M.height-V){ot.bindFramebuffer(A.FRAMEBUFFER,At);const Ct=M.textures[pt],Gt=Ct.format,qt=Ct.type;if(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+pt),!Ut.textureFormatReadable(Gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ut.textureTypeReadable(qt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Lt=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,Lt),A.bufferData(A.PIXEL_PACK_BUFFER,dt.byteLength,A.STREAM_READ),A.readPixels(N,W,k,V,ht.convert(Gt),ht.convert(qt),0);const se=O!==null?_.get(O).__webglFramebuffer:null;ot.bindFramebuffer(A.FRAMEBUFFER,se);const pe=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await qh(A,pe,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,Lt),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,dt),A.deleteBuffer(Lt),A.deleteSync(pe),dt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,N=null,W=0){const k=Math.pow(2,-W),V=Math.floor(M.image.width*k),dt=Math.floor(M.image.height*k),Mt=N!==null?N.x:0,pt=N!==null?N.y:0;I.setTexture2D(M,0),A.copyTexSubImage2D(A.TEXTURE_2D,W,0,0,Mt,pt,V,dt),ot.unbindTexture()};const rh=A.createFramebuffer(),sh=A.createFramebuffer();this.copyTextureToTexture=function(M,N,W=null,k=null,V=0,dt=0){let Mt,pt,At,Ct,Gt,qt,Lt,se,pe;const fe=M.isCompressedTexture?M.mipmaps[dt]:M.image;if(W!==null)Mt=W.max.x-W.min.x,pt=W.max.y-W.min.y,At=W.isBox3?W.max.z-W.min.z:1,Ct=W.min.x,Gt=W.min.y,qt=W.isBox3?W.min.z:0;else{const be=Math.pow(2,-V);Mt=Math.floor(fe.width*be),pt=Math.floor(fe.height*be),M.isDataArrayTexture?At=fe.depth:M.isData3DTexture?At=Math.floor(fe.depth*be):At=1,Ct=0,Gt=0,qt=0}k!==null?(Lt=k.x,se=k.y,pe=k.z):(Lt=0,se=0,pe=0);const ae=ht.convert(N.format),Ee=ht.convert(N.type);let wt;N.isData3DTexture?(I.setTexture3D(N,0),wt=A.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(I.setTexture2DArray(N,0),wt=A.TEXTURE_2D_ARRAY):(I.setTexture2D(N,0),wt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,N.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,N.unpackAlignment);const De=A.getParameter(A.UNPACK_ROW_LENGTH),$t=A.getParameter(A.UNPACK_IMAGE_HEIGHT),He=A.getParameter(A.UNPACK_SKIP_PIXELS),Ke=A.getParameter(A.UNPACK_SKIP_ROWS),kn=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,fe.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,fe.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Ct),A.pixelStorei(A.UNPACK_SKIP_ROWS,Gt),A.pixelStorei(A.UNPACK_SKIP_IMAGES,qt);const ni=M.isDataArrayTexture||M.isData3DTexture,oe=N.isDataArrayTexture||N.isData3DTexture;if(M.isDepthTexture){const be=_.get(M),wn=_.get(N),ve=_.get(be.__renderTarget),Cn=_.get(wn.__renderTarget);ot.bindFramebuffer(A.READ_FRAMEBUFFER,ve.__webglFramebuffer),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,Cn.__webglFramebuffer);for(let ii=0;ii<At;ii++)ni&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,_.get(M).__webglTexture,V,qt+ii),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,_.get(N).__webglTexture,dt,pe+ii)),A.blitFramebuffer(Ct,Gt,Mt,pt,Lt,se,Mt,pt,A.DEPTH_BUFFER_BIT,A.NEAREST);ot.bindFramebuffer(A.READ_FRAMEBUFFER,null),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(V!==0||M.isRenderTargetTexture||_.has(M)){const be=_.get(M),wn=_.get(N);ot.bindFramebuffer(A.READ_FRAMEBUFFER,rh),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,sh);for(let ve=0;ve<At;ve++)ni?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,be.__webglTexture,V,qt+ve):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,be.__webglTexture,V),oe?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,wn.__webglTexture,dt,pe+ve):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,wn.__webglTexture,dt),V!==0?A.blitFramebuffer(Ct,Gt,Mt,pt,Lt,se,Mt,pt,A.COLOR_BUFFER_BIT,A.NEAREST):oe?A.copyTexSubImage3D(wt,dt,Lt,se,pe+ve,Ct,Gt,Mt,pt):A.copyTexSubImage2D(wt,dt,Lt,se,Ct,Gt,Mt,pt);ot.bindFramebuffer(A.READ_FRAMEBUFFER,null),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else oe?M.isDataTexture||M.isData3DTexture?A.texSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,Ee,fe.data):N.isCompressedArrayTexture?A.compressedTexSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,fe.data):A.texSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,Ee,fe):M.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,dt,Lt,se,Mt,pt,ae,Ee,fe.data):M.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,dt,Lt,se,fe.width,fe.height,ae,fe.data):A.texSubImage2D(A.TEXTURE_2D,dt,Lt,se,Mt,pt,ae,Ee,fe);A.pixelStorei(A.UNPACK_ROW_LENGTH,De),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,$t),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ke),A.pixelStorei(A.UNPACK_SKIP_IMAGES,kn),dt===0&&N.generateMipmaps&&A.generateMipmap(wt),ot.unbindTexture()},this.initRenderTarget=function(M){_.get(M).__webglFramebuffer===void 0&&I.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?I.setTextureCube(M,0):M.isData3DTexture?I.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?I.setTexture2DArray(M,0):I.setTexture2D(M,0),ot.unbindTexture()},this.resetState=function(){R=0,U=0,O=null,ot.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return nn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}function l0(i){const n=new Float32Array(524288);for(let o=0;o<256;o++){const c=((o+.5)/256-.5)*Math.PI;for(let l=0;l<512;l++){const h=(l+.5)/512*Math.PI*2,f=Math.pow(.5+.5*Math.sin(4*h+1.8*Math.sin(c)),3),u=Math.pow(.5+.5*Math.cos(2*h-3*c),3),d=.12+3.2*f+.8*u,g=(o*512+l)*4;n.set([d,d,d,1],g)}}const r=new ls(n,512,256,Be,Oe);r.mapping=qr,r.needsUpdate=!0;const s=new Za(i),a=s.fromEquirectangular(r);return r.dispose(),s.dispose(),a}function c0(i){const{container:t,videos:e,lighting:n}=i;let r;try{r=new o0({antialias:!0,alpha:!0})}catch{return}r.setPixelRatio(Math.min(window.devicePixelRatio,i.maxPixelRatio)),r.outputColorSpace=Pe,r.toneMapping=Qa,r.setClearColor(0,0),t.appendChild(r.domElement);const s=new bu,a=l0(r);s.environment=a.texture,s.environmentIntensity=n.environment,s.add(new Yf(16777215,12699857,n.hemisphere));const o=new Ya(16777215,n.key.intensity);o.position.set(...n.key.position),s.add(o);const c=new Ya(15003135,n.rim.intensity);c.position.set(...n.rim.position),s.add(c);let l=0,h=0,f=!0,u=!1;const d=()=>{!l&&f&&!document.hidden&&!u&&(l=requestAnimationFrame(g))},g=C=>{if(l=0,u||!f||document.hidden)return;const w=Math.min((C-h)/1e3,.05);h=C,i.frame(C,w)&&d()},v=()=>{const C=t.clientWidth,w=t.clientHeight;!C||!w||(i.resize(C,w),r.setSize(C,w,!1),d())},m=new ResizeObserver(v),p=new IntersectionObserver(([C])=>{f=!!C?.isIntersecting,d()}),S=new Map;let b,y=!1;return{renderer:r,scene:s,environment:a.texture,invalidate:d,start(){if(!(y||u)){y=!0;for(const C of e){if(!("requestVideoFrameCallback"in C))continue;const w=()=>{u||(d(),S.set(C,C.requestVideoFrameCallback(w)))};S.set(C,C.requestVideoFrameCallback(w))}e.some(C=>!("requestVideoFrameCallback"in C))&&(b=window.setInterval(d,1e3/30)),m.observe(t),p.observe(t),document.addEventListener("visibilitychange",d),v()}},dispose(){u=!0,cancelAnimationFrame(l);for(const[C,w]of S)C.cancelVideoFrameCallback(w);clearInterval(b),m.disconnect(),p.disconnect(),document.removeEventListener("visibilitychange",d),a.dispose(),r.dispose(),r.forceContextLoss(),r.domElement.remove()}}}function h0(i){const[t,e]=Gn.useState(i),[n,r]=Gn.useState(!1),s=Gn.useRef(t);s.current=t;const a=Gn.useRef(n);a.current=n;const o=Gn.useRef({yaw:0,pitch:0}).current,c=Gn.useCallback(h=>{o.yaw=0,o.pitch=0,e(h)},[o]),l=Gn.useCallback((h,f,u)=>{o.yaw+=h*.008,o.pitch=Ec.clamp(o.pitch+f*.008,-u,u)},[o]);return{view:t,viewRef:s,chooseView:c,locked:n,lockedRef:a,setLocked:r,orbit:o,drag:l}}function u0(i){const t=i.indexOf(","),e=i.slice(0,t),n=i.slice(t+1);if(!e.endsWith(";base64"))return new TextEncoder().encode(decodeURIComponent(n)).buffer;const r=atob(n),s=new Uint8Array(r.length);for(let a=0;a<r.length;a++)s[a]=r.charCodeAt(a);return s.buffer}async function f0(i,t){const e=typeof t=="string"?t:await t();return e.startsWith("data:")?i.parseAsync(u0(e),""):i.loadAsync(e)}exports.AnimationClip=Bf;exports.Bone=Rc;exports.Box2=dd;exports.Box3=An;exports.BoxGeometry=Ri;exports.BufferAttribute=ze;exports.BufferGeometry=we;exports.CircleGeometry=xo;exports.ClampToEdgeWrapping=en;exports.Color=Zt;exports.ColorManagement=Kt;exports.CylinderGeometry=vo;exports.DirectionalLight=Ya;exports.DoubleSide=tn;exports.DynamicDrawUsage=Gh;exports.ExtrudeGeometry=bo;exports.FileLoader=Wf;exports.FrontSide=bn;exports.Group=qi;exports.ImageBitmapLoader=td;exports.InstancedBufferAttribute=Ga;exports.InstancedMesh=Nu;exports.InterleavedBuffer=wu;exports.InterleavedBufferAttribute=fo;exports.Interpolant=Pi;exports.InterpolateDiscrete=er;exports.InterpolateLinear=es;exports.Line=_o;exports.LineBasicMaterial=Pc;exports.LineLoop=zu;exports.LineSegments=Bu;exports.LinearFilter=ge;exports.LinearMipmapLinearFilter=Fn;exports.LinearMipmapNearestFilter=Yr;exports.LinearSRGBColorSpace=ti;exports.Loader=Di;exports.LoaderUtils=Qf;exports.Material=zn;exports.MathUtils=Ec;exports.Matrix4=Jt;exports.Mesh=Ve;exports.MeshBasicMaterial=po;exports.MeshPhysicalMaterial=Rf;exports.MeshStandardMaterial=Hc;exports.MirroredRepeatWrapping=ts;exports.NearestFilter=Se;exports.NearestMipmapLinearFilter=Xi;exports.NearestMipmapNearestFilter=mc;exports.NumberKeyframeTrack=lr;exports.Object3D=ue;exports.OrthographicCamera=us;exports.PerspectiveCamera=Le;exports.PointLight=$f;exports.Points=Vu;exports.PointsMaterial=Lc;exports.PropertyBinding=ne;exports.Quaternion=Bn;exports.QuaternionKeyframeTrack=ur;exports.Raycaster=fd;exports.RepeatWrapping=Qr;exports.SRGBColorSpace=Pe;exports.ShaderChunk=Ht;exports.Shape=yo;exports.ShapeGeometry=Eo;exports.Skeleton=mo;exports.SkinnedMesh=Lu;exports.Sphere=cn;exports.SpotLight=Zf;exports.Texture=ye;exports.TextureLoader=qf;exports.TriangleFanDrawMode=Dh;exports.TriangleStripDrawMode=Ih;exports.TrianglesDrawMode=Lh;exports.Vector2=ct;exports.Vector3=D;exports.VectorKeyframeTrack=cr;exports.VideoTexture=ku;exports.createDeviceStage=c0;exports.loadModel=f0;exports.useStageView=h0;
|
|
4049
|
+
}`;class t0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new Dc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new ln({vertexShader:j_,fragmentShader:Q_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ve(new cs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class e0 extends Ci{constructor(t,e){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,f=null,u=null,d=null,g=null;const v=typeof XRWebGLBinding<"u",m=new t0,p={},S=e.getContextAttributes();let b=null,y=null;const C=[],w=[],P=new ct;let x=null;const T=new Le;T.viewport=new ce;const H=new Le;H.viewport=new ce;const R=[T,H],U=new nd;let O=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getTargetRaySpace()},this.getControllerGrip=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getGripSpace()},this.getHand=function(J){let st=C[J];return st===void 0&&(st=new bs,C[J]=st),st.getHandSpace()};function B(J){const st=w.indexOf(J.inputSource);if(st===-1)return;const at=C[st];at!==void 0&&(at.update(J.inputSource,J.frame,l||a),at.dispatchEvent({type:J.type,data:J.inputSource}))}function F(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",z);for(let J=0;J<C.length;J++){const st=w[J];st!==null&&(w[J]=null,C[J].disconnect(st))}O=null,G=null,m.reset();for(const J in p)delete p[J];t.setRenderTarget(b),d=null,u=null,f=null,r=null,y=null,ie.stop(),n.isPresenting=!1,t.setPixelRatio(x),t.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,n.isPresenting===!0&&Rt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&Rt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(J){l=J},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){return f===null&&v&&(f=new XRWebGLBinding(r,e)),f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(J){if(r=J,r!==null){if(b=t.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",F),r.addEventListener("inputsourceschange",z),S.xrCompatible!==!0&&await e.makeXRCompatible(),x=t.getPixelRatio(),t.getSize(P),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let at=null,Nt=null,It=null;S.depth&&(It=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,at=S.stencil?jn:Tn,Nt=S.stencil?tr:an);const zt={colorFormat:e.RGBA8,depthFormat:It,scaleFactor:s};f=this.getBinding(),u=f.createProjectionLayer(zt),r.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),y=new sn(u.textureWidth,u.textureHeight,{format:Be,type:Fe,depthTexture:new rr(u.textureWidth,u.textureHeight,Nt,void 0,void 0,void 0,void 0,void 0,void 0,at),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const at={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,e,at),r.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new sn(d.framebufferWidth,d.framebufferHeight,{format:Be,type:Fe,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),ie.setContext(r),ie.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function z(J){for(let st=0;st<J.removed.length;st++){const at=J.removed[st],Nt=w.indexOf(at);Nt>=0&&(w[Nt]=null,C[Nt].disconnect(at))}for(let st=0;st<J.added.length;st++){const at=J.added[st];let Nt=w.indexOf(at);if(Nt===-1){for(let zt=0;zt<C.length;zt++)if(zt>=w.length){w.push(at),Nt=zt;break}else if(w[zt]===null){w[zt]=at,Nt=zt;break}if(Nt===-1)break}const It=C[Nt];It&&It.connect(at)}}const nt=new D,j=new D;function mt(J,st,at){nt.setFromMatrixPosition(st.matrixWorld),j.setFromMatrixPosition(at.matrixWorld);const Nt=nt.distanceTo(j),It=st.projectionMatrix.elements,zt=at.projectionMatrix.elements,re=It[14]/(It[10]-1),kt=It[14]/(It[10]+1),K=(It[9]+1)/It[5],tt=(It[9]-1)/It[5],$=(It[8]-1)/It[0],ut=(zt[8]+1)/zt[0],A=re*$,Dt=re*ut,xt=Nt/(-$+ut),Ut=xt*-$;if(st.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(Ut),J.translateZ(xt),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),It[10]===-1)J.projectionMatrix.copy(st.projectionMatrix),J.projectionMatrixInverse.copy(st.projectionMatrixInverse);else{const ot=re+xt,E=kt+xt,_=A-Ut,I=Dt+(Nt-Ut),X=K*kt/E*ot,Z=tt*kt/E*ot;J.projectionMatrix.makePerspective(_,I,X,Z,ot,E),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function _t(J,st){st===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(st.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(r===null)return;let st=J.near,at=J.far;m.texture!==null&&(m.depthNear>0&&(st=m.depthNear),m.depthFar>0&&(at=m.depthFar)),U.near=H.near=T.near=st,U.far=H.far=T.far=at,(O!==U.near||G!==U.far)&&(r.updateRenderState({depthNear:U.near,depthFar:U.far}),O=U.near,G=U.far),U.layers.mask=J.layers.mask|6,T.layers.mask=U.layers.mask&-5,H.layers.mask=U.layers.mask&-3;const Nt=J.parent,It=U.cameras;_t(U,Nt);for(let zt=0;zt<It.length;zt++)_t(It[zt],Nt);It.length===2?mt(U,T,H):U.projectionMatrix.copy(T.projectionMatrix),gt(J,U,Nt)};function gt(J,st,at){at===null?J.matrix.copy(st.matrixWorld):(J.matrix.copy(at.matrixWorld),J.matrix.invert(),J.matrix.multiply(st.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(st.projectionMatrix),J.projectionMatrixInverse.copy(st.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Ti*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(u===null&&d===null))return c},this.setFoveation=function(J){c=J,u!==null&&(u.fixedFoveation=J),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=J)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(U)},this.getCameraTexture=function(J){return p[J]};let Bt=null;function jt(J,st){if(h=st.getViewerPose(l||a),g=st,h!==null){const at=h.views;d!==null&&(t.setRenderTargetFramebuffer(y,d.framebuffer),t.setRenderTarget(y));let Nt=!1;at.length!==U.cameras.length&&(U.cameras.length=0,Nt=!0);for(let kt=0;kt<at.length;kt++){const K=at[kt];let tt=null;if(d!==null)tt=d.getViewport(K);else{const ut=f.getViewSubImage(u,K);tt=ut.viewport,kt===0&&(t.setRenderTargetTextures(y,ut.colorTexture,ut.depthStencilTexture),t.setRenderTarget(y))}let $=R[kt];$===void 0&&($=new Le,$.layers.enable(kt),$.viewport=new ce,R[kt]=$),$.matrix.fromArray(K.transform.matrix),$.matrix.decompose($.position,$.quaternion,$.scale),$.projectionMatrix.fromArray(K.projectionMatrix),$.projectionMatrixInverse.copy($.projectionMatrix).invert(),$.viewport.set(tt.x,tt.y,tt.width,tt.height),kt===0&&(U.matrix.copy($.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),Nt===!0&&U.cameras.push($)}const It=r.enabledFeatures;if(It&&It.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&v){f=n.getBinding();const kt=f.getDepthInformation(at[0]);kt&&kt.isValid&&kt.texture&&m.init(kt,r.renderState)}if(It&&It.includes("camera-access")&&v){t.state.unbindTexture(),f=n.getBinding();for(let kt=0;kt<at.length;kt++){const K=at[kt].camera;if(K){let tt=p[K];tt||(tt=new Dc,p[K]=tt);const $=f.getCameraImage(K);tt.sourceTexture=$}}}}for(let at=0;at<C.length;at++){const Nt=w[at],It=C[at];Nt!==null&&It!==void 0&&It.update(Nt,st,l||a)}Bt&&Bt(J,st),st.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:st}),g=null}const ie=new Yc;ie.setAnimationLoop(jt),this.setAnimationLoop=function(J){Bt=J},this.dispose=function(){}}}const Jn=new on,n0=new Jt;function i0(i,t){function e(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Gc(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,S,b,y){p.isMeshBasicMaterial?s(m,p):p.isMeshLambertMaterial?(s(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(s(m,p),f(m,p)):p.isMeshPhongMaterial?(s(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(s(m,p),u(m,p),p.isMeshPhysicalMaterial&&d(m,p,y)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),v(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?c(m,p,S,b):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,e(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Ie&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,e(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Ie&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,e(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,e(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const S=t.get(p),b=S.envMap,y=S.envMapRotation;b&&(m.envMap.value=b,Jn.copy(y),Jn.x*=-1,Jn.y*=-1,Jn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Jn.y*=-1,Jn.z*=-1),m.envMapRotation.value.setFromMatrix4(n0.makeRotationFromEuler(Jn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,S,b){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*S,m.scale.value=b*.5,p.map&&(m.map.value=p.map,e(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function f(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function u(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,S){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ie&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=S.texture,m.transmissionSamplerSize.value.set(S.width,S.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function v(m,p){const S=t.get(p).light;m.referencePosition.value.setFromMatrixPosition(S.matrixWorld),m.nearDistance.value=S.shadow.camera.near,m.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function r0(i,t,e,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(S,b){const y=b.program;n.uniformBlockBinding(S,y)}function l(S,b){let y=r[S.id];y===void 0&&(g(S),y=h(S),r[S.id]=y,S.addEventListener("dispose",m));const C=b.program;n.updateUBOMapping(S,C);const w=t.render.frame;s[S.id]!==w&&(u(S),s[S.id]=w)}function h(S){const b=f();S.__bindingPointIndex=b;const y=i.createBuffer(),C=S.__size,w=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,C,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,b,y),y}function f(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return Ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(S){const b=r[S.id],y=S.uniforms,C=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,b);for(let w=0,P=y.length;w<P;w++){const x=Array.isArray(y[w])?y[w]:[y[w]];for(let T=0,H=x.length;T<H;T++){const R=x[T];if(d(R,w,T,C)===!0){const U=R.__offset,O=Array.isArray(R.value)?R.value:[R.value];let G=0;for(let B=0;B<O.length;B++){const F=O[B],z=v(F);typeof F=="number"||typeof F=="boolean"?(R.__data[0]=F,i.bufferSubData(i.UNIFORM_BUFFER,U+G,R.__data)):F.isMatrix3?(R.__data[0]=F.elements[0],R.__data[1]=F.elements[1],R.__data[2]=F.elements[2],R.__data[3]=0,R.__data[4]=F.elements[3],R.__data[5]=F.elements[4],R.__data[6]=F.elements[5],R.__data[7]=0,R.__data[8]=F.elements[6],R.__data[9]=F.elements[7],R.__data[10]=F.elements[8],R.__data[11]=0):(F.toArray(R.__data,G),G+=z.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,U,R.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(S,b,y,C){const w=S.value,P=b+"_"+y;if(C[P]===void 0)return typeof w=="number"||typeof w=="boolean"?C[P]=w:C[P]=w.clone(),!0;{const x=C[P];if(typeof w=="number"||typeof w=="boolean"){if(x!==w)return C[P]=w,!0}else if(x.equals(w)===!1)return x.copy(w),!0}return!1}function g(S){const b=S.uniforms;let y=0;const C=16;for(let P=0,x=b.length;P<x;P++){const T=Array.isArray(b[P])?b[P]:[b[P]];for(let H=0,R=T.length;H<R;H++){const U=T[H],O=Array.isArray(U.value)?U.value:[U.value];for(let G=0,B=O.length;G<B;G++){const F=O[G],z=v(F),nt=y%C,j=nt%z.boundary,mt=nt+j;y+=j,mt!==0&&C-mt<z.storage&&(y+=C-mt),U.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=y,y+=z.storage}}}const w=y%C;return w>0&&(y+=C-w),S.__size=y,S.__cache={},this}function v(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?Rt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Rt("WebGLRenderer: Unsupported uniform value type.",S),b}function m(S){const b=S.target;b.removeEventListener("dispose",m);const y=a.indexOf(b.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function p(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:c,update:l,dispose:p}}const s0=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let je=null;function a0(){return je===null&&(je=new ls(s0,16,16,Ei,En),je.name="DFG_LUT",je.minFilter=ge,je.magFilter=ge,je.wrapS=en,je.wrapT=en,je.generateMipmaps=!1,je.needsUpdate=!0),je}class o0{constructor(t={}){const{canvas:e=Xh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:u=!1,outputBufferType:d=Fe}=t;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const v=d,m=new Set([ao,so,ro]),p=new Set([Fe,an,Qi,tr,eo,no]),S=new Uint32Array(4),b=new Int32Array(4);let y=null,C=null;const w=[],P=[];let x=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=rn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let H=!1;this._outputColorSpace=Pe;let R=0,U=0,O=null,G=-1,B=null;const F=new ce,z=new ce;let nt=null;const j=new Zt(0);let mt=0,_t=e.width,gt=e.height,Bt=1,jt=null,ie=null;const J=new ce(0,0,_t,gt),st=new ce(0,0,_t,gt);let at=!1;const Nt=new go;let It=!1,zt=!1;const re=new Jt,kt=new D,K=new ce,tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $=!1;function ut(){return O===null?Bt:1}let A=n;function Dt(M,N){return e.getContext(M,N)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ja}`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",Vt,!1),e.addEventListener("webglcontextcreationerror",le,!1),A===null){const N="webgl2";if(A=Dt(N,M),A===null)throw Dt(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw Ot("WebGLRenderer: "+M.message),M}let xt,Ut,ot,E,_,I,X,Z,q,yt,lt,Pt,Ft,Q,it,bt,Tt,vt,Xt,L,ht,rt,St;function et(){xt=new og(A),xt.init(),ht=new $_(A,xt),Ut=new Qm(A,xt,t,ht),ot=new Z_(A,xt),Ut.reversedDepthBuffer&&u&&ot.buffers.depth.setReversed(!0),E=new hg(A),_=new U_,I=new K_(A,xt,ot,_,Ut,ht,E),X=new ag(T),Z=new md(A),rt=new $m(A,Z),q=new lg(A,Z,E,rt),yt=new fg(A,q,Z,rt,E),vt=new ug(A,Ut,I),it=new tg(_),lt=new N_(T,X,xt,Ut,rt,it),Pt=new i0(T,_),Ft=new O_,Q=new H_(xt),Tt=new Km(T,X,ot,yt,g,c),bt=new J_(T,yt,Ut),St=new r0(A,E,Ut,ot),Xt=new jm(A,xt,E),L=new cg(A,xt,E),E.programs=lt.programs,T.capabilities=Ut,T.extensions=xt,T.properties=_,T.renderLists=Ft,T.shadowMap=bt,T.state=ot,T.info=E}et(),v!==Fe&&(x=new pg(v,e.width,e.height,r,s));const Y=new e0(T,A);this.xr=Y,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const M=xt.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=xt.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return Bt},this.setPixelRatio=function(M){M!==void 0&&(Bt=M,this.setSize(_t,gt,!1))},this.getSize=function(M){return M.set(_t,gt)},this.setSize=function(M,N,W=!0){if(Y.isPresenting){Rt("WebGLRenderer: Can't change size while VR device is presenting.");return}_t=M,gt=N,e.width=Math.floor(M*Bt),e.height=Math.floor(N*Bt),W===!0&&(e.style.width=M+"px",e.style.height=N+"px"),x!==null&&x.setSize(e.width,e.height),this.setViewport(0,0,M,N)},this.getDrawingBufferSize=function(M){return M.set(_t*Bt,gt*Bt).floor()},this.setDrawingBufferSize=function(M,N,W){_t=M,gt=N,Bt=W,e.width=Math.floor(M*W),e.height=Math.floor(N*W),this.setViewport(0,0,M,N)},this.setEffects=function(M){if(v===Fe){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let N=0;N<M.length;N++)if(M[N].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}x.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(F)},this.getViewport=function(M){return M.copy(J)},this.setViewport=function(M,N,W,k){M.isVector4?J.set(M.x,M.y,M.z,M.w):J.set(M,N,W,k),ot.viewport(F.copy(J).multiplyScalar(Bt).round())},this.getScissor=function(M){return M.copy(st)},this.setScissor=function(M,N,W,k){M.isVector4?st.set(M.x,M.y,M.z,M.w):st.set(M,N,W,k),ot.scissor(z.copy(st).multiplyScalar(Bt).round())},this.getScissorTest=function(){return at},this.setScissorTest=function(M){ot.setScissorTest(at=M)},this.setOpaqueSort=function(M){jt=M},this.setTransparentSort=function(M){ie=M},this.getClearColor=function(M){return M.copy(Tt.getClearColor())},this.setClearColor=function(){Tt.setClearColor(...arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){Tt.setClearAlpha(...arguments)},this.clear=function(M=!0,N=!0,W=!0){let k=0;if(M){let V=!1;if(O!==null){const dt=O.texture.format;V=m.has(dt)}if(V){const dt=O.texture.type,Mt=p.has(dt),pt=Tt.getClearColor(),At=Tt.getClearAlpha(),Ct=pt.r,Gt=pt.g,qt=pt.b;Mt?(S[0]=Ct,S[1]=Gt,S[2]=qt,S[3]=At,A.clearBufferuiv(A.COLOR,0,S)):(b[0]=Ct,b[1]=Gt,b[2]=qt,b[3]=At,A.clearBufferiv(A.COLOR,0,b))}else k|=A.COLOR_BUFFER_BIT}N&&(k|=A.DEPTH_BUFFER_BIT),W&&(k|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k!==0&&A.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",Vt,!1),e.removeEventListener("webglcontextcreationerror",le,!1),Tt.dispose(),Ft.dispose(),Q.dispose(),_.dispose(),X.dispose(),yt.dispose(),rt.dispose(),St.dispose(),lt.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",Ro),Y.removeEventListener("sessionend",Po),Vn.stop()};function Et(M){M.preventDefault(),is("WebGLRenderer: Context Lost."),H=!0}function Vt(){is("WebGLRenderer: Context Restored."),H=!1;const M=E.autoReset,N=bt.enabled,W=bt.autoUpdate,k=bt.needsUpdate,V=bt.type;et(),E.autoReset=M,bt.enabled=N,bt.autoUpdate=W,bt.needsUpdate=k,bt.type=V}function le(M){Ot("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Qt(M){const N=M.target;N.removeEventListener("dispose",Qt),un(N)}function un(M){fn(M),_.remove(M)}function fn(M){const N=_.get(M).programs;N!==void 0&&(N.forEach(function(W){lt.releaseProgram(W)}),M.isShaderMaterial&<.releaseShaderCache(M))}this.renderBufferDirect=function(M,N,W,k,V,dt){N===null&&(N=tt);const Mt=V.isMesh&&V.matrixWorld.determinant()<0,pt=th(M,N,W,k,V);ot.setMaterial(k,Mt);let At=W.index,Ct=1;if(k.wireframe===!0){if(At=q.getWireframeAttribute(W),At===void 0)return;Ct=2}const Gt=W.drawRange,qt=W.attributes.position;let Lt=Gt.start*Ct,se=(Gt.start+Gt.count)*Ct;dt!==null&&(Lt=Math.max(Lt,dt.start*Ct),se=Math.min(se,(dt.start+dt.count)*Ct)),At!==null?(Lt=Math.max(Lt,0),se=Math.min(se,At.count)):qt!=null&&(Lt=Math.max(Lt,0),se=Math.min(se,qt.count));const pe=se-Lt;if(pe<0||pe===1/0)return;rt.setup(V,k,pt,W,At);let fe,ae=Xt;if(At!==null&&(fe=Z.get(At),ae=L,ae.setIndex(fe)),V.isMesh)k.wireframe===!0?(ot.setLineWidth(k.wireframeLinewidth*ut()),ae.setMode(A.LINES)):ae.setMode(A.TRIANGLES);else if(V.isLine){let Ee=k.linewidth;Ee===void 0&&(Ee=1),ot.setLineWidth(Ee*ut()),V.isLineSegments?ae.setMode(A.LINES):V.isLineLoop?ae.setMode(A.LINE_LOOP):ae.setMode(A.LINE_STRIP)}else V.isPoints?ae.setMode(A.POINTS):V.isSprite&&ae.setMode(A.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)rs("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ae.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(xt.get("WEBGL_multi_draw"))ae.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const Ee=V._multiDrawStarts,wt=V._multiDrawCounts,De=V._multiDrawCount,$t=At?Z.get(At).bytesPerElement:1,He=_.get(k).currentProgram.getUniforms();for(let Ke=0;Ke<De;Ke++)He.setValue(A,"_gl_DrawID",Ke),ae.render(Ee[Ke]/$t,wt[Ke])}else if(V.isInstancedMesh)ae.renderInstances(Lt,pe,V.count);else if(W.isInstancedBufferGeometry){const Ee=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,wt=Math.min(W.instanceCount,Ee);ae.renderInstances(Lt,pe,wt)}else ae.render(Lt,pe)};function Co(M,N,W){M.transparent===!0&&M.side===tn&&M.forceSinglePass===!1?(M.side=Ie,M.needsUpdate=!0,dr(M,N,W),M.side=bn,M.needsUpdate=!0,dr(M,N,W),M.side=tn):dr(M,N,W)}this.compile=function(M,N,W=null){W===null&&(W=M),C=Q.get(W),C.init(N),P.push(C),W.traverseVisible(function(V){V.isLight&&V.layers.test(N.layers)&&(C.pushLight(V),V.castShadow&&C.pushShadow(V))}),M!==W&&M.traverseVisible(function(V){V.isLight&&V.layers.test(N.layers)&&(C.pushLight(V),V.castShadow&&C.pushShadow(V))}),C.setupLights();const k=new Set;return M.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const dt=V.material;if(dt)if(Array.isArray(dt))for(let Mt=0;Mt<dt.length;Mt++){const pt=dt[Mt];Co(pt,W,V),k.add(pt)}else Co(dt,W,V),k.add(dt)}),C=P.pop(),k},this.compileAsync=function(M,N,W=null){const k=this.compile(M,N,W);return new Promise(V=>{function dt(){if(k.forEach(function(Mt){_.get(Mt).currentProgram.isReady()&&k.delete(Mt)}),k.size===0){V(M);return}setTimeout(dt,10)}xt.get("KHR_parallel_shader_compile")!==null?dt():setTimeout(dt,10)})};let ps=null;function Qc(M){ps&&ps(M)}function Ro(){Vn.stop()}function Po(){Vn.start()}const Vn=new Yc;Vn.setAnimationLoop(Qc),typeof self<"u"&&Vn.setContext(self),this.setAnimationLoop=function(M){ps=M,Y.setAnimationLoop(M),M===null?Vn.stop():Vn.start()},Y.addEventListener("sessionstart",Ro),Y.addEventListener("sessionend",Po),this.render=function(M,N){if(N!==void 0&&N.isCamera!==!0){Ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(H===!0)return;const W=Y.enabled===!0&&Y.isPresenting===!0,k=x!==null&&(O===null||W)&&x.begin(T,O);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(x===null||x.isCompositing()===!1)&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(N),N=Y.getCamera()),M.isScene===!0&&M.onBeforeRender(T,M,N,O),C=Q.get(M,P.length),C.init(N),P.push(C),re.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Nt.setFromProjectionMatrix(re,nn,N.reversedDepth),zt=this.localClippingEnabled,It=it.init(this.clippingPlanes,zt),y=Ft.get(M,w.length),y.init(),w.push(y),Y.enabled===!0&&Y.isPresenting===!0){const Mt=T.xr.getDepthSensingMesh();Mt!==null&&ms(Mt,N,-1/0,T.sortObjects)}ms(M,N,0,T.sortObjects),y.finish(),T.sortObjects===!0&&y.sort(jt,ie),$=Y.enabled===!1||Y.isPresenting===!1||Y.hasDepthSensing()===!1,$&&Tt.addToRenderList(y,M),this.info.render.frame++,It===!0&&it.beginShadows();const V=C.state.shadowsArray;if(bt.render(V,M,N),It===!0&&it.endShadows(),this.info.autoReset===!0&&this.info.reset(),(k&&x.hasRenderPass())===!1){const Mt=y.opaque,pt=y.transmissive;if(C.setupLights(),N.isArrayCamera){const At=N.cameras;if(pt.length>0)for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct];Io(Mt,pt,M,qt)}$&&Tt.render(M);for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct];Lo(y,M,qt,qt.viewport)}}else pt.length>0&&Io(Mt,pt,M,N),$&&Tt.render(M),Lo(y,M,N)}O!==null&&U===0&&(I.updateMultisampleRenderTarget(O),I.updateRenderTargetMipmap(O)),k&&x.end(T),M.isScene===!0&&M.onAfterRender(T,M,N),rt.resetDefaultState(),G=-1,B=null,P.pop(),P.length>0?(C=P[P.length-1],It===!0&&it.setGlobalState(T.clippingPlanes,C.state.camera)):C=null,w.pop(),w.length>0?y=w[w.length-1]:y=null};function ms(M,N,W,k){if(M.visible===!1)return;if(M.layers.test(N.layers)){if(M.isGroup)W=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(N);else if(M.isLight)C.pushLight(M),M.castShadow&&C.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Nt.intersectsSprite(M)){k&&K.setFromMatrixPosition(M.matrixWorld).applyMatrix4(re);const Mt=yt.update(M),pt=M.material;pt.visible&&y.push(M,Mt,pt,W,K.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Nt.intersectsObject(M))){const Mt=yt.update(M),pt=M.material;if(k&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),K.copy(M.boundingSphere.center)):(Mt.boundingSphere===null&&Mt.computeBoundingSphere(),K.copy(Mt.boundingSphere.center)),K.applyMatrix4(M.matrixWorld).applyMatrix4(re)),Array.isArray(pt)){const At=Mt.groups;for(let Ct=0,Gt=At.length;Ct<Gt;Ct++){const qt=At[Ct],Lt=pt[qt.materialIndex];Lt&&Lt.visible&&y.push(M,Mt,Lt,W,K.z,qt)}}else pt.visible&&y.push(M,Mt,pt,W,K.z,null)}}const dt=M.children;for(let Mt=0,pt=dt.length;Mt<pt;Mt++)ms(dt[Mt],N,W,k)}function Lo(M,N,W,k){const{opaque:V,transmissive:dt,transparent:Mt}=M;C.setupLightsView(W),It===!0&&it.setGlobalState(T.clippingPlanes,W),k&&ot.viewport(F.copy(k)),V.length>0&&fr(V,N,W),dt.length>0&&fr(dt,N,W),Mt.length>0&&fr(Mt,N,W),ot.buffers.depth.setTest(!0),ot.buffers.depth.setMask(!0),ot.buffers.color.setMask(!0),ot.setPolygonOffset(!1)}function Io(M,N,W,k){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(C.state.transmissionRenderTarget[k.id]===void 0){const Lt=xt.has("EXT_color_buffer_half_float")||xt.has("EXT_color_buffer_float");C.state.transmissionRenderTarget[k.id]=new sn(1,1,{generateMipmaps:!0,type:Lt?En:Fe,minFilter:Fn,samples:Math.max(4,Ut.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace})}const dt=C.state.transmissionRenderTarget[k.id],Mt=k.viewport||F;dt.setSize(Mt.z*T.transmissionResolutionScale,Mt.w*T.transmissionResolutionScale);const pt=T.getRenderTarget(),At=T.getActiveCubeFace(),Ct=T.getActiveMipmapLevel();T.setRenderTarget(dt),T.getClearColor(j),mt=T.getClearAlpha(),mt<1&&T.setClearColor(16777215,.5),T.clear(),$&&Tt.render(W);const Gt=T.toneMapping;T.toneMapping=rn;const qt=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),C.setupLightsView(k),It===!0&&it.setGlobalState(T.clippingPlanes,k),fr(M,W,k),I.updateMultisampleRenderTarget(dt),I.updateRenderTargetMipmap(dt),xt.has("WEBGL_multisampled_render_to_texture")===!1){let Lt=!1;for(let se=0,pe=N.length;se<pe;se++){const fe=N[se],{object:ae,geometry:Ee,material:wt,group:De}=fe;if(wt.side===tn&&ae.layers.test(k.layers)){const $t=wt.side;wt.side=Ie,wt.needsUpdate=!0,Do(ae,W,k,Ee,wt,De),wt.side=$t,wt.needsUpdate=!0,Lt=!0}}Lt===!0&&(I.updateMultisampleRenderTarget(dt),I.updateRenderTargetMipmap(dt))}T.setRenderTarget(pt,At,Ct),T.setClearColor(j,mt),qt!==void 0&&(k.viewport=qt),T.toneMapping=Gt}function fr(M,N,W){const k=N.isScene===!0?N.overrideMaterial:null;for(let V=0,dt=M.length;V<dt;V++){const Mt=M[V],{object:pt,geometry:At,group:Ct}=Mt;let Gt=Mt.material;Gt.allowOverride===!0&&k!==null&&(Gt=k),pt.layers.test(W.layers)&&Do(pt,N,W,At,Gt,Ct)}}function Do(M,N,W,k,V,dt){M.onBeforeRender(T,N,W,k,V,dt),M.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),V.onBeforeRender(T,N,W,k,M,dt),V.transparent===!0&&V.side===tn&&V.forceSinglePass===!1?(V.side=Ie,V.needsUpdate=!0,T.renderBufferDirect(W,N,k,V,M,dt),V.side=bn,V.needsUpdate=!0,T.renderBufferDirect(W,N,k,V,M,dt),V.side=tn):T.renderBufferDirect(W,N,k,V,M,dt),M.onAfterRender(T,N,W,k,V,dt)}function dr(M,N,W){N.isScene!==!0&&(N=tt);const k=_.get(M),V=C.state.lights,dt=C.state.shadowsArray,Mt=V.state.version,pt=lt.getParameters(M,V.state,dt,N,W),At=lt.getProgramCacheKey(pt);let Ct=k.programs;k.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?N.environment:null,k.fog=N.fog;const Gt=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;k.envMap=X.get(M.envMap||k.environment,Gt),k.envMapRotation=k.environment!==null&&M.envMap===null?N.environmentRotation:M.envMapRotation,Ct===void 0&&(M.addEventListener("dispose",Qt),Ct=new Map,k.programs=Ct);let qt=Ct.get(At);if(qt!==void 0){if(k.currentProgram===qt&&k.lightsStateVersion===Mt)return Uo(M,pt),qt}else pt.uniforms=lt.getUniforms(M),M.onBeforeCompile(pt,T),qt=lt.acquireProgram(pt,At),Ct.set(At,qt),k.uniforms=pt.uniforms;const Lt=k.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Lt.clippingPlanes=it.uniform),Uo(M,pt),k.needsLights=nh(M),k.lightsStateVersion=Mt,k.needsLights&&(Lt.ambientLightColor.value=V.state.ambient,Lt.lightProbe.value=V.state.probe,Lt.directionalLights.value=V.state.directional,Lt.directionalLightShadows.value=V.state.directionalShadow,Lt.spotLights.value=V.state.spot,Lt.spotLightShadows.value=V.state.spotShadow,Lt.rectAreaLights.value=V.state.rectArea,Lt.ltc_1.value=V.state.rectAreaLTC1,Lt.ltc_2.value=V.state.rectAreaLTC2,Lt.pointLights.value=V.state.point,Lt.pointLightShadows.value=V.state.pointShadow,Lt.hemisphereLights.value=V.state.hemi,Lt.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Lt.spotLightMatrix.value=V.state.spotLightMatrix,Lt.spotLightMap.value=V.state.spotLightMap,Lt.pointShadowMatrix.value=V.state.pointShadowMatrix),k.currentProgram=qt,k.uniformsList=null,qt}function No(M){if(M.uniformsList===null){const N=M.currentProgram.getUniforms();M.uniformsList=jr.seqWithValue(N.seq,M.uniforms)}return M.uniformsList}function Uo(M,N){const W=_.get(M);W.outputColorSpace=N.outputColorSpace,W.batching=N.batching,W.batchingColor=N.batchingColor,W.instancing=N.instancing,W.instancingColor=N.instancingColor,W.instancingMorph=N.instancingMorph,W.skinning=N.skinning,W.morphTargets=N.morphTargets,W.morphNormals=N.morphNormals,W.morphColors=N.morphColors,W.morphTargetsCount=N.morphTargetsCount,W.numClippingPlanes=N.numClippingPlanes,W.numIntersection=N.numClipIntersection,W.vertexAlphas=N.vertexAlphas,W.vertexTangents=N.vertexTangents,W.toneMapping=N.toneMapping}function th(M,N,W,k,V){N.isScene!==!0&&(N=tt),I.resetTextureUnits();const dt=N.fog,Mt=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?N.environment:null,pt=O===null?T.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:ti,At=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap,Ct=X.get(k.envMap||Mt,At),Gt=k.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,qt=!!W.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Lt=!!W.morphAttributes.position,se=!!W.morphAttributes.normal,pe=!!W.morphAttributes.color;let fe=rn;k.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(fe=T.toneMapping);const ae=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Ee=ae!==void 0?ae.length:0,wt=_.get(k),De=C.state.lights;if(It===!0&&(zt===!0||M!==B)){const ve=M===B&&k.id===G;it.setState(k,M,ve)}let $t=!1;k.version===wt.__version?(wt.needsLights&&wt.lightsStateVersion!==De.state.version||wt.outputColorSpace!==pt||V.isBatchedMesh&&wt.batching===!1||!V.isBatchedMesh&&wt.batching===!0||V.isBatchedMesh&&wt.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&wt.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&wt.instancing===!1||!V.isInstancedMesh&&wt.instancing===!0||V.isSkinnedMesh&&wt.skinning===!1||!V.isSkinnedMesh&&wt.skinning===!0||V.isInstancedMesh&&wt.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&wt.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&wt.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&wt.instancingMorph===!1&&V.morphTexture!==null||wt.envMap!==Ct||k.fog===!0&&wt.fog!==dt||wt.numClippingPlanes!==void 0&&(wt.numClippingPlanes!==it.numPlanes||wt.numIntersection!==it.numIntersection)||wt.vertexAlphas!==Gt||wt.vertexTangents!==qt||wt.morphTargets!==Lt||wt.morphNormals!==se||wt.morphColors!==pe||wt.toneMapping!==fe||wt.morphTargetsCount!==Ee)&&($t=!0):($t=!0,wt.__version=k.version);let He=wt.currentProgram;$t===!0&&(He=dr(k,N,V));let Ke=!1,kn=!1,ni=!1;const oe=He.getUniforms(),be=wt.uniforms;if(ot.useProgram(He.program)&&(Ke=!0,kn=!0,ni=!0),k.id!==G&&(G=k.id,kn=!0),Ke||B!==M){ot.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),oe.setValue(A,"projectionMatrix",M.projectionMatrix),oe.setValue(A,"viewMatrix",M.matrixWorldInverse);const Cn=oe.map.cameraPosition;Cn!==void 0&&Cn.setValue(A,kt.setFromMatrixPosition(M.matrixWorld)),Ut.logarithmicDepthBuffer&&oe.setValue(A,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&oe.setValue(A,"isOrthographic",M.isOrthographicCamera===!0),B!==M&&(B=M,kn=!0,ni=!0)}if(wt.needsLights&&(De.state.directionalShadowMap.length>0&&oe.setValue(A,"directionalShadowMap",De.state.directionalShadowMap,I),De.state.spotShadowMap.length>0&&oe.setValue(A,"spotShadowMap",De.state.spotShadowMap,I),De.state.pointShadowMap.length>0&&oe.setValue(A,"pointShadowMap",De.state.pointShadowMap,I)),V.isSkinnedMesh){oe.setOptional(A,V,"bindMatrix"),oe.setOptional(A,V,"bindMatrixInverse");const ve=V.skeleton;ve&&(ve.boneTexture===null&&ve.computeBoneTexture(),oe.setValue(A,"boneTexture",ve.boneTexture,I))}V.isBatchedMesh&&(oe.setOptional(A,V,"batchingTexture"),oe.setValue(A,"batchingTexture",V._matricesTexture,I),oe.setOptional(A,V,"batchingIdTexture"),oe.setValue(A,"batchingIdTexture",V._indirectTexture,I),oe.setOptional(A,V,"batchingColorTexture"),V._colorsTexture!==null&&oe.setValue(A,"batchingColorTexture",V._colorsTexture,I));const wn=W.morphAttributes;if((wn.position!==void 0||wn.normal!==void 0||wn.color!==void 0)&&vt.update(V,W,He),(kn||wt.receiveShadow!==V.receiveShadow)&&(wt.receiveShadow=V.receiveShadow,oe.setValue(A,"receiveShadow",V.receiveShadow)),(k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial)&&k.envMap===null&&N.environment!==null&&(be.envMapIntensity.value=N.environmentIntensity),be.dfgLUT!==void 0&&(be.dfgLUT.value=a0()),kn&&(oe.setValue(A,"toneMappingExposure",T.toneMappingExposure),wt.needsLights&&eh(be,ni),dt&&k.fog===!0&&Pt.refreshFogUniforms(be,dt),Pt.refreshMaterialUniforms(be,k,Bt,gt,C.state.transmissionRenderTarget[M.id]),jr.upload(A,No(wt),be,I)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(jr.upload(A,No(wt),be,I),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&oe.setValue(A,"center",V.center),oe.setValue(A,"modelViewMatrix",V.modelViewMatrix),oe.setValue(A,"normalMatrix",V.normalMatrix),oe.setValue(A,"modelMatrix",V.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const ve=k.uniformsGroups;for(let Cn=0,ii=ve.length;Cn<ii;Cn++){const Fo=ve[Cn];St.update(Fo,He),St.bind(Fo,He)}}return He}function eh(M,N){M.ambientLightColor.needsUpdate=N,M.lightProbe.needsUpdate=N,M.directionalLights.needsUpdate=N,M.directionalLightShadows.needsUpdate=N,M.pointLights.needsUpdate=N,M.pointLightShadows.needsUpdate=N,M.spotLights.needsUpdate=N,M.spotLightShadows.needsUpdate=N,M.rectAreaLights.needsUpdate=N,M.hemisphereLights.needsUpdate=N}function nh(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(M,N,W){const k=_.get(M);k.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),_.get(M.texture).__webglTexture=N,_.get(M.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:W,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,N){const W=_.get(M);W.__webglFramebuffer=N,W.__useDefaultFramebuffer=N===void 0};const ih=A.createFramebuffer();this.setRenderTarget=function(M,N=0,W=0){O=M,R=N,U=W;let k=null,V=!1,dt=!1;if(M){const pt=_.get(M);if(pt.__useDefaultFramebuffer!==void 0){ot.bindFramebuffer(A.FRAMEBUFFER,pt.__webglFramebuffer),F.copy(M.viewport),z.copy(M.scissor),nt=M.scissorTest,ot.viewport(F),ot.scissor(z),ot.setScissorTest(nt),G=-1;return}else if(pt.__webglFramebuffer===void 0)I.setupRenderTarget(M);else if(pt.__hasExternalTextures)I.rebindTextures(M,_.get(M.texture).__webglTexture,_.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Gt=M.depthTexture;if(pt.__boundDepthTexture!==Gt){if(Gt!==null&&_.has(Gt)&&(M.width!==Gt.image.width||M.height!==Gt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");I.setupDepthRenderbuffer(M)}}const At=M.texture;(At.isData3DTexture||At.isDataArrayTexture||At.isCompressedArrayTexture)&&(dt=!0);const Ct=_.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ct[N])?k=Ct[N][W]:k=Ct[N],V=!0):M.samples>0&&I.useMultisampledRTT(M)===!1?k=_.get(M).__webglMultisampledFramebuffer:Array.isArray(Ct)?k=Ct[W]:k=Ct,F.copy(M.viewport),z.copy(M.scissor),nt=M.scissorTest}else F.copy(J).multiplyScalar(Bt).floor(),z.copy(st).multiplyScalar(Bt).floor(),nt=at;if(W!==0&&(k=ih),ot.bindFramebuffer(A.FRAMEBUFFER,k)&&ot.drawBuffers(M,k),ot.viewport(F),ot.scissor(z),ot.setScissorTest(nt),V){const pt=_.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+N,pt.__webglTexture,W)}else if(dt){const pt=N;for(let At=0;At<M.textures.length;At++){const Ct=_.get(M.textures[At]);A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0+At,Ct.__webglTexture,W,pt)}}else if(M!==null&&W!==0){const pt=_.get(M.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,pt.__webglTexture,W)}G=-1},this.readRenderTargetPixels=function(M,N,W,k,V,dt,Mt,pt=0){if(!(M&&M.isWebGLRenderTarget)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let At=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Mt!==void 0&&(At=At[Mt]),At){ot.bindFramebuffer(A.FRAMEBUFFER,At);try{const Ct=M.textures[pt],Gt=Ct.format,qt=Ct.type;if(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+pt),!Ut.textureFormatReadable(Gt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ut.textureTypeReadable(qt)){Ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=M.width-k&&W>=0&&W<=M.height-V&&A.readPixels(N,W,k,V,ht.convert(Gt),ht.convert(qt),dt)}finally{const Ct=O!==null?_.get(O).__webglFramebuffer:null;ot.bindFramebuffer(A.FRAMEBUFFER,Ct)}}},this.readRenderTargetPixelsAsync=async function(M,N,W,k,V,dt,Mt,pt=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let At=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Mt!==void 0&&(At=At[Mt]),At)if(N>=0&&N<=M.width-k&&W>=0&&W<=M.height-V){ot.bindFramebuffer(A.FRAMEBUFFER,At);const Ct=M.textures[pt],Gt=Ct.format,qt=Ct.type;if(M.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+pt),!Ut.textureFormatReadable(Gt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ut.textureTypeReadable(qt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Lt=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,Lt),A.bufferData(A.PIXEL_PACK_BUFFER,dt.byteLength,A.STREAM_READ),A.readPixels(N,W,k,V,ht.convert(Gt),ht.convert(qt),0);const se=O!==null?_.get(O).__webglFramebuffer:null;ot.bindFramebuffer(A.FRAMEBUFFER,se);const pe=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await qh(A,pe,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,Lt),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,dt),A.deleteBuffer(Lt),A.deleteSync(pe),dt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,N=null,W=0){const k=Math.pow(2,-W),V=Math.floor(M.image.width*k),dt=Math.floor(M.image.height*k),Mt=N!==null?N.x:0,pt=N!==null?N.y:0;I.setTexture2D(M,0),A.copyTexSubImage2D(A.TEXTURE_2D,W,0,0,Mt,pt,V,dt),ot.unbindTexture()};const rh=A.createFramebuffer(),sh=A.createFramebuffer();this.copyTextureToTexture=function(M,N,W=null,k=null,V=0,dt=0){let Mt,pt,At,Ct,Gt,qt,Lt,se,pe;const fe=M.isCompressedTexture?M.mipmaps[dt]:M.image;if(W!==null)Mt=W.max.x-W.min.x,pt=W.max.y-W.min.y,At=W.isBox3?W.max.z-W.min.z:1,Ct=W.min.x,Gt=W.min.y,qt=W.isBox3?W.min.z:0;else{const be=Math.pow(2,-V);Mt=Math.floor(fe.width*be),pt=Math.floor(fe.height*be),M.isDataArrayTexture?At=fe.depth:M.isData3DTexture?At=Math.floor(fe.depth*be):At=1,Ct=0,Gt=0,qt=0}k!==null?(Lt=k.x,se=k.y,pe=k.z):(Lt=0,se=0,pe=0);const ae=ht.convert(N.format),Ee=ht.convert(N.type);let wt;N.isData3DTexture?(I.setTexture3D(N,0),wt=A.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(I.setTexture2DArray(N,0),wt=A.TEXTURE_2D_ARRAY):(I.setTexture2D(N,0),wt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,N.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,N.unpackAlignment);const De=A.getParameter(A.UNPACK_ROW_LENGTH),$t=A.getParameter(A.UNPACK_IMAGE_HEIGHT),He=A.getParameter(A.UNPACK_SKIP_PIXELS),Ke=A.getParameter(A.UNPACK_SKIP_ROWS),kn=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,fe.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,fe.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Ct),A.pixelStorei(A.UNPACK_SKIP_ROWS,Gt),A.pixelStorei(A.UNPACK_SKIP_IMAGES,qt);const ni=M.isDataArrayTexture||M.isData3DTexture,oe=N.isDataArrayTexture||N.isData3DTexture;if(M.isDepthTexture){const be=_.get(M),wn=_.get(N),ve=_.get(be.__renderTarget),Cn=_.get(wn.__renderTarget);ot.bindFramebuffer(A.READ_FRAMEBUFFER,ve.__webglFramebuffer),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,Cn.__webglFramebuffer);for(let ii=0;ii<At;ii++)ni&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,_.get(M).__webglTexture,V,qt+ii),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,_.get(N).__webglTexture,dt,pe+ii)),A.blitFramebuffer(Ct,Gt,Mt,pt,Lt,se,Mt,pt,A.DEPTH_BUFFER_BIT,A.NEAREST);ot.bindFramebuffer(A.READ_FRAMEBUFFER,null),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(V!==0||M.isRenderTargetTexture||_.has(M)){const be=_.get(M),wn=_.get(N);ot.bindFramebuffer(A.READ_FRAMEBUFFER,rh),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,sh);for(let ve=0;ve<At;ve++)ni?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,be.__webglTexture,V,qt+ve):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,be.__webglTexture,V),oe?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,wn.__webglTexture,dt,pe+ve):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,wn.__webglTexture,dt),V!==0?A.blitFramebuffer(Ct,Gt,Mt,pt,Lt,se,Mt,pt,A.COLOR_BUFFER_BIT,A.NEAREST):oe?A.copyTexSubImage3D(wt,dt,Lt,se,pe+ve,Ct,Gt,Mt,pt):A.copyTexSubImage2D(wt,dt,Lt,se,Ct,Gt,Mt,pt);ot.bindFramebuffer(A.READ_FRAMEBUFFER,null),ot.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else oe?M.isDataTexture||M.isData3DTexture?A.texSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,Ee,fe.data):N.isCompressedArrayTexture?A.compressedTexSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,fe.data):A.texSubImage3D(wt,dt,Lt,se,pe,Mt,pt,At,ae,Ee,fe):M.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,dt,Lt,se,Mt,pt,ae,Ee,fe.data):M.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,dt,Lt,se,fe.width,fe.height,ae,fe.data):A.texSubImage2D(A.TEXTURE_2D,dt,Lt,se,Mt,pt,ae,Ee,fe);A.pixelStorei(A.UNPACK_ROW_LENGTH,De),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,$t),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ke),A.pixelStorei(A.UNPACK_SKIP_IMAGES,kn),dt===0&&N.generateMipmaps&&A.generateMipmap(wt),ot.unbindTexture()},this.initRenderTarget=function(M){_.get(M).__webglFramebuffer===void 0&&I.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?I.setTextureCube(M,0):M.isData3DTexture?I.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?I.setTexture2DArray(M,0):I.setTexture2D(M,0),ot.unbindTexture()},this.resetState=function(){R=0,U=0,O=null,ot.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return nn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}function l0(i){const n=new Float32Array(524288);for(let o=0;o<256;o++){const c=((o+.5)/256-.5)*Math.PI;for(let l=0;l<512;l++){const h=(l+.5)/512*Math.PI*2,f=Math.pow(.5+.5*Math.sin(4*h+1.8*Math.sin(c)),3),u=Math.pow(.5+.5*Math.cos(2*h-3*c),3),d=.12+3.2*f+.8*u,g=(o*512+l)*4;n.set([d,d,d,1],g)}}const r=new ls(n,512,256,Be,Oe);r.mapping=qr,r.needsUpdate=!0;const s=new Za(i),a=s.fromEquirectangular(r);return r.dispose(),s.dispose(),a}function c0(i){const{container:t,videos:e,lighting:n}=i;let r;try{r=new o0({antialias:!0,alpha:!0})}catch{return}r.setPixelRatio(Math.min(window.devicePixelRatio,i.maxPixelRatio)),r.outputColorSpace=Pe,r.toneMapping=Qa,r.setClearColor(0,0),t.appendChild(r.domElement);const s=new bu,a=l0(r);s.environment=a.texture,s.environmentIntensity=n.environment,s.add(new Yf(16777215,12699857,n.hemisphere));const o=new Ya(16777215,n.key.intensity);o.position.set(...n.key.position),s.add(o);const c=new Ya(15003135,n.rim.intensity);c.position.set(...n.rim.position),s.add(c);let l=0,h=0,f=!0,u=!1;const d=()=>{!l&&f&&!document.hidden&&!u&&(l=requestAnimationFrame(g))},g=C=>{if(l=0,u||!f||document.hidden)return;const w=Math.min((C-h)/1e3,.05);h=C,i.frame(C,w)&&d()},v=()=>{const C=t.clientWidth,w=t.clientHeight;!C||!w||(i.resize(C,w),r.setSize(C,w,!1),d())},m=new ResizeObserver(v),p=new IntersectionObserver(([C])=>{f=!!C?.isIntersecting,d()}),S=new Map;let b,y=!1;return{renderer:r,scene:s,environment:a.texture,invalidate:d,start(){if(!(y||u)){y=!0;for(const C of e){if(!("requestVideoFrameCallback"in C))continue;const w=()=>{u||(d(),S.set(C,C.requestVideoFrameCallback(w)))};S.set(C,C.requestVideoFrameCallback(w))}e.some(C=>!("requestVideoFrameCallback"in C))&&(b=window.setInterval(d,1e3/30)),m.observe(t),p.observe(t),document.addEventListener("visibilitychange",d),v()}},dispose(){u=!0,cancelAnimationFrame(l);for(const[C,w]of S)C.cancelVideoFrameCallback(w);clearInterval(b),m.disconnect(),p.disconnect(),document.removeEventListener("visibilitychange",d),a.dispose(),r.dispose(),r.forceContextLoss(),r.domElement.remove()}}}function h0(i){const[t,e]=Gn.useState(i),[n,r]=Gn.useState(!1),s=Gn.useRef(t);s.current=t;const a=Gn.useRef(n);a.current=n;const o=Gn.useRef({yaw:0,pitch:0}).current,c=Gn.useCallback(h=>{o.yaw=0,o.pitch=0,e(h)},[o]),l=Gn.useCallback((h,f,u)=>{o.yaw+=h*.008,o.pitch=Ec.clamp(o.pitch+f*.008,-u,u)},[o]);return{view:t,viewRef:s,chooseView:c,locked:n,lockedRef:a,setLocked:r,orbit:o,drag:l}}const u0={supported:typeof WebAssembly=="object",async decodeGltfBufferAsync(i,t,e,n,r){const{MeshoptDecoder:s}=await Promise.resolve().then(()=>require("./meshopt_decoder.module-DxJdu6ez.js"));await s.ready;const a=new Uint8Array(i*t);return s.decodeGltfBuffer(a,i,t,e,n,r),a}};function f0(i){const t=i.indexOf(","),e=i.slice(0,t),n=i.slice(t+1);if(!e.endsWith(";base64"))return new TextEncoder().encode(decodeURIComponent(n)).buffer;const r=atob(n),s=new Uint8Array(r.length);for(let a=0;a<r.length;a++)s[a]=r.charCodeAt(a);return s.buffer}async function d0(i,t){i.setMeshoptDecoder(u0);const e=typeof t=="string"?t:await t();return e.startsWith("data:")?i.parseAsync(f0(e),""):i.loadAsync(e)}exports.AnimationClip=Bf;exports.Bone=Rc;exports.Box2=dd;exports.Box3=An;exports.BoxGeometry=Ri;exports.BufferAttribute=ze;exports.BufferGeometry=we;exports.CircleGeometry=xo;exports.ClampToEdgeWrapping=en;exports.Color=Zt;exports.ColorManagement=Kt;exports.CylinderGeometry=vo;exports.DirectionalLight=Ya;exports.DoubleSide=tn;exports.DynamicDrawUsage=Gh;exports.ExtrudeGeometry=bo;exports.FileLoader=Wf;exports.FrontSide=bn;exports.Group=qi;exports.ImageBitmapLoader=td;exports.InstancedBufferAttribute=Ga;exports.InstancedMesh=Nu;exports.InterleavedBuffer=wu;exports.InterleavedBufferAttribute=fo;exports.Interpolant=Pi;exports.InterpolateDiscrete=er;exports.InterpolateLinear=es;exports.Line=_o;exports.LineBasicMaterial=Pc;exports.LineLoop=zu;exports.LineSegments=Bu;exports.LinearFilter=ge;exports.LinearMipmapLinearFilter=Fn;exports.LinearMipmapNearestFilter=Yr;exports.LinearSRGBColorSpace=ti;exports.Loader=Di;exports.LoaderUtils=Qf;exports.Material=zn;exports.MathUtils=Ec;exports.Matrix4=Jt;exports.Mesh=Ve;exports.MeshBasicMaterial=po;exports.MeshPhysicalMaterial=Rf;exports.MeshStandardMaterial=Hc;exports.MirroredRepeatWrapping=ts;exports.NearestFilter=Se;exports.NearestMipmapLinearFilter=Xi;exports.NearestMipmapNearestFilter=mc;exports.NumberKeyframeTrack=lr;exports.Object3D=ue;exports.OrthographicCamera=us;exports.PerspectiveCamera=Le;exports.PointLight=$f;exports.Points=Vu;exports.PointsMaterial=Lc;exports.PropertyBinding=ne;exports.Quaternion=Bn;exports.QuaternionKeyframeTrack=ur;exports.Raycaster=fd;exports.RepeatWrapping=Qr;exports.SRGBColorSpace=Pe;exports.ShaderChunk=Ht;exports.Shape=yo;exports.ShapeGeometry=Eo;exports.Skeleton=mo;exports.SkinnedMesh=Lu;exports.Sphere=cn;exports.SpotLight=Zf;exports.Texture=ye;exports.TextureLoader=qf;exports.TriangleFanDrawMode=Dh;exports.TriangleStripDrawMode=Ih;exports.TrianglesDrawMode=Lh;exports.Vector2=ct;exports.Vector3=D;exports.VectorKeyframeTrack=cr;exports.VideoTexture=ku;exports.createDeviceStage=c0;exports.loadModel=d0;exports.useStageView=h0;
|