@react-three/fiber 10.0.0-canary.0706a92 → 10.0.0-canary.0f8db17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1701 -1544
- package/dist/index.d.cts +64 -26
- package/dist/index.d.mts +64 -26
- package/dist/index.d.ts +64 -26
- package/dist/index.mjs +1704 -1547
- package/dist/legacy.cjs +1699 -1542
- package/dist/legacy.d.cts +64 -25
- package/dist/legacy.d.mts +64 -25
- package/dist/legacy.d.ts +64 -25
- package/dist/legacy.mjs +1701 -1544
- package/dist/webgpu/index.cjs +2116 -2201
- package/dist/webgpu/index.d.cts +80 -29
- package/dist/webgpu/index.d.mts +80 -29
- package/dist/webgpu/index.d.ts +80 -29
- package/dist/webgpu/index.mjs +2118 -2203
- package/package.json +3 -3
- package/readme.md +0 -1
package/dist/webgpu/index.cjs
CHANGED
|
@@ -6,15 +6,14 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
const React = require('react');
|
|
7
7
|
const useMeasure = require('react-use-measure');
|
|
8
8
|
const itsFine = require('its-fine');
|
|
9
|
-
const
|
|
9
|
+
const traditional = require('zustand/traditional');
|
|
10
|
+
const scheduler = require('@pmndrs/scheduler');
|
|
11
|
+
const Tb = require('scheduler');
|
|
10
12
|
const GroundedSkybox_js = require('three/examples/jsm/objects/GroundedSkybox.js');
|
|
11
13
|
const HDRLoader_js = require('three/examples/jsm/loaders/HDRLoader.js');
|
|
12
14
|
const EXRLoader_js = require('three/examples/jsm/loaders/EXRLoader.js');
|
|
13
15
|
const UltraHDRLoader_js = require('three/examples/jsm/loaders/UltraHDRLoader.js');
|
|
14
16
|
const gainmapJs = require('@monogrid/gainmap-js');
|
|
15
|
-
const Tb = require('scheduler');
|
|
16
|
-
const traditional = require('zustand/traditional');
|
|
17
|
-
const scheduler = require('@pmndrs/scheduler');
|
|
18
17
|
const suspendReact = require('suspend-react');
|
|
19
18
|
const lite = require('dequal/lite');
|
|
20
19
|
require('zustand/shallow');
|
|
@@ -63,13 +62,16 @@ const WebGLRenderer = class WebGLRenderer2 {
|
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
const WebGLRenderTarget = null;
|
|
65
|
+
const WebGLCubeRenderTarget = null;
|
|
66
66
|
|
|
67
67
|
const THREE = /*#__PURE__*/_mergeNamespaces({
|
|
68
68
|
__proto__: null,
|
|
69
|
+
CubeRenderTargetCompat: webgpu.CubeRenderTarget,
|
|
69
70
|
Inspector: Inspector_js.Inspector,
|
|
70
71
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
71
72
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
72
73
|
RenderTargetCompat: webgpu.RenderTarget,
|
|
74
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
73
75
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
74
76
|
WebGLRenderer: WebGLRenderer
|
|
75
77
|
}, [webgpu__namespace]);
|
|
@@ -132,549 +134,223 @@ function getPrimaryIds() {
|
|
|
132
134
|
return Array.from(primaryRegistry.keys());
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
137
|
+
var __defProp$1 = Object.defineProperty;
|
|
138
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
139
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
140
|
+
const useIsomorphicLayoutEffect = /* @__PURE__ */ (() => typeof window !== "undefined" && (window.document?.createElement || window.navigator?.product === "ReactNative"))() ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
141
|
+
function useMutableCallback(fn) {
|
|
142
|
+
const ref = React__namespace.useRef(fn);
|
|
143
|
+
useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
|
|
144
|
+
return ref;
|
|
145
|
+
}
|
|
146
|
+
function useBridge() {
|
|
147
|
+
const fiber = itsFine.useFiber();
|
|
148
|
+
const ContextBridge = itsFine.useContextBridge();
|
|
149
|
+
return React__namespace.useMemo(
|
|
150
|
+
() => ({ children }) => {
|
|
151
|
+
const strict = !!itsFine.traverseFiber(fiber, true, (node) => node.type === React__namespace.StrictMode);
|
|
152
|
+
const Root = strict ? React__namespace.StrictMode : React__namespace.Fragment;
|
|
153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Root, { children: /* @__PURE__ */ jsxRuntime.jsx(ContextBridge, { children }) });
|
|
154
|
+
},
|
|
155
|
+
[fiber, ContextBridge]
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
function Block({ set }) {
|
|
159
|
+
useIsomorphicLayoutEffect(() => {
|
|
160
|
+
set(new Promise(() => null));
|
|
161
|
+
return () => set(false);
|
|
162
|
+
}, [set]);
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const ErrorBoundary = /* @__PURE__ */ (() => {
|
|
166
|
+
var _a;
|
|
167
|
+
return _a = class extends React__namespace.Component {
|
|
168
|
+
constructor() {
|
|
169
|
+
super(...arguments);
|
|
170
|
+
__publicField$1(this, "state", { error: false });
|
|
171
|
+
}
|
|
172
|
+
componentDidCatch(err) {
|
|
173
|
+
this.props.set(err);
|
|
174
|
+
}
|
|
175
|
+
render() {
|
|
176
|
+
return this.state.error ? null : this.props.children;
|
|
177
|
+
}
|
|
178
|
+
}, __publicField$1(_a, "getDerivedStateFromError", () => ({ error: true })), _a;
|
|
179
|
+
})();
|
|
147
180
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} = {}) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
fiber.useLoader.clear(loader, multiFile ? [files] : files);
|
|
181
|
+
const is = {
|
|
182
|
+
obj: (a) => a === Object(a) && !is.arr(a) && typeof a !== "function",
|
|
183
|
+
fun: (a) => typeof a === "function",
|
|
184
|
+
str: (a) => typeof a === "string",
|
|
185
|
+
num: (a) => typeof a === "number",
|
|
186
|
+
boo: (a) => typeof a === "boolean",
|
|
187
|
+
und: (a) => a === void 0,
|
|
188
|
+
nul: (a) => a === null,
|
|
189
|
+
arr: (a) => Array.isArray(a),
|
|
190
|
+
equ(a, b, { arrays = "shallow", objects = "reference", strict = true } = {}) {
|
|
191
|
+
if (typeof a !== typeof b || !!a !== !!b) return false;
|
|
192
|
+
if (is.str(a) || is.num(a) || is.boo(a)) return a === b;
|
|
193
|
+
const isObj = is.obj(a);
|
|
194
|
+
if (isObj && objects === "reference") return a === b;
|
|
195
|
+
const isArr = is.arr(a);
|
|
196
|
+
if (isArr && arrays === "reference") return a === b;
|
|
197
|
+
if ((isArr || isObj) && a === b) return true;
|
|
198
|
+
let i;
|
|
199
|
+
for (i in a) if (!(i in b)) return false;
|
|
200
|
+
if (isObj && arrays === "shallow" && objects === "shallow") {
|
|
201
|
+
for (i in strict ? b : a) if (!is.equ(a[i], b[i], { strict, objects: "reference" })) return false;
|
|
202
|
+
} else {
|
|
203
|
+
for (i in strict ? b : a) if (a[i] !== b[i]) return false;
|
|
172
204
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
multiFile ? [files] : files,
|
|
178
|
-
(loader2) => {
|
|
179
|
-
if (extension === "webp" || extension === "jpg" || extension === "jpeg") {
|
|
180
|
-
loader2.setRenderer?.(renderer);
|
|
181
|
-
}
|
|
182
|
-
loader2.setPath?.(path);
|
|
183
|
-
if (extensions) extensions(loader2);
|
|
205
|
+
if (is.und(i)) {
|
|
206
|
+
if (isArr && a.length === 0 && b.length === 0) return true;
|
|
207
|
+
if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;
|
|
208
|
+
if (a !== b) return false;
|
|
184
209
|
}
|
|
185
|
-
|
|
186
|
-
let texture = multiFile ? (
|
|
187
|
-
// @ts-ignore
|
|
188
|
-
loaderResult[0]
|
|
189
|
-
) : loaderResult;
|
|
190
|
-
if (extension === "jpg" || extension === "jpeg" || extension === "webp") {
|
|
191
|
-
texture = texture.renderTarget?.texture;
|
|
192
|
-
}
|
|
193
|
-
texture.mapping = isCubemap ? webgpu.CubeReflectionMapping : webgpu.EquirectangularReflectionMapping;
|
|
194
|
-
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
195
|
-
return texture;
|
|
196
|
-
}
|
|
197
|
-
const preloadDefaultOptions = {
|
|
198
|
-
files: defaultFiles,
|
|
199
|
-
path: "",
|
|
200
|
-
preset: void 0,
|
|
201
|
-
extensions: void 0
|
|
202
|
-
};
|
|
203
|
-
useEnvironment.preload = (preloadOptions) => {
|
|
204
|
-
const options = { ...preloadDefaultOptions, ...preloadOptions };
|
|
205
|
-
let { files, path = "" } = options;
|
|
206
|
-
const { preset, extensions } = options;
|
|
207
|
-
if (preset) {
|
|
208
|
-
validatePreset(preset);
|
|
209
|
-
files = presetsObj[preset];
|
|
210
|
-
path = CUBEMAP_ROOT;
|
|
211
|
-
}
|
|
212
|
-
const { extension } = getExtension(files);
|
|
213
|
-
if (extension === "webp" || extension === "jpg" || extension === "jpeg") {
|
|
214
|
-
throw new Error("useEnvironment: Preloading gainmaps is not supported");
|
|
215
|
-
}
|
|
216
|
-
const loader = getLoader$1(extension);
|
|
217
|
-
if (!loader) throw new Error("useEnvironment: Unrecognized file extension: " + files);
|
|
218
|
-
fiber.useLoader.preload(loader, isArray(files) ? [files] : files, (loader2) => {
|
|
219
|
-
loader2.setPath?.(path);
|
|
220
|
-
if (extensions) extensions(loader2);
|
|
221
|
-
});
|
|
222
|
-
};
|
|
223
|
-
const clearDefaultOptins = {
|
|
224
|
-
files: defaultFiles,
|
|
225
|
-
preset: void 0
|
|
226
|
-
};
|
|
227
|
-
useEnvironment.clear = (clearOptions) => {
|
|
228
|
-
const options = { ...clearDefaultOptins, ...clearOptions };
|
|
229
|
-
let { files } = options;
|
|
230
|
-
const { preset } = options;
|
|
231
|
-
if (preset) {
|
|
232
|
-
validatePreset(preset);
|
|
233
|
-
files = presetsObj[preset];
|
|
210
|
+
return true;
|
|
234
211
|
}
|
|
235
|
-
const { extension } = getExtension(files);
|
|
236
|
-
const loader = getLoader$1(extension);
|
|
237
|
-
if (!loader) throw new Error("useEnvironment: Unrecognized file extension: " + files);
|
|
238
|
-
fiber.useLoader.clear(loader, isArray(files) ? [files] : files);
|
|
239
212
|
};
|
|
240
|
-
|
|
241
|
-
|
|
213
|
+
const isOrthographicCamera = (def) => def && def.isOrthographicCamera;
|
|
214
|
+
const isRef$1 = (obj) => obj !== null && typeof obj === "object" && obj.hasOwnProperty("current");
|
|
215
|
+
const isColorRepresentation = (value) => value != null && (typeof value === "string" || typeof value === "number" || value.isColor);
|
|
216
|
+
const isObject3D = (object) => object?.isObject3D;
|
|
217
|
+
const isTexture = (value) => !!value?.isTexture;
|
|
218
|
+
const isVectorLike = (object) => object !== null && typeof object === "object" && "set" in object && typeof object.set === "function";
|
|
219
|
+
const isCopyable = (object) => isVectorLike(object) && "copy" in object && typeof object.copy === "function";
|
|
220
|
+
const hasConstructor = (object) => !!object?.constructor;
|
|
221
|
+
|
|
222
|
+
function calculateDpr(dpr) {
|
|
223
|
+
const target = typeof window !== "undefined" ? window.devicePixelRatio ?? 2 : 1;
|
|
224
|
+
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
242
225
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
246
|
-
const firstEntry = isArray(files) ? files[0] : files;
|
|
247
|
-
const extension = isCubemap ? "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
|
|
248
|
-
return { extension, isCubemap, isGainmap };
|
|
226
|
+
function getUuidPrefix(uuid) {
|
|
227
|
+
return uuid.split("-")[0];
|
|
249
228
|
}
|
|
250
|
-
function
|
|
251
|
-
|
|
252
|
-
|
|
229
|
+
function updateCamera(camera, size) {
|
|
230
|
+
if (camera.manual) return;
|
|
231
|
+
if (isOrthographicCamera(camera)) {
|
|
232
|
+
camera.left = size.width / -2;
|
|
233
|
+
camera.right = size.width / 2;
|
|
234
|
+
camera.top = size.height / 2;
|
|
235
|
+
camera.bottom = size.height / -2;
|
|
236
|
+
} else {
|
|
237
|
+
camera.aspect = size.width / size.height;
|
|
238
|
+
}
|
|
239
|
+
camera.updateProjectionMatrix();
|
|
253
240
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
backgroundIntensity: 1,
|
|
261
|
-
backgroundRotation: [0, 0, 0],
|
|
262
|
-
environmentIntensity: 1,
|
|
263
|
-
environmentRotation: [0, 0, 0],
|
|
264
|
-
...sceneProps
|
|
265
|
-
};
|
|
266
|
-
const target = resolveScene(scene || defaultScene);
|
|
267
|
-
const oldbg = target.background;
|
|
268
|
-
const oldenv = target.environment;
|
|
269
|
-
const oldSceneProps = {
|
|
270
|
-
// @ts-ignore
|
|
271
|
-
backgroundBlurriness: target.backgroundBlurriness,
|
|
272
|
-
// @ts-ignore
|
|
273
|
-
backgroundIntensity: target.backgroundIntensity,
|
|
274
|
-
// @ts-ignore
|
|
275
|
-
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
276
|
-
// @ts-ignore
|
|
277
|
-
environmentIntensity: target.environmentIntensity,
|
|
278
|
-
// @ts-ignore
|
|
279
|
-
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
280
|
-
};
|
|
281
|
-
if (background !== "only") target.environment = texture;
|
|
282
|
-
if (background) target.background = texture;
|
|
283
|
-
fiber.applyProps(target, sceneProps);
|
|
284
|
-
return () => {
|
|
285
|
-
if (background !== "only") target.environment = oldenv;
|
|
286
|
-
if (background) target.background = oldbg;
|
|
287
|
-
fiber.applyProps(target, oldSceneProps);
|
|
288
|
-
};
|
|
241
|
+
const frustumMatrix = new webgpu.Matrix4();
|
|
242
|
+
function updateFrustum(camera, frustum) {
|
|
243
|
+
const target = frustum ?? new webgpu.Frustum();
|
|
244
|
+
frustumMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
245
|
+
target.setFromProjectionMatrix(frustumMatrix);
|
|
246
|
+
return target;
|
|
289
247
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return
|
|
248
|
+
|
|
249
|
+
const REACT_INTERNAL_PROPS = ["children", "key", "ref"];
|
|
250
|
+
function findInitialRoot(instance) {
|
|
251
|
+
let root = instance.root;
|
|
252
|
+
while (root.getState().previousRoot) root = root.getState().previousRoot;
|
|
253
|
+
return root;
|
|
296
254
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
...rest
|
|
307
|
-
}) {
|
|
308
|
-
const texture = useEnvironment(rest);
|
|
309
|
-
const defaultScene = fiber.useThree((state) => state.scene);
|
|
310
|
-
React__namespace.useLayoutEffect(() => {
|
|
311
|
-
return setEnvProps(background, scene, defaultScene, texture, {
|
|
312
|
-
backgroundBlurriness: blur ?? backgroundBlurriness,
|
|
313
|
-
backgroundIntensity,
|
|
314
|
-
backgroundRotation,
|
|
315
|
-
environmentIntensity,
|
|
316
|
-
environmentRotation
|
|
255
|
+
function getRootState(obj) {
|
|
256
|
+
let state = obj.__r3f?.root.getState();
|
|
257
|
+
if (!state) {
|
|
258
|
+
obj.traverseAncestors((ancestor) => {
|
|
259
|
+
const parentState = ancestor.__r3f?.root.getState();
|
|
260
|
+
if (parentState) {
|
|
261
|
+
state = parentState;
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
317
264
|
});
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return () => {
|
|
321
|
-
texture.dispose();
|
|
322
|
-
};
|
|
323
|
-
}, [texture]);
|
|
324
|
-
return null;
|
|
265
|
+
}
|
|
266
|
+
return state;
|
|
325
267
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
path,
|
|
343
|
-
preset = void 0,
|
|
344
|
-
extensions
|
|
345
|
-
}) {
|
|
346
|
-
const gl = fiber.useThree((state) => state.gl);
|
|
347
|
-
const defaultScene = fiber.useThree((state) => state.scene);
|
|
348
|
-
const camera = React__namespace.useRef(null);
|
|
349
|
-
const [virtualScene] = React__namespace.useState(() => new webgpu.Scene());
|
|
350
|
-
const fbo = React__namespace.useMemo(() => {
|
|
351
|
-
const fbo2 = new webgpu.WebGLCubeRenderTarget(resolution);
|
|
352
|
-
fbo2.texture.type = webgpu.HalfFloatType;
|
|
353
|
-
return fbo2;
|
|
354
|
-
}, [resolution]);
|
|
355
|
-
React__namespace.useEffect(() => {
|
|
356
|
-
return () => {
|
|
357
|
-
fbo.dispose();
|
|
358
|
-
};
|
|
359
|
-
}, [fbo]);
|
|
360
|
-
React__namespace.useLayoutEffect(() => {
|
|
361
|
-
if (frames === 1) {
|
|
362
|
-
const autoClear = gl.autoClear;
|
|
363
|
-
gl.autoClear = true;
|
|
364
|
-
camera.current.update(gl, virtualScene);
|
|
365
|
-
gl.autoClear = autoClear;
|
|
366
|
-
}
|
|
367
|
-
return setEnvProps(background, scene, defaultScene, fbo.texture, {
|
|
368
|
-
backgroundBlurriness: blur ?? backgroundBlurriness,
|
|
369
|
-
backgroundIntensity,
|
|
370
|
-
backgroundRotation,
|
|
371
|
-
environmentIntensity,
|
|
372
|
-
environmentRotation
|
|
268
|
+
function buildGraph(object) {
|
|
269
|
+
const data = { nodes: {}, materials: {}, meshes: {} };
|
|
270
|
+
if (object) {
|
|
271
|
+
object.traverse((obj) => {
|
|
272
|
+
if (obj.name) data.nodes[obj.name] = obj;
|
|
273
|
+
if (obj.material) {
|
|
274
|
+
const material = Array.isArray(obj.material) ? obj.material[0] : obj.material;
|
|
275
|
+
const nameAlreadyUsed = data.materials[material.name];
|
|
276
|
+
let materialName = material.name;
|
|
277
|
+
if (nameAlreadyUsed) {
|
|
278
|
+
materialName = materialName + `-${getUuidPrefix(material.uuid)}`;
|
|
279
|
+
material.userData.materialCacheName = materialName;
|
|
280
|
+
}
|
|
281
|
+
data.materials[materialName] = material;
|
|
282
|
+
}
|
|
283
|
+
if (obj.isMesh && !data.meshes[obj.name]) data.meshes[obj.name] = obj;
|
|
373
284
|
});
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
virtualScene,
|
|
377
|
-
fbo.texture,
|
|
378
|
-
scene,
|
|
379
|
-
defaultScene,
|
|
380
|
-
background,
|
|
381
|
-
frames,
|
|
382
|
-
gl,
|
|
383
|
-
blur,
|
|
384
|
-
backgroundBlurriness,
|
|
385
|
-
backgroundIntensity,
|
|
386
|
-
backgroundRotation,
|
|
387
|
-
environmentIntensity,
|
|
388
|
-
environmentRotation
|
|
389
|
-
]);
|
|
390
|
-
let count = 1;
|
|
391
|
-
fiber.useFrame(() => {
|
|
392
|
-
if (frames === Infinity || count < frames) {
|
|
393
|
-
const autoClear = gl.autoClear;
|
|
394
|
-
gl.autoClear = true;
|
|
395
|
-
camera.current.update(gl, virtualScene);
|
|
396
|
-
gl.autoClear = autoClear;
|
|
397
|
-
count++;
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fiber.createPortal(
|
|
401
|
-
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
402
|
-
children,
|
|
403
|
-
/* @__PURE__ */ jsxRuntime.jsx("cubeCamera", { ref: camera, args: [near, far, fbo] }),
|
|
404
|
-
files || preset ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { background: true, files, preset, path, extensions }) : map ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentMap, { background: true, map, extensions }) : null
|
|
405
|
-
] }),
|
|
406
|
-
virtualScene
|
|
407
|
-
) });
|
|
408
|
-
}
|
|
409
|
-
function EnvironmentGround(props) {
|
|
410
|
-
const textureDefault = useEnvironment(props);
|
|
411
|
-
const texture = props.map || textureDefault;
|
|
412
|
-
React__namespace.useMemo(() => fiber.extend({ GroundProjectedEnvImpl: GroundedSkybox_js.GroundedSkybox }), []);
|
|
413
|
-
React__namespace.useEffect(() => {
|
|
414
|
-
return () => {
|
|
415
|
-
textureDefault.dispose();
|
|
416
|
-
};
|
|
417
|
-
}, [textureDefault]);
|
|
418
|
-
const height = props.ground?.height ?? 15;
|
|
419
|
-
const radius = props.ground?.radius ?? 60;
|
|
420
|
-
const scale = props.ground?.scale ?? 1e3;
|
|
421
|
-
const args = React__namespace.useMemo(
|
|
422
|
-
() => [texture, height, radius],
|
|
423
|
-
[texture, height, radius]
|
|
424
|
-
);
|
|
425
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentMap, { ...props, map: texture }),
|
|
427
|
-
/* @__PURE__ */ jsxRuntime.jsx("groundProjectedEnvImpl", { args, scale })
|
|
428
|
-
] });
|
|
429
|
-
}
|
|
430
|
-
function EnvironmentColor({ color, scene }) {
|
|
431
|
-
const defaultScene = fiber.useThree((state) => state.scene);
|
|
432
|
-
React__namespace.useLayoutEffect(() => {
|
|
433
|
-
if (color === void 0) return;
|
|
434
|
-
const target = resolveScene(scene || defaultScene);
|
|
435
|
-
const oldBg = target.background;
|
|
436
|
-
target.background = new webgpu.Color(color);
|
|
437
|
-
return () => {
|
|
438
|
-
target.background = oldBg;
|
|
439
|
-
};
|
|
440
|
-
});
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
function EnvironmentDualSource(props) {
|
|
444
|
-
const { backgroundFiles, ...envProps } = props;
|
|
445
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
446
|
-
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...envProps, background: false }),
|
|
447
|
-
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...props, files: backgroundFiles, background: "only" })
|
|
448
|
-
] });
|
|
285
|
+
}
|
|
286
|
+
return data;
|
|
449
287
|
}
|
|
450
|
-
function
|
|
451
|
-
if (
|
|
452
|
-
|
|
288
|
+
function dispose(obj) {
|
|
289
|
+
if (obj.type !== "Scene") obj.dispose?.();
|
|
290
|
+
for (const p in obj) {
|
|
291
|
+
const prop = obj[p];
|
|
292
|
+
if (prop?.type !== "Scene") prop?.dispose?.();
|
|
453
293
|
}
|
|
454
|
-
|
|
455
|
-
|
|
294
|
+
}
|
|
295
|
+
function getInstanceProps(pendingProps) {
|
|
296
|
+
const props = {};
|
|
297
|
+
for (const key in pendingProps) {
|
|
298
|
+
if (!REACT_INTERNAL_PROPS.includes(key)) props[key] = pendingProps[key];
|
|
456
299
|
}
|
|
457
|
-
return props
|
|
300
|
+
return props;
|
|
458
301
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
302
|
+
function prepare(target, root, type, props) {
|
|
303
|
+
const object = target;
|
|
304
|
+
let instance = object?.__r3f;
|
|
305
|
+
if (!instance) {
|
|
306
|
+
instance = {
|
|
307
|
+
root,
|
|
308
|
+
type,
|
|
309
|
+
parent: null,
|
|
310
|
+
children: [],
|
|
311
|
+
props: getInstanceProps(props),
|
|
312
|
+
object,
|
|
313
|
+
eventCount: 0,
|
|
314
|
+
handlers: {},
|
|
315
|
+
isHidden: false
|
|
316
|
+
};
|
|
317
|
+
if (object) object.__r3f = instance;
|
|
318
|
+
}
|
|
319
|
+
return instance;
|
|
469
320
|
}
|
|
470
|
-
function
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const strict = !!itsFine.traverseFiber(fiber, true, (node) => node.type === React__namespace.StrictMode);
|
|
476
|
-
const Root = strict ? React__namespace.StrictMode : React__namespace.Fragment;
|
|
477
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Root, { children: /* @__PURE__ */ jsxRuntime.jsx(ContextBridge, { children }) });
|
|
478
|
-
},
|
|
479
|
-
[fiber, ContextBridge]
|
|
480
|
-
);
|
|
321
|
+
function invalidateInstance(instance) {
|
|
322
|
+
if (!instance.parent) return;
|
|
323
|
+
instance.props.onUpdate?.(instance.object);
|
|
324
|
+
const state = instance.root?.getState?.();
|
|
325
|
+
if (state && state.internal.frames === 0) state.invalidate();
|
|
481
326
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return
|
|
327
|
+
|
|
328
|
+
const tempFrustum = new webgpu.Frustum();
|
|
329
|
+
let hasWarnedWebGL = false;
|
|
330
|
+
let tslModule = null;
|
|
331
|
+
async function loadTSL() {
|
|
332
|
+
if (tslModule) return tslModule;
|
|
333
|
+
try {
|
|
334
|
+
const tsl = await import('three/tsl');
|
|
335
|
+
tslModule = { uniform: tsl.uniform, nodeObject: tsl.nodeObject };
|
|
336
|
+
return tslModule;
|
|
337
|
+
} catch {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
488
340
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}, __publicField$1(_a, "getDerivedStateFromError", () => ({ error: true })), _a;
|
|
503
|
-
})();
|
|
504
|
-
|
|
505
|
-
const is = {
|
|
506
|
-
obj: (a) => a === Object(a) && !is.arr(a) && typeof a !== "function",
|
|
507
|
-
fun: (a) => typeof a === "function",
|
|
508
|
-
str: (a) => typeof a === "string",
|
|
509
|
-
num: (a) => typeof a === "number",
|
|
510
|
-
boo: (a) => typeof a === "boolean",
|
|
511
|
-
und: (a) => a === void 0,
|
|
512
|
-
nul: (a) => a === null,
|
|
513
|
-
arr: (a) => Array.isArray(a),
|
|
514
|
-
equ(a, b, { arrays = "shallow", objects = "reference", strict = true } = {}) {
|
|
515
|
-
if (typeof a !== typeof b || !!a !== !!b) return false;
|
|
516
|
-
if (is.str(a) || is.num(a) || is.boo(a)) return a === b;
|
|
517
|
-
const isObj = is.obj(a);
|
|
518
|
-
if (isObj && objects === "reference") return a === b;
|
|
519
|
-
const isArr = is.arr(a);
|
|
520
|
-
if (isArr && arrays === "reference") return a === b;
|
|
521
|
-
if ((isArr || isObj) && a === b) return true;
|
|
522
|
-
let i;
|
|
523
|
-
for (i in a) if (!(i in b)) return false;
|
|
524
|
-
if (isObj && arrays === "shallow" && objects === "shallow") {
|
|
525
|
-
for (i in strict ? b : a) if (!is.equ(a[i], b[i], { strict, objects: "reference" })) return false;
|
|
526
|
-
} else {
|
|
527
|
-
for (i in strict ? b : a) if (a[i] !== b[i]) return false;
|
|
528
|
-
}
|
|
529
|
-
if (is.und(i)) {
|
|
530
|
-
if (isArr && a.length === 0 && b.length === 0) return true;
|
|
531
|
-
if (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;
|
|
532
|
-
if (a !== b) return false;
|
|
533
|
-
}
|
|
534
|
-
return true;
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
const isOrthographicCamera = (def) => def && def.isOrthographicCamera;
|
|
538
|
-
const isRef = (obj) => obj !== null && typeof obj === "object" && obj.hasOwnProperty("current");
|
|
539
|
-
const isColorRepresentation = (value) => value != null && (typeof value === "string" || typeof value === "number" || value.isColor);
|
|
540
|
-
const isObject3D = (object) => object?.isObject3D;
|
|
541
|
-
const isTexture = (value) => !!value?.isTexture;
|
|
542
|
-
const isVectorLike = (object) => object !== null && typeof object === "object" && "set" in object && typeof object.set === "function";
|
|
543
|
-
const isCopyable = (object) => isVectorLike(object) && "copy" in object && typeof object.copy === "function";
|
|
544
|
-
const hasConstructor = (object) => !!object?.constructor;
|
|
545
|
-
|
|
546
|
-
function calculateDpr(dpr) {
|
|
547
|
-
const target = typeof window !== "undefined" ? window.devicePixelRatio ?? 2 : 1;
|
|
548
|
-
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
549
|
-
}
|
|
550
|
-
function getUuidPrefix(uuid) {
|
|
551
|
-
return uuid.split("-")[0];
|
|
552
|
-
}
|
|
553
|
-
function updateCamera(camera, size) {
|
|
554
|
-
if (camera.manual) return;
|
|
555
|
-
if (isOrthographicCamera(camera)) {
|
|
556
|
-
camera.left = size.width / -2;
|
|
557
|
-
camera.right = size.width / 2;
|
|
558
|
-
camera.top = size.height / 2;
|
|
559
|
-
camera.bottom = size.height / -2;
|
|
560
|
-
} else {
|
|
561
|
-
camera.aspect = size.width / size.height;
|
|
562
|
-
}
|
|
563
|
-
camera.updateProjectionMatrix();
|
|
564
|
-
}
|
|
565
|
-
const frustumMatrix = new webgpu.Matrix4();
|
|
566
|
-
function updateFrustum(camera, frustum) {
|
|
567
|
-
const target = frustum ?? new webgpu.Frustum();
|
|
568
|
-
frustumMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
569
|
-
target.setFromProjectionMatrix(frustumMatrix);
|
|
570
|
-
return target;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
const REACT_INTERNAL_PROPS = ["children", "key", "ref"];
|
|
574
|
-
function findInitialRoot(instance) {
|
|
575
|
-
let root = instance.root;
|
|
576
|
-
while (root.getState().previousRoot) root = root.getState().previousRoot;
|
|
577
|
-
return root;
|
|
578
|
-
}
|
|
579
|
-
function getRootState(obj) {
|
|
580
|
-
let state = obj.__r3f?.root.getState();
|
|
581
|
-
if (!state) {
|
|
582
|
-
obj.traverseAncestors((ancestor) => {
|
|
583
|
-
const parentState = ancestor.__r3f?.root.getState();
|
|
584
|
-
if (parentState) {
|
|
585
|
-
state = parentState;
|
|
586
|
-
return false;
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
return state;
|
|
591
|
-
}
|
|
592
|
-
function buildGraph(object) {
|
|
593
|
-
const data = { nodes: {}, materials: {}, meshes: {} };
|
|
594
|
-
if (object) {
|
|
595
|
-
object.traverse((obj) => {
|
|
596
|
-
if (obj.name) data.nodes[obj.name] = obj;
|
|
597
|
-
if (obj.material) {
|
|
598
|
-
const material = Array.isArray(obj.material) ? obj.material[0] : obj.material;
|
|
599
|
-
const nameAlreadyUsed = data.materials[material.name];
|
|
600
|
-
let materialName = material.name;
|
|
601
|
-
if (nameAlreadyUsed) {
|
|
602
|
-
materialName = materialName + `-${getUuidPrefix(material.uuid)}`;
|
|
603
|
-
material.userData.materialCacheName = materialName;
|
|
604
|
-
}
|
|
605
|
-
data.materials[materialName] = material;
|
|
606
|
-
}
|
|
607
|
-
if (obj.isMesh && !data.meshes[obj.name]) data.meshes[obj.name] = obj;
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
return data;
|
|
611
|
-
}
|
|
612
|
-
function dispose(obj) {
|
|
613
|
-
if (obj.type !== "Scene") obj.dispose?.();
|
|
614
|
-
for (const p in obj) {
|
|
615
|
-
const prop = obj[p];
|
|
616
|
-
if (prop?.type !== "Scene") prop?.dispose?.();
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
function getInstanceProps(pendingProps) {
|
|
620
|
-
const props = {};
|
|
621
|
-
for (const key in pendingProps) {
|
|
622
|
-
if (!REACT_INTERNAL_PROPS.includes(key)) props[key] = pendingProps[key];
|
|
623
|
-
}
|
|
624
|
-
return props;
|
|
625
|
-
}
|
|
626
|
-
function prepare(target, root, type, props) {
|
|
627
|
-
const object = target;
|
|
628
|
-
let instance = object?.__r3f;
|
|
629
|
-
if (!instance) {
|
|
630
|
-
instance = {
|
|
631
|
-
root,
|
|
632
|
-
type,
|
|
633
|
-
parent: null,
|
|
634
|
-
children: [],
|
|
635
|
-
props: getInstanceProps(props),
|
|
636
|
-
object,
|
|
637
|
-
eventCount: 0,
|
|
638
|
-
handlers: {},
|
|
639
|
-
isHidden: false
|
|
640
|
-
};
|
|
641
|
-
if (object) object.__r3f = instance;
|
|
642
|
-
}
|
|
643
|
-
return instance;
|
|
644
|
-
}
|
|
645
|
-
function invalidateInstance(instance) {
|
|
646
|
-
if (!instance.parent) return;
|
|
647
|
-
instance.props.onUpdate?.(instance.object);
|
|
648
|
-
const state = instance.root?.getState?.();
|
|
649
|
-
if (state && state.internal.frames === 0) state.invalidate();
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
const tempFrustum = new webgpu.Frustum();
|
|
653
|
-
let hasWarnedWebGL = false;
|
|
654
|
-
let tslModule = null;
|
|
655
|
-
async function loadTSL() {
|
|
656
|
-
if (tslModule) return tslModule;
|
|
657
|
-
try {
|
|
658
|
-
const tsl = await import('three/tsl');
|
|
659
|
-
tslModule = { uniform: tsl.uniform, nodeObject: tsl.nodeObject };
|
|
660
|
-
return tslModule;
|
|
661
|
-
} catch {
|
|
662
|
-
return null;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
function createOcclusionObserverNode(store, uniform) {
|
|
666
|
-
const node = new webgpu.Node("float");
|
|
667
|
-
node.updateType = webgpu.NodeUpdateType.OBJECT;
|
|
668
|
-
node.update = function(frame) {
|
|
669
|
-
const { internal } = store.getState();
|
|
670
|
-
const registry = internal.visibilityRegistry;
|
|
671
|
-
const cache = internal.occlusionCache;
|
|
672
|
-
for (const entry of registry.values()) {
|
|
673
|
-
const { object, handlers } = entry;
|
|
674
|
-
if (handlers.onOccluded || handlers.onVisible) {
|
|
675
|
-
const isOccluded = frame.renderer.isOccluded(object);
|
|
676
|
-
cache.set(object, isOccluded);
|
|
677
|
-
}
|
|
341
|
+
function createOcclusionObserverNode(store, uniform) {
|
|
342
|
+
const node = new webgpu.Node("float");
|
|
343
|
+
node.updateType = webgpu.NodeUpdateType.OBJECT;
|
|
344
|
+
node.update = function(frame) {
|
|
345
|
+
const { internal } = store.getState();
|
|
346
|
+
const registry = internal.visibilityRegistry;
|
|
347
|
+
const cache = internal.occlusionCache;
|
|
348
|
+
for (const entry of registry.values()) {
|
|
349
|
+
const { object, handlers } = entry;
|
|
350
|
+
if (handlers.onOccluded || handlers.onVisible) {
|
|
351
|
+
const isOccluded = frame.renderer.isOccluded(object);
|
|
352
|
+
cache.set(object, isOccluded);
|
|
353
|
+
}
|
|
678
354
|
}
|
|
679
355
|
};
|
|
680
356
|
node.setup = function() {
|
|
@@ -964,9 +640,9 @@ function diffProps(instance, newProps) {
|
|
|
964
640
|
const { root, key } = resolve(instance.object, prop);
|
|
965
641
|
if (root.constructor && root.constructor.length === 0) {
|
|
966
642
|
const ctor = getMemoizedPrototype(root);
|
|
967
|
-
if (!is.und(ctor)) changedProps[
|
|
643
|
+
if (!is.und(ctor)) changedProps[prop] = ctor[key];
|
|
968
644
|
} else {
|
|
969
|
-
changedProps[
|
|
645
|
+
changedProps[prop] = 0;
|
|
970
646
|
}
|
|
971
647
|
}
|
|
972
648
|
return changedProps;
|
|
@@ -1083,614 +759,68 @@ function applyProps(object, props) {
|
|
|
1083
759
|
return object;
|
|
1084
760
|
}
|
|
1085
761
|
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
762
|
+
const shownNotices = /* @__PURE__ */ new Set();
|
|
763
|
+
function notifyDepreciated({ heading, body, link }) {
|
|
764
|
+
if (typeof process !== "undefined" && (process.env.NODE_ENV === "test" || process.env.JEST_WORKER_ID !== void 0) && process.env.R3F_SHOW_DEPRECATION_WARNINGS !== "true") {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (shownNotices.has(heading)) return;
|
|
768
|
+
shownNotices.add(heading);
|
|
769
|
+
const caller = getCallerFrame();
|
|
770
|
+
if (caller) {
|
|
771
|
+
console.log();
|
|
772
|
+
}
|
|
773
|
+
const boxStyle = "background: #ff9800; color: #1a1a1a; padding: 8px 12px; border-radius: 4px; font-weight: 500;";
|
|
774
|
+
if (caller) {
|
|
775
|
+
console.log(`%c\u26A0\uFE0F ${heading}`, boxStyle);
|
|
776
|
+
}
|
|
777
|
+
if (body || link) {
|
|
778
|
+
let message = "";
|
|
779
|
+
if (body) message += body;
|
|
780
|
+
if (link) message += (body ? "\n\n" : "") + `More info: ${link}`;
|
|
781
|
+
console.warn(`%c${message}`, "font-weight: bold;");
|
|
1098
782
|
}
|
|
1099
|
-
return state;
|
|
1100
783
|
}
|
|
1101
|
-
function
|
|
1102
|
-
|
|
784
|
+
function getCallerFrame(depth = 3) {
|
|
785
|
+
const stack = new Error().stack;
|
|
786
|
+
if (!stack) return null;
|
|
787
|
+
const lines = stack.split("\n");
|
|
788
|
+
const frame = lines[depth];
|
|
789
|
+
if (!frame) return null;
|
|
790
|
+
let match = frame.match(/^\s*at (?:(.+?) )?\(?(.+?):(\d+):(\d+)\)?$/);
|
|
791
|
+
if (!match) {
|
|
792
|
+
match = frame.match(/^(?:(.+?)@)?(.+?):(\d+):(\d+)$/);
|
|
793
|
+
}
|
|
794
|
+
if (!match) return null;
|
|
795
|
+
const [, fn, url, line] = match;
|
|
796
|
+
return {
|
|
797
|
+
functionName: fn ?? "<anonymous>",
|
|
798
|
+
location: formatLocation(url, Number(line))
|
|
799
|
+
};
|
|
1103
800
|
}
|
|
1104
|
-
function
|
|
1105
|
-
|
|
801
|
+
function formatLocation(url, line) {
|
|
802
|
+
const clean = url.split("?")[0];
|
|
803
|
+
const file = clean.split("/").pop() ?? clean;
|
|
804
|
+
return `${file}:${line}`;
|
|
1106
805
|
}
|
|
1107
|
-
function
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
const { internal } = store.getState();
|
|
1118
|
-
internal.interaction = internal.interaction.filter((o) => o !== object);
|
|
1119
|
-
for (const [pointerId, pointerState] of internal.pointerMap) {
|
|
1120
|
-
pointerState.initialHits = pointerState.initialHits.filter((o) => o !== object);
|
|
1121
|
-
pointerState.hovered.forEach((value, key) => {
|
|
1122
|
-
if (value.eventObject === object || value.object === object) {
|
|
1123
|
-
pointerState.hovered.delete(key);
|
|
1124
|
-
}
|
|
1125
|
-
});
|
|
1126
|
-
if (pointerState.captured.has(object)) {
|
|
1127
|
-
releaseInternalPointerCapture(internal, object, pointerId);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
unregisterVisibility(store, object);
|
|
1131
|
-
}
|
|
1132
|
-
function createEvents(store) {
|
|
1133
|
-
function calculateDistance(event, pointerId) {
|
|
1134
|
-
const { internal } = store.getState();
|
|
1135
|
-
const pointerState = internal.pointerMap.get(pointerId);
|
|
1136
|
-
if (!pointerState) return 0;
|
|
1137
|
-
const [initialX, initialY] = pointerState.initialClick;
|
|
1138
|
-
const dx = event.offsetX - initialX;
|
|
1139
|
-
const dy = event.offsetY - initialY;
|
|
1140
|
-
return Math.round(Math.sqrt(dx * dx + dy * dy));
|
|
1141
|
-
}
|
|
1142
|
-
function filterPointerEvents(objects) {
|
|
1143
|
-
return objects.filter(
|
|
1144
|
-
(obj) => ["Move", "Over", "Enter", "Out", "Leave"].some(
|
|
1145
|
-
(name) => obj.__r3f?.handlers["onPointer" + name]
|
|
1146
|
-
) || ["OverEnter", "OverLeave", "Over"].some(
|
|
1147
|
-
(name) => obj.__r3f?.handlers["onDrag" + name]
|
|
1148
|
-
) || obj.__r3f?.handlers.onDrop
|
|
1149
|
-
);
|
|
1150
|
-
}
|
|
1151
|
-
function intersect(event, filter) {
|
|
1152
|
-
const state = store.getState();
|
|
1153
|
-
const duplicates = /* @__PURE__ */ new Set();
|
|
1154
|
-
const intersections = [];
|
|
1155
|
-
const eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;
|
|
1156
|
-
for (let i = 0; i < eventsObjects.length; i++) {
|
|
1157
|
-
const state2 = getRootState(eventsObjects[i]);
|
|
1158
|
-
if (state2) {
|
|
1159
|
-
state2.raycaster.camera = void 0;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
if (!state.previousRoot) {
|
|
1163
|
-
state.events.compute?.(event, state);
|
|
1164
|
-
}
|
|
1165
|
-
function handleRaycast(obj) {
|
|
1166
|
-
const state2 = getRootState(obj);
|
|
1167
|
-
if (!state2 || !state2.events.enabled || state2.raycaster.camera === null) return [];
|
|
1168
|
-
if (state2.raycaster.camera === void 0) {
|
|
1169
|
-
state2.events.compute?.(event, state2, state2.previousRoot?.getState());
|
|
1170
|
-
if (state2.raycaster.camera === void 0) state2.raycaster.camera = null;
|
|
1171
|
-
}
|
|
1172
|
-
return state2.raycaster.camera ? state2.raycaster.intersectObject(obj, true) : [];
|
|
1173
|
-
}
|
|
1174
|
-
let hits = eventsObjects.flatMap(handleRaycast).sort((a, b) => {
|
|
1175
|
-
const aInteractivePriority = a.object.userData?.interactivePriority;
|
|
1176
|
-
const bInteractivePriority = b.object.userData?.interactivePriority;
|
|
1177
|
-
if (aInteractivePriority !== void 0 || bInteractivePriority !== void 0) {
|
|
1178
|
-
if (aInteractivePriority !== void 0 && bInteractivePriority === void 0) return -1;
|
|
1179
|
-
if (bInteractivePriority !== void 0 && aInteractivePriority === void 0) return 1;
|
|
1180
|
-
if (aInteractivePriority !== bInteractivePriority) {
|
|
1181
|
-
return (bInteractivePriority ?? 0) - (aInteractivePriority ?? 0);
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
const aState = getRootState(a.object);
|
|
1185
|
-
const bState = getRootState(b.object);
|
|
1186
|
-
const aPriority = aState?.events?.priority ?? 1;
|
|
1187
|
-
const bPriority = bState?.events?.priority ?? 1;
|
|
1188
|
-
return bPriority - aPriority || a.distance - b.distance;
|
|
1189
|
-
}).filter((item) => {
|
|
1190
|
-
const id = makeId(item);
|
|
1191
|
-
if (duplicates.has(id)) return false;
|
|
1192
|
-
duplicates.add(id);
|
|
1193
|
-
return true;
|
|
1194
|
-
});
|
|
1195
|
-
if (state.events.filter) hits = state.events.filter(hits, state);
|
|
1196
|
-
for (const hit of hits) {
|
|
1197
|
-
let eventObject = hit.object;
|
|
1198
|
-
while (eventObject) {
|
|
1199
|
-
if (eventObject.__r3f?.eventCount) {
|
|
1200
|
-
intersections.push({ ...hit, eventObject });
|
|
1201
|
-
}
|
|
1202
|
-
eventObject = eventObject.parent;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
if ("pointerId" in event) {
|
|
1206
|
-
const pointerId = event.pointerId;
|
|
1207
|
-
const pointerState = state.internal.pointerMap.get(pointerId);
|
|
1208
|
-
if (pointerState?.captured.size) {
|
|
1209
|
-
for (const captureData of pointerState.captured.values()) {
|
|
1210
|
-
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
return intersections;
|
|
1215
|
-
}
|
|
1216
|
-
function handleIntersects(intersections, event, delta, callback) {
|
|
1217
|
-
if (intersections.length) {
|
|
1218
|
-
const localState = { stopped: false };
|
|
1219
|
-
for (const hit of intersections) {
|
|
1220
|
-
const state = getRootState(hit.object);
|
|
1221
|
-
if (state) {
|
|
1222
|
-
const { raycaster, pointer, camera, internal } = state;
|
|
1223
|
-
const unprojectedPoint = new webgpu.Vector3(pointer.x, pointer.y, 0).unproject(camera);
|
|
1224
|
-
const hasPointerCapture = (id) => {
|
|
1225
|
-
const pointerState = internal.pointerMap.get(id);
|
|
1226
|
-
return pointerState?.captured.has(hit.eventObject) ?? false;
|
|
1227
|
-
};
|
|
1228
|
-
const setPointerCapture = (id) => {
|
|
1229
|
-
const captureData = { intersection: hit, target: event.target };
|
|
1230
|
-
const pointerState = getPointerState(internal, id);
|
|
1231
|
-
pointerState.captured.set(hit.eventObject, captureData);
|
|
1232
|
-
event.target.setPointerCapture(id);
|
|
1233
|
-
};
|
|
1234
|
-
const releasePointerCapture = (id) => {
|
|
1235
|
-
releaseInternalPointerCapture(internal, hit.eventObject, id);
|
|
1236
|
-
};
|
|
1237
|
-
const extractEventProps = {};
|
|
1238
|
-
for (const prop in event) {
|
|
1239
|
-
const property = event[prop];
|
|
1240
|
-
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
1241
|
-
}
|
|
1242
|
-
const eventPointerId = "pointerId" in event ? event.pointerId : void 0;
|
|
1243
|
-
const raycastEvent = {
|
|
1244
|
-
...hit,
|
|
1245
|
-
...extractEventProps,
|
|
1246
|
-
pointer,
|
|
1247
|
-
intersections,
|
|
1248
|
-
stopped: localState.stopped,
|
|
1249
|
-
delta,
|
|
1250
|
-
unprojectedPoint,
|
|
1251
|
-
ray: raycaster.ray,
|
|
1252
|
-
camera,
|
|
1253
|
-
pointerId: eventPointerId,
|
|
1254
|
-
// Hijack stopPropagation, which just sets a flag
|
|
1255
|
-
stopPropagation() {
|
|
1256
|
-
const pointerState = eventPointerId !== void 0 ? internal.pointerMap.get(eventPointerId) : void 0;
|
|
1257
|
-
if (
|
|
1258
|
-
// ...if this pointer hasn't been captured
|
|
1259
|
-
!pointerState?.captured.size || // ... or if the hit object is capturing the pointer
|
|
1260
|
-
pointerState.captured.has(hit.eventObject)
|
|
1261
|
-
) {
|
|
1262
|
-
raycastEvent.stopped = localState.stopped = true;
|
|
1263
|
-
if (pointerState?.hovered.size && Array.from(pointerState.hovered.values()).find((i) => i.eventObject === hit.eventObject)) {
|
|
1264
|
-
const higher = intersections.slice(0, intersections.indexOf(hit));
|
|
1265
|
-
cancelPointer([...higher, hit], eventPointerId);
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
},
|
|
1269
|
-
// there should be a distinction between target and currentTarget
|
|
1270
|
-
target: { hasPointerCapture, setPointerCapture, releasePointerCapture },
|
|
1271
|
-
currentTarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },
|
|
1272
|
-
nativeEvent: event
|
|
1273
|
-
};
|
|
1274
|
-
callback(raycastEvent);
|
|
1275
|
-
if (localState.stopped === true) break;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
return intersections;
|
|
1280
|
-
}
|
|
1281
|
-
function cancelPointer(intersections, pointerId) {
|
|
1282
|
-
const { internal } = store.getState();
|
|
1283
|
-
const pid = pointerId ?? DEFAULT_POINTER_ID;
|
|
1284
|
-
const pointerState = internal.pointerMap.get(pid);
|
|
1285
|
-
if (!pointerState) return;
|
|
1286
|
-
for (const [hoveredId, hoveredObj] of pointerState.hovered) {
|
|
1287
|
-
if (!intersections.length || !intersections.find(
|
|
1288
|
-
(hit) => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId
|
|
1289
|
-
)) {
|
|
1290
|
-
const eventObject = hoveredObj.eventObject;
|
|
1291
|
-
const instance = eventObject.__r3f;
|
|
1292
|
-
pointerState.hovered.delete(hoveredId);
|
|
1293
|
-
if (instance?.eventCount) {
|
|
1294
|
-
const handlers = instance.handlers;
|
|
1295
|
-
const data = { ...hoveredObj, intersections };
|
|
1296
|
-
handlers.onPointerOut?.(data);
|
|
1297
|
-
handlers.onPointerLeave?.(data);
|
|
1298
|
-
handlers.onDragOverLeave?.(data);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
function pointerMissed(event, objects) {
|
|
1304
|
-
for (let i = 0; i < objects.length; i++) {
|
|
1305
|
-
const instance = objects[i].__r3f;
|
|
1306
|
-
instance?.handlers.onPointerMissed?.(event);
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
function dragOverMissed(event, objects) {
|
|
1310
|
-
for (let i = 0; i < objects.length; i++) {
|
|
1311
|
-
const instance = objects[i].__r3f;
|
|
1312
|
-
instance?.handlers.onDragOverMissed?.(event);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
function dropMissed(event, objects) {
|
|
1316
|
-
for (let i = 0; i < objects.length; i++) {
|
|
1317
|
-
const instance = objects[i].__r3f;
|
|
1318
|
-
instance?.handlers.onDropMissed?.(event);
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
function cleanupPointer(pointerId) {
|
|
1322
|
-
const { internal } = store.getState();
|
|
1323
|
-
const pointerState = internal.pointerMap.get(pointerId);
|
|
1324
|
-
if (pointerState) {
|
|
1325
|
-
for (const [, hoveredObj] of pointerState.hovered) {
|
|
1326
|
-
const eventObject = hoveredObj.eventObject;
|
|
1327
|
-
const instance = eventObject.__r3f;
|
|
1328
|
-
if (instance?.eventCount) {
|
|
1329
|
-
const handlers = instance.handlers;
|
|
1330
|
-
const data = { ...hoveredObj, intersections: [] };
|
|
1331
|
-
handlers.onPointerOut?.(data);
|
|
1332
|
-
handlers.onPointerLeave?.(data);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
internal.pointerMap.delete(pointerId);
|
|
1336
|
-
}
|
|
1337
|
-
internal.pointerDirty.delete(pointerId);
|
|
1338
|
-
}
|
|
1339
|
-
function processDeferredPointer(event, pointerId) {
|
|
1340
|
-
const state = store.getState();
|
|
1341
|
-
const { internal } = state;
|
|
1342
|
-
if (!state.events.enabled) return;
|
|
1343
|
-
const filter = filterPointerEvents;
|
|
1344
|
-
const hits = intersect(event, filter);
|
|
1345
|
-
cancelPointer(hits, pointerId);
|
|
1346
|
-
function onIntersect(data) {
|
|
1347
|
-
const eventObject = data.eventObject;
|
|
1348
|
-
const instance = eventObject.__r3f;
|
|
1349
|
-
if (!instance?.eventCount) return;
|
|
1350
|
-
const handlers = instance.handlers;
|
|
1351
|
-
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
1352
|
-
const id = makeId(data);
|
|
1353
|
-
const pointerState = getPointerState(internal, pointerId);
|
|
1354
|
-
const hoveredItem = pointerState.hovered.get(id);
|
|
1355
|
-
if (!hoveredItem) {
|
|
1356
|
-
pointerState.hovered.set(id, data);
|
|
1357
|
-
handlers.onPointerOver?.(data);
|
|
1358
|
-
handlers.onPointerEnter?.(data);
|
|
1359
|
-
} else if (hoveredItem.stopped) {
|
|
1360
|
-
data.stopPropagation();
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
handlers.onPointerMove?.(data);
|
|
1364
|
-
}
|
|
1365
|
-
handleIntersects(hits, event, 0, onIntersect);
|
|
1366
|
-
}
|
|
1367
|
-
function handlePointer(name) {
|
|
1368
|
-
switch (name) {
|
|
1369
|
-
case "onPointerLeave":
|
|
1370
|
-
case "onDragLeave":
|
|
1371
|
-
return () => cancelPointer([]);
|
|
1372
|
-
// Global cancel of these events
|
|
1373
|
-
case "onPointerCancel":
|
|
1374
|
-
return (event) => {
|
|
1375
|
-
const pointerId = getPointerId(event);
|
|
1376
|
-
cleanupPointer(pointerId);
|
|
1377
|
-
};
|
|
1378
|
-
case "onLostPointerCapture":
|
|
1379
|
-
return (event) => {
|
|
1380
|
-
const { internal } = store.getState();
|
|
1381
|
-
const pointerId = getPointerId(event);
|
|
1382
|
-
const pointerState = internal.pointerMap.get(pointerId);
|
|
1383
|
-
if (pointerState?.captured.size) {
|
|
1384
|
-
requestAnimationFrame(() => {
|
|
1385
|
-
const pointerState2 = internal.pointerMap.get(pointerId);
|
|
1386
|
-
if (pointerState2?.captured.size) {
|
|
1387
|
-
pointerState2.captured.clear();
|
|
1388
|
-
}
|
|
1389
|
-
cancelPointer([], pointerId);
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
|
-
return function handleEvent(event) {
|
|
1395
|
-
const state = store.getState();
|
|
1396
|
-
const { onPointerMissed, onDragOverMissed, onDropMissed, internal, events } = state;
|
|
1397
|
-
const pointerId = getPointerId(event);
|
|
1398
|
-
internal.lastEvent.current = event;
|
|
1399
|
-
if (!events.enabled) return;
|
|
1400
|
-
const isPointerMove = name === "onPointerMove";
|
|
1401
|
-
const isDragOver = name === "onDragOver";
|
|
1402
|
-
const isDrop = name === "onDrop";
|
|
1403
|
-
const isClickEvent = name === "onClick" || name === "onContextMenu" || name === "onDoubleClick";
|
|
1404
|
-
const isPointerDown = name === "onPointerDown";
|
|
1405
|
-
const isPointerUp = name === "onPointerUp";
|
|
1406
|
-
const isWheel = name === "onWheel";
|
|
1407
|
-
const canDeferRaycasts = events.frameTimedRaycasts && state.frameloop === "always";
|
|
1408
|
-
if (isPointerMove && canDeferRaycasts) {
|
|
1409
|
-
events.compute?.(event, state);
|
|
1410
|
-
internal.pointerDirty.set(pointerId, event);
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
if (isWheel && canDeferRaycasts && !events.alwaysFireOnScroll) {
|
|
1414
|
-
events.compute?.(event, state);
|
|
1415
|
-
internal.pointerDirty.set(pointerId, event);
|
|
1416
|
-
return;
|
|
1417
|
-
}
|
|
1418
|
-
if ((isClickEvent || isPointerDown || isPointerUp) && internal.pointerDirty.has(pointerId)) {
|
|
1419
|
-
const deferredEvent = internal.pointerDirty.get(pointerId);
|
|
1420
|
-
internal.pointerDirty.delete(pointerId);
|
|
1421
|
-
processDeferredPointer(deferredEvent, pointerId);
|
|
1422
|
-
}
|
|
1423
|
-
const filter = isPointerMove || isDragOver || isDrop ? filterPointerEvents : void 0;
|
|
1424
|
-
const hits = intersect(event, filter);
|
|
1425
|
-
const delta = isClickEvent ? calculateDistance(event, pointerId) : 0;
|
|
1426
|
-
if (isPointerDown) {
|
|
1427
|
-
const pointerState2 = getPointerState(internal, pointerId);
|
|
1428
|
-
pointerState2.initialClick = [event.offsetX, event.offsetY];
|
|
1429
|
-
pointerState2.initialHits = hits.map((hit) => hit.eventObject);
|
|
1430
|
-
}
|
|
1431
|
-
const pointerState = internal.pointerMap.get(pointerId);
|
|
1432
|
-
const initialHits = pointerState?.initialHits ?? [];
|
|
1433
|
-
if (isClickEvent && !hits.length) {
|
|
1434
|
-
if (delta <= 2) {
|
|
1435
|
-
pointerMissed(event, internal.interaction);
|
|
1436
|
-
if (onPointerMissed) onPointerMissed(event);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
if (isDragOver && !hits.length) {
|
|
1440
|
-
dragOverMissed(event, internal.interaction);
|
|
1441
|
-
if (onDragOverMissed) onDragOverMissed(event);
|
|
1442
|
-
}
|
|
1443
|
-
if (isDrop && !hits.length) {
|
|
1444
|
-
dropMissed(event, internal.interaction);
|
|
1445
|
-
if (onDropMissed) onDropMissed(event);
|
|
1446
|
-
}
|
|
1447
|
-
if (isPointerMove || isDragOver) {
|
|
1448
|
-
cancelPointer(hits, pointerId);
|
|
1449
|
-
}
|
|
1450
|
-
function onIntersect(data) {
|
|
1451
|
-
const eventObject = data.eventObject;
|
|
1452
|
-
const instance = eventObject.__r3f;
|
|
1453
|
-
if (!instance?.eventCount) return;
|
|
1454
|
-
const handlers = instance.handlers;
|
|
1455
|
-
if (isPointerMove) {
|
|
1456
|
-
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
1457
|
-
const id = makeId(data);
|
|
1458
|
-
const pointerState2 = getPointerState(internal, pointerId);
|
|
1459
|
-
const hoveredItem = pointerState2.hovered.get(id);
|
|
1460
|
-
if (!hoveredItem) {
|
|
1461
|
-
pointerState2.hovered.set(id, data);
|
|
1462
|
-
handlers.onPointerOver?.(data);
|
|
1463
|
-
handlers.onPointerEnter?.(data);
|
|
1464
|
-
} else if (hoveredItem.stopped) {
|
|
1465
|
-
data.stopPropagation();
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
handlers.onPointerMove?.(data);
|
|
1469
|
-
} else if (isDragOver) {
|
|
1470
|
-
const id = makeId(data);
|
|
1471
|
-
const pointerState2 = getPointerState(internal, pointerId);
|
|
1472
|
-
const hoveredItem = pointerState2.hovered.get(id);
|
|
1473
|
-
if (!hoveredItem) {
|
|
1474
|
-
pointerState2.hovered.set(id, data);
|
|
1475
|
-
handlers.onDragOverEnter?.(data);
|
|
1476
|
-
} else if (hoveredItem.stopped) {
|
|
1477
|
-
data.stopPropagation();
|
|
1478
|
-
}
|
|
1479
|
-
handlers.onDragOver?.(data);
|
|
1480
|
-
} else if (isDrop) {
|
|
1481
|
-
handlers.onDrop?.(data);
|
|
1482
|
-
} else {
|
|
1483
|
-
const handler = handlers[name];
|
|
1484
|
-
if (handler) {
|
|
1485
|
-
if (!isClickEvent || initialHits.includes(eventObject)) {
|
|
1486
|
-
pointerMissed(
|
|
1487
|
-
event,
|
|
1488
|
-
internal.interaction.filter((object) => !initialHits.includes(object))
|
|
1489
|
-
);
|
|
1490
|
-
handler(data);
|
|
1491
|
-
}
|
|
1492
|
-
} else {
|
|
1493
|
-
if (isClickEvent && initialHits.includes(eventObject)) {
|
|
1494
|
-
pointerMissed(
|
|
1495
|
-
event,
|
|
1496
|
-
internal.interaction.filter((object) => !initialHits.includes(object))
|
|
1497
|
-
);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
handleIntersects(hits, event, delta, onIntersect);
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
function flushDeferredPointers() {
|
|
1506
|
-
const { internal, events } = store.getState();
|
|
1507
|
-
if (!events.frameTimedRaycasts) return;
|
|
1508
|
-
for (const [pointerId, event] of internal.pointerDirty) {
|
|
1509
|
-
processDeferredPointer(event, pointerId);
|
|
1510
|
-
}
|
|
1511
|
-
internal.pointerDirty.clear();
|
|
1512
|
-
}
|
|
1513
|
-
return { handlePointer, flushDeferredPointers, processDeferredPointer };
|
|
1514
|
-
}
|
|
1515
|
-
const DOM_EVENTS = {
|
|
1516
|
-
onClick: ["click", false],
|
|
1517
|
-
onContextMenu: ["contextmenu", false],
|
|
1518
|
-
onDoubleClick: ["dblclick", false],
|
|
1519
|
-
onDragEnter: ["dragenter", false],
|
|
1520
|
-
onDragLeave: ["dragleave", false],
|
|
1521
|
-
onDragOver: ["dragover", false],
|
|
1522
|
-
onDrop: ["drop", false],
|
|
1523
|
-
onWheel: ["wheel", true],
|
|
1524
|
-
onPointerDown: ["pointerdown", true],
|
|
1525
|
-
onPointerUp: ["pointerup", true],
|
|
1526
|
-
onPointerLeave: ["pointerleave", true],
|
|
1527
|
-
onPointerMove: ["pointermove", true],
|
|
1528
|
-
onPointerCancel: ["pointercancel", true],
|
|
1529
|
-
onLostPointerCapture: ["lostpointercapture", true]
|
|
1530
|
-
};
|
|
1531
|
-
function createPointerEvents(store) {
|
|
1532
|
-
const { handlePointer, flushDeferredPointers, processDeferredPointer } = createEvents(store);
|
|
1533
|
-
let nextXRPointerId = XR_POINTER_ID_START;
|
|
1534
|
-
const xrPointers = /* @__PURE__ */ new Map();
|
|
1535
|
-
return {
|
|
1536
|
-
priority: 1,
|
|
1537
|
-
enabled: true,
|
|
1538
|
-
frameTimedRaycasts: true,
|
|
1539
|
-
alwaysFireOnScroll: true,
|
|
1540
|
-
updateOnFrame: false,
|
|
1541
|
-
compute(event, state) {
|
|
1542
|
-
state.pointer.set(event.offsetX / state.size.width * 2 - 1, -(event.offsetY / state.size.height) * 2 + 1);
|
|
1543
|
-
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
1544
|
-
},
|
|
1545
|
-
connected: void 0,
|
|
1546
|
-
handlers: Object.keys(DOM_EVENTS).reduce(
|
|
1547
|
-
(acc, key) => ({ ...acc, [key]: handlePointer(key) }),
|
|
1548
|
-
{}
|
|
1549
|
-
),
|
|
1550
|
-
update: (pointerId) => {
|
|
1551
|
-
const { events, internal } = store.getState();
|
|
1552
|
-
if (!events.handlers) return;
|
|
1553
|
-
if (pointerId !== void 0) {
|
|
1554
|
-
const event = internal.pointerDirty.get(pointerId);
|
|
1555
|
-
if (event) {
|
|
1556
|
-
internal.pointerDirty.delete(pointerId);
|
|
1557
|
-
processDeferredPointer(event, pointerId);
|
|
1558
|
-
} else if (internal.lastEvent?.current) {
|
|
1559
|
-
processDeferredPointer(internal.lastEvent.current, pointerId);
|
|
1560
|
-
}
|
|
1561
|
-
} else {
|
|
1562
|
-
flushDeferredPointers();
|
|
1563
|
-
if (internal.lastEvent?.current) {
|
|
1564
|
-
events.handlers.onPointerMove(internal.lastEvent.current);
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
},
|
|
1568
|
-
flush: () => {
|
|
1569
|
-
const { events, internal } = store.getState();
|
|
1570
|
-
flushDeferredPointers();
|
|
1571
|
-
if (events.updateOnFrame && internal.lastEvent?.current && events.handlers) {
|
|
1572
|
-
events.handlers.onPointerMove(internal.lastEvent.current);
|
|
1573
|
-
}
|
|
1574
|
-
},
|
|
1575
|
-
connect: (target) => {
|
|
1576
|
-
if (!target) return;
|
|
1577
|
-
const { set, events } = store.getState();
|
|
1578
|
-
events.disconnect?.();
|
|
1579
|
-
set((state) => ({ events: { ...state.events, connected: target } }));
|
|
1580
|
-
if (events.handlers) {
|
|
1581
|
-
for (const name in events.handlers) {
|
|
1582
|
-
const event = events.handlers[name];
|
|
1583
|
-
const [eventName, passive] = DOM_EVENTS[name];
|
|
1584
|
-
target.addEventListener(eventName, event, { passive });
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
},
|
|
1588
|
-
disconnect: () => {
|
|
1589
|
-
const { set, events } = store.getState();
|
|
1590
|
-
if (events.connected) {
|
|
1591
|
-
if (events.handlers) {
|
|
1592
|
-
for (const name in events.handlers) {
|
|
1593
|
-
const event = events.handlers[name];
|
|
1594
|
-
const [eventName] = DOM_EVENTS[name];
|
|
1595
|
-
events.connected.removeEventListener(eventName, event);
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
set((state) => ({ events: { ...state.events, connected: void 0 } }));
|
|
1599
|
-
}
|
|
1600
|
-
},
|
|
1601
|
-
// PREVIEW (A8): the XR pointer registration API may change before stable.
|
|
1602
|
-
registerPointer: (config) => {
|
|
1603
|
-
const pointerId = nextXRPointerId++;
|
|
1604
|
-
xrPointers.set(pointerId, config);
|
|
1605
|
-
const { internal } = store.getState();
|
|
1606
|
-
getPointerState(internal, pointerId);
|
|
1607
|
-
return pointerId;
|
|
1608
|
-
},
|
|
1609
|
-
unregisterPointer: (pointerId) => {
|
|
1610
|
-
xrPointers.delete(pointerId);
|
|
1611
|
-
const { internal } = store.getState();
|
|
1612
|
-
const pointerState = internal.pointerMap.get(pointerId);
|
|
1613
|
-
if (pointerState) {
|
|
1614
|
-
for (const [, hoveredObj] of pointerState.hovered) {
|
|
1615
|
-
const eventObject = hoveredObj.eventObject;
|
|
1616
|
-
const instance = eventObject.__r3f;
|
|
1617
|
-
if (instance?.eventCount) {
|
|
1618
|
-
const handlers = instance.handlers;
|
|
1619
|
-
const data = { ...hoveredObj, intersections: [] };
|
|
1620
|
-
handlers.onPointerOut?.(data);
|
|
1621
|
-
handlers.onPointerLeave?.(data);
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
internal.pointerMap.delete(pointerId);
|
|
1625
|
-
}
|
|
1626
|
-
internal.pointerDirty.delete(pointerId);
|
|
1627
|
-
}
|
|
1628
|
-
};
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
const shownNotices = /* @__PURE__ */ new Set();
|
|
1632
|
-
function notifyDepreciated({ heading, body, link }) {
|
|
1633
|
-
if (typeof process !== "undefined" && (process.env.NODE_ENV === "test" || process.env.JEST_WORKER_ID !== void 0) && process.env.R3F_SHOW_DEPRECATION_WARNINGS !== "true") {
|
|
1634
|
-
return;
|
|
1635
|
-
}
|
|
1636
|
-
if (shownNotices.has(heading)) return;
|
|
1637
|
-
shownNotices.add(heading);
|
|
1638
|
-
const caller = getCallerFrame();
|
|
1639
|
-
if (caller) {
|
|
1640
|
-
console.log();
|
|
1641
|
-
}
|
|
1642
|
-
const boxStyle = "background: #ff9800; color: #1a1a1a; padding: 8px 12px; border-radius: 4px; font-weight: 500;";
|
|
1643
|
-
if (caller) {
|
|
1644
|
-
console.log(`%c\u26A0\uFE0F ${heading}`, boxStyle);
|
|
1645
|
-
}
|
|
1646
|
-
if (body || link) {
|
|
1647
|
-
let message = "";
|
|
1648
|
-
if (body) message += body;
|
|
1649
|
-
if (link) message += (body ? "\n\n" : "") + `More info: ${link}`;
|
|
1650
|
-
console.warn(`%c${message}`, "font-weight: bold;");
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
function getCallerFrame(depth = 3) {
|
|
1654
|
-
const stack = new Error().stack;
|
|
1655
|
-
if (!stack) return null;
|
|
1656
|
-
const lines = stack.split("\n");
|
|
1657
|
-
const frame = lines[depth];
|
|
1658
|
-
if (!frame) return null;
|
|
1659
|
-
let match = frame.match(/^\s*at (?:(.+?) )?\(?(.+?):(\d+):(\d+)\)?$/);
|
|
1660
|
-
if (!match) {
|
|
1661
|
-
match = frame.match(/^(?:(.+?)@)?(.+?):(\d+):(\d+)$/);
|
|
1662
|
-
}
|
|
1663
|
-
if (!match) return null;
|
|
1664
|
-
const [, fn, url, line] = match;
|
|
1665
|
-
return {
|
|
1666
|
-
functionName: fn ?? "<anonymous>",
|
|
1667
|
-
location: formatLocation(url, Number(line))
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
|
-
function formatLocation(url, line) {
|
|
1671
|
-
const clean = url.split("?")[0];
|
|
1672
|
-
const file = clean.split("/").pop() ?? clean;
|
|
1673
|
-
return `${file}:${line}`;
|
|
1674
|
-
}
|
|
1675
|
-
function notifyAlpha({ message, link }) {
|
|
1676
|
-
if (typeof process !== "undefined" && (process.env.NODE_ENV === "test" || process.env.JEST_WORKER_ID !== void 0) && process.env.R3F_SHOW_ALPHA_WARNINGS !== "true") {
|
|
1677
|
-
return;
|
|
1678
|
-
}
|
|
1679
|
-
if (shownNotices.has(message)) return;
|
|
1680
|
-
shownNotices.add(message);
|
|
1681
|
-
const boxStyle = "background: #6366f1; color: #ffffff; padding: 6px 10px; border-radius: 4px; font-weight: 500;";
|
|
1682
|
-
console.log(`%c\u{1F52C} ${message}`, boxStyle);
|
|
1683
|
-
{
|
|
1684
|
-
console.log(`%cMore info: ${link}`, "color: #6366f1; font-weight: normal;");
|
|
806
|
+
function notifyAlpha({ message, link }) {
|
|
807
|
+
if (typeof process !== "undefined" && (process.env.NODE_ENV === "test" || process.env.JEST_WORKER_ID !== void 0) && process.env.R3F_SHOW_ALPHA_WARNINGS !== "true") {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
if (shownNotices.has(message)) return;
|
|
811
|
+
shownNotices.add(message);
|
|
812
|
+
const boxStyle = "background: #6366f1; color: #ffffff; padding: 6px 10px; border-radius: 4px; font-weight: 500;";
|
|
813
|
+
console.log(`%c\u{1F52C} ${message}`, boxStyle);
|
|
814
|
+
{
|
|
815
|
+
console.log(`%cMore info: ${link}`, "color: #6366f1; font-weight: normal;");
|
|
1685
816
|
}
|
|
1686
817
|
}
|
|
1687
818
|
|
|
1688
819
|
const INTERNAL_LIB_MARKERS = ["zustand", "setState", "Object.assign"];
|
|
1689
|
-
const INTERNAL_FIBER_MARKERS = ["packages/fiber/src", "packages/fiber/dist", "@react-three/fiber", "@react-three_fiber"];
|
|
1690
820
|
function isInternalRendererAccess(stack, callerDepth = 2) {
|
|
1691
821
|
if (!stack) return false;
|
|
1692
822
|
const caller = stack.split("\n")[callerDepth] ?? "";
|
|
1693
|
-
return INTERNAL_LIB_MARKERS.some((m) => caller.includes(m))
|
|
823
|
+
return INTERNAL_LIB_MARKERS.some((m) => caller.includes(m));
|
|
1694
824
|
}
|
|
1695
825
|
|
|
1696
826
|
const R3F_CONTEXT = Symbol.for("@react-three/fiber.context");
|
|
@@ -1972,7 +1102,7 @@ const createStore = (invalidate, advance) => {
|
|
|
1972
1102
|
|
|
1973
1103
|
const memoizedLoaders = /* @__PURE__ */ new WeakMap();
|
|
1974
1104
|
const isConstructor$1 = (value) => typeof value === "function" && value?.prototype?.constructor === value;
|
|
1975
|
-
function getLoader(Proto) {
|
|
1105
|
+
function getLoader$1(Proto) {
|
|
1976
1106
|
if (isConstructor$1(Proto)) {
|
|
1977
1107
|
let loader = memoizedLoaders.get(Proto);
|
|
1978
1108
|
if (!loader) {
|
|
@@ -1985,7 +1115,7 @@ function getLoader(Proto) {
|
|
|
1985
1115
|
}
|
|
1986
1116
|
function loadingFn(extensions, onProgress) {
|
|
1987
1117
|
return function(Proto, input) {
|
|
1988
|
-
const loader = getLoader(Proto);
|
|
1118
|
+
const loader = getLoader$1(Proto);
|
|
1989
1119
|
if (extensions) extensions(loader);
|
|
1990
1120
|
if ("loadAsync" in loader && typeof loader.loadAsync === "function") {
|
|
1991
1121
|
return loader.loadAsync(input, onProgress).then((data) => {
|
|
@@ -2026,7 +1156,7 @@ useLoader.clear = function(loader, input, cacheKey) {
|
|
|
2026
1156
|
const cacheKeys = Array.isArray(cacheKey ?? input) ? cacheKey ?? input : [cacheKey ?? input];
|
|
2027
1157
|
cacheKeys.forEach((key) => suspendReact.clear([loader, key]));
|
|
2028
1158
|
};
|
|
2029
|
-
useLoader.loader = getLoader;
|
|
1159
|
+
useLoader.loader = getLoader$1;
|
|
2030
1160
|
|
|
2031
1161
|
function useFrame(callback, priorityOrOptions) {
|
|
2032
1162
|
const store = React__namespace.useContext(context);
|
|
@@ -2386,11 +1516,131 @@ function useRenderTarget(widthOrOptions, heightOrOptions, options) {
|
|
|
2386
1516
|
height = widthOrOptions;
|
|
2387
1517
|
}
|
|
2388
1518
|
}
|
|
2389
|
-
return React.useMemo(() => {
|
|
2390
|
-
const w = width ?? size.width;
|
|
2391
|
-
const h = height ?? size.height;
|
|
2392
|
-
return new webgpu.RenderTarget(w, h, opts);
|
|
2393
|
-
}, [width, height, size.width, size.height, opts, isLegacy]);
|
|
1519
|
+
return React.useMemo(() => {
|
|
1520
|
+
const w = width ?? size.width;
|
|
1521
|
+
const h = height ?? size.height;
|
|
1522
|
+
return new webgpu.RenderTarget(w, h, opts);
|
|
1523
|
+
}, [width, height, size.width, size.height, opts, isLegacy]);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const presetsObj = {
|
|
1527
|
+
apartment: "lebombo_1k.hdr",
|
|
1528
|
+
city: "potsdamer_platz_1k.hdr",
|
|
1529
|
+
dawn: "kiara_1_dawn_1k.hdr",
|
|
1530
|
+
forest: "forest_slope_1k.hdr",
|
|
1531
|
+
lobby: "st_fagans_interior_1k.hdr",
|
|
1532
|
+
night: "dikhololo_night_1k.hdr",
|
|
1533
|
+
park: "rooitou_park_1k.hdr",
|
|
1534
|
+
studio: "studio_small_03_1k.hdr",
|
|
1535
|
+
sunset: "venice_sunset_1k.hdr",
|
|
1536
|
+
warehouse: "empty_warehouse_01_1k.hdr"
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
const CUBEMAP_ROOT = "https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/";
|
|
1540
|
+
const isArray = (arr) => Array.isArray(arr);
|
|
1541
|
+
const defaultFiles = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"];
|
|
1542
|
+
function useEnvironment({
|
|
1543
|
+
files = defaultFiles,
|
|
1544
|
+
path = "",
|
|
1545
|
+
preset = void 0,
|
|
1546
|
+
colorSpace = void 0,
|
|
1547
|
+
extensions
|
|
1548
|
+
} = {}) {
|
|
1549
|
+
if (preset) {
|
|
1550
|
+
validatePreset(preset);
|
|
1551
|
+
files = presetsObj[preset];
|
|
1552
|
+
path = CUBEMAP_ROOT;
|
|
1553
|
+
}
|
|
1554
|
+
const multiFile = isArray(files);
|
|
1555
|
+
const { extension, isCubemap } = getExtension(files);
|
|
1556
|
+
const loader = getLoader(extension);
|
|
1557
|
+
if (!loader) throw new Error("useEnvironment: Unrecognized file extension: " + files);
|
|
1558
|
+
const renderer = useThree((state) => state.renderer);
|
|
1559
|
+
React.useLayoutEffect(() => {
|
|
1560
|
+
if (extension !== "webp" && extension !== "jpg" && extension !== "jpeg") return;
|
|
1561
|
+
function clearGainmapTexture() {
|
|
1562
|
+
useLoader.clear(loader, multiFile ? [files] : files);
|
|
1563
|
+
}
|
|
1564
|
+
renderer.domElement.addEventListener("webglcontextlost", clearGainmapTexture, { once: true });
|
|
1565
|
+
}, [extension, files, loader, multiFile, renderer.domElement]);
|
|
1566
|
+
const loaderResult = useLoader(
|
|
1567
|
+
loader,
|
|
1568
|
+
multiFile ? [files] : files,
|
|
1569
|
+
(loader2) => {
|
|
1570
|
+
if (extension === "webp" || extension === "jpg" || extension === "jpeg") {
|
|
1571
|
+
loader2.setRenderer?.(renderer);
|
|
1572
|
+
}
|
|
1573
|
+
loader2.setPath?.(path);
|
|
1574
|
+
if (extensions) extensions(loader2);
|
|
1575
|
+
}
|
|
1576
|
+
);
|
|
1577
|
+
let texture = multiFile ? (
|
|
1578
|
+
// @ts-ignore
|
|
1579
|
+
loaderResult[0]
|
|
1580
|
+
) : loaderResult;
|
|
1581
|
+
if (extension === "jpg" || extension === "jpeg" || extension === "webp") {
|
|
1582
|
+
texture = texture.renderTarget?.texture;
|
|
1583
|
+
}
|
|
1584
|
+
texture.mapping = isCubemap ? webgpu.CubeReflectionMapping : webgpu.EquirectangularReflectionMapping;
|
|
1585
|
+
texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
|
|
1586
|
+
return texture;
|
|
1587
|
+
}
|
|
1588
|
+
const preloadDefaultOptions = {
|
|
1589
|
+
files: defaultFiles,
|
|
1590
|
+
path: "",
|
|
1591
|
+
preset: void 0,
|
|
1592
|
+
extensions: void 0
|
|
1593
|
+
};
|
|
1594
|
+
useEnvironment.preload = (preloadOptions) => {
|
|
1595
|
+
const options = { ...preloadDefaultOptions, ...preloadOptions };
|
|
1596
|
+
let { files, path = "" } = options;
|
|
1597
|
+
const { preset, extensions } = options;
|
|
1598
|
+
if (preset) {
|
|
1599
|
+
validatePreset(preset);
|
|
1600
|
+
files = presetsObj[preset];
|
|
1601
|
+
path = CUBEMAP_ROOT;
|
|
1602
|
+
}
|
|
1603
|
+
const { extension } = getExtension(files);
|
|
1604
|
+
if (extension === "webp" || extension === "jpg" || extension === "jpeg") {
|
|
1605
|
+
throw new Error("useEnvironment: Preloading gainmaps is not supported");
|
|
1606
|
+
}
|
|
1607
|
+
const loader = getLoader(extension);
|
|
1608
|
+
if (!loader) throw new Error("useEnvironment: Unrecognized file extension: " + files);
|
|
1609
|
+
useLoader.preload(loader, isArray(files) ? [files] : files, (loader2) => {
|
|
1610
|
+
loader2.setPath?.(path);
|
|
1611
|
+
if (extensions) extensions(loader2);
|
|
1612
|
+
});
|
|
1613
|
+
};
|
|
1614
|
+
const clearDefaultOptins = {
|
|
1615
|
+
files: defaultFiles,
|
|
1616
|
+
preset: void 0
|
|
1617
|
+
};
|
|
1618
|
+
useEnvironment.clear = (clearOptions) => {
|
|
1619
|
+
const options = { ...clearDefaultOptins, ...clearOptions };
|
|
1620
|
+
let { files } = options;
|
|
1621
|
+
const { preset } = options;
|
|
1622
|
+
if (preset) {
|
|
1623
|
+
validatePreset(preset);
|
|
1624
|
+
files = presetsObj[preset];
|
|
1625
|
+
}
|
|
1626
|
+
const { extension } = getExtension(files);
|
|
1627
|
+
const loader = getLoader(extension);
|
|
1628
|
+
if (!loader) throw new Error("useEnvironment: Unrecognized file extension: " + files);
|
|
1629
|
+
useLoader.clear(loader, isArray(files) ? [files] : files);
|
|
1630
|
+
};
|
|
1631
|
+
function validatePreset(preset) {
|
|
1632
|
+
if (!(preset in presetsObj)) throw new Error("Preset must be one of: " + Object.keys(presetsObj).join(", "));
|
|
1633
|
+
}
|
|
1634
|
+
function getExtension(files) {
|
|
1635
|
+
const isCubemap = isArray(files) && files.length === 6;
|
|
1636
|
+
const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
|
|
1637
|
+
const firstEntry = isArray(files) ? files[0] : files;
|
|
1638
|
+
const extension = isCubemap ? "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
|
|
1639
|
+
return { extension, isCubemap, isGainmap };
|
|
1640
|
+
}
|
|
1641
|
+
function getLoader(extension) {
|
|
1642
|
+
const loader = extension === "cube" ? webgpu.CubeTextureLoader : extension === "hdr" ? HDRLoader_js.HDRLoader : extension === "exr" ? EXRLoader_js.EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader_js.UltraHDRLoader : extension === "webp" ? gainmapJs.GainMapLoader : null;
|
|
1643
|
+
return loader;
|
|
2394
1644
|
}
|
|
2395
1645
|
|
|
2396
1646
|
function useStore() {
|
|
@@ -2410,6 +1660,8 @@ function useGraph(object) {
|
|
|
2410
1660
|
return React.useMemo(() => buildGraph(object), [object]);
|
|
2411
1661
|
}
|
|
2412
1662
|
|
|
1663
|
+
const t = 1, o = 8, r = 32, e = 2, i$1 = 268435456;
|
|
1664
|
+
|
|
2413
1665
|
let effectId = 0;
|
|
2414
1666
|
function addEffect(callback) {
|
|
2415
1667
|
notifyDepreciated({
|
|
@@ -13099,17 +12351,212 @@ Check the top-level render call using <` + i + ">.");
|
|
|
13099
12351
|
}, use: we, useCallback: function(e, n) {
|
|
13100
12352
|
return z = "useCallback", N(), Ma(e, n);
|
|
13101
12353
|
}, useContext: function(e) {
|
|
13102
|
-
return z = "useContext", N(), Ee(e);
|
|
12354
|
+
return z = "useContext", N(), Ee(e);
|
|
12355
|
+
}, useEffect: function(e, n) {
|
|
12356
|
+
z = "useEffect", N(), Qn(2048, Ut, e, n);
|
|
12357
|
+
}, useImperativeHandle: function(e, n, o) {
|
|
12358
|
+
return z = "useImperativeHandle", N(), aa(e, n, o);
|
|
12359
|
+
}, useInsertionEffect: function(e, n) {
|
|
12360
|
+
return z = "useInsertionEffect", N(), Qn(4, Wt, e, n);
|
|
12361
|
+
}, useLayoutEffect: function(e, n) {
|
|
12362
|
+
return z = "useLayoutEffect", N(), Qn(4, Rr, e, n);
|
|
12363
|
+
}, useMemo: function(e, n) {
|
|
12364
|
+
z = "useMemo", N();
|
|
12365
|
+
var o = x.H;
|
|
12366
|
+
x.H = $o;
|
|
12367
|
+
try {
|
|
12368
|
+
return Vi(e, n);
|
|
12369
|
+
} finally {
|
|
12370
|
+
x.H = o;
|
|
12371
|
+
}
|
|
12372
|
+
}, useReducer: function(e, n, o) {
|
|
12373
|
+
z = "useReducer", N();
|
|
12374
|
+
var i = x.H;
|
|
12375
|
+
x.H = $o;
|
|
12376
|
+
try {
|
|
12377
|
+
return Br(e, n, o);
|
|
12378
|
+
} finally {
|
|
12379
|
+
x.H = i;
|
|
12380
|
+
}
|
|
12381
|
+
}, useRef: function() {
|
|
12382
|
+
return z = "useRef", N(), xe().memoizedState;
|
|
12383
|
+
}, useState: function() {
|
|
12384
|
+
z = "useState", N();
|
|
12385
|
+
var e = x.H;
|
|
12386
|
+
x.H = $o;
|
|
12387
|
+
try {
|
|
12388
|
+
return Br(gr);
|
|
12389
|
+
} finally {
|
|
12390
|
+
x.H = e;
|
|
12391
|
+
}
|
|
12392
|
+
}, useDebugValue: function() {
|
|
12393
|
+
z = "useDebugValue", N();
|
|
12394
|
+
}, useDeferredValue: function(e, n) {
|
|
12395
|
+
return z = "useDeferredValue", N(), nc(e, n);
|
|
12396
|
+
}, useTransition: function() {
|
|
12397
|
+
return z = "useTransition", N(), Qp();
|
|
12398
|
+
}, useSyncExternalStore: function(e, n, o) {
|
|
12399
|
+
return z = "useSyncExternalStore", N(), ta(e, n, o);
|
|
12400
|
+
}, useId: function() {
|
|
12401
|
+
return z = "useId", N(), xe().memoizedState;
|
|
12402
|
+
}, useFormState: function(e) {
|
|
12403
|
+
return z = "useFormState", N(), Mi(), hs(e);
|
|
12404
|
+
}, useActionState: function(e) {
|
|
12405
|
+
return z = "useActionState", N(), hs(e);
|
|
12406
|
+
}, useOptimistic: function(e, n) {
|
|
12407
|
+
return z = "useOptimistic", N(), rf(e, n);
|
|
12408
|
+
}, useHostTransitionStatus: ia, useMemoCache: Oa, useCacheRefresh: function() {
|
|
12409
|
+
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
12410
|
+
}, useEffectEvent: function(e) {
|
|
12411
|
+
return z = "useEffectEvent", N(), oa(e);
|
|
12412
|
+
} }, Ny = { readContext: function(e) {
|
|
12413
|
+
return Ee(e);
|
|
12414
|
+
}, use: we, useCallback: function(e, n) {
|
|
12415
|
+
return z = "useCallback", N(), Ma(e, n);
|
|
12416
|
+
}, useContext: function(e) {
|
|
12417
|
+
return z = "useContext", N(), Ee(e);
|
|
12418
|
+
}, useEffect: function(e, n) {
|
|
12419
|
+
z = "useEffect", N(), Qn(2048, Ut, e, n);
|
|
12420
|
+
}, useImperativeHandle: function(e, n, o) {
|
|
12421
|
+
return z = "useImperativeHandle", N(), aa(e, n, o);
|
|
12422
|
+
}, useInsertionEffect: function(e, n) {
|
|
12423
|
+
return z = "useInsertionEffect", N(), Qn(4, Wt, e, n);
|
|
12424
|
+
}, useLayoutEffect: function(e, n) {
|
|
12425
|
+
return z = "useLayoutEffect", N(), Qn(4, Rr, e, n);
|
|
12426
|
+
}, useMemo: function(e, n) {
|
|
12427
|
+
z = "useMemo", N();
|
|
12428
|
+
var o = x.H;
|
|
12429
|
+
x.H = dm;
|
|
12430
|
+
try {
|
|
12431
|
+
return Vi(e, n);
|
|
12432
|
+
} finally {
|
|
12433
|
+
x.H = o;
|
|
12434
|
+
}
|
|
12435
|
+
}, useReducer: function(e, n, o) {
|
|
12436
|
+
z = "useReducer", N();
|
|
12437
|
+
var i = x.H;
|
|
12438
|
+
x.H = dm;
|
|
12439
|
+
try {
|
|
12440
|
+
return Qi(e, n, o);
|
|
12441
|
+
} finally {
|
|
12442
|
+
x.H = i;
|
|
12443
|
+
}
|
|
12444
|
+
}, useRef: function() {
|
|
12445
|
+
return z = "useRef", N(), xe().memoizedState;
|
|
12446
|
+
}, useState: function() {
|
|
12447
|
+
z = "useState", N();
|
|
12448
|
+
var e = x.H;
|
|
12449
|
+
x.H = dm;
|
|
12450
|
+
try {
|
|
12451
|
+
return Qi(gr);
|
|
12452
|
+
} finally {
|
|
12453
|
+
x.H = e;
|
|
12454
|
+
}
|
|
12455
|
+
}, useDebugValue: function() {
|
|
12456
|
+
z = "useDebugValue", N();
|
|
12457
|
+
}, useDeferredValue: function(e, n) {
|
|
12458
|
+
return z = "useDeferredValue", N(), sf(e, n);
|
|
12459
|
+
}, useTransition: function() {
|
|
12460
|
+
return z = "useTransition", N(), Ro();
|
|
12461
|
+
}, useSyncExternalStore: function(e, n, o) {
|
|
12462
|
+
return z = "useSyncExternalStore", N(), ta(e, n, o);
|
|
12463
|
+
}, useId: function() {
|
|
12464
|
+
return z = "useId", N(), xe().memoizedState;
|
|
12465
|
+
}, useFormState: function(e) {
|
|
12466
|
+
return z = "useFormState", N(), Mi(), $t(e);
|
|
12467
|
+
}, useActionState: function(e) {
|
|
12468
|
+
return z = "useActionState", N(), $t(e);
|
|
12469
|
+
}, useOptimistic: function(e, n) {
|
|
12470
|
+
return z = "useOptimistic", N(), of(e, n);
|
|
12471
|
+
}, useHostTransitionStatus: ia, useMemoCache: Oa, useCacheRefresh: function() {
|
|
12472
|
+
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
12473
|
+
}, useEffectEvent: function(e) {
|
|
12474
|
+
return z = "useEffectEvent", N(), oa(e);
|
|
12475
|
+
} }, Ca = { readContext: function(e) {
|
|
12476
|
+
return Ce(), Ee(e);
|
|
12477
|
+
}, use: function(e) {
|
|
12478
|
+
return D(), we(e);
|
|
12479
|
+
}, useCallback: function(e, n) {
|
|
12480
|
+
return z = "useCallback", D(), ee(), Ku(e, n);
|
|
12481
|
+
}, useContext: function(e) {
|
|
12482
|
+
return z = "useContext", D(), ee(), Ee(e);
|
|
12483
|
+
}, useEffect: function(e, n) {
|
|
12484
|
+
return z = "useEffect", D(), ee(), yt(e, n);
|
|
12485
|
+
}, useImperativeHandle: function(e, n, o) {
|
|
12486
|
+
return z = "useImperativeHandle", D(), ee(), Xu(e, n, o);
|
|
12487
|
+
}, useInsertionEffect: function(e, n) {
|
|
12488
|
+
z = "useInsertionEffect", D(), ee(), To(4, Wt, e, n);
|
|
12489
|
+
}, useLayoutEffect: function(e, n) {
|
|
12490
|
+
return z = "useLayoutEffect", D(), ee(), _o(e, n);
|
|
12491
|
+
}, useMemo: function(e, n) {
|
|
12492
|
+
z = "useMemo", D(), ee();
|
|
12493
|
+
var o = x.H;
|
|
12494
|
+
x.H = Ca;
|
|
12495
|
+
try {
|
|
12496
|
+
return ec(e, n);
|
|
12497
|
+
} finally {
|
|
12498
|
+
x.H = o;
|
|
12499
|
+
}
|
|
12500
|
+
}, useReducer: function(e, n, o) {
|
|
12501
|
+
z = "useReducer", D(), ee();
|
|
12502
|
+
var i = x.H;
|
|
12503
|
+
x.H = Ca;
|
|
12504
|
+
try {
|
|
12505
|
+
return $u(e, n, o);
|
|
12506
|
+
} finally {
|
|
12507
|
+
x.H = i;
|
|
12508
|
+
}
|
|
12509
|
+
}, useRef: function(e) {
|
|
12510
|
+
return z = "useRef", D(), ee(), br(e);
|
|
12511
|
+
}, useState: function(e) {
|
|
12512
|
+
z = "useState", D(), ee();
|
|
12513
|
+
var n = x.H;
|
|
12514
|
+
x.H = Ca;
|
|
12515
|
+
try {
|
|
12516
|
+
return $i(e);
|
|
12517
|
+
} finally {
|
|
12518
|
+
x.H = n;
|
|
12519
|
+
}
|
|
12520
|
+
}, useDebugValue: function() {
|
|
12521
|
+
z = "useDebugValue", D(), ee();
|
|
12522
|
+
}, useDeferredValue: function(e, n) {
|
|
12523
|
+
return z = "useDeferredValue", D(), ee(), ms(e, n);
|
|
12524
|
+
}, useTransition: function() {
|
|
12525
|
+
return z = "useTransition", D(), ee(), tc();
|
|
12526
|
+
}, useSyncExternalStore: function(e, n, o) {
|
|
12527
|
+
return z = "useSyncExternalStore", D(), ee(), Vu(e, n, o);
|
|
12528
|
+
}, useId: function() {
|
|
12529
|
+
return z = "useId", D(), ee(), bs();
|
|
12530
|
+
}, useFormState: function(e, n) {
|
|
12531
|
+
return z = "useFormState", D(), ee(), tn(e, n);
|
|
12532
|
+
}, useActionState: function(e, n) {
|
|
12533
|
+
return z = "useActionState", D(), ee(), tn(e, n);
|
|
12534
|
+
}, useOptimistic: function(e) {
|
|
12535
|
+
return z = "useOptimistic", D(), ee(), Ju(e);
|
|
12536
|
+
}, useMemoCache: function(e) {
|
|
12537
|
+
return D(), Oa(e);
|
|
12538
|
+
}, useHostTransitionStatus: ia, useCacheRefresh: function() {
|
|
12539
|
+
return z = "useCacheRefresh", ee(), la();
|
|
12540
|
+
}, useEffectEvent: function(e) {
|
|
12541
|
+
return z = "useEffectEvent", D(), ee(), ra(e);
|
|
12542
|
+
} }, $o = { readContext: function(e) {
|
|
12543
|
+
return Ce(), Ee(e);
|
|
12544
|
+
}, use: function(e) {
|
|
12545
|
+
return D(), we(e);
|
|
12546
|
+
}, useCallback: function(e, n) {
|
|
12547
|
+
return z = "useCallback", D(), N(), Ma(e, n);
|
|
12548
|
+
}, useContext: function(e) {
|
|
12549
|
+
return z = "useContext", D(), N(), Ee(e);
|
|
13103
12550
|
}, useEffect: function(e, n) {
|
|
13104
|
-
z = "useEffect", N(), Qn(2048, Ut, e, n);
|
|
12551
|
+
z = "useEffect", D(), N(), Qn(2048, Ut, e, n);
|
|
13105
12552
|
}, useImperativeHandle: function(e, n, o) {
|
|
13106
|
-
return z = "useImperativeHandle", N(), aa(e, n, o);
|
|
12553
|
+
return z = "useImperativeHandle", D(), N(), aa(e, n, o);
|
|
13107
12554
|
}, useInsertionEffect: function(e, n) {
|
|
13108
|
-
return z = "useInsertionEffect", N(), Qn(4, Wt, e, n);
|
|
12555
|
+
return z = "useInsertionEffect", D(), N(), Qn(4, Wt, e, n);
|
|
13109
12556
|
}, useLayoutEffect: function(e, n) {
|
|
13110
|
-
return z = "useLayoutEffect", N(), Qn(4, Rr, e, n);
|
|
12557
|
+
return z = "useLayoutEffect", D(), N(), Qn(4, Rr, e, n);
|
|
13111
12558
|
}, useMemo: function(e, n) {
|
|
13112
|
-
z = "useMemo", N();
|
|
12559
|
+
z = "useMemo", D(), N();
|
|
13113
12560
|
var o = x.H;
|
|
13114
12561
|
x.H = $o;
|
|
13115
12562
|
try {
|
|
@@ -13118,7 +12565,7 @@ Check the top-level render call using <` + i + ">.");
|
|
|
13118
12565
|
x.H = o;
|
|
13119
12566
|
}
|
|
13120
12567
|
}, useReducer: function(e, n, o) {
|
|
13121
|
-
z = "useReducer", N();
|
|
12568
|
+
z = "useReducer", D(), N();
|
|
13122
12569
|
var i = x.H;
|
|
13123
12570
|
x.H = $o;
|
|
13124
12571
|
try {
|
|
@@ -13127,9 +12574,9 @@ Check the top-level render call using <` + i + ">.");
|
|
|
13127
12574
|
x.H = i;
|
|
13128
12575
|
}
|
|
13129
12576
|
}, useRef: function() {
|
|
13130
|
-
return z = "useRef", N(), xe().memoizedState;
|
|
12577
|
+
return z = "useRef", D(), N(), xe().memoizedState;
|
|
13131
12578
|
}, useState: function() {
|
|
13132
|
-
z = "useState", N();
|
|
12579
|
+
z = "useState", D(), N();
|
|
13133
12580
|
var e = x.H;
|
|
13134
12581
|
x.H = $o;
|
|
13135
12582
|
try {
|
|
@@ -13138,569 +12585,952 @@ Check the top-level render call using <` + i + ">.");
|
|
|
13138
12585
|
x.H = e;
|
|
13139
12586
|
}
|
|
13140
12587
|
}, useDebugValue: function() {
|
|
13141
|
-
z = "useDebugValue", N();
|
|
12588
|
+
z = "useDebugValue", D(), N();
|
|
13142
12589
|
}, useDeferredValue: function(e, n) {
|
|
13143
|
-
return z = "useDeferredValue", N(), nc(e, n);
|
|
12590
|
+
return z = "useDeferredValue", D(), N(), nc(e, n);
|
|
13144
12591
|
}, useTransition: function() {
|
|
13145
|
-
return z = "useTransition", N(), Qp();
|
|
12592
|
+
return z = "useTransition", D(), N(), Qp();
|
|
13146
12593
|
}, useSyncExternalStore: function(e, n, o) {
|
|
13147
|
-
return z = "useSyncExternalStore", N(), ta(e, n, o);
|
|
12594
|
+
return z = "useSyncExternalStore", D(), N(), ta(e, n, o);
|
|
13148
12595
|
}, useId: function() {
|
|
13149
|
-
return z = "useId", N(), xe().memoizedState;
|
|
12596
|
+
return z = "useId", D(), N(), xe().memoizedState;
|
|
13150
12597
|
}, useFormState: function(e) {
|
|
13151
|
-
return z = "useFormState",
|
|
12598
|
+
return z = "useFormState", D(), N(), hs(e);
|
|
13152
12599
|
}, useActionState: function(e) {
|
|
13153
|
-
return z = "useActionState", N(), hs(e);
|
|
12600
|
+
return z = "useActionState", D(), N(), hs(e);
|
|
13154
12601
|
}, useOptimistic: function(e, n) {
|
|
13155
|
-
return z = "useOptimistic", N(), rf(e, n);
|
|
13156
|
-
},
|
|
12602
|
+
return z = "useOptimistic", D(), N(), rf(e, n);
|
|
12603
|
+
}, useMemoCache: function(e) {
|
|
12604
|
+
return D(), Oa(e);
|
|
12605
|
+
}, useHostTransitionStatus: ia, useCacheRefresh: function() {
|
|
13157
12606
|
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
13158
12607
|
}, useEffectEvent: function(e) {
|
|
13159
|
-
return z = "useEffectEvent", N(), oa(e);
|
|
13160
|
-
} },
|
|
13161
|
-
return Ee(e);
|
|
13162
|
-
}, use:
|
|
13163
|
-
return
|
|
12608
|
+
return z = "useEffectEvent", D(), N(), oa(e);
|
|
12609
|
+
} }, dm = { readContext: function(e) {
|
|
12610
|
+
return Ce(), Ee(e);
|
|
12611
|
+
}, use: function(e) {
|
|
12612
|
+
return D(), we(e);
|
|
12613
|
+
}, useCallback: function(e, n) {
|
|
12614
|
+
return z = "useCallback", D(), N(), Ma(e, n);
|
|
13164
12615
|
}, useContext: function(e) {
|
|
13165
|
-
return z = "useContext", N(), Ee(e);
|
|
12616
|
+
return z = "useContext", D(), N(), Ee(e);
|
|
13166
12617
|
}, useEffect: function(e, n) {
|
|
13167
|
-
z = "useEffect", N(), Qn(2048, Ut, e, n);
|
|
12618
|
+
z = "useEffect", D(), N(), Qn(2048, Ut, e, n);
|
|
13168
12619
|
}, useImperativeHandle: function(e, n, o) {
|
|
13169
|
-
return z = "useImperativeHandle", N(), aa(e, n, o);
|
|
12620
|
+
return z = "useImperativeHandle", D(), N(), aa(e, n, o);
|
|
13170
12621
|
}, useInsertionEffect: function(e, n) {
|
|
13171
|
-
return z = "useInsertionEffect", N(), Qn(4, Wt, e, n);
|
|
12622
|
+
return z = "useInsertionEffect", D(), N(), Qn(4, Wt, e, n);
|
|
13172
12623
|
}, useLayoutEffect: function(e, n) {
|
|
13173
|
-
return z = "useLayoutEffect", N(), Qn(4, Rr, e, n);
|
|
12624
|
+
return z = "useLayoutEffect", D(), N(), Qn(4, Rr, e, n);
|
|
13174
12625
|
}, useMemo: function(e, n) {
|
|
13175
|
-
z = "useMemo", N();
|
|
12626
|
+
z = "useMemo", D(), N();
|
|
13176
12627
|
var o = x.H;
|
|
13177
|
-
x.H =
|
|
12628
|
+
x.H = $o;
|
|
13178
12629
|
try {
|
|
13179
12630
|
return Vi(e, n);
|
|
13180
12631
|
} finally {
|
|
13181
12632
|
x.H = o;
|
|
13182
12633
|
}
|
|
13183
12634
|
}, useReducer: function(e, n, o) {
|
|
13184
|
-
z = "useReducer", N();
|
|
12635
|
+
z = "useReducer", D(), N();
|
|
13185
12636
|
var i = x.H;
|
|
13186
|
-
x.H =
|
|
12637
|
+
x.H = $o;
|
|
13187
12638
|
try {
|
|
13188
12639
|
return Qi(e, n, o);
|
|
13189
12640
|
} finally {
|
|
13190
12641
|
x.H = i;
|
|
13191
12642
|
}
|
|
13192
12643
|
}, useRef: function() {
|
|
13193
|
-
return z = "useRef", N(), xe().memoizedState;
|
|
12644
|
+
return z = "useRef", D(), N(), xe().memoizedState;
|
|
13194
12645
|
}, useState: function() {
|
|
13195
|
-
z = "useState", N();
|
|
12646
|
+
z = "useState", D(), N();
|
|
13196
12647
|
var e = x.H;
|
|
13197
|
-
x.H =
|
|
12648
|
+
x.H = $o;
|
|
13198
12649
|
try {
|
|
13199
12650
|
return Qi(gr);
|
|
13200
12651
|
} finally {
|
|
13201
12652
|
x.H = e;
|
|
13202
12653
|
}
|
|
13203
12654
|
}, useDebugValue: function() {
|
|
13204
|
-
z = "useDebugValue", N();
|
|
12655
|
+
z = "useDebugValue", D(), N();
|
|
13205
12656
|
}, useDeferredValue: function(e, n) {
|
|
13206
|
-
return z = "useDeferredValue", N(), sf(e, n);
|
|
12657
|
+
return z = "useDeferredValue", D(), N(), sf(e, n);
|
|
13207
12658
|
}, useTransition: function() {
|
|
13208
|
-
return z = "useTransition", N(), Ro();
|
|
12659
|
+
return z = "useTransition", D(), N(), Ro();
|
|
13209
12660
|
}, useSyncExternalStore: function(e, n, o) {
|
|
13210
|
-
return z = "useSyncExternalStore", N(), ta(e, n, o);
|
|
12661
|
+
return z = "useSyncExternalStore", D(), N(), ta(e, n, o);
|
|
13211
12662
|
}, useId: function() {
|
|
13212
|
-
return z = "useId", N(), xe().memoizedState;
|
|
12663
|
+
return z = "useId", D(), N(), xe().memoizedState;
|
|
13213
12664
|
}, useFormState: function(e) {
|
|
13214
|
-
return z = "useFormState",
|
|
12665
|
+
return z = "useFormState", D(), N(), $t(e);
|
|
13215
12666
|
}, useActionState: function(e) {
|
|
13216
|
-
return z = "useActionState", N(), $t(e);
|
|
12667
|
+
return z = "useActionState", D(), N(), $t(e);
|
|
13217
12668
|
}, useOptimistic: function(e, n) {
|
|
13218
|
-
return z = "useOptimistic", N(), of(e, n);
|
|
13219
|
-
},
|
|
12669
|
+
return z = "useOptimistic", D(), N(), of(e, n);
|
|
12670
|
+
}, useMemoCache: function(e) {
|
|
12671
|
+
return D(), Oa(e);
|
|
12672
|
+
}, useHostTransitionStatus: ia, useCacheRefresh: function() {
|
|
13220
12673
|
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
13221
12674
|
}, useEffectEvent: function(e) {
|
|
13222
|
-
return z = "useEffectEvent", N(), oa(e);
|
|
13223
|
-
} }
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
var o =
|
|
13242
|
-
|
|
12675
|
+
return z = "useEffectEvent", D(), N(), oa(e);
|
|
12676
|
+
} };
|
|
12677
|
+
var Fy = {}, Hy = /* @__PURE__ */ new Set(), Ay = /* @__PURE__ */ new Set(), jy = /* @__PURE__ */ new Set(), Dy = /* @__PURE__ */ new Set(), Wy = /* @__PURE__ */ new Set(), Uy = /* @__PURE__ */ new Set(), By = /* @__PURE__ */ new Set(), Oy = /* @__PURE__ */ new Set(), My = /* @__PURE__ */ new Set(), Qy = /* @__PURE__ */ new Set();
|
|
12678
|
+
Object.freeze(Fy);
|
|
12679
|
+
var zg = { enqueueSetState: function(e, n, o) {
|
|
12680
|
+
e = e._reactInternals;
|
|
12681
|
+
var i = Nt(e), s = zo(i);
|
|
12682
|
+
s.payload = n, o != null && (df(o), s.callback = o), n = Mt(e, s, i), n !== null && (ur(i, "this.setState()", e), We(n, e, i), Bi(n, e, i));
|
|
12683
|
+
}, enqueueReplaceState: function(e, n, o) {
|
|
12684
|
+
e = e._reactInternals;
|
|
12685
|
+
var i = Nt(e), s = zo(i);
|
|
12686
|
+
s.tag = Cy, s.payload = n, o != null && (df(o), s.callback = o), n = Mt(e, s, i), n !== null && (ur(i, "this.replaceState()", e), We(n, e, i), Bi(n, e, i));
|
|
12687
|
+
}, enqueueForceUpdate: function(e, n) {
|
|
12688
|
+
e = e._reactInternals;
|
|
12689
|
+
var o = Nt(e), i = zo(o);
|
|
12690
|
+
i.tag = Ty, n != null && (df(n), i.callback = n), n = Mt(e, i, o), n !== null && (ur(o, "this.forceUpdate()", e), We(n, e, o), Bi(n, e, o));
|
|
12691
|
+
} }, bd = null, Cg = null, Tg = Error("This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue."), Cn = false, $y = {}, Vy = {}, qy = {}, Gy = {}, vd = false, Jy = {}, fm = {}, _g = { dehydrated: null, treeContext: null, retryLane: 0, hydrationErrors: null }, Zy = false, Yy = null;
|
|
12692
|
+
Yy = /* @__PURE__ */ new Set();
|
|
12693
|
+
var Si = false, Tn = false, Rg = false, Xy = typeof WeakSet == "function" ? WeakSet : Set, Gn = null, Sd = null, kd = null, _n = null, nr = false, Vo = null, Wn = false, wd = 8192, Vb = { getCacheForType: function(e) {
|
|
12694
|
+
var n = Ee(un), o = n.data.get(e);
|
|
12695
|
+
return o === void 0 && (o = e(), n.data.set(e, o)), o;
|
|
12696
|
+
}, cacheSignal: function() {
|
|
12697
|
+
return Ee(un).controller.signal;
|
|
12698
|
+
}, getOwner: function() {
|
|
12699
|
+
return di;
|
|
12700
|
+
} }, pm = 0, hm = 1, mm = 2, gm = 3, ym = 4;
|
|
12701
|
+
if (typeof Symbol == "function" && Symbol.for) {
|
|
12702
|
+
var bp = Symbol.for;
|
|
12703
|
+
pm = bp("selector.component"), hm = bp("selector.has_pseudo_class"), mm = bp("selector.role"), gm = bp("selector.test_id"), ym = bp("selector.text");
|
|
12704
|
+
}
|
|
12705
|
+
var bm = [], qb = typeof WeakMap == "function" ? WeakMap : Map, Jn = 0, Zn = 2, uo = 4, ki = 0, vp = 1, iu = 2, vm = 3, Tl = 4, Sm = 6, Ky = 5, ye = Jn, je = null, se = null, ae = 0, tr = 0, km = 1, lu = 2, Sp = 3, eb = 4, Eg = 5, kp = 6, wm = 7, Ig = 8, su = 9, Le = tr, Er = null, _l = false, Pd = false, Lg = false, Ta = 0, nn = ki, Rl = 0, El = 0, Ng = 0, rr = 0, uu = 0, wp = null, Bt = null, Pm = false, xm = 0, nb = 0, tb = 300, Pp = 1 / 0, Fg = 500, xp = null, gn = null, Il = null, zm = 0, Hg = 1, Ag = 2, rb = 3, Ll = 0, ob = 1, ab = 2, ib = 3, lb = 4, Cm = 5, Rn = 0, Nl = null, xd = null, qo = 0, jg = 0, Dg = -0, Wg = null, sb = null, ub = null, Go = zm, cb = null, Gb = 50, zp = 0, Ug = null, Bg = false, Tm = false, Jb = 50, cu = 0, Cp = null, zd = false, _m = null, db = false, fb = /* @__PURE__ */ new Set(), Zb = {}, co = null, Cd = null, pb = false;
|
|
12706
|
+
try {
|
|
12707
|
+
var o0 = Object.preventExtensions({});
|
|
12708
|
+
} catch {
|
|
12709
|
+
pb = true;
|
|
12710
|
+
}
|
|
12711
|
+
var hb = false, mb = {}, gb = null, yb = null, bb = null, vb = null, Sb = null, kb = null, wb = null, Pb = null, xb = null, zb = null;
|
|
12712
|
+
return gb = function(e, n, o, i) {
|
|
12713
|
+
n = Yn(e, n), n !== null && (o = _d(n.memoizedState, o, 0, i), n.memoizedState = o, n.baseState = o, e.memoizedProps = ze({}, e.memoizedProps), o = On(e, 2), o !== null && We(o, e, 2));
|
|
12714
|
+
}, yb = function(e, n, o) {
|
|
12715
|
+
n = Yn(e, n), n !== null && (o = du(n.memoizedState, o, 0), n.memoizedState = o, n.baseState = o, e.memoizedProps = ze({}, e.memoizedProps), o = On(e, 2), o !== null && We(o, e, 2));
|
|
12716
|
+
}, bb = function(e, n, o, i) {
|
|
12717
|
+
n = Yn(e, n), n !== null && (o = F(n.memoizedState, o, i), n.memoizedState = o, n.baseState = o, e.memoizedProps = ze({}, e.memoizedProps), o = On(e, 2), o !== null && We(o, e, 2));
|
|
12718
|
+
}, vb = function(e, n, o) {
|
|
12719
|
+
e.pendingProps = _d(e.memoizedProps, n, 0, o), e.alternate && (e.alternate.pendingProps = e.pendingProps), n = On(e, 2), n !== null && We(n, e, 2);
|
|
12720
|
+
}, Sb = function(e, n) {
|
|
12721
|
+
e.pendingProps = du(e.memoizedProps, n, 0), e.alternate && (e.alternate.pendingProps = e.pendingProps), n = On(e, 2), n !== null && We(n, e, 2);
|
|
12722
|
+
}, kb = function(e, n, o) {
|
|
12723
|
+
e.pendingProps = F(e.memoizedProps, n, o), e.alternate && (e.alternate.pendingProps = e.pendingProps), n = On(e, 2), n !== null && We(n, e, 2);
|
|
12724
|
+
}, wb = function(e) {
|
|
12725
|
+
var n = On(e, 2);
|
|
12726
|
+
n !== null && We(n, e, 2);
|
|
12727
|
+
}, Pb = function(e) {
|
|
12728
|
+
var n = ut(), o = On(e, n);
|
|
12729
|
+
o !== null && We(o, e, n);
|
|
12730
|
+
}, xb = function(e) {
|
|
12731
|
+
pu = e;
|
|
12732
|
+
}, zb = function(e) {
|
|
12733
|
+
fu = e;
|
|
12734
|
+
}, le.attemptContinuousHydration = function(e) {
|
|
12735
|
+
if (e.tag === 13 || e.tag === 31) {
|
|
12736
|
+
var n = On(e, 67108864);
|
|
12737
|
+
n !== null && We(n, e, 67108864), rl(e, 67108864);
|
|
12738
|
+
}
|
|
12739
|
+
}, le.attemptHydrationAtCurrentPriority = function(e) {
|
|
12740
|
+
if (e.tag === 13 || e.tag === 31) {
|
|
12741
|
+
var n = Nt(e);
|
|
12742
|
+
n = Xo(n);
|
|
12743
|
+
var o = On(e, n);
|
|
12744
|
+
o !== null && We(o, e, n), rl(e, n);
|
|
12745
|
+
}
|
|
12746
|
+
}, le.attemptSynchronousHydration = function(e) {
|
|
12747
|
+
switch (e.tag) {
|
|
12748
|
+
case 3:
|
|
12749
|
+
if (e = e.stateNode, e.current.memoizedState.isDehydrated) {
|
|
12750
|
+
var n = _t(e.pendingLanes);
|
|
12751
|
+
if (n !== 0) {
|
|
12752
|
+
for (e.pendingLanes |= 2, e.entangledLanes |= 2; n; ) {
|
|
12753
|
+
var o = 1 << 31 - vn(n);
|
|
12754
|
+
e.entanglements[1] |= o, n &= ~o;
|
|
12755
|
+
}
|
|
12756
|
+
Kn(e), (ye & (Zn | uo)) === Jn && (Pp = me() + Fg, Wa(0));
|
|
12757
|
+
}
|
|
12758
|
+
}
|
|
12759
|
+
break;
|
|
12760
|
+
case 31:
|
|
12761
|
+
case 13:
|
|
12762
|
+
n = On(e, 2), n !== null && We(n, e, 2), Ls(), rl(e, 2);
|
|
12763
|
+
}
|
|
12764
|
+
}, le.batchedUpdates = function(e, n) {
|
|
12765
|
+
return e(n);
|
|
12766
|
+
}, le.createComponentSelector = function(e) {
|
|
12767
|
+
return { $$typeof: pm, value: e };
|
|
12768
|
+
}, le.createContainer = function(e, n, o, i, s, u, f, p, g, S) {
|
|
12769
|
+
return Ka(e, n, false, null, o, i, u, null, f, p, g, S);
|
|
12770
|
+
}, le.createHasPseudoClassSelector = function(e) {
|
|
12771
|
+
return { $$typeof: hm, value: e };
|
|
12772
|
+
}, le.createHydrationContainer = function(e, n, o, i, s, u, f, p, g, S, T, _, I, O) {
|
|
12773
|
+
return e = Ka(o, i, true, e, s, u, p, O, g, S, T, _), e.context = Dh(null), o = e.current, i = Nt(o), i = Xo(i), s = zo(i), s.callback = n ?? null, Mt(o, s, i), ur(i, "hydrateRoot()", null), n = i, e.current.lanes = n, Ci(e, n), Kn(e), e;
|
|
12774
|
+
}, le.createPortal = function(e, n, o) {
|
|
12775
|
+
var i = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
|
|
13243
12776
|
try {
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
12777
|
+
vt(i);
|
|
12778
|
+
var s = false;
|
|
12779
|
+
} catch {
|
|
12780
|
+
s = true;
|
|
13247
12781
|
}
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
12782
|
+
return s && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object"), vt(i)), { $$typeof: Ao, key: i == null ? null : "" + i, children: e, containerInfo: n, implementation: o };
|
|
12783
|
+
}, le.createRoleSelector = function(e) {
|
|
12784
|
+
return { $$typeof: mm, value: e };
|
|
12785
|
+
}, le.createTestNameSelector = function(e) {
|
|
12786
|
+
return { $$typeof: gm, value: e };
|
|
12787
|
+
}, le.createTextSelector = function(e) {
|
|
12788
|
+
return { $$typeof: ym, value: e };
|
|
12789
|
+
}, le.defaultOnCaughtError = function(e) {
|
|
12790
|
+
var n = bd ? "The above error occurred in the <" + bd + "> component." : "The above error occurred in one of your React components.", o = "React will try to recreate this component tree from scratch using the error boundary you provided, " + ((Cg || "Anonymous") + ".");
|
|
12791
|
+
typeof e == "object" && e !== null && typeof e.environmentName == "string" ? ri("error", [`%o
|
|
12792
|
+
|
|
12793
|
+
%s
|
|
12794
|
+
|
|
12795
|
+
%s
|
|
12796
|
+
`, e, n, o], e.environmentName)() : console.error(`%o
|
|
12797
|
+
|
|
12798
|
+
%s
|
|
12799
|
+
|
|
12800
|
+
%s
|
|
12801
|
+
`, e, n, o);
|
|
12802
|
+
}, le.defaultOnRecoverableError = function(e) {
|
|
12803
|
+
qg(e);
|
|
12804
|
+
}, le.defaultOnUncaughtError = function(e) {
|
|
12805
|
+
qg(e), console.warn(`%s
|
|
12806
|
+
|
|
12807
|
+
%s
|
|
12808
|
+
`, bd ? "An error occurred in the <" + bd + "> component." : "An error occurred in one of your React components.", `Consider adding an error boundary to your tree to customize error handling behavior.
|
|
12809
|
+
Visit https://react.dev/link/error-boundaries to learn more about error boundaries.`);
|
|
12810
|
+
}, le.deferredUpdates = function(e) {
|
|
12811
|
+
var n = x.T, o = wt();
|
|
13252
12812
|
try {
|
|
13253
|
-
return
|
|
12813
|
+
return an(32), x.T = null, e();
|
|
13254
12814
|
} finally {
|
|
13255
|
-
x.
|
|
12815
|
+
an(o), x.T = n;
|
|
13256
12816
|
}
|
|
13257
|
-
},
|
|
13258
|
-
|
|
13259
|
-
}, useState: function(e) {
|
|
13260
|
-
z = "useState", D(), ee();
|
|
13261
|
-
var n = x.H;
|
|
13262
|
-
x.H = Ca;
|
|
12817
|
+
}, le.discreteUpdates = function(e, n, o, i, s) {
|
|
12818
|
+
var u = x.T, f = wt();
|
|
13263
12819
|
try {
|
|
13264
|
-
return
|
|
12820
|
+
return an(2), x.T = null, e(n, o, i, s);
|
|
13265
12821
|
} finally {
|
|
13266
|
-
x.
|
|
12822
|
+
an(f), x.T = u, ye === Jn && (Pp = me() + Fg);
|
|
13267
12823
|
}
|
|
13268
|
-
},
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
return z = "useEffectEvent", D(), ee(), ra(e);
|
|
13290
|
-
} }, $o = { readContext: function(e) {
|
|
13291
|
-
return Ce(), Ee(e);
|
|
13292
|
-
}, use: function(e) {
|
|
13293
|
-
return D(), we(e);
|
|
13294
|
-
}, useCallback: function(e, n) {
|
|
13295
|
-
return z = "useCallback", D(), N(), Ma(e, n);
|
|
13296
|
-
}, useContext: function(e) {
|
|
13297
|
-
return z = "useContext", D(), N(), Ee(e);
|
|
13298
|
-
}, useEffect: function(e, n) {
|
|
13299
|
-
z = "useEffect", D(), N(), Qn(2048, Ut, e, n);
|
|
13300
|
-
}, useImperativeHandle: function(e, n, o) {
|
|
13301
|
-
return z = "useImperativeHandle", D(), N(), aa(e, n, o);
|
|
13302
|
-
}, useInsertionEffect: function(e, n) {
|
|
13303
|
-
return z = "useInsertionEffect", D(), N(), Qn(4, Wt, e, n);
|
|
13304
|
-
}, useLayoutEffect: function(e, n) {
|
|
13305
|
-
return z = "useLayoutEffect", D(), N(), Qn(4, Rr, e, n);
|
|
13306
|
-
}, useMemo: function(e, n) {
|
|
13307
|
-
z = "useMemo", D(), N();
|
|
13308
|
-
var o = x.H;
|
|
13309
|
-
x.H = $o;
|
|
13310
|
-
try {
|
|
13311
|
-
return Vi(e, n);
|
|
13312
|
-
} finally {
|
|
13313
|
-
x.H = o;
|
|
12824
|
+
}, le.findAllNodes = kc, le.findBoundingRects = function(e, n) {
|
|
12825
|
+
if (!xr) throw Error("Test selector API is not supported by this renderer.");
|
|
12826
|
+
n = kc(e, n), e = [];
|
|
12827
|
+
for (var o = 0; o < n.length; o++) e.push(ma(n[o]));
|
|
12828
|
+
for (n = e.length - 1; 0 < n; n--) {
|
|
12829
|
+
o = e[n];
|
|
12830
|
+
for (var i = o.x, s = i + o.width, u = o.y, f = u + o.height, p = n - 1; 0 <= p; p--) if (n !== p) {
|
|
12831
|
+
var g = e[p], S = g.x, T = S + g.width, _ = g.y, I = _ + g.height;
|
|
12832
|
+
if (i >= S && u >= _ && s <= T && f <= I) {
|
|
12833
|
+
e.splice(n, 1);
|
|
12834
|
+
break;
|
|
12835
|
+
} else if (i !== S || o.width !== g.width || I < u || _ > f) {
|
|
12836
|
+
if (!(u !== _ || o.height !== g.height || T < i || S > s)) {
|
|
12837
|
+
S > i && (g.width += S - i, g.x = i), T < s && (g.width = s - S), e.splice(n, 1);
|
|
12838
|
+
break;
|
|
12839
|
+
}
|
|
12840
|
+
} else {
|
|
12841
|
+
_ > u && (g.height += _ - u, g.y = u), I < f && (g.height = f - _), e.splice(n, 1);
|
|
12842
|
+
break;
|
|
12843
|
+
}
|
|
12844
|
+
}
|
|
13314
12845
|
}
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
var
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
12846
|
+
return e;
|
|
12847
|
+
}, le.findHostInstance = function(e) {
|
|
12848
|
+
var n = e._reactInternals;
|
|
12849
|
+
if (n === void 0) throw typeof e.render == "function" ? Error("Unable to find node on an unmounted component.") : (e = Object.keys(e).join(","), Error("Argument appears to not be a ReactComponent. Keys: " + e));
|
|
12850
|
+
return e = mu(n), e === null ? null : ot(e.stateNode);
|
|
12851
|
+
}, le.findHostInstanceWithNoPortals = function(e) {
|
|
12852
|
+
return e = Ed(e), e = e !== null ? _p(e) : null, e === null ? null : ot(e.stateNode);
|
|
12853
|
+
}, le.findHostInstanceWithWarning = function(e, n) {
|
|
12854
|
+
var o = e._reactInternals;
|
|
12855
|
+
if (o === void 0) throw typeof e.render == "function" ? Error("Unable to find node on an unmounted component.") : (e = Object.keys(e).join(","), Error("Argument appears to not be a ReactComponent. Keys: " + e));
|
|
12856
|
+
if (e = mu(o), e === null) return null;
|
|
12857
|
+
if (e.mode & 8) {
|
|
12858
|
+
var i = G(o) || "Component";
|
|
12859
|
+
mb[i] || (mb[i] = true, B(e, function() {
|
|
12860
|
+
o.mode & 8 ? console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", n, n, i) : console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", n, n, i);
|
|
12861
|
+
}));
|
|
13323
12862
|
}
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
var
|
|
13329
|
-
x.H = $o;
|
|
12863
|
+
return ot(e.stateNode);
|
|
12864
|
+
}, le.flushPassiveEffects = el, le.flushSyncFromReconciler = function(e) {
|
|
12865
|
+
var n = ye;
|
|
12866
|
+
ye |= 1;
|
|
12867
|
+
var o = x.T, i = wt();
|
|
13330
12868
|
try {
|
|
13331
|
-
return
|
|
12869
|
+
if (an(2), x.T = null, e) return e();
|
|
13332
12870
|
} finally {
|
|
13333
|
-
x.
|
|
12871
|
+
an(i), x.T = o, ye = n, (ye & (Zn | uo)) === Jn && Wa(0);
|
|
13334
12872
|
}
|
|
13335
|
-
},
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
}, useId: function() {
|
|
13344
|
-
return z = "useId", D(), N(), xe().memoizedState;
|
|
13345
|
-
}, useFormState: function(e) {
|
|
13346
|
-
return z = "useFormState", D(), N(), hs(e);
|
|
13347
|
-
}, useActionState: function(e) {
|
|
13348
|
-
return z = "useActionState", D(), N(), hs(e);
|
|
13349
|
-
}, useOptimistic: function(e, n) {
|
|
13350
|
-
return z = "useOptimistic", D(), N(), rf(e, n);
|
|
13351
|
-
}, useMemoCache: function(e) {
|
|
13352
|
-
return D(), Oa(e);
|
|
13353
|
-
}, useHostTransitionStatus: ia, useCacheRefresh: function() {
|
|
13354
|
-
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
13355
|
-
}, useEffectEvent: function(e) {
|
|
13356
|
-
return z = "useEffectEvent", D(), N(), oa(e);
|
|
13357
|
-
} }, dm = { readContext: function(e) {
|
|
13358
|
-
return Ce(), Ee(e);
|
|
13359
|
-
}, use: function(e) {
|
|
13360
|
-
return D(), we(e);
|
|
13361
|
-
}, useCallback: function(e, n) {
|
|
13362
|
-
return z = "useCallback", D(), N(), Ma(e, n);
|
|
13363
|
-
}, useContext: function(e) {
|
|
13364
|
-
return z = "useContext", D(), N(), Ee(e);
|
|
13365
|
-
}, useEffect: function(e, n) {
|
|
13366
|
-
z = "useEffect", D(), N(), Qn(2048, Ut, e, n);
|
|
13367
|
-
}, useImperativeHandle: function(e, n, o) {
|
|
13368
|
-
return z = "useImperativeHandle", D(), N(), aa(e, n, o);
|
|
13369
|
-
}, useInsertionEffect: function(e, n) {
|
|
13370
|
-
return z = "useInsertionEffect", D(), N(), Qn(4, Wt, e, n);
|
|
13371
|
-
}, useLayoutEffect: function(e, n) {
|
|
13372
|
-
return z = "useLayoutEffect", D(), N(), Qn(4, Rr, e, n);
|
|
13373
|
-
}, useMemo: function(e, n) {
|
|
13374
|
-
z = "useMemo", D(), N();
|
|
13375
|
-
var o = x.H;
|
|
13376
|
-
x.H = $o;
|
|
13377
|
-
try {
|
|
13378
|
-
return Vi(e, n);
|
|
13379
|
-
} finally {
|
|
13380
|
-
x.H = o;
|
|
12873
|
+
}, le.flushSyncWork = Ls, le.focusWithin = function(e, n) {
|
|
12874
|
+
if (!xr) throw Error("Test selector API is not supported by this renderer.");
|
|
12875
|
+
for (e = Ef(e), n = hh(e, n), n = Array.from(n), e = 0; e < n.length; ) {
|
|
12876
|
+
var o = n[e++], i = o.tag;
|
|
12877
|
+
if (!Kr(o)) {
|
|
12878
|
+
if ((i === 5 || i === 26 || i === 27) && Ft(o.stateNode)) return true;
|
|
12879
|
+
for (o = o.child; o !== null; ) n.push(o), o = o.sibling;
|
|
12880
|
+
}
|
|
13381
12881
|
}
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
12882
|
+
return false;
|
|
12883
|
+
}, le.getFindAllNodesFailureDescription = function(e, n) {
|
|
12884
|
+
if (!xr) throw Error("Test selector API is not supported by this renderer.");
|
|
12885
|
+
var o = 0, i = [];
|
|
12886
|
+
e = [Ef(e), 0];
|
|
12887
|
+
for (var s = 0; s < e.length; ) {
|
|
12888
|
+
var u = e[s++], f = u.tag, p = e[s++], g = n[p];
|
|
12889
|
+
if ((f !== 5 && f !== 26 && f !== 27 || !Kr(u)) && (If(u, g) && (i.push(Sc(g)), p++, p > o && (o = p)), p < n.length)) for (u = u.child; u !== null; ) e.push(u, p), u = u.sibling;
|
|
13390
12890
|
}
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
12891
|
+
if (o < n.length) {
|
|
12892
|
+
for (e = []; o < n.length; o++) e.push(Sc(n[o]));
|
|
12893
|
+
return `findAllNodes was able to match part of the selector:
|
|
12894
|
+
` + (i.join(" > ") + `
|
|
12895
|
+
|
|
12896
|
+
No matching component was found for:
|
|
12897
|
+
`) + e.join(" > ");
|
|
12898
|
+
}
|
|
12899
|
+
return null;
|
|
12900
|
+
}, le.getPublicRootInstance = function(e) {
|
|
12901
|
+
if (e = e.current, !e.child) return null;
|
|
12902
|
+
switch (e.child.tag) {
|
|
12903
|
+
case 27:
|
|
12904
|
+
case 5:
|
|
12905
|
+
return ot(e.child.stateNode);
|
|
12906
|
+
default:
|
|
12907
|
+
return e.child.stateNode;
|
|
12908
|
+
}
|
|
12909
|
+
}, le.injectIntoDevTools = function() {
|
|
12910
|
+
var e = { bundleType: 1, version: Jt, rendererPackageName: Zt, currentDispatcherRef: x, reconcilerVersion: "19.2.0" };
|
|
12911
|
+
return jo !== null && (e.rendererConfig = jo), e.overrideHookState = gb, e.overrideHookStateDeletePath = yb, e.overrideHookStateRenamePath = bb, e.overrideProps = vb, e.overridePropsDeletePath = Sb, e.overridePropsRenamePath = kb, e.scheduleUpdate = wb, e.scheduleRetry = Pb, e.setErrorHandler = xb, e.setSuspenseHandler = zb, e.scheduleRefresh = hu, e.scheduleRoot = Fl, e.setRefreshHandler = Ir, e.getCurrentFiber = Ic, Ep(e);
|
|
12912
|
+
}, le.isAlreadyRendering = Ns, le.observeVisibleRects = function(e, n, o, i) {
|
|
12913
|
+
function s() {
|
|
12914
|
+
var S = kc(e, n);
|
|
12915
|
+
u.forEach(function(T) {
|
|
12916
|
+
0 > S.indexOf(T) && g(T);
|
|
12917
|
+
}), S.forEach(function(T) {
|
|
12918
|
+
0 > u.indexOf(T) && p(T);
|
|
12919
|
+
});
|
|
12920
|
+
}
|
|
12921
|
+
if (!xr) throw Error("Test selector API is not supported by this renderer.");
|
|
12922
|
+
var u = kc(e, n);
|
|
12923
|
+
o = zr(u, o, i);
|
|
12924
|
+
var f = o.disconnect, p = o.observe, g = o.unobserve;
|
|
12925
|
+
return bm.push(s), { disconnect: function() {
|
|
12926
|
+
var S = bm.indexOf(s);
|
|
12927
|
+
0 <= S && bm.splice(S, 1), f();
|
|
12928
|
+
} };
|
|
12929
|
+
}, le.shouldError = function(e) {
|
|
12930
|
+
return pu(e);
|
|
12931
|
+
}, le.shouldSuspend = function(e) {
|
|
12932
|
+
return fu(e);
|
|
12933
|
+
}, le.startHostTransition = function(e, n, o, i) {
|
|
12934
|
+
if (e.tag !== 5) throw Error("Expected the form instance to be a HostComponent. This is a bug in React.");
|
|
12935
|
+
var s = uf(e).queue;
|
|
12936
|
+
Hp(e), nt(e, s, n, Xt, o === null ? Em : function() {
|
|
12937
|
+
x.T === null && console.error("requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition.");
|
|
12938
|
+
var u = uf(e);
|
|
12939
|
+
return u.next === null && (u = e.alternate.memoizedState), qi(e, u.next.queue, {}, Nt(e)), o(i);
|
|
12940
|
+
});
|
|
12941
|
+
}, le.updateContainer = function(e, n, o, i) {
|
|
12942
|
+
var s = n.current, u = Nt(s);
|
|
12943
|
+
return As(s, u, e, n, o, i), u;
|
|
12944
|
+
}, le.updateContainerSync = Wh, le;
|
|
12945
|
+
}, Tt.exports.default = Tt.exports, Object.defineProperty(Tt.exports, "__esModule", { value: true }));
|
|
12946
|
+
})(Mg)), Mg.exports;
|
|
12947
|
+
}
|
|
12948
|
+
var Eb;
|
|
12949
|
+
function n0() {
|
|
12950
|
+
return Eb || (Eb = 1, process.env.NODE_ENV === "production" ? Rm.exports = Kb() : Rm.exports = e0()), Rm.exports;
|
|
12951
|
+
}
|
|
12952
|
+
var t0 = n0();
|
|
12953
|
+
const r0 = Xb(t0);
|
|
12954
|
+
|
|
12955
|
+
const DEFAULT_POINTER_ID = 0;
|
|
12956
|
+
const XR_POINTER_ID_START = 1e3;
|
|
12957
|
+
function getPointerState(internal, pointerId) {
|
|
12958
|
+
let state = internal.pointerMap.get(pointerId);
|
|
12959
|
+
if (!state) {
|
|
12960
|
+
state = {
|
|
12961
|
+
hovered: /* @__PURE__ */ new Map(),
|
|
12962
|
+
captured: /* @__PURE__ */ new Map(),
|
|
12963
|
+
initialClick: [0, 0],
|
|
12964
|
+
initialHits: []
|
|
12965
|
+
};
|
|
12966
|
+
internal.pointerMap.set(pointerId, state);
|
|
12967
|
+
}
|
|
12968
|
+
return state;
|
|
12969
|
+
}
|
|
12970
|
+
function getPointerId(event) {
|
|
12971
|
+
return "pointerId" in event ? event.pointerId : DEFAULT_POINTER_ID;
|
|
12972
|
+
}
|
|
12973
|
+
function makeId(event) {
|
|
12974
|
+
return (event.eventObject || event.object).uuid + "/" + event.index + event.instanceId;
|
|
12975
|
+
}
|
|
12976
|
+
function releaseInternalPointerCapture(internal, obj, pointerId) {
|
|
12977
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
12978
|
+
if (!pointerState) return;
|
|
12979
|
+
const captureData = pointerState.captured.get(obj);
|
|
12980
|
+
if (captureData) {
|
|
12981
|
+
pointerState.captured.delete(obj);
|
|
12982
|
+
captureData.target.releasePointerCapture(pointerId);
|
|
12983
|
+
}
|
|
12984
|
+
}
|
|
12985
|
+
function swapInteractivity(store, object, newObject) {
|
|
12986
|
+
const { internal } = store.getState();
|
|
12987
|
+
for (let i = 0; i < internal.interaction.length; i++) {
|
|
12988
|
+
if (internal.interaction[i] === object) internal.interaction[i] = newObject;
|
|
12989
|
+
}
|
|
12990
|
+
for (const pointerState of internal.pointerMap.values()) {
|
|
12991
|
+
for (let i = 0; i < pointerState.initialHits.length; i++) {
|
|
12992
|
+
if (pointerState.initialHits[i] === object) pointerState.initialHits[i] = newObject;
|
|
12993
|
+
}
|
|
12994
|
+
pointerState.hovered.forEach((value, key) => {
|
|
12995
|
+
if (value.eventObject === object || value.object === object) {
|
|
12996
|
+
pointerState.hovered.delete(key);
|
|
12997
|
+
const next = {
|
|
12998
|
+
...value,
|
|
12999
|
+
eventObject: value.eventObject === object ? newObject : value.eventObject,
|
|
13000
|
+
object: value.object === object ? newObject : value.object
|
|
13001
|
+
};
|
|
13002
|
+
pointerState.hovered.set(makeId(next), next);
|
|
13003
|
+
}
|
|
13004
|
+
});
|
|
13005
|
+
const captureData = pointerState.captured.get(object);
|
|
13006
|
+
if (captureData) {
|
|
13007
|
+
pointerState.captured.delete(object);
|
|
13008
|
+
pointerState.captured.set(newObject, {
|
|
13009
|
+
...captureData,
|
|
13010
|
+
intersection: {
|
|
13011
|
+
...captureData.intersection,
|
|
13012
|
+
object: captureData.intersection.object === object ? newObject : captureData.intersection.object,
|
|
13013
|
+
eventObject: captureData.intersection.eventObject === object ? newObject : captureData.intersection.eventObject
|
|
13401
13014
|
}
|
|
13402
|
-
}
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
return z = "useActionState", D(), N(), $t(e);
|
|
13416
|
-
}, useOptimistic: function(e, n) {
|
|
13417
|
-
return z = "useOptimistic", D(), N(), of(e, n);
|
|
13418
|
-
}, useMemoCache: function(e) {
|
|
13419
|
-
return D(), Oa(e);
|
|
13420
|
-
}, useHostTransitionStatus: ia, useCacheRefresh: function() {
|
|
13421
|
-
return z = "useCacheRefresh", N(), xe().memoizedState;
|
|
13422
|
-
}, useEffectEvent: function(e) {
|
|
13423
|
-
return z = "useEffectEvent", D(), N(), oa(e);
|
|
13424
|
-
} };
|
|
13425
|
-
var Fy = {}, Hy = /* @__PURE__ */ new Set(), Ay = /* @__PURE__ */ new Set(), jy = /* @__PURE__ */ new Set(), Dy = /* @__PURE__ */ new Set(), Wy = /* @__PURE__ */ new Set(), Uy = /* @__PURE__ */ new Set(), By = /* @__PURE__ */ new Set(), Oy = /* @__PURE__ */ new Set(), My = /* @__PURE__ */ new Set(), Qy = /* @__PURE__ */ new Set();
|
|
13426
|
-
Object.freeze(Fy);
|
|
13427
|
-
var zg = { enqueueSetState: function(e, n, o) {
|
|
13428
|
-
e = e._reactInternals;
|
|
13429
|
-
var i = Nt(e), s = zo(i);
|
|
13430
|
-
s.payload = n, o != null && (df(o), s.callback = o), n = Mt(e, s, i), n !== null && (ur(i, "this.setState()", e), We(n, e, i), Bi(n, e, i));
|
|
13431
|
-
}, enqueueReplaceState: function(e, n, o) {
|
|
13432
|
-
e = e._reactInternals;
|
|
13433
|
-
var i = Nt(e), s = zo(i);
|
|
13434
|
-
s.tag = Cy, s.payload = n, o != null && (df(o), s.callback = o), n = Mt(e, s, i), n !== null && (ur(i, "this.replaceState()", e), We(n, e, i), Bi(n, e, i));
|
|
13435
|
-
}, enqueueForceUpdate: function(e, n) {
|
|
13436
|
-
e = e._reactInternals;
|
|
13437
|
-
var o = Nt(e), i = zo(o);
|
|
13438
|
-
i.tag = Ty, n != null && (df(n), i.callback = n), n = Mt(e, i, o), n !== null && (ur(o, "this.forceUpdate()", e), We(n, e, o), Bi(n, e, o));
|
|
13439
|
-
} }, bd = null, Cg = null, Tg = Error("This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue."), Cn = false, $y = {}, Vy = {}, qy = {}, Gy = {}, vd = false, Jy = {}, fm = {}, _g = { dehydrated: null, treeContext: null, retryLane: 0, hydrationErrors: null }, Zy = false, Yy = null;
|
|
13440
|
-
Yy = /* @__PURE__ */ new Set();
|
|
13441
|
-
var Si = false, Tn = false, Rg = false, Xy = typeof WeakSet == "function" ? WeakSet : Set, Gn = null, Sd = null, kd = null, _n = null, nr = false, Vo = null, Wn = false, wd = 8192, Vb = { getCacheForType: function(e) {
|
|
13442
|
-
var n = Ee(un), o = n.data.get(e);
|
|
13443
|
-
return o === void 0 && (o = e(), n.data.set(e, o)), o;
|
|
13444
|
-
}, cacheSignal: function() {
|
|
13445
|
-
return Ee(un).controller.signal;
|
|
13446
|
-
}, getOwner: function() {
|
|
13447
|
-
return di;
|
|
13448
|
-
} }, pm = 0, hm = 1, mm = 2, gm = 3, ym = 4;
|
|
13449
|
-
if (typeof Symbol == "function" && Symbol.for) {
|
|
13450
|
-
var bp = Symbol.for;
|
|
13451
|
-
pm = bp("selector.component"), hm = bp("selector.has_pseudo_class"), mm = bp("selector.role"), gm = bp("selector.test_id"), ym = bp("selector.text");
|
|
13015
|
+
});
|
|
13016
|
+
}
|
|
13017
|
+
}
|
|
13018
|
+
unregisterVisibility(store, object);
|
|
13019
|
+
}
|
|
13020
|
+
function removeInteractivity(store, object) {
|
|
13021
|
+
const { internal } = store.getState();
|
|
13022
|
+
internal.interaction = internal.interaction.filter((o) => o !== object);
|
|
13023
|
+
for (const [pointerId, pointerState] of internal.pointerMap) {
|
|
13024
|
+
pointerState.initialHits = pointerState.initialHits.filter((o) => o !== object);
|
|
13025
|
+
pointerState.hovered.forEach((value, key) => {
|
|
13026
|
+
if (value.eventObject === object || value.object === object) {
|
|
13027
|
+
pointerState.hovered.delete(key);
|
|
13452
13028
|
}
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13029
|
+
});
|
|
13030
|
+
if (pointerState.captured.has(object)) {
|
|
13031
|
+
releaseInternalPointerCapture(internal, object, pointerId);
|
|
13032
|
+
}
|
|
13033
|
+
}
|
|
13034
|
+
unregisterVisibility(store, object);
|
|
13035
|
+
}
|
|
13036
|
+
function createEvents(store) {
|
|
13037
|
+
function calculateDistance(event, pointerId) {
|
|
13038
|
+
const { internal } = store.getState();
|
|
13039
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
13040
|
+
if (!pointerState) return 0;
|
|
13041
|
+
const [initialX, initialY] = pointerState.initialClick;
|
|
13042
|
+
const dx = event.offsetX - initialX;
|
|
13043
|
+
const dy = event.offsetY - initialY;
|
|
13044
|
+
return Math.round(Math.sqrt(dx * dx + dy * dy));
|
|
13045
|
+
}
|
|
13046
|
+
function filterPointerEvents(objects) {
|
|
13047
|
+
return objects.filter(
|
|
13048
|
+
(obj) => ["Move", "Over", "Enter", "Out", "Leave"].some(
|
|
13049
|
+
(name) => obj.__r3f?.handlers["onPointer" + name]
|
|
13050
|
+
) || ["OverEnter", "OverLeave", "Over"].some(
|
|
13051
|
+
(name) => obj.__r3f?.handlers["onDrag" + name]
|
|
13052
|
+
) || obj.__r3f?.handlers.onDrop
|
|
13053
|
+
);
|
|
13054
|
+
}
|
|
13055
|
+
function intersect(event, filter) {
|
|
13056
|
+
const state = store.getState();
|
|
13057
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
13058
|
+
const intersections = [];
|
|
13059
|
+
const eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;
|
|
13060
|
+
for (let i = 0; i < eventsObjects.length; i++) {
|
|
13061
|
+
const state2 = getRootState(eventsObjects[i]);
|
|
13062
|
+
if (state2) {
|
|
13063
|
+
state2.raycaster.camera = void 0;
|
|
13458
13064
|
}
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
}, zb = function(e) {
|
|
13481
|
-
fu = e;
|
|
13482
|
-
}, le.attemptContinuousHydration = function(e) {
|
|
13483
|
-
if (e.tag === 13 || e.tag === 31) {
|
|
13484
|
-
var n = On(e, 67108864);
|
|
13485
|
-
n !== null && We(n, e, 67108864), rl(e, 67108864);
|
|
13065
|
+
}
|
|
13066
|
+
if (!state.previousRoot) {
|
|
13067
|
+
state.events.compute?.(event, state);
|
|
13068
|
+
}
|
|
13069
|
+
function handleRaycast(obj) {
|
|
13070
|
+
const state2 = getRootState(obj);
|
|
13071
|
+
if (!state2 || !state2.events.enabled || state2.raycaster.camera === null) return [];
|
|
13072
|
+
if (state2.raycaster.camera === void 0) {
|
|
13073
|
+
state2.events.compute?.(event, state2, state2.previousRoot?.getState());
|
|
13074
|
+
if (state2.raycaster.camera === void 0) state2.raycaster.camera = null;
|
|
13075
|
+
}
|
|
13076
|
+
return state2.raycaster.camera ? state2.raycaster.intersectObject(obj, true) : [];
|
|
13077
|
+
}
|
|
13078
|
+
let hits = eventsObjects.flatMap(handleRaycast).sort((a, b) => {
|
|
13079
|
+
const aInteractivePriority = a.object.userData?.interactivePriority;
|
|
13080
|
+
const bInteractivePriority = b.object.userData?.interactivePriority;
|
|
13081
|
+
if (aInteractivePriority !== void 0 || bInteractivePriority !== void 0) {
|
|
13082
|
+
if (aInteractivePriority !== void 0 && bInteractivePriority === void 0) return -1;
|
|
13083
|
+
if (bInteractivePriority !== void 0 && aInteractivePriority === void 0) return 1;
|
|
13084
|
+
if (aInteractivePriority !== bInteractivePriority) {
|
|
13085
|
+
return (bInteractivePriority ?? 0) - (aInteractivePriority ?? 0);
|
|
13486
13086
|
}
|
|
13487
|
-
}
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13087
|
+
}
|
|
13088
|
+
const aState = getRootState(a.object);
|
|
13089
|
+
const bState = getRootState(b.object);
|
|
13090
|
+
const aPriority = aState?.events?.priority ?? 1;
|
|
13091
|
+
const bPriority = bState?.events?.priority ?? 1;
|
|
13092
|
+
return bPriority - aPriority || a.distance - b.distance;
|
|
13093
|
+
}).filter((item) => {
|
|
13094
|
+
const id = makeId(item);
|
|
13095
|
+
if (duplicates.has(id)) return false;
|
|
13096
|
+
duplicates.add(id);
|
|
13097
|
+
return true;
|
|
13098
|
+
});
|
|
13099
|
+
if (state.events.filter) hits = state.events.filter(hits, state);
|
|
13100
|
+
for (const hit of hits) {
|
|
13101
|
+
let eventObject = hit.object;
|
|
13102
|
+
while (eventObject) {
|
|
13103
|
+
if (eventObject.__r3f?.eventCount) {
|
|
13104
|
+
intersections.push({ ...hit, eventObject });
|
|
13493
13105
|
}
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13106
|
+
eventObject = eventObject.parent;
|
|
13107
|
+
}
|
|
13108
|
+
}
|
|
13109
|
+
if ("pointerId" in event) {
|
|
13110
|
+
const pointerId = event.pointerId;
|
|
13111
|
+
const pointerState = state.internal.pointerMap.get(pointerId);
|
|
13112
|
+
if (pointerState?.captured.size) {
|
|
13113
|
+
for (const captureData of pointerState.captured.values()) {
|
|
13114
|
+
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
13115
|
+
}
|
|
13116
|
+
}
|
|
13117
|
+
}
|
|
13118
|
+
return intersections;
|
|
13119
|
+
}
|
|
13120
|
+
function handleIntersects(intersections, event, delta, callback) {
|
|
13121
|
+
if (intersections.length) {
|
|
13122
|
+
const localState = { stopped: false };
|
|
13123
|
+
for (const hit of intersections) {
|
|
13124
|
+
const state = getRootState(hit.object);
|
|
13125
|
+
if (state) {
|
|
13126
|
+
const { raycaster, pointer, camera, internal } = state;
|
|
13127
|
+
const unprojectedPoint = new webgpu.Vector3(pointer.x, pointer.y, 0).unproject(camera);
|
|
13128
|
+
const hasPointerCapture = (id) => {
|
|
13129
|
+
const pointerState = internal.pointerMap.get(id);
|
|
13130
|
+
return pointerState?.captured.has(hit.eventObject) ?? false;
|
|
13131
|
+
};
|
|
13132
|
+
const setPointerCapture = (id) => {
|
|
13133
|
+
const captureData = { intersection: hit, target: event.target };
|
|
13134
|
+
const pointerState = getPointerState(internal, id);
|
|
13135
|
+
pointerState.captured.set(hit.eventObject, captureData);
|
|
13136
|
+
event.target.setPointerCapture(id);
|
|
13137
|
+
};
|
|
13138
|
+
const releasePointerCapture = (id) => {
|
|
13139
|
+
releaseInternalPointerCapture(internal, hit.eventObject, id);
|
|
13140
|
+
};
|
|
13141
|
+
const extractEventProps = {};
|
|
13142
|
+
for (const prop in event) {
|
|
13143
|
+
const property = event[prop];
|
|
13144
|
+
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
13145
|
+
}
|
|
13146
|
+
const eventPointerId = "pointerId" in event ? event.pointerId : void 0;
|
|
13147
|
+
const raycastEvent = {
|
|
13148
|
+
...hit,
|
|
13149
|
+
...extractEventProps,
|
|
13150
|
+
pointer,
|
|
13151
|
+
intersections,
|
|
13152
|
+
stopped: localState.stopped,
|
|
13153
|
+
delta,
|
|
13154
|
+
unprojectedPoint,
|
|
13155
|
+
ray: raycaster.ray,
|
|
13156
|
+
camera,
|
|
13157
|
+
pointerId: eventPointerId,
|
|
13158
|
+
// Hijack stopPropagation, which just sets a flag
|
|
13159
|
+
stopPropagation() {
|
|
13160
|
+
const pointerState = eventPointerId !== void 0 ? internal.pointerMap.get(eventPointerId) : void 0;
|
|
13161
|
+
if (
|
|
13162
|
+
// ...if this pointer hasn't been captured
|
|
13163
|
+
!pointerState?.captured.size || // ... or if the hit object is capturing the pointer
|
|
13164
|
+
pointerState.captured.has(hit.eventObject)
|
|
13165
|
+
) {
|
|
13166
|
+
raycastEvent.stopped = localState.stopped = true;
|
|
13167
|
+
if (pointerState?.hovered.size && Array.from(pointerState.hovered.values()).find((i) => i.eventObject === hit.eventObject)) {
|
|
13168
|
+
const higher = intersections.slice(0, intersections.indexOf(hit));
|
|
13169
|
+
cancelPointer([...higher, hit], eventPointerId);
|
|
13503
13170
|
}
|
|
13504
|
-
Kn(e), (ye & (Zn | uo)) === Jn && (Pp = me() + Fg, Wa(0));
|
|
13505
13171
|
}
|
|
13506
|
-
}
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13172
|
+
},
|
|
13173
|
+
// there should be a distinction between target and currentTarget
|
|
13174
|
+
target: { hasPointerCapture, setPointerCapture, releasePointerCapture },
|
|
13175
|
+
currentTarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },
|
|
13176
|
+
nativeEvent: event
|
|
13177
|
+
};
|
|
13178
|
+
callback(raycastEvent);
|
|
13179
|
+
if (localState.stopped === true) break;
|
|
13511
13180
|
}
|
|
13512
|
-
}
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13181
|
+
}
|
|
13182
|
+
}
|
|
13183
|
+
return intersections;
|
|
13184
|
+
}
|
|
13185
|
+
function cancelPointer(intersections, pointerId) {
|
|
13186
|
+
const { internal } = store.getState();
|
|
13187
|
+
const pid = pointerId ?? DEFAULT_POINTER_ID;
|
|
13188
|
+
const pointerState = internal.pointerMap.get(pid);
|
|
13189
|
+
if (!pointerState) return;
|
|
13190
|
+
for (const [hoveredId, hoveredObj] of pointerState.hovered) {
|
|
13191
|
+
if (!intersections.length || !intersections.find(
|
|
13192
|
+
(hit) => hit.object === hoveredObj.object && hit.index === hoveredObj.index && hit.instanceId === hoveredObj.instanceId
|
|
13193
|
+
)) {
|
|
13194
|
+
const eventObject = hoveredObj.eventObject;
|
|
13195
|
+
const instance = eventObject.__r3f;
|
|
13196
|
+
pointerState.hovered.delete(hoveredId);
|
|
13197
|
+
if (instance?.eventCount) {
|
|
13198
|
+
const handlers = instance.handlers;
|
|
13199
|
+
const data = { ...hoveredObj, intersections };
|
|
13200
|
+
handlers.onPointerOut?.(data);
|
|
13201
|
+
handlers.onPointerLeave?.(data);
|
|
13202
|
+
handlers.onDragOverLeave?.(data);
|
|
13529
13203
|
}
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
an(o), x.T = n;
|
|
13204
|
+
}
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
function pointerMissed(event, objects) {
|
|
13208
|
+
for (let i = 0; i < objects.length; i++) {
|
|
13209
|
+
const instance = objects[i].__r3f;
|
|
13210
|
+
instance?.handlers.onPointerMissed?.(event);
|
|
13211
|
+
}
|
|
13212
|
+
}
|
|
13213
|
+
function dragOverMissed(event, objects) {
|
|
13214
|
+
for (let i = 0; i < objects.length; i++) {
|
|
13215
|
+
const instance = objects[i].__r3f;
|
|
13216
|
+
instance?.handlers.onDragOverMissed?.(event);
|
|
13217
|
+
}
|
|
13218
|
+
}
|
|
13219
|
+
function dropMissed(event, objects) {
|
|
13220
|
+
for (let i = 0; i < objects.length; i++) {
|
|
13221
|
+
const instance = objects[i].__r3f;
|
|
13222
|
+
instance?.handlers.onDropMissed?.(event);
|
|
13223
|
+
}
|
|
13224
|
+
}
|
|
13225
|
+
function cleanupPointer(pointerId) {
|
|
13226
|
+
const { internal } = store.getState();
|
|
13227
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
13228
|
+
if (pointerState) {
|
|
13229
|
+
for (const [, hoveredObj] of pointerState.hovered) {
|
|
13230
|
+
const eventObject = hoveredObj.eventObject;
|
|
13231
|
+
const instance = eventObject.__r3f;
|
|
13232
|
+
if (instance?.eventCount) {
|
|
13233
|
+
const handlers = instance.handlers;
|
|
13234
|
+
const data = { ...hoveredObj, intersections: [] };
|
|
13235
|
+
handlers.onPointerOut?.(data);
|
|
13236
|
+
handlers.onPointerLeave?.(data);
|
|
13564
13237
|
}
|
|
13565
|
-
}
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13238
|
+
}
|
|
13239
|
+
internal.pointerMap.delete(pointerId);
|
|
13240
|
+
}
|
|
13241
|
+
internal.pointerDirty.delete(pointerId);
|
|
13242
|
+
}
|
|
13243
|
+
function processDeferredPointer(event, pointerId) {
|
|
13244
|
+
const state = store.getState();
|
|
13245
|
+
const { internal } = state;
|
|
13246
|
+
if (!state.events.enabled) return;
|
|
13247
|
+
const filter = filterPointerEvents;
|
|
13248
|
+
const hits = intersect(event, filter);
|
|
13249
|
+
cancelPointer(hits, pointerId);
|
|
13250
|
+
function onIntersect(data) {
|
|
13251
|
+
const eventObject = data.eventObject;
|
|
13252
|
+
const instance = eventObject.__r3f;
|
|
13253
|
+
if (!instance?.eventCount) return;
|
|
13254
|
+
const handlers = instance.handlers;
|
|
13255
|
+
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
13256
|
+
const id = makeId(data);
|
|
13257
|
+
const pointerState = getPointerState(internal, pointerId);
|
|
13258
|
+
const hoveredItem = pointerState.hovered.get(id);
|
|
13259
|
+
if (!hoveredItem) {
|
|
13260
|
+
pointerState.hovered.set(id, data);
|
|
13261
|
+
handlers.onPointerOver?.(data);
|
|
13262
|
+
handlers.onPointerEnter?.(data);
|
|
13263
|
+
} else if (hoveredItem.stopped) {
|
|
13264
|
+
data.stopPropagation();
|
|
13265
|
+
}
|
|
13266
|
+
}
|
|
13267
|
+
handlers.onPointerMove?.(data);
|
|
13268
|
+
}
|
|
13269
|
+
handleIntersects(hits, event, 0, onIntersect);
|
|
13270
|
+
}
|
|
13271
|
+
function handlePointer(name) {
|
|
13272
|
+
switch (name) {
|
|
13273
|
+
case "onPointerLeave":
|
|
13274
|
+
case "onDragLeave":
|
|
13275
|
+
return () => cancelPointer([]);
|
|
13276
|
+
// Global cancel of these events
|
|
13277
|
+
case "onPointerCancel":
|
|
13278
|
+
return (event) => {
|
|
13279
|
+
const pointerId = getPointerId(event);
|
|
13280
|
+
cleanupPointer(pointerId);
|
|
13281
|
+
};
|
|
13282
|
+
case "onLostPointerCapture":
|
|
13283
|
+
return (event) => {
|
|
13284
|
+
const { internal } = store.getState();
|
|
13285
|
+
const pointerId = getPointerId(event);
|
|
13286
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
13287
|
+
if (pointerState?.captured.size) {
|
|
13288
|
+
requestAnimationFrame(() => {
|
|
13289
|
+
const pointerState2 = internal.pointerMap.get(pointerId);
|
|
13290
|
+
if (pointerState2?.captured.size) {
|
|
13291
|
+
pointerState2.captured.clear();
|
|
13292
|
+
}
|
|
13293
|
+
cancelPointer([], pointerId);
|
|
13294
|
+
});
|
|
13295
|
+
}
|
|
13296
|
+
};
|
|
13297
|
+
}
|
|
13298
|
+
return function handleEvent(event) {
|
|
13299
|
+
const state = store.getState();
|
|
13300
|
+
const { onPointerMissed, onDragOverMissed, onDropMissed, internal, events } = state;
|
|
13301
|
+
const pointerId = getPointerId(event);
|
|
13302
|
+
internal.lastEvent.current = event;
|
|
13303
|
+
if (!events.enabled) return;
|
|
13304
|
+
const isPointerMove = name === "onPointerMove";
|
|
13305
|
+
const isDragOver = name === "onDragOver";
|
|
13306
|
+
const isDrop = name === "onDrop";
|
|
13307
|
+
const isClickEvent = name === "onClick" || name === "onContextMenu" || name === "onDoubleClick";
|
|
13308
|
+
const isPointerDown = name === "onPointerDown";
|
|
13309
|
+
const isPointerUp = name === "onPointerUp";
|
|
13310
|
+
const isWheel = name === "onWheel";
|
|
13311
|
+
const canDeferRaycasts = events.frameTimedRaycasts && state.frameloop === "always";
|
|
13312
|
+
if (isPointerMove && canDeferRaycasts) {
|
|
13313
|
+
events.compute?.(event, state);
|
|
13314
|
+
internal.pointerDirty.set(pointerId, event);
|
|
13315
|
+
return;
|
|
13316
|
+
}
|
|
13317
|
+
if (isWheel && canDeferRaycasts && !events.alwaysFireOnScroll) {
|
|
13318
|
+
events.compute?.(event, state);
|
|
13319
|
+
internal.pointerDirty.set(pointerId, event);
|
|
13320
|
+
return;
|
|
13321
|
+
}
|
|
13322
|
+
if ((isClickEvent || isPointerDown || isPointerUp) && internal.pointerDirty.has(pointerId)) {
|
|
13323
|
+
const deferredEvent = internal.pointerDirty.get(pointerId);
|
|
13324
|
+
internal.pointerDirty.delete(pointerId);
|
|
13325
|
+
processDeferredPointer(deferredEvent, pointerId);
|
|
13326
|
+
}
|
|
13327
|
+
const filter = isPointerMove || isDragOver || isDrop ? filterPointerEvents : void 0;
|
|
13328
|
+
const hits = intersect(event, filter);
|
|
13329
|
+
const delta = isClickEvent ? calculateDistance(event, pointerId) : 0;
|
|
13330
|
+
if (isPointerDown) {
|
|
13331
|
+
const pointerState2 = getPointerState(internal, pointerId);
|
|
13332
|
+
pointerState2.initialClick = [event.offsetX, event.offsetY];
|
|
13333
|
+
pointerState2.initialHits = hits.map((hit) => hit.eventObject);
|
|
13334
|
+
}
|
|
13335
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
13336
|
+
const initialHits = pointerState?.initialHits ?? [];
|
|
13337
|
+
if (isClickEvent && !hits.length) {
|
|
13338
|
+
if (delta <= 2) {
|
|
13339
|
+
pointerMissed(event, internal.interaction);
|
|
13340
|
+
if (onPointerMissed) onPointerMissed(event);
|
|
13571
13341
|
}
|
|
13572
|
-
}
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13342
|
+
}
|
|
13343
|
+
if (isDragOver && !hits.length) {
|
|
13344
|
+
dragOverMissed(event, internal.interaction);
|
|
13345
|
+
if (onDragOverMissed) onDragOverMissed(event);
|
|
13346
|
+
}
|
|
13347
|
+
if (isDrop && !hits.length) {
|
|
13348
|
+
dropMissed(event, internal.interaction);
|
|
13349
|
+
if (onDropMissed) onDropMissed(event);
|
|
13350
|
+
}
|
|
13351
|
+
if (isPointerMove || isDragOver) {
|
|
13352
|
+
cancelPointer(hits, pointerId);
|
|
13353
|
+
}
|
|
13354
|
+
function onIntersect(data) {
|
|
13355
|
+
const eventObject = data.eventObject;
|
|
13356
|
+
const instance = eventObject.__r3f;
|
|
13357
|
+
if (!instance?.eventCount) return;
|
|
13358
|
+
const handlers = instance.handlers;
|
|
13359
|
+
if (isPointerMove) {
|
|
13360
|
+
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
13361
|
+
const id = makeId(data);
|
|
13362
|
+
const pointerState2 = getPointerState(internal, pointerId);
|
|
13363
|
+
const hoveredItem = pointerState2.hovered.get(id);
|
|
13364
|
+
if (!hoveredItem) {
|
|
13365
|
+
pointerState2.hovered.set(id, data);
|
|
13366
|
+
handlers.onPointerOver?.(data);
|
|
13367
|
+
handlers.onPointerEnter?.(data);
|
|
13368
|
+
} else if (hoveredItem.stopped) {
|
|
13369
|
+
data.stopPropagation();
|
|
13591
13370
|
}
|
|
13592
13371
|
}
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
if (
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
var o = n[e++], i = o.tag;
|
|
13625
|
-
if (!Kr(o)) {
|
|
13626
|
-
if ((i === 5 || i === 26 || i === 27) && Ft(o.stateNode)) return true;
|
|
13627
|
-
for (o = o.child; o !== null; ) n.push(o), o = o.sibling;
|
|
13372
|
+
handlers.onPointerMove?.(data);
|
|
13373
|
+
} else if (isDragOver) {
|
|
13374
|
+
const id = makeId(data);
|
|
13375
|
+
const pointerState2 = getPointerState(internal, pointerId);
|
|
13376
|
+
const hoveredItem = pointerState2.hovered.get(id);
|
|
13377
|
+
if (!hoveredItem) {
|
|
13378
|
+
pointerState2.hovered.set(id, data);
|
|
13379
|
+
handlers.onDragOverEnter?.(data);
|
|
13380
|
+
} else if (hoveredItem.stopped) {
|
|
13381
|
+
data.stopPropagation();
|
|
13382
|
+
}
|
|
13383
|
+
handlers.onDragOver?.(data);
|
|
13384
|
+
} else if (isDrop) {
|
|
13385
|
+
handlers.onDrop?.(data);
|
|
13386
|
+
} else {
|
|
13387
|
+
const handler = handlers[name];
|
|
13388
|
+
if (handler) {
|
|
13389
|
+
if (!isClickEvent || initialHits.includes(eventObject)) {
|
|
13390
|
+
pointerMissed(
|
|
13391
|
+
event,
|
|
13392
|
+
internal.interaction.filter((object) => !initialHits.includes(object))
|
|
13393
|
+
);
|
|
13394
|
+
handler(data);
|
|
13395
|
+
}
|
|
13396
|
+
} else {
|
|
13397
|
+
if (isClickEvent && initialHits.includes(eventObject)) {
|
|
13398
|
+
pointerMissed(
|
|
13399
|
+
event,
|
|
13400
|
+
internal.interaction.filter((object) => !initialHits.includes(object))
|
|
13401
|
+
);
|
|
13402
|
+
}
|
|
13628
13403
|
}
|
|
13629
13404
|
}
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13405
|
+
}
|
|
13406
|
+
handleIntersects(hits, event, delta, onIntersect);
|
|
13407
|
+
};
|
|
13408
|
+
}
|
|
13409
|
+
function flushDeferredPointers() {
|
|
13410
|
+
const { internal, events } = store.getState();
|
|
13411
|
+
if (!events.frameTimedRaycasts) return;
|
|
13412
|
+
for (const [pointerId, event] of internal.pointerDirty) {
|
|
13413
|
+
processDeferredPointer(event, pointerId);
|
|
13414
|
+
}
|
|
13415
|
+
internal.pointerDirty.clear();
|
|
13416
|
+
}
|
|
13417
|
+
return { handlePointer, flushDeferredPointers, processDeferredPointer };
|
|
13418
|
+
}
|
|
13419
|
+
const DOM_EVENTS = {
|
|
13420
|
+
onClick: ["click", false],
|
|
13421
|
+
onContextMenu: ["contextmenu", false],
|
|
13422
|
+
onDoubleClick: ["dblclick", false],
|
|
13423
|
+
onDragEnter: ["dragenter", false],
|
|
13424
|
+
onDragLeave: ["dragleave", false],
|
|
13425
|
+
onDragOver: ["dragover", false],
|
|
13426
|
+
onDrop: ["drop", false],
|
|
13427
|
+
onWheel: ["wheel", true],
|
|
13428
|
+
onPointerDown: ["pointerdown", true],
|
|
13429
|
+
onPointerUp: ["pointerup", true],
|
|
13430
|
+
onPointerLeave: ["pointerleave", true],
|
|
13431
|
+
onPointerMove: ["pointermove", true],
|
|
13432
|
+
onPointerCancel: ["pointercancel", true],
|
|
13433
|
+
onLostPointerCapture: ["lostpointercapture", true]
|
|
13434
|
+
};
|
|
13435
|
+
function createPointerEvents(store) {
|
|
13436
|
+
const { handlePointer, flushDeferredPointers, processDeferredPointer } = createEvents(store);
|
|
13437
|
+
let nextXRPointerId = XR_POINTER_ID_START;
|
|
13438
|
+
const xrPointers = /* @__PURE__ */ new Map();
|
|
13439
|
+
return {
|
|
13440
|
+
priority: 1,
|
|
13441
|
+
enabled: true,
|
|
13442
|
+
frameTimedRaycasts: true,
|
|
13443
|
+
alwaysFireOnScroll: true,
|
|
13444
|
+
updateOnFrame: false,
|
|
13445
|
+
compute(event, state) {
|
|
13446
|
+
state.pointer.set(event.offsetX / state.size.width * 2 - 1, -(event.offsetY / state.size.height) * 2 + 1);
|
|
13447
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
13448
|
+
},
|
|
13449
|
+
connected: void 0,
|
|
13450
|
+
handlers: Object.keys(DOM_EVENTS).reduce(
|
|
13451
|
+
(acc, key) => ({ ...acc, [key]: handlePointer(key) }),
|
|
13452
|
+
{}
|
|
13453
|
+
),
|
|
13454
|
+
update: (pointerId) => {
|
|
13455
|
+
const { events, internal } = store.getState();
|
|
13456
|
+
if (!events.handlers) return;
|
|
13457
|
+
if (pointerId !== void 0) {
|
|
13458
|
+
const event = internal.pointerDirty.get(pointerId);
|
|
13459
|
+
if (event) {
|
|
13460
|
+
internal.pointerDirty.delete(pointerId);
|
|
13461
|
+
processDeferredPointer(event, pointerId);
|
|
13462
|
+
} else if (internal.lastEvent?.current) {
|
|
13463
|
+
processDeferredPointer(internal.lastEvent.current, pointerId);
|
|
13638
13464
|
}
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
No matching component was found for:
|
|
13645
|
-
`) + e.join(" > ");
|
|
13465
|
+
} else {
|
|
13466
|
+
flushDeferredPointers();
|
|
13467
|
+
if (internal.lastEvent?.current) {
|
|
13468
|
+
events.handlers.onPointerMove(internal.lastEvent.current);
|
|
13646
13469
|
}
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13470
|
+
}
|
|
13471
|
+
},
|
|
13472
|
+
flush: () => {
|
|
13473
|
+
const { events, internal } = store.getState();
|
|
13474
|
+
flushDeferredPointers();
|
|
13475
|
+
if (events.updateOnFrame && internal.lastEvent?.current && events.handlers) {
|
|
13476
|
+
events.handlers.onPointerMove(internal.lastEvent.current);
|
|
13477
|
+
}
|
|
13478
|
+
},
|
|
13479
|
+
connect: (target) => {
|
|
13480
|
+
if (!target) return;
|
|
13481
|
+
const { set, events } = store.getState();
|
|
13482
|
+
events.disconnect?.();
|
|
13483
|
+
set((state) => ({ events: { ...state.events, connected: target } }));
|
|
13484
|
+
if (events.handlers) {
|
|
13485
|
+
for (const name in events.handlers) {
|
|
13486
|
+
const event = events.handlers[name];
|
|
13487
|
+
const [eventName, passive] = DOM_EVENTS[name];
|
|
13488
|
+
target.addEventListener(eventName, event, { passive });
|
|
13656
13489
|
}
|
|
13657
|
-
}
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
}
|
|
13490
|
+
}
|
|
13491
|
+
},
|
|
13492
|
+
disconnect: () => {
|
|
13493
|
+
const { set, events } = store.getState();
|
|
13494
|
+
if (events.connected) {
|
|
13495
|
+
if (events.handlers) {
|
|
13496
|
+
for (const name in events.handlers) {
|
|
13497
|
+
const event = events.handlers[name];
|
|
13498
|
+
const [eventName] = DOM_EVENTS[name];
|
|
13499
|
+
events.connected.removeEventListener(eventName, event);
|
|
13500
|
+
}
|
|
13668
13501
|
}
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13502
|
+
set((state) => ({ events: { ...state.events, connected: void 0 } }));
|
|
13503
|
+
}
|
|
13504
|
+
},
|
|
13505
|
+
// PREVIEW (A8): the XR pointer registration API may change before stable.
|
|
13506
|
+
registerPointer: (config) => {
|
|
13507
|
+
const pointerId = nextXRPointerId++;
|
|
13508
|
+
xrPointers.set(pointerId, config);
|
|
13509
|
+
const { internal } = store.getState();
|
|
13510
|
+
getPointerState(internal, pointerId);
|
|
13511
|
+
return pointerId;
|
|
13512
|
+
},
|
|
13513
|
+
unregisterPointer: (pointerId) => {
|
|
13514
|
+
xrPointers.delete(pointerId);
|
|
13515
|
+
const { internal } = store.getState();
|
|
13516
|
+
const pointerState = internal.pointerMap.get(pointerId);
|
|
13517
|
+
if (pointerState) {
|
|
13518
|
+
for (const [, hoveredObj] of pointerState.hovered) {
|
|
13519
|
+
const eventObject = hoveredObj.eventObject;
|
|
13520
|
+
const instance = eventObject.__r3f;
|
|
13521
|
+
if (instance?.eventCount) {
|
|
13522
|
+
const handlers = instance.handlers;
|
|
13523
|
+
const data = { ...hoveredObj, intersections: [] };
|
|
13524
|
+
handlers.onPointerOut?.(data);
|
|
13525
|
+
handlers.onPointerLeave?.(data);
|
|
13526
|
+
}
|
|
13527
|
+
}
|
|
13528
|
+
internal.pointerMap.delete(pointerId);
|
|
13529
|
+
}
|
|
13530
|
+
internal.pointerDirty.delete(pointerId);
|
|
13531
|
+
}
|
|
13532
|
+
};
|
|
13699
13533
|
}
|
|
13700
|
-
var t0 = n0();
|
|
13701
|
-
const r0 = Xb(t0);
|
|
13702
|
-
|
|
13703
|
-
const t = 1, o = 8, r = 32, e = 2;
|
|
13704
13534
|
|
|
13705
13535
|
function createReconciler(config) {
|
|
13706
13536
|
const reconciler2 = r0(config);
|
|
@@ -13865,7 +13695,15 @@ function setFiberRef(fiber, publicInstance) {
|
|
|
13865
13695
|
}
|
|
13866
13696
|
}
|
|
13867
13697
|
const reconstructed = [];
|
|
13868
|
-
function
|
|
13698
|
+
function flushReconstructedInstances() {
|
|
13699
|
+
if (reconstructed.length === 0) return;
|
|
13700
|
+
try {
|
|
13701
|
+
swapReconstructedInstances();
|
|
13702
|
+
} finally {
|
|
13703
|
+
reconstructed.length = 0;
|
|
13704
|
+
}
|
|
13705
|
+
}
|
|
13706
|
+
function swapReconstructedInstances() {
|
|
13869
13707
|
for (const [instance] of reconstructed) {
|
|
13870
13708
|
const parent = instance.parent;
|
|
13871
13709
|
if (parent) {
|
|
@@ -13883,7 +13721,9 @@ function swapInstances() {
|
|
|
13883
13721
|
}
|
|
13884
13722
|
}
|
|
13885
13723
|
if (instance.isHidden) unhideInstance(instance);
|
|
13886
|
-
if (isObject3D(instance.object)
|
|
13724
|
+
if (isObject3D(instance.object) && !instance.parent) {
|
|
13725
|
+
removeInteractivity(findInitialRoot(instance), instance.object);
|
|
13726
|
+
}
|
|
13887
13727
|
if (instance.object.__r3f) delete instance.object.__r3f;
|
|
13888
13728
|
if (instance.type !== "primitive") disposeOnIdle(instance.object);
|
|
13889
13729
|
}
|
|
@@ -13892,9 +13732,13 @@ function swapInstances() {
|
|
|
13892
13732
|
const parent = instance.parent;
|
|
13893
13733
|
if (parent) {
|
|
13894
13734
|
const target = catalogue[toPascalCase(instance.type)];
|
|
13735
|
+
const prevObject = instance.object;
|
|
13895
13736
|
instance.object = instance.props.object ?? new target(...instance.props.args ?? []);
|
|
13896
13737
|
instance.object.__r3f = instance;
|
|
13897
13738
|
setFiberRef(fiber, instance.object);
|
|
13739
|
+
if (isObject3D(prevObject) && isObject3D(instance.object)) {
|
|
13740
|
+
swapInteractivity(findInitialRoot(instance), prevObject, instance.object);
|
|
13741
|
+
}
|
|
13898
13742
|
delete instance.appliedOnce;
|
|
13899
13743
|
instance.eventCount = 0;
|
|
13900
13744
|
instance.handlers = {};
|
|
@@ -13914,14 +13758,114 @@ function swapInstances() {
|
|
|
13914
13758
|
invalidateInstance(instance);
|
|
13915
13759
|
}
|
|
13916
13760
|
}
|
|
13917
|
-
reconstructed.length = 0;
|
|
13918
13761
|
}
|
|
13919
13762
|
const handleTextInstance = () => {
|
|
13920
13763
|
};
|
|
13921
13764
|
const NO_CONTEXT = {};
|
|
13922
13765
|
let currentUpdatePriority = NoEventPriority;
|
|
13923
|
-
|
|
13924
|
-
|
|
13766
|
+
function getEventPriority(type) {
|
|
13767
|
+
switch (type) {
|
|
13768
|
+
case "beforetoggle":
|
|
13769
|
+
case "cancel":
|
|
13770
|
+
case "click":
|
|
13771
|
+
case "close":
|
|
13772
|
+
case "contextmenu":
|
|
13773
|
+
case "copy":
|
|
13774
|
+
case "cut":
|
|
13775
|
+
case "auxclick":
|
|
13776
|
+
case "dblclick":
|
|
13777
|
+
case "dragend":
|
|
13778
|
+
case "dragstart":
|
|
13779
|
+
case "drop":
|
|
13780
|
+
case "focusin":
|
|
13781
|
+
case "focusout":
|
|
13782
|
+
case "input":
|
|
13783
|
+
case "invalid":
|
|
13784
|
+
case "keydown":
|
|
13785
|
+
case "keypress":
|
|
13786
|
+
case "keyup":
|
|
13787
|
+
case "mousedown":
|
|
13788
|
+
case "mouseup":
|
|
13789
|
+
case "paste":
|
|
13790
|
+
case "pause":
|
|
13791
|
+
case "play":
|
|
13792
|
+
case "pointercancel":
|
|
13793
|
+
case "pointerdown":
|
|
13794
|
+
case "pointerup":
|
|
13795
|
+
case "ratechange":
|
|
13796
|
+
case "reset":
|
|
13797
|
+
case "resize":
|
|
13798
|
+
case "seeked":
|
|
13799
|
+
case "submit":
|
|
13800
|
+
case "touchcancel":
|
|
13801
|
+
case "touchend":
|
|
13802
|
+
case "touchstart":
|
|
13803
|
+
case "volumechange":
|
|
13804
|
+
case "change":
|
|
13805
|
+
case "selectionchange":
|
|
13806
|
+
case "compositionstart":
|
|
13807
|
+
case "compositionend":
|
|
13808
|
+
case "compositionupdate":
|
|
13809
|
+
case "beforeinput":
|
|
13810
|
+
case "blur":
|
|
13811
|
+
case "fullscreenchange":
|
|
13812
|
+
case "focus":
|
|
13813
|
+
case "hashchange":
|
|
13814
|
+
case "popstate":
|
|
13815
|
+
case "select":
|
|
13816
|
+
case "selectstart":
|
|
13817
|
+
return e;
|
|
13818
|
+
case "drag":
|
|
13819
|
+
case "dragenter":
|
|
13820
|
+
case "dragexit":
|
|
13821
|
+
case "dragleave":
|
|
13822
|
+
case "dragover":
|
|
13823
|
+
case "mousemove":
|
|
13824
|
+
case "mouseout":
|
|
13825
|
+
case "mouseover":
|
|
13826
|
+
case "pointermove":
|
|
13827
|
+
case "pointerout":
|
|
13828
|
+
case "pointerover":
|
|
13829
|
+
case "scroll":
|
|
13830
|
+
case "touchmove":
|
|
13831
|
+
case "wheel":
|
|
13832
|
+
case "mouseenter":
|
|
13833
|
+
case "mouseleave":
|
|
13834
|
+
case "pointerenter":
|
|
13835
|
+
case "pointerleave":
|
|
13836
|
+
return o;
|
|
13837
|
+
case "message": {
|
|
13838
|
+
switch (Tb.unstable_getCurrentPriorityLevel()) {
|
|
13839
|
+
case Tb.unstable_ImmediatePriority:
|
|
13840
|
+
return e;
|
|
13841
|
+
case Tb.unstable_UserBlockingPriority:
|
|
13842
|
+
return o;
|
|
13843
|
+
case Tb.unstable_NormalPriority:
|
|
13844
|
+
case Tb.unstable_LowPriority:
|
|
13845
|
+
return r;
|
|
13846
|
+
case Tb.unstable_IdlePriority:
|
|
13847
|
+
return i$1;
|
|
13848
|
+
default:
|
|
13849
|
+
return r;
|
|
13850
|
+
}
|
|
13851
|
+
}
|
|
13852
|
+
default:
|
|
13853
|
+
return r;
|
|
13854
|
+
}
|
|
13855
|
+
}
|
|
13856
|
+
function scheduleMicrotask(callback) {
|
|
13857
|
+
if (typeof queueMicrotask === "function") {
|
|
13858
|
+
queueMicrotask(callback);
|
|
13859
|
+
} else if (typeof Promise !== "undefined") {
|
|
13860
|
+
Promise.resolve().then(callback).catch((error) => {
|
|
13861
|
+
setTimeout(() => {
|
|
13862
|
+
throw error;
|
|
13863
|
+
});
|
|
13864
|
+
});
|
|
13865
|
+
} else {
|
|
13866
|
+
setTimeout(callback);
|
|
13867
|
+
}
|
|
13868
|
+
}
|
|
13925
13869
|
const reconciler = /* @__PURE__ */ createReconciler({
|
|
13926
13870
|
isPrimaryRenderer: false,
|
|
13927
13871
|
warnsIfNotActing: false,
|
|
@@ -13960,16 +13904,15 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13960
13904
|
else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
|
|
13961
13905
|
else if (newProps.args?.some((value, index) => value !== oldProps.args?.[index])) reconstruct = true;
|
|
13962
13906
|
if (reconstruct) {
|
|
13963
|
-
reconstructed.push([instance,
|
|
13907
|
+
reconstructed.push([instance, getInstanceProps(newProps), fiber]);
|
|
13964
13908
|
} else {
|
|
13965
13909
|
const changedProps = diffProps(instance, newProps);
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13910
|
+
const attach2 = instance.props.attach;
|
|
13911
|
+
instance.props = getInstanceProps(newProps);
|
|
13912
|
+
if (attach2 !== void 0) instance.props.attach = attach2;
|
|
13913
|
+
else delete instance.props.attach;
|
|
13914
|
+
if (Object.keys(changedProps).length) applyProps(instance.object, changedProps);
|
|
13970
13915
|
}
|
|
13971
|
-
const isTailSibling = fiber.sibling === null || (fiber.flags & Update) === NoFlags;
|
|
13972
|
-
if (isTailSibling) swapInstances();
|
|
13973
13916
|
},
|
|
13974
13917
|
finalizeInitialChildren: (instance) => {
|
|
13975
13918
|
for (const prop in instance.props) {
|
|
@@ -13994,8 +13937,9 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
13994
13937
|
const target = container.getState().internal.container ?? container.getState().scene;
|
|
13995
13938
|
return prepare(target, container, "", {});
|
|
13996
13939
|
},
|
|
13997
|
-
|
|
13998
|
-
|
|
13940
|
+
// Reconstructed instances are swapped once all mutations are committed,
|
|
13941
|
+
// before layout effects run so refs point to the new objects
|
|
13942
|
+
resetAfterCommit: flushReconstructedInstances,
|
|
13999
13943
|
shouldSetTextContent: () => false,
|
|
14000
13944
|
clearContainer: () => false,
|
|
14001
13945
|
hideInstance,
|
|
@@ -14003,6 +13947,9 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
14003
13947
|
createTextInstance: handleTextInstance,
|
|
14004
13948
|
hideTextInstance: handleTextInstance,
|
|
14005
13949
|
unhideTextInstance: handleTextInstance,
|
|
13950
|
+
// Mirrors react-dom, which flushes discrete work in microtasks
|
|
13951
|
+
supportsMicrotasks: true,
|
|
13952
|
+
scheduleMicrotask,
|
|
14006
13953
|
scheduleTimeout: typeof setTimeout === "function" ? setTimeout : void 0,
|
|
14007
13954
|
cancelTimeout: typeof clearTimeout === "function" ? clearTimeout : void 0,
|
|
14008
13955
|
noTimeout: -1,
|
|
@@ -14043,28 +13990,9 @@ const reconciler = /* @__PURE__ */ createReconciler({
|
|
|
14043
13990
|
},
|
|
14044
13991
|
resolveUpdatePriority() {
|
|
14045
13992
|
if (currentUpdatePriority !== NoEventPriority) return currentUpdatePriority;
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
case "dblclick":
|
|
14050
|
-
case "dragenter":
|
|
14051
|
-
case "dragleave":
|
|
14052
|
-
case "drop":
|
|
14053
|
-
case "pointercancel":
|
|
14054
|
-
case "pointerdown":
|
|
14055
|
-
case "pointerup":
|
|
14056
|
-
return e;
|
|
14057
|
-
case "dragover":
|
|
14058
|
-
case "pointermove":
|
|
14059
|
-
case "pointerout":
|
|
14060
|
-
case "pointerover":
|
|
14061
|
-
case "pointerenter":
|
|
14062
|
-
case "pointerleave":
|
|
14063
|
-
case "wheel":
|
|
14064
|
-
return o;
|
|
14065
|
-
default:
|
|
14066
|
-
return r;
|
|
14067
|
-
}
|
|
13993
|
+
const eventType = typeof window !== "undefined" ? window.event?.type : void 0;
|
|
13994
|
+
if (eventType === void 0) return r;
|
|
13995
|
+
return getEventPriority(eventType);
|
|
14068
13996
|
},
|
|
14069
13997
|
resetFormInstance() {
|
|
14070
13998
|
},
|
|
@@ -14658,7 +14586,8 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
14658
14586
|
dispose(state.scene);
|
|
14659
14587
|
_roots.delete(canvas);
|
|
14660
14588
|
if (callback) callback(canvas);
|
|
14661
|
-
} catch {
|
|
14589
|
+
} catch (error) {
|
|
14590
|
+
console.warn("[R3F] Error while unmounting root; teardown may be incomplete:", error);
|
|
14662
14591
|
}
|
|
14663
14592
|
}, 500);
|
|
14664
14593
|
}
|
|
@@ -14765,8 +14694,214 @@ function PortalInner({ state = {}, children, container }) {
|
|
|
14765
14694
|
) })
|
|
14766
14695
|
);
|
|
14767
14696
|
}
|
|
14768
|
-
function flushSync(fn) {
|
|
14769
|
-
return reconciler.flushSyncFromReconciler(fn);
|
|
14697
|
+
function flushSync(fn) {
|
|
14698
|
+
return reconciler.flushSyncFromReconciler(fn);
|
|
14699
|
+
}
|
|
14700
|
+
|
|
14701
|
+
const isRef = (obj) => obj.current && obj.current.isScene;
|
|
14702
|
+
const resolveScene = (scene) => isRef(scene) ? scene.current : scene;
|
|
14703
|
+
function setEnvProps(background, scene, defaultScene, texture, sceneProps = {}) {
|
|
14704
|
+
sceneProps = {
|
|
14705
|
+
backgroundBlurriness: 0,
|
|
14706
|
+
backgroundIntensity: 1,
|
|
14707
|
+
backgroundRotation: [0, 0, 0],
|
|
14708
|
+
environmentIntensity: 1,
|
|
14709
|
+
environmentRotation: [0, 0, 0],
|
|
14710
|
+
...sceneProps
|
|
14711
|
+
};
|
|
14712
|
+
const target = resolveScene(scene || defaultScene);
|
|
14713
|
+
const oldbg = target.background;
|
|
14714
|
+
const oldenv = target.environment;
|
|
14715
|
+
const oldSceneProps = {
|
|
14716
|
+
// @ts-ignore
|
|
14717
|
+
backgroundBlurriness: target.backgroundBlurriness,
|
|
14718
|
+
// @ts-ignore
|
|
14719
|
+
backgroundIntensity: target.backgroundIntensity,
|
|
14720
|
+
// @ts-ignore
|
|
14721
|
+
backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
|
|
14722
|
+
// @ts-ignore
|
|
14723
|
+
environmentIntensity: target.environmentIntensity,
|
|
14724
|
+
// @ts-ignore
|
|
14725
|
+
environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
|
|
14726
|
+
};
|
|
14727
|
+
if (background !== "only") target.environment = texture;
|
|
14728
|
+
if (background) target.background = texture;
|
|
14729
|
+
applyProps(target, sceneProps);
|
|
14730
|
+
return () => {
|
|
14731
|
+
if (background !== "only") target.environment = oldenv;
|
|
14732
|
+
if (background) target.background = oldbg;
|
|
14733
|
+
applyProps(target, oldSceneProps);
|
|
14734
|
+
};
|
|
14735
|
+
}
|
|
14736
|
+
function EnvironmentMap({ scene, background = false, map, ...config }) {
|
|
14737
|
+
const defaultScene = useThree((state) => state.scene);
|
|
14738
|
+
React__namespace.useLayoutEffect(() => {
|
|
14739
|
+
if (map) return setEnvProps(background, scene, defaultScene, map, config);
|
|
14740
|
+
});
|
|
14741
|
+
return null;
|
|
14742
|
+
}
|
|
14743
|
+
function EnvironmentCube({
|
|
14744
|
+
background = false,
|
|
14745
|
+
scene,
|
|
14746
|
+
blur,
|
|
14747
|
+
backgroundBlurriness,
|
|
14748
|
+
backgroundIntensity,
|
|
14749
|
+
backgroundRotation,
|
|
14750
|
+
environmentIntensity,
|
|
14751
|
+
environmentRotation,
|
|
14752
|
+
...rest
|
|
14753
|
+
}) {
|
|
14754
|
+
const texture = useEnvironment(rest);
|
|
14755
|
+
const defaultScene = useThree((state) => state.scene);
|
|
14756
|
+
React__namespace.useLayoutEffect(() => {
|
|
14757
|
+
return setEnvProps(background, scene, defaultScene, texture, {
|
|
14758
|
+
backgroundBlurriness: blur ?? backgroundBlurriness,
|
|
14759
|
+
backgroundIntensity,
|
|
14760
|
+
backgroundRotation,
|
|
14761
|
+
environmentIntensity,
|
|
14762
|
+
environmentRotation
|
|
14763
|
+
});
|
|
14764
|
+
});
|
|
14765
|
+
React__namespace.useEffect(() => {
|
|
14766
|
+
return () => {
|
|
14767
|
+
texture.dispose();
|
|
14768
|
+
};
|
|
14769
|
+
}, [texture]);
|
|
14770
|
+
return null;
|
|
14771
|
+
}
|
|
14772
|
+
function EnvironmentPortal({
|
|
14773
|
+
children,
|
|
14774
|
+
near = 0.1,
|
|
14775
|
+
far = 1e3,
|
|
14776
|
+
resolution = 256,
|
|
14777
|
+
frames = 1,
|
|
14778
|
+
map,
|
|
14779
|
+
background = false,
|
|
14780
|
+
blur,
|
|
14781
|
+
backgroundBlurriness,
|
|
14782
|
+
backgroundIntensity,
|
|
14783
|
+
backgroundRotation,
|
|
14784
|
+
environmentIntensity,
|
|
14785
|
+
environmentRotation,
|
|
14786
|
+
scene,
|
|
14787
|
+
files,
|
|
14788
|
+
path,
|
|
14789
|
+
preset = void 0,
|
|
14790
|
+
extensions
|
|
14791
|
+
}) {
|
|
14792
|
+
const renderer = useThree((state) => state.renderer);
|
|
14793
|
+
const isLegacy = useThree((state) => state.isLegacy);
|
|
14794
|
+
const defaultScene = useThree((state) => state.scene);
|
|
14795
|
+
const camera = React__namespace.useRef(null);
|
|
14796
|
+
const [virtualScene] = React__namespace.useState(() => new webgpu.Scene());
|
|
14797
|
+
const fbo = React__namespace.useMemo(() => {
|
|
14798
|
+
const fbo2 = isLegacy ? new WebGLCubeRenderTarget(resolution) : new webgpu.CubeRenderTarget(resolution);
|
|
14799
|
+
fbo2.texture.type = webgpu.HalfFloatType;
|
|
14800
|
+
return fbo2;
|
|
14801
|
+
}, [resolution, isLegacy]);
|
|
14802
|
+
React__namespace.useEffect(() => {
|
|
14803
|
+
return () => {
|
|
14804
|
+
fbo.dispose();
|
|
14805
|
+
};
|
|
14806
|
+
}, [fbo]);
|
|
14807
|
+
React__namespace.useLayoutEffect(() => {
|
|
14808
|
+
if (frames === 1) {
|
|
14809
|
+
const autoClear = renderer.autoClear;
|
|
14810
|
+
renderer.autoClear = true;
|
|
14811
|
+
camera.current.update(renderer, virtualScene);
|
|
14812
|
+
renderer.autoClear = autoClear;
|
|
14813
|
+
}
|
|
14814
|
+
return setEnvProps(background, scene, defaultScene, fbo.texture, {
|
|
14815
|
+
backgroundBlurriness: blur ?? backgroundBlurriness,
|
|
14816
|
+
backgroundIntensity,
|
|
14817
|
+
backgroundRotation,
|
|
14818
|
+
environmentIntensity,
|
|
14819
|
+
environmentRotation
|
|
14820
|
+
});
|
|
14821
|
+
}, [
|
|
14822
|
+
children,
|
|
14823
|
+
virtualScene,
|
|
14824
|
+
fbo.texture,
|
|
14825
|
+
scene,
|
|
14826
|
+
defaultScene,
|
|
14827
|
+
background,
|
|
14828
|
+
frames,
|
|
14829
|
+
renderer,
|
|
14830
|
+
blur,
|
|
14831
|
+
backgroundBlurriness,
|
|
14832
|
+
backgroundIntensity,
|
|
14833
|
+
backgroundRotation,
|
|
14834
|
+
environmentIntensity,
|
|
14835
|
+
environmentRotation
|
|
14836
|
+
]);
|
|
14837
|
+
let count = 1;
|
|
14838
|
+
useFrame(() => {
|
|
14839
|
+
if (frames === Infinity || count < frames) {
|
|
14840
|
+
const autoClear = renderer.autoClear;
|
|
14841
|
+
renderer.autoClear = true;
|
|
14842
|
+
camera.current.update(renderer, virtualScene);
|
|
14843
|
+
renderer.autoClear = autoClear;
|
|
14844
|
+
count++;
|
|
14845
|
+
}
|
|
14846
|
+
});
|
|
14847
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: createPortal(
|
|
14848
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14849
|
+
children,
|
|
14850
|
+
/* @__PURE__ */ jsxRuntime.jsx("cubeCamera", { ref: camera, args: [near, far, fbo] }),
|
|
14851
|
+
files || preset ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { background: true, files, preset, path, extensions }) : map ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentMap, { background: true, map, extensions }) : null
|
|
14852
|
+
] }),
|
|
14853
|
+
virtualScene
|
|
14854
|
+
) });
|
|
14855
|
+
}
|
|
14856
|
+
function EnvironmentGround(props) {
|
|
14857
|
+
const textureDefault = useEnvironment(props);
|
|
14858
|
+
const texture = props.map || textureDefault;
|
|
14859
|
+
React__namespace.useMemo(() => extend({ GroundProjectedEnvImpl: GroundedSkybox_js.GroundedSkybox }), []);
|
|
14860
|
+
React__namespace.useEffect(() => {
|
|
14861
|
+
return () => {
|
|
14862
|
+
textureDefault.dispose();
|
|
14863
|
+
};
|
|
14864
|
+
}, [textureDefault]);
|
|
14865
|
+
const height = props.ground?.height ?? 15;
|
|
14866
|
+
const radius = props.ground?.radius ?? 60;
|
|
14867
|
+
const scale = props.ground?.scale ?? 1e3;
|
|
14868
|
+
const args = React__namespace.useMemo(
|
|
14869
|
+
() => [texture, height, radius],
|
|
14870
|
+
[texture, height, radius]
|
|
14871
|
+
);
|
|
14872
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14873
|
+
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentMap, { ...props, map: texture }),
|
|
14874
|
+
/* @__PURE__ */ jsxRuntime.jsx("groundProjectedEnvImpl", { args, scale })
|
|
14875
|
+
] });
|
|
14876
|
+
}
|
|
14877
|
+
function EnvironmentColor({ color, scene }) {
|
|
14878
|
+
const defaultScene = useThree((state) => state.scene);
|
|
14879
|
+
React__namespace.useLayoutEffect(() => {
|
|
14880
|
+
if (color === void 0) return;
|
|
14881
|
+
const target = resolveScene(scene || defaultScene);
|
|
14882
|
+
const oldBg = target.background;
|
|
14883
|
+
target.background = new webgpu.Color(color);
|
|
14884
|
+
return () => {
|
|
14885
|
+
target.background = oldBg;
|
|
14886
|
+
};
|
|
14887
|
+
});
|
|
14888
|
+
return null;
|
|
14889
|
+
}
|
|
14890
|
+
function EnvironmentDualSource(props) {
|
|
14891
|
+
const { backgroundFiles, ...envProps } = props;
|
|
14892
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14893
|
+
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...envProps, background: false }),
|
|
14894
|
+
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...props, files: backgroundFiles, background: "only" })
|
|
14895
|
+
] });
|
|
14896
|
+
}
|
|
14897
|
+
function Environment(props) {
|
|
14898
|
+
if (props.color && !props.files && !props.preset && !props.map) {
|
|
14899
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EnvironmentColor, { ...props });
|
|
14900
|
+
}
|
|
14901
|
+
if (props.backgroundFiles && props.backgroundFiles !== props.files) {
|
|
14902
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EnvironmentDualSource, { ...props });
|
|
14903
|
+
}
|
|
14904
|
+
return props.ground ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentGround, { ...props }) : props.map ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentMap, { ...props }) : props.children ? /* @__PURE__ */ jsxRuntime.jsx(EnvironmentPortal, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...props });
|
|
14770
14905
|
}
|
|
14771
14906
|
|
|
14772
14907
|
function parseBackground(background) {
|
|
@@ -14812,14 +14947,133 @@ function parseRendererConfig(rendererProp) {
|
|
|
14812
14947
|
return { primaryCanvas: void 0, scheduler: void 0, renderer: rendererProp };
|
|
14813
14948
|
}
|
|
14814
14949
|
|
|
14950
|
+
const RESOURCE_KINDS = ["nodes", "uniforms", "buffers", "gpuStorage"];
|
|
14951
|
+
const ROOT_SCOPE = "";
|
|
14952
|
+
const registries = /* @__PURE__ */ new WeakMap();
|
|
14953
|
+
function getKindRegistry(store, kind) {
|
|
14954
|
+
let registry = registries.get(store);
|
|
14955
|
+
if (!registry) {
|
|
14956
|
+
registry = {
|
|
14957
|
+
nodes: { valid: /* @__PURE__ */ new Set(), staged: /* @__PURE__ */ new Map() },
|
|
14958
|
+
uniforms: { valid: /* @__PURE__ */ new Set(), staged: /* @__PURE__ */ new Map() },
|
|
14959
|
+
buffers: { valid: /* @__PURE__ */ new Set(), staged: /* @__PURE__ */ new Map() },
|
|
14960
|
+
gpuStorage: { valid: /* @__PURE__ */ new Set(), staged: /* @__PURE__ */ new Map() }
|
|
14961
|
+
};
|
|
14962
|
+
registries.set(store, registry);
|
|
14963
|
+
}
|
|
14964
|
+
return registry[kind];
|
|
14965
|
+
}
|
|
14966
|
+
function resolvePrimary$1(store) {
|
|
14967
|
+
return store.getState().primaryStore ?? store;
|
|
14968
|
+
}
|
|
14969
|
+
function isScopeValid(store, kind, scopeKey) {
|
|
14970
|
+
return getKindRegistry(store, kind).valid.has(scopeKey);
|
|
14971
|
+
}
|
|
14972
|
+
function peekStaged(store, kind, scopeKey) {
|
|
14973
|
+
return getKindRegistry(store, kind).staged.get(scopeKey);
|
|
14974
|
+
}
|
|
14975
|
+
function stageEntries(store, kind, scopeKey, entries) {
|
|
14976
|
+
const { staged } = getKindRegistry(store, kind);
|
|
14977
|
+
const current = staged.get(scopeKey);
|
|
14978
|
+
if (current) Object.assign(current, entries);
|
|
14979
|
+
else staged.set(scopeKey, { ...entries });
|
|
14980
|
+
}
|
|
14981
|
+
function readCommittedScope(map, scopeKey, isLeaf) {
|
|
14982
|
+
if (scopeKey === ROOT_SCOPE) {
|
|
14983
|
+
const leaves = {};
|
|
14984
|
+
for (const [key, value] of Object.entries(map)) if (isLeaf(value)) leaves[key] = value;
|
|
14985
|
+
return leaves;
|
|
14986
|
+
}
|
|
14987
|
+
const scopeData = map[scopeKey];
|
|
14988
|
+
if (scopeData && typeof scopeData === "object" && !isLeaf(scopeData)) return scopeData;
|
|
14989
|
+
return {};
|
|
14990
|
+
}
|
|
14991
|
+
function withStagedOverlay(store, kind, committed) {
|
|
14992
|
+
const { staged } = getKindRegistry(store, kind);
|
|
14993
|
+
if (staged.size === 0) return committed;
|
|
14994
|
+
const view = { ...committed };
|
|
14995
|
+
for (const [scopeKey, entries] of staged) {
|
|
14996
|
+
if (scopeKey === ROOT_SCOPE) Object.assign(view, entries);
|
|
14997
|
+
else view[scopeKey] = { ...view[scopeKey], ...entries };
|
|
14998
|
+
}
|
|
14999
|
+
return view;
|
|
15000
|
+
}
|
|
15001
|
+
function flushStagedScope(store, kind, scopeKey, isLeaf) {
|
|
15002
|
+
const registry = getKindRegistry(store, kind);
|
|
15003
|
+
const staged = registry.staged.get(scopeKey);
|
|
15004
|
+
if (!staged) return;
|
|
15005
|
+
registry.staged.delete(scopeKey);
|
|
15006
|
+
const replace = !registry.valid.has(scopeKey);
|
|
15007
|
+
store.setState((state) => {
|
|
15008
|
+
const map = state[kind];
|
|
15009
|
+
if (scopeKey === ROOT_SCOPE) {
|
|
15010
|
+
if (!replace) return { [kind]: { ...map, ...staged } };
|
|
15011
|
+
const next = {};
|
|
15012
|
+
for (const [key, value] of Object.entries(map)) if (!isLeaf(value)) next[key] = value;
|
|
15013
|
+
return { [kind]: { ...next, ...staged } };
|
|
15014
|
+
}
|
|
15015
|
+
const current = replace ? {} : map[scopeKey] ?? {};
|
|
15016
|
+
return { [kind]: { ...map, [scopeKey]: { ...current, ...staged } } };
|
|
15017
|
+
});
|
|
15018
|
+
registry.valid.add(scopeKey);
|
|
15019
|
+
}
|
|
15020
|
+
function invalidateResource(store, kind, scopeKey) {
|
|
15021
|
+
const registry = getKindRegistry(store, kind);
|
|
15022
|
+
if (scopeKey === void 0) {
|
|
15023
|
+
registry.valid.clear();
|
|
15024
|
+
registry.staged.clear();
|
|
15025
|
+
} else {
|
|
15026
|
+
registry.valid.delete(scopeKey);
|
|
15027
|
+
registry.staged.delete(scopeKey);
|
|
15028
|
+
}
|
|
15029
|
+
}
|
|
15030
|
+
function rebuildResource(store, kind, userScope) {
|
|
15031
|
+
const primary = resolvePrimary$1(store);
|
|
15032
|
+
invalidateResource(primary, kind, userScope === "root" ? ROOT_SCOPE : userScope);
|
|
15033
|
+
primary.setState((state) => ({ _hmrVersion: state._hmrVersion + 1 }));
|
|
15034
|
+
}
|
|
15035
|
+
function invalidateAllResources(store) {
|
|
15036
|
+
for (const kind of RESOURCE_KINDS) invalidateResource(store, kind);
|
|
15037
|
+
}
|
|
15038
|
+
function removeResourceEntries(store, kind, names, scope, isLeaf) {
|
|
15039
|
+
const staged = peekStaged(store, kind, scope ?? ROOT_SCOPE);
|
|
15040
|
+
if (staged) for (const name of names) delete staged[name];
|
|
15041
|
+
store.setState((state) => {
|
|
15042
|
+
const map = state[kind];
|
|
15043
|
+
if (scope) {
|
|
15044
|
+
const currentScope = { ...map[scope] };
|
|
15045
|
+
for (const name of names) delete currentScope[name];
|
|
15046
|
+
return { [kind]: { ...map, [scope]: currentScope } };
|
|
15047
|
+
}
|
|
15048
|
+
const next = { ...map };
|
|
15049
|
+
for (const name of names) if (isLeaf(next[name])) delete next[name];
|
|
15050
|
+
return { [kind]: next };
|
|
15051
|
+
});
|
|
15052
|
+
}
|
|
15053
|
+
function clearResourceEntries(store, kind, scope, isLeaf) {
|
|
15054
|
+
const registry = getKindRegistry(store, kind);
|
|
15055
|
+
if (scope && scope !== "root") registry.staged.delete(scope);
|
|
15056
|
+
else if (scope === "root") registry.staged.delete(ROOT_SCOPE);
|
|
15057
|
+
else registry.staged.clear();
|
|
15058
|
+
store.setState((state) => {
|
|
15059
|
+
const map = state[kind];
|
|
15060
|
+
if (scope && scope !== "root") {
|
|
15061
|
+
const { [scope]: _, ...rest } = map;
|
|
15062
|
+
return { [kind]: rest };
|
|
15063
|
+
}
|
|
15064
|
+
if (scope === "root") {
|
|
15065
|
+
const next = {};
|
|
15066
|
+
for (const [key, value] of Object.entries(map)) if (!isLeaf(value)) next[key] = value;
|
|
15067
|
+
return { [kind]: next };
|
|
15068
|
+
}
|
|
15069
|
+
return { [kind]: {} };
|
|
15070
|
+
});
|
|
15071
|
+
}
|
|
15072
|
+
|
|
14815
15073
|
function clearHmrCaches(store) {
|
|
14816
|
-
store.
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
buffers: {},
|
|
14820
|
-
gpuStorage: {},
|
|
14821
|
-
_hmrVersion: state._hmrVersion + 1
|
|
14822
|
-
}));
|
|
15074
|
+
const primary = store.getState().primaryStore ?? store;
|
|
15075
|
+
invalidateAllResources(primary);
|
|
15076
|
+
primary.setState((state) => ({ _hmrVersion: state._hmrVersion + 1 }));
|
|
14823
15077
|
}
|
|
14824
15078
|
|
|
14825
15079
|
function CanvasImpl({
|
|
@@ -14956,7 +15210,7 @@ function CanvasImpl({
|
|
|
14956
15210
|
onDropMissed: (...args) => handleDropMissed.current?.(...args),
|
|
14957
15211
|
onCreated: (state) => {
|
|
14958
15212
|
state.events.connect?.(
|
|
14959
|
-
eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current
|
|
15213
|
+
eventSource ? isRef$1(eventSource) ? eventSource.current : eventSource : divRef.current
|
|
14960
15214
|
);
|
|
14961
15215
|
if (eventPrefix) {
|
|
14962
15216
|
state.setEvents({
|
|
@@ -15132,30 +15386,31 @@ let ScopedStore = _ScopedStore;
|
|
|
15132
15386
|
function createScopedStore(data) {
|
|
15133
15387
|
return new ScopedStore(data);
|
|
15134
15388
|
}
|
|
15135
|
-
function createLazyCreatorState(state) {
|
|
15389
|
+
function createLazyCreatorState(state, store) {
|
|
15136
15390
|
let _uniforms = null;
|
|
15137
15391
|
let _nodes = null;
|
|
15138
15392
|
let _buffers = null;
|
|
15139
15393
|
let _gpuStorage = null;
|
|
15394
|
+
const view = (kind) => store ? withStagedOverlay(store, kind, state[kind]) : state[kind];
|
|
15140
15395
|
return Object.create(state, {
|
|
15141
15396
|
uniforms: {
|
|
15142
15397
|
get() {
|
|
15143
|
-
return _uniforms ?? (_uniforms = createScopedStore(
|
|
15398
|
+
return _uniforms ?? (_uniforms = createScopedStore(view("uniforms")));
|
|
15144
15399
|
}
|
|
15145
15400
|
},
|
|
15146
15401
|
nodes: {
|
|
15147
15402
|
get() {
|
|
15148
|
-
return _nodes ?? (_nodes = createScopedStore(
|
|
15403
|
+
return _nodes ?? (_nodes = createScopedStore(view("nodes")));
|
|
15149
15404
|
}
|
|
15150
15405
|
},
|
|
15151
15406
|
buffers: {
|
|
15152
15407
|
get() {
|
|
15153
|
-
return _buffers ?? (_buffers = createScopedStore(
|
|
15408
|
+
return _buffers ?? (_buffers = createScopedStore(view("buffers")));
|
|
15154
15409
|
}
|
|
15155
15410
|
},
|
|
15156
15411
|
gpuStorage: {
|
|
15157
15412
|
get() {
|
|
15158
|
-
return _gpuStorage ?? (_gpuStorage = createScopedStore(
|
|
15413
|
+
return _gpuStorage ?? (_gpuStorage = createScopedStore(view("gpuStorage")));
|
|
15159
15414
|
}
|
|
15160
15415
|
}
|
|
15161
15416
|
});
|
|
@@ -15278,65 +15533,56 @@ function useCompareMemoize(value, deep) {
|
|
|
15278
15533
|
return ref.current;
|
|
15279
15534
|
}
|
|
15280
15535
|
|
|
15536
|
+
function useScopedResource(options) {
|
|
15537
|
+
const { store, kind, scope, isLeaf, create, prepare, reconcile, input } = options;
|
|
15538
|
+
const scopeKey = scope ?? ROOT_SCOPE;
|
|
15539
|
+
const version = store((s) => s._hmrVersion);
|
|
15540
|
+
const entries = React.useMemo(() => {
|
|
15541
|
+
const staged = peekStaged(store, kind, scopeKey);
|
|
15542
|
+
const reusable = isScopeValid(store, kind, scopeKey);
|
|
15543
|
+
const map = store.getState()[kind];
|
|
15544
|
+
const committed = reusable ? readCommittedScope(map, scopeKey, isLeaf) : void 0;
|
|
15545
|
+
const result = {};
|
|
15546
|
+
let fresh = null;
|
|
15547
|
+
for (const [name, candidate] of Object.entries(create())) {
|
|
15548
|
+
const existing = staged?.[name] ?? committed?.[name];
|
|
15549
|
+
if (existing !== void 0) {
|
|
15550
|
+
result[name] = existing;
|
|
15551
|
+
reconcile?.(existing, candidate);
|
|
15552
|
+
} else {
|
|
15553
|
+
const value = prepare ? prepare(name, candidate) : candidate;
|
|
15554
|
+
result[name] = value;
|
|
15555
|
+
(fresh ?? (fresh = {}))[name] = value;
|
|
15556
|
+
}
|
|
15557
|
+
}
|
|
15558
|
+
if (fresh) stageEntries(store, kind, scopeKey, fresh);
|
|
15559
|
+
return result;
|
|
15560
|
+
}, [store, kind, scopeKey, version, input]);
|
|
15561
|
+
useIsomorphicLayoutEffect(() => {
|
|
15562
|
+
flushStagedScope(store, kind, scopeKey, isLeaf);
|
|
15563
|
+
});
|
|
15564
|
+
return entries;
|
|
15565
|
+
}
|
|
15566
|
+
|
|
15281
15567
|
const isUniformNode$1 = (value) => value !== null && typeof value === "object" && "value" in value && "uuid" in value;
|
|
15282
15568
|
function useUniforms(creatorOrScope, scope) {
|
|
15283
15569
|
const store = usePrimaryStore();
|
|
15284
15570
|
const removeUniforms2 = React.useCallback(
|
|
15285
|
-
(names, targetScope) =>
|
|
15286
|
-
const nameArray = Array.isArray(names) ? names : [names];
|
|
15287
|
-
store.setState((state) => {
|
|
15288
|
-
if (targetScope) {
|
|
15289
|
-
const currentScope = { ...state.uniforms[targetScope] };
|
|
15290
|
-
for (const name of nameArray) delete currentScope[name];
|
|
15291
|
-
return { uniforms: { ...state.uniforms, [targetScope]: currentScope } };
|
|
15292
|
-
}
|
|
15293
|
-
const uniforms2 = { ...state.uniforms };
|
|
15294
|
-
for (const name of nameArray) if (isUniformNode$1(uniforms2[name])) delete uniforms2[name];
|
|
15295
|
-
return { uniforms: uniforms2 };
|
|
15296
|
-
});
|
|
15297
|
-
},
|
|
15571
|
+
(names, targetScope) => removeResourceEntries(store, "uniforms", Array.isArray(names) ? names : [names], targetScope, isUniformNode$1),
|
|
15298
15572
|
[store]
|
|
15299
15573
|
);
|
|
15300
15574
|
const clearUniforms = React.useCallback(
|
|
15301
|
-
(targetScope) =>
|
|
15302
|
-
store.setState((state) => {
|
|
15303
|
-
if (targetScope && targetScope !== "root") {
|
|
15304
|
-
const { [targetScope]: _, ...rest } = state.uniforms;
|
|
15305
|
-
return { uniforms: rest };
|
|
15306
|
-
}
|
|
15307
|
-
if (targetScope === "root") {
|
|
15308
|
-
const uniforms2 = {};
|
|
15309
|
-
for (const [key, value] of Object.entries(state.uniforms)) {
|
|
15310
|
-
if (!isUniformNode$1(value)) uniforms2[key] = value;
|
|
15311
|
-
}
|
|
15312
|
-
return { uniforms: uniforms2 };
|
|
15313
|
-
}
|
|
15314
|
-
return { uniforms: {} };
|
|
15315
|
-
});
|
|
15316
|
-
},
|
|
15575
|
+
(targetScope) => clearResourceEntries(store, "uniforms", targetScope, isUniformNode$1),
|
|
15317
15576
|
[store]
|
|
15318
15577
|
);
|
|
15319
15578
|
const rebuildUniforms = React.useCallback(
|
|
15320
|
-
(targetScope) =>
|
|
15321
|
-
store.setState((state) => {
|
|
15322
|
-
let newUniforms = {};
|
|
15323
|
-
if (targetScope && targetScope !== "root") {
|
|
15324
|
-
const { [targetScope]: _, ...rest } = state.uniforms;
|
|
15325
|
-
newUniforms = rest;
|
|
15326
|
-
} else if (targetScope === "root") {
|
|
15327
|
-
for (const [key, value] of Object.entries(state.uniforms)) {
|
|
15328
|
-
if (!isUniformNode$1(value)) newUniforms[key] = value;
|
|
15329
|
-
}
|
|
15330
|
-
}
|
|
15331
|
-
return { uniforms: newUniforms, _hmrVersion: state._hmrVersion + 1 };
|
|
15332
|
-
});
|
|
15333
|
-
},
|
|
15579
|
+
(targetScope) => rebuildResource(store, "uniforms", targetScope),
|
|
15334
15580
|
[store]
|
|
15335
15581
|
);
|
|
15336
15582
|
const inputForMemoization = React.useMemo(() => {
|
|
15337
15583
|
let raw = creatorOrScope;
|
|
15338
15584
|
if (is.fun(creatorOrScope)) {
|
|
15339
|
-
const wrappedState = createLazyCreatorState(store.getState());
|
|
15585
|
+
const wrappedState = createLazyCreatorState(store.getState(), store);
|
|
15340
15586
|
raw = creatorOrScope(wrappedState);
|
|
15341
15587
|
}
|
|
15342
15588
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
@@ -15351,80 +15597,43 @@ function useUniforms(creatorOrScope, scope) {
|
|
|
15351
15597
|
const memoizedInput = useCompareMemoize(inputForMemoization);
|
|
15352
15598
|
const isReader = memoizedInput === void 0 || typeof memoizedInput === "string";
|
|
15353
15599
|
const storeUniforms = usePrimaryThree((s) => s.uniforms);
|
|
15354
|
-
const
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
}
|
|
15379
|
-
for (const [name, node] of Object.entries(created)) {
|
|
15380
|
-
if (targetRecord[name]) {
|
|
15381
|
-
result[name] = targetRecord[name];
|
|
15382
|
-
const existingVal = result[name].value;
|
|
15383
|
-
const newVal = vectorize(node);
|
|
15384
|
-
let equals = newVal === existingVal;
|
|
15385
|
-
if (!equals && hasEqualsMethod(existingVal) && hasEqualsMethod(newVal)) {
|
|
15386
|
-
if (isThreeVector(existingVal) && isThreeVector(newVal)) {
|
|
15387
|
-
equals = vectorEquals(existingVal, newVal);
|
|
15388
|
-
} else if (isSameThreeType(existingVal, newVal)) {
|
|
15389
|
-
equals = existingVal.equals(newVal);
|
|
15390
|
-
}
|
|
15391
|
-
}
|
|
15392
|
-
if (!equals) result[name].value = newVal;
|
|
15393
|
-
} else {
|
|
15394
|
-
result[name] = createUniform(name, node, scope);
|
|
15395
|
-
hasNewUniforms = true;
|
|
15396
|
-
}
|
|
15397
|
-
}
|
|
15398
|
-
if (hasNewUniforms) {
|
|
15399
|
-
if (scope) {
|
|
15400
|
-
set((s) => ({
|
|
15401
|
-
uniforms: {
|
|
15402
|
-
...s.uniforms,
|
|
15403
|
-
[scope]: { ...s.uniforms[scope], ...result }
|
|
15404
|
-
}
|
|
15405
|
-
}));
|
|
15406
|
-
} else {
|
|
15407
|
-
set((s) => ({ uniforms: { ...s.uniforms, ...result } }));
|
|
15408
|
-
}
|
|
15600
|
+
const created = useScopedResource({
|
|
15601
|
+
store,
|
|
15602
|
+
kind: "uniforms",
|
|
15603
|
+
scope: isReader ? void 0 : scope,
|
|
15604
|
+
isLeaf: isUniformNode$1,
|
|
15605
|
+
input: memoizedInput,
|
|
15606
|
+
create: () => {
|
|
15607
|
+
if (isReader) return {};
|
|
15608
|
+
if (typeof memoizedInput !== "object" || memoizedInput === null) throw new Error("Invalid uniform input");
|
|
15609
|
+
return memoizedInput;
|
|
15610
|
+
},
|
|
15611
|
+
prepare: (name, candidate) => createUniform(name, candidate, scope),
|
|
15612
|
+
reconcile: (existing, candidate) => {
|
|
15613
|
+
const existingVal = existing.value;
|
|
15614
|
+
const newVal = vectorize(candidate);
|
|
15615
|
+
let equals = newVal === existingVal;
|
|
15616
|
+
if (!equals && hasEqualsMethod(existingVal) && hasEqualsMethod(newVal)) {
|
|
15617
|
+
if (isThreeVector(existingVal) && isThreeVector(newVal)) {
|
|
15618
|
+
equals = vectorEquals(existingVal, newVal);
|
|
15619
|
+
} else if (isSameThreeType(existingVal, newVal)) {
|
|
15620
|
+
equals = existingVal.equals(newVal);
|
|
15621
|
+
}
|
|
15622
|
+
}
|
|
15623
|
+
if (!equals) existing.value = newVal;
|
|
15409
15624
|
}
|
|
15410
|
-
|
|
15411
|
-
|
|
15625
|
+
});
|
|
15626
|
+
let uniforms = created;
|
|
15627
|
+
if (memoizedInput === void 0) {
|
|
15628
|
+
uniforms = storeUniforms;
|
|
15629
|
+
} else if (typeof memoizedInput === "string") {
|
|
15630
|
+
const scopeData = storeUniforms[memoizedInput];
|
|
15631
|
+
uniforms = scopeData && !isUniformNode$1(scopeData) ? scopeData : {};
|
|
15632
|
+
}
|
|
15412
15633
|
return { ...uniforms, removeUniforms: removeUniforms2, clearUniforms, rebuildUniforms };
|
|
15413
15634
|
}
|
|
15414
15635
|
function rebuildAllUniforms(store, scope) {
|
|
15415
|
-
store
|
|
15416
|
-
store.setState((state) => {
|
|
15417
|
-
let newUniforms = {};
|
|
15418
|
-
if (scope && scope !== "root") {
|
|
15419
|
-
const { [scope]: _, ...rest } = state.uniforms;
|
|
15420
|
-
newUniforms = rest;
|
|
15421
|
-
} else if (scope === "root") {
|
|
15422
|
-
for (const [key, value] of Object.entries(state.uniforms)) {
|
|
15423
|
-
if (!isUniformNode$1(value)) newUniforms[key] = value;
|
|
15424
|
-
}
|
|
15425
|
-
}
|
|
15426
|
-
return { uniforms: newUniforms, _hmrVersion: state._hmrVersion + 1 };
|
|
15427
|
-
});
|
|
15636
|
+
rebuildResource(store, "uniforms", scope);
|
|
15428
15637
|
}
|
|
15429
15638
|
function removeUniforms(set, names, scope) {
|
|
15430
15639
|
set((state) => {
|
|
@@ -15488,192 +15697,91 @@ function isSameThreeType(a, b) {
|
|
|
15488
15697
|
return obj_a.isColor && obj_b.isColor || obj_a.isMatrix3 && obj_b.isMatrix3 || obj_a.isMatrix4 && obj_b.isMatrix4 || obj_a.isEuler && obj_b.isEuler || obj_a.isQuaternion && obj_b.isQuaternion;
|
|
15489
15698
|
}
|
|
15490
15699
|
|
|
15700
|
+
const uniformOf = tsl.uniform;
|
|
15491
15701
|
const isUniformNode = (value) => value !== null && typeof value === "object" && "value" in value && "uuid" in value;
|
|
15492
15702
|
const isTSLNode$1 = (value) => value !== null && typeof value === "object" && "uuid" in value && "nodeType" in value;
|
|
15493
15703
|
function useUniform(name, value) {
|
|
15494
15704
|
const store = useStore();
|
|
15495
|
-
const
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15705
|
+
const registered = useScopedResource({
|
|
15706
|
+
store,
|
|
15707
|
+
kind: "uniforms",
|
|
15708
|
+
scope: void 0,
|
|
15709
|
+
isLeaf: isUniformNode,
|
|
15710
|
+
input: name,
|
|
15711
|
+
create: () => value === void 0 ? {} : { [name]: value },
|
|
15712
|
+
prepare: createNamedUniform,
|
|
15713
|
+
reconcile: (existing2) => {
|
|
15501
15714
|
if (value !== void 0 && !isTSLNode$1(value) && !isUniformNode(value)) {
|
|
15502
|
-
|
|
15715
|
+
existing2.value = typeof value === "string" ? new webgpu.Color(value) : value;
|
|
15503
15716
|
}
|
|
15504
|
-
return existing;
|
|
15505
|
-
}
|
|
15506
|
-
if (value === void 0) {
|
|
15507
|
-
throw new Error(
|
|
15508
|
-
`[useUniform] Uniform "${name}" not found. Create it first with: useUniform('${name}', initialValue)`
|
|
15509
|
-
);
|
|
15510
|
-
}
|
|
15511
|
-
if (isUniformNode(value)) {
|
|
15512
|
-
const node2 = value;
|
|
15513
|
-
if (typeof node2.setName === "function") {
|
|
15514
|
-
node2.setName(name);
|
|
15515
|
-
}
|
|
15516
|
-
set((s) => ({
|
|
15517
|
-
uniforms: { ...s.uniforms, [name]: node2 }
|
|
15518
|
-
}));
|
|
15519
|
-
return node2;
|
|
15520
|
-
}
|
|
15521
|
-
let node;
|
|
15522
|
-
if (isTSLNode$1(value)) {
|
|
15523
|
-
node = tsl.uniform(value);
|
|
15524
|
-
} else if (typeof value === "string") {
|
|
15525
|
-
node = tsl.uniform(new webgpu.Color(value));
|
|
15526
|
-
} else {
|
|
15527
|
-
node = tsl.uniform(value);
|
|
15528
|
-
}
|
|
15529
|
-
if (typeof node.setName === "function") {
|
|
15530
|
-
node.setName(name);
|
|
15531
15717
|
}
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
})
|
|
15538
|
-
|
|
15539
|
-
|
|
15718
|
+
});
|
|
15719
|
+
if (registered[name]) return registered[name];
|
|
15720
|
+
const existing = peekStaged(store, "uniforms", ROOT_SCOPE)?.[name] ?? store.getState().uniforms[name];
|
|
15721
|
+
if (existing && isUniformNode(existing)) return existing;
|
|
15722
|
+
throw new Error(
|
|
15723
|
+
`[useUniform] Uniform "${name}" not found. Create it first with: useUniform('${name}', initialValue)`
|
|
15724
|
+
);
|
|
15725
|
+
}
|
|
15726
|
+
function createNamedUniform(name, value) {
|
|
15727
|
+
let node;
|
|
15728
|
+
if (isUniformNode(value)) {
|
|
15729
|
+
node = value;
|
|
15730
|
+
} else if (isTSLNode$1(value)) {
|
|
15731
|
+
node = uniformOf(value);
|
|
15732
|
+
} else if (typeof value === "string") {
|
|
15733
|
+
node = tsl.uniform(new webgpu.Color(value));
|
|
15734
|
+
} else {
|
|
15735
|
+
node = uniformOf(value);
|
|
15736
|
+
}
|
|
15737
|
+
if (typeof node.setName === "function") {
|
|
15738
|
+
node.setName(name);
|
|
15739
|
+
}
|
|
15740
|
+
return node;
|
|
15540
15741
|
}
|
|
15541
15742
|
|
|
15542
15743
|
const isTSLNode = (value) => value !== null && typeof value === "object" && ("uuid" in value || "nodeType" in value);
|
|
15543
15744
|
function useNodes(creatorOrScope, scope) {
|
|
15544
15745
|
const store = usePrimaryStore();
|
|
15545
15746
|
const removeNodes2 = React.useCallback(
|
|
15546
|
-
(names, targetScope) =>
|
|
15547
|
-
const nameArray = Array.isArray(names) ? names : [names];
|
|
15548
|
-
store.setState((state) => {
|
|
15549
|
-
if (targetScope) {
|
|
15550
|
-
const currentScope = { ...state.nodes[targetScope] };
|
|
15551
|
-
for (const name of nameArray) delete currentScope[name];
|
|
15552
|
-
return { nodes: { ...state.nodes, [targetScope]: currentScope } };
|
|
15553
|
-
}
|
|
15554
|
-
const nodes2 = { ...state.nodes };
|
|
15555
|
-
for (const name of nameArray) if (isTSLNode(nodes2[name])) delete nodes2[name];
|
|
15556
|
-
return { nodes: nodes2 };
|
|
15557
|
-
});
|
|
15558
|
-
},
|
|
15747
|
+
(names, targetScope) => removeResourceEntries(store, "nodes", Array.isArray(names) ? names : [names], targetScope, isTSLNode),
|
|
15559
15748
|
[store]
|
|
15560
15749
|
);
|
|
15561
15750
|
const clearNodes = React.useCallback(
|
|
15562
|
-
(targetScope) =>
|
|
15563
|
-
store.setState((state) => {
|
|
15564
|
-
if (targetScope && targetScope !== "root") {
|
|
15565
|
-
const { [targetScope]: _, ...rest } = state.nodes;
|
|
15566
|
-
return { nodes: rest };
|
|
15567
|
-
}
|
|
15568
|
-
if (targetScope === "root") {
|
|
15569
|
-
const nodes2 = {};
|
|
15570
|
-
for (const [key, value] of Object.entries(state.nodes)) {
|
|
15571
|
-
if (!isTSLNode(value)) nodes2[key] = value;
|
|
15572
|
-
}
|
|
15573
|
-
return { nodes: nodes2 };
|
|
15574
|
-
}
|
|
15575
|
-
return { nodes: {} };
|
|
15576
|
-
});
|
|
15577
|
-
},
|
|
15751
|
+
(targetScope) => clearResourceEntries(store, "nodes", targetScope, isTSLNode),
|
|
15578
15752
|
[store]
|
|
15579
15753
|
);
|
|
15580
15754
|
const rebuildNodes = React.useCallback(
|
|
15581
|
-
(targetScope) =>
|
|
15582
|
-
store.setState((state) => {
|
|
15583
|
-
let newNodes = state.nodes;
|
|
15584
|
-
if (targetScope && targetScope !== "root") {
|
|
15585
|
-
const { [targetScope]: _, ...rest } = state.nodes;
|
|
15586
|
-
newNodes = rest;
|
|
15587
|
-
} else if (targetScope === "root") {
|
|
15588
|
-
newNodes = {};
|
|
15589
|
-
for (const [key, value] of Object.entries(state.nodes)) {
|
|
15590
|
-
if (!isTSLNode(value)) newNodes[key] = value;
|
|
15591
|
-
}
|
|
15592
|
-
} else {
|
|
15593
|
-
newNodes = {};
|
|
15594
|
-
}
|
|
15595
|
-
return { nodes: newNodes, _hmrVersion: state._hmrVersion + 1 };
|
|
15596
|
-
});
|
|
15597
|
-
},
|
|
15755
|
+
(targetScope) => rebuildResource(store, "nodes", targetScope),
|
|
15598
15756
|
[store]
|
|
15599
15757
|
);
|
|
15600
15758
|
const isReader = creatorOrScope === void 0 || typeof creatorOrScope === "string";
|
|
15601
15759
|
const storeNodes = usePrimaryThree((s) => s.nodes);
|
|
15602
|
-
const
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
return
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
return
|
|
15614
|
-
}
|
|
15615
|
-
const state = store.getState();
|
|
15616
|
-
const set = store.setState;
|
|
15617
|
-
const creator = creatorOrScope;
|
|
15618
|
-
const wrappedState = createLazyCreatorState(state);
|
|
15619
|
-
const created = creator(wrappedState);
|
|
15620
|
-
const result = {};
|
|
15621
|
-
let hasNewNodes = false;
|
|
15622
|
-
if (scope) {
|
|
15623
|
-
const currentScope = state.nodes[scope] ?? {};
|
|
15624
|
-
for (const [name, node] of Object.entries(created)) {
|
|
15625
|
-
if (currentScope[name]) {
|
|
15626
|
-
result[name] = currentScope[name];
|
|
15627
|
-
} else {
|
|
15628
|
-
node.setName?.(`${scope}.${name}`);
|
|
15629
|
-
result[name] = node;
|
|
15630
|
-
hasNewNodes = true;
|
|
15631
|
-
}
|
|
15632
|
-
}
|
|
15633
|
-
if (hasNewNodes) {
|
|
15634
|
-
set((s) => ({
|
|
15635
|
-
nodes: {
|
|
15636
|
-
...s.nodes,
|
|
15637
|
-
[scope]: { ...s.nodes[scope], ...result }
|
|
15638
|
-
}
|
|
15639
|
-
}));
|
|
15640
|
-
}
|
|
15641
|
-
return result;
|
|
15642
|
-
}
|
|
15643
|
-
for (const [name, node] of Object.entries(created)) {
|
|
15644
|
-
const existing = state.nodes[name];
|
|
15645
|
-
if (existing && isTSLNode(existing)) {
|
|
15646
|
-
result[name] = existing;
|
|
15647
|
-
} else {
|
|
15648
|
-
node.setName?.(name);
|
|
15649
|
-
result[name] = node;
|
|
15650
|
-
hasNewNodes = true;
|
|
15651
|
-
}
|
|
15652
|
-
}
|
|
15653
|
-
if (hasNewNodes) {
|
|
15654
|
-
set((s) => ({ nodes: { ...s.nodes, ...result } }));
|
|
15760
|
+
const created = useScopedResource({
|
|
15761
|
+
store,
|
|
15762
|
+
kind: "nodes",
|
|
15763
|
+
scope: isReader ? void 0 : scope,
|
|
15764
|
+
isLeaf: isTSLNode,
|
|
15765
|
+
create: () => {
|
|
15766
|
+
if (isReader) return {};
|
|
15767
|
+
return creatorOrScope(createLazyCreatorState(store.getState(), store));
|
|
15768
|
+
},
|
|
15769
|
+
prepare: (name, node) => {
|
|
15770
|
+
node.setName?.(scope ? `${scope}.${name}` : name);
|
|
15771
|
+
return node;
|
|
15655
15772
|
}
|
|
15656
|
-
|
|
15657
|
-
|
|
15773
|
+
});
|
|
15774
|
+
let nodes = created;
|
|
15775
|
+
if (creatorOrScope === void 0) {
|
|
15776
|
+
nodes = storeNodes;
|
|
15777
|
+
} else if (typeof creatorOrScope === "string") {
|
|
15778
|
+
const scopeData = storeNodes[creatorOrScope];
|
|
15779
|
+
nodes = scopeData && !isTSLNode(scopeData) ? scopeData : {};
|
|
15780
|
+
}
|
|
15658
15781
|
return { ...nodes, removeNodes: removeNodes2, clearNodes, rebuildNodes };
|
|
15659
15782
|
}
|
|
15660
15783
|
function rebuildAllNodes(store, scope) {
|
|
15661
|
-
store
|
|
15662
|
-
store.setState((state) => {
|
|
15663
|
-
let newNodes = state.nodes;
|
|
15664
|
-
if (scope && scope !== "root") {
|
|
15665
|
-
const { [scope]: _, ...rest } = state.nodes;
|
|
15666
|
-
newNodes = rest;
|
|
15667
|
-
} else if (scope === "root") {
|
|
15668
|
-
newNodes = {};
|
|
15669
|
-
for (const [key, value] of Object.entries(state.nodes)) {
|
|
15670
|
-
if (!isTSLNode(value)) newNodes[key] = value;
|
|
15671
|
-
}
|
|
15672
|
-
} else {
|
|
15673
|
-
newNodes = {};
|
|
15674
|
-
}
|
|
15675
|
-
return { nodes: newNodes, _hmrVersion: state._hmrVersion + 1 };
|
|
15676
|
-
});
|
|
15784
|
+
rebuildResource(store, "nodes", scope);
|
|
15677
15785
|
}
|
|
15678
15786
|
function removeNodes(set, names, scope) {
|
|
15679
15787
|
set((state) => {
|
|
@@ -15709,7 +15817,7 @@ function useLocalNodes(creator) {
|
|
|
15709
15817
|
const textures = usePrimaryThree((s) => s.textures);
|
|
15710
15818
|
const hmrVersion = usePrimaryThree((s) => s._hmrVersion);
|
|
15711
15819
|
return React.useMemo(() => {
|
|
15712
|
-
const wrappedState = createLazyCreatorState(store.getState());
|
|
15820
|
+
const wrappedState = createLazyCreatorState(store.getState(), store);
|
|
15713
15821
|
return creator(wrappedState);
|
|
15714
15822
|
}, [store, creator, uniforms, nodes, textures, hmrVersion]);
|
|
15715
15823
|
}
|
|
@@ -15730,58 +15838,15 @@ const disposeBuffer = (buffer) => {
|
|
|
15730
15838
|
function useBuffers(creatorOrScope, scope) {
|
|
15731
15839
|
const store = usePrimaryStore();
|
|
15732
15840
|
const removeBuffers = React.useCallback(
|
|
15733
|
-
(names, targetScope) =>
|
|
15734
|
-
const nameArray = Array.isArray(names) ? names : [names];
|
|
15735
|
-
store.setState((state) => {
|
|
15736
|
-
if (targetScope) {
|
|
15737
|
-
const currentScope = { ...state.buffers[targetScope] };
|
|
15738
|
-
for (const name of nameArray) delete currentScope[name];
|
|
15739
|
-
return { buffers: { ...state.buffers, [targetScope]: currentScope } };
|
|
15740
|
-
}
|
|
15741
|
-
const buffers2 = { ...state.buffers };
|
|
15742
|
-
for (const name of nameArray) if (isBufferLike(buffers2[name])) delete buffers2[name];
|
|
15743
|
-
return { buffers: buffers2 };
|
|
15744
|
-
});
|
|
15745
|
-
},
|
|
15841
|
+
(names, targetScope) => removeResourceEntries(store, "buffers", Array.isArray(names) ? names : [names], targetScope, isBufferLike),
|
|
15746
15842
|
[store]
|
|
15747
15843
|
);
|
|
15748
15844
|
const clearBuffers = React.useCallback(
|
|
15749
|
-
(targetScope) =>
|
|
15750
|
-
store.setState((state) => {
|
|
15751
|
-
if (targetScope && targetScope !== "root") {
|
|
15752
|
-
const { [targetScope]: _, ...rest } = state.buffers;
|
|
15753
|
-
return { buffers: rest };
|
|
15754
|
-
}
|
|
15755
|
-
if (targetScope === "root") {
|
|
15756
|
-
const buffers2 = {};
|
|
15757
|
-
for (const [key, value] of Object.entries(state.buffers)) {
|
|
15758
|
-
if (!isBufferLike(value)) buffers2[key] = value;
|
|
15759
|
-
}
|
|
15760
|
-
return { buffers: buffers2 };
|
|
15761
|
-
}
|
|
15762
|
-
return { buffers: {} };
|
|
15763
|
-
});
|
|
15764
|
-
},
|
|
15845
|
+
(targetScope) => clearResourceEntries(store, "buffers", targetScope, isBufferLike),
|
|
15765
15846
|
[store]
|
|
15766
15847
|
);
|
|
15767
15848
|
const rebuildBuffers = React.useCallback(
|
|
15768
|
-
(targetScope) =>
|
|
15769
|
-
store.setState((state) => {
|
|
15770
|
-
let newBuffers = state.buffers;
|
|
15771
|
-
if (targetScope && targetScope !== "root") {
|
|
15772
|
-
const { [targetScope]: _, ...rest } = state.buffers;
|
|
15773
|
-
newBuffers = rest;
|
|
15774
|
-
} else if (targetScope === "root") {
|
|
15775
|
-
newBuffers = {};
|
|
15776
|
-
for (const [key, value] of Object.entries(state.buffers)) {
|
|
15777
|
-
if (!isBufferLike(value)) newBuffers[key] = value;
|
|
15778
|
-
}
|
|
15779
|
-
} else {
|
|
15780
|
-
newBuffers = {};
|
|
15781
|
-
}
|
|
15782
|
-
return { buffers: newBuffers, _hmrVersion: state._hmrVersion + 1 };
|
|
15783
|
-
});
|
|
15784
|
-
},
|
|
15849
|
+
(targetScope) => rebuildResource(store, "buffers", targetScope),
|
|
15785
15850
|
[store]
|
|
15786
15851
|
);
|
|
15787
15852
|
const disposeBuffers = React.useCallback(
|
|
@@ -15800,85 +15865,33 @@ function useBuffers(creatorOrScope, scope) {
|
|
|
15800
15865
|
);
|
|
15801
15866
|
const isReader = creatorOrScope === void 0 || typeof creatorOrScope === "string";
|
|
15802
15867
|
const storeBuffers = usePrimaryThree((s) => s.buffers);
|
|
15803
|
-
const
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
return
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15813
|
-
if (
|
|
15814
|
-
|
|
15815
|
-
}
|
|
15816
|
-
const state = store.getState();
|
|
15817
|
-
const set = store.setState;
|
|
15818
|
-
const creator = creatorOrScope;
|
|
15819
|
-
const wrappedState = createLazyCreatorState(state);
|
|
15820
|
-
const created = creator(wrappedState);
|
|
15821
|
-
const result = {};
|
|
15822
|
-
let hasNewBuffers = false;
|
|
15823
|
-
if (scope) {
|
|
15824
|
-
const currentScope = state.buffers[scope] ?? {};
|
|
15825
|
-
for (const [name, buffer] of Object.entries(created)) {
|
|
15826
|
-
if (currentScope[name]) {
|
|
15827
|
-
result[name] = currentScope[name];
|
|
15828
|
-
} else {
|
|
15829
|
-
if ("setName" in buffer && typeof buffer.setName === "function") {
|
|
15830
|
-
buffer.setName(`${scope}.${name}`);
|
|
15831
|
-
}
|
|
15832
|
-
result[name] = buffer;
|
|
15833
|
-
hasNewBuffers = true;
|
|
15834
|
-
}
|
|
15835
|
-
}
|
|
15836
|
-
if (hasNewBuffers) {
|
|
15837
|
-
set((s) => ({
|
|
15838
|
-
buffers: {
|
|
15839
|
-
...s.buffers,
|
|
15840
|
-
[scope]: { ...s.buffers[scope], ...result }
|
|
15841
|
-
}
|
|
15842
|
-
}));
|
|
15843
|
-
}
|
|
15844
|
-
return result;
|
|
15845
|
-
}
|
|
15846
|
-
for (const [name, buffer] of Object.entries(created)) {
|
|
15847
|
-
const existing = state.buffers[name];
|
|
15848
|
-
if (existing && isBufferLike(existing)) {
|
|
15849
|
-
result[name] = existing;
|
|
15850
|
-
} else {
|
|
15851
|
-
if ("setName" in buffer && typeof buffer.setName === "function") {
|
|
15852
|
-
buffer.setName(name);
|
|
15853
|
-
}
|
|
15854
|
-
result[name] = buffer;
|
|
15855
|
-
hasNewBuffers = true;
|
|
15868
|
+
const created = useScopedResource({
|
|
15869
|
+
store,
|
|
15870
|
+
kind: "buffers",
|
|
15871
|
+
scope: isReader ? void 0 : scope,
|
|
15872
|
+
isLeaf: isBufferLike,
|
|
15873
|
+
create: () => {
|
|
15874
|
+
if (isReader) return {};
|
|
15875
|
+
return creatorOrScope(createLazyCreatorState(store.getState(), store));
|
|
15876
|
+
},
|
|
15877
|
+
prepare: (name, buffer) => {
|
|
15878
|
+
if ("setName" in buffer && typeof buffer.setName === "function") {
|
|
15879
|
+
buffer.setName(scope ? `${scope}.${name}` : name);
|
|
15856
15880
|
}
|
|
15881
|
+
return buffer;
|
|
15857
15882
|
}
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
}
|
|
15883
|
+
});
|
|
15884
|
+
let buffers = created;
|
|
15885
|
+
if (creatorOrScope === void 0) {
|
|
15886
|
+
buffers = storeBuffers;
|
|
15887
|
+
} else if (typeof creatorOrScope === "string") {
|
|
15888
|
+
const scopeData = storeBuffers[creatorOrScope];
|
|
15889
|
+
buffers = scopeData && !isBufferLike(scopeData) ? scopeData : {};
|
|
15890
|
+
}
|
|
15863
15891
|
return { ...buffers, removeBuffers, clearBuffers, rebuildBuffers, disposeBuffers };
|
|
15864
15892
|
}
|
|
15865
15893
|
function rebuildAllBuffers(store, scope) {
|
|
15866
|
-
store
|
|
15867
|
-
store.setState((state) => {
|
|
15868
|
-
let newBuffers = state.buffers;
|
|
15869
|
-
if (scope && scope !== "root") {
|
|
15870
|
-
const { [scope]: _, ...rest } = state.buffers;
|
|
15871
|
-
newBuffers = rest;
|
|
15872
|
-
} else if (scope === "root") {
|
|
15873
|
-
newBuffers = {};
|
|
15874
|
-
for (const [key, value] of Object.entries(state.buffers)) {
|
|
15875
|
-
if (!isBufferLike(value)) newBuffers[key] = value;
|
|
15876
|
-
}
|
|
15877
|
-
} else {
|
|
15878
|
-
newBuffers = {};
|
|
15879
|
-
}
|
|
15880
|
-
return { buffers: newBuffers, _hmrVersion: state._hmrVersion + 1 };
|
|
15881
|
-
});
|
|
15894
|
+
rebuildResource(store, "buffers", scope);
|
|
15882
15895
|
}
|
|
15883
15896
|
|
|
15884
15897
|
const isStorageLike = (value) => {
|
|
@@ -15897,58 +15910,15 @@ const disposeStorage = (storage) => {
|
|
|
15897
15910
|
function useGPUStorage(creatorOrScope, scope) {
|
|
15898
15911
|
const store = usePrimaryStore();
|
|
15899
15912
|
const removeStorage = React.useCallback(
|
|
15900
|
-
(names, targetScope) =>
|
|
15901
|
-
const nameArray = Array.isArray(names) ? names : [names];
|
|
15902
|
-
store.setState((state) => {
|
|
15903
|
-
if (targetScope) {
|
|
15904
|
-
const currentScope = { ...state.gpuStorage[targetScope] };
|
|
15905
|
-
for (const name of nameArray) delete currentScope[name];
|
|
15906
|
-
return { gpuStorage: { ...state.gpuStorage, [targetScope]: currentScope } };
|
|
15907
|
-
}
|
|
15908
|
-
const gpuStorage2 = { ...state.gpuStorage };
|
|
15909
|
-
for (const name of nameArray) if (isStorageLike(gpuStorage2[name])) delete gpuStorage2[name];
|
|
15910
|
-
return { gpuStorage: gpuStorage2 };
|
|
15911
|
-
});
|
|
15912
|
-
},
|
|
15913
|
+
(names, targetScope) => removeResourceEntries(store, "gpuStorage", Array.isArray(names) ? names : [names], targetScope, isStorageLike),
|
|
15913
15914
|
[store]
|
|
15914
15915
|
);
|
|
15915
15916
|
const clearStorage = React.useCallback(
|
|
15916
|
-
(targetScope) =>
|
|
15917
|
-
store.setState((state) => {
|
|
15918
|
-
if (targetScope && targetScope !== "root") {
|
|
15919
|
-
const { [targetScope]: _, ...rest } = state.gpuStorage;
|
|
15920
|
-
return { gpuStorage: rest };
|
|
15921
|
-
}
|
|
15922
|
-
if (targetScope === "root") {
|
|
15923
|
-
const gpuStorage2 = {};
|
|
15924
|
-
for (const [key, value] of Object.entries(state.gpuStorage)) {
|
|
15925
|
-
if (!isStorageLike(value)) gpuStorage2[key] = value;
|
|
15926
|
-
}
|
|
15927
|
-
return { gpuStorage: gpuStorage2 };
|
|
15928
|
-
}
|
|
15929
|
-
return { gpuStorage: {} };
|
|
15930
|
-
});
|
|
15931
|
-
},
|
|
15917
|
+
(targetScope) => clearResourceEntries(store, "gpuStorage", targetScope, isStorageLike),
|
|
15932
15918
|
[store]
|
|
15933
15919
|
);
|
|
15934
15920
|
const rebuildStorage = React.useCallback(
|
|
15935
|
-
(targetScope) =>
|
|
15936
|
-
store.setState((state) => {
|
|
15937
|
-
let newStorage = state.gpuStorage;
|
|
15938
|
-
if (targetScope && targetScope !== "root") {
|
|
15939
|
-
const { [targetScope]: _, ...rest } = state.gpuStorage;
|
|
15940
|
-
newStorage = rest;
|
|
15941
|
-
} else if (targetScope === "root") {
|
|
15942
|
-
newStorage = {};
|
|
15943
|
-
for (const [key, value] of Object.entries(state.gpuStorage)) {
|
|
15944
|
-
if (!isStorageLike(value)) newStorage[key] = value;
|
|
15945
|
-
}
|
|
15946
|
-
} else {
|
|
15947
|
-
newStorage = {};
|
|
15948
|
-
}
|
|
15949
|
-
return { gpuStorage: newStorage, _hmrVersion: state._hmrVersion + 1 };
|
|
15950
|
-
});
|
|
15951
|
-
},
|
|
15921
|
+
(targetScope) => rebuildResource(store, "gpuStorage", targetScope),
|
|
15952
15922
|
[store]
|
|
15953
15923
|
);
|
|
15954
15924
|
const disposeStorageFn = React.useCallback(
|
|
@@ -15967,72 +15937,33 @@ function useGPUStorage(creatorOrScope, scope) {
|
|
|
15967
15937
|
);
|
|
15968
15938
|
const isReader = creatorOrScope === void 0 || typeof creatorOrScope === "string";
|
|
15969
15939
|
const storeStorage = usePrimaryThree((s) => s.gpuStorage);
|
|
15970
|
-
const
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
return
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
const state = store.getState();
|
|
15984
|
-
const set = store.setState;
|
|
15985
|
-
const creator = creatorOrScope;
|
|
15986
|
-
const wrappedState = createLazyCreatorState(state);
|
|
15987
|
-
const created = creator(wrappedState);
|
|
15988
|
-
const result = {};
|
|
15989
|
-
let hasNewStorage = false;
|
|
15990
|
-
if (scope) {
|
|
15991
|
-
const currentScope = state.gpuStorage[scope] ?? {};
|
|
15992
|
-
for (const [name, storage] of Object.entries(created)) {
|
|
15993
|
-
if (currentScope[name]) {
|
|
15994
|
-
result[name] = currentScope[name];
|
|
15995
|
-
} else {
|
|
15996
|
-
if ("setName" in storage && typeof storage.setName === "function") {
|
|
15997
|
-
storage.setName(`${scope}.${name}`);
|
|
15998
|
-
}
|
|
15999
|
-
if ("name" in storage && typeof storage.name === "string") {
|
|
16000
|
-
storage.name = `${scope}.${name}`;
|
|
16001
|
-
}
|
|
16002
|
-
result[name] = storage;
|
|
16003
|
-
hasNewStorage = true;
|
|
16004
|
-
}
|
|
16005
|
-
}
|
|
16006
|
-
if (hasNewStorage) {
|
|
16007
|
-
set((s) => ({
|
|
16008
|
-
gpuStorage: {
|
|
16009
|
-
...s.gpuStorage,
|
|
16010
|
-
[scope]: { ...s.gpuStorage[scope], ...result }
|
|
16011
|
-
}
|
|
16012
|
-
}));
|
|
15940
|
+
const created = useScopedResource({
|
|
15941
|
+
store,
|
|
15942
|
+
kind: "gpuStorage",
|
|
15943
|
+
scope: isReader ? void 0 : scope,
|
|
15944
|
+
isLeaf: isStorageLike,
|
|
15945
|
+
create: () => {
|
|
15946
|
+
if (isReader) return {};
|
|
15947
|
+
return creatorOrScope(createLazyCreatorState(store.getState(), store));
|
|
15948
|
+
},
|
|
15949
|
+
prepare: (name, storage) => {
|
|
15950
|
+
const label = scope ? `${scope}.${name}` : name;
|
|
15951
|
+
if ("setName" in storage && typeof storage.setName === "function") {
|
|
15952
|
+
storage.setName(label);
|
|
16013
15953
|
}
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
for (const [name, storage] of Object.entries(created)) {
|
|
16017
|
-
const existing = state.gpuStorage[name];
|
|
16018
|
-
if (existing && isStorageLike(existing)) {
|
|
16019
|
-
result[name] = existing;
|
|
16020
|
-
} else {
|
|
16021
|
-
if ("setName" in storage && typeof storage.setName === "function") {
|
|
16022
|
-
storage.setName(name);
|
|
16023
|
-
}
|
|
16024
|
-
if ("name" in storage && typeof storage.name === "string") {
|
|
16025
|
-
storage.name = name;
|
|
16026
|
-
}
|
|
16027
|
-
result[name] = storage;
|
|
16028
|
-
hasNewStorage = true;
|
|
15954
|
+
if ("name" in storage && typeof storage.name === "string") {
|
|
15955
|
+
storage.name = label;
|
|
16029
15956
|
}
|
|
15957
|
+
return storage;
|
|
16030
15958
|
}
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
}
|
|
15959
|
+
});
|
|
15960
|
+
let gpuStorage = created;
|
|
15961
|
+
if (creatorOrScope === void 0) {
|
|
15962
|
+
gpuStorage = storeStorage;
|
|
15963
|
+
} else if (typeof creatorOrScope === "string") {
|
|
15964
|
+
const scopeData = storeStorage[creatorOrScope];
|
|
15965
|
+
gpuStorage = scopeData && !isStorageLike(scopeData) ? scopeData : {};
|
|
15966
|
+
}
|
|
16036
15967
|
return {
|
|
16037
15968
|
...gpuStorage,
|
|
16038
15969
|
removeStorage,
|
|
@@ -16042,25 +15973,9 @@ function useGPUStorage(creatorOrScope, scope) {
|
|
|
16042
15973
|
};
|
|
16043
15974
|
}
|
|
16044
15975
|
function rebuildAllStorage(store, scope) {
|
|
16045
|
-
store
|
|
16046
|
-
store.setState((state) => {
|
|
16047
|
-
let newStorage = state.gpuStorage;
|
|
16048
|
-
if (scope && scope !== "root") {
|
|
16049
|
-
const { [scope]: _, ...rest } = state.gpuStorage;
|
|
16050
|
-
newStorage = rest;
|
|
16051
|
-
} else if (scope === "root") {
|
|
16052
|
-
newStorage = {};
|
|
16053
|
-
for (const [key, value] of Object.entries(state.gpuStorage)) {
|
|
16054
|
-
if (!isStorageLike(value)) newStorage[key] = value;
|
|
16055
|
-
}
|
|
16056
|
-
} else {
|
|
16057
|
-
newStorage = {};
|
|
16058
|
-
}
|
|
16059
|
-
return { gpuStorage: newStorage, _hmrVersion: state._hmrVersion + 1 };
|
|
16060
|
-
});
|
|
15976
|
+
rebuildResource(store, "gpuStorage", scope);
|
|
16061
15977
|
}
|
|
16062
15978
|
|
|
16063
|
-
const RenderPipelineCtor = webgpu.RenderPipeline ?? webgpu.PostProcessing;
|
|
16064
15979
|
function useRenderPipeline(mainCB, setupCB) {
|
|
16065
15980
|
const store = useStore();
|
|
16066
15981
|
const { scene, camera, renderer, isLegacy } = useThree();
|
|
@@ -16103,7 +16018,7 @@ function useRenderPipeline(mainCB, setupCB) {
|
|
|
16103
16018
|
let currentPasses = { ...state.passes };
|
|
16104
16019
|
let justCreatedPipeline = false;
|
|
16105
16020
|
if (!pipeline) {
|
|
16106
|
-
pipeline = new
|
|
16021
|
+
pipeline = new webgpu.RenderPipeline(renderer);
|
|
16107
16022
|
justCreatedPipeline = true;
|
|
16108
16023
|
}
|
|
16109
16024
|
const cacheValid = scenePassCacheRef.current && scenePassCacheRef.current.sceneUuid === scene.uuid && scenePassCacheRef.current.cameraUuid === camera.uuid;
|
|
@@ -16138,7 +16053,7 @@ function useRenderPipeline(mainCB, setupCB) {
|
|
|
16138
16053
|
callbacksRanRef.current = true;
|
|
16139
16054
|
}
|
|
16140
16055
|
} catch (error) {
|
|
16141
|
-
console.
|
|
16056
|
+
console.warn("[useRenderPipeline] Setup failed; the render pipeline was not configured:", error);
|
|
16142
16057
|
}
|
|
16143
16058
|
}, [store, renderer, scene, camera, isLegacy, rebuildVersion]);
|
|
16144
16059
|
const passes = useThree((s) => s.passes);
|
|
@@ -16175,7 +16090,6 @@ exports.REACT_INTERNAL_PROPS = REACT_INTERNAL_PROPS;
|
|
|
16175
16090
|
exports.RESERVED_PROPS = RESERVED_PROPS;
|
|
16176
16091
|
exports.Texture = Texture;
|
|
16177
16092
|
exports._roots = _roots;
|
|
16178
|
-
exports.act = act;
|
|
16179
16093
|
exports.addAfterEffect = addAfterEffect;
|
|
16180
16094
|
exports.addEffect = addEffect;
|
|
16181
16095
|
exports.addTail = addTail;
|
|
@@ -16220,7 +16134,7 @@ exports.isFromRef = isFromRef;
|
|
|
16220
16134
|
exports.isObject3D = isObject3D;
|
|
16221
16135
|
exports.isOnce = isOnce;
|
|
16222
16136
|
exports.isOrthographicCamera = isOrthographicCamera;
|
|
16223
|
-
exports.isRef = isRef;
|
|
16137
|
+
exports.isRef = isRef$1;
|
|
16224
16138
|
exports.isRenderer = isRenderer;
|
|
16225
16139
|
exports.isTexture = isTexture;
|
|
16226
16140
|
exports.isVectorLike = isVectorLike;
|
|
@@ -16237,6 +16151,7 @@ exports.removeInteractivity = removeInteractivity;
|
|
|
16237
16151
|
exports.removeNodes = removeNodes;
|
|
16238
16152
|
exports.removeUniforms = removeUniforms;
|
|
16239
16153
|
exports.resolve = resolve;
|
|
16154
|
+
exports.swapInteractivity = swapInteractivity;
|
|
16240
16155
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
16241
16156
|
exports.unregisterPrimary = unregisterPrimary;
|
|
16242
16157
|
exports.updateCamera = updateCamera;
|