@roomle/web-sdk 2.99.0-alpha.7 → 2.99.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/lib/{banana-for-scale-3b4dcc5b.nomodule.js → banana-for-scale-22ad6a20.nomodule.js} +2 -2
- package/lib/{banana-for-scale-3b4dcc5b.nomodule.js.map → banana-for-scale-22ad6a20.nomodule.js.map} +1 -1
- package/lib/{banana-for-scale-6cbf7e1b.js → banana-for-scale-da4282fd.js} +2 -2
- package/lib/{banana-for-scale-6cbf7e1b.js.map → banana-for-scale-da4282fd.js.map} +1 -1
- package/lib/camera-behaviour-2f2ffe82.js +2 -0
- package/lib/{camera-behaviour-4e8c9b07.js.map → camera-behaviour-2f2ffe82.js.map} +1 -1
- package/lib/camera-behaviour-90408ba5.nomodule.js +2 -0
- package/lib/{camera-behaviour-3e3c8ef2.nomodule.js.map → camera-behaviour-90408ba5.nomodule.js.map} +1 -1
- package/lib/{component-dimensioning-02a435bc.nomodule.js → component-dimensioning-a5e291d6.nomodule.js} +2 -2
- package/lib/component-dimensioning-a5e291d6.nomodule.js.map +1 -0
- package/lib/{component-dimensioning-3ad8c6fb.js → component-dimensioning-ca877f31.js} +2 -2
- package/lib/component-dimensioning-ca877f31.js.map +1 -0
- package/lib/{component-raycast-helper-6dc3817b.nomodule.js → component-raycast-helper-40f9eb14.nomodule.js} +2 -2
- package/lib/component-raycast-helper-40f9eb14.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-cc07f227.js → component-raycast-helper-785b39cd.js} +2 -2
- package/lib/component-raycast-helper-785b39cd.js.map +1 -0
- package/lib/configurator-2d025a93.nomodule.js +2 -0
- package/lib/configurator-2d025a93.nomodule.js.map +1 -0
- package/lib/configurator-3e5c27eb.js +2 -0
- package/lib/configurator-3e5c27eb.js.map +1 -0
- package/lib/configurator-main-f75e4553.js +2 -0
- package/lib/configurator-main-f75e4553.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/continuous-drawing-helper-ae2fcdd3.js +2 -0
- package/lib/continuous-drawing-helper-ae2fcdd3.js.map +1 -0
- package/lib/continuous-drawing-helper-c71ae2ed.nomodule.js +2 -0
- package/lib/continuous-drawing-helper-c71ae2ed.nomodule.js.map +1 -0
- package/lib/default-light-setting-98201048.nomodule.js +2 -0
- package/lib/default-light-setting-98201048.nomodule.js.map +1 -0
- package/lib/default-light-setting-ba00bf2b.js +2 -0
- package/lib/default-light-setting-ba00bf2b.js.map +1 -0
- package/lib/definitions/common-core/src/utils/init-data.d.ts +0 -2
- package/lib/definitions/common-core/src/utils/shims.d.ts +0 -5
- package/lib/definitions/common-core/src/webgl/image-renderer.d.ts +0 -1
- package/lib/definitions/common-core/src/webgl/roomle-webgl-renderer.d.ts +0 -3
- package/lib/definitions/common-core/src/webgl/scene-manager.d.ts +0 -1
- package/lib/definitions/packages/common-core/src/utils/init-data.d.ts +0 -2
- package/lib/definitions/packages/common-core/src/utils/shims.d.ts +0 -5
- package/lib/definitions/packages/common-core/src/webgl/image-renderer.d.ts +0 -1
- package/lib/definitions/packages/common-core/src/webgl/roomle-webgl-renderer.d.ts +0 -3
- package/lib/definitions/packages/common-core/src/webgl/scene-manager.d.ts +0 -1
- package/lib/definitions/packages/planner-core/src/roomle-planner-ui-callback.d.ts +1 -1
- package/lib/definitions/packages/planner-core/src/roomle-planner.d.ts +2 -3
- package/lib/definitions/packages/planner-core/src/utils/{planner-scene-utils.d.ts → planner-scene-manager.d.ts} +2 -5
- package/lib/definitions/packages/planner-core/src/view-model/floor-plan-element-view-model.d.ts +0 -1
- package/lib/definitions/packages/planner-core/src/view-model/plan-view-model.d.ts +0 -21
- package/lib/definitions/packages/planner-core/src/webgl/planner-scene-manager.d.ts +5 -2
- package/lib/definitions/packages/typings/planner.d.ts +1 -7
- package/lib/definitions/planner-core/src/roomle-planner-ui-callback.d.ts +1 -1
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +2 -3
- package/lib/definitions/planner-core/src/utils/{planner-scene-utils.d.ts → planner-scene-manager.d.ts} +2 -5
- package/lib/definitions/planner-core/src/view-model/floor-plan-element-view-model.d.ts +0 -1
- package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +0 -21
- package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +5 -2
- package/lib/definitions/typings/planner.d.ts +1 -7
- package/lib/dimensioning-helper-4d7e768a.nomodule.js +2 -0
- package/lib/dimensioning-helper-4d7e768a.nomodule.js.map +1 -0
- package/lib/dimensioning-helper-fb456f28.js +2 -0
- package/lib/{dimensioning-helper-98a8ba50.js.map → dimensioning-helper-fb456f28.js.map} +1 -1
- package/lib/glb-viewer-58aa56b3.nomodule.js +2 -0
- package/lib/{glb-viewer-e85da8b2.nomodule.js.map → glb-viewer-58aa56b3.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-camera-behaviour-0da8fe97.nomodule.js → glb-viewer-camera-behaviour-1b347e77.nomodule.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-1b347e77.nomodule.js.map +1 -0
- package/lib/{glb-viewer-camera-behaviour-59d51bd7.js → glb-viewer-camera-behaviour-24e823bc.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-24e823bc.js.map +1 -0
- package/lib/glb-viewer-d4c6c346.js +2 -0
- package/lib/{glb-viewer-0745b510.js.map → glb-viewer-d4c6c346.js.map} +1 -1
- package/lib/glb-viewer-main-64179adf.js +2 -0
- package/lib/glb-viewer-main-64179adf.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/{imos-ix-poc-export-helper-21c55d26.js → imos-ix-poc-export-helper-7b16b54e.js} +2 -2
- package/lib/imos-ix-poc-export-helper-7b16b54e.js.map +1 -0
- package/lib/{imos-ix-poc-export-helper-604bba19.nomodule.js → imos-ix-poc-export-helper-b7a91cdb.nomodule.js} +2 -2
- package/lib/imos-ix-poc-export-helper-b7a91cdb.nomodule.js.map +1 -0
- package/lib/legacy/TextGeometry-778d127b.legacy.js +2 -0
- package/lib/legacy/{TextGeometry-559f28ce.legacy.js.map → TextGeometry-778d127b.legacy.js.map} +1 -1
- package/lib/legacy/{banana-for-scale-0aaf7fc2.legacy.js → banana-for-scale-b274801d.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-0aaf7fc2.legacy.js.map → banana-for-scale-b274801d.legacy.js.map} +1 -1
- package/lib/legacy/budgeteer-measure.legacy.js +1 -1
- package/lib/legacy/camera-behaviour-b47dbdd3.legacy.js +2 -0
- package/lib/legacy/{camera-behaviour-c2aedbbb.legacy.js.map → camera-behaviour-b47dbdd3.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-6f6c4856.legacy.js → component-dimensioning-a3ba2ba6.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-a3ba2ba6.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-0ed65ed0.legacy.js → component-raycast-helper-a5178cda.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-a5178cda.legacy.js.map +1 -0
- package/lib/legacy/configurator-002d161a.legacy.js +2 -0
- package/lib/legacy/configurator-002d161a.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/continuous-drawing-helper-654d7604.legacy.js +2 -0
- package/lib/legacy/continuous-drawing-helper-654d7604.legacy.js.map +1 -0
- package/lib/legacy/default-light-setting-af961df8.legacy.js +2 -0
- package/lib/legacy/default-light-setting-af961df8.legacy.js.map +1 -0
- package/lib/legacy/dimensioning-helper-4baa9955.legacy.js +2 -0
- package/lib/legacy/dimensioning-helper-4baa9955.legacy.js.map +1 -0
- package/lib/legacy/external-objects-2fd4ef1a.legacy.js +2 -0
- package/lib/legacy/external-objects-2fd4ef1a.legacy.js.map +1 -0
- package/lib/legacy/{glb-viewer-camera-behaviour-3a535720.legacy.js → glb-viewer-camera-behaviour-4be0da6a.legacy.js} +2 -2
- package/lib/legacy/glb-viewer-camera-behaviour-4be0da6a.legacy.js.map +1 -0
- package/lib/legacy/glb-viewer-d3854b02.legacy.js +2 -0
- package/lib/legacy/{glb-viewer-44a922cf.legacy.js.map → glb-viewer-d3854b02.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{imos-ix-poc-export-helper-b2dd944a.legacy.js → imos-ix-poc-export-helper-ee70d653.legacy.js} +2 -2
- package/lib/legacy/imos-ix-poc-export-helper-ee70d653.legacy.js.map +1 -0
- package/lib/legacy/{main-thread-to-worker-32b45184.legacy.js → main-thread-to-worker-da6ad96a.legacy.js} +3 -3
- package/lib/legacy/{main-thread-to-worker-32b45184.legacy.js.map → main-thread-to-worker-da6ad96a.legacy.js.map} +1 -1
- package/lib/legacy/material-viewer-117426bc.legacy.js +2 -0
- package/lib/legacy/material-viewer-117426bc.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/planner-f0a71818.legacy.js +2 -0
- package/lib/legacy/{planner-dfbb58ff.legacy.js.map → planner-f0a71818.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/query-params-helper-e3e05119.legacy.js +2 -0
- package/lib/legacy/query-params-helper-e3e05119.legacy.js.map +1 -0
- package/lib/legacy/roomle-configurator-6db65c94.legacy.js +2 -0
- package/lib/legacy/roomle-configurator-6db65c94.legacy.js.map +1 -0
- package/lib/legacy/roomle-dependency-injection-058aa06f.legacy.js +9 -0
- package/lib/legacy/{roomle-dependency-injection-74dde629.legacy.js.map → roomle-dependency-injection-058aa06f.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{script-loader-2b4cb309.legacy.js → script-loader-9921991a.legacy.js} +2 -2
- package/lib/legacy/script-loader-9921991a.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-e0b064b9d4228a3b.wasm +0 -0
- package/lib/legacy/static/RoomleCore-e599a6ccf3dd7c2a.wasm +0 -0
- package/lib/legacy/static/RoomleToolsCore-83af26798774f70c.wasm +0 -0
- package/lib/legacy/{stats-helper-53d734d0.legacy.js → stats-helper-c7bf779b.legacy.js} +2 -2
- package/lib/legacy/stats-helper-c7bf779b.legacy.js.map +1 -0
- package/lib/legacy/{tools-core-2e019c22.legacy.js → tools-core-645fb16a.legacy.js} +2 -2
- package/lib/legacy/tools-core-645fb16a.legacy.js.map +1 -0
- package/lib/material-viewer-8c7e05be.nomodule.js +2 -0
- package/lib/material-viewer-8c7e05be.nomodule.js.map +1 -0
- package/lib/material-viewer-d211106c.js +2 -0
- package/lib/material-viewer-d211106c.js.map +1 -0
- package/lib/material-viewer-main-9668a68c.js +2 -0
- package/lib/material-viewer-main-9668a68c.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/planner-a30840a8.js +2 -0
- package/lib/{planner-4b80141f.js.map → planner-a30840a8.js.map} +1 -1
- package/lib/planner-cb1acb4d.nomodule.js +2 -0
- package/lib/{planner-4699c26b.nomodule.js.map → planner-cb1acb4d.nomodule.js.map} +1 -1
- package/lib/planner-main-5c76b2c2.js +2 -0
- package/lib/planner-main-5c76b2c2.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/roomle-configurator-a11055fd.nomodule.js +2 -0
- package/lib/roomle-configurator-a11055fd.nomodule.js.map +1 -0
- package/lib/roomle-configurator-ab3900ec.js +2 -0
- package/lib/roomle-configurator-ab3900ec.js.map +1 -0
- package/lib/roomle-dependency-injection-22befdc7.nomodule.js +9 -0
- package/lib/{roomle-dependency-injection-aaa87a5a.nomodule.js.map → roomle-dependency-injection-22befdc7.nomodule.js.map} +1 -1
- package/lib/{roomle-dependency-injection-9ba44488.js → roomle-dependency-injection-8fd89dfe.js} +3 -3
- package/lib/{roomle-dependency-injection-9ba44488.js.map → roomle-dependency-injection-8fd89dfe.js.map} +1 -1
- package/lib/{roomle-sdk-0d06ac06.js → roomle-sdk-3f72ba15.js} +2 -2
- package/lib/roomle-sdk-3f72ba15.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-9bc4f752.js → script-loader-36a9dcdc.js} +2 -2
- package/lib/script-loader-36a9dcdc.js.map +1 -0
- package/lib/{script-loader-0c12029e.nomodule.js → script-loader-8e8886dd.nomodule.js} +2 -2
- package/lib/script-loader-8e8886dd.nomodule.js.map +1 -0
- package/lib/static/ConfiguratorKernel-e0b064b9d4228a3b.wasm +0 -0
- package/lib/static/RoomleCore-e599a6ccf3dd7c2a.wasm +0 -0
- package/lib/static/RoomleToolsCore-83af26798774f70c.wasm +0 -0
- package/lib/{stats-helper-38a98340.nomodule.js → stats-helper-1a0748a7.nomodule.js} +2 -2
- package/lib/stats-helper-1a0748a7.nomodule.js.map +1 -0
- package/lib/{stats-helper-b5a56002.js → stats-helper-b5614bb9.js} +2 -2
- package/lib/stats-helper-b5614bb9.js.map +1 -0
- package/lib/{tools-core-b4b1250f.js → tools-core-43082fe5.js} +2 -2
- package/lib/tools-core-43082fe5.js.map +1 -0
- package/lib/{tools-core-2ce7c41b.nomodule.js → tools-core-a5f68507.nomodule.js} +2 -2
- package/lib/tools-core-a5f68507.nomodule.js.map +1 -0
- package/package.json +2 -2
- package/lib/Object3D-2abce9d8.nomodule.js +0 -2
- package/lib/Object3D-2abce9d8.nomodule.js.map +0 -1
- package/lib/Object3D-80e9d0f8.js +0 -2
- package/lib/Object3D-80e9d0f8.js.map +0 -1
- package/lib/SpotLightHelper-56c85cfb.nomodule.js +0 -2
- package/lib/SpotLightHelper-56c85cfb.nomodule.js.map +0 -1
- package/lib/SpotLightHelper-79188e47.js +0 -2
- package/lib/SpotLightHelper-79188e47.js.map +0 -1
- package/lib/camera-behaviour-3e3c8ef2.nomodule.js +0 -2
- package/lib/camera-behaviour-4e8c9b07.js +0 -2
- package/lib/component-dimensioning-02a435bc.nomodule.js.map +0 -1
- package/lib/component-dimensioning-3ad8c6fb.js.map +0 -1
- package/lib/component-raycast-helper-6dc3817b.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-cc07f227.js.map +0 -1
- package/lib/configurator-3d454401.js +0 -2
- package/lib/configurator-3d454401.js.map +0 -1
- package/lib/configurator-69eb9cf5.nomodule.js +0 -2
- package/lib/configurator-69eb9cf5.nomodule.js.map +0 -1
- package/lib/configurator-main-913fc1f9.js +0 -2
- package/lib/configurator-main-913fc1f9.js.map +0 -1
- package/lib/continuous-drawing-helper-72763d12.nomodule.js +0 -2
- package/lib/continuous-drawing-helper-72763d12.nomodule.js.map +0 -1
- package/lib/continuous-drawing-helper-acc7886d.js +0 -2
- package/lib/continuous-drawing-helper-acc7886d.js.map +0 -1
- package/lib/default-light-setting-21979b0e.js +0 -2
- package/lib/default-light-setting-21979b0e.js.map +0 -1
- package/lib/default-light-setting-c5809ec6.nomodule.js +0 -2
- package/lib/default-light-setting-c5809ec6.nomodule.js.map +0 -1
- package/lib/definitions/packages/planner-core/src/lights/ceiling-light.d.ts +0 -19
- package/lib/definitions/packages/planner-core/src/lights/lamp-light.d.ts +0 -9
- package/lib/definitions/packages/planner-core/src/lights/light-group.d.ts +0 -11
- package/lib/definitions/packages/planner-core/src/lights/rect-area-light.d.ts +0 -7
- package/lib/definitions/planner-core/src/lights/ceiling-light.d.ts +0 -19
- package/lib/definitions/planner-core/src/lights/lamp-light.d.ts +0 -9
- package/lib/definitions/planner-core/src/lights/light-group.d.ts +0 -11
- package/lib/definitions/planner-core/src/lights/rect-area-light.d.ts +0 -7
- package/lib/dimensioning-helper-75208277.nomodule.js +0 -2
- package/lib/dimensioning-helper-75208277.nomodule.js.map +0 -1
- package/lib/dimensioning-helper-98a8ba50.js +0 -2
- package/lib/glb-viewer-0745b510.js +0 -2
- package/lib/glb-viewer-camera-behaviour-0da8fe97.nomodule.js.map +0 -1
- package/lib/glb-viewer-camera-behaviour-59d51bd7.js.map +0 -1
- package/lib/glb-viewer-e85da8b2.nomodule.js +0 -2
- package/lib/glb-viewer-main-bfbe7bb5.js +0 -2
- package/lib/glb-viewer-main-bfbe7bb5.js.map +0 -1
- package/lib/imos-ix-poc-export-helper-21c55d26.js.map +0 -1
- package/lib/imos-ix-poc-export-helper-604bba19.nomodule.js.map +0 -1
- package/lib/legacy/Object3D-1f141c55.legacy.js +0 -2
- package/lib/legacy/Object3D-1f141c55.legacy.js.map +0 -1
- package/lib/legacy/SpotLightHelper-28698e83.legacy.js +0 -2
- package/lib/legacy/SpotLightHelper-28698e83.legacy.js.map +0 -1
- package/lib/legacy/TextGeometry-559f28ce.legacy.js +0 -2
- package/lib/legacy/camera-behaviour-c2aedbbb.legacy.js +0 -2
- package/lib/legacy/component-dimensioning-6f6c4856.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-0ed65ed0.legacy.js.map +0 -1
- package/lib/legacy/configurator-5d25f72d.legacy.js +0 -2
- package/lib/legacy/configurator-5d25f72d.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-d9143937.legacy.js +0 -2
- package/lib/legacy/continuous-drawing-helper-d9143937.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-13509c2b.legacy.js +0 -2
- package/lib/legacy/default-light-setting-13509c2b.legacy.js.map +0 -1
- package/lib/legacy/dimensioning-helper-6c946184.legacy.js +0 -2
- package/lib/legacy/dimensioning-helper-6c946184.legacy.js.map +0 -1
- package/lib/legacy/external-objects-01d5a216.legacy.js +0 -2
- package/lib/legacy/external-objects-01d5a216.legacy.js.map +0 -1
- package/lib/legacy/glb-viewer-44a922cf.legacy.js +0 -2
- package/lib/legacy/glb-viewer-camera-behaviour-3a535720.legacy.js.map +0 -1
- package/lib/legacy/imos-ix-poc-export-helper-b2dd944a.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-3f5b810f.legacy.js +0 -2
- package/lib/legacy/material-viewer-3f5b810f.legacy.js.map +0 -1
- package/lib/legacy/planner-dfbb58ff.legacy.js +0 -2
- package/lib/legacy/query-params-helper-ad6b6b64.legacy.js +0 -2
- package/lib/legacy/query-params-helper-ad6b6b64.legacy.js.map +0 -1
- package/lib/legacy/roomle-configurator-c58511f7.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-c58511f7.legacy.js.map +0 -1
- package/lib/legacy/roomle-dependency-injection-74dde629.legacy.js +0 -9
- package/lib/legacy/script-loader-2b4cb309.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-c9d9881effe208ce.wasm +0 -0
- package/lib/legacy/static/RoomleCore-4f7ef133b1806a97.wasm +0 -0
- package/lib/legacy/static/RoomleToolsCore-ad314dc649461ba1.wasm +0 -0
- package/lib/legacy/stats-helper-53d734d0.legacy.js.map +0 -1
- package/lib/legacy/tools-core-2e019c22.legacy.js.map +0 -1
- package/lib/material-viewer-884c5a7e.nomodule.js +0 -2
- package/lib/material-viewer-884c5a7e.nomodule.js.map +0 -1
- package/lib/material-viewer-b3b5e1ed.js +0 -2
- package/lib/material-viewer-b3b5e1ed.js.map +0 -1
- package/lib/material-viewer-main-35ea8656.js +0 -2
- package/lib/material-viewer-main-35ea8656.js.map +0 -1
- package/lib/planner-4699c26b.nomodule.js +0 -2
- package/lib/planner-4b80141f.js +0 -2
- package/lib/planner-main-4176dbae.js +0 -2
- package/lib/planner-main-4176dbae.js.map +0 -1
- package/lib/roomle-configurator-9285759b.nomodule.js +0 -2
- package/lib/roomle-configurator-9285759b.nomodule.js.map +0 -1
- package/lib/roomle-configurator-ca748633.js +0 -2
- package/lib/roomle-configurator-ca748633.js.map +0 -1
- package/lib/roomle-dependency-injection-aaa87a5a.nomodule.js +0 -9
- package/lib/roomle-sdk-0d06ac06.js.map +0 -1
- package/lib/script-loader-0c12029e.nomodule.js.map +0 -1
- package/lib/script-loader-9bc4f752.js.map +0 -1
- package/lib/static/ConfiguratorKernel-c9d9881effe208ce.wasm +0 -0
- package/lib/static/RoomleCore-4f7ef133b1806a97.wasm +0 -0
- package/lib/static/RoomleToolsCore-ad314dc649461ba1.wasm +0 -0
- package/lib/stats-helper-38a98340.nomodule.js.map +0 -1
- package/lib/stats-helper-b5a56002.js.map +0 -1
- package/lib/tools-core-2ce7c41b.nomodule.js.map +0 -1
- package/lib/tools-core-b4b1250f.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=banana-for-scale-
|
|
1
|
+
System.register(["./roomle-dependency-injection-22befdc7.nomodule.js","./main-thread-to-worker-ff3b0e7b.nomodule.js"],(function(e){var n,t,a,s,i;return{setters:[function(e){n=e.a$,t=e._,a=e.i},function(e){s=e.g,i=e.a}],execute:function(){class o extends n{setScene(e){this._scene=e,this._staticItemLoader.loadGLB(s()+"static/banana-bbcc0e46fc0ee694.glb").then(e=>{this._banana=e.scene,this.updateBounds(null)})}updateBounds(e){if(e&&(this._bounds=e),this._bounds){if(this._banana){const e=this._bounds.getSize(new i),n=this._bounds.getCenter(new i).clone();n.x-=e.x/2+.18,n.z+=e.z/2+.05,n.y=0;let t=.1;this._banana.scale.copy(new i(t,t,t)),this._banana.rotation.y=.6,this._banana.position.copy(n)}this._scene.children.includes(this._banana)||this.addToScene()}}clearScene(e,n){super.clearScene(e,n),this.removeFromScene()}addToScene(){this._scene&&this._banana&&this._scene.add(this._banana)}removeFromScene(){this._scene&&this._banana&&this._scene.remove(this._banana)}}e("default",o),t([a],o.prototype,"_staticItemLoader",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=banana-for-scale-22ad6a20.nomodule.js.map
|
package/lib/{banana-for-scale-3b4dcc5b.nomodule.js.map → banana-for-scale-22ad6a20.nomodule.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banana-for-scale-
|
|
1
|
+
{"version":3,"file":"banana-for-scale-22ad6a20.nomodule.js","sources":["../../packages/configurator-core/public/geometry/banana.glb"],"sourcesContent":["export default \"static/banana-bbcc0e46fc0ee694.glb\""],"names":[],"mappings":"6TAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=banana-for-scale-
|
|
1
|
+
import{a$ as ScenePluginDefaultImplementation,_ as __decorate,i as inject}from"./roomle-dependency-injection-8fd89dfe.js";import{g as getAssetPath,a as Vector3}from"./main-thread-to-worker-4e303a39.js";class BananaForScale extends ScenePluginDefaultImplementation{setScene(e){this._scene=e,this._staticItemLoader.loadGLB(getAssetPath()+"static/banana-bbcc0e46fc0ee694.glb").then(e=>{this._banana=e.scene,this.updateBounds(null)})}updateBounds(e){if(e&&(this._bounds=e),this._bounds){if(this._banana){const e=this._bounds.getSize(new Vector3),a=this._bounds.getCenter(new Vector3).clone();a.x-=e.x/2+.18,a.z+=e.z/2+.05,a.y=0;let n=.1;this._banana.scale.copy(new Vector3(n,n,n)),this._banana.rotation.y=.6,this._banana.position.copy(a)}this._scene.children.includes(this._banana)||this.addToScene()}}clearScene(e,a){super.clearScene(e,a),this.removeFromScene()}addToScene(){this._scene&&this._banana&&this._scene.add(this._banana)}removeFromScene(){this._scene&&this._banana&&this._scene.remove(this._banana)}}__decorate([inject],BananaForScale.prototype,"_staticItemLoader",void 0);export{BananaForScale as default};
|
|
2
|
+
//# sourceMappingURL=banana-for-scale-da4282fd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banana-for-scale-
|
|
1
|
+
{"version":3,"file":"banana-for-scale-da4282fd.js","sources":["../../packages/configurator-core/public/geometry/banana.glb"],"sourcesContent":["export default \"static/banana-bbcc0e46fc0ee694.glb\""],"names":[],"mappings":"gVAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as __decorate,i as inject,E as EventDispatcher,u as toRadiant,a3 as position3VectorsAreEqual,a4 as position2VectorsAreEqual,q as compareBox3Size,Q as getIdealDistance,U as toDegrees,a5 as DOCK_PREVIEW_MATERIAL_OPACITY,a6 as DOCK_PREVIEW_MATERIAL_ROUGHNESS,a7 as DOCK_PREVIEW_MATERIAL_METALNESS,a8 as DOCK_PREVIEW_MATERIAL_OPACITY_HOVERED,c as convertToThreeMatrix,r as disposeMesh,a9 as MaterialCreator,aa as PREVIEW_MATERIAL_OPACITY,ab as PREVIEW_MATERIAL_COLOR,k as kernelBoxToThreeBox,t as convertToKernel,ac as animateMeshMatrix,s as setMeshMatrix,ad as convertToTHREE,ae as PREVIEW_LINE_MATERIAL_OPACITY,m as mergeGeometries,af as createMaterial,ag as addTexture,ah as getGUI,ai as rotationQuaternionsAreEqual,aj as getDelta,ak as MIN_MOVE_DISTANCE,al as LightSourceDetector,am as EnvironmentMapDecodeMaterial,an as RoomleWebGLRenderer,ao as lutImages,ap as standaloneConfiguratorQualityLevels,aq as ENV_HDR_256_FILE_NAME,K as dispose,z as DynamicLightSettingLoader}from"./roomle-dependency-injection-8fd89dfe.js";import{a as Vector3,bG as debounce,U as PerspectiveCamera,V as Vector2,bI as areCameraParametersEqual,ae as Sphere,bM as clamp,Q as Quaternion,ag as Euler,aC as deepMerge,v as MeshStandardMaterial,C as Color,bN as setCursor,z as Mesh,O as Object3D,E as LineSegments,a_ as EdgesGeometry,bO as LineDashedMaterial,aP as BoxGeometry,ad as Box3,B as BufferGeometry,bP as CylinderGeometry,bQ as Line3,X as OrthographicCamera,k as Matrix4,bR as Shape,bS as Path,bT as ShapeGeometry,m as TextureLoader,bU as Fog,r as RepeatWrapping,w as DoubleSide,aZ as handleJsonResponse,S as SpotLight,A as AmbientLight,D as DirectionalLight,R as RectAreaLight,aS as SphereGeometry,h as MeshBasicMaterial,b9 as PlaneGeometry,a$ as CircleGeometry,u as LineBasicMaterial,bV as PMREMGenerator,ap as ShaderMaterial,ao as Matrix3,av as NoBlending,ah as CubeTexture,a9 as Texture,al as Scene,W as MathUtils,bW as Clock,bL as sanitizedCameraMode,bC as WebGLRenderer,i as SRGBColorSpace,bl as PCFSoftShadowMap,bJ as download,bX as traceMethodCalls}from"./main-thread-to-worker-4e303a39.js";var TWEEN_FILE_NAME="static/Tween-d57ee5d181fce582.js";class CameraControl extends EventDispatcher{constructor(e,t,i){var s,n;super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new Vector3,this._targetPosition=new Vector3,i?this.setCurrentCameraParameters(i):(this._cameraPosition=new Vector3(0,.5,3),this._pitch=toRadiant(null!==(s=this._initData.verticalCameraAngle)&&void 0!==s?s:10),this._yaw=toRadiant(null!==(n=this._initData.horizontalCameraAngle)&&void 0!==n?n:-30));let a=this._domHelper.getClientDimensions();this._width=a.x,this._height=a.y,this._dispatchCameraIdle=debounce(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}setUp(){this._addInputListeners()}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||position3VectorsAreEqual(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e||!this._initData.animateCamera?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new Vector3(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new Vector3(e.targetX,e.targetY,e.targetZ),i,!0)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof PerspectiveCamera){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}setCurrentCameraParameters(e){var t,i,s;this._yaw=null!==(t=e.yaw)&&void 0!==t?t:0,this._pitch=null!==(i=e.pitch)&&void 0!==i?i:0,this._distance=null!==(s=e.distance)&&void 0!==s?s:0,this._targetPosition.copy(new Vector3(e.targetX,e.targetY,e.targetZ)),this._update(null,!0,!0)}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}async setToState(e,t){await this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new Vector3(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof PerspectiveCamera&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}__decorate([inject],CameraControl.prototype,"_domHelper",void 0),__decorate([inject],CameraControl.prototype,"_initData",void 0),__decorate([inject],CameraControl.prototype,"_globalInitData",void 0);class ZoomChangeEvent{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}const DISTANCE_FACTOR=2.725;class CameraControl3D extends CameraControl{constructor(e,t,i,s){super(e,t,i),this._bounds=new Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=toRadiant(0),this.maxPolarAngle=toRadiant(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:a,minVerticalCameraAngle:o,maxVerticalCameraAngle:r,minHorizontalCameraAngle:h,maxHorizontalCameraAngle:c}=this._initData;if(a&&(this._zoomDistance=a/100),void 0!==o&&(this.minPolarAngle=toRadiant(o<0?o:-1*o)),void 0!==r&&(this.maxPolarAngle=toRadiant(r)),void 0!==h&&(this.minAzimuthAngle=toRadiant(h<0?h:-1*h)),void 0!==c&&(this.maxAzimuthAngle=toRadiant(c)),void 0!==n){let e=Math.abs(toRadiant(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,toRadiant(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new PerspectiveCamera,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new Vector2(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new Vector2(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&compareBox3Size(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new Vector3);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new Vector3);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};areCameraParametersEqual(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new Vector3);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new Vector3),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const o={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};areCameraParametersEqual(s,o)||this._tweenCameraParameter(s,o,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new Vector3);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new Vector3(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),o=e.getSize(new Vector3);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new Sphere);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:o,y:r}=this._getMargin(i,s),h=getIdealDistance(e.x+o,e.y+r,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return getIdealDistance(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){const i=Math.max(this._bounds.x,this._bounds.y);let s=i>3?0:this._bounds.x/2,n=i>3?0:this._bounds.y/2;return e>1080&&(s+=i<.3?.1:0,s+=(i>3?0:this._bounds.x)*(e/1080-1)),t>1080&&(s+=i<.3?.1:0,n+=(i>3?0:this._bounds.y)*(t/1080-1)),{x:s,y:n}}reset(e,t,i,s,n=!0){var a,o;const r=e.getSize(new Vector3);if(r){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new Vector3);this._targetPosition.copy(t)}const h=this.getCurrentCameraParameters();if(i||(i=null!==(a=this._initData.horizontalCameraAngle)&&void 0!==a?a:-30),s||(s=null!==(o=this._initData.verticalCameraAngle)&&void 0!==o?o:10),i+=toDegrees(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(r),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(r);const c=this._setDistanceAndRangesBasedOnBounds(r),l=toRadiant(s),d=toRadiant(i);let _=this._targetPosition.clone();n?this._tweenCameraParameter(h,{yaw:d,pitch:l,distance:c,targetX:_.x,targetY:_.y,targetZ:_.z},!0):(this._pitch=l,this._yaw=d,this._distance=c,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateDistanceAndRangesBasedOnBounds(e){if(!e)return;const t=e.getSize(new Vector3),i=e.getCenter(new Vector3);this.setBounds(e),this._targetPosition.copy(i),this._setDistanceAndRangesBasedOnBounds(t,!1)}async updateAndReset(e,t=!0){var i,s;const n=e.getSize(new Vector3),a=e.getCenter(new Vector3);this.setBounds(e),this._targetPosition.copy(a),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(n));const o=this.getCurrentCameraParameters();this._camera.fov=30,this._pitch=toRadiant(null!==(i=this._initData.verticalCameraAngle)&&void 0!==i?i:10),this._yaw=toRadiant((null!==(s=this._initData.horizontalCameraAngle)&&void 0!==s?s:-30)+toDegrees(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(n);let r=this._targetPosition.clone();t?await this._tweenCameraParameter(o,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:r.x,targetY:r.y,targetZ:r.z},!0):this._update(this._targetPosition)}_update(e,t,i){i||(this._yaw=clamp(this._yaw,this.minAzimuthAngle,this.maxAzimuthAngle),this._pitch=this._initData.debug?clamp(this._pitch,toRadiant(-89),toRadiant(89)):clamp(this._pitch,this.minPolarAngle,this.maxPolarAngle),this._saveYawAndPitch());const s=(new Quaternion).setFromEuler(new Euler(-this._pitch,this._yaw,0,"ZYX")),n=new Vector3(0,0,-1).applyQuaternion(s);i||(this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance))),e&&this._targetPosition.copy(e);const a=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(a),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(a);else{const e=this._getCameraSphere(a);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(a),this._zoomChanged(this._distance===this.maxDistance,!1))}this._scale=1}_zoomChanged(e,t){var i;let s=e+""+t;0===(null===(i=this._currentZoomHash)||void 0===i?void 0:i.length)||this._currentZoomHash!==s?(this.dispatchEvent(5,new ZoomChangeEvent(e,t)),this._currentZoomHash=s):e||t||this.dispatchEvent(5,new ZoomChangeEvent(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new Sphere(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new Vector3);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=deepMerge(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}const PULSE_DURATION=1500,PULSE_LOOPS=5;function RoomleComponentFactoryInitializer(){class e extends Object3D{static _generateOutline(e,t){let i=new LineSegments(new EdgesGeometry(e),new LineDashedMaterial({color:"#000000",dashSize:.03,gapSize:.01,linewidth:1}));return i.translateOnAxis(t,1),i.userData.ignoreComponentRaycast=!0,i}static cloneDockLine(e,t){let i=new LineSegments(e.geometry,e.material);return i.translateOnAxis(t.getCenter(new Vector3),1),i.name="dockline",i.layers.set(5),i.userData.ignoreComponentRaycast=!0,i}_setValues(e,t,i,s,n){e&&(this.runtimeId=e,this.name=e.toString()),t&&(this.roomlePosition=Object.assign({},t)),i&&(this.roomleRotation=Object.assign({},i)),s&&(this.parentObjectId=s),n&&(this.isRootComponent=n)}constructor(e,t,i,s,n){super(),this._selected=!1,this.isChildPlanObject=!1,this.geometryChanged=!0,this.meshes=[],this.castShadow=!1,this.receiveShadow=!0,this._setValues(e,t,i,s,n)}get loadingMesh(){return this._loadingMesh}get boundingBoxMesh(){return this._boundingBoxMesh}get boundingBox(){return this._boundingBox}set roomlePosition(e){this._roomlePosition=e,e&&this.position.set(e.x/1e3,e.z/1e3,e.y/-1e3)}get roomlePosition(){return this._roomlePosition}set roomleRotation(e){this._roomleRotation=e,e&&this.rotation.set(e.x,e.z,-e.y)}get roomleRotation(){return this._roomleRotation}replaceMeshes(e){this.removeAllMeshes(),e.forEach(e=>{this.addMesh(new Mesh(e.geometry,e.material))})}addMesh(e,t){e.renderOrder=2,e.userData.meshType=0,t&&e.applyMatrix4(convertToThreeMatrix(t)),this.add(e),this.meshes.push(e)}getMeshById(e){return this.meshes.find(t=>t.userData.meshId===e)}removeMeshById(e){const t=this.getMeshById(e);t?this.removeMesh(t):console.warn("Could not remove mesh with id "+e,this.runtimeId,this.meshes)}removeMesh(e){const t=this.meshes.indexOf(e);this.remove(e),disposeMesh(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&disposeMesh(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),disposeMesh(this._boundingBoxMesh),this._boundingBoxMesh=null}_hideAllMeshes(){this.meshes.forEach(e=>e.visible=!1)}_showAllMeshes(){this.meshes.forEach(e=>e.visible=!0)}select(){this._selected=!0}loading(){if(!this._kernelBoundingBox)return void console.warn("Bounding box (box for measurements) for component "+this.runtimeId+" not set, can not show external mesh loading box!");this._removeLoadingMesh(),this._hideAllMeshes();const{x:e,y:t,z:i}=this._kernelBoundingBox.getSize(new Vector3);let s=new BoxGeometry(e,t,i);this._loadingMesh=new Mesh(s,MaterialCreator.createMeshStandardMaterial({transparent:!0,opacity:PREVIEW_MATERIAL_OPACITY,color:new Color(PREVIEW_MATERIAL_COLOR)})),this._loadingMesh.name="loading mesh",this._loadingMesh.receiveShadow=!1,this._loadingMesh.castShadow=!1,this._loadingMesh.layers.set(5),this._loadingMesh.translateOnAxis(this._kernelBoundingBox.getCenter(new Vector3),1),this._loadingMesh.renderOrder=3,this.add(this._loadingMesh)}_removeLoadingMesh(){this._loadingMesh&&(this.remove(this._loadingMesh),disposeMesh(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){setCursor("pointer")}hoverOff(){setCursor("default")}computeBoundingBox(t,i=!1){if(this._boundingBoxMesh&&this.remove(this._boundingBoxMesh),!i&&t&&0===t.size.x&&0===t.size.y&&0===t.size.z)return;let s;if(!t||i){this._boundingBox=new Box3;let e=new Vector3;this.meshes.forEach(t=>{if(t.geometry instanceof BufferGeometry){let i=t.geometry.attributes.position;if(void 0!==i)for(let s=0,n=i.count;s<n;s++)e.fromBufferAttribute(i,s).applyMatrix4(t.matrix),this._boundingBox.expandByPoint(e)}}),this._kernelBoundingBox=this._boundingBox.clone();let t=this._boundingBox.max.x-this._boundingBox.min.x,i=this._boundingBox.max.y-this._boundingBox.min.y,n=this._boundingBox.max.z-this._boundingBox.min.z;s=new BoxGeometry(t,i,n)}else{this._kernelBoundingBox=kernelBoxToThreeBox(t),this._boundingBox=this._kernelBoundingBox.clone();let{x:e,y:i,z:n}=this._boundingBox.getSize(new Vector3);s=new BoxGeometry(e,i,n)}this._boundingBoxMesh=new Mesh(s,MaterialCreator.createMeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1,visible:!1})),this._boundingBoxMesh.name="bounding box mesh";let n=this._boundingBox.getCenter(new Vector3);this._boundingBoxMesh.position.add(n),this._boundingBoxMesh.layers.set(5),this._boundingBoxMesh.renderOrder=3,this._boundingBoxMesh.castShadow=!1,this._boundingBoxMesh.receiveShadow=!1,this.add(this._boundingBoxMesh),this._dockline=e._generateOutline(s,n),this._dockline.name="bounding box outline",this._dockline.layers.set(5),this._selected&&this.add(this._dockline)}recursiveMeshes(){let t=this.meshes.slice();return this.children.forEach(i=>{i instanceof e&&t.push(...i.recursiveMeshes())}),t}isChild(t){let i=!1;return this.children.forEach(s=>{s instanceof e&&!i&&(i=s.runtimeId===t||s.isChild(t))}),i}getKernelPosition(e){let t=this.parent.localToWorld(this.position);return convertToKernel(e.worldToLocal(t))}animateMeshes(e,t,i,s=!0,n){this.meshes.forEach(a=>{var o;const r=null===(o=a.userData)||void 0===o?void 0:o.animationMatrixMap;if(r){const o=null==r?void 0:r.get(`${e}:${t}`),h=null==r?void 0:r.get(`${e}:${i}`);this._animateMesh(a,o,h,s,n)}})}_animateMesh(e,t,i,s=!0,n){var a;const o=null===(a=e.userData)||void 0===a?void 0:a.transform;if(!o||!t&&!i)return;let r=o.clone(),h=o.clone();(null==t?void 0:t.matrix)&&r.multiply(t.matrix),(null==i?void 0:i.matrix)&&h.multiply(i.matrix),s?animateMeshMatrix(e,r,h,n):(setMeshMatrix(e,h),void 0!==(null==i?void 0:i.visible)&&(e.visible=i.visible),n&&n())}}class t extends e{constructor(e,t){super(e,null,null,null,!1),this.glbUrl=t}}class i extends e{constructor(e,t,i,s,n,a){super(t,i,s,n,a),this._stringId=null,this.receivedPointAssociation=!1,this.castShadow=!1,this.receiveShadow=!1,this._creator_=e}get stringId(){return this._stringId?this._stringId:this.runtimeId.toString()}addMesh(e,t){super.addMesh(e,t),e.material instanceof MeshStandardMaterial&&(e.material.opacity=DOCK_PREVIEW_MATERIAL_OPACITY,e.material.roughness=DOCK_PREVIEW_MATERIAL_ROUGHNESS,e.material.metalness=DOCK_PREVIEW_MATERIAL_METALNESS,e.material.color=new Color(this._initData.colors.PREVIEW_DOCKING_COLOR)),e.renderOrder=1,e.castShadow=!1,e.receiveShadow=!1}startPulsating(){var e,t;if(null===(t=null===(e=this._initData)||void 0===e?void 0:e.featureFlags)||void 0===t?void 0:t.pulsePreview)for(const e of this.meshes){const t={opacity:DOCK_PREVIEW_MATERIAL_OPACITY},i={opacity:.3};new TWEEN.Tween(t).to(i,1500).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{e.material.opacity=t.opacity}).yoyo(!0).repeat(5).start()}}hoverOn(){this.remove(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=DOCK_PREVIEW_MATERIAL_OPACITY_HOVERED,e.roughness=DOCK_PREVIEW_MATERIAL_ROUGHNESS,e.metalness=DOCK_PREVIEW_MATERIAL_METALNESS,e.color=new Color(this._initData.colors.PREVIEW_DOCKING_COLOR)}),setCursor("pointer")}hoverOff(){this.add(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=DOCK_PREVIEW_MATERIAL_OPACITY,e.roughness=DOCK_PREVIEW_MATERIAL_ROUGHNESS,e.metalness=DOCK_PREVIEW_MATERIAL_METALNESS,e.color=new Color(this._initData.colors.PREVIEW_DOCKING_COLOR)}),setCursor("default")}clonePreview(t){const s=new i(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.isRootComponent);return s._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof Mesh&&0===e.userData.meshType&&s.meshes.push(e.clone(!0))}),s.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),s.add(e)}),this._dockline&&(s._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(s._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(s._boundingBox=this._boundingBox.clone()),s}preparePreview(){this.add(this._dockline),this.add(this._boundingBoxMesh)}}__decorate([inject],i.prototype,"_initData",void 0);class s extends i{constructor(e,t,i,s,n,a){super(e,t,i,s,n,!1),this.lineSegments=[],a&&(this._stringId=this.runtimeId+"_has_additional_dock_point_copy")}set roomleLineFrom(e){this._roomleLineFrom=e,this.lineFrom=convertToTHREE(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=convertToTHREE(e);t.equals(this.lineFrom)&&(console.warn("lineFrom and lineTo are equal!"),t.add(new Vector3(0,.01,0))),this.lineTo=t}get roomleLineTo(){return this._roomleLineTo}set roomlePositionFrom(e){this._roomlePositionFrom=e,this.positionFrom=convertToTHREE(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=convertToTHREE(e);t.equals(this.positionFrom)&&(console.warn("positionFrom and positionTo are equal!"),t.add(new Vector3(0,.01,0))),this.positionTo=t}get roomlePositionTo(){return this._roomlePositionTo}addMesh(e,t){super.addMesh(e,t),e.visible=!1,e.renderOrder=3}hoverOn(){this._dockline.visible=!0,setCursor("pointer")}hoverOff(){this._dockline.visible=!1,setCursor("default")}preparePreview(){super.preparePreview(),this._dockline.visible=!1;let e=this.lineTo.clone(),t=this.lineFrom.clone();const i=(new Vector3).subVectors(e,t);let s=i.length(),n=i.normalize();this._createLineMesh(.01,s,this.lineSegments);const a=(new Quaternion).setFromUnitVectors(new Vector3(0,1,0),n);this.lineMesh.quaternion.multiply(a),this.lineMesh.renderOrder=1;let o=(new Vector3).addVectors(e,t).multiplyScalar(.5);this.lineMesh.position.copy((new Vector3).subVectors(o,this.position.clone())),this.add(this.lineMesh);let r=this._boundingBox.getCenter(new Vector3).applyEuler(this.docklineRotation),h=null,c=0,l=Math.abs(n.x),d=Math.abs(n.y),_=Math.abs(n.z);l>=d&&l>=_?(h=new Vector3(r.x,0,0),c=Math.sqrt(r.y*r.y+r.z*r.z)):d>=l&&d>=_?(h=new Vector3(0,r.y,0),c=Math.sqrt(r.x*r.x+r.z*r.z)):_>=d&&_>=l&&(h=new Vector3(0,0,r.z),c=Math.sqrt(r.y*r.y+r.x*r.x)),c=c>0?c:.01;let m=(new Vector3).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length();this._createBoundingLineMesh(1.1*c,m,this.lineSegments);let u=this.positionTo.clone(),g=this.positionFrom.clone(),p=(new Vector3).subVectors(u,g).normalize();const v=(new Quaternion).setFromUnitVectors(new Vector3(0,1,0),p);this.boundingLineMesh.quaternion.multiply(v),this.boundingLineMesh.renderOrder=3;let f=(new Vector3).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(r);this.boundingLineMesh.position.copy((new Vector3).subVectors(f,this.position.clone())),this.add(this.boundingLineMesh)}_createLineMesh(e,t,i){this.lineMesh=this._createPreviewMesh(e,t,i,16,MaterialCreator.createMeshStandardMaterial({color:PREVIEW_MATERIAL_COLOR,transparent:!0,opacity:PREVIEW_LINE_MATERIAL_OPACITY})),this.lineMesh.name="line mesh"}_createBoundingLineMesh(e,t,i){this.boundingLineMesh=this._createPreviewMesh(e,t,i,32,MaterialCreator.createMeshStandardMaterial({color:"#ffffff",transparent:!0,opacity:0})),this.boundingLineMesh.name="bounding line mesh",this.boundingLineMesh.userData.ignoreComponentRaycast=!0,this.boundingLineMesh.layers.set(5)}_createPreviewMesh(e,t,i,s,n){let a;if(0===i.length)a=new CylinderGeometry(e,e,t,s,1);else{const n=[];for(const a of i){const i=a.to-a.from,o=(a.from+a.to)/2,r=new CylinderGeometry(e,e,i,s,1);r.translate(0,o-t/2,0),n.push(r)}a=mergeGeometries(n,!1)}return new Mesh(a,n)}clonePreviewLine(t){let i=new s(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.receivedPointAssociation);return i._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof Mesh&&0===e.userData.meshType&&i.meshes.push(e.clone(!0))}),i.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),i.add(e)}),this._dockline&&(i._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(i._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(i._boundingBox=this._boundingBox.clone()),i}getPositionForIntersectionPoint(e){let t=this._boundingBox.getCenter(new Vector3).applyEuler(this.docklineRotation),i=this.positionTo.clone().add(t),s=this.positionFrom.clone().add(t),n=new Line3(s,i).closestPointToPoint(e,!0,new Vector3);return(isNaN(n.x)||isNaN(n.y)||isNaN(n.z))&&n.copy(e),n.sub(t)}updatePreviewPosition(e){let t=this.getPositionForIntersectionPoint(e),i=this.parent.localToWorld(t);this._newPosition=this.worldToLocal(i);let s=this._boundingBox.getCenter(new Vector3).applyEuler(this.docklineRotation);this._dockline.position.copy((new Vector3).addVectors(this._newPosition,s)),this._dockline.rotation.copy(this.docklineRotation)}hideSelectionLine(){this._dockline.visible=!1}getKernelPosition(e){if(this._newPosition){let t=this.localToWorld(this._newPosition);return convertToKernel(e.worldToLocal(t))}return super.getKernelPosition(e)}}class n extends OrthographicCamera{constructor(e,t,i,s,n,a,o){super(e,t,i,s,n,a),o||(o={left:0,top:1,right:1,bottom:0}),this.offset=o}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}_calculateProjectionMatrix(){const e=this._calculate2DPlanes();if(this._offset.left>=this._offset.right||this._offset.bottom>this._offset.top)return(new Matrix4).makeOrthographic(e.left,e.right,e.top,e.bottom,this.near,this.far);const t=this._scaleRange(e.left,e.right,this._offset.left,this._offset.right);let i=t.from,s=t.to;const n=this._scaleRange(e.bottom,e.top,this._offset.bottom,this._offset.top);let a=n.from,o=n.to;const r=(e.right-e.left)/(e.top-e.bottom),h=(s-i)/(o-a);if(h>r){const e=(a+o)/2,t=(o-a)*h/r;a=e-t/2,o=e+t/2}else{const e=(i+s)/2,t=(s-i)*r/h;i=e-t/2,s=e+t/2}return(new Matrix4).makeOrthographic(i,s,o,a,this.near,this.far)}_scaleRange(e,t,i,s){const n=(t-e)/(s-i);return{from:e-n*i,to:t+n*(1-s)}}_calculate2DPlanes(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let n=i-e,a=i+e,o=s+t,r=s-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,o-=t*this.view.offsetY,r=o-t*this.view.height}return{left:n,right:a,top:o,bottom:r}}}class a extends PerspectiveCamera{constructor(e,t,i,s,n){super(e,t,i,s),n||(n={left:0,top:1,right:1,bottom:0}),this.offset=n}copy(e,t){return super.copy(e,t),this._offset=e._offset,this}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}_calculateProjectionMatrix(){let e,t,i,s,n=this.fov*(2*Math.PI/360)/2;i=Math.tan(n),s=-i;let a=Math.atan(this.aspect*Math.tan(n));t=Math.tan(a),e=-t;let o=this._offset.left,r=this._offset.right,h=this._offset.top,c=this._offset.bottom,l=new Vector2(r-o,h-c),d=new Vector2(o+l.x/2,c+l.y/2);if(l.x<l.y){let n=(1-d.x)/(l.x/2),a=d.x/(l.x/2);t*=n,e*=a;let o=(n+a)/2;i*=o,s*=o}else{let n=(1-d.y)/(l.y/2),a=d.y/(l.y/2);i*=n,s*=a;let o=(a+n)/2;e*=o,t*=o}e*=this.near,t*=this.near,i*=this.near,s*=this.near;let _=this.near*Math.tan(Math.PI/180*.5*this.fov)/this.zoom*2,m=this.aspect*_;return this.view&&this.view.enabled&&(e+=this.view.offsetX*m/this.view.fullWidth,i-=this.view.offsetY*_/this.view.fullHeight,t+=this.view.offsetX*m/this.view.fullWidth,s-=this.view.offsetY*_/this.view.fullHeight),(new Matrix4).makePerspective(e,t,i,s,this.near,this.far)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}}return{create:function(t,i,s,n,a){return new e(t,i,s,n,a)},createPreview:function(e,t,s){return new i(s,e,{x:0,y:0,z:0},{x:0,y:0,z:0},t,!1)},createStatic:function(e,i){return new t(e,i)},createPreviewLine:function(e,t){let i=new s(t,e.id,e.roomlePosition,e.roomleRotation,e.parentObjectId,e.receivedPointAssociation);return e.meshes.forEach(e=>{let t=e.clone();t.material=e.material.clone(),t.geometry=e.geometry.clone(),i.addMesh(t)}),i.computeBoundingBox(),i},isPreview:function(e){return e instanceof i},isPreviewLine:function(e){return e instanceof s},createPerspectiveCamera:function(e,t,i,s,n){return new a(e,t,i,s,n)},createOrthographicCamera:function(e,t,i,s,a,o,r){return new n(e,t,i,s,a,o,r)}}}class Environment{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class BakedShadowPlane{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new Object3D,this._plane.rotation.x=-Math.PI/2;const t=MaterialCreator.createMeshStandardMaterial({});this._innerPlaneMesh=new Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new Shape;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new Shape;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new Path;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new ShapeGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const o=new ShapeGeometry(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=a.attributes.uv.clone();a.setAttribute("uv2",r);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class FloorEnvironment extends Environment{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new BakedShadowPlane(100),this._fog=i||!1,this._textureLoader=new TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new Fog(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=RepeatWrapping,this._floorTexture.wrapT=RepeatWrapping,this._floorTexture.repeat.set(100/e,100/t));let i=MaterialCreator.createMeshStandardMaterial({map:this._floorTexture,side:DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=createMaterial(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(addTexture(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=getGUI();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}__decorate([inject],FloorEnvironment.prototype,"_rapiAccess",void 0),__decorate([inject],FloorEnvironment.prototype,"_dataSyncer",void 0);const KEYBOARD_ROTATION_ANGLE=Math.PI/4;class CameraControlFirstPerson extends CameraControl{constructor(e,t,i,s){super(e,t,i),this._state=0,this._cameraRotation=new Quaternion,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=toRadiant(-60),this.maxPolarAngle=toRadiant(60),this._camera=s||new PerspectiveCamera,this._camera.fov=75,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i||this._camera.position.set(0,1.5,0),this._cameraPosition=new Vector3,this._cameraPosition.copy(this._camera.position),this._pitch=0,this._yaw=0;let n=new Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}setUp(){super.setUp(),this._camera.fov=75,this._initInputListener()}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*KEYBOARD_ROTATION_ANGLE*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*KEYBOARD_ROTATION_ANGLE*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=position3VectorsAreEqual(t,s.position),a=rotationQuaternionsAreEqual(i,s.quaternion);if(!t||n&&a)return!1;let o=this.getCamera().position.clone(),r=Math.min(10*e,1);o.lerp(t,r),this.getCamera().position.copy(o);let h=this.getCamera().quaternion.clone(),c=Math.min(5*e,1);h.slerp(i,c),this.getCamera().setRotationFromQuaternion(h);let l=!1;return this._keyMap.forEach(e=>{e&&(l=!0)}),l&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.1:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new Vector2(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new Vector2(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){getDelta(this._downPosition,this._position)<MIN_MOVE_DISTANCE&&1===this._state&&(this._state=2,this._orbit(new Vector2(this._position.x,this._position.y)),this._moveForward())}_update(e){var t;let i=new Euler(-this._pitch,this._yaw,0,"ZYX");null===(t=this._cameraRotation)||void 0===t||t.setFromEuler(i)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix(),this._camera.near=.1,this._camera.far=100}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new Vector3(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1.5*t),e.get(68)&&(i.x=1.5*t),e.get(37)&&(this._rotateHorizontal(-KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal(KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1.5*i),(e.get(83)||e.get(40))&&(t.z=1.5*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){this._removeInputListener()}}class BackgroundEnvironment extends Environment{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}class DynamicEnvironmentSettingLoader{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,o=s.environment;if(!o)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(o.type){case"color":a=new Promise(t=>t(new BackgroundEnvironment(e,i,new Color(o.details.color))));break;case"image":a=new Promise(s=>s(new BackgroundEnvironment(e,i,null,t,o.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(o.details.material).then(s=>{let a=void 0===o.details.fog||o.details.fog,r=new FloorEnvironment(e,i,a);r.changeFloorMaterial(s,n).then(()=>{t(r)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}__decorate([inject],DynamicEnvironmentSettingLoader.prototype,"_rapiAccess",void 0);class LightSetting{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new Object3D),this._cameraContainer}}class DynamicLightSetting extends LightSetting{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new Vector3;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(handleJsonResponse).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new Vector3;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof SpotLight&&this._addSpotLightToGUI(e,t),t instanceof AmbientLight&&this._addAmbientLightToGUI(e,t),t instanceof DirectionalLight&&this._addDirectionalLightToGUI(e,t),t instanceof RectAreaLight&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new Color(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new Color(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new Color(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new Color(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}}__decorate([inject],DynamicLightSetting.prototype,"_dynamicLightSettingLoader",void 0);class GroundedSkybox extends Mesh{constructor(e,t,i,s=128){if(t<=0||i<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const n=new SphereGeometry(i,2*s,s);n.scale(1,1,-1);const a=n.getAttribute("position"),o=new Vector3;for(let e=0;e<a.count;++e)if(o.fromBufferAttribute(a,e),o.y<0){const i=3*-t/2,s=o.y<i?-t/o.y:1-o.y*o.y/(3*i*i);o.multiplyScalar(s),o.toArray(a.array,3*e)}a.needsUpdate=!0,super(n,new MeshBasicMaterial({map:e,depthWrite:!1}))}}class GroundProjectedEnvironment extends Environment{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new GroundedSkybox(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=getGUI();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class LightSourceDetectorDebug{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new PlaneGeometry(2,1),s=null!=t?t:new MeshBasicMaterial({color:12632256,side:DoubleSide}),n=new Mesh(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const o=n.map(e=>e.uv),r=a.map(e=>e.uv),h=e.filter(e=>!o.includes(e)&&!r.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(o,.01,255),this._createSamplePointsInMap(r,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(c,.015,16776960);let l=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<l.length&&(l=l.slice(0,s)),this._createCirclesInMap(l,8421376)}_createSamplePointsInMap(e,t,i){const s=new CircleGeometry(t,8,4),n=new MeshBasicMaterial({color:i});e.forEach(e=>{var t;const i=new Mesh(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new MeshBasicMaterial({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new CircleGeometry(e.size,8,4),n=new Mesh(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new LineBasicMaterial({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new Vector2(t,e))),a.push(this._uvToMapPosition(new Vector2(1-t,e)))}a.push(this._uvToMapPosition(n))}});const o=(new BufferGeometry).setFromPoints(a),r=new LineSegments(o,n);r.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(r)}_uvToMapPosition(e){return new Vector3(2*e.x-1,e.y-.5,0)}}class EnvironmentPmremGenertor extends PMREMGenerator{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new Matrix3}},vertexShader:equilateralVertexShader,fragmentShader:equilateralFragmentShader,blending:NoBlending,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const equilateralVertexShader="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",equilateralFragmentShader="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class EnvironmentSceneGenerator{}class EnvironmentDefinition{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof EnvironmentSceneGenerator?this.environmentSceneGenerator=e:e instanceof CubeTexture?this.cubeTexture=e:e instanceof Texture&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new EnvironmentDefinition(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new Vector2(e,0)}_createPmremTexture(e){const t=new EnvironmentPmremGenertor(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new LightSourceDetector;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new Scene;const n=new EnvironmentMapDecodeMaterial(!0,!1);n.setSourceTexture(t.environment),LightSourceDetectorDebug.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new LightSourceDetectorDebug(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class DefaultEnvironmentSceneGenerator extends EnvironmentSceneGenerator{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new DefaultEnvironmentScene({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class DefaultEnvironmentScene extends Scene{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new BoxGeometry,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new CylinderGeometry(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new Color(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new Vector2(s,n),3,1,.8,.2):this._createSideLight(e,new Vector2(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new Color(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new Vector2(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new Vector2(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new Vector2(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new MeshBasicMaterial;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new Mesh(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,o){for(let r=0;r<3;r++){const h=s*this._sideLightIntensity,c=new Mesh(this._lightGeometry,this._createAreaLightMaterial((r+i)%3==0?h:h*(1-this._colorVariation),(r+i)%3==1?h:h*(1-this._colorVariation),(r+i)%3==2?h:h*(1-this._colorVariation))),l=(1===r?-t.y:2===r?t.y:0)/Math.sqrt(2),d=0===r?0:1,_=(1===r?t.x:2===r?-t.x:0)/Math.sqrt(2);c.position.set(t.x*o*15+1.1*l*n,15*a+1.1*d*n,t.y*o*15+1.1*_*n),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(n),e.add(c)}}_createReflector(e,t,i,s,n,a){const o=new Mesh(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));o.position.set(15*t.x,10*a,15*t.y),o.scale.set(10*s,10*n,10*s),e.add(o)}}class CameraControl2D extends CameraControl{constructor(e,t,i,s){super(e,t,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new Vector2,this._zoomPosition=new Vector3,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),s?(this._camera=s,this._cameraPosition=(new Vector3).copy(this._camera.position)):this._initCamera(i?new Vector3(i.targetX,10,i.targetZ):new Vector3(0,10,0)),this._lerpEnabled=!1}_getCamera(){return this._camera||this._initCamera(new Vector3(0,10,0)),this._camera}_initCamera(e){let{x:t,y:i}=this._domHelper.getClientDimensions(),s=(t/i||1)*this._size,n=this._size;this._camera=new OrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(e),this._cameraPosition=e,this._camera.lookAt(new Vector3(0,0,0))}updateCamera(){let e=this._domHelper.getAspectRatio()*this._size,t=this._size;this._camera.left=e/-2,this._camera.right=e/2,this._camera.top=t/2,this._camera.bottom=t/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:e=>{this._locked||(this._state=1,this._lastPosition.set(e.positionRelative.x,e.positionRelative.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:e=>{this._lastPosition.x===e.positionRelative.x&&this._lastPosition.y===e.positionRelative.y||1!==this._state||this._locked||(this._move(new Vector2(e.positionRelative.x,e.positionRelative.y),e.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(3),this._scale/=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}}),this._inputListeners.push({key:8,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(4),this._scale*=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}})}_zoomTo(e){if(Date.now()-this._lastZoom>200){let t=new Vector3(e.x,e.y,0);t.unproject(this._camera),this._zoomPosition.copy(t)}this._lastZoom=Date.now()}_move(e,t){let i=new Vector3,s=new Vector3(this._lastPosition.x,this._lastPosition.y,0),n=new Vector3(e.x,e.y,0);s.unproject(this._camera),n.unproject(this._camera),i.subVectors(n,s),this._cameraPosition.x-=i.x*(2===t?1.1:1),this._cameraPosition.z-=i.z*(2===t?1.1:1),this._lastPosition.copy(e)}zoomToFitBounds(e,t,i){if(compareBox3Size(e,this._boundingBox)<0&&!i)return void this.setBounds(e);this.setBounds(e);const s=e.getSize(new Vector3),n=e.getCenter(new Vector3),a=s.x/-2/this._camera.left,o=s.z/-2/this._camera.bottom,r=1/Math.max(a,o);(r<this._cameraZoom||t)&&(this._scale=r,this._cameraZoom=r,this._cameraPosition.x=n.x,this._cameraPosition.z=n.z)}_update(e,t,i){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.1);let s=(new Vector3).subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=s.x,this._cameraPosition.z+=s.z,this._cameraZoom!==this._scale&&this.dispatchEvent(5,new ZoomChangeEvent(.1===this._scale,5===this._scale)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(e){const t=Math.abs(this._cameraZoom-this._camera.zoom)>.01;if(this._lerpEnabled=t,!super.animateCamera(e)&&!t)return!1;this._lerpEnabled=!1;const i=Math.min(10*e,1);return this._camera.zoom=MathUtils.lerp(this._camera.zoom,this._cameraZoom,i),!0}getKernelZoomFactor(){const e=1e3*(this._camera.right-this._camera.left);return this._domHelper.element.clientWidth/e*this._camera.zoom}}class SceneManager{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new MeshBasicMaterial({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(sanitizedCameraMode(s),t),this._setupScene(t,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&this.cameraBehaviour.cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){this.cameraBehaviour.cameraControl instanceof CameraControl3D&&this.cameraBehaviour.cameraControl.updateDistanceAndRangesBasedOnBounds(this.getBounds())}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof DynamicLightSetting&&this.cameraBehaviour.cameraControl.getCamera()instanceof PerspectiveCamera&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof CameraControl3D&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i,s;const{x:n,y:a}=this._domHelper.getClientDimensions();this._scene=new Scene,this._uiScene=new Scene,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new WebGLRenderer({antialias:!this._globalInitData.e2e,alpha:!0});const o=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(o),this._renderer.setSize(n,a),this._renderer.outputColorSpace=SRGBColorSpace,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new RoomleWebGLRenderer(this._renderer,n,a,null!==(i=this._initData.linearAoFilter)&&void 0!==i&&i),this._initData.debug&&this._roomleRenderer.sceneRenderer.loadLutImages(lutImages),this._roomleRenderer.setQualityMap(standaloneConfiguratorQualityLevels),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(s=this._roomleRenderer)||void 0===s||s.setSize(n,a),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.hiddenEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.visibleEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.applyParameters()),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new EnvironmentDefinition(new DefaultEnvironmentSceneGenerator({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new EnvironmentDefinition(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof GroundProjectedEnvironment&&this._environment.updateEnvironmentTexture(i),t!==ENV_HDR_256_FILE_NAME||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{dispose(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,o).then(e=>{r(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,o,r){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,o,r).then(e=>{h(e.scene)},c)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=getGUI(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=getGUI();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){import("./stats-helper-b5614bb9.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new DynamicEnvironmentSettingLoader).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new Color(e)))}setBackgroundImage(e){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const i=DynamicLightSettingLoader.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=5;let i=this._domHelper.getAspectRatio()*t,s=t;const n=RoomleComponentFactoryInitializer();this._orthographicOffsetCamera=n.createOrthographicCamera(i/-2,i/2,s/2,s/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new Vector3(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=RoomleComponentFactoryInitializer();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new Vector3);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new Vector3),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportCanvasScreenshot(e=1){return await this._waitForAssets(),new Promise(t=>{this._onAfterRender=()=>{const i=this._renderer.domElement.toDataURL(this._initData.transparentBackground?"image/png":"image/jpeg",e);t(i),this._onAfterRender=()=>{}},this._requestRender()})}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{this._onAfterRender=()=>{};const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:o,bottom:r}=this.getCameraOffset(),h=a-n,c=o-r;if(1===h&&1===c)return download(e,s),void t();const l=new Image;l.src=s,l.onload=()=>{const{naturalWidth:i,naturalHeight:s}=l,a=document.createElement("canvas");a.width=i*h,a.height=s*c;const r=a.getContext("2d"),d=i*n*-1,_=s*(1-o)*-1;r.drawImage(l,d,_),r.save(),download(e,a.toDataURL("image/jpeg",1)),t()},l.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_getCameraControl3D(e){return this._cameraControl3D?e&&this._cameraControl3D.setCurrentCameraParameters(e):this._cameraControl3D=new CameraControl3D(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera()),this._cameraControl3D}_getCameraControl2D(){return this._cameraControl2D||(this._cameraControl2D=new CameraControl2D(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._cameraControl2D}_getCameraControlFirstPerson(){return this._cameraControlFirstPerson||(this._cameraControlFirstPerson=new CameraControlFirstPerson(this._creator_,this._getInputManager(),null,this.getPerspectiveOffsetCamera())),this._cameraControlFirstPerson}}__decorate([inject],SceneManager.prototype,"_domHelper",void 0),__decorate([inject],SceneManager.prototype,"_scriptLoader",void 0),__decorate([inject],SceneManager.prototype,"_lifeCycleManager",void 0),__decorate([inject],SceneManager.prototype,"_staticItemLoader",void 0),__decorate([inject],SceneManager.prototype,"_hdrEnvironmentLoader",void 0),__decorate([inject],SceneManager.prototype,"_initData",void 0),__decorate([inject],SceneManager.prototype,"_globalInitData",void 0),__decorate([inject],SceneManager.prototype,"_globalCallback",void 0),__decorate([inject],SceneManager.prototype,"_idbManager",void 0),__decorate([inject],SceneManager.prototype,"_pluginSystem",void 0),__decorate([inject],SceneManager.prototype,"_imageRenderer",void 0),__decorate([inject],SceneManager.prototype,"_cameraBehaviourState",void 0);class CameraBehaviour{constructor(e,t){var i;return this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,(null===(i=window.__RML__DEBUG__)||void 0===i?void 0:i.camera)?traceMethodCalls(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}}export{BackgroundEnvironment as B,CameraControl3D as C,DISTANCE_FACTOR as D,FloorEnvironment as F,LightSetting as L,PULSE_LOOPS as P,RoomleComponentFactoryInitializer as R,SceneManager as S,TWEEN_FILE_NAME as T,CameraControl as a,CameraBehaviour as b,PULSE_DURATION as c,CameraControl2D as d,CameraControlFirstPerson as e};
|
|
2
|
+
//# sourceMappingURL=camera-behaviour-2f2ffe82.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-behaviour-
|
|
1
|
+
{"version":3,"file":"camera-behaviour-2f2ffe82.js","sources":["../../packages/common-core/public/textures/env/default_1k.exr","../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr"],"sourcesContent":["export default \"static/default_1k-2aa6d42244d30fb1.exr\"","export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from 'three';\n\n/**\n * A ground-projected skybox. The height is how far the camera that took the photo was above the ground -\n * a larger value will magnify the downward part of the image. By default the object is centered at the camera,\n * so it is often helpful to set skybox.position.y = height to put the ground at the origin. Set the radius\n * large enough to ensure your user's camera stays inside.\n */\n\nclass GroundedSkybox extends Mesh {\n\n\tconstructor( map, height, radius, resolution = 128 ) {\n\n\t\tif ( height <= 0 || radius <= 0 || resolution <= 0 ) {\n\n\t\t\tthrow new Error( 'GroundedSkybox height, radius, and resolution must be positive.' );\n\n\t\t}\n\n\t\tconst geometry = new SphereGeometry( radius, 2 * resolution, resolution );\n\t\tgeometry.scale( 1, 1, - 1 );\n\n\t\tconst pos = geometry.getAttribute( 'position' );\n\t\tconst tmp = new Vector3();\n\n\t\tfor ( let i = 0; i < pos.count; ++ i ) {\n\n\t\t\ttmp.fromBufferAttribute( pos, i );\n\t\t\tif ( tmp.y < 0 ) {\n\n\t\t\t\t// Smooth out the transition from flat floor to sphere:\n\t\t\t\tconst y1 = - height * 3 / 2;\n\t\t\t\tconst f =\n\t\t\t\t\t\ttmp.y < y1 ? - height / tmp.y : ( 1 - tmp.y * tmp.y / ( 3 * y1 * y1 ) );\n\t\t\t\ttmp.multiplyScalar( f );\n\t\t\t\ttmp.toArray( pos.array, 3 * i );\n\n\t\t\t}\n\n\t\t}\n\n\t\tpos.needsUpdate = true;\n\n\t\tsuper( geometry, new MeshBasicMaterial( { map, depthWrite: false } ) );\n\n\t}\n\n}\n\nexport { GroundedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\""],"names":["TWEEN_FILE_NAME","GroundedSkybox","Mesh","[object Object]","map","height","radius","resolution","Error","geometry","SphereGeometry","scale","pos","getAttribute","tmp","Vector3","i","count","fromBufferAttribute","y","y1","f","multiplyScalar","toArray","array","needsUpdate","super","MeshBasicMaterial","depthWrite"],"mappings":"wiEAAA,ICAeA,gBAAA,o+iDCSf,MAAMC,uBAAuBC,KAE5BC,YAAaC,EAAKC,EAAQC,EAAQC,EAAa,KAE9C,GAAKF,GAAU,GAAKC,GAAU,GAAKC,GAAc,EAEhD,MAAM,IAAIC,MAAO,mEAIlB,MAAMC,EAAW,IAAIC,eAAgBJ,EAAQ,EAAIC,EAAYA,GAC7DE,EAASE,MAAO,EAAG,GAAK,GAExB,MAAMC,EAAMH,EAASI,aAAc,YAC7BC,EAAM,IAAIC,QAEhB,IAAM,IAAIC,EAAI,EAAGA,EAAIJ,EAAIK,QAAUD,EAGlC,GADAF,EAAII,oBAAqBN,EAAKI,GACzBF,EAAIK,EAAI,EAAI,CAGhB,MAAMC,EAAgB,GAATf,EAAa,EACpBgB,EACJP,EAAIK,EAAIC,GAAOf,EAASS,EAAIK,EAAM,EAAIL,EAAIK,EAAIL,EAAIK,GAAM,EAAIC,EAAKA,GACnEN,EAAIQ,eAAgBD,GACpBP,EAAIS,QAASX,EAAIY,MAAO,EAAIR,GAM9BJ,EAAIa,aAAc,EAElBC,MAAOjB,EAAU,IAAIkB,kBAAmB,CAAEvB,IAAAA,EAAKwB,YAAY,qkqBC3C9C,ghDHAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register(["./roomle-dependency-injection-22befdc7.nomodule.js","./main-thread-to-worker-ff3b0e7b.nomodule.js"],(function(e,t){var i,s,n,a,o,r,h,c,l,d,_,m,u,p,g,v,f,w,y,x,b,M,C,P,S,L,E,D,I,k,B,R,z,T,O,A,F,U,j,N,q,H,G,Z,W,V,K,Y,X,J,Q,$,ee,te,ie,se,ne,ae,oe,re,he,ce,le,de,_e,me,ue,pe,ge,ve,fe,we,ye,xe,be,Me,Ce,Pe,Se,Le,Ee,De,Ie,ke,Be,Re,ze,Te,Oe,Ae,Fe,Ue,je,Ne,qe,He;return{setters:[function(e){i=e._,s=e.i,n=e.E,a=e.u,o=e.a3,r=e.a4,h=e.q,c=e.Q,l=e.U,d=e.a5,_=e.a6,m=e.a7,u=e.a8,p=e.c,g=e.r,v=e.a9,f=e.aa,w=e.ab,y=e.k,x=e.t,b=e.ac,M=e.s,C=e.ad,P=e.ae,S=e.m,L=e.af,E=e.ag,D=e.ah,I=e.ai,k=e.aj,B=e.ak,R=e.al,z=e.am,T=e.an,O=e.ao,A=e.ap,F=e.aq,U=e.K,j=e.z},function(e){N=e.a,q=e.bG,H=e.U,G=e.V,Z=e.bI,W=e.ae,V=e.bM,K=e.Q,Y=e.ag,X=e.aC,J=e.v,Q=e.C,$=e.bN,ee=e.z,te=e.O,ie=e.E,se=e.a_,ne=e.bO,ae=e.aP,oe=e.ad,re=e.B,he=e.bP,ce=e.bQ,le=e.X,de=e.k,_e=e.bR,me=e.bS,ue=e.bT,pe=e.m,ge=e.bU,ve=e.r,fe=e.w,we=e.aZ,ye=e.S,xe=e.A,be=e.D,Me=e.R,Ce=e.aS,Pe=e.h,Se=e.b9,Le=e.a$,Ee=e.u,De=e.bV,Ie=e.ap,ke=e.ao,Be=e.av,Re=e.ah,ze=e.a9,Te=e.al,Oe=e.W,Ae=e.bW,Fe=e.bL,Ue=e.bC,je=e.i,Ne=e.bl,qe=e.bJ,He=e.bX}],execute:function(){e("R",Ye),e("T","static/Tween-d57ee5d181fce582.js");class Ge extends n{constructor(e,t,i){var s,n;super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new N,this._targetPosition=new N,i?this.setCurrentCameraParameters(i):(this._cameraPosition=new N(0,.5,3),this._pitch=a(null!==(s=this._initData.verticalCameraAngle)&&void 0!==s?s:10),this._yaw=a(null!==(n=this._initData.horizontalCameraAngle)&&void 0!==n?n:-30));let o=this._domHelper.getClientDimensions();this._width=o.x,this._height=o.y,this._dispatchCameraIdle=q(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}setUp(){this._addInputListeners()}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||o(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e||!this._initData.animateCamera?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new N(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new N(e.targetX,e.targetY,e.targetZ),i,!0)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof H){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}setCurrentCameraParameters(e){var t,i,s;this._yaw=null!==(t=e.yaw)&&void 0!==t?t:0,this._pitch=null!==(i=e.pitch)&&void 0!==i?i:0,this._distance=null!==(s=e.distance)&&void 0!==s?s:0,this._targetPosition.copy(new N(e.targetX,e.targetY,e.targetZ)),this._update(null,!0,!0)}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}async setToState(e,t){await this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new N(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof H&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}e("a",Ge),i([s],Ge.prototype,"_domHelper",void 0),i([s],Ge.prototype,"_initData",void 0),i([s],Ge.prototype,"_globalInitData",void 0);class Ze{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}e("D",2.725);class We extends Ge{constructor(e,t,i,s){super(e,t,i),this._bounds=new N,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new N(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:o,minVerticalCameraAngle:r,maxVerticalCameraAngle:h,minHorizontalCameraAngle:c,maxHorizontalCameraAngle:l}=this._initData;if(o&&(this._zoomDistance=o/100),void 0!==r&&(this.minPolarAngle=a(r<0?r:-1*r)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==c&&(this.minAzimuthAngle=a(c<0?c:-1*c)),void 0!==l&&(this.maxAzimuthAngle=a(l)),void 0!==n){let e=Math.abs(a(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new H,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new G(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new G(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new G(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),r(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new G(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),r(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&h(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new N);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new N);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};Z(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new N);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new N),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const o={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};Z(s,o)||this._tweenCameraParameter(s,o,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new N);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new N(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),o=e.getSize(new N);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new W);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:o,y:r}=this._getMargin(i,s),h=c(e.x+o,e.y+r,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return c(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){const i=Math.max(this._bounds.x,this._bounds.y);let s=i>3?0:this._bounds.x/2,n=i>3?0:this._bounds.y/2;return e>1080&&(s+=i<.3?.1:0,s+=(i>3?0:this._bounds.x)*(e/1080-1)),t>1080&&(s+=i<.3?.1:0,n+=(i>3?0:this._bounds.y)*(t/1080-1)),{x:s,y:n}}reset(e,t,i,s,n=!0){var o,r;const h=e.getSize(new N);if(h){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new N);this._targetPosition.copy(t)}const c=this.getCurrentCameraParameters();if(i||(i=null!==(o=this._initData.horizontalCameraAngle)&&void 0!==o?o:-30),s||(s=null!==(r=this._initData.verticalCameraAngle)&&void 0!==r?r:10),i+=l(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(h),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(h);const d=this._setDistanceAndRangesBasedOnBounds(h),_=a(s),m=a(i);let u=this._targetPosition.clone();n?this._tweenCameraParameter(c,{yaw:m,pitch:_,distance:d,targetX:u.x,targetY:u.y,targetZ:u.z},!0):(this._pitch=_,this._yaw=m,this._distance=d,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateDistanceAndRangesBasedOnBounds(e){if(!e)return;const t=e.getSize(new N),i=e.getCenter(new N);this.setBounds(e),this._targetPosition.copy(i),this._setDistanceAndRangesBasedOnBounds(t,!1)}async updateAndReset(e,t=!0){var i,s;const n=e.getSize(new N),o=e.getCenter(new N);this.setBounds(e),this._targetPosition.copy(o),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(n));const r=this.getCurrentCameraParameters();this._camera.fov=30,this._pitch=a(null!==(i=this._initData.verticalCameraAngle)&&void 0!==i?i:10),this._yaw=a((null!==(s=this._initData.horizontalCameraAngle)&&void 0!==s?s:-30)+l(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(n);let h=this._targetPosition.clone();t?await this._tweenCameraParameter(r,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:h.x,targetY:h.y,targetZ:h.z},!0):this._update(this._targetPosition)}_update(e,t,i){i||(this._yaw=V(this._yaw,this.minAzimuthAngle,this.maxAzimuthAngle),this._pitch=this._initData.debug?V(this._pitch,a(-89),a(89)):V(this._pitch,this.minPolarAngle,this.maxPolarAngle),this._saveYawAndPitch());const s=(new K).setFromEuler(new Y(-this._pitch,this._yaw,0,"ZYX")),n=new N(0,0,-1).applyQuaternion(s);i||(this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance))),e&&this._targetPosition.copy(e);const o=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(o),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(o);else{const e=this._getCameraSphere(o);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(o),this._zoomChanged(this._distance===this.maxDistance,!1))}this._scale=1}_zoomChanged(e,t){var i;let s=e+""+t;0===(null===(i=this._currentZoomHash)||void 0===i?void 0:i.length)||this._currentZoomHash!==s?(this.dispatchEvent(5,new Ze(e,t)),this._currentZoomHash=s):e||t||this.dispatchEvent(5,new Ze(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new W(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new N(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new N);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=X(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}e("C",We);const Ve=e("c",1500),Ke=e("P",5);function Ye(){class e extends te{static _generateOutline(e,t){let i=new ie(new se(e),new ne({color:"#000000",dashSize:.03,gapSize:.01,linewidth:1}));return i.translateOnAxis(t,1),i.userData.ignoreComponentRaycast=!0,i}static cloneDockLine(e,t){let i=new ie(e.geometry,e.material);return i.translateOnAxis(t.getCenter(new N),1),i.name="dockline",i.layers.set(5),i.userData.ignoreComponentRaycast=!0,i}_setValues(e,t,i,s,n){e&&(this.runtimeId=e,this.name=e.toString()),t&&(this.roomlePosition=Object.assign({},t)),i&&(this.roomleRotation=Object.assign({},i)),s&&(this.parentObjectId=s),n&&(this.isRootComponent=n)}constructor(e,t,i,s,n){super(),this._selected=!1,this.isChildPlanObject=!1,this.geometryChanged=!0,this.meshes=[],this.castShadow=!1,this.receiveShadow=!0,this._setValues(e,t,i,s,n)}get loadingMesh(){return this._loadingMesh}get boundingBoxMesh(){return this._boundingBoxMesh}get boundingBox(){return this._boundingBox}set roomlePosition(e){this._roomlePosition=e,e&&this.position.set(e.x/1e3,e.z/1e3,e.y/-1e3)}get roomlePosition(){return this._roomlePosition}set roomleRotation(e){this._roomleRotation=e,e&&this.rotation.set(e.x,e.z,-e.y)}get roomleRotation(){return this._roomleRotation}replaceMeshes(e){this.removeAllMeshes(),e.forEach(e=>{this.addMesh(new ee(e.geometry,e.material))})}addMesh(e,t){e.renderOrder=2,e.userData.meshType=0,t&&e.applyMatrix4(p(t)),this.add(e),this.meshes.push(e)}getMeshById(e){return this.meshes.find(t=>t.userData.meshId===e)}removeMeshById(e){const t=this.getMeshById(e);t?this.removeMesh(t):console.warn("Could not remove mesh with id "+e,this.runtimeId,this.meshes)}removeMesh(e){const t=this.meshes.indexOf(e);this.remove(e),g(e),t<0||this.meshes.splice(t,1)}removeAllMeshes(e=!0){this.meshes.forEach(t=>{this.remove(t),e&&g(t)}),this.meshes=[],this._removeLoadingMesh(),this.remove(this._boundingBoxMesh),g(this._boundingBoxMesh),this._boundingBoxMesh=null}_hideAllMeshes(){this.meshes.forEach(e=>e.visible=!1)}_showAllMeshes(){this.meshes.forEach(e=>e.visible=!0)}select(){this._selected=!0}loading(){if(!this._kernelBoundingBox)return void console.warn("Bounding box (box for measurements) for component "+this.runtimeId+" not set, can not show external mesh loading box!");this._removeLoadingMesh(),this._hideAllMeshes();const{x:e,y:t,z:i}=this._kernelBoundingBox.getSize(new N);let s=new ae(e,t,i);this._loadingMesh=new ee(s,v.createMeshStandardMaterial({transparent:!0,opacity:f,color:new Q(w)})),this._loadingMesh.name="loading mesh",this._loadingMesh.receiveShadow=!1,this._loadingMesh.castShadow=!1,this._loadingMesh.layers.set(5),this._loadingMesh.translateOnAxis(this._kernelBoundingBox.getCenter(new N),1),this._loadingMesh.renderOrder=3,this.add(this._loadingMesh)}_removeLoadingMesh(){this._loadingMesh&&(this.remove(this._loadingMesh),g(this._loadingMesh),this._loadingMesh=null)}loadingFinished(){this._removeLoadingMesh(),this._showAllMeshes()}deselect(){this._selected=!1}hoverOn(){$("pointer")}hoverOff(){$("default")}computeBoundingBox(t,i=!1){if(this._boundingBoxMesh&&this.remove(this._boundingBoxMesh),!i&&t&&0===t.size.x&&0===t.size.y&&0===t.size.z)return;let s;if(!t||i){this._boundingBox=new oe;let e=new N;this.meshes.forEach(t=>{if(t.geometry instanceof re){let i=t.geometry.attributes.position;if(void 0!==i)for(let s=0,n=i.count;s<n;s++)e.fromBufferAttribute(i,s).applyMatrix4(t.matrix),this._boundingBox.expandByPoint(e)}}),this._kernelBoundingBox=this._boundingBox.clone();let t=this._boundingBox.max.x-this._boundingBox.min.x,i=this._boundingBox.max.y-this._boundingBox.min.y,n=this._boundingBox.max.z-this._boundingBox.min.z;s=new ae(t,i,n)}else{this._kernelBoundingBox=y(t),this._boundingBox=this._kernelBoundingBox.clone();let{x:e,y:i,z:n}=this._boundingBox.getSize(new N);s=new ae(e,i,n)}this._boundingBoxMesh=new ee(s,v.createMeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1,visible:!1})),this._boundingBoxMesh.name="bounding box mesh";let n=this._boundingBox.getCenter(new N);this._boundingBoxMesh.position.add(n),this._boundingBoxMesh.layers.set(5),this._boundingBoxMesh.renderOrder=3,this._boundingBoxMesh.castShadow=!1,this._boundingBoxMesh.receiveShadow=!1,this.add(this._boundingBoxMesh),this._dockline=e._generateOutline(s,n),this._dockline.name="bounding box outline",this._dockline.layers.set(5),this._selected&&this.add(this._dockline)}recursiveMeshes(){let t=this.meshes.slice();return this.children.forEach(i=>{i instanceof e&&t.push(...i.recursiveMeshes())}),t}isChild(t){let i=!1;return this.children.forEach(s=>{s instanceof e&&!i&&(i=s.runtimeId===t||s.isChild(t))}),i}getKernelPosition(e){let t=this.parent.localToWorld(this.position);return x(e.worldToLocal(t))}animateMeshes(e,t,i,s=!0,n){this.meshes.forEach(a=>{var o;const r=null===(o=a.userData)||void 0===o?void 0:o.animationMatrixMap;if(r){const o=null==r?void 0:r.get(`${e}:${t}`),h=null==r?void 0:r.get(`${e}:${i}`);this._animateMesh(a,o,h,s,n)}})}_animateMesh(e,t,i,s=!0,n){var a;const o=null===(a=e.userData)||void 0===a?void 0:a.transform;if(!o||!t&&!i)return;let r=o.clone(),h=o.clone();(null==t?void 0:t.matrix)&&r.multiply(t.matrix),(null==i?void 0:i.matrix)&&h.multiply(i.matrix),s?b(e,r,h,n):(M(e,h),void 0!==(null==i?void 0:i.visible)&&(e.visible=i.visible),n&&n())}}class t extends e{constructor(e,t){super(e,null,null,null,!1),this.glbUrl=t}}class n extends e{constructor(e,t,i,s,n,a){super(t,i,s,n,a),this._stringId=null,this.receivedPointAssociation=!1,this.castShadow=!1,this.receiveShadow=!1,this._creator_=e}get stringId(){return this._stringId?this._stringId:this.runtimeId.toString()}addMesh(e,t){super.addMesh(e,t),e.material instanceof J&&(e.material.opacity=d,e.material.roughness=_,e.material.metalness=m,e.material.color=new Q(this._initData.colors.PREVIEW_DOCKING_COLOR)),e.renderOrder=1,e.castShadow=!1,e.receiveShadow=!1}startPulsating(){var e,t;if(null===(t=null===(e=this._initData)||void 0===e?void 0:e.featureFlags)||void 0===t?void 0:t.pulsePreview)for(const e of this.meshes){const t={opacity:d},i={opacity:.3};new TWEEN.Tween(t).to(i,Ve).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{e.material.opacity=t.opacity}).yoyo(!0).repeat(Ke).start()}}hoverOn(){this.remove(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=u,e.roughness=_,e.metalness=m,e.color=new Q(this._initData.colors.PREVIEW_DOCKING_COLOR)}),$("pointer")}hoverOff(){this.add(this._dockline),this.meshes.forEach(({material:e})=>{e.opacity=d,e.roughness=_,e.metalness=m,e.color=new Q(this._initData.colors.PREVIEW_DOCKING_COLOR)}),$("default")}clonePreview(t){const i=new n(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.isRootComponent);return i._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof ee&&0===e.userData.meshType&&i.meshes.push(e.clone(!0))}),i.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),i.add(e)}),this._dockline&&(i._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(i._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(i._boundingBox=this._boundingBox.clone()),i}preparePreview(){this.add(this._dockline),this.add(this._boundingBoxMesh)}}i([s],n.prototype,"_initData",void 0);class a extends n{constructor(e,t,i,s,n,a){super(e,t,i,s,n,!1),this.lineSegments=[],a&&(this._stringId=this.runtimeId+"_has_additional_dock_point_copy")}set roomleLineFrom(e){this._roomleLineFrom=e,this.lineFrom=C(e)}get roomleLineFrom(){return this._roomleLineFrom}set roomleLineTo(e){this._roomleLineTo=e;let t=C(e);t.equals(this.lineFrom)&&(console.warn("lineFrom and lineTo are equal!"),t.add(new N(0,.01,0))),this.lineTo=t}get roomleLineTo(){return this._roomleLineTo}set roomlePositionFrom(e){this._roomlePositionFrom=e,this.positionFrom=C(e)}get roomlePositionFrom(){return this._roomlePositionFrom}set roomlePositionTo(e){this._roomlePositionTo=e;let t=C(e);t.equals(this.positionFrom)&&(console.warn("positionFrom and positionTo are equal!"),t.add(new N(0,.01,0))),this.positionTo=t}get roomlePositionTo(){return this._roomlePositionTo}addMesh(e,t){super.addMesh(e,t),e.visible=!1,e.renderOrder=3}hoverOn(){this._dockline.visible=!0,$("pointer")}hoverOff(){this._dockline.visible=!1,$("default")}preparePreview(){super.preparePreview(),this._dockline.visible=!1;let e=this.lineTo.clone(),t=this.lineFrom.clone();const i=(new N).subVectors(e,t);let s=i.length(),n=i.normalize();this._createLineMesh(.01,s,this.lineSegments);const a=(new K).setFromUnitVectors(new N(0,1,0),n);this.lineMesh.quaternion.multiply(a),this.lineMesh.renderOrder=1;let o=(new N).addVectors(e,t).multiplyScalar(.5);this.lineMesh.position.copy((new N).subVectors(o,this.position.clone())),this.add(this.lineMesh);let r=this._boundingBox.getCenter(new N).applyEuler(this.docklineRotation),h=null,c=0,l=Math.abs(n.x),d=Math.abs(n.y),_=Math.abs(n.z);l>=d&&l>=_?(h=new N(r.x,0,0),c=Math.sqrt(r.y*r.y+r.z*r.z)):d>=l&&d>=_?(h=new N(0,r.y,0),c=Math.sqrt(r.x*r.x+r.z*r.z)):_>=d&&_>=l&&(h=new N(0,0,r.z),c=Math.sqrt(r.y*r.y+r.x*r.x)),c=c>0?c:.01;let m=(new N).subVectors(this.positionTo.clone(),this.positionFrom.clone()).length()+h.length();this._createBoundingLineMesh(1.1*c,m,this.lineSegments);let u=this.positionTo.clone(),p=this.positionFrom.clone(),g=(new N).subVectors(u,p).normalize();const v=(new K).setFromUnitVectors(new N(0,1,0),g);this.boundingLineMesh.quaternion.multiply(v),this.boundingLineMesh.renderOrder=3;let f=(new N).addVectors(this.positionTo.clone(),this.positionFrom.clone()).multiplyScalar(.5).add(r);this.boundingLineMesh.position.copy((new N).subVectors(f,this.position.clone())),this.add(this.boundingLineMesh)}_createLineMesh(e,t,i){this.lineMesh=this._createPreviewMesh(e,t,i,16,v.createMeshStandardMaterial({color:w,transparent:!0,opacity:P})),this.lineMesh.name="line mesh"}_createBoundingLineMesh(e,t,i){this.boundingLineMesh=this._createPreviewMesh(e,t,i,32,v.createMeshStandardMaterial({color:"#ffffff",transparent:!0,opacity:0})),this.boundingLineMesh.name="bounding line mesh",this.boundingLineMesh.userData.ignoreComponentRaycast=!0,this.boundingLineMesh.layers.set(5)}_createPreviewMesh(e,t,i,s,n){let a;if(0===i.length)a=new he(e,e,t,s,1);else{const n=[];for(const a of i){const i=a.to-a.from,o=(a.from+a.to)/2,r=new he(e,e,i,s,1);r.translate(0,o-t/2,0),n.push(r)}a=S(n,!1)}return new ee(a,n)}clonePreviewLine(t){let i=new a(this._creator_,this.runtimeId,this.roomlePosition,this.roomleRotation,this.parentObjectId,this.receivedPointAssociation);return i._stringId=this.runtimeId+"_"+t,this.children.forEach(e=>{e instanceof ee&&0===e.userData.meshType&&i.meshes.push(e.clone(!0))}),i.meshes.forEach(e=>{e.material=e.material.clone(),e.geometry=e.geometry.clone(),i.add(e)}),this._dockline&&(i._dockline=e.cloneDockLine(this._dockline,this._boundingBox)),this._boundingBoxMesh&&(i._boundingBoxMesh=this._boundingBoxMesh.clone(!0)),this._boundingBox&&(i._boundingBox=this._boundingBox.clone()),i}getPositionForIntersectionPoint(e){let t=this._boundingBox.getCenter(new N).applyEuler(this.docklineRotation),i=this.positionTo.clone().add(t),s=this.positionFrom.clone().add(t),n=new ce(s,i).closestPointToPoint(e,!0,new N);return(isNaN(n.x)||isNaN(n.y)||isNaN(n.z))&&n.copy(e),n.sub(t)}updatePreviewPosition(e){let t=this.getPositionForIntersectionPoint(e),i=this.parent.localToWorld(t);this._newPosition=this.worldToLocal(i);let s=this._boundingBox.getCenter(new N).applyEuler(this.docklineRotation);this._dockline.position.copy((new N).addVectors(this._newPosition,s)),this._dockline.rotation.copy(this.docklineRotation)}hideSelectionLine(){this._dockline.visible=!1}getKernelPosition(e){if(this._newPosition){let t=this.localToWorld(this._newPosition);return x(e.worldToLocal(t))}return super.getKernelPosition(e)}}class o extends le{constructor(e,t,i,s,n,a,o){super(e,t,i,s,n,a),o||(o={left:0,top:1,right:1,bottom:0}),this.offset=o}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}_calculateProjectionMatrix(){const e=this._calculate2DPlanes();if(this._offset.left>=this._offset.right||this._offset.bottom>this._offset.top)return(new de).makeOrthographic(e.left,e.right,e.top,e.bottom,this.near,this.far);const t=this._scaleRange(e.left,e.right,this._offset.left,this._offset.right);let i=t.from,s=t.to;const n=this._scaleRange(e.bottom,e.top,this._offset.bottom,this._offset.top);let a=n.from,o=n.to;const r=(e.right-e.left)/(e.top-e.bottom),h=(s-i)/(o-a);if(h>r){const e=(a+o)/2,t=(o-a)*h/r;a=e-t/2,o=e+t/2}else{const e=(i+s)/2,t=(s-i)*r/h;i=e-t/2,s=e+t/2}return(new de).makeOrthographic(i,s,o,a,this.near,this.far)}_scaleRange(e,t,i,s){const n=(t-e)/(s-i);return{from:e-n*i,to:t+n*(1-s)}}_calculate2DPlanes(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let n=i-e,a=i+e,o=s+t,r=s-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,o-=t*this.view.offsetY,r=o-t*this.view.height}return{left:n,right:a,top:o,bottom:r}}}class r extends H{constructor(e,t,i,s,n){super(e,t,i,s),n||(n={left:0,top:1,right:1,bottom:0}),this.offset=n}copy(e,t){return super.copy(e,t),this._offset=e._offset,this}set offset(e){this._offset=e,this.updateProjectionMatrix()}get offset(){return this._offset}resetOffset(){this._offset={left:0,top:1,right:1,bottom:0}}_calculateProjectionMatrix(){let e,t,i,s,n=this.fov*(2*Math.PI/360)/2;i=Math.tan(n),s=-i;let a=Math.atan(this.aspect*Math.tan(n));t=Math.tan(a),e=-t;let o=this._offset.left,r=this._offset.right,h=this._offset.top,c=this._offset.bottom,l=new G(r-o,h-c),d=new G(o+l.x/2,c+l.y/2);if(l.x<l.y){let n=(1-d.x)/(l.x/2),a=d.x/(l.x/2);t*=n,e*=a;let o=(n+a)/2;i*=o,s*=o}else{let n=(1-d.y)/(l.y/2),a=d.y/(l.y/2);i*=n,s*=a;let o=(a+n)/2;e*=o,t*=o}e*=this.near,t*=this.near,i*=this.near,s*=this.near;let _=this.near*Math.tan(Math.PI/180*.5*this.fov)/this.zoom*2,m=this.aspect*_;return this.view&&this.view.enabled&&(e+=this.view.offsetX*m/this.view.fullWidth,i-=this.view.offsetY*_/this.view.fullHeight,t+=this.view.offsetX*m/this.view.fullWidth,s-=this.view.offsetY*_/this.view.fullHeight),(new de).makePerspective(e,t,i,s,this.near,this.far)}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){this._offset?(this.projectionMatrix=this._calculateProjectionMatrix(),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()):super.updateProjectionMatrix()}}return{create:function(t,i,s,n,a){return new e(t,i,s,n,a)},createPreview:function(e,t,i){return new n(i,e,{x:0,y:0,z:0},{x:0,y:0,z:0},t,!1)},createStatic:function(e,i){return new t(e,i)},createPreviewLine:function(e,t){let i=new a(t,e.id,e.roomlePosition,e.roomleRotation,e.parentObjectId,e.receivedPointAssociation);return e.meshes.forEach(e=>{let t=e.clone();t.material=e.material.clone(),t.geometry=e.geometry.clone(),i.addMesh(t)}),i.computeBoundingBox(),i},isPreview:function(e){return e instanceof n},isPreviewLine:function(e){return e instanceof a},createPerspectiveCamera:function(e,t,i,s,n){return new r(e,t,i,s,n)},createOrthographicCamera:function(e,t,i,s,n,a,r){return new o(e,t,i,s,n,a,r)}}}class Xe{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class Je{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new te,this._plane.rotation.x=-Math.PI/2;const t=v.createMeshStandardMaterial({});this._innerPlaneMesh=new ee,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new ee,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new _e;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new _e;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new me;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new ue(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const o=new ue(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=a.attributes.uv.clone();a.setAttribute("uv2",r);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class Qe extends Xe{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new Je(100),this._fog=i||!1,this._textureLoader=new pe,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new N(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new ge(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new Q(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=ve,this._floorTexture.wrapT=ve,this._floorTexture.repeat.set(100/e,100/t));let i=v.createMeshStandardMaterial({map:this._floorTexture,side:fe});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=L(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(E(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=D();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}e("F",Qe),i([s],Qe.prototype,"_rapiAccess",void 0),i([s],Qe.prototype,"_dataSyncer",void 0);const $e=Math.PI/4;class et extends Ge{constructor(e,t,i,s){super(e,t,i),this._state=0,this._cameraRotation=new K,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new H,this._camera.fov=75,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i||this._camera.position.set(0,1.5,0),this._cameraPosition=new N,this._cameraPosition.copy(this._camera.position),this._pitch=0,this._yaw=0;let n=new Y(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}setUp(){super.setUp(),this._camera.fov=75,this._initInputListener()}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*$e*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*$e*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=o(t,s.position),a=I(i,s.quaternion);if(!t||n&&a)return!1;let r=this.getCamera().position.clone(),h=Math.min(10*e,1);r.lerp(t,h),this.getCamera().position.copy(r);let c=this.getCamera().quaternion.clone(),l=Math.min(5*e,1);c.slerp(i,l),this.getCamera().setRotationFromQuaternion(c);let d=!1;return this._keyMap.forEach(e=>{e&&(d=!0)}),d&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.1:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new G(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new G(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){k(this._downPosition,this._position)<B&&1===this._state&&(this._state=2,this._orbit(new G(this._position.x,this._position.y)),this._moveForward())}_update(e){var t;let i=new Y(-this._pitch,this._yaw,0,"ZYX");null===(t=this._cameraRotation)||void 0===t||t.setFromEuler(i)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix(),this._camera.near=.1,this._camera.far=100}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new N(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1.5*t),e.get(68)&&(i.x=1.5*t),e.get(37)&&(this._rotateHorizontal(-$e*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal($e*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new N(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1.5*i),(e.get(83)||e.get(40))&&(t.z=1.5*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new G(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),r(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){this._removeInputListener()}}e("e",et);class tt extends Xe{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}e("B",tt);class it{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,o=s.environment;if(!o)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(o.type){case"color":a=new Promise(t=>t(new tt(e,i,new Q(o.details.color))));break;case"image":a=new Promise(s=>s(new tt(e,i,null,t,o.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(o.details.material).then(s=>{let a=void 0===o.details.fog||o.details.fog,r=new Qe(e,i,a);r.changeFloorMaterial(s,n).then(()=>{t(r)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}i([s],it.prototype,"_rapiAccess",void 0);class st{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new te),this._cameraContainer}}e("L",st);class nt extends st{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new N;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(we).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new N;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=D();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof ye&&this._addSpotLightToGUI(e,t),t instanceof xe&&this._addAmbientLightToGUI(e,t),t instanceof be&&this._addDirectionalLightToGUI(e,t),t instanceof Me&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new Q(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new Q(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new Q(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new Q(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new N(0,0,0))})}}i([s],nt.prototype,"_dynamicLightSettingLoader",void 0);class at extends ee{constructor(e,t,i,s=128){if(t<=0||i<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const n=new Ce(i,2*s,s);n.scale(1,1,-1);const a=n.getAttribute("position"),o=new N;for(let e=0;e<a.count;++e)if(o.fromBufferAttribute(a,e),o.y<0){const i=3*-t/2,s=o.y<i?-t/o.y:1-o.y*o.y/(3*i*i);o.multiplyScalar(s),o.toArray(a.array,3*e)}a.needsUpdate=!0,super(n,new Pe({map:e,depthWrite:!1}))}}class ot extends Xe{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new at(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=D();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class rt{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new Se(2,1),s=null!=t?t:new Pe({color:12632256,side:fe}),n=new ee(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const o=n.map(e=>e.uv),r=a.map(e=>e.uv),h=e.filter(e=>!o.includes(e)&&!r.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(o,.01,255),this._createSamplePointsInMap(r,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(c,.015,16776960);let l=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<l.length&&(l=l.slice(0,s)),this._createCirclesInMap(l,8421376)}_createSamplePointsInMap(e,t,i){const s=new Le(t,8,4),n=new Pe({color:i});e.forEach(e=>{var t;const i=new ee(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new Pe({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new Le(e.size,8,4),n=new ee(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new Ee({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new G(t,e))),a.push(this._uvToMapPosition(new G(1-t,e)))}a.push(this._uvToMapPosition(n))}});const o=(new re).setFromPoints(a),r=new ie(o,n);r.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(r)}_uvToMapPosition(e){return new N(2*e.x-1,e.y-.5,0)}}class ht extends De{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new Ie({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new ke}},vertexShader:ct,fragmentShader:lt,blending:Be,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const ct="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",lt="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class dt{}class _t{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof dt?this.environmentSceneGenerator=e:e instanceof Re?this.cubeTexture=e:e instanceof ze&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new _t(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new G(e,0)}_createPmremTexture(e){const t=new ht(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new R;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new Te;const n=new z(!0,!1);n.setSourceTexture(t.environment),rt.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new rt(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class mt extends dt{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new ut({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class ut extends Te{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new ae,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new he(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new Q(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new G(s,n),3,1,.8,.2):this._createSideLight(e,new G(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new Q(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new G(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new G(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new G(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new Pe;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new ee(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,o){for(let r=0;r<3;r++){const h=s*this._sideLightIntensity,c=new ee(this._lightGeometry,this._createAreaLightMaterial((r+i)%3==0?h:h*(1-this._colorVariation),(r+i)%3==1?h:h*(1-this._colorVariation),(r+i)%3==2?h:h*(1-this._colorVariation))),l=(1===r?-t.y:2===r?t.y:0)/Math.sqrt(2),d=0===r?0:1,_=(1===r?t.x:2===r?-t.x:0)/Math.sqrt(2);c.position.set(t.x*o*15+1.1*l*n,15*a+1.1*d*n,t.y*o*15+1.1*_*n),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(n),e.add(c)}}_createReflector(e,t,i,s,n,a){const o=new ee(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));o.position.set(15*t.x,10*a,15*t.y),o.scale.set(10*s,10*n,10*s),e.add(o)}}class pt extends Ge{constructor(e,t,i,s){super(e,t,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new G,this._zoomPosition=new N,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),s?(this._camera=s,this._cameraPosition=(new N).copy(this._camera.position)):this._initCamera(i?new N(i.targetX,10,i.targetZ):new N(0,10,0)),this._lerpEnabled=!1}_getCamera(){return this._camera||this._initCamera(new N(0,10,0)),this._camera}_initCamera(e){let{x:t,y:i}=this._domHelper.getClientDimensions(),s=(t/i||1)*this._size,n=this._size;this._camera=new le(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(e),this._cameraPosition=e,this._camera.lookAt(new N(0,0,0))}updateCamera(){let e=this._domHelper.getAspectRatio()*this._size,t=this._size;this._camera.left=e/-2,this._camera.right=e/2,this._camera.top=t/2,this._camera.bottom=t/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:e=>{this._locked||(this._state=1,this._lastPosition.set(e.positionRelative.x,e.positionRelative.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:e=>{this._lastPosition.x===e.positionRelative.x&&this._lastPosition.y===e.positionRelative.y||1!==this._state||this._locked||(this._move(new G(e.positionRelative.x,e.positionRelative.y),e.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(3),this._scale/=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}}),this._inputListeners.push({key:8,fun:e=>{e.event&&(e.event.stopPropagation(),e.event.preventDefault()),this.dispatchEvent(4),this._scale*=this._zoomSpeed,this._zoomTo(e.positionRelative),this._update()}})}_zoomTo(e){if(Date.now()-this._lastZoom>200){let t=new N(e.x,e.y,0);t.unproject(this._camera),this._zoomPosition.copy(t)}this._lastZoom=Date.now()}_move(e,t){let i=new N,s=new N(this._lastPosition.x,this._lastPosition.y,0),n=new N(e.x,e.y,0);s.unproject(this._camera),n.unproject(this._camera),i.subVectors(n,s),this._cameraPosition.x-=i.x*(2===t?1.1:1),this._cameraPosition.z-=i.z*(2===t?1.1:1),this._lastPosition.copy(e)}zoomToFitBounds(e,t,i){if(h(e,this._boundingBox)<0&&!i)return void this.setBounds(e);this.setBounds(e);const s=e.getSize(new N),n=e.getCenter(new N),a=s.x/-2/this._camera.left,o=s.z/-2/this._camera.bottom,r=1/Math.max(a,o);(r<this._cameraZoom||t)&&(this._scale=r,this._cameraZoom=r,this._cameraPosition.x=n.x,this._cameraPosition.z=n.z)}_update(e,t,i){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.1);let s=(new N).subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=s.x,this._cameraPosition.z+=s.z,this._cameraZoom!==this._scale&&this.dispatchEvent(5,new Ze(.1===this._scale,5===this._scale)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(e){const t=Math.abs(this._cameraZoom-this._camera.zoom)>.01;if(this._lerpEnabled=t,!super.animateCamera(e)&&!t)return!1;this._lerpEnabled=!1;const i=Math.min(10*e,1);return this._camera.zoom=Oe.lerp(this._camera.zoom,this._cameraZoom,i),!0}getKernelZoomFactor(){const e=1e3*(this._camera.right-this._camera.left);return this._domHelper.element.clientWidth/e*this._camera.zoom}}e("d",pt);class gt{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new Pe({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new Ae,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(Fe(s),t),this._setupScene(t,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&this.cameraBehaviour.cameraControl instanceof et&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof et&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){this.cameraBehaviour.cameraControl instanceof We&&this.cameraBehaviour.cameraControl.updateDistanceAndRangesBasedOnBounds(this.getBounds())}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof nt&&this.cameraBehaviour.cameraControl.getCamera()instanceof H&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof We&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i,s;const{x:n,y:a}=this._domHelper.getClientDimensions();this._scene=new Te,this._uiScene=new Te,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new Ue({antialias:!this._globalInitData.e2e,alpha:!0});const o=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(o),this._renderer.setSize(n,a),this._renderer.outputColorSpace=je,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Ne,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new T(this._renderer,n,a,null!==(i=this._initData.linearAoFilter)&&void 0!==i&&i),this._initData.debug&&this._roomleRenderer.sceneRenderer.loadLutImages(O),this._roomleRenderer.setQualityMap(A),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(s=this._roomleRenderer)||void 0===s||s.setSize(n,a),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.hiddenEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.parameters.visibleEdgeColor=this._initData.colors.SELECTION.getHex(),this._roomleRenderer.sceneRenderer.outlineRenderer.applyParameters()),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new _t(new mt({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new _t(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof ot&&this._environment.updateEnvironmentTexture(i),t!==F||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{U(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,o).then(e=>{r(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,o,r){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,o,r).then(e=>{h(e.scene)},c)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=D(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=D();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){t.import("./stats-helper-1a0748a7.nomodule.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new it).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new nt(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new tt(this._scene,this._environment,new Q(e)))}setBackgroundImage(e){this._setEnvironment(new tt(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new nt(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const i=j.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=5;let i=this._domHelper.getAspectRatio()*t,s=t;const n=Ye();this._orthographicOffsetCamera=n.createOrthographicCamera(i/-2,i/2,s/2,s/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new N(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=Ye();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new N);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new N),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportCanvasScreenshot(e=1){return await this._waitForAssets(),new Promise(t=>{this._onAfterRender=()=>{const i=this._renderer.domElement.toDataURL(this._initData.transparentBackground?"image/png":"image/jpeg",e);t(i),this._onAfterRender=()=>{}},this._requestRender()})}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{this._onAfterRender=()=>{};const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:o,bottom:r}=this.getCameraOffset(),h=a-n,c=o-r;if(1===h&&1===c)return qe(e,s),void t();const l=new Image;l.src=s,l.onload=()=>{const{naturalWidth:i,naturalHeight:s}=l,a=document.createElement("canvas");a.width=i*h,a.height=s*c;const r=a.getContext("2d"),d=i*n*-1,_=s*(1-o)*-1;r.drawImage(l,d,_),r.save(),qe(e,a.toDataURL("image/jpeg",1)),t()},l.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_getCameraControl3D(e){return this._cameraControl3D?e&&this._cameraControl3D.setCurrentCameraParameters(e):this._cameraControl3D=new We(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera()),this._cameraControl3D}_getCameraControl2D(){return this._cameraControl2D||(this._cameraControl2D=new pt(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._cameraControl2D}_getCameraControlFirstPerson(){return this._cameraControlFirstPerson||(this._cameraControlFirstPerson=new et(this._creator_,this._getInputManager(),null,this.getPerspectiveOffsetCamera())),this._cameraControlFirstPerson}}e("S",gt),i([s],gt.prototype,"_domHelper",void 0),i([s],gt.prototype,"_scriptLoader",void 0),i([s],gt.prototype,"_lifeCycleManager",void 0),i([s],gt.prototype,"_staticItemLoader",void 0),i([s],gt.prototype,"_hdrEnvironmentLoader",void 0),i([s],gt.prototype,"_initData",void 0),i([s],gt.prototype,"_globalInitData",void 0),i([s],gt.prototype,"_globalCallback",void 0),i([s],gt.prototype,"_idbManager",void 0),i([s],gt.prototype,"_pluginSystem",void 0),i([s],gt.prototype,"_imageRenderer",void 0),i([s],gt.prototype,"_cameraBehaviourState",void 0),e("b",class{constructor(e,t){var i;return this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,(null===(i=window.__RML__DEBUG__)||void 0===i?void 0:i.camera)?He(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}})}}}));
|
|
2
|
+
//# sourceMappingURL=camera-behaviour-90408ba5.nomodule.js.map
|
package/lib/{camera-behaviour-3e3c8ef2.nomodule.js.map → camera-behaviour-90408ba5.nomodule.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-behaviour-
|
|
1
|
+
{"version":3,"file":"camera-behaviour-90408ba5.nomodule.js","sources":["../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr","../../packages/common-core/public/textures/env/default_1k.exr"],"sourcesContent":["export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from 'three';\n\n/**\n * A ground-projected skybox. The height is how far the camera that took the photo was above the ground -\n * a larger value will magnify the downward part of the image. By default the object is centered at the camera,\n * so it is often helpful to set skybox.position.y = height to put the ground at the origin. Set the radius\n * large enough to ensure your user's camera stays inside.\n */\n\nclass GroundedSkybox extends Mesh {\n\n\tconstructor( map, height, radius, resolution = 128 ) {\n\n\t\tif ( height <= 0 || radius <= 0 || resolution <= 0 ) {\n\n\t\t\tthrow new Error( 'GroundedSkybox height, radius, and resolution must be positive.' );\n\n\t\t}\n\n\t\tconst geometry = new SphereGeometry( radius, 2 * resolution, resolution );\n\t\tgeometry.scale( 1, 1, - 1 );\n\n\t\tconst pos = geometry.getAttribute( 'position' );\n\t\tconst tmp = new Vector3();\n\n\t\tfor ( let i = 0; i < pos.count; ++ i ) {\n\n\t\t\ttmp.fromBufferAttribute( pos, i );\n\t\t\tif ( tmp.y < 0 ) {\n\n\t\t\t\t// Smooth out the transition from flat floor to sphere:\n\t\t\t\tconst y1 = - height * 3 / 2;\n\t\t\t\tconst f =\n\t\t\t\t\t\ttmp.y < y1 ? - height / tmp.y : ( 1 - tmp.y * tmp.y / ( 3 * y1 * y1 ) );\n\t\t\t\ttmp.multiplyScalar( f );\n\t\t\t\ttmp.toArray( pos.array, 3 * i );\n\n\t\t\t}\n\n\t\t}\n\n\t\tpos.needsUpdate = true;\n\n\t\tsuper( geometry, new MeshBasicMaterial( { map, depthWrite: false } ) );\n\n\t}\n\n}\n\nexport { GroundedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\"","export default \"static/default_1k-2aa6d42244d30fb1.exr\""],"names":["exports","GroundedSkybox","Mesh","[object Object]","map","height","radius","resolution","Error","geometry","SphereGeometry","scale","pos","getAttribute","tmp","Vector3","i","count","fromBufferAttribute","y","y1","f","multiplyScalar","toArray","array","needsUpdate","super","MeshBasicMaterial","depthWrite"],"mappings":"mmCAAeA,EAAA,IAAA,gv9CCSf,MAAMC,WAAuBC,GAE5BC,YAAaC,EAAKC,EAAQC,EAAQC,EAAa,KAE9C,GAAKF,GAAU,GAAKC,GAAU,GAAKC,GAAc,EAEhD,MAAM,IAAIC,MAAO,mEAIlB,MAAMC,EAAW,IAAIC,GAAgBJ,EAAQ,EAAIC,EAAYA,GAC7DE,EAASE,MAAO,EAAG,GAAK,GAExB,MAAMC,EAAMH,EAASI,aAAc,YAC7BC,EAAM,IAAIC,EAEhB,IAAM,IAAIC,EAAI,EAAGA,EAAIJ,EAAIK,QAAUD,EAGlC,GADAF,EAAII,oBAAqBN,EAAKI,GACzBF,EAAIK,EAAI,EAAI,CAGhB,MAAMC,EAAgB,GAATf,EAAa,EACpBgB,EACJP,EAAIK,EAAIC,GAAOf,EAASS,EAAIK,EAAM,EAAIL,EAAIK,EAAIL,EAAIK,GAAM,EAAIC,EAAKA,GACnEN,EAAIQ,eAAgBD,GACpBP,EAAIS,QAASX,EAAIY,MAAO,EAAIR,GAM9BJ,EAAIa,aAAc,EAElBC,MAAOjB,EAAU,IAAIkB,GAAmB,CAAEvB,IAAAA,EAAKwB,YAAY,k7nBC3C9C,g6CCAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-dimensioning-
|
|
1
|
+
System.register(["./roomle-dependency-injection-22befdc7.nomodule.js","./main-thread-to-worker-ff3b0e7b.nomodule.js","./TextGeometry-a4cc5df3.nomodule.js"],(function(e){var i,t,n,s,o,h,a,d,l,_,r,g,m,c,w,p;return{setters:[function(e){i=e._,t=e.i},function(e){n=e.O,s=e.a,o=e.u,h=e.h,a=e.w,d=e.bo,l=e.B,_=e.G,r=e.z,g=e.b,m=e.Q,c=e.bQ,w=e.b9},function(e){p=e.T}],execute:function(){const u="component_dimensioning_line_material",x="component_dimensioning_plane_material",y="component_dimensioning_text_material";class v extends n{constructor(e,i,t,n){super(),this._center=i.getCenter(new s),this._size=i.getSize(new s),this._origin=this._center.clone().sub(this._size.clone().multiplyScalar(.5)),this._dimensioning=e,this._level=this._dimensioning.maxLevel-this._dimensioning.level,this._font=t,this._cameraPosition=n,this._init()}clone(){console.warn("Will not clone ComponentDimensioning")}_initMaterials(){this._cacheHolder.materialCache.has(u)?this._lineMaterial=this._cacheHolder.materialCache.get(u):(this._lineMaterial=new o({color:3618615}),this._cacheHolder.materialCache.set(u,this._lineMaterial)),this._cacheHolder.materialCache.has(x)?this._planeMaterial=this._cacheHolder.materialCache.get(x):(this._planeMaterial=new h({color:16777215,side:a,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(x,this._planeMaterial)),this._cacheHolder.materialCache.has(y)?this._textMaterial=this._cacheHolder.materialCache.get(y):(this._textMaterial=new d({color:3618615}),this._cacheHolder.materialCache.set(y,this._textMaterial))}_init(){this._initMaterials();let e=new l;this._line=new _(e,this._lineMaterial),this._line.name="component dimension line "+this._dimensioning.type.value,this._text=new r(e,this._textMaterial),this._text.name="component dimension text "+this._dimensioning.type.value,this._plane=new r(e,this._planeMaterial),this._plane.name="component dimension plane "+this._dimensioning.type.value;let i,t=new l,n=Math.round(Math.max(this._size.y,this._size.x,this._size.z)),o=Math.abs(this._dimensioning.to-this._dimensioning.from),h=.025+(n<4?0:.005*n);o<.3&&(h*=.5+o);let a={font:this._font,size:h,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001,depth:.001},d=this._dimensioning.label?this._dimensioning.label:this._unitFormatter.formatMMValueToUnitString(1e3*o),c=new p(d,a);c.computeBoundingBox();let w=c.boundingBox.getSize(new s).y;0===this._dimensioning.type.value&&(i=this._getXEdge(w),this._addXEdgeSideLines(w)),1===this._dimensioning.type.value&&(i=this._getYEdge(w),this._addYEdgeSideLines(w)),2===this._dimensioning.type.value&&(i=this._getZEdge(w),this._addZEdgeSideLines(w));let u=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];if(t.setAttribute("position",new g(new Float32Array(u),3)),this._line.geometry.dispose(),this._line.geometry=t,this.add(this._line),this._text.geometry=c,0===this._dimensioning.type.value&&this._addText(i,c,new m,new s(0,.04,0)),1===this._dimensioning.type.value){let e=new m,t=this._getXSign()>0?Math.PI/2:Math.PI/2*3;e.setFromAxisAngle(new s(0,0,1),t),this._addText(i,c,e,new s(.04,0,0))}if(2===this._dimensioning.type.value){let e=this._getXSign()>0?Math.PI/2:Math.PI/2*3,t=(new m).setFromAxisAngle(new s(-1,0,0),Math.PI/2),n=(new m).setFromAxisAngle(new s(0,0,1),e);this._addText(i,c,t.multiply(n),new s(.04,0,0))}}_getXEdge(e){let i=this._size.y+.05+(.06+e)*this._level;const t=new s(0,this._origin.y,this._origin.z);let n=t.clone().add(new s(this._dimensioning.from,i,0)),o=t.clone().add(new s(this._dimensioning.to,i,0));return new c(n,o)}_addXEdgeSideLines(e){let i=this._size.y+.05+(.06+e)*(this._level-.5),t=this._size.y+.05+(.06+e)*this._level;const n=new s(0,this._origin.y,this._origin.z);let o=n.clone().add(new s(this._dimensioning.from,i,0)),h=n.clone().add(new s(this._dimensioning.from,t,0)),a=n.clone().add(new s(this._dimensioning.to,i,0)),d=n.clone().add(new s(this._dimensioning.to,t,0));this._addLine(o,h),this._addLine(a,d)}_getZEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,this._origin.y,0);let n=t.clone().add(new s(i,0,this._dimensioning.from)),o=t.clone().add(new s(i,0,this._dimensioning.to));return new c(n,o)}_addZEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,this._origin.y,0);let h=o.clone().add(new s(t,0,this._dimensioning.from)),a=o.clone().add(new s(n,0,this._dimensioning.from)),d=o.clone().add(new s(t,0,this._dimensioning.to)),l=o.clone().add(new s(n,0,this._dimensioning.to));this._addLine(h,a),this._addLine(d,l)}_getYEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,0,this._origin.z);let n=t.clone().add(new s(i,this._dimensioning.from,0)),o=t.clone().add(new s(i,this._dimensioning.to,0));return new c(n,o)}_addYEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,0,this._origin.z);let h=o.clone().add(new s(t,this._dimensioning.from,0)),a=o.clone().add(new s(n,this._dimensioning.from,0)),d=o.clone().add(new s(t,this._dimensioning.to,0)),l=o.clone().add(new s(n,this._dimensioning.to,0));this._addLine(h,a),this._addLine(d,l)}_addLine(e,i){let t=new l,n=[e.x,e.y,e.z,i.x,i.y,i.z];t.setAttribute("position",new g(new Float32Array(n),3)),this.add(new _(t,this._lineMaterial))}_addText(e,i,t,n){let o=e.getCenter(new s);n.x*=this._getXSign(),o.add(n);let h=i.boundingBox.getSize(new s);i.center(),this._text.position.copy(o),this._text.quaternion.copy(t),this.add(this._text);let a=new w(h.x+.02,h.y+.02,32);a.center(),this._plane.geometry=a,this._plane.position.copy(o),this._plane.quaternion.copy(t),this.add(this._plane)}_getXSign(){return this._cameraPosition.x>=0?1:-1}}e("default",v),i([t],v.prototype,"_cacheHolder",void 0),i([t],v.prototype,"_unitFormatter",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=component-dimensioning-a5e291d6.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dimensioning-a5e291d6.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-dimensioning-
|
|
1
|
+
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-8fd89dfe.js";import{O as Object3D,a as Vector3,u as LineBasicMaterial,h as MeshBasicMaterial,w as DoubleSide,bo as MeshPhongMaterial,B as BufferGeometry,G as Line,z as Mesh,b as BufferAttribute,Q as Quaternion,bQ as Line3,b9 as PlaneGeometry}from"./main-thread-to-worker-4e303a39.js";import{T as TextGeometry}from"./TextGeometry-086a9652.js";const LINE_MATERIAL="component_dimensioning_line_material",PLANE_MATERIAL="component_dimensioning_plane_material",TEXT_MATERIAL="component_dimensioning_text_material";class ComponentDimensioning extends Object3D{constructor(e,i,t,n){super(),this._center=i.getCenter(new Vector3),this._size=i.getSize(new Vector3),this._origin=this._center.clone().sub(this._size.clone().multiplyScalar(.5)),this._dimensioning=e,this._level=this._dimensioning.maxLevel-this._dimensioning.level,this._font=t,this._cameraPosition=n,this._init()}clone(){console.warn("Will not clone ComponentDimensioning")}_initMaterials(){this._cacheHolder.materialCache.has(LINE_MATERIAL)?this._lineMaterial=this._cacheHolder.materialCache.get(LINE_MATERIAL):(this._lineMaterial=new LineBasicMaterial({color:3618615}),this._cacheHolder.materialCache.set(LINE_MATERIAL,this._lineMaterial)),this._cacheHolder.materialCache.has(PLANE_MATERIAL)?this._planeMaterial=this._cacheHolder.materialCache.get(PLANE_MATERIAL):(this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(PLANE_MATERIAL,this._planeMaterial)),this._cacheHolder.materialCache.has(TEXT_MATERIAL)?this._textMaterial=this._cacheHolder.materialCache.get(TEXT_MATERIAL):(this._textMaterial=new MeshPhongMaterial({color:3618615}),this._cacheHolder.materialCache.set(TEXT_MATERIAL,this._textMaterial))}_init(){this._initMaterials();let e=new BufferGeometry;this._line=new Line(e,this._lineMaterial),this._line.name="component dimension line "+this._dimensioning.type.value,this._text=new Mesh(e,this._textMaterial),this._text.name="component dimension text "+this._dimensioning.type.value,this._plane=new Mesh(e,this._planeMaterial),this._plane.name="component dimension plane "+this._dimensioning.type.value;let i,t=new BufferGeometry,n=Math.round(Math.max(this._size.y,this._size.x,this._size.z)),s=Math.abs(this._dimensioning.to-this._dimensioning.from),o=.025+(n<4?0:.005*n);s<.3&&(o*=.5+s);let a={font:this._font,size:o,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001,depth:.001},h=this._dimensioning.label?this._dimensioning.label:this._unitFormatter.formatMMValueToUnitString(1e3*s),r=new TextGeometry(h,a);r.computeBoundingBox();let _=r.boundingBox.getSize(new Vector3).y;0===this._dimensioning.type.value&&(i=this._getXEdge(_),this._addXEdgeSideLines(_)),1===this._dimensioning.type.value&&(i=this._getYEdge(_),this._addYEdgeSideLines(_)),2===this._dimensioning.type.value&&(i=this._getZEdge(_),this._addZEdgeSideLines(_));let l=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];if(t.setAttribute("position",new BufferAttribute(new Float32Array(l),3)),this._line.geometry.dispose(),this._line.geometry=t,this.add(this._line),this._text.geometry=r,0===this._dimensioning.type.value&&this._addText(i,r,new Quaternion,new Vector3(0,.04,0)),1===this._dimensioning.type.value){let e=new Quaternion,t=this._getXSign()>0?Math.PI/2:Math.PI/2*3;e.setFromAxisAngle(new Vector3(0,0,1),t),this._addText(i,r,e,new Vector3(.04,0,0))}if(2===this._dimensioning.type.value){let e=this._getXSign()>0?Math.PI/2:Math.PI/2*3,t=(new Quaternion).setFromAxisAngle(new Vector3(-1,0,0),Math.PI/2),n=(new Quaternion).setFromAxisAngle(new Vector3(0,0,1),e);this._addText(i,r,t.multiply(n),new Vector3(.04,0,0))}}_getXEdge(e){let i=this._size.y+.05+(.06+e)*this._level;const t=new Vector3(0,this._origin.y,this._origin.z);let n=t.clone().add(new Vector3(this._dimensioning.from,i,0)),s=t.clone().add(new Vector3(this._dimensioning.to,i,0));return new Line3(n,s)}_addXEdgeSideLines(e){let i=this._size.y+.05+(.06+e)*(this._level-.5),t=this._size.y+.05+(.06+e)*this._level;const n=new Vector3(0,this._origin.y,this._origin.z);let s=n.clone().add(new Vector3(this._dimensioning.from,i,0)),o=n.clone().add(new Vector3(this._dimensioning.from,t,0)),a=n.clone().add(new Vector3(this._dimensioning.to,i,0)),h=n.clone().add(new Vector3(this._dimensioning.to,t,0));this._addLine(s,o),this._addLine(a,h)}_getZEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new Vector3(this._origin.x,this._origin.y,0);let n=t.clone().add(new Vector3(i,0,this._dimensioning.from)),s=t.clone().add(new Vector3(i,0,this._dimensioning.to));return new Line3(n,s)}_addZEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const s=new Vector3(this._origin.x,this._origin.y,0);let o=s.clone().add(new Vector3(t,0,this._dimensioning.from)),a=s.clone().add(new Vector3(n,0,this._dimensioning.from)),h=s.clone().add(new Vector3(t,0,this._dimensioning.to)),r=s.clone().add(new Vector3(n,0,this._dimensioning.to));this._addLine(o,a),this._addLine(h,r)}_getYEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new Vector3(this._origin.x,0,this._origin.z);let n=t.clone().add(new Vector3(i,this._dimensioning.from,0)),s=t.clone().add(new Vector3(i,this._dimensioning.to,0));return new Line3(n,s)}_addYEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const s=new Vector3(this._origin.x,0,this._origin.z);let o=s.clone().add(new Vector3(t,this._dimensioning.from,0)),a=s.clone().add(new Vector3(n,this._dimensioning.from,0)),h=s.clone().add(new Vector3(t,this._dimensioning.to,0)),r=s.clone().add(new Vector3(n,this._dimensioning.to,0));this._addLine(o,a),this._addLine(h,r)}_addLine(e,i){let t=new BufferGeometry,n=[e.x,e.y,e.z,i.x,i.y,i.z];t.setAttribute("position",new BufferAttribute(new Float32Array(n),3)),this.add(new Line(t,this._lineMaterial))}_addText(e,i,t,n){let s=e.getCenter(new Vector3);n.x*=this._getXSign(),s.add(n);let o=i.boundingBox.getSize(new Vector3);i.center(),this._text.position.copy(s),this._text.quaternion.copy(t),this.add(this._text);let a=new PlaneGeometry(o.x+.02,o.y+.02,32);a.center(),this._plane.geometry=a,this._plane.position.copy(s),this._plane.quaternion.copy(t),this.add(this._plane)}_getXSign(){return this._cameraPosition.x>=0?1:-1}}__decorate([inject],ComponentDimensioning.prototype,"_cacheHolder",void 0),__decorate([inject],ComponentDimensioning.prototype,"_unitFormatter",void 0);export{ComponentDimensioning as default};
|
|
2
|
+
//# sourceMappingURL=component-dimensioning-ca877f31.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dimensioning-ca877f31.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|