@shopware-ag/dive 1.19.1-beta.9 → 2.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/chunks/FileTypes-BjZ0rrIV.cjs +1 -0
- package/build/chunks/FileTypes-qgYnI0Jg.mjs +30 -0
- package/build/chunks/ModuleRegistry-NyNtjHb2.cjs +1 -0
- package/build/chunks/ModuleRegistry-RSub8W0G.mjs +13 -0
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
- package/build/chunks/PerspectiveCamera-sm4_81KJ.mjs +34 -0
- package/build/chunks/SelectTool-BRKko7uz.cjs +1 -0
- package/build/chunks/SelectTool-mTRiZYaC.mjs +712 -0
- package/build/chunks/{SystemInfo-DYq9x4Ch.mjs → SystemInfo-DPAQG-S5.mjs} +37 -40
- package/build/chunks/SystemInfo-oX-NNneO.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
- package/build/chunks/findInterface-BEdL2iUQ.cjs +1 -0
- package/build/chunks/findInterface-OrXgmwxj.mjs +18 -0
- package/build/chunks/index-C_uFFwT2.mjs +5 -0
- package/build/chunks/index-DAwIH9xh.cjs +1 -0
- package/build/chunks/package-BFpY3sIj.cjs +1 -0
- package/build/chunks/package-BvoZkrge.mjs +39 -0
- package/build/chunks/{fflate.module-Chbb_O8w.cjs → parse-error-2f5qpXP5.cjs} +2 -3
- package/build/chunks/{fflate.module-BQhIETD7.mjs → parse-error-DRBVHL9E.mjs} +16 -17
- package/build/dive.cjs +30 -0
- package/build/dive.mjs +1757 -0
- package/build/src/components/gizmo/Gizmo.d.ts +4 -4
- package/build/src/components/gizmo/handles/AxisHandle.d.ts +4 -4
- package/build/src/components/gizmo/handles/RadialHandle.d.ts +4 -4
- package/build/src/components/gizmo/handles/ScaleHandle.d.ts +4 -4
- package/build/src/components/gizmo/plane/GizmoPlane.d.ts +1 -1
- package/build/src/components/gizmo/rotate/RotateGizmo.d.ts +4 -4
- package/build/src/components/gizmo/scale/ScaleGizmo.d.ts +5 -5
- package/build/src/components/gizmo/translate/TranslateGizmo.d.ts +4 -4
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +2 -2
- package/build/src/components/node/Node.d.ts +4 -4
- package/build/src/components/primitive/Primitive.d.ts +1 -1
- package/build/src/components/root/Root.d.ts +2 -1
- package/build/src/core/Dive.d.ts +23 -11
- package/build/src/engine/Engine.d.ts +6 -6
- package/build/src/engine/clock/Clock.d.ts +4 -0
- package/build/src/engine/renderer/Renderer.d.ts +12 -8
- package/build/src/engine/resize/ResizeManager.d.ts +4 -2
- package/build/src/engine/scene/Scene.d.ts +4 -4
- package/build/src/engine/scene/xrroot/XRRoot.d.ts +5 -5
- package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +3 -3
- package/build/src/helpers/findSceneRecursive/findSceneRecursive.d.ts +1 -1
- package/build/src/helpers/isFileTypeSupported/isFileTypeSupported.d.ts +1 -1
- package/build/src/index.d.ts +6 -9
- package/build/src/interfaces/Draggable.d.ts +1 -1
- package/build/src/modules/ModuleRegistry.d.ts +19 -0
- package/build/src/modules/animation/AnimationSystem.cjs +1 -0
- package/build/src/modules/animation/AnimationSystem.d.ts +28 -4
- package/build/src/modules/animation/AnimationSystem.mjs +95 -0
- package/build/src/modules/animation/animator/Animator.d.ts +26 -0
- package/build/src/modules/animation/types/AnimatorParameters.d.ts +7 -0
- package/build/src/modules/ar/ARSystem.cjs +1 -2
- package/build/src/modules/ar/ARSystem.mjs +5 -5
- package/build/src/modules/ar/arquicklook/ARQuickLook.d.ts +1 -1
- package/build/src/modules/ar/sceneviewer/SceneViewer.d.ts +1 -1
- package/build/src/modules/ar/webxr/WebXR.d.ts +3 -3
- package/build/src/modules/ar/webxr/controller/WebXRController.d.ts +3 -3
- package/build/src/modules/ar/webxr/origin/WebXROrigin.d.ts +2 -2
- package/build/src/modules/ar/webxr/raycaster/WebXRRaycaster.d.ts +4 -4
- package/build/src/modules/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +3 -3
- package/build/src/modules/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +4 -4
- package/build/src/modules/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs +0 -1
- package/build/src/modules/asset/converter/AssetConverter.d.ts +3 -3
- package/build/src/modules/asset/converter/AssetConverter.mjs +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs +1 -2
- package/build/src/modules/asset/exporter/AssetExporter.d.ts +3 -3
- package/build/src/modules/asset/exporter/AssetExporter.mjs +1 -2
- package/build/src/modules/asset/loader/AssetLoader.cjs +2 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1917 -5
- package/build/src/modules/axiscamera/AxisCamera.d.ts +8 -9
- package/build/src/modules/controller/orbit/OrbitController.d.ts +13 -24
- package/build/src/modules/mediacreator/MediaCreator.cjs +1 -2
- package/build/src/modules/mediacreator/MediaCreator.d.ts +4 -4
- package/build/src/modules/mediacreator/MediaCreator.mjs +28 -3
- package/build/src/modules/state/ActionRegistry.d.ts +26 -0
- package/build/src/modules/state/State.cjs +27 -0
- package/build/src/modules/state/State.d.ts +58 -0
- package/build/src/modules/state/State.mjs +4271 -0
- package/build/src/modules/state/actions/action.d.ts +36 -0
- package/build/src/modules/state/actions/ar/index.d.ts +1 -0
- package/build/src/modules/state/actions/ar/launchar.d.ts +15 -0
- package/build/src/modules/state/actions/camera/computeencompassingview.d.ts +12 -0
- package/build/src/modules/state/actions/camera/getcameratransform.d.ts +12 -0
- package/build/src/modules/state/actions/camera/index.d.ts +6 -0
- package/build/src/modules/state/actions/camera/lockcamera.d.ts +8 -0
- package/build/src/modules/state/actions/camera/movecamera.d.ts +29 -0
- package/build/src/modules/state/actions/camera/setcameralayer.d.ts +12 -0
- package/build/src/modules/state/actions/camera/setcameratransform.d.ts +15 -0
- package/build/src/modules/state/actions/camera/zoomcamera.d.ts +14 -0
- package/build/src/modules/state/actions/index.d.ts +7 -0
- package/build/src/modules/state/actions/media/generatemedia.d.ts +25 -0
- package/build/src/modules/state/actions/media/index.d.ts +1 -0
- package/build/src/modules/state/actions/object/addobject.d.ts +8 -0
- package/build/src/modules/state/actions/object/deleteobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/deselectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/dropit.d.ts +12 -0
- package/build/src/modules/state/actions/object/getallobjects.d.ts +8 -0
- package/build/src/modules/state/actions/object/getobjects.d.ts +12 -0
- package/build/src/modules/state/actions/object/index.d.ts +11 -0
- package/build/src/modules/state/actions/object/modelloaded.d.ts +12 -0
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +12 -0
- package/build/src/modules/state/actions/object/selectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/setparent.d.ts +22 -0
- package/build/src/modules/state/actions/object/updateobject.d.ts +12 -0
- package/build/src/modules/state/actions/renderer/index.d.ts +1 -0
- package/build/src/modules/state/actions/renderer/startrender.d.ts +8 -0
- package/build/src/modules/state/actions/scene/exportscene.d.ts +13 -0
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +9 -0
- package/build/src/modules/state/actions/scene/index.d.ts +4 -0
- package/build/src/modules/state/actions/scene/setbackground.d.ts +12 -0
- package/build/src/modules/state/actions/scene/updatescene.d.ts +20 -0
- package/build/src/modules/state/actions/toolbox/index.d.ts +4 -0
- package/build/src/modules/state/actions/toolbox/setgizmomode.d.ts +12 -0
- package/build/src/modules/state/actions/toolbox/setgizmoscalelinked.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/setgizmovisible.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/usetool.d.ts +13 -0
- package/build/src/modules/state/types/ActionTypes.d.ts +18 -0
- package/build/src/modules/{com → state}/types/COMBaseEntity.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +6 -0
- package/build/src/modules/{com → state}/types/COMGeometry.d.ts +1 -1
- package/build/src/modules/{com → state}/types/COMGroup.d.ts +3 -1
- package/build/src/modules/{com → state}/types/COMLight.d.ts +3 -1
- package/build/src/modules/{com → state}/types/COMModel.d.ts +4 -2
- package/build/src/modules/state/types/COMPov.d.ts +9 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +13 -0
- package/build/src/modules/state/types/index.d.ts +11 -0
- package/build/src/modules/systeminfo/SystemInfo.cjs +1 -2
- package/build/src/modules/systeminfo/SystemInfo.d.ts +1 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs +3 -3
- package/build/src/modules/toolbox/BaseTool.d.ts +6 -6
- package/build/src/modules/toolbox/Toolbox.cjs +1 -0
- package/build/src/modules/toolbox/Toolbox.d.ts +12 -8
- package/build/src/modules/toolbox/Toolbox.mjs +99 -0
- package/build/src/modules/toolbox/select/SelectTool.d.ts +6 -6
- package/build/src/modules/toolbox/transform/TransformTool.d.ts +6 -6
- package/build/src/types/SceneData.d.ts +1 -1
- package/build/src/types/SceneObjects.d.ts +6 -6
- package/build/src/types/SceneType.d.ts +1 -1
- package/build/src/types/UUID.d.ts +1 -0
- package/build/src/types/file/index.d.ts +1 -1
- package/build/src/types/index.d.ts +6 -6
- package/package.json +33 -23
- package/build/chunks/AssetLoader-BYhwzCxs.cjs +0 -3
- package/build/chunks/AssetLoader-BYhwzCxs.cjs.map +0 -1
- package/build/chunks/AssetLoader-Bmcx40wo.mjs +0 -1948
- package/build/chunks/AssetLoader-Bmcx40wo.mjs.map +0 -1
- package/build/chunks/MediaCreator-CAXBbn15.mjs +0 -59
- package/build/chunks/MediaCreator-CAXBbn15.mjs.map +0 -1
- package/build/chunks/MediaCreator-DDXQIlRv.cjs +0 -2
- package/build/chunks/MediaCreator-DDXQIlRv.cjs.map +0 -1
- package/build/chunks/SystemInfo--669uW1p.cjs +0 -2
- package/build/chunks/SystemInfo--669uW1p.cjs.map +0 -1
- package/build/chunks/SystemInfo-DYq9x4Ch.mjs.map +0 -1
- package/build/chunks/fflate.module-BQhIETD7.mjs.map +0 -1
- package/build/chunks/fflate.module-Chbb_O8w.cjs.map +0 -1
- package/build/index.cjs +0 -57
- package/build/index.cjs.map +0 -1
- package/build/index.mjs +0 -6793
- package/build/index.mjs.map +0 -1
- package/build/src/engine/index.d.ts +0 -1
- package/build/src/engine/pipeline/RenderPipeline.d.ts +0 -26
- package/build/src/error/index.d.ts +0 -4
- package/build/src/modules/_system/ModuleImporter.d.ts +0 -43
- package/build/src/modules/ar/ARSystem.cjs.map +0 -1
- package/build/src/modules/ar/ARSystem.mjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.mjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.mjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.cjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.mjs.map +0 -1
- package/build/src/modules/com/Communication.d.ts +0 -72
- package/build/src/modules/com/actions/camera/computeencompassingview.d.ts +0 -9
- package/build/src/modules/com/actions/camera/getcameratransform.d.ts +0 -9
- package/build/src/modules/com/actions/camera/movecamera.d.ts +0 -15
- package/build/src/modules/com/actions/camera/resetcamera.d.ts +0 -7
- package/build/src/modules/com/actions/camera/setcameralayer.d.ts +0 -7
- package/build/src/modules/com/actions/camera/setcameratransform.d.ts +0 -9
- package/build/src/modules/com/actions/camera/zoomcamera.d.ts +0 -8
- package/build/src/modules/com/actions/index.d.ts +0 -60
- package/build/src/modules/com/actions/media/generatemedia.d.ts +0 -14
- package/build/src/modules/com/actions/object/addobject.d.ts +0 -6
- package/build/src/modules/com/actions/object/deleteobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/deselectobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/getallobjects.d.ts +0 -6
- package/build/src/modules/com/actions/object/getobjects.d.ts +0 -8
- package/build/src/modules/com/actions/object/model/dropit.d.ts +0 -7
- package/build/src/modules/com/actions/object/model/modelloaded.d.ts +0 -7
- package/build/src/modules/com/actions/object/model/placeonfloor.d.ts +0 -7
- package/build/src/modules/com/actions/object/selectobject.d.ts +0 -8
- package/build/src/modules/com/actions/object/setparent.d.ts +0 -13
- package/build/src/modules/com/actions/object/updateobject.d.ts +0 -8
- package/build/src/modules/com/actions/renderer/startrender.d.ts +0 -5
- package/build/src/modules/com/actions/scene/exportscene.d.ts +0 -8
- package/build/src/modules/com/actions/scene/getallscenedata.d.ts +0 -6
- package/build/src/modules/com/actions/scene/launchar.d.ts +0 -9
- package/build/src/modules/com/actions/scene/setbackground.d.ts +0 -7
- package/build/src/modules/com/actions/scene/updatescene.d.ts +0 -11
- package/build/src/modules/com/actions/toolbox/select/setgizmomode.d.ts +0 -7
- package/build/src/modules/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +0 -5
- package/build/src/modules/com/actions/toolbox/transform/setgizmovisible.d.ts +0 -5
- package/build/src/modules/com/actions/toolbox/usetool.d.ts +0 -8
- package/build/src/modules/com/types/COMEntity.d.ts +0 -6
- package/build/src/modules/com/types/COMPov.d.ts +0 -7
- package/build/src/modules/com/types/COMPrimitive.d.ts +0 -11
- package/build/src/modules/com/types/index.d.ts +0 -11
- package/build/src/modules/index.d.ts +0 -2
- package/build/src/modules/mediacreator/MediaCreator.cjs.map +0 -1
- package/build/src/modules/mediacreator/MediaCreator.mjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.cjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs.map +0 -1
- /package/build/{index.d.ts → dive.d.ts} +0 -0
- /package/build/src/modules/{com → state}/types/COMEntityType.d.ts +0 -0
- /package/build/src/modules/{com → state}/types/COMGeometryType.d.ts +0 -0
- /package/build/src/modules/{com → state}/types/COMMaterial.d.ts +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventDispatcher, Event } from 'three';
|
|
2
|
+
import { UUID } from '../../../types/index.ts';
|
|
3
|
+
import { TAnimatorParameters } from '../types/AnimatorParameters.ts';
|
|
4
|
+
type TAnimatorEventMap = {
|
|
5
|
+
play: Event;
|
|
6
|
+
stop: Event;
|
|
7
|
+
};
|
|
8
|
+
export declare class Animator<T extends object> extends EventDispatcher<TAnimatorEventMap> {
|
|
9
|
+
readonly object: T;
|
|
10
|
+
readonly to: T;
|
|
11
|
+
readonly duration: number;
|
|
12
|
+
readonly options?: TAnimatorParameters<T> | undefined;
|
|
13
|
+
private _uuid;
|
|
14
|
+
private _playing;
|
|
15
|
+
private _stopped;
|
|
16
|
+
private _completed;
|
|
17
|
+
constructor(object: T, to: T, duration: number, options?: TAnimatorParameters<T> | undefined);
|
|
18
|
+
get uuid(): UUID;
|
|
19
|
+
get playing(): boolean;
|
|
20
|
+
get stopped(): boolean;
|
|
21
|
+
get completed(): boolean;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
play(): this;
|
|
24
|
+
stop(): this;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
//# sourceMappingURL=ARSystem.cjs.map
|
|
1
|
+
"use strict";var u=Object.defineProperty;var d=(a,e,t)=>e in a?u(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var l=(a,e,t)=>d(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../chunks/SystemInfo-oX-NNneO.cjs"),i=require("../../../chunks/index-DAwIH9xh.cjs"),m=require("../asset/converter/AssetConverter.cjs"),h=require("../asset/loader/AssetLoader.cjs"),y=require("../asset/exporter/AssetExporter.cjs");class S{constructor(){l(this,"converter",new m.AssetConverter(new h.AssetLoader,new y.AssetExporter))}async launch(e,t){const r=await this.convertToUSDZ(e,t);return this.launchARQuickLook(r,t)}async convertToUSDZ(e,t){const r=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:(t==null?void 0:t.arPlacement)==="vertical"?"vertical":"horizontal"}}}),n=new Blob([r],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,t){return new Promise(r=>{(t==null?void 0:t.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",r(),n.click()})}}class _{launch(e,t){const r=self.location.toString(),n=document.createElement("a"),c=this._createParams(r,e,t),o=this._createIntent(r,e,c);n.setAttribute("href",o),n.click()}_createParams(e,t,r){const n=new URL(t,e),c=new URLSearchParams(n.search);return c.set("mode","ar_preferred"),this._applyScaleOption(c,r),this._applyPlacementOption(c,r),this._applySoundOption(c,e),this._applyLinkOption(c,e),c}_applyScaleOption(e,t){(t==null?void 0:t.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,t){(t==null?void 0:t.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,t){if(e.has("sound")){const r=new URL(e.get("sound"),t);e.set("sound",r.toString())}}_applyLinkOption(e,t){if(e.has("link")){const r=new URL(e.get("link"),t);e.set("link",r.toString())}}_createIntent(e,t,r){const n=new URL(e),c=new URL(t,e),o="#model-viewer-no-ar-fallback";return n.hash=o,`intent://arvr.google.com/scene-viewer/1.2?${r.toString()+"&file="+c.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class w{async launch(e,t){const r=s.SystemInfo.getSystem();return r===i.ESystem.IOS?this.tryARQuickLook(e,t):r===i.ESystem.ANDROID?this.trySceneViewer(e,t):Promise.reject(new s.ARCompatibilityError("AR not supported on non-mobile systems",window.navigator.userAgent,window.navigator.platform,window.navigator.vendor))}async tryARQuickLook(e,t){try{s.SystemInfo.getSupportsARQuickLook()}catch(r){return Promise.reject(r)}return new S().launch(e,t)}async trySceneViewer(e,t){try{return new _().launch(e,t)}catch(r){return Promise.reject(r)}}}exports.ARSystem=w;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
2
|
var m = (c, e, t) => e in c ? u(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
|
|
3
3
|
var i = (c, e, t) => m(c, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { S as l,
|
|
4
|
+
import { S as l, A as d } from "../../../chunks/SystemInfo-DPAQG-S5.mjs";
|
|
5
|
+
import { E as s } from "../../../chunks/index-C_uFFwT2.mjs";
|
|
5
6
|
import { AssetConverter as h } from "../asset/converter/AssetConverter.mjs";
|
|
6
|
-
import {
|
|
7
|
+
import { AssetLoader as w } from "../asset/loader/AssetLoader.mjs";
|
|
7
8
|
import { AssetExporter as p } from "../asset/exporter/AssetExporter.mjs";
|
|
8
9
|
class y {
|
|
9
10
|
constructor() {
|
|
@@ -103,7 +104,7 @@ class S {
|
|
|
103
104
|
)};end;`;
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
class
|
|
107
|
+
class A {
|
|
107
108
|
/**
|
|
108
109
|
* Launches an AR experience using the appropriate platform-specific implementation
|
|
109
110
|
*
|
|
@@ -158,6 +159,5 @@ class R {
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
export {
|
|
161
|
-
|
|
162
|
+
A as ARSystem
|
|
162
163
|
};
|
|
163
|
-
//# sourceMappingURL=ARSystem.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DIVEEngine } from '../../../engine';
|
|
1
|
+
import { OrbitController } from '../../../modules/controller/orbit/OrbitController.ts';
|
|
2
|
+
import { DIVEEngine } from '../../../engine/Engine.ts';
|
|
3
3
|
export declare class DIVEWebXR {
|
|
4
4
|
private static _renderer;
|
|
5
5
|
private static _scene;
|
|
@@ -12,7 +12,7 @@ export declare class DIVEWebXR {
|
|
|
12
12
|
private static _overlay;
|
|
13
13
|
private static _options;
|
|
14
14
|
private static _xrController;
|
|
15
|
-
static Launch(engine: DIVEEngine, controller:
|
|
15
|
+
static Launch(engine: DIVEEngine, controller: OrbitController): Promise<void>;
|
|
16
16
|
static Update(_time: DOMHighResTimeStamp, frame: XRFrame): void;
|
|
17
17
|
static End(): void;
|
|
18
18
|
private static _onSessionStarted;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Object3D } from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import { DIVEScene } from '../../../../engine/scene/Scene';
|
|
2
|
+
import { DIVERenderPipeline } from '../../../../engine/renderer/Renderer.ts';
|
|
3
|
+
import { DIVEScene } from '../../../../engine/scene/Scene.ts';
|
|
4
4
|
export declare class DIVEWebXRController extends Object3D {
|
|
5
5
|
private _renderer;
|
|
6
6
|
private _scene;
|
|
@@ -23,7 +23,7 @@ export declare class DIVEWebXRController extends Object3D {
|
|
|
23
23
|
private _touchQuaterion;
|
|
24
24
|
private _touchScale;
|
|
25
25
|
private _scaleThreshold;
|
|
26
|
-
constructor(session: XRSession, renderer:
|
|
26
|
+
constructor(session: XRSession, renderer: DIVERenderPipeline, scene: DIVEScene);
|
|
27
27
|
Init(): Promise<this>;
|
|
28
28
|
Dispose(): void;
|
|
29
29
|
Update(frame: XRFrame): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Matrix4, Quaternion, Vector3 } from 'three';
|
|
2
|
-
import {
|
|
2
|
+
import { DIVERenderPipeline } from '../../../../engine/renderer/Renderer.ts';
|
|
3
3
|
export declare class DIVEWebXROrigin {
|
|
4
4
|
private _renderer;
|
|
5
5
|
private _session;
|
|
@@ -22,7 +22,7 @@ export declare class DIVEWebXROrigin {
|
|
|
22
22
|
get quaternion(): Quaternion;
|
|
23
23
|
private _scale;
|
|
24
24
|
get scale(): Vector3;
|
|
25
|
-
constructor(session: XRSession, renderer:
|
|
25
|
+
constructor(session: XRSession, renderer: DIVERenderPipeline, entityTypes?: XRHitTestTrackableType[]);
|
|
26
26
|
Init(): Promise<this>;
|
|
27
27
|
Dispose(): void;
|
|
28
28
|
Update(frame: XRFrame): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Matrix4, Mesh, Vector3 } from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import { DIVEScene } from '../../../../engine/scene/Scene';
|
|
4
|
-
import { DIVEEventExecutor } from '../../../../modules/events/EventExecutor';
|
|
2
|
+
import { DIVERenderPipeline } from '../../../../engine/renderer/Renderer.ts';
|
|
3
|
+
import { DIVEScene } from '../../../../engine/scene/Scene.ts';
|
|
4
|
+
import { DIVEEventExecutor } from '../../../../modules/events/EventExecutor.ts';
|
|
5
5
|
/**
|
|
6
6
|
* object is undefined when AR world is hit.
|
|
7
7
|
*/
|
|
@@ -28,7 +28,7 @@ export declare class DIVEWebXRRaycaster extends DIVEEventExecutor<DIVEWebXRRayca
|
|
|
28
28
|
private _arHitResultBuffer;
|
|
29
29
|
private _sceneHitResultBuffer;
|
|
30
30
|
private _hasHit;
|
|
31
|
-
constructor(session: XRSession, renderer:
|
|
31
|
+
constructor(session: XRSession, renderer: DIVERenderPipeline, scene: DIVEScene);
|
|
32
32
|
Dispose(): void;
|
|
33
33
|
Init(): Promise<this>;
|
|
34
34
|
GetARIntersections(frame: XRFrame): DIVEHitResult[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DIVEHitResult } from '../WebXRRaycaster';
|
|
1
|
+
import { DIVERenderPipeline } from '../../../../../engine/renderer/Renderer.ts';
|
|
2
|
+
import { DIVEHitResult } from '../WebXRRaycaster.ts';
|
|
3
3
|
export declare class DIVEWebXRRaycasterAR {
|
|
4
4
|
private _session;
|
|
5
5
|
private _renderer;
|
|
@@ -8,7 +8,7 @@ export declare class DIVEWebXRRaycasterAR {
|
|
|
8
8
|
private _requesting;
|
|
9
9
|
private _initialized;
|
|
10
10
|
private _hitMatrixBuffer;
|
|
11
|
-
constructor(session: XRSession, renderer:
|
|
11
|
+
constructor(session: XRSession, renderer: DIVERenderPipeline);
|
|
12
12
|
Dispose(): void;
|
|
13
13
|
Init(): Promise<this>;
|
|
14
14
|
GetIntersections(frame: XRFrame): DIVEHitResult[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DIVEScene } from '../../../../../engine/scene/Scene';
|
|
3
|
-
import { DIVEHitResult } from '../WebXRRaycaster';
|
|
1
|
+
import { DIVERenderPipeline } from '../../../../../engine/renderer/Renderer.ts';
|
|
2
|
+
import { DIVEScene } from '../../../../../engine/scene/Scene.ts';
|
|
3
|
+
import { DIVEHitResult } from '../WebXRRaycaster.ts';
|
|
4
4
|
export declare class DIVEWebXRRaycasterTHREE {
|
|
5
5
|
private _renderer;
|
|
6
6
|
private _scene;
|
|
7
7
|
private _controller;
|
|
8
8
|
private _raycaster;
|
|
9
|
-
constructor(renderer:
|
|
9
|
+
constructor(renderer: DIVERenderPipeline, scene: DIVEScene);
|
|
10
10
|
Init(): Promise<this>;
|
|
11
11
|
GetIntersections(): DIVEHitResult[];
|
|
12
12
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
"use strict";var i=Object.defineProperty;var n=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>n(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class a{constructor(t,r){o(this,"_uri","");this._loader=t,this._exporter=r}convert(t){return this._uri=t,{to:this._to.bind(this)}}async _to(t,r){const s=await this._loader.load(this._uri);return this._exporter.export(s,t,r)}}exports.AssetConverter=a;
|
|
2
|
-
//# sourceMappingURL=AssetConverter.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetLoader } from '../loader/AssetLoader';
|
|
2
|
-
import { AssetExporter, FileTypeToExporterOptions } from '../exporter/AssetExporter';
|
|
3
|
-
import { FileType } from '../../../types/file';
|
|
1
|
+
import { AssetLoader } from '../loader/AssetLoader.ts';
|
|
2
|
+
import { AssetExporter, FileTypeToExporterOptions } from '../exporter/AssetExporter.ts';
|
|
3
|
+
import { FileType } from '../../../types/file/index.ts';
|
|
4
4
|
declare global {
|
|
5
5
|
interface ModuleClasses {
|
|
6
6
|
AssetConverter: typeof AssetConverter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ce=Object.defineProperty;var ue=(n,e,s)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var H=(n,e,s)=>ue(n,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),N=require("../../../../chunks/
|
|
1
|
+
"use strict";var ce=Object.defineProperty;var ue=(n,e,s)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var H=(n,e,s)=>ue(n,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),N=require("../../../../chunks/parse-error-2f5qpXP5.cjs");let $,V,C,D;function k(n,e=1/0,s=null){V||(V=new d.PlaneGeometry(2,2,1,1)),C||(C=new d.ShaderMaterial({uniforms:{blitTexture:new d.Uniform(n)},vertexShader:`
|
|
2
2
|
varying vec2 vUv;
|
|
3
3
|
void main(){
|
|
4
4
|
vUv = uv;
|
|
@@ -162,4 +162,3 @@ ${i.join(`
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
`}class We{constructor(){H(this,"_gltfExporter");H(this,"_usdzExporter");this._gltfExporter=new W,this._usdzExporter=new Ce}async export(e,s,t){switch(s){case"glb":return this._exportGlb(e,t);case"gltf":return this._exportGltf(e,t);case"usdz":return this._exportUsdz(e,t);default:throw new N.FileTypeError(`Unsupported file type: ${s}`,s)}}async _exportGlb(e,s){try{const t=await this._gltfExporter.parseAsync(e,{...s,binary:!0});if(t instanceof ArrayBuffer)return t;throw new N.ParseError("Failed to export GLB: expected ArrayBuffer")}catch(t){throw t instanceof N.ParseError?t:new N.ParseError("Failed to export GLB",t)}}async _exportGltf(e,s){try{const t=await this._gltfExporter.parseAsync(e,{...s,binary:!1}),r=JSON.stringify(t);return new TextEncoder().encode(r).buffer}catch(t){throw t instanceof N.ParseError?t:new N.ParseError("Failed to export GLTF",t)}}async _exportUsdz(e,s){try{return(await this._usdzExporter.parse(e,s)).buffer}catch(t){throw t instanceof N.ParseError?t:new N.ParseError("Failed to export USDZ",t)}}}exports.AssetExporter=We;
|
|
165
|
-
//# sourceMappingURL=AssetExporter.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Object3D } from 'three';
|
|
2
|
-
import { GLTFExporterOptions as THREEGLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter';
|
|
3
|
-
import { USDZExporterOptions as THREEUSDZExporterOptions } from 'three/examples/jsm/exporters/USDZExporter';
|
|
4
|
-
import { FileType } from '../../../types/file';
|
|
2
|
+
import { GLTFExporterOptions as THREEGLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter.js';
|
|
3
|
+
import { USDZExporterOptions as THREEUSDZExporterOptions } from 'three/examples/jsm/exporters/USDZExporter.js';
|
|
4
|
+
import { FileType } from '../../../types/file/FileTypes.ts';
|
|
5
5
|
declare global {
|
|
6
6
|
interface ModuleClasses {
|
|
7
7
|
AssetExporter: typeof AssetExporter;
|
|
@@ -2,7 +2,7 @@ var Te = Object.defineProperty;
|
|
|
2
2
|
var Me = (n, e, s) => e in n ? Te(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
|
|
3
3
|
var Y = (n, e, s) => Me(n, typeof e != "symbol" ? e + "" : e, s);
|
|
4
4
|
import { PlaneGeometry as ye, ShaderMaterial as we, Uniform as Ee, SRGBColorSpace as ue, Mesh as be, PerspectiveCamera as Ae, Scene as Z, WebGLRenderer as Ie, CanvasTexture as Re, Color as _e, Matrix4 as le, Vector3 as B, Quaternion as Se, BufferAttribute as L, CompressedTexture as j, Source as Ne, NoColorSpace as fe, MathUtils as q, RGBAFormat as Le, DoubleSide as pe, PropertyBinding as H, InterpolateDiscrete as ve, NearestFilter as Ce, NearestMipmapNearestFilter as Ue, NearestMipmapLinearFilter as Fe, LinearFilter as $e, LinearMipmapNearestFilter as Oe, LinearMipmapLinearFilter as Pe, ClampToEdgeWrapping as De, RepeatWrapping as Ge, MirroredRepeatWrapping as ke, InterpolateLinear as ze } from "three";
|
|
5
|
-
import { s as he, z as Be, F as He, P as N } from "../../../../chunks/
|
|
5
|
+
import { s as he, z as Be, F as He, P as N } from "../../../../chunks/parse-error-DRBVHL9E.mjs";
|
|
6
6
|
let O, K, C, G;
|
|
7
7
|
function z(n, e = 1 / 0, s = null) {
|
|
8
8
|
K || (K = new ye(2, 2, 1, 1)), C || (C = new we({
|
|
@@ -1618,4 +1618,3 @@ class vt {
|
|
|
1618
1618
|
export {
|
|
1619
1619
|
vt as AssetExporter
|
|
1620
1620
|
};
|
|
1621
|
-
//# sourceMappingURL=AssetExporter.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../chunks/AssetLoader-BYhwzCxs.cjs");require("../../../../chunks/fflate.module-Chbb_O8w.cjs");require("three");exports.AssetLoader=e.AssetLoader;
|
|
2
|
-
|
|
1
|
+
"use strict";var re=Object.defineProperty;var ie=(h,t,e)=>t in h?re(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var H=(h,t,e)=>ie(h,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("three"),P=require("../../../../chunks/parse-error-2f5qpXP5.cjs"),v=require("../../../../chunks/FileTypes-BjZ0rrIV.cjs");function q(h,t){if(t===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===l.TriangleFanDrawMode||t===l.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const s=[],a=h.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)s.push(o);h.setIndex(s),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const i=e.count-2,n=[];if(t===l.TriangleFanDrawMode)for(let s=1;s<=i;s++)n.push(e.getX(0)),n.push(e.getX(s)),n.push(e.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(n.push(e.getX(s)),n.push(e.getX(s+1)),n.push(e.getX(s+2))):(n.push(e.getX(s+2)),n.push(e.getX(s+1)),n.push(e.getX(s)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=h.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class oe extends l.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new fe(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new we(e)})}load(t,e,i,n){const r=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=l.LoaderUtils.extractUrlBase(t);s=l.LoaderUtils.resolveURL(c,this.path)}else s=l.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},o=new l.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{r.parse(c,s,function(f){e(f),r.manager.itemEnd(t)},a)}catch(f){a(f)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let r;const s={},a={},o=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===ee){try{s[w.KHR_BINARY_GLTF]=new ye(t)}catch(u){n&&n(u);return}r=JSON.parse(s[w.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ke(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const u=this.pluginCallbacks[f](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){const u=r.extensionsUsed[f],m=r.extensionsRequired||[];switch(u){case w.KHR_MATERIALS_UNLIT:s[u]=new le;break;case w.KHR_DRACO_MESH_COMPRESSION:s[u]=new Le(r,this.dracoLoader);break;case w.KHR_TEXTURE_TRANSFORM:s[u]=new _e;break;case w.KHR_MESH_QUANTIZATION:s[u]=new be;break;default:m.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function ae(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},removeAll:function(){h={}}}}const w={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ce{constructor(t){this.parser=t,this.name=w.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const r=e[i];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const r=e.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let c;const f=new l.Color(16777215);o.color!==void 0&&f.setRGB(o.color[0],o.color[1],o.color[2],l.LinearSRGBColorSpace);const u=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new l.DirectionalLight(f),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new l.PointLight(f),c.distance=u;break;case"spot":c=new l.SpotLight(f),c.distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,F(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(i,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,r=i.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return i._getNodeRef(e.cache,a,o)})}}class le{constructor(){this.name=w.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(t,e,i){const n=[];t.color=new l.Color(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;t.color.setRGB(s[0],s[1],s[2],l.LinearSRGBColorSpace),t.opacity=s[3]}r.baseColorTexture!==void 0&&n.push(i.assignTexture(t,"map",r.baseColorTexture,l.SRGBColorSpace))}return Promise.all(n)}}class ue{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(e.emissiveIntensity=r),Promise.resolve()}}class fe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(i.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class de{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(i.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&r.push(i.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class he{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_SHEEN}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new l.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(i.assignTexture(e,"sheenColorMap",s.sheenColorTexture,l.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class pe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(i.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class me{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_VOLUME}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(i.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),Promise.all(r)}}class ge{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_IOR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Ae{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_SPECULAR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(i.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=new l.Color().setRGB(a[0],a[1],a[2],l.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&r.push(i.assignTexture(e,"specularColorMap",s.specularColorTexture,l.SRGBColorSpace)),Promise.all(r)}}class Te{constructor(t){this.parser=t,this.name=w.EXT_MATERIALS_BUMP}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&r.push(i.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class xe{constructor(t){this.parser=t,this.name=w.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(i.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Re{constructor(t){this.parser=t,this.name=w.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Se{constructor(t){this.parser=t,this.name=w.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Ee{constructor(t){this.parser=t,this.name=w.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Me{constructor(t){this.name=w.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,f=n.count,u=n.byteStride,m=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(f,u,m,n.mode,n.filter).then(function(T){return T.buffer}):s.ready.then(function(){const T=new ArrayBuffer(f*u);return s.decodeGltfBuffer(new Uint8Array(T),f,u,m,n.mode,n.filter),T})})}else return null}}class we{constructor(t){this.name=w.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=i.extensions[this.name].attributes,a=[],o={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(f=>(o[c]=f,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const f=c.pop(),u=f.isGroup?f.children:[f],m=c[0].count,T=[];for(const R of u){const y=new l.Matrix4,x=new l.Vector3,S=new l.Quaternion,L=new l.Vector3(1,1,1),_=new l.InstancedMesh(R.geometry,R.material,m);for(let M=0;M<m;M++)o.TRANSLATION&&x.fromBufferAttribute(o.TRANSLATION,M),o.ROTATION&&S.fromBufferAttribute(o.ROTATION,M),o.SCALE&&L.fromBufferAttribute(o.SCALE,M),_.setMatrixAt(M,y.compose(x,S,L));for(const M in o)if(M==="_COLOR_0"){const N=o[M];_.instanceColor=new l.InstancedBufferAttribute(N.array,N.itemSize,N.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&R.geometry.setAttribute(M,o[M]);l.Object3D.prototype.copy.call(_,R),this.parser.assignFinalMaterial(_),T.push(_)}return f.isGroup?(f.clear(),f.add(...T),f):T[0]}))}}const ee="glTF",G=12,Y={JSON:1313821514,BIN:5130562};class ye{constructor(t){this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,G),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,r=new DataView(t,G);let s=0;for(;s<n;){const a=r.getUint32(s,!0);s+=4;const o=r.getUint32(s,!0);if(s+=4,o===Y.JSON){const c=new Uint8Array(t,G+s,a);this.content=i.decode(c)}else if(o===Y.BIN){const c=G+s;this.body=t.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Le{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},c={};for(const f in s){const u=V[f]||f.toLowerCase();a[u]=s[f]}for(const f in t.attributes){const u=V[f]||f.toLowerCase();if(s[f]!==void 0){const m=i.accessors[t.attributes[f]],T=B[m.componentType];c[u]=T.name,o[u]=m.normalized===!0}}return e.getDependency("bufferView",r).then(function(f){return new Promise(function(u,m){n.decodeDracoFile(f,function(T){for(const R in T.attributes){const y=T.attributes[R],x=o[R];x!==void 0&&(y.normalized=x)}u(T)},a,c,l.LinearSRGBColorSpace,m)})})}}class _e{constructor(){this.name=w.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class be{constructor(){this.name=w.KHR_MESH_QUANTIZATION}}class te extends l.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let s=0;s!==n;s++)e[s]=i[r+s];return e}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,f=n-e,u=(i-e)/f,m=u*u,T=m*u,R=t*c,y=R-c,x=-2*T+3*m,S=T-m,L=1-x,_=S-m+u;for(let M=0;M!==a;M++){const N=s[y+M+a],C=s[y+M+o]*f,b=s[R+M+a],d=s[R+M]*f;r[M]=L*N+_*C+x*b+S*d}return r}}const Ne=new l.Quaternion;class Ce extends te{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return Ne.fromArray(r).normalize().toArray(r),r}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},B={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Q={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},J={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},V={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ie={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},j={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Oe(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),h.DefaultMaterial}function D(h,t,e){for(const i in e.extensions)h[i]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=e.extensions[i])}function F(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Fe(h,t,e){let i=!1,n=!1,r=!1;for(let c=0,f=t.length;c<f;c++){const u=t[c];if(u.POSITION!==void 0&&(i=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(r=!0),i&&n&&r)break}if(!i&&!n&&!r)return Promise.resolve(h);const s=[],a=[],o=[];for(let c=0,f=t.length;c<f;c++){const u=t[c];if(i){const m=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):h.attributes.position;s.push(m)}if(n){const m=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):h.attributes.normal;a.push(m)}if(r){const m=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):h.attributes.color;o.push(m)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o)]).then(function(c){const f=c[0],u=c[1],m=c[2];return i&&(h.morphAttributes.position=f),n&&(h.morphAttributes.normal=u),r&&(h.morphAttributes.color=m),h.morphTargetsRelative=!0,h})}function De(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,i=t.weights.length;e<i;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let i=0,n=e.length;i<n;i++)h.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Pe(h){let t;const e=h.extensions&&h.extensions[w.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+K(e.attributes):t=h.indices+":"+K(h.attributes)+":"+h.mode,h.targets!==void 0)for(let i=0,n=h.targets.length;i<n;i++)t+=":"+K(h.targets[i]);return t}function K(h){let t="";const e=Object.keys(h).sort();for(let i=0,n=e.length;i<n;i++)t+=e[i]+":"+h[e[i]]+";";return t}function X(h){switch(h){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Be(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ge=new l.Matrix4;class ke{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ae,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,r=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,r=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||n&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:i,userData:{}};return D(r,a,n),F(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n].joints;for(let a=0,o=s.length;a<o;a++)t[s[a]].isBone=!0}for(let n=0,r=t.length;n<r;n++){const s=t[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),r=(s,a)=>{const o=this.associations.get(s);o!=null&&this.associations.set(a,o);for(const[c,f]of s.children.entries())r(f,a.children[c])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&i.push(r)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(r,s){return i.getDependency(t,s)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,s){i.load(l.LoaderUtils.resolveURL(e.uri,n.path),r,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(i){const n=e.byteLength||0,r=e.byteOffset||0;return i.slice(r,r+n)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const s=U[n.type],a=B[n.componentType],o=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new l.BufferAttribute(c,s,o))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],o=U[n.type],c=B[n.componentType],f=c.BYTES_PER_ELEMENT,u=f*o,m=n.byteOffset||0,T=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,R=n.normalized===!0;let y,x;if(T&&T!==u){const S=Math.floor(m/T),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+S+":"+n.count;let _=e.cache.get(L);_||(y=new c(a,S*T,n.count*T/f),_=new l.InterleavedBuffer(y,T/f),e.cache.add(L,_)),x=new l.InterleavedBufferAttribute(_,o,m%T/f,R)}else a===null?y=new c(n.count*o):y=new c(a,m,n.count*o),x=new l.BufferAttribute(y,o,R);if(n.sparse!==void 0){const S=U.SCALAR,L=B[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,M=n.sparse.values.byteOffset||0,N=new L(s[1],_,n.sparse.count*S),C=new c(s[2],M,n.sparse.count*o);a!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let b=0,d=N.length;b<d;b++){const p=N[b];if(x.setX(p,C[b*o]),o>=2&&x.setY(p,C[b*o+1]),o>=3&&x.setZ(p,C[b*o+2]),o>=4&&x.setW(p,C[b*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(t){const e=this.json,i=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const o=i.manager.getHandler(s.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(f){f.flipY=!1,f.name=s.name||a.name||"",f.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(f.name=a.uri);const m=(r.samplers||{})[s.sampler]||{};return f.magFilter=Q[m.magFilter]||l.LinearFilter,f.minFilter=Q[m.minFilter]||l.LinearMipmapLinearFilter,f.wrapS=J[m.wrapS]||l.RepeatWrapping,f.wrapT=J[m.wrapT]||l.RepeatWrapping,n.associations.set(f,{textures:t}),f}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(s.bufferView!==void 0)o=i.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const m=new Blob([u],{type:s.mimeType});return o=a.createObjectURL(m),o});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(o).then(function(u){return new Promise(function(m,T){let R=m;e.isImageBitmapLoader===!0&&(R=function(y){const x=new l.Texture(y);x.needsUpdate=!0,m(x)}),e.load(l.LoaderUtils.resolveURL(u,r.path),R,void 0,T)})}).then(function(u){return c===!0&&a.revokeObjectURL(o),u.userData.mimeType=s.mimeType||Be(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[t]=f,f}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),r.extensions[w.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[w.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,o)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new l.PointsMaterial,l.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new l.LineBasicMaterial,l.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||r||s){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),r&&(o.vertexColors=!0),s&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=r.extensions||{},c=[];if(o[w.KHR_MATERIALS_UNLIT]){const u=n[w.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,r,e))}else{const u=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const m=u.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],l.LinearSRGBColorSpace),a.opacity=m[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,l.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const f=r.alphaMode||j.OPAQUE;if(f===j.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,f===j.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&s!==l.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==l.MeshBasicMaterial){const u=r.emissiveFactor;a.emissive=new l.Color().setRGB(u[0],u[1],u[2],l.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&s!==l.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,l.SRGBColorSpace)),Promise.all(c).then(function(){const u=new s(a);return r.name&&(u.name=r.name),F(u,r),e.associations.set(u,{materials:t}),r.extensions&&D(n,u,r),u})}createUniqueName(t){const e=l.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(a){return i[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return Z(o,a,e)})}const s=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],f=Pe(c),u=n[f];if(u)s.push(u.promise);else{let m;c.extensions&&c.extensions[w.KHR_DRACO_MESH_COMPRESSION]?m=r(c):m=Z(new l.BufferGeometry,c,e),n[f]={primitive:c,promise:m},s.push(m)}}return Promise.all(s)}loadMesh(t){const e=this,i=this.json,n=this.extensions,r=i.meshes[t],s=r.primitives,a=[];for(let o=0,c=s.length;o<c;o++){const f=s[o].material===void 0?Oe(this.cache):this.getDependency("material",s[o].material);a.push(f)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),f=o[o.length-1],u=[];for(let T=0,R=f.length;T<R;T++){const y=f[T],x=s[T];let S;const L=c[T];if(x.mode===I.TRIANGLES||x.mode===I.TRIANGLE_STRIP||x.mode===I.TRIANGLE_FAN||x.mode===void 0)S=r.isSkinnedMesh===!0?new l.SkinnedMesh(y,L):new l.Mesh(y,L),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),x.mode===I.TRIANGLE_STRIP?S.geometry=q(S.geometry,l.TriangleStripDrawMode):x.mode===I.TRIANGLE_FAN&&(S.geometry=q(S.geometry,l.TriangleFanDrawMode));else if(x.mode===I.LINES)S=new l.LineSegments(y,L);else if(x.mode===I.LINE_STRIP)S=new l.Line(y,L);else if(x.mode===I.LINE_LOOP)S=new l.LineLoop(y,L);else if(x.mode===I.POINTS)S=new l.Points(y,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(S.geometry.morphAttributes).length>0&&De(S,r),S.name=e.createUniqueName(r.name||"mesh_"+t),F(S,r),x.extensions&&D(n,S,x),e.assignFinalMaterial(S),u.push(S)}for(let T=0,R=u.length;T<R;T++)e.associations.set(u[T],{meshes:t,primitives:T});if(u.length===1)return r.extensions&&D(n,u[0],r),u[0];const m=new l.Group;r.extensions&&D(n,m,r),e.associations.set(m,{meshes:t});for(let T=0,R=u.length;T<R;T++)m.add(u[T]);return m})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?e=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(e=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),F(e,i),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],i=[];for(let n=0,r=e.joints.length;n<r;n++)i.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const r=n.pop(),s=n,a=[],o=[];for(let c=0,f=s.length;c<f;c++){const u=s[c];if(u){a.push(u);const m=new l.Matrix4;r!==null&&m.fromArray(r.array,c*16),o.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new l.Skeleton(a,o)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],r=n.name?n.name:"animation_"+t,s=[],a=[],o=[],c=[],f=[];for(let u=0,m=n.channels.length;u<m;u++){const T=n.channels[u],R=n.samplers[T.sampler],y=T.target,x=y.node,S=n.parameters!==void 0?n.parameters[R.input]:R.input,L=n.parameters!==void 0?n.parameters[R.output]:R.output;y.node!==void 0&&(s.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",S)),o.push(this.getDependency("accessor",L)),c.push(R),f.push(y))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(f)]).then(function(u){const m=u[0],T=u[1],R=u[2],y=u[3],x=u[4],S=[];for(let L=0,_=m.length;L<_;L++){const M=m[L],N=T[L],C=R[L],b=y[L],d=x[L];if(M===void 0)continue;M.updateMatrix&&M.updateMatrix();const p=i._createAnimationTracks(M,N,C,b,d);if(p)for(let g=0;g<p.length;g++)S.push(p[g])}return new l.AnimationClip(r,void 0,S)})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(r){const s=i._getNodeRef(i.meshCache,n.mesh,r);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),s})}loadNode(t){const e=this.json,i=this,n=e.nodes[t],r=i._loadNodeShallow(t),s=[],a=n.children||[];for(let c=0,f=a.length;c<f;c++)s.push(i.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([r,Promise.all(s),o]).then(function(c){const f=c[0],u=c[1],m=c[2];m!==null&&f.traverse(function(T){T.isSkinnedMesh&&T.bind(m,Ge)});for(let T=0,R=u.length;T<R;T++)f.add(u[T]);return f})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let f;if(r.isBone===!0?f=new l.Bone:c.length>1?f=new l.Group:c.length===1?f=c[0]:f=new l.Object3D,f!==c[0])for(let u=0,m=c.length;u<m;u++)f.add(c[u]);if(r.name&&(f.userData.name=r.name,f.name=s),F(f,r),r.extensions&&D(i,f,r),r.matrix!==void 0){const u=new l.Matrix4;u.fromArray(r.matrix),f.applyMatrix4(u)}else r.translation!==void 0&&f.position.fromArray(r.translation),r.rotation!==void 0&&f.quaternion.fromArray(r.rotation),r.scale!==void 0&&f.scale.fromArray(r.scale);return n.associations.has(f)||n.associations.set(f,{}),n.associations.get(f).nodes=t,f}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,r=new l.Group;i.name&&(r.name=n.createUniqueName(i.name)),F(r,i),i.extensions&&D(e,r,i);const s=i.nodes||[],a=[];for(let o=0,c=s.length;o<c;o++)a.push(n.getDependency("node",s[o]));return Promise.all(a).then(function(o){for(let f=0,u=o.length;f<u;f++)r.add(o[f]);const c=f=>{const u=new Map;for(const[m,T]of n.associations)(m instanceof l.Material||m instanceof l.Texture)&&u.set(m,T);return f.traverse(m=>{const T=n.associations.get(m);T!=null&&u.set(m,T)}),u};return n.associations=c(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];O[r.path]===O.weights?t.traverse(function(m){m.morphTargetInfluences&&o.push(m.name?m.name:m.uuid)}):o.push(a);let c;switch(O[r.path]){case O.weights:c=l.NumberKeyframeTrack;break;case O.rotation:c=l.QuaternionKeyframeTrack;break;case O.position:case O.scale:c=l.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:c=l.NumberKeyframeTrack;break;case 2:case 3:default:c=l.VectorKeyframeTrack;break}break}const f=n.interpolation!==void 0?Ie[n.interpolation]:l.InterpolateLinear,u=this._getArrayFromAccessor(i);for(let m=0,T=o.length;m<T;m++){const R=new c(o[m]+"."+O[r.path],e.array,u,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),s.push(R)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const i=X(e.constructor),n=new Float32Array(e.length);for(let r=0,s=e.length;r<s;r++)n[r]=e[r]*i;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(i){const n=this instanceof l.QuaternionKeyframeTrack?Ce:te;return new n(this.times,this.values,this.getValueSize()/3,i)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function He(h,t,e){const i=t.attributes,n=new l.Box3;if(i.POSITION!==void 0){const a=e.json.accessors[i.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new l.Vector3(o[0],o[1],o[2]),new l.Vector3(c[0],c[1],c[2])),a.normalized){const f=X(B[a.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=t.targets;if(r!==void 0){const a=new l.Vector3,o=new l.Vector3;for(let c=0,f=r.length;c<f;c++){const u=r[c];if(u.POSITION!==void 0){const m=e.json.accessors[u.POSITION],T=m.min,R=m.max;if(T!==void 0&&R!==void 0){if(o.setX(Math.max(Math.abs(T[0]),Math.abs(R[0]))),o.setY(Math.max(Math.abs(T[1]),Math.abs(R[1]))),o.setZ(Math.max(Math.abs(T[2]),Math.abs(R[2]))),m.normalized){const y=X(B[m.componentType]);o.multiplyScalar(y)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const s=new l.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=s}function Z(h,t,e){const i=t.attributes,n=[];function r(s,a){return e.getDependency("accessor",s).then(function(o){h.setAttribute(a,o)})}for(const s in i){const a=V[s]||s.toLowerCase();a in h.attributes||n.push(r(i[s],a))}if(t.indices!==void 0&&!h.index){const s=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(s)}return l.ColorManagement.workingColorSpace!==l.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l.ColorManagement.workingColorSpace}" not supported.`),F(h,t),He(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Fe(h,t.targets,e):h})}class ve{parse(t){const e={},i=t.split(`
|
|
2
|
+
`);let n=null,r=e;const s=[e];for(const a of i)if(a.includes("=")){const o=a.split("="),c=o[0].trim(),f=o[1].trim();if(f.endsWith("{")){const u={};s.push(u),r[c]=u,r=u}else r[c]=f}else if(a.endsWith("{")){const o=r[n]||{};s.push(o),r[n]=o,r=o}else if(a.endsWith("}")){if(s.pop(),s.length===0)continue;r=s[s.length-1]}else if(a.endsWith("(")){const o={};s.push(o),n=a.split("(")[0].trim()||n,r[n]=o,r=o}else a.endsWith(")")?(s.pop(),r=s[s.length-1]):n=a.trim();return e}}class Ue extends l.Loader{constructor(t){super(t)}load(t,e,i,n){const r=this,s=new l.FileLoader(r.manager);s.setPath(r.path),s.setResponseType("arraybuffer"),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(a){try{e(r.parse(a))}catch(o){n?n(o):console.error(o),r.manager.itemError(t)}},i,n)}parse(t){const e=new ve;function i(d){const p={};new l.FileLoader().setResponseType("arraybuffer");for(const A in d){if(A.endsWith("png")){const E=new Blob([d[A]],{type:{type:"image/png"}});p[A]=URL.createObjectURL(E)}if(A.endsWith("usd")||A.endsWith("usda")){if(n(d[A])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const E=P.strFromU8(d[A]);p[A]=e.parse(E)}}return p}function n(d){const p=d.slice(0,7),g=new Uint8Array([80,88,82,45,85,83,68,67]);return p.every((A,E)=>A===g[E])}function r(d){if(d.length<1)return;const p=Object.keys(d)[0];let g=!1;if(p.endsWith("usda"))return d[p];if(p.endsWith("usdc"))g=!0;else if(p.endsWith("usd"))if(n(d[p]))g=!0;else return d[p];g&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const s=P.unzipSync(new Uint8Array(t)),a=i(s),o=r(s);if(o===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new l.Group;const c=P.strFromU8(o),f=e.parse(c);function u(d){if(d){if("prepend references"in d){const g=d["prepend references"].split("@"),A=g[1].replace(/^.\//,""),E=g[2].replace(/^<\//,"").replace(/>$/,"");return m(a[A],E)}return m(d)}}function m(d,p){if(d){if(p!==void 0){const g=`def Mesh "${p}"`;if(g in d)return d[g]}for(const g in d){const A=d[g];if(g.startsWith("def Mesh"))return"point3f[] points"in d&&(A["point3f[] points"]=d["point3f[] points"]),"texCoord2f[] primvars:st"in d&&(A["texCoord2f[] primvars:st"]=d["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in d&&(A["int[] primvars:st:indices"]=d["int[] primvars:st:indices"]),A;if(typeof A=="object"){const E=m(A);if(E)return E}}}}function T(d){if(!d)return;let p=new l.BufferGeometry;if("int[] faceVertexIndices"in d){const g=JSON.parse(d["int[] faceVertexIndices"]);p.setIndex(g)}if("point3f[] points"in d){const g=JSON.parse(d["point3f[] points"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("position",A)}if("normal3f[] normals"in d){const g=JSON.parse(d["normal3f[] normals"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),3);p.setAttribute("normal",A)}else p.computeVertexNormals();if("float2[] primvars:st"in d&&(d["texCoord2f[] primvars:st"]=d["float2[] primvars:st"]),"texCoord2f[] primvars:st"in d){const g=JSON.parse(d["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),A=new l.BufferAttribute(new Float32Array(g),2);if("int[] primvars:st:indices"in d){p=p.toNonIndexed();const E=JSON.parse(d["int[] primvars:st:indices"]);p.setAttribute("uv",R(A,E))}else p.setAttribute("uv",A)}return p}function R(d,p){const g=d.array,A=d.itemSize,E=new g.constructor(p.length*A);let W=0,ne=0;for(let k=0,se=p.length;k<se;k++){W=p[k]*A;for(let z=0;z<A;z++)E[ne++]=g[W++]}return new l.BufferAttribute(E,A)}function y(d){if(d){if("rel material:binding"in d){const A=d["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return x(f,` "${A[1]}"`)}return x(d)}}function x(d,p=""){for(const g in d){const A=d[g];if(g.startsWith("def Material"+p))return A;if(typeof A=="object"){const E=x(A,p);if(E)return E}}}function S(d,p){p["float inputs:rotation"]&&(d.rotation=parseFloat(p["float inputs:rotation"])),p["float2 inputs:scale"]&&(d.repeat=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),p["float2 inputs:translation"]&&(d.offset=new l.Vector2().fromArray(JSON.parse("["+p["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function L(d){const p=new l.MeshPhysicalMaterial;if(d!==void 0){if('def Shader "PreviewSurface"'in d){const g=d['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in g){const A=g["color3f inputs:diffuseColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.map=M(E),p.map.colorSpace=l.SRGBColorSpace,'def Shader "Transform2d_diffuse"'in d&&S(p.map,d['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in g){const A=g["color3f inputs:diffuseColor"].replace(/[()]*/g,"");p.color.fromArray(JSON.parse("["+A+"]"))}if("color3f inputs:emissiveColor.connect"in g){const A=g["color3f inputs:emissiveColor.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.emissiveMap=M(E),p.emissiveMap.colorSpace=l.SRGBColorSpace,p.emissive.set(16777215),'def Shader "Transform2d_emissive"'in d&&S(p.emissiveMap,d['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in g){const A=g["color3f inputs:emissiveColor"].replace(/[()]*/g,"");p.emissive.fromArray(JSON.parse("["+A+"]"))}if("normal3f inputs:normal.connect"in g){const A=g["normal3f inputs:normal.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.normalMap=M(E),p.normalMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_normal"'in d&&S(p.normalMap,d['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in g){const A=g["float inputs:roughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.roughness=1,p.roughnessMap=M(E),p.roughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_roughness"'in d&&S(p.roughnessMap,d['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in g&&(p.roughness=parseFloat(g["float inputs:roughness"]));if("float inputs:metallic.connect"in g){const A=g["float inputs:metallic.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.metalness=1,p.metalnessMap=M(E),p.metalnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_metallic"'in d&&S(p.metalnessMap,d['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in g&&(p.metalness=parseFloat(g["float inputs:metallic"]));if("float inputs:clearcoat.connect"in g){const A=g["float inputs:clearcoat.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoat=1,p.clearcoatMap=M(E),p.clearcoatMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoat"'in d&&S(p.clearcoatMap,d['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in g&&(p.clearcoat=parseFloat(g["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in g){const A=g["float inputs:clearcoatRoughness.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.clearcoatRoughness=1,p.clearcoatRoughnessMap=M(E),p.clearcoatRoughnessMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_clearcoatRoughness"'in d&&S(p.clearcoatRoughnessMap,d['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in g&&(p.clearcoatRoughness=parseFloat(g["float inputs:clearcoatRoughness"]));if("float inputs:ior"in g&&(p.ior=parseFloat(g["float inputs:ior"])),"float inputs:occlusion.connect"in g){const A=g["float inputs:occlusion.connect"],E=_(f,/(\w+).output/.exec(A)[1]);p.aoMap=M(E),p.aoMap.colorSpace=l.NoColorSpace,'def Shader "Transform2d_occlusion"'in d&&S(p.aoMap,d['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in d){const g=d['def Shader "diffuseColor_texture"'];p.map=M(g),p.map.colorSpace=l.SRGBColorSpace}if('def Shader "normal_texture"'in d){const g=d['def Shader "normal_texture"'];p.normalMap=M(g),p.normalMap.colorSpace=l.NoColorSpace}}return p}function _(d,p){for(const g in d){const A=d[g];if(g.startsWith(`def Shader "${p}"`))return A;if(typeof A=="object"){const E=_(A,p);if(E)return E}}}function M(d){if("asset inputs:file"in d){const p=d["asset inputs:file"].replace(/@*/g,""),A=new l.TextureLoader().load(a[p]),E={'"clamp"':l.ClampToEdgeWrapping,'"mirror"':l.MirroredRepeatWrapping,'"repeat"':l.RepeatWrapping};return"token inputs:wrapS"in d&&(A.wrapS=E[d["token inputs:wrapS"]]),"token inputs:wrapT"in d&&(A.wrapT=E[d["token inputs:wrapT"]]),A}return null}function N(d){const p=T(u(d)),g=L(y(d)),A=p?new l.Mesh(p,g):new l.Object3D;if("matrix4d xformOp:transform"in d){const E=JSON.parse("["+d["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");A.matrix.fromArray(E),A.matrix.decompose(A.position,A.quaternion,A.scale)}return A}function C(d,p){for(const g in d)if(g.startsWith("def Scope"))C(d[g],p);else if(g.startsWith("def Xform")){const A=N(d[g]);/def Xform "(\w+)"/.test(g)&&(A.name=/def Xform "(\w+)"/.exec(g)[1]),p.add(A),C(d[g],A)}}const b=new l.Group;return C(f,b),b}}class $ extends Error{constructor(t,e,i){super(e),this.url=t,this.cause=i,this.name="NetworkError"}}class je{constructor(){H(this,"_gltfLoader");H(this,"_usdzLoader");this._gltfLoader=new oe,this._usdzLoader=new Ue}async _loadFile(t){const e=await fetch(t);if(!e.ok)throw new $(t,`Failed to fetch file from ${t}`);try{return await e.arrayBuffer()}catch{throw new $(t,`Failed to fetch file from ${t}`)}}async load(t){const e=v.getFileTypeFromUri(t);if(e.length===0)throw new P.FileTypeError("No file extension found in URI","");if(!v.isFileTypeSupported(e))throw new P.FileTypeError(`Unsupported file type: ${e}. Supported types: ${v.SUPPORTED_FILE_TYPES.join(", ")}`,e);const i=await this._loadFile(t);try{switch(e){case"glb":case"gltf":return(await this._gltfLoader.parseAsync(i,"")).scene;case"usdz":return await this._usdzLoader.parse(i)}}catch(n){throw n instanceof Error?new P.ParseError(`Failed to parse ${e} file: ${n.message}`,n):new P.ParseError(`Failed to parse ${e} file`)}}}exports.AssetLoader=je;
|