From 292300c82e058a98ead658898f4480117463472e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 24 Aug 2024 13:52:11 +0200 Subject: [PATCH 01/51] feat(core): improve configurable behavior --- packages/core/package.json | 2 +- .../core/src/core/Types/src/base-scene.ts | 14 +- .../src/core/Types/src/component-with-ui.ts | 13 ++ .../core/src/core/Types/src/config-manager.ts | 60 +++++++ packages/core/src/core/Types/src/index.ts | 2 + .../core/src/core/Types/src/interfaces.ts | 9 +- .../core/Worlds/src/simple-scene-config.ts | 167 ++++++++++++++++++ .../core/src/core/Worlds/src/simple-scene.ts | 86 ++++----- packages/front/package.json | 2 +- 9 files changed, 303 insertions(+), 52 deletions(-) create mode 100644 packages/core/src/core/Types/src/component-with-ui.ts create mode 100644 packages/core/src/core/Types/src/config-manager.ts create mode 100644 packages/core/src/core/Worlds/src/simple-scene-config.ts diff --git a/packages/core/package.json b/packages/core/package.json index 6e382b1d4..3d0deff01 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.2.5", + "version": "2.3.0-alpha.1", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/core/src/core/Types/src/base-scene.ts b/packages/core/src/core/Types/src/base-scene.ts index 6ccefe705..808e39536 100644 --- a/packages/core/src/core/Types/src/base-scene.ts +++ b/packages/core/src/core/Types/src/base-scene.ts @@ -37,17 +37,25 @@ export abstract class BaseScene extends BaseWorldItem implements Disposable { disposer.destroy(mesh); } } + + this.deleteAllLights(); + + this.three.children = []; + this.onDisposed.trigger(); + this.onDisposed.reset(); + } + + deleteAllLights() { for (const [, light] of this.directionalLights) { light.removeFromParent(); light.target.removeFromParent(); light.dispose(); } + this.directionalLights.clear(); for (const [, light] of this.ambientLights) { light.removeFromParent(); light.dispose(); } - this.three.children = []; - this.onDisposed.trigger(); - this.onDisposed.reset(); + this.ambientLights.clear(); } } diff --git a/packages/core/src/core/Types/src/component-with-ui.ts b/packages/core/src/core/Types/src/component-with-ui.ts new file mode 100644 index 000000000..8c9d7911c --- /dev/null +++ b/packages/core/src/core/Types/src/component-with-ui.ts @@ -0,0 +1,13 @@ +import { Component } from "./component"; + +export type ComponentUIElement = { + name: string; + componentID: string; + attributes: { [name: string]: string }; + get: () => HTMLElement; +}; + +export abstract class ComponentWithUI extends Component { + abstract name: string; + abstract getUI(): ComponentUIElement[]; +} diff --git a/packages/core/src/core/Types/src/config-manager.ts b/packages/core/src/core/Types/src/config-manager.ts new file mode 100644 index 000000000..4bb70c9f4 --- /dev/null +++ b/packages/core/src/core/Types/src/config-manager.ts @@ -0,0 +1,60 @@ +export interface BooleanSettingsControl { + type: "Boolean"; + value: boolean; +} + +export interface ColorSettingsControl { + type: "Color"; + opacity: number; + value: number; +} + +export interface TextSettingsControl { + type: "Text"; + value: string; +} + +export interface NumberSettingControl { + type: "Number"; + interpolable: boolean; + min?: number; + max?: number; + value: number; +} + +export interface SelectSettingControl { + type: "Select"; + options?: string[]; + value: string; +} + +export interface VectorSettingControl { + type: "Vector"; + value: number[]; +} + +type ControlEntry = + | BooleanSettingsControl + | ColorSettingsControl + | TextSettingsControl + | NumberSettingControl + | SelectSettingControl + | VectorSettingControl; + +interface ControlsSchema { + [name: string]: ControlEntry | ControlsSchema; +} + +export abstract class ConfigManager { + protected abstract _list: U; + + protected _component: T; + + get controls() { + return JSON.parse(JSON.stringify(this._list)); + } + + constructor(component: T) { + this._component = component; + } +} diff --git a/packages/core/src/core/Types/src/index.ts b/packages/core/src/core/Types/src/index.ts index 59e7cda6b..7d667d1bf 100644 --- a/packages/core/src/core/Types/src/index.ts +++ b/packages/core/src/core/Types/src/index.ts @@ -10,3 +10,5 @@ export * from "./base-scene"; export * from "./world"; export * from "./data-set"; export * from "./data-map"; +export * from "./component-with-ui"; +export * from "./config-manager"; diff --git a/packages/core/src/core/Types/src/interfaces.ts b/packages/core/src/core/Types/src/interfaces.ts index 1a2070010..a1500576d 100644 --- a/packages/core/src/core/Types/src/interfaces.ts +++ b/packages/core/src/core/Types/src/interfaces.ts @@ -100,18 +100,17 @@ export interface Createable { /** * Whether this component supports to be configured. */ -export interface Configurable> { +export interface Configurable { /** Wether this components has been already configured. */ isSetup: boolean; - /** Use the provided configuration to setup the tool. */ - setup: (config?: Partial) => void | Promise; + /** Use the provided configuration to set up the tool. */ + setup: (config?: Partial) => void | Promise; /** Fired after successfully calling {@link Configurable.setup()} */ readonly onSetup: Event; - /** Object holding the tool configuration. Is not meant to be edited directly, if you need - * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated. + /** Object holding the tool configuration. You can edit this directly to change the object. */ config: Required; } diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts new file mode 100644 index 000000000..4dbb11376 --- /dev/null +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -0,0 +1,167 @@ +// eslint-disable-next-line max-classes-per-file +import * as THREE from "three"; +import { SimpleScene } from "./simple-scene"; +import { + ColorSettingsControl, + ConfigManager, + NumberSettingControl, + VectorSettingControl, +} from "../../Types"; + +type SimpleSceneConfigType = { + backgroundColor: ColorSettingsControl; + ambientLight: { + color: ColorSettingsControl; + intensity: NumberSettingControl; + }; + directionalLight: { + color: ColorSettingsControl; + intensity: NumberSettingControl; + position: VectorSettingControl; + }; +}; + +class DirectionalLightConfig { + private _list: SimpleSceneConfigType; + private _scene: SimpleScene; + + constructor(list: SimpleSceneConfigType, scene: SimpleScene) { + this._list = list; + this._scene = scene; + } + + get color() { + return this._list.directionalLight.color.value; + } + + set color(value: number) { + this._list.directionalLight.color.value = value; + for (const [, light] of this._scene.directionalLights) { + light.color = new THREE.Color(value); + } + } + + get intensity() { + return this._list.directionalLight.intensity.value; + } + + set intensity(value: number) { + this._list.directionalLight.intensity.value = value; + for (const [, light] of this._scene.directionalLights) { + light.intensity = value; + } + } + + get position() { + return this._list.directionalLight.position.value; + } + + set position(value: number[]) { + this._list.directionalLight.position.value = value; + const [x, y, z] = value; + for (const [, light] of this._scene.directionalLights) { + light.position.set(x, y, z); + } + } +} + +class AmbientLightConfig { + private _list: SimpleSceneConfigType; + private _scene: SimpleScene; + + constructor(list: SimpleSceneConfigType, scene: SimpleScene) { + this._list = list; + this._scene = scene; + } + + get color() { + return this._list.ambientLight.color.value; + } + + set color(value: number) { + this._list.ambientLight.color.value = value; + for (const [, light] of this._scene.ambientLights) { + light.color = new THREE.Color(value); + } + } + + get intensity() { + return this._list.ambientLight.intensity.value; + } + + set intensity(value: number) { + this._list.ambientLight.intensity.value = value; + for (const [, light] of this._scene.ambientLights) { + light.intensity = value; + } + } +} + +/** + * Configuration interface for the {@link SimpleScene}. + */ +export interface SimpleSceneConfig { + directionalLight: { + color: THREE.Color; + intensity: number; + position: THREE.Vector3; + }; + ambientLight: { + color: THREE.Color; + intensity: number; + }; +} + +export class SimpleSceneConfigManager extends ConfigManager< + SimpleScene, + SimpleSceneConfigType +> { + protected _list = { + backgroundColor: { + value: 0, + opacity: 1, + type: "Color" as const, + }, + ambientLight: { + color: { + type: "Color" as const, + opacity: 1, + value: 1, + }, + intensity: { + type: "Number" as const, + interpolable: false, + value: 2, + }, + }, + directionalLight: { + color: { + type: "Color" as const, + opacity: 1, + value: 1, + }, + intensity: { + type: "Number" as const, + interpolable: false, + value: 2, + }, + position: { + type: "Vector" as const, + value: [], + }, + }, + }; + + ambientLight = new AmbientLightConfig(this._list, this._component); + + directionalLight = new DirectionalLightConfig(this._list, this._component); + + get backgroundColor() { + return this._list.backgroundColor.value; + } + + set backgroundColor(value: number) { + this._list.backgroundColor.value = value; + this._component.three.background = new THREE.Color(value); + } +} diff --git a/packages/core/src/core/Worlds/src/simple-scene.ts b/packages/core/src/core/Worlds/src/simple-scene.ts index 08d9831f3..f8d7c3b67 100644 --- a/packages/core/src/core/Worlds/src/simple-scene.ts +++ b/packages/core/src/core/Worlds/src/simple-scene.ts @@ -1,26 +1,18 @@ import * as THREE from "three"; import { BaseScene, Configurable, Event } from "../../Types"; import { Components } from "../../Components"; - -/** - * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights. - */ -export interface SimpleSceneConfig { - directionalLight: { - color: THREE.Color; - intensity: number; - position: THREE.Vector3; - }; - ambientLight: { - color: THREE.Color; - intensity: number; - }; -} +import { + SimpleSceneConfig, + SimpleSceneConfigManager, +} from "./simple-scene-config"; /** * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it. */ -export class SimpleScene extends BaseScene implements Configurable<{}> { +export class SimpleScene + extends BaseScene + implements Configurable +{ /** {@link Configurable.isSetup} */ isSetup = false; @@ -33,21 +25,8 @@ export class SimpleScene extends BaseScene implements Configurable<{}> { /** {@link Configurable.onSetup} */ readonly onSetup = new Event(); - /** - * Configuration interface for the {@link SimpleScene}. - * Defines properties for directional and ambient lights. - */ - config: Required = { - directionalLight: { - color: new THREE.Color("white"), - intensity: 1.5, - position: new THREE.Vector3(5, 10, 3), - }, - ambientLight: { - color: new THREE.Color("white"), - intensity: 1, - }, - }; + /** {@link Configurable.config} */ + config = new SimpleSceneConfigManager(this); constructor(components: Components) { super(components); @@ -57,24 +36,47 @@ export class SimpleScene extends BaseScene implements Configurable<{}> { /** {@link Configurable.setup} */ setup(config?: Partial) { - this.config = { ...this.config, ...config }; + const defaultConfig = { + backgroundColor: new THREE.Color(0x202932), + directionalLight: { + color: new THREE.Color("white"), + intensity: 1.5, + position: new THREE.Vector3(5, 10, 3), + }, + ambientLight: { + color: new THREE.Color("white"), + intensity: 1, + }, + }; + + const fullConfig = { ...defaultConfig, ...config }; + + this.config.backgroundColor = fullConfig.backgroundColor.getHex(); + + const ambLight = fullConfig.ambientLight; + this.config.ambientLight.color = ambLight.color.getHex(); + this.config.ambientLight.intensity = ambLight.intensity; + + const dirLight = fullConfig.directionalLight; + this.config.directionalLight.color = dirLight.color.getHex(); + this.config.directionalLight.intensity = dirLight.intensity; + const { x, y, z } = dirLight.position; + this.config.directionalLight.position = [x, y, z]; + + this.deleteAllLights(); - const directionalLight = new THREE.DirectionalLight( - this.config.directionalLight.color, - this.config.directionalLight.intensity, - ); - directionalLight.position.copy(this.config.directionalLight.position); + const { color: dc, intensity: di } = this.config.directionalLight; + const directionalLight = new THREE.DirectionalLight(dc, di); + directionalLight.position.set(x, y, z); - const ambientLight = new THREE.AmbientLight( - this.config.ambientLight.color, - this.config.ambientLight.intensity, - ); + const { color: ac, intensity: ai } = this.config.directionalLight; + const ambientLight = new THREE.AmbientLight(ac, ai); this.three.add(directionalLight, ambientLight); this.directionalLights.set(directionalLight.uuid, directionalLight); this.ambientLights.set(ambientLight.uuid, ambientLight); this.isSetup = true; - this.onSetup.trigger(this); + this.onSetup.trigger(); } } diff --git a/packages/front/package.json b/packages/front/package.json index 1742173ac..4ad2f2999 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.2.1", + "version": "2.3.0-alpha.1", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", From 2beaffe6b87af38f6f1766fa39ab2aced01c7ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 24 Aug 2024 15:39:26 +0200 Subject: [PATCH 02/51] fix(chore): fix type problems --- index.html | 21 -- packages/core/src/core/ShadowedScene/index.ts | 52 ++-- packages/core/src/core/Types/src/base.ts | 2 +- .../core/src/core/Types/src/config-manager.ts | 25 +- packages/core/src/core/Viewpoints/index.ts | 26 +- .../core/src/core/Viewpoints/src/index.ts | 2 +- .../src/{Viewpoint.ts => viewpoint.ts} | 0 .../core/Viewpoints/src/viewpoints-config.ts | 39 +++ packages/core/src/core/Worlds/example.ts | 28 +- packages/core/src/core/Worlds/src/index.ts | 1 + .../core/Worlds/src/simple-scene-config.ts | 32 +- .../core/src/core/Worlds/src/simple-scene.ts | 47 ++- packages/core/src/openbim/BCFTopics/index.ts | 40 ++- .../BCFTopics/src/bcf-topics-config.ts | 288 ++++++++++++++++++ .../core/src/openbim/BCFTopics/src/index.ts | 1 + .../core/src/openbim/BCFTopics/src/types.ts | 86 ------ ...s.timestamp-1724501893414-c367789247f8.mjs | 68 +++++ 17 files changed, 538 insertions(+), 220 deletions(-) rename packages/core/src/core/Viewpoints/src/{Viewpoint.ts => viewpoint.ts} (100%) create mode 100644 packages/core/src/core/Viewpoints/src/viewpoints-config.ts create mode 100644 packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts create mode 100644 packages/core/vite.config.ts.timestamp-1724501893414-c367789247f8.mjs diff --git a/index.html b/index.html index 324788769..e6dd6c9e3 100644 --- a/index.html +++ b/index.html @@ -63,27 +63,6 @@

Choose an example

core/Grids core/Cullers core/Clipper -core/BCFTopics -core/MeasurementUtils -core/IfcRelationsIndexer -core/IfcPropertiesManager -core/IfcJsonExporter -core/IfcPropertiesTiler -core/IfcLoader -core/IfcGeometryTiler -core/Hider -core/FragmentsManager -core/Exploder -core/Classifier -core/BoundingBoxer -core/Worlds -core/ShadowedScene -core/Raycasters -core/OrthoPerspectiveCamera -core/MiniMap -core/Grids -core/Cullers -core/Clipper diff --git a/packages/core/src/core/ShadowedScene/index.ts b/packages/core/src/core/ShadowedScene/index.ts index 74a995b30..f89ee8e04 100644 --- a/packages/core/src/core/ShadowedScene/index.ts +++ b/packages/core/src/core/ShadowedScene/index.ts @@ -1,7 +1,11 @@ import * as THREE from "three"; -import { SimpleScene, SimpleSceneConfig } from "../Worlds"; +import { + SimpleScene, + SimpleSceneConfig, + SimpleSceneConfigManager, +} from "../Worlds"; import { DistanceRenderer } from "./src"; -import { Disposable } from "../Types"; +import { Configurable, Disposable } from "../Types"; /** * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights, @@ -23,7 +27,12 @@ export interface ShadowedSceneConfig extends SimpleSceneConfig { /** * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene). */ -export class ShadowedScene extends SimpleScene implements Disposable { +export class ShadowedScene + extends SimpleScene + implements + Disposable, + Configurable +{ private _distanceRenderer?: DistanceRenderer; /** @@ -31,24 +40,9 @@ export class ShadowedScene extends SimpleScene implements Disposable { */ autoBias = true; - /** - * Configuration interface for the {@link ShadowedScene}. - * Defines properties for directional and ambient lights, as well as shadows. - */ - config: Required = { - directionalLight: { - color: new THREE.Color("white"), - intensity: 1.5, - position: new THREE.Vector3(5, 10, 3), - }, - ambientLight: { - color: new THREE.Color("white"), - intensity: 1, - }, - shadows: { - cascade: 1, - resolution: 512, - }, + protected _defaultShadowConfig = { + cascade: 1, + resolution: 512, }; private _lightsWithShadow = new Map(); @@ -112,15 +106,19 @@ export class ShadowedScene extends SimpleScene implements Disposable { setup(config?: Partial) { super.setup(config); - this.config = { ...this.config, ...config }; + const fullConfig = { + ...this._defaultConfig, + ...this._defaultShadowConfig, + ...config, + }; - if (this.config.shadows.cascade <= 0) { + if (fullConfig.cascade <= 0) { throw new Error( "Config.shadows.cascade must be a natural number greater than 0!", ); } - if (this.config.shadows.cascade > 1) { + if (fullConfig.cascade > 1) { throw new Error("Multiple shadows not supported yet!"); } @@ -149,13 +147,13 @@ export class ShadowedScene extends SimpleScene implements Disposable { this._lightsWithShadow.clear(); // Create a light per shadow map - for (let i = 0; i < this.config.shadows.cascade; i++) { + for (let i = 0; i < fullConfig.cascade; i++) { const light = new THREE.DirectionalLight(); light.intensity = this.config.directionalLight.intensity; light.color = this.config.directionalLight.color; light.position.copy(this.config.directionalLight.position); - light.shadow.mapSize.width = this.config.shadows.resolution; - light.shadow.mapSize.height = this.config.shadows.resolution; + light.shadow.mapSize.width = fullConfig.resolution; + light.shadow.mapSize.height = fullConfig.resolution; this.three.add(light, light.target); this.directionalLights.set(light.uuid, light); this._lightsWithShadow.set(i, light.uuid); diff --git a/packages/core/src/core/Types/src/base.ts b/packages/core/src/core/Types/src/base.ts index a6f2abc04..e83fb78a7 100644 --- a/packages/core/src/core/Types/src/base.ts +++ b/packages/core/src/core/Types/src/base.ts @@ -36,7 +36,7 @@ export abstract class Base { }; /** Whether is component is {@link Configurable}. */ - isConfigurable = (): this is Configurable => { + isConfigurable = (): this is Configurable => { return "setup" in this && "config" in this && "onSetup" in this; }; } diff --git a/packages/core/src/core/Types/src/config-manager.ts b/packages/core/src/core/Types/src/config-manager.ts index 4bb70c9f4..0ae750c25 100644 --- a/packages/core/src/core/Types/src/config-manager.ts +++ b/packages/core/src/core/Types/src/config-manager.ts @@ -1,3 +1,5 @@ +import * as THREE from "three"; + export interface BooleanSettingsControl { type: "Boolean"; value: boolean; @@ -6,7 +8,7 @@ export interface BooleanSettingsControl { export interface ColorSettingsControl { type: "Color"; opacity: number; - value: number; + value: THREE.Color; } export interface TextSettingsControl { @@ -24,13 +26,24 @@ export interface NumberSettingControl { export interface SelectSettingControl { type: "Select"; - options?: string[]; + options: Set; value: string; } -export interface VectorSettingControl { +export interface MultiSelectSettingControl { + type: "MultiSelect"; + options: Set; + value: Set; +} + +export interface Vector3SettingControl { type: "Vector"; - value: number[]; + value: THREE.Vector3; +} + +export interface TextSetSettingControl { + type: "TextSet"; + value: Set; } type ControlEntry = @@ -39,7 +52,9 @@ type ControlEntry = | TextSettingsControl | NumberSettingControl | SelectSettingControl - | VectorSettingControl; + | Vector3SettingControl + | TextSetSettingControl + | MultiSelectSettingControl; interface ControlsSchema { [name: string]: ControlEntry | ControlsSchema; diff --git a/packages/core/src/core/Viewpoints/index.ts b/packages/core/src/core/Viewpoints/index.ts index 0942a8667..0ea987dc0 100644 --- a/packages/core/src/core/Viewpoints/index.ts +++ b/packages/core/src/core/Viewpoints/index.ts @@ -8,24 +8,19 @@ import { } from "../Types"; import { Components } from "../Components"; import { BCFViewpoint, Viewpoint } from "./src"; +import { + ViewpointsConfigManger, + ViewpointsConfig, +} from "./src/viewpoints-config"; -/** - * Configuration interface for the Viewpoints general behavior. - */ -interface ViewpointsConfig { - /** - * Indicates whether to overwrite the fragments colors when applying viewpoints. - * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any. - * @default false - */ - overwriteColors: boolean; -} +export * from "./src"; export class Viewpoints extends Component - implements Disposable, Configurable + implements Disposable, Configurable { static readonly uuid = "ee867824-a796-408d-8aa0-4e5962a83c66" as const; + enabled = true; /** @@ -54,9 +49,12 @@ export class Viewpoints } isSetup = false; + setup() {} + onSetup = new Event(); - config: Required = { overwriteColors: false }; + + config = new ViewpointsConfigManger(this); readonly onDisposed = new Event(); @@ -73,5 +71,3 @@ export class Viewpoints this.onDisposed.reset(); } } - -export * from "./src"; diff --git a/packages/core/src/core/Viewpoints/src/index.ts b/packages/core/src/core/Viewpoints/src/index.ts index 415d33534..c86622741 100644 --- a/packages/core/src/core/Viewpoints/src/index.ts +++ b/packages/core/src/core/Viewpoints/src/index.ts @@ -1,2 +1,2 @@ export * from "./types"; -export * from "./Viewpoint"; +export * from "./viewpoint"; diff --git a/packages/core/src/core/Viewpoints/src/Viewpoint.ts b/packages/core/src/core/Viewpoints/src/viewpoint.ts similarity index 100% rename from packages/core/src/core/Viewpoints/src/Viewpoint.ts rename to packages/core/src/core/Viewpoints/src/viewpoint.ts diff --git a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts new file mode 100644 index 000000000..b1b4ef9f4 --- /dev/null +++ b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts @@ -0,0 +1,39 @@ +import { BooleanSettingsControl, ConfigManager } from "../../Types"; +import { Viewpoints } from "../index"; + +/** + * Configuration interface for the Viewpoints general behavior. + */ +export interface ViewpointsConfig { + /** + * Indicates whether to overwrite the fragments colors when applying viewpoints. + * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any. + * @default false + */ + overwriteColors: boolean; +} + +type ViewpointsConfigType = { + overwriteColors: BooleanSettingsControl; +}; + +export class ViewpointsConfigManger extends ConfigManager< + Viewpoints, + ViewpointsConfigType +> { + protected _list = { + overwriteColors: { + value: false, + opacity: 1, + type: "Boolean" as const, + }, + }; + + get overwriteColors() { + return this._list.overwriteColors.value; + } + + set overwriteColors(value: boolean) { + this._list.overwriteColors.value = value; + } +} diff --git a/packages/core/src/core/Worlds/example.ts b/packages/core/src/core/Worlds/example.ts index 3ffa86419..af464be42 100644 --- a/packages/core/src/core/Worlds/example.ts +++ b/packages/core/src/core/Worlds/example.ts @@ -22,8 +22,8 @@ In this tutorial, we will import: import * as THREE from "three"; import * as BUI from "@thatopen/ui"; -import * as OBC from "@thatopen/components"; import Stats from "stats.js"; +import * as OBC from "../.."; /* MD ### 🖼️ Getting the container @@ -84,6 +84,12 @@ world.camera = new OBC.SimpleCamera(components); components.init(); +/* MD + We could add some lights, but the SimpleScene class can do that easier for us using its `setup` method: +*/ + +world.scene.setup(); + /* MD We'll make the background of the scene transparent so that it looks good in our docs page, but you don't have to do that in your app! @@ -105,12 +111,6 @@ const geometry = new THREE.BoxGeometry(); const cube = new THREE.Mesh(geometry, material); world.scene.three.add(cube); -/* MD - We could also add some lights, but the SimpleScene class can do that easier for us using its `setup` method: -*/ - -world.scene.setup(); - /* MD Finally, we will make the camera look at the cube: */ @@ -155,29 +155,21 @@ const panel = BUI.Component.create(() => { diff --git a/packages/core/src/core/Worlds/src/index.ts b/packages/core/src/core/Worlds/src/index.ts index f7e581898..062dd17ef 100644 --- a/packages/core/src/core/Worlds/src/index.ts +++ b/packages/core/src/core/Worlds/src/index.ts @@ -2,3 +2,4 @@ export * from "./simple-world"; export * from "./simple-scene"; export * from "./simple-renderer"; export * from "./simple-camera"; +export * from "./simple-scene-config"; diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts index 4dbb11376..086d23108 100644 --- a/packages/core/src/core/Worlds/src/simple-scene-config.ts +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -5,7 +5,7 @@ import { ColorSettingsControl, ConfigManager, NumberSettingControl, - VectorSettingControl, + Vector3SettingControl, } from "../../Types"; type SimpleSceneConfigType = { @@ -17,7 +17,7 @@ type SimpleSceneConfigType = { directionalLight: { color: ColorSettingsControl; intensity: NumberSettingControl; - position: VectorSettingControl; + position: Vector3SettingControl; }; }; @@ -34,10 +34,10 @@ class DirectionalLightConfig { return this._list.directionalLight.color.value; } - set color(value: number) { + set color(value: THREE.Color) { this._list.directionalLight.color.value = value; for (const [, light] of this._scene.directionalLights) { - light.color = new THREE.Color(value); + light.color.copy(value); } } @@ -53,14 +53,13 @@ class DirectionalLightConfig { } get position() { - return this._list.directionalLight.position.value; + return this._list.directionalLight.position.value.clone(); } - set position(value: number[]) { + set position(value: THREE.Vector3) { this._list.directionalLight.position.value = value; - const [x, y, z] = value; for (const [, light] of this._scene.directionalLights) { - light.position.set(x, y, z); + light.position.copy(value); } } } @@ -78,10 +77,10 @@ class AmbientLightConfig { return this._list.ambientLight.color.value; } - set color(value: number) { + set color(value: THREE.Color) { this._list.ambientLight.color.value = value; for (const [, light] of this._scene.ambientLights) { - light.color = new THREE.Color(value); + light.color.copy(value); } } @@ -101,6 +100,7 @@ class AmbientLightConfig { * Configuration interface for the {@link SimpleScene}. */ export interface SimpleSceneConfig { + backgroundColor: THREE.Color; directionalLight: { color: THREE.Color; intensity: number; @@ -118,7 +118,7 @@ export class SimpleSceneConfigManager extends ConfigManager< > { protected _list = { backgroundColor: { - value: 0, + value: new THREE.Color() as THREE.Color, opacity: 1, type: "Color" as const, }, @@ -126,7 +126,7 @@ export class SimpleSceneConfigManager extends ConfigManager< color: { type: "Color" as const, opacity: 1, - value: 1, + value: new THREE.Color(), }, intensity: { type: "Number" as const, @@ -138,7 +138,7 @@ export class SimpleSceneConfigManager extends ConfigManager< color: { type: "Color" as const, opacity: 1, - value: 1, + value: new THREE.Color(), }, intensity: { type: "Number" as const, @@ -147,7 +147,7 @@ export class SimpleSceneConfigManager extends ConfigManager< }, position: { type: "Vector" as const, - value: [], + value: new THREE.Vector3(), }, }, }; @@ -160,8 +160,8 @@ export class SimpleSceneConfigManager extends ConfigManager< return this._list.backgroundColor.value; } - set backgroundColor(value: number) { + set backgroundColor(value: THREE.Color) { this._list.backgroundColor.value = value; - this._component.three.background = new THREE.Color(value); + this._component.three.background = value; } } diff --git a/packages/core/src/core/Worlds/src/simple-scene.ts b/packages/core/src/core/Worlds/src/simple-scene.ts index f8d7c3b67..be72c3d79 100644 --- a/packages/core/src/core/Worlds/src/simple-scene.ts +++ b/packages/core/src/core/Worlds/src/simple-scene.ts @@ -28,6 +28,19 @@ export class SimpleScene /** {@link Configurable.config} */ config = new SimpleSceneConfigManager(this); + protected _defaultConfig: SimpleSceneConfig = { + backgroundColor: new THREE.Color(0x202932), + directionalLight: { + color: new THREE.Color("white"), + intensity: 1.5, + position: new THREE.Vector3(5, 10, 3), + }, + ambientLight: { + color: new THREE.Color("white"), + intensity: 1, + }, + }; + constructor(components: Components) { super(components); this.three = new THREE.Scene(); @@ -36,38 +49,24 @@ export class SimpleScene /** {@link Configurable.setup} */ setup(config?: Partial) { - const defaultConfig = { - backgroundColor: new THREE.Color(0x202932), - directionalLight: { - color: new THREE.Color("white"), - intensity: 1.5, - position: new THREE.Vector3(5, 10, 3), - }, - ambientLight: { - color: new THREE.Color("white"), - intensity: 1, - }, - }; - - const fullConfig = { ...defaultConfig, ...config }; + const fullConfig = { ...this._defaultConfig, ...config }; - this.config.backgroundColor = fullConfig.backgroundColor.getHex(); + this.config.backgroundColor = fullConfig.backgroundColor; - const ambLight = fullConfig.ambientLight; - this.config.ambientLight.color = ambLight.color.getHex(); - this.config.ambientLight.intensity = ambLight.intensity; + const ambLightData = fullConfig.ambientLight; + this.config.ambientLight.color = ambLightData.color; + this.config.ambientLight.intensity = ambLightData.intensity; - const dirLight = fullConfig.directionalLight; - this.config.directionalLight.color = dirLight.color.getHex(); - this.config.directionalLight.intensity = dirLight.intensity; - const { x, y, z } = dirLight.position; - this.config.directionalLight.position = [x, y, z]; + const dirLightData = fullConfig.directionalLight; + this.config.directionalLight.color = dirLightData.color; + this.config.directionalLight.intensity = dirLightData.intensity; + this.config.directionalLight.position = dirLightData.position; this.deleteAllLights(); const { color: dc, intensity: di } = this.config.directionalLight; const directionalLight = new THREE.DirectionalLight(dc, di); - directionalLight.position.set(x, y, z); + directionalLight.position.copy(dirLightData.position); const { color: ac, intensity: ai } = this.config.directionalLight; const ambientLight = new THREE.AmbientLight(ac, ai); diff --git a/packages/core/src/openbim/BCFTopics/index.ts b/packages/core/src/openbim/BCFTopics/index.ts index 200181109..92189544e 100644 --- a/packages/core/src/openbim/BCFTopics/index.ts +++ b/packages/core/src/openbim/BCFTopics/index.ts @@ -8,28 +8,32 @@ import { Event, World, DataMap, -} from "../../core/Types"; +} from "../../core"; + import { BCFTopic, - BCFTopicsConfig, BCFVersion, Topic, extensionsImporter, + BCFTopicsConfigManager, + BCFTopicsConfig, + Comment, } from "./src"; + import { BCFViewpoint, Viewpoint, ViewpointCamera, Viewpoints, } from "../../core/Viewpoints"; -import { Comment } from "./src/Comment"; + import { Clipper } from "../../core/Clipper"; // TODO: Extract import/export logic in its own class for better maintenance. export class BCFTopics extends Component - implements Disposable, Configurable + implements Disposable, Configurable { static uuid = "de977976-e4f6-4e4f-a01a-204727839802" as const; enabled = false; @@ -48,7 +52,7 @@ export class BCFTopics trimValues: true, }); - config: Required = { + protected _defaultConfig: Required = { author: "jhon.doe@example.com", version: "2.1", types: new Set([ @@ -73,13 +77,37 @@ export class BCFTopics ignoreIncompleteTopicsOnImport: false, }; + config = new BCFTopicsConfigManager(this); + readonly list = new DataMap(); readonly onSetup = new Event(); isSetup = false; setup(config?: Partial) { if (this.isSetup) return; - this.config = { ...this.config, ...config }; + + const fullConfig = { ...this._defaultConfig, ...config }; + + this.config.version = fullConfig.version; + this.config.author = fullConfig.author; + this.config.types = fullConfig.types; + this.config.statuses = fullConfig.statuses; + this.config.priorities = fullConfig.priorities; + this.config.labels = fullConfig.labels; + this.config.stages = fullConfig.stages; + this.config.users = fullConfig.users; + this.config.includeSelectionTag = fullConfig.includeSelectionTag; + this.config.updateExtensionsOnImport = fullConfig.updateExtensionsOnImport; + this.config.strict = fullConfig.strict; + this.config.includeAllExtensionsOnExport = + fullConfig.includeAllExtensionsOnExport; + + this.config.fallbackVersionOnImport = + fullConfig.fallbackVersionOnImport || ""; + + this.config.ignoreIncompleteTopicsOnImport = + fullConfig.ignoreIncompleteTopicsOnImport; + this.isSetup = true; this.enabled = true; this.onSetup.trigger(); diff --git a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts new file mode 100644 index 000000000..9ac957e8d --- /dev/null +++ b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts @@ -0,0 +1,288 @@ +import { BCFTopics, BCFVersion } from "../index"; +import { + BooleanSettingsControl, + ConfigManager, + SelectSettingControl, + TextSetSettingControl, + TextSettingsControl, +} from "../../../core"; + +/** + * Configuration settings for managing BCF topics. + * This interface defines the properties and their meanings used to control the behavior of exporting and importing BCF topics. + */ +export interface BCFTopicsConfig { + /** + * The BCF version used during export. + */ + version: BCFVersion; + + /** + * The email of the user creating topics using this component. + */ + author: string; + + /** + * The set of allowed topic types. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + types: Set; + + /** + * The set of allowed topic statuses. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + statuses: Set; + + /** + * The set of allowed topic priorities. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + priorities: Set; + + /** + * The set of allowed topic labels. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + labels: Set; + + /** + * The set of allowed topic stages. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + stages: Set; + + /** + * The set of allowed topic users. This is exported inside the + * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). + */ + users: Set; + + /** + * Whether or not to include the AuthoringSoftwareId in the viewpoint components during export. + */ + includeSelectionTag: boolean; + + /** + * Updates the types, statuses, users, etc., after importing an external BCF. + */ + updateExtensionsOnImport: boolean; + + /** + * Only allow to use the extensions (types, statuses, etc.) defined in the config when setting the corresponding data in a topic. + */ + strict: boolean; + + /** + * If true, export the extensions (types, status, etc.) based on topics data. This doesn't update the extensions in the config. + * If false, only export the extensions defined in each collection of possibilities set in the config. + * In all cases, all the values from each collection of extensions defined in the config are going to be exported. + */ + includeAllExtensionsOnExport: boolean; + + /** + * Version to be used when importing if no bcf.version file is present in the incoming data. + * When null, the importer will throw an error if the version is missing or is not supported. + */ + fallbackVersionOnImport: BCFVersion | null; + + /** + * If true, do not import a topic with missing information (guid, type, status, title, creationDate or creationAuthor). + * If false, use default values for missing data. + */ + ignoreIncompleteTopicsOnImport: boolean; +} + +type BCFTopicsConfigType = { + version: SelectSettingControl; + author: TextSettingsControl; + types: TextSetSettingControl; + statuses: TextSetSettingControl; + priorities: TextSetSettingControl; + labels: TextSetSettingControl; + stages: TextSetSettingControl; + users: TextSetSettingControl; + includeSelectionTag: BooleanSettingsControl; + updateExtensionsOnImport: BooleanSettingsControl; + strict: BooleanSettingsControl; + includeAllExtensionsOnExport: BooleanSettingsControl; + fallbackVersionOnImport: SelectSettingControl; + ignoreIncompleteTopicsOnImport: BooleanSettingsControl; +}; + +export class BCFTopicsConfigManager extends ConfigManager< + BCFTopics, + BCFTopicsConfigType +> { + protected _list = { + version: { + type: "Select" as const, + options: new Set(), + value: "", + }, + author: { + type: "Text" as const, + value: "", + }, + types: { + type: "TextSet" as const, + value: new Set(), + }, + statuses: { + type: "TextSet" as const, + value: new Set(), + }, + priorities: { + type: "TextSet" as const, + value: new Set(), + }, + labels: { + type: "TextSet" as const, + value: new Set(), + }, + stages: { + type: "TextSet" as const, + value: new Set(), + }, + users: { + type: "TextSet" as const, + value: new Set(), + }, + includeSelectionTag: { + type: "Boolean" as const, + value: false, + }, + updateExtensionsOnImport: { + type: "Boolean" as const, + value: false, + }, + strict: { + type: "Boolean" as const, + value: false, + }, + includeAllExtensionsOnExport: { + type: "Boolean" as const, + value: false, + }, + fallbackVersionOnImport: { + type: "Select" as const, + options: new Set(), + value: "", + }, + ignoreIncompleteTopicsOnImport: { + type: "Boolean" as const, + value: false, + }, + }; + + get version() { + return this._list.version.value; + } + set version(value) { + this._list.version.value = value; + } + + get author() { + return this._list.author.value; + } + + set author(value) { + this._list.author.value = value; + } + + get types() { + return this._list.types.value; + } + + set types(value) { + this._list.types.value = value; + } + + get statuses() { + return this._list.statuses.value; + } + + set statuses(value) { + this._list.statuses.value = value; + } + + get priorities() { + return this._list.priorities.value; + } + + set priorities(value) { + this._list.priorities.value = value; + } + + get labels() { + return this._list.labels.value; + } + + set labels(value) { + this._list.labels.value = value; + } + + get stages() { + return this._list.stages.value; + } + + set stages(value) { + this._list.stages.value = value; + } + + get users() { + return this._list.users.value; + } + + set users(value) { + this._list.users.value = value; + } + + get includeSelectionTag() { + return this._list.includeSelectionTag.value; + } + + set includeSelectionTag(value) { + this._list.includeSelectionTag.value = value; + } + + get updateExtensionsOnImport() { + return this._list.updateExtensionsOnImport.value; + } + + set updateExtensionsOnImport(value) { + this._list.updateExtensionsOnImport.value = value; + } + + get strict() { + return this._list.strict.value; + } + + set strict(value) { + this._list.strict.value = value; + } + + get includeAllExtensionsOnExport() { + return this._list.includeAllExtensionsOnExport.value; + } + + set includeAllExtensionsOnExport(value) { + this._list.includeAllExtensionsOnExport.value = value; + } + + get fallbackVersionOnImport() { + return this._list.fallbackVersionOnImport.value; + } + + set fallbackVersionOnImport(value) { + this._list.fallbackVersionOnImport.value = value; + } + + get ignoreIncompleteTopicsOnImport() { + return this._list.ignoreIncompleteTopicsOnImport.value; + } + + set ignoreIncompleteTopicsOnImport(value) { + this._list.ignoreIncompleteTopicsOnImport.value = value; + } +} diff --git a/packages/core/src/openbim/BCFTopics/src/index.ts b/packages/core/src/openbim/BCFTopics/src/index.ts index 973b81240..aff86fc5d 100644 --- a/packages/core/src/openbim/BCFTopics/src/index.ts +++ b/packages/core/src/openbim/BCFTopics/src/index.ts @@ -2,3 +2,4 @@ export * from "./Topic"; export * from "./types"; export * from "./Comment"; export * from "./importers"; +export * from "./bcf-topics-config"; diff --git a/packages/core/src/openbim/BCFTopics/src/types.ts b/packages/core/src/openbim/BCFTopics/src/types.ts index 33f930cb9..b87c5bbd9 100644 --- a/packages/core/src/openbim/BCFTopics/src/types.ts +++ b/packages/core/src/openbim/BCFTopics/src/types.ts @@ -18,89 +18,3 @@ export interface BCFTopic { description?: string; stage?: string; } - -/** - * Configuration settings for managing BCF topics. - * This interface defines the properties and their meanings used to control the behavior of exporting and importing BCF topics. - */ -export interface BCFTopicsConfig { - /** - * The BCF version used during export. - */ - version: BCFVersion; - - /** - * The email of the user creating topics using this component. - */ - author: string; - - /** - * The set of allowed topic types. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - types: Set; - - /** - * The set of allowed topic statuses. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - statuses: Set; - - /** - * The set of allowed topic priorities. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - priorities: Set; - - /** - * The set of allowed topic labels. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - labels: Set; - - /** - * The set of allowed topic stages. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - stages: Set; - - /** - * The set of allowed topic users. This is exported inside the - * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). - */ - users: Set; - - /** - * Whether or not to include the AuthoringSoftwareId in the viewpoint components during export. - */ - includeSelectionTag: boolean; - - /** - * Updates the types, statuses, users, etc., after importing an external BCF. - */ - updateExtensionsOnImport: boolean; - - /** - * Only allow to use the extensions (types, statuses, etc.) defined in the config when setting the corresponding data in a topic. - */ - strict: boolean; - - /** - * If true, export the extensions (types, status, etc.) based on topics data. This doesn't update the extensions in the config. - * If false, only export the extensions defined in each collection of possibilities set in the config. - * In all cases, all the values from each collection of extensions defined in the config are going to be exported. - */ - includeAllExtensionsOnExport: boolean; - - /** - * Version to be used when importing if no bcf.version file is present in the incoming data. - * When null, the importer will throw an error if the version is missing or is not supported. - */ - fallbackVersionOnImport: BCFVersion | null; - - /** - * If true, do not import a topic with missing information (guid, type, status, title, creationDate or creationAuthor). - * If false, use default values for missing data. - */ - ignoreIncompleteTopicsOnImport: boolean; -} diff --git a/packages/core/vite.config.ts.timestamp-1724501893414-c367789247f8.mjs b/packages/core/vite.config.ts.timestamp-1724501893414-c367789247f8.mjs new file mode 100644 index 000000000..22ea4b15a --- /dev/null +++ b/packages/core/vite.config.ts.timestamp-1724501893414-c367789247f8.mjs @@ -0,0 +1,68 @@ +// vite.config.ts +import dts from "file:///C:/Users/anton/Desktop/code/engine_components/node_modules/vite-plugin-dts/dist/index.mjs"; +import { defineConfig } from "file:///C:/Users/anton/Desktop/code/engine_components/node_modules/vite/dist/node/index.js"; +import * as path from "path"; +import * as fs from "fs"; + +// package.json +var peerDependencies = { + "@thatopen/fragments": "~2.2.0", + three: "^0.160.1", + "web-ifc": "0.0.57" +}; + +// vite.config.ts +var __vite_injected_original_dirname = "C:\\Users\\anton\\Desktop\\code\\engine_components\\packages\\core"; +var generateTSNamespace = (dts2) => { + if (!fs.existsSync("./dist")) + return; + console.log("Generating namespace!"); + let types = ""; + dts2.forEach((declaration) => { + const cleanedType = declaration.replace(/export\s+\*?\s+from\s+"[^"]+";/g, "").replace(/^\s*[\r\n]/gm, "").replace(/`/g, "'"); + types += cleanedType; + }); + fs.writeFileSync( + "./dist/namespace.d.ts", + `declare namespace OBC { +${types} +}` + ); +}; +var vite_config_default = defineConfig({ + build: { + outDir: "./dist", + lib: { + entry: path.resolve(__vite_injected_original_dirname, "./src/index.ts"), + formats: ["es", "cjs"], + fileName: (format) => { + const map = { + cjs: "cjs", + es: "mjs" + }; + return `index.${map[format]}`; + } + }, + rollupOptions: { + external: Object.keys(peerDependencies), + output: { + globals: { + three: "THREE", + "@thatopen/fragments": "FRAGS", + "web-ifc": "WEB-IFC" + } + } + } + }, + plugins: [ + dts({ + include: ["./src"], + exclude: ["./src/**/example.ts", "./src/**/*.test.ts"], + afterBuild: generateTSNamespace + }) + ] +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiQzpcXFxcVXNlcnNcXFxcYW50b25cXFxcRGVza3RvcFxcXFxjb2RlXFxcXGVuZ2luZV9jb21wb25lbnRzXFxcXHBhY2thZ2VzXFxcXGNvcmVcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIkM6XFxcXFVzZXJzXFxcXGFudG9uXFxcXERlc2t0b3BcXFxcY29kZVxcXFxlbmdpbmVfY29tcG9uZW50c1xcXFxwYWNrYWdlc1xcXFxjb3JlXFxcXHZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9DOi9Vc2Vycy9hbnRvbi9EZXNrdG9wL2NvZGUvZW5naW5lX2NvbXBvbmVudHMvcGFja2FnZXMvY29yZS92aXRlLmNvbmZpZy50c1wiOy8qIGVzbGludC1kaXNhYmxlIGltcG9ydC9uby1leHRyYW5lb3VzLWRlcGVuZGVuY2llcyAqL1xyXG5pbXBvcnQgZHRzIGZyb20gXCJ2aXRlLXBsdWdpbi1kdHNcIjtcclxuaW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSBcInZpdGVcIjtcclxuaW1wb3J0ICogYXMgcGF0aCBmcm9tIFwicGF0aFwiO1xyXG5pbXBvcnQgKiBhcyBmcyBmcm9tIFwiZnNcIjtcclxuaW1wb3J0ICogYXMgcGFja2FnZUpzb24gZnJvbSBcIi4vcGFja2FnZS5qc29uXCI7XHJcblxyXG5jb25zdCBnZW5lcmF0ZVRTTmFtZXNwYWNlID0gKGR0czogTWFwPHN0cmluZywgc3RyaW5nPikgPT4ge1xyXG4gIGlmICghZnMuZXhpc3RzU3luYyhcIi4vZGlzdFwiKSkgcmV0dXJuO1xyXG4gIGNvbnNvbGUubG9nKFwiR2VuZXJhdGluZyBuYW1lc3BhY2UhXCIpO1xyXG4gIGxldCB0eXBlcyA9IFwiXCI7XHJcbiAgZHRzLmZvckVhY2goKGRlY2xhcmF0aW9uKSA9PiB7XHJcbiAgICBjb25zdCBjbGVhbmVkVHlwZSA9IGRlY2xhcmF0aW9uXHJcbiAgICAgIC5yZXBsYWNlKC9leHBvcnRcXHMrXFwqP1xccytmcm9tXFxzK1wiW15cIl0rXCI7L2csIFwiXCIpXHJcbiAgICAgIC5yZXBsYWNlKC9eXFxzKltcXHJcXG5dL2dtLCBcIlwiKVxyXG4gICAgICAucmVwbGFjZSgvYC9nLCBcIidcIik7XHJcbiAgICB0eXBlcyArPSBjbGVhbmVkVHlwZTtcclxuICB9KTtcclxuICBmcy53cml0ZUZpbGVTeW5jKFxyXG4gICAgXCIuL2Rpc3QvbmFtZXNwYWNlLmQudHNcIixcclxuICAgIGBkZWNsYXJlIG5hbWVzcGFjZSBPQkMge1xcbiR7dHlwZXN9XFxufWAsXHJcbiAgKTtcclxufTtcclxuXHJcbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XHJcbiAgYnVpbGQ6IHtcclxuICAgIG91dERpcjogXCIuL2Rpc3RcIixcclxuICAgIGxpYjoge1xyXG4gICAgICBlbnRyeTogcGF0aC5yZXNvbHZlKF9fZGlybmFtZSwgXCIuL3NyYy9pbmRleC50c1wiKSxcclxuICAgICAgZm9ybWF0czogW1wiZXNcIiwgXCJjanNcIl0sXHJcbiAgICAgIGZpbGVOYW1lOiAoZm9ybWF0KSA9PiB7XHJcbiAgICAgICAgY29uc3QgbWFwID0ge1xyXG4gICAgICAgICAgY2pzOiBcImNqc1wiLFxyXG4gICAgICAgICAgZXM6IFwibWpzXCIsXHJcbiAgICAgICAgfTtcclxuICAgICAgICByZXR1cm4gYGluZGV4LiR7bWFwW2Zvcm1hdF19YDtcclxuICAgICAgfSxcclxuICAgIH0sXHJcbiAgICByb2xsdXBPcHRpb25zOiB7XHJcbiAgICAgIGV4dGVybmFsOiBPYmplY3Qua2V5cyhwYWNrYWdlSnNvbi5wZWVyRGVwZW5kZW5jaWVzKSxcclxuICAgICAgb3V0cHV0OiB7XHJcbiAgICAgICAgZ2xvYmFsczoge1xyXG4gICAgICAgICAgdGhyZWU6IFwiVEhSRUVcIixcclxuICAgICAgICAgIFwiQHRoYXRvcGVuL2ZyYWdtZW50c1wiOiBcIkZSQUdTXCIsXHJcbiAgICAgICAgICBcIndlYi1pZmNcIjogXCJXRUItSUZDXCIsXHJcbiAgICAgICAgfSxcclxuICAgICAgfSxcclxuICAgIH0sXHJcbiAgfSxcclxuICBwbHVnaW5zOiBbXHJcbiAgICBkdHMoe1xyXG4gICAgICBpbmNsdWRlOiBbXCIuL3NyY1wiXSxcclxuICAgICAgZXhjbHVkZTogW1wiLi9zcmMvKiovZXhhbXBsZS50c1wiLCBcIi4vc3JjLyoqLyoudGVzdC50c1wiXSxcclxuICAgICAgYWZ0ZXJCdWlsZDogZ2VuZXJhdGVUU05hbWVzcGFjZSxcclxuICAgIH0pLFxyXG4gIF0sXHJcbn0pO1xyXG4iLCAie1xyXG4gIFwibmFtZVwiOiBcIkB0aGF0b3Blbi9jb21wb25lbnRzXCIsXHJcbiAgXCJkZXNjcmlwdGlvblwiOiBcIkNvbGxlY3Rpb24gb2YgY29yZSBmdW5jdGlvbmFsaXRpZXMgdG8gYXV0aG9yIEJJTSBhcHBzLlwiLFxyXG4gIFwidmVyc2lvblwiOiBcIjIuMy4wLWFscGhhLjFcIixcclxuICBcImF1dGhvclwiOiBcIlRoYXQgT3BlbiBDb21wYW55XCIsXHJcbiAgXCJjb250cmlidXRvcnNcIjogW1xyXG4gICAgXCJBbnRvbmlvIEdvbnphbGV6IFZpZWdhcyAoaHR0cHM6Ly9naXRodWIuY29tL2FndmllZ2FzKVwiLFxyXG4gICAgXCJKdWFuIEhveW9zIChodHRwczovL2dpdGh1Yi5jb20vSG95b3NKdWFuKVwiLFxyXG4gICAgXCJIYXJyeSBDb2xsaW4gKGh0dHBzOi8vZ2l0aHViLmNvbS9oYXJyeWNvbGxpbilcIlxyXG4gIF0sXHJcbiAgXCJsaWNlbnNlXCI6IFwiTUlUXCIsXHJcbiAgXCJob21lcGFnZVwiOiBcImh0dHBzOi8vZ2l0aHViLmNvbS9UaGF0T3Blbi9lbmdpbmVfY29tcG9uZW50cy90cmVlL21haW4vcGFja2FnZXMvY29tcG9uZW50cyNyZWFkbWVcIixcclxuICBcImJ1Z3NcIjoge1xyXG4gICAgXCJ1cmxcIjogXCJodHRwczovL2dpdGh1Yi5jb20vVGhhdE9wZW4vZW5naW5lX2NvbXBvbmVudHMvaXNzdWVzXCJcclxuICB9LFxyXG4gIFwidHlwZVwiOiBcIm1vZHVsZVwiLFxyXG4gIFwibWFpblwiOiBcImRpc3QvaW5kZXguY2pzXCIsXHJcbiAgXCJtb2R1bGVcIjogXCJkaXN0L2luZGV4Lm1qc1wiLFxyXG4gIFwidHlwZXNcIjogXCJkaXN0L2luZGV4LmQudHNcIixcclxuICBcImZpbGVzXCI6IFtcclxuICAgIFwiZGlzdFwiXHJcbiAgXSxcclxuICBcInJlcG9zaXRvcnlcIjoge1xyXG4gICAgXCJ0eXBlXCI6IFwiZ2l0XCIsXHJcbiAgICBcInVybFwiOiBcImdpdCtodHRwczovL2dpdGh1Yi5jb20vVGhhdE9wZW4vZW5naW5lX2NvbXBvbmVudHMvdHJlZS9tYWluL3BhY2thZ2VzL2NvbXBvbmVudHMuZ2l0XCJcclxuICB9LFxyXG4gIFwicGFja2FnZU1hbmFnZXJcIjogXCJ5YXJuQDMuMi4xXCIsXHJcbiAgXCJzY3JpcHRzXCI6IHtcclxuICAgIFwiZGV2XCI6IFwidml0ZSAtLWhvc3RcIixcclxuICAgIFwidGVzdFwiOiBcImplc3RcIixcclxuICAgIFwiYnVpbGRcIjogXCJ0c2MgLS1wIC4vdHNjb25maWctYnVpbGQuanNvbiAmJiB2aXRlIGJ1aWxkXCIsXHJcbiAgICBcInByZXB1Ymxpc2hPbmx5XCI6IFwibm9kZSAuL3Jlc291cmNlcy91cGRhdGVDb21wb25lbnRzVmVyc2lvbi5tanMgJiYgeWFybiBidWlsZFwiLFxyXG4gICAgXCJwdWJsaXNoLXJlcG9cIjogXCJucG0gcHVibGlzaFwiLFxyXG4gICAgXCJwdWJsaXNoLWFscGhhXCI6IFwibnBtIHB1Ymxpc2ggLS10YWcgYWxwaGFcIlxyXG4gIH0sXHJcbiAgXCJwdWJsaXNoQ29uZmlnXCI6IHtcclxuICAgIFwiYWNjZXNzXCI6IFwicHVibGljXCJcclxuICB9LFxyXG4gIFwiZGV2RGVwZW5kZW5jaWVzXCI6IHtcclxuICAgIFwiQHRoYXRvcGVuL2ZyYWdtZW50c1wiOiBcIn4yLjIuMFwiLFxyXG4gICAgXCJAdGhhdG9wZW4vdWlcIjogXCJ+Mi4yLjBcIixcclxuICAgIFwiQHR5cGVzL3RocmVlXCI6IFwiMC4xNjAuMFwiLFxyXG4gICAgXCJzdGF0cy5qc1wiOiBcIl4wLjE3LjBcIixcclxuICAgIFwidGhyZWVcIjogXCJeMC4xNjAuMVwiLFxyXG4gICAgXCJ3ZWItaWZjXCI6IFwiMC4wLjU3XCJcclxuICB9LFxyXG4gIFwiZGVwZW5kZW5jaWVzXCI6IHtcclxuICAgIFwiY2FtZXJhLWNvbnRyb2xzXCI6IFwiMi43LjNcIixcclxuICAgIFwiZmFzdC14bWwtcGFyc2VyXCI6IFwiNC40LjFcIixcclxuICAgIFwianN6aXBcIjogXCIzLjEwLjFcIixcclxuICAgIFwidGhyZWUtbWVzaC1idmhcIjogXCIwLjcuMFwiXHJcbiAgfSxcclxuICBcInBlZXJEZXBlbmRlbmNpZXNcIjoge1xyXG4gICAgXCJAdGhhdG9wZW4vZnJhZ21lbnRzXCI6IFwifjIuMi4wXCIsXHJcbiAgICBcInRocmVlXCI6IFwiXjAuMTYwLjFcIixcclxuICAgIFwid2ViLWlmY1wiOiBcIjAuMC41N1wiXHJcbiAgfVxyXG59Il0sCiAgIm1hcHBpbmdzIjogIjtBQUNBLE9BQU8sU0FBUztBQUNoQixTQUFTLG9CQUFvQjtBQUM3QixZQUFZLFVBQVU7QUFDdEIsWUFBWSxRQUFROzs7QUNnRGxCLHVCQUFvQjtBQUFBLEVBQ2xCLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQVM7QUFBQSxFQUNULFdBQVc7QUFDYjs7O0FEeERGLElBQU0sbUNBQW1DO0FBT3pDLElBQU0sc0JBQXNCLENBQUNBLFNBQTZCO0FBQ3hELE1BQUksQ0FBSSxjQUFXLFFBQVE7QUFBRztBQUM5QixVQUFRLElBQUksdUJBQXVCO0FBQ25DLE1BQUksUUFBUTtBQUNaLEVBQUFBLEtBQUksUUFBUSxDQUFDLGdCQUFnQjtBQUMzQixVQUFNLGNBQWMsWUFDakIsUUFBUSxtQ0FBbUMsRUFBRSxFQUM3QyxRQUFRLGdCQUFnQixFQUFFLEVBQzFCLFFBQVEsTUFBTSxHQUFHO0FBQ3BCLGFBQVM7QUFBQSxFQUNYLENBQUM7QUFDRCxFQUFHO0FBQUEsSUFDRDtBQUFBLElBQ0E7QUFBQSxFQUE0QixLQUFLO0FBQUE7QUFBQSxFQUNuQztBQUNGO0FBRUEsSUFBTyxzQkFBUSxhQUFhO0FBQUEsRUFDMUIsT0FBTztBQUFBLElBQ0wsUUFBUTtBQUFBLElBQ1IsS0FBSztBQUFBLE1BQ0gsT0FBWSxhQUFRLGtDQUFXLGdCQUFnQjtBQUFBLE1BQy9DLFNBQVMsQ0FBQyxNQUFNLEtBQUs7QUFBQSxNQUNyQixVQUFVLENBQUMsV0FBVztBQUNwQixjQUFNLE1BQU07QUFBQSxVQUNWLEtBQUs7QUFBQSxVQUNMLElBQUk7QUFBQSxRQUNOO0FBQ0EsZUFBTyxTQUFTLElBQUksTUFBTSxDQUFDO0FBQUEsTUFDN0I7QUFBQSxJQUNGO0FBQUEsSUFDQSxlQUFlO0FBQUEsTUFDYixVQUFVLE9BQU8sS0FBaUIsZ0JBQWdCO0FBQUEsTUFDbEQsUUFBUTtBQUFBLFFBQ04sU0FBUztBQUFBLFVBQ1AsT0FBTztBQUFBLFVBQ1AsdUJBQXVCO0FBQUEsVUFDdkIsV0FBVztBQUFBLFFBQ2I7QUFBQSxNQUNGO0FBQUEsSUFDRjtBQUFBLEVBQ0Y7QUFBQSxFQUNBLFNBQVM7QUFBQSxJQUNQLElBQUk7QUFBQSxNQUNGLFNBQVMsQ0FBQyxPQUFPO0FBQUEsTUFDakIsU0FBUyxDQUFDLHVCQUF1QixvQkFBb0I7QUFBQSxNQUNyRCxZQUFZO0FBQUEsSUFDZCxDQUFDO0FBQUEsRUFDSDtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbImR0cyJdCn0K From 911cb796aff4e867b1cb73d1d67d32018dd5c52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 24 Aug 2024 15:44:05 +0200 Subject: [PATCH 03/51] chore(core): fix tutorial import path --- packages/core/src/core/ShadowedScene/example.ts | 16 ++++++++-------- packages/core/src/core/Worlds/example.ts | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/core/src/core/ShadowedScene/example.ts b/packages/core/src/core/ShadowedScene/example.ts index 7d2341b3b..266768c93 100644 --- a/packages/core/src/core/ShadowedScene/example.ts +++ b/packages/core/src/core/ShadowedScene/example.ts @@ -52,14 +52,6 @@ const grid = grids.create(world); world.camera.controls.setLookAt(1, 2, -2, -2, 0, -5); -/* MD - - We'll make the background of the scene transparent so that it looks good in our docs page, but you don't have to do that in your app! - -*/ - -world.scene.three.background = null; - /* MD ### 🏠 Loading a model --- @@ -161,6 +153,14 @@ world.camera.controls.addEventListener("update", async () => { await world.scene.updateShadows(); }); +/* MD + + We'll make the background of the scene transparent so that it looks good in our docs page, but you don't have to do that in your app! + +*/ + +world.scene.three.background = null; + /* MD ### ⏱️ Measuring the performance (optional) --- diff --git a/packages/core/src/core/Worlds/example.ts b/packages/core/src/core/Worlds/example.ts index af464be42..0337e1500 100644 --- a/packages/core/src/core/Worlds/example.ts +++ b/packages/core/src/core/Worlds/example.ts @@ -23,7 +23,7 @@ In this tutorial, we will import: import * as THREE from "three"; import * as BUI from "@thatopen/ui"; import Stats from "stats.js"; -import * as OBC from "../.."; +import * as OBC from "@thatopen/components"; /* MD ### 🖼️ Getting the container From cca21a636d191dbd2aebda9614520a2963487248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 24 Aug 2024 16:10:51 +0200 Subject: [PATCH 04/51] chore(core): publish --- packages/core/src/core/Components/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/core/Components/index.ts b/packages/core/src/core/Components/index.ts index cb9b16eb1..c539ff9e5 100644 --- a/packages/core/src/core/Components/index.ts +++ b/packages/core/src/core/Components/index.ts @@ -14,7 +14,7 @@ export class Components implements Disposable { /** * The version of the @thatopen/components library. */ - static readonly release = "2.2.5"; + static readonly release = "2.3.0-alpha.1"; /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); From 07bdbd3e0dacc8e9a8c985f3777d6c9a5c86b7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 27 Aug 2024 13:03:10 +0200 Subject: [PATCH 05/51] feat(front): use file system api for tiles caching --- packages/front/package.json | 2 +- .../front/src/fragments/Highlighter/index.ts | 5 +- .../src/fragments/IfcStreamer/example.ts | 1 - .../front/src/fragments/IfcStreamer/index.ts | 24 ++-- .../src/fragments/IfcStreamer/src/index.ts | 1 + .../IfcStreamer/src/streamer-file-db.ts | 123 ++++++++++++++++++ packages/front/tsconfig.json | 3 +- 7 files changed, 137 insertions(+), 22 deletions(-) create mode 100644 packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts diff --git a/packages/front/package.json b/packages/front/package.json index 4ad2f2999..d8d84ae69 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.1", + "version": "2.3.0-alpha.2", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/Highlighter/index.ts b/packages/front/src/fragments/Highlighter/index.ts index cf838b702..d55691925 100644 --- a/packages/front/src/fragments/Highlighter/index.ts +++ b/packages/front/src/fragments/Highlighter/index.ts @@ -44,10 +44,7 @@ export interface HighlighterConfig { /** * This component allows highlighting and selecting fragments in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Front/Highlighter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components-front/classes/Highlighter). */ -export class Highlighter - extends OBC.Component - implements OBC.Disposable, OBC.Configurable -{ +export class Highlighter extends OBC.Component implements OBC.Disposable { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. diff --git a/packages/front/src/fragments/IfcStreamer/example.ts b/packages/front/src/fragments/IfcStreamer/example.ts index d781d53ff..108e50986 100644 --- a/packages/front/src/fragments/IfcStreamer/example.ts +++ b/packages/front/src/fragments/IfcStreamer/example.ts @@ -71,7 +71,6 @@ world.scene.three.background = null; const loader = components.get(OBCF.IfcStreamer); loader.world = world; -loader.dbCleaner.enabled = true; /* MD Now, we need to set the base URL where the streamer needs to look for the tiles. In our case, we'll use the tiles we have prepared in our repository, but this should also work with your own backend. diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index bf3528aef..c4279e0dd 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -3,12 +3,13 @@ import * as FRAG from "@thatopen/fragments"; import * as OBC from "@thatopen/components"; import { GeometryCullerRenderer, - StreamFileDatabase, + // StreamFileDatabase, StreamPropertiesSettings, StreamedInstances, StreamedInstance, StreamLoaderSettings, - StreamerDbCleaner, + // StreamerDbCleaner, + StreamerFileDb, } from "./src"; export * from "./src"; @@ -64,8 +65,6 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ useCache = true; - dbCleaner: StreamerDbCleaner; - fetch = async (url: string) => { return fetch(url); }; @@ -79,7 +78,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { { data: FRAG.StreamedGeometries; time: number } >(); - private _fileCache = new StreamFileDatabase(); + private _fileDB = new StreamerFileDb(); private _url: string | null = null; @@ -170,13 +169,9 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { constructor(components: OBC.Components) { super(components); this.components.add(IfcStreamer.uuid, this); - this.dbCleaner = new StreamerDbCleaner(this._fileCache); const fragments = this.components.get(OBC.FragmentsManager); fragments.onFragmentsDisposed.add(this.disposeStreamedGroup); - - // const hardlyGeometry = new THREE.BoxGeometry(); - // this._hardlySeenGeometries = new THREE.InstancedMesh(); } /** {@link OBC.Disposable.dispose} */ @@ -393,7 +388,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { * @returns A Promise that resolves when the cache is cleared. */ async clearCache() { - await this._fileCache.delete(); + await this._fileDB.clear(); } /** @@ -489,18 +484,17 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { // If this file is in the local cache, get it if (this.useCache) { // Add or update this file to clean it up from indexedDB automatically later - this.dbCleaner.update(url); + // this.dbCleaner.update(url); - const found = await this._fileCache.files.get(url); + const found = await this._fileDB.get(url); if (found) { - bytes = found.file; + bytes = found; } else { const fetched = await this.fetch(url); const buffer = await fetched.arrayBuffer(); bytes = new Uint8Array(buffer); - // await this._fileCache.files.delete(url); - this._fileCache.files.add({ file: bytes, id: url }); + await this._fileDB.add(url, bytes); } } else { const fetched = await this.fetch(url); diff --git a/packages/front/src/fragments/IfcStreamer/src/index.ts b/packages/front/src/fragments/IfcStreamer/src/index.ts index 63db33d11..dd4c965bb 100644 --- a/packages/front/src/fragments/IfcStreamer/src/index.ts +++ b/packages/front/src/fragments/IfcStreamer/src/index.ts @@ -2,3 +2,4 @@ export * from "./geometry-culler-renderer"; export * from "./streamer-db"; export * from "./types"; export * from "./streamer-db-cleaner"; +export * from "./streamer-file-db"; diff --git a/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts b/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts new file mode 100644 index 000000000..9f0128861 --- /dev/null +++ b/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts @@ -0,0 +1,123 @@ +export class StreamerFileDb { + baseDirectory = "that-open-company-streaming"; + + maxDeadTime = 60000; + + private _memoryCleanTime = 10000; + + get memoryCleanTime() { + return this._memoryCleanTime; + } + + set memoryCleanTime(value: number) { + this._memoryCleanTime = value; + this.dispose(); + this.setupMemoryCleanup(); + } + + private _intervalID: number | null = null; + + private _isCleaningMemory = false; + + constructor() { + this.setupMemoryCleanup(); + } + + async get(name: string) { + const encodedName = this.encodeName(name); + const baseDir = await this.getDir(this.baseDirectory); + try { + const fileHandle = await baseDir.getFileHandle(encodedName); + const file = await fileHandle.getFile(); + this.updateLastAccessTime(encodedName); + const buffer = await file.arrayBuffer(); + return new Uint8Array(buffer); + } catch (e) { + return null; + } + } + + async add(name: string, buffer: Uint8Array) { + const encodedName = this.encodeName(name); + const baseDir = await this.getDir(this.baseDirectory); + const fileHandle = await baseDir.getFileHandle(encodedName, { + create: true, + }); + + const writable = await fileHandle.createWritable(); + await writable.write(buffer); + await writable.close(); + this.updateLastAccessTime(encodedName); + } + + async clear() { + const baseDir = await this.getDir(this.baseDirectory); + // @ts-ignore + for await (const [name] of baseDir.entries()) { + await baseDir.removeEntry(name); + } + } + + dispose() { + if (this._intervalID !== null) { + window.clearInterval(this._intervalID); + } + } + + private setupMemoryCleanup() { + this._intervalID = window.setInterval( + this.cleanMemory, + this.memoryCleanTime, + ); + } + + private cleanMemory = async () => { + if (this._isCleaningMemory) { + return; + } + this._isCleaningMemory = true; + + const rootDir = await this.getDir(this.baseDirectory); + + const filesToDelete = new Set(); + + const now = new Date().getTime(); + + // @ts-ignore + for await (const entry of rootDir.values()) { + const serializedLastAccessed = localStorage.getItem(entry.name) || "0"; + const lastAccess = parseInt(serializedLastAccessed, 10); + + const deadTime = now - lastAccess; + + if (deadTime > this.maxDeadTime) { + filesToDelete.add(entry.name); + localStorage.removeItem(entry.name); + } + } + + for (const name of filesToDelete) { + console.log(`deleted: ${name}`); + rootDir.removeEntry(name); + } + + this._isCleaningMemory = false; + }; + + private async getDir(path: string) { + const root = await navigator.storage.getDirectory(); + return root.getDirectoryHandle(path, { + create: true, + }); + } + + private encodeName(name: string) { + const illegalChars = /[\\/:*?"<>|]/g; + return name.replace(illegalChars, "ñ"); + } + + private updateLastAccessTime(encodedName: string) { + const now = new Date().getTime().toString(); + localStorage.setItem(encodedName, now); + } +} diff --git a/packages/front/tsconfig.json b/packages/front/tsconfig.json index e118a51f1..207f1065c 100644 --- a/packages/front/tsconfig.json +++ b/packages/front/tsconfig.json @@ -34,4 +34,5 @@ "excludeProtected": true, "excludeReferences": true }, -} \ No newline at end of file +} + From 0d168071f94352ad4dec6bf262d79facc39dfe83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 27 Aug 2024 13:04:09 +0200 Subject: [PATCH 06/51] chore(front): remove old indexeddb files --- .../src/fragments/IfcStreamer/src/index.ts | 2 - .../IfcStreamer/src/streamer-db-cleaner.ts | 64 ------------------- .../fragments/IfcStreamer/src/streamer-db.ts | 35 ---------- 3 files changed, 101 deletions(-) delete mode 100644 packages/front/src/fragments/IfcStreamer/src/streamer-db-cleaner.ts delete mode 100644 packages/front/src/fragments/IfcStreamer/src/streamer-db.ts diff --git a/packages/front/src/fragments/IfcStreamer/src/index.ts b/packages/front/src/fragments/IfcStreamer/src/index.ts index dd4c965bb..46b717482 100644 --- a/packages/front/src/fragments/IfcStreamer/src/index.ts +++ b/packages/front/src/fragments/IfcStreamer/src/index.ts @@ -1,5 +1,3 @@ export * from "./geometry-culler-renderer"; -export * from "./streamer-db"; export * from "./types"; -export * from "./streamer-db-cleaner"; export * from "./streamer-file-db"; diff --git a/packages/front/src/fragments/IfcStreamer/src/streamer-db-cleaner.ts b/packages/front/src/fragments/IfcStreamer/src/streamer-db-cleaner.ts deleted file mode 100644 index 42cdd4c08..000000000 --- a/packages/front/src/fragments/IfcStreamer/src/streamer-db-cleaner.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { StreamFileDatabase } from "./streamer-db"; - -export class StreamerDbCleaner { - interval = 10000; - - maxTime = 60000; - - list = new Map(); - - private _enabled = false; - private _intervalId: number | null = null; - private _fileCache: StreamFileDatabase; - - constructor(fileCache: StreamFileDatabase) { - this._fileCache = fileCache; - } - - get enabled() { - return this._enabled; - } - - set enabled(value: boolean) { - if (this._enabled === value) return; - this._enabled = value; - if (!value) { - if (this._intervalId !== null) { - clearInterval(this._intervalId); - } - this._intervalId = null; - return; - } - this._intervalId = window.setInterval(() => { - const now = new Date().getTime(); - for (const [id, time] of this.list) { - const age = now - time; - if (age > this.maxTime) { - this.clean(id); - } - } - }, this.interval); - } - - update(id: string) { - if (!this.enabled) return; - // console.log(`Added to indexedDB: ${id}`); - this.list.set(id, new Date().getTime()); - } - - async clear() { - for (const [id] of this.list) { - this.clean(id); - } - } - - private clean(id: string) { - try { - this._fileCache.files.delete(id); - // console.log(`Deleted from indexedDB: ${id}`); - } catch (e) { - console.log(`File not found in indexedDB: ${id}`); - } - this.list.delete(id); - } -} diff --git a/packages/front/src/fragments/IfcStreamer/src/streamer-db.ts b/packages/front/src/fragments/IfcStreamer/src/streamer-db.ts deleted file mode 100644 index a39a7940a..000000000 --- a/packages/front/src/fragments/IfcStreamer/src/streamer-db.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Dexie from "dexie"; - -/** - * Interface representing a streamed file. - */ -interface IStreamedFile { - /** - * Unique identifier for the file. - */ - id: string; - - /** - * The file content as a Uint8Array. - */ - file: Uint8Array; -} - -/** - * A class representing a database for storing streamed files. It extends Dexie, a minimalistic wrapper for IndexedDB. - */ -export class StreamFileDatabase extends Dexie { - /** - * Declare implicit table properties. - * (Just to inform Typescript. Instantiated by Dexie in stores() method) - * @type {Dexie.Table} - */ - files!: Dexie.Table; // number = type of the primkey - - constructor() { - super("MyAppDatabase"); - this.version(1).stores({ - files: "id, file", - }); - } -} From 75ffbfa0ddc09e84c6992a3f0bbb40f9e3202392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 28 Aug 2024 14:27:03 +0200 Subject: [PATCH 07/51] feat(front): make streaming url more flexible --- packages/front/package.json | 2 +- .../front/src/fragments/IfcStreamer/index.ts | 32 ++++++++----------- .../IfcStreamer/src/streamer-file-db.ts | 1 - 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index d8d84ae69..93cf5a7e8 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.2", + "version": "2.3.0-alpha.3", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index c4279e0dd..3721c22ec 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -65,8 +65,8 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ useCache = true; - fetch = async (url: string) => { - return fetch(url); + fetch = async (fileName: string) => { + return fetch(this.url + fileName); }; private _culler: GeometryCullerRenderer | null = null; @@ -216,8 +216,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { ) { const { assets, geometries, globalDataFileId } = settings; - const groupUrl = this.url + globalDataFileId; - const groupData = await this.fetch(groupUrl); + const groupData = await this.fetch(globalDataFileId); const groupArrayBuffer = await groupData.arrayBuffer(); const groupBuffer = new Uint8Array(groupArrayBuffer); const fragments = this.components.get(OBC.FragmentsManager); @@ -285,16 +284,16 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { "-properties", ); + FRAG.FragmentsGroup.url = this.url; + group.streamSettings = { - baseUrl: this.url, baseFileName: propertiesFileID, ids, types, }; const { indexesFile } = properties; - const indexURL = this.url + indexesFile; - const fetched = await this.fetch(indexURL); + const fetched = await this.fetch(indexesFile); const rels = await fetched.text(); const indexer = this.components.get(OBC.IfcRelationsIndexer); indexer.setRelationMap(group, indexer.getRelationsMapFromJSON(rels)); @@ -473,40 +472,37 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { const sortedFiles = Array.from(files).sort((a, b) => b[1] - a[1]); - for (const [file] of sortedFiles) { - const url = this.url + file; - + for (const [fileName] of sortedFiles) { // If this file is still in the ram, get it - if (!this._ramCache.has(url)) { + if (!this._ramCache.has(fileName)) { let bytes = new Uint8Array(); // If this file is in the local cache, get it if (this.useCache) { // Add or update this file to clean it up from indexedDB automatically later - // this.dbCleaner.update(url); - const found = await this._fileDB.get(url); + const found = await this._fileDB.get(fileName); if (found) { bytes = found; } else { - const fetched = await this.fetch(url); + const fetched = await this.fetch(fileName); const buffer = await fetched.arrayBuffer(); bytes = new Uint8Array(buffer); - await this._fileDB.add(url, bytes); + await this._fileDB.add(fileName, bytes); } } else { - const fetched = await this.fetch(url); + const fetched = await this.fetch(fileName); const buffer = await fetched.arrayBuffer(); bytes = new Uint8Array(buffer); } const data = this.serializer.import(bytes); - this._ramCache.set(url, { data, time: performance.now() }); + this._ramCache.set(fileName, { data, time: performance.now() }); } - const result = this._ramCache.get(url); + const result = this._ramCache.get(fileName); if (!result) { continue; } diff --git a/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts b/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts index 9f0128861..fedb4ec58 100644 --- a/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts +++ b/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts @@ -97,7 +97,6 @@ export class StreamerFileDb { } for (const name of filesToDelete) { - console.log(`deleted: ${name}`); rootDir.removeEntry(name); } From 15708996cd88372c79e24009e2432b3457842399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 28 Aug 2024 15:55:45 +0200 Subject: [PATCH 08/51] chore: bump version --- packages/core/package.json | 8 ++++---- packages/front/package.json | 10 +++++----- yarn.lock | 36 ++++++++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 3d0deff01..3305e7490 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.1", + "version": "2.3.0-alpha.2", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -37,7 +37,7 @@ "access": "public" }, "devDependencies": { - "@thatopen/fragments": "~2.2.0", + "@thatopen/fragments": "2.3.0-alpha.1", "@thatopen/ui": "~2.2.0", "@types/three": "0.160.0", "stats.js": "^0.17.0", @@ -51,8 +51,8 @@ "three-mesh-bvh": "0.7.0" }, "peerDependencies": { - "@thatopen/fragments": "~2.2.0", + "@thatopen/fragments": "2.3.0-alpha.1", "three": "^0.160.1", "web-ifc": "0.0.57" } -} \ No newline at end of file +} diff --git a/packages/front/package.json b/packages/front/package.json index 93cf5a7e8..79df6cc69 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.3", + "version": "2.3.0-alpha.4", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -33,12 +33,12 @@ "publish-alpha": "npm publish --tag alpha" }, "peerDependencies": { - "@thatopen/fragments": "~2.2.0", + "@thatopen/fragments": "2.3.0-alpha.1", "three": "^0.160.1", "web-ifc": "0.0.57" }, "devDependencies": { - "@thatopen/fragments": "~2.2.0", + "@thatopen/fragments": "2.3.0-alpha.1", "@thatopen/ui": "~2.2.0", "@thatopen/ui-obc": "~2.2.0", "@types/earcut": "^2.1.4", @@ -47,11 +47,11 @@ "web-ifc": "0.0.57" }, "dependencies": { - "@thatopen/components": "~2.2.0", + "@thatopen/components": "2.3.0-alpha.1", "camera-controls": "2.7.3", "dexie": "^4.0.4", "earcut": "^2.2.4", "n8ao": "1.5.1", "postprocessing": "6.34.2" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index f7e082f6b..ecb77fe93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -621,8 +621,8 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components-front@workspace:packages/front" dependencies: - "@thatopen/components": ~2.2.0 - "@thatopen/fragments": ~2.2.0 + "@thatopen/components": 2.3.0-alpha.1 + "@thatopen/fragments": 2.3.0-alpha.1 "@thatopen/ui": ~2.2.0 "@thatopen/ui-obc": ~2.2.0 "@types/earcut": ^2.1.4 @@ -635,17 +635,33 @@ __metadata: three: ^0.160.1 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": ~2.2.0 + "@thatopen/fragments": 2.3.0-alpha.1 three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/components@workspace:packages/core, @thatopen/components@~2.2.0": +"@thatopen/components@npm:2.3.0-alpha.1": + version: 2.3.0-alpha.1 + resolution: "@thatopen/components@npm:2.3.0-alpha.1" + dependencies: + camera-controls: 2.7.3 + fast-xml-parser: 4.4.1 + jszip: 3.10.1 + three-mesh-bvh: 0.7.0 + peerDependencies: + "@thatopen/fragments": ~2.2.0 + three: ^0.160.1 + web-ifc: 0.0.57 + checksum: 00faa025507aacf82be2f9388bb6f65abc3d57565b4d540d4ee7e9a621b3e7bb9983798f83b041d46f59dedadd25627f1a58be112316333f33edc53e329f90b3 + languageName: node + linkType: hard + +"@thatopen/components@workspace:packages/core": version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/core" dependencies: - "@thatopen/fragments": ~2.2.0 + "@thatopen/fragments": 2.3.0-alpha.1 "@thatopen/ui": ~2.2.0 "@types/three": 0.160.0 camera-controls: 2.7.3 @@ -656,21 +672,21 @@ __metadata: three-mesh-bvh: 0.7.0 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": ~2.2.0 + "@thatopen/fragments": 2.3.0-alpha.1 three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/fragments@npm:~2.2.0": - version: 2.2.0 - resolution: "@thatopen/fragments@npm:2.2.0" +"@thatopen/fragments@npm:2.3.0-alpha.1": + version: 2.3.0-alpha.1 + resolution: "@thatopen/fragments@npm:2.3.0-alpha.1" dependencies: flatbuffers: 23.3.3 three-mesh-bvh: 0.7.0 peerDependencies: three: ^0.160.1 - checksum: 06447122b22c460bda4b598be8b2c933ca894e400c9da568b2f1d9adc25907825743fa646f69030ce8c19a043432b75ce619d88557488a18a5eb4dbf5a498922 + checksum: a2263a03cfee1800372e733983417978c344677382574549898a402efa1a40c0387b2d756d40accd2e2bfbd4449d91e314e11791511734344cf380bdf86457a1 languageName: node linkType: hard From 3048618600c112e4fe4cedc5026165e442871ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 28 Aug 2024 17:55:00 +0200 Subject: [PATCH 09/51] fix(core): add guard when getting all properties --- packages/core/package.json | 2 +- packages/core/src/ifc/IfcJsonExporter/index.ts | 10 ++++++++-- packages/front/package.json | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 3305e7490..8aa76ba4f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.2", + "version": "2.3.0-alpha.3", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/core/src/ifc/IfcJsonExporter/index.ts b/packages/core/src/ifc/IfcJsonExporter/index.ts index 1453f6382..349446bc4 100644 --- a/packages/core/src/ifc/IfcJsonExporter/index.ts +++ b/packages/core/src/ifc/IfcJsonExporter/index.ts @@ -68,8 +68,14 @@ export class IfcJsonExporter extends Component { // const allIDs = this._webIfc.GetAllLines(0); for (const id of ids) { - const property = webIfc.GetLine(0, id, recursive, indirect); - properties[property.expressID] = property; + try { + const property = webIfc.GetLine(0, id, recursive, indirect); + properties[property.expressID] = property; + } catch (e) { + console.log( + `Could not get property ${id}, with recursive ${recursive} and indirect ${indirect}.`, + ); + } } } diff --git a/packages/front/package.json b/packages/front/package.json index 79df6cc69..7cb37f9e6 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.4", + "version": "2.3.0-alpha.5", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -38,7 +38,7 @@ "web-ifc": "0.0.57" }, "devDependencies": { - "@thatopen/fragments": "2.3.0-alpha.1", + "@thatopen/fragments": ">=2.3.0-alpha", "@thatopen/ui": "~2.2.0", "@thatopen/ui-obc": "~2.2.0", "@types/earcut": "^2.1.4", @@ -47,7 +47,7 @@ "web-ifc": "0.0.57" }, "dependencies": { - "@thatopen/components": "2.3.0-alpha.1", + "@thatopen/components": ">=2.3.0-alpha", "camera-controls": "2.7.3", "dexie": "^4.0.4", "earcut": "^2.2.4", From 5ae07173c92faef264f71630f7ceaded9f0df876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 28 Aug 2024 18:00:51 +0200 Subject: [PATCH 10/51] chore: bump version --- packages/core/package.json | 2 +- packages/front/package.json | 2 +- ....timestamp-1724860843505-44070dd64b1a1.mjs | 74 +++++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 packages/front/vite.config.ts.timestamp-1724860843505-44070dd64b1a1.mjs diff --git a/packages/core/package.json b/packages/core/package.json index 8aa76ba4f..00d837e2b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.3", + "version": "2.3.0-alpha.4", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/package.json b/packages/front/package.json index 7cb37f9e6..9709a14a9 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.5", + "version": "2.3.0-alpha.6", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/vite.config.ts.timestamp-1724860843505-44070dd64b1a1.mjs b/packages/front/vite.config.ts.timestamp-1724860843505-44070dd64b1a1.mjs new file mode 100644 index 000000000..e0583eb7e --- /dev/null +++ b/packages/front/vite.config.ts.timestamp-1724860843505-44070dd64b1a1.mjs @@ -0,0 +1,74 @@ +// vite.config.ts +import dts from "file:///C:/Users/anton/Desktop/code/engine_components/node_modules/vite-plugin-dts/dist/index.mjs"; +import { defineConfig } from "file:///C:/Users/anton/Desktop/code/engine_components/node_modules/vite/dist/node/index.js"; +import * as path from "path"; +import * as fs from "fs"; + +// package.json +var peerDependencies = { + "@thatopen/fragments": "2.3.0-alpha.1", + three: "^0.160.1", + "web-ifc": "0.0.57" +}; + +// vite.config.ts +var __vite_injected_original_dirname = "C:\\Users\\anton\\Desktop\\code\\engine_components\\packages\\front"; +var clonePackageJSON = () => { + return { + name: "copy-package-json", + async writeBundle() { + if (!fs.existsSync("./dist")) + return; + console.log("Cloning package.json!"); + const packageBuffer = fs.readFileSync("./package.json"); + fs.writeFileSync("./dist/package.json", packageBuffer); + } + }; +}; +var generateTSNamespace = (dts2) => { + if (!fs.existsSync("./dist")) + return; + console.log("Generating namespace!"); + let types = ""; + dts2.forEach((declaration) => { + const cleanedType = declaration.replace(/export\s+\*?\s+from\s+"[^"]+";/g, "").replace(/^\s*[\r\n]/gm, "").replace(/`/g, "'"); + types += cleanedType; + }); + fs.writeFileSync( + "./dist/namespace.d.ts", + `declare namespace OBC { +${types} +}` + ); +}; +var vite_config_default = defineConfig({ + build: { + lib: { + entry: path.resolve(__vite_injected_original_dirname, "./src/index.ts"), + formats: ["es"], + fileName: "index" + }, + rollupOptions: { + external: Object.keys(peerDependencies), + output: { + globals: { + three: "THREE", + "@thatopen/fragments": "FRAGS", + "web-ifc": "WEB-IFC" + } + } + } + }, + plugins: [ + clonePackageJSON(), + dts({ + include: ["./src"], + exclude: ["./src/**/example.ts", "./src/**/*.test.ts"], + afterBuild: generateTSNamespace + }) + ] +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiQzpcXFxcVXNlcnNcXFxcYW50b25cXFxcRGVza3RvcFxcXFxjb2RlXFxcXGVuZ2luZV9jb21wb25lbnRzXFxcXHBhY2thZ2VzXFxcXGZyb250XCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJDOlxcXFxVc2Vyc1xcXFxhbnRvblxcXFxEZXNrdG9wXFxcXGNvZGVcXFxcZW5naW5lX2NvbXBvbmVudHNcXFxccGFja2FnZXNcXFxcZnJvbnRcXFxcdml0ZS5jb25maWcudHNcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfaW1wb3J0X21ldGFfdXJsID0gXCJmaWxlOi8vL0M6L1VzZXJzL2FudG9uL0Rlc2t0b3AvY29kZS9lbmdpbmVfY29tcG9uZW50cy9wYWNrYWdlcy9mcm9udC92aXRlLmNvbmZpZy50c1wiOy8qIGVzbGludC1kaXNhYmxlIGltcG9ydC9uby1leHRyYW5lb3VzLWRlcGVuZGVuY2llcyAqL1xyXG5pbXBvcnQgZHRzIGZyb20gXCJ2aXRlLXBsdWdpbi1kdHNcIjtcclxuaW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSBcInZpdGVcIjtcclxuaW1wb3J0ICogYXMgcGF0aCBmcm9tIFwicGF0aFwiO1xyXG5pbXBvcnQgKiBhcyBmcyBmcm9tIFwiZnNcIjtcclxuaW1wb3J0ICogYXMgcGFja2FnZUpzb24gZnJvbSBcIi4vcGFja2FnZS5qc29uXCI7XHJcblxyXG5jb25zdCBjbG9uZVBhY2thZ2VKU09OID0gKCkgPT4ge1xyXG4gIHJldHVybiB7XHJcbiAgICBuYW1lOiBcImNvcHktcGFja2FnZS1qc29uXCIsXHJcbiAgICBhc3luYyB3cml0ZUJ1bmRsZSgpIHtcclxuICAgICAgaWYgKCFmcy5leGlzdHNTeW5jKFwiLi9kaXN0XCIpKSByZXR1cm47XHJcbiAgICAgIGNvbnNvbGUubG9nKFwiQ2xvbmluZyBwYWNrYWdlLmpzb24hXCIpO1xyXG4gICAgICBjb25zdCBwYWNrYWdlQnVmZmVyID0gZnMucmVhZEZpbGVTeW5jKFwiLi9wYWNrYWdlLmpzb25cIik7XHJcbiAgICAgIGZzLndyaXRlRmlsZVN5bmMoXCIuL2Rpc3QvcGFja2FnZS5qc29uXCIsIHBhY2thZ2VCdWZmZXIpO1xyXG4gICAgfSxcclxuICB9O1xyXG59O1xyXG5cclxuY29uc3QgZ2VuZXJhdGVUU05hbWVzcGFjZSA9IChkdHM6IE1hcDxzdHJpbmcsIHN0cmluZz4pID0+IHtcclxuICBpZiAoIWZzLmV4aXN0c1N5bmMoXCIuL2Rpc3RcIikpIHJldHVybjtcclxuICBjb25zb2xlLmxvZyhcIkdlbmVyYXRpbmcgbmFtZXNwYWNlIVwiKTtcclxuICBsZXQgdHlwZXMgPSBcIlwiO1xyXG4gIGR0cy5mb3JFYWNoKChkZWNsYXJhdGlvbikgPT4ge1xyXG4gICAgY29uc3QgY2xlYW5lZFR5cGUgPSBkZWNsYXJhdGlvblxyXG4gICAgICAucmVwbGFjZSgvZXhwb3J0XFxzK1xcKj9cXHMrZnJvbVxccytcIlteXCJdK1wiOy9nLCBcIlwiKVxyXG4gICAgICAucmVwbGFjZSgvXlxccypbXFxyXFxuXS9nbSwgXCJcIilcclxuICAgICAgLnJlcGxhY2UoL2AvZywgXCInXCIpO1xyXG4gICAgdHlwZXMgKz0gY2xlYW5lZFR5cGU7XHJcbiAgfSk7XHJcbiAgZnMud3JpdGVGaWxlU3luYyhcclxuICAgIFwiLi9kaXN0L25hbWVzcGFjZS5kLnRzXCIsXHJcbiAgICBgZGVjbGFyZSBuYW1lc3BhY2UgT0JDIHtcXG4ke3R5cGVzfVxcbn1gLFxyXG4gICk7XHJcbn07XHJcblxyXG5leHBvcnQgZGVmYXVsdCBkZWZpbmVDb25maWcoe1xyXG4gIGJ1aWxkOiB7XHJcbiAgICBsaWI6IHtcclxuICAgICAgZW50cnk6IHBhdGgucmVzb2x2ZShfX2Rpcm5hbWUsIFwiLi9zcmMvaW5kZXgudHNcIiksXHJcbiAgICAgIGZvcm1hdHM6IFtcImVzXCJdLFxyXG4gICAgICBmaWxlTmFtZTogXCJpbmRleFwiLFxyXG4gICAgfSxcclxuICAgIHJvbGx1cE9wdGlvbnM6IHtcclxuICAgICAgZXh0ZXJuYWw6IE9iamVjdC5rZXlzKHBhY2thZ2VKc29uLnBlZXJEZXBlbmRlbmNpZXMpLFxyXG4gICAgICBvdXRwdXQ6IHtcclxuICAgICAgICBnbG9iYWxzOiB7XHJcbiAgICAgICAgICB0aHJlZTogXCJUSFJFRVwiLFxyXG4gICAgICAgICAgXCJAdGhhdG9wZW4vZnJhZ21lbnRzXCI6IFwiRlJBR1NcIixcclxuICAgICAgICAgIFwid2ViLWlmY1wiOiBcIldFQi1JRkNcIixcclxuICAgICAgICB9LFxyXG4gICAgICB9LFxyXG4gICAgfSxcclxuICB9LFxyXG4gIHBsdWdpbnM6IFtcclxuICAgIGNsb25lUGFja2FnZUpTT04oKSxcclxuICAgIGR0cyh7XHJcbiAgICAgIGluY2x1ZGU6IFtcIi4vc3JjXCJdLFxyXG4gICAgICBleGNsdWRlOiBbXCIuL3NyYy8qKi9leGFtcGxlLnRzXCIsIFwiLi9zcmMvKiovKi50ZXN0LnRzXCJdLFxyXG4gICAgICBhZnRlckJ1aWxkOiBnZW5lcmF0ZVRTTmFtZXNwYWNlLFxyXG4gICAgfSksXHJcbiAgXSxcclxufSk7XHJcbiIsICJ7XHJcbiAgXCJuYW1lXCI6IFwiQHRoYXRvcGVuL2NvbXBvbmVudHMtZnJvbnRcIixcclxuICBcImRlc2NyaXB0aW9uXCI6IFwiQ29sbGVjdGlvbiBvZiBmcm9udGVuZCB0b29scyB0byBhdXRob3IgQklNIGFwcHMuXCIsXHJcbiAgXCJ2ZXJzaW9uXCI6IFwiMi4zLjAtYWxwaGEuNlwiLFxyXG4gIFwiYXV0aG9yXCI6IFwiVGhhdCBPcGVuIENvbXBhbnlcIixcclxuICBcImNvbnRyaWJ1dG9yc1wiOiBbXHJcbiAgICBcIkFudG9uaW8gR29uemFsZXogVmllZ2FzIChodHRwczovL2dpdGh1Yi5jb20vYWd2aWVnYXMpXCIsXHJcbiAgICBcIkp1YW4gSG95b3MgKGh0dHBzOi8vZ2l0aHViLmNvbS9Ib3lvc0p1YW4pXCIsXHJcbiAgICBcIkhhcnJ5IENvbGxpbiAoaHR0cHM6Ly9naXRodWIuY29tL2hhcnJ5Y29sbGluKVwiXHJcbiAgXSxcclxuICBcImxpY2Vuc2VcIjogXCJNSVRcIixcclxuICBcImhvbWVwYWdlXCI6IFwiaHR0cHM6Ly9naXRodWIuY29tL1RoYXRPcGVuL2VuZ2luZV9jb21wb25lbnRzL3RyZWUvbWFpbi9wYWNrYWdlcy9jb21wb25lbnRzLWZyb250I3JlYWRtZVwiLFxyXG4gIFwiYnVnc1wiOiB7XHJcbiAgICBcInVybFwiOiBcImh0dHBzOi8vZ2l0aHViLmNvbS9UaGF0T3Blbi9lbmdpbmVfY29tcG9uZW50cy9pc3N1ZXNcIlxyXG4gIH0sXHJcbiAgXCJ0eXBlXCI6IFwibW9kdWxlXCIsXHJcbiAgXCJtYWluXCI6IFwiZGlzdC9pbmRleC5qc1wiLFxyXG4gIFwidHlwZXNcIjogXCJkaXN0L2luZGV4LmQudHNcIixcclxuICBcImZpbGVzXCI6IFtcclxuICAgIFwiZGlzdFwiXHJcbiAgXSxcclxuICBcInJlcG9zaXRvcnlcIjoge1xyXG4gICAgXCJ0eXBlXCI6IFwiZ2l0XCIsXHJcbiAgICBcInVybFwiOiBcImdpdCtodHRwczovL2dpdGh1Yi5jb20vVGhhdE9wZW4vZW5naW5lX2NvbXBvbmVudHMvdHJlZS9tYWluL3BhY2thZ2VzL2NvbXBvbmVudHMtZnJvbnQuZ2l0XCJcclxuICB9LFxyXG4gIFwicGFja2FnZU1hbmFnZXJcIjogXCJ5YXJuQDMuMi4xXCIsXHJcbiAgXCJzY3JpcHRzXCI6IHtcclxuICAgIFwiZGV2XCI6IFwidml0ZSAtLWhvc3RcIixcclxuICAgIFwidGVzdFwiOiBcImplc3RcIixcclxuICAgIFwiYnVpbGRcIjogXCJ0c2MgLS1wIC4vdHNjb25maWctYnVpbGQuanNvbiAmJiB2aXRlIGJ1aWxkXCIsXHJcbiAgICBcInByZXB1Ymxpc2hPbmx5XCI6IFwieWFybiBidWlsZFwiLFxyXG4gICAgXCJwdWJsaXNoLXJlcG9cIjogXCJucG0gcHVibGlzaFwiLFxyXG4gICAgXCJwdWJsaXNoLWFscGhhXCI6IFwibnBtIHB1Ymxpc2ggLS10YWcgYWxwaGFcIlxyXG4gIH0sXHJcbiAgXCJwZWVyRGVwZW5kZW5jaWVzXCI6IHtcclxuICAgIFwiQHRoYXRvcGVuL2ZyYWdtZW50c1wiOiBcIjIuMy4wLWFscGhhLjFcIixcclxuICAgIFwidGhyZWVcIjogXCJeMC4xNjAuMVwiLFxyXG4gICAgXCJ3ZWItaWZjXCI6IFwiMC4wLjU3XCJcclxuICB9LFxyXG4gIFwiZGV2RGVwZW5kZW5jaWVzXCI6IHtcclxuICAgIFwiQHRoYXRvcGVuL2ZyYWdtZW50c1wiOiBcIj49Mi4zLjAtYWxwaGFcIixcclxuICAgIFwiQHRoYXRvcGVuL3VpXCI6IFwifjIuMi4wXCIsXHJcbiAgICBcIkB0aGF0b3Blbi91aS1vYmNcIjogXCJ+Mi4yLjBcIixcclxuICAgIFwiQHR5cGVzL2VhcmN1dFwiOiBcIl4yLjEuNFwiLFxyXG4gICAgXCJAdHlwZXMvdGhyZWVcIjogXCJeMC4xNjAuMFwiLFxyXG4gICAgXCJ0aHJlZVwiOiBcIl4wLjE2MC4xXCIsXHJcbiAgICBcIndlYi1pZmNcIjogXCIwLjAuNTdcIlxyXG4gIH0sXHJcbiAgXCJkZXBlbmRlbmNpZXNcIjoge1xyXG4gICAgXCJAdGhhdG9wZW4vY29tcG9uZW50c1wiOiBcIj49Mi4zLjAtYWxwaGFcIixcclxuICAgIFwiY2FtZXJhLWNvbnRyb2xzXCI6IFwiMi43LjNcIixcclxuICAgIFwiZGV4aWVcIjogXCJeNC4wLjRcIixcclxuICAgIFwiZWFyY3V0XCI6IFwiXjIuMi40XCIsXHJcbiAgICBcIm44YW9cIjogXCIxLjUuMVwiLFxyXG4gICAgXCJwb3N0cHJvY2Vzc2luZ1wiOiBcIjYuMzQuMlwiXHJcbiAgfVxyXG59XHJcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFDQSxPQUFPLFNBQVM7QUFDaEIsU0FBUyxvQkFBb0I7QUFDN0IsWUFBWSxVQUFVO0FBQ3RCLFlBQVksUUFBUTs7O0FDOEJsQix1QkFBb0I7QUFBQSxFQUNsQix1QkFBdUI7QUFBQSxFQUN2QixPQUFTO0FBQUEsRUFDVCxXQUFXO0FBQ2I7OztBRHRDRixJQUFNLG1DQUFtQztBQU96QyxJQUFNLG1CQUFtQixNQUFNO0FBQzdCLFNBQU87QUFBQSxJQUNMLE1BQU07QUFBQSxJQUNOLE1BQU0sY0FBYztBQUNsQixVQUFJLENBQUksY0FBVyxRQUFRO0FBQUc7QUFDOUIsY0FBUSxJQUFJLHVCQUF1QjtBQUNuQyxZQUFNLGdCQUFtQixnQkFBYSxnQkFBZ0I7QUFDdEQsTUFBRyxpQkFBYyx1QkFBdUIsYUFBYTtBQUFBLElBQ3ZEO0FBQUEsRUFDRjtBQUNGO0FBRUEsSUFBTSxzQkFBc0IsQ0FBQ0EsU0FBNkI7QUFDeEQsTUFBSSxDQUFJLGNBQVcsUUFBUTtBQUFHO0FBQzlCLFVBQVEsSUFBSSx1QkFBdUI7QUFDbkMsTUFBSSxRQUFRO0FBQ1osRUFBQUEsS0FBSSxRQUFRLENBQUMsZ0JBQWdCO0FBQzNCLFVBQU0sY0FBYyxZQUNqQixRQUFRLG1DQUFtQyxFQUFFLEVBQzdDLFFBQVEsZ0JBQWdCLEVBQUUsRUFDMUIsUUFBUSxNQUFNLEdBQUc7QUFDcEIsYUFBUztBQUFBLEVBQ1gsQ0FBQztBQUNELEVBQUc7QUFBQSxJQUNEO0FBQUEsSUFDQTtBQUFBLEVBQTRCLEtBQUs7QUFBQTtBQUFBLEVBQ25DO0FBQ0Y7QUFFQSxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUMxQixPQUFPO0FBQUEsSUFDTCxLQUFLO0FBQUEsTUFDSCxPQUFZLGFBQVEsa0NBQVcsZ0JBQWdCO0FBQUEsTUFDL0MsU0FBUyxDQUFDLElBQUk7QUFBQSxNQUNkLFVBQVU7QUFBQSxJQUNaO0FBQUEsSUFDQSxlQUFlO0FBQUEsTUFDYixVQUFVLE9BQU8sS0FBaUIsZ0JBQWdCO0FBQUEsTUFDbEQsUUFBUTtBQUFBLFFBQ04sU0FBUztBQUFBLFVBQ1AsT0FBTztBQUFBLFVBQ1AsdUJBQXVCO0FBQUEsVUFDdkIsV0FBVztBQUFBLFFBQ2I7QUFBQSxNQUNGO0FBQUEsSUFDRjtBQUFBLEVBQ0Y7QUFBQSxFQUNBLFNBQVM7QUFBQSxJQUNQLGlCQUFpQjtBQUFBLElBQ2pCLElBQUk7QUFBQSxNQUNGLFNBQVMsQ0FBQyxPQUFPO0FBQUEsTUFDakIsU0FBUyxDQUFDLHVCQUF1QixvQkFBb0I7QUFBQSxNQUNyRCxZQUFZO0FBQUEsSUFDZCxDQUFDO0FBQUEsRUFDSDtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbImR0cyJdCn0K From 7b24223a55172eea7221bc2c8e3dfb346516e109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 29 Aug 2024 10:08:33 +0200 Subject: [PATCH 11/51] feat(front): support file as tile response type --- packages/front/package.json | 2 +- packages/front/src/fragments/IfcStreamer/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index 9709a14a9..3275ef742 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.6", + "version": "2.3.0-alpha.7", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index 3721c22ec..b437b16b2 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -65,7 +65,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ useCache = true; - fetch = async (fileName: string) => { + fetch = async (fileName: string): Promise => { return fetch(this.url + fileName); }; From 2d93ec83362b9550718971d21d89214410eb2f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 29 Aug 2024 10:11:35 +0200 Subject: [PATCH 12/51] chore: update fragment dependency version --- packages/core/package.json | 6 +++--- packages/front/package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 00d837e2b..920c291b7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.4", + "version": "2.3.0-alpha.5", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -37,7 +37,7 @@ "access": "public" }, "devDependencies": { - "@thatopen/fragments": "2.3.0-alpha.1", + "@thatopen/fragments": ">=2.3.0-alpha", "@thatopen/ui": "~2.2.0", "@types/three": "0.160.0", "stats.js": "^0.17.0", @@ -51,7 +51,7 @@ "three-mesh-bvh": "0.7.0" }, "peerDependencies": { - "@thatopen/fragments": "2.3.0-alpha.1", + "@thatopen/fragments": ">=2.3.0-alpha", "three": "^0.160.1", "web-ifc": "0.0.57" } diff --git a/packages/front/package.json b/packages/front/package.json index 3275ef742..3c155e293 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.7", + "version": "2.3.0-alpha.8", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -33,7 +33,7 @@ "publish-alpha": "npm publish --tag alpha" }, "peerDependencies": { - "@thatopen/fragments": "2.3.0-alpha.1", + "@thatopen/fragments": ">=2.3.0-alpha", "three": "^0.160.1", "web-ifc": "0.0.57" }, From 5bed53b7a947b39765b77b7020fbfdd96f2d7d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 29 Aug 2024 11:32:54 +0200 Subject: [PATCH 13/51] fix(front): prevent URL from being null --- packages/front/package.json | 2 +- packages/front/src/fragments/IfcStreamer/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index 3c155e293..ecfd6b063 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.8", + "version": "2.3.0-alpha.9", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index b437b16b2..2e59c6cc0 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -80,7 +80,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { private _fileDB = new StreamerFileDb(); - private _url: string | null = null; + private _url: string = ""; private _isDisposing = false; From 8be541e5707b4bb7ea463fd780afa8b94b7a43e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 29 Aug 2024 11:38:37 +0200 Subject: [PATCH 14/51] fix(front): remove url setter and getter --- packages/front/package.json | 2 +- .../front/src/fragments/IfcStreamer/index.ts | 26 ++++--------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index ecfd6b063..99745d548 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.9", + "version": "2.3.0-alpha.10", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index 2e59c6cc0..cf3b2dbc2 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -80,7 +80,11 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { private _fileDB = new StreamerFileDb(); - private _url: string = ""; + /** + * The URL of the data source for the streaming service. + * It should be set before using the streaming service. Alternatively, you can use a custom fetch function. + */ + private url: string = ""; private _isDisposing = false; @@ -104,26 +108,6 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { opacity: 0.5, }); - /** - * The URL of the data source for the streaming service. - * It must be set before using the streaming service. - * If not set, an error will be thrown when trying to access the URL. - */ - get url() { - if (!this._url) { - throw new Error("url must be set before using the streaming service!"); - } - return this._url; - } - - /** - * Sets the URL of the data source for the streaming service. - * @param value - The new URL to be set. - */ - set url(value: string) { - this._url = value; - } - /** * The world in which the fragments will be displayed. * It must be set before using the streaming service. From f9b8b4e351da462eb76243a4037393a8463d8adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 29 Aug 2024 14:54:56 +0200 Subject: [PATCH 15/51] feat(front): implement fragment load cancel --- packages/front/package.json | 2 +- .../front/src/fragments/IfcStreamer/index.ts | 50 ++++++++++++++++++- .../src/geometry-culler-renderer.ts | 26 +++++++++- yarn.lock | 36 ++++--------- 4 files changed, 84 insertions(+), 30 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index 99745d548..960e1354c 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.10", + "version": "2.3.0-alpha.11", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index cf3b2dbc2..5e9bc6fda 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -65,6 +65,11 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ useCache = true; + /** + * Flag to cancel the files that are being currently loaded. + */ + cancel = false; + fetch = async (fileName: string): Promise => { return fetch(this.url + fileName); }; @@ -422,8 +427,28 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { }, visible = true, ) { + this.cancel = false; + + const cancelled: { [modelID: string]: Set } = {}; + for (const modelID in seen) { + const idsOfModel = new Set(); + for (const [, ids] of seen[modelID]) { + for (const id of ids) { + idsOfModel.add(id); + } + } + cancelled[modelID] = idsOfModel; + } + for (const modelID in seen) { - if (this._isDisposing) return; + if (this._isDisposing) { + return; + } + + if (this.cancel) { + this.cancelLoading(cancelled); + return; + } const fragments = this.components.get(OBC.FragmentsManager); const group = fragments.groups.get(modelID); @@ -441,6 +466,11 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { for (const [priority, ids] of seen[modelID]) { for (const id of ids) { + if (this.cancel) { + this.cancelLoading(cancelled); + return; + } + allIDs.add(id); const geometry = geometries[id]; if (!geometry) { @@ -449,6 +479,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { if (geometry.geometryFile) { const file = geometry.geometryFile; const value = files.get(file) || 0; + // This adds up the pixels of all fragments in a file to determine its priority files.set(file, value + priority); } } @@ -497,7 +528,17 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { if (result) { for (const [geometryID, { position, index, normal }] of result.data) { - if (this._isDisposing) return; + if (this._isDisposing) { + return; + } + + if (this.cancel) { + this.cancelLoading(cancelled); + return; + } + + // This fragment can be cancelled, it will be loaded + cancelled[modelID].delete(geometryID); if (!allIDs.has(geometryID)) continue; @@ -759,4 +800,9 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { this._isDisposing = false; }; + + private cancelLoading(items: { [modelID: string]: Set }) { + this.cancel = false; + this.culler.cancel(items); + } } diff --git a/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts b/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts index 0a1d53a3d..715a6170a 100644 --- a/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts +++ b/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts @@ -516,6 +516,31 @@ export class GeometryCullerRenderer extends OBC.CullerRenderer { } } + cancel(items: { [modelID: string]: Set }) { + for (const modelID in items) { + const modelIndex = this._modelIDIndex.get(modelID); + if (modelIndex === undefined) { + throw new Error("Model not found."); + } + const map = this.codes.get(modelIndex); + if (map === undefined) { + throw new Error("Codes not found."); + } + for (const id of items[modelID]) { + const colorCode = map.get(id); + if (colorCode === undefined) { + throw new Error("Color code not found."); + } + this._geometriesInMemory.delete(colorCode); + const found = this._geometries.get(colorCode); + if (!found) { + throw new Error("Geometry not found."); + } + found.exists = false; + } + } + } + private setGeometryVisibility( geometry: CullerBoundingBox, visible: boolean, @@ -545,7 +570,6 @@ export class GeometryCullerRenderer extends OBC.CullerRenderer { const colors = event.data.colors as Map; const toLoad: { [modelID: string]: Map> } = {}; - const toRemove: { [modelID: string]: Set } = {}; const toHide: { [modelID: string]: Set } = {}; const toShow: { [modelID: string]: Set } = {}; diff --git a/yarn.lock b/yarn.lock index ecb77fe93..dcf4855f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -621,8 +621,8 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components-front@workspace:packages/front" dependencies: - "@thatopen/components": 2.3.0-alpha.1 - "@thatopen/fragments": 2.3.0-alpha.1 + "@thatopen/components": ">=2.3.0-alpha" + "@thatopen/fragments": ">=2.3.0-alpha" "@thatopen/ui": ~2.2.0 "@thatopen/ui-obc": ~2.2.0 "@types/earcut": ^2.1.4 @@ -635,33 +635,17 @@ __metadata: three: ^0.160.1 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": 2.3.0-alpha.1 + "@thatopen/fragments": ">=2.3.0-alpha" three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/components@npm:2.3.0-alpha.1": - version: 2.3.0-alpha.1 - resolution: "@thatopen/components@npm:2.3.0-alpha.1" - dependencies: - camera-controls: 2.7.3 - fast-xml-parser: 4.4.1 - jszip: 3.10.1 - three-mesh-bvh: 0.7.0 - peerDependencies: - "@thatopen/fragments": ~2.2.0 - three: ^0.160.1 - web-ifc: 0.0.57 - checksum: 00faa025507aacf82be2f9388bb6f65abc3d57565b4d540d4ee7e9a621b3e7bb9983798f83b041d46f59dedadd25627f1a58be112316333f33edc53e329f90b3 - languageName: node - linkType: hard - -"@thatopen/components@workspace:packages/core": +"@thatopen/components@>=2.3.0-alpha, @thatopen/components@workspace:packages/core": version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/core" dependencies: - "@thatopen/fragments": 2.3.0-alpha.1 + "@thatopen/fragments": ">=2.3.0-alpha" "@thatopen/ui": ~2.2.0 "@types/three": 0.160.0 camera-controls: 2.7.3 @@ -672,21 +656,21 @@ __metadata: three-mesh-bvh: 0.7.0 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": 2.3.0-alpha.1 + "@thatopen/fragments": ">=2.3.0-alpha" three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/fragments@npm:2.3.0-alpha.1": - version: 2.3.0-alpha.1 - resolution: "@thatopen/fragments@npm:2.3.0-alpha.1" +"@thatopen/fragments@npm:>=2.3.0-alpha": + version: 2.3.0-alpha.2 + resolution: "@thatopen/fragments@npm:2.3.0-alpha.2" dependencies: flatbuffers: 23.3.3 three-mesh-bvh: 0.7.0 peerDependencies: three: ^0.160.1 - checksum: a2263a03cfee1800372e733983417978c344677382574549898a402efa1a40c0387b2d756d40accd2e2bfbd4449d91e314e11791511734344cf380bdf86457a1 + checksum: 537887ffe869e0618c50f668c8513d91b3605810e7ed1355e9cf6ca3c83154e823b8461bc0d90ad72c011f4645689963b9e052f76f746663dc547e5374937832 languageName: node linkType: hard From 2796114aa35a425a045f6a2253c682943fbfc634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Fri, 30 Aug 2024 16:58:09 +0200 Subject: [PATCH 16/51] fix(front): make streamer url public --- packages/front/package.json | 2 +- packages/front/src/fragments/IfcStreamer/index.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index 960e1354c..75cdb7c46 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.11", + "version": "2.3.0-alpha.12", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index 5e9bc6fda..d51882a74 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -70,6 +70,12 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ cancel = false; + /** + * The URL of the data source for the streaming service. + * It should be set before using the streaming service. Alternatively, you can use a custom fetch function. + */ + url: string = ""; + fetch = async (fileName: string): Promise => { return fetch(this.url + fileName); }; @@ -85,12 +91,6 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { private _fileDB = new StreamerFileDb(); - /** - * The URL of the data source for the streaming service. - * It should be set before using the streaming service. Alternatively, you can use a custom fetch function. - */ - private url: string = ""; - private _isDisposing = false; private _geometryInstances: { From a523c0142a746d189736fd750717289b43f4254a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Fri, 30 Aug 2024 23:19:15 +0200 Subject: [PATCH 17/51] feat(front): make streamer file cacher public --- packages/front/package.json | 2 +- .../front/src/fragments/IfcStreamer/index.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/front/package.json b/packages/front/package.json index 75cdb7c46..78089b23c 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.12", + "version": "2.3.0-alpha.13", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index d51882a74..d9e41309a 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -76,10 +76,19 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { */ url: string = ""; + /** + * Function used to retrieve tiles. Can be overriden to work with specific backends. + */ fetch = async (fileName: string): Promise => { return fetch(this.url + fileName); }; + + /** + * Cache system that uses the File System API. + */ + fileDB = new StreamerFileDb(); + private _culler: GeometryCullerRenderer | null = null; private _world: OBC.World | null = null; @@ -89,7 +98,6 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { { data: FRAG.StreamedGeometries; time: number } >(); - private _fileDB = new StreamerFileDb(); private _isDisposing = false; @@ -376,7 +384,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { * @returns A Promise that resolves when the cache is cleared. */ async clearCache() { - await this._fileDB.clear(); + await this.fileDB.clear(); } /** @@ -497,7 +505,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { if (this.useCache) { // Add or update this file to clean it up from indexedDB automatically later - const found = await this._fileDB.get(fileName); + const found = await this.fileDB.get(fileName); if (found) { bytes = found; @@ -505,7 +513,7 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { const fetched = await this.fetch(fileName); const buffer = await fetched.arrayBuffer(); bytes = new Uint8Array(buffer); - await this._fileDB.add(fileName, bytes); + await this.fileDB.add(fileName, bytes); } } else { const fetched = await this.fetch(fileName); From 468d42528d77f77ca01ddfe7b3953cb029a063f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 31 Aug 2024 17:23:10 +0200 Subject: [PATCH 18/51] feat(core): clean up config manager --- .../core/src/core/Types/src/config-manager.ts | 93 ++++++++++++++++--- .../core/Viewpoints/src/viewpoints-config.ts | 6 +- .../core/Worlds/src/simple-scene-config.ts | 12 +-- .../BCFTopics/src/bcf-topics-config.ts | 60 ++++++------ 4 files changed, 122 insertions(+), 49 deletions(-) diff --git a/packages/core/src/core/Types/src/config-manager.ts b/packages/core/src/core/Types/src/config-manager.ts index 0ae750c25..cda0cdf8e 100644 --- a/packages/core/src/core/Types/src/config-manager.ts +++ b/packages/core/src/core/Types/src/config-manager.ts @@ -26,18 +26,13 @@ export interface NumberSettingControl { export interface SelectSettingControl { type: "Select"; + multiple: boolean; options: Set; value: string; } -export interface MultiSelectSettingControl { - type: "MultiSelect"; - options: Set; - value: Set; -} - export interface Vector3SettingControl { - type: "Vector"; + type: "Vector3"; value: THREE.Vector3; } @@ -46,6 +41,11 @@ export interface TextSetSettingControl { value: Set; } +export interface NoControl { + type: "None"; + value: any; +} + type ControlEntry = | BooleanSettingsControl | ColorSettingsControl @@ -54,22 +54,93 @@ type ControlEntry = | SelectSettingControl | Vector3SettingControl | TextSetSettingControl - | MultiSelectSettingControl; + | NoControl; interface ControlsSchema { [name: string]: ControlEntry | ControlsSchema; } export abstract class ConfigManager { - protected abstract _list: U; + protected abstract _config: U; protected _component: T; - get controls() { - return JSON.parse(JSON.stringify(this._list)); + get controls(): U { + const copy: any = {}; + for (const name in this._config) { + const entry = this._config[name] as ControlEntry; + copy[name] = this.copyEntry(entry); + } + return copy as U; } constructor(component: T) { this._component = component; } + + copyEntry(controlEntry: ControlEntry): ControlEntry { + if (controlEntry.type === "Boolean") { + const entry = controlEntry as BooleanSettingsControl; + return { + type: entry.type, + value: entry.value, + }; + } + if (controlEntry.type === "Color") { + const entry = controlEntry as ColorSettingsControl; + return { + type: entry.type, + opacity: entry.opacity, + value: entry.value.clone(), + }; + } + if (controlEntry.type === "Text") { + const entry = controlEntry as TextSettingsControl; + return { + type: entry.type, + value: entry.value, + }; + } + if (controlEntry.type === "Number") { + const entry = controlEntry as NumberSettingControl; + return { + type: entry.type, + value: entry.value, + min: entry.min, + max: entry.max, + interpolable: entry.interpolable, + }; + } + if (controlEntry.type === "Select") { + const entry = controlEntry as SelectSettingControl; + return { + type: entry.type, + value: entry.value, + multiple: entry.multiple, + options: new Set(entry.options), + }; + } + if (controlEntry.type === "Vector3") { + const entry = controlEntry as Vector3SettingControl; + return { + type: entry.type, + value: entry.value.clone(), + }; + } + if (controlEntry.type === "TextSet") { + const entry = controlEntry as TextSetSettingControl; + return { + type: entry.type, + value: new Set(entry.value), + }; + } + if (controlEntry.type === "None") { + const entry = controlEntry as NoControl; + return { + type: entry.type, + value: entry.value, + }; + } + throw new Error("Invalid entry!"); + } } diff --git a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts index b1b4ef9f4..2d8d5a5ce 100644 --- a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts +++ b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts @@ -21,7 +21,7 @@ export class ViewpointsConfigManger extends ConfigManager< Viewpoints, ViewpointsConfigType > { - protected _list = { + protected _config = { overwriteColors: { value: false, opacity: 1, @@ -30,10 +30,10 @@ export class ViewpointsConfigManger extends ConfigManager< }; get overwriteColors() { - return this._list.overwriteColors.value; + return this._config.overwriteColors.value; } set overwriteColors(value: boolean) { - this._list.overwriteColors.value = value; + this._config.overwriteColors.value = value; } } diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts index 086d23108..2e3f5e2c5 100644 --- a/packages/core/src/core/Worlds/src/simple-scene-config.ts +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -116,7 +116,7 @@ export class SimpleSceneConfigManager extends ConfigManager< SimpleScene, SimpleSceneConfigType > { - protected _list = { + protected _config = { backgroundColor: { value: new THREE.Color() as THREE.Color, opacity: 1, @@ -146,22 +146,22 @@ export class SimpleSceneConfigManager extends ConfigManager< value: 2, }, position: { - type: "Vector" as const, + type: "Vector3" as const, value: new THREE.Vector3(), }, }, }; - ambientLight = new AmbientLightConfig(this._list, this._component); + ambientLight = new AmbientLightConfig(this._config, this._component); - directionalLight = new DirectionalLightConfig(this._list, this._component); + directionalLight = new DirectionalLightConfig(this._config, this._component); get backgroundColor() { - return this._list.backgroundColor.value; + return this._config.backgroundColor.value; } set backgroundColor(value: THREE.Color) { - this._list.backgroundColor.value = value; + this._config.backgroundColor.value = value; this._component.three.background = value; } } diff --git a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts index 9ac957e8d..45cfb0cec 100644 --- a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts +++ b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts @@ -114,10 +114,11 @@ export class BCFTopicsConfigManager extends ConfigManager< BCFTopics, BCFTopicsConfigType > { - protected _list = { + protected _config = { version: { type: "Select" as const, options: new Set(), + multiple: false, value: "", }, author: { @@ -166,6 +167,7 @@ export class BCFTopicsConfigManager extends ConfigManager< }, fallbackVersionOnImport: { type: "Select" as const, + multiple: false, options: new Set(), value: "", }, @@ -176,113 +178,113 @@ export class BCFTopicsConfigManager extends ConfigManager< }; get version() { - return this._list.version.value; + return this._config.version.value; } set version(value) { - this._list.version.value = value; + this._config.version.value = value; } get author() { - return this._list.author.value; + return this._config.author.value; } set author(value) { - this._list.author.value = value; + this._config.author.value = value; } get types() { - return this._list.types.value; + return this._config.types.value; } set types(value) { - this._list.types.value = value; + this._config.types.value = value; } get statuses() { - return this._list.statuses.value; + return this._config.statuses.value; } set statuses(value) { - this._list.statuses.value = value; + this._config.statuses.value = value; } get priorities() { - return this._list.priorities.value; + return this._config.priorities.value; } set priorities(value) { - this._list.priorities.value = value; + this._config.priorities.value = value; } get labels() { - return this._list.labels.value; + return this._config.labels.value; } set labels(value) { - this._list.labels.value = value; + this._config.labels.value = value; } get stages() { - return this._list.stages.value; + return this._config.stages.value; } set stages(value) { - this._list.stages.value = value; + this._config.stages.value = value; } get users() { - return this._list.users.value; + return this._config.users.value; } set users(value) { - this._list.users.value = value; + this._config.users.value = value; } get includeSelectionTag() { - return this._list.includeSelectionTag.value; + return this._config.includeSelectionTag.value; } set includeSelectionTag(value) { - this._list.includeSelectionTag.value = value; + this._config.includeSelectionTag.value = value; } get updateExtensionsOnImport() { - return this._list.updateExtensionsOnImport.value; + return this._config.updateExtensionsOnImport.value; } set updateExtensionsOnImport(value) { - this._list.updateExtensionsOnImport.value = value; + this._config.updateExtensionsOnImport.value = value; } get strict() { - return this._list.strict.value; + return this._config.strict.value; } set strict(value) { - this._list.strict.value = value; + this._config.strict.value = value; } get includeAllExtensionsOnExport() { - return this._list.includeAllExtensionsOnExport.value; + return this._config.includeAllExtensionsOnExport.value; } set includeAllExtensionsOnExport(value) { - this._list.includeAllExtensionsOnExport.value = value; + this._config.includeAllExtensionsOnExport.value = value; } get fallbackVersionOnImport() { - return this._list.fallbackVersionOnImport.value; + return this._config.fallbackVersionOnImport.value; } set fallbackVersionOnImport(value) { - this._list.fallbackVersionOnImport.value = value; + this._config.fallbackVersionOnImport.value = value; } get ignoreIncompleteTopicsOnImport() { - return this._list.ignoreIncompleteTopicsOnImport.value; + return this._config.ignoreIncompleteTopicsOnImport.value; } set ignoreIncompleteTopicsOnImport(value) { - this._list.ignoreIncompleteTopicsOnImport.value = value; + this._config.ignoreIncompleteTopicsOnImport.value = value; } } From df3350d5a1bd6e05c662179e9af4d68e8e8a7bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 31 Aug 2024 17:57:21 +0200 Subject: [PATCH 19/51] feat(core): centralize configuration in component --- packages/core/src/core/ConfigManager/index.ts | 26 ++++++ .../src/configurator.ts} | 84 +++++-------------- .../core/src/core/ConfigManager/src/index.ts | 1 + .../core/src/core/Types/src/config-types.ts | 61 ++++++++++++++ packages/core/src/core/Types/src/index.ts | 2 +- packages/core/src/core/Viewpoints/index.ts | 8 +- .../core/Viewpoints/src/viewpoints-config.ts | 5 +- .../core/Worlds/src/simple-scene-config.ts | 4 +- .../core/src/core/Worlds/src/simple-scene.ts | 2 +- packages/core/src/core/index.ts | 1 + packages/core/src/openbim/BCFTopics/index.ts | 2 +- .../BCFTopics/src/bcf-topics-config.ts | 4 +- 12 files changed, 125 insertions(+), 75 deletions(-) create mode 100644 packages/core/src/core/ConfigManager/index.ts rename packages/core/src/core/{Types/src/config-manager.ts => ConfigManager/src/configurator.ts} (64%) create mode 100644 packages/core/src/core/ConfigManager/src/index.ts create mode 100644 packages/core/src/core/Types/src/config-types.ts diff --git a/packages/core/src/core/ConfigManager/index.ts b/packages/core/src/core/ConfigManager/index.ts new file mode 100644 index 000000000..41d73b58f --- /dev/null +++ b/packages/core/src/core/ConfigManager/index.ts @@ -0,0 +1,26 @@ +import { Component } from "../Types"; +import { Components } from "../Components"; +import { Configurator } from "./src"; + +export * from "./src"; + +/** + * A tool to manage all the configuration from the app centrally. + */ +export class ConfigManager extends Component { + list = new Set>(); + + /** {@link Component.enabled} */ + enabled = true; + + /** + * A unique identifier for the component. + * This UUID is used to register the component within the Components system. + */ + static readonly uuid = "dc86e7e9-a8fd-5473-9ef6-724c67fecb0f" as const; + + constructor(components: Components) { + super(components); + components.add(ConfigManager.uuid, this); + } +} diff --git a/packages/core/src/core/Types/src/config-manager.ts b/packages/core/src/core/ConfigManager/src/configurator.ts similarity index 64% rename from packages/core/src/core/Types/src/config-manager.ts rename to packages/core/src/core/ConfigManager/src/configurator.ts index cda0cdf8e..f8bb4590d 100644 --- a/packages/core/src/core/Types/src/config-manager.ts +++ b/packages/core/src/core/ConfigManager/src/configurator.ts @@ -1,70 +1,25 @@ -import * as THREE from "three"; +import { + ControlsSchema, + ControlEntry, + BooleanSettingsControl, + ColorSettingsControl, + TextSettingsControl, + NumberSettingControl, + SelectSettingControl, + Vector3SettingControl, + TextSetSettingControl, + NoControl, +} from "../../Types"; +import { Components } from "../../Components"; +import { ConfigManager } from "../index"; -export interface BooleanSettingsControl { - type: "Boolean"; - value: boolean; -} - -export interface ColorSettingsControl { - type: "Color"; - opacity: number; - value: THREE.Color; -} - -export interface TextSettingsControl { - type: "Text"; - value: string; -} - -export interface NumberSettingControl { - type: "Number"; - interpolable: boolean; - min?: number; - max?: number; - value: number; -} - -export interface SelectSettingControl { - type: "Select"; - multiple: boolean; - options: Set; - value: string; -} - -export interface Vector3SettingControl { - type: "Vector3"; - value: THREE.Vector3; -} - -export interface TextSetSettingControl { - type: "TextSet"; - value: Set; -} - -export interface NoControl { - type: "None"; - value: any; -} - -type ControlEntry = - | BooleanSettingsControl - | ColorSettingsControl - | TextSettingsControl - | NumberSettingControl - | SelectSettingControl - | Vector3SettingControl - | TextSetSettingControl - | NoControl; - -interface ControlsSchema { - [name: string]: ControlEntry | ControlsSchema; -} - -export abstract class ConfigManager { +export abstract class Configurator { protected abstract _config: U; protected _component: T; + name: string; + get controls(): U { const copy: any = {}; for (const name in this._config) { @@ -74,8 +29,11 @@ export abstract class ConfigManager { return copy as U; } - constructor(component: T) { + constructor(component: T, components: Components, name: string) { this._component = component; + this.name = name; + const configManager = components.get(ConfigManager); + configManager.list.add(this); } copyEntry(controlEntry: ControlEntry): ControlEntry { diff --git a/packages/core/src/core/ConfigManager/src/index.ts b/packages/core/src/core/ConfigManager/src/index.ts new file mode 100644 index 000000000..2a508ef50 --- /dev/null +++ b/packages/core/src/core/ConfigManager/src/index.ts @@ -0,0 +1 @@ +export * from "./configurator"; diff --git a/packages/core/src/core/Types/src/config-types.ts b/packages/core/src/core/Types/src/config-types.ts new file mode 100644 index 000000000..fa4cfad10 --- /dev/null +++ b/packages/core/src/core/Types/src/config-types.ts @@ -0,0 +1,61 @@ +import * as THREE from "three"; + +export interface BooleanSettingsControl { + type: "Boolean"; + value: boolean; +} + +export interface ColorSettingsControl { + type: "Color"; + opacity: number; + value: THREE.Color; +} + +export interface TextSettingsControl { + type: "Text"; + value: string; +} + +export interface NumberSettingControl { + type: "Number"; + interpolable: boolean; + min?: number; + max?: number; + value: number; +} + +export interface SelectSettingControl { + type: "Select"; + multiple: boolean; + options: Set; + value: string; +} + +export interface Vector3SettingControl { + type: "Vector3"; + value: THREE.Vector3; +} + +export interface TextSetSettingControl { + type: "TextSet"; + value: Set; +} + +export interface NoControl { + type: "None"; + value: any; +} + +export type ControlEntry = + | BooleanSettingsControl + | ColorSettingsControl + | TextSettingsControl + | NumberSettingControl + | SelectSettingControl + | Vector3SettingControl + | TextSetSettingControl + | NoControl; + +export interface ControlsSchema { + [name: string]: ControlEntry | ControlsSchema; +} diff --git a/packages/core/src/core/Types/src/index.ts b/packages/core/src/core/Types/src/index.ts index 7d667d1bf..b317be95b 100644 --- a/packages/core/src/core/Types/src/index.ts +++ b/packages/core/src/core/Types/src/index.ts @@ -11,4 +11,4 @@ export * from "./world"; export * from "./data-set"; export * from "./data-map"; export * from "./component-with-ui"; -export * from "./config-manager"; +export * from "./config-types"; diff --git a/packages/core/src/core/Viewpoints/index.ts b/packages/core/src/core/Viewpoints/index.ts index 0ea987dc0..ad95635da 100644 --- a/packages/core/src/core/Viewpoints/index.ts +++ b/packages/core/src/core/Viewpoints/index.ts @@ -9,7 +9,7 @@ import { import { Components } from "../Components"; import { BCFViewpoint, Viewpoint } from "./src"; import { - ViewpointsConfigManger, + ViewpointsConfigManager, ViewpointsConfig, } from "./src/viewpoints-config"; @@ -17,7 +17,9 @@ export * from "./src"; export class Viewpoints extends Component - implements Disposable, Configurable + implements + Disposable, + Configurable { static readonly uuid = "ee867824-a796-408d-8aa0-4e5962a83c66" as const; @@ -54,7 +56,7 @@ export class Viewpoints onSetup = new Event(); - config = new ViewpointsConfigManger(this); + config = new ViewpointsConfigManager(this, this.components, "Viewpoints"); readonly onDisposed = new Event(); diff --git a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts index 2d8d5a5ce..4792f5fd7 100644 --- a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts +++ b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts @@ -1,5 +1,6 @@ -import { BooleanSettingsControl, ConfigManager } from "../../Types"; +import { BooleanSettingsControl } from "../../Types"; import { Viewpoints } from "../index"; +import { Configurator } from "../../ConfigManager"; /** * Configuration interface for the Viewpoints general behavior. @@ -17,7 +18,7 @@ type ViewpointsConfigType = { overwriteColors: BooleanSettingsControl; }; -export class ViewpointsConfigManger extends ConfigManager< +export class ViewpointsConfigManager extends Configurator< Viewpoints, ViewpointsConfigType > { diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts index 2e3f5e2c5..dc58333ad 100644 --- a/packages/core/src/core/Worlds/src/simple-scene-config.ts +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -3,10 +3,10 @@ import * as THREE from "three"; import { SimpleScene } from "./simple-scene"; import { ColorSettingsControl, - ConfigManager, NumberSettingControl, Vector3SettingControl, } from "../../Types"; +import { Configurator } from "../../ConfigManager"; type SimpleSceneConfigType = { backgroundColor: ColorSettingsControl; @@ -112,7 +112,7 @@ export interface SimpleSceneConfig { }; } -export class SimpleSceneConfigManager extends ConfigManager< +export class SimpleSceneConfigManager extends Configurator< SimpleScene, SimpleSceneConfigType > { diff --git a/packages/core/src/core/Worlds/src/simple-scene.ts b/packages/core/src/core/Worlds/src/simple-scene.ts index be72c3d79..ad56f2101 100644 --- a/packages/core/src/core/Worlds/src/simple-scene.ts +++ b/packages/core/src/core/Worlds/src/simple-scene.ts @@ -26,7 +26,7 @@ export class SimpleScene readonly onSetup = new Event(); /** {@link Configurable.config} */ - config = new SimpleSceneConfigManager(this); + config = new SimpleSceneConfigManager(this, this.components, "Scene"); protected _defaultConfig: SimpleSceneConfig = { backgroundColor: new THREE.Color(0x202932), diff --git a/packages/core/src/core/index.ts b/packages/core/src/core/index.ts index dc7ff1b4d..12f17916b 100644 --- a/packages/core/src/core/index.ts +++ b/packages/core/src/core/index.ts @@ -10,3 +10,4 @@ export * from "./Cullers"; export * from "./Viewpoints"; export * from "./MiniMap"; export * from "./OrthoPerspectiveCamera"; +export * from "./ConfigManager"; diff --git a/packages/core/src/openbim/BCFTopics/index.ts b/packages/core/src/openbim/BCFTopics/index.ts index 92189544e..62ae81d6d 100644 --- a/packages/core/src/openbim/BCFTopics/index.ts +++ b/packages/core/src/openbim/BCFTopics/index.ts @@ -77,7 +77,7 @@ export class BCFTopics ignoreIncompleteTopicsOnImport: false, }; - config = new BCFTopicsConfigManager(this); + config = new BCFTopicsConfigManager(this, this.components, "BCF Topics"); readonly list = new DataMap(); diff --git a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts index 45cfb0cec..2f32b8e34 100644 --- a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts +++ b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts @@ -1,7 +1,7 @@ import { BCFTopics, BCFVersion } from "../index"; import { BooleanSettingsControl, - ConfigManager, + Configurator, SelectSettingControl, TextSetSettingControl, TextSettingsControl, @@ -110,7 +110,7 @@ type BCFTopicsConfigType = { ignoreIncompleteTopicsOnImport: BooleanSettingsControl; }; -export class BCFTopicsConfigManager extends ConfigManager< +export class BCFTopicsConfigManager extends Configurator< BCFTopics, BCFTopicsConfigType > { From 288cb3def42af773a1d9bba8ac8e4013d4047623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 31 Aug 2024 18:29:36 +0200 Subject: [PATCH 20/51] feat(core): add clipper config --- packages/core/src/core/Clipper/example.ts | 10 +- packages/core/src/core/Clipper/index.ts | 35 +++++- .../src/core/Clipper/src/clipper-config.ts | 105 ++++++++++++++++++ packages/core/src/core/ConfigManager/index.ts | 2 +- .../core/ConfigManager/src/configurator.ts | 1 - .../core/src/core/Types/src/config-types.ts | 1 - .../core/Worlds/src/simple-scene-config.ts | 8 +- .../core/src/core/Worlds/src/simple-scene.ts | 6 +- 8 files changed, 154 insertions(+), 14 deletions(-) create mode 100644 packages/core/src/core/Clipper/src/clipper-config.ts diff --git a/packages/core/src/core/Clipper/example.ts b/packages/core/src/core/Clipper/example.ts index a59bcdf25..add86eab4 100644 --- a/packages/core/src/core/Clipper/example.ts +++ b/packages/core/src/core/Clipper/example.ts @@ -187,34 +187,34 @@ const panel = BUI.Component.create(() => { diff --git a/packages/core/src/core/Clipper/index.ts b/packages/core/src/core/Clipper/index.ts index 24d9d2ce2..6654a9348 100644 --- a/packages/core/src/core/Clipper/index.ts +++ b/packages/core/src/core/Clipper/index.ts @@ -1,6 +1,7 @@ import * as THREE from "three"; import { Component, + Configurable, Createable, Disposable, Event, @@ -11,6 +12,7 @@ import { SimplePlane } from "./src"; import { Components } from "../Components"; import { Raycasters } from "../Raycasters"; import { Worlds } from "../Worlds"; +import { ClipperConfig, ClipperConfigManager } from "./src/clipper-config"; export * from "./src"; @@ -22,7 +24,11 @@ export * from "./src"; */ export class Clipper extends Component - implements Createable, Disposable, Hideable + implements + Createable, + Disposable, + Hideable, + Configurable { /** * A unique identifier for the component. @@ -30,6 +36,9 @@ export class Clipper */ static readonly uuid = "66290bc5-18c4-4cd1-9379-2e17a0617611" as const; + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + /** Event that fires when the user starts dragging a clipping plane. */ readonly onBeforeDrag = new Event(); @@ -71,6 +80,9 @@ export class Clipper /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); + /** {@link Configurable.isSetup} */ + isSetup = false; + /** * Whether to force the clipping plane to be orthogonal in the Y direction * (up). This is desirable when clipping a building horizontally and a @@ -97,6 +109,15 @@ export class Clipper */ list: SimplePlane[] = []; + /** {@link Configurable.config} */ + config = new ClipperConfigManager(this, this.components, "Clipper"); + + protected _defaultConfig: ClipperConfig = { + color: new THREE.Color(0xbb00ff), + opacity: 0.2, + size: 2, + }; + /** The material used in all the clipping planes. */ private _material = new THREE.MeshBasicMaterial({ color: 0xbb00ff, @@ -253,6 +274,18 @@ export class Clipper } } + /** {@link Configurable.setup} */ + setup(config?: Partial) { + const fullConfig = { ...this._defaultConfig, ...config }; + + this.config.color = fullConfig.color; + this.config.opacity = fullConfig.opacity; + this.config.size = fullConfig.size; + + this.isSetup = true; + this.onSetup.trigger(); + } + private deletePlane(plane: SimplePlane) { const index = this.list.indexOf(plane); if (index !== -1) { diff --git a/packages/core/src/core/Clipper/src/clipper-config.ts b/packages/core/src/core/Clipper/src/clipper-config.ts new file mode 100644 index 000000000..c9dc31ce7 --- /dev/null +++ b/packages/core/src/core/Clipper/src/clipper-config.ts @@ -0,0 +1,105 @@ +// eslint-disable-next-line max-classes-per-file +import * as THREE from "three"; +import { + BooleanSettingsControl, + ColorSettingsControl, + NumberSettingControl, +} from "../../Types"; +import { Configurator } from "../../ConfigManager"; +import { Clipper } from "../index"; + +type ClipperConfigType = { + enabled: BooleanSettingsControl; + visible: BooleanSettingsControl; + color: ColorSettingsControl; + opacity: NumberSettingControl; + size: NumberSettingControl; +}; + +/** + * Configuration interface for the {@link Clipper}. + */ +export interface ClipperConfig { + color: THREE.Color; + opacity: number; + size: number; +} + +export class ClipperConfigManager extends Configurator< + Clipper, + ClipperConfigType +> { + protected _config = { + enabled: { + value: true, + type: "Boolean" as const, + }, + visible: { + value: true, + type: "Boolean" as const, + }, + color: { + value: new THREE.Color() as THREE.Color, + type: "Color" as const, + }, + opacity: { + type: "Number" as const, + interpolable: true, + value: 1, + min: 0, + max: 1, + }, + size: { + type: "Number" as const, + interpolable: true, + value: 2, + min: 0, + max: 100, + }, + }; + + get enabled() { + return this._config.enabled.value; + } + + set enabled(value: boolean) { + this._config.enabled.value = value; + this._component.enabled = value; + } + + get visible() { + return this._config.visible.value; + } + + set visible(value: boolean) { + this._config.visible.value = value; + this._component.visible = value; + } + + get color() { + return this._config.color.value; + } + + set color(value: THREE.Color) { + this._config.color.value = value; + this._component.material.color.copy(value); + } + + get opacity() { + return this._config.opacity.value; + } + + set opacity(value: number) { + this._config.opacity.value = value; + this._component.material.opacity = value; + } + + get size() { + return this._config.size.value; + } + + set size(value: number) { + this._config.size.value = value; + this._component.size = value; + } +} diff --git a/packages/core/src/core/ConfigManager/index.ts b/packages/core/src/core/ConfigManager/index.ts index 41d73b58f..f38ff89e4 100644 --- a/packages/core/src/core/ConfigManager/index.ts +++ b/packages/core/src/core/ConfigManager/index.ts @@ -17,7 +17,7 @@ export class ConfigManager extends Component { * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ - static readonly uuid = "dc86e7e9-a8fd-5473-9ef6-724c67fecb0f" as const; + static readonly uuid = "b8c764e0-6b24-4e77-9a32-35fa728ee5b4" as const; constructor(components: Components) { super(components); diff --git a/packages/core/src/core/ConfigManager/src/configurator.ts b/packages/core/src/core/ConfigManager/src/configurator.ts index f8bb4590d..3679d9be9 100644 --- a/packages/core/src/core/ConfigManager/src/configurator.ts +++ b/packages/core/src/core/ConfigManager/src/configurator.ts @@ -48,7 +48,6 @@ export abstract class Configurator { const entry = controlEntry as ColorSettingsControl; return { type: entry.type, - opacity: entry.opacity, value: entry.value.clone(), }; } diff --git a/packages/core/src/core/Types/src/config-types.ts b/packages/core/src/core/Types/src/config-types.ts index fa4cfad10..f4119eb00 100644 --- a/packages/core/src/core/Types/src/config-types.ts +++ b/packages/core/src/core/Types/src/config-types.ts @@ -7,7 +7,6 @@ export interface BooleanSettingsControl { export interface ColorSettingsControl { type: "Color"; - opacity: number; value: THREE.Color; } diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts index dc58333ad..a24fe596c 100644 --- a/packages/core/src/core/Worlds/src/simple-scene-config.ts +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -130,7 +130,9 @@ export class SimpleSceneConfigManager extends Configurator< }, intensity: { type: "Number" as const, - interpolable: false, + interpolable: true, + min: 0, + max: 10, value: 2, }, }, @@ -142,7 +144,9 @@ export class SimpleSceneConfigManager extends Configurator< }, intensity: { type: "Number" as const, - interpolable: false, + interpolable: true, + min: 0, + max: 10, value: 2, }, position: { diff --git a/packages/core/src/core/Worlds/src/simple-scene.ts b/packages/core/src/core/Worlds/src/simple-scene.ts index ad56f2101..c61c8220c 100644 --- a/packages/core/src/core/Worlds/src/simple-scene.ts +++ b/packages/core/src/core/Worlds/src/simple-scene.ts @@ -13,6 +13,9 @@ export class SimpleScene extends BaseScene implements Configurable { + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + /** {@link Configurable.isSetup} */ isSetup = false; @@ -22,9 +25,6 @@ export class SimpleScene */ three: THREE.Scene; - /** {@link Configurable.onSetup} */ - readonly onSetup = new Event(); - /** {@link Configurable.config} */ config = new SimpleSceneConfigManager(this, this.components, "Scene"); From e62f783d7d2a3fefb522d0dac365dc18985fcdcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 31 Aug 2024 20:00:32 +0200 Subject: [PATCH 21/51] feat(core) add culler config --- .../src/core/Clipper/src/clipper-config.ts | 2 +- packages/core/src/core/Cullers/example.ts | 2 +- packages/core/src/core/Cullers/index.ts | 11 +- .../Cullers/src/culler-renderer-config.ts | 215 ++++++++++++++++++ .../src/core/Cullers/src/culler-renderer.ts | 159 +++++++------ .../core/Cullers/src/mesh-culler-renderer.ts | 70 ++---- .../core/Viewpoints/src/viewpoints-config.ts | 3 +- .../core/Worlds/src/simple-scene-config.ts | 5 +- .../BCFTopics/src/bcf-topics-config.ts | 2 +- 9 files changed, 323 insertions(+), 146 deletions(-) create mode 100644 packages/core/src/core/Cullers/src/culler-renderer-config.ts diff --git a/packages/core/src/core/Clipper/src/clipper-config.ts b/packages/core/src/core/Clipper/src/clipper-config.ts index c9dc31ce7..926ef74b9 100644 --- a/packages/core/src/core/Clipper/src/clipper-config.ts +++ b/packages/core/src/core/Clipper/src/clipper-config.ts @@ -29,7 +29,7 @@ export class ClipperConfigManager extends Configurator< Clipper, ClipperConfigType > { - protected _config = { + protected _config: ClipperConfigType = { enabled: { value: true, type: "Boolean" as const, diff --git a/packages/core/src/core/Cullers/example.ts b/packages/core/src/core/Cullers/example.ts index fecb7a0ec..def4fe8a5 100644 --- a/packages/core/src/core/Cullers/example.ts +++ b/packages/core/src/core/Cullers/example.ts @@ -84,7 +84,7 @@ culler.threshold = 200; Additionally, we will activate the `culler.renderDebugFrame` so that we can see the 2D screen of the elements that are not occluded. We will get the **domElement** and attach it to the body so that we can see this frame in real-time. To see it in your app, just comment out the `debugFrame.style.visibility = "collapse";` line. */ -culler.renderDebugFrame = true; +culler.config.renderDebugFrame = true; const debugFrame = culler.renderer.domElement; document.body.appendChild(debugFrame); debugFrame.style.position = "fixed"; diff --git a/packages/core/src/core/Cullers/index.ts b/packages/core/src/core/Cullers/index.ts index 965128f0c..399688223 100644 --- a/packages/core/src/core/Cullers/index.ts +++ b/packages/core/src/core/Cullers/index.ts @@ -1,6 +1,6 @@ import * as THREE from "three"; import { Components } from "../Components"; -import { MeshCullerRenderer, CullerRendererSettings } from "./src"; +import { MeshCullerRenderer } from "./src"; import { Component, Event, Disposable, World } from "../Types"; export * from "./src"; @@ -50,18 +50,14 @@ export class Cullers extends Component implements Disposable { * If a MeshCullerRenderer already exists for the world, it will return the existing one. * * @param world - The world for which to create the MeshCullerRenderer. - * @param config - Optional configuration settings for the MeshCullerRenderer. * * @returns The newly created or existing MeshCullerRenderer for the given world. */ - create( - world: World, - config?: Partial, - ): MeshCullerRenderer { + create(world: World): MeshCullerRenderer { if (this.list.has(world.uuid)) { return this.list.get(world.uuid) as MeshCullerRenderer; } - const culler = new MeshCullerRenderer(this.components, world, config); + const culler = new MeshCullerRenderer(this.components, world); this.list.set(world.uuid, culler); return culler; } @@ -98,7 +94,6 @@ export class Cullers extends Component implements Disposable { * * @param meshes - The meshes to update. * - * @returns {void} */ updateInstanced(meshes: Iterable) { for (const [, culler] of this.list) { diff --git a/packages/core/src/core/Cullers/src/culler-renderer-config.ts b/packages/core/src/core/Cullers/src/culler-renderer-config.ts new file mode 100644 index 000000000..50d8bd9e9 --- /dev/null +++ b/packages/core/src/core/Cullers/src/culler-renderer-config.ts @@ -0,0 +1,215 @@ +// eslint-disable-next-line max-classes-per-file +import * as THREE from "three"; +import { BooleanSettingsControl, NumberSettingControl } from "../../Types"; +import { Configurator } from "../../ConfigManager"; +import { CullerRenderer } from "../index"; + +type CullerRendererConfigType = { + enabled: BooleanSettingsControl; + width: NumberSettingControl; + height: NumberSettingControl; + updateInterval: NumberSettingControl; + autoUpdate: BooleanSettingsControl; + renderDebugFrame: BooleanSettingsControl; + threshold: NumberSettingControl; +}; + +/** + * Configuration interface for the {@link CullerRenderer}. + */ +export interface CullerRendererConfig { + /** + * Whether the culler renderer should make renders or not. + */ + enabled: boolean; + + /** + * Width of the render target used for visibility checks. + */ + width: number; + + /** + * Height of the render target used for visibility checks. + * Default value is 512. + */ + height: number; + + /** + * Whether the visibility check should be performed automatically. + * Default value is true. + */ + autoUpdate: boolean; + + /** + * Interval in milliseconds at which the visibility check should be performed. + */ + updateInterval: number; + + /** + * Whether to render the frame use to debug the culler behavior. + */ + renderDebugFrame: boolean; + + /** + * Pixels in screen a geometry must occupy to be considered "seen". + * Default value is 100. + */ + threshold: number; +} + +/** + * Settings to configure the CullerRenderer. + */ + +export class CullerRendererConfigManager extends Configurator< + CullerRenderer, + CullerRendererConfigType +> { + protected _config: CullerRendererConfigType = { + enabled: { + value: true, + type: "Boolean" as const, + }, + width: { + type: "Number" as const, + interpolable: true, + value: 512, + min: 32, + max: 1024, + }, + height: { + type: "Number" as const, + interpolable: true, + value: 512, + min: 32, + max: 1024, + }, + autoUpdate: { + value: true, + type: "Boolean" as const, + }, + renderDebugFrame: { + value: false, + type: "Boolean" as const, + }, + updateInterval: { + type: "Number" as const, + interpolable: true, + value: 1, + min: 0, + max: 1, + }, + threshold: { + type: "Number" as const, + interpolable: true, + value: 100, + min: 1, + max: 512, + }, + }; + + private _interval: number | null = null; + + get enabled() { + return this._config.enabled.value; + } + + set enabled(value: boolean) { + this._config.enabled.value = value; + this._component.enabled = value; + } + + get width() { + return this._config.width.value; + } + + set width(value: number) { + this.setWidthHeight(value, this.height); + } + + get height() { + return this._config.height.value; + } + + set height(value: number) { + this.setWidthHeight(this.width, value); + } + + get autoUpdate() { + return this._config.autoUpdate.value; + } + + set autoUpdate(value: boolean) { + this.setAutoAndInterval(value, this.updateInterval); + } + + get updateInterval() { + return this._config.updateInterval.value; + } + + set updateInterval(value: number) { + this.setAutoAndInterval(this.autoUpdate, value); + } + + get renderDebugFrame() { + return this._config.renderDebugFrame.value; + } + + set renderDebugFrame(value: boolean) { + this._config.renderDebugFrame.value = value; + } + + get threshold() { + return this._config.threshold.value; + } + + set threshold(value: number) { + this._config.threshold.value = value; + } + + setWidthHeight(width: number, height: number) { + if (width <= 0 || height <= 0) { + throw new Error( + "The width and height of the culler renderer must be more than 0!", + ); + } + this._config.width.value = width; + this._config.height.value = height; + this.resetRenderTarget(); + } + + setAutoAndInterval(auto: boolean, interval: number) { + if (interval <= 0) { + throw new Error( + "The updateInterval of the culler renderer must be more than 0!", + ); + } + this._config.autoUpdate.value = auto; + this._config.updateInterval.value = interval; + this.resetInterval(auto); + } + + private resetRenderTarget() { + this._component.renderTarget.dispose(); + this._component.renderTarget = new THREE.WebGLRenderTarget( + this.width, + this.height, + ); + this._component.bufferSize = this.width * this.height * 4; + this._component.buffer = new Uint8Array(this._component.bufferSize); + } + + private resetInterval(enabled: boolean) { + if (this._interval !== null) { + window.clearInterval(this._interval); + } + + if (!enabled) return; + + this._interval = window.setInterval(async () => { + if (!this._component.preventUpdate) { + await this._component.updateVisibility(); + } + }, this.updateInterval); + } +} diff --git a/packages/core/src/core/Cullers/src/culler-renderer.ts b/packages/core/src/core/Cullers/src/culler-renderer.ts index 36ed374e2..4f81cb22c 100644 --- a/packages/core/src/core/Cullers/src/culler-renderer.ts +++ b/packages/core/src/core/Cullers/src/culler-renderer.ts @@ -1,41 +1,21 @@ import * as THREE from "three"; import { Components } from "../../Components"; import { readPixelsAsync } from "./screen-culler-helper"; -import { AsyncEvent, Event, World } from "../../Types"; - -/** - * Settings to configure the CullerRenderer. - */ -export interface CullerRendererSettings { - /** - * Interval in milliseconds at which the visibility check should be performed. - * Default value is 1000. - */ - updateInterval?: number; - - /** - * Width of the render target used for visibility checks. - * Default value is 512. - */ - width?: number; - - /** - * Height of the render target used for visibility checks. - * Default value is 512. - */ - height?: number; - - /** - * Whether the visibility check should be performed automatically. - * Default value is true. - */ - autoUpdate?: boolean; -} +import { AsyncEvent, Configurable, Event, World } from "../../Types"; +import { + CullerRendererConfig, + CullerRendererConfigManager, +} from "./culler-renderer-config"; /** * A base renderer to determine visibility on screen. */ -export class CullerRenderer { +export class CullerRenderer + implements Configurable +{ + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); @@ -57,14 +37,32 @@ export class CullerRenderer { */ needsUpdate = false; + /** The components instance to which this renderer belongs. */ + components: Components; + + /** The render target used to render the visibility scene. */ + renderTarget = new THREE.WebGLRenderTarget(); + /** - * Render the internal scene used to determine the object visibility. Used - * for debugging purposes. + * The size of the buffer where the result of the visibility check is stored. */ - renderDebugFrame = false; + bufferSize = 1; - /** The components instance to which this renderer belongs. */ - components: Components; + /** + * The buffer when the result of the visibility check is stored. + */ + buffer = new Uint8Array(); + + /** + * Flag to indicate if the renderer shouldn't update the visibility. + */ + preventUpdate = false; + + /** {@link Configurable.config} */ + config: CullerRendererConfigManager; + + /** {@link Configurable.isSetup} */ + isSetup = false; /** The world instance to which this renderer belongs. */ readonly world: World; @@ -72,48 +70,41 @@ export class CullerRenderer { /** The THREE.js renderer used to make the visibility test. */ readonly renderer: THREE.WebGLRenderer; - protected autoUpdate = true; - - protected updateInterval = 1000; + protected _defaultConfig: CullerRendererConfig = { + enabled: true, + height: 512, + width: 512, + updateInterval: 1000, + autoUpdate: true, + renderDebugFrame: false, + threshold: 100, + }; protected readonly worker: Worker; protected readonly scene = new THREE.Scene(); - private _width = 512; - - private _height = 512; - private _availableColor = 1; - private readonly renderTarget: THREE.WebGLRenderTarget; - - private readonly bufferSize: number; - - private readonly _buffer: Uint8Array; - // Prevents worker being fired multiple times protected _isWorkerBusy = false; - constructor( - components: Components, - world: World, - settings?: CullerRendererSettings, - ) { + constructor(components: Components, world: World) { if (!world.renderer) { throw new Error("The given world must have a renderer!"); } this.components = components; - this.applySettings(settings); + + this.config = new CullerRendererConfigManager( + this, + this.components, + "Culler renderer", + ); this.world = world; this.renderer = new THREE.WebGLRenderer(); - this.renderTarget = new THREE.WebGLRenderTarget(this._width, this._height); - this.bufferSize = this._width * this._height * 4; - this._buffer = new Uint8Array(this.bufferSize); - this.renderer.clippingPlanes = world.renderer.clippingPlanes; const code = ` @@ -137,11 +128,14 @@ export class CullerRenderer { const blob = new Blob([code], { type: "application/javascript" }); this.worker = new Worker(URL.createObjectURL(blob)); + + this.setup(); } /** {@link Disposable.dispose} */ dispose() { this.enabled = false; + this.config.autoUpdate = false; for (const child of this.scene.children) { child.removeFromParent(); } @@ -150,7 +144,7 @@ export class CullerRenderer { this.renderer.forceContextLoss(); this.renderer.dispose(); this.renderTarget.dispose(); - (this._buffer as any) = null; + (this.buffer as any) = null; this.onDisposed.reset(); } @@ -170,7 +164,8 @@ export class CullerRenderer { const camera = this.world.camera.three; camera.updateMatrix(); - this.renderer.setSize(this._width, this._height); + const { width, height } = this.config; + this.renderer.setSize(width, height); this.renderer.setRenderTarget(this.renderTarget); this.renderer.render(this.scene, camera); @@ -179,26 +174,41 @@ export class CullerRenderer { context, 0, 0, - this._width, - this._height, + width, + height, context.RGBA, context.UNSIGNED_BYTE, - this._buffer, + this.buffer, ); this.renderer.setRenderTarget(null); - if (this.renderDebugFrame) { + if (this.config.renderDebugFrame) { this.renderer.render(this.scene, camera); } this.worker.postMessage({ - buffer: this._buffer, + buffer: this.buffer, }); this.needsUpdate = false; }; + setup(config?: Partial) { + const fullConfig = { ...this._defaultConfig, ...config }; + + const { width, height } = fullConfig; + this.config.setWidthHeight(width, height); + + const { updateInterval, autoUpdate } = fullConfig; + this.config.setAutoAndInterval(autoUpdate, updateInterval); + + this.config.threshold = fullConfig.threshold; + + this.isSetup = true; + this.onSetup.trigger(); + } + protected getAvailableColor() { // src: https://stackoverflow.com/a/67579485 @@ -234,21 +244,4 @@ export class CullerRenderer { } this._availableColor--; } - - private applySettings(settings?: CullerRendererSettings) { - if (settings) { - if (settings.updateInterval !== undefined) { - this.updateInterval = settings.updateInterval; - } - if (settings.height !== undefined) { - this._height = settings.height; - } - if (settings.width !== undefined) { - this._width = settings.width; - } - if (settings.autoUpdate !== undefined) { - this.autoUpdate = settings.autoUpdate; - } - } - } } diff --git a/packages/core/src/core/Cullers/src/mesh-culler-renderer.ts b/packages/core/src/core/Cullers/src/mesh-culler-renderer.ts index 86d3a6d23..515bf66b3 100644 --- a/packages/core/src/core/Cullers/src/mesh-culler-renderer.ts +++ b/packages/core/src/core/Cullers/src/mesh-culler-renderer.ts @@ -1,5 +1,5 @@ import * as THREE from "three"; -import { CullerRenderer, CullerRendererSettings } from "./culler-renderer"; +import { CullerRenderer } from "./culler-renderer"; import { Components } from "../../Components"; import { Disposer } from "../../Disposer"; import { Event, World, Disposable } from "../../Types"; @@ -18,12 +18,6 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { unseen: Set; }> = new Event(); - /** - * Pixels in screen a geometry must occupy to be considered "seen". - * Default value is 100. - */ - threshold = 100; - /** * Map of color code to THREE.InstancedMesh. * Used to keep track of color-coded meshes. @@ -31,38 +25,32 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { colorMeshes = new Map(); /** - * Flag to indicate if the renderer is currently processing. - * Used to prevent concurrent processing. + * @deprecated use config.threshold instead. */ - isProcessing = false; + get threshold() { + return this.config.threshold; + } - private _interval: number | null = null; + /** + * @deprecated use config.threshold instead. + */ + set threshold(value: number) { + this.config.threshold = value; + } private _colorCodeMeshMap = new Map(); private _meshIDColorCodeMap = new Map(); private _currentVisibleMeshes = new Set(); private _recentlyHiddenMeshes = new Set(); - private _intervalID: number | null = null; private readonly _transparentMat = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0, }); - constructor( - components: Components, - world: World, - settings?: CullerRendererSettings, - ) { - super(components, world, settings); + constructor(components: Components, world: World) { + super(components, world); this.worker.addEventListener("message", this.handleWorkerMessage); - if (this.autoUpdate) { - this._interval = window.setInterval(async () => { - if (!this.isProcessing) { - await this.updateVisibility(); - } - }, this.updateInterval); - } this.onViewUpdated.add(({ seen, unseen }) => { for (const mesh of seen) { @@ -77,14 +65,6 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { /** {@link Disposable.dispose} */ dispose() { super.dispose(); - if (this._intervalID !== null) { - window.clearInterval(this._intervalID); - this._intervalID = null; - } - if (this._interval !== null) { - window.clearInterval(this._interval); - this._intervalID = null; - } this._currentVisibleMeshes.clear(); this._recentlyHiddenMeshes.clear(); @@ -104,17 +84,16 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { /** * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene. * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh. - * @returns {void} */ add(mesh: THREE.Mesh | THREE.InstancedMesh) { if (!this.enabled) return; - if (this.isProcessing) { + if (this.preventUpdate) { console.log("Culler processing not finished yet."); return; } - this.isProcessing = true; + this.preventUpdate = true; const isInstanced = mesh instanceof THREE.InstancedMesh; @@ -140,7 +119,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { // If we find that all the materials are transparent then we must remove this from analysis if (transparentOnly) { colorMaterial.dispose(); - this.isProcessing = false; + this.preventUpdate = false; return; } @@ -149,7 +128,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { // This material is transparent, so we must remove it from analysis // TODO: Make transparent meshes blink like in the memory culler? colorMaterial.dispose(); - this.isProcessing = false; + this.preventUpdate = false; return; } else { newMaterial = colorMaterial; @@ -178,22 +157,21 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { this.increaseColor(); - this.isProcessing = false; + this.preventUpdate = false; } /** * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore. * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed. * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh. - * @returns {void} */ remove(mesh: THREE.Mesh | THREE.InstancedMesh) { - if (this.isProcessing) { + if (this.preventUpdate) { console.log("Culler processing not finished yet."); return; } - this.isProcessing = true; + this.preventUpdate = true; const disposer = this.components.get(Disposer); @@ -204,7 +182,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { const code = this._meshIDColorCodeMap.get(mesh.uuid); if (!colorMesh || !code) { - this.isProcessing = false; + this.preventUpdate = false; return; } @@ -218,7 +196,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { this._recentlyHiddenMeshes.delete(mesh); this._currentVisibleMeshes.delete(mesh); - this.isProcessing = false; + this.preventUpdate = false; } /** @@ -239,7 +217,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { } private handleWorkerMessage = async (event: MessageEvent) => { - if (this.isProcessing) { + if (this.preventUpdate) { return; } @@ -249,7 +227,7 @@ export class MeshCullerRenderer extends CullerRenderer implements Disposable { this._currentVisibleMeshes.clear(); for (const [code, pixels] of colors) { - if (pixels < this.threshold) { + if (pixels < this.config.threshold) { continue; } const mesh = this._colorCodeMeshMap.get(code); diff --git a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts index 4792f5fd7..734732009 100644 --- a/packages/core/src/core/Viewpoints/src/viewpoints-config.ts +++ b/packages/core/src/core/Viewpoints/src/viewpoints-config.ts @@ -22,10 +22,9 @@ export class ViewpointsConfigManager extends Configurator< Viewpoints, ViewpointsConfigType > { - protected _config = { + protected _config: ViewpointsConfigType = { overwriteColors: { value: false, - opacity: 1, type: "Boolean" as const, }, }; diff --git a/packages/core/src/core/Worlds/src/simple-scene-config.ts b/packages/core/src/core/Worlds/src/simple-scene-config.ts index a24fe596c..a6d11397a 100644 --- a/packages/core/src/core/Worlds/src/simple-scene-config.ts +++ b/packages/core/src/core/Worlds/src/simple-scene-config.ts @@ -116,16 +116,14 @@ export class SimpleSceneConfigManager extends Configurator< SimpleScene, SimpleSceneConfigType > { - protected _config = { + protected _config: SimpleSceneConfigType = { backgroundColor: { value: new THREE.Color() as THREE.Color, - opacity: 1, type: "Color" as const, }, ambientLight: { color: { type: "Color" as const, - opacity: 1, value: new THREE.Color(), }, intensity: { @@ -139,7 +137,6 @@ export class SimpleSceneConfigManager extends Configurator< directionalLight: { color: { type: "Color" as const, - opacity: 1, value: new THREE.Color(), }, intensity: { diff --git a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts index 2f32b8e34..e42e2511d 100644 --- a/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts +++ b/packages/core/src/openbim/BCFTopics/src/bcf-topics-config.ts @@ -114,7 +114,7 @@ export class BCFTopicsConfigManager extends Configurator< BCFTopics, BCFTopicsConfigType > { - protected _config = { + protected _config: BCFTopicsConfigType = { version: { type: "Select" as const, options: new Set(), From fde9faa16ded3f8d0ff17c2d2f83afc31e589c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 31 Aug 2024 20:05:03 +0200 Subject: [PATCH 22/51] feat(core): connect all existing configs with manager --- packages/core/src/core/Clipper/index.ts | 8 ++++++++ packages/core/src/core/ConfigManager/index.ts | 7 +++++-- packages/core/src/core/Cullers/src/culler-renderer.ts | 8 ++++++++ packages/core/src/core/Worlds/src/simple-scene.ts | 10 ++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/core/src/core/Clipper/index.ts b/packages/core/src/core/Clipper/index.ts index 6654a9348..ce372471c 100644 --- a/packages/core/src/core/Clipper/index.ts +++ b/packages/core/src/core/Clipper/index.ts @@ -13,6 +13,7 @@ import { Components } from "../Components"; import { Raycasters } from "../Raycasters"; import { Worlds } from "../Worlds"; import { ClipperConfig, ClipperConfigManager } from "./src/clipper-config"; +import { ConfigManager } from "../ConfigManager"; export * from "./src"; @@ -186,11 +187,18 @@ export class Clipper constructor(components: Components) { super(components); this.components.add(Clipper.uuid, this); + + const configs = components.get(ConfigManager); + configs.list.add(this.config); } /** {@link Disposable.dispose} */ dispose() { this._enabled = false; + + const configs = this.components.get(ConfigManager); + configs.list.delete(this.config); + for (const plane of this.list) { plane.dispose(); } diff --git a/packages/core/src/core/ConfigManager/index.ts b/packages/core/src/core/ConfigManager/index.ts index f38ff89e4..3bab80418 100644 --- a/packages/core/src/core/ConfigManager/index.ts +++ b/packages/core/src/core/ConfigManager/index.ts @@ -1,4 +1,4 @@ -import { Component } from "../Types"; +import { Component, DataSet } from "../Types"; import { Components } from "../Components"; import { Configurator } from "./src"; @@ -8,7 +8,10 @@ export * from "./src"; * A tool to manage all the configuration from the app centrally. */ export class ConfigManager extends Component { - list = new Set>(); + /** + * The list of all configurations of this app. + */ + list = new DataSet>(); /** {@link Component.enabled} */ enabled = true; diff --git a/packages/core/src/core/Cullers/src/culler-renderer.ts b/packages/core/src/core/Cullers/src/culler-renderer.ts index 4f81cb22c..e51a7bb36 100644 --- a/packages/core/src/core/Cullers/src/culler-renderer.ts +++ b/packages/core/src/core/Cullers/src/culler-renderer.ts @@ -6,6 +6,7 @@ import { CullerRendererConfig, CullerRendererConfigManager, } from "./culler-renderer-config"; +import { ConfigManager } from "../../ConfigManager"; /** * A base renderer to determine visibility on screen. @@ -102,6 +103,9 @@ export class CullerRenderer "Culler renderer", ); + const configs = this.components.get(ConfigManager); + configs.list.add(this.config); + this.world = world; this.renderer = new THREE.WebGLRenderer(); @@ -136,6 +140,10 @@ export class CullerRenderer dispose() { this.enabled = false; this.config.autoUpdate = false; + + const configs = this.components.get(ConfigManager); + configs.list.delete(this.config); + for (const child of this.scene.children) { child.removeFromParent(); } diff --git a/packages/core/src/core/Worlds/src/simple-scene.ts b/packages/core/src/core/Worlds/src/simple-scene.ts index c61c8220c..135a20e70 100644 --- a/packages/core/src/core/Worlds/src/simple-scene.ts +++ b/packages/core/src/core/Worlds/src/simple-scene.ts @@ -5,6 +5,7 @@ import { SimpleSceneConfig, SimpleSceneConfigManager, } from "./simple-scene-config"; +import { ConfigManager } from "../../ConfigManager"; /** * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it. @@ -45,6 +46,9 @@ export class SimpleScene super(components); this.three = new THREE.Scene(); this.three.background = new THREE.Color(0x202932); + + const configs = this.components.get(ConfigManager); + configs.list.add(this.config); } /** {@link Configurable.setup} */ @@ -78,4 +82,10 @@ export class SimpleScene this.isSetup = true; this.onSetup.trigger(); } + + dispose() { + super.dispose(); + const configs = this.components.get(ConfigManager); + configs.list.delete(this.config); + } } From 64e75734cefcfc7cf7c4da659dca88e96eeeb136 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Mon, 2 Sep 2024 23:26:53 -0500 Subject: [PATCH 23/51] first wip on ids integration --- index.html | 1 + .../openbim/IDSSpecifications/example.html | 49 ++++++ .../src/openbim/IDSSpecifications/example.ts | 47 ++++++ .../src/openbim/IDSSpecifications/index.ts | 12 ++ .../resources/project-naming.ts | 36 +++++ .../resources/specification.ts | 37 +++++ .../IDSSpecifications/src/Specification.ts | 142 ++++++++++++++++++ .../IDSSpecifications/src/facets/Attribute.ts | 76 ++++++++++ .../src/facets/Classification.ts | 26 ++++ .../IDSSpecifications/src/facets/Entity.ts | 72 +++++++++ .../IDSSpecifications/src/facets/Material.ts | 21 +++ .../IDSSpecifications/src/facets/PartOf.ts | 21 +++ .../IDSSpecifications/src/facets/Property.ts | 93 ++++++++++++ .../IDSSpecifications/src/facets/index.ts | 6 + .../openbim/IDSSpecifications/src/index.ts | 3 + .../openbim/IDSSpecifications/src/types.ts | 45 ++++++ packages/core/src/openbim/index.ts | 1 + 17 files changed, 688 insertions(+) create mode 100644 packages/core/src/openbim/IDSSpecifications/example.html create mode 100644 packages/core/src/openbim/IDSSpecifications/example.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/index.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/resources/specification.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/Specification.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/index.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/index.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/types.ts diff --git a/index.html b/index.html index e6dd6c9e3..1a29c9a5a 100644 --- a/index.html +++ b/index.html @@ -42,6 +42,7 @@

Choose an example

front/CivilElevationNavigator front/CivilCrossSectionNavigator front/Civil3DNavigator +core/IDSSpecifications core/BCFTopics core/MeasurementUtils core/IfcRelationsIndexer diff --git a/packages/core/src/openbim/IDSSpecifications/example.html b/packages/core/src/openbim/IDSSpecifications/example.html new file mode 100644 index 000000000..0eb1ffb2f --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/example.html @@ -0,0 +1,49 @@ + + + + + + + IDS Specifications + + + + + + + + + \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts new file mode 100644 index 000000000..3cfbac6bd --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -0,0 +1,47 @@ +import * as WEBIFC from "web-ifc"; +import * as FRAGS from "@thatopen/fragments"; +import * as OBC from "../.."; + +const components = new OBC.Components(); +const ifcLoader = components.get(OBC.IfcLoader); +await ifcLoader.setup(); +const file = await fetch("/resources/small.ifc"); +const data = await file.arrayBuffer(); +const buffer = new Uint8Array(data); +const model = await ifcLoader.load(buffer); + +const world = components.get(OBC.Worlds).create(); + +const indexer = components.get(OBC.IfcRelationsIndexer); +await indexer.process(model); + +// IDS Integration +const collector: FRAGS.IfcProperties = {}; + +const entityFacet = new OBC.IDSEntityFacet(WEBIFC.IFCSLAB); +await entityFacet.getEntities(model, collector); + +const propertyFacet = new OBC.IDSPropertyFacet( + components, + { type: "simpleValue", value: "Pset_SlabCommon" }, + { type: "simpleValue", value: "IsExternal" }, +); + +propertyFacet.value = { type: "simpleValue", value: true }; + +const result = await propertyFacet.test(collector, model); + +// BCF Integration +const bcfTopics = components.get(OBC.BCFTopics); +const viewpoints = components.get(OBC.Viewpoints); + +if (result.fail.length > 0) { + const topic = bcfTopics.create({ + title: "Invalid Property", + description: "This elements are not external", + }); + + const viewpoint = viewpoints.create(world); + viewpoint.selectionComponents.add(...result.fail); + topic.viewpoints.add(viewpoint.guid); +} diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts new file mode 100644 index 000000000..68b933044 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -0,0 +1,12 @@ +import { Component, DataMap } from "../../core/Types"; +import { IDSSpecification } from "./src"; + +export class IDSSpecifications extends Component { + enabled = true; + + readonly list = new DataMap(); + + create() {} +} + +export * from "./src"; diff --git a/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts b/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts new file mode 100644 index 000000000..c31f1be08 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts @@ -0,0 +1,36 @@ +import { IIDS } from ".." + +export const specification: IIDS = { + title: "Bimply Sample IDS", + copyright: "Bimply", + version: "1.0.0", + description: "These are example specifications for those learning how to use IDS. The goal is to be able to automate IFC requirements.", + author: "juan.hoyos4@gmail.com", + date: new Date(), + purpose: "Contractual requirements", + milestone: "Design", + specifications: [ + { + name: "Project naming", + ifcVersion: "IFC4", + identifier: 1, + description: "Projects shall be named correctly for the purposes of identification, project archival, and model federation.", + instructions: "Each discipline is responsible for naming their own project.", + minOccurs: 1, + maxOccurs: 1, + applicability: [ + { + type: "entity", + name: {type: "simpleValue", value: "IFCPROJECT"}, + }, + ], + requirements: [ + { + type: "attribute", + name: {type: "simpleValue", value: "Name"}, + value: {type: "simpleValue", value: "TEST"}, + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/resources/specification.ts b/packages/core/src/openbim/IDSSpecifications/resources/specification.ts new file mode 100644 index 000000000..e193f4632 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/resources/specification.ts @@ -0,0 +1,37 @@ +import { Ids, IdsEntityFacet, IdsPropertyFacet } from ".." + +export const specification: Ids = { + title: "Bimply Sample IDS", + copyright: "Bimply", + version: "1.0.0", + description: "These are example specifications for those learning how to use IDS. The goal is to be able to automate IFC requirements.", + author: "juan.hoyos4@gmail.com", + date: new Date(), + purpose: "Contractual requirements", + milestone: "Design", + specifications: [ + { + name: "Fire rating", + ifcVersion: "IFC4", + description: "All wall and floor finishes must not be load bearing.", + applicability: [ + { + type: new IdsEntityFacet({ + name: { type: "simpleValue", value: "IFCWALL" }, + predefinedType: { type: "simpleValue", value: "SOLIDWALL" } + }) + }, + ], + requirements: [ + { + type: new IdsPropertyFacet({ + name: { type: "simpleValue", value: "LoadBearing" }, + dataType: "IfcBoolean", + propertySet: { type: "simpleValue", value: "Pset_WallCommon" }, + value: { type: "simpleValue", value: "T" } + }), + } + ] + }, + ] +} \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts new file mode 100644 index 000000000..1eb7044c3 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -0,0 +1,142 @@ +import * as FRAGS from "@thatopen/fragments"; +import { Components } from "../../../core/Components"; +import { Component } from "../../../core/Types"; +import { IDSCheckResult, IDSFacet, IfcVersion } from "./types"; + +export class IDSSpecification extends Component { + name: string; + ifcVersion: IfcVersion; + identifier?: string | number; + description?: string; + instructions?: string; + applicability: IDSFacet[] = []; + requirements: IDSFacet[] = []; + enabled = true; + + constructor(components: Components, name: string, ifcVersion: IfcVersion) { + super(components); + this.name = name; + this.ifcVersion = ifcVersion; + } + + addApplicability(applicability: IDSFacet) { + this.applicability.push(applicability); + } + + addRequirement(requirement: IDSFacet) { + this.requirements.push(requirement); + } + + check(model: FRAGS.FragmentsGroup) { + if (!model.hasProperties) + throw new Error(`${model.name || model.uuid} doesn't have properties`); + const result: IDSCheckResult = { pass: {}, fail: {} }; + + // Get applicable elements + const entities: { [expressID: string]: Record } = {}; + this.applicability.forEach((applicability) => { + applicability.getEntities(model.properties, entities); + }); + // return + + // Test applicable elements against requirements + const requirementsResult: { [expressId: string]: boolean } = {}; + for (const expressID in entities) { + requirementsResult[expressID] = true; + } + this.requirements.forEach((requirement) => { + const arrayEntities = Object.values(entities); + const checkingElements = arrayEntities.filter( + (entity) => requirementsResult[entity.expressID], + ); + const test = requirement.test(model.properties, checkingElements); + if (!test) { + return; + } + for (const expressID in test.fail) { + requirementsResult[expressID] = false; + } + }); + for (const expressID in requirementsResult) { + const entity = entities[expressID]; + if (!entity) { + continue; + } + if (requirementsResult[expressID]) { + result.pass[expressID] = entity; + } else { + result.fail[expressID] = entity; + } + } + return result; + } + + resultToGlobalIds(facetResult: IdsSpecificationResult) { + const result: { pass: string[]; fail: string[] } = { pass: [], fail: [] }; + const passed = Object.values(facetResult.pass); + const failed = Object.values(facetResult.fail); + result.pass = passed.map((entity) => { + return entity.GlobalId.value; + }); + result.fail = failed.map((entity) => { + return entity.GlobalId.value; + }); + return result; + } + + resultToFragmentMap( + models: FRAGS.FragmentsGroup[], + facetResult: IDSCheckResult, + ) { + const result: { + pass: { [fragmentID: string]: string[] }; + fail: { [fragmentID: string]: string[] }; + } = { pass: {}, fail: {} }; + models.forEach((model) => { + const expressIDFragmentIDMap = model.expressIDFragmentIDMap; + for (const expressID in facetResult.pass) { + const fragmentID = expressIDFragmentIDMap[expressID]; + if (!fragmentID) { + continue; + } + if (!result.pass[fragmentID]) { + result.pass[fragmentID] = []; + } + result.pass[fragmentID].push(String(expressID)); + } + for (const expressID in facetResult.fail) { + const fragmentID = expressIDFragmentIDMap[expressID]; + if (!fragmentID) { + continue; + } + if (!result.fail[fragmentID]) { + result.fail[fragmentID] = []; + } + result.fail[fragmentID].push(String(expressID)); + } + }); + return result; + } + + highlightResult( + result: { + pass: { [fragmentID: string]: string[] }; + fail: { [fragmentID: string]: string[] }; + }, + applyTransparency = false, + ) { + const fragments = this.components.tools.get("Fragments") as + | Fragments + | undefined; + if (!fragments) { + return; + } + if (applyTransparency) { + fragments.materials.apply( + new MeshLambertMaterial({ transparent: true, opacity: 0.01 }), + ); + } + fragments.highlighter.highlightByID("ids-check-pass", result.pass); + fragments.highlighter.highlightByID("ids-check-fail", result.fail); + } +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts new file mode 100644 index 000000000..00223a70e --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -0,0 +1,76 @@ +import * as FRAGS from "@thatopen/fragments"; +import { IDSFacet, IDSFacetParameter, IDSCheckResult } from "../types"; + +// https://github.com/buildingSMART/IDS/blob/master/Documentation/attribute-facet.md +// Every entity in an IFC model has a list of standardised Attributes. +// Attributes are a limited set of fundamental data (usually less than 10) associated with all IFC entities. +// These are fixed by the IFC standard and cannot be customised. + +export class IDSAttributeFacet { + name: string; + value?: IDSFacetParameter; + + constructor(name: string) { + this.name = name; + } + + // This can be very ineficcient as we do not have an easy way to get an entity based on an attribute + // When the new IfcEntitiesFinder comes, this can become easier. + async getEntities( + model: FRAGS.FragmentsGroup, + collector: { [expressID: string]: Record }, + ) { + // for (const expressID in model) { + // if (collector[expressID]) continue; + // const entity = model[expressID]; + // // Check if the attribute exists + // const attribute = entity[this.name]; + // const attributeExists = !!attribute; + // // Check if the attribute value matches + // let valueMatches = true; + // if (attributeExists && this.value && this.value.value) { + // if (this.value.type === "simpleValue") { + // valueMatches = attribute.value === this.value.value; + // } + // if (this.value.type === "restriction") { + // const regex = new RegExp(this.value.value); + // valueMatches = regex.test(attribute.value); + // } + // } + // if (attributeExists && valueMatches) { + // collector[entity.expressID] = entity; + // } + // } + } + + test(entities: FRAGS.IfcProperties) { + const result: IDSCheckResult = { pass: [], fail: [] }; + for (const expressID in entities) { + const attrs = entities[expressID]; + if (!attrs.GlobalId?.value) continue; + + // Check if the attribute exists + const attribute = attrs[this.name]; + const attributeExists = !!attribute; + + // Check if the attribute value matches + let valueMatches = true; + if (attributeExists && this.value && this.value.value) { + if (this.value.type === "simpleValue") { + valueMatches = attribute.value === this.value.value; + } + if (this.value.type === "restriction") { + const regex = new RegExp(this.value.value); + valueMatches = regex.test(attribute.value); + } + } + + if (attributeExists && valueMatches) { + result.pass.push(attrs.GlobalId.value); + } else { + result.fail.push(attrs.GlobalId.value); + } + } + return result; + } +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts new file mode 100644 index 000000000..eb100baa3 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -0,0 +1,26 @@ +import { IDSFacet, IDSFacetParameter } from "../types"; + +// https://github.com/buildingSMART/IDS/blob/master/Documentation/classification-facet.md +interface IIdsClassificationFacet { + system?: IDSFacetParameter; + value?: IDSFacetParameter; + uri?: string; +} + +export class IdsClassificationFacet + implements IIdsClassificationFacet, IDSFacet +{ + system?: IDSFacetParameter; + value?: IDSFacetParameter; + uri?: string; + + constructor(parameters: IIdsClassificationFacet) { + this.system = parameters.system; + this.value = parameters.value; + this.uri = parameters.uri; + } + + getEntities() {} + + test() {} +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts new file mode 100644 index 000000000..cb45e1b1b --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -0,0 +1,72 @@ +import * as FRAGS from "@thatopen/fragments"; +import { IDSCheckResult, IDSFacet } from "../types"; + +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md + +export class IDSEntityFacet { + type: number; + private _predefinedType?: string; + + set predefinedType(predefinedType: string | undefined) { + this._predefinedType = predefinedType?.toUpperCase(); + } + get predefinedType() { + return this._predefinedType; + } + + constructor(type: number) { + this.type = type; + } + + async getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties = {}, + ) { + const entities = await model.getAllPropertiesOfType(this.type); + if (!entities) return []; + if (!this.predefinedType) { + for (const expressID in entities) { + collector[expressID] = entities[expressID]; + } + return Object.keys(entities) as unknown as number[]; + } + const validEntities: number[] = []; + for (const _expressID in entities) { + const expressID = Number(_expressID); + if (expressID in collector) continue; + const attrs = entities[expressID]; + const validPredefinedType = + attrs.PredefinedType?.value === this.predefinedType; + if (validPredefinedType) { + collector[expressID] = attrs; + validEntities.push(expressID); + } + } + return validEntities; + } + + test(entities: FRAGS.IfcProperties) { + const result: IDSCheckResult = { pass: [], fail: [] }; + for (const expressID in entities) { + const attrs = entities[expressID]; + if (!attrs.GlobalId?.value) continue; + + // Check if entity type matches + const typeMatches = attrs.type === this.type; + + // Check if the predefined type matches + let predefinedTypeMatches = true; + if (typeMatches && this.predefinedType) { + predefinedTypeMatches = + attrs.PredefinedType?.value === this.predefinedType; + } + + if (typeMatches && predefinedTypeMatches) { + result.pass.push(attrs.GlobalId.value); + } else { + result.fail.push(attrs.GlobalId.value); + } + } + return result; + } +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts new file mode 100644 index 000000000..8abee031c --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts @@ -0,0 +1,21 @@ +import { IDSFacet, IDSFacetParameter } from "../types"; + +// https://github.com/buildingSMART/IDS/blob/master/Documentation/material-facet.md +interface IIdsMaterialFacet { + value?: IDSFacetParameter; + uri?: string; +} + +export class IdsMaterialFacet implements IIdsMaterialFacet, IDSFacet { + value?: IDSFacetParameter; + uri?: string; + + constructor(parameters: IIdsMaterialFacet) { + this.value = parameters.value; + this.uri = parameters.uri; + } + + getEntities() {} + + test() {} +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts new file mode 100644 index 000000000..7b2eeed66 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts @@ -0,0 +1,21 @@ +import { IDSFacet, IDSFacetParameter } from "../types"; + +// https://github.com/buildingSMART/IDS/blob/master/Documentation/partof-facet.md +interface IIdsPartOfFacet { + relation: IDSFacetParameter; + entity?: IDSFacetParameter; +} + +export class IdsPartOfFacet implements IIdsPartOfFacet, IDSFacet { + relation: IDSFacetParameter; + entity?: IDSFacetParameter; + + constructor(parameters: IIdsPartOfFacet) { + this.relation = parameters.relation; + this.entity = parameters.entity; + } + + getEntities() {} + + test() {} +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts new file mode 100644 index 000000000..47bd51d4d --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts @@ -0,0 +1,93 @@ +import * as FRAGS from "@thatopen/fragments"; +import * as WEBIFC from "web-ifc"; +import { IDSCheckResult, IDSFacet, IDSFacetParameter } from "../types"; +import { Components } from "../../../../core/Components"; +import { IfcRelationsIndexer } from "../../../../ifc"; + +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/property-facet.md +export class IDSPropertyFacet { + propertySet: IDSFacetParameter; // This is the name of the property set, like Pset_WallCommon, Qto_WallBaseQuantities or any other custom one. + name: IDSFacetParameter; // This is the name of the property like LoadBearing, IsExternal or any other custom one. + dataType?: string; + value?: IDSFacetParameter; + uri?: string; + + private _components: Components; + + constructor( + components: Components, + propertySet: IDSFacetParameter, + name: IDSFacetParameter, + ) { + this._components = components; + this.propertySet = propertySet; + this.name = name; + } + + async getEntities( + model: FRAGS.FragmentsGroup, + collector: { [expressID: string]: Record } = {}, + ) {} + + async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { + const result: IDSCheckResult = { pass: [], fail: [] }; + const indexer = this._components.get(IfcRelationsIndexer); + for (const _expressID in entities) { + const expressID = Number(_expressID); + const attrs = entities[expressID]; + if (!attrs.GlobalId?.value) continue; + + const definitions = indexer.getEntityRelations( + model, + expressID, + "IsDefinedBy", + ); + if (!definitions) continue; + + let matches = false; + + for (const definitionID of definitions) { + const definitionAttrs = await model.getProperties(definitionID); + if (!definitionAttrs) continue; + + const nameMatches = + definitionAttrs.Name?.value === this.propertySet.value; + if (!nameMatches) continue; + + let propsListName: string | undefined; + if (definitionAttrs.type === WEBIFC.IFCPROPERTYSET) + propsListName = "HasProperties"; + if (definitionAttrs.type === WEBIFC.IFCELEMENTQUANTITY) + propsListName = "Quantities"; + if (!propsListName) continue; + + for (const handle of definitionAttrs[propsListName]) { + const propAttrs = await model.getProperties(handle.value); + if (!propAttrs) continue; + + const propNameMatches = propAttrs.Name?.value === this.name.value; + if (!propNameMatches) continue; + + if (this.value) { + const valueKey = Object.keys(propAttrs).find((name) => + name.endsWith("Value"), + ); + if (!valueKey) continue; + const valueMatches = propAttrs[valueKey].value === this.value.value; + if (!valueMatches) continue; + } + + matches = true; + break; + } + } + + if (matches) { + result.pass.push(attrs.GlobalId.value); + } else { + result.fail.push(attrs.GlobalId.value); + } + } + return result; + } +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts new file mode 100644 index 000000000..39e895e45 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts @@ -0,0 +1,6 @@ +export * from "./Attribute"; +export * from "./Classification"; +export * from "./Entity"; +export * from "./Material"; +export * from "./PartOf"; +export * from "./Property"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/index.ts b/packages/core/src/openbim/IDSSpecifications/src/index.ts new file mode 100644 index 000000000..6bfd49cf5 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/index.ts @@ -0,0 +1,3 @@ +export * from "./types"; +export * from "./facets"; +export * from "./Specification"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts new file mode 100644 index 000000000..aba03f07d --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -0,0 +1,45 @@ +import { IDSSpecification } from "./Specification"; + +export type IDSFacetParameterType = "simpleValue" | "restriction"; + +export interface IDSFacetParameter { + type: IDSFacetParameterType; + value?: string | boolean | number; + enumeration?: string[] | number[]; +} + +// export interface IDSCheckResult { +// pass: { [expressID: string]: Record }; +// fail: { [expressID: string]: Record }; +// } + +export interface IDSCheckResult { + pass: string[]; // IfcGUIDs + fail: string[]; +} + +export interface IDSFacet { + instructions?: string; + getEntities: ( + ifcRawProperties: Record, + collector: { [expressID: string]: Record }, + ) => void; + test: ( + ifcRawProperties: Record, + entities: Record[], + ) => IDSCheckResult; +} + +export type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3"; + +export interface IDS { + title: string; + description?: string; + copyright?: string; + version?: string; + author?: string; + date?: Date; + purpose?: string; + milestone?: string; + specifications: IDSSpecification[]; +} diff --git a/packages/core/src/openbim/index.ts b/packages/core/src/openbim/index.ts index 2c7d2bbf5..282f4a817 100644 --- a/packages/core/src/openbim/index.ts +++ b/packages/core/src/openbim/index.ts @@ -1 +1,2 @@ export * from "./BCFTopics"; +export * from "./IDSSpecifications"; From c633f0d6070a9c9684a0925952b2a612ddb0476e Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Tue, 3 Sep 2024 17:51:16 -0500 Subject: [PATCH 24/51] improved a lot the facets implementation --- .../core/src/ifc/IfcRelationsIndexer/index.ts | 2 +- .../src/openbim/IDSSpecifications/example.ts | 72 +++++--- .../src/openbim/IDSSpecifications/index.ts | 13 +- .../IDSSpecifications/src/Specification.ts | 160 +++++------------- .../IDSSpecifications/src/eval-value.ts | 1 + .../IDSSpecifications/src/facets/Attribute.ts | 35 ++-- .../src/facets/Classification.ts | 146 ++++++++++++++-- .../IDSSpecifications/src/facets/Entity.ts | 29 ++-- .../IDSSpecifications/src/facets/Material.ts | 27 +-- .../IDSSpecifications/src/facets/PartOf.ts | 131 ++++++++++++-- .../IDSSpecifications/src/facets/Property.ts | 109 +++++++++--- .../openbim/IDSSpecifications/src/types.ts | 50 +++--- 12 files changed, 514 insertions(+), 261 deletions(-) create mode 100644 packages/core/src/openbim/IDSSpecifications/src/eval-value.ts diff --git a/packages/core/src/ifc/IfcRelationsIndexer/index.ts b/packages/core/src/ifc/IfcRelationsIndexer/index.ts index 339ef7dda..b8a6556af 100644 --- a/packages/core/src/ifc/IfcRelationsIndexer/index.ts +++ b/packages/core/src/ifc/IfcRelationsIndexer/index.ts @@ -175,7 +175,7 @@ export class IfcRelationsIndexer extends Component implements Disposable { } } - private getAttributeIndex(inverseAttribute: InverseAttribute) { + getAttributeIndex(inverseAttribute: InverseAttribute) { const index = this._inverseAttributes.indexOf(inverseAttribute); if (index === -1) return null; return index; diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index 3cfbac6bd..54c1e7cfe 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -5,43 +5,71 @@ import * as OBC from "../.."; const components = new OBC.Components(); const ifcLoader = components.get(OBC.IfcLoader); await ifcLoader.setup(); -const file = await fetch("/resources/small.ifc"); +const file = await fetch("/resources/structure.ifc"); const data = await file.arrayBuffer(); const buffer = new Uint8Array(data); const model = await ifcLoader.load(buffer); -const world = components.get(OBC.Worlds).create(); - const indexer = components.get(OBC.IfcRelationsIndexer); await indexer.process(model); -// IDS Integration -const collector: FRAGS.IfcProperties = {}; - -const entityFacet = new OBC.IDSEntityFacet(WEBIFC.IFCSLAB); -await entityFacet.getEntities(model, collector); +// const ids = components.get(OBC.IDSSpecifications); +// const specifications = ids.create("My First IDS!", "IFC4X3"); +// Define some facets to be used in specifications +const entityFacet = new OBC.IDSEntityFacet(components, WEBIFC.IFCSLAB); const propertyFacet = new OBC.IDSPropertyFacet( components, { type: "simpleValue", value: "Pset_SlabCommon" }, { type: "simpleValue", value: "IsExternal" }, ); -propertyFacet.value = { type: "simpleValue", value: true }; +propertyFacet.value = { type: "simpleValue", value: false }; + +const classificationFacet = new OBC.IDSClassificationFacet(components, { + type: "simpleValue", + value: "Uniformat", +}); + +const partOfFacet = new OBC.IDSPartOfFacet( + components, + WEBIFC.IFCBUILDINGSTOREY, +); + +partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; + +// IfcSlab entities must have a Pset_SlabCommon with an IsExternal property set to false +const entitiesA: FRAGS.IfcProperties = {}; +await entityFacet.getEntities(model, entitiesA); +const resultA = await propertyFacet.test(entitiesA, model); +console.log(resultA); + +// Entities with a Pset_SlabCommon including an IsExternal property set to false, must be IfcSlab +const entitiesB: FRAGS.IfcProperties = {}; +await propertyFacet.getEntities(model, entitiesB); +const resultB = await entityFacet.test(entitiesB); +console.log(resultB); -const result = await propertyFacet.test(collector, model); +// Entities with Uniformat IfcClassification must be IfcSlab +const entitiesC: FRAGS.IfcProperties = {}; +await classificationFacet.getEntities(model, entitiesC); +const resultC = await entityFacet.test(entitiesC); +console.log(resultC); -// BCF Integration -const bcfTopics = components.get(OBC.BCFTopics); -const viewpoints = components.get(OBC.Viewpoints); +// IfcSlab entities must have IfcClassification as Uniformat +const entitiesD: FRAGS.IfcProperties = {}; +await entityFacet.getEntities(model, entitiesD); +const resultD = await classificationFacet.test(entitiesD, model); +console.log(resultD); -if (result.fail.length > 0) { - const topic = bcfTopics.create({ - title: "Invalid Property", - description: "This elements are not external", - }); +// IfcSlab entities must be related with IfcBuildingStorey +const entitiesE: FRAGS.IfcProperties = {}; +await entityFacet.getEntities(model, entitiesE); +const resultE = await partOfFacet.test(entitiesE, model); +console.log(resultE); - const viewpoint = viewpoints.create(world); - viewpoint.selectionComponents.add(...result.fail); - topic.viewpoints.add(viewpoint.guid); -} +// Entities related with any IfcBuildingStorey must have a Pset_SlabCommon with an IsExternal property set to false +const entitiesF: FRAGS.IfcProperties = {}; +await partOfFacet.getEntities(model, entitiesF); +const resultF = await propertyFacet.test(entitiesF, model); +console.log(resultF); diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts index 68b933044..fe1d40097 100644 --- a/packages/core/src/openbim/IDSSpecifications/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -1,3 +1,4 @@ +import * as FRAGS from "@thatopen/fragments"; import { Component, DataMap } from "../../core/Types"; import { IDSSpecification } from "./src"; @@ -6,7 +7,17 @@ export class IDSSpecifications extends Component { readonly list = new DataMap(); - create() {} + create(name: string, ifcVersion: FRAGS.IfcSchema) { + const specification = new IDSSpecification( + this.components, + name, + ifcVersion, + ); + + this.list.set(specification.guid, specification); + + return specification; + } } export * from "./src"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 1eb7044c3..28824897d 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -1,142 +1,68 @@ import * as FRAGS from "@thatopen/fragments"; import { Components } from "../../../core/Components"; -import { Component } from "../../../core/Types"; -import { IDSCheckResult, IDSFacet, IfcVersion } from "./types"; +import { DataSet } from "../../../core/Types"; +import { IDSCheckResult, IDSFacet } from "./types"; +import { UUID } from "../../../utils"; -export class IDSSpecification extends Component { +export class IDSSpecification { name: string; - ifcVersion: IfcVersion; + ifcVersion: FRAGS.IfcSchema; identifier?: string | number; description?: string; instructions?: string; - applicability: IDSFacet[] = []; - requirements: IDSFacet[] = []; - enabled = true; + applicability = new DataSet(); + requirements = new DataSet(); - constructor(components: Components, name: string, ifcVersion: IfcVersion) { - super(components); - this.name = name; - this.ifcVersion = ifcVersion; - } + readonly guid = UUID.create(); - addApplicability(applicability: IDSFacet) { - this.applicability.push(applicability); - } + protected components: Components; - addRequirement(requirement: IDSFacet) { - this.requirements.push(requirement); + constructor( + components: Components, + name: string, + ifcVersion: FRAGS.IfcSchema, + ) { + this.components = components; + this.name = name; + this.ifcVersion = ifcVersion; } - check(model: FRAGS.FragmentsGroup) { - if (!model.hasProperties) - throw new Error(`${model.name || model.uuid} doesn't have properties`); - const result: IDSCheckResult = { pass: {}, fail: {} }; + async check(model: FRAGS.FragmentsGroup) { + const result: IDSCheckResult = { pass: [], fail: [] }; // Get applicable elements - const entities: { [expressID: string]: Record } = {}; - this.applicability.forEach((applicability) => { - applicability.getEntities(model.properties, entities); - }); - // return + const entities: FRAGS.IfcProperties = {}; + for (const app of this.applicability) { + await app.getEntities(model, entities); + } // Test applicable elements against requirements const requirementsResult: { [expressId: string]: boolean } = {}; for (const expressID in entities) { requirementsResult[expressID] = true; } - this.requirements.forEach((requirement) => { - const arrayEntities = Object.values(entities); - const checkingElements = arrayEntities.filter( - (entity) => requirementsResult[entity.expressID], - ); - const test = requirement.test(model.properties, checkingElements); - if (!test) { - return; - } - for (const expressID in test.fail) { - requirementsResult[expressID] = false; - } - }); - for (const expressID in requirementsResult) { - const entity = entities[expressID]; - if (!entity) { - continue; - } - if (requirementsResult[expressID]) { - result.pass[expressID] = entity; - } else { - result.fail[expressID] = entity; - } - } - return result; - } - resultToGlobalIds(facetResult: IdsSpecificationResult) { - const result: { pass: string[]; fail: string[] } = { pass: [], fail: [] }; - const passed = Object.values(facetResult.pass); - const failed = Object.values(facetResult.fail); - result.pass = passed.map((entity) => { - return entity.GlobalId.value; - }); - result.fail = failed.map((entity) => { - return entity.GlobalId.value; - }); - return result; - } + // for (const requirement of this.requirements) { + // const arrayEntities = Object.values(entities); + // const checkingElements = arrayEntities.filter( + // (entity) => requirementsResult[entity.expressID], + // ); + // const test = await requirement.test(checkingElements, model); + // for (const expressID in test.fail) { + // requirementsResult[expressID] = false; + // } + // } - resultToFragmentMap( - models: FRAGS.FragmentsGroup[], - facetResult: IDSCheckResult, - ) { - const result: { - pass: { [fragmentID: string]: string[] }; - fail: { [fragmentID: string]: string[] }; - } = { pass: {}, fail: {} }; - models.forEach((model) => { - const expressIDFragmentIDMap = model.expressIDFragmentIDMap; - for (const expressID in facetResult.pass) { - const fragmentID = expressIDFragmentIDMap[expressID]; - if (!fragmentID) { - continue; - } - if (!result.pass[fragmentID]) { - result.pass[fragmentID] = []; - } - result.pass[fragmentID].push(String(expressID)); - } - for (const expressID in facetResult.fail) { - const fragmentID = expressIDFragmentIDMap[expressID]; - if (!fragmentID) { - continue; - } - if (!result.fail[fragmentID]) { - result.fail[fragmentID] = []; - } - result.fail[fragmentID].push(String(expressID)); - } - }); - return result; - } + // for (const expressID in requirementsResult) { + // const entity = entities[expressID]; + // if (!entity) continue; + // if (requirementsResult[expressID]) { + // result.pass[expressID] = entity; + // } else { + // result.fail[expressID] = entity; + // } + // } - highlightResult( - result: { - pass: { [fragmentID: string]: string[] }; - fail: { [fragmentID: string]: string[] }; - }, - applyTransparency = false, - ) { - const fragments = this.components.tools.get("Fragments") as - | Fragments - | undefined; - if (!fragments) { - return; - } - if (applyTransparency) { - fragments.materials.apply( - new MeshLambertMaterial({ transparent: true, opacity: 0.01 }), - ); - } - fragments.highlighter.highlightByID("ids-check-pass", result.pass); - fragments.highlighter.highlightByID("ids-check-fail", result.fail); + return result; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts b/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts new file mode 100644 index 000000000..b55ea015b --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts @@ -0,0 +1 @@ +import { IDSFacetParameter } from "./types"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index 00223a70e..209797d04 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -1,25 +1,27 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSFacet, IDSFacetParameter, IDSCheckResult } from "../types"; +import { IDSFacet, IDSFacetParameter } from "../types"; +import { Components } from "../../../../core/Components"; -// https://github.com/buildingSMART/IDS/blob/master/Documentation/attribute-facet.md -// Every entity in an IFC model has a list of standardised Attributes. -// Attributes are a limited set of fundamental data (usually less than 10) associated with all IFC entities. -// These are fixed by the IFC standard and cannot be customised. +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/attribute-facet.md -export class IDSAttributeFacet { +export class IDSAttributeFacet extends IDSFacet { name: string; value?: IDSFacetParameter; - constructor(name: string) { + constructor(components: Components, name: string) { + super(components); this.name = name; } // This can be very ineficcient as we do not have an easy way to get an entity based on an attribute + // Right now, all entities must be iterated. // When the new IfcEntitiesFinder comes, this can become easier. + // This may be greatly increase in performance if the applicability has any of the other facets async getEntities( model: FRAGS.FragmentsGroup, - collector: { [expressID: string]: Record }, + collector: FRAGS.IfcProperties = {}, ) { + return []; // for (const expressID in model) { // if (collector[expressID]) continue; // const entity = model[expressID]; @@ -43,8 +45,8 @@ export class IDSAttributeFacet { // } } - test(entities: FRAGS.IfcProperties) { - const result: IDSCheckResult = { pass: [], fail: [] }; + async test(entities: FRAGS.IfcProperties) { + this.testResult = { pass: [], fail: [] }; for (const expressID in entities) { const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; @@ -59,18 +61,15 @@ export class IDSAttributeFacet { if (this.value.type === "simpleValue") { valueMatches = attribute.value === this.value.value; } - if (this.value.type === "restriction") { - const regex = new RegExp(this.value.value); + if (this.value.value && this.value.type === "restriction") { + const regex = new RegExp(String(this.value.value)); valueMatches = regex.test(attribute.value); } } - if (attributeExists && valueMatches) { - result.pass.push(attrs.GlobalId.value); - } else { - result.fail.push(attrs.GlobalId.value); - } + this.saveResult(attrs, attributeExists && valueMatches); } - return result; + + return this.testResult; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index eb100baa3..bb8ec3e2f 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -1,26 +1,140 @@ +import * as FRAGS from "@thatopen/fragments"; +import * as WEBIFC from "web-ifc"; +import { Components } from "../../../../core/Components"; import { IDSFacet, IDSFacetParameter } from "../types"; +import { IfcRelationsIndexer } from "../../../../ifc/IfcRelationsIndexer"; -// https://github.com/buildingSMART/IDS/blob/master/Documentation/classification-facet.md -interface IIdsClassificationFacet { - system?: IDSFacetParameter; - value?: IDSFacetParameter; - uri?: string; -} +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/classification-facet.md -export class IdsClassificationFacet - implements IIdsClassificationFacet, IDSFacet -{ - system?: IDSFacetParameter; +export class IDSClassificationFacet extends IDSFacet { + system: IDSFacetParameter; value?: IDSFacetParameter; uri?: string; - constructor(parameters: IIdsClassificationFacet) { - this.system = parameters.system; - this.value = parameters.value; - this.uri = parameters.uri; + constructor(components: Components, system: IDSFacetParameter) { + super(components); + this.system = system; + } + + async getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties = {}, + ) { + const result: number[] = []; + const classificationReferences = await model.getAllPropertiesOfType( + WEBIFC.IFCCLASSIFICATIONREFERENCE, + ); + + if (!classificationReferences) return result; + + const matchingClassifications: number[] = []; + + for (const _classificationID in classificationReferences) { + const classificationID = Number(_classificationID); + const attrs = await model.getProperties(classificationID); + if (!attrs) continue; + + const referencedSourceID = attrs.ReferencedSource?.value; + if (!referencedSourceID) continue; + + const classificationAttrs = await model.getProperties(referencedSourceID); + if (!classificationAttrs) continue; + + let systemMatches = true; + let valueMatches = true; + let uriMatches = true; + + systemMatches = classificationAttrs.Name?.value === this.system.value; + if (!systemMatches) continue; + + if (this.value) { + valueMatches = attrs.Identification?.value === this.value.value; + if (!valueMatches) continue; + } + if (this.uri) { + uriMatches = attrs.Location?.value === this.uri; + if (!uriMatches) continue; + } + matchingClassifications.push(classificationID); + } + + const indexer = this.components.get(IfcRelationsIndexer); + + for (const classificationID of matchingClassifications) { + const expressIDs = indexer.getEntitiesWithRelation( + model, + "HasAssociations", + classificationID, + ); + + for (const expressID of expressIDs) { + if (expressID in collector) continue; + const attrs = await model.getProperties(expressID); + if (!attrs) continue; + collector[expressID] = attrs; + result.push(expressID); + } + } + + return result; } - getEntities() {} + async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { + this.testResult = { pass: [], fail: [] }; + const indexer = this.components.get(IfcRelationsIndexer); + for (const _expressID in entities) { + const expressID = Number(_expressID); + const attrs = entities[expressID]; + if (!attrs.GlobalId?.value) continue; + + let matches = false; + + const associations = indexer.getEntityRelations( + model, + expressID, + "HasAssociations", + ); + if (!associations) { + this.saveResult(attrs, matches); + continue; + } + + for (const associationID of associations) { + const associationAttrs = await model.getProperties(associationID); + if (!associationAttrs) continue; + if (associationAttrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) + continue; + + const referencedSourceID = associationAttrs.ReferencedSource?.value; + if (!referencedSourceID) continue; - test() {} + const classificationAttrs = + await model.getProperties(referencedSourceID); + if (!classificationAttrs) continue; + + let systemMatches = true; + let valueMatches = true; + let uriMatches = true; + + systemMatches = classificationAttrs.Name?.value === this.system.value; + if (!systemMatches) continue; + + if (this.value) { + valueMatches = attrs.Identification?.value === this.value.value; + if (!valueMatches) continue; + } + if (this.uri) { + uriMatches = attrs.Location?.value === this.uri; + if (!uriMatches) continue; + } + + matches = true; + break; + } + + this.saveResult(attrs, matches); + } + + return this.testResult; + } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index cb45e1b1b..803692c8d 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -1,9 +1,10 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSCheckResult, IDSFacet } from "../types"; +import { IDSFacet } from "../types"; +import { Components } from "../../../../core/Components"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md -export class IDSEntityFacet { +export class IDSEntityFacet extends IDSFacet { type: number; private _predefinedType?: string; @@ -14,7 +15,8 @@ export class IDSEntityFacet { return this._predefinedType; } - constructor(type: number) { + constructor(components: Components, type: number) { + super(components); this.type = type; } @@ -28,9 +30,9 @@ export class IDSEntityFacet { for (const expressID in entities) { collector[expressID] = entities[expressID]; } - return Object.keys(entities) as unknown as number[]; + return Object.keys(entities).map(Number); } - const validEntities: number[] = []; + const result: number[] = []; for (const _expressID in entities) { const expressID = Number(_expressID); if (expressID in collector) continue; @@ -39,14 +41,14 @@ export class IDSEntityFacet { attrs.PredefinedType?.value === this.predefinedType; if (validPredefinedType) { collector[expressID] = attrs; - validEntities.push(expressID); + result.push(expressID); } } - return validEntities; + return result; } - test(entities: FRAGS.IfcProperties) { - const result: IDSCheckResult = { pass: [], fail: [] }; + async test(entities: FRAGS.IfcProperties) { + this.testResult = { pass: [], fail: [] }; for (const expressID in entities) { const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; @@ -61,12 +63,9 @@ export class IDSEntityFacet { attrs.PredefinedType?.value === this.predefinedType; } - if (typeMatches && predefinedTypeMatches) { - result.pass.push(attrs.GlobalId.value); - } else { - result.fail.push(attrs.GlobalId.value); - } + this.saveResult(attrs, typeMatches && predefinedTypeMatches); } - return result; + + return this.testResult; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts index 8abee031c..92c79d5b5 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts @@ -1,21 +1,22 @@ -import { IDSFacet, IDSFacetParameter } from "../types"; +import * as FRAGS from "@thatopen/fragments"; +import { IDSCheckResult, IDSFacet, IDSFacetParameter } from "../types"; -// https://github.com/buildingSMART/IDS/blob/master/Documentation/material-facet.md -interface IIdsMaterialFacet { - value?: IDSFacetParameter; - uri?: string; -} +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/material-facet.md -export class IdsMaterialFacet implements IIdsMaterialFacet, IDSFacet { +export class IdsMaterialFacet extends IDSFacet { value?: IDSFacetParameter; uri?: string; - constructor(parameters: IIdsMaterialFacet) { - this.value = parameters.value; - this.uri = parameters.uri; + async getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties = {}, + ) { + const result: number[] = []; + return result; } - getEntities() {} - - test() {} + async test(entities: FRAGS.IfcProperties) { + const result: IDSCheckResult = { pass: [], fail: [] }; + return result; + } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts index 7b2eeed66..8722acce8 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts @@ -1,21 +1,124 @@ -import { IDSFacet, IDSFacetParameter } from "../types"; +import * as FRAGS from "@thatopen/fragments"; +import { Components } from "../../../../core/Components"; +import { + IfcRelation, + IfcRelationsIndexer, + relToAttributesMap, +} from "../../../../ifc"; +import { IDSFacet } from "../types"; -// https://github.com/buildingSMART/IDS/blob/master/Documentation/partof-facet.md -interface IIdsPartOfFacet { - relation: IDSFacetParameter; - entity?: IDSFacetParameter; -} +// https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/partof-facet.md + +export class IDSPartOfFacet extends IDSFacet { + entity: number; + + // Performance should be better if you provide the type of relation + relation?: number; + + constructor(components: Components, entity: number) { + super(components); + this.entity = entity; + } + + async getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties = {}, + ) { + const result: number[] = []; + const entities = await model.getAllPropertiesOfType(this.entity); + if (!entities) return result; + + const indexer = this.components.get(IfcRelationsIndexer); + + const modelRelations = indexer.relationMaps[model.uuid]; + if (!modelRelations) return result; -export class IdsPartOfFacet implements IIdsPartOfFacet, IDSFacet { - relation: IDSFacetParameter; - entity?: IDSFacetParameter; + if (this.relation) { + const invAttrs = relToAttributesMap.get(this.relation as IfcRelation); + if (!invAttrs) return result; + for (const _expressID in entities) { + const expressID = Number(_expressID); + const { forRelated } = invAttrs; + const relations = indexer.getEntitiesWithRelation( + model, + forRelated, + expressID, + ); + for (const relID of relations) { + if (relID in collector) continue; + const relAttrs = await model.getProperties(relID); + if (!relAttrs) continue; + collector[relID] = relAttrs; + result.push(relID); + } + } + } else { + for (const _expressID in entities) { + const expressID = Number(_expressID); + for (const [entityID, rels] of modelRelations) { + if (entityID in collector) continue; + const relAttrs = await model.getProperties(entityID); + if (!relAttrs) continue; + // Check if any of the relations with the entity includes this.entity + for (const [_, relIDs] of rels) { + if (!relIDs.includes(expressID)) continue; + collector[entityID] = relAttrs; + result.push(entityID); + } + } + } + } - constructor(parameters: IIdsPartOfFacet) { - this.relation = parameters.relation; - this.entity = parameters.entity; + return result; } - getEntities() {} + async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { + this.testResult = { pass: [], fail: [] }; + const indexer = this.components.get(IfcRelationsIndexer); + for (const _expressID in entities) { + const expressID = Number(_expressID); + const attrs = entities[expressID]; + if (!attrs.GlobalId?.value) continue; - test() {} + let matches = false; + + const modelRelations = indexer.relationMaps[model.uuid]; + if (!modelRelations) { + this.saveResult(attrs, matches); + continue; + } + + const entityRelations = modelRelations.get(expressID); + if (!entityRelations) { + this.saveResult(attrs, matches); + continue; + } + + for (const [invAttrIndex, relIDs] of entityRelations) { + if (this.relation) { + const invAttrs = relToAttributesMap.get(this.relation as IfcRelation); + if (!invAttrs) continue; + const forRelatedIndex = indexer.getAttributeIndex( + invAttrs.forRelated, + ); + if (forRelatedIndex !== invAttrIndex) continue; + } + + for (const relID of relIDs) { + const relAttrs = await model.getProperties(relID); + if (!relAttrs) continue; + const entityMatches = relAttrs.type === this.entity; + if (!entityMatches) continue; + matches = true; + break; + } + + if (matches) break; + } + + this.saveResult(attrs, matches); + } + + return this.testResult; + } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts index 47bd51d4d..e830dfe61 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts @@ -1,50 +1,116 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; -import { IDSCheckResult, IDSFacet, IDSFacetParameter } from "../types"; +import { IDSFacet, IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; import { IfcRelationsIndexer } from "../../../../ifc"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/property-facet.md -export class IDSPropertyFacet { - propertySet: IDSFacetParameter; // This is the name of the property set, like Pset_WallCommon, Qto_WallBaseQuantities or any other custom one. - name: IDSFacetParameter; // This is the name of the property like LoadBearing, IsExternal or any other custom one. - dataType?: string; + +export class IDSPropertyFacet extends IDSFacet { + propertySet: IDSFacetParameter; + baseName: IDSFacetParameter; + dataType?: number; value?: IDSFacetParameter; uri?: string; - private _components: Components; - constructor( components: Components, propertySet: IDSFacetParameter, name: IDSFacetParameter, ) { - this._components = components; + super(components); this.propertySet = propertySet; - this.name = name; + this.baseName = name; } async getEntities( model: FRAGS.FragmentsGroup, - collector: { [expressID: string]: Record } = {}, - ) {} + collector: FRAGS.IfcProperties = {}, + ) { + let sets: FRAGS.IfcProperties = {}; + const psets = await model.getAllPropertiesOfType(WEBIFC.IFCPROPERTYSET); + sets = { ...sets, ...psets }; + const qsets = await model.getAllPropertiesOfType(WEBIFC.IFCELEMENTQUANTITY); + sets = { ...sets, ...qsets }; + if (Object.keys(sets).length === 0) return []; + + const matchingSets: number[] = []; + + for (const _setID in sets) { + const setID = Number(_setID); + const attrs = await model.getProperties(setID); + if (!attrs) continue; + + const nameMatches = attrs.Name?.value === this.propertySet.value; + if (!nameMatches) continue; + + let propsListName: string | undefined; + if (attrs.type === WEBIFC.IFCPROPERTYSET) propsListName = "HasProperties"; + if (attrs.type === WEBIFC.IFCELEMENTQUANTITY) + propsListName = "Quantities"; + if (!propsListName) continue; + + for (const handle of attrs[propsListName]) { + const propAttrs = await model.getProperties(handle.value); + if (!propAttrs) continue; + + const propNameMatches = propAttrs.Name?.value === this.baseName.value; + if (!propNameMatches) continue; + + if (this.value) { + const valueKey = Object.keys(propAttrs).find((name) => + name.endsWith("Value"), + ); + if (!valueKey) continue; + const valueMatches = propAttrs[valueKey].value === this.value.value; + if (!valueMatches) continue; + } + + matchingSets.push(setID); + } + } + + const result: number[] = []; + const indexer = this.components.get(IfcRelationsIndexer); + + for (const setID of matchingSets) { + const expressIDs = indexer.getEntitiesWithRelation( + model, + "IsDefinedBy", + setID, + ); + + for (const expressID of expressIDs) { + if (expressID in collector) continue; + const attrs = await model.getProperties(expressID); + if (!attrs) continue; + collector[expressID] = attrs; + result.push(expressID); + } + } + + return []; + } async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { - const result: IDSCheckResult = { pass: [], fail: [] }; - const indexer = this._components.get(IfcRelationsIndexer); + this.testResult = { pass: [], fail: [] }; + const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; + let matches = false; + const definitions = indexer.getEntityRelations( model, expressID, "IsDefinedBy", ); - if (!definitions) continue; - - let matches = false; + if (!definitions) { + this.saveResult(attrs, matches); + continue; + } for (const definitionID of definitions) { const definitionAttrs = await model.getProperties(definitionID); @@ -65,7 +131,7 @@ export class IDSPropertyFacet { const propAttrs = await model.getProperties(handle.value); if (!propAttrs) continue; - const propNameMatches = propAttrs.Name?.value === this.name.value; + const propNameMatches = propAttrs.Name?.value === this.baseName.value; if (!propNameMatches) continue; if (this.value) { @@ -82,12 +148,9 @@ export class IDSPropertyFacet { } } - if (matches) { - result.pass.push(attrs.GlobalId.value); - } else { - result.fail.push(attrs.GlobalId.value); - } + this.saveResult(attrs, matches); } - return result; + + return this.testResult; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index aba03f07d..dd7e03c13 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -1,36 +1,44 @@ +import * as FRAGS from "@thatopen/fragments"; import { IDSSpecification } from "./Specification"; - -export type IDSFacetParameterType = "simpleValue" | "restriction"; +import { Components } from "../../../core/Components"; export interface IDSFacetParameter { - type: IDSFacetParameterType; + type: "simpleValue" | "restriction"; value?: string | boolean | number; enumeration?: string[] | number[]; } -// export interface IDSCheckResult { -// pass: { [expressID: string]: Record }; -// fail: { [expressID: string]: Record }; -// } - +/** + * Represents the result of a check performed by an IDS facet. + * This interface contains two arrays: `pass` and `fail`. Each array contains IfcGUIDs of the entities that passed or failed the check, respectively. + */ export interface IDSCheckResult { - pass: string[]; // IfcGUIDs + pass: string[]; fail: string[]; } -export interface IDSFacet { - instructions?: string; - getEntities: ( - ifcRawProperties: Record, - collector: { [expressID: string]: Record }, - ) => void; - test: ( - ifcRawProperties: Record, - entities: Record[], - ) => IDSCheckResult; -} +export abstract class IDSFacet { + constructor(protected components: Components) {} -export type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3"; + protected testResult: IDSCheckResult = { pass: [], fail: [] }; + protected saveResult(attrs: any, matches: boolean) { + if (matches) { + this.testResult.pass.push(attrs.GlobalId.value); + } else { + this.testResult.fail.push(attrs.GlobalId.value); + } + } + + abstract getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties, + ): Promise; + + abstract test( + entities: FRAGS.IfcProperties, + model?: FRAGS.FragmentsGroup, + ): Promise; +} export interface IDS { title: string; From 8c0bf7c8f32e1d083d6eadc480c52e7e4bd65dfa Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Tue, 3 Sep 2024 21:41:05 -0500 Subject: [PATCH 25/51] improved the requirement evaluation functions --- .../src/openbim/IDSSpecifications/example.ts | 44 ++++--- .../resources/project-naming.ts | 36 ------ .../resources/specification.ts | 37 ------ .../IDSSpecifications/src/Specification.ts | 5 +- .../IDSSpecifications/src/eval-value.ts | 1 - .../IDSSpecifications/src/facets/Attribute.ts | 17 +-- .../src/facets/Classification.ts | 102 +++++++++++++--- .../IDSSpecifications/src/facets/Entity.ts | 6 +- .../IDSSpecifications/src/facets/Facet.ts | 115 ++++++++++++++++++ .../IDSSpecifications/src/facets/Material.ts | 7 +- .../IDSSpecifications/src/facets/PartOf.ts | 6 +- .../IDSSpecifications/src/facets/Property.ts | 23 ++-- .../IDSSpecifications/src/facets/index.ts | 1 + .../openbim/IDSSpecifications/src/types.ts | 80 +++++++----- 14 files changed, 308 insertions(+), 172 deletions(-) delete mode 100644 packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts delete mode 100644 packages/core/src/openbim/IDSSpecifications/resources/specification.ts delete mode 100644 packages/core/src/openbim/IDSSpecifications/src/eval-value.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index 54c1e7cfe..450410416 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -2,6 +2,17 @@ import * as WEBIFC from "web-ifc"; import * as FRAGS from "@thatopen/fragments"; import * as OBC from "../.."; +const logResult = (result: OBC.IDSCheckResult[]) => { + console.log( + "Pass:", + result.filter(({ pass }) => pass), + ); + console.log( + "Fail:", + result.filter(({ pass }) => !pass), + ); +}; + const components = new OBC.Components(); const ifcLoader = components.get(OBC.IfcLoader); await ifcLoader.setup(); @@ -17,24 +28,21 @@ await indexer.process(model); // const specifications = ids.create("My First IDS!", "IFC4X3"); // Define some facets to be used in specifications -const entityFacet = new OBC.IDSEntityFacet(components, WEBIFC.IFCSLAB); -const propertyFacet = new OBC.IDSPropertyFacet( +const entityFacet = new OBC.IDSEntity(components, WEBIFC.IFCSLAB); +const propertyFacet = new OBC.IDSProperty( components, - { type: "simpleValue", value: "Pset_SlabCommon" }, - { type: "simpleValue", value: "IsExternal" }, + { type: "simple", parameter: "Pset_SlabCommon" }, + { type: "simple", parameter: "IsExternal" }, ); -propertyFacet.value = { type: "simpleValue", value: false }; +propertyFacet.value = { type: "simple", parameter: false }; -const classificationFacet = new OBC.IDSClassificationFacet(components, { - type: "simpleValue", - value: "Uniformat", +const classificationFacet = new OBC.IDSClassification(components, { + type: "simple", + parameter: "Uniformat", }); -const partOfFacet = new OBC.IDSPartOfFacet( - components, - WEBIFC.IFCBUILDINGSTOREY, -); +const partOfFacet = new OBC.IDSPartOf(components, WEBIFC.IFCBUILDINGSTOREY); partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; @@ -42,34 +50,34 @@ partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; const entitiesA: FRAGS.IfcProperties = {}; await entityFacet.getEntities(model, entitiesA); const resultA = await propertyFacet.test(entitiesA, model); -console.log(resultA); +logResult(resultA); // Entities with a Pset_SlabCommon including an IsExternal property set to false, must be IfcSlab const entitiesB: FRAGS.IfcProperties = {}; await propertyFacet.getEntities(model, entitiesB); const resultB = await entityFacet.test(entitiesB); -console.log(resultB); +logResult(resultB); // Entities with Uniformat IfcClassification must be IfcSlab const entitiesC: FRAGS.IfcProperties = {}; await classificationFacet.getEntities(model, entitiesC); const resultC = await entityFacet.test(entitiesC); -console.log(resultC); +logResult(resultC); // IfcSlab entities must have IfcClassification as Uniformat const entitiesD: FRAGS.IfcProperties = {}; await entityFacet.getEntities(model, entitiesD); const resultD = await classificationFacet.test(entitiesD, model); -console.log(resultD); +logResult(resultD); // IfcSlab entities must be related with IfcBuildingStorey const entitiesE: FRAGS.IfcProperties = {}; await entityFacet.getEntities(model, entitiesE); const resultE = await partOfFacet.test(entitiesE, model); -console.log(resultE); +logResult(resultE); // Entities related with any IfcBuildingStorey must have a Pset_SlabCommon with an IsExternal property set to false const entitiesF: FRAGS.IfcProperties = {}; await partOfFacet.getEntities(model, entitiesF); const resultF = await propertyFacet.test(entitiesF, model); -console.log(resultF); +logResult(resultF); diff --git a/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts b/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts deleted file mode 100644 index c31f1be08..000000000 --- a/packages/core/src/openbim/IDSSpecifications/resources/project-naming.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { IIDS } from ".." - -export const specification: IIDS = { - title: "Bimply Sample IDS", - copyright: "Bimply", - version: "1.0.0", - description: "These are example specifications for those learning how to use IDS. The goal is to be able to automate IFC requirements.", - author: "juan.hoyos4@gmail.com", - date: new Date(), - purpose: "Contractual requirements", - milestone: "Design", - specifications: [ - { - name: "Project naming", - ifcVersion: "IFC4", - identifier: 1, - description: "Projects shall be named correctly for the purposes of identification, project archival, and model federation.", - instructions: "Each discipline is responsible for naming their own project.", - minOccurs: 1, - maxOccurs: 1, - applicability: [ - { - type: "entity", - name: {type: "simpleValue", value: "IFCPROJECT"}, - }, - ], - requirements: [ - { - type: "attribute", - name: {type: "simpleValue", value: "Name"}, - value: {type: "simpleValue", value: "TEST"}, - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/resources/specification.ts b/packages/core/src/openbim/IDSSpecifications/resources/specification.ts deleted file mode 100644 index e193f4632..000000000 --- a/packages/core/src/openbim/IDSSpecifications/resources/specification.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Ids, IdsEntityFacet, IdsPropertyFacet } from ".." - -export const specification: Ids = { - title: "Bimply Sample IDS", - copyright: "Bimply", - version: "1.0.0", - description: "These are example specifications for those learning how to use IDS. The goal is to be able to automate IFC requirements.", - author: "juan.hoyos4@gmail.com", - date: new Date(), - purpose: "Contractual requirements", - milestone: "Design", - specifications: [ - { - name: "Fire rating", - ifcVersion: "IFC4", - description: "All wall and floor finishes must not be load bearing.", - applicability: [ - { - type: new IdsEntityFacet({ - name: { type: "simpleValue", value: "IFCWALL" }, - predefinedType: { type: "simpleValue", value: "SOLIDWALL" } - }) - }, - ], - requirements: [ - { - type: new IdsPropertyFacet({ - name: { type: "simpleValue", value: "LoadBearing" }, - dataType: "IfcBoolean", - propertySet: { type: "simpleValue", value: "Pset_WallCommon" }, - value: { type: "simpleValue", value: "T" } - }), - } - ] - }, - ] -} \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 28824897d..16f02f716 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -1,8 +1,9 @@ import * as FRAGS from "@thatopen/fragments"; import { Components } from "../../../core/Components"; import { DataSet } from "../../../core/Types"; -import { IDSCheckResult, IDSFacet } from "./types"; +import { IDSCheckResult } from "./types"; import { UUID } from "../../../utils"; +import { IDSFacet } from "./facets"; export class IDSSpecification { name: string; @@ -28,7 +29,7 @@ export class IDSSpecification { } async check(model: FRAGS.FragmentsGroup) { - const result: IDSCheckResult = { pass: [], fail: [] }; + const result: IDSCheckResult[] = []; // Get applicable elements const entities: FRAGS.IfcProperties = {}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts b/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts deleted file mode 100644 index b55ea015b..000000000 --- a/packages/core/src/openbim/IDSSpecifications/src/eval-value.ts +++ /dev/null @@ -1 +0,0 @@ -import { IDSFacetParameter } from "./types"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index 209797d04..f4f2272ae 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -1,10 +1,11 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSFacet, IDSFacetParameter } from "../types"; +import { IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/attribute-facet.md -export class IDSAttributeFacet extends IDSFacet { +export class IDSAttribute extends IDSFacet { name: string; value?: IDSFacetParameter; @@ -46,7 +47,7 @@ export class IDSAttributeFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties) { - this.testResult = { pass: [], fail: [] }; + this.testResult = []; for (const expressID in entities) { const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; @@ -57,12 +58,12 @@ export class IDSAttributeFacet extends IDSFacet { // Check if the attribute value matches let valueMatches = true; - if (attributeExists && this.value && this.value.value) { - if (this.value.type === "simpleValue") { - valueMatches = attribute.value === this.value.value; + if (attributeExists && this.value && this.value.parameter) { + if (this.value.type === "simple") { + valueMatches = attribute.value === this.value.parameter; } - if (this.value.value && this.value.type === "restriction") { - const regex = new RegExp(String(this.value.value)); + if (this.value.parameter && this.value.type === "pattern") { + const regex = new RegExp(String(this.value.parameter)); valueMatches = regex.test(attribute.value); } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index bb8ec3e2f..2084e979f 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -1,12 +1,13 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; import { Components } from "../../../../core/Components"; -import { IDSFacet, IDSFacetParameter } from "../types"; +import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { IfcRelationsIndexer } from "../../../../ifc/IfcRelationsIndexer"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/classification-facet.md -export class IDSClassificationFacet extends IDSFacet { +export class IDSClassification extends IDSFacet { system: IDSFacetParameter; value?: IDSFacetParameter; uri?: string; @@ -44,11 +45,11 @@ export class IDSClassificationFacet extends IDSFacet { let valueMatches = true; let uriMatches = true; - systemMatches = classificationAttrs.Name?.value === this.system.value; + systemMatches = classificationAttrs.Name?.value === this.system.parameter; if (!systemMatches) continue; if (this.value) { - valueMatches = attrs.Identification?.value === this.value.value; + valueMatches = attrs.Identification?.value === this.value.parameter; if (!valueMatches) continue; } if (this.uri) { @@ -80,14 +81,21 @@ export class IDSClassificationFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { - this.testResult = { pass: [], fail: [] }; + this.testResult = []; const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; - let matches = false; + const checks: IDSCheck[] = []; + const result: IDSCheckResult = { + guid: attrs.GlobalId.value, + pass: false, + checks, + }; + + this.testResult.push(result); const associations = indexer.getEntityRelations( model, @@ -95,44 +103,98 @@ export class IDSClassificationFacet extends IDSFacet { "HasAssociations", ); if (!associations) { - this.saveResult(attrs, matches); + checks.push({ + parameter: "System", + currentValue: null, + requiredValue: this.system, + pass: false, + }); continue; } for (const associationID of associations) { const associationAttrs = await model.getProperties(associationID); - if (!associationAttrs) continue; - if (associationAttrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) + if (!associationAttrs) { + checks.push({ + parameter: "System", + currentValue: null, + requiredValue: this.system, + pass: false, + }); continue; + } + + if (associationAttrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) { + checks.push({ + parameter: "System", + currentValue: null, + requiredValue: this.system, + pass: false, + }); + continue; + } const referencedSourceID = associationAttrs.ReferencedSource?.value; - if (!referencedSourceID) continue; + if (!referencedSourceID) { + checks.push({ + parameter: "System", + currentValue: null, + requiredValue: this.system, + pass: false, + }); + continue; + } const classificationAttrs = await model.getProperties(referencedSourceID); - if (!classificationAttrs) continue; + if (!classificationAttrs) { + checks.push({ + parameter: "System", + currentValue: null, + requiredValue: this.system, + pass: false, + }); + continue; + } let systemMatches = true; let valueMatches = true; let uriMatches = true; - systemMatches = classificationAttrs.Name?.value === this.system.value; - if (!systemMatches) continue; + systemMatches = this.evalRequirement( + "System", + classificationAttrs.Name?.value, + this.system, + checks, + ); if (this.value) { - valueMatches = attrs.Identification?.value === this.value.value; - if (!valueMatches) continue; + const currentValue = attrs.Identification?.value; + valueMatches = this.evalRequirement( + "System", + currentValue, + this.value, + checks, + ); } + if (this.uri) { - uriMatches = attrs.Location?.value === this.uri; - if (!uriMatches) continue; + const currentValue = attrs.Location?.value; + uriMatches = this.evalRequirement( + "System", + currentValue, + { + type: "simple", + parameter: this.uri, + }, + checks, + ); } - matches = true; - break; + if (systemMatches && valueMatches && uriMatches) break; } - this.saveResult(attrs, matches); + result.pass = checks.every(({ pass }) => pass); } return this.testResult; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index 803692c8d..6f4933585 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -1,10 +1,10 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSFacet } from "../types"; import { Components } from "../../../../core/Components"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md -export class IDSEntityFacet extends IDSFacet { +export class IDSEntity extends IDSFacet { type: number; private _predefinedType?: string; @@ -48,7 +48,7 @@ export class IDSEntityFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties) { - this.testResult = { pass: [], fail: [] }; + this.testResult = []; for (const expressID in entities) { const attrs = entities[expressID]; if (!attrs.GlobalId?.value) continue; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts new file mode 100644 index 000000000..414d85743 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -0,0 +1,115 @@ +import * as FRAGS from "@thatopen/fragments"; +import { Components } from "../../../../core/Components"; +import { + IDSFacetParameter, + IDSCheckResult, + IDSFacetParameterName, + IDSSimpleParameter, + IDSEnumerationParameter, + IDSPatternParameter, + IDSLengthParameter, + IDSBoundsParameter, + IDSCheck, +} from "../types"; + +export abstract class IDSFacet { + constructor(protected components: Components) {} + + protected evalRequirement = ( + parameter: IDSFacetParameterName, + value: string | number | boolean, + facetParameter: IDSFacetParameter, + checks: IDSCheck[], + ) => { + const checkLog: IDSCheck = { + parameter, + currentValue: value, + requiredValue: facetParameter.parameter, + pass: false, + }; + + const index = checks.findIndex( + ({ parameter }) => parameter === checkLog.parameter, + ); + + if (index !== -1) { + checks[index] = checkLog; + } else { + checks.push(checkLog); + } + + if (facetParameter.type === "simple") { + const parameter = facetParameter.parameter as IDSSimpleParameter; + checkLog.pass = value === parameter; + } + + if (facetParameter.type === "enumeration") { + const parameter = facetParameter.parameter as IDSEnumerationParameter; + checkLog.pass = parameter.includes(value as never); + } + + if (facetParameter.type === "pattern") { + const parameter = facetParameter.parameter as IDSPatternParameter; + const regex = new RegExp(String(parameter)); + checkLog.pass = regex.test(String(value)); + } + + if (facetParameter.type === "length") { + const parameter = facetParameter.parameter as IDSLengthParameter; + const { min, length, max } = parameter; + if (length !== undefined) checkLog.pass = String(value).length === length; + if (min !== undefined) checkLog.pass = String(value).length >= min; + if (max !== undefined) checkLog.pass = String(value).length <= max; + } + + if (facetParameter.type === "bounds" && typeof value === "number") { + const { min, minInclusive, max, maxInclusive } = + facetParameter.parameter as IDSBoundsParameter; + + if (min !== undefined) { + if (minInclusive) { + if (value < min) checkLog.pass = false; + } else if (value <= min) { + checkLog.pass = false; + } + } + + if (max !== undefined) { + if (maxInclusive) { + if (value > max) checkLog.pass = false; + } else if (value >= max) { + checkLog.pass = false; + } + } + } + + return checkLog.pass; + }; + + protected testResult: IDSCheckResult[] = []; + protected saveResult(attrs: any, pass: boolean) { + const { GlobalId } = attrs; + if (!GlobalId) return; + const { value: guid } = GlobalId; + const result: IDSCheckResult = { guid, pass, checks: [] }; + // if (data && !pass) { + // const { currentValue, requiredValue, parameter } = data; + // result.reason = { + // currentValue, + // requiredValue, + // parameter, + // }; + // } + this.testResult.push(result); + } + + abstract getEntities( + model: FRAGS.FragmentsGroup, + collector: FRAGS.IfcProperties, + ): Promise; + + abstract test( + entities: FRAGS.IfcProperties, + model?: FRAGS.FragmentsGroup, + ): Promise; +} diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts index 92c79d5b5..4343d8b91 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts @@ -1,5 +1,6 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSCheckResult, IDSFacet, IDSFacetParameter } from "../types"; +import { IDSFacetParameter } from "../types"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/material-facet.md @@ -16,7 +17,7 @@ export class IdsMaterialFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties) { - const result: IDSCheckResult = { pass: [], fail: [] }; - return result; + this.testResult = []; + return this.testResult; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts index 8722acce8..99e05133d 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts @@ -5,11 +5,11 @@ import { IfcRelationsIndexer, relToAttributesMap, } from "../../../../ifc"; -import { IDSFacet } from "../types"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/partof-facet.md -export class IDSPartOfFacet extends IDSFacet { +export class IDSPartOf extends IDSFacet { entity: number; // Performance should be better if you provide the type of relation @@ -73,7 +73,7 @@ export class IDSPartOfFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { - this.testResult = { pass: [], fail: [] }; + this.testResult = []; const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts index e830dfe61..49de0474f 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts @@ -1,12 +1,13 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; -import { IDSFacet, IDSFacetParameter } from "../types"; +import { IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; import { IfcRelationsIndexer } from "../../../../ifc"; +import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/property-facet.md -export class IDSPropertyFacet extends IDSFacet { +export class IDSProperty extends IDSFacet { propertySet: IDSFacetParameter; baseName: IDSFacetParameter; dataType?: number; @@ -41,7 +42,7 @@ export class IDSPropertyFacet extends IDSFacet { const attrs = await model.getProperties(setID); if (!attrs) continue; - const nameMatches = attrs.Name?.value === this.propertySet.value; + const nameMatches = attrs.Name?.value === this.propertySet.parameter; if (!nameMatches) continue; let propsListName: string | undefined; @@ -54,7 +55,8 @@ export class IDSPropertyFacet extends IDSFacet { const propAttrs = await model.getProperties(handle.value); if (!propAttrs) continue; - const propNameMatches = propAttrs.Name?.value === this.baseName.value; + const propNameMatches = + propAttrs.Name?.value === this.baseName.parameter; if (!propNameMatches) continue; if (this.value) { @@ -62,7 +64,8 @@ export class IDSPropertyFacet extends IDSFacet { name.endsWith("Value"), ); if (!valueKey) continue; - const valueMatches = propAttrs[valueKey].value === this.value.value; + const valueMatches = + propAttrs[valueKey].value === this.value.parameter; if (!valueMatches) continue; } @@ -93,7 +96,7 @@ export class IDSPropertyFacet extends IDSFacet { } async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { - this.testResult = { pass: [], fail: [] }; + this.testResult = []; const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); @@ -117,7 +120,7 @@ export class IDSPropertyFacet extends IDSFacet { if (!definitionAttrs) continue; const nameMatches = - definitionAttrs.Name?.value === this.propertySet.value; + definitionAttrs.Name?.value === this.propertySet.parameter; if (!nameMatches) continue; let propsListName: string | undefined; @@ -131,7 +134,8 @@ export class IDSPropertyFacet extends IDSFacet { const propAttrs = await model.getProperties(handle.value); if (!propAttrs) continue; - const propNameMatches = propAttrs.Name?.value === this.baseName.value; + const propNameMatches = + propAttrs.Name?.value === this.baseName.parameter; if (!propNameMatches) continue; if (this.value) { @@ -139,7 +143,8 @@ export class IDSPropertyFacet extends IDSFacet { name.endsWith("Value"), ); if (!valueKey) continue; - const valueMatches = propAttrs[valueKey].value === this.value.value; + const valueMatches = + propAttrs[valueKey].value === this.value.parameter; if (!valueMatches) continue; } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts index 39e895e45..a0e9ded4b 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts @@ -4,3 +4,4 @@ export * from "./Entity"; export * from "./Material"; export * from "./PartOf"; export * from "./Property"; +export * from "./Facet"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index dd7e03c13..f2d51a9e0 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -1,43 +1,59 @@ -import * as FRAGS from "@thatopen/fragments"; import { IDSSpecification } from "./Specification"; -import { Components } from "../../../core/Components"; + +export type IDSFacetParameterName = + | "Name" + | "Predefined Type" + | "Value" + | "System" + | "URI" + | "Property Set" + | "Base Name" + | "Data Type" + | "Value" + | "Entity" + | "Relation"; + +export type IDSSimpleParameter = string | number | boolean; +export type IDSEnumerationParameter = string[] | number[] | boolean[]; +export type IDSPatternParameter = string; +export type IDSBoundsParameter = { + min?: number; + minInclusive?: boolean; + max?: number; + maxInclusive?: boolean; +}; +export type IDSLengthParameter = { + min?: number; + length?: number; + max?: number; +}; + +export interface IDSRestrictionParameter {} export interface IDSFacetParameter { - type: "simpleValue" | "restriction"; - value?: string | boolean | number; - enumeration?: string[] | number[]; + type: "simple" | "enumeration" | "pattern" | "bounds" | "length"; + parameter: + | IDSSimpleParameter + | IDSEnumerationParameter + | IDSPatternParameter + | IDSBoundsParameter + | IDSLengthParameter; +} + +export interface IDSCheck { + parameter: IDSFacetParameterName; + currentValue: string | number | boolean | null; + requiredValue: any; + pass: boolean; } /** - * Represents the result of a check performed by an IDS facet. - * This interface contains two arrays: `pass` and `fail`. Each array contains IfcGUIDs of the entities that passed or failed the check, respectively. + * Represents the result of a check performed by an IDSFacet test. */ export interface IDSCheckResult { - pass: string[]; - fail: string[]; -} - -export abstract class IDSFacet { - constructor(protected components: Components) {} - - protected testResult: IDSCheckResult = { pass: [], fail: [] }; - protected saveResult(attrs: any, matches: boolean) { - if (matches) { - this.testResult.pass.push(attrs.GlobalId.value); - } else { - this.testResult.fail.push(attrs.GlobalId.value); - } - } - - abstract getEntities( - model: FRAGS.FragmentsGroup, - collector: FRAGS.IfcProperties, - ): Promise; - - abstract test( - entities: FRAGS.IfcProperties, - model?: FRAGS.FragmentsGroup, - ): Promise; + guid: string; + pass: boolean; + checks: IDSCheck[]; } export interface IDS { From 88bc1755be64cecf4772270546a24270dfbf4821 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Wed, 4 Sep 2024 23:20:35 -0500 Subject: [PATCH 26/51] more working on polishing the tests on imported ids --- .../src/openbim/IDSSpecifications/example.ts | 199 ++++++++++++++---- .../src/openbim/IDSSpecifications/index.ts | 109 +++++++++- .../IDSSpecifications/src/Specification.ts | 21 +- .../IDSSpecifications/src/facets/Attribute.ts | 90 ++++++-- .../src/facets/Classification.ts | 13 +- .../IDSSpecifications/src/facets/Entity.ts | 34 +-- .../IDSSpecifications/src/facets/Facet.ts | 82 +++++--- .../IDSSpecifications/src/facets/PartOf.ts | 40 +++- .../src/importers/attribute.ts | 20 ++ .../src/importers/classification.ts | 20 ++ .../IDSSpecifications/src/importers/entity.ts | 16 ++ .../IDSSpecifications/src/importers/index.ts | 3 + .../src/importers/parameter.ts | 39 ++++ .../openbim/IDSSpecifications/src/types.ts | 22 +- 14 files changed, 573 insertions(+), 135 deletions(-) create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/attribute.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/index.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/parameter.ts diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index 450410416..61a9e83b3 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -16,7 +16,10 @@ const logResult = (result: OBC.IDSCheckResult[]) => { const components = new OBC.Components(); const ifcLoader = components.get(OBC.IfcLoader); await ifcLoader.setup(); -const file = await fetch("/resources/structure.ifc"); +// const file = await fetch("/resources/structure.ifc"); +const file = await fetch( + "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ifc", +); const data = await file.arrayBuffer(); const buffer = new Uint8Array(data); const model = await ifcLoader.load(buffer); @@ -24,11 +27,14 @@ const model = await ifcLoader.load(buffer); const indexer = components.get(OBC.IfcRelationsIndexer); await indexer.process(model); -// const ids = components.get(OBC.IDSSpecifications); +const ids = components.get(OBC.IDSSpecifications); // const specifications = ids.create("My First IDS!", "IFC4X3"); // Define some facets to be used in specifications -const entityFacet = new OBC.IDSEntity(components, WEBIFC.IFCSLAB); +const entityFacet = new OBC.IDSEntity(components, { + type: "simple", + parameter: "IFCSLAB", +}); const propertyFacet = new OBC.IDSProperty( components, { type: "simple", parameter: "Pset_SlabCommon" }, @@ -42,42 +48,157 @@ const classificationFacet = new OBC.IDSClassification(components, { parameter: "Uniformat", }); -const partOfFacet = new OBC.IDSPartOf(components, WEBIFC.IFCBUILDINGSTOREY); +const partOfFacet = new OBC.IDSPartOf(components, { + name: { type: "simple", parameter: "IFCBUILDINGSTOREY" }, +}); partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; -// IfcSlab entities must have a Pset_SlabCommon with an IsExternal property set to false -const entitiesA: FRAGS.IfcProperties = {}; -await entityFacet.getEntities(model, entitiesA); -const resultA = await propertyFacet.test(entitiesA, model); -logResult(resultA); - -// Entities with a Pset_SlabCommon including an IsExternal property set to false, must be IfcSlab -const entitiesB: FRAGS.IfcProperties = {}; -await propertyFacet.getEntities(model, entitiesB); -const resultB = await entityFacet.test(entitiesB); -logResult(resultB); - -// Entities with Uniformat IfcClassification must be IfcSlab -const entitiesC: FRAGS.IfcProperties = {}; -await classificationFacet.getEntities(model, entitiesC); -const resultC = await entityFacet.test(entitiesC); -logResult(resultC); - -// IfcSlab entities must have IfcClassification as Uniformat -const entitiesD: FRAGS.IfcProperties = {}; -await entityFacet.getEntities(model, entitiesD); -const resultD = await classificationFacet.test(entitiesD, model); -logResult(resultD); - -// IfcSlab entities must be related with IfcBuildingStorey -const entitiesE: FRAGS.IfcProperties = {}; -await entityFacet.getEntities(model, entitiesE); -const resultE = await partOfFacet.test(entitiesE, model); -logResult(resultE); - -// Entities related with any IfcBuildingStorey must have a Pset_SlabCommon with an IsExternal property set to false -const entitiesF: FRAGS.IfcProperties = {}; -await partOfFacet.getEntities(model, entitiesF); -const resultF = await propertyFacet.test(entitiesF, model); -logResult(resultF); +// // IfcSlab entities must have a Pset_SlabCommon with an IsExternal property set to false +// const entitiesA: FRAGS.IfcProperties = {}; +// await entityFacet.getEntities(model, entitiesA); +// const resultA = await propertyFacet.test(entitiesA, model); +// logResult(resultA); + +// // Entities with a Pset_SlabCommon including an IsExternal property set to false, must be IfcSlab +// const entitiesB: FRAGS.IfcProperties = {}; +// await propertyFacet.getEntities(model, entitiesB); +// const resultB = await entityFacet.test(entitiesB); +// logResult(resultB); + +// // Entities with Uniformat IfcClassification must be IfcSlab +// const entitiesC: FRAGS.IfcProperties = {}; +// await classificationFacet.getEntities(model, entitiesC); +// const resultC = await entityFacet.test(entitiesC); +// logResult(resultC); + +// // IfcSlab entities must have IfcClassification as Uniformat +// const entitiesD: FRAGS.IfcProperties = {}; +// await entityFacet.getEntities(model, entitiesD); +// const resultD = await classificationFacet.test(entitiesD, model); +// logResult(resultD); + +// // IfcSlab entities must be related with IfcBuildingStorey +// const entitiesE: FRAGS.IfcProperties = {}; +// await entityFacet.getEntities(model, entitiesE); +// const resultE = await partOfFacet.test(entitiesE, model); +// logResult(resultE); + +// // Entities related with any IfcBuildingStorey must have a Pset_SlabCommon with an IsExternal property set to false +// const entitiesF: FRAGS.IfcProperties = {}; +// await partOfFacet.getEntities(model, entitiesF); +// const resultF = await propertyFacet.test(entitiesF, model); +// logResult(resultF); + +// Importing +const idsFile = await fetch( + "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ids", +); +// const idsFile = await fetch("/resources/ids.ids"); + +const idsData = await idsFile.text(); +const imports = ids.load(idsData); +for (const spec of imports) { + const app = [...spec.applicability][0]; + const req = [...spec.requirements][0]; + const entities: FRAGS.IfcProperties = {}; + await app.getEntities(model, entities); + const result = await req.test(entities, model); + logResult(result); +} + +// Load test cases from GitHub +// Define the URL for fetching the files list +const apiURL = + "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/attribute?ref=development"; + +// Function to process each pair of IFC and IDS files +async function processPair(ifcUrl: string, idsUrl: string) { + try { + const routes = ifcUrl.split("/"); + const name = routes[routes.length - 1]; + const pieces = name.split("-"); + const bsResult = pieces[0] === "pass"; + + // Fetch the IFC and IDS content + const ifcResponse = await fetch(ifcUrl); + const idsResponse = await fetch(idsUrl); + + if (!ifcResponse.ok || !idsResponse.ok) { + throw new Error("Error fetching IFC or IDS file"); + } + + const ifcContent = await ifcResponse.arrayBuffer(); + const idsContent = await idsResponse.text(); + + const model = await ifcLoader.load(new Uint8Array(ifcContent)); + + const imports = ids.load(idsContent); + for (const spec of imports) { + const app = [...spec.applicability][0]; + const req = [...spec.requirements][0]; + const entities: FRAGS.IfcProperties = {}; + await app.getEntities(model, entities); + const result = await req.test(entities, model); + const passes = result.filter(({ pass }) => pass); + const fails = result.filter(({ pass }) => !pass); + console.log(bsResult, passes, fails, ifcUrl, idsUrl); + } + + // Use your custom loaders for IFC and IDS + // customIfcLoader(ifcContent); + // customIdsLoader(idsContent); + + // console.log(`Successfully processed pair: ${ifcUrl}, ${idsUrl}`); + } catch (error) { + // console.error(`Error processing pair: ${ifcUrl}, ${idsUrl}`, error); + } +} + +// Function to fetch the list of files and group them by pairs (IFC + IDS) +async function fetchFileListAndProcessPairs() { + try { + const response = await fetch(apiURL); + + if (!response.ok) { + throw new Error(`Error fetching files list: ${response.statusText}`); + } + + const files = await response.json(); + const filePairs: { [key: string]: { ifc?: string; ids?: string } } = {}; + + // Group files by their base names + for (const file of files) { + const fileName = file.name; + + // Extract the base name (everything before the file extension) + const baseName = fileName.split(".").slice(0, -1).join("."); + + // Check if the file is an .ifc or .ids and group them + if (fileName.endsWith(".ifc")) { + if (!filePairs[baseName]) filePairs[baseName] = {}; + filePairs[baseName].ifc = file.download_url; + } else if (fileName.endsWith(".ids")) { + if (!filePairs[baseName]) filePairs[baseName] = {}; + filePairs[baseName].ids = file.download_url; + } + } + + // Now process each pair using the custom loaders + for (const baseName in filePairs) { + const { ifc, ids } = filePairs[baseName]; + + if (ifc && ids) { + // console.log(`Processing pair: ${baseName}`); + await processPair(ifc, ids); + } else { + // console.warn(`Pair incomplete for ${baseName}`); + } + } + } catch (error) { + console.error(error); + } +} + +// Call the function to fetch and process file pairs +fetchFileListAndProcessPairs(); diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts index fe1d40097..955e5594d 100644 --- a/packages/core/src/openbim/IDSSpecifications/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -1,23 +1,126 @@ import * as FRAGS from "@thatopen/fragments"; +import { XMLParser } from "fast-xml-parser"; import { Component, DataMap } from "../../core/Types"; -import { IDSSpecification } from "./src"; +import { IDSFacet, IDSInfo, IDSSpecification } from "./src"; +import { Components } from "../../core"; +import { + createEntityFacets, + createAttributeFacets, + createClassificationFacets, +} from "./src/importers"; export class IDSSpecifications extends Component { + static uuid = "9f0b9f78-9b2e-481a-b766-2fbfd01f342c" as const; enabled = true; + static xmlParser = new XMLParser({ + allowBooleanAttributes: true, + attributeNamePrefix: "", + ignoreAttributes: false, + ignoreDeclaration: true, + ignorePiTags: true, + numberParseOptions: { leadingZeros: true, hex: true }, + parseAttributeValue: true, + preserveOrder: false, + processEntities: false, + removeNSPrefix: true, + trimValues: true, + }); + + constructor(components: Components) { + super(components); + components.add(IDSSpecifications.uuid, this); + } readonly list = new DataMap(); - create(name: string, ifcVersion: FRAGS.IfcSchema) { + create(name: string, ifcVersion: FRAGS.IfcSchema[]) { const specification = new IDSSpecification( this.components, name, ifcVersion, ); - this.list.set(specification.guid, specification); + this.list.set(specification.identifier!, specification); return specification; } + + load(data: string) { + const result: IDSSpecification[] = []; + const ids = IDSSpecifications.xmlParser.parse(data).ids; + const { specifications } = ids; + if (specifications && specifications.specification) { + const specs = Array.isArray(specifications.specification) + ? specifications.specification + : [specifications.specification]; + + for (const spec of specs) { + const { name, ifcVersion } = spec; + if (!(name && ifcVersion)) continue; + + const applicabilities: IDSFacet[] = []; + const reqs: IDSFacet[] = []; + + const { applicability, requirements } = spec; + + if (applicability) { + const { maxOccurs, ...rest } = applicability; + const facets = Array.isArray(rest) ? rest : [rest]; + for (const facet of facets) { + for (const facetName in facet) { + const elements = Array.isArray(facet[facetName]) + ? facet[facetName] + : [facet[facetName]]; + if (facetName === "entity") { + const facets = createEntityFacets(this.components, elements); + applicabilities.push(...facets); + } + } + } + } + + if (requirements) { + const { maxOccurs, ...rest } = requirements; + const facets = Array.isArray(rest) ? rest : [rest]; + for (const facet of facets) { + for (const facetName in facet) { + const elements = Array.isArray(facet[facetName]) + ? facet[facetName] + : [facet[facetName]]; + if (facetName === "entity") { + const facets = createEntityFacets(this.components, elements); + reqs.push(...facets); + } + if (facetName === "attribute") { + const facets = createAttributeFacets(this.components, elements); + reqs.push(...facets); + } + if (facetName === "classification") { + const facets = createClassificationFacets( + this.components, + elements, + ); + reqs.push(...facets); + } + } + } + } + + if (applicabilities.length > 0 && reqs.length > 0) { + const specification = this.create(name, ifcVersion.split(/\s+/)); + specification.applicability.add(...applicabilities); + specification.requirements.add(...reqs); + result.push(specification); + } + } + } + return result; + } + + export( + info: IDSInfo, + specifications: Iterable = this.list.values(), + ) {} } export * from "./src"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 16f02f716..402fe7c31 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -7,36 +7,39 @@ import { IDSFacet } from "./facets"; export class IDSSpecification { name: string; - ifcVersion: FRAGS.IfcSchema; - identifier?: string | number; + ifcVersion = new Set(); + identifier? = UUID.create(); description?: string; instructions?: string; + requirementsDescription?: string; applicability = new DataSet(); requirements = new DataSet(); - readonly guid = UUID.create(); - protected components: Components; constructor( components: Components, name: string, - ifcVersion: FRAGS.IfcSchema, + ifcVersion: FRAGS.IfcSchema[], ) { this.components = components; this.name = name; - this.ifcVersion = ifcVersion; + for (const version of ifcVersion) { + this.ifcVersion.add(version); + } } - async check(model: FRAGS.FragmentsGroup) { + async test(model: FRAGS.FragmentsGroup) { const result: IDSCheckResult[] = []; // Get applicable elements const entities: FRAGS.IfcProperties = {}; - for (const app of this.applicability) { - await app.getEntities(model, entities); + for (const facet of this.applicability) { + await facet.getEntities(model, entities); } + console.log(entities); + // Test applicable elements against requirements const requirementsResult: { [expressId: string]: boolean } = {}; for (const expressID in entities) { diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index f4f2272ae..1f10a4bdc 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -1,15 +1,15 @@ import * as FRAGS from "@thatopen/fragments"; -import { IDSFacetParameter } from "../types"; +import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; import { IDSFacet } from "./Facet"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/attribute-facet.md export class IDSAttribute extends IDSFacet { - name: string; + name: IDSFacetParameter; value?: IDSFacetParameter; - constructor(components: Components, name: string) { + constructor(components: Components, name: IDSFacetParameter) { super(components); this.name = name; } @@ -17,7 +17,7 @@ export class IDSAttribute extends IDSFacet { // This can be very ineficcient as we do not have an easy way to get an entity based on an attribute // Right now, all entities must be iterated. // When the new IfcEntitiesFinder comes, this can become easier. - // This may be greatly increase in performance if the applicability has any of the other facets + // This may be greatly increase in performance if the applicability has any of the other facets and this is applied the latest async getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties = {}, @@ -48,29 +48,85 @@ export class IDSAttribute extends IDSFacet { async test(entities: FRAGS.IfcProperties) { this.testResult = []; - for (const expressID in entities) { + for (const _expressID in entities) { + const expressID = Number(_expressID); const attrs = entities[expressID]; - if (!attrs.GlobalId?.value) continue; + + const checks: IDSCheck[] = []; + const result: IDSCheckResult = { + expressID, + pass: false, + checks, + }; + + this.testResult.push(result); // Check if the attribute exists - const attribute = attrs[this.name]; - const attributeExists = !!attribute; + const attrNames = Object.keys(attrs); + const matchingAttributes = attrNames.filter((name) => { + const value = attrs[name]; + if (value === null) { + if ( + this.cardinality === "optional" || + this.cardinality === "prohibited" + ) { + return true; + } + return false; + } + return this.evalRequirement(name, this.name, "Name"); + }); + + const attributeMatches = matchingAttributes.length > 0; + + checks.push({ + parameter: "Name", + currentValue: attributeMatches ? matchingAttributes[0] : null, + requiredValue: this.name.parameter, + pass: + this.cardinality === "prohibited" + ? !attributeMatches + : attributeMatches, + }); // Check if the attribute value matches let valueMatches = true; - if (attributeExists && this.value && this.value.parameter) { - if (this.value.type === "simple") { - valueMatches = attribute.value === this.value.parameter; - } - if (this.value.parameter && this.value.type === "pattern") { - const regex = new RegExp(String(this.value.parameter)); - valueMatches = regex.test(attribute.value); + if (this.value) { + if (matchingAttributes[0]) { + const attribute = attrs[matchingAttributes[0]]; + const isRef = attribute?.type === 5; + if (isRef) { + valueMatches = false; + checks.push({ + parameter: "Value", + currentValue: null, + requiredValue: this.value.parameter, + pass: this.cardinality === "prohibited", + }); + } else { + valueMatches = this.evalRequirement( + attribute ? attribute.value : null, + this.value, + "Value", + checks, + ); + } + } else { + valueMatches = false; + checks.push({ + parameter: "Value", + currentValue: null, + requiredValue: this.value.parameter, + pass: this.cardinality === "prohibited", + }); } } - this.saveResult(attrs, attributeExists && valueMatches); + result.pass = checks.every(({ pass }) => pass); } - return this.testResult; + const result = [...this.testResult]; + this.testResult = []; + return result; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index 2084e979f..3e80caeb1 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -86,11 +86,10 @@ export class IDSClassification extends IDSFacet { for (const _expressID in entities) { const expressID = Number(_expressID); const attrs = entities[expressID]; - if (!attrs.GlobalId?.value) continue; const checks: IDSCheck[] = []; const result: IDSCheckResult = { - guid: attrs.GlobalId.value, + expressID, pass: false, checks, }; @@ -162,18 +161,18 @@ export class IDSClassification extends IDSFacet { let uriMatches = true; systemMatches = this.evalRequirement( - "System", classificationAttrs.Name?.value, this.system, + "System", checks, ); if (this.value) { const currentValue = attrs.Identification?.value; valueMatches = this.evalRequirement( - "System", currentValue, this.value, + "System", checks, ); } @@ -181,12 +180,12 @@ export class IDSClassification extends IDSFacet { if (this.uri) { const currentValue = attrs.Location?.value; uriMatches = this.evalRequirement( - "System", currentValue, { type: "simple", parameter: this.uri, }, + "System", checks, ); } @@ -197,6 +196,8 @@ export class IDSClassification extends IDSFacet { result.pass = checks.every(({ pass }) => pass); } - return this.testResult; + const result = [...this.testResult]; + this.testResult = []; + return result; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index 6f4933585..a893f21e3 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -1,37 +1,42 @@ import * as FRAGS from "@thatopen/fragments"; import { Components } from "../../../../core/Components"; import { IDSFacet } from "./Facet"; +import { IDSFacetParameter } from "../types"; +import { IfcCategoryMap } from "../../../../ifc"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md export class IDSEntity extends IDSFacet { - type: number; - private _predefinedType?: string; + name: IDSFacetParameter; + predefinedType?: IDSFacetParameter; - set predefinedType(predefinedType: string | undefined) { - this._predefinedType = predefinedType?.toUpperCase(); - } - get predefinedType() { - return this._predefinedType; - } - - constructor(components: Components, type: number) { + constructor(components: Components, name: IDSFacetParameter) { super(components); - this.type = type; + this.name = name; } async getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties = {}, ) { - const entities = await model.getAllPropertiesOfType(this.type); - if (!entities) return []; + const types = Object.entries(IfcCategoryMap); + const typeIDs = types + .filter(([, type]) => this.evalRequirement(type, this.name, "Name")) + .map(([id]) => id); + + let entities: FRAGS.IfcProperties = {}; + for (const id of typeIDs) { + const elements = await model.getAllPropertiesOfType(Number(id)); + if (elements) entities = { ...entities, ...elements }; + } + if (!this.predefinedType) { for (const expressID in entities) { collector[expressID] = entities[expressID]; } return Object.keys(entities).map(Number); } + const result: number[] = []; for (const _expressID in entities) { const expressID = Number(_expressID); @@ -44,6 +49,7 @@ export class IDSEntity extends IDSFacet { result.push(expressID); } } + return result; } @@ -54,7 +60,7 @@ export class IDSEntity extends IDSFacet { if (!attrs.GlobalId?.value) continue; // Check if entity type matches - const typeMatches = attrs.type === this.type; + const typeMatches = attrs.type === this.name; // Check if the predefined type matches let predefinedTypeMatches = true; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts index 414d85743..5edc95ee9 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -10,16 +10,25 @@ import { IDSLengthParameter, IDSBoundsParameter, IDSCheck, + IDSConditionalCardinaltiy, + IDSSimpleCardinality, } from "../types"; export abstract class IDSFacet { + // Used when the facet is a requirement + // On IDSEntity is always required + cardinality: IDSSimpleCardinality | IDSConditionalCardinaltiy = "required"; + + // When using this facet as a requirement, instructions can be given for the authors of the IFC. + instructions?: string; + constructor(protected components: Components) {} protected evalRequirement = ( - parameter: IDSFacetParameterName, - value: string | number | boolean, + value: string | number | boolean | null, facetParameter: IDSFacetParameter, - checks: IDSCheck[], + parameter: IDSFacetParameterName, + checks?: IDSCheck[], ) => { const checkLog: IDSCheck = { parameter, @@ -28,61 +37,72 @@ export abstract class IDSFacet { pass: false, }; - const index = checks.findIndex( - ({ parameter }) => parameter === checkLog.parameter, - ); + if (checks) { + const index = checks.findIndex( + ({ parameter }) => parameter === checkLog.parameter, + ); - if (index !== -1) { - checks[index] = checkLog; - } else { - checks.push(checkLog); + if (index !== -1) { + checks[index] = checkLog; + } else { + checks.push(checkLog); + } } + let pass = false; + if (facetParameter.type === "simple") { const parameter = facetParameter.parameter as IDSSimpleParameter; - checkLog.pass = value === parameter; + pass = value === parameter; } if (facetParameter.type === "enumeration") { const parameter = facetParameter.parameter as IDSEnumerationParameter; - checkLog.pass = parameter.includes(value as never); + pass = parameter.includes(value as never); } if (facetParameter.type === "pattern") { const parameter = facetParameter.parameter as IDSPatternParameter; const regex = new RegExp(String(parameter)); - checkLog.pass = regex.test(String(value)); + pass = regex.test(String(value)); } if (facetParameter.type === "length") { const parameter = facetParameter.parameter as IDSLengthParameter; const { min, length, max } = parameter; - if (length !== undefined) checkLog.pass = String(value).length === length; - if (min !== undefined) checkLog.pass = String(value).length >= min; - if (max !== undefined) checkLog.pass = String(value).length <= max; + if (length !== undefined) { + pass = String(value).length === length; + } + if (min !== undefined) { + pass = String(value).length >= min; + } + if (max !== undefined) { + pass = String(value).length <= max; + } } if (facetParameter.type === "bounds" && typeof value === "number") { const { min, minInclusive, max, maxInclusive } = facetParameter.parameter as IDSBoundsParameter; + let minPass = true; + let maxPass = true; + if (min !== undefined) { - if (minInclusive) { - if (value < min) checkLog.pass = false; - } else if (value <= min) { - checkLog.pass = false; - } + minPass = minInclusive ? value <= min : value < min; } if (max !== undefined) { - if (maxInclusive) { - if (value > max) checkLog.pass = false; - } else if (value >= max) { - checkLog.pass = false; - } + maxPass = maxInclusive ? value >= max : value > max; } + + pass = minPass && maxPass; } + if (this.cardinality === "prohibited") pass = !pass; + if (this.cardinality === "optional" && value === null) pass = true; + + checkLog.pass = pass; return checkLog.pass; }; @@ -91,15 +111,7 @@ export abstract class IDSFacet { const { GlobalId } = attrs; if (!GlobalId) return; const { value: guid } = GlobalId; - const result: IDSCheckResult = { guid, pass, checks: [] }; - // if (data && !pass) { - // const { currentValue, requiredValue, parameter } = data; - // result.reason = { - // currentValue, - // requiredValue, - // parameter, - // }; - // } + const result: IDSCheckResult = { expressID: guid, pass, checks: [] }; this.testResult.push(result); } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts index 99e05133d..c376158d8 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts @@ -6,18 +6,46 @@ import { relToAttributesMap, } from "../../../../ifc"; import { IDSFacet } from "./Facet"; +import { IDSFacetParameter, IDSSimpleCardinality } from "../types"; +import { IDSEntity } from "./Entity"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/partof-facet.md export class IDSPartOf extends IDSFacet { - entity: number; + private _entityFacet: IDSEntity; + + private _entity: { + name: IDSFacetParameter; + predefinedType?: IDSFacetParameter; + }; + + set entity(value: { + name: IDSFacetParameter; + predefinedType?: IDSFacetParameter; + }) { + this._entity = value; + const { name, predefinedType } = value; + this._entityFacet = new IDSEntity(this.components, name); + this._entityFacet.predefinedType = predefinedType; + } + + get entity() { + return this._entity; + } - // Performance should be better if you provide the type of relation + // Performance is better when provided relation?: number; - constructor(components: Components, entity: number) { + cardinality: IDSSimpleCardinality = "required"; + + constructor( + components: Components, + entity: { name: IDSFacetParameter; predefinedType?: IDSFacetParameter }, + ) { super(components); - this.entity = entity; + this._entity = entity; + this._entityFacet = new IDSEntity(components, entity.name); + this._entityFacet.predefinedType = entity.predefinedType; } async getEntities( @@ -25,8 +53,8 @@ export class IDSPartOf extends IDSFacet { collector: FRAGS.IfcProperties = {}, ) { const result: number[] = []; - const entities = await model.getAllPropertiesOfType(this.entity); - if (!entities) return result; + const entities: FRAGS.IfcProperties = {}; + await this._entityFacet.getEntities(model, entities); const indexer = this.components.get(IfcRelationsIndexer); diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/attribute.ts new file mode 100644 index 000000000..8c0ac4865 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/attribute.ts @@ -0,0 +1,20 @@ +import { Components } from "../../../../core/Components"; +import { IDSAttribute, IDSFacet } from "../facets"; +import { getParameterValue } from "./parameter"; + +export const createAttributeFacets = ( + components: Components, + elements: any, +) => { + const facets: IDSFacet[] = []; + for (const element of elements) { + const nameParameter = element.name; + const name = getParameterValue(nameParameter); + if (!name) continue; + const facet = new IDSAttribute(components, name); + if (element.cardinality) facet.cardinality = element.cardinality; + facet.value = getParameterValue(element.value); + facets.push(facet); + } + return facets; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts new file mode 100644 index 000000000..f7b855d3a --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts @@ -0,0 +1,20 @@ +import { Components } from "../../../../core/Components"; +import { IDSClassification, IDSFacet } from "../facets"; +import { getParameterValue } from "./parameter"; + +export const createClassificationFacets = ( + components: Components, + elements: any, +) => { + const facets: IDSFacet[] = []; + for (const element of elements) { + const systemParameter = element.system; + const system = getParameterValue(systemParameter); + if (!system) continue; + const facet = new IDSClassification(components, system); + if (element.cardinality) facet.cardinality = element.cardinality; + facet.value = getParameterValue(element.value); + facets.push(facet); + } + return facets; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts new file mode 100644 index 000000000..628151076 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts @@ -0,0 +1,16 @@ +import { Components } from "../../../../core/Components"; +import { IDSEntity, IDSFacet } from "../facets"; +import { getParameterValue } from "./parameter"; + +export const createEntityFacets = (components: Components, elements: any) => { + const facets: IDSFacet[] = []; + for (const element of elements) { + const nameParameter = element.name; + const name = getParameterValue(nameParameter); + if (!name) continue; + const facet = new IDSEntity(components, name); + facet.predefinedType = getParameterValue(element.predefinedType); + facets.push(facet); + } + return facets; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/index.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/index.ts new file mode 100644 index 000000000..dc545f893 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/index.ts @@ -0,0 +1,3 @@ +export * from "./entity"; +export * from "./attribute"; +export * from "./classification"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/parameter.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/parameter.ts new file mode 100644 index 000000000..83ff27e37 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/parameter.ts @@ -0,0 +1,39 @@ +import { IDSFacetParameter } from "../types"; + +export const getParameterValue = (property: any) => { + if (!property) return undefined; + const result: Partial = { type: "simple" }; + if ("simpleValue" in property) { + result.parameter = property.simpleValue; + } + if ("restriction" in property) { + const restriction = property.restriction; + if ("pattern" in restriction) { + result.type = "pattern"; + result.parameter = restriction.pattern.value; + } + if ("enumeration" in restriction) { + result.type = "enumeration"; + const enumeration = restriction.enumeration.map( + ({ value }: { value: string }) => value, + ); + result.parameter = enumeration; + } + if ("bounds" in restriction) { + // result.type = "bounds"; + // const bounds = restriction.bounds.map( + // ({ value }: { value: string }) => value, + // ); + // result.parameter = bounds; + } + if ("length" in restriction) { + // result.type = "length"; + // const length = restriction.length.map( + // ({ value }: { value: string }) => value, + // ); + // result.parameter = length; + } + } + if (result.parameter === undefined) return undefined; + return result as IDSFacetParameter; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index f2d51a9e0..49721bb4d 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -1,5 +1,3 @@ -import { IDSSpecification } from "./Specification"; - export type IDSFacetParameterName = | "Name" | "Predefined Type" @@ -13,6 +11,12 @@ export type IDSFacetParameterName = | "Entity" | "Relation"; +// required must match +// prohibited mustn't match +// optional passes for matches and nulls +export type IDSSimpleCardinality = "required" | "prohibited"; +export type IDSConditionalCardinaltiy = IDSSimpleCardinality | "optional"; + export type IDSSimpleParameter = string | number | boolean; export type IDSEnumerationParameter = string[] | number[] | boolean[]; export type IDSPatternParameter = string; @@ -30,8 +34,15 @@ export type IDSLengthParameter = { export interface IDSRestrictionParameter {} +export type IDSFacetParameterType = + | "simple" + | "enumeration" + | "pattern" + | "bounds" + | "length"; + export interface IDSFacetParameter { - type: "simple" | "enumeration" | "pattern" | "bounds" | "length"; + type: IDSFacetParameterType; parameter: | IDSSimpleParameter | IDSEnumerationParameter @@ -51,12 +62,12 @@ export interface IDSCheck { * Represents the result of a check performed by an IDSFacet test. */ export interface IDSCheckResult { - guid: string; + expressID: number; pass: boolean; checks: IDSCheck[]; } -export interface IDS { +export interface IDSInfo { title: string; description?: string; copyright?: string; @@ -65,5 +76,4 @@ export interface IDS { date?: Date; purpose?: string; milestone?: string; - specifications: IDSSpecification[]; } From fad43419e6ad1d17d95a2f1dbd5a951f2f0b4269 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Thu, 5 Sep 2024 16:25:59 -0500 Subject: [PATCH 27/51] entity facet almost ready attribute facet test almost ready --- .../src/openbim/IDSSpecifications/example.ts | 59 +++++----- .../IDSSpecifications/src/facets/Attribute.ts | 35 ++++-- .../IDSSpecifications/src/facets/Entity.ts | 105 ++++++++++++++---- .../IDSSpecifications/src/facets/Facet.ts | 11 +- .../openbim/IDSSpecifications/src/types.ts | 1 + 5 files changed, 151 insertions(+), 60 deletions(-) diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index 61a9e83b3..068e2eb42 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -2,30 +2,19 @@ import * as WEBIFC from "web-ifc"; import * as FRAGS from "@thatopen/fragments"; import * as OBC from "../.."; -const logResult = (result: OBC.IDSCheckResult[]) => { - console.log( - "Pass:", - result.filter(({ pass }) => pass), - ); - console.log( - "Fail:", - result.filter(({ pass }) => !pass), - ); -}; - const components = new OBC.Components(); const ifcLoader = components.get(OBC.IfcLoader); await ifcLoader.setup(); // const file = await fetch("/resources/structure.ifc"); -const file = await fetch( - "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ifc", -); -const data = await file.arrayBuffer(); -const buffer = new Uint8Array(data); -const model = await ifcLoader.load(buffer); +// const file = await fetch( +// "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ifc", +// ); +// const data = await file.arrayBuffer(); +// const buffer = new Uint8Array(data); +// const model = await ifcLoader.load(buffer); const indexer = components.get(OBC.IfcRelationsIndexer); -await indexer.process(model); +// await indexer.process(model); const ids = components.get(OBC.IDSSpecifications); // const specifications = ids.create("My First IDS!", "IFC4X3"); @@ -91,26 +80,26 @@ partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; // logResult(resultF); // Importing -const idsFile = await fetch( - "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ids", -); +// const idsFile = await fetch( +// "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases/attribute/fail-a_prohibited_facet_returns_the_opposite_of_a_required_facet.ids", +// ); // const idsFile = await fetch("/resources/ids.ids"); -const idsData = await idsFile.text(); -const imports = ids.load(idsData); -for (const spec of imports) { - const app = [...spec.applicability][0]; - const req = [...spec.requirements][0]; - const entities: FRAGS.IfcProperties = {}; - await app.getEntities(model, entities); - const result = await req.test(entities, model); - logResult(result); -} +// const idsData = await idsFile.text(); +// const imports = ids.load(idsData); +// for (const spec of imports) { +// const app = [...spec.applicability][0]; +// const req = [...spec.requirements][0]; +// const entities: FRAGS.IfcProperties = {}; +// await app.getEntities(model, entities); +// const result = await req.test(entities, model); +// logResult(result); +// } // Load test cases from GitHub // Define the URL for fetching the files list const apiURL = - "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/attribute?ref=development"; + "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/entity?ref=development"; // Function to process each pair of IFC and IDS files async function processPair(ifcUrl: string, idsUrl: string) { @@ -132,6 +121,7 @@ async function processPair(ifcUrl: string, idsUrl: string) { const idsContent = await idsResponse.text(); const model = await ifcLoader.load(new Uint8Array(ifcContent)); + await indexer.process(model); const imports = ids.load(idsContent); for (const spec of imports) { @@ -202,3 +192,8 @@ async function fetchFileListAndProcessPairs() { // Call the function to fetch and process file pairs fetchFileListAndProcessPairs(); + +// const baseURL = +// "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases"; +// const url = `${baseURL}/entity/pass-inherited_predefined_types_should_pass`; +// processPair(`${url}.ifc`, `${url}.ids`); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index 1f10a4bdc..231cd72ca 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -46,6 +46,10 @@ export class IDSAttribute extends IDSFacet { // } } + // https://github.com/buildingSMART/IDS/tree/development/Documentation/ImplementersDocumentation/TestCases/attribute + // Test cases from buildingSMART repo have been tested and they all match with the expected result + // All invalid cases have been treated as failures + // FragmentsGroup do not hold some of the entities used in the tests async test(entities: FRAGS.IfcProperties) { this.testResult = []; for (const _expressID in entities) { @@ -54,6 +58,7 @@ export class IDSAttribute extends IDSFacet { const checks: IDSCheck[] = []; const result: IDSCheckResult = { + guid: attrs.GlobalId?.value, expressID, pass: false, checks, @@ -64,8 +69,10 @@ export class IDSAttribute extends IDSFacet { // Check if the attribute exists const attrNames = Object.keys(attrs); const matchingAttributes = attrNames.filter((name) => { - const value = attrs[name]; - if (value === null) { + const nameMatches = this.evalRequirement(name, this.name, "Name"); + const attrValue = attrs[name]; + // IDSDocs: Attributes with null values always fail + if (nameMatches && attrValue === null) { if ( this.cardinality === "optional" || this.cardinality === "prohibited" @@ -74,7 +81,23 @@ export class IDSAttribute extends IDSFacet { } return false; } - return this.evalRequirement(name, this.name, "Name"); + // IDSDocs: Attributes with a logical unknown always fail + if (nameMatches && attrValue?.type === 3 && attrValue.value === 2) { + return false; + } + // IDSDocs: Attributes with an empty list always fail + if (nameMatches && Array.isArray(attrValue) && attrValue.length === 0) { + return false; + } + // IDSDocs: Attributes with empty strings always fail + if ( + nameMatches && + attrValue?.type === 1 && + attrValue.value.trim() === "" + ) { + return false; + } + return nameMatches; }); const attributeMatches = matchingAttributes.length > 0; @@ -90,13 +113,12 @@ export class IDSAttribute extends IDSFacet { }); // Check if the attribute value matches - let valueMatches = true; if (this.value) { if (matchingAttributes[0]) { const attribute = attrs[matchingAttributes[0]]; + // Value checks always fail for objects const isRef = attribute?.type === 5; if (isRef) { - valueMatches = false; checks.push({ parameter: "Value", currentValue: null, @@ -104,7 +126,7 @@ export class IDSAttribute extends IDSFacet { pass: this.cardinality === "prohibited", }); } else { - valueMatches = this.evalRequirement( + this.evalRequirement( attribute ? attribute.value : null, this.value, "Value", @@ -112,7 +134,6 @@ export class IDSAttribute extends IDSFacet { ); } } else { - valueMatches = false; checks.push({ parameter: "Value", currentValue: null, diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index a893f21e3..f13a5467b 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -1,8 +1,8 @@ import * as FRAGS from "@thatopen/fragments"; import { Components } from "../../../../core/Components"; import { IDSFacet } from "./Facet"; -import { IDSFacetParameter } from "../types"; -import { IfcCategoryMap } from "../../../../ifc"; +import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; +import { IfcCategoryMap, IfcRelationsIndexer } from "../../../../ifc"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md @@ -15,23 +15,29 @@ export class IDSEntity extends IDSFacet { this.name = name; } + // IFCSURFACESTYLEREFRACTION is not present in the FragmentsGroup + // IFCSURFACESTYLERENDERING is not present in the FragmentsGroup async getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties = {}, ) { const types = Object.entries(IfcCategoryMap); - const typeIDs = types - .filter(([, type]) => this.evalRequirement(type, this.name, "Name")) - .map(([id]) => id); + const typeIDs: number[] = []; + for (const [type] of types) { + const validName = await this.evalName({ type }); + if (!validName) continue; + typeIDs.push(Number(type)); + } let entities: FRAGS.IfcProperties = {}; for (const id of typeIDs) { - const elements = await model.getAllPropertiesOfType(Number(id)); + const elements = await model.getAllPropertiesOfType(id); if (elements) entities = { ...entities, ...elements }; } if (!this.predefinedType) { for (const expressID in entities) { + if (expressID in collector) continue; collector[expressID] = entities[expressID]; } return Object.keys(entities).map(Number); @@ -42,8 +48,7 @@ export class IDSEntity extends IDSFacet { const expressID = Number(_expressID); if (expressID in collector) continue; const attrs = entities[expressID]; - const validPredefinedType = - attrs.PredefinedType?.value === this.predefinedType; + const validPredefinedType = await this.evalPredefinedType(model, attrs); if (validPredefinedType) { collector[expressID] = attrs; result.push(expressID); @@ -53,25 +58,85 @@ export class IDSEntity extends IDSFacet { return result; } - async test(entities: FRAGS.IfcProperties) { + async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { this.testResult = []; - for (const expressID in entities) { + for (const _expressID in entities) { + const expressID = Number(_expressID); const attrs = entities[expressID]; - if (!attrs.GlobalId?.value) continue; - // Check if entity type matches - const typeMatches = attrs.type === this.name; + const checks: IDSCheck[] = []; + const result: IDSCheckResult = { + guid: attrs.GlobalId?.value, + expressID, + pass: false, + checks, + }; - // Check if the predefined type matches - let predefinedTypeMatches = true; - if (typeMatches && this.predefinedType) { - predefinedTypeMatches = - attrs.PredefinedType?.value === this.predefinedType; - } + this.testResult.push(result); + + await this.evalName(attrs, checks); + await this.evalPredefinedType(model, attrs, checks); - this.saveResult(attrs, typeMatches && predefinedTypeMatches); + result.pass = checks.every(({ pass }) => pass); } return this.testResult; } + + protected async evalName(attrs: any, checks?: IDSCheck[]) { + const entityName = IfcCategoryMap[attrs.type]; + const result = this.evalRequirement(entityName, this.name, "Name", checks); + return result; + } + + protected async evalPredefinedType( + model: FRAGS.FragmentsGroup, + attrs: any, + checks?: IDSCheck[], + ) { + if (!this.predefinedType) return null; + const indexer = this.components.get(IfcRelationsIndexer); + const isRequirementUserDefined = + typeof this.predefinedType.parameter === "string" && + this.predefinedType.parameter === "USERDEFINED"; + let value = attrs.PredefinedType?.value; + + if (value === "USERDEFINED" && !isRequirementUserDefined) { + const attrNames = Object.keys(attrs); + const result = attrNames.find((str) => + /^((?!Predefined).)*Type$/.test(str), + ); + value = result ? attrs[result]?.value : "USERDEFINED"; + } + + if (!value) { + const types = indexer.getEntityRelations( + model, + attrs.expressID, + "IsTypedBy", + ); + if (types && types[0]) { + const typeAttrs = await model.getProperties(types[0]); + if (typeAttrs) { + value = typeAttrs.PredefinedType?.value; + if (value === "USERDEFINED" && !isRequirementUserDefined) { + const attrNames = Object.keys(typeAttrs); + const result = attrNames.find((str) => + /^((?!Predefined).)*Type$/.test(str), + ); + value = result ? typeAttrs[result]?.value : "USERDEFINED"; + } + } + } + } + + const result = this.evalRequirement( + value, + this.predefinedType, + "Predefined Type", + checks, + ); + + return result; + } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts index 5edc95ee9..5e848230b 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -63,7 +63,7 @@ export abstract class IDSFacet { if (facetParameter.type === "pattern") { const parameter = facetParameter.parameter as IDSPatternParameter; - const regex = new RegExp(String(parameter)); + const regex = new RegExp(parameter); pass = regex.test(String(value)); } @@ -115,6 +115,15 @@ export abstract class IDSFacet { this.testResult.push(result); } + /** + * Returns the list of expressIDs that pass the criteria of this facet. + * @param model - The IFC model to retrieve entities from. + * @param collector - An optional object to collect the retrieved entities. + * @remarks + * If the collector already includes the entity, it won't get processed any further. + * + * @returns An array of express IDs of the retrieved entities. + */ abstract getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties, diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index 49721bb4d..80e6225a4 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -62,6 +62,7 @@ export interface IDSCheck { * Represents the result of a check performed by an IDSFacet test. */ export interface IDSCheckResult { + guid?: string; expressID: number; pass: boolean; checks: IDSCheck[]; From f99e13730f31776e3f0f525057ceb6db3377cce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 7 Sep 2024 15:58:01 +0200 Subject: [PATCH 28/51] feat(core): add grids config --- .../src/core/Clipper/src/clipper-config.ts | 1 - packages/core/src/core/Grids/example.ts | 81 ++++++++++- packages/core/src/core/Grids/index.ts | 15 +-- packages/core/src/core/Grids/src/index.ts | 1 + .../src/core/Grids/src/simple-grid-config.ts | 127 ++++++++++++++++++ .../core/src/core/Grids/src/simple-grid.ts | 85 +++++++----- 6 files changed, 264 insertions(+), 46 deletions(-) create mode 100644 packages/core/src/core/Grids/src/simple-grid-config.ts diff --git a/packages/core/src/core/Clipper/src/clipper-config.ts b/packages/core/src/core/Clipper/src/clipper-config.ts index 926ef74b9..3606a0965 100644 --- a/packages/core/src/core/Clipper/src/clipper-config.ts +++ b/packages/core/src/core/Clipper/src/clipper-config.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line max-classes-per-file import * as THREE from "three"; import { BooleanSettingsControl, diff --git a/packages/core/src/core/Grids/example.ts b/packages/core/src/core/Grids/example.ts index ba0d6a818..4a59a2c09 100644 --- a/packages/core/src/core/Grids/example.ts +++ b/packages/core/src/core/Grids/example.ts @@ -19,7 +19,9 @@ In this tutorial, we will import: */ import * as THREE from "three"; +import Stats from "stats.js"; import * as OBC from "@thatopen/components"; +import * as BUI from "@thatopen/ui"; /* MD ### 🌎 Setting up a simple scene @@ -46,7 +48,10 @@ world.camera = new OBC.SimpleCamera(components); components.init(); -const cube = new THREE.Mesh(new THREE.BoxGeometry()); +const cube = new THREE.Mesh( + new THREE.BoxGeometry(), + new THREE.MeshBasicMaterial({ color: "red" }), +); world.scene.three.add(cube); /* MD @@ -69,6 +74,80 @@ const grids = components.get(OBC.Grids); const grid = grids.create(world); console.log(grid); +/* MD + ### 🧩 Adding some UI + --- + + We will use the `@thatopen/ui` library to add some simple and cool UI elements to our app. First, we need to call the `init` method of the `BUI.Manager` class to initialize the library: + +*/ + +BUI.Manager.init(); + +/* MD + Now we will create some UI elements and bind them to some of the controls of the clipper, like activation, visibility, size, color, etc. For more information about the UI library, you can check the specific documentation for it! +*/ + +const panel = BUI.Component.create(() => { + return BUI.html` + + + + + + + + + + + + + + + + + + + `; +}); + +document.body.append(panel); + +/* MD + And we will make some logic that adds a button to the screen when the user is visiting our app from their phone, allowing to show or hide the menu. Otherwise, the menu would make the app unusable. +*/ + +const button = BUI.Component.create(() => { + return BUI.html` + + + `; +}); + +document.body.append(button); + /* MD ### ⏱️ Measuring the performance (optional) --- diff --git a/packages/core/src/core/Grids/index.ts b/packages/core/src/core/Grids/index.ts index 8c4909f1c..a572f7ed5 100644 --- a/packages/core/src/core/Grids/index.ts +++ b/packages/core/src/core/Grids/index.ts @@ -1,6 +1,5 @@ -import * as THREE from "three"; import { Component, Disposable, World, Event } from "../Types"; -import { GridConfig, SimpleGrid } from "./src"; +import { SimpleGrid } from "./src"; import { Components } from "../Components"; export * from "./src"; @@ -20,16 +19,6 @@ export class Grids extends Component implements Disposable { */ list = new Map(); - /** - * The default configuration for grid creation. - */ - config: Required = { - color: new THREE.Color(0xbbbbbb), - size1: 1, - size2: 10, - distance: 500, - }; - /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); @@ -54,7 +43,7 @@ export class Grids extends Component implements Disposable { if (this.list.has(world.uuid)) { throw new Error("This world already has a grid!"); } - const grid = new SimpleGrid(this.components, world, this.config); + const grid = new SimpleGrid(this.components, world); this.list.set(world.uuid, grid); world.onDisposed.add(() => { this.delete(world); diff --git a/packages/core/src/core/Grids/src/index.ts b/packages/core/src/core/Grids/src/index.ts index 2a9f15fb3..1051afda7 100644 --- a/packages/core/src/core/Grids/src/index.ts +++ b/packages/core/src/core/Grids/src/index.ts @@ -1 +1,2 @@ export * from "./simple-grid"; +export * from "./simple-grid-config"; diff --git a/packages/core/src/core/Grids/src/simple-grid-config.ts b/packages/core/src/core/Grids/src/simple-grid-config.ts new file mode 100644 index 000000000..fd2ad9dbe --- /dev/null +++ b/packages/core/src/core/Grids/src/simple-grid-config.ts @@ -0,0 +1,127 @@ +import * as THREE from "three"; +import { + BooleanSettingsControl, + ColorSettingsControl, + NumberSettingControl, +} from "../../Types"; +import { Configurator } from "../../ConfigManager"; +import { SimpleGrid } from "./simple-grid"; + +type SimpleGridConfigType = { + visible: BooleanSettingsControl; + color: ColorSettingsControl; + primarySize: NumberSettingControl; + secondarySize: NumberSettingControl; + distance: NumberSettingControl; +}; + +/** + * Configuration interface for the {@link SimpleGrid}. + */ +export interface SimpleGridConfig { + /** + * The color of the grid lines. + */ + color: THREE.Color; + + /** + * The size of the primary grid lines. + */ + primarySize: number; + + /** + * The size of the secondary grid lines. + */ + secondarySize: number; + + /** + * The distance at which the grid lines start to fade away. + */ + distance: number; +} + +export class SimpleGridConfigManager extends Configurator< + SimpleGrid, + SimpleGridConfigType +> { + protected _config: SimpleGridConfigType = { + visible: { + value: true, + type: "Boolean" as const, + }, + color: { + value: new THREE.Color() as THREE.Color, + type: "Color" as const, + }, + primarySize: { + type: "Number" as const, + interpolable: true, + value: 1, + min: 0, + max: 1000, + }, + secondarySize: { + type: "Number" as const, + interpolable: true, + value: 10, + min: 0, + max: 1000, + }, + distance: { + type: "Number" as const, + interpolable: true, + value: 500, + min: 0, + max: 500, + }, + }; + + get visible() { + return this._config.visible.value; + } + + set visible(value: boolean) { + this._config.visible.value = value; + this._component.visible = value; + } + + get color() { + return this._config.color.value; + } + + set color(value: THREE.Color) { + this._config.color.value = value; + this._component.material.uniforms.uColor.value = value; + this._component.material.uniformsNeedUpdate = true; + } + + get primarySize() { + return this._config.primarySize.value; + } + + set primarySize(value: number) { + this._config.primarySize.value = value; + this._component.material.uniforms.uSize1.value = value; + this._component.material.uniformsNeedUpdate = true; + } + + get secondarySize() { + return this._config.secondarySize.value; + } + + set secondarySize(value: number) { + this._config.secondarySize.value = value; + this._component.material.uniforms.uSize2.value = value; + this._component.material.uniformsNeedUpdate = true; + } + + get distance() { + return this._config.distance.value; + } + + set distance(value: number) { + this._config.distance.value = value; + this._component.material.uniforms.uDistance.value = value; + this._component.material.uniformsNeedUpdate = true; + } +} diff --git a/packages/core/src/core/Grids/src/simple-grid.ts b/packages/core/src/core/Grids/src/simple-grid.ts index 5038c3025..b67722098 100644 --- a/packages/core/src/core/Grids/src/simple-grid.ts +++ b/packages/core/src/core/Grids/src/simple-grid.ts @@ -1,47 +1,48 @@ import * as THREE from "three"; -import { Hideable, Event, World, Disposable } from "../../Types"; +import { Hideable, Event, World, Disposable, Configurable } from "../../Types"; import { Components } from "../../Components"; import { Disposer } from "../../Disposer"; import { SimpleCamera } from "../../Worlds"; - -/** - * Configuration interface for the {@link SimpleGrid} class. - */ -export interface GridConfig { - /** - * The color of the grid lines. - */ - color: THREE.Color; - - /** - * The size of the primary grid lines. - */ - size1: number; - - /** - * The size of the secondary grid lines. - */ - size2: number; - - /** - * The distance at which the grid lines start to fade away. - */ - distance: number; -} +import { + SimpleGridConfig, + SimpleGridConfigManager, +} from "./simple-grid-config"; +import { ConfigManager } from "../../ConfigManager"; /** * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts). */ -export class SimpleGrid implements Hideable, Disposable { +export class SimpleGrid + implements + Hideable, + Disposable, + Configurable +{ /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + + /** {@link Configurable.isSetup} */ + isSetup = false; + /** The world instance to which this Raycaster belongs. */ world: World; /** The components instance to which this grid belongs. */ components: Components; + /** {@link Configurable.config} */ + config: SimpleGridConfigManager; + + protected _defaultConfig: SimpleGridConfig = { + color: new THREE.Color(0xbbbbbb), + primarySize: 1, + secondarySize: 10, + distance: 500, + }; + /** {@link Hideable.visible} */ get visible() { return this.three.visible; @@ -84,16 +85,20 @@ export class SimpleGrid implements Hideable, Disposable { private _fade = 3; - constructor(components: Components, world: World, config: GridConfig) { + constructor(components: Components, world: World) { // Source: https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts // Author: Fyrestar https://mevedia.com (https://github.com/Fyrestar/THREE.InfiniteGridHelper) this.world = world; - const { color, size1, size2, distance } = config; + const { color, primarySize, secondarySize, distance } = this._defaultConfig; this.components = components; + this.config = new SimpleGridConfigManager(this, this.components, "Grid"); + const configs = components.get(ConfigManager); + configs.list.add(this.config); + const geometry = new THREE.PlaneGeometry(2, 2, 1, 1); const material = new THREE.ShaderMaterial({ @@ -101,10 +106,10 @@ export class SimpleGrid implements Hideable, Disposable { uniforms: { uSize1: { - value: size1, + value: primarySize, }, uSize2: { - value: size2, + value: secondarySize, }, uColor: { value: color, @@ -197,9 +202,27 @@ export class SimpleGrid implements Hideable, Disposable { this.setupEvents(true); } + /** {@link Configurable.setup} */ + setup(config?: Partial) { + const fullConfig = { ...this._defaultConfig, ...config }; + + this.config.visible = true; + this.config.color = fullConfig.color; + this.config.primarySize = fullConfig.primarySize; + this.config.secondarySize = fullConfig.secondarySize; + this.config.distance = fullConfig.distance; + + this.isSetup = true; + this.onSetup.trigger(); + } + /** {@link Disposable.dispose} */ dispose() { this.setupEvents(false); + + const configs = this.components.get(ConfigManager); + configs.list.delete(this.config); + const disposer = this.components.get(Disposer); disposer.destroy(this.three); this.onDisposed.trigger(); From 331bd6916e8a6f601516d3e66b372500f927c8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Mon, 9 Sep 2024 15:42:04 +0200 Subject: [PATCH 29/51] feat(front): add streamed properties caching --- packages/core/package.json | 2 +- packages/front/package.json | 6 +- .../front/src/fragments/IfcStreamer/index.ts | 8 +- .../src/geometry-culler-renderer.ts | 16 +-- .../src/fragments/IfcStreamer/src/index.ts | 1 - .../IfcStreamer/src/streamer-file-db.ts | 122 ------------------ yarn.lock | 18 ++- 7 files changed, 25 insertions(+), 148 deletions(-) delete mode 100644 packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts diff --git a/packages/core/package.json b/packages/core/package.json index 920c291b7..c14a577b1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.5", + "version": "2.3.0-alpha.6", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/front/package.json b/packages/front/package.json index 78089b23c..cb8d81300 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.13", + "version": "2.3.0-alpha.14", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -38,7 +38,7 @@ "web-ifc": "0.0.57" }, "devDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha", + "@thatopen/fragments": ">=2.3.0-alpha.4", "@thatopen/ui": "~2.2.0", "@thatopen/ui-obc": "~2.2.0", "@types/earcut": "^2.1.4", @@ -47,7 +47,7 @@ "web-ifc": "0.0.57" }, "dependencies": { - "@thatopen/components": ">=2.3.0-alpha", + "@thatopen/components": ">=2.3.0-alpha.4", "camera-controls": "2.7.3", "dexie": "^4.0.4", "earcut": "^2.2.4", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index d9e41309a..38acff6b9 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -9,7 +9,6 @@ import { StreamedInstance, StreamLoaderSettings, // StreamerDbCleaner, - StreamerFileDb, } from "./src"; export * from "./src"; @@ -83,11 +82,10 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { return fetch(this.url + fileName); }; - /** * Cache system that uses the File System API. */ - fileDB = new StreamerFileDb(); + fileDB = new FRAG.StreamerFileDb("that-open-company-streaming"); private _culler: GeometryCullerRenderer | null = null; @@ -98,7 +96,6 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { { data: FRAG.StreamedGeometries; time: number } >(); - private _isDisposing = false; private _geometryInstances: { @@ -508,7 +505,8 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { const found = await this.fileDB.get(fileName); if (found) { - bytes = found; + const arrayBuffer = await found.arrayBuffer(); + bytes = new Uint8Array(arrayBuffer); } else { const fetched = await this.fetch(fileName); const buffer = await fetched.arrayBuffer(); diff --git a/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts b/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts index 715a6170a..ff2aa0029 100644 --- a/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts +++ b/packages/front/src/fragments/IfcStreamer/src/geometry-culler-renderer.ts @@ -57,14 +57,10 @@ export class GeometryCullerRenderer extends OBC.CullerRenderer { private codes = new Map>(); - constructor( - components: OBC.Components, - world: OBC.World, - settings?: OBC.CullerRendererSettings, - ) { - super(components, world, settings); + constructor(components: OBC.Components, world: OBC.World) { + super(components, world); - this.updateInterval = 500; + this.config.updateInterval = 500; this._geometry = new THREE.BoxGeometry(1, 1, 1); this._geometry.groups = []; @@ -76,12 +72,6 @@ export class GeometryCullerRenderer extends OBC.CullerRenderer { this._geometry.attributes.position.needsUpdate = true; this.worker.addEventListener("message", this.handleWorkerMessage); - if (this.autoUpdate) { - this._intervalID = window.setInterval( - this.updateVisibility, - this.updateInterval, - ); - } } dispose() { diff --git a/packages/front/src/fragments/IfcStreamer/src/index.ts b/packages/front/src/fragments/IfcStreamer/src/index.ts index 46b717482..408843307 100644 --- a/packages/front/src/fragments/IfcStreamer/src/index.ts +++ b/packages/front/src/fragments/IfcStreamer/src/index.ts @@ -1,3 +1,2 @@ export * from "./geometry-culler-renderer"; export * from "./types"; -export * from "./streamer-file-db"; diff --git a/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts b/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts deleted file mode 100644 index fedb4ec58..000000000 --- a/packages/front/src/fragments/IfcStreamer/src/streamer-file-db.ts +++ /dev/null @@ -1,122 +0,0 @@ -export class StreamerFileDb { - baseDirectory = "that-open-company-streaming"; - - maxDeadTime = 60000; - - private _memoryCleanTime = 10000; - - get memoryCleanTime() { - return this._memoryCleanTime; - } - - set memoryCleanTime(value: number) { - this._memoryCleanTime = value; - this.dispose(); - this.setupMemoryCleanup(); - } - - private _intervalID: number | null = null; - - private _isCleaningMemory = false; - - constructor() { - this.setupMemoryCleanup(); - } - - async get(name: string) { - const encodedName = this.encodeName(name); - const baseDir = await this.getDir(this.baseDirectory); - try { - const fileHandle = await baseDir.getFileHandle(encodedName); - const file = await fileHandle.getFile(); - this.updateLastAccessTime(encodedName); - const buffer = await file.arrayBuffer(); - return new Uint8Array(buffer); - } catch (e) { - return null; - } - } - - async add(name: string, buffer: Uint8Array) { - const encodedName = this.encodeName(name); - const baseDir = await this.getDir(this.baseDirectory); - const fileHandle = await baseDir.getFileHandle(encodedName, { - create: true, - }); - - const writable = await fileHandle.createWritable(); - await writable.write(buffer); - await writable.close(); - this.updateLastAccessTime(encodedName); - } - - async clear() { - const baseDir = await this.getDir(this.baseDirectory); - // @ts-ignore - for await (const [name] of baseDir.entries()) { - await baseDir.removeEntry(name); - } - } - - dispose() { - if (this._intervalID !== null) { - window.clearInterval(this._intervalID); - } - } - - private setupMemoryCleanup() { - this._intervalID = window.setInterval( - this.cleanMemory, - this.memoryCleanTime, - ); - } - - private cleanMemory = async () => { - if (this._isCleaningMemory) { - return; - } - this._isCleaningMemory = true; - - const rootDir = await this.getDir(this.baseDirectory); - - const filesToDelete = new Set(); - - const now = new Date().getTime(); - - // @ts-ignore - for await (const entry of rootDir.values()) { - const serializedLastAccessed = localStorage.getItem(entry.name) || "0"; - const lastAccess = parseInt(serializedLastAccessed, 10); - - const deadTime = now - lastAccess; - - if (deadTime > this.maxDeadTime) { - filesToDelete.add(entry.name); - localStorage.removeItem(entry.name); - } - } - - for (const name of filesToDelete) { - rootDir.removeEntry(name); - } - - this._isCleaningMemory = false; - }; - - private async getDir(path: string) { - const root = await navigator.storage.getDirectory(); - return root.getDirectoryHandle(path, { - create: true, - }); - } - - private encodeName(name: string) { - const illegalChars = /[\\/:*?"<>|]/g; - return name.replace(illegalChars, "ñ"); - } - - private updateLastAccessTime(encodedName: string) { - const now = new Date().getTime().toString(); - localStorage.setItem(encodedName, now); - } -} diff --git a/yarn.lock b/yarn.lock index dcf4855f7..540bb2934 100644 --- a/yarn.lock +++ b/yarn.lock @@ -621,8 +621,8 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components-front@workspace:packages/front" dependencies: - "@thatopen/components": ">=2.3.0-alpha" - "@thatopen/fragments": ">=2.3.0-alpha" + "@thatopen/components": ">=2.3.0-alpha.4" + "@thatopen/fragments": ">=2.3.0-alpha.4" "@thatopen/ui": ~2.2.0 "@thatopen/ui-obc": ~2.2.0 "@types/earcut": ^2.1.4 @@ -641,7 +641,7 @@ __metadata: languageName: unknown linkType: soft -"@thatopen/components@>=2.3.0-alpha, @thatopen/components@workspace:packages/core": +"@thatopen/components@>=2.3.0-alpha.4, @thatopen/components@workspace:packages/core": version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/core" dependencies: @@ -674,6 +674,18 @@ __metadata: languageName: node linkType: hard +"@thatopen/fragments@npm:>=2.3.0-alpha.4": + version: 2.3.0-alpha.4 + resolution: "@thatopen/fragments@npm:2.3.0-alpha.4" + dependencies: + flatbuffers: 23.3.3 + three-mesh-bvh: 0.7.0 + peerDependencies: + three: ^0.160.1 + checksum: 7301ce05d7aff3c895f3a01ba5e554074b8f68e8bbf5abcff73267d0f84fa8b2c541ebe213078f41d1783d99266c78dbd63a240f54f84023c7f2053a1e51aeb4 + languageName: node + linkType: hard + "@thatopen/ui-obc@npm:~2.2.0": version: 2.2.0 resolution: "@thatopen/ui-obc@npm:2.2.0" From 00569d1e77b1722c5139980a3f463dd8ed3d82c0 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Mon, 9 Sep 2024 22:34:57 -0500 Subject: [PATCH 30/51] entity and classification facets ready attribute facet almost ready --- .../src/openbim/IDSSpecifications/example.ts | 6 +- .../IDSSpecifications/src/facets/Attribute.ts | 1 + .../src/facets/Classification.ts | 295 ++++++++++++------ .../IDSSpecifications/src/facets/Entity.ts | 1 + .../IDSSpecifications/src/facets/Facet.ts | 31 +- .../src/importers/classification.ts | 9 +- .../openbim/IDSSpecifications/src/types.ts | 1 + 7 files changed, 229 insertions(+), 115 deletions(-) diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index 068e2eb42..c3ad3da2c 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -99,7 +99,7 @@ partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; // Load test cases from GitHub // Define the URL for fetching the files list const apiURL = - "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/entity?ref=development"; + "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/classification?ref=development"; // Function to process each pair of IFC and IDS files async function processPair(ifcUrl: string, idsUrl: string) { @@ -191,9 +191,9 @@ async function fetchFileListAndProcessPairs() { } // Call the function to fetch and process file pairs -fetchFileListAndProcessPairs(); +// fetchFileListAndProcessPairs(); // const baseURL = // "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases"; -// const url = `${baseURL}/entity/pass-inherited_predefined_types_should_pass`; +// const url = `${baseURL}/classification/pass-occurrences_override_the_type_classification_per_system_1_3`; // processPair(`${url}.ifc`, `${url}.ids`); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index 231cd72ca..4f8d1b3c2 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -62,6 +62,7 @@ export class IDSAttribute extends IDSFacet { expressID, pass: false, checks, + cardinality: this.cardinality, }; this.testResult.push(result); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index 3e80caeb1..59ecd8eb5 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -22,16 +22,21 @@ export class IDSClassification extends IDSFacet { collector: FRAGS.IfcProperties = {}, ) { const result: number[] = []; - const classificationReferences = await model.getAllPropertiesOfType( + + const references = await model.getAllPropertiesOfType( WEBIFC.IFCCLASSIFICATIONREFERENCE, ); - if (!classificationReferences) return result; + const classifications = await model.getAllPropertiesOfType( + WEBIFC.IFCCLASSIFICATION, + ); + + const systems = { ...references, ...classifications }; const matchingClassifications: number[] = []; - for (const _classificationID in classificationReferences) { - const classificationID = Number(_classificationID); + for (const id in systems) { + const classificationID = Number(id); const attrs = await model.getProperties(classificationID); if (!attrs) continue; @@ -41,21 +46,15 @@ export class IDSClassification extends IDSFacet { const classificationAttrs = await model.getProperties(referencedSourceID); if (!classificationAttrs) continue; - let systemMatches = true; - let valueMatches = true; - let uriMatches = true; - - systemMatches = classificationAttrs.Name?.value === this.system.parameter; + const systemMatches = this.evalSystem(classificationAttrs); if (!systemMatches) continue; - if (this.value) { - valueMatches = attrs.Identification?.value === this.value.parameter; - if (!valueMatches) continue; - } - if (this.uri) { - uriMatches = attrs.Location?.value === this.uri; - if (!uriMatches) continue; - } + const valueMatches = this.evalValue(attrs); + if (!valueMatches) continue; + + const uriMatches = this.evalURI(attrs); + if (!uriMatches) continue; + matchingClassifications.push(classificationID); } @@ -82,122 +81,220 @@ export class IDSClassification extends IDSFacet { async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { this.testResult = []; - const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); const attrs = entities[expressID]; const checks: IDSCheck[] = []; const result: IDSCheckResult = { + guid: attrs.GlobalId?.value, expressID, pass: false, checks, + cardinality: this.cardinality, }; this.testResult.push(result); - const associations = indexer.getEntityRelations( - model, - expressID, - "HasAssociations", - ); - if (!associations) { - checks.push({ - parameter: "System", - currentValue: null, - requiredValue: this.system, - pass: false, - }); - continue; - } + let missingClassification = true; + const elementClassifications = await this.getSystems(model, expressID); - for (const associationID of associations) { - const associationAttrs = await model.getProperties(associationID); - if (!associationAttrs) { - checks.push({ - parameter: "System", - currentValue: null, - requiredValue: this.system, - pass: false, - }); - continue; - } + const allSystemNames = elementClassifications + .map((classification) => this.getSystemName(classification)) + .filter((system) => system) as string[]; - if (associationAttrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) { - checks.push({ - parameter: "System", - currentValue: null, - requiredValue: this.system, - pass: false, - }); - continue; - } + for (const classificationAttrs of elementClassifications) { + const systemMatches = this.evalSystem(classificationAttrs, checks); + if (!systemMatches) continue; + missingClassification = false; - const referencedSourceID = associationAttrs.ReferencedSource?.value; - if (!referencedSourceID) { - checks.push({ - parameter: "System", - currentValue: null, - requiredValue: this.system, - pass: false, - }); - continue; - } + if (!(this.value && this.system)) break; - const classificationAttrs = - await model.getProperties(referencedSourceID); - if (!classificationAttrs) { - checks.push({ - parameter: "System", - currentValue: null, - requiredValue: this.system, - pass: false, - }); + if (classificationAttrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) { continue; } - let systemMatches = true; - let valueMatches = true; - let uriMatches = true; + const valueMatches = + !this.value || this.evalValue(classificationAttrs, checks); + + const uriMatches = + !this.uri || this.evalURI(classificationAttrs, checks); - systemMatches = this.evalRequirement( - classificationAttrs.Name?.value, - this.system, - "System", + if (valueMatches && uriMatches) break; + } + + if (missingClassification) { + this.addCheckResult( + { + parameter: "System", + currentValue: allSystemNames as any, + requiredValue: this.system, + pass: this.cardinality === "optional", + }, checks, ); + } + + result.pass = checks.every(({ pass }) => pass); + } + + const result = [...this.testResult]; + this.testResult = []; + return result; + } - if (this.value) { - const currentValue = attrs.Identification?.value; - valueMatches = this.evalRequirement( - currentValue, - this.value, - "System", - checks, + private async processReferencedSource( + model: FRAGS.FragmentsGroup, + attrs: Record, + ) { + const sourceID = attrs.ReferencedSource?.value; + if (!sourceID) return null; + const sourceAttrs = await model.getProperties(sourceID); + if (!sourceAttrs) return null; + if (sourceAttrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + sourceAttrs.ReferencedSource = await this.processReferencedSource( + model, + sourceAttrs, + ); + } + return sourceAttrs; + } + + private async getSystems(model: FRAGS.FragmentsGroup, expressID: number) { + const result: Record[] = []; + const indexer = this.components.get(IfcRelationsIndexer); + const ocurrenceAssociations = indexer.getEntityRelations( + model, + expressID, + "HasAssociations", + ); + if (ocurrenceAssociations) { + for (const id of ocurrenceAssociations) { + const attrs = await model.getProperties(id); + if (!attrs) continue; + if (attrs.type === WEBIFC.IFCCLASSIFICATION) { + result.push(attrs); + } + if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + attrs.ReferencedSource = await this.processReferencedSource( + model, + attrs, ); + if (attrs.ReferencedSource) result.push(attrs); } + } + } + + // As occurence classifications prevail over type clasifications + // the classification systems used by the occurrence are get + // so type classifications are not included + const occurrenceSystems = result + .map((attrs) => { + if (attrs.type === WEBIFC.IFCCLASSIFICATION) { + return attrs.Name?.value; + } + if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + return attrs.ReferencedSource?.Name?.value; + } + return null; + }) + .filter((name) => name); - if (this.uri) { - const currentValue = attrs.Location?.value; - uriMatches = this.evalRequirement( - currentValue, - { - type: "simple", - parameter: this.uri, - }, - "System", - checks, + const types = indexer.getEntityRelations(model, expressID, "IsTypedBy"); + if (!(types && types[0])) return result; + const type = types[0]; + const typeAssociations = indexer.getEntityRelations( + model, + type, + "HasAssociations", + ); + if (typeAssociations) { + for (const id of typeAssociations) { + const attrs = await model.getProperties(id); + if (!attrs) continue; + if (attrs.type === WEBIFC.IFCCLASSIFICATION) { + if (occurrenceSystems.includes(attrs.Name?.value)) continue; + result.push(attrs); + } + if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + attrs.ReferencedSource = await this.processReferencedSource( + model, + attrs, ); + if (attrs.ReferencedSource) result.push(attrs); } + } + } - if (systemMatches && valueMatches && uriMatches) break; + return result; + } + + private getSystemName(attrs: Record): string | null { + if (attrs.type === WEBIFC.IFCCLASSIFICATION) { + return attrs.Name?.value; + } + if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + if (attrs.ReferencedSource?.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) { + return this.getSystemName(attrs.ReferencedSource); + } + if (attrs.ReferencedSource?.type === WEBIFC.IFCCLASSIFICATION) { + return attrs.ReferencedSource.Name?.value; } + } + return null; + } - result.pass = checks.every(({ pass }) => pass); + private getAllReferenceIdentifications(attrs: Record) { + if (attrs.type !== WEBIFC.IFCCLASSIFICATIONREFERENCE) return null; + const identifications: string[] = []; + if (attrs.Identification) identifications.push(attrs.Identification.value); + if (attrs.ReferencedSource) { + const identification = this.getAllReferenceIdentifications( + attrs.ReferencedSource, + ); + if (identification) identifications.push(...identification); + } + return identifications; + } + + private evalSystem(attrs: Record, checks?: IDSCheck[]) { + const name = this.getSystemName(attrs); + return this.evalRequirement(name, this.system, "System", checks); + } + + private evalValue(attrs: any, checks?: IDSCheck[]) { + if (!this.value) return true; + const identifications = this.getAllReferenceIdentifications(attrs); + if (!identifications) return false; + const identifier = identifications.find((id) => { + if (!this.value) return false; + return this.evalRequirement(id, this.value, "Value"); + }); + if (checks) { + this.addCheckResult( + { + parameter: "Value", + currentValue: identifier ?? null, + requiredValue: this.value, + pass: !!identifier, + }, + checks, + ); } + return !!identifier; + } - const result = [...this.testResult]; - this.testResult = []; + private evalURI(attrs: any, checks?: IDSCheck[]) { + if (!this.uri) return true; + const result = this.evalRequirement( + attrs.Location?.value, + { + type: "simple", + parameter: this.uri, + }, + "URI", + checks, + ); return result; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index f13a5467b..7fe75a22e 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -70,6 +70,7 @@ export class IDSEntity extends IDSFacet { expressID, pass: false, checks, + cardinality: this.cardinality, }; this.testResult.push(result); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts index 5e848230b..7aee66e14 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -24,6 +24,18 @@ export abstract class IDSFacet { constructor(protected components: Components) {} + protected addCheckResult(check: IDSCheck, checks: IDSCheck[]) { + const index = checks.findIndex( + ({ parameter }) => parameter === check.parameter, + ); + + if (index !== -1) { + checks[index] = check; + } else { + checks.push(check); + } + } + protected evalRequirement = ( value: string | number | boolean | null, facetParameter: IDSFacetParameter, @@ -37,17 +49,7 @@ export abstract class IDSFacet { pass: false, }; - if (checks) { - const index = checks.findIndex( - ({ parameter }) => parameter === checkLog.parameter, - ); - - if (index !== -1) { - checks[index] = checkLog; - } else { - checks.push(checkLog); - } - } + if (checks) this.addCheckResult(checkLog, checks); let pass = false; @@ -111,7 +113,12 @@ export abstract class IDSFacet { const { GlobalId } = attrs; if (!GlobalId) return; const { value: guid } = GlobalId; - const result: IDSCheckResult = { expressID: guid, pass, checks: [] }; + const result: IDSCheckResult = { + expressID: guid, + pass, + checks: [], + cardinality: this.cardinality, + }; this.testResult.push(result); } diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts index f7b855d3a..0a0d0be13 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts @@ -13,7 +13,14 @@ export const createClassificationFacets = ( if (!system) continue; const facet = new IDSClassification(components, system); if (element.cardinality) facet.cardinality = element.cardinality; - facet.value = getParameterValue(element.value); + const value = getParameterValue(element.value); + if (value?.type === "simple") { + value.parameter = String(value.parameter); + } + if (value?.type === "enumeration" && Array.isArray(value.parameter)) { + value.parameter = value.parameter.map(String); + } + facet.value = value; facets.push(facet); } return facets; diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index 80e6225a4..1bacc88a9 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -66,6 +66,7 @@ export interface IDSCheckResult { expressID: number; pass: boolean; checks: IDSCheck[]; + cardinality: IDSConditionalCardinaltiy; } export interface IDSInfo { From 9fb76dcca1f602228bff8bcc936a9c50ee738946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 10 Sep 2024 14:44:07 +0200 Subject: [PATCH 31/51] feat(front): implement fragment geometry splitting --- .../src/fragments/IfcGeometryTiler/index.ts | 207 +++++++++++------- .../src/streaming-settings.ts | 5 + packages/front/package.json | 2 +- 3 files changed, 134 insertions(+), 80 deletions(-) diff --git a/packages/core/src/fragments/IfcGeometryTiler/index.ts b/packages/core/src/fragments/IfcGeometryTiler/index.ts index 29e01bcaf..56c7452b2 100644 --- a/packages/core/src/fragments/IfcGeometryTiler/index.ts +++ b/packages/core/src/fragments/IfcGeometryTiler/index.ts @@ -2,7 +2,7 @@ import * as WEBIFC from "web-ifc"; import * as THREE from "three"; import * as FRAGS from "@thatopen/fragments"; import { Components, Disposable, Event, Component } from "../../core"; -import { isPointInFrontOfPlane, obbFromPoints } from "../../utils"; +import { obbFromPoints } from "../../utils"; import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src"; import { SpatialStructure, @@ -66,6 +66,10 @@ export class IfcGeometryTiler extends Component implements Disposable { */ webIfc = new WEBIFC.IfcAPI(); + private _nextAvailableID = 0; + + private _splittedGeometries = new Map>(); + private _spatialTree = new SpatialStructure(); private _metaData = new IfcMetadataReader(); @@ -167,6 +171,7 @@ export class IfcGeometryTiler extends Component implements Disposable { this.webIfc.SetLogLevel(logLevel); } this.webIfc.OpenModel(data, this.settings.webIfc); + this._nextAvailableID = this.webIfc.GetMaxExpressID(0); } private async streamIfcFile(loadCallback: WEBIFC.ModelLoadCallback) { @@ -245,10 +250,6 @@ export class IfcGeometryTiler extends Component implements Disposable { this.getMesh(this.webIfc, mesh, group); }); - if (this._geometryCount > minGeometrySize) { - await this.streamGeometries(); - } - if (this._assets.length > minAssetsSize) { await this.streamAssets(); } @@ -277,15 +278,6 @@ export class IfcGeometryTiler extends Component implements Disposable { geometryID.set(id, index); } - // Delete assets that have no geometric representation - // const ids = group.data.keys(); - // for (const id of ids) { - // const [keys] = group.data.get(id)!; - // if (!keys.length) { - // group.data.delete(id); - // } - // } - SpatialIdsFinder.get(group, this.webIfc); const matrix = this.webIfc.GetCoordinationMatrix(0); @@ -327,45 +319,41 @@ export class IfcGeometryTiler extends Component implements Disposable { const geometryID = geometry.geometryExpressID; // Distinguish between opaque and transparent geometries - const factor = geometry.color.w === 1 ? 1 : -1; + const isOpaque = geometry.color.w === 1; + const factor = isOpaque ? 1 : -1; const transpGeometryID = geometryID * factor; if (!this._visitedGeometries.has(transpGeometryID)) { - if (!this._visitedGeometries.has(geometryID)) { - // This is the first time we see this geometry - this.getGeometry(webIfc, geometryID); - } - - // Save geometry for fragment generation - // separating transparent and opaque geometries - const index = this._visitedGeometries.size; - const uuid = THREE.MathUtils.generateUUID(); - this._visitedGeometries.set(transpGeometryID, { uuid, index }); + // This is the first time we see this geometry + this.getGeometry(webIfc, geometryID, isOpaque); } - const geometryData = this._visitedGeometries.get(transpGeometryID); - if (geometryData === undefined) { - throw new Error("Error getting geometry data for streaming!"); - } - const data = group.data.get(id); - if (!data) { - throw new Error("Data not found!"); + this.registerGeometryData( + group, + id, + geometry, + asset, + geometryID, + transpGeometryID, + ); + + // Also save splits, if any + const splits = this._splittedGeometries.get(geometryID); + if (splits) { + for (const split of splits) { + this.registerGeometryData(group, id, geometry, asset, split, split); + } } - - data[0].push(geometryData.index); - - const { x, y, z, w } = geometry.color; - const color = [x, y, z, w]; - const transformation = geometry.flatTransformation; - asset.geometries.push({ color, geometryID, transformation }); } this._assets.push(asset); } - private getGeometry(webIfc: WEBIFC.IfcAPI, id: number) { + private getGeometry(webIfc: WEBIFC.IfcAPI, id: number, isOpaque: boolean) { const geometry = webIfc.GetGeometry(0, id); + // Get the full index, position and normal data + const index = webIfc.GetIndexArray( geometry.GetIndexData(), geometry.GetIndexDataSize(), @@ -389,48 +377,84 @@ export class IfcGeometryTiler extends Component implements Disposable { normal[i / 2 + 2] = vertexData[i + 5]; } - // const bbox = makeApproxBoundingBox(position, index); - const obb = obbFromPoints(position); - const boundingBox = new Float32Array(obb.transformation.elements); - - // Simple hole test: see if all triangles are facing away the center - // Using the vertex normal because it's easier - // Geometries with holes are treated as transparent items - // in the visibility test for geometry streaming - // Not perfect, but it will work for most cases and all the times it fails - // are false positives, so it's always on the safety side - - const centerArray = [obb.center.x, obb.center.y, obb.center.z]; - - let hasHoles = false; - for (let i = 0; i < position.length - 2; i += 3) { - const x = position[i]; - const y = position[i + 1]; - const z = position[i + 2]; - - const nx = normal[i]; - const ny = normal[i + 1]; - const nz = normal[i + 2]; - - const pos = [x, y, z]; - const nor = [nx, ny, nz]; - if (isPointInFrontOfPlane(centerArray, pos, nor)) { - hasHoles = true; - break; + const maxTris = this.settings.maxTriangles || index.length / 3; + const maxIndexSize = maxTris * 3; + + let firstSplit = true; + + // Split geometries to normalize fragment size + for (let i = 0; i < index.length; i += maxIndexSize) { + const distanceToEnd = index.length - i; + const distance = Math.min(distanceToEnd, maxIndexSize); + const end = i + distance; + + const splittedIndexArray = [] as number[]; + const splittedPosArray = [] as number[]; + const splittedNorArray = [] as number[]; + + // Now, let's generate a new sub-geometry + let indexCounter = 0; + for (let j = i; j < end; j++) { + splittedIndexArray.push(indexCounter++); + + const previousIndex = index[j]; + splittedPosArray.push(position[previousIndex * 3]); + splittedPosArray.push(position[previousIndex * 3 + 1]); + splittedPosArray.push(position[previousIndex * 3 + 2]); + + splittedNorArray.push(normal[previousIndex * 3]); + splittedNorArray.push(normal[previousIndex * 3 + 1]); + splittedNorArray.push(normal[previousIndex * 3 + 2]); } - } - this._geometries.set(id, { - position, - normal, - index, - boundingBox, - hasHoles, - }); + const splittedIndex = new Uint32Array(splittedIndexArray); + const splittedPosition = new Float32Array(splittedPosArray); + const splittedNormal = new Float32Array(splittedNorArray); - geometry.delete(); + // const bbox = makeApproxBoundingBox(position, index); + const obb = obbFromPoints(splittedPosition); + const boundingBox = new Float32Array(obb.transformation.elements); + + // Deprecated, we don't need this anymore + const hasHoles = false; + + // Get the ID for the geometry. If just 1 split, keep original ID. + // If more than 1 split, create extra IDs + const geometryID = firstSplit ? id : this._nextAvailableID++; - this._geometryCount++; + this._geometries.set(geometryID, { + position: splittedPosition, + normal: splittedNormal, + index: splittedIndex, + boundingBox, + hasHoles, + }); + + if (!firstSplit) { + if (!this._splittedGeometries.has(id)) { + this._splittedGeometries.set(id, new Set()); + } + const splits = this._splittedGeometries.get(id) as Set; + splits.add(geometryID); + } + + // Distinguish between opaque and transparent geometries + const factor = isOpaque ? 1 : -1; + const transpGeometryID = geometryID * factor; + + const geomIndex = this._visitedGeometries.size; + const uuid = THREE.MathUtils.generateUUID(); + this._visitedGeometries.set(transpGeometryID, { uuid, index: geomIndex }); + + this._geometryCount++; + firstSplit = false; + + if (this._geometryCount > this.settings.minGeometrySize) { + this.streamGeometries(); + } + } + + geometry.delete(); } private async streamAssets() { @@ -439,7 +463,7 @@ export class IfcGeometryTiler extends Component implements Disposable { this._assets = []; } - private async streamGeometries() { + private streamGeometries() { let buffer = this._streamSerializer.export(this._geometries) as Uint8Array; let data: StreamedGeometries = {}; @@ -456,4 +480,29 @@ export class IfcGeometryTiler extends Component implements Disposable { this._geometries.clear(); this._geometryCount = 0; } + + private registerGeometryData( + group: FRAGS.FragmentsGroup, + itemID: number, + geometry: WEBIFC.PlacedGeometry, + asset: StreamedAsset, + geometryID: number, + transpGeometryID: number, + ) { + const geometryData = this._visitedGeometries.get(transpGeometryID); + if (geometryData === undefined) { + throw new Error("Error getting geometry data for streaming!"); + } + const data = group.data.get(itemID); + if (!data) { + throw new Error("Data not found!"); + } + + data[0].push(geometryData.index); + + const { x, y, z, w } = geometry.color; + const color = [x, y, z, w]; + const transformation = geometry.flatTransformation; + asset.geometries.push({ color, geometryID, transformation }); + } } diff --git a/packages/core/src/fragments/IfcGeometryTiler/src/streaming-settings.ts b/packages/core/src/fragments/IfcGeometryTiler/src/streaming-settings.ts index 6feecf082..6795c04e2 100644 --- a/packages/core/src/fragments/IfcGeometryTiler/src/streaming-settings.ts +++ b/packages/core/src/fragments/IfcGeometryTiler/src/streaming-settings.ts @@ -15,4 +15,9 @@ export class IfcStreamingSettings extends IfcFragmentSettings { * Defaults to 1000 assets. */ minAssetsSize = 1000; + + /** + * Maximum amount of triangles per fragment. Useful for controlling the maximum size of fragment files. + */ + maxTriangles: number | null = null; } diff --git a/packages/front/package.json b/packages/front/package.json index cb8d81300..fc48ec123 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.14", + "version": "2.3.0-alpha.15", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", From d4aa1022dd3594e26d07c31c1c035a71fa93d3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 10 Sep 2024 18:04:35 +0200 Subject: [PATCH 32/51] chore: bump version --- packages/core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/package.json b/packages/core/package.json index c14a577b1..bdee4dab0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.6", + "version": "2.3.0-alpha.8", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", From 4f9f87d785d72e7231d991b5ecc42283e5e6be97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 11 Sep 2024 09:27:00 +0200 Subject: [PATCH 33/51] chore: bump version --- packages/core/package.json | 6 ++-- packages/front/package.json | 6 ++-- .../front/src/fragments/IfcStreamer/index.ts | 4 +++ yarn.lock | 30 ++++++------------- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index bdee4dab0..877faf46e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.3.0-alpha.8", + "version": "2.3.0-alpha.9", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -37,7 +37,7 @@ "access": "public" }, "devDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha", + "@thatopen/fragments": ">=2.3.0-alpha.5", "@thatopen/ui": "~2.2.0", "@types/three": "0.160.0", "stats.js": "^0.17.0", @@ -51,7 +51,7 @@ "three-mesh-bvh": "0.7.0" }, "peerDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha", + "@thatopen/fragments": ">=2.3.0-alpha.5", "three": "^0.160.1", "web-ifc": "0.0.57" } diff --git a/packages/front/package.json b/packages/front/package.json index fc48ec123..e5557d982 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.3.0-alpha.15", + "version": "2.3.0-alpha.16", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -38,7 +38,7 @@ "web-ifc": "0.0.57" }, "devDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha.4", + "@thatopen/fragments": ">=2.3.0-alpha.5", "@thatopen/ui": "~2.2.0", "@thatopen/ui-obc": "~2.2.0", "@types/earcut": "^2.1.4", @@ -47,7 +47,7 @@ "web-ifc": "0.0.57" }, "dependencies": { - "@thatopen/components": ">=2.3.0-alpha.4", + "@thatopen/components": ">=2.3.0-alpha.5", "camera-controls": "2.7.3", "dexie": "^4.0.4", "earcut": "^2.2.4", diff --git a/packages/front/src/fragments/IfcStreamer/index.ts b/packages/front/src/fragments/IfcStreamer/index.ts index 38acff6b9..e3cd54b36 100644 --- a/packages/front/src/fragments/IfcStreamer/index.ts +++ b/packages/front/src/fragments/IfcStreamer/index.ts @@ -166,6 +166,8 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { const fragments = this.components.get(OBC.FragmentsManager); fragments.onFragmentsDisposed.add(this.disposeStreamedGroup); + + FRAG.FragmentsGroup.setPropertiesDB(true); } /** {@link OBC.Disposable.dispose} */ @@ -193,6 +195,8 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable { this.onDisposed.trigger(IfcStreamer.uuid); this.onDisposed.reset(); this._isDisposing = false; + + FRAG.FragmentsGroup.setPropertiesDB(false); } /** diff --git a/yarn.lock b/yarn.lock index 540bb2934..7a7f5efe8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -621,8 +621,8 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components-front@workspace:packages/front" dependencies: - "@thatopen/components": ">=2.3.0-alpha.4" - "@thatopen/fragments": ">=2.3.0-alpha.4" + "@thatopen/components": ">=2.3.0-alpha.5" + "@thatopen/fragments": ">=2.3.0-alpha.5" "@thatopen/ui": ~2.2.0 "@thatopen/ui-obc": ~2.2.0 "@types/earcut": ^2.1.4 @@ -641,11 +641,11 @@ __metadata: languageName: unknown linkType: soft -"@thatopen/components@>=2.3.0-alpha.4, @thatopen/components@workspace:packages/core": +"@thatopen/components@>=2.3.0-alpha.5, @thatopen/components@workspace:packages/core": version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/core" dependencies: - "@thatopen/fragments": ">=2.3.0-alpha" + "@thatopen/fragments": ">=2.3.0-alpha.5" "@thatopen/ui": ~2.2.0 "@types/three": 0.160.0 camera-controls: 2.7.3 @@ -656,33 +656,21 @@ __metadata: three-mesh-bvh: 0.7.0 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": ">=2.3.0-alpha" + "@thatopen/fragments": ">=2.3.0-alpha.5" three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/fragments@npm:>=2.3.0-alpha": - version: 2.3.0-alpha.2 - resolution: "@thatopen/fragments@npm:2.3.0-alpha.2" - dependencies: - flatbuffers: 23.3.3 - three-mesh-bvh: 0.7.0 - peerDependencies: - three: ^0.160.1 - checksum: 537887ffe869e0618c50f668c8513d91b3605810e7ed1355e9cf6ca3c83154e823b8461bc0d90ad72c011f4645689963b9e052f76f746663dc547e5374937832 - languageName: node - linkType: hard - -"@thatopen/fragments@npm:>=2.3.0-alpha.4": - version: 2.3.0-alpha.4 - resolution: "@thatopen/fragments@npm:2.3.0-alpha.4" +"@thatopen/fragments@npm:>=2.3.0-alpha.5": + version: 2.3.0-alpha.5 + resolution: "@thatopen/fragments@npm:2.3.0-alpha.5" dependencies: flatbuffers: 23.3.3 three-mesh-bvh: 0.7.0 peerDependencies: three: ^0.160.1 - checksum: 7301ce05d7aff3c895f3a01ba5e554074b8f68e8bbf5abcff73267d0f84fa8b2c541ebe213078f41d1783d99266c78dbd63a240f54f84023c7f2053a1e51aeb4 + checksum: fa3dd32d3b601c2df1fa5b6107369253879eec8a5c45bbb584703a258615ec0ee51d2add13ce7259448dd4bae8242475c8d6d115122a7ce3728d0b2d00e88dd5 languageName: node linkType: hard From efd96881f0e8ca32ceef4fccd470f0fc47b167a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 12 Sep 2024 19:11:23 +0200 Subject: [PATCH 34/51] wip: test basic text search --- .../core/src/fragments/IfcLoader/example.ts | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index 04d3aad03..b2bfa1ce0 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -214,6 +214,80 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); +window.addEventListener("keydown", async (e) => { + if (e.code !== "KeyP") { + return; + } + + const [fileHandle] = await window.showOpenFilePicker(); + // console.log(fileHandle); + const file = await fileHandle.getFile(); + + const reader = new FileReader(); + const decoder = new TextDecoder("utf-8"); + + // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ + const chunkSize = 10000 * 1024; // 10mb + const offset = 1000; // To avoid IFC lines that are split + let start = 0; + + const endLineToken = /;/; + + const textFilters = new Set([/wall/]); + + const resultItems = new Set<{ + id: number; + category: string; + position: number; + }>(); + + const readTextPart = () => { + if (start >= file.size) { + return; + } + const end = Math.min(start + chunkSize + offset, file.size); + const slice = file.slice(start, end); + reader.readAsArrayBuffer(slice); + }; + + reader.onload = () => { + if (!(reader.result instanceof ArrayBuffer)) { + return; + } + const buffer = new Uint8Array(reader.result); + + const snippet = decoder.decode(buffer); + + // Get individual IFC lines + const lines = snippet.split(endLineToken); + + // Test all filters against each line + for (const line of lines) { + let filtersPass = true; + for (const filter of textFilters) { + if (!filter.test(line)) { + filtersPass = false; + break; + } + } + if (!filtersPass) { + continue; + } + + console.log(line); + } + + console.log(start / file.size); + + start += chunkSize; + readTextPart(); + }; + + readTextPart(); + + // console.log(file); +}); + /* MD ### 🧩 Adding some UI --- From d3ccdf95cee16077a716892939116d59cb4c7ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 14 Sep 2024 11:44:16 +0200 Subject: [PATCH 35/51] wip: first working version of finder --- .../core/src/fragments/IfcLoader/example.ts | 83 +- packages/core/src/ifc/IfcFinder/index.ts | 200 +++ .../core/src/ifc/Utils/ifc-category-case.ts | 1152 +++++++++++++++++ packages/core/src/ifc/Utils/index.ts | 1 + packages/core/src/ifc/index.ts | 1 + 5 files changed, 1373 insertions(+), 64 deletions(-) create mode 100644 packages/core/src/ifc/IfcFinder/index.ts create mode 100644 packages/core/src/ifc/Utils/ifc-category-case.ts diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index b2bfa1ce0..be777b299 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -21,7 +21,7 @@ In this tutorial, we will import: import * as WEBIFC from "web-ifc"; import * as BUI from "@thatopen/ui"; import Stats from "stats.js"; -import * as OBC from "@thatopen/components"; +import * as OBC from "../.."; /* MD ### 🌎 Setting up a simple scene @@ -223,69 +223,24 @@ window.addEventListener("keydown", async (e) => { // console.log(fileHandle); const file = await fileHandle.getFile(); - const reader = new FileReader(); - const decoder = new TextDecoder("utf-8"); - - // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ - const chunkSize = 10000 * 1024; // 10mb - const offset = 1000; // To avoid IFC lines that are split - let start = 0; - - const endLineToken = /;/; - - const textFilters = new Set([/wall/]); - - const resultItems = new Set<{ - id: number; - category: string; - position: number; - }>(); - - const readTextPart = () => { - if (start >= file.size) { - return; - } - const end = Math.min(start + chunkSize + offset, file.size); - const slice = file.slice(start, end); - reader.readAsArrayBuffer(slice); - }; - - reader.onload = () => { - if (!(reader.result instanceof ArrayBuffer)) { - return; - } - const buffer = new Uint8Array(reader.result); - - const snippet = decoder.decode(buffer); - - // Get individual IFC lines - const lines = snippet.split(endLineToken); - - // Test all filters against each line - for (const line of lines) { - let filtersPass = true; - for (const filter of textFilters) { - if (!filter.test(line)) { - filtersPass = false; - break; - } - } - if (!filtersPass) { - continue; - } - - console.log(line); - } - - console.log(start / file.size); - - start += chunkSize; - readTextPart(); - }; - - readTextPart(); - - // console.log(file); + const start = performance.now(); + + const finder = components.get(OBC.IfcFinder); + const result = await finder.find(file, [ + { + type: "category", + value: /IfcWallStandardCase/, + }, + // { + // type: "property", + // name: /.*/, + // value: /Aripa/, + // }, + ]); + + console.log(result); + + console.log(`Time: ${performance.now() - start}`); }); /* MD diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts new file mode 100644 index 000000000..5a1f4805b --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -0,0 +1,200 @@ +import * as WEBIFC from "web-ifc"; +import { Component, Components, Event } from "../../core"; +import { ifcCategoryCase } from "../Utils"; + +export interface IfcCategoryRule { + type: "category"; + value: RegExp; +} + +export interface IfcPropertyRule { + type: "property"; + name: RegExp; + value: RegExp; +} + +export type IfcFinderRules = IfcCategoryRule | IfcPropertyRule; + +/** + * Component to make text queries in the IFC. + */ +export class IfcFinder extends Component { + /** + * A unique identifier for the component. + * This UUID is used to register the component within the Components system. + */ + static readonly uuid = "0da7ad77-f734-42ca-942f-a074adfd1e3a" as const; + + readonly onProgress = new Event(); + + /** {@link Component.enabled} */ + enabled = true; + + constructor(components: Components) { + super(components); + } + + find(file: File, rules: IfcFinderRules[]) { + return new Promise>((resolve) => { + const reader = new FileReader(); + const decoder = new TextDecoder("utf-8"); + + // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ + const chunkSize = 10000 * 1024; // 10mb + const offset = 1000; // To avoid IFC lines that are split + let start = 0; + + const endLineToken = /;/; + + const resultItems = new Set(); + + const readTextPart = () => { + if (start >= file.size) { + resolve(resultItems); + return; + } + const end = Math.min(start + chunkSize + offset, file.size); + const slice = file.slice(start, end); + reader.readAsArrayBuffer(slice); + }; + + reader.onload = () => { + if (!(reader.result instanceof ArrayBuffer)) { + return; + } + + const buffer = new Uint8Array(reader.result); + + const snippet = decoder.decode(buffer); + + // Get individual IFC lines + const lines = snippet.split(endLineToken); + // Remove first line, which is cut + lines.shift(); + + // Test all filters against each line + for (const line of lines) { + let category: string | null = null; + let attrValues: string[] | null = null; + let attrNames: string[] | null = null; + + let filtersPass = true; + + for (const rule of rules) { + if (rule.type === "category") { + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + filtersPass = false; + break; + } + } + + if (!rule.value.test(category)) { + filtersPass = false; + break; + } + continue; + } + + if (rule.type === "property") { + const { name, value } = rule; + + // Quick test to see if this line contains what we are looking for + if (!value.test(line)) { + filtersPass = false; + break; + } + + if (attrValues === null) { + attrValues = this.getAttributesFromLine(line); + if (attrValues === null) { + filtersPass = false; + break; + } + } + + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + filtersPass = false; + break; + } + } + + if (attrNames === null) { + // @ts-ignore + attrNames = Object.keys(new WEBIFC.IFC4[category]()); + if (attrNames === null) { + filtersPass = false; + break; + } + } + + // Slow test to detect if + + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrValue = attrValues[i]; + const attrName = attrNames[i]; + // Check that both name and value match + if (value.test(attrValue) && name.test(attrName)) { + someNameValueMatch = true; + break; + } + } + + if (!someNameValueMatch) { + filtersPass = false; + break; + } + } + } + + if (filtersPass) { + const idString = line.slice( + line.indexOf("#") + 1, + line.indexOf("="), + ); + const id = parseInt(idString, 10); + resultItems.add(id); + } + } + + console.log(start / file.size); + + start += chunkSize; + readTextPart(); + }; + + readTextPart(); + }); + } + + private getCategoryFromLine(line: string) { + const start = line.indexOf("=") + 1; + const end = line.indexOf("("); + const category = line.slice(start, end).trim(); + const name = ifcCategoryCase[category]; + if (!name) { + return null; + } + return name; + } + + private getAttributesFromLine(line: string) { + const matchRegex = /\((.*)\)/; + const match = line.match(matchRegex); + if (!(match && match[1])) { + return null; + } + const splitRegex = /,(?![^()]*\))/g; + const attrs = match[1].split(splitRegex).map((part) => part.trim()); + const validAttrs = attrs.map((attr) => { + if (attr.startsWith("(") && attr.endsWith(")")) return "$"; + if (attr.startsWith("'") && attr.endsWith("'")) return attr.slice(1, -1); + return attr; + }); + return validAttrs; + } +} diff --git a/packages/core/src/ifc/Utils/ifc-category-case.ts b/packages/core/src/ifc/Utils/ifc-category-case.ts new file mode 100644 index 000000000..bfef09b3a --- /dev/null +++ b/packages/core/src/ifc/Utils/ifc-category-case.ts @@ -0,0 +1,1152 @@ +export const ifcCategoryCase: { [upperCase: string]: string } = { + IFCURIREFERENCE: "IfcUriReference", + IFCTIME: "IfcTime", + IFCTEMPERATURERATEOFCHANGEMEASURE: "IfcTemperatureRateOfChangeMeasure", + IFCSOUNDPRESSURELEVELMEASURE: "IfcSoundPressureLevelMeasure", + IFCSOUNDPOWERLEVELMEASURE: "IfcSoundPowerLevelMeasure", + IFCPROPERTYSETDEFINITIONSET: "IfcPropertySetDefinitionSet", + IFCPOSITIVEINTEGER: "IfcPositiveInteger", + IFCNONNEGATIVELENGTHMEASURE: "IfcNonNegativeLengthMeasure", + IFCLINEINDEX: "IfcLineIndex", + IFCLANGUAGEID: "IfcLanguageId", + IFCDURATION: "IfcDuration", + IFCDAYINWEEKNUMBER: "IfcDayInWeekNumber", + IFCDATETIME: "IfcDateTime", + IFCDATE: "IfcDate", + IFCCARDINALPOINTREFERENCE: "IfcCardinalPointReference", + IFCBINARY: "IfcBinary", + IFCAREADENSITYMEASURE: "IfcAreaDensityMeasure", + IFCARCINDEX: "IfcArcIndex", + IFCYEARNUMBER: "IfcYearNumber", + IFCWARPINGMOMENTMEASURE: "IfcWarpingMomentMeasure", + IFCWARPINGCONSTANTMEASURE: "IfcWarpingConstantMeasure", + IFCVOLUMETRICFLOWRATEMEASURE: "IfcVolumetricFlowRateMeasure", + IFCVOLUMEMEASURE: "IfcVolumeMeasure", + IFCVAPORPERMEABILITYMEASURE: "IfcVaporPermeabilityMeasure", + IFCTORQUEMEASURE: "IfcTorqueMeasure", + IFCTIMESTAMP: "IfcTimestamp", + IFCTIMEMEASURE: "IfcTimeMeasure", + IFCTHERMODYNAMICTEMPERATUREMEASURE: "IfcThermodynamicTemperatureMeasure", + IFCTHERMALTRANSMITTANCEMEASURE: "IfcThermalTransmittanceMeasure", + IFCTHERMALRESISTANCEMEASURE: "IfcThermalResistanceMeasure", + IFCTHERMALEXPANSIONCOEFFICIENTMEASURE: + "IfcThermalExpansionCoefficientMeasure", + IFCTHERMALCONDUCTIVITYMEASURE: "IfcThermalConductivityMeasure", + IFCTHERMALADMITTANCEMEASURE: "IfcThermalAdmittanceMeasure", + IFCTEXTTRANSFORMATION: "IfcTextTransformation", + IFCTEXTFONTNAME: "IfcTextFontName", + IFCTEXTDECORATION: "IfcTextDecoration", + IFCTEXTALIGNMENT: "IfcTextAlignment", + IFCTEXT: "IfcText", + IFCTEMPERATUREGRADIENTMEASURE: "IfcTemperatureGradientMeasure", + IFCSPECULARROUGHNESS: "IfcSpecularRoughness", + IFCSPECULAREXPONENT: "IfcSpecularExponent", + IFCSPECIFICHEATCAPACITYMEASURE: "IfcSpecificHeatCapacityMeasure", + IFCSOUNDPRESSUREMEASURE: "IfcSoundPressureMeasure", + IFCSOUNDPOWERMEASURE: "IfcSoundPowerMeasure", + IFCSOLIDANGLEMEASURE: "IfcSolidAngleMeasure", + IFCSHEARMODULUSMEASURE: "IfcShearModulusMeasure", + IFCSECTIONALAREAINTEGRALMEASURE: "IfcSectionalAreaIntegralMeasure", + IFCSECTIONMODULUSMEASURE: "IfcSectionModulusMeasure", + IFCSECONDINMINUTE: "IfcSecondInMinute", + IFCROTATIONALSTIFFNESSMEASURE: "IfcRotationalStiffnessMeasure", + IFCROTATIONALMASSMEASURE: "IfcRotationalMassMeasure", + IFCROTATIONALFREQUENCYMEASURE: "IfcRotationalFrequencyMeasure", + IFCREAL: "IfcReal", + IFCRATIOMEASURE: "IfcRatioMeasure", + IFCRADIOACTIVITYMEASURE: "IfcRadioactivityMeasure", + IFCPRESSUREMEASURE: "IfcPressureMeasure", + IFCPRESENTABLETEXT: "IfcPresentableText", + IFCPOWERMEASURE: "IfcPowerMeasure", + IFCPOSITIVERATIOMEASURE: "IfcPositiveRatioMeasure", + IFCPOSITIVEPLANEANGLEMEASURE: "IfcPositivePlaneAngleMeasure", + IFCPOSITIVELENGTHMEASURE: "IfcPositiveLengthMeasure", + IFCPLANEANGLEMEASURE: "IfcPlaneAngleMeasure", + IFCPLANARFORCEMEASURE: "IfcPlanarForceMeasure", + IFCPARAMETERVALUE: "IfcParameterValue", + IFCPHMEASURE: "IfcPhMeasure", + IFCNUMERICMEASURE: "IfcNumericMeasure", + IFCNORMALISEDRATIOMEASURE: "IfcNormalisedRatioMeasure", + IFCMONTHINYEARNUMBER: "IfcMonthInYearNumber", + IFCMONETARYMEASURE: "IfcMonetaryMeasure", + IFCMOMENTOFINERTIAMEASURE: "IfcMomentOfInertiaMeasure", + IFCMOLECULARWEIGHTMEASURE: "IfcMolecularWeightMeasure", + IFCMOISTUREDIFFUSIVITYMEASURE: "IfcMoistureDiffusivityMeasure", + IFCMODULUSOFSUBGRADEREACTIONMEASURE: "IfcModulusOfSubgradeReactionMeasure", + IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE: + "IfcModulusOfRotationalSubgradeReactionMeasure", + IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE: + "IfcModulusOfLinearSubgradeReactionMeasure", + IFCMODULUSOFELASTICITYMEASURE: "IfcModulusOfElasticityMeasure", + IFCMINUTEINHOUR: "IfcMinuteInHour", + IFCMASSPERLENGTHMEASURE: "IfcMassPerLengthMeasure", + IFCMASSMEASURE: "IfcMassMeasure", + IFCMASSFLOWRATEMEASURE: "IfcMassFlowRateMeasure", + IFCMASSDENSITYMEASURE: "IfcMassDensityMeasure", + IFCMAGNETICFLUXMEASURE: "IfcMagneticFluxMeasure", + IFCMAGNETICFLUXDENSITYMEASURE: "IfcMagneticFluxDensityMeasure", + IFCLUMINOUSINTENSITYMEASURE: "IfcLuminousIntensityMeasure", + IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE: + "IfcLuminousIntensityDistributionMeasure", + IFCLUMINOUSFLUXMEASURE: "IfcLuminousFluxMeasure", + IFCLOGICAL: "IfcLogical", + IFCLINEARVELOCITYMEASURE: "IfcLinearVelocityMeasure", + IFCLINEARSTIFFNESSMEASURE: "IfcLinearStiffnessMeasure", + IFCLINEARMOMENTMEASURE: "IfcLinearMomentMeasure", + IFCLINEARFORCEMEASURE: "IfcLinearForceMeasure", + IFCLENGTHMEASURE: "IfcLengthMeasure", + IFCLABEL: "IfcLabel", + IFCKINEMATICVISCOSITYMEASURE: "IfcKinematicViscosityMeasure", + IFCISOTHERMALMOISTURECAPACITYMEASURE: "IfcIsothermalMoistureCapacityMeasure", + IFCIONCONCENTRATIONMEASURE: "IfcIonConcentrationMeasure", + IFCINTEGERCOUNTRATEMEASURE: "IfcIntegerCountRateMeasure", + IFCINTEGER: "IfcInteger", + IFCINDUCTANCEMEASURE: "IfcInductanceMeasure", + IFCILLUMINANCEMEASURE: "IfcIlluminanceMeasure", + IFCIDENTIFIER: "IfcIdentifier", + IFCHOURINDAY: "IfcHourInDay", + IFCHEATINGVALUEMEASURE: "IfcHeatingValueMeasure", + IFCHEATFLUXDENSITYMEASURE: "IfcHeatFluxDensityMeasure", + IFCGLOBALLYUNIQUEID: "IfcGloballyUniqueId", + IFCFREQUENCYMEASURE: "IfcFrequencyMeasure", + IFCFORCEMEASURE: "IfcForceMeasure", + IFCFONTWEIGHT: "IfcFontWeight", + IFCFONTVARIANT: "IfcFontVariant", + IFCFONTSTYLE: "IfcFontStyle", + IFCENERGYMEASURE: "IfcEnergyMeasure", + IFCELECTRICVOLTAGEMEASURE: "IfcElectricVoltageMeasure", + IFCELECTRICRESISTANCEMEASURE: "IfcElectricResistanceMeasure", + IFCELECTRICCURRENTMEASURE: "IfcElectricCurrentMeasure", + IFCELECTRICCONDUCTANCEMEASURE: "IfcElectricConductanceMeasure", + IFCELECTRICCHARGEMEASURE: "IfcElectricChargeMeasure", + IFCELECTRICCAPACITANCEMEASURE: "IfcElectricCapacitanceMeasure", + IFCDYNAMICVISCOSITYMEASURE: "IfcDynamicViscosityMeasure", + IFCDOSEEQUIVALENTMEASURE: "IfcDoseEquivalentMeasure", + IFCDIMENSIONCOUNT: "IfcDimensionCount", + IFCDESCRIPTIVEMEASURE: "IfcDescriptiveMeasure", + IFCDAYLIGHTSAVINGHOUR: "IfcDaylightSavingHour", + IFCDAYINMONTHNUMBER: "IfcDayInMonthNumber", + IFCCURVATUREMEASURE: "IfcCurvatureMeasure", + IFCCOUNTMEASURE: "IfcCountMeasure", + IFCCONTEXTDEPENDENTMEASURE: "IfcContextDependentMeasure", + IFCCOMPOUNDPLANEANGLEMEASURE: "IfcCompoundPlaneAngleMeasure", + IFCCOMPLEXNUMBER: "IfcComplexNumber", + IFCBOXALIGNMENT: "IfcBoxAlignment", + IFCBOOLEAN: "IfcBoolean", + IFCAREAMEASURE: "IfcAreaMeasure", + IFCANGULARVELOCITYMEASURE: "IfcAngularVelocityMeasure", + IFCAMOUNTOFSUBSTANCEMEASURE: "IfcAmountOfSubstanceMeasure", + IFCACCELERATIONMEASURE: "IfcAccelerationMeasure", + IFCABSORBEDDOSEMEASURE: "IfcAbsorbedDoseMeasure", + IFCGEOSLICE: "IfcGeoSlice", + IFCGEOMODEL: "IfcGeoModel", + IFCELECTRICFLOWTREATMENTDEVICE: "IfcElectricFlowTreatmentDevice", + IFCDISTRIBUTIONBOARD: "IfcDistributionBoard", + IFCCONVEYORSEGMENT: "IfcConveyorSegment", + IFCCAISSONFOUNDATION: "IfcCaissonFoundation", + IFCBOREHOLE: "IfcBorehole", + IFCBEARING: "IfcBearing", + IFCALIGNMENT: "IfcAlignment", + IFCTRACKELEMENT: "IfcTrackElement", + IFCSIGNAL: "IfcSignal", + IFCREINFORCEDSOIL: "IfcReinforcedSoil", + IFCRAIL: "IfcRail", + IFCPAVEMENT: "IfcPavement", + IFCNAVIGATIONELEMENT: "IfcNavigationElement", + IFCMOORINGDEVICE: "IfcMooringDevice", + IFCMOBILETELECOMMUNICATIONSAPPLIANCE: "IfcMobileTelecommunicationsAppliance", + IFCLIQUIDTERMINAL: "IfcLiquidTerminal", + IFCLINEARPOSITIONINGELEMENT: "IfcLinearPositioningElement", + IFCKERB: "IfcKerb", + IFCGEOTECHNICALASSEMBLY: "IfcGeotechnicalAssembly", + IFCELECTRICFLOWTREATMENTDEVICETYPE: "IfcElectricFlowTreatmentDeviceType", + IFCEARTHWORKSFILL: "IfcEarthworksFill", + IFCEARTHWORKSELEMENT: "IfcEarthworksElement", + IFCEARTHWORKSCUT: "IfcEarthworksCut", + IFCDISTRIBUTIONBOARDTYPE: "IfcDistributionBoardType", + IFCDEEPFOUNDATION: "IfcDeepFoundation", + IFCCOURSE: "IfcCourse", + IFCCONVEYORSEGMENTTYPE: "IfcConveyorSegmentType", + IFCCAISSONFOUNDATIONTYPE: "IfcCaissonFoundationType", + IFCBUILTSYSTEM: "IfcBuiltSystem", + IFCBUILTELEMENT: "IfcBuiltElement", + IFCBRIDGEPART: "IfcBridgePart", + IFCBRIDGE: "IfcBridge", + IFCBEARINGTYPE: "IfcBearingType", + IFCALIGNMENTVERTICAL: "IfcAlignmentVertical", + IFCALIGNMENTSEGMENT: "IfcAlignmentSegment", + IFCALIGNMENTHORIZONTAL: "IfcAlignmentHorizontal", + IFCALIGNMENTCANT: "IfcAlignmentCant", + IFCVIBRATIONDAMPERTYPE: "IfcVibrationDamperType", + IFCVIBRATIONDAMPER: "IfcVibrationDamper", + IFCVEHICLE: "IfcVehicle", + IFCTRANSPORTATIONDEVICE: "IfcTransportationDevice", + IFCTRACKELEMENTTYPE: "IfcTrackElementType", + IFCTENDONCONDUITTYPE: "IfcTendonConduitType", + IFCTENDONCONDUIT: "IfcTendonConduit", + IFCSINESPIRAL: "IfcSineSpiral", + IFCSIGNALTYPE: "IfcSignalType", + IFCSIGNTYPE: "IfcSignType", + IFCSIGN: "IfcSign", + IFCSEVENTHORDERPOLYNOMIALSPIRAL: "IfcSeventhOrderPolynomialSpiral", + IFCSEGMENTEDREFERENCECURVE: "IfcSegmentedReferenceCurve", + IFCSECONDORDERPOLYNOMIALSPIRAL: "IfcSecondOrderPolynomialSpiral", + IFCROADPART: "IfcRoadPart", + IFCROAD: "IfcRoad", + IFCRELADHERESTOELEMENT: "IfcRelAdheresToElement", + IFCREFERENT: "IfcReferent", + IFCRAILWAYPART: "IfcRailwayPart", + IFCRAILWAY: "IfcRailway", + IFCRAILTYPE: "IfcRailType", + IFCPOSITIONINGELEMENT: "IfcPositioningElement", + IFCPAVEMENTTYPE: "IfcPavementType", + IFCNAVIGATIONELEMENTTYPE: "IfcNavigationElementType", + IFCMOORINGDEVICETYPE: "IfcMooringDeviceType", + IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE: + "IfcMobileTelecommunicationsApplianceType", + IFCMARINEPART: "IfcMarinePart", + IFCMARINEFACILITY: "IfcMarineFacility", + IFCLIQUIDTERMINALTYPE: "IfcLiquidTerminalType", + IFCLINEARELEMENT: "IfcLinearElement", + IFCKERBTYPE: "IfcKerbType", + IFCIMPACTPROTECTIONDEVICETYPE: "IfcImpactProtectionDeviceType", + IFCIMPACTPROTECTIONDEVICE: "IfcImpactProtectionDevice", + IFCGRADIENTCURVE: "IfcGradientCurve", + IFCGEOTECHNICALSTRATUM: "IfcGeotechnicalStratum", + IFCGEOTECHNICALELEMENT: "IfcGeotechnicalElement", + IFCFACILITYPARTCOMMON: "IfcFacilityPartCommon", + IFCFACILITYPART: "IfcFacilityPart", + IFCFACILITY: "IfcFacility", + IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID: + "IfcDirectrixDerivedReferenceSweptAreaSolid", + IFCDEEPFOUNDATIONTYPE: "IfcDeepFoundationType", + IFCCOURSETYPE: "IfcCourseType", + IFCCOSINESPIRAL: "IfcCosineSpiral", + IFCCLOTHOID: "IfcClothoid", + IFCBUILTELEMENTTYPE: "IfcBuiltElementType", + IFCVEHICLETYPE: "IfcVehicleType", + IFCTRIANGULATEDIRREGULARNETWORK: "IfcTriangulatedIrregularNetwork", + IFCTRANSPORTATIONDEVICETYPE: "IfcTransportationDeviceType", + IFCTHIRDORDERPOLYNOMIALSPIRAL: "IfcThirdOrderPolynomialSpiral", + IFCSPIRAL: "IfcSpiral", + IFCSECTIONEDSURFACE: "IfcSectionedSurface", + IFCSECTIONEDSOLIDHORIZONTAL: "IfcSectionedSolidHorizontal", + IFCSECTIONEDSOLID: "IfcSectionedSolid", + IFCRELPOSITIONS: "IfcRelPositions", + IFCRELASSOCIATESPROFILEDEF: "IfcRelAssociatesProfileDef", + IFCPOLYNOMIALCURVE: "IfcPolynomialCurve", + IFCOFFSETCURVEBYDISTANCES: "IfcOffsetCurveByDistances", + IFCOFFSETCURVE: "IfcOffsetCurve", + IFCINDEXEDPOLYGONALTEXTUREMAP: "IfcIndexedPolygonalTextureMap", + IFCDIRECTRIXCURVESWEPTAREASOLID: "IfcDirectrixCurveSweptAreaSolid", + IFCCURVESEGMENT: "IfcCurveSegment", + IFCAXIS2PLACEMENTLINEAR: "IfcAxis2PlacementLinear", + IFCSEGMENT: "IfcSegment", + IFCPOINTBYDISTANCEEXPRESSION: "IfcPointByDistanceExpression", + IFCOPENCROSSPROFILEDEF: "IfcOpenCrossProfileDef", + IFCLINEARPLACEMENT: "IfcLinearPlacement", + IFCALIGNMENTHORIZONTALSEGMENT: "IfcAlignmentHorizontalSegment", + IFCALIGNMENTCANTSEGMENT: "IfcAlignmentCantSegment", + IFCTEXTURECOORDINATEINDICESWITHVOIDS: "IfcTextureCoordinateIndicesWithVoids", + IFCTEXTURECOORDINATEINDICES: "IfcTextureCoordinateIndices", + IFCQUANTITYNUMBER: "IfcQuantityNumber", + IFCALIGNMENTVERTICALSEGMENT: "IfcAlignmentVerticalSegment", + IFCALIGNMENTPARAMETERSEGMENT: "IfcAlignmentParameterSegment", + IFCCONTROLLER: "IfcController", + IFCALARM: "IfcAlarm", + IFCACTUATOR: "IfcActuator", + IFCUNITARYCONTROLELEMENT: "IfcUnitaryControlElement", + IFCSENSOR: "IfcSensor", + IFCPROTECTIVEDEVICETRIPPINGUNIT: "IfcProtectiveDeviceTrippingUnit", + IFCFLOWINSTRUMENT: "IfcFlowInstrument", + IFCFIRESUPPRESSIONTERMINAL: "IfcFireSuppressionTerminal", + IFCFILTER: "IfcFilter", + IFCFAN: "IfcFan", + IFCELECTRICTIMECONTROL: "IfcElectricTimeControl", + IFCELECTRICMOTOR: "IfcElectricMotor", + IFCELECTRICGENERATOR: "IfcElectricGenerator", + IFCELECTRICFLOWSTORAGEDEVICE: "IfcElectricFlowStorageDevice", + IFCELECTRICDISTRIBUTIONBOARD: "IfcElectricDistributionBoard", + IFCELECTRICAPPLIANCE: "IfcElectricAppliance", + IFCDUCTSILENCER: "IfcDuctSilencer", + IFCDUCTSEGMENT: "IfcDuctSegment", + IFCDUCTFITTING: "IfcDuctFitting", + IFCDISTRIBUTIONCIRCUIT: "IfcDistributionCircuit", + IFCDAMPER: "IfcDamper", + IFCCOOLINGTOWER: "IfcCoolingTower", + IFCCOOLEDBEAM: "IfcCooledBeam", + IFCCONDENSER: "IfcCondenser", + IFCCOMPRESSOR: "IfcCompressor", + IFCCOMMUNICATIONSAPPLIANCE: "IfcCommunicationsAppliance", + IFCCOIL: "IfcCoil", + IFCCHILLER: "IfcChiller", + IFCCABLESEGMENT: "IfcCableSegment", + IFCCABLEFITTING: "IfcCableFitting", + IFCCABLECARRIERSEGMENT: "IfcCableCarrierSegment", + IFCCABLECARRIERFITTING: "IfcCableCarrierFitting", + IFCBURNER: "IfcBurner", + IFCBOILER: "IfcBoiler", + IFCBEAMSTANDARDCASE: "IfcBeamStandardCase", + IFCAUDIOVISUALAPPLIANCE: "IfcAudioVisualAppliance", + IFCAIRTOAIRHEATRECOVERY: "IfcAirToAirHeatRecovery", + IFCAIRTERMINALBOX: "IfcAirTerminalBox", + IFCAIRTERMINAL: "IfcAirTerminal", + IFCWINDOWSTANDARDCASE: "IfcWindowStandardCase", + IFCWASTETERMINAL: "IfcWasteTerminal", + IFCWALLELEMENTEDCASE: "IfcWallElementedCase", + IFCVALVE: "IfcValve", + IFCUNITARYEQUIPMENT: "IfcUnitaryEquipment", + IFCUNITARYCONTROLELEMENTTYPE: "IfcUnitaryControlElementType", + IFCTUBEBUNDLE: "IfcTubeBundle", + IFCTRANSFORMER: "IfcTransformer", + IFCTANK: "IfcTank", + IFCSWITCHINGDEVICE: "IfcSwitchingDevice", + IFCSTRUCTURALLOADCASE: "IfcStructuralLoadCase", + IFCSTACKTERMINAL: "IfcStackTerminal", + IFCSPACEHEATER: "IfcSpaceHeater", + IFCSOLARDEVICE: "IfcSolarDevice", + IFCSLABSTANDARDCASE: "IfcSlabStandardCase", + IFCSLABELEMENTEDCASE: "IfcSlabElementedCase", + IFCSHADINGDEVICE: "IfcShadingDevice", + IFCSANITARYTERMINAL: "IfcSanitaryTerminal", + IFCREINFORCINGBARTYPE: "IfcReinforcingBarType", + IFCRATIONALBSPLINECURVEWITHKNOTS: "IfcRationalBSplineCurveWithKnots", + IFCPUMP: "IfcPump", + IFCPROTECTIVEDEVICETRIPPINGUNITTYPE: "IfcProtectiveDeviceTrippingUnitType", + IFCPROTECTIVEDEVICE: "IfcProtectiveDevice", + IFCPLATESTANDARDCASE: "IfcPlateStandardCase", + IFCPIPESEGMENT: "IfcPipeSegment", + IFCPIPEFITTING: "IfcPipeFitting", + IFCOUTLET: "IfcOutlet", + IFCOUTERBOUNDARYCURVE: "IfcOuterBoundaryCurve", + IFCMOTORCONNECTION: "IfcMotorConnection", + IFCMEMBERSTANDARDCASE: "IfcMemberStandardCase", + IFCMEDICALDEVICE: "IfcMedicalDevice", + IFCLIGHTFIXTURE: "IfcLightFixture", + IFCLAMP: "IfcLamp", + IFCJUNCTIONBOX: "IfcJunctionBox", + IFCINTERCEPTOR: "IfcInterceptor", + IFCHUMIDIFIER: "IfcHumidifier", + IFCHEATEXCHANGER: "IfcHeatExchanger", + IFCFLOWMETER: "IfcFlowMeter", + IFCEXTERNALSPATIALELEMENT: "IfcExternalSpatialElement", + IFCEVAPORATOR: "IfcEvaporator", + IFCEVAPORATIVECOOLER: "IfcEvaporativeCooler", + IFCENGINE: "IfcEngine", + IFCELECTRICDISTRIBUTIONBOARDTYPE: "IfcElectricDistributionBoardType", + IFCDOORSTANDARDCASE: "IfcDoorStandardCase", + IFCDISTRIBUTIONSYSTEM: "IfcDistributionSystem", + IFCCOMMUNICATIONSAPPLIANCETYPE: "IfcCommunicationsApplianceType", + IFCCOLUMNSTANDARDCASE: "IfcColumnStandardCase", + IFCCIVILELEMENT: "IfcCivilElement", + IFCCHIMNEY: "IfcChimney", + IFCCABLEFITTINGTYPE: "IfcCableFittingType", + IFCBURNERTYPE: "IfcBurnerType", + IFCBUILDINGSYSTEM: "IfcBuildingSystem", + IFCBUILDINGELEMENTPARTTYPE: "IfcBuildingElementPartType", + IFCBOUNDARYCURVE: "IfcBoundaryCurve", + IFCBSPLINECURVEWITHKNOTS: "IfcBSplineCurveWithKnots", + IFCAUDIOVISUALAPPLIANCETYPE: "IfcAudioVisualApplianceType", + IFCWORKCALENDAR: "IfcWorkCalendar", + IFCWINDOWTYPE: "IfcWindowType", + IFCVOIDINGFEATURE: "IfcVoidingFeature", + IFCVIBRATIONISOLATOR: "IfcVibrationIsolator", + IFCTENDONTYPE: "IfcTendonType", + IFCTENDONANCHORTYPE: "IfcTendonAnchorType", + IFCSYSTEMFURNITUREELEMENT: "IfcSystemFurnitureElement", + IFCSURFACEFEATURE: "IfcSurfaceFeature", + IFCSTRUCTURALSURFACEACTION: "IfcStructuralSurfaceAction", + IFCSTRUCTURALCURVEREACTION: "IfcStructuralCurveReaction", + IFCSTRUCTURALCURVEACTION: "IfcStructuralCurveAction", + IFCSTAIRTYPE: "IfcStairType", + IFCSOLARDEVICETYPE: "IfcSolarDeviceType", + IFCSHADINGDEVICETYPE: "IfcShadingDeviceType", + IFCSEAMCURVE: "IfcSeamCurve", + IFCROOFTYPE: "IfcRoofType", + IFCREINFORCINGMESHTYPE: "IfcReinforcingMeshType", + IFCREINFORCINGELEMENTTYPE: "IfcReinforcingElementType", + IFCRATIONALBSPLINESURFACEWITHKNOTS: "IfcRationalBSplineSurfaceWithKnots", + IFCRAMPTYPE: "IfcRampType", + IFCPOLYGONALFACESET: "IfcPolygonalFaceSet", + IFCPILETYPE: "IfcPileType", + IFCOPENINGSTANDARDCASE: "IfcOpeningStandardCase", + IFCMEDICALDEVICETYPE: "IfcMedicalDeviceType", + IFCINTERSECTIONCURVE: "IfcIntersectionCurve", + IFCINTERCEPTORTYPE: "IfcInterceptorType", + IFCINDEXEDPOLYCURVE: "IfcIndexedPolyCurve", + IFCGEOGRAPHICELEMENT: "IfcGeographicElement", + IFCFURNITURE: "IfcFurniture", + IFCFOOTINGTYPE: "IfcFootingType", + IFCEXTERNALSPATIALSTRUCTUREELEMENT: "IfcExternalSpatialStructureElement", + IFCEVENT: "IfcEvent", + IFCENGINETYPE: "IfcEngineType", + IFCELEMENTASSEMBLYTYPE: "IfcElementAssemblyType", + IFCDOORTYPE: "IfcDoorType", + IFCCYLINDRICALSURFACE: "IfcCylindricalSurface", + IFCCONSTRUCTIONPRODUCTRESOURCETYPE: "IfcConstructionProductResourceType", + IFCCONSTRUCTIONMATERIALRESOURCETYPE: "IfcConstructionMaterialResourceType", + IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE: "IfcConstructionEquipmentResourceType", + IFCCOMPOSITECURVEONSURFACE: "IfcCompositeCurveOnSurface", + IFCCOMPLEXPROPERTYTEMPLATE: "IfcComplexPropertyTemplate", + IFCCIVILELEMENTTYPE: "IfcCivilElementType", + IFCCHIMNEYTYPE: "IfcChimneyType", + IFCBSPLINESURFACEWITHKNOTS: "IfcBSplineSurfaceWithKnots", + IFCBSPLINESURFACE: "IfcBSplineSurface", + IFCADVANCEDBREPWITHVOIDS: "IfcAdvancedBrepWithVoids", + IFCADVANCEDBREP: "IfcAdvancedBrep", + IFCTRIANGULATEDFACESET: "IfcTriangulatedFaceSet", + IFCTOROIDALSURFACE: "IfcToroidalSurface", + IFCTESSELLATEDFACESET: "IfcTessellatedFaceSet", + IFCTASKTYPE: "IfcTaskType", + IFCSURFACECURVE: "IfcSurfaceCurve", + IFCSUBCONTRACTRESOURCETYPE: "IfcSubContractResourceType", + IFCSTRUCTURALSURFACEREACTION: "IfcStructuralSurfaceReaction", + IFCSPHERICALSURFACE: "IfcSphericalSurface", + IFCSPATIALZONETYPE: "IfcSpatialZoneType", + IFCSPATIALZONE: "IfcSpatialZone", + IFCSPATIALELEMENTTYPE: "IfcSpatialElementType", + IFCSPATIALELEMENT: "IfcSpatialElement", + IFCSIMPLEPROPERTYTEMPLATE: "IfcSimplePropertyTemplate", + IFCREVOLVEDAREASOLIDTAPERED: "IfcRevolvedAreaSolidTapered", + IFCREPARAMETRISEDCOMPOSITECURVESEGMENT: + "IfcReparametrisedCompositeCurveSegment", + IFCRELSPACEBOUNDARY2NDLEVEL: "IfcRelSpaceBoundary2ndLevel", + IFCRELSPACEBOUNDARY1STLEVEL: "IfcRelSpaceBoundary1stLevel", + IFCRELINTERFERESELEMENTS: "IfcRelInterferesElements", + IFCRELDEFINESBYTEMPLATE: "IfcRelDefinesByTemplate", + IFCRELDEFINESBYOBJECT: "IfcRelDefinesByObject", + IFCRELDECLARES: "IfcRelDeclares", + IFCRELASSIGNSTOGROUPBYFACTOR: "IfcRelAssignsToGroupByFactor", + IFCPROPERTYTEMPLATE: "IfcPropertyTemplate", + IFCPROPERTYSETTEMPLATE: "IfcPropertySetTemplate", + IFCPROJECTLIBRARY: "IfcProjectLibrary", + IFCPROCEDURETYPE: "IfcProcedureType", + IFCPREDEFINEDPROPERTYSET: "IfcPredefinedPropertySet", + IFCPCURVE: "IfcPCurve", + IFCLABORRESOURCETYPE: "IfcLaborResourceType", + IFCINDEXEDPOLYGONALFACEWITHVOIDS: "IfcIndexedPolygonalFaceWithVoids", + IFCINDEXEDPOLYGONALFACE: "IfcIndexedPolygonalFace", + IFCGEOGRAPHICELEMENTTYPE: "IfcGeographicElementType", + IFCFIXEDREFERENCESWEPTAREASOLID: "IfcFixedReferenceSweptAreaSolid", + IFCEXTRUDEDAREASOLIDTAPERED: "IfcExtrudedAreaSolidTapered", + IFCEVENTTYPE: "IfcEventType", + IFCCURVEBOUNDEDSURFACE: "IfcCurveBoundedSurface", + IFCCREWRESOURCETYPE: "IfcCrewResourceType", + IFCCONTEXT: "IfcContext", + IFCCONSTRUCTIONRESOURCETYPE: "IfcConstructionResourceType", + IFCCARTESIANPOINTLIST3D: "IfcCartesianPointList3D", + IFCCARTESIANPOINTLIST2D: "IfcCartesianPointList2D", + IFCCARTESIANPOINTLIST: "IfcCartesianPointList", + IFCADVANCEDFACE: "IfcAdvancedFace", + IFCTYPERESOURCE: "IfcTypeResource", + IFCTYPEPROCESS: "IfcTypeProcess", + IFCTESSELLATEDITEM: "IfcTessellatedItem", + IFCSWEPTDISKSOLIDPOLYGONAL: "IfcSweptDiskSolidPolygonal", + IFCRESOURCETIME: "IfcResourceTime", + IFCRESOURCECONSTRAINTRELATIONSHIP: "IfcResourceConstraintRelationship", + IFCRESOURCEAPPROVALRELATIONSHIP: "IfcResourceApprovalRelationship", + IFCQUANTITYSET: "IfcQuantitySet", + IFCPROPERTYTEMPLATEDEFINITION: "IfcPropertyTemplateDefinition", + IFCPREDEFINEDPROPERTIES: "IfcPredefinedProperties", + IFCMIRROREDPROFILEDEF: "IfcMirroredProfileDef", + IFCMATERIALRELATIONSHIP: "IfcMaterialRelationship", + IFCMATERIALPROFILESETUSAGETAPERING: "IfcMaterialProfileSetUsageTapering", + IFCMATERIALPROFILESETUSAGE: "IfcMaterialProfileSetUsage", + IFCMATERIALCONSTITUENTSET: "IfcMaterialConstituentSet", + IFCMATERIALCONSTITUENT: "IfcMaterialConstituent", + IFCLAGTIME: "IfcLagTime", + IFCINDEXEDTRIANGLETEXTUREMAP: "IfcIndexedTriangleTextureMap", + IFCINDEXEDTEXTUREMAP: "IfcIndexedTextureMap", + IFCINDEXEDCOLOURMAP: "IfcIndexedColourMap", + IFCEXTERNALREFERENCERELATIONSHIP: "IfcExternalReferenceRelationship", + IFCEXTENDEDPROPERTIES: "IfcExtendedProperties", + IFCEVENTTIME: "IfcEventTime", + IFCCONVERSIONBASEDUNITWITHOFFSET: "IfcConversionBasedUnitWithOffset", + IFCCOLOURRGBLIST: "IfcColourRgbList", + IFCWORKTIME: "IfcWorkTime", + IFCTIMEPERIOD: "IfcTimePeriod", + IFCTEXTUREVERTEXLIST: "IfcTextureVertexList", + IFCTASKTIMERECURRING: "IfcTaskTimeRecurring", + IFCTASKTIME: "IfcTaskTime", + IFCTABLECOLUMN: "IfcTableColumn", + IFCSURFACEREINFORCEMENTAREA: "IfcSurfaceReinforcementArea", + IFCSTRUCTURALLOADORRESULT: "IfcStructuralLoadOrResult", + IFCSTRUCTURALLOADCONFIGURATION: "IfcStructuralLoadConfiguration", + IFCSCHEDULINGTIME: "IfcSchedulingTime", + IFCRESOURCELEVELRELATIONSHIP: "IfcResourceLevelRelationship", + IFCREFERENCE: "IfcReference", + IFCRECURRENCEPATTERN: "IfcRecurrencePattern", + IFCPROPERTYABSTRACTION: "IfcPropertyAbstraction", + IFCPROJECTEDCRS: "IfcProjectedCrs", + IFCPRESENTATIONITEM: "IfcPresentationItem", + IFCMATERIALUSAGEDEFINITION: "IfcMaterialUsageDefinition", + IFCMATERIALPROFILEWITHOFFSETS: "IfcMaterialProfileWithOffsets", + IFCMATERIALPROFILESET: "IfcMaterialProfileSet", + IFCMATERIALPROFILE: "IfcMaterialProfile", + IFCMATERIALLAYERWITHOFFSETS: "IfcMaterialLayerWithOffsets", + IFCMATERIALDEFINITION: "IfcMaterialDefinition", + IFCMAPCONVERSION: "IfcMapConversion", + IFCEXTERNALINFORMATION: "IfcExternalInformation", + IFCCOORDINATEREFERENCESYSTEM: "IfcCoordinateReferenceSystem", + IFCCOORDINATEOPERATION: "IfcCoordinateOperation", + IFCCONNECTIONVOLUMEGEOMETRY: "IfcConnectionVolumeGeometry", + IFCREINFORCINGBAR: "IfcReinforcingBar", + IFCELECTRICDISTRIBUTIONPOINT: "IfcElectricDistributionPoint", + IFCDISTRIBUTIONCONTROLELEMENT: "IfcDistributionControlElement", + IFCDISTRIBUTIONCHAMBERELEMENT: "IfcDistributionChamberElement", + IFCCONTROLLERTYPE: "IfcControllerType", + IFCCHAMFEREDGEFEATURE: "IfcChamferEdgeFeature", + IFCBEAM: "IfcBeam", + IFCALARMTYPE: "IfcAlarmType", + IFCACTUATORTYPE: "IfcActuatorType", + IFCWINDOW: "IfcWindow", + IFCWALLSTANDARDCASE: "IfcWallStandardCase", + IFCWALL: "IfcWall", + IFCVIBRATIONISOLATORTYPE: "IfcVibrationIsolatorType", + IFCTENDONANCHOR: "IfcTendonAnchor", + IFCTENDON: "IfcTendon", + IFCSTRUCTURALANALYSISMODEL: "IfcStructuralAnalysisModel", + IFCSTAIRFLIGHT: "IfcStairFlight", + IFCSTAIR: "IfcStair", + IFCSLAB: "IfcSlab", + IFCSENSORTYPE: "IfcSensorType", + IFCROUNDEDEDGEFEATURE: "IfcRoundedEdgeFeature", + IFCROOF: "IfcRoof", + IFCREINFORCINGMESH: "IfcReinforcingMesh", + IFCREINFORCINGELEMENT: "IfcReinforcingElement", + IFCRATIONALBEZIERCURVE: "IfcRationalBezierCurve", + IFCRAMPFLIGHT: "IfcRampFlight", + IFCRAMP: "IfcRamp", + IFCRAILING: "IfcRailing", + IFCPLATE: "IfcPlate", + IFCPILE: "IfcPile", + IFCMEMBER: "IfcMember", + IFCFOOTING: "IfcFooting", + IFCFLOWTREATMENTDEVICE: "IfcFlowTreatmentDevice", + IFCFLOWTERMINAL: "IfcFlowTerminal", + IFCFLOWSTORAGEDEVICE: "IfcFlowStorageDevice", + IFCFLOWSEGMENT: "IfcFlowSegment", + IFCFLOWMOVINGDEVICE: "IfcFlowMovingDevice", + IFCFLOWINSTRUMENTTYPE: "IfcFlowInstrumentType", + IFCFLOWFITTING: "IfcFlowFitting", + IFCFLOWCONTROLLER: "IfcFlowController", + IFCFIRESUPPRESSIONTERMINALTYPE: "IfcFireSuppressionTerminalType", + IFCFILTERTYPE: "IfcFilterType", + IFCFANTYPE: "IfcFanType", + IFCENERGYCONVERSIONDEVICE: "IfcEnergyConversionDevice", + IFCELECTRICALELEMENT: "IfcElectricalElement", + IFCELECTRICALCIRCUIT: "IfcElectricalCircuit", + IFCELECTRICTIMECONTROLTYPE: "IfcElectricTimeControlType", + IFCELECTRICMOTORTYPE: "IfcElectricMotorType", + IFCELECTRICHEATERTYPE: "IfcElectricHeaterType", + IFCELECTRICGENERATORTYPE: "IfcElectricGeneratorType", + IFCELECTRICFLOWSTORAGEDEVICETYPE: "IfcElectricFlowStorageDeviceType", + IFCELECTRICAPPLIANCETYPE: "IfcElectricApplianceType", + IFCEDGEFEATURE: "IfcEdgeFeature", + IFCDUCTSILENCERTYPE: "IfcDuctSilencerType", + IFCDUCTSEGMENTTYPE: "IfcDuctSegmentType", + IFCDUCTFITTINGTYPE: "IfcDuctFittingType", + IFCDOOR: "IfcDoor", + IFCDISTRIBUTIONPORT: "IfcDistributionPort", + IFCDISTRIBUTIONFLOWELEMENT: "IfcDistributionFlowElement", + IFCDISTRIBUTIONELEMENT: "IfcDistributionElement", + IFCDISTRIBUTIONCONTROLELEMENTTYPE: "IfcDistributionControlElementType", + IFCDISTRIBUTIONCHAMBERELEMENTTYPE: "IfcDistributionChamberElementType", + IFCDISCRETEACCESSORYTYPE: "IfcDiscreteAccessoryType", + IFCDISCRETEACCESSORY: "IfcDiscreteAccessory", + IFCDIAMETERDIMENSION: "IfcDiameterDimension", + IFCDAMPERTYPE: "IfcDamperType", + IFCCURTAINWALL: "IfcCurtainWall", + IFCCOVERING: "IfcCovering", + IFCCOOLINGTOWERTYPE: "IfcCoolingTowerType", + IFCCOOLEDBEAMTYPE: "IfcCooledBeamType", + IFCCONSTRUCTIONPRODUCTRESOURCE: "IfcConstructionProductResource", + IFCCONSTRUCTIONMATERIALRESOURCE: "IfcConstructionMaterialResource", + IFCCONSTRUCTIONEQUIPMENTRESOURCE: "IfcConstructionEquipmentResource", + IFCCONDITIONCRITERION: "IfcConditionCriterion", + IFCCONDITION: "IfcCondition", + IFCCONDENSERTYPE: "IfcCondenserType", + IFCCOMPRESSORTYPE: "IfcCompressorType", + IFCCOLUMN: "IfcColumn", + IFCCOILTYPE: "IfcCoilType", + IFCCIRCLE: "IfcCircle", + IFCCHILLERTYPE: "IfcChillerType", + IFCCABLESEGMENTTYPE: "IfcCableSegmentType", + IFCCABLECARRIERSEGMENTTYPE: "IfcCableCarrierSegmentType", + IFCCABLECARRIERFITTINGTYPE: "IfcCableCarrierFittingType", + IFCBUILDINGELEMENTPROXYTYPE: "IfcBuildingElementProxyType", + IFCBUILDINGELEMENTPROXY: "IfcBuildingElementProxy", + IFCBUILDINGELEMENTPART: "IfcBuildingElementPart", + IFCBUILDINGELEMENTCOMPONENT: "IfcBuildingElementComponent", + IFCBUILDINGELEMENT: "IfcBuildingElement", + IFCBOILERTYPE: "IfcBoilerType", + IFCBEZIERCURVE: "IfcBezierCurve", + IFCBEAMTYPE: "IfcBeamType", + IFCBSPLINECURVE: "IfcBSplineCurve", + IFCASSET: "IfcAsset", + IFCANGULARDIMENSION: "IfcAngularDimension", + IFCAIRTOAIRHEATRECOVERYTYPE: "IfcAirToAirHeatRecoveryType", + IFCAIRTERMINALTYPE: "IfcAirTerminalType", + IFCAIRTERMINALBOXTYPE: "IfcAirTerminalBoxType", + IFCACTIONREQUEST: "IfcActionRequest", + IFC2DCOMPOSITECURVE: "Ifc2DCompositeCurve", + IFCZONE: "IfcZone", + IFCWORKSCHEDULE: "IfcWorkSchedule", + IFCWORKPLAN: "IfcWorkPlan", + IFCWORKCONTROL: "IfcWorkControl", + IFCWASTETERMINALTYPE: "IfcWasteTerminalType", + IFCWALLTYPE: "IfcWallType", + IFCVIRTUALELEMENT: "IfcVirtualElement", + IFCVALVETYPE: "IfcValveType", + IFCUNITARYEQUIPMENTTYPE: "IfcUnitaryEquipmentType", + IFCTUBEBUNDLETYPE: "IfcTubeBundleType", + IFCTRIMMEDCURVE: "IfcTrimmedCurve", + IFCTRANSPORTELEMENT: "IfcTransportElement", + IFCTRANSFORMERTYPE: "IfcTransformerType", + IFCTIMESERIESSCHEDULE: "IfcTimeSeriesSchedule", + IFCTANKTYPE: "IfcTankType", + IFCSYSTEM: "IfcSystem", + IFCSWITCHINGDEVICETYPE: "IfcSwitchingDeviceType", + IFCSUBCONTRACTRESOURCE: "IfcSubContractResource", + IFCSTRUCTURALSURFACECONNECTION: "IfcStructuralSurfaceConnection", + IFCSTRUCTURALRESULTGROUP: "IfcStructuralResultGroup", + IFCSTRUCTURALPOINTREACTION: "IfcStructuralPointReaction", + IFCSTRUCTURALPOINTCONNECTION: "IfcStructuralPointConnection", + IFCSTRUCTURALPOINTACTION: "IfcStructuralPointAction", + IFCSTRUCTURALPLANARACTIONVARYING: "IfcStructuralPlanarActionVarying", + IFCSTRUCTURALPLANARACTION: "IfcStructuralPlanarAction", + IFCSTRUCTURALLOADGROUP: "IfcStructuralLoadGroup", + IFCSTRUCTURALLINEARACTIONVARYING: "IfcStructuralLinearActionVarying", + IFCSTRUCTURALLINEARACTION: "IfcStructuralLinearAction", + IFCSTRUCTURALCURVEMEMBERVARYING: "IfcStructuralCurveMemberVarying", + IFCSTRUCTURALCURVEMEMBER: "IfcStructuralCurveMember", + IFCSTRUCTURALCURVECONNECTION: "IfcStructuralCurveConnection", + IFCSTRUCTURALCONNECTION: "IfcStructuralConnection", + IFCSTRUCTURALACTION: "IfcStructuralAction", + IFCSTAIRFLIGHTTYPE: "IfcStairFlightType", + IFCSTACKTERMINALTYPE: "IfcStackTerminalType", + IFCSPACETYPE: "IfcSpaceType", + IFCSPACEPROGRAM: "IfcSpaceProgram", + IFCSPACEHEATERTYPE: "IfcSpaceHeaterType", + IFCSPACE: "IfcSpace", + IFCSLABTYPE: "IfcSlabType", + IFCSITE: "IfcSite", + IFCSERVICELIFE: "IfcServiceLife", + IFCSCHEDULETIMECONTROL: "IfcScheduleTimeControl", + IFCSANITARYTERMINALTYPE: "IfcSanitaryTerminalType", + IFCRELASSIGNSTASKS: "IfcRelAssignsTasks", + IFCRELAGGREGATES: "IfcRelAggregates", + IFCRAMPFLIGHTTYPE: "IfcRampFlightType", + IFCRAILINGTYPE: "IfcRailingType", + IFCRADIUSDIMENSION: "IfcRadiusDimension", + IFCPUMPTYPE: "IfcPumpType", + IFCPROTECTIVEDEVICETYPE: "IfcProtectiveDeviceType", + IFCPROJECTIONELEMENT: "IfcProjectionElement", + IFCPROJECTORDERRECORD: "IfcProjectOrderRecord", + IFCPROJECTORDER: "IfcProjectOrder", + IFCPROCEDURE: "IfcProcedure", + IFCPORT: "IfcPort", + IFCPOLYLINE: "IfcPolyline", + IFCPLATETYPE: "IfcPlateType", + IFCPIPESEGMENTTYPE: "IfcPipeSegmentType", + IFCPIPEFITTINGTYPE: "IfcPipeFittingType", + IFCPERMIT: "IfcPermit", + IFCPERFORMANCEHISTORY: "IfcPerformanceHistory", + IFCOUTLETTYPE: "IfcOutletType", + IFCORDERACTION: "IfcOrderAction", + IFCOPENINGELEMENT: "IfcOpeningElement", + IFCOCCUPANT: "IfcOccupant", + IFCMOVE: "IfcMove", + IFCMOTORCONNECTIONTYPE: "IfcMotorConnectionType", + IFCMEMBERTYPE: "IfcMemberType", + IFCMECHANICALFASTENERTYPE: "IfcMechanicalFastenerType", + IFCMECHANICALFASTENER: "IfcMechanicalFastener", + IFCLINEARDIMENSION: "IfcLinearDimension", + IFCLIGHTFIXTURETYPE: "IfcLightFixtureType", + IFCLAMPTYPE: "IfcLampType", + IFCLABORRESOURCE: "IfcLaborResource", + IFCJUNCTIONBOXTYPE: "IfcJunctionBoxType", + IFCINVENTORY: "IfcInventory", + IFCHUMIDIFIERTYPE: "IfcHumidifierType", + IFCHEATEXCHANGERTYPE: "IfcHeatExchangerType", + IFCGROUP: "IfcGroup", + IFCGRID: "IfcGrid", + IFCGASTERMINALTYPE: "IfcGasTerminalType", + IFCFURNITURESTANDARD: "IfcFurnitureStandard", + IFCFURNISHINGELEMENT: "IfcFurnishingElement", + IFCFLOWTREATMENTDEVICETYPE: "IfcFlowTreatmentDeviceType", + IFCFLOWTERMINALTYPE: "IfcFlowTerminalType", + IFCFLOWSTORAGEDEVICETYPE: "IfcFlowStorageDeviceType", + IFCFLOWSEGMENTTYPE: "IfcFlowSegmentType", + IFCFLOWMOVINGDEVICETYPE: "IfcFlowMovingDeviceType", + IFCFLOWMETERTYPE: "IfcFlowMeterType", + IFCFLOWFITTINGTYPE: "IfcFlowFittingType", + IFCFLOWCONTROLLERTYPE: "IfcFlowControllerType", + IFCFEATUREELEMENTSUBTRACTION: "IfcFeatureElementSubtraction", + IFCFEATUREELEMENTADDITION: "IfcFeatureElementAddition", + IFCFEATUREELEMENT: "IfcFeatureElement", + IFCFASTENERTYPE: "IfcFastenerType", + IFCFASTENER: "IfcFastener", + IFCFACETEDBREPWITHVOIDS: "IfcFacetedBrepWithVoids", + IFCFACETEDBREP: "IfcFacetedBrep", + IFCEVAPORATORTYPE: "IfcEvaporatorType", + IFCEVAPORATIVECOOLERTYPE: "IfcEvaporativeCoolerType", + IFCEQUIPMENTSTANDARD: "IfcEquipmentStandard", + IFCEQUIPMENTELEMENT: "IfcEquipmentElement", + IFCENERGYCONVERSIONDEVICETYPE: "IfcEnergyConversionDeviceType", + IFCELLIPSE: "IfcEllipse", + IFCELEMENTCOMPONENTTYPE: "IfcElementComponentType", + IFCELEMENTCOMPONENT: "IfcElementComponent", + IFCELEMENTASSEMBLY: "IfcElementAssembly", + IFCELEMENT: "IfcElement", + IFCELECTRICALBASEPROPERTIES: "IfcElectricalBaseProperties", + IFCDISTRIBUTIONFLOWELEMENTTYPE: "IfcDistributionFlowElementType", + IFCDISTRIBUTIONELEMENTTYPE: "IfcDistributionElementType", + IFCDIMENSIONCURVEDIRECTEDCALLOUT: "IfcDimensionCurveDirectedCallout", + IFCCURTAINWALLTYPE: "IfcCurtainWallType", + IFCCREWRESOURCE: "IfcCrewResource", + IFCCOVERINGTYPE: "IfcCoveringType", + IFCCOSTSCHEDULE: "IfcCostSchedule", + IFCCOSTITEM: "IfcCostItem", + IFCCONTROL: "IfcControl", + IFCCONSTRUCTIONRESOURCE: "IfcConstructionResource", + IFCCONIC: "IfcConic", + IFCCOMPOSITECURVE: "IfcCompositeCurve", + IFCCOLUMNTYPE: "IfcColumnType", + IFCCIRCLEHOLLOWPROFILEDEF: "IfcCircleHollowProfileDef", + IFCBUILDINGSTOREY: "IfcBuildingStorey", + IFCBUILDINGELEMENTTYPE: "IfcBuildingElementType", + IFCBUILDING: "IfcBuilding", + IFCBOUNDEDCURVE: "IfcBoundedCurve", + IFCBOOLEANCLIPPINGRESULT: "IfcBooleanClippingResult", + IFCBLOCK: "IfcBlock", + IFCASYMMETRICISHAPEPROFILEDEF: "IfcAsymmetricIShapeProfileDef", + IFCANNOTATION: "IfcAnnotation", + IFCACTOR: "IfcActor", + IFCTRANSPORTELEMENTTYPE: "IfcTransportElementType", + IFCTASK: "IfcTask", + IFCSYSTEMFURNITUREELEMENTTYPE: "IfcSystemFurnitureElementType", + IFCSURFACEOFREVOLUTION: "IfcSurfaceOfRevolution", + IFCSURFACEOFLINEAREXTRUSION: "IfcSurfaceOfLinearExtrusion", + IFCSURFACECURVESWEPTAREASOLID: "IfcSurfaceCurveSweptAreaSolid", + IFCSTRUCTUREDDIMENSIONCALLOUT: "IfcStructuredDimensionCallout", + IFCSTRUCTURALSURFACEMEMBERVARYING: "IfcStructuralSurfaceMemberVarying", + IFCSTRUCTURALSURFACEMEMBER: "IfcStructuralSurfaceMember", + IFCSTRUCTURALREACTION: "IfcStructuralReaction", + IFCSTRUCTURALMEMBER: "IfcStructuralMember", + IFCSTRUCTURALITEM: "IfcStructuralItem", + IFCSTRUCTURALACTIVITY: "IfcStructuralActivity", + IFCSPHERE: "IfcSphere", + IFCSPATIALSTRUCTUREELEMENTTYPE: "IfcSpatialStructureElementType", + IFCSPATIALSTRUCTUREELEMENT: "IfcSpatialStructureElement", + IFCRIGHTCIRCULARCYLINDER: "IfcRightCircularCylinder", + IFCRIGHTCIRCULARCONE: "IfcRightCircularCone", + IFCREVOLVEDAREASOLID: "IfcRevolvedAreaSolid", + IFCRESOURCE: "IfcResource", + IFCRELVOIDSELEMENT: "IfcRelVoidsElement", + IFCRELSPACEBOUNDARY: "IfcRelSpaceBoundary", + IFCRELSERVICESBUILDINGS: "IfcRelServicesBuildings", + IFCRELSEQUENCE: "IfcRelSequence", + IFCRELSCHEDULESCOSTITEMS: "IfcRelSchedulesCostItems", + IFCRELREFERENCEDINSPATIALSTRUCTURE: "IfcRelReferencedInSpatialStructure", + IFCRELPROJECTSELEMENT: "IfcRelProjectsElement", + IFCRELOVERRIDESPROPERTIES: "IfcRelOverridesProperties", + IFCRELOCCUPIESSPACES: "IfcRelOccupiesSpaces", + IFCRELNESTS: "IfcRelNests", + IFCRELINTERACTIONREQUIREMENTS: "IfcRelInteractionRequirements", + IFCRELFLOWCONTROLELEMENTS: "IfcRelFlowControlElements", + IFCRELFILLSELEMENT: "IfcRelFillsElement", + IFCRELDEFINESBYTYPE: "IfcRelDefinesByType", + IFCRELDEFINESBYPROPERTIES: "IfcRelDefinesByProperties", + IFCRELDEFINES: "IfcRelDefines", + IFCRELDECOMPOSES: "IfcRelDecomposes", + IFCRELCOVERSSPACES: "IfcRelCoversSpaces", + IFCRELCOVERSBLDGELEMENTS: "IfcRelCoversBldgElements", + IFCRELCONTAINEDINSPATIALSTRUCTURE: "IfcRelContainedInSpatialStructure", + IFCRELCONNECTSWITHREALIZINGELEMENTS: "IfcRelConnectsWithRealizingElements", + IFCRELCONNECTSWITHECCENTRICITY: "IfcRelConnectsWithEccentricity", + IFCRELCONNECTSSTRUCTURALMEMBER: "IfcRelConnectsStructuralMember", + IFCRELCONNECTSSTRUCTURALELEMENT: "IfcRelConnectsStructuralElement", + IFCRELCONNECTSSTRUCTURALACTIVITY: "IfcRelConnectsStructuralActivity", + IFCRELCONNECTSPORTS: "IfcRelConnectsPorts", + IFCRELCONNECTSPORTTOELEMENT: "IfcRelConnectsPortToElement", + IFCRELCONNECTSPATHELEMENTS: "IfcRelConnectsPathElements", + IFCRELCONNECTSELEMENTS: "IfcRelConnectsElements", + IFCRELCONNECTS: "IfcRelConnects", + IFCRELASSOCIATESPROFILEPROPERTIES: "IfcRelAssociatesProfileProperties", + IFCRELASSOCIATESMATERIAL: "IfcRelAssociatesMaterial", + IFCRELASSOCIATESLIBRARY: "IfcRelAssociatesLibrary", + IFCRELASSOCIATESDOCUMENT: "IfcRelAssociatesDocument", + IFCRELASSOCIATESCONSTRAINT: "IfcRelAssociatesConstraint", + IFCRELASSOCIATESCLASSIFICATION: "IfcRelAssociatesClassification", + IFCRELASSOCIATESAPPROVAL: "IfcRelAssociatesApproval", + IFCRELASSOCIATESAPPLIEDVALUE: "IfcRelAssociatesAppliedValue", + IFCRELASSOCIATES: "IfcRelAssociates", + IFCRELASSIGNSTORESOURCE: "IfcRelAssignsToResource", + IFCRELASSIGNSTOPROJECTORDER: "IfcRelAssignsToProjectOrder", + IFCRELASSIGNSTOPRODUCT: "IfcRelAssignsToProduct", + IFCRELASSIGNSTOPROCESS: "IfcRelAssignsToProcess", + IFCRELASSIGNSTOGROUP: "IfcRelAssignsToGroup", + IFCRELASSIGNSTOCONTROL: "IfcRelAssignsToControl", + IFCRELASSIGNSTOACTOR: "IfcRelAssignsToActor", + IFCRELASSIGNS: "IfcRelAssigns", + IFCRECTANGULARTRIMMEDSURFACE: "IfcRectangularTrimmedSurface", + IFCRECTANGULARPYRAMID: "IfcRectangularPyramid", + IFCRECTANGLEHOLLOWPROFILEDEF: "IfcRectangleHollowProfileDef", + IFCPROXY: "IfcProxy", + IFCPROPERTYSET: "IfcPropertySet", + IFCPROJECTIONCURVE: "IfcProjectionCurve", + IFCPROJECT: "IfcProject", + IFCPRODUCT: "IfcProduct", + IFCPROCESS: "IfcProcess", + IFCPLANE: "IfcPlane", + IFCPLANARBOX: "IfcPlanarBox", + IFCPERMEABLECOVERINGPROPERTIES: "IfcPermeableCoveringProperties", + IFCOFFSETCURVE3D: "IfcOffsetCurve3D", + IFCOFFSETCURVE2D: "IfcOffsetCurve2D", + IFCOBJECT: "IfcObject", + IFCMANIFOLDSOLIDBREP: "IfcManifoldSolidBrep", + IFCLINE: "IfcLine", + IFCLSHAPEPROFILEDEF: "IfcLShapeProfileDef", + IFCISHAPEPROFILEDEF: "IfcIShapeProfileDef", + IFCGEOMETRICCURVESET: "IfcGeometricCurveSet", + IFCFURNITURETYPE: "IfcFurnitureType", + IFCFURNISHINGELEMENTTYPE: "IfcFurnishingElementType", + IFCFLUIDFLOWPROPERTIES: "IfcFluidFlowProperties", + IFCFILLAREASTYLETILES: "IfcFillAreaStyleTiles", + IFCFILLAREASTYLETILESYMBOLWITHSTYLE: "IfcFillAreaStyleTileSymbolWithStyle", + IFCFILLAREASTYLEHATCHING: "IfcFillAreaStyleHatching", + IFCFACEBASEDSURFACEMODEL: "IfcFaceBasedSurfaceModel", + IFCEXTRUDEDAREASOLID: "IfcExtrudedAreaSolid", + IFCENERGYPROPERTIES: "IfcEnergyProperties", + IFCELLIPSEPROFILEDEF: "IfcEllipseProfileDef", + IFCELEMENTARYSURFACE: "IfcElementarySurface", + IFCELEMENTTYPE: "IfcElementType", + IFCELEMENTQUANTITY: "IfcElementQuantity", + IFCEDGELOOP: "IfcEdgeLoop", + IFCDRAUGHTINGPREDEFINEDCURVEFONT: "IfcDraughtingPredefinedCurveFont", + IFCDRAUGHTINGPREDEFINEDCOLOUR: "IfcDraughtingPredefinedColour", + IFCDRAUGHTINGCALLOUT: "IfcDraughtingCallout", + IFCDOORSTYLE: "IfcDoorStyle", + IFCDOORPANELPROPERTIES: "IfcDoorPanelProperties", + IFCDOORLININGPROPERTIES: "IfcDoorLiningProperties", + IFCDIRECTION: "IfcDirection", + IFCDIMENSIONCURVETERMINATOR: "IfcDimensionCurveTerminator", + IFCDIMENSIONCURVE: "IfcDimensionCurve", + IFCDEFINEDSYMBOL: "IfcDefinedSymbol", + IFCCURVEBOUNDEDPLANE: "IfcCurveBoundedPlane", + IFCCURVE: "IfcCurve", + IFCCSGSOLID: "IfcCsgSolid", + IFCCSGPRIMITIVE3D: "IfcCsgPrimitive3D", + IFCCRANERAILFSHAPEPROFILEDEF: "IfcCraneRailFShapeProfileDef", + IFCCRANERAILASHAPEPROFILEDEF: "IfcCraneRailAShapeProfileDef", + IFCCOMPOSITECURVESEGMENT: "IfcCompositeCurveSegment", + IFCCLOSEDSHELL: "IfcClosedShell", + IFCCIRCLEPROFILEDEF: "IfcCircleProfileDef", + IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM: + "IfcCartesianTransformationOperator3DNonUniform", + IFCCARTESIANTRANSFORMATIONOPERATOR3D: "IfcCartesianTransformationOperator3D", + IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM: + "IfcCartesianTransformationOperator2DNonUniform", + IFCCARTESIANTRANSFORMATIONOPERATOR2D: "IfcCartesianTransformationOperator2D", + IFCCARTESIANTRANSFORMATIONOPERATOR: "IfcCartesianTransformationOperator", + IFCCARTESIANPOINT: "IfcCartesianPoint", + IFCCSHAPEPROFILEDEF: "IfcCShapeProfileDef", + IFCBOXEDHALFSPACE: "IfcBoxedHalfSpace", + IFCBOUNDINGBOX: "IfcBoundingBox", + IFCBOUNDEDSURFACE: "IfcBoundedSurface", + IFCBOOLEANRESULT: "IfcBooleanResult", + IFCAXIS2PLACEMENT3D: "IfcAxis2Placement3D", + IFCAXIS2PLACEMENT2D: "IfcAxis2Placement2D", + IFCAXIS1PLACEMENT: "IfcAxis1Placement", + IFCANNOTATIONSURFACE: "IfcAnnotationSurface", + IFCANNOTATIONFILLAREAOCCURRENCE: "IfcAnnotationFillAreaOccurrence", + IFCANNOTATIONFILLAREA: "IfcAnnotationFillArea", + IFCANNOTATIONCURVEOCCURRENCE: "IfcAnnotationCurveOccurrence", + IFCZSHAPEPROFILEDEF: "IfcZShapeProfileDef", + IFCWINDOWSTYLE: "IfcWindowStyle", + IFCWINDOWPANELPROPERTIES: "IfcWindowPanelProperties", + IFCWINDOWLININGPROPERTIES: "IfcWindowLiningProperties", + IFCVERTEXLOOP: "IfcVertexLoop", + IFCVECTOR: "IfcVector", + IFCUSHAPEPROFILEDEF: "IfcUShapeProfileDef", + IFCTYPEPRODUCT: "IfcTypeProduct", + IFCTYPEOBJECT: "IfcTypeObject", + IFCTWODIRECTIONREPEATFACTOR: "IfcTwoDirectionRepeatFactor", + IFCTRAPEZIUMPROFILEDEF: "IfcTrapeziumProfileDef", + IFCTEXTLITERALWITHEXTENT: "IfcTextLiteralWithExtent", + IFCTEXTLITERAL: "IfcTextLiteral", + IFCTERMINATORSYMBOL: "IfcTerminatorSymbol", + IFCTSHAPEPROFILEDEF: "IfcTShapeProfileDef", + IFCSWEPTSURFACE: "IfcSweptSurface", + IFCSWEPTDISKSOLID: "IfcSweptDiskSolid", + IFCSWEPTAREASOLID: "IfcSweptAreaSolid", + IFCSURFACESTYLERENDERING: "IfcSurfaceStyleRendering", + IFCSURFACE: "IfcSurface", + IFCSUBEDGE: "IfcSubedge", + IFCSTRUCTURALSTEELPROFILEPROPERTIES: "IfcStructuralSteelProfileProperties", + IFCSTRUCTURALPROFILEPROPERTIES: "IfcStructuralProfileProperties", + IFCSTRUCTURALLOADSINGLEFORCEWARPING: "IfcStructuralLoadSingleForceWarping", + IFCSTRUCTURALLOADSINGLEFORCE: "IfcStructuralLoadSingleForce", + IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION: + "IfcStructuralLoadSingleDisplacementDistortion", + IFCSTRUCTURALLOADSINGLEDISPLACEMENT: "IfcStructuralLoadSingleDisplacement", + IFCSTRUCTURALLOADPLANARFORCE: "IfcStructuralLoadPlanarForce", + IFCSTRUCTURALLOADLINEARFORCE: "IfcStructuralLoadLinearForce", + IFCSPACETHERMALLOADPROPERTIES: "IfcSpaceThermalLoadProperties", + IFCSOUNDVALUE: "IfcSoundValue", + IFCSOUNDPROPERTIES: "IfcSoundProperties", + IFCSOLIDMODEL: "IfcSolidModel", + IFCSLIPPAGECONNECTIONCONDITION: "IfcSlippageConnectionCondition", + IFCSHELLBASEDSURFACEMODEL: "IfcShellBasedSurfaceModel", + IFCSERVICELIFEFACTOR: "IfcServiceLifeFactor", + IFCSECTIONEDSPINE: "IfcSectionedSpine", + IFCROUNDEDRECTANGLEPROFILEDEF: "IfcRoundedRectangleProfileDef", + IFCRELATIONSHIP: "IfcRelationship", + IFCREINFORCEMENTDEFINITIONPROPERTIES: "IfcReinforcementDefinitionProperties", + IFCREGULARTIMESERIES: "IfcRegularTimeSeries", + IFCRECTANGLEPROFILEDEF: "IfcRectangleProfileDef", + IFCPROPERTYTABLEVALUE: "IfcPropertyTableValue", + IFCPROPERTYSINGLEVALUE: "IfcPropertySingleValue", + IFCPROPERTYSETDEFINITION: "IfcPropertySetDefinition", + IFCPROPERTYREFERENCEVALUE: "IfcPropertyReferenceValue", + IFCPROPERTYLISTVALUE: "IfcPropertyListValue", + IFCPROPERTYENUMERATEDVALUE: "IfcPropertyEnumeratedValue", + IFCPROPERTYDEFINITION: "IfcPropertyDefinition", + IFCPROPERTYBOUNDEDVALUE: "IfcPropertyBoundedValue", + IFCPRODUCTDEFINITIONSHAPE: "IfcProductDefinitionShape", + IFCPREDEFINEDPOINTMARKERSYMBOL: "IfcPredefinedPointMarkerSymbol", + IFCPREDEFINEDDIMENSIONSYMBOL: "IfcPredefinedDimensionSymbol", + IFCPREDEFINEDCURVEFONT: "IfcPredefinedCurveFont", + IFCPREDEFINEDCOLOUR: "IfcPredefinedColour", + IFCPOLYGONALBOUNDEDHALFSPACE: "IfcPolygonalBoundedHalfSpace", + IFCPOLYLOOP: "IfcPolyLoop", + IFCPOINTONSURFACE: "IfcPointOnSurface", + IFCPOINTONCURVE: "IfcPointOnCurve", + IFCPOINT: "IfcPoint", + IFCPLANAREXTENT: "IfcPlanarExtent", + IFCPLACEMENT: "IfcPlacement", + IFCPIXELTEXTURE: "IfcPixelTexture", + IFCPHYSICALCOMPLEXQUANTITY: "IfcPhysicalComplexQuantity", + IFCPATH: "IfcPath", + IFCPARAMETERIZEDPROFILEDEF: "IfcParameterizedProfileDef", + IFCORIENTEDEDGE: "IfcOrientedEdge", + IFCOPENSHELL: "IfcOpenShell", + IFCONEDIRECTIONREPEATFACTOR: "IfcOneDirectionRepeatFactor", + IFCOBJECTDEFINITION: "IfcObjectDefinition", + IFCMECHANICALCONCRETEMATERIALPROPERTIES: + "IfcMechanicalConcreteMaterialProperties", + IFCMATERIALDEFINITIONREPRESENTATION: "IfcMaterialDefinitionRepresentation", + IFCMAPPEDITEM: "IfcMappedItem", + IFCLOOP: "IfcLoop", + IFCLOCALPLACEMENT: "IfcLocalPlacement", + IFCLIGHTSOURCESPOT: "IfcLightSourceSpot", + IFCLIGHTSOURCEPOSITIONAL: "IfcLightSourcePositional", + IFCLIGHTSOURCEGONIOMETRIC: "IfcLightSourceGoniometric", + IFCLIGHTSOURCEDIRECTIONAL: "IfcLightSourceDirectional", + IFCLIGHTSOURCEAMBIENT: "IfcLightSourceAmbient", + IFCLIGHTSOURCE: "IfcLightSource", + IFCIRREGULARTIMESERIES: "IfcIrregularTimeSeries", + IFCIMAGETEXTURE: "IfcImageTexture", + IFCHYGROSCOPICMATERIALPROPERTIES: "IfcHygroscopicMaterialProperties", + IFCHALFSPACESOLID: "IfcHalfSpaceSolid", + IFCGRIDPLACEMENT: "IfcGridPlacement", + IFCGEOMETRICSET: "IfcGeometricSet", + IFCGEOMETRICREPRESENTATIONSUBCONTEXT: "IfcGeometricRepresentationSubContext", + IFCGEOMETRICREPRESENTATIONITEM: "IfcGeometricRepresentationItem", + IFCGEOMETRICREPRESENTATIONCONTEXT: "IfcGeometricRepresentationContext", + IFCGENERALPROFILEPROPERTIES: "IfcGeneralProfileProperties", + IFCGENERALMATERIALPROPERTIES: "IfcGeneralMaterialProperties", + IFCFUELPROPERTIES: "IfcFuelProperties", + IFCFILLAREASTYLE: "IfcFillAreaStyle", + IFCFAILURECONNECTIONCONDITION: "IfcFailureConnectionCondition", + IFCFACESURFACE: "IfcFaceSurface", + IFCFACEOUTERBOUND: "IfcFaceOuterBound", + IFCFACEBOUND: "IfcFaceBound", + IFCFACE: "IfcFace", + IFCEXTENDEDMATERIALPROPERTIES: "IfcExtendedMaterialProperties", + IFCEDGECURVE: "IfcEdgeCurve", + IFCEDGE: "IfcEdge", + IFCDRAUGHTINGPREDEFINEDTEXTFONT: "IfcDraughtingPredefinedTextFont", + IFCDOCUMENTREFERENCE: "IfcDocumentReference", + IFCDIMENSIONPAIR: "IfcDimensionPair", + IFCDIMENSIONCALLOUTRELATIONSHIP: "IfcDimensionCalloutRelationship", + IFCDERIVEDPROFILEDEF: "IfcDerivedProfileDef", + IFCCURVESTYLE: "IfcCurveStyle", + IFCCONVERSIONBASEDUNIT: "IfcConversionBasedUnit", + IFCCONTEXTDEPENDENTUNIT: "IfcContextDependentUnit", + IFCCONNECTIONPOINTECCENTRICITY: "IfcConnectionPointEccentricity", + IFCCONNECTIONCURVEGEOMETRY: "IfcConnectionCurveGeometry", + IFCCONNECTEDFACESET: "IfcConnectedFaceSet", + IFCCOMPOSITEPROFILEDEF: "IfcCompositeProfileDef", + IFCCOMPLEXPROPERTY: "IfcComplexProperty", + IFCCOLOURRGB: "IfcColourRgb", + IFCCLASSIFICATIONREFERENCE: "IfcClassificationReference", + IFCCENTERLINEPROFILEDEF: "IfcCenterLineProfileDef", + IFCBLOBTEXTURE: "IfcBlobTexture", + IFCARBITRARYPROFILEDEFWITHVOIDS: "IfcArbitraryProfileDefWithVoids", + IFCARBITRARYOPENPROFILEDEF: "IfcArbitraryOpenProfileDef", + IFCARBITRARYCLOSEDPROFILEDEF: "IfcArbitraryClosedProfileDef", + IFCANNOTATIONTEXTOCCURRENCE: "IfcAnnotationTextOccurrence", + IFCANNOTATIONSYMBOLOCCURRENCE: "IfcAnnotationSymbolOccurrence", + IFCANNOTATIONSURFACEOCCURRENCE: "IfcAnnotationSurfaceOccurrence", + IFCANNOTATIONOCCURRENCE: "IfcAnnotationOccurrence", + IFCWATERPROPERTIES: "IfcWaterProperties", + IFCVIRTUALGRIDINTERSECTION: "IfcVirtualGridIntersection", + IFCVERTEXPOINT: "IfcVertexPoint", + IFCVERTEXBASEDTEXTUREMAP: "IfcVertexBasedTextureMap", + IFCVERTEX: "IfcVertex", + IFCUNITASSIGNMENT: "IfcUnitAssignment", + IFCTOPOLOGYREPRESENTATION: "IfcTopologyRepresentation", + IFCTOPOLOGICALREPRESENTATIONITEM: "IfcTopologicalRepresentationItem", + IFCTIMESERIESVALUE: "IfcTimeSeriesValue", + IFCTIMESERIESREFERENCERELATIONSHIP: "IfcTimeSeriesReferenceRelationship", + IFCTIMESERIES: "IfcTimeSeries", + IFCTHERMALMATERIALPROPERTIES: "IfcThermalMaterialProperties", + IFCTEXTUREVERTEX: "IfcTextureVertex", + IFCTEXTUREMAP: "IfcTextureMap", + IFCTEXTURECOORDINATEGENERATOR: "IfcTextureCoordinateGenerator", + IFCTEXTURECOORDINATE: "IfcTextureCoordinate", + IFCTEXTSTYLEWITHBOXCHARACTERISTICS: "IfcTextStyleWithBoxCharacteristics", + IFCTEXTSTYLETEXTMODEL: "IfcTextStyleTextModel", + IFCTEXTSTYLEFORDEFINEDFONT: "IfcTextStyleForDefinedFont", + IFCTEXTSTYLEFONTMODEL: "IfcTextStyleFontModel", + IFCTEXTSTYLE: "IfcTextStyle", + IFCTELECOMADDRESS: "IfcTelecomAddress", + IFCTABLEROW: "IfcTableRow", + IFCTABLE: "IfcTable", + IFCSYMBOLSTYLE: "IfcSymbolStyle", + IFCSURFACETEXTURE: "IfcSurfaceTexture", + IFCSURFACESTYLEWITHTEXTURES: "IfcSurfaceStyleWithTextures", + IFCSURFACESTYLESHADING: "IfcSurfaceStyleShading", + IFCSURFACESTYLEREFRACTION: "IfcSurfaceStyleRefraction", + IFCSURFACESTYLELIGHTING: "IfcSurfaceStyleLighting", + IFCSURFACESTYLE: "IfcSurfaceStyle", + IFCSTYLEDREPRESENTATION: "IfcStyledRepresentation", + IFCSTYLEDITEM: "IfcStyledItem", + IFCSTYLEMODEL: "IfcStyleModel", + IFCSTRUCTURALLOADTEMPERATURE: "IfcStructuralLoadTemperature", + IFCSTRUCTURALLOADSTATIC: "IfcStructuralLoadStatic", + IFCSTRUCTURALLOAD: "IfcStructuralLoad", + IFCSTRUCTURALCONNECTIONCONDITION: "IfcStructuralConnectionCondition", + IFCSIMPLEPROPERTY: "IfcSimpleProperty", + IFCSHAPEREPRESENTATION: "IfcShapeRepresentation", + IFCSHAPEMODEL: "IfcShapeModel", + IFCSHAPEASPECT: "IfcShapeAspect", + IFCSECTIONREINFORCEMENTPROPERTIES: "IfcSectionReinforcementProperties", + IFCSECTIONPROPERTIES: "IfcSectionProperties", + IFCSIUNIT: "IfcSIUnit", + IFCROOT: "IfcRoot", + IFCRIBPLATEPROFILEPROPERTIES: "IfcRibPlateProfileProperties", + IFCREPRESENTATIONMAP: "IfcRepresentationMap", + IFCREPRESENTATIONITEM: "IfcRepresentationItem", + IFCREPRESENTATIONCONTEXT: "IfcRepresentationContext", + IFCREPRESENTATION: "IfcRepresentation", + IFCRELAXATION: "IfcRelaxation", + IFCREINFORCEMENTBARPROPERTIES: "IfcReinforcementBarProperties", + IFCREFERENCESVALUEDOCUMENT: "IfcReferencesValueDocument", + IFCQUANTITYWEIGHT: "IfcQuantityWeight", + IFCQUANTITYVOLUME: "IfcQuantityVolume", + IFCQUANTITYTIME: "IfcQuantityTime", + IFCQUANTITYLENGTH: "IfcQuantityLength", + IFCQUANTITYCOUNT: "IfcQuantityCount", + IFCQUANTITYAREA: "IfcQuantityArea", + IFCPROPERTYENUMERATION: "IfcPropertyEnumeration", + IFCPROPERTYDEPENDENCYRELATIONSHIP: "IfcPropertyDependencyRelationship", + IFCPROPERTYCONSTRAINTRELATIONSHIP: "IfcPropertyConstraintRelationship", + IFCPROPERTY: "IfcProperty", + IFCPROFILEPROPERTIES: "IfcProfileProperties", + IFCPROFILEDEF: "IfcProfileDef", + IFCPRODUCTSOFCOMBUSTIONPROPERTIES: "IfcProductsOfCombustionProperties", + IFCPRODUCTREPRESENTATION: "IfcProductRepresentation", + IFCPRESENTATIONSTYLEASSIGNMENT: "IfcPresentationStyleAssignment", + IFCPRESENTATIONSTYLE: "IfcPresentationStyle", + IFCPRESENTATIONLAYERWITHSTYLE: "IfcPresentationLayerWithStyle", + IFCPRESENTATIONLAYERASSIGNMENT: "IfcPresentationLayerAssignment", + IFCPREDEFINEDTEXTFONT: "IfcPredefinedTextFont", + IFCPREDEFINEDTERMINATORSYMBOL: "IfcPredefinedTerminatorSymbol", + IFCPREDEFINEDSYMBOL: "IfcPredefinedSymbol", + IFCPREDEFINEDITEM: "IfcPredefinedItem", + IFCPOSTALADDRESS: "IfcPostalAddress", + IFCPHYSICALSIMPLEQUANTITY: "IfcPhysicalSimpleQuantity", + IFCPHYSICALQUANTITY: "IfcPhysicalQuantity", + IFCPERSONANDORGANIZATION: "IfcPersonAndOrganization", + IFCPERSON: "IfcPerson", + IFCOWNERHISTORY: "IfcOwnerHistory", + IFCORGANIZATIONRELATIONSHIP: "IfcOrganizationRelationship", + IFCORGANIZATION: "IfcOrganization", + IFCOPTICALMATERIALPROPERTIES: "IfcOpticalMaterialProperties", + IFCOBJECTIVE: "IfcObjective", + IFCOBJECTPLACEMENT: "IfcObjectPlacement", + IFCNAMEDUNIT: "IfcNamedUnit", + IFCMONETARYUNIT: "IfcMonetaryUnit", + IFCMETRIC: "IfcMetric", + IFCMECHANICALSTEELMATERIALPROPERTIES: "IfcMechanicalSteelMaterialProperties", + IFCMECHANICALMATERIALPROPERTIES: "IfcMechanicalMaterialProperties", + IFCMEASUREWITHUNIT: "IfcMeasureWithUnit", + IFCMATERIALPROPERTIES: "IfcMaterialProperties", + IFCMATERIALLIST: "IfcMaterialList", + IFCMATERIALLAYERSETUSAGE: "IfcMaterialLayerSetUsage", + IFCMATERIALLAYERSET: "IfcMaterialLayerSet", + IFCMATERIALLAYER: "IfcMaterialLayer", + IFCMATERIALCLASSIFICATIONRELATIONSHIP: + "IfcMaterialClassificationRelationship", + IFCMATERIAL: "IfcMaterial", + IFCLOCALTIME: "IfcLocalTime", + IFCLIGHTINTENSITYDISTRIBUTION: "IfcLightIntensityDistribution", + IFCLIGHTDISTRIBUTIONDATA: "IfcLightDistributionData", + IFCLIBRARYREFERENCE: "IfcLibraryReference", + IFCLIBRARYINFORMATION: "IfcLibraryInformation", + IFCIRREGULARTIMESERIESVALUE: "IfcIrregularTimeSeriesValue", + IFCGRIDAXIS: "IfcGridAxis", + IFCEXTERNALLYDEFINEDTEXTFONT: "IfcExternallyDefinedTextFont", + IFCEXTERNALLYDEFINEDSYMBOL: "IfcExternallyDefinedSymbol", + IFCEXTERNALLYDEFINEDSURFACESTYLE: "IfcExternallyDefinedSurfaceStyle", + IFCEXTERNALLYDEFINEDHATCHSTYLE: "IfcExternallyDefinedHatchStyle", + IFCEXTERNALREFERENCE: "IfcExternalReference", + IFCENVIRONMENTALIMPACTVALUE: "IfcEnvironmentalImpactValue", + IFCDRAUGHTINGCALLOUTRELATIONSHIP: "IfcDraughtingCalloutRelationship", + IFCDOCUMENTINFORMATIONRELATIONSHIP: "IfcDocumentInformationRelationship", + IFCDOCUMENTINFORMATION: "IfcDocumentInformation", + IFCDOCUMENTELECTRONICFORMAT: "IfcDocumentElectronicFormat", + IFCDIMENSIONALEXPONENTS: "IfcDimensionalExponents", + IFCDERIVEDUNITELEMENT: "IfcDerivedUnitElement", + IFCDERIVEDUNIT: "IfcDerivedUnit", + IFCDATEANDTIME: "IfcDateAndTime", + IFCCURVESTYLEFONTPATTERN: "IfcCurveStyleFontPattern", + IFCCURVESTYLEFONTANDSCALING: "IfcCurveStyleFontAndScaling", + IFCCURVESTYLEFONT: "IfcCurveStyleFont", + IFCCURRENCYRELATIONSHIP: "IfcCurrencyRelationship", + IFCCOSTVALUE: "IfcCostValue", + IFCCOORDINATEDUNIVERSALTIMEOFFSET: "IfcCoordinatedUniversalTimeOffset", + IFCCONSTRAINTRELATIONSHIP: "IfcConstraintRelationship", + IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP: + "IfcConstraintClassificationRelationship", + IFCCONSTRAINTAGGREGATIONRELATIONSHIP: "IfcConstraintAggregationRelationship", + IFCCONSTRAINT: "IfcConstraint", + IFCCONNECTIONSURFACEGEOMETRY: "IfcConnectionSurfaceGeometry", + IFCCONNECTIONPORTGEOMETRY: "IfcConnectionPortGeometry", + IFCCONNECTIONPOINTGEOMETRY: "IfcConnectionPointGeometry", + IFCCONNECTIONGEOMETRY: "IfcConnectionGeometry", + IFCCOLOURSPECIFICATION: "IfcColourSpecification", + IFCCLASSIFICATIONNOTATIONFACET: "IfcClassificationNotationFacet", + IFCCLASSIFICATIONNOTATION: "IfcClassificationNotation", + IFCCLASSIFICATIONITEMRELATIONSHIP: "IfcClassificationItemRelationship", + IFCCLASSIFICATIONITEM: "IfcClassificationItem", + IFCCLASSIFICATION: "IfcClassification", + IFCCALENDARDATE: "IfcCalendarDate", + IFCBOUNDARYNODECONDITIONWARPING: "IfcBoundaryNodeConditionWarping", + IFCBOUNDARYNODECONDITION: "IfcBoundaryNodeCondition", + IFCBOUNDARYFACECONDITION: "IfcBoundaryFaceCondition", + IFCBOUNDARYEDGECONDITION: "IfcBoundaryEdgeCondition", + IFCBOUNDARYCONDITION: "IfcBoundaryCondition", + IFCAPPROVALRELATIONSHIP: "IfcApprovalRelationship", + IFCAPPROVALPROPERTYRELATIONSHIP: "IfcApprovalPropertyRelationship", + IFCAPPROVALACTORRELATIONSHIP: "IfcApprovalActorRelationship", + IFCAPPROVAL: "IfcApproval", + IFCAPPLIEDVALUERELATIONSHIP: "IfcAppliedValueRelationship", + IFCAPPLIEDVALUE: "IfcAppliedValue", + IFCAPPLICATION: "IfcApplication", + IFCADDRESS: "IfcAddress", + IFCACTORROLE: "IfcActorRole", +}; diff --git a/packages/core/src/ifc/Utils/index.ts b/packages/core/src/ifc/Utils/index.ts index f4fa1cb17..6e15fe061 100644 --- a/packages/core/src/ifc/Utils/index.ts +++ b/packages/core/src/ifc/Utils/index.ts @@ -2,3 +2,4 @@ export * from "./ifc-categories"; export * from "./ifc-elements-map"; export * from "./ifc-category-map"; export * from "./properties-utils"; +export * from "./ifc-category-case"; diff --git a/packages/core/src/ifc/index.ts b/packages/core/src/ifc/index.ts index 38cc45ff0..7199ff08c 100644 --- a/packages/core/src/ifc/index.ts +++ b/packages/core/src/ifc/index.ts @@ -2,3 +2,4 @@ export * from "./IfcJsonExporter"; export * from "./IfcRelationsIndexer"; export * from "./IfcPropertiesManager"; export * from "./Utils"; +export * from "./IfcFinder"; From 1b1de6065419c811ab92a93b2ac033149b1e1c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Sat, 14 Sep 2024 13:58:33 +0200 Subject: [PATCH 36/51] wip: first working version of query groups --- .../core/src/fragments/IfcLoader/example.ts | 84 ++++-- packages/core/src/ifc/IfcFinder/index.ts | 239 ++++++++++++------ 2 files changed, 221 insertions(+), 102 deletions(-) diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index be777b299..c8792bad2 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -214,33 +214,75 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); +const queries: OBC.IfcFinderQueries = [ + { + name: "walls", + result: [], + needsUpdate: true, + rules: [ + { + type: "category", + value: /IfcWallStandardCase/, + exclusive: false, + }, + ], + }, +]; + +// Aripa + +let file: File | null = null; + window.addEventListener("keydown", async (e) => { - if (e.code !== "KeyP") { - return; - } + if (e.code === "KeyP") { + if (!file) { + const [fileHandle] = await window.showOpenFilePicker(); + // console.log(fileHandle); + file = await fileHandle.getFile(); + } - const [fileHandle] = await window.showOpenFilePicker(); - // console.log(fileHandle); - const file = await fileHandle.getFile(); + const start = performance.now(); - const start = performance.now(); + const finder = components.get(OBC.IfcFinder); - const finder = components.get(OBC.IfcFinder); - const result = await finder.find(file, [ - { - type: "category", - value: /IfcWallStandardCase/, - }, - // { - // type: "property", - // name: /.*/, - // value: /Aripa/, - // }, - ]); + const result = await finder.find(file, queries); - console.log(result); + console.log(result); + console.log(queries); + console.log(`Time: ${performance.now() - start}`); + } - console.log(`Time: ${performance.now() - start}`); + if (e.code === "KeyO") { + queries.push({ + name: "aripa", + needsUpdate: true, + result: [], + rules: [ + { + type: "property", + exclusive: false, + name: /.*/, + value: /Aripa/, + }, + ], + }); + + if (!file) { + const [fileHandle] = await window.showOpenFilePicker(); + // console.log(fileHandle); + file = await fileHandle.getFile(); + } + + const start = performance.now(); + + const finder = components.get(OBC.IfcFinder); + + const result = await finder.find(file, queries); + + console.log(result); + console.log(queries); + console.log(`Time: ${performance.now() - start}`); + } }); /* MD diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 5a1f4805b..1a9e2d85c 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -4,16 +4,25 @@ import { ifcCategoryCase } from "../Utils"; export interface IfcCategoryRule { type: "category"; + exclusive: boolean; value: RegExp; } export interface IfcPropertyRule { type: "property"; + exclusive: boolean; name: RegExp; value: RegExp; } -export type IfcFinderRules = IfcCategoryRule | IfcPropertyRule; +export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule; + +export type IfcFinderQueries = { + name: string; + rules: IfcFinderRule[]; + result: string[]; + needsUpdate: boolean; +}[]; /** * Component to make text queries in the IFC. @@ -34,11 +43,44 @@ export class IfcFinder extends Component { super(components); } - find(file: File, rules: IfcFinderRules[]) { - return new Promise>((resolve) => { + async find(file: File, queries: IfcFinderQueries) { + let found = new Set(); + + // Handle the rest of query parts + for (let i = 0; i < queries.length; i++) { + found = new Set(); + const { rules, result, needsUpdate } = queries[i]; + + if (!needsUpdate) { + // This query is up to date, so let's use its data directly + this.findInLines(result, rules, found); + continue; + } + + queries[i].result = []; + + if (!queries[i - 1]) { + // There's no previous result, so let's read the file + queries[i].result = await this.findInFile(file, rules, found); + queries[i].needsUpdate = false; + continue; + } + + // There's previous data, so let's use it + this.findInLines(queries[i - 1].result, rules, found, queries[i].result); + queries[i].needsUpdate = false; + } + + return found; + } + + findInFile(file: File, rules: IfcFinderRule[], found: Set) { + return new Promise((resolve) => { const reader = new FileReader(); const decoder = new TextDecoder("utf-8"); + const resultLines: string[] = []; + // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ const chunkSize = 10000 * 1024; // 10mb const offset = 1000; // To avoid IFC lines that are split @@ -46,11 +88,9 @@ export class IfcFinder extends Component { const endLineToken = /;/; - const resultItems = new Set(); - const readTextPart = () => { if (start >= file.size) { - resolve(resultItems); + resolve(resultLines); return; } const end = Math.min(start + chunkSize + offset, file.size); @@ -72,103 +112,140 @@ export class IfcFinder extends Component { // Remove first line, which is cut lines.shift(); - // Test all filters against each line - for (const line of lines) { - let category: string | null = null; - let attrValues: string[] | null = null; - let attrNames: string[] | null = null; - - let filtersPass = true; - - for (const rule of rules) { - if (rule.type === "category") { - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - filtersPass = false; - break; - } - } + this.findInLines(lines, rules, found, resultLines); - if (!rule.value.test(category)) { - filtersPass = false; + console.log(start / file.size); + + start += chunkSize; + readTextPart(); + }; + + readTextPart(); + }); + } + + private findInLines( + lines: string[], + rules: IfcFinderRule[], + found: Set, + resultLines?: string[], + ) { + for (const line of lines) { + let category: string | null = null; + let attrValues: string[] | null = null; + let attrNames: string[] | null = null; + + let filtersPass = false; + + for (const rule of rules) { + if (rule.type === "category") { + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + if (rule.exclusive) { break; + } else { + continue; } - continue; } + } - if (rule.type === "property") { - const { name, value } = rule; + if (!rule.value.test(category)) { + if (rule.exclusive) { + filtersPass = false; + break; + } else { + continue; + } + } - // Quick test to see if this line contains what we are looking for - if (!value.test(line)) { - filtersPass = false; - break; - } + filtersPass = true; + continue; + } - if (attrValues === null) { - attrValues = this.getAttributesFromLine(line); - if (attrValues === null) { - filtersPass = false; - break; - } - } + if (rule.type === "property") { + const { name, value } = rule; - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - filtersPass = false; - break; - } - } + // Quick test to see if this line contains what we are looking for + if (!value.test(line)) { + if (rule.exclusive) { + filtersPass = false; + break; + } else { + continue; + } + } - if (attrNames === null) { - // @ts-ignore - attrNames = Object.keys(new WEBIFC.IFC4[category]()); - if (attrNames === null) { - filtersPass = false; - break; - } + if (attrValues === null) { + attrValues = this.getAttributesFromLine(line); + if (attrValues === null) { + if (rule.exclusive) { + filtersPass = false; + break; + } else { + continue; } + } + } - // Slow test to detect if - - let someNameValueMatch = false; - for (let i = 0; i < attrValues.length; i++) { - const attrValue = attrValues[i]; - const attrName = attrNames[i]; - // Check that both name and value match - if (value.test(attrValue) && name.test(attrName)) { - someNameValueMatch = true; - break; - } + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + if (rule.exclusive) { + filtersPass = false; + break; + } else { + continue; } + } + } - if (!someNameValueMatch) { + if (attrNames === null) { + // @ts-ignore + attrNames = Object.keys(new WEBIFC.IFC4[category]()); + if (attrNames === null) { + if (rule.exclusive) { filtersPass = false; break; + } else { + continue; } } } - if (filtersPass) { - const idString = line.slice( - line.indexOf("#") + 1, - line.indexOf("="), - ); - const id = parseInt(idString, 10); - resultItems.add(id); - } - } + // Slow test to detect if - console.log(start / file.size); + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrValue = attrValues[i]; + const attrName = attrNames[i]; + // Check that both name and value match + if (value.test(attrValue) && name.test(attrName)) { + someNameValueMatch = true; + break; + } + } - start += chunkSize; - readTextPart(); - }; + if (!someNameValueMatch) { + if (rule.exclusive) { + filtersPass = false; + break; + } + } else { + filtersPass = true; + } + } + } - readTextPart(); - }); + if (filtersPass) { + const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); + const id = parseInt(idString, 10); + if (resultLines) { + resultLines.push(line); + } + found.add(id); + } + } } private getCategoryFromLine(line: string) { From 2b9b33852ae951d690f8b8b9830e3ec95547d5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 17 Sep 2024 12:08:58 +0200 Subject: [PATCH 37/51] wip: define "inclusive" as query group attribute --- .../core/src/fragments/IfcLoader/example.ts | 10 ++-- packages/core/src/ifc/IfcFinder/index.ts | 52 ++++++++++--------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index c8792bad2..c76cb61cf 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -214,16 +214,16 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); -const queries: OBC.IfcFinderQueries = [ +const queries: OBC.IfcFinderQuery[] = [ { name: "walls", result: [], needsUpdate: true, + inclusive: false, rules: [ { type: "category", value: /IfcWallStandardCase/, - exclusive: false, }, ], }, @@ -254,15 +254,15 @@ window.addEventListener("keydown", async (e) => { if (e.code === "KeyO") { queries.push({ - name: "aripa", + name: "guid", needsUpdate: true, + inclusive: false, result: [], rules: [ { type: "property", - exclusive: false, name: /.*/, - value: /Aripa/, + value: /2idC0G3ezCdhA9WVjWemc\$/, }, ], }); diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 1a9e2d85c..61eb5ffe4 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -4,25 +4,24 @@ import { ifcCategoryCase } from "../Utils"; export interface IfcCategoryRule { type: "category"; - exclusive: boolean; value: RegExp; } export interface IfcPropertyRule { type: "property"; - exclusive: boolean; name: RegExp; value: RegExp; } export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule; -export type IfcFinderQueries = { +export type IfcFinderQuery = { name: string; + inclusive: boolean; rules: IfcFinderRule[]; result: string[]; needsUpdate: boolean; -}[]; +}; /** * Component to make text queries in the IFC. @@ -43,38 +42,39 @@ export class IfcFinder extends Component { super(components); } - async find(file: File, queries: IfcFinderQueries) { + async find(file: File, queries: IfcFinderQuery[]) { let found = new Set(); // Handle the rest of query parts for (let i = 0; i < queries.length; i++) { found = new Set(); - const { rules, result, needsUpdate } = queries[i]; + const query = queries[i]; + const previousQuery = queries[i - 1]; - if (!needsUpdate) { + if (!query.needsUpdate) { // This query is up to date, so let's use its data directly - this.findInLines(result, rules, found); + this.findInLines(query.result, query, found); continue; } - queries[i].result = []; + query.result = []; - if (!queries[i - 1]) { + if (!previousQuery) { // There's no previous result, so let's read the file - queries[i].result = await this.findInFile(file, rules, found); - queries[i].needsUpdate = false; + query.result = await this.findInFile(file, query, found); + query.needsUpdate = false; continue; } // There's previous data, so let's use it - this.findInLines(queries[i - 1].result, rules, found, queries[i].result); - queries[i].needsUpdate = false; + this.findInLines(previousQuery.result, query, found, query.result); + query.needsUpdate = false; } return found; } - findInFile(file: File, rules: IfcFinderRule[], found: Set) { + findInFile(file: File, query: IfcFinderQuery, found: Set) { return new Promise((resolve) => { const reader = new FileReader(); const decoder = new TextDecoder("utf-8"); @@ -112,7 +112,7 @@ export class IfcFinder extends Component { // Remove first line, which is cut lines.shift(); - this.findInLines(lines, rules, found, resultLines); + this.findInLines(lines, query, found, resultLines); console.log(start / file.size); @@ -126,10 +126,11 @@ export class IfcFinder extends Component { private findInLines( lines: string[], - rules: IfcFinderRule[], + query: IfcFinderQuery, found: Set, resultLines?: string[], ) { + const { rules } = query; for (const line of lines) { let category: string | null = null; let attrValues: string[] | null = null; @@ -142,7 +143,7 @@ export class IfcFinder extends Component { if (category === null) { category = this.getCategoryFromLine(line); if (category === null) { - if (rule.exclusive) { + if (!query.inclusive) { break; } else { continue; @@ -151,7 +152,7 @@ export class IfcFinder extends Component { } if (!rule.value.test(category)) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } else { @@ -168,7 +169,7 @@ export class IfcFinder extends Component { // Quick test to see if this line contains what we are looking for if (!value.test(line)) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } else { @@ -179,7 +180,7 @@ export class IfcFinder extends Component { if (attrValues === null) { attrValues = this.getAttributesFromLine(line); if (attrValues === null) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } else { @@ -191,7 +192,7 @@ export class IfcFinder extends Component { if (category === null) { category = this.getCategoryFromLine(line); if (category === null) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } else { @@ -203,8 +204,11 @@ export class IfcFinder extends Component { if (attrNames === null) { // @ts-ignore attrNames = Object.keys(new WEBIFC.IFC4[category]()); + // Remove attributes expressID and type, given by web-ifc + attrNames = attrNames.slice(2); + if (attrNames === null) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } else { @@ -227,7 +231,7 @@ export class IfcFinder extends Component { } if (!someNameValueMatch) { - if (rule.exclusive) { + if (!query.inclusive) { filtersPass = false; break; } From ba635988e72cb16a4c20b23c44e43bd55d1d21dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Tue, 17 Sep 2024 19:36:00 +0200 Subject: [PATCH 38/51] wip: make queries a class for more modularity --- .../core/src/fragments/IfcLoader/example.ts | 39 ++- packages/core/src/ifc/IfcFinder/index.ts | 255 +----------------- .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 227 ++++++++++++++++ packages/core/src/ifc/IfcFinder/src/index.ts | 2 + packages/core/src/ifc/IfcFinder/src/types.ts | 12 + 5 files changed, 269 insertions(+), 266 deletions(-) create mode 100644 packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts create mode 100644 packages/core/src/ifc/IfcFinder/src/index.ts create mode 100644 packages/core/src/ifc/IfcFinder/src/types.ts diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index c76cb61cf..c9e20d753 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -215,22 +215,19 @@ world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); const queries: OBC.IfcFinderQuery[] = [ - { + new OBC.IfcFinderQuery({ name: "walls", - result: [], - needsUpdate: true, inclusive: false, rules: [ { - type: "category", - value: /IfcWallStandardCase/, + type: "property", + name: /.*/, + value: /FireResistanceRating/, }, ], - }, + }), ]; -// Aripa - let file: File | null = null; window.addEventListener("keydown", async (e) => { @@ -253,19 +250,19 @@ window.addEventListener("keydown", async (e) => { } if (e.code === "KeyO") { - queries.push({ - name: "guid", - needsUpdate: true, - inclusive: false, - result: [], - rules: [ - { - type: "property", - name: /.*/, - value: /2idC0G3ezCdhA9WVjWemc\$/, - }, - ], - }); + // queries.push({ + // name: "guid", + // needsUpdate: true, + // inclusive: false, + // lines: [], + // rules: [ + // { + // type: "property", + // name: /.*/, + // value: /2idC0G3ezCdhA9WVjWemc\$/, + // }, + // ], + // }); if (!file) { const [fileHandle] = await window.showOpenFilePicker(); diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 61eb5ffe4..785f5047e 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -1,27 +1,7 @@ -import * as WEBIFC from "web-ifc"; import { Component, Components, Event } from "../../core"; -import { ifcCategoryCase } from "../Utils"; +import { IfcFinderQuery } from "./src"; -export interface IfcCategoryRule { - type: "category"; - value: RegExp; -} - -export interface IfcPropertyRule { - type: "property"; - name: RegExp; - value: RegExp; -} - -export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule; - -export type IfcFinderQuery = { - name: string; - inclusive: boolean; - rules: IfcFinderRule[]; - result: string[]; - needsUpdate: boolean; -}; +export * from "./src"; /** * Component to make text queries in the IFC. @@ -43,239 +23,24 @@ export class IfcFinder extends Component { } async find(file: File, queries: IfcFinderQuery[]) { - let found = new Set(); + let wasPreviousQueryUpdated = false; // Handle the rest of query parts for (let i = 0; i < queries.length; i++) { - found = new Set(); const query = queries[i]; const previousQuery = queries[i - 1]; - if (!query.needsUpdate) { - // This query is up to date, so let's use its data directly - this.findInLines(query.result, query, found); - continue; - } - - query.result = []; - - if (!previousQuery) { - // There's no previous result, so let's read the file - query.result = await this.findInFile(file, query, found); - query.needsUpdate = false; + if (!query.needsUpdate && !wasPreviousQueryUpdated) { + // This query is up to date and previous queries were not updated, so let's skip it continue; } - // There's previous data, so let's use it - this.findInLines(previousQuery.result, query, found, query.result); - query.needsUpdate = false; - } - - return found; - } - - findInFile(file: File, query: IfcFinderQuery, found: Set) { - return new Promise((resolve) => { - const reader = new FileReader(); - const decoder = new TextDecoder("utf-8"); - - const resultLines: string[] = []; - - // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ - const chunkSize = 10000 * 1024; // 10mb - const offset = 1000; // To avoid IFC lines that are split - let start = 0; - - const endLineToken = /;/; - - const readTextPart = () => { - if (start >= file.size) { - resolve(resultLines); - return; - } - const end = Math.min(start + chunkSize + offset, file.size); - const slice = file.slice(start, end); - reader.readAsArrayBuffer(slice); - }; - - reader.onload = () => { - if (!(reader.result instanceof ArrayBuffer)) { - return; - } - - const buffer = new Uint8Array(reader.result); - - const snippet = decoder.decode(buffer); - - // Get individual IFC lines - const lines = snippet.split(endLineToken); - // Remove first line, which is cut - lines.shift(); - - this.findInLines(lines, query, found, resultLines); - - console.log(start / file.size); - - start += chunkSize; - readTextPart(); - }; - - readTextPart(); - }); - } - - private findInLines( - lines: string[], - query: IfcFinderQuery, - found: Set, - resultLines?: string[], - ) { - const { rules } = query; - for (const line of lines) { - let category: string | null = null; - let attrValues: string[] | null = null; - let attrNames: string[] | null = null; - - let filtersPass = false; - - for (const rule of rules) { - if (rule.type === "category") { - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - if (!query.inclusive) { - break; - } else { - continue; - } - } - } - - if (!rule.value.test(category)) { - if (!query.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - - filtersPass = true; - continue; - } - - if (rule.type === "property") { - const { name, value } = rule; - - // Quick test to see if this line contains what we are looking for - if (!value.test(line)) { - if (!query.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - - if (attrValues === null) { - attrValues = this.getAttributesFromLine(line); - if (attrValues === null) { - if (!query.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - } - - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - if (!query.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - } - - if (attrNames === null) { - // @ts-ignore - attrNames = Object.keys(new WEBIFC.IFC4[category]()); - // Remove attributes expressID and type, given by web-ifc - attrNames = attrNames.slice(2); - - if (attrNames === null) { - if (!query.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - } - - // Slow test to detect if - - let someNameValueMatch = false; - for (let i = 0; i < attrValues.length; i++) { - const attrValue = attrValues[i]; - const attrName = attrNames[i]; - // Check that both name and value match - if (value.test(attrValue) && name.test(attrName)) { - someNameValueMatch = true; - break; - } - } - - if (!someNameValueMatch) { - if (!query.inclusive) { - filtersPass = false; - break; - } - } else { - filtersPass = true; - } - } - } - - if (filtersPass) { - const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); - const id = parseInt(idString, 10); - if (resultLines) { - resultLines.push(line); - } - found.add(id); - } - } - } - - private getCategoryFromLine(line: string) { - const start = line.indexOf("=") + 1; - const end = line.indexOf("("); - const category = line.slice(start, end).trim(); - const name = ifcCategoryCase[category]; - if (!name) { - return null; + const queryInput = previousQuery?.lines || file; + await query.update(queryInput); + wasPreviousQueryUpdated = true; } - return name; - } - private getAttributesFromLine(line: string) { - const matchRegex = /\((.*)\)/; - const match = line.match(matchRegex); - if (!(match && match[1])) { - return null; - } - const splitRegex = /,(?![^()]*\))/g; - const attrs = match[1].split(splitRegex).map((part) => part.trim()); - const validAttrs = attrs.map((attr) => { - if (attr.startsWith("(") && attr.endsWith(")")) return "$"; - if (attr.startsWith("'") && attr.endsWith("'")) return attr.slice(1, -1); - return attr; - }); - return validAttrs; + const lastQuery = queries[queries.length - 1]; + return new Set(lastQuery.ids); } } diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts new file mode 100644 index 000000000..3b4bf1bdd --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -0,0 +1,227 @@ +import * as WEBIFC from "web-ifc"; +import { IfcFinderRule } from "./types"; +import { ifcCategoryCase } from "../../Utils"; + +export class IfcFinderQuery { + rules: IfcFinderRule[]; + inclusive: boolean; + name: string; + lines: string[] = []; + ids = new Set(); + needsUpdate = true; + + constructor(data: { + name: string; + rules: IfcFinderRule[]; + inclusive: boolean; + }) { + this.name = data.name; + this.rules = data.rules; + this.inclusive = data.inclusive || false; + } + + async update(data: File | string[]) { + if (data instanceof File) { + await this.findInFile(data); + } else { + this.findInLines(data); + } + + this.needsUpdate = false; + } + + private findInFile(file: File) { + return new Promise((resolve) => { + const reader = new FileReader(); + const decoder = new TextDecoder("utf-8"); + + // src: https://joji.me/en-us/blog/processing-huge-files-using-filereader-readasarraybuffer-in-web-browser/ + const chunkSize = 10000 * 1024; // 10mb + const offset = 1000; // To avoid IFC lines that are split + let start = 0; + + const endLineToken = /;/; + + const readTextPart = () => { + if (start >= file.size) { + resolve(); + return; + } + const end = Math.min(start + chunkSize + offset, file.size); + const slice = file.slice(start, end); + reader.readAsArrayBuffer(slice); + }; + + reader.onload = () => { + if (!(reader.result instanceof ArrayBuffer)) { + return; + } + + const buffer = new Uint8Array(reader.result); + + const snippet = decoder.decode(buffer); + + // Get individual IFC lines + const lines = snippet.split(endLineToken); + // Remove first line, which is cut + lines.shift(); + + this.findInLines(lines); + + console.log(start / file.size); + + start += chunkSize; + readTextPart(); + }; + + readTextPart(); + }); + } + + private findInLines(lines: string[]) { + for (const line of lines) { + let category: string | null = null; + let attrValues: string[] | null = null; + let attrNames: string[] | null = null; + + let filtersPass = false; + + for (const rule of this.rules) { + if (rule.type === "category") { + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + if (!this.inclusive) { + break; + } else { + continue; + } + } + } + + if (!rule.value.test(category)) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + + filtersPass = true; + continue; + } + + if (rule.type === "property") { + const { name, value } = rule; + + // Quick test to see if this line contains what we are looking for + if (!value.test(line)) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + + if (attrValues === null) { + attrValues = this.getAttributesFromLine(line); + if (attrValues === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + } + + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + } + + if (attrNames === null) { + // @ts-ignore + attrNames = Object.keys(new WEBIFC.IFC4[category]()); + // Remove attributes expressID and type, given by web-ifc + attrNames = attrNames.slice(2); + + if (attrNames === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + } + + // Slow test to detect if + + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrValue = attrValues[i]; + const attrName = attrNames[i]; + // Check that both name and value match + if (value.test(attrValue) && name.test(attrName)) { + someNameValueMatch = true; + break; + } + } + + if (!someNameValueMatch) { + if (!this.inclusive) { + filtersPass = false; + break; + } + } else { + filtersPass = true; + } + } + } + + if (filtersPass) { + const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); + const id = parseInt(idString, 10); + this.lines.push(line); + this.ids.add(id); + } + } + } + + private getCategoryFromLine(line: string) { + const start = line.indexOf("=") + 1; + const end = line.indexOf("("); + const category = line.slice(start, end).trim(); + const name = ifcCategoryCase[category]; + if (!name) { + return null; + } + return name; + } + + private getAttributesFromLine(line: string) { + const matchRegex = /\((.*)\)/; + const match = line.match(matchRegex); + if (!(match && match[1])) { + return null; + } + const splitRegex = /,(?![^()]*\))/g; + const attrs = match[1].split(splitRegex).map((part) => part.trim()); + const validAttrs = attrs.map((attr) => { + if (attr.startsWith("(") && attr.endsWith(")")) return "$"; + if (attr.startsWith("'") && attr.endsWith("'")) return attr.slice(1, -1); + return attr; + }); + return validAttrs; + } +} diff --git a/packages/core/src/ifc/IfcFinder/src/index.ts b/packages/core/src/ifc/IfcFinder/src/index.ts new file mode 100644 index 000000000..664117a9c --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./ifc-finder-query"; diff --git a/packages/core/src/ifc/IfcFinder/src/types.ts b/packages/core/src/ifc/IfcFinder/src/types.ts new file mode 100644 index 000000000..465287c0c --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/types.ts @@ -0,0 +1,12 @@ +export interface IfcCategoryRule { + type: "category"; + value: RegExp; +} + +export interface IfcPropertyRule { + type: "property"; + name: RegExp; + value: RegExp; +} + +export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule; From 3e2551a4300904c9240fad814f422d4b919d8b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Wed, 18 Sep 2024 13:32:35 +0200 Subject: [PATCH 39/51] wip: make efficient pset query --- .../core/src/fragments/IfcLoader/example.ts | 53 ++--- packages/core/src/ifc/IfcFinder/index.ts | 4 +- .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 39 ++-- packages/core/src/ifc/IfcFinder/src/index.ts | 1 + .../src/property-to-elements-query.ts | 209 ++++++++++++++++++ 5 files changed, 254 insertions(+), 52 deletions(-) create mode 100644 packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index c9e20d753..2dbc85dfb 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -215,14 +215,13 @@ world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); const queries: OBC.IfcFinderQuery[] = [ - new OBC.IfcFinderQuery({ + new OBC.PropertyToElementsQuery({ name: "walls", - inclusive: false, rules: [ { type: "property", name: /.*/, - value: /FireResistanceRating/, + value: /FireRating/, }, ], }), @@ -249,37 +248,23 @@ window.addEventListener("keydown", async (e) => { console.log(`Time: ${performance.now() - start}`); } - if (e.code === "KeyO") { - // queries.push({ - // name: "guid", - // needsUpdate: true, - // inclusive: false, - // lines: [], - // rules: [ - // { - // type: "property", - // name: /.*/, - // value: /2idC0G3ezCdhA9WVjWemc\$/, - // }, - // ], - // }); - - if (!file) { - const [fileHandle] = await window.showOpenFilePicker(); - // console.log(fileHandle); - file = await fileHandle.getFile(); - } - - const start = performance.now(); - - const finder = components.get(OBC.IfcFinder); - - const result = await finder.find(file, queries); - - console.log(result); - console.log(queries); - console.log(`Time: ${performance.now() - start}`); - } + // if (e.code === "KeyO") { + // queries.push(new OBC.PropertyToElementsQuery()); + // + // const [fileHandle] = await window.showOpenFilePicker(); + // // console.log(fileHandle); + // file = await fileHandle.getFile(); + // + // const start = performance.now(); + // + // const finder = components.get(OBC.IfcFinder); + // + // const result = await finder.find(file, queries); + // + // console.log(result); + // console.log(queries); + // console.log(`Time: ${performance.now() - start}`); + // } }); /* MD diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 785f5047e..567ef8583 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -35,8 +35,8 @@ export class IfcFinder extends Component { continue; } - const queryInput = previousQuery?.lines || file; - await query.update(queryInput); + const queryInput = previousQuery?.lines || undefined; + await query.update(file, queryInput); wasPreviousQueryUpdated = true; } diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts index 3b4bf1bdd..de4c81a53 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -20,17 +20,23 @@ export class IfcFinderQuery { this.inclusive = data.inclusive || false; } - async update(data: File | string[]) { - if (data instanceof File) { - await this.findInFile(data); - } else { + async update(file: File, data?: string[]) { + // If previous data exists, use it. Otherwise, read whole file + if (data) { this.findInLines(data); + } else { + await this.findInFile(file); } this.needsUpdate = false; } - private findInFile(file: File) { + protected getIdFromLine(line: string) { + const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); + return parseInt(idString, 10); + } + + protected findInFile(file: File) { return new Promise((resolve) => { const reader = new FileReader(); const decoder = new TextDecoder("utf-8"); @@ -78,7 +84,7 @@ export class IfcFinderQuery { }); } - private findInLines(lines: string[]) { + protected findInLines(lines: string[]) { for (const line of lines) { let category: string | null = null; let attrValues: string[] | null = null; @@ -190,15 +196,14 @@ export class IfcFinderQuery { } if (filtersPass) { - const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); - const id = parseInt(idString, 10); this.lines.push(line); + const id = this.getIdFromLine(line); this.ids.add(id); } } } - private getCategoryFromLine(line: string) { + protected getCategoryFromLine(line: string) { const start = line.indexOf("=") + 1; const end = line.indexOf("("); const category = line.slice(start, end).trim(); @@ -209,7 +214,7 @@ export class IfcFinderQuery { return name; } - private getAttributesFromLine(line: string) { + protected getAttributesFromLine(line: string) { const matchRegex = /\((.*)\)/; const match = line.match(matchRegex); if (!(match && match[1])) { @@ -217,11 +222,13 @@ export class IfcFinderQuery { } const splitRegex = /,(?![^()]*\))/g; const attrs = match[1].split(splitRegex).map((part) => part.trim()); - const validAttrs = attrs.map((attr) => { - if (attr.startsWith("(") && attr.endsWith(")")) return "$"; - if (attr.startsWith("'") && attr.endsWith("'")) return attr.slice(1, -1); - return attr; - }); - return validAttrs; + // console.log(attrs); + // const validAttrs = attrs.map((attr) => { + // if (attr.startsWith("(") && attr.endsWith(")")) return "$"; + // if (attr.startsWith("'") && attr.endsWith("'")) return attr.slice(1, -1); + // return attr; + // }); + // return validAttrs; + return attrs; } } diff --git a/packages/core/src/ifc/IfcFinder/src/index.ts b/packages/core/src/ifc/IfcFinder/src/index.ts index 664117a9c..15e02030e 100644 --- a/packages/core/src/ifc/IfcFinder/src/index.ts +++ b/packages/core/src/ifc/IfcFinder/src/index.ts @@ -1,2 +1,3 @@ export * from "./types"; export * from "./ifc-finder-query"; +export * from "./property-to-elements-query"; diff --git a/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts b/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts new file mode 100644 index 000000000..022f93061 --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts @@ -0,0 +1,209 @@ +import * as WEBIFC from "web-ifc"; +import { IfcFinderQuery } from "./ifc-finder-query"; +import { IfcPropertyRule } from "./types"; + +export class PropertyToElementsQuery extends IfcFinderQuery { + private psets: string[] = []; + + constructor(data: { name?: string; rules: IfcPropertyRule[] }) { + super({ + name: data?.name || "Properties to elements query", + inclusive: false, + rules: data.rules, + }); + + this.rules.unshift({ + type: "category", + value: /IfcPropertySingleValue/, + }); + } + + async update(file: File, data?: string[]) { + // 1. Gather all propertysinglevalue that match the filters AND all psets + + if (data) { + this.findInLines(data); + } else { + await this.findInFile(file); + } + + this.lines = []; + const psetIDs = new Set(); + + // Now, let's check which psets we are looking for + for (const pset of this.psets) { + const attrs = this.getAttributesFromLine(pset); + if (attrs === null) { + continue; + } + + const idsString = attrs[4] + .replace("(", "[") + .replace(")", "]") + .replace(/#/g, ""); + + const ids = JSON.parse(idsString) as number[]; + + for (const id of ids) { + if (this.ids.has(id)) { + const psetID = this.getIdFromLine(pset); + psetIDs.add(psetID); + this.lines.push(pset); + break; + } + } + } + + this.ids = psetIDs; + this.psets = []; + + this.needsUpdate = false; + + // if (!data) { + // throw new Error( + // "The property to element query requires previous data containing the desired properties", + // ); + // } + + // Gather all the properties + + // const propertiesIDs: number[] = []; + // const propertyPattern = /IFCPROPERTYSINGLEVALUE/; + // for (const line of data) { + // if (propertyPattern.test(line)) { + // const id = this.getIdFromLine(line); + // propertiesIDs.push(id); + // } + // } + + // Create filter + + // let filterText = ""; + // for (const id of propertiesIDs) { + // filterText += `#${id}|`; + // } + // filterText = filterText.slice(0, filterText.length - 1); + // const psetFilter = new RegExp(filterText); + + // Create a filter for the psets that have these properties + + // this.rules = [ + // { + // type: "property", + // name: /.*/, + // value: psetFilter, + // }, + // { + // type: "property", + // name: /.*/, + // value: psetFilter, + // }, + // ]; + + // Get the related psets + + // await this.findInFile(file); + + // this.needsUpdate = false; + } + + protected findInLines(lines: string[]) { + for (const line of lines) { + let category: string | null = null; + let attrValues: string[] | null = null; + let attrNames: string[] | null = null; + + let filtersPass = false; + + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + continue; + } + } + + // If it's pset, gather it + if (category === "IfcPropertySet") { + this.psets.push(line); + continue; + } + + // Now, only process property single values + if (category !== "IfcPropertySingleValue") { + continue; + } + + // Check if property filters apply + for (const rule of this.rules) { + if (rule.type === "property") { + const { name, value } = rule; + + // Quick test to see if this line contains what we are looking for + if (!value.test(line)) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + + if (attrValues === null) { + attrValues = this.getAttributesFromLine(line); + if (attrValues === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + } + + if (attrNames === null) { + // @ts-ignore + attrNames = Object.keys(new WEBIFC.IFC4[category]()); + // Remove attributes expressID and type, given by web-ifc + attrNames = attrNames.slice(2); + + if (attrNames === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } + } + } + + // Slow test to detect if + + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrValue = attrValues[i]; + const attrName = attrNames[i]; + // Check that both name and value match + if (value.test(attrValue) && name.test(attrName)) { + someNameValueMatch = true; + break; + } + } + + if (!someNameValueMatch) { + if (!this.inclusive) { + filtersPass = false; + break; + } + } else { + filtersPass = true; + } + } + } + + if (filtersPass) { + const id = this.getIdFromLine(line); + this.ids.add(id); + } + } + } +} From d2d20d6daef97bbd533d77a2d035bb8c95ddea1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Mon, 23 Sep 2024 00:07:58 +0200 Subject: [PATCH 40/51] wip: clean up finder api --- packages/core/package.json | 4 +- .../core/src/fragments/Classifier/index.ts | 11 +- .../core/src/fragments/IfcLoader/example.ts | 66 +++-- packages/core/src/ifc/IfcFinder/index.ts | 40 +-- .../src/ifc/IfcFinder/src/ifc-basic-query.ts | 55 ++++ .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 280 ++++++++++-------- .../ifc/IfcFinder/src/ifc-property-query.ts | 114 +++++++ .../src/ifc/IfcFinder/src/ifc-query-group.ts | 51 ++++ packages/core/src/ifc/IfcFinder/src/index.ts | 3 +- .../src/property-to-elements-query.ts | 209 ------------- packages/core/src/ifc/IfcFinder/src/types.ts | 9 +- .../core/src/ifc/IfcRelationsIndexer/index.ts | 9 +- packages/front/package.json | 2 +- yarn.lock | 14 +- 14 files changed, 482 insertions(+), 385 deletions(-) create mode 100644 packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts create mode 100644 packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts create mode 100644 packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts delete mode 100644 packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts diff --git a/packages/core/package.json b/packages/core/package.json index 877faf46e..d6e2099de 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -37,7 +37,7 @@ "access": "public" }, "devDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha.5", + "@thatopen/fragments": ">=2.3.0-alpha.8", "@thatopen/ui": "~2.2.0", "@types/three": "0.160.0", "stats.js": "^0.17.0", @@ -51,7 +51,7 @@ "three-mesh-bvh": "0.7.0" }, "peerDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha.5", + "@thatopen/fragments": ">=2.3.0-alpha.8", "three": "^0.160.1", "web-ifc": "0.0.57" } diff --git a/packages/core/src/fragments/Classifier/index.ts b/packages/core/src/fragments/Classifier/index.ts index 237b62e97..134a50315 100644 --- a/packages/core/src/fragments/Classifier/index.ts +++ b/packages/core/src/fragments/Classifier/index.ts @@ -5,6 +5,14 @@ import { IfcCategoryMap, IfcPropertiesUtils } from "../../ifc"; import { IfcRelationsIndexer } from "../../ifc/IfcRelationsIndexer"; import { FragmentsManager } from "../FragmentsManager"; +// TODO: SMART GROUPS Static vs dynamic classifications +// static: has fragmentIdMap +// dynamic: use the finder to find the result from a querygroup +// for dynamic, we just need to add a queryGroup as shown below + +// TODO: Make the groups a class to have a getter that gets the combined FragmentIdMap +// combined from the cherry picked elements and the elements found in the group + /** * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information. */ @@ -18,10 +26,11 @@ export interface Classification { * A class within the system. * The key is the class name, and the value is an object containing a map of fragment IDs with extra information. */ - [className: string]: { + [groupName: string]: { map: FRAGS.FragmentIdMap; name: string; id: number | null; + // rules?: QueryGroup; }; }; } diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index 2dbc85dfb..a76498b8f 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -21,6 +21,7 @@ In this tutorial, we will import: import * as WEBIFC from "web-ifc"; import * as BUI from "@thatopen/ui"; import Stats from "stats.js"; +import * as OBCF from "@thatopen/components-front/src"; import * as OBC from "../.."; /* MD @@ -214,37 +215,56 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); -const queries: OBC.IfcFinderQuery[] = [ - new OBC.PropertyToElementsQuery({ - name: "walls", - rules: [ - { - type: "property", - name: /.*/, - value: /FireRating/, - }, - ], - }), -]; - -let file: File | null = null; +const highlighter = components.get(OBCF.Highlighter) as OBCF.Highlighter; +highlighter.setup({ world }); window.addEventListener("keydown", async (e) => { if (e.code === "KeyP") { - if (!file) { - const [fileHandle] = await window.showOpenFilePicker(); - // console.log(fileHandle); - file = await fileHandle.getFile(); - } + const [fileHandle] = await window.showOpenFilePicker(); + // console.log(fileHandle); + const file = await fileHandle.getFile(); - const start = performance.now(); + const model = await fragmentIfcLoader.load( + new Uint8Array(await file.arrayBuffer()), + ); + const indexer = components.get(OBC.IfcRelationsIndexer); + await indexer.process(model); + + model.name = "example"; + world.scene.three.add(model); + + const start = performance.now(); const finder = components.get(OBC.IfcFinder); - const result = await finder.find(file, queries); + const queryGroup = finder.create(); + + queryGroup.add( + new OBC.IfcPropertyQuery(components, { + name: "pset", + inclusive: false, + rules: [ + { + type: "property", + name: /.*/, + value: /Unconnected Height/, + }, + { + type: "operator", + value: 3, + operator: ">", + name: /.*/, + }, + ], + }), + ); + + await queryGroup.update(model.uuid, file); + + const items = queryGroup.items; + console.log(items); + highlighter.highlightByID("select", items, true, true); - console.log(result); - console.log(queries); console.log(`Time: ${performance.now() - start}`); } diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 567ef8583..921df2ef3 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -1,4 +1,5 @@ import { Component, Components, Event } from "../../core"; +import { IfcQueryGroup } from "./src/ifc-query-group"; import { IfcFinderQuery } from "./src"; export * from "./src"; @@ -18,29 +19,30 @@ export class IfcFinder extends Component { /** {@link Component.enabled} */ enabled = true; + list = new Map(); + + get queries() { + // return list of all queries traversing all groups + const queries = new Set(); + for (const [, group] of this.list) { + for (const query of group.queries) { + queries.add(query); + } + } + return queries; + } + constructor(components: Components) { super(components); } - async find(file: File, queries: IfcFinderQuery[]) { - let wasPreviousQueryUpdated = false; - - // Handle the rest of query parts - for (let i = 0; i < queries.length; i++) { - const query = queries[i]; - const previousQuery = queries[i - 1]; - - if (!query.needsUpdate && !wasPreviousQueryUpdated) { - // This query is up to date and previous queries were not updated, so let's skip it - continue; - } - - const queryInput = previousQuery?.lines || undefined; - await query.update(file, queryInput); - wasPreviousQueryUpdated = true; - } + create() { + const group = new IfcQueryGroup(); + this.list.set(group.uuid, group); + return group; + } - const lastQuery = queries[queries.length - 1]; - return new Set(lastQuery.ids); + delete(id: string) { + this.list.delete(id); } } diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts new file mode 100644 index 000000000..0f96f4aa8 --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts @@ -0,0 +1,55 @@ +import * as FRAGS from "@thatopen/fragments"; +import { IfcFinderRule } from "./types"; +import { IfcFinderQuery } from "./ifc-finder-query"; +import { Components } from "../../../core"; +import { FragmentsManager } from "../../../fragments"; + +export class IfcBasicQuery extends IfcFinderQuery { + name: string; + + get items() { + const fragments = this.components.get(FragmentsManager); + const maps: FRAGS.FragmentIdMap[] = []; + for (const modelID in this.ids) { + const ids = this.ids[modelID]; + const found = fragments.groups.get(modelID); + if (!found) { + console.warn(`Model ${modelID} not found!`); + continue; + } + const map = found.getFragmentMap(ids); + maps.push(map); + } + return FRAGS.FragmentUtils.combine(maps); + } + + constructor( + components: Components, + data: { + name: string; + rules: IfcFinderRule[]; + inclusive: boolean; + }, + ) { + super(components); + this.name = data.name; + this.rules = data.rules; + this.inclusive = data.inclusive; + } + + async update(modelID: string, file: File) { + this.ids[modelID] = new Set(); + await this.findInFile(modelID, file); + this.needsUpdate.set(modelID, false); + } + + protected findInLines(modelID: string, lines: string[]) { + for (const line of lines) { + const filtersPass = this.testRules(line); + if (filtersPass) { + const id = this.getIdFromLine(line); + this.addID(modelID, id); + } + } + } +} diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts index de4c81a53..930f5c486 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -1,42 +1,45 @@ +import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; -import { IfcFinderRule } from "./types"; import { ifcCategoryCase } from "../../Utils"; +import { IfcFinderRule } from "./types"; +import { Components } from "../../../core"; -export class IfcFinderQuery { - rules: IfcFinderRule[]; - inclusive: boolean; - name: string; - lines: string[] = []; - ids = new Set(); - needsUpdate = true; - - constructor(data: { - name: string; - rules: IfcFinderRule[]; - inclusive: boolean; - }) { - this.name = data.name; - this.rules = data.rules; - this.inclusive = data.inclusive || false; - } +export abstract class IfcFinderQuery { + abstract name: string; - async update(file: File, data?: string[]) { - // If previous data exists, use it. Otherwise, read whole file - if (data) { - this.findInLines(data); - } else { - await this.findInFile(file); - } + abstract items: FRAGS.FragmentIdMap; + + inclusive = false; + + rules: IfcFinderRule[] = []; + + ids: { [modelID: string]: Set } = {}; + + needsUpdate = new Map(); + + components: Components; + + abstract update(modelID: string, file: File): Promise; - this.needsUpdate = false; + protected abstract findInLines(modelID: string, lines: string[]): void; + + protected constructor(components: Components) { + this.components = components; } - protected getIdFromLine(line: string) { - const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); - return parseInt(idString, 10); + clear(modelID: string) { + delete this.ids[modelID]; + this.needsUpdate.delete(modelID); + } + + protected addID(modelID: string, id: number) { + if (!this.ids[modelID]) { + this.ids[modelID] = new Set(); + } + this.ids[modelID].add(id); } - protected findInFile(file: File) { + protected findInFile(modelID: string, file: File) { return new Promise((resolve) => { const reader = new FileReader(); const decoder = new TextDecoder("utf-8"); @@ -72,7 +75,7 @@ export class IfcFinderQuery { // Remove first line, which is cut lines.shift(); - this.findInLines(lines); + this.findInLines(modelID, lines); console.log(start / file.size); @@ -84,123 +87,166 @@ export class IfcFinderQuery { }); } - protected findInLines(lines: string[]) { - for (const line of lines) { - let category: string | null = null; - let attrValues: string[] | null = null; - let attrNames: string[] | null = null; + protected getIdFromLine(line: string) { + const idString = line.slice(line.indexOf("#") + 1, line.indexOf("=")); + return parseInt(idString, 10); + } - let filtersPass = false; + protected testRules(line: string) { + let category: string | null = null; + let attrValues: string[] | null = null; + let attrNames: string[] | null = null; - for (const rule of this.rules) { - if (rule.type === "category") { - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - if (!this.inclusive) { - break; - } else { - continue; - } - } - } + let filtersPass = false; - if (!rule.value.test(category)) { + for (const rule of this.rules) { + // Test categories + if (rule.type === "category") { + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { if (!this.inclusive) { - filtersPass = false; break; } else { continue; } } + } - filtersPass = true; - continue; + if (!rule.value.test(category)) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; + } } - if (rule.type === "property") { - const { name, value } = rule; + filtersPass = true; + continue; + } - // Quick test to see if this line contains what we are looking for - if (!value.test(line)) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } + if (attrValues === null) { + attrValues = this.getAttributesFromLine(line); + if (attrValues === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; } + } + } - if (attrValues === null) { - attrValues = this.getAttributesFromLine(line); - if (attrValues === null) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } + if (category === null) { + category = this.getCategoryFromLine(line); + if (category === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; } + } + } - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } + if (attrNames === null) { + // @ts-ignore + attrNames = Object.keys(new WEBIFC.IFC4[category]()); + // Remove attributes expressID and type, given by web-ifc + attrNames = attrNames.slice(2); + + if (attrNames === null) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; } + } + } - if (attrNames === null) { - // @ts-ignore - attrNames = Object.keys(new WEBIFC.IFC4[category]()); - // Remove attributes expressID and type, given by web-ifc - attrNames = attrNames.slice(2); - - if (attrNames === null) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } + // Test properties + if (rule.type === "property") { + const { name, value } = rule; + + // Quick test to see if this line contains what we are looking for + if (!value.test(line)) { + if (!this.inclusive) { + filtersPass = false; + break; + } else { + continue; } + } - // Slow test to detect if + // Slow test to detect if - let someNameValueMatch = false; - for (let i = 0; i < attrValues.length; i++) { - const attrValue = attrValues[i]; - const attrName = attrNames[i]; - // Check that both name and value match - if (value.test(attrValue) && name.test(attrName)) { - someNameValueMatch = true; - break; - } + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrValue = attrValues[i]; + const attrName = attrNames[i]; + // Check that both name and value match + if (value.test(attrValue) && name.test(attrName)) { + someNameValueMatch = true; + break; } + } - if (!someNameValueMatch) { - if (!this.inclusive) { - filtersPass = false; + if (!someNameValueMatch) { + if (!this.inclusive) { + filtersPass = false; + break; + } + } else { + filtersPass = true; + } + } + + // Test operators + if (rule.type === "operator") { + const { name, value, operator } = rule; + + let someNameValueMatch = false; + for (let i = 0; i < attrValues.length; i++) { + const attrName = attrNames[i]; + const attrValue = attrValues[i].replace( + /IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g, + "", + ); + // Check that name matches and operator applies + if (name.test(attrName)) { + if (operator === "=" && parseFloat(attrValue) === value) { + someNameValueMatch = true; + break; + } else if (operator === "<" && parseFloat(attrValue) < value) { + someNameValueMatch = true; + break; + } else if (operator === ">" && parseFloat(attrValue) > value) { + someNameValueMatch = true; + break; + } else if (operator === ">=" && parseFloat(attrValue) >= value) { + someNameValueMatch = true; + break; + } else if (operator === "<=" && parseFloat(attrValue) <= value) { + someNameValueMatch = true; break; } - } else { - filtersPass = true; } } - } - if (filtersPass) { - this.lines.push(line); - const id = this.getIdFromLine(line); - this.ids.add(id); + if (!someNameValueMatch) { + if (!this.inclusive) { + filtersPass = false; + break; + } + } else { + filtersPass = true; + } } } + + return filtersPass; } protected getCategoryFromLine(line: string) { diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts new file mode 100644 index 000000000..eaee66b6d --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts @@ -0,0 +1,114 @@ +import * as FRAGS from "@thatopen/fragments"; +import { IfcFinderQuery } from "./ifc-finder-query"; +import { IfcOperatorRule, IfcPropertyRule } from "./types"; +import { Components } from "../../../core"; +import { IfcRelationsIndexer } from "../../IfcRelationsIndexer"; +import { FragmentsManager } from "../../../fragments"; + +export class IfcPropertyQuery extends IfcFinderQuery { + name: string; + + private psets: string[] = []; + + get items() { + // Use the indexer to get all items related to the found psets + const indexer = this.components.get(IfcRelationsIndexer); + const fragments = this.components.get(FragmentsManager); + const maps: FRAGS.FragmentIdMap[] = []; + for (const modelID in this.ids) { + const model = fragments.groups.get(modelID); + if (!model) { + console.log(`Model not found: ${modelID}.`); + continue; + } + const ids = this.ids[modelID]; + for (const id of ids) { + const elements = indexer.getEntityRelations( + modelID, + id, + "DefinesOcurrence", + ); + if (elements) { + const map = model.getFragmentMap(elements); + maps.push(map); + } + } + } + return FRAGS.FragmentUtils.combine(maps); + } + + constructor( + components: Components, + data: { + name: string; + inclusive: boolean; + rules: (IfcPropertyRule | IfcOperatorRule)[]; + }, + ) { + super(components); + this.name = data.name; + this.rules = data.rules; + this.inclusive = data.inclusive; + } + + async update(modelID: string, file: File) { + // 1. Gather all propertysinglevalues that match the filters + // also gather all ifcpropertysets and save them in this.psets + await this.findInFile(modelID, file); + + // Now, let's see which psets contain the found ifcpropertysinglevalues + const psetIDs = new Set(); + for (const pset of this.psets) { + const attrs = this.getAttributesFromLine(pset); + if (attrs === null) { + continue; + } + + const idsString = attrs[4] + .replace("(", "[") + .replace(")", "]") + .replace(/#/g, ""); + + const containedPropertySingleValues = JSON.parse(idsString) as number[]; + + for (const id of containedPropertySingleValues) { + const ids = this.ids[modelID]; + if (ids && ids.has(id)) { + const psetID = this.getIdFromLine(pset); + psetIDs.add(psetID); + break; + } + } + } + + this.ids[modelID] = psetIDs; + this.psets = []; + + this.needsUpdate.set(modelID, false); + } + + protected findInLines(modelID: string, lines: string[]) { + for (const line of lines) { + const category = this.getCategoryFromLine(line); + + // If it's pset, gather it + if (category === "IfcPropertySet") { + this.psets.push(line); + continue; + } + + // Otherwise, only process property single values + if (category !== "IfcPropertySingleValue") { + continue; + } + + // Check if property filters apply + const filtersPass = this.testRules(line); + + if (filtersPass) { + const id = this.getIdFromLine(line); + this.addID(modelID, id); + } + } + } +} diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts new file mode 100644 index 000000000..9e05f6343 --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts @@ -0,0 +1,51 @@ +import * as FRAGS from "@thatopen/fragments"; +import * as THREE from "three"; +import { IfcFinderQuery } from "./ifc-finder-query"; + +export class IfcQueryGroup { + list = new Map(); + + uuid = THREE.MathUtils.generateUUID(); + + mode: "combine" | "intersect" = "intersect"; + + get queries() { + return new Set(this.list.values()); + } + + get items(): FRAGS.FragmentIdMap { + // Returns intersection of getElements of all queries + const maps: FRAGS.FragmentIdMap[] = []; + for (const query of this.queries) { + maps.push(query.items); + } + if (this.mode === "combine") { + return FRAGS.FragmentUtils.combine(maps); + } + return FRAGS.FragmentUtils.intersect(maps); + } + + add(query: IfcFinderQuery) { + if (this.list.has(query.name)) { + throw new Error( + `This group already has a query with the name ${query.name}.`, + ); + } + this.list.set(query.name, query); + } + + clear(modelID: string) { + for (const query of this.queries) { + query.clear(modelID); + } + } + + async update(modelID: string, file: File) { + for (const query of this.queries) { + const needsUpdate = query.needsUpdate.get(modelID); + if (needsUpdate === undefined || needsUpdate) { + await query.update(modelID, file); + } + } + } +} diff --git a/packages/core/src/ifc/IfcFinder/src/index.ts b/packages/core/src/ifc/IfcFinder/src/index.ts index 15e02030e..487b9ea4a 100644 --- a/packages/core/src/ifc/IfcFinder/src/index.ts +++ b/packages/core/src/ifc/IfcFinder/src/index.ts @@ -1,3 +1,4 @@ export * from "./types"; export * from "./ifc-finder-query"; -export * from "./property-to-elements-query"; +export * from "./ifc-basic-query"; +export * from "./ifc-property-query.ts"; diff --git a/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts b/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts deleted file mode 100644 index 022f93061..000000000 --- a/packages/core/src/ifc/IfcFinder/src/property-to-elements-query.ts +++ /dev/null @@ -1,209 +0,0 @@ -import * as WEBIFC from "web-ifc"; -import { IfcFinderQuery } from "./ifc-finder-query"; -import { IfcPropertyRule } from "./types"; - -export class PropertyToElementsQuery extends IfcFinderQuery { - private psets: string[] = []; - - constructor(data: { name?: string; rules: IfcPropertyRule[] }) { - super({ - name: data?.name || "Properties to elements query", - inclusive: false, - rules: data.rules, - }); - - this.rules.unshift({ - type: "category", - value: /IfcPropertySingleValue/, - }); - } - - async update(file: File, data?: string[]) { - // 1. Gather all propertysinglevalue that match the filters AND all psets - - if (data) { - this.findInLines(data); - } else { - await this.findInFile(file); - } - - this.lines = []; - const psetIDs = new Set(); - - // Now, let's check which psets we are looking for - for (const pset of this.psets) { - const attrs = this.getAttributesFromLine(pset); - if (attrs === null) { - continue; - } - - const idsString = attrs[4] - .replace("(", "[") - .replace(")", "]") - .replace(/#/g, ""); - - const ids = JSON.parse(idsString) as number[]; - - for (const id of ids) { - if (this.ids.has(id)) { - const psetID = this.getIdFromLine(pset); - psetIDs.add(psetID); - this.lines.push(pset); - break; - } - } - } - - this.ids = psetIDs; - this.psets = []; - - this.needsUpdate = false; - - // if (!data) { - // throw new Error( - // "The property to element query requires previous data containing the desired properties", - // ); - // } - - // Gather all the properties - - // const propertiesIDs: number[] = []; - // const propertyPattern = /IFCPROPERTYSINGLEVALUE/; - // for (const line of data) { - // if (propertyPattern.test(line)) { - // const id = this.getIdFromLine(line); - // propertiesIDs.push(id); - // } - // } - - // Create filter - - // let filterText = ""; - // for (const id of propertiesIDs) { - // filterText += `#${id}|`; - // } - // filterText = filterText.slice(0, filterText.length - 1); - // const psetFilter = new RegExp(filterText); - - // Create a filter for the psets that have these properties - - // this.rules = [ - // { - // type: "property", - // name: /.*/, - // value: psetFilter, - // }, - // { - // type: "property", - // name: /.*/, - // value: psetFilter, - // }, - // ]; - - // Get the related psets - - // await this.findInFile(file); - - // this.needsUpdate = false; - } - - protected findInLines(lines: string[]) { - for (const line of lines) { - let category: string | null = null; - let attrValues: string[] | null = null; - let attrNames: string[] | null = null; - - let filtersPass = false; - - if (category === null) { - category = this.getCategoryFromLine(line); - if (category === null) { - continue; - } - } - - // If it's pset, gather it - if (category === "IfcPropertySet") { - this.psets.push(line); - continue; - } - - // Now, only process property single values - if (category !== "IfcPropertySingleValue") { - continue; - } - - // Check if property filters apply - for (const rule of this.rules) { - if (rule.type === "property") { - const { name, value } = rule; - - // Quick test to see if this line contains what we are looking for - if (!value.test(line)) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - - if (attrValues === null) { - attrValues = this.getAttributesFromLine(line); - if (attrValues === null) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - } - - if (attrNames === null) { - // @ts-ignore - attrNames = Object.keys(new WEBIFC.IFC4[category]()); - // Remove attributes expressID and type, given by web-ifc - attrNames = attrNames.slice(2); - - if (attrNames === null) { - if (!this.inclusive) { - filtersPass = false; - break; - } else { - continue; - } - } - } - - // Slow test to detect if - - let someNameValueMatch = false; - for (let i = 0; i < attrValues.length; i++) { - const attrValue = attrValues[i]; - const attrName = attrNames[i]; - // Check that both name and value match - if (value.test(attrValue) && name.test(attrName)) { - someNameValueMatch = true; - break; - } - } - - if (!someNameValueMatch) { - if (!this.inclusive) { - filtersPass = false; - break; - } - } else { - filtersPass = true; - } - } - } - - if (filtersPass) { - const id = this.getIdFromLine(line); - this.ids.add(id); - } - } - } -} diff --git a/packages/core/src/ifc/IfcFinder/src/types.ts b/packages/core/src/ifc/IfcFinder/src/types.ts index 465287c0c..40ad4a627 100644 --- a/packages/core/src/ifc/IfcFinder/src/types.ts +++ b/packages/core/src/ifc/IfcFinder/src/types.ts @@ -9,4 +9,11 @@ export interface IfcPropertyRule { value: RegExp; } -export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule; +export interface IfcOperatorRule { + type: "operator"; + name: RegExp; + value: number; + operator: "<" | ">" | "=" | "<=" | ">="; +} + +export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule | IfcOperatorRule; diff --git a/packages/core/src/ifc/IfcRelationsIndexer/index.ts b/packages/core/src/ifc/IfcRelationsIndexer/index.ts index b2f43e402..266944547 100644 --- a/packages/core/src/ifc/IfcRelationsIndexer/index.ts +++ b/packages/core/src/ifc/IfcRelationsIndexer/index.ts @@ -263,21 +263,22 @@ export class IfcRelationsIndexer extends Component implements Disposable { * This method searches the indexed relation maps for the specified model and entity, * returning the IDs of related entities if a match is found. * - * @param model The `FragmentsGroup` model containing the entity. + * @param model The `FragmentsGroup` model containing the entity, or its UUID. * @param expressID The unique identifier of the entity within the model. * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements"). * @returns An array of express IDs representing the related entities, or `null` if no relations are found * or the specified relation name is not indexed. */ getEntityRelations( - model: FragmentsGroup, + model: FragmentsGroup | string, expressID: number, relationName: InverseAttribute, ) { - const indexMap = this.relationMaps[model.uuid]; + const id = model instanceof FragmentsGroup ? model.uuid : model; + const indexMap = this.relationMaps[id]; if (!indexMap) { throw new Error( - `IfcRelationsIndexer: model ${model.uuid} has no relations indexed.`, + `IfcRelationsIndexer: model ${id} has no relations indexed.`, ); } const entityRelations = indexMap.get(expressID); diff --git a/packages/front/package.json b/packages/front/package.json index e5557d982..b3c87daa6 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -38,7 +38,7 @@ "web-ifc": "0.0.57" }, "devDependencies": { - "@thatopen/fragments": ">=2.3.0-alpha.5", + "@thatopen/fragments": ">=2.3.0-alpha.8", "@thatopen/ui": "~2.2.0", "@thatopen/ui-obc": "~2.2.0", "@types/earcut": "^2.1.4", diff --git a/yarn.lock b/yarn.lock index 7a7f5efe8..90bd07cb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -622,7 +622,7 @@ __metadata: resolution: "@thatopen/components-front@workspace:packages/front" dependencies: "@thatopen/components": ">=2.3.0-alpha.5" - "@thatopen/fragments": ">=2.3.0-alpha.5" + "@thatopen/fragments": ">=2.3.0-alpha.8" "@thatopen/ui": ~2.2.0 "@thatopen/ui-obc": ~2.2.0 "@types/earcut": ^2.1.4 @@ -645,7 +645,7 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/core" dependencies: - "@thatopen/fragments": ">=2.3.0-alpha.5" + "@thatopen/fragments": ">=2.3.0-alpha.8" "@thatopen/ui": ~2.2.0 "@types/three": 0.160.0 camera-controls: 2.7.3 @@ -656,21 +656,21 @@ __metadata: three-mesh-bvh: 0.7.0 web-ifc: 0.0.57 peerDependencies: - "@thatopen/fragments": ">=2.3.0-alpha.5" + "@thatopen/fragments": ">=2.3.0-alpha.8" three: ^0.160.1 web-ifc: 0.0.57 languageName: unknown linkType: soft -"@thatopen/fragments@npm:>=2.3.0-alpha.5": - version: 2.3.0-alpha.5 - resolution: "@thatopen/fragments@npm:2.3.0-alpha.5" +"@thatopen/fragments@npm:>=2.3.0-alpha.8": + version: 2.3.0-alpha.8 + resolution: "@thatopen/fragments@npm:2.3.0-alpha.8" dependencies: flatbuffers: 23.3.3 three-mesh-bvh: 0.7.0 peerDependencies: three: ^0.160.1 - checksum: fa3dd32d3b601c2df1fa5b6107369253879eec8a5c45bbb584703a258615ec0ee51d2add13ce7259448dd4bae8242475c8d6d115122a7ce3728d0b2d00e88dd5 + checksum: 3ca9e2118d6168669cae04b44c4b0c856e75d89ab9576e4357bacee7ff354a1bcb212cedfefa582bda4f294052bade7e992843bd9c141ea17ce321f56b9e4dfc languageName: node linkType: hard From 2a397f526ae0736b464c339e7eedabeacfa6b38f Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Tue, 24 Sep 2024 23:08:47 -0500 Subject: [PATCH 41/51] exporting almost done --- .gitignore | 2 + .../src/openbim/IDSSpecifications/example.ts | 42 +- .../src/openbim/IDSSpecifications/index.ts | 41 +- .../IDSSpecifications/src/Specification.ts | 40 +- .../src/exporters/parameter.ts | 37 ++ .../IDSSpecifications/src/facets/Attribute.ts | 63 +-- .../src/facets/Classification.ts | 10 + .../IDSSpecifications/src/facets/Entity.ts | 12 +- .../IDSSpecifications/src/facets/Facet.ts | 4 +- .../IDSSpecifications/src/facets/Material.ts | 12 +- .../IDSSpecifications/src/facets/PartOf.ts | 4 + .../IDSSpecifications/src/facets/Property.ts | 364 +++++++++++++++--- .../src/importers/classification.ts | 1 + .../src/importers/property.ts | 32 ++ .../openbim/IDSSpecifications/src/types.ts | 8 +- 15 files changed, 563 insertions(+), 109 deletions(-) create mode 100644 packages/core/src/openbim/IDSSpecifications/src/exporters/parameter.ts create mode 100644 packages/core/src/openbim/IDSSpecifications/src/importers/property.ts diff --git a/.gitignore b/.gitignore index ee7af0fea..d4718cdd2 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,5 @@ resources/bbbb.* resources/asdf2.frag resources/asdf2.json resources/umdasch/ + +app \ No newline at end of file diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index c3ad3da2c..c0e7e20a4 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -17,13 +17,18 @@ const indexer = components.get(OBC.IfcRelationsIndexer); // await indexer.process(model); const ids = components.get(OBC.IDSSpecifications); -// const specifications = ids.create("My First IDS!", "IFC4X3"); +const specification = ids.create("My First IDS!", ["IFC4X3"]); +specification.description = "Description"; +specification.instructions = "Instructions"; // Define some facets to be used in specifications const entityFacet = new OBC.IDSEntity(components, { - type: "simple", - parameter: "IFCSLAB", + type: "enumeration", + parameter: ["IFCSLAB", "IFCWALL"], }); + +specification.applicability.add(entityFacet); + const propertyFacet = new OBC.IDSProperty( components, { type: "simple", parameter: "Pset_SlabCommon" }, @@ -32,16 +37,27 @@ const propertyFacet = new OBC.IDSProperty( propertyFacet.value = { type: "simple", parameter: false }; -const classificationFacet = new OBC.IDSClassification(components, { - type: "simple", - parameter: "Uniformat", -}); +specification.requirements.add(propertyFacet); -const partOfFacet = new OBC.IDSPartOf(components, { - name: { type: "simple", parameter: "IFCBUILDINGSTOREY" }, -}); +const idsTitle = "My Custom IDS"; +const idsExport = ids.export({ title: idsTitle }); +const file = new File([idsExport], "idsTitle.ids"); +const a = document.createElement("a"); +a.href = URL.createObjectURL(file); +a.download = file.name; +// a.click(); +// URL.revokeObjectURL(a.href); + +// const classificationFacet = new OBC.IDSClassification(components, { +// type: "simple", +// parameter: "Uniformat", +// }); + +// const partOfFacet = new OBC.IDSPartOf(components, { +// name: { type: "simple", parameter: "IFCBUILDINGSTOREY" }, +// }); -partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; +// partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; // // IfcSlab entities must have a Pset_SlabCommon with an IsExternal property set to false // const entitiesA: FRAGS.IfcProperties = {}; @@ -99,7 +115,7 @@ partOfFacet.relation = WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE; // Load test cases from GitHub // Define the URL for fetching the files list const apiURL = - "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/classification?ref=development"; + "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/property?ref=development"; // Function to process each pair of IFC and IDS files async function processPair(ifcUrl: string, idsUrl: string) { @@ -195,5 +211,5 @@ async function fetchFileListAndProcessPairs() { // const baseURL = // "https://raw.githubusercontent.com/buildingSMART/IDS/development/Documentation/ImplementersDocumentation/TestCases"; -// const url = `${baseURL}/classification/pass-occurrences_override_the_type_classification_per_system_1_3`; +// const url = `${baseURL}/property/pass-a_number_specified_as_a_string_is_treated_as_a_string`; // processPair(`${url}.ifc`, `${url}.ids`); diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts index 955e5594d..e297f863c 100644 --- a/packages/core/src/openbim/IDSSpecifications/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -1,13 +1,14 @@ import * as FRAGS from "@thatopen/fragments"; import { XMLParser } from "fast-xml-parser"; import { Component, DataMap } from "../../core/Types"; -import { IDSFacet, IDSInfo, IDSSpecification } from "./src"; +import { IDSCheckResult, IDSFacet, IDSInfo, IDSSpecification } from "./src"; import { Components } from "../../core"; import { createEntityFacets, createAttributeFacets, createClassificationFacets, } from "./src/importers"; +import { createPropertyFacets } from "./src/importers/property"; export class IDSSpecifications extends Component { static uuid = "9f0b9f78-9b2e-481a-b766-2fbfd01f342c" as const; @@ -33,6 +34,18 @@ export class IDSSpecifications extends Component { readonly list = new DataMap(); + getFragmentIdMap(model: FRAGS.FragmentsGroup, result: IDSCheckResult[]) { + const passResults = result.filter((check) => check.pass); + const passIDs = passResults.map((check) => check.expressID); + const pass = model.getFragmentMap(passIDs); + + const failResults = result.filter((check) => !check.pass); + const failIDs = failResults.map((check) => check.expressID); + const fail = model.getFragmentMap(failIDs); + + return { pass, fail }; + } + create(name: string, ifcVersion: FRAGS.IfcSchema[]) { const specification = new IDSSpecification( this.components, @@ -102,6 +115,10 @@ export class IDSSpecifications extends Component { ); reqs.push(...facets); } + if (facetName === "property") { + const facets = createPropertyFacets(this.components, elements); + reqs.push(...facets); + } } } } @@ -120,7 +137,27 @@ export class IDSSpecifications extends Component { export( info: IDSInfo, specifications: Iterable = this.list.values(), - ) {} + ) { + const _specifications = specifications ?? this.list; + const xml = ` + + + ${info.title} + ${info.copyright ? `${info.copyright}` : ""} + ${info.version ? `${info.version}` : ""} + ${info.description ? `${info.description}` : ""} + ${info.author ? `${info.author}` : ""} + ${info.date ? `${info.date.toISOString().split("T")[0]}` : ""} + ${info.purpose ? `${info.purpose}` : ""} + ${info.milestone ? `${info.milestone}` : ""} + + + ${[..._specifications].map((spec) => spec.serialize()).join("\n")} + +`; + + return xml; + } } export * from "./src"; diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 402fe7c31..134b5edeb 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -30,7 +30,9 @@ export class IDSSpecification { } async test(model: FRAGS.FragmentsGroup) { - const result: IDSCheckResult[] = []; + let result: IDSCheckResult[] = []; + + if (this.requirements.size === 0) return result; // Get applicable elements const entities: FRAGS.IfcProperties = {}; @@ -38,13 +40,14 @@ export class IDSSpecification { await facet.getEntities(model, entities); } - console.log(entities); - // Test applicable elements against requirements - const requirementsResult: { [expressId: string]: boolean } = {}; - for (const expressID in entities) { - requirementsResult[expressID] = true; - } + const requirement = [...this.requirements][0]; + result = await requirement.test(entities, model); + return result; + // const requirementsResult: { [expressId: string]: boolean } = {}; + // for (const expressID in entities) { + // requirementsResult[expressID] = true; + // } // for (const requirement of this.requirements) { // const arrayEntities = Object.values(entities); @@ -66,7 +69,28 @@ export class IDSSpecification { // result.fail[expressID] = entity; // } // } + } - return result; + serialize() { + const name = `name="${this.name}"`; + const identifier = this.identifier ? `identifier="${this.identifier}"` : ""; + + const description = this.description + ? `description="${this.description}"` + : ""; + + const instructions = this.instructions + ? `instructions="${this.instructions}"` + : ""; + + const xml = ` + + ${[...this.applicability].map((applicability) => applicability.serialize())} + + + ${[...this.requirements].map((requirement) => requirement.serialize())} + + `; + return xml; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/exporters/parameter.ts b/packages/core/src/openbim/IDSSpecifications/src/exporters/parameter.ts new file mode 100644 index 000000000..02c357d03 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/exporters/parameter.ts @@ -0,0 +1,37 @@ +import { + IDSFacetParameterName, + IDSFacetParameter, + IDSEnumerationParameter, + IDSPatternParameter, +} from "../types"; + +export const getParameterXML = ( + name: IDSFacetParameterName, + parameter?: IDSFacetParameter, +) => { + let parameterXML = ""; + if (!parameter) return parameterXML; + if (parameter.type === "simple") { + parameterXML = `${parameter.parameter}`; + } + + if (parameter.type === "enumeration") { + const value = parameter.parameter as IDSEnumerationParameter; + parameterXML = ` + ${value.map((v) => ``).join("\r\n")} + `; + } + + if (parameter.type === "pattern") { + const value = parameter.parameter as IDSPatternParameter; + parameterXML = ` + + `; + } + + const xml = ` + ${parameterXML} + `; + + return xml; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index 4f8d1b3c2..de549df9d 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -2,6 +2,7 @@ import * as FRAGS from "@thatopen/fragments"; import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; import { IDSFacet } from "./Facet"; +import { getParameterXML } from "../exporters/parameter"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/attribute-facet.md @@ -14,37 +15,49 @@ export class IDSAttribute extends IDSFacet { this.name = name; } + serialize() { + const nameXML = getParameterXML("Name", this.name); + const valueXML = getParameterXML("Value", this.value); + return ` + ${nameXML} + ${valueXML} +`; + } + // This can be very ineficcient as we do not have an easy way to get an entity based on an attribute // Right now, all entities must be iterated. // When the new IfcEntitiesFinder comes, this can become easier. // This may be greatly increase in performance if the applicability has any of the other facets and this is applied the latest - async getEntities( - model: FRAGS.FragmentsGroup, - collector: FRAGS.IfcProperties = {}, - ) { + async getEntities() { return []; - // for (const expressID in model) { - // if (collector[expressID]) continue; - // const entity = model[expressID]; - // // Check if the attribute exists - // const attribute = entity[this.name]; - // const attributeExists = !!attribute; - // // Check if the attribute value matches - // let valueMatches = true; - // if (attributeExists && this.value && this.value.value) { - // if (this.value.type === "simpleValue") { - // valueMatches = attribute.value === this.value.value; - // } - // if (this.value.type === "restriction") { - // const regex = new RegExp(this.value.value); - // valueMatches = regex.test(attribute.value); - // } - // } - // if (attributeExists && valueMatches) { - // collector[entity.expressID] = entity; - // } - // } } + // async getEntities( + // model: FRAGS.FragmentsGroup, + // collector: FRAGS.IfcProperties = {}, + // ) { + // return []; + // // for (const expressID in model) { + // // if (collector[expressID]) continue; + // // const entity = model[expressID]; + // // // Check if the attribute exists + // // const attribute = entity[this.name]; + // // const attributeExists = !!attribute; + // // // Check if the attribute value matches + // // let valueMatches = true; + // // if (attributeExists && this.value && this.value.value) { + // // if (this.value.type === "simpleValue") { + // // valueMatches = attribute.value === this.value.value; + // // } + // // if (this.value.type === "restriction") { + // // const regex = new RegExp(this.value.value); + // // valueMatches = regex.test(attribute.value); + // // } + // // } + // // if (attributeExists && valueMatches) { + // // collector[entity.expressID] = entity; + // // } + // // } + // } // https://github.com/buildingSMART/IDS/tree/development/Documentation/ImplementersDocumentation/TestCases/attribute // Test cases from buildingSMART repo have been tested and they all match with the expected result diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index 59ecd8eb5..2a9355eb4 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -4,6 +4,7 @@ import { Components } from "../../../../core/Components"; import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { IfcRelationsIndexer } from "../../../../ifc/IfcRelationsIndexer"; import { IDSFacet } from "./Facet"; +import { getParameterXML } from "../exporters/parameter"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/classification-facet.md @@ -17,6 +18,15 @@ export class IDSClassification extends IDSFacet { this.system = system; } + serialize() { + const systemXML = getParameterXML("System", this.system); + const valueXML = getParameterXML("Value", this.value); + return ` + ${systemXML} + ${valueXML} +`; + } + async getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties = {}, diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index 7fe75a22e..555611867 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -3,6 +3,7 @@ import { Components } from "../../../../core/Components"; import { IDSFacet } from "./Facet"; import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { IfcCategoryMap, IfcRelationsIndexer } from "../../../../ifc"; +import { getParameterXML } from "../exporters/parameter"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/entity-facet.md @@ -15,6 +16,15 @@ export class IDSEntity extends IDSFacet { this.name = name; } + serialize() { + const nameXML = getParameterXML("Name", this.name); + const predefinedTypeXML = getParameterXML("Name", this.predefinedType); + return ` + ${nameXML} + ${predefinedTypeXML} +`; + } + // IFCSURFACESTYLEREFRACTION is not present in the FragmentsGroup // IFCSURFACESTYLERENDERING is not present in the FragmentsGroup async getEntities( @@ -134,7 +144,7 @@ export class IDSEntity extends IDSFacet { const result = this.evalRequirement( value, this.predefinedType, - "Predefined Type", + "PredefinedType", checks, ); diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts index 7aee66e14..b0c496751 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -102,7 +102,7 @@ export abstract class IDSFacet { } if (this.cardinality === "prohibited") pass = !pass; - if (this.cardinality === "optional" && value === null) pass = true; + if (this.cardinality === "optional") pass = true; checkLog.pass = pass; return checkLog.pass; @@ -140,4 +140,6 @@ export abstract class IDSFacet { entities: FRAGS.IfcProperties, model?: FRAGS.FragmentsGroup, ): Promise; + + abstract serialize(): string; } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts index 4343d8b91..de6082382 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts @@ -1,4 +1,3 @@ -import * as FRAGS from "@thatopen/fragments"; import { IDSFacetParameter } from "../types"; import { IDSFacet } from "./Facet"; @@ -8,15 +7,16 @@ export class IdsMaterialFacet extends IDSFacet { value?: IDSFacetParameter; uri?: string; - async getEntities( - model: FRAGS.FragmentsGroup, - collector: FRAGS.IfcProperties = {}, - ) { + serialize() { + return ""; + } + + async getEntities() { const result: number[] = []; return result; } - async test(entities: FRAGS.IfcProperties) { + async test() { this.testResult = []; return this.testResult; } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts index c376158d8..f27c74db4 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/PartOf.ts @@ -48,6 +48,10 @@ export class IDSPartOf extends IDSFacet { this._entityFacet.predefinedType = entity.predefinedType; } + serialize() { + return ""; + } + async getEntities( model: FRAGS.FragmentsGroup, collector: FRAGS.IfcProperties = {}, diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts index 49de0474f..741db7d22 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts @@ -1,27 +1,44 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; -import { IDSFacetParameter } from "../types"; +import { IDSCheck, IDSCheckResult, IDSFacetParameter } from "../types"; import { Components } from "../../../../core/Components"; import { IfcRelationsIndexer } from "../../../../ifc"; import { IDSFacet } from "./Facet"; +import { getParameterXML } from "../exporters/parameter"; // https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/property-facet.md export class IDSProperty extends IDSFacet { propertySet: IDSFacetParameter; baseName: IDSFacetParameter; - dataType?: number; value?: IDSFacetParameter; + dataType?: string; uri?: string; + private _unsupportedTypes = [ + WEBIFC.IFCCOMPLEXPROPERTY, + WEBIFC.IFCPHYSICALCOMPLEXQUANTITY, + ]; + constructor( components: Components, propertySet: IDSFacetParameter, - name: IDSFacetParameter, + baseName: IDSFacetParameter, ) { super(components); this.propertySet = propertySet; - this.baseName = name; + this.baseName = baseName; + } + + serialize() { + const propertySetXML = getParameterXML("PropertySet", this.propertySet); + const baseNameXML = getParameterXML("BaseName", this.baseName); + const valueXML = getParameterXML("Value", this.value); + return ` + ${propertySetXML} + ${baseNameXML} + ${valueXML} +`; } async getEntities( @@ -97,65 +114,314 @@ export class IDSProperty extends IDSFacet { async test(entities: FRAGS.IfcProperties, model: FRAGS.FragmentsGroup) { this.testResult = []; - const indexer = this.components.get(IfcRelationsIndexer); for (const _expressID in entities) { const expressID = Number(_expressID); const attrs = entities[expressID]; - if (!attrs.GlobalId?.value) continue; - - let matches = false; - const definitions = indexer.getEntityRelations( - model, + const checks: IDSCheck[] = []; + const result: IDSCheckResult = { + guid: attrs.GlobalId?.value, expressID, - "IsDefinedBy", - ); - if (!definitions) { - this.saveResult(attrs, matches); + pass: false, + checks, + cardinality: this.cardinality, + }; + + this.testResult.push(result); + + const sets = await this.getPsets(model, expressID); + const matchingSets = sets.filter((set) => { + const result = this.evalRequirement( + set.Name?.value ?? null, + this.propertySet, + "PropertySet", + ); + if (!result) return false; + checks.push({ + currentValue: set.Name.value, + parameter: "PropertySet", + pass: true, + requiredValue: this.propertySet.parameter, + }); + return true; + }); + + if (matchingSets.length === 0) { + checks.push({ + currentValue: null, + parameter: "PropertySet", + pass: false, + requiredValue: this.propertySet.parameter, + }); continue; } - for (const definitionID of definitions) { - const definitionAttrs = await model.getProperties(definitionID); - if (!definitionAttrs) continue; - - const nameMatches = - definitionAttrs.Name?.value === this.propertySet.parameter; - if (!nameMatches) continue; - - let propsListName: string | undefined; - if (definitionAttrs.type === WEBIFC.IFCPROPERTYSET) - propsListName = "HasProperties"; - if (definitionAttrs.type === WEBIFC.IFCELEMENTQUANTITY) - propsListName = "Quantities"; - if (!propsListName) continue; - - for (const handle of definitionAttrs[propsListName]) { - const propAttrs = await model.getProperties(handle.value); - if (!propAttrs) continue; - - const propNameMatches = - propAttrs.Name?.value === this.baseName.parameter; - if (!propNameMatches) continue; - - if (this.value) { - const valueKey = Object.keys(propAttrs).find((name) => - name.endsWith("Value"), - ); - if (!valueKey) continue; - const valueMatches = - propAttrs[valueKey].value === this.value.parameter; - if (!valueMatches) continue; + for (const set of matchingSets) { + const itemsAttrName = this.getItemsAttrName(set.type); + if (!itemsAttrName) { + checks.push({ + currentValue: null, + parameter: "BaseName", + pass: false, + requiredValue: this.baseName.parameter, + }); + continue; + } + + const items = set[itemsAttrName]; + const matchingItems = items.filter((item: any) => { + if (this._unsupportedTypes.includes(item.type)) { + return false; } + const result = this.evalRequirement( + item.Name?.value ?? null, + this.baseName, + "BaseName", + ); + if (!result) return false; + checks.push({ + currentValue: item.Name.value, + parameter: "BaseName", + pass: true, + requiredValue: this.baseName.parameter, + }); + return true; + }); + + if (matchingItems.length === 0) { + checks.push({ + currentValue: null, + parameter: "BaseName", + pass: false, + requiredValue: this.baseName.parameter, + }); + continue; + } - matches = true; - break; + for (const item of matchingItems) { + this.evalValue(item, checks); + this.evalDataType(item, checks); + this.evalURI(); } } - this.saveResult(attrs, matches); + // for (const definitionID of definitions) { + // const definitionAttrs = await model.getProperties(definitionID); + // if (!definitionAttrs) continue; + + // const psetNameMatches = this.evalRequirement( + // definitionAttrs.Name?.value ?? null, + // this.propertySet, + // "Property Set", + // ); + // if (!psetNameMatches) continue; + + // checks.push({ + // currentValue: definitionAttrs.Name.value, + // parameter: "Property Set", + // pass: true, + // requiredValue: this.propertySet.parameter, + // }); + + // let propsListName: string | undefined; + // if (definitionAttrs.type === WEBIFC.IFCPROPERTYSET) + // propsListName = "HasProperties"; + // if (definitionAttrs.type === WEBIFC.IFCELEMENTQUANTITY) + // propsListName = "Quantities"; + // if (!propsListName) continue; + + // for (const handle of definitionAttrs[propsListName]) { + // const propAttrs = await model.getProperties(handle.value); + // if (!propAttrs) continue; + + // const baseNameMatches = this.evalRequirement( + // propAttrs.Name?.value ?? null, + // this.baseName, + // "Base Name", + // ); + + // if (!baseNameMatches) continue; + + // checks.push({ + // currentValue: propAttrs.Name.value, + // parameter: "Base Name", + // pass: true, + // requiredValue: this.baseName.parameter, + // }); + + // this.evalValue(propAttrs, checks); + // } + // } + + result.pass = checks.every(({ pass }) => pass); } - return this.testResult; + const result = [...this.testResult]; + this.testResult = []; + return result; + } + + private getItemsAttrName(type: number) { + let propsListName: string | undefined; + if (type === WEBIFC.IFCPROPERTYSET) propsListName = "HasProperties"; + if (type === WEBIFC.IFCELEMENTQUANTITY) propsListName = "Quantities"; + return propsListName; + } + + private getValueKey(attrs: Record) { + return Object.keys(attrs).find( + (name) => name.endsWith("Value") || name.endsWith("Values"), + ); + } + + // IFCPROPERTYSET from type must be get as well + private async getPsets(model: FRAGS.FragmentsGroup, expressID: number) { + const sets: Record[] = []; + + const indexer = this.components.get(IfcRelationsIndexer); + const definitions = indexer.getEntityRelations( + model, + expressID, + "IsDefinedBy", + ); + if (!definitions) return sets; + + for (const definitionID of definitions) { + const attrs = await model.getProperties(definitionID); + if (!attrs) continue; + + const propsListName = this.getItemsAttrName(attrs.type); + if (!propsListName) continue; + + const attrsClone = structuredClone(attrs); + const props: Record[] = []; + for (const { value } of attrsClone[propsListName]) { + const propAttrs = await model.getProperties(value); + if (propAttrs) props.push(propAttrs); + } + attrsClone[propsListName] = props; + + sets.push(attrsClone); + } + + return sets; + } + + // IFCPROPERTYBOUNDEDVALUE are not supported yet + // IFCPROPERTYTABLEVALUE are not supported yet + // Work must to be done to convert numerical value units to IDS-nominated standard units https://github.com/buildingSMART/IDS/blob/development/Documentation/UserManual/units.md + private evalValue(attrs: Record, checks?: IDSCheck[]) { + const valueKey = this.getValueKey(attrs); + if (this.value) { + if (!valueKey) { + checks?.push({ + parameter: "Value", + currentValue: null, + pass: false, + requiredValue: this.value.parameter, + }); + return false; + } + + const valueAttr = attrs[valueKey]; + const facetValue = structuredClone(this.value); + if (valueAttr.name === "IFCLABEL" && facetValue.type === "simple") { + facetValue.parameter = String(facetValue.parameter); + } + + if ( + (attrs.type === WEBIFC.IFCPROPERTYLISTVALUE || + attrs.type === WEBIFC.IFCPROPERTYENUMERATEDVALUE) && + Array.isArray(valueAttr) + ) { + const values = valueAttr.map((value) => value.value); + const matchingValue = valueAttr.find((value) => { + if (!facetValue) return false; + return this.evalRequirement(value.value, facetValue, "Value"); + }); + checks?.push({ + currentValue: values as any, + pass: !!matchingValue, + parameter: "Value", + requiredValue: facetValue.parameter, + }); + return !!matchingValue; + } + + const result = this.evalRequirement( + valueAttr.value, + facetValue, + "Value", + checks, + ); + return result; + } + + if (!valueKey) return true; + const value = attrs[valueKey]; + + // IDSDocs: Values with a logical unknown always fail + if (value.type === 3 && value.value === 2) { + checks?.push({ + parameter: "Value", + currentValue: null, + pass: false, + requiredValue: null, + }); + return false; + } + + // IDSDocs: An empty string is considered false + if (value.type === 1 && value.value.trim() === "") { + checks?.push({ + parameter: "Value", + currentValue: "", + pass: false, + requiredValue: null, + }); + return false; + } + + return true; + } + + private evalDataType(attrs: Record, checks?: IDSCheck[]) { + if (!this.dataType) return true; + const valueKey = this.getValueKey(attrs); + const valueAttr = attrs[valueKey as any]; + + if ( + (attrs.type === WEBIFC.IFCPROPERTYLISTVALUE || + attrs.type === WEBIFC.IFCPROPERTYENUMERATEDVALUE) && + Array.isArray(valueAttr) && + valueAttr[0] + ) { + const valueType = valueAttr[0].name; + const result = this.evalRequirement( + valueType, + { + type: "simple", + parameter: this.dataType, + }, + "DataType", + checks, + ); + return result; + } + + const result = this.evalRequirement( + valueAttr.name, + { + type: "simple", + parameter: this.dataType, + }, + "DataType", + checks, + ); + return result; + } + + private evalURI() { + return true; } } diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts index 0a0d0be13..6d04214ab 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/classification.ts @@ -21,6 +21,7 @@ export const createClassificationFacets = ( value.parameter = value.parameter.map(String); } facet.value = value; + facet.uri = element.uri; facets.push(facet); } return facets; diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/property.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/property.ts new file mode 100644 index 000000000..a7c29d8c1 --- /dev/null +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/property.ts @@ -0,0 +1,32 @@ +import { Components } from "../../../../core/Components"; +import { IDSFacet, IDSProperty } from "../facets"; +import { getParameterValue } from "./parameter"; + +export const createPropertyFacets = (components: Components, elements: any) => { + const facets: IDSFacet[] = []; + for (const element of elements) { + const psetParameter = element.propertySet; + const baseNameParameter = element.baseName; + const pset = getParameterValue(psetParameter); + const baseName = getParameterValue(baseNameParameter); + if (!(baseName && pset)) continue; + const facet = new IDSProperty(components, pset, baseName); + if (element.cardinality) facet.cardinality = element.cardinality; + + // Value + const value = getParameterValue(element.value); + if (value?.type === "enumeration" && Array.isArray(value.parameter)) { + value.parameter = value.parameter.map(String); + } + facet.value = value; + + // DataType + facet.dataType = element.dataType; + + // URI + facet.uri = element.uri; + + facets.push(facet); + } + return facets; +}; diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index 1bacc88a9..1961d6ba5 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -1,12 +1,12 @@ export type IDSFacetParameterName = | "Name" - | "Predefined Type" + | "PredefinedType" | "Value" | "System" | "URI" - | "Property Set" - | "Base Name" - | "Data Type" + | "PropertySet" + | "BaseName" + | "DataType" | "Value" | "Entity" | "Relation"; From 10c178ec27cd68738084a492e7d0ebbea86bc9b5 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Wed, 25 Sep 2024 09:29:03 -0500 Subject: [PATCH 42/51] import/export adjustments --- .../IDSSpecifications/src/Specification.ts | 14 ++++++-------- .../IDSSpecifications/src/facets/Attribute.ts | 11 +++++++++-- .../src/facets/Classification.ts | 12 ++++++++++-- .../IDSSpecifications/src/facets/Entity.ts | 11 +++++++++-- .../IDSSpecifications/src/facets/Facet.ts | 2 +- .../IDSSpecifications/src/facets/Material.ts | 17 +++++++++++++++-- .../IDSSpecifications/src/facets/Property.ts | 13 +++++++++++-- .../IDSSpecifications/src/importers/entity.ts | 1 + 8 files changed, 62 insertions(+), 19 deletions(-) diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 134b5edeb..1377afd71 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -5,9 +5,11 @@ import { IDSCheckResult } from "./types"; import { UUID } from "../../../utils"; import { IDSFacet } from "./facets"; +type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3_ADD2"; + export class IDSSpecification { name: string; - ifcVersion = new Set(); + ifcVersion = new Set(); identifier? = UUID.create(); description?: string; instructions?: string; @@ -17,11 +19,7 @@ export class IDSSpecification { protected components: Components; - constructor( - components: Components, - name: string, - ifcVersion: FRAGS.IfcSchema[], - ) { + constructor(components: Components, name: string, ifcVersion: IfcVersion[]) { this.components = components; this.name = name; for (const version of ifcVersion) { @@ -85,10 +83,10 @@ export class IDSSpecification { const xml = ` - ${[...this.applicability].map((applicability) => applicability.serialize())} + ${[...this.applicability].map((facet) => facet.serialize("applicability"))} - ${[...this.requirements].map((requirement) => requirement.serialize())} + ${[...this.requirements].map((facet) => facet.serialize("requirement"))} `; return xml; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts index de549df9d..10965a711 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Attribute.ts @@ -15,10 +15,17 @@ export class IDSAttribute extends IDSFacet { this.name = name; } - serialize() { + serialize(type: "applicability" | "requirement") { const nameXML = getParameterXML("Name", this.name); const valueXML = getParameterXML("Value", this.value); - return ` + let attributes = ""; + if (type === "requirement") { + attributes += `cardinality="${this.cardinality}"`; + attributes += this.instructions + ? `instructions="${this.instructions}"` + : ""; + } + return ` ${nameXML} ${valueXML} `; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts index 2a9355eb4..b2ef5fc6c 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Classification.ts @@ -18,10 +18,18 @@ export class IDSClassification extends IDSFacet { this.system = system; } - serialize() { + serialize(type: "applicability" | "requirement") { const systemXML = getParameterXML("System", this.system); const valueXML = getParameterXML("Value", this.value); - return ` + let attributes = ""; + if (type === "requirement") { + attributes += `cardinality="${this.cardinality}"`; + attributes += this.uri ? `uri=${this.uri}` : ""; + attributes += this.instructions + ? `instructions="${this.instructions}"` + : ""; + } + return ` ${systemXML} ${valueXML} `; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts index 555611867..675de0a83 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Entity.ts @@ -16,10 +16,17 @@ export class IDSEntity extends IDSFacet { this.name = name; } - serialize() { + serialize(type: "applicability" | "requirement") { const nameXML = getParameterXML("Name", this.name); const predefinedTypeXML = getParameterXML("Name", this.predefinedType); - return ` + let attributes = ""; + if (type === "requirement") { + attributes += `cardinality="${this.cardinality}"`; + attributes += this.instructions + ? `instructions="${this.instructions}"` + : ""; + } + return ` ${nameXML} ${predefinedTypeXML} `; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts index b0c496751..01d2c0212 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Facet.ts @@ -141,5 +141,5 @@ export abstract class IDSFacet { model?: FRAGS.FragmentsGroup, ): Promise; - abstract serialize(): string; + abstract serialize(type: "applicability" | "requirement"): string; } diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts index de6082382..4248d2853 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Material.ts @@ -1,3 +1,4 @@ +import { getParameterXML } from "../exporters/parameter"; import { IDSFacetParameter } from "../types"; import { IDSFacet } from "./Facet"; @@ -7,8 +8,20 @@ export class IdsMaterialFacet extends IDSFacet { value?: IDSFacetParameter; uri?: string; - serialize() { - return ""; + serialize(type: "applicability" | "requirement") { + if (!(this.value && this.uri)) return ""; + const valueXML = getParameterXML("Value", this.value); + let attributes = ""; + if (type === "requirement") { + attributes += `cardinality="${this.cardinality}"`; + attributes += this.uri ? `uri=${this.uri}` : ""; + attributes += this.instructions + ? `instructions="${this.instructions}"` + : ""; + } + return ` + ${valueXML} +`; } async getEntities() { diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts index 741db7d22..fb6494e97 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/Property.ts @@ -30,11 +30,20 @@ export class IDSProperty extends IDSFacet { this.baseName = baseName; } - serialize() { + serialize(type: "applicability" | "requirement") { const propertySetXML = getParameterXML("PropertySet", this.propertySet); const baseNameXML = getParameterXML("BaseName", this.baseName); const valueXML = getParameterXML("Value", this.value); - return ` + const dataTypeXML = this.dataType ? `dataType=${this.dataType}` : ""; + let attributes = ""; + if (type === "requirement") { + attributes += `cardinality="${this.cardinality}"`; + attributes += this.uri ? `uri=${this.uri}` : ""; + attributes += this.instructions + ? `instructions="${this.instructions}"` + : ""; + } + return ` ${propertySetXML} ${baseNameXML} ${valueXML} diff --git a/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts b/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts index 628151076..1e98ecb64 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/importers/entity.ts @@ -9,6 +9,7 @@ export const createEntityFacets = (components: Components, elements: any) => { const name = getParameterValue(nameParameter); if (!name) continue; const facet = new IDSEntity(components, name); + if (element.cardinality) facet.cardinality = element.cardinality; facet.predefinedType = getParameterValue(element.predefinedType); facets.push(facet); } From d2a03cfaf67a059cdb2325ee758c11b9df50c671 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Wed, 25 Sep 2024 09:30:18 -0500 Subject: [PATCH 43/51] types updated --- packages/core/src/openbim/IDSSpecifications/index.ts | 10 ++++++++-- .../src/openbim/IDSSpecifications/src/Specification.ts | 4 +--- .../core/src/openbim/IDSSpecifications/src/types.ts | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts index e297f863c..ff56c6625 100644 --- a/packages/core/src/openbim/IDSSpecifications/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -1,7 +1,13 @@ import * as FRAGS from "@thatopen/fragments"; import { XMLParser } from "fast-xml-parser"; import { Component, DataMap } from "../../core/Types"; -import { IDSCheckResult, IDSFacet, IDSInfo, IDSSpecification } from "./src"; +import { + IDSCheckResult, + IDSFacet, + IDSInfo, + IDSSpecification, + IfcVersion, +} from "./src"; import { Components } from "../../core"; import { createEntityFacets, @@ -46,7 +52,7 @@ export class IDSSpecifications extends Component { return { pass, fail }; } - create(name: string, ifcVersion: FRAGS.IfcSchema[]) { + create(name: string, ifcVersion: IfcVersion[]) { const specification = new IDSSpecification( this.components, name, diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 1377afd71..293ef63b9 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -1,12 +1,10 @@ import * as FRAGS from "@thatopen/fragments"; import { Components } from "../../../core/Components"; import { DataSet } from "../../../core/Types"; -import { IDSCheckResult } from "./types"; +import { IDSCheckResult, IfcVersion } from "./types"; import { UUID } from "../../../utils"; import { IDSFacet } from "./facets"; -type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3_ADD2"; - export class IDSSpecification { name: string; ifcVersion = new Set(); diff --git a/packages/core/src/openbim/IDSSpecifications/src/types.ts b/packages/core/src/openbim/IDSSpecifications/src/types.ts index 1961d6ba5..8857f5397 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/types.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/types.ts @@ -1,3 +1,5 @@ +export type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3_ADD2"; + export type IDSFacetParameterName = | "Name" | "PredefinedType" From e4fa9e94f7d9a441a9e7315bdae1274ec5bd783a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 26 Sep 2024 11:04:35 +0200 Subject: [PATCH 44/51] wip: add ifcfinder serialization --- index.html | 1 + .../core/src/fragments/IfcLoader/example.ts | 38 +- packages/core/src/ifc/IfcFinder/example.html | 67 +++ packages/core/src/ifc/IfcFinder/example.ts | 386 ++++++++++++++++++ packages/core/src/ifc/IfcFinder/index.ts | 20 +- .../src/ifc/IfcFinder/src/ifc-basic-query.ts | 23 +- .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 77 +++- .../ifc/IfcFinder/src/ifc-property-query.ts | 24 +- .../src/ifc/IfcFinder/src/ifc-query-group.ts | 36 +- packages/core/src/ifc/IfcFinder/src/types.ts | 8 + 10 files changed, 668 insertions(+), 12 deletions(-) create mode 100644 packages/core/src/ifc/IfcFinder/example.html create mode 100644 packages/core/src/ifc/IfcFinder/example.ts diff --git a/index.html b/index.html index e6dd6c9e3..85a10e563 100644 --- a/index.html +++ b/index.html @@ -47,6 +47,7 @@

Choose an example

core/IfcRelationsIndexer core/IfcPropertiesManager core/IfcJsonExporter +core/IfcFinder core/IfcPropertiesTiler core/IfcLoader core/IfcGeometryTiler diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index a76498b8f..2423154a9 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -235,33 +235,59 @@ window.addEventListener("keydown", async (e) => { world.scene.three.add(model); const start = performance.now(); + const finder = components.get(OBC.IfcFinder); const queryGroup = finder.create(); queryGroup.add( new OBC.IfcPropertyQuery(components, { - name: "pset", + name: "external", inclusive: false, rules: [ { type: "property", name: /.*/, - value: /Unconnected Height/, + value: /IsExternal/, }, { - type: "operator", - value: 3, - operator: ">", + type: "property", name: /.*/, + value: /\.T\./, }, ], }), ); + // queryGroup.add( + // new OBC.IfcPropertyQuery(components, { + // name: "height", + // inclusive: false, + // rules: [ + // { + // type: "property", + // name: /.*/, + // value: /Unconnected Height/, + // }, + // { + // type: "operator", + // value: 3, + // operator: ">", + // name: /.*/, + // }, + // ], + // }), + // ); + await queryGroup.update(model.uuid, file); - const items = queryGroup.items; + const exported = queryGroup.export(); + + finder.delete(queryGroup.id); + const newGroup = finder.create(); + newGroup.import(exported); + + const items = newGroup.items; console.log(items); highlighter.highlightByID("select", items, true, true); diff --git a/packages/core/src/ifc/IfcFinder/example.html b/packages/core/src/ifc/IfcFinder/example.html new file mode 100644 index 000000000..74af53031 --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/example.html @@ -0,0 +1,67 @@ + + + + + + + + + + + IfcFinder + + + + +
+ + + + \ No newline at end of file diff --git a/packages/core/src/ifc/IfcFinder/example.ts b/packages/core/src/ifc/IfcFinder/example.ts new file mode 100644 index 000000000..2423154a9 --- /dev/null +++ b/packages/core/src/ifc/IfcFinder/example.ts @@ -0,0 +1,386 @@ +/* MD +### 🏢 Loading IFC files +--- + +IFC is the most common format to share BIM data openly. Our libraries are able to load, navigate and even create and edit them directly. In this tutorial, you'll learn how to open an IFC model in the 3D scene. + +:::tip IFC? + +If you are not famliar with the construction industry, this might be the first time you come across this term. It stands for Industry Foundation Classes, and it's the most widespread standard for sharing BIM data freely, without depending on specific software manufacturers and their propietary formats. + +::: + +In this tutorial, we will import: + +- `web-ifc` to get some IFC items. +- `@thatopen/ui` to add some simple and cool UI menus. +- `@thatopen/components` to set up the barebone of our app. +- `Stats.js` (optional) to measure the performance of our app. +*/ + +import * as WEBIFC from "web-ifc"; +import * as BUI from "@thatopen/ui"; +import Stats from "stats.js"; +import * as OBCF from "@thatopen/components-front/src"; +import * as OBC from "../.."; + +/* MD + ### 🌎 Setting up a simple scene + --- + + We will start by creating a simple scene with a camera and a renderer. If you don't know how to set up a scene, you can check the Worlds tutorial. +*/ + +const container = document.getElementById("container")!; + +const components = new OBC.Components(); + +const worlds = components.get(OBC.Worlds); + +const world = worlds.create< + OBC.SimpleScene, + OBC.SimpleCamera, + OBC.SimpleRenderer +>(); + +world.scene = new OBC.SimpleScene(components); +world.renderer = new OBC.SimpleRenderer(components, container); +world.camera = new OBC.SimpleCamera(components); + +components.init(); + +world.camera.controls.setLookAt(12, 6, 8, 0, 0, -10); + +world.scene.setup(); + +const grids = components.get(OBC.Grids); +grids.create(world); + +/* MD + + We'll make the background of the scene transparent so that it looks good in our docs page, but you don't have to do that in your app! + +*/ + +world.scene.three.background = null; + +/* MD + ### 🚗🏎️ Getting IFC and fragments + --- + When we read an IFC file, we convert it to a geometry called Fragments. Fragments are a lightweight representation of geometry built on top of THREE.js `InstancedMesh` to make it easy to work with BIM data efficiently. All the BIM geometry you see in our libraries are Fragments, and they are great: they are lightweight, they are fast and we have tons of tools to work with them. But fragments are not used outside our libraries. So how can we convert an IFC file to fragments? Let's check out how: + */ + +const fragments = components.get(OBC.FragmentsManager); +const fragmentIfcLoader = components.get(OBC.IfcLoader); + +/* MD + :::info Why not just IFC? + + IFC is nice because it lets us exchange data with many tools in the AECO industry. But your graphics card doesn't understand IFC. It only understands one thing: triangles. So we must convert IFC to triangles. There are many ways to do it, some more efficient than others. And that's exactly what Fragments are: a very efficient way to display the triangles coming from IFC files. + + ::: + + Once Fragments have been generated, you can export them and then load them back directly, without needing the original IFC file. Why would you do that? Well, because fragments can load +10 times faster than IFC. And the reason is very simple. When reading an IFC, we must parse the file, read the implicit geometry, convert it to triangles (Fragments) and send it to the GPU. When reading fragments, we just take the triangles and send them, so it's super fast. + + :::danger How to use Fragments? + + If you want to find out more about Fragments, check out the Fragments Manager tutorial. + + ::: + + + ### 🔭🔧 Calibrating the converter + --- + Now, we need to configure the path of the WASM files. What's WASM? It's a technology that lets us run C++ on the browser, which means that we can load IFCs super fast! These files are the compilation of our `web-ifc` library. You can find them in the github repo and in NPM. These files need to be available to our app, so you have 2 options: + + - Download them and serve them statically. + - Get them from a remote server. + + The easiest way is getting them from unpkg, and the cool thing is that you don't need to do it manually! It can be done directly by the tool just by writing the following: + */ + +await fragmentIfcLoader.setup(); + +// If you want to the path to unpkg manually, then you can skip the line +// above and set them manually as below: +// fragmentIfcLoader.settings.wasm = { +// path: "https://unpkg.com/web-ifc@0.0.56/", +// absolute: true, +// }; + +/* MD + Awesome! Optionally, we can exclude categories that we don't want to convert to fragments like very easily: +*/ + +const excludedCats = [ + WEBIFC.IFCTENDONANCHOR, + WEBIFC.IFCREINFORCINGBAR, + WEBIFC.IFCREINFORCINGELEMENT, +]; + +for (const cat of excludedCats) { + fragmentIfcLoader.settings.excludedCategories.add(cat); +} + +/* MD + We can further configure the conversion using the `webIfc` object. In this example, we will make the IFC model go to the origin of the scene (don't worry, this supports model federation): + */ + +fragmentIfcLoader.settings.webIfc.COORDINATE_TO_ORIGIN = true; + +/* MD + ### 🚗🔥 Loading the IFC + --- + Next, let's define a function to load the IFC programmatically. We have hardcoded the path to one of our IFC files, but feel free to do this with any of your own files! + + :::info Opening local IFCs + + Keep in mind that the browser can't access the file of your computer directly, so you will need to use the Open File API to open local files. + + ::: +*/ + +async function loadIfc() { + const file = await fetch( + "https://thatopen.github.io/engine_components/resources/small.ifc", + ); + const data = await file.arrayBuffer(); + const buffer = new Uint8Array(data); + const model = await fragmentIfcLoader.load(buffer); + model.name = "example"; + world.scene.three.add(model); +} + +/* MD + If you want to get the resulted model every time a new model is loaded, you can subscribe to the following event anywhere in your app: +*/ + +fragments.onFragmentsLoaded.add((model) => { + console.log(model); +}); + +/* MD + ### 🎁 Exporting the result to fragments + --- + Once you have your precious fragments, you might want to save them so that you don't need to open this IFC file each time your user gets into your app. Instead, the next time you can load the fragments directly. Defining a function to export fragments is as easy as this: +*/ + +function download(file: File) { + const link = document.createElement("a"); + link.href = URL.createObjectURL(file); + link.download = file.name; + document.body.appendChild(link); + link.click(); + link.remove(); +} + +async function exportFragments() { + if (!fragments.groups.size) { + return; + } + const group = Array.from(fragments.groups.values())[0]; + const data = fragments.export(group); + download(new File([new Blob([data])], "small.frag")); + + const properties = group.getLocalProperties(); + if (properties) { + download(new File([JSON.stringify(properties)], "small.json")); + } +} + +/* MD + ### 🧠🧼 Cleaning memory + --- + Now, just like in the `FragmentManager` tutorial, you will need to dispose the memory if your user wants to reset the state of the scene, especially if you are using Single Page Application technologies like React, Angular, Vue, etc. To do that, you can simply call the `dispose` method: +*/ + +function disposeFragments() { + fragments.dispose(); +} + +/* MD + That's it! Congrats, now you can load IFC files into your app, generate the 3D geometry and property data for them and navigate them in 3D. In other tutorials, you'll find tons of tools to work with them and create amazing BIM apps! See you there. 💪 + + ### ⏱️ Measuring the performance (optional) + --- + + We'll use the [Stats.js](https://github.com/mrdoob/stats.js) to measure the performance of our app. We will add it to the top left corner of the viewport. This way, we'll make sure that the memory consumption and the FPS of our app are under control. +*/ + +const stats = new Stats(); +stats.showPanel(2); +document.body.append(stats.dom); +stats.dom.style.left = "0px"; +stats.dom.style.zIndex = "unset"; +world.renderer.onBeforeUpdate.add(() => stats.begin()); +world.renderer.onAfterUpdate.add(() => stats.end()); + +const highlighter = components.get(OBCF.Highlighter) as OBCF.Highlighter; +highlighter.setup({ world }); + +window.addEventListener("keydown", async (e) => { + if (e.code === "KeyP") { + const [fileHandle] = await window.showOpenFilePicker(); + // console.log(fileHandle); + const file = await fileHandle.getFile(); + + const model = await fragmentIfcLoader.load( + new Uint8Array(await file.arrayBuffer()), + ); + + const indexer = components.get(OBC.IfcRelationsIndexer); + await indexer.process(model); + + model.name = "example"; + world.scene.three.add(model); + + const start = performance.now(); + + const finder = components.get(OBC.IfcFinder); + + const queryGroup = finder.create(); + + queryGroup.add( + new OBC.IfcPropertyQuery(components, { + name: "external", + inclusive: false, + rules: [ + { + type: "property", + name: /.*/, + value: /IsExternal/, + }, + { + type: "property", + name: /.*/, + value: /\.T\./, + }, + ], + }), + ); + + // queryGroup.add( + // new OBC.IfcPropertyQuery(components, { + // name: "height", + // inclusive: false, + // rules: [ + // { + // type: "property", + // name: /.*/, + // value: /Unconnected Height/, + // }, + // { + // type: "operator", + // value: 3, + // operator: ">", + // name: /.*/, + // }, + // ], + // }), + // ); + + await queryGroup.update(model.uuid, file); + + const exported = queryGroup.export(); + + finder.delete(queryGroup.id); + const newGroup = finder.create(); + newGroup.import(exported); + + const items = newGroup.items; + console.log(items); + highlighter.highlightByID("select", items, true, true); + + console.log(`Time: ${performance.now() - start}`); + } + + // if (e.code === "KeyO") { + // queries.push(new OBC.PropertyToElementsQuery()); + // + // const [fileHandle] = await window.showOpenFilePicker(); + // // console.log(fileHandle); + // file = await fileHandle.getFile(); + // + // const start = performance.now(); + // + // const finder = components.get(OBC.IfcFinder); + // + // const result = await finder.find(file, queries); + // + // console.log(result); + // console.log(queries); + // console.log(`Time: ${performance.now() - start}`); + // } +}); + +/* MD + ### 🧩 Adding some UI + --- + + We will use the `@thatopen/ui` library to add some simple and cool UI elements to our app. First, we need to call the `init` method of the `BUI.Manager` class to initialize the library: +*/ + +BUI.Manager.init(); + +/* MD +Now we will add some UI to explode and restore our BIM model, which can be easily done with a checkbox that determines whether a model is exploded or not. For more information about the UI library, you can check the specific documentation for it! +*/ + +const panel = BUI.Component.create(() => { + return BUI.html` + + + + + + + + + + + + + + + + + `; +}); + +document.body.append(panel); + +/* MD + And we will make some logic that adds a button to the screen when the user is visiting our app from their phone, allowing to show or hide the menu. Otherwise, the menu would make the app unusable. +*/ + +const button = BUI.Component.create(() => { + return BUI.html` + + + `; +}); + +document.body.append(button); + +/* MD + ### 🎉 Wrap up + --- + + That's it! You have created an app that can load IFC files, convert them to 3D fragments and navigate them in 3D. Fantastic job! For bigger IFC files, instead of reading them directly every time, you can store the fragments and properties and load them instead of the original IFC. For even bigger files, you can use streaming, which we also cover in other tutorials! +*/ diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 921df2ef3..7c46907ec 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -36,9 +36,25 @@ export class IfcFinder extends Component { super(components); } + import(data: { [groupID: string]: any }) { + for (const id in data) { + const group = new IfcQueryGroup(this.components); + group.import(data[id]); + this.list.set(id, group); + } + } + + export() { + const result: { [groupID: string]: any } = {}; + for (const [id, group] of this.list) { + result[id] = group.export(); + } + return result; + } + create() { - const group = new IfcQueryGroup(); - this.list.set(group.uuid, group); + const group = new IfcQueryGroup(this.components); + this.list.set(group.id, group); return group; } diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts index 0f96f4aa8..f6336a78f 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts @@ -1,5 +1,5 @@ import * as FRAGS from "@thatopen/fragments"; -import { IfcFinderRule } from "./types"; +import { IfcFinderRule, SerializedQuery } from "./types"; import { IfcFinderQuery } from "./ifc-finder-query"; import { Components } from "../../../core"; import { FragmentsManager } from "../../../fragments"; @@ -7,6 +7,8 @@ import { FragmentsManager } from "../../../fragments"; export class IfcBasicQuery extends IfcFinderQuery { name: string; + static type = "IfcBasicQuery" as const; + get items() { const fragments = this.components.get(FragmentsManager); const maps: FRAGS.FragmentIdMap[] = []; @@ -43,6 +45,12 @@ export class IfcBasicQuery extends IfcFinderQuery { this.needsUpdate.set(modelID, false); } + export() { + const data = this.getData(); + data.type = IfcBasicQuery.type; + return data; + } + protected findInLines(modelID: string, lines: string[]) { for (const line of lines) { const filtersPass = this.testRules(line); @@ -53,3 +61,16 @@ export class IfcBasicQuery extends IfcFinderQuery { } } } + +IfcFinderQuery.importers.set( + IfcBasicQuery.type, + (components: Components, data: SerializedQuery) => { + const query = new IfcBasicQuery(components, { + name: data.name, + rules: IfcFinderQuery.importRules(data.rules), + inclusive: data.inclusive, + }); + query.ids = IfcFinderQuery.importIds(data); + return query; + }, +); diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts index 930f5c486..247a87543 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -1,7 +1,7 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; import { ifcCategoryCase } from "../../Utils"; -import { IfcFinderRule } from "./types"; +import { IfcFinderRule, SerializedQuery } from "./types"; import { Components } from "../../../core"; export abstract class IfcFinderQuery { @@ -19,6 +19,13 @@ export abstract class IfcFinderQuery { components: Components; + static importers = new Map< + string, + (components: Components, data: any) => IfcFinderQuery + >(); + + abstract export(): { [key: string]: any }; + abstract update(modelID: string, file: File): Promise; protected abstract findInLines(modelID: string, lines: string[]): void; @@ -27,6 +34,40 @@ export abstract class IfcFinderQuery { this.components = components; } + static import(components: Components, data: { [id: string]: any }) { + const newQuery = IfcFinderQuery.importers.get(data.type); + if (!newQuery) { + console.warn(`Invalid query data:.`, data); + return null; + } + return newQuery(components, data); + } + + static importRules(serializedRules: { [key: string]: any }[]) { + const rules: IfcFinderRule[] = []; + for (const serializedRule of serializedRules) { + const rule: Partial = {}; + for (const id in serializedRule) { + const item = serializedRule[id]; + if (item.regexp) { + rule[id as keyof IfcFinderRule] = new RegExp(item.value) as any; + } else { + rule[id as keyof IfcFinderRule] = item; + } + } + rules.push(rule as IfcFinderRule); + } + return rules; + } + + static importIds(data: SerializedQuery) { + const ids: { [modelID: string]: Set } = {}; + for (const modelID in data.ids) { + ids[modelID] = new Set(data.ids[modelID]); + } + return ids; + } + clear(modelID: string) { delete this.ids[modelID]; this.needsUpdate.delete(modelID); @@ -39,6 +80,40 @@ export abstract class IfcFinderQuery { this.ids[modelID].add(id); } + protected getData() { + const ids: { [modelID: string]: number[] } = {}; + for (const modelID in this.ids) { + ids[modelID] = Array.from(this.ids[modelID]); + } + + const rules = this.exportRules(); + + return { + name: this.name, + inclusive: this.inclusive, + type: "IfcFinderQuery", + ids, + rules, + } as SerializedQuery; + } + + protected exportRules(): { [key: string]: any }[] { + const rules: { [key: string]: any }[] = []; + for (const rule of this.rules) { + const serializedRule: { [key: string]: any } = {}; + for (const id in rule) { + const item = rule[id as keyof IfcFinderRule]; + if (item instanceof RegExp) { + serializedRule[id] = { regexp: true, value: item.source }; + } else { + serializedRule[id] = item; + } + } + rules.push(serializedRule); + } + return rules; + } + protected findInFile(modelID: string, file: File) { return new Promise((resolve) => { const reader = new FileReader(); diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts index eaee66b6d..e3e6c6b92 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts @@ -1,6 +1,6 @@ import * as FRAGS from "@thatopen/fragments"; import { IfcFinderQuery } from "./ifc-finder-query"; -import { IfcOperatorRule, IfcPropertyRule } from "./types"; +import { IfcOperatorRule, IfcPropertyRule, SerializedQuery } from "./types"; import { Components } from "../../../core"; import { IfcRelationsIndexer } from "../../IfcRelationsIndexer"; import { FragmentsManager } from "../../../fragments"; @@ -8,6 +8,8 @@ import { FragmentsManager } from "../../../fragments"; export class IfcPropertyQuery extends IfcFinderQuery { name: string; + static type = "IfcPropertyQuery" as const; + private psets: string[] = []; get items() { @@ -51,6 +53,12 @@ export class IfcPropertyQuery extends IfcFinderQuery { this.inclusive = data.inclusive; } + export() { + const data = this.getData(); + data.type = IfcPropertyQuery.type; + return data; + } + async update(modelID: string, file: File) { // 1. Gather all propertysinglevalues that match the filters // also gather all ifcpropertysets and save them in this.psets @@ -112,3 +120,17 @@ export class IfcPropertyQuery extends IfcFinderQuery { } } } + +IfcFinderQuery.importers.set( + IfcPropertyQuery.type, + (components: Components, data: SerializedQuery) => { + type PropRules = (IfcPropertyRule | IfcOperatorRule)[]; + const query = new IfcPropertyQuery(components, { + name: data.name, + inclusive: data.inclusive, + rules: IfcFinderQuery.importRules(data.rules) as PropRules, + }); + query.ids = IfcFinderQuery.importIds(data); + return query; + }, +); diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts index 9e05f6343..0cf315a0e 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts @@ -1,14 +1,17 @@ import * as FRAGS from "@thatopen/fragments"; import * as THREE from "three"; import { IfcFinderQuery } from "./ifc-finder-query"; +import { Components } from "../../../core"; export class IfcQueryGroup { list = new Map(); - uuid = THREE.MathUtils.generateUUID(); + id = THREE.MathUtils.generateUUID(); mode: "combine" | "intersect" = "intersect"; + components: Components; + get queries() { return new Set(this.list.values()); } @@ -25,6 +28,10 @@ export class IfcQueryGroup { return FRAGS.FragmentUtils.intersect(maps); } + constructor(components: Components) { + this.components = components; + } + add(query: IfcFinderQuery) { if (this.list.has(query.name)) { throw new Error( @@ -40,6 +47,33 @@ export class IfcQueryGroup { } } + import(data: { + mode: "combine" | "intersect"; + id: string; + queries: { [guid: string]: any }; + }) { + this.mode = data.mode; + this.id = data.id; + for (const id in data.queries) { + const query = IfcFinderQuery.import(this.components, data.queries[id]); + if (query) { + this.list.set(id, query); + } + } + } + + export() { + const queries: { [guid: string]: any } = {}; + for (const [id, query] of this.list) { + queries[id] = query.export(); + } + return { + mode: this.mode, + id: this.id, + queries, + }; + } + async update(modelID: string, file: File) { for (const query of this.queries) { const needsUpdate = query.needsUpdate.get(modelID); diff --git a/packages/core/src/ifc/IfcFinder/src/types.ts b/packages/core/src/ifc/IfcFinder/src/types.ts index 40ad4a627..d5848968d 100644 --- a/packages/core/src/ifc/IfcFinder/src/types.ts +++ b/packages/core/src/ifc/IfcFinder/src/types.ts @@ -17,3 +17,11 @@ export interface IfcOperatorRule { } export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule | IfcOperatorRule; + +export type SerializedQuery = { + name: string; + inclusive: boolean; + type: string; + ids: { [modelID: string]: number[] }; + rules: { [key: string]: any }[]; +}; From d8d2efd0603c43c2dd09a440be9be5fa38bd9256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 26 Sep 2024 12:42:51 +0200 Subject: [PATCH 45/51] wip: add finder example --- packages/core/src/ifc/IfcFinder/example.ts | 332 ++++++------------ .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 7 +- 2 files changed, 113 insertions(+), 226 deletions(-) diff --git a/packages/core/src/ifc/IfcFinder/example.ts b/packages/core/src/ifc/IfcFinder/example.ts index 2423154a9..d7a2bd295 100644 --- a/packages/core/src/ifc/IfcFinder/example.ts +++ b/packages/core/src/ifc/IfcFinder/example.ts @@ -2,27 +2,24 @@ ### 🏢 Loading IFC files --- -IFC is the most common format to share BIM data openly. Our libraries are able to load, navigate and even create and edit them directly. In this tutorial, you'll learn how to open an IFC model in the 3D scene. +IFC is complex, and sometimes we want to look for items using complex filters. For instance, imagine we want to target all items in a file that have a property called "FireProtection". This is due to the indirection present in most IFC files. Luckily for you, we have a component to easily perform complex queries on any IFC: the IfcFinder. In this tutorial, you'll learn how to use it. -:::tip IFC? +:::tip What does the finder do? -If you are not famliar with the construction industry, this might be the first time you come across this term. It stands for Industry Foundation Classes, and it's the most widespread standard for sharing BIM data freely, without depending on specific software manufacturers and their propietary formats. +The finder is a powerful text scanner that can make complex queries in one or multiple IFC files. You can use regular expressions, operators like ">", "<", combine multiple filters, etc. ::: In this tutorial, we will import: -- `web-ifc` to get some IFC items. - `@thatopen/ui` to add some simple and cool UI menus. - `@thatopen/components` to set up the barebone of our app. - `Stats.js` (optional) to measure the performance of our app. */ -import * as WEBIFC from "web-ifc"; import * as BUI from "@thatopen/ui"; import Stats from "stats.js"; -import * as OBCF from "@thatopen/components-front/src"; -import * as OBC from "../.."; +import * as OBC from "@thatopen/components"; /* MD ### 🌎 Setting up a simple scene @@ -65,142 +62,106 @@ grids.create(world); world.scene.three.background = null; /* MD - ### 🚗🏎️ Getting IFC and fragments + ### 🧳 Loading a BIM model --- - When we read an IFC file, we convert it to a geometry called Fragments. Fragments are a lightweight representation of geometry built on top of THREE.js `InstancedMesh` to make it easy to work with BIM data efficiently. All the BIM geometry you see in our libraries are Fragments, and they are great: they are lightweight, they are fast and we have tons of tools to work with them. But fragments are not used outside our libraries. So how can we convert an IFC file to fragments? Let's check out how: - */ -const fragments = components.get(OBC.FragmentsManager); -const fragmentIfcLoader = components.get(OBC.IfcLoader); + We'll start by adding a BIM model to our scene. That model is already converted to fragments, so it will load much faster than if we loaded the IFC fileResponse. -/* MD - :::info Why not just IFC? + :::tip Fragments? - IFC is nice because it lets us exchange data with many tools in the AECO industry. But your graphics card doesn't understand IFC. It only understands one thing: triangles. So we must convert IFC to triangles. There are many ways to do it, some more efficient than others. And that's exactly what Fragments are: a very efficient way to display the triangles coming from IFC files. - - ::: - - Once Fragments have been generated, you can export them and then load them back directly, without needing the original IFC file. Why would you do that? Well, because fragments can load +10 times faster than IFC. And the reason is very simple. When reading an IFC, we must parse the file, read the implicit geometry, convert it to triangles (Fragments) and send it to the GPU. When reading fragments, we just take the triangles and send them, so it's super fast. - - :::danger How to use Fragments? - - If you want to find out more about Fragments, check out the Fragments Manager tutorial. + If you are not familiar with fragments, check out the IfcLoader tutorial! ::: +*/ +const fragments = new OBC.FragmentsManager(components); +const fragFile = await fetch( + "https://thatopen.github.io/engine_components/resources/small.frag", +); +const data = await fragFile.arrayBuffer(); +const buffer = new Uint8Array(data); +const model = fragments.load(buffer); +world.scene.three.add(model); + +const indexer = components.get(OBC.IfcRelationsIndexer); +const relationsFile = await fetch( + "https://thatopen.github.io/engine_components/resources/small-relations.json", +); +const relations = indexer.getRelationsMapFromJSON(await relationsFile.text()); +indexer.setRelationMap(model, relations); - ### 🔭🔧 Calibrating the converter +/* MD + ### 🔎 Setting up the finder --- - Now, we need to configure the path of the WASM files. What's WASM? It's a technology that lets us run C++ on the browser, which means that we can load IFCs super fast! These files are the compilation of our `web-ifc` library. You can find them in the github repo and in NPM. These files need to be available to our app, so you have 2 options: - - - Download them and serve them statically. - - Get them from a remote server. - - The easiest way is getting them from unpkg, and the cool thing is that you don't need to do it manually! It can be done directly by the tool just by writing the following: - */ -await fragmentIfcLoader.setup(); - -// If you want to the path to unpkg manually, then you can skip the line -// above and set them manually as below: -// fragmentIfcLoader.settings.wasm = { -// path: "https://unpkg.com/web-ifc@0.0.56/", -// absolute: true, -// }; - -/* MD - Awesome! Optionally, we can exclude categories that we don't want to convert to fragments like very easily: + Now, let's get the finder component and create a new queryGroup. A query group is a set of "questions" we can apply to one or many models. */ -const excludedCats = [ - WEBIFC.IFCTENDONANCHOR, - WEBIFC.IFCREINFORCINGBAR, - WEBIFC.IFCREINFORCINGELEMENT, -]; - -for (const cat of excludedCats) { - fragmentIfcLoader.settings.excludedCategories.add(cat); -} +const finder = components.get(OBC.IfcFinder); +const queryGroup = finder.create(); /* MD - We can further configure the conversion using the `webIfc` object. In this example, we will make the IFC model go to the origin of the scene (don't worry, this supports model federation): - */ + Now we need an IFC file to feed to the finder. The finder operates on IFC files directly, so it can perform high-performance text queries. +*/ -fragmentIfcLoader.settings.webIfc.COORDINATE_TO_ORIGIN = true; +const fileResponse = await fetch( + "https://thatopen.github.io/engine_components/resources/small.ifc", +); +const ifcFile = new File([await fileResponse.arrayBuffer()], "example"); /* MD - ### 🚗🔥 Loading the IFC - --- - Next, let's define a function to load the IFC programmatically. We have hardcoded the path to one of our IFC files, but feel free to do this with any of your own files! - - :::info Opening local IFCs - - Keep in mind that the browser can't access the file of your computer directly, so you will need to use the Open File API to open local files. - - ::: + Great! Now, let's create our first query. There are different types of queries. You'll have to pick one or another depending on the type of data you are looking for. In this case we want to check the direct attributes of elements, so we will use an IfcBasicQuery. */ -async function loadIfc() { - const file = await fetch( - "https://thatopen.github.io/engine_components/resources/small.ifc", - ); - const data = await file.arrayBuffer(); - const buffer = new Uint8Array(data); - const model = await fragmentIfcLoader.load(buffer); - model.name = "example"; - world.scene.three.add(model); -} +const basicQuery = new OBC.IfcBasicQuery(components, { + name: "category", + inclusive: false, + rules: [], +}); + +queryGroup.add(basicQuery); /* MD - If you want to get the resulted model every time a new model is loaded, you can subscribe to the following event anywhere in your app: + Great job! Now we have a query, but it's empty. Queries are made of rules. There are rules of different types for different purposes. In this case we want to filter the walls, so let's a */ -fragments.onFragmentsLoaded.add((model) => { - console.log(model); -}); +const categoryRule: OBC.IfcCategoryRule = { + type: "category", + value: /IfcWallStandardCase/, +}; + +basicQuery.rules.push(categoryRule); /* MD - ### 🎁 Exporting the result to fragments - --- - Once you have your precious fragments, you might want to save them so that you don't need to open this IFC file each time your user gets into your app. Instead, the next time you can load the fragments directly. Defining a function to export fragments is as easy as this: + Awesome! Now, our library has better ways to filter by category, so what's the point of the finder? Well, let's make something a bit more complex. Imagine we want to look for any object that has any property (in a pset) with the word "yeso" (plaster in spanish). We can do this easily with the finder using another type of query: a property query. */ -function download(file: File) { - const link = document.createElement("a"); - link.href = URL.createObjectURL(file); - link.download = file.name; - document.body.appendChild(link); - link.click(); - link.remove(); -} - -async function exportFragments() { - if (!fragments.groups.size) { - return; - } - const group = Array.from(fragments.groups.values())[0]; - const data = fragments.export(group); - download(new File([new Blob([data])], "small.frag")); +const propertyRule: OBC.IfcPropertyRule = { + type: "property", + name: /.*/, + value: /yeso/, +}; - const properties = group.getLocalProperties(); - if (properties) { - download(new File([JSON.stringify(properties)], "small.json")); - } -} +const propertyQuery = new OBC.IfcPropertyQuery(components, { + name: "property", + inclusive: false, + rules: [propertyRule], +}); + +queryGroup.add(propertyQuery); /* MD - ### 🧠🧼 Cleaning memory - --- - Now, just like in the `FragmentManager` tutorial, you will need to dispose the memory if your user wants to reset the state of the scene, especially if you are using Single Page Application technologies like React, Angular, Vue, etc. To do that, you can simply call the `dispose` method: + Great! Now, to perform the query we just need to update the group, and we can then get the items resulting from all the queries of the query group. To illustrate this, we'll isolate the found items in the scene: */ -function disposeFragments() { - fragments.dispose(); -} +await queryGroup.update(model.uuid, ifcFile); +const items = queryGroup.items; -/* MD - That's it! Congrats, now you can load IFC files into your app, generate the 3D geometry and property data for them and navigate them in 3D. In other tutorials, you'll find tons of tools to work with them and create amazing BIM apps! See you there. 💪 +const hider = components.get(OBC.Hider); +hider.set(false); +hider.set(true, items); +/* MD ### ⏱️ Measuring the performance (optional) --- @@ -215,104 +176,6 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); -const highlighter = components.get(OBCF.Highlighter) as OBCF.Highlighter; -highlighter.setup({ world }); - -window.addEventListener("keydown", async (e) => { - if (e.code === "KeyP") { - const [fileHandle] = await window.showOpenFilePicker(); - // console.log(fileHandle); - const file = await fileHandle.getFile(); - - const model = await fragmentIfcLoader.load( - new Uint8Array(await file.arrayBuffer()), - ); - - const indexer = components.get(OBC.IfcRelationsIndexer); - await indexer.process(model); - - model.name = "example"; - world.scene.three.add(model); - - const start = performance.now(); - - const finder = components.get(OBC.IfcFinder); - - const queryGroup = finder.create(); - - queryGroup.add( - new OBC.IfcPropertyQuery(components, { - name: "external", - inclusive: false, - rules: [ - { - type: "property", - name: /.*/, - value: /IsExternal/, - }, - { - type: "property", - name: /.*/, - value: /\.T\./, - }, - ], - }), - ); - - // queryGroup.add( - // new OBC.IfcPropertyQuery(components, { - // name: "height", - // inclusive: false, - // rules: [ - // { - // type: "property", - // name: /.*/, - // value: /Unconnected Height/, - // }, - // { - // type: "operator", - // value: 3, - // operator: ">", - // name: /.*/, - // }, - // ], - // }), - // ); - - await queryGroup.update(model.uuid, file); - - const exported = queryGroup.export(); - - finder.delete(queryGroup.id); - const newGroup = finder.create(); - newGroup.import(exported); - - const items = newGroup.items; - console.log(items); - highlighter.highlightByID("select", items, true, true); - - console.log(`Time: ${performance.now() - start}`); - } - - // if (e.code === "KeyO") { - // queries.push(new OBC.PropertyToElementsQuery()); - // - // const [fileHandle] = await window.showOpenFilePicker(); - // // console.log(fileHandle); - // file = await fileHandle.getFile(); - // - // const start = performance.now(); - // - // const finder = components.get(OBC.IfcFinder); - // - // const result = await finder.find(file, queries); - // - // console.log(result); - // console.log(queries); - // console.log(`Time: ${performance.now() - start}`); - // } -}); - /* MD ### 🧩 Adding some UI --- @@ -323,32 +186,51 @@ window.addEventListener("keydown", async (e) => { BUI.Manager.init(); /* MD -Now we will add some UI to explode and restore our BIM model, which can be easily done with a checkbox that determines whether a model is exploded or not. For more information about the UI library, you can check the specific documentation for it! +Now we will add some UI to play around with the Finder, isolating the items that it finds in the scene. For more information about the UI library, you can check the specific documentation for it! */ +const categoryInput = BUI.Component.create(() => { + return BUI.html` + + `; +}); + +const propertyInput = BUI.Component.create(() => { + return BUI.html` + + `; +}); + +const updateFinder = async () => { + basicQuery.clear(); + propertyQuery.clear(); + categoryRule.value = new RegExp(categoryInput.value); + propertyRule.value = new RegExp(propertyInput.value); + await queryGroup.update(model.uuid, ifcFile); + const items = queryGroup.items; + console.log(items); + if (Object.keys(items).length === 0) { + alert("No items found!"); + return; + } + hider.set(false); + hider.set(true, items); +}; + const panel = BUI.Component.create(() => { return BUI.html` - + - - - - - - - @@ -382,5 +264,5 @@ document.body.append(button); ### 🎉 Wrap up --- - That's it! You have created an app that can load IFC files, convert them to 3D fragments and navigate them in 3D. Fantastic job! For bigger IFC files, instead of reading them directly every time, you can store the fragments and properties and load them instead of the original IFC. For even bigger files, you can use streaming, which we also cover in other tutorials! + That's it! You have created an app that can make complex text queries in an IFC. Congratulations! */ diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts index 247a87543..e9c7e1e56 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -68,7 +68,12 @@ export abstract class IfcFinderQuery { return ids; } - clear(modelID: string) { + clear(modelID?: string) { + if (modelID === undefined) { + this.ids = {}; + this.needsUpdate.clear(); + return; + } delete this.ids[modelID]; this.needsUpdate.delete(modelID); } From d66e77575a72def2fae2f3a42db08a5d88ec5282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 26 Sep 2024 17:57:30 +0200 Subject: [PATCH 46/51] wip: add docs for everything --- .../core/src/fragments/IfcLoader/example.ts | 107 +----------------- packages/core/src/ifc/IfcFinder/index.ts | 31 ++++- .../src/ifc/IfcFinder/src/ifc-basic-query.ts | 30 ++++- .../src/ifc/IfcFinder/src/ifc-finder-query.ts | 74 ++++++++++-- .../ifc/IfcFinder/src/ifc-property-query.ts | 18 +++ .../src/ifc/IfcFinder/src/ifc-query-group.ts | 48 +++++++- packages/core/src/ifc/IfcFinder/src/types.ts | 66 +++++++++++ 7 files changed, 249 insertions(+), 125 deletions(-) diff --git a/packages/core/src/fragments/IfcLoader/example.ts b/packages/core/src/fragments/IfcLoader/example.ts index 2423154a9..95f3142b0 100644 --- a/packages/core/src/fragments/IfcLoader/example.ts +++ b/packages/core/src/fragments/IfcLoader/example.ts @@ -21,8 +21,7 @@ In this tutorial, we will import: import * as WEBIFC from "web-ifc"; import * as BUI from "@thatopen/ui"; import Stats from "stats.js"; -import * as OBCF from "@thatopen/components-front/src"; -import * as OBC from "../.."; +import * as OBC from "@thatopen/components"; /* MD ### 🌎 Setting up a simple scene @@ -76,11 +75,11 @@ const fragmentIfcLoader = components.get(OBC.IfcLoader); /* MD :::info Why not just IFC? - IFC is nice because it lets us exchange data with many tools in the AECO industry. But your graphics card doesn't understand IFC. It only understands one thing: triangles. So we must convert IFC to triangles. There are many ways to do it, some more efficient than others. And that's exactly what Fragments are: a very efficient way to display the triangles coming from IFC files. + IFC is nice because it lets us exchange data with many tools in the AECO industry. But your graphics card doesn't understand IFC. It only understands one thing: triangles. So we must convert IFC to triangles. There are many ways to do it, some more efficient than others. And that's exactly what Fragments are: a very efficient way to display the triangles coming from IFC files. ::: - Once Fragments have been generated, you can export them and then load them back directly, without needing the original IFC file. Why would you do that? Well, because fragments can load +10 times faster than IFC. And the reason is very simple. When reading an IFC, we must parse the file, read the implicit geometry, convert it to triangles (Fragments) and send it to the GPU. When reading fragments, we just take the triangles and send them, so it's super fast. + Once Fragments have been generated, you can export them and then load them back directly, without needing the original IFC file. Why would you do that? Well, because fragments can load +10 times faster than IFC. And the reason is very simple. When reading an IFC, we must parse the file, read the implicit geometry, convert it to triangles (Fragments) and send it to the GPU. When reading fragments, we just take the triangles and send them, so it's super fast. :::danger How to use Fragments? @@ -215,104 +214,6 @@ stats.dom.style.zIndex = "unset"; world.renderer.onBeforeUpdate.add(() => stats.begin()); world.renderer.onAfterUpdate.add(() => stats.end()); -const highlighter = components.get(OBCF.Highlighter) as OBCF.Highlighter; -highlighter.setup({ world }); - -window.addEventListener("keydown", async (e) => { - if (e.code === "KeyP") { - const [fileHandle] = await window.showOpenFilePicker(); - // console.log(fileHandle); - const file = await fileHandle.getFile(); - - const model = await fragmentIfcLoader.load( - new Uint8Array(await file.arrayBuffer()), - ); - - const indexer = components.get(OBC.IfcRelationsIndexer); - await indexer.process(model); - - model.name = "example"; - world.scene.three.add(model); - - const start = performance.now(); - - const finder = components.get(OBC.IfcFinder); - - const queryGroup = finder.create(); - - queryGroup.add( - new OBC.IfcPropertyQuery(components, { - name: "external", - inclusive: false, - rules: [ - { - type: "property", - name: /.*/, - value: /IsExternal/, - }, - { - type: "property", - name: /.*/, - value: /\.T\./, - }, - ], - }), - ); - - // queryGroup.add( - // new OBC.IfcPropertyQuery(components, { - // name: "height", - // inclusive: false, - // rules: [ - // { - // type: "property", - // name: /.*/, - // value: /Unconnected Height/, - // }, - // { - // type: "operator", - // value: 3, - // operator: ">", - // name: /.*/, - // }, - // ], - // }), - // ); - - await queryGroup.update(model.uuid, file); - - const exported = queryGroup.export(); - - finder.delete(queryGroup.id); - const newGroup = finder.create(); - newGroup.import(exported); - - const items = newGroup.items; - console.log(items); - highlighter.highlightByID("select", items, true, true); - - console.log(`Time: ${performance.now() - start}`); - } - - // if (e.code === "KeyO") { - // queries.push(new OBC.PropertyToElementsQuery()); - // - // const [fileHandle] = await window.showOpenFilePicker(); - // // console.log(fileHandle); - // file = await fileHandle.getFile(); - // - // const start = performance.now(); - // - // const finder = components.get(OBC.IfcFinder); - // - // const result = await finder.find(file, queries); - // - // console.log(result); - // console.log(queries); - // console.log(`Time: ${performance.now() - start}`); - // } -}); - /* MD ### 🧩 Adding some UI --- @@ -323,7 +224,7 @@ window.addEventListener("keydown", async (e) => { BUI.Manager.init(); /* MD -Now we will add some UI to explode and restore our BIM model, which can be easily done with a checkbox that determines whether a model is exploded or not. For more information about the UI library, you can check the specific documentation for it! +Now we will add some UI to load and unload our BIM model. For more information about the UI library, you can check the specific documentation for it! */ const panel = BUI.Component.create(() => { diff --git a/packages/core/src/ifc/IfcFinder/index.ts b/packages/core/src/ifc/IfcFinder/index.ts index 7c46907ec..1a787ed20 100644 --- a/packages/core/src/ifc/IfcFinder/index.ts +++ b/packages/core/src/ifc/IfcFinder/index.ts @@ -1,4 +1,4 @@ -import { Component, Components, Event } from "../../core"; +import { Component, Components } from "../../core"; import { IfcQueryGroup } from "./src/ifc-query-group"; import { IfcFinderQuery } from "./src"; @@ -14,13 +14,17 @@ export class IfcFinder extends Component { */ static readonly uuid = "0da7ad77-f734-42ca-942f-a074adfd1e3a" as const; - readonly onProgress = new Event(); - /** {@link Component.enabled} */ enabled = true; + /** + * List of all created {@link IfcQueryGroup} instances. + */ list = new Map(); + /** + * List of all queries from all created {@link IfcQueryGroup} instances. + */ get queries() { // return list of all queries traversing all groups const queries = new Set(); @@ -34,8 +38,13 @@ export class IfcFinder extends Component { constructor(components: Components) { super(components); + components.add(IfcFinder.uuid, this); } + /** + * Imports all the query groups provided in the given data. You can generate this data to save the result of queries and persist it over time. + * @param data The data containing the serialized query groups to import. + */ import(data: { [groupID: string]: any }) { for (const id in data) { const group = new IfcQueryGroup(this.components); @@ -44,6 +53,9 @@ export class IfcFinder extends Component { } } + /** + * Exports all the query groups created. You can then import this data back using the import method. + */ export() { const result: { [groupID: string]: any } = {}; for (const [id, group] of this.list) { @@ -52,13 +64,26 @@ export class IfcFinder extends Component { return result; } + /** + * Creates a new {@link IfcQueryGroup}. + */ create() { const group = new IfcQueryGroup(this.components); this.list.set(group.id, group); return group; } + /** + * Creates the {@link IfcQueryGroup} with the given ID. + */ delete(id: string) { this.list.delete(id); } + + /** + * Deletes all {@link IfcQueryGroup} instances. + */ + clear() { + this.list.clear(); + } } diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts index f6336a78f..38be52535 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-basic-query.ts @@ -4,11 +4,23 @@ import { IfcFinderQuery } from "./ifc-finder-query"; import { Components } from "../../../core"; import { FragmentsManager } from "../../../fragments"; +/** + * A query that checks the direct attributes of IFC items. + */ export class IfcBasicQuery extends IfcFinderQuery { + /** + * {@link IfcFinderQuery.name} + */ name: string; + /** + * The type of this query. + */ static type = "IfcBasicQuery" as const; + /** + * {@link IfcFinderQuery.items} + */ get items() { const fragments = this.components.get(FragmentsManager); const maps: FRAGS.FragmentIdMap[] = []; @@ -39,18 +51,24 @@ export class IfcBasicQuery extends IfcFinderQuery { this.inclusive = data.inclusive; } - async update(modelID: string, file: File) { - this.ids[modelID] = new Set(); - await this.findInFile(modelID, file); - this.needsUpdate.set(modelID, false); - } - + /** + * {@link IfcFinderQuery.export} + */ export() { const data = this.getData(); data.type = IfcBasicQuery.type; return data; } + /** + * {@link IfcFinderQuery.update} + */ + async update(modelID: string, file: File) { + this.ids[modelID] = new Set(); + await this.findInFile(modelID, file); + this.needsUpdate.set(modelID, false); + } + protected findInLines(modelID: string, lines: string[]) { for (const line of lines) { const filtersPass = this.testRules(line); diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts index e9c7e1e56..11c8a35cc 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-finder-query.ts @@ -2,38 +2,79 @@ import * as FRAGS from "@thatopen/fragments"; import * as WEBIFC from "web-ifc"; import { ifcCategoryCase } from "../../Utils"; import { IfcFinderRule, SerializedQuery } from "./types"; -import { Components } from "../../../core"; +import { Components, Event } from "../../../core"; +/** + * The base class for all queries used by the {@link IfcFinder}. + */ export abstract class IfcFinderQuery { + /** + * The list of functions to import the queries. If you create your own custom query, you should add its importer here. See the other queries provided by the library for reference. + */ + static importers = new Map< + string, + (components: Components, data: any) => IfcFinderQuery + >(); + + /** + * Event used to notify the progress when performing a query on an IFC file. + */ + readonly onProgress = new Event(); + + /** + * A name given to the instance of the query to identify it. + */ abstract name: string; + /** + * The list of IFC items that this query found across all models. + */ abstract items: FRAGS.FragmentIdMap; + /** + * If false, ALL rules of the query must comply to make a match. If true, ANY rule will be enough to make a match. + */ inclusive = false; + /** + * The list of rules to be applied by this query. + */ rules: IfcFinderRule[] = []; + /** + * The IDs of the match items per model. + */ ids: { [modelID: string]: Set } = {}; + /** + * Whether this query is up to date or not per file. If not, when updating the group where it belongs, it will re-process the given file. + */ needsUpdate = new Map(); - components: Components; - - static importers = new Map< - string, - (components: Components, data: any) => IfcFinderQuery - >(); - + /** + * Export the current data of this query in a serializable object to persist it over time. + */ abstract export(): { [key: string]: any }; + /** + * Perform the search in the given file and save the result. + */ abstract update(modelID: string, file: File): Promise; + protected components: Components; + protected abstract findInLines(modelID: string, lines: string[]): void; protected constructor(components: Components) { this.components = components; } + /** + * Imports a query given its data. This data can be generating using its {@link IfcFinderQuery.export} method. + * + * @param components the instance of {@link Components} used by this app. + * @param data the data of the query to import as a serializable object. + */ static import(components: Components, data: { [id: string]: any }) { const newQuery = IfcFinderQuery.importers.get(data.type); if (!newQuery) { @@ -43,6 +84,11 @@ export abstract class IfcFinderQuery { return newQuery(components, data); } + /** + * Imports the given serialized rules. Only use this when writing your own custom query. See the other queries provided by the library for reference. + * + * @param serializedRules the rules to be parsed. + */ static importRules(serializedRules: { [key: string]: any }[]) { const rules: IfcFinderRule[] = []; for (const serializedRule of serializedRules) { @@ -60,6 +106,11 @@ export abstract class IfcFinderQuery { return rules; } + /** + * Imports the given IDs. Only use this when writing your own custom query. See the other queries provided by the library for reference. + * + * @param data the serialized object representing the query whose IDs to parse. + */ static importIds(data: SerializedQuery) { const ids: { [modelID: string]: Set } = {}; for (const modelID in data.ids) { @@ -68,6 +119,11 @@ export abstract class IfcFinderQuery { return ids; } + /** + * Clears the data of the given model. If not specified, clears all the data. + * + * @param modelID ID of the model whose data to clear. + */ clear(modelID?: string) { if (modelID === undefined) { this.ids = {}; @@ -157,7 +213,7 @@ export abstract class IfcFinderQuery { this.findInLines(modelID, lines); - console.log(start / file.size); + this.onProgress.trigger(start / file.size); start += chunkSize; readTextPart(); diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts index e3e6c6b92..92f96e504 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-property-query.ts @@ -5,13 +5,25 @@ import { Components } from "../../../core"; import { IfcRelationsIndexer } from "../../IfcRelationsIndexer"; import { FragmentsManager } from "../../../fragments"; +/** + * A query that checks the properties in the property sets assigned to IFC items. + */ export class IfcPropertyQuery extends IfcFinderQuery { + /** + * {@link IfcFinderQuery.name} + */ name: string; + /** + * The type of this query. + */ static type = "IfcPropertyQuery" as const; private psets: string[] = []; + /** + * {@link IfcFinderQuery.items} + */ get items() { // Use the indexer to get all items related to the found psets const indexer = this.components.get(IfcRelationsIndexer); @@ -53,12 +65,18 @@ export class IfcPropertyQuery extends IfcFinderQuery { this.inclusive = data.inclusive; } + /** + * {@link IfcFinderQuery.export} + */ export() { const data = this.getData(); data.type = IfcPropertyQuery.type; return data; } + /** + * {@link IfcFinderQuery.update} + */ async update(modelID: string, file: File) { // 1. Gather all propertysinglevalues that match the filters // also gather all ifcpropertysets and save them in this.psets diff --git a/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts index 0cf315a0e..eaad288f7 100644 --- a/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts +++ b/packages/core/src/ifc/IfcFinder/src/ifc-query-group.ts @@ -3,19 +3,39 @@ import * as THREE from "three"; import { IfcFinderQuery } from "./ifc-finder-query"; import { Components } from "../../../core"; +/** + * A group of queries to perform searches in one or many IFC files. + */ export class IfcQueryGroup { + /** + * The list of queries contained in this group. + */ list = new Map(); + /** + * A unique string to identify this group instance. + */ id = THREE.MathUtils.generateUUID(); + /** + * The way this group works when retrieving items. + * - Combine: returns the sum of all items of all queries. + * - Intersect: returns only the common elements of all queries. + */ mode: "combine" | "intersect" = "intersect"; - components: Components; + private _components: Components; + /** + * The list of unique queries contained in this group. + */ get queries() { return new Set(this.list.values()); } + /** + * The items of all the queries contained in this group. The returned data depends on {@link IfcQueryGroup.mode}. + */ get items(): FRAGS.FragmentIdMap { // Returns intersection of getElements of all queries const maps: FRAGS.FragmentIdMap[] = []; @@ -29,9 +49,13 @@ export class IfcQueryGroup { } constructor(components: Components) { - this.components = components; + this._components = components; } + /** + * Adds a new query to this group. + * @param query the query to add. + */ add(query: IfcFinderQuery) { if (this.list.has(query.name)) { throw new Error( @@ -41,12 +65,20 @@ export class IfcQueryGroup { this.list.set(query.name, query); } - clear(modelID: string) { + /** + * Clears the data of the given modelID of all queries contained in this group. If no modelID is provided, clears all data. + * @param modelID the model whose data to remove. + */ + clear(modelID?: string) { for (const query of this.queries) { query.clear(modelID); } } + /** + * Imports data that has been previously exported through {@link IfcQueryGroup.export}. + * @param data the serializable object used to persist a group's data. + */ import(data: { mode: "combine" | "intersect"; id: string; @@ -55,13 +87,16 @@ export class IfcQueryGroup { this.mode = data.mode; this.id = data.id; for (const id in data.queries) { - const query = IfcFinderQuery.import(this.components, data.queries[id]); + const query = IfcFinderQuery.import(this._components, data.queries[id]); if (query) { this.list.set(id, query); } } } + /** + * Exports all the data of this group, so that it can be persisted and imported later using {@link IfcQueryGroup.import}. + */ export() { const queries: { [guid: string]: any } = {}; for (const [id, query] of this.list) { @@ -74,6 +109,11 @@ export class IfcQueryGroup { }; } + /** + * Updates all the queries contained in this group that need an update for the given file. It will skip those where {@link IfcFinderQuery.needsUpdate} is false. + * @param modelID the identifier used to refer to the given file. + * @param file the file to process. + */ async update(modelID: string, file: File) { for (const query of this.queries) { const needsUpdate = query.needsUpdate.get(modelID); diff --git a/packages/core/src/ifc/IfcFinder/src/types.ts b/packages/core/src/ifc/IfcFinder/src/types.ts index d5848968d..5d63122ff 100644 --- a/packages/core/src/ifc/IfcFinder/src/types.ts +++ b/packages/core/src/ifc/IfcFinder/src/types.ts @@ -1,27 +1,93 @@ +/** + * A rule for the {@link IfcFinder} to search items based on their category. + */ export interface IfcCategoryRule { + /** + * The type of this rule. All rules have a fixed type. + */ type: "category"; + + /** + * The category value. It's a regular expression, so you can make complex queries and use ".*" to match all categories. + */ value: RegExp; } +/** + * A rule for the {@link IfcFinder} to search items based on the properties defined in their property sets. + */ export interface IfcPropertyRule { + /** + * The type of this rule. All rules have a fixed type. + */ type: "property"; + + /** + * The name of the property. It's a regular expression, so you can make complex queries and use ".*" to match all names. + */ name: RegExp; + + /** + * The value of the property. It's a regular expression, so you can make complex queries and use ".*" to match all values. + */ value: RegExp; } +/** + * A rule for the {@link IfcFinder} to search items based on the value of a numeric property defined in their property sets. + */ export interface IfcOperatorRule { + /** + * The type of this rule. All rules have a fixed type. + */ type: "operator"; + + /** + * The name of the property. It's a regular expression, so you can make complex queries and use ".*" to match all names. + */ name: RegExp; + + /** + * The value of the property. + */ value: number; + + /** + * The operator to apply to the numeric value. + */ operator: "<" | ">" | "=" | "<=" | ">="; } +/** + * The type of rules that can be used in the queries of the {@link IfcFinder}. + */ export type IfcFinderRule = IfcCategoryRule | IfcPropertyRule | IfcOperatorRule; +/** + * The data type used when the queries of the {@link IfcFinder} export or import query data to persist it. + */ export type SerializedQuery = { + /** + * {@link IfcFinderQuery.name} + */ name: string; + /** + * {@link IfcFinderQuery.inclusive} + */ inclusive: boolean; + + /** + * The type of query. + */ type: string; + + /** + * {@link IfcFinderQuery.ids} + */ ids: { [modelID: string]: number[] }; + + /** + * {@link IfcFinderQuery.rules} + */ rules: { [key: string]: any }[]; }; From 47f95a38e095388ee7477ae6344d7d2ba5088242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Gonz=C3=A1lez=20Viegas?= Date: Thu, 26 Sep 2024 19:19:32 +0200 Subject: [PATCH 47/51] feat(core): add minimap config --- .../src/core/Grids/src/simple-grid-config.ts | 35 +++ .../core/src/core/Grids/src/simple-grid.ts | 1 + packages/core/src/core/MiniMap/example.ts | 22 +- packages/core/src/core/MiniMap/index.ts | 14 +- packages/core/src/core/MiniMap/src/index.ts | 234 +------------- .../src/core/MiniMap/src/mini-map-config.ts | 222 ++++++++++++++ .../core/src/core/MiniMap/src/mini-map.ts | 288 ++++++++++++++++++ 7 files changed, 571 insertions(+), 245 deletions(-) create mode 100644 packages/core/src/core/MiniMap/src/mini-map-config.ts create mode 100644 packages/core/src/core/MiniMap/src/mini-map.ts diff --git a/packages/core/src/core/Grids/src/simple-grid-config.ts b/packages/core/src/core/Grids/src/simple-grid-config.ts index fd2ad9dbe..52219e1b1 100644 --- a/packages/core/src/core/Grids/src/simple-grid-config.ts +++ b/packages/core/src/core/Grids/src/simple-grid-config.ts @@ -19,6 +19,11 @@ type SimpleGridConfigType = { * Configuration interface for the {@link SimpleGrid}. */ export interface SimpleGridConfig { + /** + * Whether the grid is visible or not. + */ + visible: boolean; + /** * The color of the grid lines. */ @@ -76,49 +81,79 @@ export class SimpleGridConfigManager extends Configurator< }, }; + /** + * Whether the grid is visible or not. + */ get visible() { return this._config.visible.value; } + /** + * Whether the grid is visible or not. + */ set visible(value: boolean) { this._config.visible.value = value; this._component.visible = value; } + /** + * The color of the grid lines. + */ get color() { return this._config.color.value; } + /** + * The color of the grid lines. + */ set color(value: THREE.Color) { this._config.color.value = value; this._component.material.uniforms.uColor.value = value; this._component.material.uniformsNeedUpdate = true; } + /** + * The size of the primary grid lines. + */ get primarySize() { return this._config.primarySize.value; } + /** + * The size of the primary grid lines. + */ set primarySize(value: number) { this._config.primarySize.value = value; this._component.material.uniforms.uSize1.value = value; this._component.material.uniformsNeedUpdate = true; } + /** + * The size of the secondary grid lines. + */ get secondarySize() { return this._config.secondarySize.value; } + /** + * The size of the secondary grid lines. + */ set secondarySize(value: number) { this._config.secondarySize.value = value; this._component.material.uniforms.uSize2.value = value; this._component.material.uniformsNeedUpdate = true; } + /** + * The distance at which the grid lines start to fade away. + */ get distance() { return this._config.distance.value; } + /** + * The distance at which the grid lines start to fade away. + */ set distance(value: number) { this._config.distance.value = value; this._component.material.uniforms.uDistance.value = value; diff --git a/packages/core/src/core/Grids/src/simple-grid.ts b/packages/core/src/core/Grids/src/simple-grid.ts index b67722098..50c83c3c6 100644 --- a/packages/core/src/core/Grids/src/simple-grid.ts +++ b/packages/core/src/core/Grids/src/simple-grid.ts @@ -37,6 +37,7 @@ export class SimpleGrid config: SimpleGridConfigManager; protected _defaultConfig: SimpleGridConfig = { + visible: true, color: new THREE.Color(0xbbbbbb), primarySize: 1, secondarySize: 10, diff --git a/packages/core/src/core/MiniMap/example.ts b/packages/core/src/core/MiniMap/example.ts index 11e9831b5..5c749fa59 100644 --- a/packages/core/src/core/MiniMap/example.ts +++ b/packages/core/src/core/MiniMap/example.ts @@ -12,7 +12,6 @@ Not quite. The minimap is a simple 2D representation of the 3D world. It is usef In this tutorial, we will import: -- `Three.js` to get some 3D entities for our app. - `@thatopen/components` to set up the barebone of our app. - `@thatopen/ui` to add some simple and cool UI menus. - `Stats.js` (optional) to measure the performance of our app. @@ -21,7 +20,6 @@ In this tutorial, we will import: import Stats from "stats.js"; import * as BUI from "@thatopen/ui"; -import * as THREE from "three"; import * as OBC from "@thatopen/components"; /* MD @@ -160,23 +158,29 @@ const panel = BUI.Component.create(() => { }}"> + + + @@ -184,17 +188,13 @@ const panel = BUI.Component.create(() => { diff --git a/packages/core/src/core/MiniMap/index.ts b/packages/core/src/core/MiniMap/index.ts index 388167b23..e8158f462 100644 --- a/packages/core/src/core/MiniMap/index.ts +++ b/packages/core/src/core/MiniMap/index.ts @@ -1,5 +1,12 @@ import { MiniMap } from "./src"; -import { Component, Updateable, World, Event, Disposable } from "../Types"; +import { + Component, + Updateable, + World, + Event, + Disposable, + Configurable, +} from "../Types"; import { Components } from "../Components"; export * from "./src"; @@ -23,6 +30,9 @@ export class MiniMaps extends Component implements Updateable, Disposable { /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + /** {@link Component.enabled} */ enabled = true; @@ -48,7 +58,7 @@ export class MiniMaps extends Component implements Updateable, Disposable { if (this.list.has(world.uuid)) { throw new Error("This world already has a minimap!"); } - const map = new MiniMap(world); + const map = new MiniMap(world, this.components); this.list.set(world.uuid, map); return map; } diff --git a/packages/core/src/core/MiniMap/src/index.ts b/packages/core/src/core/MiniMap/src/index.ts index 88578a0ff..feb32bb7f 100644 --- a/packages/core/src/core/MiniMap/src/index.ts +++ b/packages/core/src/core/MiniMap/src/index.ts @@ -1,232 +1,2 @@ -import * as THREE from "three"; -import { Resizeable, Updateable, World, Event, Disposable } from "../../Types"; - -/** - * A class representing a 2D minimap of a 3D world. - */ -export class MiniMap implements Resizeable, Updateable, Disposable { - /** {@link Disposable.onDisposed} */ - readonly onDisposed = new Event(); - - /** {@link Updateable.onAfterUpdate} */ - readonly onAfterUpdate = new Event(); - - /** {@link Updateable.onBeforeUpdate} */ - readonly onBeforeUpdate = new Event(); - - /** {@link Resizeable.onResize} */ - readonly onResize = new Event(); - - /** - * The front offset of the minimap. - * It determines how much the minimap's view is offset from the camera's view. - * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map - */ - frontOffset = 0; - - /** - * The override material for the minimap. - * It is used to render the depth information of the world onto the minimap. - */ - overrideMaterial = new THREE.MeshDepthMaterial(); - - /** - * The background color of the minimap. - * It is used to set the background color of the minimap's renderer. - */ - backgroundColor = new THREE.Color(0x06080a); - - /** - * The WebGL renderer for the minimap. - * It is used to render the minimap onto the screen. - */ - renderer: THREE.WebGLRenderer; - - /** - * A flag indicating whether the minimap is enabled. - * If disabled, the minimap will not update or render. - */ - enabled = true; - - /** - * The world in which the minimap is displayed. - * It provides access to the 3D scene, camera, and other relevant world elements. - */ - world: World; - - private _lockRotation = true; - private _camera: THREE.OrthographicCamera; - private _plane: THREE.Plane; - private _size = new THREE.Vector2(320, 160); - private _tempVector1 = new THREE.Vector3(); - private _tempVector2 = new THREE.Vector3(); - private _tempTarget = new THREE.Vector3(); - - private readonly down = new THREE.Vector3(0, -1, 0); - - /** - * Gets or sets whether the minimap rotation is locked. - * When rotation is locked, the minimap will always face the same direction as the camera. - */ - get lockRotation() { - return this._lockRotation; - } - - /** - * Sets whether the minimap rotation is locked. - * When rotation is locked, the minimap will always face the same direction as the camera. - * @param active - If `true`, rotation is locked. If `false`, rotation is not locked. - */ - set lockRotation(active: boolean) { - this._lockRotation = active; - if (active) { - this._camera.rotation.z = 0; - } - } - - /** - * Gets the current zoom level of the minimap. - * The zoom level determines how much of the world is visible on the minimap. - * @returns The current zoom level of the minimap. - */ - get zoom() { - return this._camera.zoom; - } - - /** - * Sets the zoom level of the minimap. - * The zoom level determines how much of the world is visible on the minimap. - * @param value - The new zoom level of the minimap. - */ - set zoom(value: number) { - this._camera.zoom = value; - this._camera.updateProjectionMatrix(); - } - - constructor(world: World) { - this.world = world; - - if (!this.world.renderer) { - throw new Error("The given world must have a renderer!"); - } - - this.renderer = new THREE.WebGLRenderer(); - this.renderer.setSize(this._size.x, this._size.y); - - const frustumSize = 1; - const aspect = this._size.x / this._size.y; - - this._camera = new THREE.OrthographicCamera( - (frustumSize * aspect) / -2, - (frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - ); - - this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes); - - this._camera.position.set(0, 200, 0); - this._camera.zoom = 0.1; - this._camera.rotation.x = -Math.PI / 2; - this._plane = new THREE.Plane(this.down, 200); - this.updatePlanes(); - } - - /** {@link Disposable.dispose} */ - dispose() { - this.enabled = false; - this.onBeforeUpdate.reset(); - this.onAfterUpdate.reset(); - this.onResize.reset(); - this.overrideMaterial.dispose(); - this.renderer.forceContextLoss(); - this.renderer.dispose(); - this.onDisposed.trigger(); - this.onDisposed.reset(); - } - - /** Returns the camera used by the MiniMap */ - get() { - return this._camera; - } - - /** {@link Updateable.update} */ - update() { - if (!this.enabled) return; - this.onBeforeUpdate.trigger(); - const scene = this.world.scene.three; - const camera = this.world.camera; - - if (!camera.hasCameraControls()) { - throw new Error("The given world must use camera controls!"); - } - - if (!(scene instanceof THREE.Scene)) { - throw new Error("The given world must have a THREE.Scene as a root!"); - } - - const controls = camera.controls; - controls.getPosition(this._tempVector1); - - this._camera.position.x = this._tempVector1.x; - this._camera.position.z = this._tempVector1.z; - - if (this.frontOffset !== 0) { - controls.getTarget(this._tempVector2); - this._tempVector2.sub(this._tempVector1); - this._tempVector2.normalize().multiplyScalar(this.frontOffset); - this._camera.position.x += this._tempVector2.x; - this._camera.position.z += this._tempVector2.z; - } - - if (!this._lockRotation) { - controls.getTarget(this._tempTarget); - const angle = Math.atan2( - this._tempTarget.x - this._tempVector1.x, - this._tempTarget.z - this._tempVector1.z, - ); - this._camera.rotation.z = angle + Math.PI; - } - - this._plane.set(this.down, this._tempVector1.y); - const previousBackground = scene.background; - scene.background = this.backgroundColor; - this.renderer.render(scene, this._camera); - scene.background = previousBackground; - this.onAfterUpdate.trigger(); - } - - /** {@link Resizeable.getSize} */ - getSize() { - return this._size; - } - - /** {@link Resizeable.resize} */ - resize(size: THREE.Vector2 = this._size) { - this._size.copy(size); - this.renderer.setSize(size.x, size.y); - - const aspect = size.x / size.y; - const frustumSize = 1; - - this._camera.left = (frustumSize * aspect) / -2; - this._camera.right = (frustumSize * aspect) / 2; - this._camera.top = frustumSize / 2; - this._camera.bottom = -frustumSize / 2; - this._camera.updateProjectionMatrix(); - this.onResize.trigger(size); - } - - private updatePlanes = () => { - if (!this.world.renderer) { - throw new Error("The given world must have a renderer!"); - } - const planes: THREE.Plane[] = []; - const renderer = this.world.renderer.three; - for (const plane of renderer.clippingPlanes) { - planes.push(plane); - } - planes.push(this._plane); - this.renderer.clippingPlanes = planes; - }; -} +export * from "./mini-map"; +export * from "./mini-map-config"; diff --git a/packages/core/src/core/MiniMap/src/mini-map-config.ts b/packages/core/src/core/MiniMap/src/mini-map-config.ts new file mode 100644 index 000000000..82e7b7b9b --- /dev/null +++ b/packages/core/src/core/MiniMap/src/mini-map-config.ts @@ -0,0 +1,222 @@ +import * as THREE from "three"; +import { + BooleanSettingsControl, + ColorSettingsControl, + NumberSettingControl, +} from "../../Types"; +import { Configurator } from "../../ConfigManager"; +import { MiniMap } from "./index"; + +type MiniMapConfigType = { + visible: BooleanSettingsControl; + lockRotation: BooleanSettingsControl; + zoom: NumberSettingControl; + frontOffset: NumberSettingControl; + sizeX: NumberSettingControl; + sizeY: NumberSettingControl; + backgroundColor: ColorSettingsControl; +}; + +/** + * Configuration interface for the {@link MiniMap}. + */ +export interface MiniMapConfig { + /** + * Whether the minimap is visible or not. + */ + visible: boolean; + + /** + * Whether to lock the rotation of the top camera in the minimap. + */ + lockRotation: boolean; + + /** + * The zoom of the camera in the minimap. + */ + zoom: number; + + /** + * The front offset of the minimap. + * It determines how much the minimap's view is offset from the camera's view. + * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map + */ + frontOffset: number; + + /** + * The horizontal dimension of the minimap. + */ + sizeX: number; + + /** + * The vertical dimension of the minimap. + */ + sizeY: number; + + /** + * The color of the background of the minimap. + */ + backgroundColor: THREE.Color; +} + +export class MiniMapConfigManager extends Configurator< + MiniMap, + MiniMapConfigType +> { + protected _config: MiniMapConfigType = { + visible: { + value: true, + type: "Boolean" as const, + }, + lockRotation: { + value: true, + type: "Boolean" as const, + }, + zoom: { + type: "Number" as const, + interpolable: true, + value: 0.05, + min: 0.001, + max: 5, + }, + frontOffset: { + type: "Number" as const, + interpolable: true, + value: 0, + min: 0, + max: 100, + }, + sizeX: { + type: "Number" as const, + interpolable: true, + value: 320, + min: 20, + max: 5000, + }, + sizeY: { + type: "Number" as const, + interpolable: true, + value: 160, + min: 20, + max: 5000, + }, + backgroundColor: { + value: new THREE.Color() as THREE.Color, + type: "Color" as const, + }, + }; + + /** + * Whether the minimap is visible or not. + */ + get visible() { + return this._config.visible.value; + } + + /** + * Whether the minimap is visible or not. + */ + set visible(value: boolean) { + this._config.visible.value = value; + const style = this._component.renderer.domElement.style; + style.display = value ? "block" : "none"; + } + + /** + * Whether to lock the rotation of the top camera in the minimap. + */ + get lockRotation() { + return this._config.lockRotation.value; + } + + /** + * Whether to lock the rotation of the top camera in the minimap. + */ + set lockRotation(value: boolean) { + this._config.lockRotation.value = value; + this._component.lockRotation = value; + } + + /** + * The zoom of the camera in the minimap. + */ + get zoom() { + return this._config.zoom.value; + } + + /** + * The zoom of the camera in the minimap. + */ + set zoom(value: number) { + this._config.zoom.value = value; + this._component.zoom = value; + } + + /** + * The front offset of the minimap. + * It determines how much the minimap's view is offset from the camera's view. + * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map + */ + get frontOffset() { + return this._config.frontOffset.value; + } + + /** + * The front offset of the minimap. + * It determines how much the minimap's view is offset from the camera's view. + * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map + */ + set frontOffset(value: number) { + this._config.frontOffset.value = value; + this._component.frontOffset = value; + } + + /** + * The horizontal dimension of the minimap. + */ + get sizeX() { + return this._config.sizeX.value; + } + + /** + * The horizontal dimension of the minimap. + */ + set sizeX(value: number) { + this._config.sizeX.value = value; + const { sizeX, sizeY } = this._config; + const size = new THREE.Vector2(sizeX.value, sizeY.value); + this._component.resize(size); + } + + /** + * The vertical dimension of the minimap. + */ + get sizeY() { + return this._config.sizeY.value; + } + + /** + * The vertical dimension of the minimap. + */ + set sizeY(value: number) { + this._config.sizeY.value = value; + const { sizeX, sizeY } = this._config; + const size = new THREE.Vector2(sizeX.value, sizeY.value); + this._component.resize(size); + } + + /** + * The color of the background of the minimap. + */ + get backgroundColor() { + return this._config.backgroundColor.value; + } + + /** + * The color of the background of the minimap. + */ + set backgroundColor(value: THREE.Color) { + this._config.backgroundColor.value = value; + this._component.backgroundColor = value; + } +} diff --git a/packages/core/src/core/MiniMap/src/mini-map.ts b/packages/core/src/core/MiniMap/src/mini-map.ts new file mode 100644 index 000000000..ce3d64ced --- /dev/null +++ b/packages/core/src/core/MiniMap/src/mini-map.ts @@ -0,0 +1,288 @@ +import * as THREE from "three"; +import { + Resizeable, + Updateable, + World, + Event, + Disposable, + Configurable, +} from "../../Types"; +import { MiniMapConfig, MiniMapConfigManager } from "./mini-map-config"; +import { ConfigManager } from "../../ConfigManager"; +import { Components } from "../../Components"; + +/** + * A class representing a 2D minimap of a 3D world. + */ +export class MiniMap + implements + Resizeable, + Updateable, + Disposable, + Configurable +{ + /** {@link Disposable.onDisposed} */ + readonly onDisposed = new Event(); + + /** {@link Updateable.onAfterUpdate} */ + readonly onAfterUpdate = new Event(); + + /** {@link Updateable.onBeforeUpdate} */ + readonly onBeforeUpdate = new Event(); + + /** {@link Resizeable.onResize} */ + readonly onResize = new Event(); + + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); + + /** + * The front offset of the minimap. + * It determines how much the minimap's view is offset from the camera's view. + * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map + */ + frontOffset = 0; + + /** + * The override material for the minimap. + * It is used to render the depth information of the world onto the minimap. + */ + overrideMaterial = new THREE.MeshDepthMaterial(); + + /** + * The background color of the minimap. + * It is used to set the background color of the minimap's renderer. + */ + backgroundColor = new THREE.Color(0x06080a); + + /** + * The WebGL renderer for the minimap. + * It is used to render the minimap onto the screen. + */ + renderer: THREE.WebGLRenderer; + + /** + * A flag indicating whether the minimap is enabled. + * If disabled, the minimap will not update or render. + */ + enabled = true; + + /** + * The world in which the minimap is displayed. + * It provides access to the 3D scene, camera, and other relevant world elements. + */ + world: World; + + /** {@link Configurable.config} */ + config: MiniMapConfigManager; + + /** {@link Configurable.isSetup} */ + isSetup = false; + + protected _defaultConfig: MiniMapConfig = { + visible: true, + lockRotation: false, + zoom: 0.05, + frontOffset: 0, + sizeX: 320, + sizeY: 160, + backgroundColor: new THREE.Color(0x06080a), + }; + + private _lockRotation = true; + private _size = new THREE.Vector2(320, 160); + + private _camera: THREE.OrthographicCamera; + private _plane: THREE.Plane; + private _tempVector1 = new THREE.Vector3(); + private _tempVector2 = new THREE.Vector3(); + private _tempTarget = new THREE.Vector3(); + + private readonly down = new THREE.Vector3(0, -1, 0); + + /** + * Gets or sets whether the minimap rotation is locked. + * When rotation is locked, the minimap will always face the same direction as the camera. + */ + get lockRotation() { + return this._lockRotation; + } + + /** + * Sets whether the minimap rotation is locked. + * When rotation is locked, the minimap will always face the same direction as the camera. + * @param active - If `true`, rotation is locked. If `false`, rotation is not locked. + */ + set lockRotation(active: boolean) { + this._lockRotation = active; + if (active) { + this._camera.rotation.z = 0; + } + } + + /** + * Gets the current zoom level of the minimap. + * The zoom level determines how much of the world is visible on the minimap. + * @returns The current zoom level of the minimap. + */ + get zoom() { + return this._camera.zoom; + } + + /** + * Sets the zoom level of the minimap. + * The zoom level determines how much of the world is visible on the minimap. + * @param value - The new zoom level of the minimap. + */ + set zoom(value: number) { + this._camera.zoom = value; + this._camera.updateProjectionMatrix(); + } + + constructor(world: World, components: Components) { + this.world = world; + + if (!this.world.renderer) { + throw new Error("The given world must have a renderer!"); + } + + this.renderer = new THREE.WebGLRenderer(); + this.renderer.setSize(this._size.x, this._size.y); + + const frustumSize = 1; + const aspect = this._size.x / this._size.y; + + this._camera = new THREE.OrthographicCamera( + (frustumSize * aspect) / -2, + (frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + ); + + this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes); + + this._camera.position.set(0, 200, 0); + this._camera.zoom = 0.1; + this._camera.rotation.x = -Math.PI / 2; + this._plane = new THREE.Plane(this.down, 200); + this.updatePlanes(); + + this.config = new MiniMapConfigManager(this, components, "MiniMap"); + const configs = components.get(ConfigManager); + configs.list.add(this.config); + } + + /** {@link Disposable.dispose} */ + dispose() { + this.enabled = false; + this.onBeforeUpdate.reset(); + this.onAfterUpdate.reset(); + this.onResize.reset(); + this.overrideMaterial.dispose(); + this.renderer.forceContextLoss(); + this.renderer.dispose(); + this.onDisposed.trigger(); + this.onDisposed.reset(); + } + + /** Returns the camera used by the MiniMap */ + get() { + return this._camera; + } + + /** {@link Updateable.update} */ + update() { + if (!this.enabled) return; + this.onBeforeUpdate.trigger(); + const scene = this.world.scene.three; + const camera = this.world.camera; + + if (!camera.hasCameraControls()) { + throw new Error("The given world must use camera controls!"); + } + + if (!(scene instanceof THREE.Scene)) { + throw new Error("The given world must have a THREE.Scene as a root!"); + } + + const controls = camera.controls; + controls.getPosition(this._tempVector1); + + this._camera.position.x = this._tempVector1.x; + this._camera.position.z = this._tempVector1.z; + + if (this.frontOffset !== 0) { + controls.getTarget(this._tempVector2); + this._tempVector2.sub(this._tempVector1); + this._tempVector2.normalize().multiplyScalar(this.frontOffset); + this._camera.position.x += this._tempVector2.x; + this._camera.position.z += this._tempVector2.z; + } + + if (!this._lockRotation) { + controls.getTarget(this._tempTarget); + const angle = Math.atan2( + this._tempTarget.x - this._tempVector1.x, + this._tempTarget.z - this._tempVector1.z, + ); + this._camera.rotation.z = angle + Math.PI; + } + + this._plane.set(this.down, this._tempVector1.y); + const previousBackground = scene.background; + scene.background = this.backgroundColor; + this.renderer.render(scene, this._camera); + scene.background = previousBackground; + this.onAfterUpdate.trigger(); + } + + /** {@link Resizeable.getSize} */ + getSize() { + return this._size; + } + + /** {@link Resizeable.resize} */ + resize(size: THREE.Vector2 = this._size) { + this._size.copy(size); + this.renderer.setSize(size.x, size.y); + + const aspect = size.x / size.y; + const frustumSize = 1; + + this._camera.left = (frustumSize * aspect) / -2; + this._camera.right = (frustumSize * aspect) / 2; + this._camera.top = frustumSize / 2; + this._camera.bottom = -frustumSize / 2; + this._camera.updateProjectionMatrix(); + this.onResize.trigger(size); + } + + /** {@link Configurable.setup} */ + setup(config?: Partial) { + const fullConfig = { ...this._defaultConfig, ...config }; + + this.config.visible = true; + this.config.lockRotation = fullConfig.lockRotation; + this.config.zoom = fullConfig.zoom; + this.config.frontOffset = fullConfig.frontOffset; + this.config.sizeX = fullConfig.sizeX; + this.config.sizeY = fullConfig.sizeY; + this.config.backgroundColor = fullConfig.backgroundColor; + + this.isSetup = true; + this.onSetup.trigger(); + } + + private updatePlanes = () => { + if (!this.world.renderer) { + throw new Error("The given world must have a renderer!"); + } + const planes: THREE.Plane[] = []; + const renderer = this.world.renderer.three; + for (const plane of renderer.clippingPlanes) { + planes.push(plane); + } + planes.push(this._plane); + this.renderer.clippingPlanes = planes; + }; +} From 56ad3f005c82507fc1b22af732ab87c75759e4f9 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Fri, 4 Oct 2024 10:39:04 -0500 Subject: [PATCH 48/51] JSDocs added to some methods --- .../src/openbim/IDSSpecifications/example.ts | 181 +++++++++--------- .../src/openbim/IDSSpecifications/index.ts | 43 ++++- .../IDSSpecifications/src/Specification.ts | 22 ++- .../IDSSpecifications/src/facets/index.ts | 4 +- 4 files changed, 155 insertions(+), 95 deletions(-) diff --git a/packages/core/src/openbim/IDSSpecifications/example.ts b/packages/core/src/openbim/IDSSpecifications/example.ts index c0e7e20a4..2bae2787a 100644 --- a/packages/core/src/openbim/IDSSpecifications/example.ts +++ b/packages/core/src/openbim/IDSSpecifications/example.ts @@ -1,5 +1,4 @@ -import * as WEBIFC from "web-ifc"; -import * as FRAGS from "@thatopen/fragments"; +// import * as FRAGS from "@thatopen/fragments"; import * as OBC from "../.."; const components = new OBC.Components(); @@ -13,11 +12,11 @@ await ifcLoader.setup(); // const buffer = new Uint8Array(data); // const model = await ifcLoader.load(buffer); -const indexer = components.get(OBC.IfcRelationsIndexer); +// const indexer = components.get(OBC.IfcRelationsIndexer); // await indexer.process(model); const ids = components.get(OBC.IDSSpecifications); -const specification = ids.create("My First IDS!", ["IFC4X3"]); +const specification = ids.create("My First IDS!", ["IFC4X3_ADD2"]); specification.description = "Description"; specification.instructions = "Instructions"; @@ -114,97 +113,97 @@ a.download = file.name; // Load test cases from GitHub // Define the URL for fetching the files list -const apiURL = - "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/property?ref=development"; +// const apiURL = +// "https://api.github.com/repos/buildingSMART/IDS/contents/Documentation/ImplementersDocumentation/TestCases/property?ref=development"; // Function to process each pair of IFC and IDS files -async function processPair(ifcUrl: string, idsUrl: string) { - try { - const routes = ifcUrl.split("/"); - const name = routes[routes.length - 1]; - const pieces = name.split("-"); - const bsResult = pieces[0] === "pass"; - - // Fetch the IFC and IDS content - const ifcResponse = await fetch(ifcUrl); - const idsResponse = await fetch(idsUrl); - - if (!ifcResponse.ok || !idsResponse.ok) { - throw new Error("Error fetching IFC or IDS file"); - } - - const ifcContent = await ifcResponse.arrayBuffer(); - const idsContent = await idsResponse.text(); - - const model = await ifcLoader.load(new Uint8Array(ifcContent)); - await indexer.process(model); - - const imports = ids.load(idsContent); - for (const spec of imports) { - const app = [...spec.applicability][0]; - const req = [...spec.requirements][0]; - const entities: FRAGS.IfcProperties = {}; - await app.getEntities(model, entities); - const result = await req.test(entities, model); - const passes = result.filter(({ pass }) => pass); - const fails = result.filter(({ pass }) => !pass); - console.log(bsResult, passes, fails, ifcUrl, idsUrl); - } - - // Use your custom loaders for IFC and IDS - // customIfcLoader(ifcContent); - // customIdsLoader(idsContent); - - // console.log(`Successfully processed pair: ${ifcUrl}, ${idsUrl}`); - } catch (error) { - // console.error(`Error processing pair: ${ifcUrl}, ${idsUrl}`, error); - } -} +// async function processPair(ifcUrl: string, idsUrl: string) { +// try { +// const routes = ifcUrl.split("/"); +// const name = routes[routes.length - 1]; +// const pieces = name.split("-"); +// const bsResult = pieces[0] === "pass"; + +// // Fetch the IFC and IDS content +// const ifcResponse = await fetch(ifcUrl); +// const idsResponse = await fetch(idsUrl); + +// if (!ifcResponse.ok || !idsResponse.ok) { +// throw new Error("Error fetching IFC or IDS file"); +// } + +// const ifcContent = await ifcResponse.arrayBuffer(); +// const idsContent = await idsResponse.text(); + +// const model = await ifcLoader.load(new Uint8Array(ifcContent)); +// await indexer.process(model); + +// const imports = ids.load(idsContent); +// for (const spec of imports) { +// const app = [...spec.applicability][0]; +// const req = [...spec.requirements][0]; +// const entities: FRAGS.IfcProperties = {}; +// await app.getEntities(model, entities); +// const result = await req.test(entities, model); +// const passes = result.filter(({ pass }) => pass); +// const fails = result.filter(({ pass }) => !pass); +// console.log(bsResult, passes, fails, ifcUrl, idsUrl); +// } + +// // Use your custom loaders for IFC and IDS +// // customIfcLoader(ifcContent); +// // customIdsLoader(idsContent); + +// // console.log(`Successfully processed pair: ${ifcUrl}, ${idsUrl}`); +// } catch (error) { +// // console.error(`Error processing pair: ${ifcUrl}, ${idsUrl}`, error); +// } +// } // Function to fetch the list of files and group them by pairs (IFC + IDS) -async function fetchFileListAndProcessPairs() { - try { - const response = await fetch(apiURL); - - if (!response.ok) { - throw new Error(`Error fetching files list: ${response.statusText}`); - } - - const files = await response.json(); - const filePairs: { [key: string]: { ifc?: string; ids?: string } } = {}; - - // Group files by their base names - for (const file of files) { - const fileName = file.name; - - // Extract the base name (everything before the file extension) - const baseName = fileName.split(".").slice(0, -1).join("."); - - // Check if the file is an .ifc or .ids and group them - if (fileName.endsWith(".ifc")) { - if (!filePairs[baseName]) filePairs[baseName] = {}; - filePairs[baseName].ifc = file.download_url; - } else if (fileName.endsWith(".ids")) { - if (!filePairs[baseName]) filePairs[baseName] = {}; - filePairs[baseName].ids = file.download_url; - } - } - - // Now process each pair using the custom loaders - for (const baseName in filePairs) { - const { ifc, ids } = filePairs[baseName]; - - if (ifc && ids) { - // console.log(`Processing pair: ${baseName}`); - await processPair(ifc, ids); - } else { - // console.warn(`Pair incomplete for ${baseName}`); - } - } - } catch (error) { - console.error(error); - } -} +// async function fetchFileListAndProcessPairs() { +// try { +// const response = await fetch(apiURL); + +// if (!response.ok) { +// throw new Error(`Error fetching files list: ${response.statusText}`); +// } + +// const files = await response.json(); +// const filePairs: { [key: string]: { ifc?: string; ids?: string } } = {}; + +// // Group files by their base names +// for (const file of files) { +// const fileName = file.name; + +// // Extract the base name (everything before the file extension) +// const baseName = fileName.split(".").slice(0, -1).join("."); + +// // Check if the file is an .ifc or .ids and group them +// if (fileName.endsWith(".ifc")) { +// if (!filePairs[baseName]) filePairs[baseName] = {}; +// filePairs[baseName].ifc = file.download_url; +// } else if (fileName.endsWith(".ids")) { +// if (!filePairs[baseName]) filePairs[baseName] = {}; +// filePairs[baseName].ids = file.download_url; +// } +// } + +// // Now process each pair using the custom loaders +// for (const baseName in filePairs) { +// const { ifc, ids } = filePairs[baseName]; + +// if (ifc && ids) { +// // console.log(`Processing pair: ${baseName}`); +// await processPair(ifc, ids); +// } else { +// // console.warn(`Pair incomplete for ${baseName}`); +// } +// } +// } catch (error) { +// console.error(error); +// } +// } // Call the function to fetch and process file pairs // fetchFileListAndProcessPairs(); diff --git a/packages/core/src/openbim/IDSSpecifications/index.ts b/packages/core/src/openbim/IDSSpecifications/index.ts index ff56c6625..778c05051 100644 --- a/packages/core/src/openbim/IDSSpecifications/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/index.ts @@ -16,6 +16,10 @@ import { } from "./src/importers"; import { createPropertyFacets } from "./src/importers/property"; +/** + * Component that manages Information Delivery Specification (IDS) data. + * It provides functionality for importing, exporting, and manipulating IDS data. + */ export class IDSSpecifications extends Component { static uuid = "9f0b9f78-9b2e-481a-b766-2fbfd01f342c" as const; enabled = true; @@ -40,6 +44,17 @@ export class IDSSpecifications extends Component { readonly list = new DataMap(); + /** + * Retrieves a FragmentIdMap based on the given IDSCheckResult array. + * The map separates the IDs into two categories: pass and fail. + * + * @param model - The FragmentsGroup model from which to retrieve the fragment map. + * @param result - An array of IDSCheckResult objects, each representing a check result. + * + * @returns An object containing two properties: + * - `pass`: A FragmentIdMap that passed the checks. + * - `fail`: A FragmentIdMap that failed the checks. + */ getFragmentIdMap(model: FRAGS.FragmentsGroup, result: IDSCheckResult[]) { const passResults = result.filter((check) => check.pass); const passIDs = passResults.map((check) => check.expressID); @@ -52,6 +67,14 @@ export class IDSSpecifications extends Component { return { pass, fail }; } + /** + * Creates a new IDSSpecification instance and adds it to the list. + * + * @param name - The name of the IDSSpecification. + * @param ifcVersion - An array of IfcVersion values that the specification supports. + * + * @returns The newly created IDSSpecification instance. + */ create(name: string, ifcVersion: IfcVersion[]) { const specification = new IDSSpecification( this.components, @@ -59,11 +82,20 @@ export class IDSSpecifications extends Component { ifcVersion, ); - this.list.set(specification.identifier!, specification); + this.list.set(specification.identifier, specification); return specification; } + /** + * Parses and processes an XML string containing Information Delivery Specification (IDS) data. + * It creates IDSSpecification instances based on the parsed data and returns them in an array. + * Also, the instances are added to the list array. + * + * @param data - The XML string to parse. + * + * @returns An array of IDSSpecification instances created from the parsed data. + */ load(data: string) { const result: IDSSpecification[] = []; const ids = IDSSpecifications.xmlParser.parse(data).ids; @@ -140,6 +172,15 @@ export class IDSSpecifications extends Component { return result; } + /** + * Exports the IDSSpecifications data into an XML string. + * + * @param info - The metadata information for the exported XML. + * @param specifications - An optional iterable of IDSSpecification instances to export. + * If not provided, all specifications in the list will be exported. + * + * @returns A string containing the exported IDSSpecifications data in XML format. + */ export( info: IDSInfo, specifications: Iterable = this.list.values(), diff --git a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts index 293ef63b9..c5e11b784 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/Specification.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/Specification.ts @@ -5,10 +5,16 @@ import { IDSCheckResult, IfcVersion } from "./types"; import { UUID } from "../../../utils"; import { IDSFacet } from "./facets"; +/** + * Represents a single specification from the Information Delivery Specification (IDS) standard. + * + * @remarks This class provides methods for testing a model against the specification, + * as well as serializing the specification into XML format. + */ export class IDSSpecification { name: string; ifcVersion = new Set(); - identifier? = UUID.create(); + identifier = UUID.create(); description?: string; instructions?: string; requirementsDescription?: string; @@ -25,6 +31,13 @@ export class IDSSpecification { } } + /** + * Tests the model to test against the specification's requirements. + * + * @param model - The model to be tested. + * @returns An array representing the test results. + * If no requirements are defined for the specification, an empty array is returned. + */ async test(model: FRAGS.FragmentsGroup) { let result: IDSCheckResult[] = []; @@ -67,6 +80,13 @@ export class IDSSpecification { // } } + /** + * Serializes the IDSSpecification instance into XML format. + * + * @remarks This method is not meant to be used directly. It is used by the IDSSpecifications component. + * + * @returns The XML representation of the IDSSpecification. + */ serialize() { const name = `name="${this.name}"`; const identifier = this.identifier ? `identifier="${this.identifier}"` : ""; diff --git a/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts index a0e9ded4b..d47ee316c 100644 --- a/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts +++ b/packages/core/src/openbim/IDSSpecifications/src/facets/index.ts @@ -1,7 +1,7 @@ export * from "./Attribute"; export * from "./Classification"; export * from "./Entity"; -export * from "./Material"; -export * from "./PartOf"; export * from "./Property"; export * from "./Facet"; +// export * from "./Material"; +// export * from "./PartOf"; From d46b0efb818e41feca73975fff50d1b486fc5402 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Fri, 4 Oct 2024 10:43:25 -0500 Subject: [PATCH 49/51] lock file updated --- yarn.lock | 383 ++++++++++++++++++++++++++---------------------------- 1 file changed, 186 insertions(+), 197 deletions(-) diff --git a/yarn.lock b/yarn.lock index f7e082f6b..64acb4f4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,39 +5,39 @@ __metadata: version: 6 cacheKey: 8 -"@babel/helper-string-parser@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/helper-string-parser@npm:7.24.8" - checksum: 39b03c5119216883878655b149148dc4d2e284791e969b19467a9411fccaa33f7a713add98f4db5ed519535f70ad273cdadfd2eb54d47ebbdeac5083351328ce +"@babel/helper-string-parser@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-string-parser@npm:7.25.7" + checksum: 0835fda5efe02cdcb5144a939b639acc017ba4aa1cc80524b44032ddb714080d3e40e8f0d3240832b7bd86f5513f0b63d4fe77d8fc52d8c8720ae674182c0753 languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-validator-identifier@npm:7.24.7" - checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257 +"@babel/helper-validator-identifier@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/helper-validator-identifier@npm:7.25.7" + checksum: 062f55208deead4876eb474dc6fd55155c9eada8d0a505434de3b9aa06c34195562e0f3142b22a08793a38d740238efa2fe00ff42956cdcb8ac03f0b6c542247 languageName: node linkType: hard -"@babel/parser@npm:^7.24.7": - version: 7.25.3 - resolution: "@babel/parser@npm:7.25.3" +"@babel/parser@npm:^7.25.3": + version: 7.25.7 + resolution: "@babel/parser@npm:7.25.7" dependencies: - "@babel/types": ^7.25.2 + "@babel/types": ^7.25.7 bin: parser: ./bin/babel-parser.js - checksum: b55aba64214fa1d66ccd0d29f476d2e55a48586920d280f88c546f81cbbececc0e01c9d05a78d6bf206e8438b9c426caa344942c1a581eecc4d365beaab8a20e + checksum: 7c40c2881e92415f5f2a88ac1078a8fea7f2b10097e76116ce40bfe01443d3a842c704bdb64d7b54c9e9dbbf49a60a0e1cf79ff35bcd02c52ff424179acd4259 languageName: node linkType: hard -"@babel/types@npm:^7.25.2": - version: 7.25.2 - resolution: "@babel/types@npm:7.25.2" +"@babel/types@npm:^7.25.7": + version: 7.25.7 + resolution: "@babel/types@npm:7.25.7" dependencies: - "@babel/helper-string-parser": ^7.24.8 - "@babel/helper-validator-identifier": ^7.24.7 + "@babel/helper-string-parser": ^7.25.7 + "@babel/helper-validator-identifier": ^7.25.7 to-fast-properties: ^2.0.0 - checksum: f73f66ba903c6f7e38f519a33d53a67d49c07e208e59ea65250362691dc546c6da7ab90ec66ee79651ef697329872f6f97eb19a6dfcacc026fd05e76a563c5d2 + checksum: a63a3ecdac5eb2fa10a75d50ec23d1560beed6c4037ccf478a430cc221ba9b8b3a55cfbaaefb6e997051728f3c02b44dcddb06de9a0132f164a0a597dd825731 languageName: node linkType: hard @@ -214,9 +214,9 @@ __metadata: linkType: hard "@eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": - version: 4.11.0 - resolution: "@eslint-community/regexpp@npm:4.11.0" - checksum: 97d2fe46690b69417a551bd19a3dc53b6d9590d2295c43cc4c4e44e64131af541e2f4a44d5c12e87de990403654d3dae9d33600081f3a2f0386b368abc9111ec + version: 4.11.1 + resolution: "@eslint-community/regexpp@npm:4.11.1" + checksum: 6986685529d30e33c2640973c3d8e7ddd31bef3cc8cb10ad54ddc1dea12680779a2c23a45562aa1462c488137a3570e672d122fac7da22d82294382d915cec70 languageName: node linkType: hard @@ -245,11 +245,11 @@ __metadata: linkType: hard "@floating-ui/core@npm:^1.0.0": - version: 1.6.7 - resolution: "@floating-ui/core@npm:1.6.7" + version: 1.6.8 + resolution: "@floating-ui/core@npm:1.6.8" dependencies: - "@floating-ui/utils": ^0.2.7 - checksum: ff940c228f7c4f95138c4979ba1c1122d804cac55e514c889cbdb9f76d5bebbd0f7a02ae1d468b66a9e728343d5a79430845781230e012560b4719fdde458461 + "@floating-ui/utils": ^0.2.8 + checksum: 82faa6ea9d57e466779324e51308d6d49c098fb9d184a08d9bb7f4fad83f08cc070fc491f8d56f0cad44a16215fb43f9f829524288413e6c33afcb17303698de languageName: node linkType: hard @@ -263,10 +263,10 @@ __metadata: languageName: node linkType: hard -"@floating-ui/utils@npm:^0.2.0, @floating-ui/utils@npm:^0.2.7": - version: 0.2.7 - resolution: "@floating-ui/utils@npm:0.2.7" - checksum: 7e6707c4c6d496f86377a97aac0232926953a2da9c2058ed79d8b44031038ef8fcf9743dac7b38c1da7148460194da987814d78af801ec5c278abf9b303adb22 +"@floating-ui/utils@npm:^0.2.0, @floating-ui/utils@npm:^0.2.8": + version: 0.2.8 + resolution: "@floating-ui/utils@npm:0.2.8" + checksum: deb98bba017c4e073c7ad5740d4dec33a4d3e0942d412e677ac0504f3dade15a68fc6fd164d43c93c0bb0bcc5dc5015c1f4080dfb1a6161140fe660624f7c875 languageName: node linkType: hard @@ -448,8 +448,8 @@ __metadata: linkType: hard "@rollup/pluginutils@npm:^5.1.0": - version: 5.1.0 - resolution: "@rollup/pluginutils@npm:5.1.0" + version: 5.1.2 + resolution: "@rollup/pluginutils@npm:5.1.2" dependencies: "@types/estree": ^1.0.0 estree-walker: ^2.0.2 @@ -459,118 +459,118 @@ __metadata: peerDependenciesMeta: rollup: optional: true - checksum: 3cc5a6d91452a6eabbfd1ae79b4dd1f1e809d2eecda6e175deb784e75b0911f47e9ecce73f8dd315d6a8b3f362582c91d3c0f66908b6ced69345b3cbe28f8ce8 + checksum: 16c8c154fef9a32c513b52bd79c92ac427edccd05a8dc3994f10c296063940c57bf809d05903b473d9d408aa5977d75b98c701f481dd1856d5ffc37187ac0060 languageName: node linkType: hard -"@rollup/rollup-android-arm-eabi@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-android-arm-eabi@npm:4.20.0" +"@rollup/rollup-android-arm-eabi@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.24.0" conditions: os=android & cpu=arm languageName: node linkType: hard -"@rollup/rollup-android-arm64@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-android-arm64@npm:4.20.0" +"@rollup/rollup-android-arm64@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-android-arm64@npm:4.24.0" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-arm64@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-darwin-arm64@npm:4.20.0" +"@rollup/rollup-darwin-arm64@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-darwin-arm64@npm:4.24.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-x64@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-darwin-x64@npm:4.20.0" +"@rollup/rollup-darwin-x64@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-darwin-x64@npm:4.24.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-linux-arm-gnueabihf@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.20.0" +"@rollup/rollup-linux-arm-gnueabihf@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.24.0" conditions: os=linux & cpu=arm & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm-musleabihf@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.20.0" +"@rollup/rollup-linux-arm-musleabihf@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.24.0" conditions: os=linux & cpu=arm & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-arm64-gnu@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.20.0" +"@rollup/rollup-linux-arm64-gnu@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.24.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm64-musl@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-arm64-musl@npm:4.20.0" +"@rollup/rollup-linux-arm64-musl@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.24.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-powerpc64le-gnu@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.20.0" +"@rollup/rollup-linux-powerpc64le-gnu@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.24.0" conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-gnu@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.20.0" +"@rollup/rollup-linux-riscv64-gnu@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.24.0" conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-s390x-gnu@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.20.0" +"@rollup/rollup-linux-s390x-gnu@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.24.0" conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-gnu@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-x64-gnu@npm:4.20.0" +"@rollup/rollup-linux-x64-gnu@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.24.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-musl@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-linux-x64-musl@npm:4.20.0" +"@rollup/rollup-linux-x64-musl@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.24.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-win32-arm64-msvc@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.20.0" +"@rollup/rollup-win32-arm64-msvc@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.24.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-win32-ia32-msvc@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.20.0" +"@rollup/rollup-win32-ia32-msvc@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.24.0" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@rollup/rollup-win32-x64-msvc@npm:4.20.0": - version: 4.20.0 - resolution: "@rollup/rollup-win32-x64-msvc@npm:4.20.0" +"@rollup/rollup-win32-x64-msvc@npm:4.24.0": + version: 4.24.0 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.24.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -675,8 +675,8 @@ __metadata: linkType: hard "@thatopen/ui-obc@npm:~2.2.0": - version: 2.2.0 - resolution: "@thatopen/ui-obc@npm:2.2.0" + version: 2.2.5 + resolution: "@thatopen/ui-obc@npm:2.2.5" dependencies: "@thatopen/ui": ~2.2.0 lit: 3.1.2 @@ -685,18 +685,18 @@ __metadata: "@thatopen/components-front": ~2.2.0 three: 0.160.1 web-ifc: 0.0.57 - checksum: 0f76dafc8377f2568412da765c2f14658b9cbe397d6fbf8b9ec702bbe3e7fa9dcec4b82f3f221a61076b302aafe226e36b59391337bf2c9cdf0840e6352f3f7c + checksum: ee0ef22f671c7e802e12771063de8b9f8d68094fb53862cc98a7688ed227604d2cadfc8121245e77d293f8e4773782e22cd0562aed42e7b7898eddc83a5c8072 languageName: node linkType: hard "@thatopen/ui@npm:~2.2.0": - version: 2.2.0 - resolution: "@thatopen/ui@npm:2.2.0" + version: 2.2.2 + resolution: "@thatopen/ui@npm:2.2.2" dependencies: "@floating-ui/dom": 1.6.3 iconify-icon: 2.0.0 lit: 3.1.2 - checksum: 29a81792166bc75e2db8a285f9767e2fc8af98eadb1c422e9c5d1877391443860a970a2487f96491f1f0e9a1dfe55dac65423de7997e541541f6d775b8847774 + checksum: 72bbf5ecad9f33272656b79d0338c753a4c03a63c1d2c07676476206d14de39be9c747af20d6fce9483061d8afcd39f61b584daaf001a19db286b05a70d552b6 languageName: node linkType: hard @@ -714,10 +714,10 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": - version: 1.0.5 - resolution: "@types/estree@npm:1.0.5" - checksum: dd8b5bed28e6213b7acd0fb665a84e693554d850b0df423ac8076cc3ad5823a6bc26b0251d080bdc545af83179ede51dd3f6fa78cad2c46ed1f29624ddf3e41a +"@types/estree@npm:1.0.6, @types/estree@npm:^1.0.0": + version: 1.0.6 + resolution: "@types/estree@npm:1.0.6" + checksum: 8825d6e729e16445d9a1dd2fb1db2edc5ed400799064cd4d028150701031af012ba30d6d03fe9df40f4d7a437d0de6d2b256020152b7b09bde9f2e420afdffd9 languageName: node linkType: hard @@ -736,11 +736,11 @@ __metadata: linkType: hard "@types/node@npm:latest": - version: 22.3.0 - resolution: "@types/node@npm:22.3.0" + version: 22.7.4 + resolution: "@types/node@npm:22.7.4" dependencies: - undici-types: ~6.18.2 - checksum: a86a552e9d3e135da4c975aa73bb1a655ae94f4d8de1547f6f95ad6b244ae2156347548fd35b6a5dd2c65688694198ae8b0923d9c32264dbc3dbfb2f688bd147 + undici-types: ~6.19.2 + checksum: a3f4154147639369aed08fe6f8d62eff637cf87b187bb252d7bbccdc82884626007af424b08a653c53f2182adfa0340001b4888cb7cbb942cef351210fc742a5 languageName: node linkType: hard @@ -778,9 +778,9 @@ __metadata: linkType: hard "@types/webxr@npm:*": - version: 0.5.19 - resolution: "@types/webxr@npm:0.5.19" - checksum: aed3e799d66084923ab7238129ad9e1876d4c9b1f26d3f4351fb82733107842f0e53a29b5d43d8460228bf51ef75daa578922a64ef6c15265ba3fc43e23972cb + version: 0.5.20 + resolution: "@types/webxr@npm:0.5.20" + checksum: 8085c291ca8a8adfe03245725384234e62d61cc0f5f7b9985c2a0ba2b2a794cac538861c4904d8fcd28e3e381f0a4ecc5d4514d143dbf3fc0cf3193dc1cc7a54 languageName: node linkType: hard @@ -942,26 +942,26 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-core@npm:3.4.38": - version: 3.4.38 - resolution: "@vue/compiler-core@npm:3.4.38" +"@vue/compiler-core@npm:3.5.11": + version: 3.5.11 + resolution: "@vue/compiler-core@npm:3.5.11" dependencies: - "@babel/parser": ^7.24.7 - "@vue/shared": 3.4.38 + "@babel/parser": ^7.25.3 + "@vue/shared": 3.5.11 entities: ^4.5.0 estree-walker: ^2.0.2 source-map-js: ^1.2.0 - checksum: dbfda932e03743aa4575a61c28b40bfeddbc89d665e99f148a6b356d4a5f41a174c421e25193dc3483baa3060afbbd46f78bf82abb3e0eea99373f33258814fc + checksum: 5b5cec0bacdefbccd7852970bfb517da10e3880f8377df150ddc71c9a146f830e10e35b97cbab958a32c930cb984c4682f9d36eeed965b4cb05e753dbcfbc7e5 languageName: node linkType: hard "@vue/compiler-dom@npm:^3.3.0": - version: 3.4.38 - resolution: "@vue/compiler-dom@npm:3.4.38" + version: 3.5.11 + resolution: "@vue/compiler-dom@npm:3.5.11" dependencies: - "@vue/compiler-core": 3.4.38 - "@vue/shared": 3.4.38 - checksum: eef48039b05727c545d2d13436ea529b239aa2151ba383b6938cb53204a6e867fd7f40f8fa69d1d27c86a51ca09f9ca15fc2e4bdb785e2702ee3a0b93a81d2fb + "@vue/compiler-core": 3.5.11 + "@vue/shared": 3.5.11 + checksum: 4e757cd1c023d73f9f33ae07a442bc9710e9aeb64dd4953a9f128232798d157c70b0cfb5d0a7d3af08ade0677545fe7376bb83839a7a0cca2f11b32d04f620d3 languageName: node linkType: hard @@ -987,10 +987,10 @@ __metadata: languageName: node linkType: hard -"@vue/shared@npm:3.4.38, @vue/shared@npm:^3.3.0": - version: 3.4.38 - resolution: "@vue/shared@npm:3.4.38" - checksum: 598d36eb2e4793d3c0b01594683fb37fd257ddfac7d02013c9d2d1f5e2ab5df41b2d9b1d1bf9384aa0cca69a4a2b09d43931c73c2e372dfe1e11bb6cbe16f5b0 +"@vue/shared@npm:3.5.11, @vue/shared@npm:^3.3.0": + version: 3.5.11 + resolution: "@vue/shared@npm:3.5.11" + checksum: cc754649b3ca364c2dc5bb4105cb1e836707733efb1d8b70acd50a46d50835ad07082a25f23b22c88c4f6fa0770c61e684abea9c92693091da80fdc86c8b22cf languageName: node linkType: hard @@ -1058,9 +1058,9 @@ __metadata: linkType: hard "ansi-regex@npm:^6.0.1": - version: 6.0.1 - resolution: "ansi-regex@npm:6.0.1" - checksum: 1ff8b7667cded1de4fa2c9ae283e979fc87036864317da86a2e546725f96406746411d0d85e87a2d12fa5abd715d90006de7fa4fa0477c92321ad3b4c7d4e169 + version: 6.1.0 + resolution: "ansi-regex@npm:6.1.0" + checksum: 495834a53b0856c02acd40446f7130cb0f8284f4a39afdab20d5dc42b2e198b1196119fe887beed8f9055c4ff2055e3b2f6d4641d0be018cdfb64fedf6fc1aac languageName: node linkType: hard @@ -1408,14 +1408,14 @@ __metadata: linkType: hard "debug@npm:4, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4": - version: 4.3.6 - resolution: "debug@npm:4.3.6" + version: 4.3.7 + resolution: "debug@npm:4.3.7" dependencies: - ms: 2.1.2 + ms: ^2.1.3 peerDependenciesMeta: supports-color: optional: true - checksum: 1630b748dea3c581295e02137a9f5cbe2c1d85fea35c1e6597a65ca2b16a6fce68cec61b299d480787ef310ba927dc8c92d3061faba0ad06c6a724672f66be7f + checksum: 822d74e209cd910ef0802d261b150314bbcf36c582ccdbb3e70f0894823c17e49a50d3e66d96b633524263975ca16b6a833f3e3b7e030c157169a5fabac63160 languageName: node linkType: hard @@ -1784,14 +1784,14 @@ __metadata: linkType: hard "eslint-module-utils@npm:^2.8.0": - version: 2.8.1 - resolution: "eslint-module-utils@npm:2.8.1" + version: 2.12.0 + resolution: "eslint-module-utils@npm:2.12.0" dependencies: debug: ^3.2.7 peerDependenciesMeta: eslint: optional: true - checksum: 3cecd99b6baf45ffc269167da0f95dcb75e5aa67b93d73a3bab63e2a7eedd9cdd6f188eed048e2f57c1b77db82c9cbf2adac20b512fa70e597d863dd3720170d + checksum: be3ac52e0971c6f46daeb1a7e760e45c7c45f820c8cc211799f85f10f04ccbf7afc17039165d56cb2da7f7ca9cec2b3a777013cddf0b976784b37eb9efa24180 languageName: node linkType: hard @@ -2558,11 +2558,11 @@ __metadata: linkType: hard "is-core-module@npm:^2.1.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.13.1": - version: 2.15.0 - resolution: "is-core-module@npm:2.15.0" + version: 2.15.1 + resolution: "is-core-module@npm:2.15.1" dependencies: hasown: ^2.0.2 - checksum: a9f7a52707c9b59d7164094d183bda892514fc3ba3139f245219c7abe7f6e8d3e2cdcf861f52a891a467f785f1dfa5d549f73b0ee715f4ba56e8882d335ea585 + checksum: df134c168115690724b62018c37b2f5bba0d5745fa16960b329c5a00883a8bea6a5632fdb1e3efcce237c201826ba09f93197b7cd95577ea56b0df335be23633 languageName: node linkType: hard @@ -2741,15 +2741,11 @@ __metadata: linkType: hard "jackspeak@npm:^4.0.1": - version: 4.0.1 - resolution: "jackspeak@npm:4.0.1" + version: 4.0.2 + resolution: "jackspeak@npm:4.0.2" dependencies: "@isaacs/cliui": ^8.0.2 - "@pkgjs/parseargs": ^0.11.0 - dependenciesMeta: - "@pkgjs/parseargs": - optional: true - checksum: 7989d19eddeff0631ef653df413e26290db77dc3791438bd12b56bed1c0b24d5d535fdfec13cf35775cd5b47f8ee57d36fd0bceaf2df672b1f523533fd4184cc + checksum: 210030029edfa1658328799ad88c3d0fc057c4cb8a069fc4137cc8d2cc4b65c9721c6e749e890f9ca77a954bb54f200f715b8896e50d330e5f3e902e72b40974 languageName: node linkType: hard @@ -2945,9 +2941,9 @@ __metadata: linkType: hard "lru-cache@npm:^11.0.0": - version: 11.0.0 - resolution: "lru-cache@npm:11.0.0" - checksum: c29385f9369b1a566e1db9eda9a4b12f6507de906e5720ca12844dd775b7139c42b8e5837e7d5162bcc292ce4d3eecfa74ec2856c6afcc0caa2e3c9ea3a17f27 + version: 11.0.1 + resolution: "lru-cache@npm:11.0.1" + checksum: 6056230a99fb399234e82368b99586bd4740079e80649102f681b19337b7d8c6bc8dd7f8b8c59377c31d26deb89f548b717ae932e139b4b795879d920fccf820 languageName: node linkType: hard @@ -2995,12 +2991,12 @@ __metadata: linkType: hard "micromatch@npm:^4.0.4": - version: 4.0.7 - resolution: "micromatch@npm:4.0.7" + version: 4.0.8 + resolution: "micromatch@npm:4.0.8" dependencies: braces: ^3.0.3 picomatch: ^2.3.1 - checksum: 3cde047d70ad80cf60c787b77198d680db3b8c25b23feb01de5e2652205d9c19f43bd81882f69a0fd1f0cde6a7a122d774998aad3271ddb1b8accf8a0f480cf7 + checksum: 79920eb634e6f400b464a954fcfa589c4e7c7143209488e44baf627f9affc8b1e306f41f4f0deedde97e69cb725920879462d3e750ab3bd3c1aed675bb3a8966 languageName: node linkType: hard @@ -3140,14 +3136,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.2": - version: 2.1.2 - resolution: "ms@npm:2.1.2" - checksum: 673cdb2c3133eb050c745908d8ce632ed2c02d85640e2edb3ace856a2266a813b30c613569bf3354fdf4ea7d1a1494add3bfa95e2713baa27d0c2c71fc44f58f - languageName: node - linkType: hard - -"ms@npm:^2.1.1": +"ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d @@ -3347,9 +3336,9 @@ __metadata: linkType: hard "package-json-from-dist@npm:^1.0.0": - version: 1.0.0 - resolution: "package-json-from-dist@npm:1.0.0" - checksum: ac706ec856a5a03f5261e4e48fa974f24feb044d51f84f8332e2af0af04fbdbdd5bbbfb9cbbe354190409bc8307c83a9e38c6672c3c8855f709afb0006a009ea + version: 1.0.1 + resolution: "package-json-from-dist@npm:1.0.1" + checksum: 58ee9538f2f762988433da00e26acc788036914d57c71c246bf0be1b60cdbd77dd60b6a3e1a30465f0b248aeb80079e0b34cb6050b1dfa18c06953bb1cbc7602 languageName: node linkType: hard @@ -3431,10 +3420,10 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^1.0.1": - version: 1.0.1 - resolution: "picocolors@npm:1.0.1" - checksum: fa68166d1f56009fc02a34cdfd112b0dd3cf1ef57667ac57281f714065558c01828cdf4f18600ad6851cbe0093952ed0660b1e0156bddf2184b6aaf5817553a5 +"picocolors@npm:^1.1.0": + version: 1.1.0 + resolution: "picocolors@npm:1.1.0" + checksum: a64d653d3a188119ff45781dfcdaeedd7625583f45280aea33fcb032c7a0d3959f2368f9b192ad5e8aade75b74dbd954ffe3106c158509a45e4c18ab379a2acd languageName: node linkType: hard @@ -3453,13 +3442,13 @@ __metadata: linkType: hard "postcss@npm:^8.4.35": - version: 8.4.41 - resolution: "postcss@npm:8.4.41" + version: 8.4.47 + resolution: "postcss@npm:8.4.47" dependencies: nanoid: ^3.3.7 - picocolors: ^1.0.1 - source-map-js: ^1.2.0 - checksum: f865894929eb0f7fc2263811cc853c13b1c75103028b3f4f26df777e27b201f1abe21cb4aa4c2e901c80a04f6fb325ee22979688fe55a70e2ea82b0a517d3b6f + picocolors: ^1.1.0 + source-map-js: ^1.2.1 + checksum: f78440a9d8f97431dd2ab1ab8e1de64f12f3eff38a3d8d4a33919b96c381046a314658d2de213a5fa5eb296b656de76a3ec269fdea27f16d5ab465b916a0f52c languageName: node linkType: hard @@ -3551,14 +3540,14 @@ __metadata: linkType: hard "regexp.prototype.flags@npm:^1.5.2": - version: 1.5.2 - resolution: "regexp.prototype.flags@npm:1.5.2" + version: 1.5.3 + resolution: "regexp.prototype.flags@npm:1.5.3" dependencies: - call-bind: ^1.0.6 + call-bind: ^1.0.7 define-properties: ^1.2.1 es-errors: ^1.3.0 - set-function-name: ^2.0.1 - checksum: d7f333667d5c564e2d7a97c56c3075d64c722c9bb51b2b4df6822b2e8096d623a5e63088fb4c83df919b6951ef8113841de8b47de7224872fa6838bc5d8a7d64 + set-function-name: ^2.0.2 + checksum: 83ff0705b837f7cb6d664010a11642250f36d3f642263dd0f3bdfe8f150261aa7b26b50ee97f21c1da30ef82a580bb5afedbef5f45639d69edaafbeac9bbb0ed languageName: node linkType: hard @@ -3641,26 +3630,26 @@ __metadata: linkType: hard "rollup@npm:^4.2.0": - version: 4.20.0 - resolution: "rollup@npm:4.20.0" - dependencies: - "@rollup/rollup-android-arm-eabi": 4.20.0 - "@rollup/rollup-android-arm64": 4.20.0 - "@rollup/rollup-darwin-arm64": 4.20.0 - "@rollup/rollup-darwin-x64": 4.20.0 - "@rollup/rollup-linux-arm-gnueabihf": 4.20.0 - "@rollup/rollup-linux-arm-musleabihf": 4.20.0 - "@rollup/rollup-linux-arm64-gnu": 4.20.0 - "@rollup/rollup-linux-arm64-musl": 4.20.0 - "@rollup/rollup-linux-powerpc64le-gnu": 4.20.0 - "@rollup/rollup-linux-riscv64-gnu": 4.20.0 - "@rollup/rollup-linux-s390x-gnu": 4.20.0 - "@rollup/rollup-linux-x64-gnu": 4.20.0 - "@rollup/rollup-linux-x64-musl": 4.20.0 - "@rollup/rollup-win32-arm64-msvc": 4.20.0 - "@rollup/rollup-win32-ia32-msvc": 4.20.0 - "@rollup/rollup-win32-x64-msvc": 4.20.0 - "@types/estree": 1.0.5 + version: 4.24.0 + resolution: "rollup@npm:4.24.0" + dependencies: + "@rollup/rollup-android-arm-eabi": 4.24.0 + "@rollup/rollup-android-arm64": 4.24.0 + "@rollup/rollup-darwin-arm64": 4.24.0 + "@rollup/rollup-darwin-x64": 4.24.0 + "@rollup/rollup-linux-arm-gnueabihf": 4.24.0 + "@rollup/rollup-linux-arm-musleabihf": 4.24.0 + "@rollup/rollup-linux-arm64-gnu": 4.24.0 + "@rollup/rollup-linux-arm64-musl": 4.24.0 + "@rollup/rollup-linux-powerpc64le-gnu": 4.24.0 + "@rollup/rollup-linux-riscv64-gnu": 4.24.0 + "@rollup/rollup-linux-s390x-gnu": 4.24.0 + "@rollup/rollup-linux-x64-gnu": 4.24.0 + "@rollup/rollup-linux-x64-musl": 4.24.0 + "@rollup/rollup-win32-arm64-msvc": 4.24.0 + "@rollup/rollup-win32-ia32-msvc": 4.24.0 + "@rollup/rollup-win32-x64-msvc": 4.24.0 + "@types/estree": 1.0.6 fsevents: ~2.3.2 dependenciesMeta: "@rollup/rollup-android-arm-eabi": @@ -3699,7 +3688,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: 92c6c68a93d7726345df2627fd5b0a88d1481fbe76e6c8ad84a8eae6835c03fc36ed4cb3271350b5290397b26eb97a97297496ca972289b2299a24e81649bca0 + checksum: b7e915b0cc43749c2c71255ff58858496460b1a75148db2abecc8e9496af83f488517768593826715f610e20e480a5ae7f1132a1408eb1d364830d6b239325cf languageName: node linkType: hard @@ -3812,7 +3801,7 @@ __metadata: languageName: node linkType: hard -"set-function-name@npm:^2.0.1": +"set-function-name@npm:^2.0.2": version: 2.0.2 resolution: "set-function-name@npm:2.0.2" dependencies: @@ -3901,10 +3890,10 @@ __metadata: languageName: node linkType: hard -"source-map-js@npm:^1.2.0": - version: 1.2.0 - resolution: "source-map-js@npm:1.2.0" - checksum: 791a43306d9223792e84293b00458bf102a8946e7188f3db0e4e22d8d530b5f80a4ce468eb5ec0bf585443ad55ebbd630bf379c98db0b1f317fd902500217f97 +"source-map-js@npm:^1.2.0, source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 4eb0cd997cdf228bc253bcaff9340afeb706176e64868ecd20efbe6efea931465f43955612346d6b7318789e5265bdc419bc7669c1cebe3db0eb255f57efa76b languageName: node linkType: hard @@ -4157,9 +4146,9 @@ __metadata: linkType: hard "tslib@npm:^2.6.2": - version: 2.6.3 - resolution: "tslib@npm:2.6.3" - checksum: 74fce0e100f1ebd95b8995fbbd0e6c91bdd8f4c35c00d4da62e285a3363aaa534de40a80db30ecfd388ed7c313c42d930ee0eaf108e8114214b180eec3dbe6f5 + version: 2.7.0 + resolution: "tslib@npm:2.7.0" + checksum: 1606d5c89f88d466889def78653f3aab0f88692e80bb2066d090ca6112ae250ec1cfa9dbfaab0d17b60da15a4186e8ec4d893801c67896b277c17374e36e1d28 languageName: node linkType: hard @@ -4283,10 +4272,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~6.18.2": - version: 6.18.2 - resolution: "undici-types@npm:6.18.2" - checksum: 5cd9b1c0fc612603c7ba0f0c6a19d04f00d21b98c5a9da06dc3bf92f1f9d3ec3946322e9806ec0f2fbfbad3f248cde1988410fc30ffacee39693ac24078992ca +"undici-types@npm:~6.19.2": + version: 6.19.8 + resolution: "undici-types@npm:6.19.8" + checksum: de51f1b447d22571cf155dfe14ff6d12c5bdaec237c765085b439c38ca8518fc360e88c70f99469162bf2e14188a7b0bcb06e1ed2dc031042b984b0bb9544017 languageName: node linkType: hard From ed6eca279db207868917a9392b375c284f38e14f Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Fri, 4 Oct 2024 11:07:49 -0500 Subject: [PATCH 50/51] build examples --- examples/AngleMeasurement/index.html | 9 +- examples/AreaMeasurement/index.html | 9 +- examples/BCFTopics/index.html | 8 +- examples/BoundingBoxer/index.html | 9 +- examples/Civil3DNavigator/index.html | 9 +- .../CivilCrossSectionNavigator/index.html | 13 +- examples/CivilElevationNavigator/index.html | 13 +- examples/CivilPlanNavigator/index.html | 13 +- examples/Classifier/index.html | 9 +- examples/ClipEdges/index.html | 11 +- examples/Clipper/index.html | 9 +- examples/Cullers/index.html | 7 +- examples/EdgeMeasurement/index.html | 9 +- examples/Exploder/index.html | 9 +- examples/FaceMeasurement/index.html | 9 +- examples/FragmentsManager/index.html | 9 +- examples/Grids/index.html | 6 +- examples/Hider/index.html | 9 +- examples/Highlighter/index.html | 9 +- examples/IDSSpecifications/index.html | 51 + examples/IfcFinder/index.html | 71 + examples/IfcGeometryTiler/index.html | 9 +- examples/IfcJsonExporter/index.html | 9 +- examples/IfcLoader/index.html | 9 +- examples/IfcPropertiesManager/index.html | 5 +- examples/IfcPropertiesTiler/index.html | 9 +- examples/IfcRelationsIndexer/index.html | 10 +- examples/IfcStreamer/index.html | 9 +- examples/LengthMeasurement/index.html | 11 +- examples/Marker/index.html | 9 +- examples/MeasurementUtils/index.html | 7 +- examples/MiniMap/index.html | 9 +- examples/OrthoPerspectiveCamera/index.html | 9 +- examples/Plans/index.html | 11 +- examples/PostproductionRenderer/index.html | 11 +- examples/Raycasters/index.html | 7 +- examples/Sections/index.html | 11 +- examples/ShadowDropper/index.html | 11 +- examples/ShadowedScene/index.html | 7 +- examples/VolumeMeasurement/index.html | 9 +- examples/Worlds/index.html | 9 +- examples/assets/_commonjsHelpers-Cpj98o6Y.js | 1 - examples/assets/angleMeasurement.js | 2 +- examples/assets/areaMeasurement.js | 2 +- examples/assets/bCFTopics.js | 71 +- examples/assets/boundingBoxer.js | 8 +- examples/assets/civil3DNavigator.js | 2 +- examples/assets/civilCrossSectionNavigator.js | 2 +- examples/assets/civilElevationNavigator.js | 2 +- examples/assets/civilPlanNavigator.js | 2 +- examples/assets/classifier.js | 18 +- examples/assets/clipEdges.js | 6 +- examples/assets/clipper.js | 20 +- examples/assets/cullers.js | 2 +- examples/assets/edgeMeasurement.js | 2 +- examples/assets/exploder.js | 8 +- examples/assets/faceMeasurement.js | 2 +- examples/assets/fragmentsManager.js | 12 +- examples/assets/grids.js | 32 +- examples/assets/hider.js | 16 +- examples/assets/highlighter.js | 2 +- examples/assets/iDSSpecifications.js | 1 + examples/assets/ifcFinder.js | 24 + examples/assets/ifcGeometryTiler.js | 8 +- examples/assets/ifcJsonExporter.js | 4 +- examples/assets/ifcLoader.js | 14 +- examples/assets/ifcPropertiesManager.js | 2 +- examples/assets/ifcPropertiesTiler.js | 8 +- examples/assets/ifcRelationsIndexer.js | 15 +- examples/assets/ifcStreamer.js | 2 +- examples/assets/index-6e07lNWw.js | 306 +++ examples/assets/index-BELYWC4t.js | 162 -- .../{index-BPTct15x.js => index-CO3KVvRB.js} | 724 ++++---- examples/assets/index-Cbq44wZW.js | 263 --- examples/assets/index-Cs1SYVzD.js | 205 ++ examples/assets/index-DDq_E_eW.js | 1644 +++++++++++++++++ examples/assets/index-DDyOrdLb.js | 62 + examples/assets/index-DconH7kp.js | 1603 ---------------- .../{index-CqPyogbW.js => index-DtbylpTq.js} | 496 ++--- examples/assets/lengthMeasurement.js | 8 +- examples/assets/marker.js | 2 +- examples/assets/measurementUtils.js | 2 +- examples/assets/miniMap.js | 30 +- examples/assets/orthoPerspectiveCamera.js | 14 +- examples/assets/plans.js | 4 +- examples/assets/postproductionRenderer.js | 6 +- examples/assets/raycasters.js | 2 +- examples/assets/sections.js | 10 +- examples/assets/shadowDropper.js | 8 +- examples/assets/shadowedScene.js | 2 +- examples/assets/stats.min-GTpOrGrX.js | 1 - examples/assets/stats.min-bmkVNhZk.js | 1 + examples/assets/volumeMeasurement.js | 2 +- ...pi-CgBULNZm.js => web-ifc-api-Dlf_dxms.js} | 154 +- examples/assets/worlds.js | 14 +- examples/paths.json | 2 +- 96 files changed, 3416 insertions(+), 3083 deletions(-) create mode 100644 examples/IDSSpecifications/index.html create mode 100644 examples/IfcFinder/index.html delete mode 100644 examples/assets/_commonjsHelpers-Cpj98o6Y.js create mode 100644 examples/assets/iDSSpecifications.js create mode 100644 examples/assets/ifcFinder.js create mode 100644 examples/assets/index-6e07lNWw.js delete mode 100644 examples/assets/index-BELYWC4t.js rename examples/assets/{index-BPTct15x.js => index-CO3KVvRB.js} (52%) delete mode 100644 examples/assets/index-Cbq44wZW.js create mode 100644 examples/assets/index-Cs1SYVzD.js create mode 100644 examples/assets/index-DDq_E_eW.js create mode 100644 examples/assets/index-DDyOrdLb.js delete mode 100644 examples/assets/index-DconH7kp.js rename examples/assets/{index-CqPyogbW.js => index-DtbylpTq.js} (51%) delete mode 100644 examples/assets/stats.min-GTpOrGrX.js create mode 100644 examples/assets/stats.min-bmkVNhZk.js rename examples/assets/{web-ifc-api-CgBULNZm.js => web-ifc-api-Dlf_dxms.js} (51%) diff --git a/examples/AngleMeasurement/index.html b/examples/AngleMeasurement/index.html index 42fae54d0..68dc031c8 100644 --- a/examples/AngleMeasurement/index.html +++ b/examples/AngleMeasurement/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/AreaMeasurement/index.html b/examples/AreaMeasurement/index.html index ed463e888..189572a64 100644 --- a/examples/AreaMeasurement/index.html +++ b/examples/AreaMeasurement/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/BCFTopics/index.html b/examples/BCFTopics/index.html index f783890f8..131955170 100644 --- a/examples/BCFTopics/index.html +++ b/examples/BCFTopics/index.html @@ -40,10 +40,10 @@ } - - - - + + + + diff --git a/examples/BoundingBoxer/index.html b/examples/BoundingBoxer/index.html index c24e7f123..80fa24ab0 100644 --- a/examples/BoundingBoxer/index.html +++ b/examples/BoundingBoxer/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Civil3DNavigator/index.html b/examples/Civil3DNavigator/index.html index 9d0533524..cffe59d9e 100644 --- a/examples/Civil3DNavigator/index.html +++ b/examples/Civil3DNavigator/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/CivilCrossSectionNavigator/index.html b/examples/CivilCrossSectionNavigator/index.html index 42cb3c65b..66104f2fe 100644 --- a/examples/CivilCrossSectionNavigator/index.html +++ b/examples/CivilCrossSectionNavigator/index.html @@ -76,13 +76,12 @@ - - - - - - - + + + + + + diff --git a/examples/CivilElevationNavigator/index.html b/examples/CivilElevationNavigator/index.html index d1627fd7f..8ae315365 100644 --- a/examples/CivilElevationNavigator/index.html +++ b/examples/CivilElevationNavigator/index.html @@ -77,13 +77,12 @@ - - - - - - - + + + + + + diff --git a/examples/CivilPlanNavigator/index.html b/examples/CivilPlanNavigator/index.html index 8a4138a75..061ab6d08 100644 --- a/examples/CivilPlanNavigator/index.html +++ b/examples/CivilPlanNavigator/index.html @@ -66,13 +66,12 @@ - - - - - - - + + + + + + diff --git a/examples/Classifier/index.html b/examples/Classifier/index.html index d7bb80226..15220835a 100644 --- a/examples/Classifier/index.html +++ b/examples/Classifier/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/ClipEdges/index.html b/examples/ClipEdges/index.html index 7511b0ee3..b9c68bfa5 100644 --- a/examples/ClipEdges/index.html +++ b/examples/ClipEdges/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/Clipper/index.html b/examples/Clipper/index.html index 0218e414d..0307d8e34 100644 --- a/examples/Clipper/index.html +++ b/examples/Clipper/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Cullers/index.html b/examples/Cullers/index.html index 6f84b4cdb..3f76d11e8 100644 --- a/examples/Cullers/index.html +++ b/examples/Cullers/index.html @@ -58,10 +58,9 @@ - - - - + + + diff --git a/examples/EdgeMeasurement/index.html b/examples/EdgeMeasurement/index.html index 7007d84ca..48fea66e9 100644 --- a/examples/EdgeMeasurement/index.html +++ b/examples/EdgeMeasurement/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Exploder/index.html b/examples/Exploder/index.html index 6b3636971..c3108ffbf 100644 --- a/examples/Exploder/index.html +++ b/examples/Exploder/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/FaceMeasurement/index.html b/examples/FaceMeasurement/index.html index 3211bb844..26720988d 100644 --- a/examples/FaceMeasurement/index.html +++ b/examples/FaceMeasurement/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/FragmentsManager/index.html b/examples/FragmentsManager/index.html index f70f18fcc..b1f3118e6 100644 --- a/examples/FragmentsManager/index.html +++ b/examples/FragmentsManager/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Grids/index.html b/examples/Grids/index.html index 6409a1811..a7bc119d5 100644 --- a/examples/Grids/index.html +++ b/examples/Grids/index.html @@ -64,8 +64,10 @@ - - + + + + diff --git a/examples/Hider/index.html b/examples/Hider/index.html index 9ab036907..d74e1c197 100644 --- a/examples/Hider/index.html +++ b/examples/Hider/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Highlighter/index.html b/examples/Highlighter/index.html index 420017548..bc2fff01f 100644 --- a/examples/Highlighter/index.html +++ b/examples/Highlighter/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/IDSSpecifications/index.html b/examples/IDSSpecifications/index.html new file mode 100644 index 000000000..32c165f07 --- /dev/null +++ b/examples/IDSSpecifications/index.html @@ -0,0 +1,51 @@ + + + + + + + IDS Specifications + + + + + + + + + + + \ No newline at end of file diff --git a/examples/IfcFinder/index.html b/examples/IfcFinder/index.html new file mode 100644 index 000000000..208e61ad9 --- /dev/null +++ b/examples/IfcFinder/index.html @@ -0,0 +1,71 @@ + + + + + + + + + + + IfcFinder + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/examples/IfcGeometryTiler/index.html b/examples/IfcGeometryTiler/index.html index eda659155..81a046a8d 100644 --- a/examples/IfcGeometryTiler/index.html +++ b/examples/IfcGeometryTiler/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/IfcJsonExporter/index.html b/examples/IfcJsonExporter/index.html index de159f2fa..b7e8d91c2 100644 --- a/examples/IfcJsonExporter/index.html +++ b/examples/IfcJsonExporter/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/IfcLoader/index.html b/examples/IfcLoader/index.html index 06e28eab6..b1b6f58f2 100644 --- a/examples/IfcLoader/index.html +++ b/examples/IfcLoader/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/IfcPropertiesManager/index.html b/examples/IfcPropertiesManager/index.html index e283181fb..e7c0ade6e 100644 --- a/examples/IfcPropertiesManager/index.html +++ b/examples/IfcPropertiesManager/index.html @@ -6,9 +6,8 @@ Ifc Properties Manager - - - + + diff --git a/examples/IfcPropertiesTiler/index.html b/examples/IfcPropertiesTiler/index.html index 43c41425d..3074f025c 100644 --- a/examples/IfcPropertiesTiler/index.html +++ b/examples/IfcPropertiesTiler/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/IfcRelationsIndexer/index.html b/examples/IfcRelationsIndexer/index.html index 156faf792..5d6c0e27e 100644 --- a/examples/IfcRelationsIndexer/index.html +++ b/examples/IfcRelationsIndexer/index.html @@ -58,11 +58,11 @@ - - - - - + + + + + diff --git a/examples/IfcStreamer/index.html b/examples/IfcStreamer/index.html index e73c8745e..bd3e4af11 100644 --- a/examples/IfcStreamer/index.html +++ b/examples/IfcStreamer/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/LengthMeasurement/index.html b/examples/LengthMeasurement/index.html index c448284c3..aa061be1c 100644 --- a/examples/LengthMeasurement/index.html +++ b/examples/LengthMeasurement/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/Marker/index.html b/examples/Marker/index.html index 5a3aa3283..a5abc4899 100644 --- a/examples/Marker/index.html +++ b/examples/Marker/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/MeasurementUtils/index.html b/examples/MeasurementUtils/index.html index 422534f5f..0d80b9b17 100644 --- a/examples/MeasurementUtils/index.html +++ b/examples/MeasurementUtils/index.html @@ -58,10 +58,9 @@ - - - - + + + diff --git a/examples/MiniMap/index.html b/examples/MiniMap/index.html index 2ad9ccec8..9f9f52731 100644 --- a/examples/MiniMap/index.html +++ b/examples/MiniMap/index.html @@ -64,11 +64,10 @@ - - - - - + + + + diff --git a/examples/OrthoPerspectiveCamera/index.html b/examples/OrthoPerspectiveCamera/index.html index 0496bd0e3..8c9567b9c 100644 --- a/examples/OrthoPerspectiveCamera/index.html +++ b/examples/OrthoPerspectiveCamera/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Plans/index.html b/examples/Plans/index.html index 28cb5951f..d30d6a820 100644 --- a/examples/Plans/index.html +++ b/examples/Plans/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/PostproductionRenderer/index.html b/examples/PostproductionRenderer/index.html index 2a07464c5..1f44cae16 100644 --- a/examples/PostproductionRenderer/index.html +++ b/examples/PostproductionRenderer/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/Raycasters/index.html b/examples/Raycasters/index.html index 2cd55bf34..2703c02a8 100644 --- a/examples/Raycasters/index.html +++ b/examples/Raycasters/index.html @@ -58,10 +58,9 @@ - - - - + + + diff --git a/examples/Sections/index.html b/examples/Sections/index.html index 6742310c9..b07954cdb 100644 --- a/examples/Sections/index.html +++ b/examples/Sections/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/ShadowDropper/index.html b/examples/ShadowDropper/index.html index 050178dea..69f986441 100644 --- a/examples/ShadowDropper/index.html +++ b/examples/ShadowDropper/index.html @@ -58,12 +58,11 @@ - - - - - - + + + + + diff --git a/examples/ShadowedScene/index.html b/examples/ShadowedScene/index.html index 595c97b67..2aeaf55a4 100644 --- a/examples/ShadowedScene/index.html +++ b/examples/ShadowedScene/index.html @@ -64,10 +64,9 @@ - - - - + + + diff --git a/examples/VolumeMeasurement/index.html b/examples/VolumeMeasurement/index.html index 1f4f16cac..8ab3440b1 100644 --- a/examples/VolumeMeasurement/index.html +++ b/examples/VolumeMeasurement/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/Worlds/index.html b/examples/Worlds/index.html index e3dd36381..7810a56aa 100644 --- a/examples/Worlds/index.html +++ b/examples/Worlds/index.html @@ -58,11 +58,10 @@ - - - - - + + + + diff --git a/examples/assets/_commonjsHelpers-Cpj98o6Y.js b/examples/assets/_commonjsHelpers-Cpj98o6Y.js deleted file mode 100644 index b285ce543..000000000 --- a/examples/assets/_commonjsHelpers-Cpj98o6Y.js +++ /dev/null @@ -1 +0,0 @@ -var o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}export{o as c,l as g}; diff --git a/examples/assets/angleMeasurement.js b/examples/assets/angleMeasurement.js index 79028da68..88f2e0a02 100644 --- a/examples/assets/angleMeasurement.js +++ b/examples/assets/angleMeasurement.js @@ -1 +1 @@ -import{B as c,M as d,a as l}from"./web-ifc-api-CgBULNZm.js";import{o as m,a as i,L as w,N as p,l as u}from"./index-Cbq44wZW.js";import{$ as b,a as f}from"./index-DconH7kp.js";import{S as g}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";const r=document.getElementById("container"),o=new m,y=o.get(i),e=y.create();e.scene=new w(o);e.renderer=new b(o,r);e.camera=new p(o);o.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const h=o.get(u);h.create(e);e.scene.three.background=null;const k=new c(3,3,3),B=new d({color:"#6528D7"}),a=new l(k,B);a.position.set(0,1.5,0);e.scene.three.add(a);e.meshes.add(a);const t=o.get(f);t.world=e;t.enabled=!0;r.ondblclick=()=>t.create();window.onkeydown=s=>{(s.code==="Delete"||s.code==="Backspace")&&t.deleteAll()};const n=new g;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import{B as c,M as d,a as l}from"./web-ifc-api-Dlf_dxms.js";import{p as m,A as i,e as p,v as w,O as u}from"./index-6e07lNWw.js";import{P as b,a as f}from"./index-DDq_E_eW.js";import{S as g}from"./stats.min-bmkVNhZk.js";const r=document.getElementById("container"),n=new m,y=n.get(i),e=y.create();e.scene=new p(n);e.renderer=new b(n,r);e.camera=new w(n);n.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const h=n.get(u);h.create(e);e.scene.three.background=null;const k=new c(3,3,3),A=new d({color:"#6528D7"}),s=new l(k,A);s.position.set(0,1.5,0);e.scene.three.add(s);e.meshes.add(s);const o=n.get(f);o.world=e;o.enabled=!0;r.ondblclick=()=>o.create();window.onkeydown=a=>{(a.code==="Delete"||a.code==="Backspace")&&o.deleteAll()};const t=new g;t.showPanel(2);document.body.append(t.dom);t.dom.style.left="0px";t.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>t.begin());e.renderer.onAfterUpdate.add(()=>t.end()); diff --git a/examples/assets/areaMeasurement.js b/examples/assets/areaMeasurement.js index 670a696d4..ce49c5d72 100644 --- a/examples/assets/areaMeasurement.js +++ b/examples/assets/areaMeasurement.js @@ -1 +1 @@ -import{B as c,M as d,a as l}from"./web-ifc-api-CgBULNZm.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{o as i,a as w,L as p,N as u,l as b}from"./index-Cbq44wZW.js";import{$ as f,J as g}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const a=document.getElementById("container"),n=new i,y=n.get(w),e=y.create();e.scene=new p(n);e.renderer=new f(n,a);e.camera=new u(n);n.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const h=n.get(b);h.create(e);e.scene.three.background=null;const k=new c(3,3,3),B=new d({color:"#6528D7"}),s=new l(k,B);s.position.set(0,1.5,0);e.scene.three.add(s);e.meshes.add(s);const t=n.get(g);t.world=e;t.enabled=!0;a.ondblclick=()=>t.create();a.oncontextmenu=()=>t.endCreation();window.onkeydown=r=>{(r.code==="Delete"||r.code==="Backspace")&&t.deleteAll()};const o=new m;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); +import{B as c,M as d,a as m}from"./web-ifc-api-Dlf_dxms.js";import{S as l}from"./stats.min-bmkVNhZk.js";import{p as i,A as p,e as w,v as u,O as b}from"./index-6e07lNWw.js";import{P as f,o as g}from"./index-DDq_E_eW.js";const s=document.getElementById("container"),n=new i,y=n.get(p),e=y.create();e.scene=new w(n);e.renderer=new f(n,s);e.camera=new u(n);n.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const h=n.get(b);h.create(e);e.scene.three.background=null;const k=new c(3,3,3),A=new d({color:"#6528D7"}),a=new m(k,A);a.position.set(0,1.5,0);e.scene.three.add(a);e.meshes.add(a);const t=n.get(g);t.world=e;t.enabled=!0;s.ondblclick=()=>t.create();s.oncontextmenu=()=>t.endCreation();window.onkeydown=r=>{(r.code==="Delete"||r.code==="Backspace")&&t.deleteAll()};const o=new l;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); diff --git a/examples/assets/bCFTopics.js b/examples/assets/bCFTopics.js index 2b898cacb..88f10384d 100644 --- a/examples/assets/bCFTopics.js +++ b/examples/assets/bCFTopics.js @@ -1,74 +1,13 @@ -var A=Object.defineProperty;var I=(n,s,e)=>s in n?A(n,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[s]=e;var i=(n,s,e)=>(I(n,typeof s!="symbol"?s+"":s,e),e);import{C as h,V as W,z as Z,D as O,A as T,W as z,h as C,N as V,at as k,Q as G,a as j,bb as H}from"./web-ifc-api-CgBULNZm.js";import{d as N,R as y,m as x}from"./index-CqPyogbW.js";import{B as L,E as l,D as E,S as g,C as $,a as Q,W as q,I as J,b as K,F as X,c as Y,V as ee}from"./index-BELYWC4t.js";import"./_commonjsHelpers-Cpj98o6Y.js";class te extends L{constructor(){super(...arguments);i(this,"onAfterUpdate",new l);i(this,"onBeforeUpdate",new l);i(this,"onDisposed",new l);i(this,"onResize",new l);i(this,"onClippingPlanesUpdated",new l);i(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,o){t.isLocal=o;const r=this.clippingPlanes.indexOf(t);e&&r===-1?this.clippingPlanes.push(t):!e&&r>-1&&this.clippingPlanes.splice(r,1),this.three.clippingPlanes=this.clippingPlanes.filter(c=>!c.isLocal)}}class ie extends L{constructor(e){super(e);i(this,"onDisposed",new l);i(this,"directionalLights",new Map);i(this,"ambientLights",new Map)}dispose(){const e=this.components.get(E);for(const t of this.three.children){const o=t;o.geometry&&e.destroy(o)}for(const[,t]of this.directionalLights)t.removeFromParent(),t.target.removeFromParent(),t.dispose();for(const[,t]of this.ambientLights)t.removeFromParent(),t.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class se extends ie{constructor(e){super(e);i(this,"isSetup",!1);i(this,"three");i(this,"onSetup",new l);i(this,"config",{directionalLight:{color:new h("white"),intensity:1.5,position:new W(5,10,3)},ambientLight:{color:new h("white"),intensity:1}});this.three=new Z,this.three.background=new h(2107698)}setup(e){this.config={...this.config,...e};const t=new O(this.config.directionalLight.color,this.config.directionalLight.intensity);t.position.copy(this.config.directionalLight.position);const o=new T(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(t,o),this.directionalLights.set(t.uuid,t),this.ambientLights.set(o.uuid,o),this.isSetup=!0,this.onSetup.trigger(this)}}class ne extends te{constructor(e,t,o){super(e);i(this,"enabled",!0);i(this,"container");i(this,"three");i(this,"_canvas");i(this,"_parameters");i(this,"_resizeObserver",null);i(this,"onContainerUpdated",new l);i(this,"_resizing",!1);i(this,"resize",e=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const t=e?e.x:this.container.clientWidth,o=e?e.y:this.container.clientHeight;this.three.setSize(t,o),this.onResize.trigger(new C(t,o)),this._resizing=!1});i(this,"resizeEvent",()=>{this.resize()});i(this,"onContextLost",e=>{e.preventDefault(),this.enabled=!1});i(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new z({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=t,this._parameters=o,this.three=new z({antialias:!0,alpha:!0,...o}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const r=this.three.getContext(),{canvas:c}=r;c.addEventListener("webglcontextlost",this.onContextLost,!1),c.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new C(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}class oe{constructor(s,e,t){i(this,"onDisposed",new l);i(this,"world");i(this,"components");i(this,"three");i(this,"_fade",3);i(this,"updateZoom",()=>{this.world.camera instanceof g&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=e;const{color:o,size1:r,size2:c,distance:R}=t;this.components=s;const M=new V(2,2,1,1),U=new k({side:G,uniforms:{uSize1:{value:r},uSize2:{value:c},uColor:{value:o},uDistance:{value:R},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` - - varying vec3 worldPosition; - - uniform float uDistance; - - void main() { - - vec3 pos = position.xzy * uDistance; - pos.xz += cameraPosition.xz; - - worldPosition = pos; - - gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); - - } - `,fragmentShader:` - - varying vec3 worldPosition; - - uniform float uZoom; - uniform float uFade; - uniform float uSize1; - uniform float uSize2; - uniform vec3 uColor; - uniform float uDistance; - - - - float getGrid(float size) { - - vec2 r = worldPosition.xz / size; - - - vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r); - float line = min(grid.x, grid.y); - - - return 1.0 - min(line, 1.0); - } - - void main() { - - - float d = 1.0 - min(distance(cameraPosition.xz, worldPosition.xz) / uDistance, 1.0); - - float g1 = getGrid(uSize1); - float g2 = getGrid(uSize2); - - // Ortho camera fades the grid away when zooming out - float minZoom = step(0.2, uZoom); - float zoomFactor = pow(min(uZoom, 1.), 2.) * minZoom; - - gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, uFade)); - gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2) * zoomFactor; - - if ( gl_FragColor.a <= 0.0 ) discard; - - - } - - `,extensions:{derivatives:!0}});this.three=new j(M,U),this.three.frustumCulled=!1,e.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(s){s?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(E).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(this.world.isDisposing||!(this.world.camera instanceof g))return;const e=this.world.camera.controls;s?e.addEventListener("update",this.updateZoom):e.removeEventListener("update",this.updateZoom)}}const m=class m extends ${constructor(e){super(e);i(this,"list",new Map);i(this,"config",{color:new h(12303291),size1:1,size2:10,distance:500});i(this,"onDisposed",new l);i(this,"enabled",!0);e.add(m.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new oe(this.components,e,this.config);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};i(m,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let f=m;N.init();const a=new Q,re=a.get(q),d=re.create(),D=new se(a);D.setup();d.scene=D;d.scene.three.add(new H(10));const u=document.createElement("bim-viewport"),P=new ne(a,u);d.renderer=P;const S=new g(a);d.camera=S;u.addEventListener("resize",()=>{P.resize(),S.updateAspect()});const w=document.createElement("bim-grid");w.floating=!0;u.append(w);const ae=a.get(f);ae.create(d);a.init();const _=a.get(J);await _.setup();const ce=a.get(K),le=a.get(X);le.onFragmentsLoaded.add(async n=>{d.scene.three.add(n),n.hasProperties&&await ce.process(n);for(const s of n.items)d.meshes.add(s.mesh)});const de=async n=>{const s=[];for(const e of n){const o=await(await fetch(e)).arrayBuffer(),r=new Uint8Array(o),c=await _.load(r);s.push(c)}return s},he=await de(["https://thatopen.github.io/engine_components/resources/small.ifc"]),pe=he[0],p=a.get(Y);p.setup({types:new Set([...p.config.types,"Information","Coordination"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),users:new Set(["juan.hoyos4@gmail.com"])});const me=a.get(ee);w.layouts={main:{template:` +import{bk as I}from"./web-ifc-api-Dlf_dxms.js";import{T as S,z as f,m as w}from"./index-DtbylpTq.js";import{C as F,W as B,S as D,I as P,d as T,F as x,B as A,V as E}from"./index-Cs1SYVzD.js";import{S as L,a as M,G as j}from"./index-DDyOrdLb.js";S.init();const e=new F,k=e.get(B),n=k.create(),u=new L(e);u.setup();n.scene=u;n.scene.three.add(new I(10));const s=document.createElement("bim-viewport"),b=new M(e,s);n.renderer=b;const g=new D(e);n.camera=g;s.addEventListener("resize",()=>{b.resize(),g.updateAspect()});const l=document.createElement("bim-grid");l.floating=!0;s.append(l);const z=e.get(j);z.create(n);e.init();const y=e.get(P);await y.setup();const G=e.get(T),V=e.get(x);V.onFragmentsLoaded.add(async t=>{n.scene.three.add(t),t.hasProperties&&await G.process(t);for(const o of t.items)n.meshes.add(o.mesh)});const R=async t=>{const o=[];for(const i of t){const r=await(await fetch(i)).arrayBuffer(),c=new Uint8Array(r),m=await y.load(c);o.push(m)}return o},W=await R(["https://thatopen.github.io/engine_components/resources/small.ifc"]),H=W[0],a=e.get(A);a.setup({types:new Set([...a.config.types,"Information","Coordination"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),users:new Set(["juan.hoyos4@gmail.com"])});const U=e.get(E);l.layouts={main:{template:` "empty topicPanel" 1fr /1fr 22rem - `,elements:{}}};const ue=async n=>{const s={viewpoints:[],topics:[]};for(const e of n){const o=await(await fetch(e)).arrayBuffer(),{viewpoints:r,topics:c}=await p.load(new Uint8Array(o),d);s.viewpoints.push(...r),s.topics.push(...c)}return s};await ue([]);const v=p.create({title:"Missing information",description:"It seems these elements are badly defined.",dueDate:new Date("08-01-2020"),type:"Clash",priority:"Major",stage:"Design",labels:new Set(["Architecture","Cost Estimation"]),assignedTo:"juan.hoyos4@gmail.com"}),b=me.create(d,{title:"Custom Viewpoint"});b.addComponentsFromMap(pe.getFragmentMap([186]));v.viewpoints.add(b.guid);const F=v.createComment("What if we talk about this next meeting?");F.author="juan.hoyos4@gmail.com";v.createComment("Hi there! I agree.");F.viewpoint=b;const ge=y.create(()=>x` + `,elements:{}}};const $=async t=>{const o={viewpoints:[],topics:[]};for(const i of t){const r=await(await fetch(i)).arrayBuffer(),{viewpoints:c,topics:m}=await a.load(new Uint8Array(r),n);o.viewpoints.push(...c),o.topics.push(...m)}return o};await $([]);const p=a.create({title:"Missing information",description:"It seems these elements are badly defined.",dueDate:new Date("08-01-2020"),type:"Clash",priority:"Major",stage:"Design",labels:new Set(["Architecture","Cost Estimation"]),assignedTo:"juan.hoyos4@gmail.com"}),d=U.create(n,{title:"Custom Viewpoint"});d.addComponentsFromMap(H.getFragmentMap([186]));p.viewpoints.add(d.guid);const h=p.createComment("What if we talk about this next meeting?");h.author="juan.hoyos4@gmail.com";p.createComment("Hi there! I agree.");h.viewpoint=d;const N=f.create(()=>w` - `),fe=y.create(()=>x` + `),_=f.create(()=>w`
@@ -78,8 +17,8 @@ var A=Object.defineProperty;var I=(n,s,e)=>s in n?A(n,s,{enumerable:!0,configura - `),B=document.getElementById("app");B.layouts={main:{template:` + `),v=document.getElementById("app");v.layouts={main:{template:` "leftPanel viewport" 2fr "leftPanel bottomPanel" 1fr / 25rem 1fr - `,elements:{leftPanel:ge,viewport:u,bottomPanel:fe}}};B.layout="main"; + `,elements:{leftPanel:N,viewport:s,bottomPanel:_}}};v.layout="main"; diff --git a/examples/assets/boundingBoxer.js b/examples/assets/boundingBoxer.js index b7cdf0ba2..400800ac5 100644 --- a/examples/assets/boundingBoxer.js +++ b/examples/assets/boundingBoxer.js @@ -1,16 +1,16 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as c}from"./stats.min-GTpOrGrX.js";import{d as l,R as a,m as r}from"./index-CqPyogbW.js";import{o as d,a as m,L as p,M as b,N as u,l as f,_ as g,h}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const w=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,w);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(f);B.create(e);e.scene.three.background=null;const L=t.get(g),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await v.arrayBuffer(),k=new Uint8Array(x),i=L.load(k);e.scene.three.add(i);const s=t.get(h);s.add(i);const M=s.getMesh();s.reset();const n=new c;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r` +import"./web-ifc-api-Dlf_dxms.js";import{S as i}from"./stats.min-bmkVNhZk.js";import{T as l,z as a,m as r}from"./index-DtbylpTq.js";import{p as d,A as m,e as p,m as b,v as u,O as g,T as f,w}from"./index-6e07lNWw.js";const h=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,h);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const v=t.get(g);v.create(e);e.scene.three.background=null;const B=t.get(f),T=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await T.arrayBuffer(),A=new Uint8Array(x),c=B.load(A);e.scene.three.add(c);const s=t.get(w);s.add(c);const k=s.getMesh();s.reset();const n=new i;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r` + @click="${()=>{e.camera.controls.fitToSphere(k,!0)}}"> - `);document.body.append(o);const A=a.create(()=>r` + `);document.body.append(o);const L=a.create(()=>r` - `);document.body.append(A); + `);document.body.append(L); diff --git a/examples/assets/civil3DNavigator.js b/examples/assets/civil3DNavigator.js index b4dfb5360..e92cd7698 100644 --- a/examples/assets/civil3DNavigator.js +++ b/examples/assets/civil3DNavigator.js @@ -1 +1 @@ -import{r as i,S as l}from"./web-ifc-api-CgBULNZm.js";import{o as p,a as m,L as h,N as f,l as g,_ as u,c as w}from"./index-Cbq44wZW.js";import{S as y}from"./stats.min-GTpOrGrX.js";import{X as b,q as L}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const d=document.getElementById("container"),t=new p,S=t.get(m),e=S.create();e.scene=new h(t);e.renderer=new b(t,d);e.camera=new f(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);d.appendChild(e.renderer.three2D.domElement);const U=t.get(g);U.create(e);e.scene.three.background=null;const _=t.get(u),v=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),A=await v.arrayBuffer(),B=new Uint8Array(A),r=await _.load(B);e.scene.three.add(r);const E=await fetch("https://thatopen.github.io/engine_components/resources/road.json");r.setLocalProperties(await E.json());const a=t.get(L);a.world=e;a.draw(r);const I=t.get(w),s=I.create(e);s.threshold=10;for(const o of r.children)o instanceof i&&s.add(o);s.needsUpdate=!0;e.camera.controls.addEventListener("sleep",()=>{s.needsUpdate=!0});const c=new l(void 0,20);a.onHighlight.add(({point:o})=>{c.center.copy(o),e.camera.controls.fitToSphere(c,!0)});const n=new y;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import{s as i,S as p}from"./web-ifc-api-Dlf_dxms.js";import{p as l,A as m,e as h,v as f,O as g,T as u,F as w}from"./index-6e07lNWw.js";import{S as y}from"./stats.min-bmkVNhZk.js";import{n as b,i as v}from"./index-DDq_E_eW.js";const d=document.getElementById("container"),t=new l,A=t.get(m),e=A.create();e.scene=new h(t);e.renderer=new b(t,d);e.camera=new f(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);d.appendChild(e.renderer.three2D.domElement);const S=t.get(g);S.create(e);e.scene.three.background=null;const U=t.get(u),B=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),E=await B.arrayBuffer(),I=new Uint8Array(E),r=await U.load(I);e.scene.three.add(r);const L=await fetch("https://thatopen.github.io/engine_components/resources/road.json");r.setLocalProperties(await L.json());const a=t.get(v);a.world=e;a.draw(r);const T=t.get(w),s=T.create(e);s.threshold=10;for(const o of r.children)o instanceof i&&s.add(o);s.needsUpdate=!0;e.camera.controls.addEventListener("sleep",()=>{s.needsUpdate=!0});const c=new p(void 0,20);a.onHighlight.add(({point:o})=>{c.center.copy(o),e.camera.controls.fitToSphere(c,!0)});const n=new y;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/civilCrossSectionNavigator.js b/examples/assets/civilCrossSectionNavigator.js index 85433be2e..3e088ebaf 100644 --- a/examples/assets/civilCrossSectionNavigator.js +++ b/examples/assets/civilCrossSectionNavigator.js @@ -1 +1 @@ -import{C as M,L as B}from"./web-ifc-api-CgBULNZm.js";import{o as E,a as L,L as S,i as k,l as D,_ as v,b as x}from"./index-Cbq44wZW.js";import{d as I}from"./index-CqPyogbW.js";import{Z as A}from"./index-BPTct15x.js";import{S as C}from"./stats.min-GTpOrGrX.js";import{X as Z,Z as _,q as P,Q as U,K as j}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";I.init();A.init();const y=document.getElementById("container"),e=new E,q=e.get(L),t=q.create();t.scene=new S(e);t.renderer=new Z(e,y);t.camera=new k(e);e.init();t.scene.setup();t.camera.controls.setLookAt(5,5,5,0,0,0);y.appendChild(t.renderer.three2D.domElement);const H=e.get(D);H.create(t);t.scene.three.background=null;const b=e.get(v),K=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),N=await K.arrayBuffer(),Q=new Uint8Array(N),d=b.load(Q);t.scene.three.add(d);const W=await fetch("https://thatopen.github.io/engine_components/resources/road.json");d.setLocalProperties(await W.json());const f=document.getElementById("scene-2d-left");f.components=e;if(!f.world)throw new Error("World not found!");const c=e.get(_);c.world=f.world;await c.draw(d);const l=e.get(P);l.world=t;l.draw(d);const g=document.getElementById("scene-2d-right");g.components=e;if(!g.world)throw new Error("World not found!");const h=e.get(U);h.world=g.world;h.world3D=t;c.onMarkerChange.add(({alignment:o,percentage:n,type:r,curve:s})=>{if(l.setMarker(o,n,r),r==="select"){const i=s.alignment.absolute[s.index].mesh,m=o.getPointAt(n,"absolute");h.set(i,m)}});c.onHighlight.add(({mesh:o})=>{l.highlighter.select(o);const n=o.curve.index,r=o.curve.alignment.absolute[n];r.mesh.geometry.computeBoundingSphere();const s=r.mesh.geometry.boundingSphere;s&&t.camera.controls.fitToSphere(s,!0)});c.onMarkerHidden.add(({type:o})=>{l.hideMarker(o)});const p=e.get(x);p.byEntity(d);const X=p.list,w=e.get(j),u=w.styles.list;for(const o in X.entities){const n=p.find({entities:[o]}),r=new M(Math.random(),Math.random(),Math.random()),s=new B({color:r});w.styles.create(o,new Set,g.world,s);for(const i in n){const m=b.list.get(i);m&&(u[o].fragments[i]=new Set(n[i]),u[o].meshes.add(m.mesh))}}w.update(!0);const a=new C;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end()); +import{C as M,L as v}from"./web-ifc-api-Dlf_dxms.js";import{p as B,A as E,e as S,_ as k,O as A,T as D,U as x}from"./index-6e07lNWw.js";import{T as I}from"./index-DtbylpTq.js";import{v as L}from"./index-CO3KVvRB.js";import{S as T}from"./stats.min-bmkVNhZk.js";import{n as U,s as C,i as O,r as _,O as P}from"./index-DDq_E_eW.js";I.init();L.init();const y=document.getElementById("container"),e=new B,j=e.get(E),t=j.create();t.scene=new S(e);t.renderer=new U(e,y);t.camera=new k(e);e.init();t.scene.setup();t.camera.controls.setLookAt(5,5,5,0,0,0);y.appendChild(t.renderer.three2D.domElement);const H=e.get(A);H.create(t);t.scene.three.background=null;const b=e.get(D),N=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),W=await N.arrayBuffer(),z=new Uint8Array(W),d=b.load(z);t.scene.three.add(d);const F=await fetch("https://thatopen.github.io/engine_components/resources/road.json");d.setLocalProperties(await F.json());const f=document.getElementById("scene-2d-left");f.components=e;if(!f.world)throw new Error("World not found!");const c=e.get(C);c.world=f.world;await c.draw(d);const l=e.get(O);l.world=t;l.draw(d);const g=document.getElementById("scene-2d-right");g.components=e;if(!g.world)throw new Error("World not found!");const h=e.get(_);h.world=g.world;h.world3D=t;c.onMarkerChange.add(({alignment:o,percentage:n,type:r,curve:s})=>{if(l.setMarker(o,n,r),r==="select"){const i=s.alignment.absolute[s.index].mesh,m=o.getPointAt(n,"absolute");h.set(i,m)}});c.onHighlight.add(({mesh:o})=>{l.highlighter.select(o);const n=o.curve.index,r=o.curve.alignment.absolute[n];r.mesh.geometry.computeBoundingSphere();const s=r.mesh.geometry.boundingSphere;s&&t.camera.controls.fitToSphere(s,!0)});c.onMarkerHidden.add(({type:o})=>{l.hideMarker(o)});const p=e.get(x);p.byEntity(d);const R=p.list,w=e.get(P),u=w.styles.list;for(const o in R.entities){const n=p.find({entities:[o]}),r=new M(Math.random(),Math.random(),Math.random()),s=new v({color:r});w.styles.create(o,new Set,g.world,s);for(const i in n){const m=b.list.get(i);m&&(u[o].fragments[i]=new Set(n[i]),u[o].meshes.add(m.mesh))}}w.update(!0);const a=new T;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end()); diff --git a/examples/assets/civilElevationNavigator.js b/examples/assets/civilElevationNavigator.js index 2100a37df..86009918d 100644 --- a/examples/assets/civilElevationNavigator.js +++ b/examples/assets/civilElevationNavigator.js @@ -1 +1 @@ -import"./web-ifc-api-CgBULNZm.js";import{o as y,a as S,L as b,i as B,l as k,_ as E}from"./index-Cbq44wZW.js";import{X as A,q as I,Z as L,d as M}from"./index-DconH7kp.js";import{d as Z}from"./index-CqPyogbW.js";import{Z as x}from"./index-BPTct15x.js";import{S as C}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";Z.init();x.init();const f=document.getElementById("container"),t=new y,D=t.get(S),e=D.create();e.scene=new b(t);e.renderer=new A(t,f);e.camera=new B(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);f.appendChild(e.renderer.three2D.domElement);const U=t.get(k);U.create(e);e.scene.three.background=null;const X=t.get(E),_=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),q=await _.arrayBuffer(),z=new Uint8Array(q),c=X.load(z);e.scene.three.add(c);const i=t.get(I);i.world=e;i.draw(c);const g=document.getElementById("scene-2d-left");g.components=t;if(!g.world)throw new Error("World not found!");const l=new L(t);l.world=g.world;l.draw(c);const a=document.getElementById("scene-2d-right");a.components=t;if(!a.world)throw new Error("World not found!");const s=t.get(M);s.world=a.world;s.draw(c);l.onMarkerChange.add(({alignment:r,percentage:d})=>{s.setMarker(r,d,"hover"),i.setMarker(r,d,"hover")});l.onHighlight.add(({mesh:r,point:d})=>{const{index:v,alignment:h}=r.curve,m=h.getPercentageAt(d,"horizontal");if(m===null)return;const{curve:n}=h.getCurveAt(m,"vertical");if(s.highlighter.select(n.mesh),s.setMarker(n.alignment,m,"select"),a.world){n.mesh.geometry.boundingSphere||n.mesh.geometry.computeBoundingSphere();const w=n.mesh.geometry.boundingSphere.clone();w.radius*=1.5,a.world.camera.controls.fitToSphere(w,!0)}i.highlighter.select(r);const p=r.curve.alignment.absolute[v];p.mesh.geometry.computeBoundingSphere();const u=p.mesh.geometry.boundingSphere;u&&e.camera.controls.fitToSphere(u,!0)});const o=new C;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); +import"./web-ifc-api-Dlf_dxms.js";import{p as y,A as S,e as b,_ as A,O as B,T as k}from"./index-6e07lNWw.js";import{n as E,i as T,s as I,j as M}from"./index-DDq_E_eW.js";import{T as x}from"./index-DtbylpTq.js";import{v as C}from"./index-CO3KVvRB.js";import{S as D}from"./stats.min-bmkVNhZk.js";x.init();C.init();const f=document.getElementById("container"),t=new y,U=t.get(S),e=U.create();e.scene=new b(t);e.renderer=new E(t,f);e.camera=new A(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);f.appendChild(e.renderer.three2D.domElement);const _=t.get(B);_.create(e);e.scene.three.background=null;const z=t.get(k),L=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),N=await L.arrayBuffer(),O=new Uint8Array(N),c=z.load(O);e.scene.three.add(c);const i=t.get(T);i.world=e;i.draw(c);const g=document.getElementById("scene-2d-left");g.components=t;if(!g.world)throw new Error("World not found!");const l=new I(t);l.world=g.world;l.draw(c);const s=document.getElementById("scene-2d-right");s.components=t;if(!s.world)throw new Error("World not found!");const a=t.get(M);a.world=s.world;a.draw(c);l.onMarkerChange.add(({alignment:r,percentage:d})=>{a.setMarker(r,d,"hover"),i.setMarker(r,d,"hover")});l.onHighlight.add(({mesh:r,point:d})=>{const{index:v,alignment:h}=r.curve,m=h.getPercentageAt(d,"horizontal");if(m===null)return;const{curve:n}=h.getCurveAt(m,"vertical");if(a.highlighter.select(n.mesh),a.setMarker(n.alignment,m,"select"),s.world){n.mesh.geometry.boundingSphere||n.mesh.geometry.computeBoundingSphere();const w=n.mesh.geometry.boundingSphere.clone();w.radius*=1.5,s.world.camera.controls.fitToSphere(w,!0)}i.highlighter.select(r);const p=r.curve.alignment.absolute[v];p.mesh.geometry.computeBoundingSphere();const u=p.mesh.geometry.boundingSphere;u&&e.camera.controls.fitToSphere(u,!0)});const o=new D;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); diff --git a/examples/assets/civilPlanNavigator.js b/examples/assets/civilPlanNavigator.js index 8ebff98f4..d0f522cf5 100644 --- a/examples/assets/civilPlanNavigator.js +++ b/examples/assets/civilPlanNavigator.js @@ -1 +1 @@ -import"./web-ifc-api-CgBULNZm.js";import{o as p,a as g,L as u,i as f,l as h,_ as w}from"./index-Cbq44wZW.js";import{X as y,q as b,Z as v}from"./index-DconH7kp.js";import{d as B}from"./index-CqPyogbW.js";import{Z as S}from"./index-BPTct15x.js";import{S as x}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";B.init();S.init();const i=document.getElementById("container"),t=new p,Z=t.get(g),e=Z.create();e.scene=new u(t);e.renderer=new y(t,i);e.camera=new f(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);i.appendChild(e.renderer.three2D.domElement);const A=t.get(h);A.create(e);e.scene.three.background=null;const E=t.get(w),I=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),L=await I.arrayBuffer(),U=new Uint8Array(L),r=E.load(U);e.scene.three.add(r);const a=t.get(b);a.world=e;a.draw(r);const m=document.getElementById("scene-2d"),s=t.get(v);m.components=t;s.world=m.world;await s.draw(r);s.onHighlight.add(({mesh:o})=>{a.highlighter.select(o);const l=o.curve.index,d=o.curve.alignment.absolute[l];d.mesh.geometry.computeBoundingSphere();const c=d.mesh.geometry.boundingSphere;c&&e.camera.controls.fitToSphere(c,!0)});const n=new x;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import"./web-ifc-api-Dlf_dxms.js";import{p,A as g,e as f,_ as h,O as u,T as w}from"./index-6e07lNWw.js";import{n as y,i as b,s as v}from"./index-DDq_E_eW.js";import{T as A}from"./index-DtbylpTq.js";import{v as B}from"./index-CO3KVvRB.js";import{S}from"./stats.min-bmkVNhZk.js";A.init();B.init();const i=document.getElementById("container"),t=new p,T=t.get(g),e=T.create();e.scene=new f(t);e.renderer=new y(t,i);e.camera=new h(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);i.appendChild(e.renderer.three2D.domElement);const x=t.get(u);x.create(e);e.scene.three.background=null;const E=t.get(w),I=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),U=await I.arrayBuffer(),_=new Uint8Array(U),r=E.load(_);e.scene.three.add(r);const a=t.get(b);a.world=e;a.draw(r);const m=document.getElementById("scene-2d"),s=t.get(v);m.components=t;s.world=m.world;await s.draw(r);s.onHighlight.add(({mesh:o})=>{a.highlighter.select(o);const l=o.curve.index,d=o.curve.alignment.absolute[l];d.mesh.geometry.computeBoundingSphere();const c=d.mesh.geometry.boundingSphere;c&&e.camera.controls.fitToSphere(c,!0)});const n=new S;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/classifier.js b/examples/assets/classifier.js index 5a622caff..32d73833e 100644 --- a/examples/assets/classifier.js +++ b/examples/assets/classifier.js @@ -1,41 +1,41 @@ -import{a3 as d,C as m}from"./web-ifc-api-CgBULNZm.js";import{S as u}from"./stats.min-GTpOrGrX.js";import{d as b,R as a,m as c}from"./index-CqPyogbW.js";import{o as p,a as f,L as C,M as w,N as I,l as g,_ as y,b as L}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const A=document.getElementById("container"),s=new p,E=s.get(f),t=E.create();t.scene=new C(s);t.renderer=new w(s,A);t.camera=new I(s);s.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const R=s.get(g);R.create(t);t.scene.three.background=null;const F=new y(s),N=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),S=await N.arrayBuffer(),h=new Uint8Array(S),l=F.load(h);t.scene.three.add(l);const o=s.get(L);o.byEntity(l);o.byIfcRel(l,d,"storeys");o.byModel(l.uuid,l);const T=o.find({entities:["IFCWALLSTANDARDCASE"]}),$=o.find({entities:["IFCSLAB"]}),M=o.find({entities:["IFCMEMBER","IFCPLATE"]}),U=o.find({entities:["IFCFURNISHINGELEMENT"]}),v=o.find({entities:["IFCDOOR"]}),B=o.find({models:[l.uuid]}),i=new u;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>i.begin());t.renderer.onAfterUpdate.add(()=>i.end());b.init();const e=new m,r=a.create(()=>c` +import{ac as m,C as u}from"./web-ifc-api-Dlf_dxms.js";import{S as d}from"./stats.min-bmkVNhZk.js";import{T as b,z as a,m as c}from"./index-DtbylpTq.js";import{p,A as f,e as C,m as w,v as I,O as g,T as A,U as y}from"./index-6e07lNWw.js";const E=document.getElementById("container"),s=new p,T=s.get(f),t=T.create();t.scene=new C(s);t.renderer=new w(s,E);t.camera=new I(s);s.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const L=s.get(g);L.create(t);t.scene.three.background=null;const h=new A(s),F=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),R=await F.arrayBuffer(),S=new Uint8Array(R),l=h.load(S);t.scene.three.add(l);const o=s.get(y);o.byEntity(l);o.byIfcRel(l,m,"storeys");o.byModel(l.uuid,l);const U=o.find({entities:["IFCWALLSTANDARDCASE"]}),v=o.find({entities:["IFCSLAB"]}),N=o.find({entities:["IFCMEMBER","IFCPLATE"]}),$=o.find({entities:["IFCFURNISHINGELEMENT"]}),B=o.find({entities:["IFCDOOR"]}),D=o.find({models:[l.uuid]}),i=new d;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>i.begin());t.renderer.onAfterUpdate.add(()=>i.end());b.init();const e=new u,r=a.create(()=>c` + @input="${({target:n})=>{e.set(n.color),o.setColor(U,e)}}"> + @input="${({target:n})=>{e.set(n.color),o.setColor(v,e)}}"> + @input="${({target:n})=>{e.set(n.color),o.setColor(N,e)}}"> + @input="${({target:n})=>{e.set(n.color),o.setColor($,e)}}"> + @input="${({target:n})=>{e.set(n.color),o.setColor(B,e)}}"> + @click="${()=>{o.resetColor(D)}}"> - `);document.body.append(r);const D=a.create(()=>c` + `);document.body.append(r);const O=a.create(()=>c` - `);document.body.append(D); + `);document.body.append(O); diff --git a/examples/assets/clipEdges.js b/examples/assets/clipEdges.js index cebc2e7e4..eb1884b28 100644 --- a/examples/assets/clipEdges.js +++ b/examples/assets/clipEdges.js @@ -1,4 +1,4 @@ -import{B as M,M as y,a as d,b as c,L as b}from"./web-ifc-api-CgBULNZm.js";import{S as f}from"./stats.min-GTpOrGrX.js";import{d as k,R as m,m as p}from"./index-CqPyogbW.js";import{o as x,a as v,L,N as P,l as $,K as B,d as I}from"./index-Cbq44wZW.js";import{$ as C,K as D,c as z}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const u=document.getElementById("container"),o=new x,E=o.get(v),e=E.create();e.scene=new L(o);e.renderer=new C(o,u);e.camera=new P(o);e.renderer.postproduction.enabled=!0;e.renderer.postproduction.customEffects.outlineEnabled=!0;o.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const h=o.get($);h.config.color.setHex(6710886);const S=h.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(S.three);e.scene.three.background=null;const g=new M(3,3,3),w=new y({color:"#6528D7"}),a=new d(g,w);a.position.set(-2,1.5,0);e.scene.three.add(a);e.meshes.add(a);const l=new d(g,w);l.position.set(2,1.5,0);e.scene.three.add(l);e.meshes.add(l);const K=o.get(B);K.get(e);const n=o.get(I);n.enabled=!0;const r=o.get(D);n.Type=z;const R=new c({color:"lightblue",side:2}),A=new b({color:"blue"}),O=new c({color:"blue",opacity:.5,side:2,transparent:!0});r.styles.create("Red lines",new Set([a]),e,A,R,O);const F=new c({color:"salmon",side:2}),G=new b({color:"red"}),N=new c({color:"red",opacity:.5,side:2,transparent:!0});r.styles.create("Blue lines",new Set([l]),e,G,F,N);u.ondblclick=()=>{n.enabled&&n.create(e)};window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&n.enabled&&n.delete(e)};const s=new f;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end());k.init();const i=m.create(()=>p` +import{B as M,M as y,a as d,b as c,L as b}from"./web-ifc-api-Dlf_dxms.js";import{S as f}from"./stats.min-bmkVNhZk.js";import{T as k,z as m,m as p}from"./index-DtbylpTq.js";import{p as v,A as x,e as P,v as B,O as I,o as L,S as $}from"./index-6e07lNWw.js";import{P as z,O,g as S}from"./index-DDq_E_eW.js";const u=document.getElementById("container"),o=new v,C=o.get(x),e=C.create();e.scene=new P(o);e.renderer=new z(o,u);e.camera=new B(o);e.renderer.postproduction.enabled=!0;e.renderer.postproduction.customEffects.outlineEnabled=!0;o.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const h=o.get(I);h.config.color.setHex(6710886);const D=h.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(D.three);e.scene.three.background=null;const g=new M(3,3,3),w=new y({color:"#6528D7"}),a=new d(g,w);a.position.set(-2,1.5,0);e.scene.three.add(a);e.meshes.add(a);const l=new d(g,w);l.position.set(2,1.5,0);e.scene.three.add(l);e.meshes.add(l);const A=o.get(L);A.get(e);const n=o.get($);n.enabled=!0;const r=o.get(O);n.Type=S;const E=new c({color:"lightblue",side:2}),T=new b({color:"blue"}),F=new c({color:"blue",opacity:.5,side:2,transparent:!0});r.styles.create("Red lines",new Set([a]),e,T,E,F);const G=new c({color:"salmon",side:2}),R=new b({color:"red"}),U=new c({color:"red",opacity:.5,side:2,transparent:!0});r.styles.create("Blue lines",new Set([l]),e,R,G,U);u.ondblclick=()=>{n.enabled&&n.create(e)};window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&n.enabled&&n.delete(e)};const s=new f;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end());k.init();const i=m.create(()=>p` @@ -45,8 +45,8 @@ import{B as M,M as y,a as d,b as c,L as b}from"./web-ifc-api-CgBULNZm.js";import - `);document.body.append(i);const T=m.create(()=>p` + `);document.body.append(i);const W=m.create(()=>p` - `);document.body.append(T); + `);document.body.append(W); diff --git a/examples/assets/clipper.js b/examples/assets/clipper.js index 7b8cd5933..126ea9a81 100644 --- a/examples/assets/clipper.js +++ b/examples/assets/clipper.js @@ -1,4 +1,4 @@ -import{B as r,M as m,a as d}from"./web-ifc-api-CgBULNZm.js";import{S as p}from"./stats.min-GTpOrGrX.js";import{d as u,R as s,m as c}from"./index-CqPyogbW.js";import{o as h,a as g,L as k,M as w,N as y,K as M,d as f}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const b=document.getElementById("container"),a=new h,v=a.get(g),e=v.create();e.scene=new k(a);e.renderer=new w(a,b);e.camera=new y(a);a.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const x=new r(3,3,3),$=new m({color:"#6528D7"}),o=new d(x,$);o.position.set(0,1.5,0);e.scene.three.add(o);e.meshes.add(o);const P=a.get(M);P.get(e);const t=a.get(f);t.enabled=!0;b.ondblclick=()=>{t.enabled&&t.create(e)};window.onkeydown=n=>{(n.code==="Delete"||n.code==="Backspace")&&t.enabled&&t.delete(e)};const l=new p;l.showPanel(2);document.body.append(l.dom);l.dom.style.left="0px";l.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>l.begin());e.renderer.onAfterUpdate.add(()=>l.end());u.init();const i=s.create(()=>c` +import{B as r,M as m,a as d,C as p}from"./web-ifc-api-Dlf_dxms.js";import{S as u}from"./stats.min-bmkVNhZk.js";import{T as h,z as s,m as c}from"./index-DtbylpTq.js";import{p as g,A as f,e as k,m as w,v,o as y,S as M}from"./index-6e07lNWw.js";const b=document.getElementById("container"),t=new g,x=t.get(f),e=x.create();e.scene=new k(t);e.renderer=new w(t,b);e.camera=new v(t);t.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const C=new r(3,3,3),$=new m({color:"#6528D7"}),a=new d(C,$);a.position.set(0,1.5,0);e.scene.three.add(a);e.meshes.add(a);const P=t.get(y);P.get(e);const o=t.get(M);o.enabled=!0;b.ondblclick=()=>{o.enabled&&o.create(e)};window.onkeydown=n=>{(n.code==="Delete"||n.code==="Backspace")&&o.enabled&&o.delete(e)};const l=new u;l.showPanel(2);document.body.append(l.dom);l.dom.style.left="0px";l.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>l.begin());e.renderer.onAfterUpdate.add(()=>l.end());h.init();const i=s.create(()=>c` @@ -10,43 +10,43 @@ import{B as r,M as m,a as d}from"./web-ifc-api-CgBULNZm.js";import{S as p}from". + @change="${({target:n})=>{o.config.enabled=n.value}}"> + @change="${({target:n})=>{o.config.visible=n.value}}"> + @input="${({target:n})=>{o.config.color=new p(n.color)}}"> + @change="${({target:n})=>{o.config.opacity=n.value}}"> + @change="${({target:n})=>{o.config.size=n.value}}"> + @click="${()=>{o.deleteAll()}}"> + @click="${()=>{a.rotation.x=2*Math.PI*Math.random(),a.rotation.y=2*Math.PI*Math.random(),a.rotation.z=2*Math.PI*Math.random()}}"> - `);document.body.append(i);const C=s.create(()=>c` + `);document.body.append(i);const z=s.create(()=>c` - `);document.body.append(C); + `);document.body.append(z); diff --git a/examples/assets/cullers.js b/examples/assets/cullers.js index ca27d685d..7316b3f29 100644 --- a/examples/assets/cullers.js +++ b/examples/assets/cullers.js @@ -1 +1 @@ -import{B as c,ad as l,a as i}from"./web-ifc-api-CgBULNZm.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{o as p,a as u,L as y,M as b,N as g,l as f,c as w}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),t=new p,M=t.get(u),e=M.create();e.scene=new y(t);e.renderer=new b(t,h);e.camera=new g(t);t.init();e.camera.controls.setLookAt(13,13,13,0,0,0);e.scene.setup();const x=t.get(f);x.create(e);e.scene.three.background=null;const L=t.get(w),o=L.create(e);o.threshold=200;o.renderDebugFrame=!0;const s=o.renderer.domElement;document.body.appendChild(s);s.style.position="fixed";s.style.left="0";s.style.bottom="0";s.style.visibility="collapse";const B=new c(2,2,2),U=new l({color:"#6528D7"});function d(a){return Math.random()*a}function E(){for(let a=0;a<300;a++){const n=new i(B,U);n.position.x=d(10),n.position.y=d(10),n.position.z=d(10),n.updateMatrix(),e.scene.three.add(n),o.add(n)}}E();o.needsUpdate=!0;e.camera.controls.addEventListener("controlend",()=>{o.needsUpdate=!0});const r=new m;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end()); +import{B as c,Z as i,a as l}from"./web-ifc-api-Dlf_dxms.js";import{S as m}from"./stats.min-bmkVNhZk.js";import{p,A as u,e as g,m as y,v as b,O as f,F as w}from"./index-6e07lNWw.js";const h=document.getElementById("container"),t=new p,x=t.get(u),e=x.create();e.scene=new g(t);e.renderer=new y(t,h);e.camera=new b(t);t.init();e.camera.controls.setLookAt(13,13,13,0,0,0);e.scene.setup();const M=t.get(f);M.create(e);e.scene.three.background=null;const v=t.get(w),o=v.create(e);o.threshold=200;o.config.renderDebugFrame=!0;const s=o.renderer.domElement;document.body.appendChild(s);s.style.position="fixed";s.style.left="0";s.style.bottom="0";s.style.visibility="collapse";const A=new c(2,2,2),B=new i({color:"#6528D7"});function d(a){return Math.random()*a}function F(){for(let a=0;a<300;a++){const n=new l(A,B);n.position.x=d(10),n.position.y=d(10),n.position.z=d(10),n.updateMatrix(),e.scene.three.add(n),o.add(n)}}F();o.needsUpdate=!0;e.camera.controls.addEventListener("controlend",()=>{o.needsUpdate=!0});const r=new m;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end()); diff --git a/examples/assets/edgeMeasurement.js b/examples/assets/edgeMeasurement.js index b1bbece8e..46e1657ab 100644 --- a/examples/assets/edgeMeasurement.js +++ b/examples/assets/edgeMeasurement.js @@ -1 +1 @@ -import{a as c}from"./web-ifc-api-CgBULNZm.js";import{S as i}from"./stats.min-GTpOrGrX.js";import{o as l,a as m,L as f,N as w,l as p,_ as g}from"./index-Cbq44wZW.js";import{$ as h,n as u}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const r=document.getElementById("container"),t=new l,y=t.get(m),e=y.create();e.scene=new f(t);e.renderer=new h(t,r);e.camera=new w(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const b=t.get(p);b.create(e);e.scene.three.background=null;const L=new g(t),k=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await k.arrayBuffer(),B=new Uint8Array(A),d=L.load(B);e.scene.three.add(d);for(const o of d.children)o instanceof c&&e.meshes.add(o);const n=t.get(u);n.world=e;n.enabled=!0;r.ondblclick=()=>n.create();let a;window.addEventListener("keydown",o=>{o.code==="KeyO"?n.delete():o.code==="KeyS"?(a=n.get(),n.deleteAll()):o.code==="KeyL"&&a&&n.set(a)});const s=new i;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end()); +import{a as c}from"./web-ifc-api-Dlf_dxms.js";import{S as i}from"./stats.min-bmkVNhZk.js";import{p as l,A as f,e as m,v as p,O as w,T as h}from"./index-6e07lNWw.js";import{P as g,h as u}from"./index-DDq_E_eW.js";const r=document.getElementById("container"),t=new l,y=t.get(f),e=y.create();e.scene=new m(t);e.renderer=new g(t,r);e.camera=new p(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const b=t.get(w);b.create(e);e.scene.three.background=null;const A=new h(t),k=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await k.arrayBuffer(),K=new Uint8Array(B),d=A.load(K);e.scene.three.add(d);for(const o of d.children)o instanceof c&&e.meshes.add(o);const n=t.get(u);n.world=e;n.enabled=!0;r.ondblclick=()=>n.create();let a;window.addEventListener("keydown",o=>{o.code==="KeyO"?n.delete():o.code==="KeyS"?(a=n.get(),n.deleteAll()):o.code==="KeyL"&&a&&n.set(a)});const s=new i;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end()); diff --git a/examples/assets/exploder.js b/examples/assets/exploder.js index c8fbb3a34..29f0171fd 100644 --- a/examples/assets/exploder.js +++ b/examples/assets/exploder.js @@ -1,15 +1,15 @@ -import{av as l}from"./web-ifc-api-CgBULNZm.js";import{S as d}from"./stats.min-GTpOrGrX.js";import{d as m,R as a,m as i}from"./index-CqPyogbW.js";import{o as p,a as b,L as u,M as g,N as f,l as h,_ as w,J as y,y as x,b as L}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const v=document.getElementById("container"),e=new p,S=e.get(b),t=S.create();t.scene=new u(e);t.renderer=new g(e,v);t.camera=new f(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const k=e.get(h);k.create(t);t.scene.three.background=null;const I=new w(e),R=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),_=await R.arrayBuffer(),B=new Uint8Array(_),s=I.load(B);t.scene.three.add(s);const E=await fetch("https://thatopen.github.io/engine_components/resources/small.json");s.setLocalProperties(await E.json());const r=e.get(y),M=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),N=r.getRelationsMapFromJSON(await M.text());r.setRelationMap(s,N);const U=e.get(x),j=e.get(L);await j.bySpatialStructure(s,{isolate:new Set([l])});const n=new d;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>n.begin());t.renderer.onAfterUpdate.add(()=>n.end());m.init();const o=a.create(()=>i` +import{aA as l}from"./web-ifc-api-Dlf_dxms.js";import{S as m}from"./stats.min-bmkVNhZk.js";import{T as p,z as a,m as i}from"./index-DtbylpTq.js";import{p as d,A as b,e as u,m as g,v as h,O as f,T as w,k as x,z as y,U as v}from"./index-6e07lNWw.js";const k=document.getElementById("container"),e=new d,S=e.get(b),t=S.create();t.scene=new u(e);t.renderer=new g(e,k);t.camera=new h(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const A=e.get(f);A.create(t);t.scene.three.background=null;const L=new w(e),T=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),U=await T.arrayBuffer(),z=new Uint8Array(U),s=L.load(z);t.scene.three.add(s);const I=await fetch("https://thatopen.github.io/engine_components/resources/small.json");s.setLocalProperties(await I.json());const r=e.get(x),B=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),E=r.getRelationsMapFromJSON(await B.text());r.setRelationMap(s,E);const O=e.get(y),j=e.get(v);await j.bySpatialStructure(s,{isolate:new Set([l])});const n=new m;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>n.begin());t.renderer.onAfterUpdate.add(()=>n.end());p.init();const o=a.create(()=>i` + @change="${({target:c})=>{O.set(c.value)}}"> - `);document.body.append(o);const A=a.create(()=>i` + `);document.body.append(o);const F=a.create(()=>i` - `);document.body.append(A); + `);document.body.append(F); diff --git a/examples/assets/faceMeasurement.js b/examples/assets/faceMeasurement.js index 9e7bc250c..ba39f55aa 100644 --- a/examples/assets/faceMeasurement.js +++ b/examples/assets/faceMeasurement.js @@ -1 +1 @@ -import{a as c}from"./web-ifc-api-CgBULNZm.js";import{S as i}from"./stats.min-GTpOrGrX.js";import{o as l,a as m,L as f,N as w,l as p,_ as g}from"./index-Cbq44wZW.js";import{$ as h,t as u}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const r=document.getElementById("container"),t=new l,y=t.get(m),e=y.create();e.scene=new f(t);e.renderer=new h(t,r);e.camera=new w(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const b=t.get(p);b.create(e);e.scene.three.background=null;const L=new g(t),k=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await k.arrayBuffer(),B=new Uint8Array(A),d=L.load(B);e.scene.three.add(d);for(const o of d.children)o instanceof c&&e.meshes.add(o);const n=t.get(u);n.world=e;n.enabled=!0;r.ondblclick=()=>n.create();let a;window.addEventListener("keydown",o=>{o.code==="KeyO"?n.delete():o.code==="KeyS"?(a=n.get(),n.deleteAll()):o.code==="KeyL"&&a&&n.set(a)});const s=new i;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end()); +import{a as c}from"./web-ifc-api-Dlf_dxms.js";import{S as i}from"./stats.min-bmkVNhZk.js";import{p as l,A as f,e as m,v as p,O as w,T as g}from"./index-6e07lNWw.js";import{P as h,c as u}from"./index-DDq_E_eW.js";const r=document.getElementById("container"),t=new l,y=t.get(f),e=y.create();e.scene=new m(t);e.renderer=new h(t,r);e.camera=new p(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const b=t.get(w);b.create(e);e.scene.three.background=null;const A=new g(t),k=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await k.arrayBuffer(),K=new Uint8Array(B),d=A.load(K);e.scene.three.add(d);for(const o of d.children)o instanceof c&&e.meshes.add(o);const n=t.get(u);n.world=e;n.enabled=!0;r.ondblclick=()=>n.create();let a;window.addEventListener("keydown",o=>{o.code==="KeyO"?n.delete():o.code==="KeyS"?(a=n.get(),n.deleteAll()):o.code==="KeyL"&&a&&n.set(a)});const s=new i;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end()); diff --git a/examples/assets/fragmentsManager.js b/examples/assets/fragmentsManager.js index a275f8519..13039e6a4 100644 --- a/examples/assets/fragmentsManager.js +++ b/examples/assets/fragmentsManager.js @@ -1,26 +1,26 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as u}from"./stats.min-GTpOrGrX.js";import{o as p,a as b,L as g,M as f,N as w,l as h,_ as y}from"./index-Cbq44wZW.js";import{d as L,R as l,m as d}from"./index-CqPyogbW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const k=document.getElementById("container"),n=new p,v=n.get(b),e=v.create();e.scene=new g(n);e.renderer=new f(n,k);e.camera=new w(n);n.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=n.get(h);x.create(e);e.scene.three.background=null;const s=n.get(y);let m="";async function F(){if(s.groups.size)return;const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.frag")).arrayBuffer(),c=new Uint8Array(t),r=s.load(c);e.scene.three.add(r),m=r.uuid}function U(o){const t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=o.name,document.body.appendChild(t),t.click(),t.remove()}function B(){if(!s.groups.size)return;const o=s.groups.get(m);if(!o)return;const t=s.export(o),c=new Blob([t]),r=new File([c],"small.frag");U(r)}function R(){s.dispose()}const a=new u;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>a.begin());e.renderer.onAfterUpdate.add(()=>a.end());L.init();const i=l.create(()=>d` +import"./web-ifc-api-Dlf_dxms.js";import{S as u}from"./stats.min-bmkVNhZk.js";import{p,A as b,e as g,m as f,v as w,O as h,T as y}from"./index-6e07lNWw.js";import{T as k,z as l,m}from"./index-DtbylpTq.js";const v=document.getElementById("container"),n=new p,L=n.get(b),e=L.create();e.scene=new g(n);e.renderer=new f(n,v);e.camera=new w(n);n.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=n.get(h);x.create(e);e.scene.three.background=null;const s=n.get(y);let d="";async function z(){if(s.groups.size)return;const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.frag")).arrayBuffer(),c=new Uint8Array(t),r=s.load(c);e.scene.three.add(r),d=r.uuid}function A(o){const t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=o.name,document.body.appendChild(t),t.click(),t.remove()}function F(){if(!s.groups.size)return;const o=s.groups.get(d);if(!o)return;const t=s.export(o),c=new Blob([t]),r=new File([c],"small.frag");A(r)}function T(){s.dispose()}const a=new u;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>a.begin());e.renderer.onAfterUpdate.add(()=>a.end());k.init();const i=l.create(()=>m` + @click="${()=>{z()}}"> + @click="${()=>{T()}}"> + @click="${()=>{F()}}"> - `);document.body.append(i);const $=l.create(()=>d` + `);document.body.append(i);const U=l.create(()=>m` - `);document.body.append($); + `);document.body.append(U); diff --git a/examples/assets/grids.js b/examples/assets/grids.js index c99c5f59c..e5cc0a066 100644 --- a/examples/assets/grids.js +++ b/examples/assets/grids.js @@ -1 +1,31 @@ -import{a as t,B as s}from"./web-ifc-api-CgBULNZm.js";import{o as r,a,L as d,M as c,N as l,l as m}from"./index-Cbq44wZW.js";const w=document.getElementById("container"),n=new r,i=n.get(a),e=i.create();e.scene=new d(n);e.renderer=new c(n,w);e.camera=new l(n);n.init();const g=new t(new s);e.scene.three.add(g);e.scene.three.background=null;const p=n.get(m),u=p.create(e);console.log(u);const o=new Stats;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); +import{a as c,B as l,b as m,C as b}from"./web-ifc-api-Dlf_dxms.js";import{S as d}from"./stats.min-bmkVNhZk.js";import{p,A as u,e as g,m as h,v,O as f}from"./index-6e07lNWw.js";import{T as w,z as a,m as r}from"./index-DtbylpTq.js";const y=document.getElementById("container"),o=new p,x=o.get(u),e=x.create();e.scene=new g(o);e.renderer=new h(o,y);e.camera=new v(o);o.init();const z=new c(new l,new m({color:"red"}));e.scene.three.add(z);e.scene.three.background=null;const G=o.get(f),i=G.create(e);console.log(i);w.init();const t=a.create(()=>r` + + + + + + + + + + + + + + + + + + + `);document.body.append(t);const k=a.create(()=>r` + + + `);document.body.append(k);const s=new d;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>s.begin());e.renderer.onAfterUpdate.add(()=>s.end()); diff --git a/examples/assets/hider.js b/examples/assets/hider.js index b5c4f03c5..b8aa47173 100644 --- a/examples/assets/hider.js +++ b/examples/assets/hider.js @@ -1,4 +1,4 @@ -import{av as S}from"./web-ifc-api-CgBULNZm.js";import{S as k}from"./stats.min-GTpOrGrX.js";import{d as x,R as r,m as l}from"./index-CqPyogbW.js";import{o as v,a as L,L as F,M as C,N as I,l as M,_ as N,J as _,m as j,b as R}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const $=document.getElementById("container"),e=new v,B=e.get(L),t=B.create();t.scene=new F(e);t.renderer=new C(e,$);t.camera=new I(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const E=e.get(M);E.create(t);t.scene.three.background=null;const b=e.get(N),O=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),U=await O.arrayBuffer(),A=new Uint8Array(U),i=b.load(A);t.scene.three.add(i);const J=await fetch("https://thatopen.github.io/engine_components/resources/small.json");i.setLocalProperties(await J.json());const d=e.get(_),q=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),D=d.getRelationsMapFromJSON(await q.text());d.setRelationMap(i,D);const f=e.get(j),s=e.get(R);s.byEntity(i);await s.bySpatialStructure(i,{isolate:new Set([S])});const a=new k;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end());x.init();const g={},P=Object.keys(s.list.spatialStructures);for(const n of P)g[n]=!0;const h={},T=Object.keys(s.list.entities);for(const n of T)h[n]=!0;const o=r.create(()=>l` +import{aA as k}from"./web-ifc-api-Dlf_dxms.js";import{S}from"./stats.min-bmkVNhZk.js";import{T as v,z as r,m as l}from"./index-DtbylpTq.js";import{p as x,A as F,e as A,m as C,v as I,O as L,T as O,k as T,a as U,U as j}from"./index-6e07lNWw.js";const M=document.getElementById("container"),e=new x,$=e.get(F),t=$.create();t.scene=new A(e);t.renderer=new C(e,M);t.camera=new I(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const B=e.get(L);B.create(t);t.scene.three.background=null;const b=e.get(O),E=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),N=await E.arrayBuffer(),_=new Uint8Array(N),i=b.load(_);t.scene.three.add(i);const z=await fetch("https://thatopen.github.io/engine_components/resources/small.json");i.setLocalProperties(await z.json());const d=e.get(T),R=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),q=d.getRelationsMapFromJSON(await R.text());d.setRelationMap(i,q);const f=e.get(U),o=e.get(j);o.byEntity(i);await o.bySpatialStructure(i,{isolate:new Set([k])});const a=new S;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end());v.init();const g={},D=Object.keys(o.list.spatialStructures);for(const n of D)g[n]=!0;const h={},P=Object.keys(o.list.entities);for(const n of P)h[n]=!0;const s=r.create(()=>l` @@ -9,16 +9,16 @@ import{av as S}from"./web-ifc-api-CgBULNZm.js";import{S as k}from"./stats.min-GT - `);document.body.append(o);const z=o.querySelector("bim-panel-section[name='Floors']"),G=o.querySelector("bim-panel-section[name='Categories']");for(const n in g){const m=r.create(()=>l` + `);document.body.append(s);const G=s.querySelector("bim-panel-section[name='Floors']"),H=s.querySelector("bim-panel-section[name='Categories']");for(const n in g){const m=r.create(()=>l` + @change="${({target:p})=>{const c=o.list.spatialStructures[n];if(c&&c.id!==null)for(const[Y,u]of b.groups){const w=d.getEntityChildren(u,c.id),y=u.getFragmentMap(w);f.set(p.value,y)}}}"> - `);z.append(m)}for(const n in h){const m=r.create(()=>l` + `);G.append(m)}for(const n in h){const m=r.create(()=>l` + @change="${({target:p})=>{const c=o.find({entities:[n]});f.set(p.value,c)}}"> - `);G.append(m)}const H=r.create(()=>l` + `);H.append(m)}const J=r.create(()=>l` + @click="${()=>{s.classList.contains("options-menu-visible")?s.classList.remove("options-menu-visible"):s.classList.add("options-menu-visible")}}"> - `);document.body.append(H); + `);document.body.append(J); diff --git a/examples/assets/highlighter.js b/examples/assets/highlighter.js index e73075031..e78ae6fb7 100644 --- a/examples/assets/highlighter.js +++ b/examples/assets/highlighter.js @@ -1 +1 @@ -import{b as s}from"./web-ifc-api-CgBULNZm.js";import{o as c,a as d,L as l,N as i,l as m,_ as p}from"./index-Cbq44wZW.js";import{$ as u,r as g,W as f}from"./index-DconH7kp.js";import{S as h}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";const w=document.getElementById("container"),t=new c,b=t.get(d),e=b.create();e.scene=new l(t);e.renderer=new u(t,w);e.camera=new i(t);t.init();e.renderer.postproduction.enabled=!0;e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=t.get(m),y=x.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(y.three);e.scene.three.background=null;const B=new p(t),A=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),L=await A.arrayBuffer(),M=new Uint8Array(L),S=B.load(M);e.scene.three.add(S);const r=t.get(g);r.setup({world:e});r.zoomToSelection=!0;const n=t.get(f);n.world=e;n.enabled=!0;n.create("example",new s({color:12382500,transparent:!0,opacity:.5}));r.events.select.onHighlight.add(a=>{n.clear("example"),n.add("example",a)});r.events.select.onClear.add(()=>{n.clear("example")});const o=new h;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); +import{b as a}from"./web-ifc-api-Dlf_dxms.js";import{p as c,A as d,e as l,v as i,O as p,T as m}from"./index-6e07lNWw.js";import{P as u,u as f,$ as g}from"./index-DDq_E_eW.js";import{S as h}from"./stats.min-bmkVNhZk.js";const w=document.getElementById("container"),t=new c,b=t.get(d),e=b.create();e.scene=new l(t);e.renderer=new u(t,w);e.camera=new i(t);t.init();e.renderer.postproduction.enabled=!0;e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=t.get(p),y=x.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(y.three);e.scene.three.background=null;const A=new m(t),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await v.arrayBuffer(),M=new Uint8Array(B),P=A.load(M);e.scene.three.add(P);const o=t.get(f);o.setup({world:e});o.zoomToSelection=!0;const n=t.get(g);n.world=e;n.enabled=!0;n.create("example",new a({color:12382500,transparent:!0,opacity:.5}));o.events.select.onHighlight.add(s=>{n.clear("example"),n.add("example",s)});o.events.select.onClear.add(()=>{n.clear("example")});const r=new h;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end()); diff --git a/examples/assets/iDSSpecifications.js b/examples/assets/iDSSpecifications.js new file mode 100644 index 000000000..dd6a3c706 --- /dev/null +++ b/examples/assets/iDSSpecifications.js @@ -0,0 +1 @@ +import"./web-ifc-api-Dlf_dxms.js";import{C as o,I as r,a as c,b as p,c as m}from"./index-Cs1SYVzD.js";const e=new o,l=e.get(r);await l.setup();const s=e.get(c),t=s.create("My First IDS!",["IFC4X3_ADD2"]);t.description="Description";t.instructions="Instructions";const d=new p(e,{type:"enumeration",parameter:["IFCSLAB","IFCWALL"]});t.applicability.add(d);const a=new m(e,{type:"simple",parameter:"Pset_SlabCommon"},{type:"simple",parameter:"IsExternal"});a.value={type:"simple",parameter:!1};t.requirements.add(a);const I="My Custom IDS",y=s.export({title:I}),i=new File([y],"idsTitle.ids"),n=document.createElement("a");n.href=URL.createObjectURL(i);n.download=i.name; diff --git a/examples/assets/ifcFinder.js b/examples/assets/ifcFinder.js new file mode 100644 index 000000000..de69a2461 --- /dev/null +++ b/examples/assets/ifcFinder.js @@ -0,0 +1,24 @@ +import"./web-ifc-api-Dlf_dxms.js";import{T as w,z as r,m as i}from"./index-DtbylpTq.js";import{S as h}from"./stats.min-bmkVNhZk.js";import{p as v,A as x,e as R,m as F,v as k,O as I,T as $,k as A,G as T,d as B,R as C,a as L}from"./index-6e07lNWw.js";const O=document.getElementById("container"),e=new v,S=e.get(x),t=S.create();t.scene=new R(e);t.renderer=new F(e,O);t.camera=new k(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const U=e.get(I);U.create(t);t.scene.three.background=null;const z=new $(e),E=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),G=await E.arrayBuffer(),M=new Uint8Array(G),c=z.load(M);t.scene.three.add(c);const m=e.get(A),_=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),j=m.getRelationsMapFromJSON(await _.text());m.setRelationMap(c,j);const N=e.get(T),n=N.create(),P=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),b=new File([await P.arrayBuffer()],"example"),u=new B(e,{name:"category",inclusive:!1,rules:[]});n.add(u);const p={type:"category",value:/IfcWallStandardCase/};u.rules.push(p);const d={type:"property",name:/.*/,value:/yeso/},g=new C(e,{name:"property",inclusive:!1,rules:[d]});n.add(g);await n.update(c.uuid,b);const Q=n.items,o=e.get(L);o.set(!1);o.set(!0,Q);const s=new h;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>s.begin());t.renderer.onAfterUpdate.add(()=>s.end());w.init();const f=r.create(()=>i` + + `),y=r.create(()=>i` + + `),q=async()=>{u.clear(),g.clear(),p.value=new RegExp(f.value),d.value=new RegExp(y.value),await n.update(c.uuid,b);const l=n.items;if(console.log(l),Object.keys(l).length===0){alert("No items found!");return}o.set(!1),o.set(!0,l)},a=r.create(()=>i` + + + + + ${f} + ${y} + + + + + + + + `);document.body.append(a);const J=r.create(()=>i` + + + `);document.body.append(J); diff --git a/examples/assets/ifcGeometryTiler.js b/examples/assets/ifcGeometryTiler.js index b8bfd5efe..adb90e475 100644 --- a/examples/assets/ifcGeometryTiler.js +++ b/examples/assets/ifcGeometryTiler.js @@ -1,16 +1,16 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as w}from"./stats.min-GTpOrGrX.js";import{d as h,R as b,m as g}from"./index-CqPyogbW.js";import{o as y,a as L,L as F,M as B,N as I,l as S,_ as U,w as k}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const v=document.getElementById("container"),a=new y,A=a.get(L),t=A.create();t.scene=new F(a);t.renderer=new B(a,v);t.camera=new I(a);a.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const D=a.get(S);D.create(t);t.scene.three.background=null;const R=new U(a),N=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),_=await N.arrayBuffer(),j=new Uint8Array(_),x=R.load(j);t.scene.three.add(x);const i=a.get(k),z={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};i.settings.wasm=z;i.settings.minGeometrySize=20;i.settings.minAssetsSize=1e3;let l=[],f={},u=1;i.onGeometryStreamed.add(e=>{const{buffer:s,data:n}=e,o=`small.ifc-processed-geometries-${u}`;for(const c in n){const p=n[c];p.geometryFile=o,f[c]=p}l.push({name:o,bits:[s]}),u++});let d=[];i.onAssetStreamed.add(e=>{d=[...d,...e]});i.onIfcLoaded.add(e=>{l.push({name:"small.ifc-processed-global",bits:[e]})});function C(e,...s){const n=new File(s,e),o=document.createElement("a"),c=URL.createObjectURL(n);o.href=c,o.download=n.name,o.click(),URL.revokeObjectURL(c)}async function G(e){for(const{name:s,bits:n}of e)C(s,...n),await new Promise(o=>{setTimeout(o,100)})}i.onProgress.add(e=>{e===1&&setTimeout(async()=>{const s={geometries:f,assets:d,globalDataFileId:"small.ifc-processed-global"};l.push({name:"small.ifc-processed.json",bits:[JSON.stringify(s)]}),await G(l),d=[],f={},l=[],u=1})});async function O(){const s=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),n=new Uint8Array(s);await i.streamFromBuffer(n)}const r=new w;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>r.begin());t.renderer.onAfterUpdate.add(()=>r.end());h.init();const m=b.create(()=>g` +import"./web-ifc-api-Dlf_dxms.js";import{S as w}from"./stats.min-bmkVNhZk.js";import{T as h,z as b,m as g}from"./index-DtbylpTq.js";import{p as y,A as F,e as L,m as v,v as A,O as k,T as B,g as I}from"./index-6e07lNWw.js";const S=document.getElementById("container"),a=new y,U=a.get(F),t=U.create();t.scene=new L(a);t.renderer=new v(a,S);t.camera=new A(a);a.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const T=a.get(k);T.create(t);t.scene.three.background=null;const D=new B(a),z=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await z.arrayBuffer(),R=new Uint8Array(O),j=D.load(R);t.scene.three.add(j);const i=a.get(I),x={path:"https://unpkg.com/web-ifc@0.0.57/",absolute:!0};i.settings.wasm=x;i.settings.minGeometrySize=20;i.settings.minAssetsSize=1e3;let l=[],f={},u=1;i.onGeometryStreamed.add(e=>{const{buffer:s,data:n}=e,o=`small.ifc-processed-geometries-${u}`;for(const c in n){const p=n[c];p.geometryFile=o,f[c]=p}l.push({name:o,bits:[s]}),u++});let d=[];i.onAssetStreamed.add(e=>{d=[...d,...e]});i.onIfcLoaded.add(e=>{l.push({name:"small.ifc-processed-global",bits:[e]})});function C(e,...s){const n=new File(s,e),o=document.createElement("a"),c=URL.createObjectURL(n);o.href=c,o.download=n.name,o.click(),URL.revokeObjectURL(c)}async function G(e){for(const{name:s,bits:n}of e)C(s,...n),await new Promise(o=>{setTimeout(o,100)})}i.onProgress.add(e=>{e===1&&setTimeout(async()=>{const s={geometries:f,assets:d,globalDataFileId:"small.ifc-processed-global"};l.push({name:"small.ifc-processed.json",bits:[JSON.stringify(s)]}),await G(l),d=[],f={},l=[],u=1})});async function P(){const s=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),n=new Uint8Array(s);await i.streamFromBuffer(n)}const r=new w;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>r.begin());t.renderer.onAfterUpdate.add(()=>r.end());h.init();const m=b.create(()=>g` + @click="${()=>{P()}}"> - `);document.body.append(m);const P=b.create(()=>g` + `);document.body.append(m);const $=b.create(()=>g` - `);document.body.append(P); + `);document.body.append($); diff --git a/examples/assets/ifcJsonExporter.js b/examples/assets/ifcJsonExporter.js index 752d9c8fb..751e7afc5 100644 --- a/examples/assets/ifcJsonExporter.js +++ b/examples/assets/ifcJsonExporter.js @@ -1,10 +1,10 @@ -import{ac as m}from"./web-ifc-api-CgBULNZm.js";import{S as b}from"./stats.min-GTpOrGrX.js";import{d as f,R as c,m as i}from"./index-CqPyogbW.js";import{o as u,a as w,L as g,M as h,N as y,l as L,_ as k,p as x}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const I=document.getElementById("container"),t=new u,U=t.get(w),e=U.create();e.scene=new g(t);e.renderer=new h(t,I);e.camera=new y(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const v=t.get(L);v.create(e);e.scene.three.background=null;const B=new k(t),O=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),R=await O.arrayBuffer(),S=new Uint8Array(R),A=B.load(S);e.scene.three.add(A);const N=t.get(x),a=new m;a.SetWasmPath("https://unpkg.com/web-ifc@0.0.56/",!0);await a.Init();const j=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),E=await j.arrayBuffer(),F=new Uint8Array(E),_=a.OpenModel(F),n=new b;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());f.init();const s=c.create(()=>i` +import{Y as d}from"./web-ifc-api-Dlf_dxms.js";import{S as b}from"./stats.min-bmkVNhZk.js";import{T as f,z as c,m as i}from"./index-DtbylpTq.js";import{p as u,A as w,e as g,m as h,v as y,O as v,T as O,c as k}from"./index-6e07lNWw.js";const x=document.getElementById("container"),t=new u,I=t.get(w),e=I.create();e.scene=new g(t);e.renderer=new h(t,x);e.camera=new y(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const L=t.get(v);L.create(e);e.scene.three.background=null;const U=new O(t),A=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await A.arrayBuffer(),S=new Uint8Array(B),T=U.load(S);e.scene.three.add(T);const j=t.get(k),a=new d;a.SetWasmPath("https://unpkg.com/web-ifc@0.0.57/",!0);await a.Init();const z=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),E=await z.arrayBuffer(),F=new Uint8Array(E),R=a.OpenModel(F),n=new b;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());f.init();const s=c.create(()=>i` + @click="${async()=>{const l=await j.export(a,R),p=JSON.stringify(l),m=new File([new Blob([p])],"properties.json"),r=URL.createObjectURL(m),o=document.createElement("a");o.download="properties.json",o.href=r,o.click(),URL.revokeObjectURL(r),o.remove()}}"> diff --git a/examples/assets/ifcLoader.js b/examples/assets/ifcLoader.js index 6490bcfd8..5e72b48dd 100644 --- a/examples/assets/ifcLoader.js +++ b/examples/assets/ifcLoader.js @@ -1,25 +1,25 @@ -import{bd as b,be as u,bf as f}from"./web-ifc-api-CgBULNZm.js";import{d as g,R as m,m as p}from"./index-CqPyogbW.js";import{S as w}from"./stats.min-GTpOrGrX.js";import{o as I,a as y,L,M as C,N,l as E,_ as F,E as R}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),o=new I,O=o.get(y),t=O.create();t.scene=new L(o);t.renderer=new C(o,h);t.camera=new N(o);o.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const x=o.get(E);x.create(t);t.scene.three.background=null;const a=o.get(F),c=o.get(R);await c.setup();const k=[b,u,f];for(const e of k)c.settings.excludedCategories.add(e);c.settings.webIfc.COORDINATE_TO_ORIGIN=!0;async function v(){const n=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),i=new Uint8Array(n),l=await c.load(i);l.name="example",t.scene.three.add(l)}a.onFragmentsLoaded.add(e=>{console.log(e)});function d(e){const n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=e.name,document.body.appendChild(n),n.click(),n.remove()}async function A(){if(!a.groups.size)return;const e=Array.from(a.groups.values())[0],n=a.export(e);d(new File([new Blob([n])],"small.frag"));const i=e.getLocalProperties();i&&d(new File([JSON.stringify(i)],"small.json"))}function B(){a.dispose()}const s=new w;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>s.begin());t.renderer.onAfterUpdate.add(()=>s.end());g.init();const r=m.create(()=>p` +import{bp as b,bq as u,br as f}from"./web-ifc-api-Dlf_dxms.js";import{T as g,z as m,m as p}from"./index-DtbylpTq.js";import{S as w}from"./stats.min-bmkVNhZk.js";import{p as I,A as y,e as C,m as N,v as F,O as L,T as O,N as h}from"./index-6e07lNWw.js";const E=document.getElementById("container"),o=new I,R=o.get(y),t=R.create();t.scene=new C(o);t.renderer=new N(o,E);t.camera=new F(o);o.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const v=o.get(L);v.create(t);t.scene.three.background=null;const a=o.get(O),i=o.get(h);await i.setup();const x=[b,u,f];for(const e of x)i.settings.excludedCategories.add(e);i.settings.webIfc.COORDINATE_TO_ORIGIN=!0;async function A(){const n=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),r=new Uint8Array(n),l=await i.load(r);l.name="example",t.scene.three.add(l)}a.onFragmentsLoaded.add(e=>{console.log(e)});function d(e){const n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=e.name,document.body.appendChild(n),n.click(),n.remove()}async function T(){if(!a.groups.size)return;const e=Array.from(a.groups.values())[0],n=a.export(e);d(new File([new Blob([n])],"small.frag"));const r=e.getLocalProperties();r&&d(new File([JSON.stringify(r)],"small.json"))}function k(){a.dispose()}const s=new w;s.showPanel(2);document.body.append(s.dom);s.dom.style.left="0px";s.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>s.begin());t.renderer.onAfterUpdate.add(()=>s.end());g.init();const c=m.create(()=>p` + @click="${()=>{A()}}"> + @click="${()=>{T()}}"> + @click="${()=>{k()}}"> - `);document.body.append(r);const T=m.create(()=>p` + `);document.body.append(c);const B=m.create(()=>p` + @click="${()=>{c.classList.contains("options-menu-visible")?c.classList.remove("options-menu-visible"):c.classList.add("options-menu-visible")}}"> - `);document.body.append(T); + `);document.body.append(B); diff --git a/examples/assets/ifcPropertiesManager.js b/examples/assets/ifcPropertiesManager.js index ad723216f..8b4059906 100644 --- a/examples/assets/ifcPropertiesManager.js +++ b/examples/assets/ifcPropertiesManager.js @@ -1 +1 @@ -var m=Object.defineProperty;var O=(d,l,e)=>l in d?m(d,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[l]=e;var c=(d,l,e)=>(O(d,typeof l!="symbol"?l+"":l,e),e);import{ai as p,aj as I,i as x,ak as M,bc as D}from"./web-ifc-api-CgBULNZm.js";import{C as A,E as w,d as v,b as N,I as F,U as L,a as B}from"./index-BELYWC4t.js";import"./_commonjsHelpers-Cpj98o6Y.js";const f=class f extends A{constructor(e){super(e);c(this,"onDisposed",new w);c(this,"onRequestFile",new w);c(this,"ifcToExport",null);c(this,"onElementToPset",new w);c(this,"onPropToPset",new w);c(this,"onPsetRemoved",new w);c(this,"onDataChanged",new w);c(this,"wasm",{path:"/",absolute:!1});c(this,"enabled",!0);c(this,"attributeListeners",{});c(this,"selectedModel");c(this,"changeMap",{});this.components.add(f.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(f.uuid),this.onDisposed.reset()}static getIFCSchema(e){const t=e.ifcMetadata.schema;if(!t)throw new Error("IFC Schema not found");return t.startsWith("IFC2X3")?"IFC2X3":t.startsWith("IFC4")&&t.replace("IFC4","")===""?"IFC4":t.startsWith("IFC4X3")?"IFC4X3":t}async setData(e,...t){for(const s of t){const{expressID:n}=s;(!n||n===-1)&&(s.expressID=this.getNewExpressID(e)),await e.setProperties(s.expressID,s),this.registerChange(e,n)}}async newPset(e,t,s){const n=f.getIFCSchema(e),{ownerHistoryHandle:r}=await this.getOwnerHistory(e),i=this.newGUID(e),o=new p[n].IfcLabel(t),a=s?new p[n].IfcText(s):null,u=new p[n].IfcPropertySet(i,r,o,a,[]);u.expressID=this.getNewExpressID(e);const P=this.newGUID(e),y=new p[n].IfcRelDefinesByProperties(P,r,null,null,[],new I(u.expressID));return y.expressID=this.getNewExpressID(e),await this.setData(e,u,y),{pset:u,rel:y}}async removePset(e,...t){for(const s of t){const n=await e.getProperties(s);if((n==null?void 0:n.type)!==x)continue;const r=await v.getPsetRel(e,s);if(r&&(await e.setProperties(r,null),this.registerChange(e,r)),n){for(const i of n.HasProperties)await e.setProperties(i.value,null);await e.setProperties(s,null),this.onPsetRemoved.trigger({model:e,psetID:s}),this.registerChange(e,s)}}}newSingleStringProperty(e,t,s,n){return this.newSingleProperty(e,t,s,n)}newSingleNumericProperty(e,t,s,n){return this.newSingleProperty(e,t,s,n)}newSingleBooleanProperty(e,t,s,n){return this.newSingleProperty(e,t,s,n)}async removePsetProp(e,t,s){const n=await e.getProperties(t),r=await e.getProperties(s);!n||!r||n.type===x&&r&&(n.HasProperties=n.HasProperties.filter(i=>i.value!==s),await e.setProperties(s,null),this.registerChange(e,t,s))}async addElementToPset(e,t,...s){const n=await v.getPsetRel(e,t);if(!n)return;const r=await e.getProperties(n);if(!r)return;for(const o of s){const a=new I(o);r.RelatedObjects.push(a),this.onElementToPset.trigger({model:e,psetID:t,elementID:o})}this.registerChange(e,t);const i=this.components.get(N);for(const o of s)try{i.addEntityRelations(e,o,"IsDefinedBy",t)}catch{}}async addPropToPset(e,t,...s){const n=await e.getProperties(t);if(n){for(const r of s){if(n.HasProperties.includes(r))continue;const i=new I(r);n.HasProperties.push(i),this.onPropToPset.trigger({model:e,psetID:t,propID:r})}this.registerChange(e,t)}}async saveToIfc(e,t){const s=this.components.get(F),n=s.webIfc,r=await s.readIfcFile(t),i=this.changeMap[e.uuid]??[];for(const a of i){const u=await e.getProperties(a);if(u)try{n.WriteLine(r,u)}catch{}else try{n.DeleteLine(r,a)}catch{}}const o=n.SaveModel(r);return s.webIfc.CloseModel(r),s.cleanUp(),o}async getEntityRef(e,t){const s=await e.getAllPropertiesOfType(t);if(!s)return null;const n=[];for(const r in s){const i=new I(Number(r));n.push(i)}return n}async setAttributeListener(e,t,s){this.attributeListeners[e.uuid]||(this.attributeListeners[e.uuid]={});const n=this.attributeListeners[e.uuid][t]?this.attributeListeners[e.uuid][t][s]:null;if(n)return n;const r=await e.getProperties(t);if(!r)throw new Error(`Entity with expressID ${t} doesn't exists.`);const i=r[s];if(Array.isArray(i)||!i)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const o=i.value;if(o===void 0||o==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const a=new w;return Object.defineProperty(r[s],"value",{get(){return this._value},async set(u){this._value=u,a.trigger(u)}}),r[s].value=o,this.attributeListeners[e.uuid][t]||(this.attributeListeners[e.uuid][t]={}),this.attributeListeners[e.uuid][t][s]=a,a}getNewExpressID(e){return e.ifcMetadata.maxExpressID++,e.ifcMetadata.maxExpressID}newGUID(e){const t=f.getIFCSchema(e);return new p[t].IfcGloballyUniqueId(L.create())}async getOwnerHistory(e){const t=await e.getAllPropertiesOfType(M);if(!t)throw new Error("No OwnerHistory was found.");const s=Object.keys(t).map(i=>parseInt(i,10)),n=t[s[0]],r=new I(n.expressID);return{ownerHistory:n,ownerHistoryHandle:r}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const s of t)this.changeMap[e.uuid].add(s),this.onDataChanged.trigger({model:e,expressID:s})}async newSingleProperty(e,t,s,n){const r=f.getIFCSchema(e),i=new p[r].IfcIdentifier(s),o=new p[r][t](n),a=new p[r].IfcPropertySingleValue(i,null,o,null);return a.expressID=this.getNewExpressID(e),await this.setData(e,a),a}};c(f,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let b=f;const T=new B,R=T.get(F);await R.setup();const G=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),S=await G.arrayBuffer(),h=await R.load(new Uint8Array(S)),g=T.get(b),{pset:H}=await g.newPset(h,"CalculatedQuantities"),W=await g.newSingleNumericProperty(h,"IfcReal","Volume",12.25);await g.addPropToPset(h,H.expressID,W.expressID);await g.addElementToPset(h,H.expressID,186);const C=await h.getProperties(186);C&&(C.Name.value="New Wall Name",await g.setData(h,C));const j=new D.IfcTask(new D.IfcGloballyUniqueId(L.create()),null,null,null,null,null,null,null,null,new D.IfcBoolean(!1),null,null,null);await g.setData(h,j);const k=await g.saveToIfc(h,new Uint8Array(S)),U=new File([k],"small-modified.ifc"),E=document.createElement("a");E.href=URL.createObjectURL(U);E.download=U.name;URL.revokeObjectURL(E.href); +import{bl as t}from"./web-ifc-api-Dlf_dxms.js";import{C as f,I as u,f as w,U as m}from"./index-Cs1SYVzD.js";const l=new f,s=l.get(u);await s.setup();const p=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),i=await p.arrayBuffer(),e=await s.load(new Uint8Array(i)),a=l.get(w),{pset:r}=await a.newPset(e,"CalculatedQuantities"),d=await a.newSingleNumericProperty(e,"IfcReal","Volume",12.25);await a.addPropToPset(e,r.expressID,d.expressID);await a.addElementToPset(e,r.expressID,186);const n=await e.getProperties(186);n&&(n.Name.value="New Wall Name",await a.setData(e,n));const I=new t.IfcTask(new t.IfcGloballyUniqueId(m.create()),null,null,null,null,null,null,null,null,new t.IfcBoolean(!1),null,null,null);await a.setData(e,I);const U=await a.saveToIfc(e,new Uint8Array(i)),c=new File([U],"small-modified.ifc"),o=document.createElement("a");o.href=URL.createObjectURL(c);o.download=c.name;URL.revokeObjectURL(o.href); diff --git a/examples/assets/ifcPropertiesTiler.js b/examples/assets/ifcPropertiesTiler.js index b080fd1ca..13f6d73db 100644 --- a/examples/assets/ifcPropertiesTiler.js +++ b/examples/assets/ifcPropertiesTiler.js @@ -1,18 +1,18 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as b}from"./stats.min-GTpOrGrX.js";import{d as g,R as f,m as u}from"./index-CqPyogbW.js";import{o as w,a as y,L as h,M as B,N as L,l as F,_ as R,g as S,J as U}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const k=document.getElementById("container"),n=new w,v=n.get(y),s=v.create();s.scene=new h(n);s.renderer=new B(n,k);s.camera=new L(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const x=n.get(F);x.create(s);s.scene.three.background=null;const I=new R(n),A=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await A.arrayBuffer(),P=new Uint8Array(O),j=I.load(P);s.scene.three.add(j);function J(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function N(e){for(const{name:o,bits:t}of e)J(o,t),await new Promise(a=>{setTimeout(a,100)})}const c=n.get(S);c.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};const r={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];c.onPropertiesStreamed.add(async e=>{r.types[e.type]||(r.types[e.type]=[]),r.types[e.type].push(l);for(const a in e.data)r.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});c.onProgress.add(async e=>{console.log(e)});c.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(r)])});const t=n.get(U).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await N(d)});async function _(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await c.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());g.init();const m=f.create(()=>u` +import"./web-ifc-api-Dlf_dxms.js";import{S as b}from"./stats.min-bmkVNhZk.js";import{T as w,z as f,m as u}from"./index-DtbylpTq.js";import{p as y,A as g,e as h,m as B,v as k,O as F,T as L,f as v,k as S}from"./index-6e07lNWw.js";const U=document.getElementById("container"),n=new y,A=n.get(g),s=A.create();s.scene=new h(n);s.renderer=new B(n,U);s.camera=new k(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const T=n.get(F);T.create(s);s.scene.three.background=null;const x=new L(n),I=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await I.arrayBuffer(),R=new Uint8Array(O),z=x.load(R);s.scene.three.add(z);function P(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function j(e){for(const{name:o,bits:t}of e)P(o,t),await new Promise(a=>{setTimeout(a,100)})}const r=n.get(v);r.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.57/",absolute:!0};const c={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];r.onPropertiesStreamed.add(async e=>{c.types[e.type]||(c.types[e.type]=[]),c.types[e.type].push(l);for(const a in e.data)c.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});r.onProgress.add(async e=>{console.log(e)});r.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(c)])});const t=n.get(S).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await j(d)});async function $(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await r.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());w.init();const m=f.create(()=>u` + @click="${()=>{$()}}"> - `);document.body.append(m);const z=f.create(()=>u` + `);document.body.append(m);const C=f.create(()=>u` - `);document.body.append(z); + `);document.body.append(C); diff --git a/examples/assets/ifcRelationsIndexer.js b/examples/assets/ifcRelationsIndexer.js index f1ba6da5d..dbff05c75 100644 --- a/examples/assets/ifcRelationsIndexer.js +++ b/examples/assets/ifcRelationsIndexer.js @@ -1,17 +1,22 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as f}from"./stats.min-GTpOrGrX.js";import{d as b,R as m,m as u}from"./index-CqPyogbW.js";import{o as w,a as y,L as h,M as R,N as I,l as E,E as S,J as L,f as x}from"./index-Cbq44wZW.js";import"./_commonjsHelpers-Cpj98o6Y.js";const B=document.getElementById("container"),o=new w,M=o.get(y),n=M.create();n.scene=new h(o);n.renderer=new R(o,B);n.camera=new I(o);o.init();n.camera.controls.setLookAt(12,6,8,0,0,-10);n.scene.setup();const P=o.get(E);P.create(n);n.scene.three.background=null;const g=o.get(S);await g.setup();const U=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),k=await U.arrayBuffer(),v=new Uint8Array(k),e=await g.load(v);n.scene.three.add(e);const t=o.get(L);await t.process(e);const p=t.getEntityRelations(e,6518,"IsDefinedBy");if(p)for(const s of p){const r=await e.getProperties(s);console.log(r),await x.getPsetProps(e,s,async l=>{const i=await e.getProperties(l);console.log(i)})}const j=(s,r)=>{const l=new File([s],r),i=document.createElement("a");i.href=URL.createObjectURL(l),i.download=l.name,i.click(),URL.revokeObjectURL(i.href)},A=t.serializeModelRelations(e);console.log(A);const C=t.serializeAllRelations();delete t.relationMaps[e.uuid];const D=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),J=t.getRelationsMapFromJSON(await D.text());t.setRelationMap(e,J);const d=t.getEntityRelations(e,6518,"ContainedInStructure");if(d&&d[0]){const s=await e.getProperties(d[0]);console.log(s)}const N=t.getEntitiesWithRelation(e,"ContainedInStructure",138);console.log(`IfcBuildingStorey 138 has the following IfcElement: ${[...N]}`);const O=t.getEntitiesWithRelation(e,"ContainsElements",186);console.log(`IfcElement 186 is located inside IfcBuildingStorey ${[...O][0]}`);const $=t.getEntitiesWithRelation(e,"IsDefinedBy",303);console.log(`${[...$]} are defined by IfcPropertySet 303`);const a=new f;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";n.renderer.onBeforeUpdate.add(()=>a.begin());n.renderer.onAfterUpdate.add(()=>a.end());b.init();const c=m.create(()=>u` +import{a5 as D,bl as r,a3 as L,bm as P,a4 as I}from"./web-ifc-api-Dlf_dxms.js";import{S as x}from"./stats.min-bmkVNhZk.js";import{T as U,z as w,m as g}from"./index-DtbylpTq.js";import{C,W as O,S as v,I as F,d as A,e as k,f as y,U as B}from"./index-Cs1SYVzD.js";import{S as M,a as N,G as j}from"./index-DDyOrdLb.js";const T=document.getElementById("container"),s=new C,W=s.get(O),a=W.create();a.scene=new M(s);a.renderer=new N(s,T);a.camera=new v(s);s.init();a.camera.controls.setLookAt(12,6,8,0,0,-10);a.scene.setup();const $=s.get(j);$.create(a);a.scene.three.background=null;const R=s.get(F);await R.setup();const z=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),G=await z.arrayBuffer(),S=new Uint8Array(G),e=await R.load(S);a.scene.three.add(e);const t=s.get(A);await t.process(e);const u=t.getEntityRelations(e,6518,"IsDefinedBy");if(u)for(const n of u){const i=await e.getProperties(n);console.log(i),await k.getPsetProps(e,n,async l=>{const o=await e.getProperties(l);console.log(o)})}const H=(n,i)=>{const l=new File([n],i),o=document.createElement("a");o.href=URL.createObjectURL(l),o.download=l.name,o.click(),URL.revokeObjectURL(o.href)},J=t.serializeModelRelations(e);console.log(J);const V=t.serializeAllRelations();delete t.relationMaps[e.uuid];const Y=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),_=t.getRelationsMapFromJSON(await Y.text());t.setRelationMap(e,_);const p=t.getEntityRelations(e,6518,"ContainedInStructure");if(p&&p[0]){const n=await e.getProperties(p[0]);console.log(n)}const q=t.getEntitiesWithRelation(e,"ContainedInStructure",138);console.log(`IfcBuildingStorey 138 has the following IfcElement: ${[...q]}`);const X=t.getEntitiesWithRelation(e,"ContainsElements",186);console.log(`IfcElement 186 is located inside IfcBuildingStorey ${[...X][0]}`);const K=t.getEntitiesWithRelation(e,"IsDefinedBy",303);console.log(`${[...K]} are defined by IfcPropertySet 303`);const m=s.get(y),b=await m.getEntityRef(e,D),h=new r.IfcPropertySingleValue(new r.IfcIdentifier("Property Name"),null,new r.IfcLabel("Property Value"),null);await m.setData(e,h);const f=new r.IfcPropertySet(new r.IfcGloballyUniqueId(B.create()),b?b[0]:null,new r.IfcLabel("My New Pset!"),null,[new L(h.expressID)]);await m.setData(e,f);const E=await e.getAllPropertiesOfType(P),Q=Object.values(E).map(n=>n.expressID);t.addEntitiesRelation(e,f.expressID,{type:I,inv:"DefinesOcurrence"},...Q);for(const n in E)t.addEntitiesRelation(e,Number(n),{type:I,inv:"IsDefinedBy"},f.expressID);const c=new x;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";c.dom.style.zIndex="unset";a.renderer.onBeforeUpdate.add(()=>c.begin());a.renderer.onAfterUpdate.add(()=>c.end());U.init();const d=w.create(()=>g` + @click="${async()=>{H(V,"relations-index-all.json")}}"> + + + - `);document.body.append(c);const F=m.create(()=>u` + `);document.body.append(d);const Z=w.create(()=>g` + @click="${()=>{d.classList.contains("options-menu-visible")?d.classList.remove("options-menu-visible"):d.classList.add("options-menu-visible")}}"> - `);document.body.append(F); + `);document.body.append(Z); diff --git a/examples/assets/ifcStreamer.js b/examples/assets/ifcStreamer.js index b9b64d82e..e8bac4e06 100644 --- a/examples/assets/ifcStreamer.js +++ b/examples/assets/ifcStreamer.js @@ -1 +1 @@ -import"./web-ifc-api-CgBULNZm.js";import{S as i}from"./stats.min-GTpOrGrX.js";import{o as l,a as m,L as p,M as u,N as w,l as g}from"./index-Cbq44wZW.js";import{s as h}from"./index-DconH7kp.js";import"./_commonjsHelpers-Cpj98o6Y.js";const f=document.getElementById("container"),o=new l,b=o.get(m),e=b.create();e.scene=new p(o);e.renderer=new u(o,f);e.camera=new w(o);o.init();e.scene.setup();e.camera.controls.setLookAt(12,6,8,0,0,-10);const y=o.get(g);y.create(e);e.scene.three.background=null;const t=o.get(h);t.world=e;t.dbCleaner.enabled=!0;t.url="https://thatopen.github.io/engine_components/resources/streaming/";async function D(s,r){const c=await(await fetch(s)).json();let a;a=await(await fetch(r)).json();const d=await t.load(c,!0,a);console.log(d)}await D("https://thatopen.github.io/engine_components/resources/streaming/small.ifc-processed.json","https://thatopen.github.io/engine_components/resources/streaming/small.ifc-processed-properties.json");e.camera.controls.addEventListener("sleep",()=>{t.culler.needsUpdate=!0});t.useCache=!0;t.culler.threshold=10;t.culler.maxHiddenTime=1e3;t.culler.maxLostTime=3e3;const n=new i;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import"./web-ifc-api-Dlf_dxms.js";import{S as i}from"./stats.min-bmkVNhZk.js";import{p as l,A as m,e as p,m as u,v as w,O as g}from"./index-6e07lNWw.js";import{d as h}from"./index-DDq_E_eW.js";const f=document.getElementById("container"),o=new l,y=o.get(m),e=y.create();e.scene=new p(o);e.renderer=new u(o,f);e.camera=new w(o);o.init();e.scene.setup();e.camera.controls.setLookAt(12,6,8,0,0,-10);const b=o.get(g);b.create(e);e.scene.three.background=null;const t=o.get(h);t.world=e;t.url="https://thatopen.github.io/engine_components/resources/streaming/";async function D(a,r){const c=await(await fetch(a)).json();let s;s=await(await fetch(r)).json();const d=await t.load(c,!0,s);console.log(d)}await D("https://thatopen.github.io/engine_components/resources/streaming/small.ifc-processed.json","https://thatopen.github.io/engine_components/resources/streaming/small.ifc-processed-properties.json");e.camera.controls.addEventListener("sleep",()=>{t.culler.needsUpdate=!0});t.useCache=!0;t.culler.threshold=10;t.culler.maxHiddenTime=1e3;t.culler.maxLostTime=3e3;const n=new i;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/index-6e07lNWw.js b/examples/assets/index-6e07lNWw.js new file mode 100644 index 000000000..21447eed9 --- /dev/null +++ b/examples/assets/index-6e07lNWw.js @@ -0,0 +1,306 @@ +import{t as it,V as x,h as He,w as Is,T as os,S as Li,x as we,a as se,C as ve,E as Pi,D as co,A as _a,W as xs,v as Gt,P as Pn,aB as wa,z as va,aC as st,c as Ee,aD as Ma,y as _n,ap as wn,Y as hs,J as Da,e as Bs,as as Si,aZ as ar,a_ as ba,b0 as Ua,bs as xa,aw as ho,N as _i,b as us,Q as Gs,s as Vt,X as Bt,Z as lr,_ as uo,$ as vn,a0 as zt,a1 as Ba,d as Ys,a2 as Ke,a3 as pt,i as ls,a4 as zs,a5 as Ya,a6 as wi,a7 as Mn,a8 as Dn,a9 as bn,aa as Un,ab as xn,ac as vi,ad as Bn,ae as Yn,af as Vn,ag as Gn,ah as zn,ai as kn,aj as Hn,ak as Io,B as De,al as Va,am as Ga,an as Ai,ao as za,I as Wn,aO as Xn,aP as jn,aA as Zn,aE as Bi,K as xe,O as Oi,j as Ci,aI as ka,L as Eo,aJ as Ha,aK as Wa,aL as Xa,aM as ja,aN as Za,av as $a,k as It,aQ as Ht,aR as qa,aS as Qa,aT as cr,aU as hr,b9 as ur,ba as Ka,H as dr,aF as Ws,ay as At,aG as Ja,aH as Ts,r as el,bb as tl,bc as sl,bd as il,be as nl,ax as rl,bj as ol}from"./web-ifc-api-Dlf_dxms.js";var al=Object.defineProperty,ll=(l,e,t)=>e in l?al(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,p=(l,e,t)=>(ll(l,typeof e!="symbol"?e+"":e,t),t);const fo=0,cl=1,hl=2,Ir=2,Yi=1.25,Er=1,Ti=6*4+4+4,Mi=65535,ul=Math.pow(2,-24),Vi=Symbol("SKIP_GENERATION");function dl(l){return l.index?l.index.count:l.attributes.position.count}function Es(l){return dl(l)/3}function Il(l,e=ArrayBuffer){return l>65535?new Uint32Array(new e(4*l)):new Uint16Array(new e(2*l))}function El(l,e){if(!l.index){const t=l.attributes.position.count,s=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Il(t,s);l.setIndex(new Ys(i,1));for(let n=0;no-a);for(let o=0;on.offset-r.offset),s=t[t.length-1];s.count=Math.min(e-s.offset,s.count);let i=0;return t.forEach(({count:n})=>i+=n),e!==i}function Oe(l,e,t){return t.min.x=e[l],t.min.y=e[l+1],t.min.z=e[l+2],t.max.x=e[l+3],t.max.y=e[l+4],t.max.z=e[l+5],t}function pl(l){l[0]=l[1]=l[2]=1/0,l[3]=l[4]=l[5]=-1/0}function fr(l){let e=-1,t=-1/0;for(let s=0;s<3;s++){const i=l[s+3]-l[s];i>t&&(t=i,e=s)}return e}function pr(l,e){e.set(l)}function Cr(l,e,t){let s,i;for(let n=0;n<3;n++){const r=n+3;s=l[n],i=e[n],t[n]=si?s:i}}function Xs(l,e,t){for(let s=0;s<3;s++){const i=e[l+2*s],n=e[l+2*s+1],r=i-n,o=i+n;rt[s+3]&&(t[s+3]=o)}}function ms(l){const e=l[3]-l[0],t=l[4]-l[1],s=l[5]-l[2];return 2*(e*t+t*s+s*e)}function Gi(l,e,t,s,i=null){let n=1/0,r=1/0,o=1/0,a=-1/0,c=-1/0,h=-1/0,d=1/0,I=1/0,u=1/0,f=-1/0,E=-1/0,C=-1/0;const T=i!==null;for(let m=e*6,A=(e+t)*6;ma&&(a=y),T&&Rf&&(f=R);const w=l[m+2],P=l[m+3],M=w-P,B=w+P;Mc&&(c=B),T&&wE&&(E=w);const O=l[m+4],v=l[m+5],g=O-v,b=O+v;gh&&(h=b),T&&OC&&(C=O)}s[0]=n,s[1]=r,s[2]=o,s[3]=a,s[4]=c,s[5]=h,T&&(i[0]=d,i[1]=I,i[2]=u,i[3]=f,i[4]=E,i[5]=C)}function Cl(l,e,t,s){let i=1/0,n=1/0,r=1/0,o=-1/0,a=-1/0,c=-1/0;for(let h=e*6,d=(e+t)*6;ho&&(o=I);const u=l[h+2];ua&&(a=u);const f=l[h+4];fc&&(c=f)}s[0]=i,s[1]=n,s[2]=r,s[3]=o,s[4]=a,s[5]=c}function Tl(l,e){pl(e);const t=l.attributes.position,s=l.index?l.index.array:null,i=Es(l),n=new Float32Array(i*6),r=t.normalized,o=t.array,a=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;dL&&(L=A),R>L&&(L=R);const y=(L-S)/2,w=T*2;n[u+w+0]=S+y,n[u+w+1]=y+(Math.abs(S)+y)*ul,Se[T+3]&&(e[T+3]=L)}}return n}const Et=32,ml=(l,e)=>l.candidate-e.candidate,Ot=new Array(Et).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),js=new Float32Array(6);function Rl(l,e,t,s,i,n){let r=-1,o=0;if(n===fo)r=fr(e),r!==-1&&(o=(e[r]+e[r+3])/2);else if(n===cl)r=fr(l),r!==-1&&(o=gl(t,s,i,r));else if(n===hl){const a=ms(l);let c=Yi*i;const h=s*6,d=(s+i)*6;for(let I=0;I<3;I++){const u=e[I],f=(e[I+3]-u)/Et;if(i=S.candidate?Xs(m,t,S.rightCacheBounds):(Xs(m,t,S.leftCacheBounds),S.count++)}}for(let m=0;m=Et&&(m=Et-1);const A=Ot[m];A.count++,Xs(T,t,A.bounds)}const E=Ot[Et-1];pr(E.bounds,E.rightCacheBounds);for(let T=Et-2;T>=0;T--){const m=Ot[T],A=Ot[T+1];Cr(m.bounds,A.rightCacheBounds,m.rightCacheBounds)}let C=0;for(let T=0;T=a;)o--;if(r=a;)o--;if(r2**16,i=s?4:2,n=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),r=s?new Uint32Array(n):new Uint16Array(n);for(let o=0,a=r.length;o=i&&(d=!0,n&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),L<=r||w>=i)return m(S+L),R.offset=S,R.count=L,R;const P=Rl(R.boundingData,y,f,S,L,o);if(P.axis===-1)return m(S+L),R.offset=S,R.count=L,R;const M=E(h,s,f,S,L,P);if(M===S||M===S+L)m(S+L),R.offset=S,R.count=L;else{R.splitAxis=P.axis;const B=new Zs,O=S,v=M-S;R.left=B,B.boundingData=new Float32Array(6),Gi(f,O,v,B.boundingData,u),A(B,O,v,u,w+1);const g=new Zs,b=M,Z=L-v;R.right=g,g.boundingData=new Float32Array(6),Gi(f,b,Z,g.boundingData,u),A(g,b,Z,u,w+1)}return R}}function Nl(l,e){const t=l.geometry;e.indirect&&(l._indirectBuffer=Al(t,e.useSharedArrayBuffer),fl(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),l._indirectBuffer||El(t,e);const s=Ol(l,e);let i,n,r;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;dMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[u+6]=R/4,R=h(R,m),n[u+7]=A,R}}}class Ft{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let s=1/0,i=-1/0;for(let n=0,r=e.length;ni?o:i}this.min=s,this.max=i}setFromPoints(e,t){let s=1/0,i=-1/0;for(let n=0,r=t.length;ni?a:i}this.min=s,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Ft.prototype.setFromBox=function(){const l=new x;return function(e,t){const s=t.min,i=t.max;let n=1/0,r=-1/0;for(let o=0;o<=1;o++)for(let a=0;a<=1;a++)for(let c=0;c<=1;c++){l.x=s.x*o+i.x*(1-o),l.y=s.y*a+i.y*(1-a),l.z=s.z*c+i.z*(1-c);const h=e.dot(l);n=Math.min(h,n),r=Math.max(h,r)}this.min=n,this.max=r}}();const yl=function(){const l=new x,e=new x,t=new x;return function(s,i,n){const r=s.start,o=l,a=i.start,c=e;t.subVectors(r,a),l.subVectors(s.end,s.start),e.subVectors(i.end,i.start);const h=t.dot(c),d=c.dot(o),I=c.dot(c),u=t.dot(o),f=o.dot(o)*I-d*d;let E,C;f!==0?E=(h*d-u*I)/f:E=0,C=(h+E*d)/I,n.x=E,n.y=C}}(),$n=function(){const l=new He,e=new x,t=new x;return function(s,i,n,r){yl(s,i,l);let o=l.x,a=l.y;if(o>=0&&o<=1&&a>=0&&a<=1){s.at(o,n),i.at(a,r);return}else if(o>=0&&o<=1){a<0?i.at(0,r):i.at(1,r),s.closestPointToPoint(r,!0,n);return}else if(a>=0&&a<=1){o<0?s.at(0,n):s.at(1,n),i.closestPointToPoint(n,!0,r);return}else{let c;o<0?c=s.start:c=s.end;let h;a<0?h=i.start:h=i.end;const d=e,I=t;if(s.closestPointToPoint(h,!0,e),i.closestPointToPoint(c,!0,t),d.distanceToSquared(h)<=I.distanceToSquared(c)){n.copy(d),r.copy(h);return}else{n.copy(c),r.copy(I);return}}}}(),Ll=function(){const l=new x,e=new x,t=new Is,s=new it;return function(i,n){const{radius:r,center:o}=i,{a,b:c,c:h}=n;if(s.start=a,s.end=c,s.closestPointToPoint(o,!0,l).distanceTo(o)<=r||(s.start=a,s.end=h,s.closestPointToPoint(o,!0,l).distanceTo(o)<=r)||(s.start=c,s.end=h,s.closestPointToPoint(o,!0,l).distanceTo(o)<=r))return!0;const d=n.getPlane(t);if(Math.abs(d.distanceToPoint(o))<=r){const I=d.projectPoint(o,e);if(n.containsPoint(I))return!0}return!1}}(),Pl=1e-15;function zi(l){return Math.abs(l)new x),this.satBounds=new Array(4).fill().map(()=>new Ft),this.points=[this.a,this.b,this.c],this.sphere=new Li,this.plane=new Is,this.needsUpdate=!0}intersectsSphere(e){return Ll(e,this)}update(){const e=this.a,t=this.b,s=this.c,i=this.points,n=this.satAxes,r=this.satBounds,o=n[0],a=r[0];this.getNormal(o),a.setFromPoints(o,i);const c=n[1],h=r[1];c.subVectors(e,t),h.setFromPoints(c,i);const d=n[2],I=r[2];d.subVectors(t,s),I.setFromPoints(d,i);const u=n[3],f=r[3];u.subVectors(s,e),f.setFromPoints(u,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}}nt.prototype.closestPointToSegment=function(){const l=new x,e=new x,t=new it;return function(s,i=null,n=null){const{start:r,end:o}=s,a=this.points;let c,h=1/0;for(let d=0;d<3;d++){const I=(d+1)%3;t.start.copy(a[d]),t.end.copy(a[I]),$n(t,s,l,e),c=l.distanceToSquared(e),c=2){(R===1?T.start:T.end).copy(u),A=2;break}if(A++,A===2&&R===-1)break}}return A}return function(E,C=null,T=!1){this.needsUpdate&&this.update(),E.isExtendedTriangle?E.needsUpdate&&E.update():(l.copy(E),l.update(),E=l);const m=this.plane,A=E.plane;if(Math.abs(m.normal.dot(A.normal))>1-1e-10){const R=this.satBounds,S=this.satAxes;t[0]=E.a,t[1]=E.b,t[2]=E.c;for(let w=0;w<4;w++){const P=R[w],M=S[w];if(s.setFromPoints(M,t),P.isSeparated(s))return!1}const L=E.satBounds,y=E.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let w=0;w<4;w++){const P=L[w],M=y[w];if(s.setFromPoints(M,e),P.isSeparated(s))return!1}for(let w=0;w<4;w++){const P=S[w];for(let M=0;M<4;M++){const B=y[M];if(n.crossVectors(P,B),s.setFromPoints(n,e),i.setFromPoints(n,t),s.isSeparated(i))return!1}}return C&&(T||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),C.start.set(0,0,0),C.end.set(0,0,0)),!0}else{const R=f(this,A,d);if(R===1&&E.containsPoint(d.end))return C&&(C.start.copy(d.end),C.end.copy(d.end)),!0;if(R!==2)return!1;const S=f(E,m,I);if(S===1&&this.containsPoint(I.end))return C&&(C.start.copy(I.end),C.end.copy(I.end)),!0;if(S!==2)return!1;if(d.delta(o),I.delta(a),o.dot(a)<0){let O=I.start;I.start=I.end,I.end=O}const L=d.start.dot(o),y=d.end.dot(o),w=I.start.dot(o),P=I.end.dot(o),M=y0?C.start.copy(d.start):C.start.copy(I.start),c.subVectors(d.end,I.end),c.dot(o)<0?C.end.copy(d.end):C.end.copy(I.end)),!0)}}}();nt.prototype.distanceToPoint=function(){const l=new x;return function(e){return this.closestPointToPoint(e,l),e.distanceTo(l)}}();nt.prototype.distanceToTriangle=function(){const l=new x,e=new x,t=["a","b","c"],s=new it,i=new it;return function(n,r=null,o=null){const a=r||o?s:null;if(this.intersectsTriangle(n,a))return(r||o)&&(r&&a.getCenter(r),o&&a.getCenter(o)),0;let c=1/0;for(let h=0;h<3;h++){let d;const I=t[h],u=n[I];this.closestPointToPoint(u,l),d=u.distanceToSquared(l),dnew x),this.satAxes=new Array(3).fill().map(()=>new x),this.satBounds=new Array(3).fill().map(()=>new Ft),this.alignedSatBounds=new Array(3).fill().map(()=>new Ft),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}set(e,t,s){this.min.copy(e),this.max.copy(t),this.matrix.copy(s),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ve.prototype.update=function(){return function(){const l=this.matrix,e=this.min,t=this.max,s=this.points;for(let a=0;a<=1;a++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){const d=1*a|2*c|4*h,I=s[d];I.x=a?t.x:e.x,I.y=c?t.y:e.y,I.z=h?t.z:e.z,I.applyMatrix4(l)}const i=this.satBounds,n=this.satAxes,r=s[0];for(let a=0;a<3;a++){const c=n[a],h=i[a],d=1<new it),t=new Array(12).fill().map(()=>new it),s=new x,i=new x;return function(n,r=0,o=null,a=null){if(this.needsUpdate&&this.update(),this.intersectsBox(n))return(o||a)&&(n.getCenter(i),this.closestPointToPoint(i,s),n.closestPointToPoint(s,i),o&&o.copy(s),a&&a.copy(i)),0;const c=r*r,h=n.min,d=n.max,I=this.points;let u=1/0;for(let E=0;E<8;E++){const C=I[E];i.copy(C).clamp(h,d);const T=C.distanceToSquared(i);if(Tnew nt)}}const Ze=new _l;function ze(l,e){return e[l+15]===65535}function ke(l,e){return e[l+6]}function $e(l,e){return e[l+14]}function qe(l){return l+8}function Qe(l,e){return e[l+6]}function To(l,e){return e[l+7]}class wl{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=s=>{t&&e.push(t),t=s,this.float32Array=new Float32Array(s),this.uint16Array=new Uint16Array(s),this.uint32Array=new Uint32Array(s)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const ge=new wl;let _t,as;const Wt=[],$s=new qn(()=>new we);function vl(l,e,t,s,i,n){_t=$s.getPrimitive(),as=$s.getPrimitive(),Wt.push(_t,as),ge.setBuffer(l._roots[e]);const r=an(0,l.geometry,t,s,i,n);ge.clearBuffer(),$s.releasePrimitive(_t),$s.releasePrimitive(as),Wt.pop(),Wt.pop();const o=Wt.length;return o>0&&(as=Wt[o-1],_t=Wt[o-2]),r}function an(l,e,t,s,i=null,n=0,r=0){const{float32Array:o,uint16Array:a,uint32Array:c}=ge;let h=l*2;if(ze(h,a)){const d=ke(l,c),I=$e(h,a);return Oe(l,o,_t),s(d,I,!1,r,n+l,_t)}else{let d=function(B){const{uint16Array:O,uint32Array:v}=ge;let g=B*2;for(;!ze(g,O);)B=qe(B),g=B*2;return ke(B,v)},I=function(B){const{uint16Array:O,uint32Array:v}=ge;let g=B*2;for(;!ze(g,O);)B=Qe(B,v),g=B*2;return ke(B,v)+$e(g,O)};const u=qe(l),f=Qe(l,c);let E=u,C=f,T,m,A,R;if(i&&(A=_t,R=as,Oe(E,o,A),Oe(C,o,R),T=i(A),m=i(R),m(Rs.copy(e).clamp(h.min,h.max),Rs.distanceToSquared(e)),intersectsBounds:(h,d,I)=>I{h.closestPointToPoint(e,Rs);const I=e.distanceToSquared(Rs);return I0&&c.normal.multiplyScalar(-1));const h={a:n,b:r,c:o,normal:new x,materialIndex:0};os.getNormal(Xt,jt,Zt,h.normal),c.face=h,c.faceIndex=n}return c}function Di(l,e,t,s,i){const n=s*3;let r=n+0,o=n+1,a=n+2;const c=l.index;l.index&&(r=c.getX(r),o=c.getX(o),a=c.getX(a));const{position:h,normal:d,uv:I,uv1:u}=l.attributes,f=bl(t,h,d,I,u,r,o,a,e);return f?(f.faceIndex=s,i&&i.push(f),f):null}function Pe(l,e,t,s){const i=l.a,n=l.b,r=l.c;let o=e,a=e+1,c=e+2;t&&(o=t.getX(o),a=t.getX(a),c=t.getX(c)),i.x=s.getX(o),i.y=s.getY(o),i.z=s.getZ(o),n.x=s.getX(a),n.y=s.getY(a),n.z=s.getZ(a),r.x=s.getX(c),r.y=s.getY(c),r.z=s.getZ(c)}function Ul(l,e,t,s,i,n){const{geometry:r,_indirectBuffer:o}=l;for(let a=s,c=s+i;aS&&(S=B),OL&&(L=O),vy&&(y=v)}return a[I+0]!==m||a[I+1]!==A||a[I+2]!==R||a[I+3]!==S||a[I+4]!==L||a[I+5]!==y?(a[I+0]=m,a[I+1]=A,a[I+2]=R,a[I+3]=S,a[I+4]=L,a[I+5]=y,!0):!1}else{const C=I+8,T=r[I+6],m=C+u,A=T+u;let R=f,S=!1,L=!1;e?R||(S=e.has(m),L=e.has(A),R=!S&&!L):(S=!0,L=!0);const y=R||S,w=R||L;let P=!1;y&&(P=d(C,u,R));let M=!1;w&&(M=d(T,u,R));const B=P||M;if(B)for(let O=0;O<3;O++){const v=C+O,g=T+O,b=a[v],Z=a[v+3],z=a[g],J=a[g+3];a[I+O]=bJ?Z:J}return B}}}const gr=new we;function wt(l,e,t,s){return Oe(l,e,gr),t.intersectBox(gr,s)}function Vl(l,e,t,s,i,n){const{geometry:r,_indirectBuffer:o}=l;for(let a=s,c=s+i;a=0;let d,I;h?(d=qe(l),I=Qe(l,r)):(d=Qe(l,r),I=qe(l));const u=wt(d,i,s,Sr)?cn(d,e,t,s):null;if(u){const E=u.point[c];if(h?E<=i[I+a]:E>=i[I+a+3])return u}const f=wt(I,i,s,Sr)?cn(I,e,t,s):null;return u&&f?u.distance<=f.distance?u:f:u||f||null}}const ei=new we,$t=new nt,qt=new nt,gs=new Ee,Ar=new Ve,ti=new Ve;function Xl(l,e,t,s){ge.setBuffer(l._roots[e]);const i=hn(0,l,t,s);return ge.clearBuffer(),i}function hn(l,e,t,s,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=ge;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Ar.set(t.boundingBox.min,t.boundingBox.max,s),i=Ar),ze(a,r)){const c=e.geometry,h=c.index,d=c.attributes.position,I=t.index,u=t.attributes.position,f=ke(l,o),E=$e(a,r);if(gs.copy(s).invert(),t.boundsTree)return Oe(l,n,ti),ti.matrix.copy(gs),ti.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>ti.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(s),C.b.applyMatrix4(s),C.c.applyMatrix4(s),C.needsUpdate=!0;for(let T=f*3,m=(E+f)*3;THi.distanceToBox(S),intersectsBounds:(S,L,y)=>y{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:y=>Fs.distanceToBox(y),intersectsBounds:(y,w,P)=>P{for(let P=y,M=y+w;PS&&(S=v),gL&&(L=g),by&&(y=b)}}return a[I+0]!==m||a[I+1]!==A||a[I+2]!==R||a[I+3]!==S||a[I+4]!==L||a[I+5]!==y?(a[I+0]=m,a[I+1]=A,a[I+2]=R,a[I+3]=S,a[I+4]=L,a[I+5]=y,!0):!1}else{const C=I+8,T=r[I+6],m=C+u,A=T+u;let R=f,S=!1,L=!1;e?R||(S=e.has(m),L=e.has(A),R=!S&&!L):(S=!0,L=!0);const y=R||S,w=R||L;let P=!1;y&&(P=d(C,u,R));let M=!1;w&&(M=d(T,u,R));const B=P||M;if(B)for(let O=0;O<3;O++){const v=C+O,g=T+O,b=a[v],Z=a[v+3],z=a[g],J=a[g+3];a[I+O]=bJ?Z:J}return B}}}const Or=new x;function Jl(l,e,t,s,i){ge.setBuffer(l._roots[e]),un(0,l,t,s,i),ge.clearBuffer()}function un(l,e,t,s,i){const{float32Array:n,uint16Array:r,uint32Array:o}=ge,a=l*2;if(ze(a,r)){const c=ke(l,o),h=$e(a,r);Vl(e,t,s,c,h,i)}else{const c=qe(l);wt(c,n,s,Or)&&un(c,e,t,s,i);const h=Qe(l,o);wt(h,n,s,Or)&&un(h,e,t,s,i)}}const Nr=new x,ec=["x","y","z"];function tc(l,e,t,s){ge.setBuffer(l._roots[e]);const i=dn(0,l,t,s);return ge.clearBuffer(),i}function dn(l,e,t,s){const{float32Array:i,uint16Array:n,uint32Array:r}=ge;let o=l*2;if(ze(o,n)){const a=ke(l,r),c=$e(o,n);return Gl(e,t,s,a,c)}else{const a=To(l,r),c=ec[a],h=s.direction[c]>=0;let d,I;h?(d=qe(l),I=Qe(l,r)):(d=Qe(l,r),I=qe(l));const u=wt(d,i,s,Nr)?dn(d,e,t,s):null;if(u){const E=u.point[c];if(h?E<=i[I+a]:E>=i[I+a+3])return u}const f=wt(I,i,s,Nr)?dn(I,e,t,s):null;return u&&f?u.distance<=f.distance?u:f:u||f||null}}const ii=new we,Qt=new nt,Kt=new nt,Ss=new Ee,yr=new Ve,ni=new Ve;function sc(l,e,t,s){ge.setBuffer(l._roots[e]);const i=In(0,l,t,s);return ge.clearBuffer(),i}function In(l,e,t,s,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=ge;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),yr.set(t.boundingBox.min,t.boundingBox.max,s),i=yr),ze(a,r)){const c=e.geometry,h=c.index,d=c.attributes.position,I=t.index,u=t.attributes.position,f=ke(l,o),E=$e(a,r);if(Ss.copy(s).invert(),t.boundsTree)return Oe(l,n,ni),ni.matrix.copy(Ss),ni.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>ni.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(s),C.b.applyMatrix4(s),C.c.applyMatrix4(s),C.needsUpdate=!0;for(let T=f,m=E+f;TWi.distanceToBox(S),intersectsBounds:(S,L,y)=>y{if(e.boundsTree){const y=e.boundsTree;return y.shapecast({boundsTraverseOrder:w=>As.distanceToBox(w),intersectsBounds:(w,P,M)=>M{for(let M=w,B=w+P;Mnew we),Jt=new we,es=new we,Xi=new we,ji=new we;let Zi=!1;function cc(l,e,t,s){if(Zi)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Zi=!0;const i=l._roots,n=e._roots;let r,o=0,a=0;const c=new Ee().copy(t).invert();for(let h=0,d=i.length;ha.slice()),index:r.array.slice(),indirectBuffer:n?n.slice():null}:o={roots:i,index:r.array,indirectBuffer:n},o}static deserialize(e,t,s={}){s={setIndex:!0,indirect:!!e.indirectBuffer,...s};const{index:i,roots:n,indirectBuffer:r}=e,o=new Qn(t,{...s,[Vi]:!0});if(o._roots=n,o._indirectBuffer=r||null,s.setIndex){const a=t.getIndex();if(a===null){const c=new Ys(e.index,1,!1);t.setIndex(c)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:fo,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Vi]:!1},t),t.useSharedArrayBuffer&&!lc())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Vi]||(Nl(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new we)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?i=>s[i]:i=>i}refit(e=null){return(this.indirect?Kl:Yl)(this,e)}traverse(e,t=0){const s=this._roots[t],i=new Uint32Array(s),n=new Uint16Array(s);r(0);function r(o,a=0){const c=o*2,h=n[c+15]===Mi;if(h){const d=i[o+6],I=n[c+14];e(a,h,new Float32Array(s,o*4,6),d,I)}else{const d=o+Ti/4,I=i[o+6],u=i[o+7];e(a,h,new Float32Array(s,o*4,6),u)||(r(d,a+1),r(I,a+1))}}}raycast(e,t=ur){const s=this._roots,i=this.geometry,n=[],r=t.isMaterial,o=Array.isArray(t),a=i.groups,c=r?t.side:t,h=this.indirect?Jl:kl;for(let d=0,I=s.length;dd(I,u,f,E,C)?!0:s(I,u,this,o,f,E,t)}else r||(o?r=(d,I,u,f)=>s(d,I,this,o,u,f,t):r=(d,I,u)=>u);let a=!1,c=0;const h=this._roots;for(let d=0,I=h.length;d{const E=this.resolveTriangleIndex(f);Pe(r,E*3,o,a)}:f=>{Pe(r,f*3,o,a)},h=Ze.getPrimitive(),d=e.geometry.index,I=e.geometry.attributes.position,u=e.indirect?f=>{const E=e.resolveTriangleIndex(f);Pe(h,E*3,d,I)}:f=>{Pe(h,f*3,d,I)};if(n){const f=(E,C,T,m,A,R,S,L)=>{for(let y=T,w=T+m;yoi.intersectsBox(s),intersectsTriangle:s=>oi.intersectsTriangle(s)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,s={},i={},n=0,r=1/0){return(this.indirect?ac:Ql)(this,e,t,s,i,n,r)}closestPointToPoint(e,t={},s=0,i=1/0){return Ml(this,e,t,s,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{Oe(0,new Float32Array(t),Lr),e.union(Lr)}),e}}function Pr(l,e,t){return l===null||(l.point.applyMatrix4(e.matrixWorld),l.distance=l.point.distanceTo(t.ray.origin),l.object=e,l.distancet.far)?null:l}const $i=new Ka,_r=new Ee,hc=se.prototype.raycast;function uc(l,e){if(this.geometry.boundsTree){if(this.material===void 0)return;_r.copy(this.matrixWorld).invert(),$i.copy(l.ray).applyMatrix4(_r);const t=this.geometry.boundsTree;if(l.firstHitOnly===!0){const s=Pr(t.raycastFirst($i,this.material),this,l);s&&e.push(s)}else{const s=t.raycast($i,this.material);for(let i=0,n=s.length;i{const t=this.handlers.slice(0);for(const s of t)s(e)}),p(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class mi{constructor(){p(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const s of t)await s(e)}),p(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Kn{constructor(e){p(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this),p(this,"isResizeable",()=>"resize"in this&&"getSize"in this),p(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this),p(this,"isHideable",()=>"visible"in this),p(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this),this.components=e}}class Ae extends Kn{}class Jn extends Kn{constructor(e){super(e),p(this,"worlds",new Map),p(this,"onWorldChanged",new $),p(this,"currentWorld",null),this.onWorldChanged.add(({world:t,action:s})=>{s==="removed"&&this.worlds.delete(t.uuid)})}}class Ec extends Jn{constructor(){super(...arguments),p(this,"hasCameraControls",()=>"controls"in this)}}class fc extends Jn{constructor(){super(...arguments),p(this,"onAfterUpdate",new $),p(this,"onBeforeUpdate",new $),p(this,"onDisposed",new $),p(this,"onResize",new $),p(this,"onClippingPlanesUpdated",new $),p(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,s){t.isLocal=s;const i=this.clippingPlanes.indexOf(t);e&&i===-1?this.clippingPlanes.push(t):!e&&i>-1&&this.clippingPlanes.splice(i,1),this.three.clippingPlanes=this.clippingPlanes.filter(n=>!n.isLocal)}}const mo=class En extends Ae{constructor(e){super(e),p(this,"_disposedComponents",new Set),p(this,"enabled",!0),e.add(En.uuid,this)}get(){return this._disposedComponents}destroy(e,t=!0,s=!0){e.removeFromParent();const i=e;i.dispose&&i.dispose(),this.disposeGeometryAndMaterials(e,t),s&&i.children&&i.children.length&&this.disposeChildren(i),e.children.length=0}disposeGeometry(e){e.boundsTree&&e.disposeBoundsTree&&e.disposeBoundsTree(),e.dispose()}disposeGeometryAndMaterials(e,t){const s=e;s.geometry&&this.disposeGeometry(s.geometry),t&&s.material&&En.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(e){for(const t of e.children)this.destroy(t)}static disposeMaterial(e){if(e.material)if(Array.isArray(e.material))for(const t of e.material)t.dispose();else e.material.dispose()}};p(mo,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let ds=mo;class pc extends Jn{constructor(e){super(e),p(this,"onDisposed",new $),p(this,"directionalLights",new Map),p(this,"ambientLights",new Map)}dispose(){const e=this.components.get(ds);for(const t of this.three.children){const s=t;s.geometry&&e.destroy(s)}this.deleteAllLights(),this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}deleteAllLights(){for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();this.directionalLights.clear();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.ambientLights.clear()}}class Tt extends Set{constructor(e){super(e),p(this,"onItemAdded",new $),p(this,"onItemDeleted",new $),p(this,"onCleared",new $),p(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...e){for(const t of e)this.has(t)||!this.guard(t)||(super.add(t),this.onItemAdded||(this.onItemAdded=new $),this.onItemAdded.trigger(t));return this}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(),t}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class St extends Map{constructor(e){super(e),p(this,"onItemSet",new $),p(this,"onItemUpdated",new $),p(this,"onItemDeleted",new $),p(this,"onCleared",new $),p(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(e,t){const s=this.has(e);if(!(this.guard??(()=>!0))(e,t))return this;const i=super.set(e,t);return s?(this.onItemUpdated||(this.onItemUpdated=new $),this.onItemUpdated.trigger({key:e,value:t})):(this.onItemSet||(this.onItemSet=new $),this.onItemSet.trigger({key:e,value:t})),i}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(e),t}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const Ri=0,Cc=1,Tc=new x,wr=new it,qi=new Is,vr=new x,ai=new os;class mc{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Mr,this.unassigned=new Mr,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,s=e.length;tthis.tolerance)return!1;return!0}intersectRay(e,t){const s=this.faces;let i=-1/0,n=1/0;for(let r=0,o=s.length;r0&&h>=0)return null;const d=h!==0?-c/h:0;if(!(d<=0)&&(h>0?n=Math.min(d,n):i=Math.max(d,i),i>n))return null}return i!==-1/0?e.at(i,t):e.at(n,t),t}intersectsRay(e){return this.intersectRay(e,Tc)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let s=e.outside;for(;s.next!==null&&s.next.face===e;)s=s.next;return this.assigned.removeSubList(t,s),t.prev=s.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const s=this.removeAllVerticesFromFace(e);if(s!==void 0)if(t===void 0)this.unassigned.appendChain(s);else{let i=s;do{const n=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=n}while(i!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const s=t.next;let i=this.tolerance,n=null;for(let r=0;ri&&(i=a,n=o),i>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(t,n),t=s}while(t!==null)}return this}computeExtremes(){const e=new x,t=new x,s=[],i=[];for(let n=0;n<3;n++)s[n]=i[n]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let n=0,r=this.vertices.length;nt.getComponent(c)&&(t.setComponent(c,a.getComponent(c)),i[c]=o)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:s,max:i}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),s=t.min,i=t.max;let n=0,r=0;for(let I=0;I<3;I++){const u=i[I].point.getComponent(I)-s[I].point.getComponent(I);u>n&&(n=u,r=I)}const o=s[r],a=i[r];let c,h;n=0,wr.set(o.point,a.point);for(let I=0,u=this.vertices.length;In&&(n=E,c=f)}}n=-1,qi.setFromCoplanarPoints(o.point,a.point,c.point);for(let I=0,u=this.vertices.length;In&&(n=E,h=f)}}const d=[];if(qi.distanceToPoint(h.point)<0){d.push(tt.create(o,a,c),tt.create(h,a,o),tt.create(h,c,a),tt.create(h,o,c));for(let I=0;I<3;I++){const u=(I+1)%3;d[I+1].getEdge(2).setTwin(d[0].getEdge(u)),d[I+1].getEdge(1).setTwin(d[u+1].getEdge(0))}}else{d.push(tt.create(o,c,a),tt.create(h,o,a),tt.create(h,a,c),tt.create(h,c,o));for(let I=0;I<3;I++){const u=(I+1)%3;d[I+1].getEdge(2).setTwin(d[0].getEdge((3-I)%3)),d[I+1].getEdge(0).setTwin(d[u+1].getEdge(1))}}for(let I=0;I<4;I++)this.faces.push(d[I]);for(let I=0,u=e.length;In&&(n=T,E=this.faces[C])}E!==null&&this.addVertexToFace(f,E)}}return this}reindexFaces(){const e=[];for(let t=0;tt&&(t=n,e=i),i=i.next}while(i!==null&&i.face===s);return e}}computeHorizon(e,t,s,i){this.deleteFaceVertices(s),s.mark=Cc;let n;t===null?n=t=s.getEdge(0):n=t.next;do{const r=n.twin,o=r.face;o.mark===Ri&&(o.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,r,o,i):i.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const s=tt.create(e,t.tail(),t.head());return this.faces.push(s),s.getEdge(-1).setTwin(t.twin),s.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let s=null,i=null;for(let n=0;n0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),s=this.edge.next.head();return ai.set(e.point,t.point,s.point),ai.getNormal(this.normal),ai.getMidpoint(this.midpoint),this.area=ai.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class Qi{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class Rc{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class Mr{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}}const fn=[2,2,1],pn=[1,0,0];function ht(l,e){return l*3+e}function gc(l){const e=l.elements;let t=0;for(let s=0;s<9;s++)t+=e[s]*e[s];return Math.sqrt(t)}function Fc(l){const e=l.elements;let t=0;for(let s=0;s<3;s++){const i=e[ht(fn[s],pn[s])];t+=2*i*i}return Math.sqrt(t)}function Sc(l,e){let t=0,s=1;const i=l.elements;for(let c=0;c<3;c++){const h=Math.abs(i[ht(fn[c],pn[c])]);h>t&&(t=h,s=c)}let n=1,r=0;const o=pn[s],a=fn[s];if(Math.abs(i[ht(a,o)])>Number.EPSILON){const c=i[ht(a,a)],h=i[ht(o,o)],d=i[ht(a,o)],I=(c-h)/2/d;let u;I<0?u=-1/(-I+Math.sqrt(1+I*I)):u=1/(I+Math.sqrt(1+I*I)),n=1/Math.sqrt(1+u*u),r=u*n}return e.identity(),e.elements[ht(o,o)]=n,e.elements[ht(a,a)]=n,e.elements[ht(a,o)]=r,e.elements[ht(o,a)]=-r,e}function Ac(l,e){let t=0,s=0;const i=10;e.unitary.identity(),e.diagonal.copy(l);const n=e.unitary,r=e.diagonal,o=new Bt,a=new Bt,c=Number.EPSILON*gc(r);for(;sc;)Sc(r,o),a.copy(o).transpose(),r.multiply(o),r.premultiply(a),n.multiply(o),++t>2&&(s++,t=0);return e}function Oc(l){const e=[];for(let re=0;re>8&255]+_e._lut[e>>16&255]+_e._lut[e>>24&255]}-${_e._lut[t&255]}${_e._lut[t>>8&255]}-${_e._lut[t>>16&15|64]}${_e._lut[t>>24&255]}-${_e._lut[s&63|128]}${_e._lut[s>>8&255]}-${_e._lut[s>>16&255]}${_e._lut[s>>24&255]}${_e._lut[i&255]}${_e._lut[i>>8&255]}${_e._lut[i>>16&255]}${_e._lut[i>>24&255]}`.toLowerCase()}static validate(e){if(!_e._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. + +- If you're the tool creator, you can take one from https://www.uuidgenerator.net/. + +- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};p(Cn,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),p(Cn,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let vt=Cn;const Ro=class go{constructor(){p(this,"onDisposed",new $),p(this,"list",new Map),p(this,"enabled",!1),p(this,"_clock"),p(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(e);requestAnimationFrame(this.update)}),this._clock=new Da,go.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");vt.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const s=new e(this);return this.list.has(t)||this.add(t,s),s}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){Bs.prototype.computeBoundsTree=dc,Bs.prototype.disposeBoundsTree=Ic,se.prototype.raycast=uc}};p(Ro,"release","2.3.0-alpha.1");let Fo=Ro;class Nc extends Kn{constructor(){super(...arguments),p(this,"meshes",new Set),p(this,"onAfterUpdate",new $),p(this,"onBeforeUpdate",new $),p(this,"onDisposed",new $),p(this,"isDisposing",!1),p(this,"enabled",!0),p(this,"uuid",vt.create()),p(this,"name"),p(this,"_scene"),p(this,"_camera"),p(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(e){this._scene=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(e){this._camera=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(e){this._renderer=e,e&&(e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"}))}update(e){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(e),this.camera.isUpdateable()&&this.camera.update(e),this.renderer&&this.renderer.update(e),this.onAfterUpdate.trigger()))}dispose(e=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),e){const t=this.components.get(ds);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)t.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class kt{constructor(e,t,s){p(this,"_component"),p(this,"name"),this._component=e,this.name=s,t.get(ut).list.add(this)}get controls(){const e={};for(const t in this._config){const s=this._config[t];e[t]=this.copyEntry(s)}return e}copyEntry(e){if(e.type==="Boolean"){const t=e;return{type:t.type,value:t.value}}if(e.type==="Color"){const t=e;return{type:t.type,value:t.value.clone()}}if(e.type==="Text"){const t=e;return{type:t.type,value:t.value}}if(e.type==="Number"){const t=e;return{type:t.type,value:t.value,min:t.min,max:t.max,interpolable:t.interpolable}}if(e.type==="Select"){const t=e;return{type:t.type,value:t.value,multiple:t.multiple,options:new Set(t.options)}}if(e.type==="Vector3"){const t=e;return{type:t.type,value:t.value.clone()}}if(e.type==="TextSet"){const t=e;return{type:t.type,value:new Set(t.value)}}if(e.type==="None"){const t=e;return{type:t.type,value:t.value}}throw new Error("Invalid entry!")}}const So=class Ao extends Ae{constructor(e){super(e),p(this,"list",new Tt),p(this,"enabled",!0),e.add(Ao.uuid,this)}};p(So,"uuid","b8c764e0-6b24-4e77-9a32-35fa728ee5b4");let ut=So;class yc{constructor(e,t){p(this,"_list"),p(this,"_scene"),this._list=e,this._scene=t}get color(){return this._list.directionalLight.color.value}set color(e){this._list.directionalLight.color.value=e;for(const[,t]of this._scene.directionalLights)t.color.copy(e)}get intensity(){return this._list.directionalLight.intensity.value}set intensity(e){this._list.directionalLight.intensity.value=e;for(const[,t]of this._scene.directionalLights)t.intensity=e}get position(){return this._list.directionalLight.position.value.clone()}set position(e){this._list.directionalLight.position.value=e;for(const[,t]of this._scene.directionalLights)t.position.copy(e)}}class Lc{constructor(e,t){p(this,"_list"),p(this,"_scene"),this._list=e,this._scene=t}get color(){return this._list.ambientLight.color.value}set color(e){this._list.ambientLight.color.value=e;for(const[,t]of this._scene.ambientLights)t.color.copy(e)}get intensity(){return this._list.ambientLight.intensity.value}set intensity(e){this._list.ambientLight.intensity.value=e;for(const[,t]of this._scene.ambientLights)t.intensity=e}}class Pc extends kt{constructor(){super(...arguments),p(this,"_config",{backgroundColor:{value:new ve,type:"Color"},ambientLight:{color:{type:"Color",value:new ve},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2}},directionalLight:{color:{type:"Color",value:new ve},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2},position:{type:"Vector3",value:new x}}}),p(this,"ambientLight",new Lc(this._config,this._component)),p(this,"directionalLight",new yc(this._config,this._component))}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.three.background=e}}class _c extends pc{constructor(e){super(e),p(this,"onSetup",new $),p(this,"isSetup",!1),p(this,"three"),p(this,"config",new Pc(this,this.components,"Scene")),p(this,"_defaultConfig",{backgroundColor:new ve(2107698),directionalLight:{color:new ve("white"),intensity:1.5,position:new x(5,10,3)},ambientLight:{color:new ve("white"),intensity:1}}),this.three=new Pi,this.three.background=new ve(2107698),this.components.get(ut).list.add(this.config)}setup(e){const t={...this._defaultConfig,...e};this.config.backgroundColor=t.backgroundColor;const s=t.ambientLight;this.config.ambientLight.color=s.color,this.config.ambientLight.intensity=s.intensity;const i=t.directionalLight;this.config.directionalLight.color=i.color,this.config.directionalLight.intensity=i.intensity,this.config.directionalLight.position=i.position,this.deleteAllLights();const{color:n,intensity:r}=this.config.directionalLight,o=new co(n,r);o.position.copy(i.position);const{color:a,intensity:c}=this.config.directionalLight,h=new _a(a,c);this.three.add(o,h),this.directionalLights.set(o.uuid,o),this.ambientLights.set(h.uuid,h),this.isSetup=!0,this.onSetup.trigger()}dispose(){super.dispose(),this.components.get(ut).list.delete(this.config)}}class qu extends fc{constructor(e,t,s){super(e),p(this,"enabled",!0),p(this,"container"),p(this,"three"),p(this,"_canvas"),p(this,"_parameters"),p(this,"_resizeObserver",null),p(this,"onContainerUpdated",new $),p(this,"_resizing",!1),p(this,"resize",r=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const o=r?r.x:this.container.clientWidth,a=r?r.y:this.container.clientHeight;this.three.setSize(o,a),this.onResize.trigger(new He(o,a)),this._resizing=!1}),p(this,"resizeEvent",()=>{this.resize()}),p(this,"onContextLost",r=>{r.preventDefault(),this.enabled=!1}),p(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new xs({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0}),this.container=t,this._parameters=s,this.three=new xs({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const i=this.three.getContext(),{canvas:n}=i;n.addEventListener("webglcontextlost",this.onContextLost,!1),n.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new He(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! + * camera-controls + * https://github.com/yomotsu/camera-controls + * (c) 2017 @yomotsu + * Released under the MIT License. + */const le={LEFT:1,RIGHT:2,MIDDLE:4},k=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),ts={NONE:0,IN:1,OUT:-1};function Dt(l){return l.isPerspectiveCamera}function yt(l){return l.isOrthographicCamera}const ss=Math.PI*2,br=Math.PI/2,Oo=1e-5,Os=Math.PI/180;function et(l,e,t){return Math.max(e,Math.min(t,l))}function me(l,e=Oo){return Math.abs(l)0==u>h&&(u=h,t.value=(u-h)/n),u}function xr(l,e,t,s,i=1/0,n,r){s=Math.max(1e-4,s);const o=2/s,a=o*n,c=1/(1+a+.48*a*a+.235*a*a*a);let h=e.x,d=e.y,I=e.z,u=l.x-h,f=l.y-d,E=l.z-I;const C=h,T=d,m=I,A=i*s,R=A*A,S=u*u+f*f+E*E;if(S>R){const b=Math.sqrt(S);u=u/b*A,f=f/b*A,E=E/b*A}h=l.x-u,d=l.y-f,I=l.z-E;const L=(t.x+o*u)*n,y=(t.y+o*f)*n,w=(t.z+o*E)*n;t.x=(t.x-o*L)*c,t.y=(t.y-o*y)*c,t.z=(t.z-o*w)*c,r.x=h+(u+L)*c,r.y=d+(f+y)*c,r.z=I+(E+w)*c;const P=C-l.x,M=T-l.y,B=m-l.z,O=r.x-C,v=r.y-T,g=r.z-m;return P*O+M*v+B*g>0&&(r.x=C,r.y=T,r.z=m,t.x=(r.x-C)/n,t.y=(r.y-T)/n,t.z=(r.z-m)/n),r}function Ki(l,e){e.set(0,0),l.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=l.length,e.y/=l.length}function Ji(l,e){return yt(l)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class wc{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const t=this._listeners[e.type];if(t!==void 0){e.target=this;const s=t.slice(0);for(let i=0,n=s.length;i{},this._enabled=!0,this._state=k.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=ts.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ae.Vector3,this._focalOffsetVelocity=new ae.Vector3,this._zoomVelocity={value:0},this._truckInternal=(R,S,L)=>{let y,w;if(Dt(this._camera)){const P=ce.copy(this._camera.position).sub(this._target),M=this._camera.getEffectiveFOV()*Os,B=P.length()*Math.tan(M*.5);y=this.truckSpeed*R*B/this._elementRect.height,w=this.truckSpeed*S*B/this._elementRect.height}else if(yt(this._camera)){const P=this._camera;y=R*(P.right-P.left)/P.zoom/this._elementRect.width,w=S*(P.top-P.bottom)/P.zoom/this._elementRect.height}else return;this.verticalDragToForward?(L?this.setFocalOffset(this._focalOffsetEnd.x+y,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(y,0,!0),this.forward(-w,!0)):L?this.setFocalOffset(this._focalOffsetEnd.x+y,this._focalOffsetEnd.y+w,this._focalOffsetEnd.z,!0):this.truck(y,w,!0)},this._rotateInternal=(R,S)=>{const L=ss*this.azimuthRotateSpeed*R/this._elementRect.height,y=ss*this.polarRotateSpeed*S/this._elementRect.height;this.rotate(L,y,!0)},this._dollyInternal=(R,S,L)=>{const y=Math.pow(.95,-R*this.dollySpeed),w=this._sphericalEnd.radius,P=this._sphericalEnd.radius*y,M=et(P,this.minDistance,this.maxDistance),B=M-P;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(P,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(B,!0),this._dollyToNoClamp(M,!0)):this._dollyToNoClamp(M,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?P:M)-w,this._dollyControlCoord.set(S,L)),this._lastDollyDirection=Math.sign(-R)},this._zoomInternal=(R,S,L)=>{const y=Math.pow(.95,R*this.dollySpeed),w=this._zoom,P=this._zoom*y;this.zoomTo(P,!0),this.dollyToCursor&&(this._changedZoom+=P-w,this._dollyControlCoord.set(S,L))},typeof ae>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ae.Quaternion().setFromUnitVectors(this._camera.up,hi),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=k.NONE,this._target=new ae.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ae.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ae.Spherical().setFromVector3(ce.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ae.Vector3,new ae.Vector3,new ae.Vector3,new ae.Vector3],this._updateNearPlaneCorners(),this._boundary=new ae.Box3(new ae.Vector3(-1/0,-1/0,-1/0),new ae.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ae.Vector2,this.mouseButtons={left:k.ROTATE,middle:k.DOLLY,right:k.TRUCK,wheel:Dt(this._camera)?k.DOLLY:yt(this._camera)?k.ZOOM:k.NONE},this.touches={one:k.TOUCH_ROTATE,two:Dt(this._camera)?k.TOUCH_DOLLY_TRUCK:yt(this._camera)?k.TOUCH_ZOOM_TRUCK:k.NONE,three:k.TOUCH_TRUCK};const s=new ae.Vector2,i=new ae.Vector2,n=new ae.Vector2,r=R=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const y=this._domElement.getBoundingClientRect(),w=R.clientX/y.width,P=R.clientY/y.height;if(wthis._interactiveArea.right||Pthis._interactiveArea.bottom)return}const S=R.pointerType!=="mouse"?null:(R.buttons&le.LEFT)===le.LEFT?le.LEFT:(R.buttons&le.MIDDLE)===le.MIDDLE?le.MIDDLE:(R.buttons&le.RIGHT)===le.RIGHT?le.RIGHT:null;if(S!==null){const y=this._findPointerByMouseButton(S);y&&this._disposePointer(y)}if((R.buttons&le.LEFT)===le.LEFT&&this._lockedPointer)return;const L={pointerId:R.pointerId,clientX:R.clientX,clientY:R.clientY,deltaX:0,deltaY:0,mouseButton:S};this._activePointers.push(L),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,E(R)},o=R=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const y=this._domElement.getBoundingClientRect(),w=R.clientX/y.width,P=R.clientY/y.height;if(wthis._interactiveArea.right||Pthis._interactiveArea.bottom)return}const S=(R.buttons&le.LEFT)===le.LEFT?le.LEFT:(R.buttons&le.MIDDLE)===le.MIDDLE?le.MIDDLE:(R.buttons&le.RIGHT)===le.RIGHT?le.RIGHT:null;if(S!==null){const y=this._findPointerByMouseButton(S);y&&this._disposePointer(y)}const L={pointerId:1,clientX:R.clientX,clientY:R.clientY,deltaX:0,deltaY:0,mouseButton:(R.buttons&le.LEFT)===le.LEFT?le.LEFT:(R.buttons&le.MIDDLE)===le.LEFT?le.MIDDLE:(R.buttons&le.RIGHT)===le.LEFT?le.RIGHT:null};this._activePointers.push(L),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,E(R)},a=R=>{R.cancelable&&R.preventDefault();const S=R.pointerId,L=this._lockedPointer||this._findPointerById(S);if(L){if(L.clientX=R.clientX,L.clientY=R.clientY,L.deltaX=R.movementX,L.deltaY=R.movementY,this._state=0,R.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(R.buttons&le.LEFT)===le.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(R.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(R.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right);C()}},c=R=>{const S=this._lockedPointer||this._findPointerById(1);S&&(S.clientX=R.clientX,S.clientY=R.clientY,S.deltaX=R.movementX,S.deltaY=R.movementY,this._state=0,(this._lockedPointer||(R.buttons&le.LEFT)===le.LEFT)&&(this._state=this._state|this.mouseButtons.left),(R.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(R.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right),C())},h=R=>{const S=this._findPointerById(R.pointerId);if(!(S&&S===this._lockedPointer)){if(S&&this._disposePointer(S),R.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=k.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=k.NONE;T()}},d=()=>{const R=this._findPointerById(1);R&&R===this._lockedPointer||(R&&this._disposePointer(R),this._state=k.NONE,T())};let I=-1;const u=R=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===k.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const P=this._domElement.getBoundingClientRect(),M=R.clientX/P.width,B=R.clientY/P.height;if(Mthis._interactiveArea.right||Bthis._interactiveArea.bottom)return}if(R.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===k.ROTATE||this.mouseButtons.wheel===k.TRUCK){const P=performance.now();I-P<1e3&&this._getClientRect(this._elementRect),I=P}const S=Mc?-1:-3,L=R.deltaMode===1?R.deltaY/S:R.deltaY/(S*10),y=this.dollyToCursor?(R.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(R.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case k.ROTATE:{this._rotateInternal(R.deltaX,R.deltaY),this._isUserControllingRotate=!0;break}case k.TRUCK:{this._truckInternal(R.deltaX,R.deltaY,!1),this._isUserControllingTruck=!0;break}case k.OFFSET:{this._truckInternal(R.deltaX,R.deltaY,!0),this._isUserControllingOffset=!0;break}case k.DOLLY:{this._dollyInternal(-L,y,w),this._isUserControllingDolly=!0;break}case k.ZOOM:{this._zoomInternal(-L,y,w),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},f=R=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ue.ACTION.NONE){const S=R instanceof PointerEvent?R.pointerId:0,L=this._findPointerById(S);L&&this._disposePointer(L),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}R.preventDefault()}},E=R=>{if(this._enabled){if(Ki(this._activePointers,Ge),this._getClientRect(this._elementRect),s.copy(Ge),i.copy(Ge),this._activePointers.length>=2){const S=Ge.x-this._activePointers[1].clientX,L=Ge.y-this._activePointers[1].clientY,y=Math.sqrt(S*S+L*L);n.set(0,y);const w=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,P=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(w,P)}if(this._state=0,!R)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in R&&R.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(R.buttons&le.LEFT)===le.LEFT&&(this._state=this._state|this.mouseButtons.left),(R.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(R.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&k.ROTATE)===k.ROTATE||(this._state&k.TOUCH_ROTATE)===k.TOUCH_ROTATE||(this._state&k.TOUCH_DOLLY_ROTATE)===k.TOUCH_DOLLY_ROTATE||(this._state&k.TOUCH_ZOOM_ROTATE)===k.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&k.TRUCK)===k.TRUCK||(this._state&k.TOUCH_TRUCK)===k.TOUCH_TRUCK||(this._state&k.TOUCH_DOLLY_TRUCK)===k.TOUCH_DOLLY_TRUCK||(this._state&k.TOUCH_ZOOM_TRUCK)===k.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&k.DOLLY)===k.DOLLY||(this._state&k.TOUCH_DOLLY)===k.TOUCH_DOLLY||(this._state&k.TOUCH_DOLLY_TRUCK)===k.TOUCH_DOLLY_TRUCK||(this._state&k.TOUCH_DOLLY_OFFSET)===k.TOUCH_DOLLY_OFFSET||(this._state&k.TOUCH_DOLLY_ROTATE)===k.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&k.ZOOM)===k.ZOOM||(this._state&k.TOUCH_ZOOM)===k.TOUCH_ZOOM||(this._state&k.TOUCH_ZOOM_TRUCK)===k.TOUCH_ZOOM_TRUCK||(this._state&k.TOUCH_ZOOM_OFFSET)===k.TOUCH_ZOOM_OFFSET||(this._state&k.TOUCH_ZOOM_ROTATE)===k.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&k.OFFSET)===k.OFFSET||(this._state&k.TOUCH_OFFSET)===k.TOUCH_OFFSET||(this._state&k.TOUCH_DOLLY_OFFSET)===k.TOUCH_DOLLY_OFFSET||(this._state&k.TOUCH_ZOOM_OFFSET)===k.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},C=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Ki(this._activePointers,Ge);const R=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,S=R?-R.deltaX:i.x-Ge.x,L=R?-R.deltaY:i.y-Ge.y;if(i.copy(Ge),((this._state&k.ROTATE)===k.ROTATE||(this._state&k.TOUCH_ROTATE)===k.TOUCH_ROTATE||(this._state&k.TOUCH_DOLLY_ROTATE)===k.TOUCH_DOLLY_ROTATE||(this._state&k.TOUCH_ZOOM_ROTATE)===k.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(S,L),this._isUserControllingRotate=!0),(this._state&k.DOLLY)===k.DOLLY||(this._state&k.ZOOM)===k.ZOOM){const y=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,P=this.dollyDragInverted?-1:1;(this._state&k.DOLLY)===k.DOLLY?(this._dollyInternal(P*L*ci,y,w),this._isUserControllingDolly=!0):(this._zoomInternal(P*L*ci,y,w),this._isUserControllingZoom=!0)}if((this._state&k.TOUCH_DOLLY)===k.TOUCH_DOLLY||(this._state&k.TOUCH_ZOOM)===k.TOUCH_ZOOM||(this._state&k.TOUCH_DOLLY_TRUCK)===k.TOUCH_DOLLY_TRUCK||(this._state&k.TOUCH_ZOOM_TRUCK)===k.TOUCH_ZOOM_TRUCK||(this._state&k.TOUCH_DOLLY_OFFSET)===k.TOUCH_DOLLY_OFFSET||(this._state&k.TOUCH_ZOOM_OFFSET)===k.TOUCH_ZOOM_OFFSET||(this._state&k.TOUCH_DOLLY_ROTATE)===k.TOUCH_DOLLY_ROTATE||(this._state&k.TOUCH_ZOOM_ROTATE)===k.TOUCH_ZOOM_ROTATE){const y=Ge.x-this._activePointers[1].clientX,w=Ge.y-this._activePointers[1].clientY,P=Math.sqrt(y*y+w*w),M=n.y-P;n.set(0,P);const B=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&k.TOUCH_DOLLY)===k.TOUCH_DOLLY||(this._state&k.TOUCH_DOLLY_ROTATE)===k.TOUCH_DOLLY_ROTATE||(this._state&k.TOUCH_DOLLY_TRUCK)===k.TOUCH_DOLLY_TRUCK||(this._state&k.TOUCH_DOLLY_OFFSET)===k.TOUCH_DOLLY_OFFSET?(this._dollyInternal(M*ci,B,O),this._isUserControllingDolly=!0):(this._zoomInternal(M*ci,B,O),this._isUserControllingZoom=!0)}((this._state&k.TRUCK)===k.TRUCK||(this._state&k.TOUCH_TRUCK)===k.TOUCH_TRUCK||(this._state&k.TOUCH_DOLLY_TRUCK)===k.TOUCH_DOLLY_TRUCK||(this._state&k.TOUCH_ZOOM_TRUCK)===k.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(S,L,!1),this._isUserControllingTruck=!0),((this._state&k.OFFSET)===k.OFFSET||(this._state&k.TOUCH_OFFSET)===k.TOUCH_OFFSET||(this._state&k.TOUCH_DOLLY_OFFSET)===k.TOUCH_DOLLY_OFFSET||(this._state&k.TOUCH_ZOOM_OFFSET)===k.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(S,L,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},T=()=>{Ki(this._activePointers,Ge),i.copy(Ge),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",m),this._domElement.ownerDocument.addEventListener("pointerlockerror",A),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),E())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",m),this._domElement.ownerDocument.removeEventListener("pointerlockerror",A))};const m=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},A=()=>{this.unlockPointer()};this._addAllEventListeners=R=>{this._domElement=R,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),Dc&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",f)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",f),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",m),this._domElement.ownerDocument.removeEventListener("pointerlockerror",A))},this.cancel=()=>{this._state!==k.NONE&&(this._state=k.NONE,this._activePointers.length=0,T())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=et(e.width,0,1),this._interactiveArea.height=et(e.height,0,1),this._interactiveArea.x=et(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=et(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const i=et(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=et(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const r=!s||fe(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&fe(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=ts.NONE,this._changedDolly=0,this._dollyToNoClamp(et(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),r=fe(n,this._spherical.radius);if(!(s>e)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,n)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const i=!t||fe(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ls).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||fe(this._target.x,this._targetEnd.x,this.restThreshold)&&fe(this._target.y,this._targetEnd.y,this.restThreshold)&&fe(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=et(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||fe(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),at.setFromMatrixColumn(this._camera.matrix,0),lt.setFromMatrixColumn(this._camera.matrix,1),at.multiplyScalar(e),lt.multiplyScalar(-t);const i=ce.copy(at).add(lt),n=Ie.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,s)}forward(e,t=!1){ce.setFromMatrixColumn(this._camera.matrix,0),ce.crossVectors(this._camera.up,ce),ce.multiplyScalar(e);const s=Ie.copy(this._targetEnd).add(ce);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return ce.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ce.x,this._targetEnd.y+ce.y,this._targetEnd.z+ce.z,t)}moveTo(e,t,s,i=!1){this._isUserControllingTruck=!1;const n=ce.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const r=!i||fe(this._target.x,this._targetEnd.x,this.restThreshold)&&fe(this._target.y,this._targetEnd.y,this.restThreshold)&&fe(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(e,t,s,i=!1){const n=ce.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(n.x,n.y,n.z,i)}fitToBox(e,t,{cover:s=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const a=[],c=e.isBox3?ns.copy(e):ns.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=Ur(this._sphericalEnd.theta,br),d=Ur(this._sphericalEnd.phi,br);a.push(this.rotateTo(h,d,t));const I=ce.setFromSpherical(this._sphericalEnd).normalize(),u=zr.setFromUnitVectors(I,en),f=fe(Math.abs(I.y),1);f&&u.multiply(sn.setFromAxisAngle(hi,h)),u.multiply(this._yAxisUpSpaceInverse);const E=Gr.makeEmpty();Ie.copy(c.min).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.min).setX(c.max.x).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.min).setY(c.max.y).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.max).setZ(c.min.z).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.min).setZ(c.max.z).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.max).setY(c.min.y).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.max).setX(c.min.x).applyQuaternion(u),E.expandByPoint(Ie),Ie.copy(c.max).applyQuaternion(u),E.expandByPoint(Ie),E.min.x-=i,E.min.y-=r,E.max.x+=n,E.max.y+=o,u.setFromUnitVectors(en,I),f&&u.premultiply(sn.invert()),u.premultiply(this._yAxisUpSpace);const C=E.getSize(ce),T=E.getCenter(Ie).applyQuaternion(u);if(Dt(this._camera)){const m=this.getDistanceToFitBox(C.x,C.y,C.z,s);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.dollyTo(m,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(yt(this._camera)){const m=this._camera,A=m.right-m.left,R=m.top-m.bottom,S=s?Math.max(A/C.x,R/C.y):Math.min(A/C.x,R/C.y);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.zoomTo(S,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const s=[],i=e instanceof ae.Sphere?tn.copy(e):Ue.createBoundingSphere(e,tn);if(s.push(this.moveTo(i.center.x,i.center.y,i.center.z,t)),Dt(this._camera)){const n=this.getDistanceToFitSphere(i.radius);s.push(this.dollyTo(n,t))}else if(yt(this._camera)){const n=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,o=2*i.radius,a=Math.min(n/o,r/o);s.push(this.zoomTo(a,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,i,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ts.NONE,this._changedDolly=0;const a=Ie.set(i,n,r),c=ce.set(e,t,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||fe(this._target.x,this._targetEnd.x,this.restThreshold)&&fe(this._target.y,this._targetEnd.y,this.restThreshold)&&fe(this._target.z,this._targetEnd.z,this.restThreshold)&&fe(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&fe(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&fe(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,s,i,n,r,o,a,c,h,d,I,u,f=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ts.NONE,this._changedDolly=0;const E=ce.set(i,n,r),C=Ie.set(e,t,s);je.setFromVector3(C.sub(E).applyQuaternion(this._yAxisUpSpace));const T=is.set(h,d,I),m=Ie.set(o,a,c);Ps.setFromVector3(m.sub(T).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(E.lerp(T,u));const A=Ps.theta-je.theta,R=Ps.phi-je.phi,S=Ps.radius-je.radius;this._sphericalEnd.set(je.radius+S*u,je.phi+R*u,je.theta+A*u),this.normalizeRotations(),this._needsUpdate=!0,f||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const L=!f||fe(this._target.x,this._targetEnd.x,this.restThreshold)&&fe(this._target.y,this._targetEnd.y,this.restThreshold)&&fe(this._target.z,this._targetEnd.z,this.restThreshold)&&fe(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&fe(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&fe(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(L)}setPosition(e,t,s,i=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,s,i=!1){const n=this.getPosition(ce),r=this.setLookAt(n.x,n.y,n.z,e,t,s,i);return this._sphericalEnd.phi=et(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}setFocalOffset(e,t,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||fe(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&fe(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&fe(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),at.setFromMatrixColumn(this._camera.matrixWorldInverse,0),lt.setFromMatrixColumn(this._camera.matrixWorldInverse,1),bt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=ce.set(e,t,s),n=i.distanceTo(this._camera.position),r=i.sub(this._camera.position);at.multiplyScalar(r.x),lt.multiplyScalar(r.y),bt.multiplyScalar(r.z),ce.copy(at).add(lt).add(bt),ce.z=ce.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ce.x,ce.y,-ce.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ae.Vector4,typeof e=="number"?this._viewport.set(e,t,s,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,i=!1){if(Ji(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,r=this._camera.getEffectiveFOV()*Os,o=this._camera.aspect;return((i?n>o:nt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const i=t.lengthSq();if(i===0)return e;const n=Ie.copy(t).add(e),r=this._boundary.clampPoint(n,is).sub(n),o=r.lengthSq();if(o===0)return e.add(t);if(o===i)return e;if(s===0)return e.add(t).add(r);{const a=1+s*o/t.dot(r);return e.add(Ie.copy(t).multiplyScalar(a)).add(r.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(Dt(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*Os,i=Math.tan(s*.5)*t,n=i*e.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(yt(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,i=e.right*t,n=e.top*t,r=e.bottom*t;this._nearPlaneCorners[0].set(s,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,r,0),this._nearPlaneCorners[3].set(s,r,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Ji(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(Ls);nn.lookAt(Br,t,this._camera.up);for(let s=0;s<4;s++){const i=Ie.copy(this._nearPlaneCorners[s]);i.applyMatrix4(nn);const n=is.addVectors(this._target,i);ui.set(n,t),ui.far=this._spherical.radius+1;const r=ui.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ae.Sphere){const s=t,i=s.center;ns.makeEmpty(),e.traverseVisible(r=>{r.isMesh&&ns.expandByObject(r)}),ns.getCenter(i);let n=0;return e.traverseVisible(r=>{if(!r.isMesh)return;const o=r,a=o.geometry.clone();a.applyMatrix4(o.matrixWorld);const c=a.attributes.position;for(let h=0,d=c.count;h{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof Gt){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:t,world:s})=>{if(t==="added"){const i=this.newCameraControls();this._allControls.set(s.uuid,i)}if(t==="removed"){const i=this._allControls.get(s.uuid);i&&(i.dispose(),this._allControls.delete(s.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(e){this.currentWorld!==null&&(this.controls.enabled=e)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new Pn(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new x(0,0,0)),t}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Ue.install({THREE:Vs.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Ue(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t.minDistance=6,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:wa,Vector2:He,Vector3:x,Vector4:va,Quaternion:st,Matrix4:Ee,Spherical:Ma,Box3:we,Sphere:Li,Raycaster:_n,MathUtils:wn}}}const yo=class Lo extends Ae{constructor(e){super(e),p(this,"onAfterUpdate",new $),p(this,"onBeforeUpdate",new $),p(this,"onDisposed",new $),p(this,"onWorldCreated",new $),p(this,"onWorldDeleted",new $),p(this,"list",new Map),p(this,"enabled",!0),e.add(Lo.uuid,this)}create(){const e=new Nc(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),this.onWorldCreated.trigger(e),e}delete(e){if(!this.list.has(e.uuid))throw new Error("The provided world is not found in the list!");const t=e.uuid;this.list.delete(e.uuid),e.dispose(),this.onWorldDeleted.trigger(t)}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,s]of this.list)s.update(e)}};p(yo,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let bc=yo;function Uc(l,e,t,s){return new Promise((i,n)=>{function r(){const o=l.clientWaitSync(e,t,0);if(o===l.WAIT_FAILED){n();return}if(o===l.TIMEOUT_EXPIRED){setTimeout(r,s);return}i()}r()})}async function xc(l,e,t,s,i,n,r){const o=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),await Uc(l,o,0,10),l.deleteSync(o),l.bindBuffer(e,t),l.getBufferSubData(e,s,i,n,r),l.bindBuffer(e,null)}async function Po(l,e,t,s,i,n,r,o){const a=l.createBuffer();return l.bindBuffer(l.PIXEL_PACK_BUFFER,a),l.bufferData(l.PIXEL_PACK_BUFFER,o.byteLength,l.STREAM_READ),l.readPixels(e,t,s,i,n,r,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await xc(l,l.PIXEL_PACK_BUFFER,a,0,o),l.deleteBuffer(a),o}class Bc extends kt{constructor(){super(...arguments),p(this,"_config",{enabled:{value:!0,type:"Boolean"},width:{type:"Number",interpolable:!0,value:512,min:32,max:1024},height:{type:"Number",interpolable:!0,value:512,min:32,max:1024},autoUpdate:{value:!0,type:"Boolean"},renderDebugFrame:{value:!1,type:"Boolean"},updateInterval:{type:"Number",interpolable:!0,value:1,min:0,max:1},threshold:{type:"Number",interpolable:!0,value:100,min:1,max:512}}),p(this,"_interval",null)}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get width(){return this._config.width.value}set width(e){this.setWidthHeight(e,this.height)}get height(){return this._config.height.value}set height(e){this.setWidthHeight(this.width,e)}get autoUpdate(){return this._config.autoUpdate.value}set autoUpdate(e){this.setAutoAndInterval(e,this.updateInterval)}get updateInterval(){return this._config.updateInterval.value}set updateInterval(e){this.setAutoAndInterval(this.autoUpdate,e)}get renderDebugFrame(){return this._config.renderDebugFrame.value}set renderDebugFrame(e){this._config.renderDebugFrame.value=e}get threshold(){return this._config.threshold.value}set threshold(e){this._config.threshold.value=e}setWidthHeight(e,t){if(e<=0||t<=0)throw new Error("The width and height of the culler renderer must be more than 0!");this._config.width.value=e,this._config.height.value=t,this.resetRenderTarget()}setAutoAndInterval(e,t){if(t<=0)throw new Error("The updateInterval of the culler renderer must be more than 0!");this._config.autoUpdate.value=e,this._config.updateInterval.value=t,this.resetInterval(e)}resetRenderTarget(){this._component.renderTarget.dispose(),this._component.renderTarget=new Si(this.width,this.height),this._component.bufferSize=this.width*this.height*4,this._component.buffer=new Uint8Array(this._component.bufferSize)}resetInterval(e){this._interval!==null&&window.clearInterval(this._interval),e&&(this._interval=window.setInterval(async()=>{this._component.preventUpdate||await this._component.updateVisibility()},this.updateInterval))}}class Yc{constructor(e,t){if(p(this,"onSetup",new $),p(this,"onDisposed",new $),p(this,"onViewUpdated",new mi),p(this,"enabled",!0),p(this,"needsUpdate",!1),p(this,"components"),p(this,"renderTarget",new Si),p(this,"bufferSize",1),p(this,"buffer",new Uint8Array),p(this,"preventUpdate",!1),p(this,"config"),p(this,"isSetup",!1),p(this,"world"),p(this,"renderer"),p(this,"_defaultConfig",{enabled:!0,height:512,width:512,updateInterval:1e3,autoUpdate:!0,renderDebugFrame:!1,threshold:100}),p(this,"worker"),p(this,"scene",new Pi),p(this,"_availableColor",1),p(this,"_isWorkerBusy",!1),p(this,"updateVisibility",async n=>{if(!this.enabled||!this.needsUpdate&&!n||this._isWorkerBusy)return;this._isWorkerBusy=!0;const r=this.world.camera.three;r.updateMatrix();const{width:o,height:a}=this.config;this.renderer.setSize(o,a),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,r);const c=this.renderer.getContext();await Po(c,0,0,o,a,c.RGBA,c.UNSIGNED_BYTE,this.buffer),this.renderer.setRenderTarget(null),this.config.renderDebugFrame&&this.renderer.render(this.scene,r),this.worker.postMessage({buffer:this.buffer}),this.needsUpdate=!1}),!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.config=new Bc(this,this.components,"Culler renderer"),this.components.get(ut).list.add(this.config),this.world=t,this.renderer=new xs,this.renderer.clippingPlanes=t.renderer.clippingPlanes;const s=` + addEventListener("message", (event) => { + const { buffer } = event.data; + const colors = new Map(); + for (let i = 0; i < buffer.length; i += 4) { + const r = buffer[i]; + const g = buffer[i + 1]; + const b = buffer[i + 2]; + const code = "" + r + "-" + g + "-" + b; + if(colors.has(code)) { + colors.set(code, colors.get(code) + 1); + } else { + colors.set(code, 1); + } + } + postMessage({ colors }); + }); + `,i=new Blob([s],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(i)),this.setup()}dispose(){this.enabled=!1,this.config.autoUpdate=!1,this.components.get(ut).list.delete(this.config);for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this.buffer=null,this.onDisposed.reset()}setup(e){const t={...this._defaultConfig,...e},{width:s,height:i}=t;this.config.setWidthHeight(s,i);const{updateInterval:n,autoUpdate:r}=t;this.config.setAutoAndInterval(r,n),this.config.threshold=t.threshold,this.isSetup=!0,this.onSetup.trigger()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[s,i,n]=t,r=`${s}-${i}-${n}`;return{r:s,g:i,b:n,code:r}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}}class Vc extends Yc{constructor(e,t){super(e,t),p(this,"onViewUpdated",new $),p(this,"colorMeshes",new Map),p(this,"_colorCodeMeshMap",new Map),p(this,"_meshIDColorCodeMap",new Map),p(this,"_currentVisibleMeshes",new Set),p(this,"_recentlyHiddenMeshes",new Set),p(this,"_transparentMat",new us({transparent:!0,opacity:0})),p(this,"handleWorkerMessage",async s=>{if(this.preventUpdate)return;const i=s.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[n,r]of i){if(r{for(const n of s)n.visible=!0;for(const n of i)n.visible=!1})}get threshold(){return this.config.threshold}set threshold(e){this.config.threshold=e}dispose(){super.dispose(),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const e=this.components.get(ds);for(const t in this.colorMeshes){const s=this.colorMeshes.get(t);s&&e.destroy(s,!0)}this.colorMeshes.clear()}add(e){if(!this.enabled)return;if(this.preventUpdate){console.log("Culler processing not finished yet.");return}this.preventUpdate=!0;const t=e instanceof Vt,{geometry:s,material:i}=e,{colorMaterial:n,code:r}=this.getAvailableMaterial();let o;if(Array.isArray(i)){let h=!0;const d=[];for(const I of i)Dr.isTransparent(I)?d.push(this._transparentMat):(h=!1,d.push(n));if(h){n.dispose(),this.preventUpdate=!1;return}o=d}else if(Dr.isTransparent(i)){n.dispose(),this.preventUpdate=!1;return}else o=n;this._colorCodeMeshMap.set(r,e),this._meshIDColorCodeMap.set(e.uuid,r);const a=t?e.count:1,c=new Vt(s,o,a);t?c.instanceMatrix=e.instanceMatrix:c.setMatrixAt(0,new Ee),e.visible=!1,e.updateWorldMatrix(!0,!1),c.applyMatrix4(e.matrixWorld),c.updateMatrix(),this.scene.add(c),this.colorMeshes.set(e.uuid,c),this.increaseColor(),this.preventUpdate=!1}remove(e){if(this.preventUpdate){console.log("Culler processing not finished yet.");return}this.preventUpdate=!0;const t=this.components.get(ds);this._currentVisibleMeshes.delete(e),this._recentlyHiddenMeshes.delete(e);const s=this.colorMeshes.get(e.uuid),i=this._meshIDColorCodeMap.get(e.uuid);if(!s||!i){this.preventUpdate=!1;return}this._colorCodeMeshMap.delete(i),this._meshIDColorCodeMap.delete(e.uuid),this.colorMeshes.delete(e.uuid),s.geometry=void 0,s.material=[],t.destroy(s,!0),this._recentlyHiddenMeshes.delete(e),this._currentVisibleMeshes.delete(e),this.preventUpdate=!1}updateInstanced(e){for(const t of e){const s=this.colorMeshes.get(t.uuid);s&&(s.count=t.count)}}getAvailableMaterial(){const{r:e,g:t,b:s,code:i}=this.getAvailableColor(),n=Bi.enabled;Bi.enabled=!1;const r=new ve(`rgb(${e}, ${t}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const o=this.world.renderer.clippingPlanes,a=new us({color:r,clippingPlanes:o,side:Gs});return Bi.enabled=n,{colorMaterial:a,code:i}}}const _o=class Tn extends Ae{constructor(e){super(e),p(this,"onDisposed",new $),p(this,"_enabled",!0),p(this,"list",new Map),e.add(Tn.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const[t,s]of this.list)s.enabled=e}create(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new Vc(this.components,e);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Tn.uuid),this.onDisposed.reset();for(const[e,t]of this.list)t.dispose();this.list.clear()}updateInstanced(e){for(const[,t]of this.list)t.updateInstanced(e)}};p(_o,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Gc=_o;class zc{constructor(e,t){if(p(this,"onDisposed",new $),p(this,"onDistanceComputed",new $),p(this,"excludedObjects",new Set),p(this,"enabled",!0),p(this,"renderDebugFrame",!1),p(this,"components"),p(this,"scene",new Pi),p(this,"camera",new Gt(-1,1,1,-1,0,1)),p(this,"depthMaterial"),p(this,"world"),p(this,"renderer"),p(this,"worker"),p(this,"_width",512),p(this,"_height",512),p(this,"_postQuad"),p(this,"tempRT"),p(this,"resultRT"),p(this,"bufferSize"),p(this,"_buffer"),p(this,"_isWorkerBusy",!1),p(this,"compute",async()=>{if(!this.enabled||this.world.isDisposing||this._isWorkerBusy)return;this._isWorkerBusy=!0,this.world.camera.three.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.tempRT);const o="visibilityBeforeDistanceCheck";for(const c of this.excludedObjects)c.userData[o]=c.visible,c.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const c of this.excludedObjects)c.userData[o]!==void 0&&(c.visible=c.userData[o]);this.depthMaterial.uniforms.tDiffuse.value=this.tempRT.texture,this.depthMaterial.uniforms.tDepth.value=this.tempRT.depthTexture,this.renderer.setRenderTarget(this.resultRT),this.renderer.render(this.scene,this.camera);const a=this.renderer.getContext();try{await Po(a,0,0,this._width,this._height,a.RGBA,a.UNSIGNED_BYTE,this._buffer)}catch{this.renderer.setRenderTarget(null),this._isWorkerBusy=!1;return}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})}),p(this,"handleWorkerMessage",o=>{if(!this.enabled||this.world.isDisposing)return;const a=o.data.colors;let c=Number.MAX_VALUE;for(const u of a)u!==0&&u + +varying vec2 vUv; +uniform sampler2D tDiffuse; +uniform sampler2D tDepth; +uniform float cameraNear; +uniform float cameraFar; + + +float readDepth( sampler2D depthSampler, vec2 coord ) { + float fragCoordZ = texture2D( depthSampler, coord ).x; + float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); + return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); +} + +void main() { + //vec3 diffuse = texture2D( tDiffuse, vUv ).rgb; + float depth = readDepth( tDepth, vUv ); + + gl_FragColor.rgb = 1.0 - vec3( depth ); + gl_FragColor.a = 1.0; +} + `,uniforms:{cameraNear:{value:s.near},cameraFar:{value:s.far},tDiffuse:{value:null},tDepth:{value:null}}});const i=new _i(2,2);this._postQuad=new se(i,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const n=` + addEventListener("message", (event) => { + const { buffer } = event.data; + const colors = new Set(); + for (let i = 0; i < buffer.length; i += 4) { + const r = buffer[i]; + colors.add(r); + } + postMessage({ colors }); + }); + `,r=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const e=[...this.scene.children];this.excludedObjects.clear();for(const t of e)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class Qu extends _c{constructor(){super(...arguments),p(this,"_distanceRenderer"),p(this,"autoBias",!0),p(this,"_defaultShadowConfig",{cascade:1,resolution:512}),p(this,"_lightsWithShadow",new Map),p(this,"_isComputingShadows",!1),p(this,"_shadowsEnabled",!0),p(this,"_bias",0),p(this,"recomputeShadows",e=>{if(!this._shadowsEnabled)return;if(this.autoBias&&(this.bias=e/-1e5),e*=1.5,!this.currentWorld)throw new Error("A world needs to be assigned to the scene before computing shadows!");if(!this._lightsWithShadow.size)throw new Error("No shadows found!");const t=this.currentWorld.camera.three;if(!(t instanceof Pn)&&!(t instanceof Gt))throw new Error("Invalid camera type!");const s=new x;t.getWorldDirection(s);let i=e;const n=new x;n.copy(this.config.directionalLight.position),n.normalize();for(const[r,o]of this._lightsWithShadow){const a=this.directionalLights.get(o);if(!a)throw new Error("Light not found.");const c=new x;c.copy(s);const h=r===this._lightsWithShadow.size-1,d=h?i/2:i*2/3;c.multiplyScalar(d),c.add(t.position);const I=i-d,u=new x;u.copy(n),u.multiplyScalar(I),a.target.position.copy(c),a.position.copy(c),a.position.add(u),a.shadow.camera.right=I,a.shadow.camera.left=-I,a.shadow.camera.top=I,a.shadow.camera.bottom=-I,a.shadow.camera.far=I*2,a.shadow.camera.updateProjectionMatrix(),a.shadow.camera.updateMatrix(),h||(i/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(e){this._bias=e;for(const[,t]of this._lightsWithShadow){const s=this.directionalLights.get(t);s&&(s.shadow.bias=e)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(e){this._shadowsEnabled=e;for(const[,t]of this.directionalLights)t.castShadow=e}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(e){super.setup(e);const t={...this._defaultConfig,...this._defaultShadowConfig,...e};if(t.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(t.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,s]of this.directionalLights)s.target.removeFromParent(),s.removeFromParent(),s.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new zc(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let s=0;s{this._event=t}),this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class Hc{constructor(e,t){p(this,"enabled",!0),p(this,"components"),p(this,"onDisposed",new $),p(this,"mouse"),p(this,"three",new _n),p(this,"world");const s=t.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new kc(s.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(e)}castRayFromVector(e,t,s=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(s)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),s=this.filterClippingPlanes(t);return s.length>0?s[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const s=t.clippingPlanes;return e.length<=0||!s||(s==null?void 0:s.length)<=0?e:e.filter(i=>s.every(n=>n.distanceToPoint(i.point)>0))}}const wo=class vo extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"list",new Map),p(this,"onDisposed",new $),e.add(vo.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new Hc(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}};p(wo,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let mn=wo;class Wc extends kt{constructor(){super(...arguments),p(this,"_config",{visible:{value:!0,type:"Boolean"},color:{value:new ve,type:"Color"},primarySize:{type:"Number",interpolable:!0,value:1,min:0,max:1e3},secondarySize:{type:"Number",interpolable:!0,value:10,min:0,max:1e3},distance:{type:"Number",interpolable:!0,value:500,min:0,max:500}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.uniforms.uColor.value=e,this._component.material.uniformsNeedUpdate=!0}get primarySize(){return this._config.primarySize.value}set primarySize(e){this._config.primarySize.value=e,this._component.material.uniforms.uSize1.value=e,this._component.material.uniformsNeedUpdate=!0}get secondarySize(){return this._config.secondarySize.value}set secondarySize(e){this._config.secondarySize.value=e,this._component.material.uniforms.uSize2.value=e,this._component.material.uniformsNeedUpdate=!0}get distance(){return this._config.distance.value}set distance(e){this._config.distance.value=e,this._component.material.uniforms.uDistance.value=e,this._component.material.uniformsNeedUpdate=!0}}class Xc{constructor(e,t){p(this,"onDisposed",new $),p(this,"onSetup",new $),p(this,"isSetup",!1),p(this,"world"),p(this,"components"),p(this,"config"),p(this,"_defaultConfig",{visible:!0,color:new ve(12303291),primarySize:1,secondarySize:10,distance:500}),p(this,"three"),p(this,"_fade",3),p(this,"updateZoom",()=>{this.world.camera instanceof Vs&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=t;const{color:s,primarySize:i,secondarySize:n,distance:r}=this._defaultConfig;this.components=e,this.config=new Wc(this,this.components,"Grid"),e.get(ut).list.add(this.config);const o=new _i(2,2,1,1),a=new ho({side:Gs,uniforms:{uSize1:{value:i},uSize2:{value:n},uColor:{value:s},uDistance:{value:r},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` + + varying vec3 worldPosition; + + uniform float uDistance; + + void main() { + + vec3 pos = position.xzy * uDistance; + pos.xz += cameraPosition.xz; + + worldPosition = pos; + + gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); + + } + `,fragmentShader:` + + varying vec3 worldPosition; + + uniform float uZoom; + uniform float uFade; + uniform float uSize1; + uniform float uSize2; + uniform vec3 uColor; + uniform float uDistance; + + + + float getGrid(float size) { + + vec2 r = worldPosition.xz / size; + + + vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r); + float line = min(grid.x, grid.y); + + + return 1.0 - min(line, 1.0); + } + + void main() { + + + float d = 1.0 - min(distance(cameraPosition.xz, worldPosition.xz) / uDistance, 1.0); + + float g1 = getGrid(uSize1); + float g2 = getGrid(uSize2); + + // Ortho camera fades the grid away when zooming out + float minZoom = step(0.2, uZoom); + float zoomFactor = pow(min(uZoom, 1.), 2.) * minZoom; + + gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, uFade)); + gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2) * zoomFactor; + + if ( gl_FragColor.a <= 0.0 ) discard; + + + } + + `,extensions:{derivatives:!0}});this.three=new se(o,a),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.color=t.color,this.config.primarySize=t.primarySize,this.config.secondarySize=t.secondarySize,this.config.distance=t.distance,this.isSetup=!0,this.onSetup.trigger()}dispose(){this.setupEvents(!1),this.components.get(ut).list.delete(this.config),this.components.get(ds).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Vs))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const Mo=class Do extends Ae{constructor(e){super(e),p(this,"list",new Map),p(this,"onDisposed",new $),p(this,"enabled",!0),e.add(Do.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new Xc(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};p(Mo,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Ku=Mo;const Ut=new _n,be=new x,Nt=new x,Se=new st,kr={X:new x(1,0,0),Y:new x(0,1,0),Z:new x(0,0,1)},rn={type:"change"},Hr={type:"mouseDown"},Wr={type:"mouseUp",mode:null},Xr={type:"objectChange"};class jc extends Oi{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const s=new Jc;this._gizmo=s,this.add(s);const i=new eh;this._plane=i,this.add(i);const n=this;function r(m,A){let R=A;Object.defineProperty(n,m,{get:function(){return R!==void 0?R:A},set:function(S){R!==S&&(R=S,i[m]=S,s[m]=S,n.dispatchEvent({type:m+"-changed",value:S}),n.dispatchEvent(rn))}}),n[m]=A,i[m]=A,s[m]=A}r("camera",e),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0);const o=new x,a=new x,c=new st,h=new st,d=new x,I=new st,u=new x,f=new x,E=new x,C=0,T=new x;r("worldPosition",o),r("worldPositionStart",a),r("worldQuaternion",c),r("worldQuaternionStart",h),r("cameraPosition",d),r("cameraQuaternion",I),r("pointStart",u),r("pointEnd",f),r("rotationAxis",E),r("rotationAngle",C),r("eye",T),this._offset=new x,this._startNorm=new x,this._endNorm=new x,this._cameraScale=new x,this._parentPosition=new x,this._parentQuaternion=new st,this._parentQuaternionInv=new st,this._parentScale=new x,this._worldScaleStart=new x,this._worldQuaternionInv=new st,this._worldScale=new x,this._positionStart=new x,this._quaternionStart=new st,this._scaleStart=new x,this._getPointer=Zc.bind(this),this._onPointerDown=qc.bind(this),this._onPointerHover=$c.bind(this),this._onPointerMove=Qc.bind(this),this._onPointerUp=Kc.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;Ut.setFromCamera(e,this.camera);const t=on(this._gizmo.picker[this.mode],Ut);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){Ut.setFromCamera(e,this.camera);const t=on(this._plane,Ut,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Hr.mode=this.mode,this.dispatchEvent(Hr)}}pointerMove(e){const t=this.axis,s=this.mode,i=this.object;let n=this.space;if(s==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),i===void 0||t===null||this.dragging===!1||e.button!==-1)return;Ut.setFromCamera(e,this.camera);const r=on(this._plane,Ut,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Se.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(be.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(be.setFromMatrixPosition(i.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),Nt.set(o,o,o)}else be.copy(this.pointStart),Nt.copy(this.pointEnd),be.applyQuaternion(this._worldQuaternionInv),Nt.applyQuaternion(this._worldQuaternionInv),Nt.divide(be),t.search("X")===-1&&(Nt.x=1),t.search("Y")===-1&&(Nt.y=1),t.search("Z")===-1&&(Nt.z=1);i.scale.copy(this._scaleStart).multiply(Nt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const o=20/this.worldPosition.distanceTo(be.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(be.copy(this.rotationAxis).cross(this.eye))*o):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(kr[t]),be.copy(kr[t]),n==="local"&&be.applyQuaternion(this.worldQuaternion),be.cross(this.eye),be.length()===0?a=!0:this.rotationAngle=this._offset.dot(be.normalize())*o),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Se.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Se.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(rn),this.dispatchEvent(Xr)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Wr.mode=this.mode,this.dispatchEvent(Wr)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(rn),this.dispatchEvent(Xr),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Ut}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Zc(l){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:l.button};{const e=this.domElement.getBoundingClientRect();return{x:(l.clientX-e.left)/e.width*2-1,y:-(l.clientY-e.top)/e.height*2+1,button:l.button}}}function $c(l){if(this.enabled)switch(l.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(l));break}}function qc(l){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(l.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(l)),this.pointerDown(this._getPointer(l)))}function Qc(l){this.enabled&&this.pointerMove(this._getPointer(l))}function Kc(l){this.enabled&&(this.domElement.releasePointerCapture(l.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(l)))}function on(l,e,t){const s=e.intersectObject(l,!0);for(let i=0;i.9&&(n.visible=!1)),this.axis==="Y"&&(Se.setFromEuler(di.set(0,0,Math.PI/2)),n.quaternion.copy(t).multiply(Se),Math.abs(Ce.copy(xt).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Se.setFromEuler(di.set(0,Math.PI/2,0)),n.quaternion.copy(t).multiply(Se),Math.abs(Ce.copy(bs).applyQuaternion(t).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Se.setFromEuler(di.set(0,Math.PI/2,0)),Ce.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(Zr.lookAt(jr,Ce,xt)),n.quaternion.multiply(Se),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),be.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),be.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(be),n.visible=this.dragging):(n.quaternion.copy(t),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(Ce.copy(Ds).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(Ce.copy(xt).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(Ce.copy(bs).applyQuaternion(t).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(Ce.copy(bs).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(Ce.copy(Ds).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(Ce.copy(xt).applyQuaternion(t).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(Ii.copy(t),Ce.copy(this.eye).applyQuaternion(Se.copy(t).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(Zr.lookAt(this.eye,jr,xt)),n.name==="X"&&(Se.setFromAxisAngle(Ds,Math.atan2(-Ce.y,Ce.z)),Se.multiplyQuaternions(Ii,Se),n.quaternion.copy(Se)),n.name==="Y"&&(Se.setFromAxisAngle(xt,Math.atan2(Ce.x,Ce.z)),Se.multiplyQuaternions(Ii,Se),n.quaternion.copy(Se)),n.name==="Z"&&(Se.setFromAxisAngle(bs,Math.atan2(Ce.y,Ce.x)),Se.multiplyQuaternions(Ii,Se),n.quaternion.copy(Se))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(o){return n.name===o}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(e)}}class eh extends se{constructor(){super(new _i(1e5,1e5,2,2),new us({visible:!1,wireframe:!0,side:Gs,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Ei.copy(Ds).applyQuaternion(t==="local"?this.worldQuaternion:gi),_s.copy(xt).applyQuaternion(t==="local"?this.worldQuaternion:gi),ws.copy(bs).applyQuaternion(t==="local"?this.worldQuaternion:gi),Ce.copy(_s),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ce.copy(this.eye).cross(Ei),ct.copy(Ei).cross(Ce);break;case"Y":Ce.copy(this.eye).cross(_s),ct.copy(_s).cross(Ce);break;case"Z":Ce.copy(this.eye).cross(ws),ct.copy(ws).cross(Ce);break;case"XY":ct.copy(ws);break;case"YZ":ct.copy(Ei);break;case"XZ":Ce.copy(ws),ct.copy(_s);break;case"XYZ":case"E":ct.set(0,0,0);break}break;case"rotate":default:ct.set(0,0,0)}ct.length()===0?this.quaternion.copy(this.cameraQuaternion):($r.lookAt(be.set(0,0,0),ct,Ce),this.quaternion.setFromRotationMatrix($r)),super.updateMatrixWorld(e)}}class er{constructor(e,t,s,i,n,r=5,o=!0){if(p(this,"onDraggingStarted",new $),p(this,"onDraggingEnded",new $),p(this,"onDisposed",new $),p(this,"normal"),p(this,"origin"),p(this,"three",new Is),p(this,"components"),p(this,"world"),p(this,"type","default"),p(this,"_helper"),p(this,"_visible",!0),p(this,"_enabled",!0),p(this,"_controlsActive",!1),p(this,"_arrowBoundBox",new se),p(this,"_planeMesh"),p(this,"_controls"),p(this,"_hiddenMaterial",new us({visible:!1})),p(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)}),p(this,"changeDrag",a=>{this._visible=!a.value,this.preventCameraMovement(),this.notifyDraggingChanged(a)}),this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=s,t.renderer.setPlane(!0,this.three),this._planeMesh=er.newPlaneMesh(r,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,s),o&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const e=new x(1,0,0),t=new x;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,s=new jc(e,t);return this.initializeControls(s),this.world.scene.three.add(s),s}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new xe(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new Oi;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const s=new _i(1),i=new se(s,t);return i.scale.set(e,e,e),i}}class th extends kt{constructor(){super(...arguments),p(this,"_config",{enabled:{value:!0,type:"Boolean"},visible:{value:!0,type:"Boolean"},color:{value:new ve,type:"Color"},opacity:{type:"Number",interpolable:!0,value:1,min:0,max:1},size:{type:"Number",interpolable:!0,value:2,min:0,max:100}})}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.color.copy(e)}get opacity(){return this._config.opacity.value}set opacity(e){this._config.opacity.value=e,this._component.material.opacity=e}get size(){return this._config.size.value}set size(e){this._config.size.value=e,this._component.size=e}}const bo=class Rn extends Ae{constructor(e){super(e),p(this,"onSetup",new $),p(this,"onBeforeDrag",new $),p(this,"onAfterDrag",new $),p(this,"onBeforeCreate",new $),p(this,"onBeforeCancel",new $),p(this,"onAfterCancel",new $),p(this,"onBeforeDelete",new $),p(this,"onAfterCreate",new $),p(this,"onAfterDelete",new $),p(this,"onDisposed",new $),p(this,"isSetup",!1),p(this,"orthogonalY",!1),p(this,"toleranceOrthogonalY",.7),p(this,"Type",er),p(this,"list",[]),p(this,"config",new th(this,this.components,"Clipper")),p(this,"_defaultConfig",{color:new ve(12255487),opacity:.2,size:2}),p(this,"_material",new us({color:12255487,side:Gs,transparent:!0,opacity:.2})),p(this,"_size",5),p(this,"_enabled",!1),p(this,"_visible",!0),p(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()}),p(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()}),this.components.add(Rn.uuid,this),e.get(ut).list.add(this.config)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const t of this.list)t.enabled=e;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get material(){return this._material}set material(e){this._material=e;for(const t of this.list)t.planeMaterial=e}get size(){return this._size}set size(e){this._size=e;for(const t of this.list)t.size=e}dispose(){this._enabled=!1,this.components.get(ut).list.delete(this.config);for(const e of this.list)e.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(Rn.uuid),this.onDisposed.reset()}create(e){const t=this.components.get(mn).get(e).castRay();return t?this.createPlaneFromIntersection(e,t):null}createFromNormalAndCoplanarPoint(e,t,s){const i=this.newPlane(e,s,t);return this.updateMaterialsAndPlanes(),i}delete(e,t){t||(t=this.pickPlane(e)),t&&this.deletePlane(t)}deleteAll(e){const t=[...this.list];for(const s of t)if(!e||e.has(s.type)){this.delete(s.world,s);const i=this.list.indexOf(s);i!==-1&&this.list.splice(i,1)}}setup(e){const t={...this._defaultConfig,...e};this.config.color=t.color,this.config.opacity=t.opacity,this.config.size=t.size,this.isSetup=!0,this.onSetup.trigger()}deletePlane(e){const t=this.list.indexOf(e);if(t!==-1){if(this.list.splice(t,1),!e.world.renderer)throw new Error("Renderer not found for this plane's world!");e.world.renderer.setPlane(!1,e.three),e.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(e)}}pickPlane(e){const t=this.components.get(mn).get(e),s=this.getAllPlaneMeshes(),i=t.castRay(s);if(i){const n=i.object;return this.list.find(r=>r.meshes.includes(n))}}getAllPlaneMeshes(){const e=[];for(const t of this.list)e.push(...t.meshes);return e}createPlaneFromIntersection(e,t){var s;if(!e.renderer)throw new Error("The given world must have a renderer!");const i=t.point.distanceTo(new x(0,0,0)),n=(s=t.face)==null?void 0:s.normal;if(!i||!n)return null;const r=this.getWorldNormal(t,n),o=this.newPlane(e,t.point,r.negate());return o.visible=this._visible,o.size=this._size,e.renderer.setPlane(!0,o.three),this.updateMaterialsAndPlanes(),o}getWorldNormal(e,t){const s=e.object;let i=e.object.matrixWorld.clone();if(s instanceof Vt&&e.instanceId!==void 0){const o=new Ee;s.getMatrixAt(e.instanceId,o),i=o.multiply(i)}const n=new Bt().getNormalMatrix(i),r=t.clone().applyMatrix3(n).normalize();return this.normalizePlaneDirectionY(r),r}normalizePlaneDirectionY(e){this.orthogonalY&&(e.y>this.toleranceOrthogonalY&&(e.x=0,e.y=1,e.z=0),e.y<-this.toleranceOrthogonalY&&(e.x=0,e.y=-1,e.z=0))}newPlane(e,t,s){const i=new this.Type(this.components,e,t,s,this._material);return i.onDraggingStarted.add(this._onStartDragging),i.onDraggingEnded.add(this._onEndDragging),this.list.push(i),this.onAfterCreate.trigger(i),i}updateMaterialsAndPlanes(){const e=this.components.get(bc);for(const[t,s]of e.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:i}=s.renderer;for(const n of s.meshes)if(n.material)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=i;else n.material.clippingPlanes=i}}};p(bo,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let sh=bo;class ih{constructor(e){p(this,"enabled",!1),p(this,"id","FirstPerson"),this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new x;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=Ue.ACTION.DOLLY,e.touches.two=Ue.ACTION.TOUCH_ZOOM_TRUCK}}class nh{constructor(e){p(this,"enabled",!0),p(this,"id","Orbit"),this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new x;e.getPosition(t);const s=t.length();e.distance=s,e.truckSpeed=2;const{rotation:i}=this.camera.three,n=new x(0,0,-1).applyEuler(i),r=t.addScaledVector(n,s);e.moveTo(r.x,r.y,r.z)}}class rh{constructor(e){p(this,"enabled",!1),p(this,"id","Plan"),p(this,"mouseAction1"),p(this,"mouseAction2"),p(this,"mouseInitialized",!1),p(this,"defaultAzimuthSpeed"),p(this,"defaultPolarSpeed"),this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=Ue.ACTION.TRUCK,t.touches.one=Ue.ACTION.TOUCH_TRUCK,t.touches.two=Ue.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Ue.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class oh{constructor(e){p(this,"onChanged",new $),p(this,"current","Perspective"),p(this,"camera"),p(this,"matchOrthoDistanceEnabled",!1),p(this,"_component"),p(this,"_previousDistance",-1),this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const e=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(e)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const e=this.getPerspectiveDims();if(!e)return;const{width:t,height:s}=e;this.setupOrthoCamera(s,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new x;this._component.threePersp.getWorldDirection(t);const s=new x;this._component.controls.getTarget(s);const i=s.clone().sub(this._component.threePersp.position).dot(t),n=e.renderer.getSize(),r=n.x/n.y,o=this._component.threePersp,a=i*2*Math.atan(o.fov*(Math.PI/180)/2);return{width:a*r,height:a}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Ue.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Ue.ACTION.ZOOM;const s=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=e/2,i.bottom=e/-2,i.updateProjectionMatrix(),i.position.copy(s.position),i.quaternion.copy(s.quaternion),this._component.controls.camera=i}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=Ue.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Ue.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=Ue.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class ah extends Vs{constructor(e){super(e),p(this,"projection"),p(this,"threeOrtho"),p(this,"threePersp"),p(this,"_userInputButtons",{}),p(this,"_frustumSize",50),p(this,"_navigationModes",new Map),p(this,"_mode",null),p(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new oh(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(t=>{this.three=t,this.updateAspect()}),this.onWorldChanged.add(({action:t})=>{t==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new nh(this)),this._navigationModes.set("FirstPerson",new ih(this)),this._navigationModes.set("Plan",new rh(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(e){if(this.mode!==null&&this.mode.id!==e){if(this.mode.set(!1),!this._navigationModes.has(e))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(e),this.mode.set(!0)}}async fit(e,t=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,i=Number.MIN_VALUE,n=new x(s,s,s),r=new x(i,i,i);for(const I of e){const u=new we().setFromObject(I);u.min.xr.x&&(r.x=u.max.x),u.max.y>r.y&&(r.y=u.max.y),u.max.z>r.z&&(r.z=u.max.z)}const o=new we(n,r),a=new x;o.getSize(a);const c=new x;o.getCenter(c);const h=Math.max(a.x,a.y,a.z)*t,d=new Li(c,h);await this.controls.fitToSphere(d,!0)}setUserInput(e){e?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const e=window.innerWidth/window.innerHeight;return new Gt(this._frustumSize*e/-2,this._frustumSize*e/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const e=this.currentWorld.renderer.getSize(),t=this.threeOrtho.top,s=this.threeOrtho.right,i=e.y/this.previousSize.y,n=e.x/this.previousSize.x,r=t*i,o=s*n;this.threeOrtho.left=-o,this.threeOrtho.right=o,this.threeOrtho.top=r,this.threeOrtho.bottom=-r,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(e)}}const qr=new Map([[wi,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[Mn,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[Dn,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[bn,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[zs,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Un,{forRelated:"IsTypedBy",forRelating:"Types"}],[xn,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[vi,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[Bn,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[Yn,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[Vn,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[Gn,{forRelated:"HasContext",forRelating:"Declares"}],[zn,{forRelated:"HasAssignments",forRelating:"Controls"}],[kn,{forRelated:"Nests",forRelating:"IsNestedBy"}],[Hn,{forRelated:"HasAssociations",forRelating:"DocumentRefForObjects"}]]),yi={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class cs{static async getUnits(e){var t,s,i;const{IFCUNITASSIGNMENT:n}=Ke,r=await e.getAllPropertiesOfType(n);if(!r)return 1;const o=Object.keys(r),a=r[parseInt(o[0],10)];for(const c of a.Units){if(c.value===void 0||c.value===null)continue;const h=await e.getProperties(c.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let d=1,I=1;return h.Name.value==="METRE"&&(I=1),h.Name.value==="FOOT"&&(I=.3048),((t=h.Prefix)==null?void 0:t.value)==="MILLI"?d=.001:((s=h.Prefix)==null?void 0:s.value)==="CENTI"?d=.01:((i=h.Prefix)==null?void 0:i.value)==="DECI"&&(d=.1),I*d}return 1}static async findItemByGuid(e,t){var s;const i=e.getAllPropertiesIDs();for(const n of i){const r=await e.getProperties(n);if(r&&((s=r.GlobalId)==null?void 0:s.value)===t)return r}return null}static async getRelationMap(e,t,s){var i;const n=s??(async()=>{}),r={},o=e.getAllPropertiesIDs();for(const a of o){const c=await e.getProperties(a);if(!c)continue;const h=c.type===t,d=Object.keys(c).find(C=>C.startsWith("Relating")),I=Object.keys(c).find(C=>C.startsWith("Related"));if(!(h&&d&&I))continue;const u=await e.getProperties((i=c[d])==null?void 0:i.value),f=c[I];if(!u||!f||!(f&&Array.isArray(f)))continue;const E=f.map(C=>C.value);await n(u.expressID,E),r[u.expressID]=E}return r}static async getQsetQuantities(e,t,s){const i=s??(()=>{}),n=await e.getProperties(t);return!n||n.type!==Ci?null:(n.Quantities??[{}]).map(r=>(r.value&&i(r.value),r.value)).filter(r=>r!==null)}static async getPsetProps(e,t,s){const i=s??(()=>{}),n=await e.getProperties(t);return!n||n.type!==ls?null:(n.HasProperties??[{}]).map(r=>(r.value&&i(r.value),r.value)).filter(r=>r!==null)}static async getPsetRel(e,t){var s;if(!await e.getProperties(t))return null;const i=await e.getAllPropertiesOfType(zs);if(!i)return null;const n=Object.values(i);let r=null;for(const o of n)((s=o.RelatingPropertyDefinition)==null?void 0:s.value)===t&&(r=o.expressID);return r}static async getQsetRel(e,t){return cs.getPsetRel(e,t)}static async getEntityName(e,t){var s;const i=await e.getProperties(t);if(!i)return{key:null,name:null};const n=Object.keys(i).find(o=>o.endsWith("Name"))??null,r=n?(s=i[n])==null?void 0:s.value:null;return{key:n,name:r}}static async getQuantityValue(e,t){const s=await e.getProperties(t);if(!s)return{key:null,value:null};const i=Object.keys(s).find(r=>r.endsWith("Value"))??null;let n;return i===null||s[i]===void 0||s[i]===null?n=null:n=s[i].value,{key:i,value:n}}static isRel(e){return yi[e].startsWith("IFCREL")}static async attributeExists(e,t,s){const i=await e.getProperties(t);return i?Object.keys(i).includes(s):!1}static async groupEntitiesByType(e,t){var s;const i=new Map;for(const n of t){const r=await e.getProperties(n);if(!r)continue;const o=r.type;i.get(o)||i.set(o,new Set),(s=i.get(o))==null||s.add(n)}return i}}const lh={IFCURIREFERENCE:"IfcUriReference",IFCTIME:"IfcTime",IFCTEMPERATURERATEOFCHANGEMEASURE:"IfcTemperatureRateOfChangeMeasure",IFCSOUNDPRESSURELEVELMEASURE:"IfcSoundPressureLevelMeasure",IFCSOUNDPOWERLEVELMEASURE:"IfcSoundPowerLevelMeasure",IFCPROPERTYSETDEFINITIONSET:"IfcPropertySetDefinitionSet",IFCPOSITIVEINTEGER:"IfcPositiveInteger",IFCNONNEGATIVELENGTHMEASURE:"IfcNonNegativeLengthMeasure",IFCLINEINDEX:"IfcLineIndex",IFCLANGUAGEID:"IfcLanguageId",IFCDURATION:"IfcDuration",IFCDAYINWEEKNUMBER:"IfcDayInWeekNumber",IFCDATETIME:"IfcDateTime",IFCDATE:"IfcDate",IFCCARDINALPOINTREFERENCE:"IfcCardinalPointReference",IFCBINARY:"IfcBinary",IFCAREADENSITYMEASURE:"IfcAreaDensityMeasure",IFCARCINDEX:"IfcArcIndex",IFCYEARNUMBER:"IfcYearNumber",IFCWARPINGMOMENTMEASURE:"IfcWarpingMomentMeasure",IFCWARPINGCONSTANTMEASURE:"IfcWarpingConstantMeasure",IFCVOLUMETRICFLOWRATEMEASURE:"IfcVolumetricFlowRateMeasure",IFCVOLUMEMEASURE:"IfcVolumeMeasure",IFCVAPORPERMEABILITYMEASURE:"IfcVaporPermeabilityMeasure",IFCTORQUEMEASURE:"IfcTorqueMeasure",IFCTIMESTAMP:"IfcTimestamp",IFCTIMEMEASURE:"IfcTimeMeasure",IFCTHERMODYNAMICTEMPERATUREMEASURE:"IfcThermodynamicTemperatureMeasure",IFCTHERMALTRANSMITTANCEMEASURE:"IfcThermalTransmittanceMeasure",IFCTHERMALRESISTANCEMEASURE:"IfcThermalResistanceMeasure",IFCTHERMALEXPANSIONCOEFFICIENTMEASURE:"IfcThermalExpansionCoefficientMeasure",IFCTHERMALCONDUCTIVITYMEASURE:"IfcThermalConductivityMeasure",IFCTHERMALADMITTANCEMEASURE:"IfcThermalAdmittanceMeasure",IFCTEXTTRANSFORMATION:"IfcTextTransformation",IFCTEXTFONTNAME:"IfcTextFontName",IFCTEXTDECORATION:"IfcTextDecoration",IFCTEXTALIGNMENT:"IfcTextAlignment",IFCTEXT:"IfcText",IFCTEMPERATUREGRADIENTMEASURE:"IfcTemperatureGradientMeasure",IFCSPECULARROUGHNESS:"IfcSpecularRoughness",IFCSPECULAREXPONENT:"IfcSpecularExponent",IFCSPECIFICHEATCAPACITYMEASURE:"IfcSpecificHeatCapacityMeasure",IFCSOUNDPRESSUREMEASURE:"IfcSoundPressureMeasure",IFCSOUNDPOWERMEASURE:"IfcSoundPowerMeasure",IFCSOLIDANGLEMEASURE:"IfcSolidAngleMeasure",IFCSHEARMODULUSMEASURE:"IfcShearModulusMeasure",IFCSECTIONALAREAINTEGRALMEASURE:"IfcSectionalAreaIntegralMeasure",IFCSECTIONMODULUSMEASURE:"IfcSectionModulusMeasure",IFCSECONDINMINUTE:"IfcSecondInMinute",IFCROTATIONALSTIFFNESSMEASURE:"IfcRotationalStiffnessMeasure",IFCROTATIONALMASSMEASURE:"IfcRotationalMassMeasure",IFCROTATIONALFREQUENCYMEASURE:"IfcRotationalFrequencyMeasure",IFCREAL:"IfcReal",IFCRATIOMEASURE:"IfcRatioMeasure",IFCRADIOACTIVITYMEASURE:"IfcRadioactivityMeasure",IFCPRESSUREMEASURE:"IfcPressureMeasure",IFCPRESENTABLETEXT:"IfcPresentableText",IFCPOWERMEASURE:"IfcPowerMeasure",IFCPOSITIVERATIOMEASURE:"IfcPositiveRatioMeasure",IFCPOSITIVEPLANEANGLEMEASURE:"IfcPositivePlaneAngleMeasure",IFCPOSITIVELENGTHMEASURE:"IfcPositiveLengthMeasure",IFCPLANEANGLEMEASURE:"IfcPlaneAngleMeasure",IFCPLANARFORCEMEASURE:"IfcPlanarForceMeasure",IFCPARAMETERVALUE:"IfcParameterValue",IFCPHMEASURE:"IfcPhMeasure",IFCNUMERICMEASURE:"IfcNumericMeasure",IFCNORMALISEDRATIOMEASURE:"IfcNormalisedRatioMeasure",IFCMONTHINYEARNUMBER:"IfcMonthInYearNumber",IFCMONETARYMEASURE:"IfcMonetaryMeasure",IFCMOMENTOFINERTIAMEASURE:"IfcMomentOfInertiaMeasure",IFCMOLECULARWEIGHTMEASURE:"IfcMolecularWeightMeasure",IFCMOISTUREDIFFUSIVITYMEASURE:"IfcMoistureDiffusivityMeasure",IFCMODULUSOFSUBGRADEREACTIONMEASURE:"IfcModulusOfSubgradeReactionMeasure",IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE:"IfcModulusOfRotationalSubgradeReactionMeasure",IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE:"IfcModulusOfLinearSubgradeReactionMeasure",IFCMODULUSOFELASTICITYMEASURE:"IfcModulusOfElasticityMeasure",IFCMINUTEINHOUR:"IfcMinuteInHour",IFCMASSPERLENGTHMEASURE:"IfcMassPerLengthMeasure",IFCMASSMEASURE:"IfcMassMeasure",IFCMASSFLOWRATEMEASURE:"IfcMassFlowRateMeasure",IFCMASSDENSITYMEASURE:"IfcMassDensityMeasure",IFCMAGNETICFLUXMEASURE:"IfcMagneticFluxMeasure",IFCMAGNETICFLUXDENSITYMEASURE:"IfcMagneticFluxDensityMeasure",IFCLUMINOUSINTENSITYMEASURE:"IfcLuminousIntensityMeasure",IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE:"IfcLuminousIntensityDistributionMeasure",IFCLUMINOUSFLUXMEASURE:"IfcLuminousFluxMeasure",IFCLOGICAL:"IfcLogical",IFCLINEARVELOCITYMEASURE:"IfcLinearVelocityMeasure",IFCLINEARSTIFFNESSMEASURE:"IfcLinearStiffnessMeasure",IFCLINEARMOMENTMEASURE:"IfcLinearMomentMeasure",IFCLINEARFORCEMEASURE:"IfcLinearForceMeasure",IFCLENGTHMEASURE:"IfcLengthMeasure",IFCLABEL:"IfcLabel",IFCKINEMATICVISCOSITYMEASURE:"IfcKinematicViscosityMeasure",IFCISOTHERMALMOISTURECAPACITYMEASURE:"IfcIsothermalMoistureCapacityMeasure",IFCIONCONCENTRATIONMEASURE:"IfcIonConcentrationMeasure",IFCINTEGERCOUNTRATEMEASURE:"IfcIntegerCountRateMeasure",IFCINTEGER:"IfcInteger",IFCINDUCTANCEMEASURE:"IfcInductanceMeasure",IFCILLUMINANCEMEASURE:"IfcIlluminanceMeasure",IFCIDENTIFIER:"IfcIdentifier",IFCHOURINDAY:"IfcHourInDay",IFCHEATINGVALUEMEASURE:"IfcHeatingValueMeasure",IFCHEATFLUXDENSITYMEASURE:"IfcHeatFluxDensityMeasure",IFCGLOBALLYUNIQUEID:"IfcGloballyUniqueId",IFCFREQUENCYMEASURE:"IfcFrequencyMeasure",IFCFORCEMEASURE:"IfcForceMeasure",IFCFONTWEIGHT:"IfcFontWeight",IFCFONTVARIANT:"IfcFontVariant",IFCFONTSTYLE:"IfcFontStyle",IFCENERGYMEASURE:"IfcEnergyMeasure",IFCELECTRICVOLTAGEMEASURE:"IfcElectricVoltageMeasure",IFCELECTRICRESISTANCEMEASURE:"IfcElectricResistanceMeasure",IFCELECTRICCURRENTMEASURE:"IfcElectricCurrentMeasure",IFCELECTRICCONDUCTANCEMEASURE:"IfcElectricConductanceMeasure",IFCELECTRICCHARGEMEASURE:"IfcElectricChargeMeasure",IFCELECTRICCAPACITANCEMEASURE:"IfcElectricCapacitanceMeasure",IFCDYNAMICVISCOSITYMEASURE:"IfcDynamicViscosityMeasure",IFCDOSEEQUIVALENTMEASURE:"IfcDoseEquivalentMeasure",IFCDIMENSIONCOUNT:"IfcDimensionCount",IFCDESCRIPTIVEMEASURE:"IfcDescriptiveMeasure",IFCDAYLIGHTSAVINGHOUR:"IfcDaylightSavingHour",IFCDAYINMONTHNUMBER:"IfcDayInMonthNumber",IFCCURVATUREMEASURE:"IfcCurvatureMeasure",IFCCOUNTMEASURE:"IfcCountMeasure",IFCCONTEXTDEPENDENTMEASURE:"IfcContextDependentMeasure",IFCCOMPOUNDPLANEANGLEMEASURE:"IfcCompoundPlaneAngleMeasure",IFCCOMPLEXNUMBER:"IfcComplexNumber",IFCBOXALIGNMENT:"IfcBoxAlignment",IFCBOOLEAN:"IfcBoolean",IFCAREAMEASURE:"IfcAreaMeasure",IFCANGULARVELOCITYMEASURE:"IfcAngularVelocityMeasure",IFCAMOUNTOFSUBSTANCEMEASURE:"IfcAmountOfSubstanceMeasure",IFCACCELERATIONMEASURE:"IfcAccelerationMeasure",IFCABSORBEDDOSEMEASURE:"IfcAbsorbedDoseMeasure",IFCGEOSLICE:"IfcGeoSlice",IFCGEOMODEL:"IfcGeoModel",IFCELECTRICFLOWTREATMENTDEVICE:"IfcElectricFlowTreatmentDevice",IFCDISTRIBUTIONBOARD:"IfcDistributionBoard",IFCCONVEYORSEGMENT:"IfcConveyorSegment",IFCCAISSONFOUNDATION:"IfcCaissonFoundation",IFCBOREHOLE:"IfcBorehole",IFCBEARING:"IfcBearing",IFCALIGNMENT:"IfcAlignment",IFCTRACKELEMENT:"IfcTrackElement",IFCSIGNAL:"IfcSignal",IFCREINFORCEDSOIL:"IfcReinforcedSoil",IFCRAIL:"IfcRail",IFCPAVEMENT:"IfcPavement",IFCNAVIGATIONELEMENT:"IfcNavigationElement",IFCMOORINGDEVICE:"IfcMooringDevice",IFCMOBILETELECOMMUNICATIONSAPPLIANCE:"IfcMobileTelecommunicationsAppliance",IFCLIQUIDTERMINAL:"IfcLiquidTerminal",IFCLINEARPOSITIONINGELEMENT:"IfcLinearPositioningElement",IFCKERB:"IfcKerb",IFCGEOTECHNICALASSEMBLY:"IfcGeotechnicalAssembly",IFCELECTRICFLOWTREATMENTDEVICETYPE:"IfcElectricFlowTreatmentDeviceType",IFCEARTHWORKSFILL:"IfcEarthworksFill",IFCEARTHWORKSELEMENT:"IfcEarthworksElement",IFCEARTHWORKSCUT:"IfcEarthworksCut",IFCDISTRIBUTIONBOARDTYPE:"IfcDistributionBoardType",IFCDEEPFOUNDATION:"IfcDeepFoundation",IFCCOURSE:"IfcCourse",IFCCONVEYORSEGMENTTYPE:"IfcConveyorSegmentType",IFCCAISSONFOUNDATIONTYPE:"IfcCaissonFoundationType",IFCBUILTSYSTEM:"IfcBuiltSystem",IFCBUILTELEMENT:"IfcBuiltElement",IFCBRIDGEPART:"IfcBridgePart",IFCBRIDGE:"IfcBridge",IFCBEARINGTYPE:"IfcBearingType",IFCALIGNMENTVERTICAL:"IfcAlignmentVertical",IFCALIGNMENTSEGMENT:"IfcAlignmentSegment",IFCALIGNMENTHORIZONTAL:"IfcAlignmentHorizontal",IFCALIGNMENTCANT:"IfcAlignmentCant",IFCVIBRATIONDAMPERTYPE:"IfcVibrationDamperType",IFCVIBRATIONDAMPER:"IfcVibrationDamper",IFCVEHICLE:"IfcVehicle",IFCTRANSPORTATIONDEVICE:"IfcTransportationDevice",IFCTRACKELEMENTTYPE:"IfcTrackElementType",IFCTENDONCONDUITTYPE:"IfcTendonConduitType",IFCTENDONCONDUIT:"IfcTendonConduit",IFCSINESPIRAL:"IfcSineSpiral",IFCSIGNALTYPE:"IfcSignalType",IFCSIGNTYPE:"IfcSignType",IFCSIGN:"IfcSign",IFCSEVENTHORDERPOLYNOMIALSPIRAL:"IfcSeventhOrderPolynomialSpiral",IFCSEGMENTEDREFERENCECURVE:"IfcSegmentedReferenceCurve",IFCSECONDORDERPOLYNOMIALSPIRAL:"IfcSecondOrderPolynomialSpiral",IFCROADPART:"IfcRoadPart",IFCROAD:"IfcRoad",IFCRELADHERESTOELEMENT:"IfcRelAdheresToElement",IFCREFERENT:"IfcReferent",IFCRAILWAYPART:"IfcRailwayPart",IFCRAILWAY:"IfcRailway",IFCRAILTYPE:"IfcRailType",IFCPOSITIONINGELEMENT:"IfcPositioningElement",IFCPAVEMENTTYPE:"IfcPavementType",IFCNAVIGATIONELEMENTTYPE:"IfcNavigationElementType",IFCMOORINGDEVICETYPE:"IfcMooringDeviceType",IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE:"IfcMobileTelecommunicationsApplianceType",IFCMARINEPART:"IfcMarinePart",IFCMARINEFACILITY:"IfcMarineFacility",IFCLIQUIDTERMINALTYPE:"IfcLiquidTerminalType",IFCLINEARELEMENT:"IfcLinearElement",IFCKERBTYPE:"IfcKerbType",IFCIMPACTPROTECTIONDEVICETYPE:"IfcImpactProtectionDeviceType",IFCIMPACTPROTECTIONDEVICE:"IfcImpactProtectionDevice",IFCGRADIENTCURVE:"IfcGradientCurve",IFCGEOTECHNICALSTRATUM:"IfcGeotechnicalStratum",IFCGEOTECHNICALELEMENT:"IfcGeotechnicalElement",IFCFACILITYPARTCOMMON:"IfcFacilityPartCommon",IFCFACILITYPART:"IfcFacilityPart",IFCFACILITY:"IfcFacility",IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID:"IfcDirectrixDerivedReferenceSweptAreaSolid",IFCDEEPFOUNDATIONTYPE:"IfcDeepFoundationType",IFCCOURSETYPE:"IfcCourseType",IFCCOSINESPIRAL:"IfcCosineSpiral",IFCCLOTHOID:"IfcClothoid",IFCBUILTELEMENTTYPE:"IfcBuiltElementType",IFCVEHICLETYPE:"IfcVehicleType",IFCTRIANGULATEDIRREGULARNETWORK:"IfcTriangulatedIrregularNetwork",IFCTRANSPORTATIONDEVICETYPE:"IfcTransportationDeviceType",IFCTHIRDORDERPOLYNOMIALSPIRAL:"IfcThirdOrderPolynomialSpiral",IFCSPIRAL:"IfcSpiral",IFCSECTIONEDSURFACE:"IfcSectionedSurface",IFCSECTIONEDSOLIDHORIZONTAL:"IfcSectionedSolidHorizontal",IFCSECTIONEDSOLID:"IfcSectionedSolid",IFCRELPOSITIONS:"IfcRelPositions",IFCRELASSOCIATESPROFILEDEF:"IfcRelAssociatesProfileDef",IFCPOLYNOMIALCURVE:"IfcPolynomialCurve",IFCOFFSETCURVEBYDISTANCES:"IfcOffsetCurveByDistances",IFCOFFSETCURVE:"IfcOffsetCurve",IFCINDEXEDPOLYGONALTEXTUREMAP:"IfcIndexedPolygonalTextureMap",IFCDIRECTRIXCURVESWEPTAREASOLID:"IfcDirectrixCurveSweptAreaSolid",IFCCURVESEGMENT:"IfcCurveSegment",IFCAXIS2PLACEMENTLINEAR:"IfcAxis2PlacementLinear",IFCSEGMENT:"IfcSegment",IFCPOINTBYDISTANCEEXPRESSION:"IfcPointByDistanceExpression",IFCOPENCROSSPROFILEDEF:"IfcOpenCrossProfileDef",IFCLINEARPLACEMENT:"IfcLinearPlacement",IFCALIGNMENTHORIZONTALSEGMENT:"IfcAlignmentHorizontalSegment",IFCALIGNMENTCANTSEGMENT:"IfcAlignmentCantSegment",IFCTEXTURECOORDINATEINDICESWITHVOIDS:"IfcTextureCoordinateIndicesWithVoids",IFCTEXTURECOORDINATEINDICES:"IfcTextureCoordinateIndices",IFCQUANTITYNUMBER:"IfcQuantityNumber",IFCALIGNMENTVERTICALSEGMENT:"IfcAlignmentVerticalSegment",IFCALIGNMENTPARAMETERSEGMENT:"IfcAlignmentParameterSegment",IFCCONTROLLER:"IfcController",IFCALARM:"IfcAlarm",IFCACTUATOR:"IfcActuator",IFCUNITARYCONTROLELEMENT:"IfcUnitaryControlElement",IFCSENSOR:"IfcSensor",IFCPROTECTIVEDEVICETRIPPINGUNIT:"IfcProtectiveDeviceTrippingUnit",IFCFLOWINSTRUMENT:"IfcFlowInstrument",IFCFIRESUPPRESSIONTERMINAL:"IfcFireSuppressionTerminal",IFCFILTER:"IfcFilter",IFCFAN:"IfcFan",IFCELECTRICTIMECONTROL:"IfcElectricTimeControl",IFCELECTRICMOTOR:"IfcElectricMotor",IFCELECTRICGENERATOR:"IfcElectricGenerator",IFCELECTRICFLOWSTORAGEDEVICE:"IfcElectricFlowStorageDevice",IFCELECTRICDISTRIBUTIONBOARD:"IfcElectricDistributionBoard",IFCELECTRICAPPLIANCE:"IfcElectricAppliance",IFCDUCTSILENCER:"IfcDuctSilencer",IFCDUCTSEGMENT:"IfcDuctSegment",IFCDUCTFITTING:"IfcDuctFitting",IFCDISTRIBUTIONCIRCUIT:"IfcDistributionCircuit",IFCDAMPER:"IfcDamper",IFCCOOLINGTOWER:"IfcCoolingTower",IFCCOOLEDBEAM:"IfcCooledBeam",IFCCONDENSER:"IfcCondenser",IFCCOMPRESSOR:"IfcCompressor",IFCCOMMUNICATIONSAPPLIANCE:"IfcCommunicationsAppliance",IFCCOIL:"IfcCoil",IFCCHILLER:"IfcChiller",IFCCABLESEGMENT:"IfcCableSegment",IFCCABLEFITTING:"IfcCableFitting",IFCCABLECARRIERSEGMENT:"IfcCableCarrierSegment",IFCCABLECARRIERFITTING:"IfcCableCarrierFitting",IFCBURNER:"IfcBurner",IFCBOILER:"IfcBoiler",IFCBEAMSTANDARDCASE:"IfcBeamStandardCase",IFCAUDIOVISUALAPPLIANCE:"IfcAudioVisualAppliance",IFCAIRTOAIRHEATRECOVERY:"IfcAirToAirHeatRecovery",IFCAIRTERMINALBOX:"IfcAirTerminalBox",IFCAIRTERMINAL:"IfcAirTerminal",IFCWINDOWSTANDARDCASE:"IfcWindowStandardCase",IFCWASTETERMINAL:"IfcWasteTerminal",IFCWALLELEMENTEDCASE:"IfcWallElementedCase",IFCVALVE:"IfcValve",IFCUNITARYEQUIPMENT:"IfcUnitaryEquipment",IFCUNITARYCONTROLELEMENTTYPE:"IfcUnitaryControlElementType",IFCTUBEBUNDLE:"IfcTubeBundle",IFCTRANSFORMER:"IfcTransformer",IFCTANK:"IfcTank",IFCSWITCHINGDEVICE:"IfcSwitchingDevice",IFCSTRUCTURALLOADCASE:"IfcStructuralLoadCase",IFCSTACKTERMINAL:"IfcStackTerminal",IFCSPACEHEATER:"IfcSpaceHeater",IFCSOLARDEVICE:"IfcSolarDevice",IFCSLABSTANDARDCASE:"IfcSlabStandardCase",IFCSLABELEMENTEDCASE:"IfcSlabElementedCase",IFCSHADINGDEVICE:"IfcShadingDevice",IFCSANITARYTERMINAL:"IfcSanitaryTerminal",IFCREINFORCINGBARTYPE:"IfcReinforcingBarType",IFCRATIONALBSPLINECURVEWITHKNOTS:"IfcRationalBSplineCurveWithKnots",IFCPUMP:"IfcPump",IFCPROTECTIVEDEVICETRIPPINGUNITTYPE:"IfcProtectiveDeviceTrippingUnitType",IFCPROTECTIVEDEVICE:"IfcProtectiveDevice",IFCPLATESTANDARDCASE:"IfcPlateStandardCase",IFCPIPESEGMENT:"IfcPipeSegment",IFCPIPEFITTING:"IfcPipeFitting",IFCOUTLET:"IfcOutlet",IFCOUTERBOUNDARYCURVE:"IfcOuterBoundaryCurve",IFCMOTORCONNECTION:"IfcMotorConnection",IFCMEMBERSTANDARDCASE:"IfcMemberStandardCase",IFCMEDICALDEVICE:"IfcMedicalDevice",IFCLIGHTFIXTURE:"IfcLightFixture",IFCLAMP:"IfcLamp",IFCJUNCTIONBOX:"IfcJunctionBox",IFCINTERCEPTOR:"IfcInterceptor",IFCHUMIDIFIER:"IfcHumidifier",IFCHEATEXCHANGER:"IfcHeatExchanger",IFCFLOWMETER:"IfcFlowMeter",IFCEXTERNALSPATIALELEMENT:"IfcExternalSpatialElement",IFCEVAPORATOR:"IfcEvaporator",IFCEVAPORATIVECOOLER:"IfcEvaporativeCooler",IFCENGINE:"IfcEngine",IFCELECTRICDISTRIBUTIONBOARDTYPE:"IfcElectricDistributionBoardType",IFCDOORSTANDARDCASE:"IfcDoorStandardCase",IFCDISTRIBUTIONSYSTEM:"IfcDistributionSystem",IFCCOMMUNICATIONSAPPLIANCETYPE:"IfcCommunicationsApplianceType",IFCCOLUMNSTANDARDCASE:"IfcColumnStandardCase",IFCCIVILELEMENT:"IfcCivilElement",IFCCHIMNEY:"IfcChimney",IFCCABLEFITTINGTYPE:"IfcCableFittingType",IFCBURNERTYPE:"IfcBurnerType",IFCBUILDINGSYSTEM:"IfcBuildingSystem",IFCBUILDINGELEMENTPARTTYPE:"IfcBuildingElementPartType",IFCBOUNDARYCURVE:"IfcBoundaryCurve",IFCBSPLINECURVEWITHKNOTS:"IfcBSplineCurveWithKnots",IFCAUDIOVISUALAPPLIANCETYPE:"IfcAudioVisualApplianceType",IFCWORKCALENDAR:"IfcWorkCalendar",IFCWINDOWTYPE:"IfcWindowType",IFCVOIDINGFEATURE:"IfcVoidingFeature",IFCVIBRATIONISOLATOR:"IfcVibrationIsolator",IFCTENDONTYPE:"IfcTendonType",IFCTENDONANCHORTYPE:"IfcTendonAnchorType",IFCSYSTEMFURNITUREELEMENT:"IfcSystemFurnitureElement",IFCSURFACEFEATURE:"IfcSurfaceFeature",IFCSTRUCTURALSURFACEACTION:"IfcStructuralSurfaceAction",IFCSTRUCTURALCURVEREACTION:"IfcStructuralCurveReaction",IFCSTRUCTURALCURVEACTION:"IfcStructuralCurveAction",IFCSTAIRTYPE:"IfcStairType",IFCSOLARDEVICETYPE:"IfcSolarDeviceType",IFCSHADINGDEVICETYPE:"IfcShadingDeviceType",IFCSEAMCURVE:"IfcSeamCurve",IFCROOFTYPE:"IfcRoofType",IFCREINFORCINGMESHTYPE:"IfcReinforcingMeshType",IFCREINFORCINGELEMENTTYPE:"IfcReinforcingElementType",IFCRATIONALBSPLINESURFACEWITHKNOTS:"IfcRationalBSplineSurfaceWithKnots",IFCRAMPTYPE:"IfcRampType",IFCPOLYGONALFACESET:"IfcPolygonalFaceSet",IFCPILETYPE:"IfcPileType",IFCOPENINGSTANDARDCASE:"IfcOpeningStandardCase",IFCMEDICALDEVICETYPE:"IfcMedicalDeviceType",IFCINTERSECTIONCURVE:"IfcIntersectionCurve",IFCINTERCEPTORTYPE:"IfcInterceptorType",IFCINDEXEDPOLYCURVE:"IfcIndexedPolyCurve",IFCGEOGRAPHICELEMENT:"IfcGeographicElement",IFCFURNITURE:"IfcFurniture",IFCFOOTINGTYPE:"IfcFootingType",IFCEXTERNALSPATIALSTRUCTUREELEMENT:"IfcExternalSpatialStructureElement",IFCEVENT:"IfcEvent",IFCENGINETYPE:"IfcEngineType",IFCELEMENTASSEMBLYTYPE:"IfcElementAssemblyType",IFCDOORTYPE:"IfcDoorType",IFCCYLINDRICALSURFACE:"IfcCylindricalSurface",IFCCONSTRUCTIONPRODUCTRESOURCETYPE:"IfcConstructionProductResourceType",IFCCONSTRUCTIONMATERIALRESOURCETYPE:"IfcConstructionMaterialResourceType",IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE:"IfcConstructionEquipmentResourceType",IFCCOMPOSITECURVEONSURFACE:"IfcCompositeCurveOnSurface",IFCCOMPLEXPROPERTYTEMPLATE:"IfcComplexPropertyTemplate",IFCCIVILELEMENTTYPE:"IfcCivilElementType",IFCCHIMNEYTYPE:"IfcChimneyType",IFCBSPLINESURFACEWITHKNOTS:"IfcBSplineSurfaceWithKnots",IFCBSPLINESURFACE:"IfcBSplineSurface",IFCADVANCEDBREPWITHVOIDS:"IfcAdvancedBrepWithVoids",IFCADVANCEDBREP:"IfcAdvancedBrep",IFCTRIANGULATEDFACESET:"IfcTriangulatedFaceSet",IFCTOROIDALSURFACE:"IfcToroidalSurface",IFCTESSELLATEDFACESET:"IfcTessellatedFaceSet",IFCTASKTYPE:"IfcTaskType",IFCSURFACECURVE:"IfcSurfaceCurve",IFCSUBCONTRACTRESOURCETYPE:"IfcSubContractResourceType",IFCSTRUCTURALSURFACEREACTION:"IfcStructuralSurfaceReaction",IFCSPHERICALSURFACE:"IfcSphericalSurface",IFCSPATIALZONETYPE:"IfcSpatialZoneType",IFCSPATIALZONE:"IfcSpatialZone",IFCSPATIALELEMENTTYPE:"IfcSpatialElementType",IFCSPATIALELEMENT:"IfcSpatialElement",IFCSIMPLEPROPERTYTEMPLATE:"IfcSimplePropertyTemplate",IFCREVOLVEDAREASOLIDTAPERED:"IfcRevolvedAreaSolidTapered",IFCREPARAMETRISEDCOMPOSITECURVESEGMENT:"IfcReparametrisedCompositeCurveSegment",IFCRELSPACEBOUNDARY2NDLEVEL:"IfcRelSpaceBoundary2ndLevel",IFCRELSPACEBOUNDARY1STLEVEL:"IfcRelSpaceBoundary1stLevel",IFCRELINTERFERESELEMENTS:"IfcRelInterferesElements",IFCRELDEFINESBYTEMPLATE:"IfcRelDefinesByTemplate",IFCRELDEFINESBYOBJECT:"IfcRelDefinesByObject",IFCRELDECLARES:"IfcRelDeclares",IFCRELASSIGNSTOGROUPBYFACTOR:"IfcRelAssignsToGroupByFactor",IFCPROPERTYTEMPLATE:"IfcPropertyTemplate",IFCPROPERTYSETTEMPLATE:"IfcPropertySetTemplate",IFCPROJECTLIBRARY:"IfcProjectLibrary",IFCPROCEDURETYPE:"IfcProcedureType",IFCPREDEFINEDPROPERTYSET:"IfcPredefinedPropertySet",IFCPCURVE:"IfcPCurve",IFCLABORRESOURCETYPE:"IfcLaborResourceType",IFCINDEXEDPOLYGONALFACEWITHVOIDS:"IfcIndexedPolygonalFaceWithVoids",IFCINDEXEDPOLYGONALFACE:"IfcIndexedPolygonalFace",IFCGEOGRAPHICELEMENTTYPE:"IfcGeographicElementType",IFCFIXEDREFERENCESWEPTAREASOLID:"IfcFixedReferenceSweptAreaSolid",IFCEXTRUDEDAREASOLIDTAPERED:"IfcExtrudedAreaSolidTapered",IFCEVENTTYPE:"IfcEventType",IFCCURVEBOUNDEDSURFACE:"IfcCurveBoundedSurface",IFCCREWRESOURCETYPE:"IfcCrewResourceType",IFCCONTEXT:"IfcContext",IFCCONSTRUCTIONRESOURCETYPE:"IfcConstructionResourceType",IFCCARTESIANPOINTLIST3D:"IfcCartesianPointList3D",IFCCARTESIANPOINTLIST2D:"IfcCartesianPointList2D",IFCCARTESIANPOINTLIST:"IfcCartesianPointList",IFCADVANCEDFACE:"IfcAdvancedFace",IFCTYPERESOURCE:"IfcTypeResource",IFCTYPEPROCESS:"IfcTypeProcess",IFCTESSELLATEDITEM:"IfcTessellatedItem",IFCSWEPTDISKSOLIDPOLYGONAL:"IfcSweptDiskSolidPolygonal",IFCRESOURCETIME:"IfcResourceTime",IFCRESOURCECONSTRAINTRELATIONSHIP:"IfcResourceConstraintRelationship",IFCRESOURCEAPPROVALRELATIONSHIP:"IfcResourceApprovalRelationship",IFCQUANTITYSET:"IfcQuantitySet",IFCPROPERTYTEMPLATEDEFINITION:"IfcPropertyTemplateDefinition",IFCPREDEFINEDPROPERTIES:"IfcPredefinedProperties",IFCMIRROREDPROFILEDEF:"IfcMirroredProfileDef",IFCMATERIALRELATIONSHIP:"IfcMaterialRelationship",IFCMATERIALPROFILESETUSAGETAPERING:"IfcMaterialProfileSetUsageTapering",IFCMATERIALPROFILESETUSAGE:"IfcMaterialProfileSetUsage",IFCMATERIALCONSTITUENTSET:"IfcMaterialConstituentSet",IFCMATERIALCONSTITUENT:"IfcMaterialConstituent",IFCLAGTIME:"IfcLagTime",IFCINDEXEDTRIANGLETEXTUREMAP:"IfcIndexedTriangleTextureMap",IFCINDEXEDTEXTUREMAP:"IfcIndexedTextureMap",IFCINDEXEDCOLOURMAP:"IfcIndexedColourMap",IFCEXTERNALREFERENCERELATIONSHIP:"IfcExternalReferenceRelationship",IFCEXTENDEDPROPERTIES:"IfcExtendedProperties",IFCEVENTTIME:"IfcEventTime",IFCCONVERSIONBASEDUNITWITHOFFSET:"IfcConversionBasedUnitWithOffset",IFCCOLOURRGBLIST:"IfcColourRgbList",IFCWORKTIME:"IfcWorkTime",IFCTIMEPERIOD:"IfcTimePeriod",IFCTEXTUREVERTEXLIST:"IfcTextureVertexList",IFCTASKTIMERECURRING:"IfcTaskTimeRecurring",IFCTASKTIME:"IfcTaskTime",IFCTABLECOLUMN:"IfcTableColumn",IFCSURFACEREINFORCEMENTAREA:"IfcSurfaceReinforcementArea",IFCSTRUCTURALLOADORRESULT:"IfcStructuralLoadOrResult",IFCSTRUCTURALLOADCONFIGURATION:"IfcStructuralLoadConfiguration",IFCSCHEDULINGTIME:"IfcSchedulingTime",IFCRESOURCELEVELRELATIONSHIP:"IfcResourceLevelRelationship",IFCREFERENCE:"IfcReference",IFCRECURRENCEPATTERN:"IfcRecurrencePattern",IFCPROPERTYABSTRACTION:"IfcPropertyAbstraction",IFCPROJECTEDCRS:"IfcProjectedCrs",IFCPRESENTATIONITEM:"IfcPresentationItem",IFCMATERIALUSAGEDEFINITION:"IfcMaterialUsageDefinition",IFCMATERIALPROFILEWITHOFFSETS:"IfcMaterialProfileWithOffsets",IFCMATERIALPROFILESET:"IfcMaterialProfileSet",IFCMATERIALPROFILE:"IfcMaterialProfile",IFCMATERIALLAYERWITHOFFSETS:"IfcMaterialLayerWithOffsets",IFCMATERIALDEFINITION:"IfcMaterialDefinition",IFCMAPCONVERSION:"IfcMapConversion",IFCEXTERNALINFORMATION:"IfcExternalInformation",IFCCOORDINATEREFERENCESYSTEM:"IfcCoordinateReferenceSystem",IFCCOORDINATEOPERATION:"IfcCoordinateOperation",IFCCONNECTIONVOLUMEGEOMETRY:"IfcConnectionVolumeGeometry",IFCREINFORCINGBAR:"IfcReinforcingBar",IFCELECTRICDISTRIBUTIONPOINT:"IfcElectricDistributionPoint",IFCDISTRIBUTIONCONTROLELEMENT:"IfcDistributionControlElement",IFCDISTRIBUTIONCHAMBERELEMENT:"IfcDistributionChamberElement",IFCCONTROLLERTYPE:"IfcControllerType",IFCCHAMFEREDGEFEATURE:"IfcChamferEdgeFeature",IFCBEAM:"IfcBeam",IFCALARMTYPE:"IfcAlarmType",IFCACTUATORTYPE:"IfcActuatorType",IFCWINDOW:"IfcWindow",IFCWALLSTANDARDCASE:"IfcWallStandardCase",IFCWALL:"IfcWall",IFCVIBRATIONISOLATORTYPE:"IfcVibrationIsolatorType",IFCTENDONANCHOR:"IfcTendonAnchor",IFCTENDON:"IfcTendon",IFCSTRUCTURALANALYSISMODEL:"IfcStructuralAnalysisModel",IFCSTAIRFLIGHT:"IfcStairFlight",IFCSTAIR:"IfcStair",IFCSLAB:"IfcSlab",IFCSENSORTYPE:"IfcSensorType",IFCROUNDEDEDGEFEATURE:"IfcRoundedEdgeFeature",IFCROOF:"IfcRoof",IFCREINFORCINGMESH:"IfcReinforcingMesh",IFCREINFORCINGELEMENT:"IfcReinforcingElement",IFCRATIONALBEZIERCURVE:"IfcRationalBezierCurve",IFCRAMPFLIGHT:"IfcRampFlight",IFCRAMP:"IfcRamp",IFCRAILING:"IfcRailing",IFCPLATE:"IfcPlate",IFCPILE:"IfcPile",IFCMEMBER:"IfcMember",IFCFOOTING:"IfcFooting",IFCFLOWTREATMENTDEVICE:"IfcFlowTreatmentDevice",IFCFLOWTERMINAL:"IfcFlowTerminal",IFCFLOWSTORAGEDEVICE:"IfcFlowStorageDevice",IFCFLOWSEGMENT:"IfcFlowSegment",IFCFLOWMOVINGDEVICE:"IfcFlowMovingDevice",IFCFLOWINSTRUMENTTYPE:"IfcFlowInstrumentType",IFCFLOWFITTING:"IfcFlowFitting",IFCFLOWCONTROLLER:"IfcFlowController",IFCFIRESUPPRESSIONTERMINALTYPE:"IfcFireSuppressionTerminalType",IFCFILTERTYPE:"IfcFilterType",IFCFANTYPE:"IfcFanType",IFCENERGYCONVERSIONDEVICE:"IfcEnergyConversionDevice",IFCELECTRICALELEMENT:"IfcElectricalElement",IFCELECTRICALCIRCUIT:"IfcElectricalCircuit",IFCELECTRICTIMECONTROLTYPE:"IfcElectricTimeControlType",IFCELECTRICMOTORTYPE:"IfcElectricMotorType",IFCELECTRICHEATERTYPE:"IfcElectricHeaterType",IFCELECTRICGENERATORTYPE:"IfcElectricGeneratorType",IFCELECTRICFLOWSTORAGEDEVICETYPE:"IfcElectricFlowStorageDeviceType",IFCELECTRICAPPLIANCETYPE:"IfcElectricApplianceType",IFCEDGEFEATURE:"IfcEdgeFeature",IFCDUCTSILENCERTYPE:"IfcDuctSilencerType",IFCDUCTSEGMENTTYPE:"IfcDuctSegmentType",IFCDUCTFITTINGTYPE:"IfcDuctFittingType",IFCDOOR:"IfcDoor",IFCDISTRIBUTIONPORT:"IfcDistributionPort",IFCDISTRIBUTIONFLOWELEMENT:"IfcDistributionFlowElement",IFCDISTRIBUTIONELEMENT:"IfcDistributionElement",IFCDISTRIBUTIONCONTROLELEMENTTYPE:"IfcDistributionControlElementType",IFCDISTRIBUTIONCHAMBERELEMENTTYPE:"IfcDistributionChamberElementType",IFCDISCRETEACCESSORYTYPE:"IfcDiscreteAccessoryType",IFCDISCRETEACCESSORY:"IfcDiscreteAccessory",IFCDIAMETERDIMENSION:"IfcDiameterDimension",IFCDAMPERTYPE:"IfcDamperType",IFCCURTAINWALL:"IfcCurtainWall",IFCCOVERING:"IfcCovering",IFCCOOLINGTOWERTYPE:"IfcCoolingTowerType",IFCCOOLEDBEAMTYPE:"IfcCooledBeamType",IFCCONSTRUCTIONPRODUCTRESOURCE:"IfcConstructionProductResource",IFCCONSTRUCTIONMATERIALRESOURCE:"IfcConstructionMaterialResource",IFCCONSTRUCTIONEQUIPMENTRESOURCE:"IfcConstructionEquipmentResource",IFCCONDITIONCRITERION:"IfcConditionCriterion",IFCCONDITION:"IfcCondition",IFCCONDENSERTYPE:"IfcCondenserType",IFCCOMPRESSORTYPE:"IfcCompressorType",IFCCOLUMN:"IfcColumn",IFCCOILTYPE:"IfcCoilType",IFCCIRCLE:"IfcCircle",IFCCHILLERTYPE:"IfcChillerType",IFCCABLESEGMENTTYPE:"IfcCableSegmentType",IFCCABLECARRIERSEGMENTTYPE:"IfcCableCarrierSegmentType",IFCCABLECARRIERFITTINGTYPE:"IfcCableCarrierFittingType",IFCBUILDINGELEMENTPROXYTYPE:"IfcBuildingElementProxyType",IFCBUILDINGELEMENTPROXY:"IfcBuildingElementProxy",IFCBUILDINGELEMENTPART:"IfcBuildingElementPart",IFCBUILDINGELEMENTCOMPONENT:"IfcBuildingElementComponent",IFCBUILDINGELEMENT:"IfcBuildingElement",IFCBOILERTYPE:"IfcBoilerType",IFCBEZIERCURVE:"IfcBezierCurve",IFCBEAMTYPE:"IfcBeamType",IFCBSPLINECURVE:"IfcBSplineCurve",IFCASSET:"IfcAsset",IFCANGULARDIMENSION:"IfcAngularDimension",IFCAIRTOAIRHEATRECOVERYTYPE:"IfcAirToAirHeatRecoveryType",IFCAIRTERMINALTYPE:"IfcAirTerminalType",IFCAIRTERMINALBOXTYPE:"IfcAirTerminalBoxType",IFCACTIONREQUEST:"IfcActionRequest",IFC2DCOMPOSITECURVE:"Ifc2DCompositeCurve",IFCZONE:"IfcZone",IFCWORKSCHEDULE:"IfcWorkSchedule",IFCWORKPLAN:"IfcWorkPlan",IFCWORKCONTROL:"IfcWorkControl",IFCWASTETERMINALTYPE:"IfcWasteTerminalType",IFCWALLTYPE:"IfcWallType",IFCVIRTUALELEMENT:"IfcVirtualElement",IFCVALVETYPE:"IfcValveType",IFCUNITARYEQUIPMENTTYPE:"IfcUnitaryEquipmentType",IFCTUBEBUNDLETYPE:"IfcTubeBundleType",IFCTRIMMEDCURVE:"IfcTrimmedCurve",IFCTRANSPORTELEMENT:"IfcTransportElement",IFCTRANSFORMERTYPE:"IfcTransformerType",IFCTIMESERIESSCHEDULE:"IfcTimeSeriesSchedule",IFCTANKTYPE:"IfcTankType",IFCSYSTEM:"IfcSystem",IFCSWITCHINGDEVICETYPE:"IfcSwitchingDeviceType",IFCSUBCONTRACTRESOURCE:"IfcSubContractResource",IFCSTRUCTURALSURFACECONNECTION:"IfcStructuralSurfaceConnection",IFCSTRUCTURALRESULTGROUP:"IfcStructuralResultGroup",IFCSTRUCTURALPOINTREACTION:"IfcStructuralPointReaction",IFCSTRUCTURALPOINTCONNECTION:"IfcStructuralPointConnection",IFCSTRUCTURALPOINTACTION:"IfcStructuralPointAction",IFCSTRUCTURALPLANARACTIONVARYING:"IfcStructuralPlanarActionVarying",IFCSTRUCTURALPLANARACTION:"IfcStructuralPlanarAction",IFCSTRUCTURALLOADGROUP:"IfcStructuralLoadGroup",IFCSTRUCTURALLINEARACTIONVARYING:"IfcStructuralLinearActionVarying",IFCSTRUCTURALLINEARACTION:"IfcStructuralLinearAction",IFCSTRUCTURALCURVEMEMBERVARYING:"IfcStructuralCurveMemberVarying",IFCSTRUCTURALCURVEMEMBER:"IfcStructuralCurveMember",IFCSTRUCTURALCURVECONNECTION:"IfcStructuralCurveConnection",IFCSTRUCTURALCONNECTION:"IfcStructuralConnection",IFCSTRUCTURALACTION:"IfcStructuralAction",IFCSTAIRFLIGHTTYPE:"IfcStairFlightType",IFCSTACKTERMINALTYPE:"IfcStackTerminalType",IFCSPACETYPE:"IfcSpaceType",IFCSPACEPROGRAM:"IfcSpaceProgram",IFCSPACEHEATERTYPE:"IfcSpaceHeaterType",IFCSPACE:"IfcSpace",IFCSLABTYPE:"IfcSlabType",IFCSITE:"IfcSite",IFCSERVICELIFE:"IfcServiceLife",IFCSCHEDULETIMECONTROL:"IfcScheduleTimeControl",IFCSANITARYTERMINALTYPE:"IfcSanitaryTerminalType",IFCRELASSIGNSTASKS:"IfcRelAssignsTasks",IFCRELAGGREGATES:"IfcRelAggregates",IFCRAMPFLIGHTTYPE:"IfcRampFlightType",IFCRAILINGTYPE:"IfcRailingType",IFCRADIUSDIMENSION:"IfcRadiusDimension",IFCPUMPTYPE:"IfcPumpType",IFCPROTECTIVEDEVICETYPE:"IfcProtectiveDeviceType",IFCPROJECTIONELEMENT:"IfcProjectionElement",IFCPROJECTORDERRECORD:"IfcProjectOrderRecord",IFCPROJECTORDER:"IfcProjectOrder",IFCPROCEDURE:"IfcProcedure",IFCPORT:"IfcPort",IFCPOLYLINE:"IfcPolyline",IFCPLATETYPE:"IfcPlateType",IFCPIPESEGMENTTYPE:"IfcPipeSegmentType",IFCPIPEFITTINGTYPE:"IfcPipeFittingType",IFCPERMIT:"IfcPermit",IFCPERFORMANCEHISTORY:"IfcPerformanceHistory",IFCOUTLETTYPE:"IfcOutletType",IFCORDERACTION:"IfcOrderAction",IFCOPENINGELEMENT:"IfcOpeningElement",IFCOCCUPANT:"IfcOccupant",IFCMOVE:"IfcMove",IFCMOTORCONNECTIONTYPE:"IfcMotorConnectionType",IFCMEMBERTYPE:"IfcMemberType",IFCMECHANICALFASTENERTYPE:"IfcMechanicalFastenerType",IFCMECHANICALFASTENER:"IfcMechanicalFastener",IFCLINEARDIMENSION:"IfcLinearDimension",IFCLIGHTFIXTURETYPE:"IfcLightFixtureType",IFCLAMPTYPE:"IfcLampType",IFCLABORRESOURCE:"IfcLaborResource",IFCJUNCTIONBOXTYPE:"IfcJunctionBoxType",IFCINVENTORY:"IfcInventory",IFCHUMIDIFIERTYPE:"IfcHumidifierType",IFCHEATEXCHANGERTYPE:"IfcHeatExchangerType",IFCGROUP:"IfcGroup",IFCGRID:"IfcGrid",IFCGASTERMINALTYPE:"IfcGasTerminalType",IFCFURNITURESTANDARD:"IfcFurnitureStandard",IFCFURNISHINGELEMENT:"IfcFurnishingElement",IFCFLOWTREATMENTDEVICETYPE:"IfcFlowTreatmentDeviceType",IFCFLOWTERMINALTYPE:"IfcFlowTerminalType",IFCFLOWSTORAGEDEVICETYPE:"IfcFlowStorageDeviceType",IFCFLOWSEGMENTTYPE:"IfcFlowSegmentType",IFCFLOWMOVINGDEVICETYPE:"IfcFlowMovingDeviceType",IFCFLOWMETERTYPE:"IfcFlowMeterType",IFCFLOWFITTINGTYPE:"IfcFlowFittingType",IFCFLOWCONTROLLERTYPE:"IfcFlowControllerType",IFCFEATUREELEMENTSUBTRACTION:"IfcFeatureElementSubtraction",IFCFEATUREELEMENTADDITION:"IfcFeatureElementAddition",IFCFEATUREELEMENT:"IfcFeatureElement",IFCFASTENERTYPE:"IfcFastenerType",IFCFASTENER:"IfcFastener",IFCFACETEDBREPWITHVOIDS:"IfcFacetedBrepWithVoids",IFCFACETEDBREP:"IfcFacetedBrep",IFCEVAPORATORTYPE:"IfcEvaporatorType",IFCEVAPORATIVECOOLERTYPE:"IfcEvaporativeCoolerType",IFCEQUIPMENTSTANDARD:"IfcEquipmentStandard",IFCEQUIPMENTELEMENT:"IfcEquipmentElement",IFCENERGYCONVERSIONDEVICETYPE:"IfcEnergyConversionDeviceType",IFCELLIPSE:"IfcEllipse",IFCELEMENTCOMPONENTTYPE:"IfcElementComponentType",IFCELEMENTCOMPONENT:"IfcElementComponent",IFCELEMENTASSEMBLY:"IfcElementAssembly",IFCELEMENT:"IfcElement",IFCELECTRICALBASEPROPERTIES:"IfcElectricalBaseProperties",IFCDISTRIBUTIONFLOWELEMENTTYPE:"IfcDistributionFlowElementType",IFCDISTRIBUTIONELEMENTTYPE:"IfcDistributionElementType",IFCDIMENSIONCURVEDIRECTEDCALLOUT:"IfcDimensionCurveDirectedCallout",IFCCURTAINWALLTYPE:"IfcCurtainWallType",IFCCREWRESOURCE:"IfcCrewResource",IFCCOVERINGTYPE:"IfcCoveringType",IFCCOSTSCHEDULE:"IfcCostSchedule",IFCCOSTITEM:"IfcCostItem",IFCCONTROL:"IfcControl",IFCCONSTRUCTIONRESOURCE:"IfcConstructionResource",IFCCONIC:"IfcConic",IFCCOMPOSITECURVE:"IfcCompositeCurve",IFCCOLUMNTYPE:"IfcColumnType",IFCCIRCLEHOLLOWPROFILEDEF:"IfcCircleHollowProfileDef",IFCBUILDINGSTOREY:"IfcBuildingStorey",IFCBUILDINGELEMENTTYPE:"IfcBuildingElementType",IFCBUILDING:"IfcBuilding",IFCBOUNDEDCURVE:"IfcBoundedCurve",IFCBOOLEANCLIPPINGRESULT:"IfcBooleanClippingResult",IFCBLOCK:"IfcBlock",IFCASYMMETRICISHAPEPROFILEDEF:"IfcAsymmetricIShapeProfileDef",IFCANNOTATION:"IfcAnnotation",IFCACTOR:"IfcActor",IFCTRANSPORTELEMENTTYPE:"IfcTransportElementType",IFCTASK:"IfcTask",IFCSYSTEMFURNITUREELEMENTTYPE:"IfcSystemFurnitureElementType",IFCSURFACEOFREVOLUTION:"IfcSurfaceOfRevolution",IFCSURFACEOFLINEAREXTRUSION:"IfcSurfaceOfLinearExtrusion",IFCSURFACECURVESWEPTAREASOLID:"IfcSurfaceCurveSweptAreaSolid",IFCSTRUCTUREDDIMENSIONCALLOUT:"IfcStructuredDimensionCallout",IFCSTRUCTURALSURFACEMEMBERVARYING:"IfcStructuralSurfaceMemberVarying",IFCSTRUCTURALSURFACEMEMBER:"IfcStructuralSurfaceMember",IFCSTRUCTURALREACTION:"IfcStructuralReaction",IFCSTRUCTURALMEMBER:"IfcStructuralMember",IFCSTRUCTURALITEM:"IfcStructuralItem",IFCSTRUCTURALACTIVITY:"IfcStructuralActivity",IFCSPHERE:"IfcSphere",IFCSPATIALSTRUCTUREELEMENTTYPE:"IfcSpatialStructureElementType",IFCSPATIALSTRUCTUREELEMENT:"IfcSpatialStructureElement",IFCRIGHTCIRCULARCYLINDER:"IfcRightCircularCylinder",IFCRIGHTCIRCULARCONE:"IfcRightCircularCone",IFCREVOLVEDAREASOLID:"IfcRevolvedAreaSolid",IFCRESOURCE:"IfcResource",IFCRELVOIDSELEMENT:"IfcRelVoidsElement",IFCRELSPACEBOUNDARY:"IfcRelSpaceBoundary",IFCRELSERVICESBUILDINGS:"IfcRelServicesBuildings",IFCRELSEQUENCE:"IfcRelSequence",IFCRELSCHEDULESCOSTITEMS:"IfcRelSchedulesCostItems",IFCRELREFERENCEDINSPATIALSTRUCTURE:"IfcRelReferencedInSpatialStructure",IFCRELPROJECTSELEMENT:"IfcRelProjectsElement",IFCRELOVERRIDESPROPERTIES:"IfcRelOverridesProperties",IFCRELOCCUPIESSPACES:"IfcRelOccupiesSpaces",IFCRELNESTS:"IfcRelNests",IFCRELINTERACTIONREQUIREMENTS:"IfcRelInteractionRequirements",IFCRELFLOWCONTROLELEMENTS:"IfcRelFlowControlElements",IFCRELFILLSELEMENT:"IfcRelFillsElement",IFCRELDEFINESBYTYPE:"IfcRelDefinesByType",IFCRELDEFINESBYPROPERTIES:"IfcRelDefinesByProperties",IFCRELDEFINES:"IfcRelDefines",IFCRELDECOMPOSES:"IfcRelDecomposes",IFCRELCOVERSSPACES:"IfcRelCoversSpaces",IFCRELCOVERSBLDGELEMENTS:"IfcRelCoversBldgElements",IFCRELCONTAINEDINSPATIALSTRUCTURE:"IfcRelContainedInSpatialStructure",IFCRELCONNECTSWITHREALIZINGELEMENTS:"IfcRelConnectsWithRealizingElements",IFCRELCONNECTSWITHECCENTRICITY:"IfcRelConnectsWithEccentricity",IFCRELCONNECTSSTRUCTURALMEMBER:"IfcRelConnectsStructuralMember",IFCRELCONNECTSSTRUCTURALELEMENT:"IfcRelConnectsStructuralElement",IFCRELCONNECTSSTRUCTURALACTIVITY:"IfcRelConnectsStructuralActivity",IFCRELCONNECTSPORTS:"IfcRelConnectsPorts",IFCRELCONNECTSPORTTOELEMENT:"IfcRelConnectsPortToElement",IFCRELCONNECTSPATHELEMENTS:"IfcRelConnectsPathElements",IFCRELCONNECTSELEMENTS:"IfcRelConnectsElements",IFCRELCONNECTS:"IfcRelConnects",IFCRELASSOCIATESPROFILEPROPERTIES:"IfcRelAssociatesProfileProperties",IFCRELASSOCIATESMATERIAL:"IfcRelAssociatesMaterial",IFCRELASSOCIATESLIBRARY:"IfcRelAssociatesLibrary",IFCRELASSOCIATESDOCUMENT:"IfcRelAssociatesDocument",IFCRELASSOCIATESCONSTRAINT:"IfcRelAssociatesConstraint",IFCRELASSOCIATESCLASSIFICATION:"IfcRelAssociatesClassification",IFCRELASSOCIATESAPPROVAL:"IfcRelAssociatesApproval",IFCRELASSOCIATESAPPLIEDVALUE:"IfcRelAssociatesAppliedValue",IFCRELASSOCIATES:"IfcRelAssociates",IFCRELASSIGNSTORESOURCE:"IfcRelAssignsToResource",IFCRELASSIGNSTOPROJECTORDER:"IfcRelAssignsToProjectOrder",IFCRELASSIGNSTOPRODUCT:"IfcRelAssignsToProduct",IFCRELASSIGNSTOPROCESS:"IfcRelAssignsToProcess",IFCRELASSIGNSTOGROUP:"IfcRelAssignsToGroup",IFCRELASSIGNSTOCONTROL:"IfcRelAssignsToControl",IFCRELASSIGNSTOACTOR:"IfcRelAssignsToActor",IFCRELASSIGNS:"IfcRelAssigns",IFCRECTANGULARTRIMMEDSURFACE:"IfcRectangularTrimmedSurface",IFCRECTANGULARPYRAMID:"IfcRectangularPyramid",IFCRECTANGLEHOLLOWPROFILEDEF:"IfcRectangleHollowProfileDef",IFCPROXY:"IfcProxy",IFCPROPERTYSET:"IfcPropertySet",IFCPROJECTIONCURVE:"IfcProjectionCurve",IFCPROJECT:"IfcProject",IFCPRODUCT:"IfcProduct",IFCPROCESS:"IfcProcess",IFCPLANE:"IfcPlane",IFCPLANARBOX:"IfcPlanarBox",IFCPERMEABLECOVERINGPROPERTIES:"IfcPermeableCoveringProperties",IFCOFFSETCURVE3D:"IfcOffsetCurve3D",IFCOFFSETCURVE2D:"IfcOffsetCurve2D",IFCOBJECT:"IfcObject",IFCMANIFOLDSOLIDBREP:"IfcManifoldSolidBrep",IFCLINE:"IfcLine",IFCLSHAPEPROFILEDEF:"IfcLShapeProfileDef",IFCISHAPEPROFILEDEF:"IfcIShapeProfileDef",IFCGEOMETRICCURVESET:"IfcGeometricCurveSet",IFCFURNITURETYPE:"IfcFurnitureType",IFCFURNISHINGELEMENTTYPE:"IfcFurnishingElementType",IFCFLUIDFLOWPROPERTIES:"IfcFluidFlowProperties",IFCFILLAREASTYLETILES:"IfcFillAreaStyleTiles",IFCFILLAREASTYLETILESYMBOLWITHSTYLE:"IfcFillAreaStyleTileSymbolWithStyle",IFCFILLAREASTYLEHATCHING:"IfcFillAreaStyleHatching",IFCFACEBASEDSURFACEMODEL:"IfcFaceBasedSurfaceModel",IFCEXTRUDEDAREASOLID:"IfcExtrudedAreaSolid",IFCENERGYPROPERTIES:"IfcEnergyProperties",IFCELLIPSEPROFILEDEF:"IfcEllipseProfileDef",IFCELEMENTARYSURFACE:"IfcElementarySurface",IFCELEMENTTYPE:"IfcElementType",IFCELEMENTQUANTITY:"IfcElementQuantity",IFCEDGELOOP:"IfcEdgeLoop",IFCDRAUGHTINGPREDEFINEDCURVEFONT:"IfcDraughtingPredefinedCurveFont",IFCDRAUGHTINGPREDEFINEDCOLOUR:"IfcDraughtingPredefinedColour",IFCDRAUGHTINGCALLOUT:"IfcDraughtingCallout",IFCDOORSTYLE:"IfcDoorStyle",IFCDOORPANELPROPERTIES:"IfcDoorPanelProperties",IFCDOORLININGPROPERTIES:"IfcDoorLiningProperties",IFCDIRECTION:"IfcDirection",IFCDIMENSIONCURVETERMINATOR:"IfcDimensionCurveTerminator",IFCDIMENSIONCURVE:"IfcDimensionCurve",IFCDEFINEDSYMBOL:"IfcDefinedSymbol",IFCCURVEBOUNDEDPLANE:"IfcCurveBoundedPlane",IFCCURVE:"IfcCurve",IFCCSGSOLID:"IfcCsgSolid",IFCCSGPRIMITIVE3D:"IfcCsgPrimitive3D",IFCCRANERAILFSHAPEPROFILEDEF:"IfcCraneRailFShapeProfileDef",IFCCRANERAILASHAPEPROFILEDEF:"IfcCraneRailAShapeProfileDef",IFCCOMPOSITECURVESEGMENT:"IfcCompositeCurveSegment",IFCCLOSEDSHELL:"IfcClosedShell",IFCCIRCLEPROFILEDEF:"IfcCircleProfileDef",IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM:"IfcCartesianTransformationOperator3DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR3D:"IfcCartesianTransformationOperator3D",IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM:"IfcCartesianTransformationOperator2DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR2D:"IfcCartesianTransformationOperator2D",IFCCARTESIANTRANSFORMATIONOPERATOR:"IfcCartesianTransformationOperator",IFCCARTESIANPOINT:"IfcCartesianPoint",IFCCSHAPEPROFILEDEF:"IfcCShapeProfileDef",IFCBOXEDHALFSPACE:"IfcBoxedHalfSpace",IFCBOUNDINGBOX:"IfcBoundingBox",IFCBOUNDEDSURFACE:"IfcBoundedSurface",IFCBOOLEANRESULT:"IfcBooleanResult",IFCAXIS2PLACEMENT3D:"IfcAxis2Placement3D",IFCAXIS2PLACEMENT2D:"IfcAxis2Placement2D",IFCAXIS1PLACEMENT:"IfcAxis1Placement",IFCANNOTATIONSURFACE:"IfcAnnotationSurface",IFCANNOTATIONFILLAREAOCCURRENCE:"IfcAnnotationFillAreaOccurrence",IFCANNOTATIONFILLAREA:"IfcAnnotationFillArea",IFCANNOTATIONCURVEOCCURRENCE:"IfcAnnotationCurveOccurrence",IFCZSHAPEPROFILEDEF:"IfcZShapeProfileDef",IFCWINDOWSTYLE:"IfcWindowStyle",IFCWINDOWPANELPROPERTIES:"IfcWindowPanelProperties",IFCWINDOWLININGPROPERTIES:"IfcWindowLiningProperties",IFCVERTEXLOOP:"IfcVertexLoop",IFCVECTOR:"IfcVector",IFCUSHAPEPROFILEDEF:"IfcUShapeProfileDef",IFCTYPEPRODUCT:"IfcTypeProduct",IFCTYPEOBJECT:"IfcTypeObject",IFCTWODIRECTIONREPEATFACTOR:"IfcTwoDirectionRepeatFactor",IFCTRAPEZIUMPROFILEDEF:"IfcTrapeziumProfileDef",IFCTEXTLITERALWITHEXTENT:"IfcTextLiteralWithExtent",IFCTEXTLITERAL:"IfcTextLiteral",IFCTERMINATORSYMBOL:"IfcTerminatorSymbol",IFCTSHAPEPROFILEDEF:"IfcTShapeProfileDef",IFCSWEPTSURFACE:"IfcSweptSurface",IFCSWEPTDISKSOLID:"IfcSweptDiskSolid",IFCSWEPTAREASOLID:"IfcSweptAreaSolid",IFCSURFACESTYLERENDERING:"IfcSurfaceStyleRendering",IFCSURFACE:"IfcSurface",IFCSUBEDGE:"IfcSubedge",IFCSTRUCTURALSTEELPROFILEPROPERTIES:"IfcStructuralSteelProfileProperties",IFCSTRUCTURALPROFILEPROPERTIES:"IfcStructuralProfileProperties",IFCSTRUCTURALLOADSINGLEFORCEWARPING:"IfcStructuralLoadSingleForceWarping",IFCSTRUCTURALLOADSINGLEFORCE:"IfcStructuralLoadSingleForce",IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION:"IfcStructuralLoadSingleDisplacementDistortion",IFCSTRUCTURALLOADSINGLEDISPLACEMENT:"IfcStructuralLoadSingleDisplacement",IFCSTRUCTURALLOADPLANARFORCE:"IfcStructuralLoadPlanarForce",IFCSTRUCTURALLOADLINEARFORCE:"IfcStructuralLoadLinearForce",IFCSPACETHERMALLOADPROPERTIES:"IfcSpaceThermalLoadProperties",IFCSOUNDVALUE:"IfcSoundValue",IFCSOUNDPROPERTIES:"IfcSoundProperties",IFCSOLIDMODEL:"IfcSolidModel",IFCSLIPPAGECONNECTIONCONDITION:"IfcSlippageConnectionCondition",IFCSHELLBASEDSURFACEMODEL:"IfcShellBasedSurfaceModel",IFCSERVICELIFEFACTOR:"IfcServiceLifeFactor",IFCSECTIONEDSPINE:"IfcSectionedSpine",IFCROUNDEDRECTANGLEPROFILEDEF:"IfcRoundedRectangleProfileDef",IFCRELATIONSHIP:"IfcRelationship",IFCREINFORCEMENTDEFINITIONPROPERTIES:"IfcReinforcementDefinitionProperties",IFCREGULARTIMESERIES:"IfcRegularTimeSeries",IFCRECTANGLEPROFILEDEF:"IfcRectangleProfileDef",IFCPROPERTYTABLEVALUE:"IfcPropertyTableValue",IFCPROPERTYSINGLEVALUE:"IfcPropertySingleValue",IFCPROPERTYSETDEFINITION:"IfcPropertySetDefinition",IFCPROPERTYREFERENCEVALUE:"IfcPropertyReferenceValue",IFCPROPERTYLISTVALUE:"IfcPropertyListValue",IFCPROPERTYENUMERATEDVALUE:"IfcPropertyEnumeratedValue",IFCPROPERTYDEFINITION:"IfcPropertyDefinition",IFCPROPERTYBOUNDEDVALUE:"IfcPropertyBoundedValue",IFCPRODUCTDEFINITIONSHAPE:"IfcProductDefinitionShape",IFCPREDEFINEDPOINTMARKERSYMBOL:"IfcPredefinedPointMarkerSymbol",IFCPREDEFINEDDIMENSIONSYMBOL:"IfcPredefinedDimensionSymbol",IFCPREDEFINEDCURVEFONT:"IfcPredefinedCurveFont",IFCPREDEFINEDCOLOUR:"IfcPredefinedColour",IFCPOLYGONALBOUNDEDHALFSPACE:"IfcPolygonalBoundedHalfSpace",IFCPOLYLOOP:"IfcPolyLoop",IFCPOINTONSURFACE:"IfcPointOnSurface",IFCPOINTONCURVE:"IfcPointOnCurve",IFCPOINT:"IfcPoint",IFCPLANAREXTENT:"IfcPlanarExtent",IFCPLACEMENT:"IfcPlacement",IFCPIXELTEXTURE:"IfcPixelTexture",IFCPHYSICALCOMPLEXQUANTITY:"IfcPhysicalComplexQuantity",IFCPATH:"IfcPath",IFCPARAMETERIZEDPROFILEDEF:"IfcParameterizedProfileDef",IFCORIENTEDEDGE:"IfcOrientedEdge",IFCOPENSHELL:"IfcOpenShell",IFCONEDIRECTIONREPEATFACTOR:"IfcOneDirectionRepeatFactor",IFCOBJECTDEFINITION:"IfcObjectDefinition",IFCMECHANICALCONCRETEMATERIALPROPERTIES:"IfcMechanicalConcreteMaterialProperties",IFCMATERIALDEFINITIONREPRESENTATION:"IfcMaterialDefinitionRepresentation",IFCMAPPEDITEM:"IfcMappedItem",IFCLOOP:"IfcLoop",IFCLOCALPLACEMENT:"IfcLocalPlacement",IFCLIGHTSOURCESPOT:"IfcLightSourceSpot",IFCLIGHTSOURCEPOSITIONAL:"IfcLightSourcePositional",IFCLIGHTSOURCEGONIOMETRIC:"IfcLightSourceGoniometric",IFCLIGHTSOURCEDIRECTIONAL:"IfcLightSourceDirectional",IFCLIGHTSOURCEAMBIENT:"IfcLightSourceAmbient",IFCLIGHTSOURCE:"IfcLightSource",IFCIRREGULARTIMESERIES:"IfcIrregularTimeSeries",IFCIMAGETEXTURE:"IfcImageTexture",IFCHYGROSCOPICMATERIALPROPERTIES:"IfcHygroscopicMaterialProperties",IFCHALFSPACESOLID:"IfcHalfSpaceSolid",IFCGRIDPLACEMENT:"IfcGridPlacement",IFCGEOMETRICSET:"IfcGeometricSet",IFCGEOMETRICREPRESENTATIONSUBCONTEXT:"IfcGeometricRepresentationSubContext",IFCGEOMETRICREPRESENTATIONITEM:"IfcGeometricRepresentationItem",IFCGEOMETRICREPRESENTATIONCONTEXT:"IfcGeometricRepresentationContext",IFCGENERALPROFILEPROPERTIES:"IfcGeneralProfileProperties",IFCGENERALMATERIALPROPERTIES:"IfcGeneralMaterialProperties",IFCFUELPROPERTIES:"IfcFuelProperties",IFCFILLAREASTYLE:"IfcFillAreaStyle",IFCFAILURECONNECTIONCONDITION:"IfcFailureConnectionCondition",IFCFACESURFACE:"IfcFaceSurface",IFCFACEOUTERBOUND:"IfcFaceOuterBound",IFCFACEBOUND:"IfcFaceBound",IFCFACE:"IfcFace",IFCEXTENDEDMATERIALPROPERTIES:"IfcExtendedMaterialProperties",IFCEDGECURVE:"IfcEdgeCurve",IFCEDGE:"IfcEdge",IFCDRAUGHTINGPREDEFINEDTEXTFONT:"IfcDraughtingPredefinedTextFont",IFCDOCUMENTREFERENCE:"IfcDocumentReference",IFCDIMENSIONPAIR:"IfcDimensionPair",IFCDIMENSIONCALLOUTRELATIONSHIP:"IfcDimensionCalloutRelationship",IFCDERIVEDPROFILEDEF:"IfcDerivedProfileDef",IFCCURVESTYLE:"IfcCurveStyle",IFCCONVERSIONBASEDUNIT:"IfcConversionBasedUnit",IFCCONTEXTDEPENDENTUNIT:"IfcContextDependentUnit",IFCCONNECTIONPOINTECCENTRICITY:"IfcConnectionPointEccentricity",IFCCONNECTIONCURVEGEOMETRY:"IfcConnectionCurveGeometry",IFCCONNECTEDFACESET:"IfcConnectedFaceSet",IFCCOMPOSITEPROFILEDEF:"IfcCompositeProfileDef",IFCCOMPLEXPROPERTY:"IfcComplexProperty",IFCCOLOURRGB:"IfcColourRgb",IFCCLASSIFICATIONREFERENCE:"IfcClassificationReference",IFCCENTERLINEPROFILEDEF:"IfcCenterLineProfileDef",IFCBLOBTEXTURE:"IfcBlobTexture",IFCARBITRARYPROFILEDEFWITHVOIDS:"IfcArbitraryProfileDefWithVoids",IFCARBITRARYOPENPROFILEDEF:"IfcArbitraryOpenProfileDef",IFCARBITRARYCLOSEDPROFILEDEF:"IfcArbitraryClosedProfileDef",IFCANNOTATIONTEXTOCCURRENCE:"IfcAnnotationTextOccurrence",IFCANNOTATIONSYMBOLOCCURRENCE:"IfcAnnotationSymbolOccurrence",IFCANNOTATIONSURFACEOCCURRENCE:"IfcAnnotationSurfaceOccurrence",IFCANNOTATIONOCCURRENCE:"IfcAnnotationOccurrence",IFCWATERPROPERTIES:"IfcWaterProperties",IFCVIRTUALGRIDINTERSECTION:"IfcVirtualGridIntersection",IFCVERTEXPOINT:"IfcVertexPoint",IFCVERTEXBASEDTEXTUREMAP:"IfcVertexBasedTextureMap",IFCVERTEX:"IfcVertex",IFCUNITASSIGNMENT:"IfcUnitAssignment",IFCTOPOLOGYREPRESENTATION:"IfcTopologyRepresentation",IFCTOPOLOGICALREPRESENTATIONITEM:"IfcTopologicalRepresentationItem",IFCTIMESERIESVALUE:"IfcTimeSeriesValue",IFCTIMESERIESREFERENCERELATIONSHIP:"IfcTimeSeriesReferenceRelationship",IFCTIMESERIES:"IfcTimeSeries",IFCTHERMALMATERIALPROPERTIES:"IfcThermalMaterialProperties",IFCTEXTUREVERTEX:"IfcTextureVertex",IFCTEXTUREMAP:"IfcTextureMap",IFCTEXTURECOORDINATEGENERATOR:"IfcTextureCoordinateGenerator",IFCTEXTURECOORDINATE:"IfcTextureCoordinate",IFCTEXTSTYLEWITHBOXCHARACTERISTICS:"IfcTextStyleWithBoxCharacteristics",IFCTEXTSTYLETEXTMODEL:"IfcTextStyleTextModel",IFCTEXTSTYLEFORDEFINEDFONT:"IfcTextStyleForDefinedFont",IFCTEXTSTYLEFONTMODEL:"IfcTextStyleFontModel",IFCTEXTSTYLE:"IfcTextStyle",IFCTELECOMADDRESS:"IfcTelecomAddress",IFCTABLEROW:"IfcTableRow",IFCTABLE:"IfcTable",IFCSYMBOLSTYLE:"IfcSymbolStyle",IFCSURFACETEXTURE:"IfcSurfaceTexture",IFCSURFACESTYLEWITHTEXTURES:"IfcSurfaceStyleWithTextures",IFCSURFACESTYLESHADING:"IfcSurfaceStyleShading",IFCSURFACESTYLEREFRACTION:"IfcSurfaceStyleRefraction",IFCSURFACESTYLELIGHTING:"IfcSurfaceStyleLighting",IFCSURFACESTYLE:"IfcSurfaceStyle",IFCSTYLEDREPRESENTATION:"IfcStyledRepresentation",IFCSTYLEDITEM:"IfcStyledItem",IFCSTYLEMODEL:"IfcStyleModel",IFCSTRUCTURALLOADTEMPERATURE:"IfcStructuralLoadTemperature",IFCSTRUCTURALLOADSTATIC:"IfcStructuralLoadStatic",IFCSTRUCTURALLOAD:"IfcStructuralLoad",IFCSTRUCTURALCONNECTIONCONDITION:"IfcStructuralConnectionCondition",IFCSIMPLEPROPERTY:"IfcSimpleProperty",IFCSHAPEREPRESENTATION:"IfcShapeRepresentation",IFCSHAPEMODEL:"IfcShapeModel",IFCSHAPEASPECT:"IfcShapeAspect",IFCSECTIONREINFORCEMENTPROPERTIES:"IfcSectionReinforcementProperties",IFCSECTIONPROPERTIES:"IfcSectionProperties",IFCSIUNIT:"IfcSIUnit",IFCROOT:"IfcRoot",IFCRIBPLATEPROFILEPROPERTIES:"IfcRibPlateProfileProperties",IFCREPRESENTATIONMAP:"IfcRepresentationMap",IFCREPRESENTATIONITEM:"IfcRepresentationItem",IFCREPRESENTATIONCONTEXT:"IfcRepresentationContext",IFCREPRESENTATION:"IfcRepresentation",IFCRELAXATION:"IfcRelaxation",IFCREINFORCEMENTBARPROPERTIES:"IfcReinforcementBarProperties",IFCREFERENCESVALUEDOCUMENT:"IfcReferencesValueDocument",IFCQUANTITYWEIGHT:"IfcQuantityWeight",IFCQUANTITYVOLUME:"IfcQuantityVolume",IFCQUANTITYTIME:"IfcQuantityTime",IFCQUANTITYLENGTH:"IfcQuantityLength",IFCQUANTITYCOUNT:"IfcQuantityCount",IFCQUANTITYAREA:"IfcQuantityArea",IFCPROPERTYENUMERATION:"IfcPropertyEnumeration",IFCPROPERTYDEPENDENCYRELATIONSHIP:"IfcPropertyDependencyRelationship",IFCPROPERTYCONSTRAINTRELATIONSHIP:"IfcPropertyConstraintRelationship",IFCPROPERTY:"IfcProperty",IFCPROFILEPROPERTIES:"IfcProfileProperties",IFCPROFILEDEF:"IfcProfileDef",IFCPRODUCTSOFCOMBUSTIONPROPERTIES:"IfcProductsOfCombustionProperties",IFCPRODUCTREPRESENTATION:"IfcProductRepresentation",IFCPRESENTATIONSTYLEASSIGNMENT:"IfcPresentationStyleAssignment",IFCPRESENTATIONSTYLE:"IfcPresentationStyle",IFCPRESENTATIONLAYERWITHSTYLE:"IfcPresentationLayerWithStyle",IFCPRESENTATIONLAYERASSIGNMENT:"IfcPresentationLayerAssignment",IFCPREDEFINEDTEXTFONT:"IfcPredefinedTextFont",IFCPREDEFINEDTERMINATORSYMBOL:"IfcPredefinedTerminatorSymbol",IFCPREDEFINEDSYMBOL:"IfcPredefinedSymbol",IFCPREDEFINEDITEM:"IfcPredefinedItem",IFCPOSTALADDRESS:"IfcPostalAddress",IFCPHYSICALSIMPLEQUANTITY:"IfcPhysicalSimpleQuantity",IFCPHYSICALQUANTITY:"IfcPhysicalQuantity",IFCPERSONANDORGANIZATION:"IfcPersonAndOrganization",IFCPERSON:"IfcPerson",IFCOWNERHISTORY:"IfcOwnerHistory",IFCORGANIZATIONRELATIONSHIP:"IfcOrganizationRelationship",IFCORGANIZATION:"IfcOrganization",IFCOPTICALMATERIALPROPERTIES:"IfcOpticalMaterialProperties",IFCOBJECTIVE:"IfcObjective",IFCOBJECTPLACEMENT:"IfcObjectPlacement",IFCNAMEDUNIT:"IfcNamedUnit",IFCMONETARYUNIT:"IfcMonetaryUnit",IFCMETRIC:"IfcMetric",IFCMECHANICALSTEELMATERIALPROPERTIES:"IfcMechanicalSteelMaterialProperties",IFCMECHANICALMATERIALPROPERTIES:"IfcMechanicalMaterialProperties",IFCMEASUREWITHUNIT:"IfcMeasureWithUnit",IFCMATERIALPROPERTIES:"IfcMaterialProperties",IFCMATERIALLIST:"IfcMaterialList",IFCMATERIALLAYERSETUSAGE:"IfcMaterialLayerSetUsage",IFCMATERIALLAYERSET:"IfcMaterialLayerSet",IFCMATERIALLAYER:"IfcMaterialLayer",IFCMATERIALCLASSIFICATIONRELATIONSHIP:"IfcMaterialClassificationRelationship",IFCMATERIAL:"IfcMaterial",IFCLOCALTIME:"IfcLocalTime",IFCLIGHTINTENSITYDISTRIBUTION:"IfcLightIntensityDistribution",IFCLIGHTDISTRIBUTIONDATA:"IfcLightDistributionData",IFCLIBRARYREFERENCE:"IfcLibraryReference",IFCLIBRARYINFORMATION:"IfcLibraryInformation",IFCIRREGULARTIMESERIESVALUE:"IfcIrregularTimeSeriesValue",IFCGRIDAXIS:"IfcGridAxis",IFCEXTERNALLYDEFINEDTEXTFONT:"IfcExternallyDefinedTextFont",IFCEXTERNALLYDEFINEDSYMBOL:"IfcExternallyDefinedSymbol",IFCEXTERNALLYDEFINEDSURFACESTYLE:"IfcExternallyDefinedSurfaceStyle",IFCEXTERNALLYDEFINEDHATCHSTYLE:"IfcExternallyDefinedHatchStyle",IFCEXTERNALREFERENCE:"IfcExternalReference",IFCENVIRONMENTALIMPACTVALUE:"IfcEnvironmentalImpactValue",IFCDRAUGHTINGCALLOUTRELATIONSHIP:"IfcDraughtingCalloutRelationship",IFCDOCUMENTINFORMATIONRELATIONSHIP:"IfcDocumentInformationRelationship",IFCDOCUMENTINFORMATION:"IfcDocumentInformation",IFCDOCUMENTELECTRONICFORMAT:"IfcDocumentElectronicFormat",IFCDIMENSIONALEXPONENTS:"IfcDimensionalExponents",IFCDERIVEDUNITELEMENT:"IfcDerivedUnitElement",IFCDERIVEDUNIT:"IfcDerivedUnit",IFCDATEANDTIME:"IfcDateAndTime",IFCCURVESTYLEFONTPATTERN:"IfcCurveStyleFontPattern",IFCCURVESTYLEFONTANDSCALING:"IfcCurveStyleFontAndScaling",IFCCURVESTYLEFONT:"IfcCurveStyleFont",IFCCURRENCYRELATIONSHIP:"IfcCurrencyRelationship",IFCCOSTVALUE:"IfcCostValue",IFCCOORDINATEDUNIVERSALTIMEOFFSET:"IfcCoordinatedUniversalTimeOffset",IFCCONSTRAINTRELATIONSHIP:"IfcConstraintRelationship",IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP:"IfcConstraintClassificationRelationship",IFCCONSTRAINTAGGREGATIONRELATIONSHIP:"IfcConstraintAggregationRelationship",IFCCONSTRAINT:"IfcConstraint",IFCCONNECTIONSURFACEGEOMETRY:"IfcConnectionSurfaceGeometry",IFCCONNECTIONPORTGEOMETRY:"IfcConnectionPortGeometry",IFCCONNECTIONPOINTGEOMETRY:"IfcConnectionPointGeometry",IFCCONNECTIONGEOMETRY:"IfcConnectionGeometry",IFCCOLOURSPECIFICATION:"IfcColourSpecification",IFCCLASSIFICATIONNOTATIONFACET:"IfcClassificationNotationFacet",IFCCLASSIFICATIONNOTATION:"IfcClassificationNotation",IFCCLASSIFICATIONITEMRELATIONSHIP:"IfcClassificationItemRelationship",IFCCLASSIFICATIONITEM:"IfcClassificationItem",IFCCLASSIFICATION:"IfcClassification",IFCCALENDARDATE:"IfcCalendarDate",IFCBOUNDARYNODECONDITIONWARPING:"IfcBoundaryNodeConditionWarping",IFCBOUNDARYNODECONDITION:"IfcBoundaryNodeCondition",IFCBOUNDARYFACECONDITION:"IfcBoundaryFaceCondition",IFCBOUNDARYEDGECONDITION:"IfcBoundaryEdgeCondition",IFCBOUNDARYCONDITION:"IfcBoundaryCondition",IFCAPPROVALRELATIONSHIP:"IfcApprovalRelationship",IFCAPPROVALPROPERTYRELATIONSHIP:"IfcApprovalPropertyRelationship",IFCAPPROVALACTORRELATIONSHIP:"IfcApprovalActorRelationship",IFCAPPROVAL:"IfcApproval",IFCAPPLIEDVALUERELATIONSHIP:"IfcAppliedValueRelationship",IFCAPPLIEDVALUE:"IfcAppliedValue",IFCAPPLICATION:"IfcApplication",IFCADDRESS:"IfcAddress",IFCACTORROLE:"IfcActorRole"};class ch{constructor(){p(this,"factor",1),p(this,"complement",1)}apply(e){const t=this.getScaleMatrix().multiply(e);e.copy(t)}setUp(e){var t,s,i;this.factor=1;const n=this.getLengthUnits(e);if(!n)return;const r=n==null,o=n.Name===void 0||n.Name===null;r||o||(n.Name.value==="FOOT"&&(this.factor=.3048),((t=n.Prefix)==null?void 0:t.value)==="MILLI"?this.complement=.001:((s=n.Prefix)==null?void 0:s.value)==="CENTI"?this.complement=.01:((i=n.Prefix)==null?void 0:i.value)==="DECI"&&(this.complement=.01))}getLengthUnits(e){try{const t=e.GetLineIDsWithType(0,el).get(0),s=e.GetLine(0,t);for(const i of s.Units){if(!i||i.value===null||i.value===void 0)continue;const n=e.GetLine(0,i.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new Ee().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Uo{constructor(){p(this,"itemsByFloor",{}),p(this,"_units",new ch)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,vi),s=new Set,i=e.GetLineIDsWithType(0,zt);for(let c=0;c0&&!r.has(n)||this.settings.excludedCategories.has(n))continue;const o=this.webIfc.GetLineIDsWithType(0,n),a=o.size();for(let c=0;c{this.getMesh(n,t)});for(const n of this._visitedFragments){const{index:r,fragment:o}=n[1];t.keyFragments.set(r,o.id)}for(const n of t.items){const r=this._fragmentInstances.get(n.id);if(!r)throw new Error("Fragment not found!");const o=[];for(const[a,c]of r)o.push(c);n.add(o)}const i=this.webIfc.GetCoordinationMatrix(0);return t.coordinationMatrix.fromArray(i),t.civilData=this._civil.read(this.webIfc),t}getMesh(e,t){const s=e.geometries.size(),i=e.expressID;for(let n=0;nr.value!==s),await e.setProperties(s,null),this.registerChange(e,t,s))}addElementToPset(e,t,...s){this.components.get(rt).addEntitiesRelation(e,t,{type:zs,inv:"IsDefinedBy"},...s)}async addPropToPset(e,t,...s){const i=await e.getProperties(t);if(i){for(const n of s){if(i.HasProperties.includes(n))continue;const r=new pt(n);i.HasProperties.push(r),this.onPropToPset.trigger({model:e,psetID:t,propID:n})}this.registerChange(e,t)}}async createIfcRel(e,t,s,i){const n=Ih[t];if(!n)throw new Error(`IfcPropertiesManager: ${n} is unsoported.`);const r=e.ifcMetadata.schema,o=dh[n],a=Ke[r][n];if(!(o&&a))throw new Error(`IfcPropertiesManager: ${n} is unsoported.`);const c=[new Ke[r].IfcGloballyUniqueId(vt.create())],{related:h,relating:d}=o,I=[...new Set(i)].map(E=>new pt(E)),u=(E,C)=>{for(let T=E;TparseInt(r,10)),i=t[s[0]],n=new pt(i.expressID);return{ownerHistory:i,ownerHistoryHandle:n}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const s of t)this.changeMap[e.uuid].add(s),this.onDataChanged.trigger({model:e,expressID:s})}async newSingleProperty(e,t,s,i){const n=rs.getIFCSchema(e),r=new Ke[n].IfcIdentifier(s),o=new Ke[n][t](i),a=new Ke[n].IfcPropertySingleValue(r,null,o,null);return a.expressID=this.getNewExpressID(e),await this.setData(e,a),a}};p(Ho,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Eh=Ho;const Wo=class Fn extends Ae{constructor(e){super(e),p(this,"onDisposed",new $),p(this,"onRelationsIndexed",new $),p(this,"relationMaps",{}),p(this,"enabled",!0),p(this,"_relToAttributesMap",qr),p(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests","DocumentRefForObjects"]),p(this,"_ifcRels",[wi,Mn,Dn,bn,zs,Un,xn,vi,Bn,Yn,Vn,Gn,zn,kn,Hn]),p(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]}),p(this,"_changeMap",{}),p(this,"onEntitiesRelated",new $),this.components.add(Fn.uuid,this),e.get(Re).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(e,t,s,i){const n=Object.keys(t).find(h=>h.startsWith("Relating")),r=Object.keys(t).find(h=>h.startsWith("Related"));if(!(n&&r))return;const o=t[n].value,a=t[r].map(h=>h.value),c=this.getAttributeIndex(i);if(c!==null){let h=e.get(o);h||(h=new Map,e.set(o,h));let d=h.get(c);d||(d=[],h.set(c,d)),d.push(...a)}for(const h of a){const d=this.getAttributeIndex(s);if(d===null)continue;let I=e.get(h);I||(I=new Map,e.set(h,I));let u=I.get(d);u||(u=[],I.set(d,u)),u.push(o)}}getAttributeIndex(e){const t=this._inverseAttributes.indexOf(e);return t===-1?null:t}setRelationMap(e,t){this.relationMaps[e.uuid]=t,this.onRelationsIndexed.trigger({modelID:e.uuid,relationsMap:t})}async process(e){if(!e.hasProperties)throw new Error("FragmentsGroup properties not found");let t=this.relationMaps[e.uuid];if(t)return t;t=new Map;for(const s of this._ifcRels){const i=await e.getAllPropertiesOfType(s);if(!i)continue;const n=this._relToAttributesMap.get(s);if(!n)continue;const{forRelated:r,forRelating:o}=n;for(const a in i){const c=i[a];this.indexRelations(t,c,r,o)}}return this.setRelationMap(e,t),t}async processFromWebIfc(e,t){const s=new Map;for(const i of this._ifcRels){const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:r,forRelating:o}=n,a=e.GetLineIDsWithType(t,i);for(let c=0;cC.startsWith("Related")),E=u.find(C=>C.startsWith("Relating"));if(!(f&&E))continue;I[f]=[...h].map(C=>new pt(C)),I[E]=new pt(a),await t.setData(i,I)}else{const I=await t.createIfcRel(i,r,a,[...h]);if(!I)continue;c.relID=I.expressID}}}}addEntitiesRelation(e,t,s,...i){const{type:n,inv:r}=s,o=this.relationMaps[e.uuid];if(!o||!this._ifcRels.includes(n))return;const a=qr.get(n);if(!a)return;const{forRelated:c,forRelating:h}=a;if(!(c===r||h===r))return;let d=this._changeMap[e.uuid];d||(d=new St,this._changeMap[e.uuid]=d);const I=h===r?[t]:i,u=c===r?[t]:i;let f=d.get(n);f||(f=new St,f.onItemSet.add(()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:I,relatedIDs:u})),f.onItemUpdated.add(()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:I,relatedIDs:u})),d.set(n,f));for(const E of I){let C=f.get(E);C||(C={related:new Tt},f.set(E,C)),C.related.add(...u)}for(const E of I){let C=o.get(E);C||(C=new Map,o.set(E,C));const T=this.getAttributeIndex(h);if(T!==null){let m=C.get(T);m||(m=[],C.set(T,m)),m.push(...u)}}for(const E of u){let C=o.get(E);C||(C=new Map,o.set(E,C));const T=this.getAttributeIndex(c);if(T===null)continue;let m=C.get(T);m||(m=[],C.set(T,m)),m.push(...I)}}getEntityChildren(e,t,s=new Set){if(s.add(t),this.relationMaps[e.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const i=this.getEntityRelations(e,t,"IsDecomposedBy");if(i)for(const r of i)this.getEntityChildren(e,r,s);const n=this.getEntityRelations(e,t,"ContainsElements");if(n)for(const r of n)this.getEntityChildren(e,r,s);return s}};p(Wo,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let rt=Wo;const Xo=class jo extends Ae{constructor(e){super(e),p(this,"onDisposed",new $),p(this,"onFragmentsLoaded",new $),p(this,"onFragmentsDisposed",new $),p(this,"list",new St),p(this,"groups",new St),p(this,"baseCoordinationModel",""),p(this,"baseCoordinationMatrix",new Ee),p(this,"enabled",!0),p(this,"_loader",new Io),this.components.add(jo.uuid,this)}get meshes(){const e=[];for(const[t,s]of this.list)e.push(s.mesh);return e}dispose(){for(const[e,t]of this.groups)t.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(e){const{uuid:t}=e,s=[];for(const i of e.items)s.push(i.id),this.list.delete(i.id);e.dispose(!0),this.groups.delete(e.uuid),this.groups.size===0&&(this.baseCoordinationModel="",this.baseCoordinationMatrix=new Ee),this.onFragmentsDisposed.trigger({groupID:t,fragmentIDs:s})}load(e,t){const s={coordinate:!0,...t},{coordinate:i,name:n,properties:r,relationsMap:o}=s,a=this._loader.import(e);t&&(a.isStreamed=t.isStreamed||!1),n&&(a.name=n);for(const c of a.items)c.group=a,this.list.set(c.id,c);return i&&this.coordinate([a]),this.groups.set(a.uuid,a),r&&a.setLocalProperties(r),o&&this.components.get(rt).setRelationMap(a,o),this.onFragmentsLoaded.trigger(a),a}export(e){return this._loader.export(e)}getModelIdMap(e){const t={};for(const s in e){const i=this.list.get(s);if(!(i&&i.group))continue;const n=i.group;n.uuid in t||(t[n.uuid]=new Set);const r=e[s];for(const o of r)t[n.uuid].add(o)}return t}modelIdToFragmentIdMap(e){let t={};for(const s in e){const i=this.groups.get(s);if(!i)continue;const n=e[s],r=i.getFragmentMap(n);t={...t,...r}}return t}guidToFragmentIdMap(e){const t={};for(const[s,i]of this.groups){s in t||(t[s]=new Set);for(const n of e){const r=i.globalToExpressIDs.get(n);r&&t[s].add(r)}}return this.modelIdToFragmentIdMap(t)}fragmentIdMapToGuids(e){const t=[],s=this.getModelIdMap(e);for(const i in s){const n=this.groups.get(i);if(!n)continue;const r=s[i];for(const o of r)for(const[a,c]of n.globalToExpressIDs.entries())if(c===o){t.push(a);break}}return t}coordinate(e=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const t=e.pop();if(!t)return;this.baseCoordinationModel=t.uuid,this.baseCoordinationMatrix=t.coordinationMatrix.clone()}if(e.length)for(const t of e)t.coordinationMatrix.equals(this.baseCoordinationMatrix)||(t.position.set(0,0,0),t.rotation.set(0,0,0),t.scale.set(1,1,1),t.updateMatrix(),this.applyBaseCoordinateSystem(t,t.coordinationMatrix))}applyBaseCoordinateSystem(e,t){t&&e.applyMatrix4(t.clone().invert()),e.applyMatrix4(this.baseCoordinationMatrix)}clone(e,t){const s=e.cloneGroup(t);this.groups.set(s.uuid,s);for(const i of s.items)this.list.set(i.id,i);return s}};p(Xo,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let Re=Xo;var fi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fh(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}function pi(l){throw new Error('Could not dynamically require "'+l+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Zo={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/(function(l,e){(function(t){l.exports=t()})(function(){return function t(s,i,n){function r(c,h){if(!i[c]){if(!s[c]){var d=typeof pi=="function"&πif(!h&&d)return d(c,!0);if(o)return o(c,!0);var I=new Error("Cannot find module '"+c+"'");throw I.code="MODULE_NOT_FOUND",I}var u=i[c]={exports:{}};s[c][0].call(u.exports,function(f){var E=s[c][1][f];return r(E||f)},u,u.exports,t,s,i,n)}return i[c].exports}for(var o=typeof pi=="function"&&pi,a=0;a>2,u=(3&c)<<4|h>>4,f=1>6:64,E=2>4,h=(15&I)<<4|(u=o.indexOf(a.charAt(E++)))>>2,d=(3&u)<<6|(f=o.indexOf(a.charAt(E++))),m[C++]=c,u!==64&&(m[C++]=h),f!==64&&(m[C++]=d);return m}},{"./support":30,"./utils":32}],2:[function(t,s,i){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function c(h,d,I,u,f){this.compressedSize=h,this.uncompressedSize=d,this.crc32=I,this.compression=u,this.compressedContent=f}c.prototype={getContentWorker:function(){var h=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,d,I){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(d.compressWorker(I)).pipe(new a("compressedSize")).withStreamInfo("compression",d)},s.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,s,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,s,i){var n=t("./utils"),r=function(){for(var o,a=[],c=0;c<256;c++){o=c;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[c]=o}return a}();s.exports=function(o,a){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(c,h,d,I){var u=r,f=I+d;c^=-1;for(var E=I;E>>8^u[255&(c^h[E])];return-1^c}(0|a,o,o.length,0):function(c,h,d,I){var u=r,f=I+d;c^=-1;for(var E=I;E>>8^u[255&(c^h.charCodeAt(E))];return-1^c}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(t,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,s,i){var n=null;n=typeof Promise<"u"?Promise:t("lie"),s.exports={Promise:n}},{lie:37}],7:[function(t,s,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=t("pako"),o=t("./utils"),a=t("./stream/GenericWorker"),c=n?"uint8array":"array";function h(d,I){a.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=I,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,d.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(I){d.push({data:I,meta:d.meta})}},i.compressWorker=function(d){return new h("Deflate",d)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,s,i){function n(u,f){var E,C="";for(E=0;E>>=8;return C}function r(u,f,E,C,T,m){var A,R,S=u.file,L=u.compression,y=m!==c.utf8encode,w=o.transformTo("string",m(S.name)),P=o.transformTo("string",c.utf8encode(S.name)),M=S.comment,B=o.transformTo("string",m(M)),O=o.transformTo("string",c.utf8encode(M)),v=P.length!==S.name.length,g=O.length!==M.length,b="",Z="",z="",J=S.dir,X=S.date,ne={crc32:0,compressedSize:0,uncompressedSize:0};f&&!E||(ne.crc32=u.crc32,ne.compressedSize=u.compressedSize,ne.uncompressedSize=u.uncompressedSize);var V=0;f&&(V|=8),y||!v&&!g||(V|=2048);var Y=0,ie=0;J&&(Y|=16),T==="UNIX"?(ie=798,Y|=function(K,Fe){var Ne=K;return K||(Ne=Fe?16893:33204),(65535&Ne)<<16}(S.unixPermissions,J)):(ie=20,Y|=function(K){return 63&(K||0)}(S.dosPermissions)),A=X.getUTCHours(),A<<=6,A|=X.getUTCMinutes(),A<<=5,A|=X.getUTCSeconds()/2,R=X.getUTCFullYear()-1980,R<<=4,R|=X.getUTCMonth()+1,R<<=5,R|=X.getUTCDate(),v&&(Z=n(1,1)+n(h(w),4)+P,b+="up"+n(Z.length,2)+Z),g&&(z=n(1,1)+n(h(B),4)+O,b+="uc"+n(z.length,2)+z);var ee="";return ee+=` +\0`,ee+=n(V,2),ee+=L.magic,ee+=n(A,2),ee+=n(R,2),ee+=n(ne.crc32,4),ee+=n(ne.compressedSize,4),ee+=n(ne.uncompressedSize,4),ee+=n(w.length,2),ee+=n(b.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ee+w+b,dirRecord:d.CENTRAL_FILE_HEADER+n(ie,2)+ee+n(B.length,2)+"\0\0\0\0"+n(Y,4)+n(C,4)+w+b+B}}var o=t("../utils"),a=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),d=t("../signature");function I(u,f,E,C){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=f,this.zipPlatform=E,this.encodeFileName=C,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(I,a),I.prototype.push=function(u){var f=u.meta.percent||0,E=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,a.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:E?(f+100*(E-C-1))/E:100}}))},I.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var f=this.streamFiles&&!u.file.dir;if(f){var E=r(u,f,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:E.fileRecord,meta:{percent:0}})}else this.accumulate=!0},I.prototype.closedSource=function(u){this.accumulate=!1;var f=this.streamFiles&&!u.file.dir,E=r(u,f,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(E.dirRecord),f)this.push({data:function(C){return d.DATA_DESCRIPTOR+n(C.crc32,4)+n(C.compressedSize,4)+n(C.uncompressedSize,4)}(u),meta:{percent:100}});else for(this.push({data:E.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},I.prototype.flush=function(){for(var u=this.bytesWritten,f=0;f=this.index;a--)c=(c<<8)+this.byteAt(a);return this.index+=o,c},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},s.exports=r},{"../utils":32}],19:[function(t,s,i){var n=t("./Uint8ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},s.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,s,i){var n=t("./DataReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},r.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},r.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},s.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,s,i){var n=t("./ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},s.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,s,i){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");s.exports=function(d){var I=n.getTypeOf(d);return n.checkSupport(I),I!=="string"||r.uint8array?I==="nodebuffer"?new c(d):r.uint8array?new h(n.transformTo("uint8array",d)):new o(n.transformTo("array",d)):new a(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,s,i){var n=t("./GenericWorker"),r=t("../utils");function o(a){n.call(this,"ConvertWorker to "+a),this.destType=a}r.inherits(o,n),o.prototype.processChunk=function(a){this.push({data:r.transformTo(this.destType,a.data),meta:a.meta})},s.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,s,i){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(a){this.streamInfo.crc32=r(a.data,this.streamInfo.crc32||0),this.push(a)},s.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}n.inherits(o,r),o.prototype.processChunk=function(a){if(a){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+a.data.length}r.prototype.processChunk.call(this,a)},s.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=n.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,c);break;case"uint8array":a=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":a=this.data.slice(this.index,c)}return this.index=c,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,s,i){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,o){return this._listeners[r].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,o){if(this._listeners[r])for(var a=0;a "+r:r}},s.exports=n},{}],29:[function(t,s,i){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),c=t("../support"),h=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function I(f,E){return new h.Promise(function(C,T){var m=[],A=f._internalType,R=f._outputType,S=f._mimeType;f.on("data",function(L,y){m.push(L),E&&E(y)}).on("error",function(L){m=[],T(L)}).on("end",function(){try{var L=function(y,w,P){switch(y){case"blob":return n.newBlob(n.transformTo("arraybuffer",w),P);case"base64":return a.encode(w);default:return n.transformTo(y,w)}}(R,function(y,w){var P,M=0,B=null,O=0;for(P=0;P"u")i.blob=!1;else{var n=new ArrayBuffer(0);try{i.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),i.blob=r.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,s,i){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),a=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function d(){a.call(this,"utf-8 decode"),this.leftOver=null}function I(){a.call(this,"utf-8 encode")}i.utf8encode=function(u){return r.nodebuffer?o.newBufferFrom(u,"utf-8"):function(f){var E,C,T,m,A,R=f.length,S=0;for(m=0;m>>6:(C<65536?E[A++]=224|C>>>12:(E[A++]=240|C>>>18,E[A++]=128|C>>>12&63),E[A++]=128|C>>>6&63),E[A++]=128|63&C);return E}(u)},i.utf8decode=function(u){return r.nodebuffer?n.transformTo("nodebuffer",u).toString("utf-8"):function(f){var E,C,T,m,A=f.length,R=new Array(2*A);for(E=C=0;E>10&1023,R[C++]=56320|1023&T)}return R.length!==C&&(R.subarray?R=R.subarray(0,C):R.length=C),n.applyFromCharCode(R)}(u=n.transformTo(r.uint8array?"uint8array":"array",u))},n.inherits(d,a),d.prototype.processChunk=function(u){var f=n.transformTo(r.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var E=f;(f=new Uint8Array(E.length+this.leftOver.length)).set(this.leftOver,0),f.set(E,this.leftOver.length)}else f=this.leftOver.concat(f);this.leftOver=null}var C=function(m,A){var R;for((A=A||m.length)>m.length&&(A=m.length),R=A-1;0<=R&&(192&m[R])==128;)R--;return R<0||R===0?A:R+c[m[R]]>A?R:A}(f),T=f;C!==f.length&&(r.uint8array?(T=f.subarray(0,C),this.leftOver=f.subarray(C,f.length)):(T=f.slice(0,C),this.leftOver=f.slice(C,f.length))),this.push({data:i.utf8decode(T),meta:u.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,n.inherits(I,a),I.prototype.processChunk=function(u){this.push({data:i.utf8encode(u.data),meta:u.meta})},i.Utf8EncodeWorker=I},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,s,i){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function c(E){return E}function h(E,C){for(var T=0;T>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var f,E,C,T=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4>>6:(u<65536?I[C++]=224|u>>>12:(I[C++]=240|u>>>18,I[C++]=128|u>>>12&63),I[C++]=128|u>>>6&63),I[C++]=128|63&u);return I},i.buf2binstring=function(d){return h(d,d.length)},i.binstring2buf=function(d){for(var I=new n.Buf8(d.length),u=0,f=I.length;u>10&1023,m[f++]=56320|1023&E)}return h(m,f)},i.utf8border=function(d,I){var u;for((I=I||d.length)>d.length&&(I=d.length),u=I-1;0<=u&&(192&d[u])==128;)u--;return u<0||u===0?I:u+a[d[u]]>I?u:I}},{"./common":41}],43:[function(t,s,i){s.exports=function(n,r,o,a){for(var c=65535&n|0,h=n>>>16&65535|0,d=0;o!==0;){for(o-=d=2e3>>1:r>>>1;o[a]=r}return o}();s.exports=function(r,o,a,c){var h=n,d=c+a;r^=-1;for(var I=c;I>>8^h[255&(r^o[I])];return-1^r}},{}],46:[function(t,s,i){var n,r=t("../utils/common"),o=t("./trees"),a=t("./adler32"),c=t("./crc32"),h=t("./messages"),d=0,I=4,u=0,f=-2,E=-1,C=4,T=2,m=8,A=9,R=286,S=30,L=19,y=2*R+1,w=15,P=3,M=258,B=M+P+1,O=42,v=113,g=1,b=2,Z=3,z=4;function J(F,H){return F.msg=h[H],H}function X(F){return(F<<1)-(4F.avail_out&&(G=F.avail_out),G!==0&&(r.arraySet(F.output,H.pending_buf,H.pending_out,G,F.next_out),F.next_out+=G,H.pending_out+=G,F.total_out+=G,F.avail_out-=G,H.pending-=G,H.pending===0&&(H.pending_out=0))}function Y(F,H){o._tr_flush_block(F,0<=F.block_start?F.block_start:-1,F.strstart-F.block_start,H),F.block_start=F.strstart,V(F.strm)}function ie(F,H){F.pending_buf[F.pending++]=H}function ee(F,H){F.pending_buf[F.pending++]=H>>>8&255,F.pending_buf[F.pending++]=255&H}function K(F,H){var G,_,N=F.max_chain_length,D=F.strstart,W=F.prev_length,j=F.nice_match,U=F.strstart>F.w_size-B?F.strstart-(F.w_size-B):0,q=F.window,te=F.w_mask,Q=F.prev,oe=F.strstart+M,Te=q[D+W-1],de=q[D+W];F.prev_length>=F.good_match&&(N>>=2),j>F.lookahead&&(j=F.lookahead);do if(q[(G=H)+W]===de&&q[G+W-1]===Te&&q[G]===q[D]&&q[++G]===q[D+1]){D+=2,G++;do;while(q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&q[++D]===q[++G]&&DU&&--N!=0);return W<=F.lookahead?W:F.lookahead}function Fe(F){var H,G,_,N,D,W,j,U,q,te,Q=F.w_size;do{if(N=F.window_size-F.lookahead-F.strstart,F.strstart>=Q+(Q-B)){for(r.arraySet(F.window,F.window,Q,Q,0),F.match_start-=Q,F.strstart-=Q,F.block_start-=Q,H=G=F.hash_size;_=F.head[--H],F.head[H]=Q<=_?_-Q:0,--G;);for(H=G=Q;_=F.prev[--H],F.prev[H]=Q<=_?_-Q:0,--G;);N+=Q}if(F.strm.avail_in===0)break;if(W=F.strm,j=F.window,U=F.strstart+F.lookahead,q=N,te=void 0,te=W.avail_in,q=P)for(D=F.strstart-F.insert,F.ins_h=F.window[D],F.ins_h=(F.ins_h<=P&&(F.ins_h=(F.ins_h<=P)if(_=o._tr_tally(F,F.strstart-F.match_start,F.match_length-P),F.lookahead-=F.match_length,F.match_length<=F.max_lazy_match&&F.lookahead>=P){for(F.match_length--;F.strstart++,F.ins_h=(F.ins_h<=P&&(F.ins_h=(F.ins_h<=P&&F.match_length<=F.prev_length){for(N=F.strstart+F.lookahead-P,_=o._tr_tally(F,F.strstart-1-F.prev_match,F.prev_length-P),F.lookahead-=F.prev_length-1,F.prev_length-=2;++F.strstart<=N&&(F.ins_h=(F.ins_h<F.pending_buf_size-5&&(G=F.pending_buf_size-5);;){if(F.lookahead<=1){if(Fe(F),F.lookahead===0&&H===d)return g;if(F.lookahead===0)break}F.strstart+=F.lookahead,F.lookahead=0;var _=F.block_start+G;if((F.strstart===0||F.strstart>=_)&&(F.lookahead=F.strstart-_,F.strstart=_,Y(F,!1),F.strm.avail_out===0)||F.strstart-F.block_start>=F.w_size-B&&(Y(F,!1),F.strm.avail_out===0))return g}return F.insert=0,H===I?(Y(F,!0),F.strm.avail_out===0?Z:z):(F.strstart>F.block_start&&(Y(F,!1),F.strm.avail_out),g)}),new ue(4,4,8,4,Ne),new ue(4,5,16,8,Ne),new ue(4,6,32,32,Ne),new ue(4,4,16,16,re),new ue(8,16,32,32,re),new ue(8,16,128,128,re),new ue(8,32,128,256,re),new ue(32,128,258,1024,re),new ue(32,258,258,4096,re)],i.deflateInit=function(F,H){return Me(F,H,m,15,8,0)},i.deflateInit2=Me,i.deflateReset=We,i.deflateResetKeep=pe,i.deflateSetHeader=function(F,H){return F&&F.state?F.state.wrap!==2?f:(F.state.gzhead=H,u):f},i.deflate=function(F,H){var G,_,N,D;if(!F||!F.state||5>8&255),ie(_,_.gzhead.time>>16&255),ie(_,_.gzhead.time>>24&255),ie(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),ie(_,255&_.gzhead.os),_.gzhead.extra&&_.gzhead.extra.length&&(ie(_,255&_.gzhead.extra.length),ie(_,_.gzhead.extra.length>>8&255)),_.gzhead.hcrc&&(F.adler=c(F.adler,_.pending_buf,_.pending,0)),_.gzindex=0,_.status=69):(ie(_,0),ie(_,0),ie(_,0),ie(_,0),ie(_,0),ie(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),ie(_,3),_.status=v);else{var W=m+(_.w_bits-8<<4)<<8;W|=(2<=_.strategy||_.level<2?0:_.level<6?1:_.level===6?2:3)<<6,_.strstart!==0&&(W|=32),W+=31-W%31,_.status=v,ee(_,W),_.strstart!==0&&(ee(_,F.adler>>>16),ee(_,65535&F.adler)),F.adler=1}if(_.status===69)if(_.gzhead.extra){for(N=_.pending;_.gzindex<(65535&_.gzhead.extra.length)&&(_.pending!==_.pending_buf_size||(_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),V(F),N=_.pending,_.pending!==_.pending_buf_size));)ie(_,255&_.gzhead.extra[_.gzindex]),_.gzindex++;_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),_.gzindex===_.gzhead.extra.length&&(_.gzindex=0,_.status=73)}else _.status=73;if(_.status===73)if(_.gzhead.name){N=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),V(F),N=_.pending,_.pending===_.pending_buf_size)){D=1;break}D=_.gzindex<_.gzhead.name.length?255&_.gzhead.name.charCodeAt(_.gzindex++):0,ie(_,D)}while(D!==0);_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),D===0&&(_.gzindex=0,_.status=91)}else _.status=91;if(_.status===91)if(_.gzhead.comment){N=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),V(F),N=_.pending,_.pending===_.pending_buf_size)){D=1;break}D=_.gzindex<_.gzhead.comment.length?255&_.gzhead.comment.charCodeAt(_.gzindex++):0,ie(_,D)}while(D!==0);_.gzhead.hcrc&&_.pending>N&&(F.adler=c(F.adler,_.pending_buf,_.pending-N,N)),D===0&&(_.status=103)}else _.status=103;if(_.status===103&&(_.gzhead.hcrc?(_.pending+2>_.pending_buf_size&&V(F),_.pending+2<=_.pending_buf_size&&(ie(_,255&F.adler),ie(_,F.adler>>8&255),F.adler=0,_.status=v)):_.status=v),_.pending!==0){if(V(F),F.avail_out===0)return _.last_flush=-1,u}else if(F.avail_in===0&&X(H)<=X(G)&&H!==I)return J(F,-5);if(_.status===666&&F.avail_in!==0)return J(F,-5);if(F.avail_in!==0||_.lookahead!==0||H!==d&&_.status!==666){var j=_.strategy===2?function(U,q){for(var te;;){if(U.lookahead===0&&(Fe(U),U.lookahead===0)){if(q===d)return g;break}if(U.match_length=0,te=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,te&&(Y(U,!1),U.strm.avail_out===0))return g}return U.insert=0,q===I?(Y(U,!0),U.strm.avail_out===0?Z:z):U.last_lit&&(Y(U,!1),U.strm.avail_out===0)?g:b}(_,H):_.strategy===3?function(U,q){for(var te,Q,oe,Te,de=U.window;;){if(U.lookahead<=M){if(Fe(U),U.lookahead<=M&&q===d)return g;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=P&&0U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=P?(te=o._tr_tally(U,1,U.match_length-P),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(te=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),te&&(Y(U,!1),U.strm.avail_out===0))return g}return U.insert=0,q===I?(Y(U,!0),U.strm.avail_out===0?Z:z):U.last_lit&&(Y(U,!1),U.strm.avail_out===0)?g:b}(_,H):n[_.level].func(_,H);if(j!==Z&&j!==z||(_.status=666),j===g||j===Z)return F.avail_out===0&&(_.last_flush=-1),u;if(j===b&&(H===1?o._tr_align(_):H!==5&&(o._tr_stored_block(_,0,0,!1),H===3&&(ne(_.head),_.lookahead===0&&(_.strstart=0,_.block_start=0,_.insert=0))),V(F),F.avail_out===0))return _.last_flush=-1,u}return H!==I?u:_.wrap<=0?1:(_.wrap===2?(ie(_,255&F.adler),ie(_,F.adler>>8&255),ie(_,F.adler>>16&255),ie(_,F.adler>>24&255),ie(_,255&F.total_in),ie(_,F.total_in>>8&255),ie(_,F.total_in>>16&255),ie(_,F.total_in>>24&255)):(ee(_,F.adler>>>16),ee(_,65535&F.adler)),V(F),0<_.wrap&&(_.wrap=-_.wrap),_.pending!==0?u:1)},i.deflateEnd=function(F){var H;return F&&F.state?(H=F.state.status)!==O&&H!==69&&H!==73&&H!==91&&H!==103&&H!==v&&H!==666?J(F,f):(F.state=null,H===v?J(F,-3):u):f},i.deflateSetDictionary=function(F,H){var G,_,N,D,W,j,U,q,te=H.length;if(!F||!F.state||(D=(G=F.state).wrap)===2||D===1&&G.status!==O||G.lookahead)return f;for(D===1&&(F.adler=a(F.adler,H,te,0)),G.wrap=0,te>=G.w_size&&(D===0&&(ne(G.head),G.strstart=0,G.block_start=0,G.insert=0),q=new r.Buf8(G.w_size),r.arraySet(q,H,te-G.w_size,G.w_size,0),H=q,te=G.w_size),W=F.avail_in,j=F.next_in,U=F.input,F.avail_in=te,F.next_in=0,F.input=H,Fe(G);G.lookahead>=P;){for(_=G.strstart,N=G.lookahead-(P-1);G.ins_h=(G.ins_h<>>=P=w>>>24,A-=P,(P=w>>>16&255)===0)b[h++]=65535&w;else{if(!(16&P)){if(!(64&P)){w=R[(65535&w)+(m&(1<>>=P,A-=P),A<15&&(m+=g[a++]<>>=P=w>>>24,A-=P,!(16&(P=w>>>16&255))){if(!(64&P)){w=S[(65535&w)+(m&(1<>>=P,A-=P,(P=h-d)>3,m&=(1<<(A-=M<<3))-1,n.next_in=a,n.next_out=h,n.avail_in=a>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function A(O){var v;return O&&O.state?(v=O.state,O.total_in=O.total_out=v.total=0,O.msg="",v.wrap&&(O.adler=1&v.wrap),v.mode=f,v.last=0,v.havedict=0,v.dmax=32768,v.head=null,v.hold=0,v.bits=0,v.lencode=v.lendyn=new n.Buf32(E),v.distcode=v.distdyn=new n.Buf32(C),v.sane=1,v.back=-1,I):u}function R(O){var v;return O&&O.state?((v=O.state).wsize=0,v.whave=0,v.wnext=0,A(O)):u}function S(O,v){var g,b;return O&&O.state?(b=O.state,v<0?(g=0,v=-v):(g=1+(v>>4),v<48&&(v&=15)),v&&(v<8||15=z.wsize?(n.arraySet(z.window,v,g-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(b<(Z=z.wsize-z.wnext)&&(Z=b),n.arraySet(z.window,v,g-b,Z,z.wnext),(b-=Z)?(n.arraySet(z.window,v,g-b,b,0),z.wnext=b,z.whave=z.wsize):(z.wnext+=Z,z.wnext===z.wsize&&(z.wnext=0),z.whave>>8&255,g.check=o(g.check,D,2,0),Y=V=0,g.mode=2;break}if(g.flags=0,g.head&&(g.head.done=!1),!(1&g.wrap)||(((255&V)<<8)+(V>>8))%31){O.msg="incorrect header check",g.mode=30;break}if((15&V)!=8){O.msg="unknown compression method",g.mode=30;break}if(Y-=4,F=8+(15&(V>>>=4)),g.wbits===0)g.wbits=F;else if(F>g.wbits){O.msg="invalid window size",g.mode=30;break}g.dmax=1<>8&1),512&g.flags&&(D[0]=255&V,D[1]=V>>>8&255,g.check=o(g.check,D,2,0)),Y=V=0,g.mode=3;case 3:for(;Y<32;){if(X===0)break e;X--,V+=b[z++]<>>8&255,D[2]=V>>>16&255,D[3]=V>>>24&255,g.check=o(g.check,D,4,0)),Y=V=0,g.mode=4;case 4:for(;Y<16;){if(X===0)break e;X--,V+=b[z++]<>8),512&g.flags&&(D[0]=255&V,D[1]=V>>>8&255,g.check=o(g.check,D,2,0)),Y=V=0,g.mode=5;case 5:if(1024&g.flags){for(;Y<16;){if(X===0)break e;X--,V+=b[z++]<>>8&255,g.check=o(g.check,D,2,0)),Y=V=0}else g.head&&(g.head.extra=null);g.mode=6;case 6:if(1024&g.flags&&(X<(K=g.length)&&(K=X),K&&(g.head&&(F=g.head.extra_len-g.length,g.head.extra||(g.head.extra=new Array(g.head.extra_len)),n.arraySet(g.head.extra,b,z,K,F)),512&g.flags&&(g.check=o(g.check,b,K,z)),X-=K,z+=K,g.length-=K),g.length))break e;g.length=0,g.mode=7;case 7:if(2048&g.flags){if(X===0)break e;for(K=0;F=b[z+K++],g.head&&F&&g.length<65536&&(g.head.name+=String.fromCharCode(F)),F&&K>9&1,g.head.done=!0),O.adler=g.check=0,g.mode=12;break;case 10:for(;Y<32;){if(X===0)break e;X--,V+=b[z++]<>>=7&Y,Y-=7&Y,g.mode=27;break}for(;Y<3;){if(X===0)break e;X--,V+=b[z++]<>>=1)){case 0:g.mode=14;break;case 1:if(M(g),g.mode=20,v!==6)break;V>>>=2,Y-=2;break e;case 2:g.mode=17;break;case 3:O.msg="invalid block type",g.mode=30}V>>>=2,Y-=2;break;case 14:for(V>>>=7&Y,Y-=7&Y;Y<32;){if(X===0)break e;X--,V+=b[z++]<>>16^65535)){O.msg="invalid stored block lengths",g.mode=30;break}if(g.length=65535&V,Y=V=0,g.mode=15,v===6)break e;case 15:g.mode=16;case 16:if(K=g.length){if(X>>=5,Y-=5,g.ndist=1+(31&V),V>>>=5,Y-=5,g.ncode=4+(15&V),V>>>=4,Y-=4,286>>=3,Y-=3}for(;g.have<19;)g.lens[W[g.have++]]=0;if(g.lencode=g.lendyn,g.lenbits=7,G={bits:g.lenbits},H=c(0,g.lens,0,19,g.lencode,0,g.work,G),g.lenbits=G.bits,H){O.msg="invalid code lengths set",g.mode=30;break}g.have=0,g.mode=19;case 19:for(;g.have>>16&255,he=65535&N,!((re=N>>>24)<=Y);){if(X===0)break e;X--,V+=b[z++]<>>=re,Y-=re,g.lens[g.have++]=he;else{if(he===16){for(_=re+2;Y<_;){if(X===0)break e;X--,V+=b[z++]<>>=re,Y-=re,g.have===0){O.msg="invalid bit length repeat",g.mode=30;break}F=g.lens[g.have-1],K=3+(3&V),V>>>=2,Y-=2}else if(he===17){for(_=re+3;Y<_;){if(X===0)break e;X--,V+=b[z++]<>>=re)),V>>>=3,Y-=3}else{for(_=re+7;Y<_;){if(X===0)break e;X--,V+=b[z++]<>>=re)),V>>>=7,Y-=7}if(g.have+K>g.nlen+g.ndist){O.msg="invalid bit length repeat",g.mode=30;break}for(;K--;)g.lens[g.have++]=F}}if(g.mode===30)break;if(g.lens[256]===0){O.msg="invalid code -- missing end-of-block",g.mode=30;break}if(g.lenbits=9,G={bits:g.lenbits},H=c(h,g.lens,0,g.nlen,g.lencode,0,g.work,G),g.lenbits=G.bits,H){O.msg="invalid literal/lengths set",g.mode=30;break}if(g.distbits=6,g.distcode=g.distdyn,G={bits:g.distbits},H=c(d,g.lens,g.nlen,g.ndist,g.distcode,0,g.work,G),g.distbits=G.bits,H){O.msg="invalid distances set",g.mode=30;break}if(g.mode=20,v===6)break e;case 20:g.mode=21;case 21:if(6<=X&&258<=ne){O.next_out=J,O.avail_out=ne,O.next_in=z,O.avail_in=X,g.hold=V,g.bits=Y,a(O,ee),J=O.next_out,Z=O.output,ne=O.avail_out,z=O.next_in,b=O.input,X=O.avail_in,V=g.hold,Y=g.bits,g.mode===12&&(g.back=-1);break}for(g.back=0;ue=(N=g.lencode[V&(1<>>16&255,he=65535&N,!((re=N>>>24)<=Y);){if(X===0)break e;X--,V+=b[z++]<>pe)])>>>16&255,he=65535&N,!(pe+(re=N>>>24)<=Y);){if(X===0)break e;X--,V+=b[z++]<>>=pe,Y-=pe,g.back+=pe}if(V>>>=re,Y-=re,g.back+=re,g.length=he,ue===0){g.mode=26;break}if(32&ue){g.back=-1,g.mode=12;break}if(64&ue){O.msg="invalid literal/length code",g.mode=30;break}g.extra=15&ue,g.mode=22;case 22:if(g.extra){for(_=g.extra;Y<_;){if(X===0)break e;X--,V+=b[z++]<>>=g.extra,Y-=g.extra,g.back+=g.extra}g.was=g.length,g.mode=23;case 23:for(;ue=(N=g.distcode[V&(1<>>16&255,he=65535&N,!((re=N>>>24)<=Y);){if(X===0)break e;X--,V+=b[z++]<>pe)])>>>16&255,he=65535&N,!(pe+(re=N>>>24)<=Y);){if(X===0)break e;X--,V+=b[z++]<>>=pe,Y-=pe,g.back+=pe}if(V>>>=re,Y-=re,g.back+=re,64&ue){O.msg="invalid distance code",g.mode=30;break}g.offset=he,g.extra=15&ue,g.mode=24;case 24:if(g.extra){for(_=g.extra;Y<_;){if(X===0)break e;X--,V+=b[z++]<>>=g.extra,Y-=g.extra,g.back+=g.extra}if(g.offset>g.dmax){O.msg="invalid distance too far back",g.mode=30;break}g.mode=25;case 25:if(ne===0)break e;if(K=ee-ne,g.offset>K){if((K=g.offset-K)>g.whave&&g.sane){O.msg="invalid distance too far back",g.mode=30;break}Fe=K>g.wnext?(K-=g.wnext,g.wsize-K):g.wnext-K,K>g.length&&(K=g.length),Ne=g.window}else Ne=Z,Fe=J-g.offset,K=g.length;for(ney?(P=Fe[Ne+C[v]],Y[ie+C[v]]):(P=96,0),m=1<>J)+(A-=m)]=w<<24|P<<16|M|0,A!==0;);for(m=1<>=1;if(m!==0?(V&=m-1,V+=m):V=0,v++,--ee[O]==0){if(O===b)break;O=d[I+C[v]]}if(Z>>7)]}function ie(N,D){N.pending_buf[N.pending++]=255&D,N.pending_buf[N.pending++]=D>>>8&255}function ee(N,D,W){N.bi_valid>T-W?(N.bi_buf|=D<>T-N.bi_valid,N.bi_valid+=W-T):(N.bi_buf|=D<>>=1,W<<=1,0<--D;);return W>>>1}function Ne(N,D,W){var j,U,q=new Array(C+1),te=0;for(j=1;j<=C;j++)q[j]=te=te+W[j-1]<<1;for(U=0;U<=D;U++){var Q=N[2*U+1];Q!==0&&(N[2*U]=Fe(q[Q]++,Q))}}function re(N){var D;for(D=0;D>1;1<=W;W--)pe(N,q,W);for(U=oe;W=N.heap[1],N.heap[1]=N.heap[N.heap_len--],pe(N,q,1),j=N.heap[1],N.heap[--N.heap_max]=W,N.heap[--N.heap_max]=j,q[2*U]=q[2*W]+q[2*j],N.depth[U]=(N.depth[W]>=N.depth[j]?N.depth[W]:N.depth[j])+1,q[2*W+1]=q[2*j+1]=U,N.heap[1]=U++,pe(N,q,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],function(de,Xe){var fs,ot,ps,ye,ks,xi,dt=Xe.dyn_tree,rr=Xe.max_code,ya=Xe.stat_desc.static_tree,La=Xe.stat_desc.has_stree,Pa=Xe.stat_desc.extra_bits,or=Xe.stat_desc.extra_base,Cs=Xe.stat_desc.max_length,Hs=0;for(ye=0;ye<=C;ye++)de.bl_count[ye]=0;for(dt[2*de.heap[de.heap_max]+1]=0,fs=de.heap_max+1;fs>=7;U>>=1)if(1&Te&&Q.dyn_ltree[2*oe]!==0)return r;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return o;for(oe=32;oe>>3,(q=N.static_len+3+7>>>3)<=U&&(U=q)):U=q=W+5,W+4<=U&&D!==-1?_(N,D,W,j):N.strategy===4||q===U?(ee(N,2+(j?1:0),3),We(N,B,O)):(ee(N,4+(j?1:0),3),function(Q,oe,Te,de){var Xe;for(ee(Q,oe-257,5),ee(Q,Te-1,5),ee(Q,de-4,4),Xe=0;Xe>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&D,N.pending_buf[N.l_buf+N.last_lit]=255&W,N.last_lit++,D===0?N.dyn_ltree[2*W]++:(N.matches++,D--,N.dyn_ltree[2*(g[W]+d+1)]++,N.dyn_dtree[2*Y(D)]++),N.last_lit===N.lit_bufsize-1},i._tr_align=function(N){ee(N,2,3),K(N,A,B),function(D){D.bi_valid===16?(ie(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(N)}},{"../utils/common":41}],53:[function(t,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,s,i){(function(n){(function(r,o){if(!r.setImmediate){var a,c,h,d,I=1,u={},f=!1,E=r.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(r);C=C&&C.setTimeout?C:r,a={}.toString.call(r.process)==="[object process]"?function(R){process.nextTick(function(){m(R)})}:function(){if(r.postMessage&&!r.importScripts){var R=!0,S=r.onmessage;return r.onmessage=function(){R=!1},r.postMessage("","*"),r.onmessage=S,R}}()?(d="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",A,!1):r.attachEvent("onmessage",A),function(R){r.postMessage(d+R,"*")}):r.MessageChannel?((h=new MessageChannel).port1.onmessage=function(R){m(R.data)},function(R){h.port2.postMessage(R)}):E&&"onreadystatechange"in E.createElement("script")?(c=E.documentElement,function(R){var S=E.createElement("script");S.onreadystatechange=function(){m(R),S.onreadystatechange=null,c.removeChild(S),S=null},c.appendChild(S)}):function(R){setTimeout(m,0,R)},C.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var S=new Array(arguments.length-1),L=0;L"u"?n===void 0?this:n:self)}).call(this,typeof fi<"u"?fi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Zo);var ph=Zo.exports;const Qr=fh(ph);var sr={},bi={};(function(l){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+e+"]["+t+"]*",i=new RegExp("^"+s+"$"),n=function(o,a){const c=[];let h=a.exec(o);for(;h;){const d=[];d.startIndex=a.lastIndex-h[0].length;const I=h.length;for(let u=0;u"u")};l.isExist=function(o){return typeof o<"u"},l.isEmptyObject=function(o){return Object.keys(o).length===0},l.merge=function(o,a,c){if(a){const h=Object.keys(a),d=h.length;for(let I=0;I"&&l[n]!==" "&&l[n]!==" "&&l[n]!==` +`&&l[n]!=="\r";n++)a+=l[n];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),n--),!Oh(a)){let d;return a.trim().length===0?d="Invalid space after '<'.":d="Tag '"+a+"' is an invalid name.",Le("InvalidTag",d,Be(l,n))}const c=Rh(l,n);if(c===!1)return Le("InvalidAttr","Attributes for '"+a+"' have open quote.",Be(l,n));let h=c.value;if(n=c.index,h[h.length-1]==="/"){const d=n-h.length;h=h.substring(0,h.length-1);const I=to(h,e);if(I===!0)s=!0;else return Le(I.err.code,I.err.msg,Be(l,d+I.err.line))}else if(o)if(c.tagClosed){if(h.trim().length>0)return Le("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",Be(l,r));if(t.length===0)return Le("InvalidTag","Closing tag '"+a+"' has not been opened.",Be(l,r));{const d=t.pop();if(a!==d.tagName){let I=Be(l,d.tagStartPos);return Le("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+I.line+", col "+I.col+") instead of closing tag '"+a+"'.",Be(l,r))}t.length==0&&(i=!0)}}else return Le("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",Be(l,n));else{const d=to(h,e);if(d!==!0)return Le(d.err.code,d.err.msg,Be(l,n-h.length+d.err.line));if(i===!0)return Le("InvalidXml","Multiple possible root nodes found.",Be(l,n));e.unpairedTags.indexOf(a)!==-1||t.push({tagName:a,tagStartPos:r}),s=!0}for(n++;n0)return Le("InvalidXml","Invalid '"+JSON.stringify(t.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Le("InvalidXml","Start tag expected.",1);return!0};function Kr(l){return l===" "||l===" "||l===` +`||l==="\r"}function Jr(l,e){const t=e;for(;e5&&s==="xml")return Le("InvalidXml","XML declaration allowed only at the start of the document.",Be(l,e));if(l[e]=="?"&&l[e+1]==">"){e++;break}else continue}return e}function eo(l,e){if(l.length>e+5&&l[e+1]==="-"&&l[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(l.length>e+8&&l[e+1]==="D"&&l[e+2]==="O"&&l[e+3]==="C"&&l[e+4]==="T"&&l[e+5]==="Y"&&l[e+6]==="P"&&l[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(l.length>e+9&&l[e+1]==="["&&l[e+2]==="C"&&l[e+3]==="D"&&l[e+4]==="A"&&l[e+5]==="T"&&l[e+6]==="A"&&l[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}const Th='"',mh="'";function Rh(l,e){let t="",s="",i=!1;for(;e"&&s===""){i=!0;break}t+=l[e]}return s!==""?!1:{value:t,index:e,tagClosed:i}}const gh=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function to(l,e){const t=ir.getAllMatches(l,gh),s={};for(let i=0;i!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(l,e,t){return l}},Nh=function(l){return Object.assign({},$o,l)};nr.buildOptions=Nh;nr.defaultOptions=$o;class yh{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Lh=yh;const Ph=bi;function _h(l,e){const t={};if(l[e+3]==="O"&&l[e+4]==="C"&&l[e+5]==="T"&&l[e+6]==="Y"&&l[e+7]==="P"&&l[e+8]==="E"){e=e+9;let s=1,i=!1,n=!1,r="";for(;e"){if(n?l[e-1]==="-"&&l[e-2]==="-"&&(n=!1,s--):s--,s===0)break}else l[e]==="["?i=!0:r+=l[e];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function wh(l,e){let t="";for(;e0&&i&&t[2]!=="."||!e.leadingZeros&&n.length>0&&!i&&t[1]!==".")return l;{const a=Number(t),c=""+a;return c.search(/[eE]/)!==-1||o?e.eNotation?a:l:t.indexOf(".")!==-1?c==="0"&&r===""||c===r||i&&c==="-"+r?a:l:n?r===c||i+r===c?a:l:t===c||t===i+c?a:l}}else return l}}function kh(l){return l&&l.indexOf(".")!==-1&&(l=l.replace(/0+$/,""),l==="."?l="0":l[0]==="."?l="0"+l:l[l.length-1]==="."&&(l=l.substr(0,l.length-1))),l}var Hh=zh;const qo=bi,Ms=Lh,Wh=Bh,Xh=Hh;let jh=class{constructor(l){this.options=l,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=Zh,this.parseXml=Jh,this.parseTextData=$h,this.resolveNameSpace=qh,this.buildAttributesMap=Kh,this.isItStopNode=iu,this.replaceEntitiesValue=tu,this.readStopNodeData=ru,this.saveTextToParentTag=su,this.addChild=eu}};function Zh(l){const e=Object.keys(l);for(let t=0;t0)){r||(l=this.replaceEntitiesValue(l));const o=this.options.tagValueProcessor(e,l,t,i,n);return o==null?l:typeof o!=typeof l||o!==l?o:this.options.trimValues?An(l,this.options.parseTagValue,this.options.numberParseOptions):l.trim()===l?An(l,this.options.parseTagValue,this.options.numberParseOptions):l}}function qh(l){if(this.options.removeNSPrefix){const e=l.split(":"),t=l.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(l=t+e[1])}return l}const Qh=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Kh(l,e,t){if(!this.options.ignoreAttributes&&typeof l=="string"){const s=qo.getAllMatches(l,Qh),i=s.length,n={};for(let r=0;r",n,"Closing Tag is not closed.");let o=l.substring(n+2,r).trim();if(this.options.removeNSPrefix){const h=o.indexOf(":");h!==-1&&(o=o.substr(h+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),t&&(s=this.saveTextToParentTag(s,t,i));const a=i.substring(i.lastIndexOf(".")+1);if(o&&this.options.unpairedTags.indexOf(o)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let c=0;a&&this.options.unpairedTags.indexOf(a)!==-1?(c=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=i.lastIndexOf("."),i=i.substring(0,c),t=this.tagsNodeStack.pop(),s="",n=r}else if(l[n+1]==="?"){let r=Sn(l,n,!1,"?>");if(!r)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,t,i),!(this.options.ignoreDeclaration&&r.tagName==="?xml"||this.options.ignorePiTags)){const o=new Ms(r.tagName);o.add(this.options.textNodeName,""),r.tagName!==r.tagExp&&r.attrExpPresent&&(o[":@"]=this.buildAttributesMap(r.tagExp,i,r.tagName)),this.addChild(t,o,i)}n=r.closeIndex+1}else if(l.substr(n+1,3)==="!--"){const r=Yt(l,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){const o=l.substring(n+4,r-2);s=this.saveTextToParentTag(s,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}n=r}else if(l.substr(n+1,2)==="!D"){const r=Wh(l,n);this.docTypeEntities=r.entities,n=r.i}else if(l.substr(n+1,2)==="!["){const r=Yt(l,"]]>",n,"CDATA is not closed.")-2,o=l.substring(n+9,r);s=this.saveTextToParentTag(s,t,i);let a=this.parseTextData(o,t.tagname,i,!0,!1,!0,!0);a==null&&(a=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):t.add(this.options.textNodeName,a),n=r+2}else{let r=Sn(l,n,this.options.removeNSPrefix),o=r.tagName;const a=r.rawTagName;let c=r.tagExp,h=r.attrExpPresent,d=r.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),t&&s&&t.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,t,i,!1));const I=t;if(I&&this.options.unpairedTags.indexOf(I.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),o!==e.tagname&&(i+=i?"."+o:o),this.isItStopNode(this.options.stopNodes,i,o)){let u="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)o[o.length-1]==="/"?(o=o.substr(0,o.length-1),i=i.substr(0,i.length-1),c=o):c=c.substr(0,c.length-1),n=r.closeIndex;else if(this.options.unpairedTags.indexOf(o)!==-1)n=r.closeIndex;else{const E=this.readStopNodeData(l,a,d+1);if(!E)throw new Error(`Unexpected end of ${a}`);n=E.i,u=E.tagContent}const f=new Ms(o);o!==c&&h&&(f[":@"]=this.buildAttributesMap(c,i,o)),u&&(u=this.parseTextData(u,o,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),f.add(this.options.textNodeName,u),this.addChild(t,f,i)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){o[o.length-1]==="/"?(o=o.substr(0,o.length-1),i=i.substr(0,i.length-1),c=o):c=c.substr(0,c.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));const u=new Ms(o);o!==c&&h&&(u[":@"]=this.buildAttributesMap(c,i,o)),this.addChild(t,u,i),i=i.substr(0,i.lastIndexOf("."))}else{const u=new Ms(o);this.tagsNodeStack.push(t),o!==c&&h&&(u[":@"]=this.buildAttributesMap(c,i,o)),this.addChild(t,u,i),t=u}s="",n=d}}else s+=l[n];return e.child};function eu(l,e,t){const s=this.options.updateTag(e.tagname,t,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),l.addChild(e))}const tu=function(l){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];l=l.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];l=l.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];l=l.replace(t.regex,t.val)}l=l.replace(this.ampEntity.regex,this.ampEntity.val)}return l};function su(l,e,t,s){return l&&(s===void 0&&(s=Object.keys(e.child).length===0),l=this.parseTextData(l,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),l!==void 0&&l!==""&&e.add(this.options.textNodeName,l),l=""),l}function iu(l,e,t){const s="*."+t;for(const i in l){const n=l[i];if(s===n||e===n)return!0}return!1}function nu(l,e,t=">"){let s,i="";for(let n=e;n",t,`${e} is not closed`);if(l.substring(t+2,n).trim()===e&&(i--,i===0))return{tagContent:l.substring(s,t),i:n};t=n}else if(l[t+1]==="?")t=Yt(l,"?>",t+1,"StopNode is not closed.");else if(l.substr(t+1,3)==="!--")t=Yt(l,"-->",t+3,"StopNode is not closed.");else if(l.substr(t+1,2)==="![")t=Yt(l,"]]>",t,"StopNode is not closed.")-2;else{const n=Sn(l,t,">");n&&((n&&n.tagName)===e&&n.tagExp[n.tagExp.length-1]!=="/"&&i++,t=n.closeIndex)}}function An(l,e,t){if(e&&typeof l=="string"){const s=l.trim();return s==="true"?!0:s==="false"?!1:Xh(l,t)}else return qo.isExist(l)?l:""}var ou=jh,Qo={};function au(l,e){return Ko(l,e)}function Ko(l,e,t){let s;const i={};for(let n=0;n0&&(i[e.textNodeName]=s):s!==void 0&&(i[e.textNodeName]=s),i}function lu(l){const e=Object.keys(l);for(let t=0;t0&&(t=Cu),Jo(l,e,"",t)}function Jo(l,e,t,s){let i="",n=!1;for(let r=0;r`,n=!1;continue}else if(a===e.commentPropName){i+=s+``,n=!0;continue}else if(a[0]==="?"){const f=so(o[":@"],e),E=a==="?xml"?"":s;let C=o[a][0][e.textNodeName];C=C.length!==0?" "+C:"",i+=E+`<${a}${C}${f}?>`,n=!0;continue}let h=s;h!==""&&(h+=e.indentBy);const d=so(o[":@"],e),I=s+`<${a}${d}`,u=Jo(o[a],e,c,h);e.unpairedTags.indexOf(a)!==-1?e.suppressUnpairedNode?i+=I+">":i+=I+"/>":(!u||u.length===0)&&e.suppressEmptyNode?i+=I+"/>":u&&u.endsWith(">")?i+=I+`>${u}${s}`:(i+=I+">",u&&s!==""&&(u.includes("/>")||u.includes("`),n=!0}return i}function mu(l){const e=Object.keys(l);for(let t=0;t0&&e.processEntities)for(let t=0;t","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Mt(l){this.options=Object.assign({},Su,l),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Nu),this.processTextOrObjNode=Au,this.options.format?(this.indentate=Ou,this.tagEndChar=`> +`,this.newLine=` +`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Mt.prototype.build=function(l){return this.options.preserveOrder?Fu(l,this.options):(Array.isArray(l)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(l={[this.options.arrayNodeName]:l}),this.j2x(l,0).val)};Mt.prototype.j2x=function(l,e){let t="",s="";for(let i in l)if(Object.prototype.hasOwnProperty.call(l,i))if(typeof l[i]>"u")this.isAttribute(i)&&(s+="");else if(l[i]===null)this.isAttribute(i)?s+="":i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(l[i]instanceof Date)s+=this.buildTextValNode(l[i],i,"",e);else if(typeof l[i]!="object"){const n=this.isAttribute(i);if(n)t+=this.buildAttrPairStr(n,""+l[i]);else if(i===this.options.textNodeName){let r=this.options.tagValueProcessor(i,""+l[i]);s+=this.replaceEntitiesValue(r)}else s+=this.buildTextValNode(l[i],i,"",e)}else if(Array.isArray(l[i])){const n=l[i].length;let r="",o="";for(let a=0;a"u"))if(c===null)i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const h=this.j2x(c,e+1);r+=h.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(o+=h.attrStr)}else r+=this.processTextOrObjNode(c,i,e);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(i,c);h=this.replaceEntitiesValue(h),r+=h}else r+=this.buildTextValNode(c,i,"",e)}this.options.oneListGroup&&(r=this.buildObjectNode(r,i,o,e)),s+=r}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const n=Object.keys(l[i]),r=n.length;for(let o=0;o"+l+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&n.length===0?this.indentate(s)+``+this.newLine:this.indentate(s)+"<"+e+t+n+this.tagEndChar+l+this.indentate(s)+i}};Mt.prototype.closeTag=function(l){let e="";return this.options.unpairedTags.indexOf(l)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(s)+``+this.newLine;if(e[0]==="?")return this.indentate(s)+"<"+e+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,l);return i=this.replaceEntitiesValue(i),i===""?this.indentate(s)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+t+">"+i+"0&&this.options.processEntities)for(let e=0;e`);let t=null;this.modifiedDate&&(t=`${this.modifiedDate.toISOString()}`);let s=null;return this.modifiedAuthor&&(s=`${this.modifiedAuthor}`),` + + ${this.date.toISOString()} + ${this.author} + ${this.comment} + ${e??""} + ${s??""} + ${t??""} + + `}}const sa=class Lt{constructor(e){p(this,"guid",vt.create()),p(this,"title",Lt.default.title),p(this,"creationDate",new Date),p(this,"creationAuthor",""),p(this,"viewpoints",new Tt),p(this,"relatedTopics",new Tt),p(this,"comments",new St),p(this,"customData",{}),p(this,"description"),p(this,"serverAssignedId"),p(this,"dueDate"),p(this,"modifiedAuthor"),p(this,"modifiedDate"),p(this,"index"),p(this,"_type",Lt.default.type),p(this,"_status",Lt.default.status),p(this,"_priority",Lt.default.priority),p(this,"_stage",Lt.default.priority),p(this,"_assignedTo",Lt.default.assignedTo),p(this,"_labels",Lt.default.labels),p(this,"_components"),this._components=e;const t=e.get(Ye);this.creationAuthor=t.config.author,this.relatedTopics.guard=s=>s!==this.guid}set type(e){const t=this._components.get(Ye),{strict:s,types:i}=t.config;(!s||i.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(Ye),{strict:s,statuses:i}=t.config;(!s||i.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(Ye);if(e){const{strict:s,priorities:i}=t.config;if(!(!s||i.has(e)))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(Ye);if(e){const{strict:s,stages:i}=t.config;if(!(!s||i.has(e)))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(Ye);if(e){const{strict:s,users:i}=t.config;if(!(!s||i.has(e)))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(Ye),{strict:s,labels:i}=t.config;if(s){const n=new Set;for(const r of e)(!s||i.has(r))&&n.add(r);this._labels=n}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(Ye).config.version}set(e){const t=e,s=this;for(const i in e){if(i==="guid")continue;const n=t[i];i in this&&(s[i]=n)}return this._components.get(Ye).list.set(this.guid,this),this}createComment(e,t){const s=new On(this._components,e);return s.viewpoint=t,s.topic=this,this.comments.set(s.guid,s),s}createLabelTags(e=this._managerVersion){let t="Labels";e==="2.1"&&(t="Labels"),e==="3"&&(t="Label");let s=[...this.labels].map(i=>`<${t}>${i}`).join(` +`);for(const i in this.customData){const n=this.customData[i];typeof n=="string"&&(s+=` +<${t}>${n}`)}return e==="2.1"?s:e==="3"?s.length!==0?` +${s} +`:"":s}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map(s=>s.serialize()).join(` +`);return e==="2.1"?t:e==="3"?t.length!==0?` +${t} +`:"":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";e==="2.1"&&(t="Viewpoints"),e==="3"&&(t="ViewPoint");const s=this._components.get(Ct),i=[...this.viewpoints].map(n=>s.list.get(n)).filter(n=>n).map(n=>`<${t} Guid="${n.guid}"> + ${n.guid}.bcfv + ${n.guid}.jpeg + + `).join(` +`);return e==="2.1"?i:e==="3"?i.length!==0?` +${i} +`:"":i}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map(s=>` + `).join(` +`);return e==="2.1"?t:e==="3"?t.length!==0?` +${t} +`:"":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let s=null;this.priority&&(s=`${this.priority}`);let i=null;this.index&&e==="2.1"&&(i=`${this.index}`);let n=null;this.modifiedDate&&(n=`${this.modifiedDate.toISOString()}`);let r=null;this.modifiedAuthor&&(r=`${this.modifiedAuthor}`);let o=null;this.dueDate&&(o=`${this.dueDate.toISOString()}`);let a=null;this.assignedTo&&(a=`${this.assignedTo}`);let c=null;this.description&&(c=`${this.description}`);let h=null;this.stage&&(h=`${this.stage}`);const d=this.createCommentTags(e),I=this.createViewpointTags(e),u=this.createLabelTags(e),f=this.createRelatedTopicTags(e);return` + + + + ${this.title} + ${this.creationDate.toISOString()} + ${this.creationAuthor} + ${s??""} + ${i??""} + ${n??""} + ${r??""} + ${o??""} + ${a??""} + ${c??""} + ${h??""} + ${u} + ${f} + ${e==="3"?d:""} + ${e==="3"?I:""} + + ${e==="2.1"?d:""} + ${e==="2.1"?I:""} + + `}};p(sa,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let io=sa;const wu=(l,e)=>{if(e.trim()==="")return;const t=Ye.xmlParser.parse(e).Extensions;if(!t)return;const{Priorities:s,TopicStatuses:i,TopicTypes:n,Users:r}=t;if(s&&s.Priority){const o=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const a of o)l.config.priorities.add(a)}if(i&&i.TopicStatus){const o=Array.isArray(i.TopicStatus)?i.TopicStatus:[i.TopicStatus];for(const a of o)l.config.statuses.add(a)}if(n&&n.TopicType){const o=Array.isArray(n.TopicType)?n.TopicType:[n.TopicType];for(const a of o)l.config.types.add(a)}if(r&&r.User){const o=Array.isArray(r.User)?r.User:[r.User];for(const a of o)l.config.users.add(a)}};class vu extends kt{constructor(){super(...arguments),p(this,"_config",{version:{type:"Select",options:new Set,multiple:!1,value:""},author:{type:"Text",value:""},types:{type:"TextSet",value:new Set},statuses:{type:"TextSet",value:new Set},priorities:{type:"TextSet",value:new Set},labels:{type:"TextSet",value:new Set},stages:{type:"TextSet",value:new Set},users:{type:"TextSet",value:new Set},includeSelectionTag:{type:"Boolean",value:!1},updateExtensionsOnImport:{type:"Boolean",value:!1},strict:{type:"Boolean",value:!1},includeAllExtensionsOnExport:{type:"Boolean",value:!1},fallbackVersionOnImport:{type:"Select",multiple:!1,options:new Set,value:""},ignoreIncompleteTopicsOnImport:{type:"Boolean",value:!1}})}get version(){return this._config.version.value}set version(e){this._config.version.value=e}get author(){return this._config.author.value}set author(e){this._config.author.value=e}get types(){return this._config.types.value}set types(e){this._config.types.value=e}get statuses(){return this._config.statuses.value}set statuses(e){this._config.statuses.value=e}get priorities(){return this._config.priorities.value}set priorities(e){this._config.priorities.value=e}get labels(){return this._config.labels.value}set labels(e){this._config.labels.value=e}get stages(){return this._config.stages.value}set stages(e){this._config.stages.value=e}get users(){return this._config.users.value}set users(e){this._config.users.value=e}get includeSelectionTag(){return this._config.includeSelectionTag.value}set includeSelectionTag(e){this._config.includeSelectionTag.value=e}get updateExtensionsOnImport(){return this._config.updateExtensionsOnImport.value}set updateExtensionsOnImport(e){this._config.updateExtensionsOnImport.value=e}get strict(){return this._config.strict.value}set strict(e){this._config.strict.value=e}get includeAllExtensionsOnExport(){return this._config.includeAllExtensionsOnExport.value}set includeAllExtensionsOnExport(e){this._config.includeAllExtensionsOnExport.value=e}get fallbackVersionOnImport(){return this._config.fallbackVersionOnImport.value}set fallbackVersionOnImport(e){this._config.fallbackVersionOnImport.value=e}get ignoreIncompleteTopicsOnImport(){return this._config.ignoreIncompleteTopicsOnImport.value}set ignoreIncompleteTopicsOnImport(e){this._config.ignoreIncompleteTopicsOnImport.value=e}}const Nn=class Fi extends Ae{constructor(){super(...arguments),p(this,"enabled",!1),p(this,"_defaultConfig",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1}),p(this,"config",new vu(this,this.components,"BCF Topics")),p(this,"list",new St),p(this,"onSetup",new $),p(this,"isSetup",!1),p(this,"onBCFImported",new $),p(this,"onDisposed",new $)}setup(e){if(this.isSetup)return;const t={...this._defaultConfig,...e};this.config.version=t.version,this.config.author=t.author,this.config.types=t.types,this.config.statuses=t.statuses,this.config.priorities=t.priorities,this.config.labels=t.labels,this.config.stages=t.stages,this.config.users=t.users,this.config.includeSelectionTag=t.includeSelectionTag,this.config.updateExtensionsOnImport=t.updateExtensionsOnImport,this.config.strict=t.strict,this.config.includeAllExtensionsOnExport=t.includeAllExtensionsOnExport,this.config.fallbackVersionOnImport=t.fallbackVersionOnImport||"",this.config.ignoreIncompleteTopicsOnImport=t.ignoreIncompleteTopicsOnImport,this.isSetup=!0,this.enabled=!0,this.onSetup.trigger()}create(e){const t=new io(this.components);return e&&(t.guid=e.guid??t.guid,t.set(e)),this.list.set(t.guid,t),t}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const e=[...this.list].map(([t,s])=>s.type);return new Set(e)}get usedStatuses(){const e=[...this.list].map(([t,s])=>s.status);return new Set(e)}get usedPriorities(){const e=[...this.list].map(([t,s])=>s.priority).filter(t=>t);return new Set(e)}get usedStages(){const e=[...this.list].map(([t,s])=>s.stage).filter(t=>t);return new Set(e)}get usedUsers(){const e=[];for(const[t,s]of this.list){e.push(s.creationAuthor),s.assignedTo&&e.push(s.assignedTo),s.modifiedAuthor&&e.push(s.modifiedAuthor);for(const[i,n]of s.comments)e.push(n.author),n.modifiedAuthor&&e.push(n.modifiedAuthor)}return new Set(e)}get usedLabels(){const e=[];for(const[t,s]of this.list)e.push(...s.labels);return new Set(e)}updateExtensions(){for(const[e,t]of this.list){for(const s of t.labels)this.config.labels.add(s);this.config.types.add(t.type),t.priority&&this.config.priorities.add(t.priority),t.stage&&this.config.stages.add(t.stage),this.config.statuses.add(t.status),this.config.users.add(t.creationAuthor),t.assignedTo&&this.config.users.add(t.assignedTo),t.modifiedAuthor&&this.config.users.add(t.modifiedAuthor);for(const[s,i]of t.comments)this.config.users.add(i.author),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor)}}updateViewpointReferences(){const e=this.components.get(Ct);for(const[t,s]of this.list)for(const i of s.viewpoints)e.list.has(i)||s.viewpoints.delete(i)}async export(e=this.list.values()){const t=new Qr;t.file("bcf.version",` + + `),t.file("bcf.extensions",this.serializeExtensions());const s=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob(),i=this.components.get(Ct);for(const n of e){const r=t.folder(n.guid);r.file("markup.bcf",n.serialize());for(const o of n.viewpoints){const a=i.list.get(o);a&&(r.file(`${o}.jpeg`,s,{binary:!0}),r.file(`${o}.bcfv`,await a.serialize()))}}return await t.generateAsync({type:"blob"})}serializeExtensions(){const e=[...this.config.types].map(o=>`${o}`).join(` +`),t=[...this.config.statuses].map(o=>`${o}`).join(` +`),s=[...this.config.priorities].map(o=>`${o}`).join(` +`),i=[...this.config.labels].map(o=>`${o}`).join(` +`),n=[...this.config.stages].map(o=>`${o}`).join(` +`),r=[...this.config.users].map(o=>`${o}`).join(` +`);return` + + + ${e.length!==0?` +${e} +`:""} + ${t.length!==0?` +${t} +`:""} + ${s.length!==0?` +${s} +`:""} + ${i.length!==0?` +${i} +`:""} + ${n.length!==0?` +${n} +`:""} + ${r.length!==0?` +${r} +`:""} + + `}processMarkupComment(e){const{Guid:t,Date:s,Author:i,Comment:n,Viewpoint:r}=e;if(!(t&&s&&i&&(On||r)))return null;const o=this.components.get(Ct),a=new On(this.components,n??"");return a.guid=t,a.date=new Date(s),a.author=i,a.viewpoint=r!=null&&r.Guid?o.list.get(r.Guid):void 0,a.modifiedAuthor=e.ModifiedAuthor,a.modifiedDate=e.ModifiedDate?new Date(e.ModifiedDate):void 0,a}getMarkupComments(e,t){var s;let i;if(t==="2.1"&&(i=e.Comment),t==="3"&&(i=(s=e.Topic.Comments)==null?void 0:s.Comment),!i)return[];i=Array.isArray(i)?i:[i];const n=i.map(r=>this.processMarkupComment(r)).filter(r=>r);return Array.isArray(n)?n:[n]}getMarkupLabels(e,t){var s;let i;return t==="2.1"&&(i=e.Topic.Labels),t==="3"&&(i=(s=e.Topic.Labels)==null?void 0:s.Label),i?Array.isArray(i)?i:[i]:[]}getMarkupViewpoints(e,t){var s;let i;return t==="2.1"&&(i=e.Viewpoints),t==="3"&&(i=(s=e.Topic.Viewpoints)==null?void 0:s.ViewPoint),i?(i=Array.isArray(i)?i:[i],i):[]}getMarkupRelatedTopics(e,t){var s;let i;return t==="2.1"&&(i=e.Topic.RelatedTopic),t==="3"&&(i=(s=e.Topic.RelatedTopics)==null?void 0:s.RelatedTopic),i?(Array.isArray(i)?i:[i]).map(n=>n.Guid):[]}async load(e,t){var s;const{fallbackVersionOnImport:i,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new Qr;await o.loadAsync(e);const a=Object.values(o.files);let c=i;const h=a.find(m=>m.name.endsWith(".version"));if(h){const m=await h.async("string"),A=Fi.xmlParser.parse(m).Version.VersionId;c=String(A)}if(!(c&&(c==="2.1"||c==="3")))throw new Error(`BCFTopics: ${c} is not supported.`);const d=a.find(m=>m.name.endsWith(".extensions"));if(r&&d){const m=await d.async("string");wu(this,m)}const I=[],u=this.components.get(Ct),f=a.filter(m=>m.name.endsWith(".bcfv"));for(const m of f){const A=await m.async("string"),R=Fi.xmlParser.parse(A).VisualizationInfo;if(!R){console.warn("Missing VisualizationInfo in Viewpoint");continue}const S={},{Guid:L,ClippingPlanes:y,Components:w,OrthogonalCamera:P,PerspectiveCamera:M}=R;if(L&&(S.guid=L),w){const{Selection:O,Visibility:v}=w;if(O&&O.Component){const b=Array.isArray(O.Component)?O.Component:[O.Component];S.selectionComponents=b.map(Z=>Z.IfcGuid).filter(Z=>Z)}if(v&&"DefaultVisibility"in v&&(S.defaultVisibility=v.DefaultVisibility),v&&v.Exceptions&&"Component"in v.Exceptions){const{Component:b}=v.Exceptions,Z=Array.isArray(b)?b:[b];S.exceptionComponents=Z.map(z=>z.IfcGuid).filter(z=>z)}let g;c==="2.1"&&(g=w.ViewSetupHints),c==="3"&&(g=(s=w.Visibility)==null?void 0:s.ViewSetupHints),g&&("OpeningsVisible"in g&&(S.openingsVisible=g.OpeningsVisible),"SpacesVisible"in g&&(S.spacesVisible=g.SpacesVisible),"SpaceBoundariesVisible"in g&&(S.spaceBoundariesVisible=g.SpaceBoundariesVisible))}if(P||M){const O=R.PerspectiveCamera??R.OrthogonalCamera,{CameraViewPoint:v,CameraDirection:g}=O,b=new x(Number(v.X),Number(v.Z),Number(-v.Y)),Z=new x(Number(g.X),Number(g.Z),Number(-g.Y)),z={position:{x:b.x,y:b.y,z:b.z},direction:{x:Z.x,y:Z.y,z:Z.z},aspectRatio:"AspectRatio"in O?O.AspectRatio:1};"ViewToWorldScale"in O&&(S.camera={...z,viewToWorldScale:O.ViewToWorldScale}),"FieldOfView"in O&&(S.camera={...z,fov:O.FieldOfView})}const B=new Ra(this.components,t,{data:S,setCamera:!1});if(w){const{Coloring:O}=w;if(O&&O.Color){const v=Array.isArray(O.Color)?O.Color:[O.Color];for(const g of v){const{Color:b,Component:Z}=g,z=(Array.isArray(Z)?Z:[Z]).map(J=>J.IfcGuid);B.componentColors.set(b,z)}}}if(I.push(B),y){const O=this.components.get(sh),v=Array.isArray(y.ClippingPlane)?y.ClippingPlane:[y.ClippingPlane];for(const g of v){const{Location:b,Direction:Z}=g;if(!(b&&Z))continue;const z=new x(b.X,b.Z,-b.Y),J=new x(Z.X,-Z.Z,Z.Y),X=O.createFromNormalAndCoplanarPoint(t,J,z);X.visible=!1,X.enabled=!1,B.clippingPlanes.add(X)}}}const E={},C=[],T=a.filter(m=>m.name.endsWith(".bcf"));for(const m of T){const A=await m.async("string"),R=Fi.xmlParser.parse(A).Markup,S=R.Topic,{Guid:L,TopicType:y,TopicStatus:w,Title:P,CreationDate:M,CreationAuthor:B}=S;if(n&&!(L&&y&&w&&P&&M&&B))continue;const O=new io(this.components);O.guid=L??O.guid;const v=this.getMarkupRelatedTopics(R,c);E[O.guid]=new Set(v),O.type=y??O.type,O.status=w??O.status,O.title=P??O.title,O.creationDate=M?new Date(M):O.creationDate,O.creationAuthor=B??O.creationAuthor,O.serverAssignedId=S.ServerAssignedId,O.priority=S.Priority,O.index=S.Index,O.modifiedDate=S.ModifiedDate?new Date(S.ModifiedDate):void 0,O.modifiedAuthor=S.ModifiedAuthor,O.dueDate=S.DueDate?new Date(S.DueDate):void 0,O.assignedTo=S.AssignedTo,O.description=S.Description,O.stage=S.Stage;const g=this.getMarkupLabels(R,c);for(const z of g)O.labels.add(z);const b=this.getMarkupComments(R,c);for(const z of b)O.comments.set(z.guid,z);const Z=this.getMarkupViewpoints(R,c);for(const z of Z){if(!(z&&z.Guid))continue;const J=u.list.get(z.Guid);J&&O.viewpoints.add(J.guid)}this.list.set(O.guid,O),C.push(O)}for(const m in E){const A=this.list.get(m);if(!A)continue;const R=E[m];for(const S of R)A.relatedTopics.add(S)}return this.onBCFImported.trigger(C),{viewpoints:I,topics:C}}};p(Nn,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),p(Nn,"xmlParser",new ta.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Ye=Nn;const ia=class ft extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"onDisposed",new $),p(this,"_absoluteMin"),p(this,"_absoluteMax"),p(this,"_meshes",[]),this.components.add(ft.uuid,this),this._absoluteMin=ft.newBound(!0),this._absoluteMax=ft.newBound(!1)}static getDimensions(e){const{min:t,max:s}=e,i=Math.abs(s.x-t.x),n=Math.abs(s.y-t.y),r=Math.abs(s.z-t.z),o=new x;return o.subVectors(s,t).divideScalar(2).add(t),{width:i,height:n,depth:r,center:o}}static newBound(e){const t=e?1:-1;return new x(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,s){const i=s||this.newBound(!1),n=t||this.newBound(!0);for(const r of e)r.xi.x&&(i.x=r.x),r.y>i.y&&(i.y=r.y),r.z>i.z&&(i.z=r.z);return new we(t,s)}dispose(){const e=this.components.get(ds);for(const t of this._meshes)e.destroy(t);this._meshes=[],this.onDisposed.trigger(ft.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new we(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),s=Math.abs((t.x-e.x)/2),i=Math.abs((t.y-e.y)/2),n=Math.abs((t.z-e.z)/2),r=new x(e.x+s,e.y+i,e.z+n),o=r.distanceTo(e);return new Li(r,o)}getMesh(){const e=new we(this._absoluteMin,this._absoluteMax),t=ft.getDimensions(e),{width:s,height:i,depth:n,center:r}=t,o=new De(s,i,n),a=new se(o);return this._meshes.push(a),a.position.copy(r),a}reset(){this._absoluteMin=ft.newBound(!0),this._absoluteMax=ft.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(e,t){if(!e.geometry.index)return;const s=ft.getFragmentBounds(e);e.updateMatrixWorld();const i=e.matrixWorld,n=new Ee,r=e instanceof Vt,o=new Set;if(e instanceof Va){t||(t=e.fragment.ids);for(const a of t){const c=e.fragment.getInstancesIDs(a);if(c)for(const h of c)o.add(h)}}else o.add(0);for(const a of o){const c=s.min.clone(),h=s.max.clone();r&&(e.getMatrixAt(a,n),c.applyMatrix4(n),h.applyMatrix4(n)),c.applyMatrix4(i),h.applyMatrix4(i),c.xthis._absoluteMax.x&&(this._absoluteMax.x=c.x),c.y>this._absoluteMax.y&&(this._absoluteMax.y=c.y),c.z>this._absoluteMax.z&&(this._absoluteMax.z=c.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),h.xr.x&&(r.x=h),d>r.y&&(r.y=d),I>r.z&&(r.z=I)}return new we(n,r)}};p(ia,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Mu=ia;const na=class ra{constructor(e){p(this,"onProgress",new $),p(this,"inclusive",!1),p(this,"rules",[]),p(this,"ids",{}),p(this,"needsUpdate",new Map),p(this,"components"),this.components=e}static import(e,t){const s=ra.importers.get(t.type);return s?s(e,t):(console.warn("Invalid query data:.",t),null)}static importRules(e){const t=[];for(const s of e){const i={};for(const n in s){const r=s[n];r.regexp?i[n]=new RegExp(r.value):i[n]=r}t.push(i)}return t}static importIds(e){const t={};for(const s in e.ids)t[s]=new Set(e.ids[s]);return t}clear(e){if(e===void 0){this.ids={},this.needsUpdate.clear();return}delete this.ids[e],this.needsUpdate.delete(e)}addID(e,t){this.ids[e]||(this.ids[e]=new Set),this.ids[e].add(t)}getData(){const e={};for(const s in this.ids)e[s]=Array.from(this.ids[s]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:e,rules:t}}exportRules(){const e=[];for(const t of this.rules){const s={};for(const i in t){const n=t[i];n instanceof RegExp?s[i]={regexp:!0,value:n.source}:s[i]=n}e.push(s)}return e}findInFile(e,t){return new Promise(s=>{const i=new FileReader,n=new TextDecoder("utf-8"),r=1e4*1024,o=1e3;let a=0;const c=/;/,h=()=>{if(a>=t.size){s();return}const d=Math.min(a+r+o,t.size),I=t.slice(a,d);i.readAsArrayBuffer(I)};i.onload=()=>{if(!(i.result instanceof ArrayBuffer))return;const d=new Uint8Array(i.result),I=n.decode(d).split(c);I.shift(),this.findInLines(e,I),this.onProgress.trigger(a/t.size),a+=r,h()},h()})}getIdFromLine(e){const t=e.slice(e.indexOf("#")+1,e.indexOf("="));return parseInt(t,10)}testRules(e){let t=null,s=null,i=null,n=!1;for(const r of this.rules){if(r.type==="category"){if(t===null&&(t=this.getCategoryFromLine(e),t===null)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0;continue}if(s===null&&(s=this.getAttributesFromLine(e),s===null)){if(this.inclusive)continue;n=!1;break}if(t===null&&(t=this.getCategoryFromLine(e),t===null)){if(this.inclusive)continue;n=!1;break}if(i===null&&(i=Object.keys(new Ga[t]),i=i.slice(2),i===null)){if(this.inclusive)continue;n=!1;break}if(r.type==="property"){const{name:o,value:a}=r;if(!a.test(e)){if(this.inclusive)continue;n=!1;break}let c=!1;for(let h=0;h"&&parseFloat(u)>a){h=!0;break}else if(c===">="&&parseFloat(u)>=a){h=!0;break}else if(c==="<="&&parseFloat(u)<=a){h=!0;break}}}if(h)n=!0;else if(!this.inclusive){n=!1;break}}}return n}getCategoryFromLine(e){const t=e.indexOf("=")+1,s=e.indexOf("("),i=e.slice(t,s).trim();return lh[i]||null}getAttributesFromLine(e){const t=/\((.*)\)/,s=e.match(t);if(!(s&&s[1]))return null;const i=/,(?![^()]*\))/g;return s[1].split(i).map(n=>n.trim())}};p(na,"importers",new Map);let mt=na;class no{constructor(e){p(this,"list",new Map),p(this,"id",wn.generateUUID()),p(this,"mode","intersect"),p(this,"_components"),this._components=e}get queries(){return new Set(this.list.values())}get items(){const e=[];for(const t of this.queries)e.push(t.items);return this.mode==="combine"?Ai.combine(e):Ai.intersect(e)}add(e){if(this.list.has(e.name))throw new Error(`This group already has a query with the name ${e.name}.`);this.list.set(e.name,e)}clear(e){for(const t of this.queries)t.clear(e)}import(e){this.mode=e.mode,this.id=e.id;for(const t in e.queries){const s=mt.import(this._components,e.queries[t]);s&&this.list.set(t,s)}}export(){const e={};for(const[t,s]of this.list)e[t]=s.export();return{mode:this.mode,id:this.id,queries:e}}async update(e,t){for(const s of this.queries){const i=s.needsUpdate.get(e);(i===void 0||i)&&await s.update(e,t)}}}const oa=class aa extends mt{constructor(e,t){super(e),p(this,"name"),this.name=t.name,this.rules=t.rules,this.inclusive=t.inclusive}get items(){const e=this.components.get(Re),t=[];for(const s in this.ids){const i=this.ids[s],n=e.groups.get(s);if(!n){console.warn(`Model ${s} not found!`);continue}const r=n.getFragmentMap(i);t.push(r)}return Ai.combine(t)}export(){const e=this.getData();return e.type=aa.type,e}async update(e,t){this.ids[e]=new Set,await this.findInFile(e,t),this.needsUpdate.set(e,!1)}findInLines(e,t){for(const s of t)if(this.testRules(s)){const i=this.getIdFromLine(s);this.addID(e,i)}}};p(oa,"type","IfcBasicQuery");let ro=oa;mt.importers.set(ro.type,(l,e)=>{const t=new ro(l,{name:e.name,rules:mt.importRules(e.rules),inclusive:e.inclusive});return t.ids=mt.importIds(e),t});const la=class ca extends mt{constructor(e,t){super(e),p(this,"name"),p(this,"psets",[]),this.name=t.name,this.rules=t.rules,this.inclusive=t.inclusive}get items(){const e=this.components.get(rt),t=this.components.get(Re),s=[];for(const i in this.ids){const n=t.groups.get(i);if(!n){console.log(`Model not found: ${i}.`);continue}const r=this.ids[i];for(const o of r){const a=e.getEntityRelations(i,o,"DefinesOcurrence");if(a){const c=n.getFragmentMap(a);s.push(c)}}}return Ai.combine(s)}export(){const e=this.getData();return e.type=ca.type,e}async update(e,t){await this.findInFile(e,t);const s=new Set;for(const i of this.psets){const n=this.getAttributesFromLine(i);if(n===null)continue;const r=n[4].replace("(","[").replace(")","]").replace(/#/g,""),o=JSON.parse(r);for(const a of o){const c=this.ids[e];if(c&&c.has(a)){const h=this.getIdFromLine(i);s.add(h);break}}}this.ids[e]=s,this.psets=[],this.needsUpdate.set(e,!1)}findInLines(e,t){for(const s of t){const i=this.getCategoryFromLine(s);if(i==="IfcPropertySet"){this.psets.push(s);continue}if(i==="IfcPropertySingleValue"&&this.testRules(s)){const n=this.getIdFromLine(s);this.addID(e,n)}}}};p(la,"type","IfcPropertyQuery");let oo=la;mt.importers.set(oo.type,(l,e)=>{const t=new oo(l,{name:e.name,inclusive:e.inclusive,rules:mt.importRules(e.rules)});return t.ids=mt.importIds(e),t});const ha=class ua extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"list",new Map),e.add(ua.uuid,this)}get queries(){const e=new Set;for(const[,t]of this.list)for(const s of t.queries)e.add(s);return e}import(e){for(const t in e){const s=new no(this.components);s.import(e[t]),this.list.set(t,s)}}export(){const e={};for(const[t,s]of this.list)e[t]=s.export();return e}create(){const e=new no(this.components);return this.list.set(e.id,e),e}delete(e){this.list.delete(e)}clear(){this.list.clear()}};p(ha,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let Ju=ha;const da=class Ia extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"list",{}),p(this,"onDisposed",new $),p(this,"onFragmentsDisposed",t=>{const{groupID:s,fragmentIDs:i}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(s))delete r[s],Object.values(r).length===0&&delete this.list[n];else for(const a of o){const c=r[a];for(const h of i)delete c.map[h];Object.values(c).length===0&&delete r[a]}}}),e.add(Ia.uuid,this),e.get(Re).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(Re).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const s=this.list[t];for(const i in s){const n=s[i];delete n.map[e]}}}find(e){const t=this.components.get(Re);if(!e){const r={};for(const[o,a]of t.list)r[o]=new Set(a.ids);return r}const s=Object.keys(e).length,i={};for(const r in e){const o=e[r];if(!this.list[r]){console.warn(`Classification ${r} does not exist.`);continue}for(const a of o){const c=this.list[r][a];if(c)for(const h in c.map){i[h]||(i[h]=new Map);for(const d of c.map[h]){const I=i[h].get(d);I===void 0?i[h].set(d,1):i[h].set(d,I+1)}}}}const n={};for(const r in i){const o=i[r];for(const[a,c]of o){if(c===void 0)throw new Error("Malformed fragments map!");c===s&&(n[r]||(n[r]=new Set),n[r].add(a))}}return n}byModel(e,t){this.list.models||(this.list.models={});const s=this.list.models;s[e]||(s[e]={map:{},id:null,name:e});const i=s[e];for(const[n,r]of t.data){const o=r[0];for(const a of o){const c=t.keyFragments.get(a);c&&(i.map[c]||(i.map[c]=new Set),i.map[c].add(n))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const s=this.list.predefinedTypes,i=e.getAllPropertiesIDs();for(const n of i){const r=await e.getProperties(n);if(!r)continue;const o=String((t=r.PredefinedType)==null?void 0:t.value).toUpperCase();s[o]||(s[o]={map:{},id:null,name:o});const a=s[o];for(const[c,h]of e.data){const d=h[0];for(const I of d){const u=e.keyFragments.get(I);if(!u)throw new Error("Fragment ID not found!");a.map[u]||(a.map[u]=new Set),a.map[u].add(r.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,s]of e.data){const i=s[1][1],n=yi[i];this.saveItem(e,"entities",n,t)}}async byIfcRel(e,t,s){cs.isRel(t)&&await cs.getRelationMap(e,t,async(i,n)=>{const{name:r}=await cs.getEntityName(e,i);for(const o of n)this.saveItem(e,s,r??"NO REL NAME",o)})}async bySpatialStructure(e,t={}){var s,i;const n=this.components.get(rt),r=n.relationMaps[e.uuid];if(!r)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const o="spatialStructures",a=t.useProperties===void 0||t.useProperties;for(const[c]of r){if(t.isolate){const u=e.data.get(c);if(!u)continue;const f=u[1][1];if(f===void 0||!t.isolate.has(f))continue}const h=n.getEntityRelations(e,c,"Decomposes");if(h)for(const u of h){let f=u.toString();if(a){const E=await e.getProperties(u);if(!E)continue;f=(s=E.Name)==null?void 0:s.value}this.saveItem(e,o,f,c,u)}const d=n.getEntityRelations(e,c,"ContainsElements");if(!d)continue;let I=c.toString();if(a){const u=await e.getProperties(c);if(!u)continue;I=(i=u.Name)==null?void 0:i.value}for(const u of d){this.saveItem(e,o,I,u,c);const f=n.getEntityRelations(e,Number(u),"IsDecomposedBy");if(f)for(const E of f)this.saveItem(e,o,I,E,c)}}}setColor(e,t,s=!1){const i=this.components.get(Re);for(const n in e){const r=i.list.get(n);if(!r)continue;const o=e[n];r.setColor(t,o,s)}}resetColor(e){const t=this.components.get(Re);for(const s in e){const i=t.list.get(s);if(!i)continue;const n=e[s];i.resetColor(n)}}saveItem(e,t,s,i,n=null){this.list[t]||(this.list[t]={});const r=e.data.get(i);if(r)for(const o of r[0]){const a=e.keyFragments.get(o);if(a){const c=this.list[t];c[s]||(c[s]={map:{},id:n,name:s}),c[s].map[a]||(c[s].map[a]=new Set),c[s].map[a].add(i)}}}};p(da,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let yn=da;const Ea=class fa extends Ae{constructor(e){super(e),p(this,"onDisposed",new $),p(this,"enabled",!0),p(this,"height",10),p(this,"groupName","spatialStructures"),p(this,"list",new Set),e.add(fa.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(yn),s=this.components.get(Re),i=e?1:-1;let n=0;const r=t.list[this.groupName],o=new Ee;for(const a in r){o.elements[13]=n*i*this.height;for(const c in r[a].map){const h=s.list.get(c),d=a+c,I=this.list.has(d);if(!h||e&&I||!e&&!I)continue;e?this.list.add(d):this.list.delete(d);const u=r[a].map[c];h.applyTransform(u,o),h.mesh.computeBoundingSphere(),h.mesh.computeBoundingBox()}n++}}};p(Ea,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let ed=Ea;const pa=class Ca extends Ae{constructor(e){super(e),p(this,"enabled",!0),this.components.add(Ca.uuid,this)}set(e,t){const s=this.components.get(Re);if(!t){for(const[i,n]of s.list)n&&(n.setVisibility(e),this.updateCulledVisibility(n));return}for(const i in t){const n=t[i],r=s.list.get(i);r&&(r.setVisibility(e,n),this.updateCulledVisibility(r))}}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(Gc);for(const[s,i]of t.list){const n=i.colorMeshes.get(e.id);n&&(n.count=e.mesh.count)}}};p(pa,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Du=pa;class bu extends tr{constructor(){super(...arguments),p(this,"minGeometrySize",10),p(this,"minAssetsSize",1e3),p(this,"maxTriangles",null)}}const Ta=class ma extends Ae{constructor(e){super(e),p(this,"onGeometryStreamed",new $),p(this,"onAssetStreamed",new $),p(this,"onProgress",new $),p(this,"onIfcLoaded",new $),p(this,"onDisposed",new $),p(this,"settings",new bu),p(this,"enabled",!0),p(this,"webIfc",new hs),p(this,"_nextAvailableID",0),p(this,"_splittedGeometries",new Map),p(this,"_spatialTree",new Uo),p(this,"_metaData",new Bo),p(this,"_visitedGeometries",new Map),p(this,"_streamSerializer",new za),p(this,"_geometries",new Map),p(this,"_geometryCount",0),p(this,"_civil",new xo),p(this,"_groupSerializer",new Io),p(this,"_assets",[]),p(this,"_meshesWithHoles",new Set),this.components.add(ma.uuid,this),this.settings.excludedCategories.add(uo)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(t,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(e){const{path:t,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(t,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),i=[[]],n=new vn;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,o=0;for(const f of s){if(!this.webIfc.IsIfcElement(f)&&f!==zt||this.settings.excludedCategories.has(f))continue;const E=this.webIfc.GetLineIDsWithType(0,f),C=E.size();for(let T=0;Te&&(r=0,o++,i.push([]));const m=E.get(T);i[o].push(m);const A=this.webIfc.GetLine(0,m);if(A.GlobalId){const S=(A==null?void 0:A.GlobalId.value)||(A==null?void 0:A.GlobalId);n.globalToExpressIDs.set(S,m)}const R=this._spatialTree.itemsByFloor[m]||0;n.data.set(m,[[],[R,f]]),r++}}this._spatialTree.cleanUp();let a=.01,c=0;for(const f of i){c++,this.webIfc.StreamMeshes(0,f,C=>{this.getMesh(this.webIfc,C,n)}),this._assets.length>t&&await this.streamAssets();const E=c/i.length;E>a&&(a+=.01,a=Math.max(a,E),this.onProgress.trigger(Math.round(a*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:h,transparent:d}=n.geometryIDs;for(const[f,{index:E,uuid:C}]of this._visitedGeometries)n.keyFragments.set(E,C),(f>1?h:d).set(f,E);Yo.get(n,this.webIfc);const I=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(I),n.civilData=this._civil.read(this.webIfc);const u=this._groupSerializer.export(n);this.onIfcLoaded.trigger(u),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new hs,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,s){const i=t.geometries.size(),n=t.expressID,r={id:n,geometries:[]};for(let o=0;othis.settings.minGeometrySize&&this.streamGeometries()}i.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}streamGeometries(){let e=this._streamSerializer.export(this._geometries),t={};for(const[s,{boundingBox:i,hasHoles:n}]of this._geometries)t[s]={boundingBox:i,hasHoles:n};this.onGeometryStreamed.trigger({data:t,buffer:e}),t=null,e=null,this._geometries.clear(),this._geometryCount=0}registerGeometryData(e,t,s,i,n,r){const o=this._visitedGeometries.get(r);if(o===void 0)throw new Error("Error getting geometry data for streaming!");const a=e.data.get(t);if(!a)throw new Error("Data not found!");a[0].push(o.index);const{x:c,y:h,z:d,w:I}=s.color,u=[c,h,d,I],f=s.flatTransformation;i.geometries.push({color:u,geometryID:n,transformation:f})}};p(Ta,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let td=Ta;class Uu extends tr{constructor(){super(...arguments),p(this,"propertiesSize",100)}}class xu extends Ae{constructor(){super(...arguments),p(this,"onPropertiesStreamed",new mi),p(this,"onProgress",new mi),p(this,"onIndicesStreamed",new mi),p(this,"onDisposed",new $),p(this,"enabled",!0),p(this,"settings",new Uu),p(this,"webIfc",new hs)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(t,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(t,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([Wn,Xn,jn,Zn,zt]);for(const o of s)t.add(o);let i=.01,n=0;for(const o of t){if(n++,Vo.has(o))continue;const a=s.has(o),c=this.webIfc.GetLineIDsWithType(0,o),h=c.size();let d=0;for(let I=0;Ii&&(i=Math.round(i*100)/100,await this.onProgress.trigger(i),i+=.01)}await this.onProgress.trigger(1);const r=await this.components.get(rt).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(r)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new hs}}p(xu,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class Ra{constructor(e,t,s){p(this,"title"),p(this,"guid",vt.create()),p(this,"clippingPlanes",new Tt),p(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}}),p(this,"exceptionComponents",new Tt),p(this,"selectionComponents",new Tt),p(this,"componentColors",new St),p(this,"spacesVisible",!1),p(this,"spaceBoundariesVisible",!1),p(this,"openingsVisible",!1),p(this,"defaultVisibility",!0),p(this,"_components"),p(this,"world");const i={setCamera:!0,...s},{data:n,setCamera:r}=i;this._components=e,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(Re),t={};for(const[s,i]of e.groups){s in t||(t[s]=new Set);for(const n of this.selectionComponents){const r=i.globalToExpressIDs.get(n);r&&t[s].add(r)}}return t}get _exceptionModelIdMap(){const e=this._components.get(Re),t={};for(const[s,i]of e.groups){s in t||(t[s]=new Set);for(const n of this.exceptionComponents){const r=i.globalToExpressIDs.get(n);r&&t[s].add(r)}}return t}get selection(){return this._components.get(Re).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(Re).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(Re),{position:t}=this.camera,{x:s,y:i,z:n}=t,r=new x(s,i,n);return e.applyBaseCoordinateSystem(r,new Ee),r}get direction(){const{direction:e}=this.camera,{x:t,y:s,z:i}=e;return new x(t,s,i)}get _managerVersion(){return this._components.get(Ye).config.version}get topics(){return[...this._components.get(Ye).list.values()].filter(e=>e.viewpoints.has(this.guid))}addComponentsFromMap(e){const t=this._components.get(Re).fragmentIdMapToGuids(e);this.selectionComponents.add(...t),this._components.get(Ct).list.set(this.guid,this)}set(e){const t=e,s=this;for(const i in e){if(i==="guid")continue;const n=t[i];if(i==="selectionComponents"){this.selectionComponents.clear(),this.selectionComponents.add(...n);continue}if(i==="exceptionComponents"){this.exceptionComponents.clear(),this.exceptionComponents.add(...n);continue}i in this&&(s[i]=n)}return this._components.get(Ct).list.set(this.guid,this),this}async go(e=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof ah&&t.projection.set(this.projection);const s=this.position,i=this.direction;let n={x:s.x+i.x*80,y:s.y+i.y*80,z:s.z+i.z*80};const r=this.selection;if(Object.keys(r).length===0){const a=this._components.get(mn).get(this.world).castRayFromVector(s,this.direction);a&&(n=a.point)}else{const a=this._components.get(Mu);a.reset(),a.addFragmentIdMap(r),n=a.getSphere().center,a.reset()}const o=this._components.get(Du);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(s.x,s.y,s.z,n.x,n.y,n.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new x;e.controls.getPosition(s);const i=e.three,n=new x(0,0,-1).applyEuler(i.rotation),{width:r,height:o}=t.getSize();let a=r/o;Number.isNaN(a)&&(a=1);const c=this._components.get(Re);s.applyMatrix4(c.baseCoordinationMatrix.clone().invert());const h={aspectRatio:a,position:{x:s.x,y:s.y,z:s.z},direction:{x:n.x,y:n.y,z:n.z}};i instanceof Pn?this.camera={...h,fov:i.fov}:i instanceof Gt&&(this.camera={...h,viewToWorldScale:i.top-i.bottom}),this._components.get(Ct).list.set(this.guid,this)}colorize(){const e=this._components.get(Ct),t=this._components.get(Re),s=this._components.get(yn);for(const[i,n]of this.componentColors){const r=t.guidToFragmentIdMap(n),o=new ve(`#${i}`);s.setColor(r,o,e.config.overwriteColors)}}resetColors(){const e=this._components.get(Re),t=this._components.get(yn);for(const[s,i]of this.componentColors){const n=e.guidToFragmentIdMap(i);t.resetColor(n)}}async createComponentTags(e){var t,s;const i=this._components.get(Re),n=this._components.get(Ye);let r="";if(n.config.includeSelectionTag){const o=e==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const a in o){const c=i.groups.get(a);if(!c)continue;const h=o[a];for(const d of h){const I=await c.getProperties(d);if(!I)continue;const u=(t=I.GlobalId)==null?void 0:t.value;if(!u)continue;const f=(s=I.Tag)==null?void 0:s.value;let E=null;f&&(E=`AuthoringToolId="${f}"`),r+=` +`}}}else r=[...this.selectionComponents].map(o=>``).join(` +`);return r}async serialize(e=this._managerVersion){const t=this._components.get(Re),s=this.position;s.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const i=this.direction;i.normalize();const n=new Ee().makeRotationX(Math.PI/2),r=i.clone().applyMatrix4(n);r.normalize();const o=` + ${s.x} + ${-s.z} + ${s.y} + `,a=` + ${i.x} + ${-i.z} + ${i.y} + `,c=` + ${r.x} + ${-r.z} + ${r.y} + `,h=`${this.camera.aspectRatio}`;let d="";"viewToWorld"in this.camera?d=` + ${o} + ${a} + ${c} + ${h} + ${this.camera.viewToWorld} + `:"fov"in this.camera&&(d=` + ${o} + ${a} + ${c} + ${h} + ${this.camera.fov} + `);const I=``,u=(await this.createComponentTags("selection")).trim(),f=(await this.createComponentTags("exception")).trim();return` + + + ${e==="2.1"?I:""} + ${u.length!==0?`${u}`:""} + + ${e==="3"?I:""} + ${f.length!==0?`${f}`:""} + + + ${d} + `}}class Bu extends kt{constructor(){super(...arguments),p(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(e){this._config.overwriteColors.value=e}}const ga=class Fa extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"list",new St),p(this,"isSetup",!1),p(this,"onSetup",new $),p(this,"config",new Bu(this,this.components,"Viewpoints")),p(this,"onDisposed",new $),e.add(Fa.uuid,this)}create(e,t){const s=new Ra(this.components,e,{data:t});return t||this.list.set(s.guid,s),s}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};p(ga,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Ct=ga;class Yu extends kt{constructor(){super(...arguments),p(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new ve,type:"Color"}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e;const t=this._component.renderer.domElement.style;t.display=e?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(e){this._config.lockRotation.value=e,this._component.lockRotation=e}get zoom(){return this._config.zoom.value}set zoom(e){this._config.zoom.value=e,this._component.zoom=e}get frontOffset(){return this._config.frontOffset.value}set frontOffset(e){this._config.frontOffset.value=e,this._component.frontOffset=e}get sizeX(){return this._config.sizeX.value}set sizeX(e){this._config.sizeX.value=e;const{sizeX:t,sizeY:s}=this._config,i=new He(t.value,s.value);this._component.resize(i)}get sizeY(){return this._config.sizeY.value}set sizeY(e){this._config.sizeY.value=e;const{sizeX:t,sizeY:s}=this._config,i=new He(t.value,s.value);this._component.resize(i)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.backgroundColor=e}}class Vu{constructor(e,t){if(p(this,"onDisposed",new $),p(this,"onAfterUpdate",new $),p(this,"onBeforeUpdate",new $),p(this,"onResize",new $),p(this,"onSetup",new $),p(this,"frontOffset",0),p(this,"overrideMaterial",new $a),p(this,"backgroundColor",new ve(395274)),p(this,"renderer"),p(this,"enabled",!0),p(this,"world"),p(this,"config"),p(this,"isSetup",!1),p(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new ve(395274)}),p(this,"_lockRotation",!0),p(this,"_size",new He(320,160)),p(this,"_camera"),p(this,"_plane"),p(this,"_tempVector1",new x),p(this,"_tempVector2",new x),p(this,"_tempTarget",new x),p(this,"down",new x(0,-1,0)),p(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const n=[],r=this.world.renderer.three;for(const o of r.clippingPlanes)n.push(o);n.push(this._plane),this.renderer.clippingPlanes=n}),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new xs,this.renderer.setSize(this._size.x,this._size.y);const s=1,i=this._size.x/this._size.y;this._camera=new Gt(s*i/-2,s*i/2,s/2,s/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new Is(this.down,200),this.updatePlanes(),this.config=new Yu(this,t,"MiniMap"),t.get(ut).list.add(this.config)}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof Pi))throw new Error("The given world must have a THREE.Scene as a root!");const s=t.controls;if(s.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(s.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){s.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,s=1;this._camera.left=s*t/-2,this._camera.right=s*t/2,this._camera.top=s/2,this._camera.bottom=-s/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const Sa=class Aa extends Ae{constructor(e){super(e),p(this,"onAfterUpdate",new $),p(this,"onBeforeUpdate",new $),p(this,"onDisposed",new $),p(this,"onSetup",new $),p(this,"enabled",!0),p(this,"list",new Map),this.components.add(Aa.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new Vu(e,this.components);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};p(Sa,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let sd=Sa;const Oa=class Na extends Ae{constructor(e){super(e),p(this,"enabled",!0),e.add(Na.uuid,this)}static distanceFromPointToLine(e,t,s,i=!1){const n=new it,r=new x;return n.set(t,s),n.closestPointToPoint(e,i,r),r.distanceTo(e)}getFace(e,t,s){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const i=new Map,n=e.geometry.index.array,{plane:r}=this.getFaceData(t,s,e),o=[];for(let d=0;dR.id);if(!u.size){const R=a++;for(const{id:S}of I)c.set(S,R);h.set(R,{edges:new Set(f),indices:new Set([d])});continue}let E=null;const C=new Set,T=new Set(f);for(const[R,S]of u){E===null?E=S:S!==E&&C.add(S),c.delete(R);const{edges:L}=h.get(S);L.delete(R),T.delete(R)}if(E===null)throw new Error("Error computing face!");const m=h.get(E),{indices:A}=m;A.add(d);for(const R of T){c.set(R,E);const{edges:S}=m;S.add(R)}for(const R of C){const S=h.get(R),{edges:L,indices:y}=S,w=h.get(E),{edges:P,indices:M}=w;for(const B of L)P.add(B),c.set(B,E);for(const B of y)M.add(B);h.delete(R)}}for(const[d,{indices:I,edges:u}]of h)if(I.has(t)){const f=[];for(const E of u){const C=i.get(E);f.push(C)}return{edges:f,indices:I}}return null}getVerticesAndNormal(e,t,s){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const i=e.geometry.index.array,n=e.geometry.attributes.position.array,r=e.geometry.attributes.normal.array,o=i[t*3]*3,a=i[t*3+1]*3,c=i[t*3+2]*3,h=new x(n[o],n[o+1],n[o+2]),d=new x(n[a],n[a+1],n[a+2]),I=new x(n[c],n[c+1],n[c+2]),u=new x(r[o],r[o+1],r[o+2]),f=new x(r[a],r[a+1],r[a+2]),E=new x(r[c],r[c+1],r[c+2]),C=(u.x+f.x+E.x)/3,T=(u.y+f.y+E.y)/3,m=(u.z+f.z+E.z)/3,A=new x(C,T,m);if(s!==void 0&&e instanceof Vt){const R=new Ee;e.getMatrixAt(s,R);const S=new Ee;S.extractRotation(R),A.applyMatrix4(S),h.applyMatrix4(R),d.applyMatrix4(R),I.applyMatrix4(R)}return{p1:h,p2:d,p3:I,faceNormal:A}}round(e){e.x=Math.trunc(e.x*1e3)/1e3,e.y=Math.trunc(e.y*1e3)/1e3,e.z=Math.trunc(e.z*1e3)/1e3}getVolumeFromFragments(e){const t=this.components.get(Re),s=new Ee,i=[];for(const r in e){const o=t.list.get(r);if(!o)continue;const a=e[r];let c=0;for(const I of a){const u=o.getInstancesIDs(I);u&&(c+=u.size)}const h=new Vt(o.mesh.geometry,void 0,c);let d=0;for(const I of a){const u=o.getInstancesIDs(I);if(u)for(const f of u)o.mesh.getMatrixAt(f,s),h.setMatrixAt(d++,s)}i.push(h)}const n=this.getVolumeFromMeshes(i);for(const r of i)r.geometry=null,r.material=[],r.dispose();return n}getVolumeFromMeshes(e){let t=0;for(const s of e)t+=this.getVolumeOfMesh(s);return t}getFaceData(e,t,s){const i=this.getVerticesAndNormal(s,e,t),{p1:n,p2:r,p3:o,faceNormal:a}=i;this.round(n),this.round(r),this.round(o),this.round(a);const c=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o}];c.sort((m,A)=>m.idA.id?1:0);const[{id:h,value:d},{id:I,value:u},{id:f,value:E}]=c,C=[{id:`${h}|${I}`,distance:d.distanceTo(u),points:[d,u]},{id:`${I}|${f}`,distance:u.distanceTo(E),points:[u,E]},{id:`${h}|${f}`,distance:d.distanceTo(E),points:[d,E]}],T=new Is;return T.setFromNormalAndCoplanarPoint(a,n),T.constant=Math.round(T.constant*10)/10,{plane:T,edges:C}}getVolumeOfMesh(e){let t=0;const s=new x,i=new x,n=new x,{index:r}=e.geometry,o=e.geometry.attributes.position.array;if(!r)return console.warn("Geometry must be indexed to compute its volume!"),0;const a=[];if(e instanceof Vt)for(let h=0;h{const r={parameter:i,currentValue:t,requiredValue:s.parameter,pass:!1};n&&this.addCheckResult(r,n);let o=!1;if(s.type==="simple"){const a=s.parameter;o=t===a}if(s.type==="enumeration"&&(o=s.parameter.includes(t)),s.type==="pattern"){const a=s.parameter;o=new RegExp(a).test(String(t))}if(s.type==="length"){const a=s.parameter,{min:c,length:h,max:d}=a;h!==void 0&&(o=String(t).length===h),c!==void 0&&(o=String(t).length>=c),d!==void 0&&(o=String(t).length<=d)}if(s.type==="bounds"&&typeof t=="number"){const{min:a,minInclusive:c,max:h,maxInclusive:d}=s.parameter;let I=!0,u=!0;a!==void 0&&(I=c?t<=a:t=h:t>h),o=I&&u}return this.cardinality==="prohibited"&&(o=!o),this.cardinality==="optional"&&(o=!0),r.pass=o,r.pass}),p(this,"testResult",[]),this.components=e}addCheckResult(e,t){const s=t.findIndex(({parameter:i})=>i===e.parameter);s!==-1?t[s]=e:t.push(e)}saveResult(e,t){const{GlobalId:s}=e;if(!s)return;const{value:i}=s,n={expressID:i,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const Rt=(l,e)=>{let t="";return e?(e.type==="simple"&&(t=`${e.parameter}`),e.type==="enumeration"&&(t=` + ${e.parameter.map(s=>``).join(`\r +`)} + `),e.type==="pattern"&&(t=` + + `),` + ${t} + `):t};class Gu extends Ui{constructor(e,t){super(e),p(this,"name"),p(this,"value"),this.name=t}serialize(e){const t=Rt("Name",this.name),s=Rt("Value",this.value);let i="";return e==="requirement"&&(i+=`cardinality="${this.cardinality}"`,i+=this.instructions?`instructions="${this.instructions}"`:""),` + ${t} + ${s} +`}async getEntities(){return[]}async test(e){var t;this.testResult=[];for(const i in e){const n=Number(i),r=e[n],o=[],a={guid:(t=r.GlobalId)==null?void 0:t.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a);const c=Object.keys(r).filter(d=>{const I=this.evalRequirement(d,this.name,"Name"),u=r[d];return I&&u===null?this.cardinality==="optional"||this.cardinality==="prohibited":I&&(u==null?void 0:u.type)===3&&u.value===2||I&&Array.isArray(u)&&u.length===0||I&&(u==null?void 0:u.type)===1&&u.value.trim()===""?!1:I}),h=c.length>0;if(o.push({parameter:"Name",currentValue:h?c[0]:null,requiredValue:this.name.parameter,pass:this.cardinality==="prohibited"?!h:h}),this.value)if(c[0]){const d=r[c[0]];(d==null?void 0:d.type)===5?o.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:this.cardinality==="prohibited"}):this.evalRequirement(d?d.value:null,this.value,"Value",o)}else o.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:this.cardinality==="prohibited"});a.pass=o.every(({pass:d})=>d)}const s=[...this.testResult];return this.testResult=[],s}}class zu extends Ui{constructor(e,t){super(e),p(this,"system"),p(this,"value"),p(this,"uri"),this.system=t}serialize(e){const t=Rt("System",this.system),s=Rt("Value",this.value);let i="";return e==="requirement"&&(i+=`cardinality="${this.cardinality}"`,i+=this.uri?`uri=${this.uri}`:"",i+=this.instructions?`instructions="${this.instructions}"`:""),` + ${t} + ${s} +`}async getEntities(e,t={}){var s;const i=[],n=await e.getAllPropertiesOfType(It),r=await e.getAllPropertiesOfType(Ht),o={...n,...r},a=[];for(const h in o){const d=Number(h),I=await e.getProperties(d);if(!I)continue;const u=(s=I.ReferencedSource)==null?void 0:s.value;if(!u)continue;const f=await e.getProperties(u);!f||!this.evalSystem(f)||!this.evalValue(I)||!this.evalURI(I)||a.push(d)}const c=this.components.get(rt);for(const h of a){const d=c.getEntitiesWithRelation(e,"HasAssociations",h);for(const I of d){if(I in t)continue;const u=await e.getProperties(I);u&&(t[I]=u,i.push(I))}}return i}async test(e,t){var s;this.testResult=[];for(const n in e){const r=Number(n),o=e[r],a=[],c={guid:(s=o.GlobalId)==null?void 0:s.value,expressID:r,pass:!1,checks:a,cardinality:this.cardinality};this.testResult.push(c);let h=!0;const d=await this.getSystems(t,r),I=d.map(u=>this.getSystemName(u)).filter(u=>u);for(const u of d){if(!this.evalSystem(u,a))continue;if(h=!1,!(this.value&&this.system))break;if(u.type!==It)continue;const f=!this.value||this.evalValue(u,a),E=!this.uri||this.evalURI(u,a);if(f&&E)break}h&&this.addCheckResult({parameter:"System",currentValue:I,requiredValue:this.system,pass:this.cardinality==="optional"},a),c.pass=a.every(({pass:u})=>u)}const i=[...this.testResult];return this.testResult=[],i}async processReferencedSource(e,t){var s;const i=(s=t.ReferencedSource)==null?void 0:s.value;if(!i)return null;const n=await e.getProperties(i);return n?(n.type===It&&(n.ReferencedSource=await this.processReferencedSource(e,n)),n):null}async getSystems(e,t){var s;const i=[],n=this.components.get(rt),r=n.getEntityRelations(e,t,"HasAssociations");if(r)for(const d of r){const I=await e.getProperties(d);I&&(I.type===Ht&&i.push(I),I.type===It&&(I.ReferencedSource=await this.processReferencedSource(e,I),I.ReferencedSource&&i.push(I)))}const o=i.map(d=>{var I,u,f;return d.type===Ht?(I=d.Name)==null?void 0:I.value:d.type===It?(f=(u=d.ReferencedSource)==null?void 0:u.Name)==null?void 0:f.value:null}).filter(d=>d),a=n.getEntityRelations(e,t,"IsTypedBy");if(!(a&&a[0]))return i;const c=a[0],h=n.getEntityRelations(e,c,"HasAssociations");if(h)for(const d of h){const I=await e.getProperties(d);if(I){if(I.type===Ht){if(o.includes((s=I.Name)==null?void 0:s.value))continue;i.push(I)}I.type===It&&(I.ReferencedSource=await this.processReferencedSource(e,I),I.ReferencedSource&&i.push(I))}}return i}getSystemName(e){var t,s,i,n;if(e.type===Ht)return(t=e.Name)==null?void 0:t.value;if(e.type===It){if(((s=e.ReferencedSource)==null?void 0:s.type)===It)return this.getSystemName(e.ReferencedSource);if(((i=e.ReferencedSource)==null?void 0:i.type)===Ht)return(n=e.ReferencedSource.Name)==null?void 0:n.value}return null}getAllReferenceIdentifications(e){if(e.type!==It)return null;const t=[];if(e.Identification&&t.push(e.Identification.value),e.ReferencedSource){const s=this.getAllReferenceIdentifications(e.ReferencedSource);s&&t.push(...s)}return t}evalSystem(e,t){const s=this.getSystemName(e);return this.evalRequirement(s,this.system,"System",t)}evalValue(e,t){if(!this.value)return!0;const s=this.getAllReferenceIdentifications(e);if(!s)return!1;const i=s.find(n=>this.value?this.evalRequirement(n,this.value,"Value"):!1);return t&&this.addCheckResult({parameter:"Value",currentValue:i??null,requiredValue:this.value,pass:!!i},t),!!i}evalURI(e,t){var s;return this.uri?this.evalRequirement((s=e.Location)==null?void 0:s.value,{type:"simple",parameter:this.uri},"URI",t):!0}}class ku extends Ui{constructor(e,t){super(e),p(this,"name"),p(this,"predefinedType"),this.name=t}serialize(e){const t=Rt("Name",this.name),s=Rt("Name",this.predefinedType);let i="";return e==="requirement"&&(i+=`cardinality="${this.cardinality}"`,i+=this.instructions?`instructions="${this.instructions}"`:""),` + ${t} + ${s} +`}async getEntities(e,t={}){const s=Object.entries(yi),i=[];for(const[o]of s)await this.evalName({type:o})&&i.push(Number(o));let n={};for(const o of i){const a=await e.getAllPropertiesOfType(o);a&&(n={...n,...a})}if(!this.predefinedType){for(const o in n)o in t||(t[o]=n[o]);return Object.keys(n).map(Number)}const r=[];for(const o in n){const a=Number(o);if(a in t)continue;const c=n[a];await this.evalPredefinedType(e,c)&&(t[a]=c,r.push(a))}return r}async test(e,t){var s;this.testResult=[];for(const i in e){const n=Number(i),r=e[n],o=[],a={guid:(s=r.GlobalId)==null?void 0:s.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a),await this.evalName(r,o),await this.evalPredefinedType(t,r,o),a.pass=o.every(({pass:c})=>c)}return this.testResult}async evalName(e,t){const s=yi[e.type];return this.evalRequirement(s,this.name,"Name",t)}async evalPredefinedType(e,t,s){var i,n,r,o;if(!this.predefinedType)return null;const a=this.components.get(rt),c=typeof this.predefinedType.parameter=="string"&&this.predefinedType.parameter==="USERDEFINED";let h=(i=t.PredefinedType)==null?void 0:i.value;if(h==="USERDEFINED"&&!c){const d=Object.keys(t).find(I=>/^((?!Predefined).)*Type$/.test(I));h=d?(n=t[d])==null?void 0:n.value:"USERDEFINED"}if(!h){const d=a.getEntityRelations(e,t.expressID,"IsTypedBy");if(d&&d[0]){const I=await e.getProperties(d[0]);if(I&&(h=(r=I.PredefinedType)==null?void 0:r.value,h==="USERDEFINED"&&!c)){const u=Object.keys(I).find(f=>/^((?!Predefined).)*Type$/.test(f));h=u?(o=I[u])==null?void 0:o.value:"USERDEFINED"}}}return this.evalRequirement(h,this.predefinedType,"PredefinedType",s)}}class Hu extends Ui{constructor(e,t,s){super(e),p(this,"propertySet"),p(this,"baseName"),p(this,"value"),p(this,"dataType"),p(this,"uri"),p(this,"_unsupportedTypes",[qa,Qa]),this.propertySet=t,this.baseName=s}serialize(e){const t=Rt("PropertySet",this.propertySet),s=Rt("BaseName",this.baseName),i=Rt("Value",this.value),n=this.dataType?`dataType=${this.dataType}`:"";let r="";return e==="requirement"&&(r+=`cardinality="${this.cardinality}"`,r+=this.uri?`uri=${this.uri}`:"",r+=this.instructions?`instructions="${this.instructions}"`:""),` + ${t} + ${s} + ${i} +`}async getEntities(e,t={}){var s,i;let n={};const r=await e.getAllPropertiesOfType(ls);n={...n,...r};const o=await e.getAllPropertiesOfType(Ci);if(n={...n,...o},Object.keys(n).length===0)return[];const a=[];for(const h in n){const d=Number(h),I=await e.getProperties(d);if(!I||((s=I.Name)==null?void 0:s.value)!==this.propertySet.parameter)continue;let u;if(I.type===ls&&(u="HasProperties"),I.type===Ci&&(u="Quantities"),!!u)for(const f of I[u]){const E=await e.getProperties(f.value);if(!(!E||((i=E.Name)==null?void 0:i.value)!==this.baseName.parameter)){if(this.value){const C=Object.keys(E).find(T=>T.endsWith("Value"));if(!C||E[C].value!==this.value.parameter)continue}a.push(d)}}}const c=this.components.get(rt);for(const h of a){const d=c.getEntitiesWithRelation(e,"IsDefinedBy",h);for(const I of d){if(I in t)continue;const u=await e.getProperties(I);u&&(t[I]=u)}}return[]}async test(e,t){var s;this.testResult=[];for(const n in e){const r=Number(n),o=e[r],a=[],c={guid:(s=o.GlobalId)==null?void 0:s.value,expressID:r,pass:!1,checks:a,cardinality:this.cardinality};this.testResult.push(c);const h=(await this.getPsets(t,r)).filter(d=>{var I;return this.evalRequirement(((I=d.Name)==null?void 0:I.value)??null,this.propertySet,"PropertySet")?(a.push({currentValue:d.Name.value,parameter:"PropertySet",pass:!0,requiredValue:this.propertySet.parameter}),!0):!1});if(h.length===0){a.push({currentValue:null,parameter:"PropertySet",pass:!1,requiredValue:this.propertySet.parameter});continue}for(const d of h){const I=this.getItemsAttrName(d.type);if(!I){a.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}const u=d[I].filter(f=>{var E;return this._unsupportedTypes.includes(f.type)||!this.evalRequirement(((E=f.Name)==null?void 0:E.value)??null,this.baseName,"BaseName")?!1:(a.push({currentValue:f.Name.value,parameter:"BaseName",pass:!0,requiredValue:this.baseName.parameter}),!0)});if(u.length===0){a.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}for(const f of u)this.evalValue(f,a),this.evalDataType(f,a),this.evalURI()}c.pass=a.every(({pass:d})=>d)}const i=[...this.testResult];return this.testResult=[],i}getItemsAttrName(e){let t;return e===ls&&(t="HasProperties"),e===Ci&&(t="Quantities"),t}getValueKey(e){return Object.keys(e).find(t=>t.endsWith("Value")||t.endsWith("Values"))}async getPsets(e,t){const s=[],i=this.components.get(rt).getEntityRelations(e,t,"IsDefinedBy");if(!i)return s;for(const n of i){const r=await e.getProperties(n);if(!r)continue;const o=this.getItemsAttrName(r.type);if(!o)continue;const a=structuredClone(r),c=[];for(const{value:h}of a[o]){const d=await e.getProperties(h);d&&c.push(d)}a[o]=c,s.push(a)}return s}evalValue(e,t){const s=this.getValueKey(e);if(this.value){if(!s)return t==null||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:this.value.parameter}),!1;const n=e[s],r=structuredClone(this.value);if(n.name==="IFCLABEL"&&r.type==="simple"&&(r.parameter=String(r.parameter)),(e.type===cr||e.type===hr)&&Array.isArray(n)){const o=n.map(c=>c.value),a=n.find(c=>r?this.evalRequirement(c.value,r,"Value"):!1);return t==null||t.push({currentValue:o,pass:!!a,parameter:"Value",requiredValue:r.parameter}),!!a}return this.evalRequirement(n.value,r,"Value",t)}if(!s)return!0;const i=e[s];return i.type===3&&i.value===2?(t==null||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:null}),!1):i.type===1&&i.value.trim()===""?(t==null||t.push({parameter:"Value",currentValue:"",pass:!1,requiredValue:null}),!1):!0}evalDataType(e,t){if(!this.dataType)return!0;const s=this.getValueKey(e),i=e[s];if((e.type===cr||e.type===hr)&&Array.isArray(i)&&i[0]){const n=i[0].name;return this.evalRequirement(n,{type:"simple",parameter:this.dataType},"DataType",t)}return this.evalRequirement(i.name,{type:"simple",parameter:this.dataType},"DataType",t)}evalURI(){return!0}}class Wu{constructor(e,t,s){p(this,"name"),p(this,"ifcVersion",new Set),p(this,"identifier",vt.create()),p(this,"description"),p(this,"instructions"),p(this,"requirementsDescription"),p(this,"applicability",new Tt),p(this,"requirements",new Tt),p(this,"components"),this.components=e,this.name=t;for(const i of s)this.ifcVersion.add(i)}async test(e){let t=[];if(this.requirements.size===0)return t;const s={};for(const i of this.applicability)await i.getEntities(e,s);return t=await[...this.requirements][0].test(s,e),t}serialize(){const e=`name="${this.name}"`,t=this.identifier?`identifier="${this.identifier}"`:"",s=this.description?`description="${this.description}"`:"",i=this.instructions?`instructions="${this.instructions}"`:"";return` + + ${[...this.applicability].map(n=>n.serialize("applicability"))} + + + ${[...this.requirements].map(n=>n.serialize("requirement"))} + + `}}const gt=l=>{if(!l)return;const e={type:"simple"};if("simpleValue"in l&&(e.parameter=l.simpleValue),"restriction"in l){const t=l.restriction;if("pattern"in t&&(e.type="pattern",e.parameter=t.pattern.value),"enumeration"in t){e.type="enumeration";const s=t.enumeration.map(({value:i})=>i);e.parameter=s}}if(e.parameter!==void 0)return e},ao=(l,e)=>{const t=[];for(const s of e){const i=s.name,n=gt(i);if(!n)continue;const r=new ku(l,n);s.cardinality&&(r.cardinality=s.cardinality),r.predefinedType=gt(s.predefinedType),t.push(r)}return t},Xu=(l,e)=>{const t=[];for(const s of e){const i=s.name,n=gt(i);if(!n)continue;const r=new Gu(l,n);s.cardinality&&(r.cardinality=s.cardinality),r.value=gt(s.value),t.push(r)}return t},ju=(l,e)=>{const t=[];for(const s of e){const i=s.system,n=gt(i);if(!n)continue;const r=new zu(l,n);s.cardinality&&(r.cardinality=s.cardinality);const o=gt(s.value);(o==null?void 0:o.type)==="simple"&&(o.parameter=String(o.parameter)),(o==null?void 0:o.type)==="enumeration"&&Array.isArray(o.parameter)&&(o.parameter=o.parameter.map(String)),r.value=o,r.uri=s.uri,t.push(r)}return t},Zu=(l,e)=>{const t=[];for(const s of e){const i=s.propertySet,n=s.baseName,r=gt(i),o=gt(n);if(!(o&&r))continue;const a=new Hu(l,r,o);s.cardinality&&(a.cardinality=s.cardinality);const c=gt(s.value);(c==null?void 0:c.type)==="enumeration"&&Array.isArray(c.parameter)&&(c.parameter=c.parameter.map(String)),a.value=c,a.dataType=s.dataType,a.uri=s.uri,t.push(a)}return t},lo=class Ln extends Ae{constructor(e){super(e),p(this,"enabled",!0),p(this,"list",new St),e.add(Ln.uuid,this)}getFragmentIdMap(e,t){const s=t.filter(o=>o.pass).map(o=>o.expressID),i=e.getFragmentMap(s),n=t.filter(o=>!o.pass).map(o=>o.expressID),r=e.getFragmentMap(n);return{pass:i,fail:r}}create(e,t){const s=new Wu(this.components,e,t);return this.list.set(s.identifier,s),s}load(e){const t=[],s=Ln.xmlParser.parse(e).ids,{specifications:i}=s;if(i&&i.specification){const n=Array.isArray(i.specification)?i.specification:[i.specification];for(const r of n){const{name:o,ifcVersion:a}=r;if(!(o&&a))continue;const c=[],h=[],{applicability:d,requirements:I}=r;if(d){const{maxOccurs:u,...f}=d,E=Array.isArray(f)?f:[f];for(const C of E)for(const T in C){const m=Array.isArray(C[T])?C[T]:[C[T]];if(T==="entity"){const A=ao(this.components,m);c.push(...A)}}}if(I){const{maxOccurs:u,...f}=I,E=Array.isArray(f)?f:[f];for(const C of E)for(const T in C){const m=Array.isArray(C[T])?C[T]:[C[T]];if(T==="entity"){const A=ao(this.components,m);h.push(...A)}if(T==="attribute"){const A=Xu(this.components,m);h.push(...A)}if(T==="classification"){const A=ju(this.components,m);h.push(...A)}if(T==="property"){const A=Zu(this.components,m);h.push(...A)}}}if(c.length>0&&h.length>0){const u=this.create(o,a.split(/\s+/));u.applicability.add(...c),u.requirements.add(...h),t.push(u)}}}return t}export(e,t=this.list.values()){const s=t??this.list;return` + + + ${e.title} + ${e.copyright?`${e.copyright}`:""} + ${e.version?`${e.version}`:""} + ${e.description?`${e.description}`:""} + ${e.author?`${e.author}`:""} + ${e.date?`${e.date.toISOString().split("T")[0]}`:""} + ${e.purpose?`${e.purpose}`:""} + ${e.milestone?`${e.milestone}`:""} + + + ${[...s].map(i=>i.serialize()).join(` +`)} + +`}};p(lo,"uuid","9f0b9f78-9b2e-481a-b766-2fbfd01f342c"),p(lo,"xmlParser",new ta.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));export{bc as A,yi as C,Gc as F,Ju as G,sd as H,Ye as M,uh as N,Ku as O,Nc as Q,oo as R,sh as S,Re as T,yn as U,id as W,ah as _,Du as a,io as b,hh as c,ro as d,_c as e,xu as f,td as g,Qu as h,rt as k,qu as m,mn as o,Fo as p,Ct as s,Vs as v,Mu as w,Eh as y,ed as z}; diff --git a/examples/assets/index-BELYWC4t.js b/examples/assets/index-BELYWC4t.js deleted file mode 100644 index 868807e4b..000000000 --- a/examples/assets/index-BELYWC4t.js +++ /dev/null @@ -1,162 +0,0 @@ -var Qr=Object.defineProperty;var Kr=(a,e,t)=>e in a?Qr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var O=(a,e,t)=>(Kr(a,typeof e!="symbol"?e+"":e,t),t);import{d as As,V as W,h as Ie,y as rn,s as le,T as us,S as Ei,c as Ft,t as Nt,ba as qr,Q as mi,a$ as Rn,a as et,b0 as Jr,J as to,e as Rs,x as on,P as pr,aw as eo,w as so,ax as qt,ay as io,u as an,am as no,z as ro,W as oo,ap as ao,b as Ve,r as ei,az as _i,C as cn,O as si,E as co,L as Er,K as xt,B as Lt,H as yn,aA as ws,au as ue,aB as lo,aC as je,N as mr,X as ho,Y as ln,Z as Ir,_ as Cr,$ as Tr,a0 as hn,a1 as gr,a2 as _r,a3 as un,a4 as Ar,a5 as Rr,a6 as yr,a7 as Or,a8 as Fr,a9 as Sr,aa as uo,ab as fo,I as wr,aD as Nr,aE as br,av as Pr,ag as Os,j as po,i as Eo,ai as mo,b1 as Io,aF as Co,aG as To,aH as go,aI as _o,aJ as Ao,aK as Ro,b2 as yo,b3 as Oo,b4 as Fo,b5 as So,ac as On,ad as Fn,ae as wo,af as No,ah as bo}from"./web-ifc-api-CgBULNZm.js";import{c as Ns,g as Po}from"./_commonjsHelpers-Cpj98o6Y.js";const Lr=0,Lo=1,Mo=2,Sn=2,Ai=1.25,wn=1,Js=6*4+4+4,Ii=65535,vo=Math.pow(2,-24),Ri=Symbol("SKIP_GENERATION");function xo(a){return a.index?a.index.count:a.attributes.position.count}function We(a){return xo(a)/3}function Uo(a,e=ArrayBuffer){return a>65535?new Uint32Array(new e(4*a)):new Uint16Array(new e(2*a))}function Do(a,e){if(!a.index){const t=a.attributes.position.count,s=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Uo(t,s);a.setIndex(new As(i,1));for(let n=0;no-c);for(let o=0;on.offset-r.offset),s=t[t.length-1];s.count=Math.min(e-s.offset,s.count);let i=0;return t.forEach(({count:n})=>i+=n),e!==i}function gt(a,e,t){return t.min.x=e[a],t.min.y=e[a+1],t.min.z=e[a+2],t.max.x=e[a+3],t.max.y=e[a+4],t.max.z=e[a+5],t}function ko(a){a[0]=a[1]=a[2]=1/0,a[3]=a[4]=a[5]=-1/0}function Nn(a){let e=-1,t=-1/0;for(let s=0;s<3;s++){const i=a[s+3]-a[s];i>t&&(t=i,e=s)}return e}function bn(a,e){e.set(a)}function Pn(a,e,t){let s,i;for(let n=0;n<3;n++){const r=n+3;s=a[n],i=e[n],t[n]=si?s:i}}function bs(a,e,t){for(let s=0;s<3;s++){const i=e[a+2*s],n=e[a+2*s+1],r=i-n,o=i+n;rt[s+3]&&(t[s+3]=o)}}function Qe(a){const e=a[3]-a[0],t=a[4]-a[1],s=a[5]-a[2];return 2*(e*t+t*s+s*e)}function yi(a,e,t,s,i=null){let n=1/0,r=1/0,o=1/0,c=-1/0,l=-1/0,h=-1/0,u=1/0,d=1/0,f=1/0,E=-1/0,p=-1/0,T=-1/0;const m=i!==null;for(let _=e*6,R=(e+t)*6;_c&&(c=w),m&&gE&&(E=g);const L=a[_+2],N=a[_+3],M=L-N,z=L+N;Ml&&(l=z),m&&Lp&&(p=L);const y=a[_+4],P=a[_+5],I=y-P,v=y+P;Ih&&(h=v),m&&yT&&(T=y)}s[0]=n,s[1]=r,s[2]=o,s[3]=c,s[4]=l,s[5]=h,m&&(i[0]=u,i[1]=d,i[2]=f,i[3]=E,i[4]=p,i[5]=T)}function zo(a,e,t,s){let i=1/0,n=1/0,r=1/0,o=-1/0,c=-1/0,l=-1/0;for(let h=e*6,u=(e+t)*6;ho&&(o=d);const f=a[h+2];fc&&(c=f);const E=a[h+4];El&&(l=E)}s[0]=i,s[1]=n,s[2]=r,s[3]=o,s[4]=c,s[5]=l}function Yo(a,e){ko(e);const t=a.attributes.position,s=a.index?a.index.array:null,i=We(a),n=new Float32Array(i*6),r=t.normalized,o=t.array,c=t.offset||0;let l=3;t.isInterleavedBufferAttribute&&(l=t.data.stride);const h=["getX","getY","getZ"];for(let u=0;uF&&(F=R),g>F&&(F=g);const w=(F-A)/2,L=m*2;n[f+L+0]=A+w,n[f+L+1]=w+(Math.abs(A)+w)*vo,Ae[m+3]&&(e[m+3]=F)}}return n}const ce=32,Vo=(a,e)=>a.candidate-e.candidate,de=new Array(ce).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Ps=new Float32Array(6);function Go(a,e,t,s,i,n){let r=-1,o=0;if(n===Lr)r=Nn(e),r!==-1&&(o=(e[r]+e[r+3])/2);else if(n===Lo)r=Nn(a),r!==-1&&(o=Ho(t,s,i,r));else if(n===Mo){const c=Qe(a);let l=Ai*i;const h=s*6,u=(s+i)*6;for(let d=0;d<3;d++){const f=e[d],T=(e[d+3]-f)/ce;if(i=w.candidate?bs(g,t,w.rightCacheBounds):(bs(g,t,w.leftCacheBounds),w.count++)}}for(let g=0;g=ce&&(F=ce-1);const w=de[F];w.count++,bs(R,t,w.bounds)}const m=de[ce-1];bn(m.bounds,m.rightCacheBounds);for(let R=ce-2;R>=0;R--){const g=de[R],A=de[R+1];Pn(g.bounds,A.rightCacheBounds,g.rightCacheBounds)}let _=0;for(let R=0;R=c;)o--;if(r=c;)o--;if(r2**16,i=s?4:2,n=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),r=s?new Uint32Array(n):new Uint16Array(n);for(let o=0,c=r.length;o=i&&(u=!0,n&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),F<=r||L>=i)return _(A+F),g.offset=A,g.count=F,g;const N=Go(g.boundingData,w,E,A,F,o);if(N.axis===-1)return _(A+F),g.offset=A,g.count=F,g;const M=p(h,s,E,A,F,N);if(M===A||M===A+F)_(A+F),g.offset=A,g.count=F;else{g.splitAxis=N.axis;const z=new Ls,y=A,P=M-A;g.left=z,z.boundingData=new Float32Array(6),yi(E,y,P,z.boundingData,f),R(z,y,P,f,L+1);const I=new Ls,v=M,$=F-P;g.right=I,I.boundingData=new Float32Array(6),yi(E,v,$,I.boundingData,f),R(I,v,$,f,L+1)}return g}}function jo(a,e){const t=a.geometry;e.indirect&&(a._indirectBuffer=Zo(t,e.useSharedArrayBuffer),Bo(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),a._indirectBuffer||Do(t,e);const s=$o(a,e);let i,n,r;const o=[],c=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[f+6]=g/4,g=h(g,_),n[f+7]=R,g}}}class he{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let s=1/0,i=-1/0;for(let n=0,r=e.length;ni?c:i}this.min=s,this.max=i}setFromPoints(e,t){let s=1/0,i=-1/0;for(let n=0,r=t.length;ni?c:i}this.min=s,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}he.prototype.setFromBox=function(){const a=new W;return function(t,s){const i=s.min,n=s.max;let r=1/0,o=-1/0;for(let c=0;c<=1;c++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){a.x=i.x*c+n.x*(1-c),a.y=i.y*l+n.y*(1-l),a.z=i.z*h+n.z*(1-h);const u=t.dot(a);r=Math.min(u,r),o=Math.max(u,o)}this.min=r,this.max=o}}();const Qo=function(){const a=new W,e=new W,t=new W;return function(i,n,r){const o=i.start,c=a,l=n.start,h=e;t.subVectors(o,l),a.subVectors(i.end,i.start),e.subVectors(n.end,n.start);const u=t.dot(h),d=h.dot(c),f=h.dot(h),E=t.dot(c),T=c.dot(c)*f-d*d;let m,_;T!==0?m=(u*d-E*f)/T:m=0,_=(u+m*d)/f,r.x=m,r.y=_}}(),dn=function(){const a=new Ie,e=new W,t=new W;return function(i,n,r,o){Qo(i,n,a);let c=a.x,l=a.y;if(c>=0&&c<=1&&l>=0&&l<=1){i.at(c,r),n.at(l,o);return}else if(c>=0&&c<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){c<0?i.at(0,r):i.at(1,r),n.closestPointToPoint(r,!0,o);return}else{let h;c<0?h=i.start:h=i.end;let u;l<0?u=n.start:u=n.end;const d=e,f=t;if(i.closestPointToPoint(u,!0,e),n.closestPointToPoint(h,!0,t),d.distanceToSquared(u)<=f.distanceToSquared(h)){r.copy(d),o.copy(u);return}else{r.copy(h),o.copy(f);return}}}}(),Ko=function(){const a=new W,e=new W,t=new rn,s=new le;return function(n,r){const{radius:o,center:c}=n,{a:l,b:h,c:u}=r;if(s.start=l,s.end=h,s.closestPointToPoint(c,!0,a).distanceTo(c)<=o||(s.start=l,s.end=u,s.closestPointToPoint(c,!0,a).distanceTo(c)<=o)||(s.start=h,s.end=u,s.closestPointToPoint(c,!0,a).distanceTo(c)<=o))return!0;const p=r.getPlane(t);if(Math.abs(p.distanceToPoint(c))<=o){const m=p.projectPoint(c,e);if(r.containsPoint(m))return!0}return!1}}(),qo=1e-15;function Oi(a){return Math.abs(a)new W),this.satBounds=new Array(4).fill().map(()=>new he),this.points=[this.a,this.b,this.c],this.sphere=new Ei,this.plane=new rn,this.needsUpdate=!0}intersectsSphere(e){return Ko(e,this)}update(){const e=this.a,t=this.b,s=this.c,i=this.points,n=this.satAxes,r=this.satBounds,o=n[0],c=r[0];this.getNormal(o),c.setFromPoints(o,i);const l=n[1],h=r[1];l.subVectors(e,t),h.setFromPoints(l,i);const u=n[2],d=r[2];u.subVectors(t,s),d.setFromPoints(u,i);const f=n[3],E=r[3];f.subVectors(s,e),E.setFromPoints(f,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}}te.prototype.closestPointToSegment=function(){const a=new W,e=new W,t=new le;return function(i,n=null,r=null){const{start:o,end:c}=i,l=this.points;let h,u=1/0;for(let d=0;d<3;d++){const f=(d+1)%3;t.start.copy(l[d]),t.end.copy(l[f]),dn(t,i,a,e),h=a.distanceToSquared(e),h=2){(g===1?m.start:m.end).copy(f),R=2;break}if(R++,R===2&&g===-1)break}}return R}return function(T,m=null,_=!1){this.needsUpdate&&this.update(),T.isExtendedTriangle?T.needsUpdate&&T.update():(a.copy(T),a.update(),T=a);const R=this.plane,g=T.plane;if(Math.abs(R.normal.dot(g.normal))>1-1e-10){const A=this.satBounds,F=this.satAxes;t[0]=T.a,t[1]=T.b,t[2]=T.c;for(let N=0;N<4;N++){const M=A[N],z=F[N];if(s.setFromPoints(z,t),M.isSeparated(s))return!1}const w=T.satBounds,L=T.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let N=0;N<4;N++){const M=w[N],z=L[N];if(s.setFromPoints(z,e),M.isSeparated(s))return!1}for(let N=0;N<4;N++){const M=F[N];for(let z=0;z<4;z++){const y=L[z];if(n.crossVectors(M,y),s.setFromPoints(n,e),i.setFromPoints(n,t),s.isSeparated(i))return!1}}return m&&(_||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const A=E(this,g,u);if(A===1&&T.containsPoint(u.end))return m&&(m.start.copy(u.end),m.end.copy(u.end)),!0;if(A!==2)return!1;const F=E(T,R,d);if(F===1&&this.containsPoint(d.end))return m&&(m.start.copy(d.end),m.end.copy(d.end)),!0;if(F!==2)return!1;if(u.delta(o),d.delta(c),o.dot(c)<0){let P=d.start;d.start=d.end,d.end=P}const w=u.start.dot(o),L=u.end.dot(o),N=d.start.dot(o),M=d.end.dot(o),z=L0?m.start.copy(u.start):m.start.copy(d.start),l.subVectors(u.end,d.end),l.dot(o)<0?m.end.copy(u.end):m.end.copy(d.end)),!0)}}}();te.prototype.distanceToPoint=function(){const a=new W;return function(t){return this.closestPointToPoint(t,a),t.distanceTo(a)}}();te.prototype.distanceToTriangle=function(){const a=new W,e=new W,t=["a","b","c"],s=new le,i=new le;return function(r,o=null,c=null){const l=o||c?s:null;if(this.intersectsTriangle(r,l))return(o||c)&&(o&&l.getCenter(o),c&&l.getCenter(c)),0;let h=1/0;for(let u=0;u<3;u++){let d;const f=t[u],E=r[f];this.closestPointToPoint(E,a),d=E.distanceToSquared(a),dnew W),this.satAxes=new Array(3).fill().map(()=>new W),this.satBounds=new Array(3).fill().map(()=>new he),this.alignedSatBounds=new Array(3).fill().map(()=>new he),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}set(e,t,s){this.min.copy(e),this.max.copy(t),this.matrix.copy(s),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Dt.prototype.update=function(){return function(){const e=this.matrix,t=this.min,s=this.max,i=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let u=0;u<=1;u++){const d=1*l|2*h|4*u,f=i[d];f.x=l?s.x:t.x,f.y=h?s.y:t.y,f.z=u?s.z:t.z,f.applyMatrix4(e)}const n=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){const h=r[l],u=n[l],d=1<new le),t=new Array(12).fill().map(()=>new le),s=new W,i=new W;return function(r,o=0,c=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(c||l)&&(r.getCenter(i),this.closestPointToPoint(i,s),r.closestPointToPoint(s,i),c&&c.copy(s),l&&l.copy(i)),0;const h=o*o,u=r.min,d=r.max,f=this.points;let E=1/0;for(let T=0;T<8;T++){const m=f[T];i.copy(m).clamp(u,d);const _=m.distanceToSquared(i);if(_new te)}}const Ht=new Jo;function zt(a,e){return e[a+15]===65535}function Yt(a,e){return e[a+6]}function Wt(a,e){return e[a+14]}function Xt(a){return a+8}function Zt(a,e){return e[a+6]}function xr(a,e){return e[a+7]}class ta{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=s=>{t&&e.push(t),t=s,this.float32Array=new Float32Array(s),this.uint16Array=new Uint16Array(s),this.uint32Array=new Uint32Array(s)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const It=new ta;let me,Ye;const Se=[],Ms=new fn(()=>new Nt);function ea(a,e,t,s,i,n){me=Ms.getPrimitive(),Ye=Ms.getPrimitive(),Se.push(me,Ye),It.setBuffer(a._roots[e]);const r=Yi(0,a.geometry,t,s,i,n);It.clearBuffer(),Ms.releasePrimitive(me),Ms.releasePrimitive(Ye),Se.pop(),Se.pop();const o=Se.length;return o>0&&(Ye=Se[o-1],me=Se[o-2]),r}function Yi(a,e,t,s,i=null,n=0,r=0){const{float32Array:o,uint16Array:c,uint32Array:l}=It;let h=a*2;if(zt(h,c)){const d=Yt(a,l),f=Wt(h,c);return gt(a,o,me),s(d,f,!1,r,n+a,me)}else{let M=function(y){const{uint16Array:P,uint32Array:I}=It;let v=y*2;for(;!zt(v,P);)y=Xt(y),v=y*2;return Yt(y,I)},z=function(y){const{uint16Array:P,uint32Array:I}=It;let v=y*2;for(;!zt(v,P);)y=Zt(y,I),v=y*2;return Yt(y,I)+Wt(v,P)};const d=Xt(a),f=Zt(a,l);let E=d,p=f,T,m,_,R;if(i&&(_=me,R=Ye,gt(E,o,_),gt(p,o,R),T=i(_),m=i(R),m(Ke.copy(e).clamp(h.min,h.max),Ke.distanceToSquared(e)),intersectsBounds:(h,u,d)=>d{h.closestPointToPoint(e,Ke);const d=e.distanceToSquared(Ke);return d0&&l.normal.multiplyScalar(-1));const h={a:n,b:r,c:o,normal:new W,materialIndex:0};us.getNormal(we,Ne,be,h.normal),l.face=h,l.faceIndex=n}return l}function Ci(a,e,t,s,i){const n=s*3;let r=n+0,o=n+1,c=n+2;const l=a.index;a.index&&(r=l.getX(r),o=l.getX(o),c=l.getX(c));const{position:h,normal:u,uv:d,uv1:f}=a.attributes,E=na(t,h,u,d,f,r,o,c,e);return E?(E.faceIndex=s,i&&i.push(E),E):null}function St(a,e,t,s){const i=a.a,n=a.b,r=a.c;let o=e,c=e+1,l=e+2;t&&(o=t.getX(o),c=t.getX(c),l=t.getX(l)),i.x=s.getX(o),i.y=s.getY(o),i.z=s.getZ(o),n.x=s.getX(c),n.y=s.getY(c),n.z=s.getZ(c),r.x=s.getX(l),r.y=s.getY(l),r.z=s.getZ(l)}function ra(a,e,t,s,i,n){const{geometry:r,_indirectBuffer:o}=a;for(let c=s,l=s+i;cF&&(F=y),Pw&&(w=P),IL&&(L=I)}return c[d+0]!==R||c[d+1]!==g||c[d+2]!==A||c[d+3]!==F||c[d+4]!==w||c[d+5]!==L?(c[d+0]=R,c[d+1]=g,c[d+2]=A,c[d+3]=F,c[d+4]=w,c[d+5]=L,!0):!1}else{const m=d+8,_=r[d+6],R=m+f,g=_+f;let A=E,F=!1,w=!1;e?A||(F=e.has(R),w=e.has(g),A=!F&&!w):(F=!0,w=!0);const L=A||F,N=A||w;let M=!1;L&&(M=u(m,f,A));let z=!1;N&&(z=u(_,f,A));const y=M||z;if(y)for(let P=0;P<3;P++){const I=m+P,v=_+P,$=c[I],Y=c[I+3],q=c[v],G=c[v+3];c[d+P]=$G?Y:G}return y}}}const xn=new Nt;function Ce(a,e,t,s){return gt(a,e,xn),t.intersectBox(xn,s)}function la(a,e,t,s,i,n){const{geometry:r,_indirectBuffer:o}=a;for(let c=s,l=s+i;c=0;let f,E;d?(f=Xt(a),E=Zt(a,r)):(f=Zt(a,r),E=Xt(a));const T=Ce(f,i,s,Dn)?Gi(f,e,t,s):null;if(T){const R=T.point[h];if(d?R<=i[E+l]:R>=i[E+l+3])return T}const _=Ce(E,i,s,Dn)?Gi(E,e,t,s):null;return T&&_?T.distance<=_.distance?T:_:T||_||null}}const Bs=new Nt,Pe=new te,Le=new te,qe=new Ft,Bn=new Dt,ks=new Dt;function Ea(a,e,t,s){It.setBuffer(a._roots[e]);const i=Hi(0,a,t,s);return It.clearBuffer(),i}function Hi(a,e,t,s,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=It;let c=a*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Bn.set(t.boundingBox.min,t.boundingBox.max,s),i=Bn),zt(c,r)){const h=e.geometry,u=h.index,d=h.attributes.position,f=t.index,E=t.attributes.position,p=Yt(a,o),T=Wt(c,r);if(qe.copy(s).invert(),t.boundsTree)return gt(a,n,ks),ks.matrix.copy(qe),ks.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:_=>ks.intersectsBox(_),intersectsTriangle:_=>{_.a.applyMatrix4(s),_.b.applyMatrix4(s),_.c.applyMatrix4(s),_.needsUpdate=!0;for(let R=p*3,g=(T+p)*3;RSi.distanceToBox(A),intersectsBounds:(A,F,w)=>w<_&&w{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:L=>Je.distanceToBox(L),intersectsBounds:(L,N,M)=>M<_&&M{for(let M=L,z=L+N;MF&&(F=I),vw&&(w=v),$L&&(L=$)}}return c[d+0]!==R||c[d+1]!==g||c[d+2]!==A||c[d+3]!==F||c[d+4]!==w||c[d+5]!==L?(c[d+0]=R,c[d+1]=g,c[d+2]=A,c[d+3]=F,c[d+4]=w,c[d+5]=L,!0):!1}else{const m=d+8,_=r[d+6],R=m+f,g=_+f;let A=E,F=!1,w=!1;e?A||(F=e.has(R),w=e.has(g),A=!F&&!w):(F=!0,w=!0);const L=A||F,N=A||w;let M=!1;L&&(M=u(m,f,A));let z=!1;N&&(z=u(_,f,A));const y=M||z;if(y)for(let P=0;P<3;P++){const I=m+P,v=_+P,$=c[I],Y=c[I+3],q=c[v],G=c[v+3];c[d+P]=$G?Y:G}return y}}}const kn=new W;function Aa(a,e,t,s,i){It.setBuffer(a._roots[e]),Wi(0,a,t,s,i),It.clearBuffer()}function Wi(a,e,t,s,i){const{float32Array:n,uint16Array:r,uint32Array:o}=It,c=a*2;if(zt(c,r)){const h=Yt(a,o),u=Wt(c,r);la(e,t,s,h,u,i)}else{const h=Xt(a);Ce(h,n,s,kn)&&Wi(h,e,t,s,i);const u=Zt(a,o);Ce(u,n,s,kn)&&Wi(u,e,t,s,i)}}const zn=new W,Ra=["x","y","z"];function ya(a,e,t,s){It.setBuffer(a._roots[e]);const i=Xi(0,a,t,s);return It.clearBuffer(),i}function Xi(a,e,t,s){const{float32Array:i,uint16Array:n,uint32Array:r}=It;let o=a*2;if(zt(o,n)){const l=Yt(a,r),h=Wt(o,n);return ha(e,t,s,l,h)}else{const l=xr(a,r),h=Ra[l],d=s.direction[h]>=0;let f,E;d?(f=Xt(a),E=Zt(a,r)):(f=Zt(a,r),E=Xt(a));const T=Ce(f,i,s,zn)?Xi(f,e,t,s):null;if(T){const R=T.point[h];if(d?R<=i[E+l]:R>=i[E+l+3])return T}const _=Ce(E,i,s,zn)?Xi(E,e,t,s):null;return T&&_?T.distance<=_.distance?T:_:T||_||null}}const Ys=new Nt,Me=new te,ve=new te,ts=new Ft,Yn=new Dt,Vs=new Dt;function Oa(a,e,t,s){It.setBuffer(a._roots[e]);const i=Zi(0,a,t,s);return It.clearBuffer(),i}function Zi(a,e,t,s,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=It;let c=a*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Yn.set(t.boundingBox.min,t.boundingBox.max,s),i=Yn),zt(c,r)){const h=e.geometry,u=h.index,d=h.attributes.position,f=t.index,E=t.attributes.position,p=Yt(a,o),T=Wt(c,r);if(ts.copy(s).invert(),t.boundsTree)return gt(a,n,Vs),Vs.matrix.copy(ts),Vs.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:_=>Vs.intersectsBox(_),intersectsTriangle:_=>{_.a.applyMatrix4(s),_.b.applyMatrix4(s),_.c.applyMatrix4(s),_.needsUpdate=!0;for(let R=p,g=T+p;Rwi.distanceToBox(A),intersectsBounds:(A,F,w)=>w<_&&w{if(e.boundsTree){const w=e.boundsTree;return w.shapecast({boundsTraverseOrder:L=>es.distanceToBox(L),intersectsBounds:(L,N,M)=>M<_&&M{for(let M=L,z=L+N;Mnew Nt),xe=new Nt,Ue=new Nt,Ni=new Nt,bi=new Nt;let Pi=!1;function La(a,e,t,s){if(Pi)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Pi=!0;const i=a._roots,n=e._roots;let r,o=0,c=0;const l=new Ft().copy(t).invert();for(let h=0,u=i.length;hc.slice()),index:r.array.slice(),indirectBuffer:n?n.slice():null}:o={roots:i,index:r.array,indirectBuffer:n},o}static deserialize(e,t,s={}){s={setIndex:!0,indirect:!!e.indirectBuffer,...s};const{index:i,roots:n,indirectBuffer:r}=e,o=new pn(t,{...s,[Ri]:!0});if(o._roots=n,o._indirectBuffer=r||null,s.setIndex){const c=t.getIndex();if(c===null){const l=new As(e.index,1,!1);t.setIndex(l)}else c.array!==i&&(c.array.set(i),c.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Lr,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Ri]:!1},t),t.useSharedArrayBuffer&&!Pa())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Ri]||(jo(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Nt)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?i=>s[i]:i=>i}refit(e=null){return(this.indirect?_a:ca)(this,e)}traverse(e,t=0){const s=this._roots[t],i=new Uint32Array(s),n=new Uint16Array(s);r(0);function r(o,c=0){const l=o*2,h=n[l+15]===Ii;if(h){const u=i[o+6],d=n[l+14];e(c,h,new Float32Array(s,o*4,6),u,d)}else{const u=o+Js/4,d=i[o+6],f=i[o+7];e(c,h,new Float32Array(s,o*4,6),f)||(r(u,c+1),r(d,c+1))}}}raycast(e,t=Rn){const s=this._roots,i=this.geometry,n=[],r=t.isMaterial,o=Array.isArray(t),c=i.groups,l=r?t.side:t,h=this.indirect?Aa:da;for(let u=0,d=s.length;uu(d,f,E,p,T)?!0:s(d,f,this,o,E,p,t)}else r||(o?r=(u,d,f,E)=>s(u,d,this,o,f,E,t):r=(u,d,f)=>f);let c=!1,l=0;const h=this._roots;for(let u=0,d=h.length;u{const p=this.resolveTriangleIndex(E);St(r,p*3,o,c)}:E=>{St(r,E*3,o,c)},h=Ht.getPrimitive(),u=e.geometry.index,d=e.geometry.attributes.position,f=e.indirect?E=>{const p=e.resolveTriangleIndex(E);St(h,p*3,u,d)}:E=>{St(h,E*3,u,d)};if(n){const E=(p,T,m,_,R,g,A,F)=>{for(let w=m,L=m+_;wHs.intersectsBox(s),intersectsTriangle:s=>Hs.intersectsTriangle(s)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,s={},i={},n=0,r=1/0){return(this.indirect?ba:ga)(this,e,t,s,i,n,r)}closestPointToPoint(e,t={},s=0,i=1/0){return sa(this,e,t,s,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(s=>{gt(0,new Float32Array(s),Vn),e.union(Vn)}),e}}function Gn(a,e,t){return a===null||(a.point.applyMatrix4(e.matrixWorld),a.distance=a.point.distanceTo(t.ray.origin),a.object=e,a.distancet.far)?null:a}const Li=new Jr,Hn=new Ft,Ma=et.prototype.raycast;function va(a,e){if(this.geometry.boundsTree){if(this.material===void 0)return;Hn.copy(this.matrixWorld).invert(),Li.copy(a.ray).applyMatrix4(Hn);const t=this.geometry.boundsTree;if(a.firstHitOnly===!0){const s=Gn(t.raycastFirst(Li,this.material),this,a);s&&e.push(s)}else{const s=t.raycast(Li,this.material);for(let i=0,n=s.length;i{const t=this.handlers.slice(0);for(const s of t)s(e)});O(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Da{constructor(){O(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const s of t)await s(e)});O(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class En{constructor(e){O(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);O(this,"isResizeable",()=>"resize"in this&&"getSize"in this);O(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);O(this,"isHideable",()=>"visible"in this);O(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class kt extends En{}class Ba extends En{constructor(t){super(t);O(this,"worlds",new Map);O(this,"onWorldChanged",new st);O(this,"currentWorld",null);this.onWorldChanged.add(({world:s,action:i})=>{i==="removed"&&this.worlds.delete(s.uuid)})}}class ka extends Ba{constructor(){super(...arguments);O(this,"hasCameraControls",()=>"controls"in this)}}const Is=class Is extends kt{constructor(t){super(t);O(this,"_disposedComponents",new Set);O(this,"enabled",!0);t.add(Is.uuid,this)}get(){return this._disposedComponents}destroy(t,s=!0,i=!0){t.removeFromParent();const n=t;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(t,s),i&&n.children&&n.children.length&&this.disposeChildren(n),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,s){const i=t;i.geometry&&this.disposeGeometry(i.geometry),s&&i.material&&Is.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const s of t.children)this.destroy(s)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const s of t.material)s.dispose();else t.material.dispose()}};O(Is,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Ge=Is;class Es extends Set{constructor(t){super(t);O(this,"onItemAdded",new st);O(this,"onItemDeleted",new st);O(this,"onCleared",new st);O(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...t){for(const s of t)this.has(s)||!this.guard(s)||(super.add(s),this.onItemAdded||(this.onItemAdded=new st),this.onItemAdded.trigger(s));return this}delete(t){const s=super.delete(t);return s&&this.onItemDeleted.trigger(),s}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class He extends Map{constructor(t){super(t);O(this,"onItemSet",new st);O(this,"onItemUpdated",new st);O(this,"onItemDeleted",new st);O(this,"onCleared",new st);O(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(t,s){const i=this.has(t);if(!this.guard(t,s))return this;const r=super.set(t,s);return i?(this.onItemUpdated||(this.onItemUpdated=new st),this.onItemUpdated.trigger({key:t,value:s})):(this.onItemSet||(this.onItemSet=new st),this.onItemSet.trigger({key:t,value:s})),r}delete(t){const s=super.delete(t);return s&&this.onItemDeleted.trigger(t),s}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Wn{static isTransparent(e){return e.transparent&&e.opacity<1}}const yt=class yt{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${yt._lut[e&255]+yt._lut[e>>8&255]+yt._lut[e>>16&255]+yt._lut[e>>24&255]}-${yt._lut[t&255]}${yt._lut[t>>8&255]}-${yt._lut[t>>16&15|64]}${yt._lut[t>>24&255]}-${yt._lut[s&63|128]}${yt._lut[s>>8&255]}-${yt._lut[s>>16&255]}${yt._lut[s>>24&255]}${yt._lut[i&255]}${yt._lut[i>>8&255]}${yt._lut[i>>16&255]}${yt._lut[i>>24&255]}`.toLowerCase()}static validate(e){if(!yt._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. - -- If you're the tool creator, you can take one from https://www.uuidgenerator.net/. - -- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};O(yt,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),O(yt,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Fe=yt;const ai=class ai{constructor(){O(this,"onDisposed",new st);O(this,"list",new Map);O(this,"enabled",!1);O(this,"_clock");O(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(e);requestAnimationFrame(this.update)});this._clock=new to,ai.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Fe.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const s=new e(this);return this.list.has(t)||this.add(t,s),s}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){Rs.prototype.computeBoundsTree=xa,Rs.prototype.disposeBoundsTree=Ua,et.prototype.raycast=va}};O(ai,"release","2.2.0-alpha.0");let $i=ai;class za extends En{constructor(){super(...arguments);O(this,"meshes",new Set);O(this,"onAfterUpdate",new st);O(this,"onBeforeUpdate",new st);O(this,"onDisposed",new st);O(this,"isDisposing",!1);O(this,"enabled",!0);O(this,"uuid",Fe.create());O(this,"name");O(this,"_scene");O(this,"_camera");O(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const s=this.components.get(Ge);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)s.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}/*! - * camera-controls - * https://github.com/yomotsu/camera-controls - * (c) 2017 @yomotsu - * Released under the MIT License. - */const at={LEFT:1,RIGHT:2,MIDDLE:4},V=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),De={NONE:0,IN:1,OUT:-1};function ge(a){return a.isPerspectiveCamera}function pe(a){return a.isOrthographicCamera}const Be=Math.PI*2,Xn=Math.PI/2,Ur=1e-5,ss=Math.PI/180;function Qt(a,e,t){return Math.max(e,Math.min(t,a))}function mt(a,e=Ur){return Math.abs(a)0==f>h&&(f=h,t.value=(f-h)/n),f}function $n(a,e,t,s,i=1/0,n,r){s=Math.max(1e-4,s);const o=2/s,c=o*n,l=1/(1+c+.48*c*c+.235*c*c*c);let h=e.x,u=e.y,d=e.z,f=a.x-h,E=a.y-u,p=a.z-d;const T=h,m=u,_=d,R=i*s,g=R*R,A=f*f+E*E+p*p;if(A>g){const v=Math.sqrt(A);f=f/v*R,E=E/v*R,p=p/v*R}h=a.x-f,u=a.y-E,d=a.z-p;const F=(t.x+o*f)*n,w=(t.y+o*E)*n,L=(t.z+o*p)*n;t.x=(t.x-o*F)*l,t.y=(t.y-o*w)*l,t.z=(t.z-o*L)*l,r.x=h+(f+F)*l,r.y=u+(E+w)*l,r.z=d+(p+L)*l;const N=T-a.x,M=m-a.y,z=_-a.z,y=r.x-T,P=r.y-m,I=r.z-_;return N*y+M*P+z*I>0&&(r.x=T,r.y=m,r.z=_,t.x=(r.x-T)/n,t.y=(r.y-m)/n,t.z=(r.z-_)/n),r}function Mi(a,e){e.set(0,0),a.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=a.length,e.y/=a.length}function vi(a,e){return pe(a)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class Ya{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let n=0,r=i.length;n{},this._enabled=!0,this._state=V.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=De.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ot.Vector3,this._focalOffsetVelocity=new ot.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,A,F)=>{let w,L;if(ge(this._camera)){const N=ct.copy(this._camera.position).sub(this._target),M=this._camera.getEffectiveFOV()*ss,z=N.length()*Math.tan(M*.5);w=this.truckSpeed*g*z/this._elementRect.height,L=this.truckSpeed*A*z/this._elementRect.height}else if(pe(this._camera)){const N=this._camera;w=g*(N.right-N.left)/N.zoom/this._elementRect.width,L=A*(N.top-N.bottom)/N.zoom/this._elementRect.height}else return;this.verticalDragToForward?(F?this.setFocalOffset(this._focalOffsetEnd.x+w,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(w,0,!0),this.forward(-L,!0)):F?this.setFocalOffset(this._focalOffsetEnd.x+w,this._focalOffsetEnd.y+L,this._focalOffsetEnd.z,!0):this.truck(w,L,!0)},this._rotateInternal=(g,A)=>{const F=Be*this.azimuthRotateSpeed*g/this._elementRect.height,w=Be*this.polarRotateSpeed*A/this._elementRect.height;this.rotate(F,w,!0)},this._dollyInternal=(g,A,F)=>{const w=Math.pow(.95,-g*this.dollySpeed),L=this._sphericalEnd.radius,N=this._sphericalEnd.radius*w,M=Qt(N,this.minDistance,this.maxDistance),z=M-N;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(N,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(z,!0),this._dollyToNoClamp(M,!0)):this._dollyToNoClamp(M,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?N:M)-L,this._dollyControlCoord.set(A,F)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,A,F)=>{const w=Math.pow(.95,g*this.dollySpeed),L=this._zoom,N=this._zoom*w;this.zoomTo(N,!0),this.dollyToCursor&&(this._changedZoom+=N-L,this._dollyControlCoord.set(A,F))},typeof ot>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ot.Quaternion().setFromUnitVectors(this._camera.up,Zs),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=V.NONE,this._target=new ot.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ot.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ot.Spherical().setFromVector3(ct.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ot.Vector3,new ot.Vector3,new ot.Vector3,new ot.Vector3],this._updateNearPlaneCorners(),this._boundary=new ot.Box3(new ot.Vector3(-1/0,-1/0,-1/0),new ot.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ot.Vector2,this.mouseButtons={left:V.ROTATE,middle:V.DOLLY,right:V.TRUCK,wheel:ge(this._camera)?V.DOLLY:pe(this._camera)?V.ZOOM:V.NONE},this.touches={one:V.TOUCH_ROTATE,two:ge(this._camera)?V.TOUCH_DOLLY_TRUCK:pe(this._camera)?V.TOUCH_ZOOM_TRUCK:V.NONE,three:V.TOUCH_TRUCK};const s=new ot.Vector2,i=new ot.Vector2,n=new ot.Vector2,r=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),L=g.clientX/w.width,N=g.clientY/w.height;if(Lthis._interactiveArea.right||Nthis._interactiveArea.bottom)return}const A=g.pointerType!=="mouse"?null:(g.buttons&at.LEFT)===at.LEFT?at.LEFT:(g.buttons&at.MIDDLE)===at.MIDDLE?at.MIDDLE:(g.buttons&at.RIGHT)===at.RIGHT?at.RIGHT:null;if(A!==null){const w=this._findPointerByMouseButton(A);w&&this._disposePointer(w)}if((g.buttons&at.LEFT)===at.LEFT&&this._lockedPointer)return;const F={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:A};this._activePointers.push(F),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,p(g)},o=g=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),L=g.clientX/w.width,N=g.clientY/w.height;if(Lthis._interactiveArea.right||Nthis._interactiveArea.bottom)return}const A=(g.buttons&at.LEFT)===at.LEFT?at.LEFT:(g.buttons&at.MIDDLE)===at.MIDDLE?at.MIDDLE:(g.buttons&at.RIGHT)===at.RIGHT?at.RIGHT:null;if(A!==null){const w=this._findPointerByMouseButton(A);w&&this._disposePointer(w)}const F={pointerId:1,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:(g.buttons&at.LEFT)===at.LEFT?at.LEFT:(g.buttons&at.MIDDLE)===at.LEFT?at.MIDDLE:(g.buttons&at.RIGHT)===at.LEFT?at.RIGHT:null};this._activePointers.push(F),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.addEventListener("mousemove",l),this._domElement.ownerDocument.addEventListener("mouseup",u),this._isDragging=!0,p(g)},c=g=>{g.cancelable&&g.preventDefault();const A=g.pointerId,F=this._lockedPointer||this._findPointerById(A);if(F){if(F.clientX=g.clientX,F.clientY=g.clientY,F.deltaX=g.movementX,F.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&at.LEFT)===at.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&at.MIDDLE)===at.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&at.RIGHT)===at.RIGHT&&(this._state=this._state|this.mouseButtons.right);T()}},l=g=>{const A=this._lockedPointer||this._findPointerById(1);A&&(A.clientX=g.clientX,A.clientY=g.clientY,A.deltaX=g.movementX,A.deltaY=g.movementY,this._state=0,(this._lockedPointer||(g.buttons&at.LEFT)===at.LEFT)&&(this._state=this._state|this.mouseButtons.left),(g.buttons&at.MIDDLE)===at.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&at.RIGHT)===at.RIGHT&&(this._state=this._state|this.mouseButtons.right),T())},h=g=>{const A=this._findPointerById(g.pointerId);if(!(A&&A===this._lockedPointer)){if(A&&this._disposePointer(A),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=V.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=V.NONE;m()}},u=()=>{const g=this._findPointerById(1);g&&g===this._lockedPointer||(g&&this._disposePointer(g),this._state=V.NONE,m())};let d=-1;const f=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===V.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const N=this._domElement.getBoundingClientRect(),M=g.clientX/N.width,z=g.clientY/N.height;if(Mthis._interactiveArea.right||zthis._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===V.ROTATE||this.mouseButtons.wheel===V.TRUCK){const N=performance.now();d-N<1e3&&this._getClientRect(this._elementRect),d=N}const A=Ga?-1:-3,F=g.deltaMode===1?g.deltaY/A:g.deltaY/(A*10),w=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case V.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case V.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case V.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case V.DOLLY:{this._dollyInternal(-F,w,L),this._isUserControllingDolly=!0;break}case V.ZOOM:{this._zoomInternal(-F,w,L),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},E=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===vt.ACTION.NONE){const A=g instanceof PointerEvent?g.pointerId:(g instanceof MouseEvent,0),F=this._findPointerById(A);F&&this._disposePointer(F),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",u);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(Mi(this._activePointers,Bt),this._getClientRect(this._elementRect),s.copy(Bt),i.copy(Bt),this._activePointers.length>=2){const F=Bt.x-this._activePointers[1].clientX,w=Bt.y-this._activePointers[1].clientY,L=Math.sqrt(F*F+w*w);n.set(0,L);const N=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,M=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(N,M)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&at.LEFT)===at.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&at.MIDDLE)===at.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&at.RIGHT)===at.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&V.ROTATE)===V.ROTATE||(this._state&V.TOUCH_ROTATE)===V.TOUCH_ROTATE||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&V.TRUCK)===V.TRUCK||(this._state&V.TOUCH_TRUCK)===V.TOUCH_TRUCK||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&V.DOLLY)===V.DOLLY||(this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&V.ZOOM)===V.ZOOM||(this._state&V.TOUCH_ZOOM)===V.TOUCH_ZOOM||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&V.OFFSET)===V.OFFSET||(this._state&V.TOUCH_OFFSET)===V.TOUCH_OFFSET||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},T=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Mi(this._activePointers,Bt);const A=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,F=A?-A.deltaX:i.x-Bt.x,w=A?-A.deltaY:i.y-Bt.y;if(i.copy(Bt),((this._state&V.ROTATE)===V.ROTATE||(this._state&V.TOUCH_ROTATE)===V.TOUCH_ROTATE||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(F,w),this._isUserControllingRotate=!0),(this._state&V.DOLLY)===V.DOLLY||(this._state&V.ZOOM)===V.ZOOM){const L=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,M=this.dollyDragInverted?-1:1;(this._state&V.DOLLY)===V.DOLLY?(this._dollyInternal(M*w*Xs,L,N),this._isUserControllingDolly=!0):(this._zoomInternal(M*w*Xs,L,N),this._isUserControllingZoom=!0)}if((this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_ZOOM)===V.TOUCH_ZOOM||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE){const L=Bt.x-this._activePointers[1].clientX,N=Bt.y-this._activePointers[1].clientY,M=Math.sqrt(L*L+N*N),z=n.y-M;n.set(0,M);const y=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET?(this._dollyInternal(z*Xs,y,P),this._isUserControllingDolly=!0):(this._zoomInternal(z*Xs,y,P),this._isUserControllingZoom=!0)}((this._state&V.TRUCK)===V.TRUCK||(this._state&V.TOUCH_TRUCK)===V.TOUCH_TRUCK||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(F,w,!1),this._isUserControllingTruck=!0),((this._state&V.OFFSET)===V.OFFSET||(this._state&V.TOUCH_OFFSET)===V.TOUCH_OFFSET||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(F,w,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Mi(this._activePointers,Bt),i.copy(Bt),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",u),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_),this._domElement.ownerDocument.addEventListener("pointerlockerror",R),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),p())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))};const _=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},R=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),Ha&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",E)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",E),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))},this.cancel=()=>{this._state!==V.NONE&&(this._state=V.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=Qt(e.width,0,1),this._interactiveArea.height=Qt(e.height,0,1),this._interactiveArea.x=Qt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Qt(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const i=Qt(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=Qt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const r=!s||ft(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ft(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=De.NONE,this._changedDolly=0,this._dollyToNoClamp(Qt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const r=this._collisionTest(),o=ft(r,this._spherical.radius);if(!(s>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,r)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||ft(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(rs).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||ft(this._target.x,this._targetEnd.x,this.restThreshold)&&ft(this._target.y,this._targetEnd.y,this.restThreshold)&&ft(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=Qt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||ft(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),ie.setFromMatrixColumn(this._camera.matrix,0),ne.setFromMatrixColumn(this._camera.matrix,1),ie.multiplyScalar(e),ne.multiplyScalar(-t);const i=ct.copy(ie).add(ne),n=ut.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,s)}forward(e,t=!1){ct.setFromMatrixColumn(this._camera.matrix,0),ct.crossVectors(this._camera.up,ct),ct.multiplyScalar(e);const s=ut.copy(this._targetEnd).add(ct);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return ct.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ct.x,this._targetEnd.y+ct.y,this._targetEnd.z+ct.z,t)}moveTo(e,t,s,i=!1){this._isUserControllingTruck=!1;const n=ct.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const r=!i||ft(this._target.x,this._targetEnd.x,this.restThreshold)&&ft(this._target.y,this._targetEnd.y,this.restThreshold)&&ft(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(e,t,s,i=!1){const o=ct.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(e,t,{cover:s=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const c=[],l=e.isBox3?ze.copy(e):ze.setFromObject(e);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=Zn(this._sphericalEnd.theta,Xn),u=Zn(this._sphericalEnd.phi,Xn);c.push(this.rotateTo(h,u,t));const d=ct.setFromSpherical(this._sphericalEnd).normalize(),f=Jn.setFromUnitVectors(d,xi),E=ft(Math.abs(d.y),1);E&&f.multiply(Di.setFromAxisAngle(Zs,h)),f.multiply(this._yAxisUpSpaceInverse);const p=qn.makeEmpty();ut.copy(l.min).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.min).setX(l.max.x).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.min).setY(l.max.y).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.max).setZ(l.min.z).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.min).setZ(l.max.z).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.max).setY(l.min.y).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.max).setX(l.min.x).applyQuaternion(f),p.expandByPoint(ut),ut.copy(l.max).applyQuaternion(f),p.expandByPoint(ut),p.min.x-=i,p.min.y-=r,p.max.x+=n,p.max.y+=o,f.setFromUnitVectors(xi,d),E&&f.premultiply(Di.invert()),f.premultiply(this._yAxisUpSpace);const T=p.getSize(ct),m=p.getCenter(ut).applyQuaternion(f);if(ge(this._camera)){const _=this.getDistanceToFitBox(T.x,T.y,T.z,s);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.dollyTo(_,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(pe(this._camera)){const _=this._camera,R=_.right-_.left,g=_.top-_.bottom,A=s?Math.max(R/T.x,g/T.y):Math.min(R/T.x,g/T.y);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.zoomTo(A,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const s=[],n=e instanceof ot.Sphere?Ui.copy(e):vt.createBoundingSphere(e,Ui);if(s.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),ge(this._camera)){const r=this.getDistanceToFitSphere(n.radius);s.push(this.dollyTo(r,t))}else if(pe(this._camera)){const r=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,c=2*n.radius,l=Math.min(r/c,o/c);s.push(this.zoomTo(l,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,i,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=De.NONE,this._changedDolly=0;const c=ut.set(i,n,r),l=ct.set(e,t,s);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(l.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||ft(this._target.x,this._targetEnd.x,this.restThreshold)&&ft(this._target.y,this._targetEnd.y,this.restThreshold)&&ft(this._target.z,this._targetEnd.z,this.restThreshold)&&ft(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ft(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&ft(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,s,i,n,r,o,c,l,h,u,d,f,E=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=De.NONE,this._changedDolly=0;const p=ct.set(i,n,r),T=ut.set(e,t,s);Gt.setFromVector3(T.sub(p).applyQuaternion(this._yAxisUpSpace));const m=ke.set(h,u,d),_=ut.set(o,c,l);os.setFromVector3(_.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(p.lerp(m,f));const R=os.theta-Gt.theta,g=os.phi-Gt.phi,A=os.radius-Gt.radius;this._sphericalEnd.set(Gt.radius+A*f,Gt.phi+g*f,Gt.theta+R*f),this.normalizeRotations(),this._needsUpdate=!0,E||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const F=!E||ft(this._target.x,this._targetEnd.x,this.restThreshold)&&ft(this._target.y,this._targetEnd.y,this.restThreshold)&&ft(this._target.z,this._targetEnd.z,this.restThreshold)&&ft(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ft(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&ft(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(F)}setPosition(e,t,s,i=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,s,i=!1){const n=this.getPosition(ct),r=this.setLookAt(n.x,n.y,n.z,e,t,s,i);return this._sphericalEnd.phi=Qt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}setFocalOffset(e,t,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||ft(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&ft(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&ft(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),ie.setFromMatrixColumn(this._camera.matrixWorldInverse,0),ne.setFromMatrixColumn(this._camera.matrixWorldInverse,1),_e.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=ct.set(e,t,s),n=i.distanceTo(this._camera.position),r=i.sub(this._camera.position);ie.multiplyScalar(r.x),ne.multiplyScalar(r.y),_e.multiplyScalar(r.z),ct.copy(ie).add(ne).add(_e),ct.z=ct.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ct.x,ct.y,-ct.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ot.Vector4,typeof e=="number"?this._viewport.set(e,t,s,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,i=!1){if(vi(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,r=this._camera.getEffectiveFOV()*ss,o=this._camera.aspect;return((i?n>o:nt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const i=t.lengthSq();if(i===0)return e;const n=ut.copy(t).add(e),o=this._boundary.clampPoint(n,ke).sub(n),c=o.lengthSq();if(c===0)return e.add(t);if(c===i)return e;if(s===0)return e.add(t).add(o);{const l=1+s*c/t.dot(o);return e.add(ut.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(ge(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*ss,i=Math.tan(s*.5)*t,n=i*e.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(pe(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,i=e.right*t,n=e.top*t,r=e.bottom*t;this._nearPlaneCorners[0].set(s,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,r,0),this._nearPlaneCorners[3].set(s,r,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||vi(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection(rs);Bi.lookAt(jn,s,this._camera.up);for(let i=0;i<4;i++){const n=ut.copy(this._nearPlaneCorners[i]);n.applyMatrix4(Bi);const r=ke.addVectors(this._target,n);$s.set(r,s),$s.far=this._spherical.radius+1;const o=$s.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ot.Sphere){const s=t,i=s.center;ze.makeEmpty(),e.traverseVisible(r=>{r.isMesh&&ze.expandByObject(r)}),ze.getCenter(i);let n=0;return e.traverseVisible(r=>{if(!r.isMesh)return;const o=r,c=o.geometry.clone();c.applyMatrix4(o.matrixWorld);const h=c.attributes.position;for(let u=0,d=h.count;u{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof on){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:s,world:i})=>{if(s==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(s==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.currentWorld!==null&&(this.controls.enabled=t)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,s]of this._allControls)s.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,s=new pr(60,t,1,1e3);return s.position.set(50,50,50),s.lookAt(new W(0,0,0)),s}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");vt.install({THREE:mn.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,s=new vt(this.three,t);return s.smoothTime=.2,s.dollyToCursor=!0,s.infinityDolly=!0,s.minDistance=6,s}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:eo,Vector2:Ie,Vector3:W,Vector4:so,Quaternion:qt,Matrix4:Ft,Spherical:io,Box3:Nt,Sphere:Ei,Raycaster:an,MathUtils:no}}}const ci=class ci extends kt{constructor(t){super(t);O(this,"onAfterUpdate",new st);O(this,"onBeforeUpdate",new st);O(this,"onDisposed",new st);O(this,"onWorldCreated",new st);O(this,"onWorldDeleted",new st);O(this,"list",new Map);O(this,"enabled",!0);t.add(ci.uuid,this)}create(){const t=new za(this.components),s=t.uuid;if(this.list.has(s))throw new Error("There is already a world with this name!");return this.list.set(s,t),this.onWorldCreated.trigger(t),t}delete(t){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");const s=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(s)}dispose(){this.enabled=!1;for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[s,i]of this.list)i.update(t)}};O(ci,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let ji=ci;function Wa(a,e,t,s){return new Promise((i,n)=>{function r(){const o=a.clientWaitSync(e,t,0);if(o===a.WAIT_FAILED){n();return}if(o===a.TIMEOUT_EXPIRED){setTimeout(r,s);return}i()}r()})}async function Xa(a,e,t,s,i,n,r){const o=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);a.flush(),await Wa(a,o,0,10),a.deleteSync(o),a.bindBuffer(e,t),a.getBufferSubData(e,s,i,n,r),a.bindBuffer(e,null)}async function Za(a,e,t,s,i,n,r,o){const c=a.createBuffer();return a.bindBuffer(a.PIXEL_PACK_BUFFER,c),a.bufferData(a.PIXEL_PACK_BUFFER,o.byteLength,a.STREAM_READ),a.readPixels(e,t,s,i,n,r,0),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),await Xa(a,a.PIXEL_PACK_BUFFER,c,0,o),a.deleteBuffer(c),o}class $a{constructor(e,t,s){O(this,"onDisposed",new st);O(this,"onViewUpdated",new Da);O(this,"enabled",!0);O(this,"needsUpdate",!1);O(this,"renderDebugFrame",!1);O(this,"components");O(this,"world");O(this,"renderer");O(this,"autoUpdate",!0);O(this,"updateInterval",1e3);O(this,"worker");O(this,"scene",new ro);O(this,"_width",512);O(this,"_height",512);O(this,"_availableColor",1);O(this,"renderTarget");O(this,"bufferSize");O(this,"_buffer");O(this,"_isWorkerBusy",!1);O(this,"updateVisibility",async e=>{if(!this.enabled||!this.needsUpdate&&!e||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const s=this.renderer.getContext();await Za(s,0,0,this._width,this._height,s.RGBA,s.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.applySettings(s),this.world=t,this.renderer=new oo,this.renderTarget=new ao(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=` - addEventListener("message", (event) => { - const { buffer } = event.data; - const colors = new Map(); - for (let i = 0; i < buffer.length; i += 4) { - const r = buffer[i]; - const g = buffer[i + 1]; - const b = buffer[i + 2]; - const code = "" + r + "-" + g + "-" + b; - if(colors.has(code)) { - colors.set(code, colors.get(code) + 1); - } else { - colors.set(code, 1); - } - } - postMessage({ colors }); - }); - `,n=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[s,i,n]=t,r=`${s}-${i}-${n}`;return{r:s,g:i,b:n,code:r}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(e){e&&(e.updateInterval!==void 0&&(this.updateInterval=e.updateInterval),e.height!==void 0&&(this._height=e.height),e.width!==void 0&&(this._width=e.width),e.autoUpdate!==void 0&&(this.autoUpdate=e.autoUpdate))}}class ja extends $a{constructor(t,s,i){super(t,s,i);O(this,"onViewUpdated",new st);O(this,"threshold",100);O(this,"colorMeshes",new Map);O(this,"isProcessing",!1);O(this,"_colorCodeMeshMap",new Map);O(this,"_meshIDColorCodeMap",new Map);O(this,"_currentVisibleMeshes",new Set);O(this,"_recentlyHiddenMeshes",new Set);O(this,"_intervalID",null);O(this,"_transparentMat",new Ve({transparent:!0,opacity:0}));O(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const s=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[i,n]of s){if(n{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:n,unseen:r})=>{for(const o of n)o.visible=!0;for(const o of r)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(Ge);for(const s in this.colorMeshes){const i=this.colorMeshes.get(s);i&&t.destroy(i,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const s=t instanceof ei,{geometry:i,material:n}=t,{colorMaterial:r,code:o}=this.getAvailableMaterial();let c;if(Array.isArray(n)){let u=!0;const d=[];for(const f of n)Wn.isTransparent(f)?d.push(this._transparentMat):(u=!1,d.push(r));if(u){r.dispose(),this.isProcessing=!1;return}c=d}else if(Wn.isTransparent(n)){r.dispose(),this.isProcessing=!1;return}else c=r;this._colorCodeMeshMap.set(o,t),this._meshIDColorCodeMap.set(t.uuid,o);const l=s?t.count:1,h=new ei(i,c,l);s?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new Ft),t.visible=!1,t.updateWorldMatrix(!0,!1),h.applyMatrix4(t.matrixWorld),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(t.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const s=this.components.get(Ge);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const i=this.colorMeshes.get(t.uuid),n=this._meshIDColorCodeMap.get(t.uuid);if(!i||!n){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),i.geometry=void 0,i.material=[],s.destroy(i,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const s of t){const i=this.colorMeshes.get(s.uuid);i&&(i.count=s.count)}}getAvailableMaterial(){const{r:t,g:s,b:i,code:n}=this.getAvailableColor(),r=_i.enabled;_i.enabled=!1;const o=new cn(`rgb(${t}, ${s}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const c=this.world.renderer.clippingPlanes,l=new Ve({color:o,clippingPlanes:c,side:mi});return _i.enabled=r,{colorMaterial:l,code:n}}}const Cs=class Cs extends kt{constructor(t){super(t);O(this,"onDisposed",new st);O(this,"_enabled",!0);O(this,"list",new Map);t.add(Cs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[s,i]of this.list)i.enabled=t}create(t,s){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new ja(this.components,t,s);return this.list.set(t.uuid,i),i}delete(t){const s=this.list.get(t.uuid);s&&s.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Cs.uuid),this.onDisposed.reset();for(const[t,s]of this.list)s.dispose();this.list.clear()}updateInstanced(t){for(const[,s]of this.list)s.updateInstanced(t)}};O(Cs,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Qi=Cs;class Qa{constructor(e){O(this,"_event");O(this,"_position",new Ie);O(this,"onDisposed",new st);O(this,"updateMouseInfo",e=>{this._event=e});this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class Ka{constructor(e,t){O(this,"enabled",!0);O(this,"components");O(this,"onDisposed",new st);O(this,"mouse");O(this,"three",new an);O(this,"world");const s=t.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new Qa(s.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(e)}castRayFromVector(e,t,s=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(s)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),s=this.filterClippingPlanes(t);return s.length>0?s[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const s=t.clippingPlanes;return e.length<=0||!s||(s==null?void 0:s.length)<=0?e:e.filter(i=>s.every(n=>n.distanceToPoint(i.point)>0))}}const li=class li extends kt{constructor(t){super(t);O(this,"enabled",!0);O(this,"list",new Map);O(this,"onDisposed",new st);t.add(li.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new Ka(this.components,t);return this.list.set(t.uuid,s),t.onDisposed.add(()=>{this.delete(t)}),s}delete(t){const s=this.list.get(t.uuid);s&&s.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}};O(li,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let ys=li;const Ae=new an,Mt=new W,fe=new W,Ct=new qt,tr={X:new W(1,0,0),Y:new W(0,1,0),Z:new W(0,0,1)},ki={type:"change"},er={type:"mouseDown"},sr={type:"mouseUp",mode:null},ir={type:"objectChange"};class qa extends si{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const s=new nc;this._gizmo=s,this.add(s);const i=new rc;this._plane=i,this.add(i);const n=this;function r(_,R){let g=R;Object.defineProperty(n,_,{get:function(){return g!==void 0?g:R},set:function(A){g!==A&&(g=A,i[_]=A,s[_]=A,n.dispatchEvent({type:_+"-changed",value:A}),n.dispatchEvent(ki))}}),n[_]=R,i[_]=R,s[_]=R}r("camera",e),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0);const o=new W,c=new W,l=new qt,h=new qt,u=new W,d=new qt,f=new W,E=new W,p=new W,T=0,m=new W;r("worldPosition",o),r("worldPositionStart",c),r("worldQuaternion",l),r("worldQuaternionStart",h),r("cameraPosition",u),r("cameraQuaternion",d),r("pointStart",f),r("pointEnd",E),r("rotationAxis",p),r("rotationAngle",T),r("eye",m),this._offset=new W,this._startNorm=new W,this._endNorm=new W,this._cameraScale=new W,this._parentPosition=new W,this._parentQuaternion=new qt,this._parentQuaternionInv=new qt,this._parentScale=new W,this._worldScaleStart=new W,this._worldQuaternionInv=new qt,this._worldScale=new W,this._positionStart=new W,this._quaternionStart=new qt,this._scaleStart=new W,this._getPointer=Ja.bind(this),this._onPointerDown=ec.bind(this),this._onPointerHover=tc.bind(this),this._onPointerMove=sc.bind(this),this._onPointerUp=ic.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;Ae.setFromCamera(e,this.camera);const t=zi(this._gizmo.picker[this.mode],Ae);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){Ae.setFromCamera(e,this.camera);const t=zi(this._plane,Ae,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,er.mode=this.mode,this.dispatchEvent(er)}}pointerMove(e){const t=this.axis,s=this.mode,i=this.object;let n=this.space;if(s==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),i===void 0||t===null||this.dragging===!1||e.button!==-1)return;Ae.setFromCamera(e,this.camera);const r=zi(this._plane,Ae,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Ct.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(Mt.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Mt.setFromMatrixPosition(i.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),fe.set(o,o,o)}else Mt.copy(this.pointStart),fe.copy(this.pointEnd),Mt.applyQuaternion(this._worldQuaternionInv),fe.applyQuaternion(this._worldQuaternionInv),fe.divide(Mt),t.search("X")===-1&&(fe.x=1),t.search("Y")===-1&&(fe.y=1),t.search("Z")===-1&&(fe.z=1);i.scale.copy(this._scaleStart).multiply(fe),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const o=20/this.worldPosition.distanceTo(Mt.setFromMatrixPosition(this.camera.matrixWorld));let c=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Mt.copy(this.rotationAxis).cross(this.eye))*o):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(tr[t]),Mt.copy(tr[t]),n==="local"&&Mt.applyQuaternion(this.worldQuaternion),Mt.cross(this.eye),Mt.length()===0?c=!0:this.rotationAngle=this._offset.dot(Mt.normalize())*o),(t==="E"||c)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Ct.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Ct.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ki),this.dispatchEvent(ir)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(sr.mode=this.mode,this.dispatchEvent(sr)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ki),this.dispatchEvent(ir),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Ae}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Ja(a){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:a.button};{const e=this.domElement.getBoundingClientRect();return{x:(a.clientX-e.left)/e.width*2-1,y:-(a.clientY-e.top)/e.height*2+1,button:a.button}}}function tc(a){if(this.enabled)switch(a.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(a));break}}function ec(a){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(a.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(a)),this.pointerDown(this._getPointer(a)))}function sc(a){this.enabled&&this.pointerMove(this._getPointer(a))}function ic(a){this.enabled&&(this.domElement.releasePointerCapture(a.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(a)))}function zi(a,e,t){const s=e.intersectObject(a,!0);for(let i=0;i.9&&(r.visible=!1)),this.axis==="Y"&&(Ct.setFromEuler(js.set(0,0,Math.PI/2)),r.quaternion.copy(s).multiply(Ct),Math.abs(pt.copy(Re).applyQuaternion(s).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Ct.setFromEuler(js.set(0,Math.PI/2,0)),r.quaternion.copy(s).multiply(Ct),Math.abs(pt.copy(fs).applyQuaternion(s).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Ct.setFromEuler(js.set(0,Math.PI/2,0)),pt.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(rr.lookAt(nr,pt,Re)),r.quaternion.multiply(Ct),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Mt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Mt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Mt),r.visible=this.dragging):(r.quaternion.copy(s),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(pt.copy(ds).applyQuaternion(s).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(pt.copy(Re).applyQuaternion(s).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(pt.copy(fs).applyQuaternion(s).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(pt.copy(fs).applyQuaternion(s).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(pt.copy(ds).applyQuaternion(s).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(pt.copy(Re).applyQuaternion(s).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Qs.copy(s),pt.copy(this.eye).applyQuaternion(Ct.copy(s).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(rr.lookAt(this.eye,nr,Re)),r.name==="X"&&(Ct.setFromAxisAngle(ds,Math.atan2(-pt.y,pt.z)),Ct.multiplyQuaternions(Qs,Ct),r.quaternion.copy(Ct)),r.name==="Y"&&(Ct.setFromAxisAngle(Re,Math.atan2(pt.x,pt.z)),Ct.multiplyQuaternions(Qs,Ct),r.quaternion.copy(Ct)),r.name==="Z"&&(Ct.setFromAxisAngle(fs,Math.atan2(pt.y,pt.x)),Ct.multiplyQuaternions(Qs,Ct),r.quaternion.copy(Ct))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(c){return r.name===c}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class rc extends et{constructor(){super(new mr(1e5,1e5,2,2),new Ve({visible:!1,wireframe:!0,side:mi,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Ks.copy(ds).applyQuaternion(t==="local"?this.worldQuaternion:ti),as.copy(Re).applyQuaternion(t==="local"?this.worldQuaternion:ti),cs.copy(fs).applyQuaternion(t==="local"?this.worldQuaternion:ti),pt.copy(as),this.mode){case"translate":case"scale":switch(this.axis){case"X":pt.copy(this.eye).cross(Ks),re.copy(Ks).cross(pt);break;case"Y":pt.copy(this.eye).cross(as),re.copy(as).cross(pt);break;case"Z":pt.copy(this.eye).cross(cs),re.copy(cs).cross(pt);break;case"XY":re.copy(cs);break;case"YZ":re.copy(Ks);break;case"XZ":pt.copy(cs),re.copy(as);break;case"XYZ":case"E":re.set(0,0,0);break}break;case"rotate":default:re.set(0,0,0)}re.length()===0?this.quaternion.copy(this.cameraQuaternion):(or.lookAt(Mt.set(0,0,0),re,pt),this.quaternion.setFromRotationMatrix(or)),super.updateMatrixWorld(e)}}class In{constructor(e,t,s,i,n,r=5,o=!0){O(this,"onDraggingStarted",new st);O(this,"onDraggingEnded",new st);O(this,"onDisposed",new st);O(this,"normal");O(this,"origin");O(this,"three",new rn);O(this,"components");O(this,"world");O(this,"type","default");O(this,"_helper");O(this,"_visible",!0);O(this,"_enabled",!0);O(this,"_controlsActive",!1);O(this,"_arrowBoundBox",new et);O(this,"_planeMesh");O(this,"_controls");O(this,"_hiddenMaterial",new Ve({visible:!1}));O(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});O(this,"changeDrag",e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)});if(this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=s,t.renderer.setPlane(!0,this.three),this._planeMesh=In.newPlaneMesh(r,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,s),o&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const e=new W(1,0,0),t=new W;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,s=new qa(e,t);return this.initializeControls(s),this.world.scene.three.add(s),s}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new xt(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new si;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const s=new mr(1),i=new et(s,t);return i.scale.set(e,e,e),i}}const Ts=class Ts extends kt{constructor(t){super(t);O(this,"onBeforeDrag",new st);O(this,"onAfterDrag",new st);O(this,"onBeforeCreate",new st);O(this,"onBeforeCancel",new st);O(this,"onAfterCancel",new st);O(this,"onBeforeDelete",new st);O(this,"onAfterCreate",new st);O(this,"onAfterDelete",new st);O(this,"onDisposed",new st);O(this,"orthogonalY",!1);O(this,"toleranceOrthogonalY",.7);O(this,"Type",In);O(this,"list",[]);O(this,"_material",new Ve({color:12255487,side:mi,transparent:!0,opacity:.2}));O(this,"_size",5);O(this,"_enabled",!1);O(this,"_visible",!0);O(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});O(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(Ts.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const s of this.list)s.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const s of this.list)s.visible=t}get material(){return this._material}set material(t){this._material=t;for(const s of this.list)s.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const s of this.list)s.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(Ts.uuid),this.onDisposed.reset()}create(t){const n=this.components.get(ys).get(t).castRay();return n?this.createPlaneFromIntersection(t,n):null}createFromNormalAndCoplanarPoint(t,s,i){const n=this.newPlane(t,i,s);return this.updateMaterialsAndPlanes(),n}delete(t,s){s||(s=this.pickPlane(t)),s&&this.deletePlane(s)}deleteAll(t){const s=[...this.list];for(const i of s)if(!t||t.has(i.type)){this.delete(i.world,i);const n=this.list.indexOf(i);n!==-1&&this.list.splice(n,1)}}deletePlane(t){const s=this.list.indexOf(t);if(s!==-1){if(this.list.splice(s,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(ys).get(t),n=this.getAllPlaneMeshes(),r=i.castRay(n);if(r){const o=r.object;return this.list.find(c=>c.meshes.includes(o))}}getAllPlaneMeshes(){const t=[];for(const s of this.list)t.push(...s.meshes);return t}createPlaneFromIntersection(t,s){var c;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=s.point.distanceTo(new W(0,0,0)),n=(c=s.face)==null?void 0:c.normal;if(!i||!n)return null;const r=this.getWorldNormal(s,n),o=this.newPlane(t,s.point,r.negate());return o.visible=this._visible,o.size=this._size,t.renderer.setPlane(!0,o.three),this.updateMaterialsAndPlanes(),o}getWorldNormal(t,s){const i=t.object;let n=t.object.matrixWorld.clone();if(i instanceof ei&&t.instanceId!==void 0){const l=new Ft;i.getMatrixAt(t.instanceId,l),n=l.multiply(n)}const o=new ho().getNormalMatrix(n),c=s.clone().applyMatrix3(o).normalize();return this.normalizePlaneDirectionY(c),c}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,s,i){const n=new this.Type(this.components,t,s,i,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const t=this.components.get(ji);for(const[s,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:n}=i.renderer;for(const r of i.meshes)if(r.material)if(Array.isArray(r.material))for(const o of r.material)o.clippingPlanes=n;else r.material.clippingPlanes=n}}};O(Ts,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Ki=Ts;class oc{constructor(e){O(this,"enabled",!1);O(this,"id","FirstPerson");this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new W;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=vt.ACTION.DOLLY,e.touches.two=vt.ACTION.TOUCH_ZOOM_TRUCK}}class ac{constructor(e){O(this,"enabled",!0);O(this,"id","Orbit");this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new W;e.getPosition(t);const s=t.length();e.distance=s,e.truckSpeed=2;const{rotation:i}=this.camera.three,n=new W(0,0,-1).applyEuler(i),r=t.addScaledVector(n,s);e.moveTo(r.x,r.y,r.z)}}class cc{constructor(e){O(this,"enabled",!1);O(this,"id","Plan");O(this,"mouseAction1");O(this,"mouseAction2");O(this,"mouseInitialized",!1);O(this,"defaultAzimuthSpeed");O(this,"defaultPolarSpeed");this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=vt.ACTION.TRUCK,t.touches.one=vt.ACTION.TOUCH_TRUCK,t.touches.two=vt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=vt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class lc{constructor(e){O(this,"onChanged",new st);O(this,"current","Perspective");O(this,"camera");O(this,"matchOrthoDistanceEnabled",!1);O(this,"_component");O(this,"_previousDistance",-1);this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const e=this.getPerspectiveDims();if(!e)return;const{width:t,height:s}=e;this.setupOrthoCamera(s,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new W;this._component.threePersp.getWorldDirection(t);const s=new W;this._component.controls.getTarget(s);const n=s.clone().sub(this._component.threePersp.position).dot(t),r=e.renderer.getSize(),o=r.x/r.y,c=this._component.threePersp,l=n*2*Math.atan(c.fov*(Math.PI/180)/2);return{width:l*o,height:l}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=vt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=vt.ACTION.ZOOM;const s=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=e/2,i.bottom=e/-2,i.updateProjectionMatrix(),i.position.copy(s.position),i.quaternion.copy(s.quaternion),this._component.controls.camera=i}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=vt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=vt.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=vt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class hc extends mn{constructor(t){super(t);O(this,"projection");O(this,"threeOrtho");O(this,"threePersp");O(this,"_userInputButtons",{});O(this,"_frustumSize",50);O(this,"_navigationModes",new Map);O(this,"_mode",null);O(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new lc(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(s=>{this.three=s,this.updateAspect()}),this.onWorldChanged.add(({action:s})=>{s==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new ac(this)),this._navigationModes.set("FirstPerson",new oc(this)),this._navigationModes.set("Plan",new cc(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,s=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,n=Number.MIN_VALUE,r=new W(i,i,i),o=new W(n,n,n);for(const f of t){const E=new Nt().setFromObject(f);E.min.xo.x&&(o.x=E.max.x),E.max.y>o.y&&(o.y=E.max.y),E.max.z>o.z&&(o.z=E.max.z)}const c=new Nt(r,o),l=new W;c.getSize(l);const h=new W;c.getCenter(h);const u=Math.max(l.x,l.y,l.z)*s,d=new Ei(h,u);await this.controls.fitToSphere(d,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new on(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),s=this.threeOrtho.top,i=this.threeOrtho.right,n=t.y/this.previousSize.y,r=t.x/this.previousSize.x,o=s*n,c=i*r;this.threeOrtho.left=-c,this.threeOrtho.right=c,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const uc=new Map([[ln,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[Ir,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[Cr,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[Tr,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[hn,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[gr,{forRelated:"IsTypedBy",forRelating:"Types"}],[_r,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[un,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[Ar,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[Rr,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[yr,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[Or,{forRelated:"HasContext",forRelating:"Declares"}],[Fr,{forRelated:"HasAssignments",forRelating:"Controls"}],[Sr,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),gs=class gs extends kt{constructor(t){super(t);O(this,"onDisposed",new st);O(this,"onRelationsIndexed",new st);O(this,"relationMaps",{});O(this,"enabled",!0);O(this,"_relToAttributesMap",uc);O(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests"]);O(this,"_ifcRels",[ln,Ir,Cr,Tr,hn,gr,_r,un,Ar,Rr,yr,Or,Fr,Sr]);O(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(gs.uuid,this),t.get(Tt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,s,i,n){const r=Object.keys(s).find(d=>d.startsWith("Relating")),o=Object.keys(s).find(d=>d.startsWith("Related"));if(!(r&&o))return;const c=s[r].value,l=s[o].map(d=>d.value),h=t.get(c)??new Map,u=this.getAttributeIndex(n);u!==null&&(h.set(u,l),t.set(c,h));for(const d of l){const f=t.get(d)??new Map,E=this.getAttributeIndex(i);if(!E)continue;const p=f.get(E)??[];p.push(c),f.set(E,p),t.set(d,f)}}getAttributeIndex(t){const s=this._inverseAttributes.indexOf(t);return s===-1?null:s}setRelationMap(t,s){this.relationMaps[t.uuid]=s,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:s})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let s=this.relationMaps[t.uuid];if(s)return s;s=new Map;for(const i of this._ifcRels){const n=await t.getAllPropertiesOfType(i);if(!n)continue;const r=this._relToAttributesMap.get(i);if(!r)continue;const{forRelated:o,forRelating:c}=r;for(const l in n){const h=n[l];this.indexRelations(s,h,o,c)}}return this.setRelationMap(t,s),s}async processFromWebIfc(t,s){const i=new Map;for(const n of this._ifcRels){const r=this._relToAttributesMap.get(n);if(!r)continue;const{forRelated:o,forRelating:c}=r,l=t.GetLineIDsWithType(s,n);for(let h=0;h - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(a,e){(function(t){a.exports=t()})(function(){return function t(s,i,n){function r(l,h){if(!i[l]){if(!s[l]){var u=typeof qs=="function"&&qs;if(!h&&u)return u(l,!0);if(o)return o(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var f=i[l]={exports:{}};s[l][0].call(f.exports,function(E){var p=s[l][1][E];return r(p||E)},f,f.exports,t,s,i,n)}return i[l].exports}for(var o=typeof qs=="function"&&qs,c=0;c>2,f=(3&l)<<4|h>>4,E=1>6:64,p=2>4,h=(15&d)<<4|(f=o.indexOf(c.charAt(p++)))>>2,u=(3&f)<<6|(E=o.indexOf(c.charAt(p++))),_[T++]=l,f!==64&&(_[T++]=h),E!==64&&(_[T++]=u);return _}},{"./support":30,"./utils":32}],2:[function(t,s,i){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(h,u,d,f,E){this.compressedSize=h,this.uncompressedSize=u,this.crc32=d,this.compression=f,this.compressedContent=E}l.prototype={getContentWorker:function(){var h=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),u=this;return h.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,u,d){return h.pipe(new o).pipe(new c("uncompressedSize")).pipe(u.compressWorker(d)).pipe(new c("compressedSize")).withStreamInfo("compression",u)},s.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,s,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,s,i){var n=t("./utils"),r=function(){for(var o,c=[],l=0;l<256;l++){o=l;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;c[l]=o}return c}();s.exports=function(o,c){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(l,h,u,d){var f=r,E=d+u;l^=-1;for(var p=d;p>>8^f[255&(l^h[p])];return-1^l}(0|c,o,o.length,0):function(l,h,u,d){var f=r,E=d+u;l^=-1;for(var p=d;p>>8^f[255&(l^h.charCodeAt(p))];return-1^l}(0|c,o,o.length,0):0}},{"./utils":32}],5:[function(t,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,s,i){var n=null;n=typeof Promise<"u"?Promise:t("lie"),s.exports={Promise:n}},{lie:37}],7:[function(t,s,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=t("pako"),o=t("./utils"),c=t("./stream/GenericWorker"),l=n?"uint8array":"array";function h(u,d){c.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=d,this.meta={}}i.magic="\b\0",o.inherits(h,c),h.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(l,u.data),!1)},h.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(d){u.push({data:d,meta:u.meta})}},i.compressWorker=function(u){return new h("Deflate",u)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,s,i){function n(f,E){var p,T="";for(p=0;p>>=8;return T}function r(f,E,p,T,m,_){var R,g,A=f.file,F=f.compression,w=_!==l.utf8encode,L=o.transformTo("string",_(A.name)),N=o.transformTo("string",l.utf8encode(A.name)),M=A.comment,z=o.transformTo("string",_(M)),y=o.transformTo("string",l.utf8encode(M)),P=N.length!==A.name.length,I=y.length!==M.length,v="",$="",Y="",q=A.dir,G=A.date,it={crc32:0,compressedSize:0,uncompressedSize:0};E&&!p||(it.crc32=f.crc32,it.compressedSize=f.compressedSize,it.uncompressedSize=f.uncompressedSize);var B=0;E&&(B|=8),w||!P&&!I||(B|=2048);var D=0,nt=0;q&&(D|=16),m==="UNIX"?(nt=798,D|=function(K,_t){var Pt=K;return K||(Pt=_t?16893:33204),(65535&Pt)<<16}(A.unixPermissions,q)):(nt=20,D|=function(K){return 63&(K||0)}(A.dosPermissions)),R=G.getUTCHours(),R<<=6,R|=G.getUTCMinutes(),R<<=5,R|=G.getUTCSeconds()/2,g=G.getUTCFullYear()-1980,g<<=4,g|=G.getUTCMonth()+1,g<<=5,g|=G.getUTCDate(),P&&($=n(1,1)+n(h(L),4)+N,v+="up"+n($.length,2)+$),I&&(Y=n(1,1)+n(h(z),4)+y,v+="uc"+n(Y.length,2)+Y);var J="";return J+=` -\0`,J+=n(B,2),J+=F.magic,J+=n(R,2),J+=n(g,2),J+=n(it.crc32,4),J+=n(it.compressedSize,4),J+=n(it.uncompressedSize,4),J+=n(L.length,2),J+=n(v.length,2),{fileRecord:u.LOCAL_FILE_HEADER+J+L+v,dirRecord:u.CENTRAL_FILE_HEADER+n(nt,2)+J+n(z.length,2)+"\0\0\0\0"+n(D,4)+n(T,4)+L+v+z}}var o=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),h=t("../crc32"),u=t("../signature");function d(f,E,p,T){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=E,this.zipPlatform=p,this.encodeFileName=T,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,c),d.prototype.push=function(f){var E=f.meta.percent||0,p=this.entriesCount,T=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(E+100*(p-T-1))/p:100}}))},d.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var E=this.streamFiles&&!f.file.dir;if(E){var p=r(f,E,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(f){this.accumulate=!1;var E=this.streamFiles&&!f.file.dir,p=r(f,E,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),E)this.push({data:function(T){return u.DATA_DESCRIPTOR+n(T.crc32,4)+n(T.compressedSize,4)+n(T.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var f=this.bytesWritten,E=0;E=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=o,l},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},s.exports=r},{"../utils":32}],19:[function(t,s,i){var n=t("./Uint8ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},s.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,s,i){var n=t("./DataReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},r.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},r.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},r.prototype.readData=function(o){this.checkOffset(o);var c=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},s.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,s,i){var n=t("./ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,c},s.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,s,i){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");s.exports=function(u){var d=n.getTypeOf(u);return n.checkSupport(d),d!=="string"||r.uint8array?d==="nodebuffer"?new l(u):r.uint8array?new h(n.transformTo("uint8array",u)):new o(n.transformTo("array",u)):new c(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,s,i){var n=t("./GenericWorker"),r=t("../utils");function o(c){n.call(this,"ConvertWorker to "+c),this.destType=c}r.inherits(o,n),o.prototype.processChunk=function(c){this.push({data:r.transformTo(this.destType,c.data),meta:c.meta})},s.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,s,i){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(c){this.streamInfo.crc32=r(c.data,this.streamInfo.crc32||0),this.push(c)},s.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function o(c){r.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}n.inherits(o,r),o.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}r.prototype.processChunk.call(this,c)},s.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function o(c){r.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=n.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,s,i){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,o){return this._listeners[r].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,o){if(this._listeners[r])for(var c=0;c "+r:r}},s.exports=n},{}],29:[function(t,s,i){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),c=t("../base64"),l=t("../support"),h=t("../external"),u=null;if(l.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function d(E,p){return new h.Promise(function(T,m){var _=[],R=E._internalType,g=E._outputType,A=E._mimeType;E.on("data",function(F,w){_.push(F),p&&p(w)}).on("error",function(F){_=[],m(F)}).on("end",function(){try{var F=function(w,L,N){switch(w){case"blob":return n.newBlob(n.transformTo("arraybuffer",L),N);case"base64":return c.encode(L);default:return n.transformTo(w,L)}}(g,function(w,L){var N,M=0,z=null,y=0;for(N=0;N"u")i.blob=!1;else{var n=new ArrayBuffer(0);try{i.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),i.blob=r.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,s,i){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function u(){c.call(this,"utf-8 decode"),this.leftOver=null}function d(){c.call(this,"utf-8 encode")}i.utf8encode=function(f){return r.nodebuffer?o.newBufferFrom(f,"utf-8"):function(E){var p,T,m,_,R,g=E.length,A=0;for(_=0;_>>6:(T<65536?p[R++]=224|T>>>12:(p[R++]=240|T>>>18,p[R++]=128|T>>>12&63),p[R++]=128|T>>>6&63),p[R++]=128|63&T);return p}(f)},i.utf8decode=function(f){return r.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(E){var p,T,m,_,R=E.length,g=new Array(2*R);for(p=T=0;p>10&1023,g[T++]=56320|1023&m)}return g.length!==T&&(g.subarray?g=g.subarray(0,T):g.length=T),n.applyFromCharCode(g)}(f=n.transformTo(r.uint8array?"uint8array":"array",f))},n.inherits(u,c),u.prototype.processChunk=function(f){var E=n.transformTo(r.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var p=E;(E=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),E.set(p,this.leftOver.length)}else E=this.leftOver.concat(E);this.leftOver=null}var T=function(_,R){var g;for((R=R||_.length)>_.length&&(R=_.length),g=R-1;0<=g&&(192&_[g])==128;)g--;return g<0||g===0?R:g+l[_[g]]>R?g:R}(E),m=E;T!==E.length&&(r.uint8array?(m=E.subarray(0,T),this.leftOver=E.subarray(T,E.length)):(m=E.slice(0,T),this.leftOver=E.slice(T,E.length))),this.push({data:i.utf8decode(m),meta:f.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,n.inherits(d,c),d.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,s,i){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),c=t("./external");function l(p){return p}function h(p,T){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var E,p,T,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?d[T++]=224|f>>>12:(d[T++]=240|f>>>18,d[T++]=128|f>>>12&63),d[T++]=128|f>>>6&63),d[T++]=128|63&f);return d},i.buf2binstring=function(u){return h(u,u.length)},i.binstring2buf=function(u){for(var d=new n.Buf8(u.length),f=0,E=d.length;f>10&1023,_[E++]=56320|1023&p)}return h(_,E)},i.utf8border=function(u,d){var f;for((d=d||u.length)>u.length&&(d=u.length),f=d-1;0<=f&&(192&u[f])==128;)f--;return f<0||f===0?d:f+c[u[f]]>d?f:d}},{"./common":41}],43:[function(t,s,i){s.exports=function(n,r,o,c){for(var l=65535&n|0,h=n>>>16&65535|0,u=0;o!==0;){for(o-=u=2e3>>1:r>>>1;o[c]=r}return o}();s.exports=function(r,o,c,l){var h=n,u=l+c;r^=-1;for(var d=l;d>>8^h[255&(r^o[d])];return-1^r}},{}],46:[function(t,s,i){var n,r=t("../utils/common"),o=t("./trees"),c=t("./adler32"),l=t("./crc32"),h=t("./messages"),u=0,d=4,f=0,E=-2,p=-1,T=4,m=2,_=8,R=9,g=286,A=30,F=19,w=2*g+1,L=15,N=3,M=258,z=M+N+1,y=42,P=113,I=1,v=2,$=3,Y=4;function q(C,H){return C.msg=h[H],H}function G(C){return(C<<1)-(4C.avail_out&&(k=C.avail_out),k!==0&&(r.arraySet(C.output,H.pending_buf,H.pending_out,k,C.next_out),C.next_out+=k,H.pending_out+=k,C.total_out+=k,C.avail_out-=k,H.pending-=k,H.pending===0&&(H.pending_out=0))}function D(C,H){o._tr_flush_block(C,0<=C.block_start?C.block_start:-1,C.strstart-C.block_start,H),C.block_start=C.strstart,B(C.strm)}function nt(C,H){C.pending_buf[C.pending++]=H}function J(C,H){C.pending_buf[C.pending++]=H>>>8&255,C.pending_buf[C.pending++]=255&H}function K(C,H){var k,b,S=C.max_chain_length,x=C.strstart,X=C.prev_length,Z=C.nice_match,U=C.strstart>C.w_size-z?C.strstart-(C.w_size-z):0,j=C.window,tt=C.w_mask,Q=C.prev,rt=C.strstart+M,Et=j[x+X-1],ht=j[x+X];C.prev_length>=C.good_match&&(S>>=2),Z>C.lookahead&&(Z=C.lookahead);do if(j[(k=H)+X]===ht&&j[k+X-1]===Et&&j[k]===j[x]&&j[++k]===j[x+1]){x+=2,k++;do;while(j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&j[++x]===j[++k]&&xU&&--S!=0);return X<=C.lookahead?X:C.lookahead}function _t(C){var H,k,b,S,x,X,Z,U,j,tt,Q=C.w_size;do{if(S=C.window_size-C.lookahead-C.strstart,C.strstart>=Q+(Q-z)){for(r.arraySet(C.window,C.window,Q,Q,0),C.match_start-=Q,C.strstart-=Q,C.block_start-=Q,H=k=C.hash_size;b=C.head[--H],C.head[H]=Q<=b?b-Q:0,--k;);for(H=k=Q;b=C.prev[--H],C.prev[H]=Q<=b?b-Q:0,--k;);S+=Q}if(C.strm.avail_in===0)break;if(X=C.strm,Z=C.window,U=C.strstart+C.lookahead,j=S,tt=void 0,tt=X.avail_in,j=N)for(x=C.strstart-C.insert,C.ins_h=C.window[x],C.ins_h=(C.ins_h<=N&&(C.ins_h=(C.ins_h<=N)if(b=o._tr_tally(C,C.strstart-C.match_start,C.match_length-N),C.lookahead-=C.match_length,C.match_length<=C.max_lazy_match&&C.lookahead>=N){for(C.match_length--;C.strstart++,C.ins_h=(C.ins_h<=N&&(C.ins_h=(C.ins_h<=N&&C.match_length<=C.prev_length){for(S=C.strstart+C.lookahead-N,b=o._tr_tally(C,C.strstart-1-C.prev_match,C.prev_length-N),C.lookahead-=C.prev_length-1,C.prev_length-=2;++C.strstart<=S&&(C.ins_h=(C.ins_h<C.pending_buf_size-5&&(k=C.pending_buf_size-5);;){if(C.lookahead<=1){if(_t(C),C.lookahead===0&&H===u)return I;if(C.lookahead===0)break}C.strstart+=C.lookahead,C.lookahead=0;var b=C.block_start+k;if((C.strstart===0||C.strstart>=b)&&(C.lookahead=C.strstart-b,C.strstart=b,D(C,!1),C.strm.avail_out===0)||C.strstart-C.block_start>=C.w_size-z&&(D(C,!1),C.strm.avail_out===0))return I}return C.insert=0,H===d?(D(C,!0),C.strm.avail_out===0?$:Y):(C.strstart>C.block_start&&(D(C,!1),C.strm.avail_out),I)}),new dt(4,4,8,4,Pt),new dt(4,5,16,8,Pt),new dt(4,6,32,32,Pt),new dt(4,4,16,16,lt),new dt(8,16,32,32,lt),new dt(8,16,128,128,lt),new dt(8,32,128,256,lt),new dt(32,128,258,1024,lt),new dt(32,258,258,4096,lt)],i.deflateInit=function(C,H){return $t(C,H,_,15,8,0)},i.deflateInit2=$t,i.deflateReset=ee,i.deflateResetKeep=At,i.deflateSetHeader=function(C,H){return C&&C.state?C.state.wrap!==2?E:(C.state.gzhead=H,f):E},i.deflate=function(C,H){var k,b,S,x;if(!C||!C.state||5>8&255),nt(b,b.gzhead.time>>16&255),nt(b,b.gzhead.time>>24&255),nt(b,b.level===9?2:2<=b.strategy||b.level<2?4:0),nt(b,255&b.gzhead.os),b.gzhead.extra&&b.gzhead.extra.length&&(nt(b,255&b.gzhead.extra.length),nt(b,b.gzhead.extra.length>>8&255)),b.gzhead.hcrc&&(C.adler=l(C.adler,b.pending_buf,b.pending,0)),b.gzindex=0,b.status=69):(nt(b,0),nt(b,0),nt(b,0),nt(b,0),nt(b,0),nt(b,b.level===9?2:2<=b.strategy||b.level<2?4:0),nt(b,3),b.status=P);else{var X=_+(b.w_bits-8<<4)<<8;X|=(2<=b.strategy||b.level<2?0:b.level<6?1:b.level===6?2:3)<<6,b.strstart!==0&&(X|=32),X+=31-X%31,b.status=P,J(b,X),b.strstart!==0&&(J(b,C.adler>>>16),J(b,65535&C.adler)),C.adler=1}if(b.status===69)if(b.gzhead.extra){for(S=b.pending;b.gzindex<(65535&b.gzhead.extra.length)&&(b.pending!==b.pending_buf_size||(b.gzhead.hcrc&&b.pending>S&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),B(C),S=b.pending,b.pending!==b.pending_buf_size));)nt(b,255&b.gzhead.extra[b.gzindex]),b.gzindex++;b.gzhead.hcrc&&b.pending>S&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),b.gzindex===b.gzhead.extra.length&&(b.gzindex=0,b.status=73)}else b.status=73;if(b.status===73)if(b.gzhead.name){S=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>S&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),B(C),S=b.pending,b.pending===b.pending_buf_size)){x=1;break}x=b.gzindexS&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),x===0&&(b.gzindex=0,b.status=91)}else b.status=91;if(b.status===91)if(b.gzhead.comment){S=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>S&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),B(C),S=b.pending,b.pending===b.pending_buf_size)){x=1;break}x=b.gzindexS&&(C.adler=l(C.adler,b.pending_buf,b.pending-S,S)),x===0&&(b.status=103)}else b.status=103;if(b.status===103&&(b.gzhead.hcrc?(b.pending+2>b.pending_buf_size&&B(C),b.pending+2<=b.pending_buf_size&&(nt(b,255&C.adler),nt(b,C.adler>>8&255),C.adler=0,b.status=P)):b.status=P),b.pending!==0){if(B(C),C.avail_out===0)return b.last_flush=-1,f}else if(C.avail_in===0&&G(H)<=G(k)&&H!==d)return q(C,-5);if(b.status===666&&C.avail_in!==0)return q(C,-5);if(C.avail_in!==0||b.lookahead!==0||H!==u&&b.status!==666){var Z=b.strategy===2?function(U,j){for(var tt;;){if(U.lookahead===0&&(_t(U),U.lookahead===0)){if(j===u)return I;break}if(U.match_length=0,tt=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,tt&&(D(U,!1),U.strm.avail_out===0))return I}return U.insert=0,j===d?(D(U,!0),U.strm.avail_out===0?$:Y):U.last_lit&&(D(U,!1),U.strm.avail_out===0)?I:v}(b,H):b.strategy===3?function(U,j){for(var tt,Q,rt,Et,ht=U.window;;){if(U.lookahead<=M){if(_t(U),U.lookahead<=M&&j===u)return I;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=N&&0U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=N?(tt=o._tr_tally(U,1,U.match_length-N),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(tt=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),tt&&(D(U,!1),U.strm.avail_out===0))return I}return U.insert=0,j===d?(D(U,!0),U.strm.avail_out===0?$:Y):U.last_lit&&(D(U,!1),U.strm.avail_out===0)?I:v}(b,H):n[b.level].func(b,H);if(Z!==$&&Z!==Y||(b.status=666),Z===I||Z===$)return C.avail_out===0&&(b.last_flush=-1),f;if(Z===v&&(H===1?o._tr_align(b):H!==5&&(o._tr_stored_block(b,0,0,!1),H===3&&(it(b.head),b.lookahead===0&&(b.strstart=0,b.block_start=0,b.insert=0))),B(C),C.avail_out===0))return b.last_flush=-1,f}return H!==d?f:b.wrap<=0?1:(b.wrap===2?(nt(b,255&C.adler),nt(b,C.adler>>8&255),nt(b,C.adler>>16&255),nt(b,C.adler>>24&255),nt(b,255&C.total_in),nt(b,C.total_in>>8&255),nt(b,C.total_in>>16&255),nt(b,C.total_in>>24&255)):(J(b,C.adler>>>16),J(b,65535&C.adler)),B(C),0=k.w_size&&(x===0&&(it(k.head),k.strstart=0,k.block_start=0,k.insert=0),j=new r.Buf8(k.w_size),r.arraySet(j,H,tt-k.w_size,k.w_size,0),H=j,tt=k.w_size),X=C.avail_in,Z=C.next_in,U=C.input,C.avail_in=tt,C.next_in=0,C.input=H,_t(k);k.lookahead>=N;){for(b=k.strstart,S=k.lookahead-(N-1);k.ins_h=(k.ins_h<>>=N=L>>>24,R-=N,(N=L>>>16&255)===0)v[h++]=65535&L;else{if(!(16&N)){if(!(64&N)){L=g[(65535&L)+(_&(1<>>=N,R-=N),R<15&&(_+=I[c++]<>>=N=L>>>24,R-=N,!(16&(N=L>>>16&255))){if(!(64&N)){L=A[(65535&L)+(_&(1<>>=N,R-=N,(N=h-u)>3,_&=(1<<(R-=M<<3))-1,n.next_in=c,n.next_out=h,n.avail_in=c>>24&255)+(y>>>8&65280)+((65280&y)<<8)+((255&y)<<24)}function _(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R(y){var P;return y&&y.state?(P=y.state,y.total_in=y.total_out=P.total=0,y.msg="",P.wrap&&(y.adler=1&P.wrap),P.mode=E,P.last=0,P.havedict=0,P.dmax=32768,P.head=null,P.hold=0,P.bits=0,P.lencode=P.lendyn=new n.Buf32(p),P.distcode=P.distdyn=new n.Buf32(T),P.sane=1,P.back=-1,d):f}function g(y){var P;return y&&y.state?((P=y.state).wsize=0,P.whave=0,P.wnext=0,R(y)):f}function A(y,P){var I,v;return y&&y.state?(v=y.state,P<0?(I=0,P=-P):(I=1+(P>>4),P<48&&(P&=15)),P&&(P<8||15=Y.wsize?(n.arraySet(Y.window,P,I-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(v<($=Y.wsize-Y.wnext)&&($=v),n.arraySet(Y.window,P,I-v,$,Y.wnext),(v-=$)?(n.arraySet(Y.window,P,I-v,v,0),Y.wnext=v,Y.whave=Y.wsize):(Y.wnext+=$,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave>>8&255,I.check=o(I.check,x,2,0),D=B=0,I.mode=2;break}if(I.flags=0,I.head&&(I.head.done=!1),!(1&I.wrap)||(((255&B)<<8)+(B>>8))%31){y.msg="incorrect header check",I.mode=30;break}if((15&B)!=8){y.msg="unknown compression method",I.mode=30;break}if(D-=4,C=8+(15&(B>>>=4)),I.wbits===0)I.wbits=C;else if(C>I.wbits){y.msg="invalid window size",I.mode=30;break}I.dmax=1<>8&1),512&I.flags&&(x[0]=255&B,x[1]=B>>>8&255,I.check=o(I.check,x,2,0)),D=B=0,I.mode=3;case 3:for(;D<32;){if(G===0)break t;G--,B+=v[Y++]<>>8&255,x[2]=B>>>16&255,x[3]=B>>>24&255,I.check=o(I.check,x,4,0)),D=B=0,I.mode=4;case 4:for(;D<16;){if(G===0)break t;G--,B+=v[Y++]<>8),512&I.flags&&(x[0]=255&B,x[1]=B>>>8&255,I.check=o(I.check,x,2,0)),D=B=0,I.mode=5;case 5:if(1024&I.flags){for(;D<16;){if(G===0)break t;G--,B+=v[Y++]<>>8&255,I.check=o(I.check,x,2,0)),D=B=0}else I.head&&(I.head.extra=null);I.mode=6;case 6:if(1024&I.flags&&(G<(K=I.length)&&(K=G),K&&(I.head&&(C=I.head.extra_len-I.length,I.head.extra||(I.head.extra=new Array(I.head.extra_len)),n.arraySet(I.head.extra,v,Y,K,C)),512&I.flags&&(I.check=o(I.check,v,K,Y)),G-=K,Y+=K,I.length-=K),I.length))break t;I.length=0,I.mode=7;case 7:if(2048&I.flags){if(G===0)break t;for(K=0;C=v[Y+K++],I.head&&C&&I.length<65536&&(I.head.name+=String.fromCharCode(C)),C&&K>9&1,I.head.done=!0),y.adler=I.check=0,I.mode=12;break;case 10:for(;D<32;){if(G===0)break t;G--,B+=v[Y++]<>>=7&D,D-=7&D,I.mode=27;break}for(;D<3;){if(G===0)break t;G--,B+=v[Y++]<>>=1)){case 0:I.mode=14;break;case 1:if(M(I),I.mode=20,P!==6)break;B>>>=2,D-=2;break t;case 2:I.mode=17;break;case 3:y.msg="invalid block type",I.mode=30}B>>>=2,D-=2;break;case 14:for(B>>>=7&D,D-=7&D;D<32;){if(G===0)break t;G--,B+=v[Y++]<>>16^65535)){y.msg="invalid stored block lengths",I.mode=30;break}if(I.length=65535&B,D=B=0,I.mode=15,P===6)break t;case 15:I.mode=16;case 16:if(K=I.length){if(G>>=5,D-=5,I.ndist=1+(31&B),B>>>=5,D-=5,I.ncode=4+(15&B),B>>>=4,D-=4,286>>=3,D-=3}for(;I.have<19;)I.lens[X[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,k={bits:I.lenbits},H=l(0,I.lens,0,19,I.lencode,0,I.work,k),I.lenbits=k.bits,H){y.msg="invalid code lengths set",I.mode=30;break}I.have=0,I.mode=19;case 19:for(;I.have>>16&255,wt=65535&S,!((lt=S>>>24)<=D);){if(G===0)break t;G--,B+=v[Y++]<>>=lt,D-=lt,I.lens[I.have++]=wt;else{if(wt===16){for(b=lt+2;D>>=lt,D-=lt,I.have===0){y.msg="invalid bit length repeat",I.mode=30;break}C=I.lens[I.have-1],K=3+(3&B),B>>>=2,D-=2}else if(wt===17){for(b=lt+3;D>>=lt)),B>>>=3,D-=3}else{for(b=lt+7;D>>=lt)),B>>>=7,D-=7}if(I.have+K>I.nlen+I.ndist){y.msg="invalid bit length repeat",I.mode=30;break}for(;K--;)I.lens[I.have++]=C}}if(I.mode===30)break;if(I.lens[256]===0){y.msg="invalid code -- missing end-of-block",I.mode=30;break}if(I.lenbits=9,k={bits:I.lenbits},H=l(h,I.lens,0,I.nlen,I.lencode,0,I.work,k),I.lenbits=k.bits,H){y.msg="invalid literal/lengths set",I.mode=30;break}if(I.distbits=6,I.distcode=I.distdyn,k={bits:I.distbits},H=l(u,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,k),I.distbits=k.bits,H){y.msg="invalid distances set",I.mode=30;break}if(I.mode=20,P===6)break t;case 20:I.mode=21;case 21:if(6<=G&&258<=it){y.next_out=q,y.avail_out=it,y.next_in=Y,y.avail_in=G,I.hold=B,I.bits=D,c(y,J),q=y.next_out,$=y.output,it=y.avail_out,Y=y.next_in,v=y.input,G=y.avail_in,B=I.hold,D=I.bits,I.mode===12&&(I.back=-1);break}for(I.back=0;dt=(S=I.lencode[B&(1<>>16&255,wt=65535&S,!((lt=S>>>24)<=D);){if(G===0)break t;G--,B+=v[Y++]<>At)])>>>16&255,wt=65535&S,!(At+(lt=S>>>24)<=D);){if(G===0)break t;G--,B+=v[Y++]<>>=At,D-=At,I.back+=At}if(B>>>=lt,D-=lt,I.back+=lt,I.length=wt,dt===0){I.mode=26;break}if(32&dt){I.back=-1,I.mode=12;break}if(64&dt){y.msg="invalid literal/length code",I.mode=30;break}I.extra=15&dt,I.mode=22;case 22:if(I.extra){for(b=I.extra;D>>=I.extra,D-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=23;case 23:for(;dt=(S=I.distcode[B&(1<>>16&255,wt=65535&S,!((lt=S>>>24)<=D);){if(G===0)break t;G--,B+=v[Y++]<>At)])>>>16&255,wt=65535&S,!(At+(lt=S>>>24)<=D);){if(G===0)break t;G--,B+=v[Y++]<>>=At,D-=At,I.back+=At}if(B>>>=lt,D-=lt,I.back+=lt,64&dt){y.msg="invalid distance code",I.mode=30;break}I.offset=wt,I.extra=15&dt,I.mode=24;case 24:if(I.extra){for(b=I.extra;D>>=I.extra,D-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){y.msg="invalid distance too far back",I.mode=30;break}I.mode=25;case 25:if(it===0)break t;if(K=J-it,I.offset>K){if((K=I.offset-K)>I.whave&&I.sane){y.msg="invalid distance too far back",I.mode=30;break}_t=K>I.wnext?(K-=I.wnext,I.wsize-K):I.wnext-K,K>I.length&&(K=I.length),Pt=I.window}else Pt=$,_t=q-I.offset,K=I.length;for(itw?(N=_t[Pt+T[P]],D[nt+T[P]]):(N=96,0),_=1<>q)+(R-=_)]=L<<24|N<<16|M|0,R!==0;);for(_=1<>=1;if(_!==0?(B&=_-1,B+=_):B=0,P++,--J[y]==0){if(y===v)break;y=u[d+T[P]]}if($>>7)]}function nt(S,x){S.pending_buf[S.pending++]=255&x,S.pending_buf[S.pending++]=x>>>8&255}function J(S,x,X){S.bi_valid>m-X?(S.bi_buf|=x<>m-S.bi_valid,S.bi_valid+=X-m):(S.bi_buf|=x<>>=1,X<<=1,0<--x;);return X>>>1}function Pt(S,x,X){var Z,U,j=new Array(T+1),tt=0;for(Z=1;Z<=T;Z++)j[Z]=tt=tt+X[Z-1]<<1;for(U=0;U<=x;U++){var Q=S[2*U+1];Q!==0&&(S[2*U]=_t(j[Q]++,Q))}}function lt(S){var x;for(x=0;x>1;1<=X;X--)At(S,j,X);for(U=rt;X=S.heap[1],S.heap[1]=S.heap[S.heap_len--],At(S,j,1),Z=S.heap[1],S.heap[--S.heap_max]=X,S.heap[--S.heap_max]=Z,j[2*U]=j[2*X]+j[2*Z],S.depth[U]=(S.depth[X]>=S.depth[Z]?S.depth[X]:S.depth[Z])+1,j[2*X+1]=j[2*Z+1]=U,S.heap[1]=U++,At(S,j,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(ht,Vt){var Xe,se,Ze,Rt,Fs,gi,ae=Vt.dyn_tree,_n=Vt.max_code,Zr=Vt.stat_desc.static_tree,$r=Vt.stat_desc.has_stree,jr=Vt.stat_desc.extra_bits,An=Vt.stat_desc.extra_base,$e=Vt.stat_desc.max_length,Ss=0;for(Rt=0;Rt<=T;Rt++)ht.bl_count[Rt]=0;for(ae[2*ht.heap[ht.heap_max]+1]=0,Xe=ht.heap_max+1;Xe>=7;U>>=1)if(1&Et&&Q.dyn_ltree[2*rt]!==0)return r;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return o;for(rt=32;rt>>3,(j=S.static_len+3+7>>>3)<=U&&(U=j)):U=j=X+5,X+4<=U&&x!==-1?b(S,x,X,Z):S.strategy===4||j===U?(J(S,2+(Z?1:0),3),ee(S,z,y)):(J(S,4+(Z?1:0),3),function(Q,rt,Et,ht){var Vt;for(J(Q,rt-257,5),J(Q,Et-1,5),J(Q,ht-4,4),Vt=0;Vt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&x,S.pending_buf[S.l_buf+S.last_lit]=255&X,S.last_lit++,x===0?S.dyn_ltree[2*X]++:(S.matches++,x--,S.dyn_ltree[2*(I[X]+u+1)]++,S.dyn_dtree[2*D(x)]++),S.last_lit===S.lit_bufsize-1},i._tr_align=function(S){J(S,2,3),K(S,R,z),function(x){x.bi_valid===16?(nt(x,x.bi_buf),x.bi_buf=0,x.bi_valid=0):8<=x.bi_valid&&(x.pending_buf[x.pending++]=255&x.bi_buf,x.bi_buf>>=8,x.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(t,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,s,i){(function(n){(function(r,o){if(!r.setImmediate){var c,l,h,u,d=1,f={},E=!1,p=r.document,T=Object.getPrototypeOf&&Object.getPrototypeOf(r);T=T&&T.setTimeout?T:r,c={}.toString.call(r.process)==="[object process]"?function(g){process.nextTick(function(){_(g)})}:function(){if(r.postMessage&&!r.importScripts){var g=!0,A=r.onmessage;return r.onmessage=function(){g=!1},r.postMessage("","*"),r.onmessage=A,g}}()?(u="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",R,!1):r.attachEvent("onmessage",R),function(g){r.postMessage(u+g,"*")}):r.MessageChannel?((h=new MessageChannel).port1.onmessage=function(g){_(g.data)},function(g){h.port2.postMessage(g)}):p&&"onreadystatechange"in p.createElement("script")?(l=p.documentElement,function(g){var A=p.createElement("script");A.onreadystatechange=function(){_(g),A.onreadystatechange=null,l.removeChild(A),A=null},l.appendChild(A)}):function(g){setTimeout(_,0,g)},T.setImmediate=function(g){typeof g!="function"&&(g=new Function(""+g));for(var A=new Array(arguments.length-1),F=0;F"u"?n===void 0?this:n:self)}).call(this,typeof Ns<"u"?Ns:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Br);var dc=Br.exports;const ar=Po(dc);var Cn={},Ti={};(function(a){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+e+"]["+t+"]*",i=new RegExp("^"+s+"$"),n=function(o,c){const l=[];let h=c.exec(o);for(;h;){const u=[];u.startIndex=c.lastIndex-h[0].length;const d=h.length;for(let f=0;f"u")};a.isExist=function(o){return typeof o<"u"},a.isEmptyObject=function(o){return Object.keys(o).length===0},a.merge=function(o,c,l){if(c){const h=Object.keys(c),u=h.length;for(let d=0;d"&&a[n]!==" "&&a[n]!==" "&&a[n]!==` -`&&a[n]!=="\r";n++)c+=a[n];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),n--),!_c(c)){let u;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",Ot("InvalidTag",u,Ut(a,n))}const l=mc(a,n);if(l===!1)return Ot("InvalidAttr","Attributes for '"+c+"' have open quote.",Ut(a,n));let h=l.value;if(n=l.index,h[h.length-1]==="/"){const u=n-h.length;h=h.substring(0,h.length-1);const d=ur(h,e);if(d===!0)s=!0;else return Ot(d.err.code,d.err.msg,Ut(a,u+d.err.line))}else if(o)if(l.tagClosed){if(h.trim().length>0)return Ot("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Ut(a,r));if(t.length===0)return Ot("InvalidTag","Closing tag '"+c+"' has not been opened.",Ut(a,r));{const u=t.pop();if(c!==u.tagName){let d=Ut(a,u.tagStartPos);return Ot("InvalidTag","Expected closing tag '"+u.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+c+"'.",Ut(a,r))}t.length==0&&(i=!0)}}else return Ot("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Ut(a,n));else{const u=ur(h,e);if(u!==!0)return Ot(u.err.code,u.err.msg,Ut(a,n-h.length+u.err.line));if(i===!0)return Ot("InvalidXml","Multiple possible root nodes found.",Ut(a,n));e.unpairedTags.indexOf(c)!==-1||t.push({tagName:c,tagStartPos:r}),s=!0}for(n++;n0)return Ot("InvalidXml","Invalid '"+JSON.stringify(t.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ot("InvalidXml","Start tag expected.",1);return!0};function cr(a){return a===" "||a===" "||a===` -`||a==="\r"}function lr(a,e){const t=e;for(;e5&&s==="xml")return Ot("InvalidXml","XML declaration allowed only at the start of the document.",Ut(a,e));if(a[e]=="?"&&a[e+1]==">"){e++;break}else continue}return e}function hr(a,e){if(a.length>e+5&&a[e+1]==="-"&&a[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(a.length>e+8&&a[e+1]==="D"&&a[e+2]==="O"&&a[e+3]==="C"&&a[e+4]==="T"&&a[e+5]==="Y"&&a[e+6]==="P"&&a[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(a.length>e+9&&a[e+1]==="["&&a[e+2]==="C"&&a[e+3]==="D"&&a[e+4]==="A"&&a[e+5]==="T"&&a[e+6]==="A"&&a[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}const pc='"',Ec="'";function mc(a,e){let t="",s="",i=!1;for(;e"&&s===""){i=!0;break}t+=a[e]}return s!==""?!1:{value:t,index:e,tagClosed:i}}const Ic=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function ur(a,e){const t=Tn.getAllMatches(a,Ic),s={};for(let i=0;i!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(a,e,t){return a}},Ac=function(a){return Object.assign({},kr,a)};gn.buildOptions=Ac;gn.defaultOptions=kr;class Rc{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var yc=Rc;const Oc=Ti;function Fc(a,e){const t={};if(a[e+3]==="O"&&a[e+4]==="C"&&a[e+5]==="T"&&a[e+6]==="Y"&&a[e+7]==="P"&&a[e+8]==="E"){e=e+9;let s=1,i=!1,n=!1,r="";for(;e"){if(n?a[e-1]==="-"&&a[e-2]==="-"&&(n=!1,s--):s--,s===0)break}else a[e]==="["?i=!0:r+=a[e];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Sc(a,e){let t="";for(;e0&&i&&t[2]!==".")return a;if(!e.leadingZeros&&n.length>0&&!i&&t[1]!==".")return a;{const c=Number(t),l=""+c;return l.search(/[eE]/)!==-1||o?e.eNotation?c:a:t.indexOf(".")!==-1?l==="0"&&r===""||l===r||i&&l==="-"+r?c:a:n?r===l||i+r===l?c:a:t===l||t===i+l?c:a}}else return a}}function kc(a){return a&&a.indexOf(".")!==-1&&(a=a.replace(/0+$/,""),a==="."?a="0":a[0]==="."?a="0"+a:a[a.length-1]==="."&&(a=a.substr(0,a.length-1))),a}var zc=Bc;const zr=Ti,hs=yc,Yc=vc,Vc=zc;let Gc=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,s)=>String.fromCharCode(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,s)=>String.fromCharCode(Number.parseInt(s,16))}},this.addExternalEntities=Hc,this.parseXml=jc,this.parseTextData=Wc,this.resolveNameSpace=Xc,this.buildAttributesMap=$c,this.isItStopNode=Jc,this.replaceEntitiesValue=Kc,this.readStopNodeData=el,this.saveTextToParentTag=qc,this.addChild=Qc}};function Hc(a){const e=Object.keys(a);for(let t=0;t0)){r||(a=this.replaceEntitiesValue(a));const o=this.options.tagValueProcessor(e,a,t,i,n);return o==null?a:typeof o!=typeof a||o!==a?o:this.options.trimValues?Ji(a,this.options.parseTagValue,this.options.numberParseOptions):a.trim()===a?Ji(a,this.options.parseTagValue,this.options.numberParseOptions):a}}function Xc(a){if(this.options.removeNSPrefix){const e=a.split(":"),t=a.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(a=t+e[1])}return a}const Zc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function $c(a,e,t){if(!this.options.ignoreAttributes&&typeof a=="string"){const s=zr.getAllMatches(a,Zc),i=s.length,n={};for(let r=0;r",n,"Closing Tag is not closed.");let c=a.substring(n+2,o).trim();if(this.options.removeNSPrefix){const u=c.indexOf(":");u!==-1&&(c=c.substr(u+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&(s=this.saveTextToParentTag(s,t,i));const l=i.substring(i.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let h=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(h=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=i.lastIndexOf("."),i=i.substring(0,h),t=this.tagsNodeStack.pop(),s="",n=o}else if(a[n+1]==="?"){let o=qi(a,n,!1,"?>");if(!o)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,t,i),!(this.options.ignoreDeclaration&&o.tagName==="?xml"||this.options.ignorePiTags)){const c=new hs(o.tagName);c.add(this.options.textNodeName,""),o.tagName!==o.tagExp&&o.attrExpPresent&&(c[":@"]=this.buildAttributesMap(o.tagExp,i,o.tagName)),this.addChild(t,c,i)}n=o.closeIndex+1}else if(a.substr(n+1,3)==="!--"){const o=Oe(a,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){const c=a.substring(n+4,o-2);s=this.saveTextToParentTag(s,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}n=o}else if(a.substr(n+1,2)==="!D"){const o=Yc(a,n);this.docTypeEntities=o.entities,n=o.i}else if(a.substr(n+1,2)==="!["){const o=Oe(a,"]]>",n,"CDATA is not closed.")-2,c=a.substring(n+9,o);s=this.saveTextToParentTag(s,t,i);let l=this.parseTextData(c,t.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):t.add(this.options.textNodeName,l),n=o+2}else{let o=qi(a,n,this.options.removeNSPrefix),c=o.tagName;const l=o.rawTagName;let h=o.tagExp,u=o.attrExpPresent,d=o.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&s&&t.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,t,i,!1));const f=t;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),c!==e.tagname&&(i+=i?"."+c:c),this.isItStopNode(this.options.stopNodes,i,c)){let E="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),h=c):h=h.substr(0,h.length-1),n=o.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)n=o.closeIndex;else{const T=this.readStopNodeData(a,l,d+1);if(!T)throw new Error(`Unexpected end of ${l}`);n=T.i,E=T.tagContent}const p=new hs(c);c!==h&&u&&(p[":@"]=this.buildAttributesMap(h,i,c)),E&&(E=this.parseTextData(E,c,i,!0,u,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),p.add(this.options.textNodeName,E),this.addChild(t,p,i)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),h=c):h=h.substr(0,h.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const E=new hs(c);c!==h&&u&&(E[":@"]=this.buildAttributesMap(h,i,c)),this.addChild(t,E,i),i=i.substr(0,i.lastIndexOf("."))}else{const E=new hs(c);this.tagsNodeStack.push(t),c!==h&&u&&(E[":@"]=this.buildAttributesMap(h,i,c)),this.addChild(t,E,i),t=E}s="",n=d}}else s+=a[n];return e.child};function Qc(a,e,t){const s=this.options.updateTag(e.tagname,t,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),a.addChild(e))}const Kc=function(a){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];a=a.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];a=a.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];a=a.replace(t.regex,t.val)}a=a.replace(this.ampEntity.regex,this.ampEntity.val)}return a};function qc(a,e,t,s){return a&&(s===void 0&&(s=Object.keys(e.child).length===0),a=this.parseTextData(a,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,s),a!==void 0&&a!==""&&e.add(this.options.textNodeName,a),a=""),a}function Jc(a,e,t){const s="*."+t;for(const i in a){const n=a[i];if(s===n||e===n)return!0}return!1}function tl(a,e,t=">"){let s,i="";for(let n=e;n",t,`${e} is not closed`);if(a.substring(t+2,n).trim()===e&&(i--,i===0))return{tagContent:a.substring(s,t),i:n};t=n}else if(a[t+1]==="?")t=Oe(a,"?>",t+1,"StopNode is not closed.");else if(a.substr(t+1,3)==="!--")t=Oe(a,"-->",t+3,"StopNode is not closed.");else if(a.substr(t+1,2)==="![")t=Oe(a,"]]>",t,"StopNode is not closed.")-2;else{const n=qi(a,t,">");n&&((n&&n.tagName)===e&&n.tagExp[n.tagExp.length-1]!=="/"&&i++,t=n.closeIndex)}}function Ji(a,e,t){if(e&&typeof a=="string"){const s=a.trim();return s==="true"?!0:s==="false"?!1:Vc(a,t)}else return zr.isExist(a)?a:""}var sl=Gc,Yr={};function il(a,e){return Vr(a,e)}function Vr(a,e,t){let s;const i={};for(let n=0;n0&&(i[e.textNodeName]=s):s!==void 0&&(i[e.textNodeName]=s),i}function nl(a){const e=Object.keys(a);for(let t=0;t0&&(t=fl),Gr(a,e,"",t)}function Gr(a,e,t,s){let i="",n=!1;for(let r=0;r`,n=!1;continue}else if(c===e.commentPropName){i+=s+``,n=!0;continue}else if(c[0]==="?"){const E=dr(o[":@"],e),p=c==="?xml"?"":s;let T=o[c][0][e.textNodeName];T=T.length!==0?" "+T:"",i+=p+`<${c}${T}${E}?>`,n=!0;continue}let h=s;h!==""&&(h+=e.indentBy);const u=dr(o[":@"],e),d=s+`<${c}${u}`,f=Gr(o[c],e,l,h);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?i+=d+">":i+=d+"/>":(!f||f.length===0)&&e.suppressEmptyNode?i+=d+"/>":f&&f.endsWith(">")?i+=d+`>${f}${s}`:(i+=d+">",f&&s!==""&&(f.includes("/>")||f.includes("`),n=!0}return i}function El(a){const e=Object.keys(a);for(let t=0;t0&&e.processEntities)for(let t=0;t","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Te(a){this.options=Object.assign({},Tl,a),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Al),this.processTextOrObjNode=gl,this.options.format?(this.indentate=_l,this.tagEndChar=`> -`,this.newLine=` -`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Te.prototype.build=function(a){return this.options.preserveOrder?Cl(a,this.options):(Array.isArray(a)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(a={[this.options.arrayNodeName]:a}),this.j2x(a,0).val)};Te.prototype.j2x=function(a,e){let t="",s="";for(let i in a)if(Object.prototype.hasOwnProperty.call(a,i))if(typeof a[i]>"u")this.isAttribute(i)&&(s+="");else if(a[i]===null)this.isAttribute(i)?s+="":i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(a[i]instanceof Date)s+=this.buildTextValNode(a[i],i,"",e);else if(typeof a[i]!="object"){const n=this.isAttribute(i);if(n)t+=this.buildAttrPairStr(n,""+a[i]);else if(i===this.options.textNodeName){let r=this.options.tagValueProcessor(i,""+a[i]);s+=this.replaceEntitiesValue(r)}else s+=this.buildTextValNode(a[i],i,"",e)}else if(Array.isArray(a[i])){const n=a[i].length;let r="",o="";for(let c=0;c"u"))if(l===null)i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){const h=this.j2x(l,e+1);r+=h.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(o+=h.attrStr)}else r+=this.processTextOrObjNode(l,i,e);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(i,l);h=this.replaceEntitiesValue(h),r+=h}else r+=this.buildTextValNode(l,i,"",e)}this.options.oneListGroup&&(r=this.buildObjectNode(r,i,o,e)),s+=r}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const n=Object.keys(a[i]),r=n.length;for(let o=0;o"+a+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&n.length===0?this.indentate(s)+``+this.newLine:this.indentate(s)+"<"+e+t+n+this.tagEndChar+a+this.indentate(s)+i}};Te.prototype.closeTag=function(a){let e="";return this.options.unpairedTags.indexOf(a)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(s)+``+this.newLine;if(e[0]==="?")return this.indentate(s)+"<"+e+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,a);return i=this.replaceEntitiesValue(i),i===""?this.indentate(s)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+t+">"+i+"0&&this.options.processEntities)for(let e=0;e`);let t=null;this.modifiedDate&&(t=`${this.modifiedDate.toISOString()}`);let s=null;return this.modifiedAuthor&&(s=`${this.modifiedAuthor}`),` - - ${this.date.toISOString()} - ${this.author} - ${this.comment} - ${e??""} - ${s??""} - ${t??""} - - `}}const oe=class oe{constructor(e){O(this,"guid",Fe.create());O(this,"title",oe.default.title);O(this,"creationDate",new Date);O(this,"creationAuthor","");O(this,"viewpoints",new Es);O(this,"relatedTopics",new Es);O(this,"comments",new He);O(this,"customData",{});O(this,"description");O(this,"serverAssignedId");O(this,"dueDate");O(this,"modifiedAuthor");O(this,"modifiedDate");O(this,"index");O(this,"_type",oe.default.type);O(this,"_status",oe.default.status);O(this,"_priority",oe.default.priority);O(this,"_stage",oe.default.priority);O(this,"_assignedTo",oe.default.assignedTo);O(this,"_labels",oe.default.labels);O(this,"_components");this._components=e;const t=e.get(bt);this.creationAuthor=t.config.author,this.relatedTopics.guard=s=>s!==this.guid}set type(e){const t=this._components.get(bt),{strict:s,types:i}=t.config;(!s||i.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(bt),{strict:s,statuses:i}=t.config;(!s||i.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(bt);if(e){const{strict:s,priorities:i}=t.config;if(!(s?i.has(e):!0))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(bt);if(e){const{strict:s,stages:i}=t.config;if(!(s?i.has(e):!0))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(bt);if(e){const{strict:s,users:i}=t.config;if(!(s?i.has(e):!0))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(bt),{strict:s,labels:i}=t.config;if(s){const n=new Set;for(const r of e)(!s||i.has(r))&&n.add(r);this._labels=n}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(bt).config.version}set(e){const t=e,s=this;for(const n in e){if(n==="guid")continue;const r=t[n];n in this&&(s[n]=r)}return this._components.get(bt).list.set(this.guid,this),this}createComment(e,t){const s=new tn(this._components,e);return s.viewpoint=t,s.topic=this,this.comments.set(s.guid,s),s}createLabelTags(e=this._managerVersion){let t="Labels";e==="2.1"&&(t="Labels"),e==="3"&&(t="Label");let s=[...this.labels].map(i=>`<${t}>${i}`).join(` -`);for(const i in this.customData){const n=this.customData[i];typeof n=="string"&&(s+=` -<${t}>${n}`)}return e==="2.1"?s:e==="3"?s.length!==0?` -${s} -`:"":s}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map(s=>s.serialize()).join(` -`);return e==="2.1"?t:e==="3"?t.length!==0?` -${t} -`:"":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";e==="2.1"&&(t="Viewpoints"),e==="3"&&(t="ViewPoint");const s=this._components.get(Jt),n=[...this.viewpoints].map(r=>s.list.get(r)).filter(r=>r).map(r=>`<${t} Guid="${r.guid}"> - ${r.guid}.bcfv - ${r.guid}.jpeg - - `).join(` -`);return e==="2.1"?n:e==="3"?n.length!==0?` -${n} -`:"":n}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map(s=>` - `).join(` -`);return e==="2.1"?t:e==="3"?t.length!==0?` -${t} -`:"":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let s=null;this.priority&&(s=`${this.priority}`);let i=null;this.index&&e==="2.1"&&(i=`${this.index}`);let n=null;this.modifiedDate&&(n=`${this.modifiedDate.toISOString()}`);let r=null;this.modifiedAuthor&&(r=`${this.modifiedAuthor}`);let o=null;this.dueDate&&(o=`${this.dueDate.toISOString()}`);let c=null;this.assignedTo&&(c=`${this.assignedTo}`);let l=null;this.description&&(l=`${this.description}`);let h=null;this.stage&&(h=`${this.stage}`);const u=this.createCommentTags(e),d=this.createViewpointTags(e),f=this.createLabelTags(e),E=this.createRelatedTopicTags(e);return` - - - - ${this.title} - ${this.creationDate.toISOString()} - ${this.creationAuthor} - ${s??""} - ${i??""} - ${n??""} - ${r??""} - ${o??""} - ${c??""} - ${l??""} - ${h??""} - ${f} - ${E} - ${e==="3"?u:""} - ${e==="3"?d:""} - - ${e==="2.1"?u:""} - ${e==="2.1"?d:""} - - `}};O(oe,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let ri=oe;const wl=(a,e)=>{if(e.trim()==="")return;const t=bt.xmlParser.parse(e).Extensions;if(!t)return;const{Priorities:s,TopicStatuses:i,TopicTypes:n,Users:r}=t;if(s&&s.Priority){const o=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const c of o)a.config.priorities.add(c)}if(i&&i.TopicStatus){const o=Array.isArray(i.TopicStatus)?i.TopicStatus:[i.TopicStatus];for(const c of o)a.config.statuses.add(c)}if(n&&n.TopicType){const o=Array.isArray(n.TopicType)?n.TopicType:[n.TopicType];for(const c of o)a.config.types.add(c)}if(r&&r.User){const o=Array.isArray(r.User)?r.User:[r.User];for(const c of o)a.config.users.add(c)}},ye=class ye extends kt{constructor(){super(...arguments);O(this,"enabled",!1);O(this,"config",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1});O(this,"list",new He);O(this,"onSetup",new st);O(this,"isSetup",!1);O(this,"onBCFImported",new st);O(this,"onDisposed",new st)}setup(t){this.isSetup||(this.config={...this.config,...t},this.isSetup=!0,this.enabled=!0,this.onSetup.trigger())}create(t){const s=new ri(this.components);return t&&(s.guid=t.guid??s.guid,s.set(t)),this.list.set(s.guid,s),s}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([s,i])=>i.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([s,i])=>i.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([s,i])=>i.priority).filter(s=>s);return new Set(t)}get usedStages(){const t=[...this.list].map(([s,i])=>i.stage).filter(s=>s);return new Set(t)}get usedUsers(){const t=[];for(const[s,i]of this.list){t.push(i.creationAuthor),i.assignedTo&&t.push(i.assignedTo),i.modifiedAuthor&&t.push(i.modifiedAuthor);for(const[n,r]of i.comments)t.push(r.author),r.modifiedAuthor&&t.push(r.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[s,i]of this.list)t.push(...i.labels);return new Set(t)}updateExtensions(){for(const[t,s]of this.list){for(const i of s.labels)this.config.labels.add(i);this.config.types.add(s.type),s.priority&&this.config.priorities.add(s.priority),s.stage&&this.config.stages.add(s.stage),this.config.statuses.add(s.status),this.config.users.add(s.creationAuthor),s.assignedTo&&this.config.users.add(s.assignedTo),s.modifiedAuthor&&this.config.users.add(s.modifiedAuthor);for(const[i,n]of s.comments)this.config.users.add(n.author),n.modifiedAuthor&&this.config.users.add(n.modifiedAuthor)}}updateViewpointReferences(){const t=this.components.get(Jt);for(const[s,i]of this.list)for(const n of i.viewpoints)t.list.has(n)||i.viewpoints.delete(n)}async export(t=this.list.values()){const s=new ar;s.file("bcf.version",` - - `),s.file("bcf.extensions",this.serializeExtensions());const n=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob(),r=this.components.get(Jt);for(const c of t){const l=s.folder(c.guid);l.file("markup.bcf",c.serialize());for(const h of c.viewpoints){const u=r.list.get(h);u&&(l.file(`${h}.jpeg`,n,{binary:!0}),l.file(`${h}.bcfv`,await u.serialize()))}}return await s.generateAsync({type:"blob"})}serializeExtensions(){const t=[...this.config.types].map(c=>`${c}`).join(` -`),s=[...this.config.statuses].map(c=>`${c}`).join(` -`),i=[...this.config.priorities].map(c=>`${c}`).join(` -`),n=[...this.config.labels].map(c=>`${c}`).join(` -`),r=[...this.config.stages].map(c=>`${c}`).join(` -`),o=[...this.config.users].map(c=>`${c}`).join(` -`);return` - - - ${t.length!==0?` -${t} -`:""} - ${s.length!==0?` -${s} -`:""} - ${i.length!==0?` -${i} -`:""} - ${n.length!==0?` -${n} -`:""} - ${r.length!==0?` -${r} -`:""} - ${o.length!==0?` -${o} -`:""} - - `}processMarkupComment(t){const{Guid:s,Date:i,Author:n,Comment:r,Viewpoint:o}=t;if(!(s&&i&&n&&(tn||o)))return null;const c=this.components.get(Jt),l=new tn(this.components,r??"");return l.guid=s,l.date=new Date(i),l.author=n,l.viewpoint=o!=null&&o.Guid?c.list.get(o.Guid):void 0,l.modifiedAuthor=t.ModifiedAuthor,l.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,l}getMarkupComments(t,s){var o;let i;if(s==="2.1"&&(i=t.Comment),s==="3"&&(i=(o=t.Topic.Comments)==null?void 0:o.Comment),!i)return[];i=Array.isArray(i)?i:[i];const n=i.map(c=>this.processMarkupComment(c)).filter(c=>c);return Array.isArray(n)?n:[n]}getMarkupLabels(t,s){var r;let i;return s==="2.1"&&(i=t.Topic.Labels),s==="3"&&(i=(r=t.Topic.Labels)==null?void 0:r.Label),i?Array.isArray(i)?i:[i]:[]}getMarkupViewpoints(t,s){var n;let i;return s==="2.1"&&(i=t.Viewpoints),s==="3"&&(i=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),i?(i=Array.isArray(i)?i:[i],i):[]}getMarkupRelatedTopics(t,s){var r;let i;return s==="2.1"&&(i=t.Topic.RelatedTopic),s==="3"&&(i=(r=t.Topic.RelatedTopics)==null?void 0:r.RelatedTopic),i?(Array.isArray(i)?i:[i]).map(o=>o.Guid):[]}async load(t,s){var _;const{fallbackVersionOnImport:i,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new ar;await o.loadAsync(t);const c=Object.values(o.files);let l=i;const h=c.find(R=>R.name.endsWith(".version"));if(h){const R=await h.async("string"),g=ye.xmlParser.parse(R).Version.VersionId;l=String(g)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const u=c.find(R=>R.name.endsWith(".extensions"));if(r&&u){const R=await u.async("string");wl(this,R)}const d=[],f=this.components.get(Jt),E=c.filter(R=>R.name.endsWith(".bcfv"));for(const R of E){const g=await R.async("string"),A=ye.xmlParser.parse(g).VisualizationInfo;if(!A){console.warn("Missing VisualizationInfo in Viewpoint");continue}const F={},{Guid:w,ClippingPlanes:L,Components:N,OrthogonalCamera:M,PerspectiveCamera:z}=A;if(w&&(F.guid=w),N){const{Selection:P,Visibility:I}=N;if(P&&P.Component){const $=Array.isArray(P.Component)?P.Component:[P.Component];F.selectionComponents=$.map(Y=>Y.IfcGuid).filter(Y=>Y)}if(I&&"DefaultVisibility"in I&&(F.defaultVisibility=I.DefaultVisibility),I&&I.Exceptions&&"Component"in I.Exceptions){const{Component:$}=I.Exceptions,Y=Array.isArray($)?$:[$];F.exceptionComponents=Y.map(q=>q.IfcGuid).filter(q=>q)}let v;l==="2.1"&&(v=N.ViewSetupHints),l==="3"&&(v=(_=N.Visibility)==null?void 0:_.ViewSetupHints),v&&("OpeningsVisible"in v&&(F.openingsVisible=v.OpeningsVisible),"SpacesVisible"in v&&(F.spacesVisible=v.SpacesVisible),"SpaceBoundariesVisible"in v&&(F.spaceBoundariesVisible=v.SpaceBoundariesVisible))}if(M||z){const P=A.PerspectiveCamera??A.OrthogonalCamera,{CameraViewPoint:I,CameraDirection:v}=P,$=new W(Number(I.X),Number(I.Z),Number(-I.Y)),Y=new W(Number(v.X),Number(v.Z),Number(-v.Y)),q={position:{x:$.x,y:$.y,z:$.z},direction:{x:Y.x,y:Y.y,z:Y.z},aspectRatio:"AspectRatio"in P?P.AspectRatio:1};"ViewToWorldScale"in P&&(F.camera={...q,viewToWorldScale:P.ViewToWorldScale}),"FieldOfView"in P&&(F.camera={...q,fov:P.FieldOfView})}const y=new Xr(this.components,s,{data:F,setCamera:!1});if(N){const{Coloring:P}=N;if(P&&P.Color){const I=Array.isArray(P.Color)?P.Color:[P.Color];for(const v of I){const{Color:$,Component:Y}=v,G=(Array.isArray(Y)?Y:[Y]).map(it=>it.IfcGuid);y.componentColors.set($,G)}}}if(d.push(y),L){const P=this.components.get(Ki),I=Array.isArray(L.ClippingPlane)?L.ClippingPlane:[L.ClippingPlane];for(const v of I){const{Location:$,Direction:Y}=v;if(!($&&Y))continue;const q=new W($.X,$.Z,-$.Y),G=new W(Y.X,-Y.Z,Y.Y),it=P.createFromNormalAndCoplanarPoint(s,G,q);it.visible=!1,it.enabled=!1,y.clippingPlanes.add(it)}}}const p={},T=[],m=c.filter(R=>R.name.endsWith(".bcf"));for(const R of m){const g=await R.async("string"),A=ye.xmlParser.parse(g).Markup,F=A.Topic,{Guid:w,Type:L,Status:N,Title:M,CreationDate:z,CreationAuthor:y}=F;if(n&&!(w&&L&&N&&M&&z&&y))continue;const P=new ri(this.components);P.guid=w??P.guid;const I=this.getMarkupRelatedTopics(A,l);p[P.guid]=new Set(I),P.type=L??P.type,P.status=N??P.status,P.title=M??P.title,P.creationDate=z?new Date(z):P.creationDate,P.creationAuthor=y??P.creationAuthor,P.serverAssignedId=F.ServerAssignedId,P.priority=F.Priority,P.index=F.Index,P.modifiedDate=F.ModifiedDate?new Date(F.ModifiedDate):void 0,P.modifiedAuthor=F.ModifiedAuthor,P.dueDate=F.DueDate?new Date(F.DueDate):void 0,P.assignedTo=F.AssignedTo,P.description=F.Description,P.stage=F.Stage;const v=this.getMarkupLabels(A,l);for(const q of v)P.labels.add(q);const $=this.getMarkupComments(A,l);for(const q of $)P.comments.set(q.guid,q);const Y=this.getMarkupViewpoints(A,l);for(const q of Y){if(!(q&&q.Guid))continue;const G=f.list.get(q.Guid);G&&P.viewpoints.add(G.guid)}this.list.set(P.guid,P),T.push(P)}for(const R in p){const g=this.list.get(R);if(!g)continue;const A=p[R];for(const F of A)g.relatedTopics.add(F)}return this.onBCFImported.trigger(T),{viewpoints:d,topics:T}}};O(ye,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),O(ye,"xmlParser",new Sl.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let bt=ye;const Kt=class Kt extends kt{constructor(t){super(t);O(this,"enabled",!0);O(this,"onDisposed",new st);O(this,"_absoluteMin");O(this,"_absoluteMax");O(this,"_meshes",[]);this.components.add(Kt.uuid,this),this._absoluteMin=Kt.newBound(!0),this._absoluteMax=Kt.newBound(!1)}static getDimensions(t){const{min:s,max:i}=t,n=Math.abs(i.x-s.x),r=Math.abs(i.y-s.y),o=Math.abs(i.z-s.z),c=new W;return c.subVectors(i,s).divideScalar(2).add(s),{width:n,height:r,depth:o,center:c}}static newBound(t){const s=t?1:-1;return new W(s*Number.MAX_VALUE,s*Number.MAX_VALUE,s*Number.MAX_VALUE)}static getBounds(t,s,i){const n=i||this.newBound(!1),r=s||this.newBound(!0);for(const o of t)o.xn.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new Nt(s,i)}dispose(){const t=this.components.get(Ge);for(const s of this._meshes)t.destroy(s);this._meshes=[],this.onDisposed.trigger(Kt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),s=this._absoluteMax.clone();return new Nt(t,s)}getSphere(){const t=this._absoluteMin.clone(),s=this._absoluteMax.clone(),i=Math.abs((s.x-t.x)/2),n=Math.abs((s.y-t.y)/2),r=Math.abs((s.z-t.z)/2),o=new W(t.x+i,t.y+n,t.z+r),c=o.distanceTo(t);return new Ei(o,c)}getMesh(){const t=new Nt(this._absoluteMin,this._absoluteMax),s=Kt.getDimensions(t),{width:i,height:n,depth:r,center:o}=s,c=new Lt(i,n,r),l=new et(c);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=Kt.newBound(!0),this._absoluteMax=Kt.newBound(!1)}add(t){for(const s of t.items)this.addMesh(s.mesh)}addMesh(t,s){if(!t.geometry.index)return;const i=Kt.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new Ft,o=t instanceof ei,c=new Set;if(t instanceof fo){s||(s=t.fragment.ids);for(const l of s){const h=t.fragment.getInstancesIDs(l);if(h)for(const u of h)c.add(u)}}else c.add(0);for(const l of c){const h=i.min.clone(),u=i.max.clone();o&&(t.getMatrixAt(l,r),h.applyMatrix4(r),u.applyMatrix4(r)),h.applyMatrix4(n),u.applyMatrix4(n),h.xthis._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),u.x>this._absoluteMax.x&&(this._absoluteMax.x=u.x),u.y>this._absoluteMax.y&&(this._absoluteMax.y=u.y),u.z>this._absoluteMax.z&&(this._absoluteMax.z=u.z),u.xo.x&&(o.x=u),d>o.y&&(o.y=d),f>o.z&&(o.z=f)}return new Nt(r,o)}};O(Kt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let en=Kt;const Nl=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),ui=class ui extends kt{constructor(t){super(t);O(this,"enabled",!0);t.add(ui.uuid,this)}async export(t,s,i=!1,n=!0){const r={},o=new Set(t.GetIfcEntityList(s)),c=new Set([wr,Nr,br,Pr,Os]);for(const l of c)o.add(l);for(const l of o){if(Nl.has(l))continue;const h=c.has(l)&&n,u=t.GetLineIDsWithType(s,l);for(const d of u){const f=t.GetLine(0,d,h,i);r[f.expressID]=f}}return r}};O(ui,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let sn=ui;const Wr={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class ms{static async getUnits(e){var r,o,c;const{IFCUNITASSIGNMENT:t}=mo,s=await e.getAllPropertiesOfType(t);if(!s)return 1;const i=Object.keys(s),n=s[parseInt(i[0],10)];for(const l of n.Units){if(l.value===void 0||l.value===null)continue;const h=await e.getProperties(l.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let d=1,f=1;return h.Name.value==="METRE"&&(f=1),h.Name.value==="FOOT"&&(f=.3048),((r=h.Prefix)==null?void 0:r.value)==="MILLI"?d=.001:((o=h.Prefix)==null?void 0:o.value)==="CENTI"?d=.01:((c=h.Prefix)==null?void 0:c.value)==="DECI"&&(d=.1),f*d}return 1}static async findItemByGuid(e,t){var i;const s=e.getAllPropertiesIDs();for(const n of s){const r=await e.getProperties(n);if(r&&((i=r.GlobalId)==null?void 0:i.value)===t)return r}return null}static async getRelationMap(e,t,s){var c;const n=s??(async()=>{}),r={},o=e.getAllPropertiesIDs();for(const l of o){const h=await e.getProperties(l);if(!h)continue;const u=h.type===t,d=Object.keys(h).find(m=>m.startsWith("Relating")),f=Object.keys(h).find(m=>m.startsWith("Related"));if(!(u&&d&&f))continue;const E=await e.getProperties((c=h[d])==null?void 0:c.value),p=h[f];if(!E||!p||!(p&&Array.isArray(p)))continue;const T=p.map(m=>m.value);await n(E.expressID,T),r[E.expressID]=T}return r}static async getQsetQuantities(e,t,s){const n=s??(()=>{}),r=await e.getProperties(t);return!r||r.type!==po?null:(r.Quantities??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetProps(e,t,s){const n=s??(()=>{}),r=await e.getProperties(t);return!r||r.type!==Eo?null:(r.HasProperties??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetRel(e,t){var o;if(!await e.getProperties(t))return null;const i=await e.getAllPropertiesOfType(hn);if(!i)return null;const n=Object.values(i);let r=null;for(const c of n)((o=c.RelatingPropertyDefinition)==null?void 0:o.value)===t&&(r=c.expressID);return r}static async getQsetRel(e,t){return ms.getPsetRel(e,t)}static async getEntityName(e,t){var r;const s=await e.getProperties(t);if(!s)return{key:null,name:null};const i=Object.keys(s).find(o=>o.endsWith("Name"))??null,n=i?(r=s[i])==null?void 0:r.value:null;return{key:i,name:n}}static async getQuantityValue(e,t){const s=await e.getProperties(t);if(!s)return{key:null,value:null};const i=Object.keys(s).find(r=>r.endsWith("Value"))??null;let n;return i===null||s[i]===void 0||s[i]===null?n=null:n=s[i].value,{key:i,value:n}}static isRel(e){return Wr[e].startsWith("IFCREL")}static async attributeExists(e,t,s){const i=await e.getProperties(t);return i?Object.keys(i).includes(s):!1}static async groupEntitiesByType(e,t){var i;const s=new Map;for(const n of t){const r=await e.getProperties(n);if(!r)continue;const o=r.type;s.get(o)||s.set(o,new Set),(i=s.get(o))==null||i.add(n)}return s}}class bl{constructor(){O(this,"factor",1);O(this,"complement",1)}apply(e){const s=this.getScaleMatrix().multiply(e);e.copy(s)}setUp(e){var n,r,o;this.factor=1;const t=this.getLengthUnits(e);if(!t)return;const s=t==null,i=t.Name===void 0||t.Name===null;s||i||(t.Name.value==="FOOT"&&(this.factor=.3048),((n=t.Prefix)==null?void 0:n.value)==="MILLI"?this.complement=.001:((r=t.Prefix)==null?void 0:r.value)==="CENTI"?this.complement=.01:((o=t.Prefix)==null?void 0:o.value)==="DECI"&&(this.complement=.01))}getLengthUnits(e){try{const s=e.GetLineIDsWithType(0,Io).get(0),i=e.GetLine(0,s);for(const n of i.Units){if(!n||n.value===null||n.value===void 0)continue;const r=e.GetLine(0,n.value);if(r.UnitType&&r.UnitType.value==="LENGTHUNIT")return r}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new Ft().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Pl{constructor(){O(this,"itemsByFloor",{});O(this,"_units",new bl)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,un),s=new Set,i=e.GetLineIDsWithType(0,Os);for(let l=0;l0&&!o.has(r))continue;if(this.settings.excludedCategories.has(r))continue;const c=this.webIfc.GetLineIDsWithType(0,r),l=c.size();for(let h=0;h{this.getMesh(r,s)});for(const r of this._visitedFragments){const{index:o,fragment:c}=r[1];s.keyFragments.set(o,c.id)}for(const r of s.items){const o=this._fragmentInstances.get(r.id);if(!o)throw new Error("Fragment not found!");const c=[];for(const[l,h]of o)c.push(h);r.add(c)}const n=this.webIfc.GetCoordinationMatrix(0);return s.coordinationMatrix.fromArray(n),s.civilData=this._civil.read(this.webIfc),s}getMesh(t,s){const i=t.geometries.size(),n=t.expressID;for(let r=0;r{const{groupID:s,fragmentIDs:i}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(s))delete r[s],Object.values(r).length===0&&delete this.list[n];else for(const c of o){const l=r[c];for(const h of i)delete l.map[h];Object.values(l).length===0&&delete r[c]}}});t.add(di.uuid,this),t.get(Tt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(Tt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const s in this.list){const i=this.list[s];for(const n in i){const r=i[n];delete r.map[t]}}}find(t){const s=this.components.get(Tt);if(!t){const o={};for(const[c,l]of s.list)o[c]=new Set(l.ids);return o}const i=Object.keys(t).length,n={};for(const o in t){const c=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of c){const h=this.list[o][l];if(h)for(const u in h.map){n[u]||(n[u]=new Map);for(const d of h.map[u]){const f=n[u].get(d);f===void 0?n[u].set(d,1):n[u].set(d,f+1)}}}}const r={};for(const o in n){const c=n[o];for(const[l,h]of c){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(t,s){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={map:{},id:null,name:t});const n=i[t];for(const[r,o]of s.data){const c=o[0];for(const l of c){const h=s.keyFragments.get(l);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(r))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const s=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const r of i){const o=await t.getProperties(r);if(!o)continue;const c=String((n=o.PredefinedType)==null?void 0:n.value).toUpperCase();s[c]||(s[c]={map:{},id:null,name:c});const l=s[c];for(const[h,u]of t.data){const d=u[0];for(const f of d){const E=t.keyFragments.get(f);if(!E)throw new Error("Fragment ID not found!");l.map[E]||(l.map[E]=new Set),l.map[E].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[s,i]of t.data){const r=i[1][1],o=Wr[r];this.saveItem(t,"entities",o,s)}}async byIfcRel(t,s,i){ms.isRel(s)&&await ms.getRelationMap(t,s,async(n,r)=>{const{name:o}=await ms.getEntityName(t,n);for(const c of r)this.saveItem(t,i,o??"NO REL NAME",c)})}async bySpatialStructure(t,s={}){var l,h;const i=this.components.get(ni),n=i.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const r="spatialStructures",c=s.useProperties===void 0||s.useProperties;for(const[u]of n){if(s.isolate){const p=t.data.get(u);if(!p)continue;const T=p[1][1];if(T===void 0||!s.isolate.has(T))continue}const d=i.getEntityRelations(t,u,"Decomposes");if(d)for(const p of d){let T=p.toString();if(c){const m=await t.getProperties(p);if(!m)continue;T=(l=m.Name)==null?void 0:l.value}this.saveItem(t,r,T,u,p)}const f=i.getEntityRelations(t,u,"ContainsElements");if(!f)continue;let E=u.toString();if(c){const p=await t.getProperties(u);if(!p)continue;E=(h=p.Name)==null?void 0:h.value}for(const p of f){this.saveItem(t,r,E,p,u);const T=i.getEntityRelations(t,Number(p),"IsDecomposedBy");if(T)for(const m of T)this.saveItem(t,r,E,m,u)}}}setColor(t,s,i=!1){const n=this.components.get(Tt);for(const r in t){const o=n.list.get(r);if(!o)continue;const c=t[r];o.setColor(s,c,i)}}resetColor(t){const s=this.components.get(Tt);for(const i in t){const n=s.list.get(i);if(!n)continue;const r=t[i];n.resetColor(r)}}saveItem(t,s,i,n,r=null){this.list[s]||(this.list[s]={});const o=t.data.get(n);if(o)for(const c of o[0]){const l=t.keyFragments.get(c);if(l){const h=this.list[s];h[i]||(h[i]={map:{},id:r,name:i}),h[i].map[l]||(h[i].map[l]=new Set),h[i].map[l].add(n)}}}};O(di,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let oi=di;const fi=class fi extends kt{constructor(t){super(t);O(this,"enabled",!0);this.components.add(fi.uuid,this)}set(t,s){const i=this.components.get(Tt);if(!s){for(const[n,r]of i.list)r&&(r.setVisibility(t),this.updateCulledVisibility(r));return}for(const n in s){const r=s[n],o=i.list.get(n);o&&(o.setVisibility(t,r),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const s=this.components.get(Qi);for(const[i,n]of s.list){const r=n.colorMeshes.get(t.id);r&&(r.count=t.mesh.count)}}};O(fi,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let nn=fi;class Xr{constructor(e,t,s){O(this,"title");O(this,"guid",Fe.create());O(this,"clippingPlanes",new Es);O(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});O(this,"exceptionComponents",new Es);O(this,"selectionComponents",new Es);O(this,"componentColors",new He);O(this,"spacesVisible",!1);O(this,"spaceBoundariesVisible",!1);O(this,"openingsVisible",!1);O(this,"defaultVisibility",!0);O(this,"_components");O(this,"world");const i={setCamera:!0,...s},{data:n,setCamera:r}=i;this._components=e,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(Tt),t={};for(const[s,i]of e.groups){s in t||(t[s]=new Set);for(const n of this.selectionComponents){const r=i.globalToExpressIDs.get(n);r&&t[s].add(r)}}return t}get _exceptionModelIdMap(){const e=this._components.get(Tt),t={};for(const[s,i]of e.groups){s in t||(t[s]=new Set);for(const n of this.exceptionComponents){const r=i.globalToExpressIDs.get(n);r&&t[s].add(r)}}return t}get selection(){return this._components.get(Tt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(Tt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(Tt),{position:t}=this.camera,{x:s,y:i,z:n}=t,r=new W(s,i,n);return e.applyBaseCoordinateSystem(r,new Ft),r}get direction(){const{direction:e}=this.camera,{x:t,y:s,z:i}=e;return new W(t,s,i)}get _managerVersion(){return this._components.get(bt).config.version}get topics(){return[...this._components.get(bt).list.values()].filter(i=>i.viewpoints.has(this.guid))}async addComponentsFromMap(e){var i;const t=this._components.get(Tt);for(const n in e){const r=t.list.get(n);if(!(r&&r.group))continue;const o=r.group,c=e[n];for(const l of c){const h=await o.getProperties(l);if(!h)continue;const u=(i=h.GlobalId)==null?void 0:i.value;u&&this.selectionComponents.add(u)}}this._components.get(Jt).list.set(this.guid,this)}set(e){const t=e,s=this;for(const n in e){if(n==="guid")continue;const r=t[n];n in this&&(s[n]=r)}return this._components.get(Jt).list.set(this.guid,this),this}async go(e=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof hc&&t.projection.set(this.projection);const s=this.position,i=this.direction;let n={x:s.x+i.x*80,y:s.y+i.y*80,z:s.z+i.z*80};const r=this.selection;if(Object.keys(r).length===0){const h=this._components.get(ys).get(this.world).castRayFromVector(s,this.direction);h&&(n=h.point)}else{const c=this._components.get(en);c.reset(),c.addFragmentIdMap(r),n=c.getSphere().center,c.reset()}const o=this._components.get(nn);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(s.x,s.y,s.z,n.x,n.y,n.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new W;e.controls.getPosition(s);const i=e.three,n=new W(0,0,-1).applyEuler(i.rotation),{width:r,height:o}=t.getSize();let c=r/o;Number.isNaN(c)&&(c=1);const l=this._components.get(Tt);s.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:c,position:{x:s.x,y:s.y,z:s.z},direction:{x:n.x,y:n.y,z:n.z}};i instanceof pr?this.camera={...h,fov:i.fov}:i instanceof on&&(this.camera={...h,viewToWorldScale:i.top-i.bottom}),this._components.get(Jt).list.set(this.guid,this)}colorize(){const e=this._components.get(Jt),t=this._components.get(Tt),s=this._components.get(oi);for(const[i,n]of this.componentColors){const r=t.guidToFragmentIdMap(n),o=new cn(`#${i}`);s.setColor(r,o,e.config.overwriteColors)}}resetColors(){const e=this._components.get(Tt),t=this._components.get(oi);for(const[s,i]of this.componentColors){const n=e.guidToFragmentIdMap(i);t.resetColor(n)}}async createComponentTags(e){var n,r;const t=this._components.get(Tt),s=this._components.get(bt);let i="";if(s.config.includeSelectionTag){const o=e==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const c in o){const l=t.groups.get(c);if(!l)continue;const h=o[c];for(const u of h){const d=await l.getProperties(u);if(!d)continue;const f=(n=d.GlobalId)==null?void 0:n.value;if(!f)continue;const E=(r=d.Tag)==null?void 0:r.value;let p=null;E&&(p=`AuthoringToolId="${E}"`),i+=` -`}}}else i=[...this.selectionComponents].map(o=>``).join(` -`);return i}async serialize(e=this._managerVersion){const t=this._components.get(Tt),s=this.position;s.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const i=this.direction;i.normalize();const n=new Ft().makeRotationX(Math.PI/2),r=i.clone().applyMatrix4(n);r.normalize();const o=` - ${s.x} - ${-s.z} - ${s.y} - `,c=` - ${i.x} - ${-i.z} - ${i.y} - `,l=` - ${r.x} - ${-r.z} - ${r.y} - `,h=`${this.camera.aspectRatio}`;let u="";"viewToWorld"in this.camera?u=` - ${o} - ${c} - ${l} - ${h} - ${this.camera.viewToWorld} - `:"fov"in this.camera&&(u=` - ${o} - ${c} - ${l} - ${h} - ${this.camera.fov} - `);const d=``,f=(await this.createComponentTags("selection")).trim(),E=(await this.createComponentTags("exception")).trim();return` - - - ${e==="2.1"?d:""} - ${f.length!==0?`${f}`:""} - - ${e==="3"?d:""} - ${E.length!==0?`${E}`:""} - - - ${u} - `}}const pi=class pi extends kt{constructor(t){super(t);O(this,"enabled",!0);O(this,"list",new He);O(this,"isSetup",!1);O(this,"onSetup",new st);O(this,"config",{overwriteColors:!1});O(this,"onDisposed",new st);t.add(pi.uuid,this)}create(t,s){const i=new Xr(this.components,t,{data:s});return s||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};O(pi,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Jt=pi;export{Ba as B,kt as C,Ge as D,st as E,Tt as F,fr as I,mn as S,Fe as U,Jt as V,ji as W,$i as a,ni as b,bt as c,ms as d}; diff --git a/examples/assets/index-BPTct15x.js b/examples/assets/index-CO3KVvRB.js similarity index 52% rename from examples/assets/index-BPTct15x.js rename to examples/assets/index-CO3KVvRB.js index a6a4cc50a..722cb4647 100644 --- a/examples/assets/index-BPTct15x.js +++ b/examples/assets/index-CO3KVvRB.js @@ -1,46 +1,46 @@ -import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m as Uo,P as qr,R as Yr,l as Xr,X as di}from"./index-Cbq44wZW.js";import{V as vn,c as Si,G as zn,F as Jr,L as Qr,d as Fn,e as Zr,f as Kr,P as ti,g as ye,D as ta,A as ea,C as ze,O as ia,h as na,I as oa,R as sa,i as Vo,j as Wo,k as ra,l as Go,m as aa,n as la,o as qo,p as Yo,q as ca}from"./web-ifc-api-CgBULNZm.js";import{X as da,r as ua,$ as L}from"./index-DconH7kp.js";var ha=Object.defineProperty,pa=(e,t,i)=>t in e?ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,It=(e,t,i)=>(pa(e,typeof t!="symbol"?t+"":t,i),i);const Jt=Math.min,ht=Math.max,ui=Math.round,$t=e=>({x:e,y:e}),ma={left:"right",right:"left",bottom:"top",top:"bottom"},ba={start:"end",end:"start"};function Hn(e,t,i){return ht(e,Jt(t,i))}function Fe(e,t){return typeof e=="function"?e(t):e}function mt(e){return e.split("-")[0]}function ki(e){return e.split("-")[1]}function Xo(e){return e==="x"?"y":"x"}function Jo(e){return e==="y"?"height":"width"}function Rt(e){return["top","bottom"].includes(mt(e))?"y":"x"}function Qo(e){return Xo(Rt(e))}function fa(e,t,i){i===void 0&&(i=!1);const n=ki(e),o=Qo(e),s=Jo(o);let r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=hi(r)),[r,hi(r)]}function ga(e){const t=hi(e);return[Ki(e),t,Ki(t)]}function Ki(e){return e.replace(/start|end/g,t=>ba[t])}function va(e,t,i){const n=["left","right"],o=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(e){case"top":case"bottom":return i?t?o:n:t?n:o;case"left":case"right":return t?s:r;default:return[]}}function ya(e,t,i,n){const o=ki(e);let s=va(mt(e),i==="start",n);return o&&(s=s.map(r=>r+"-"+o),t&&(s=s.concat(s.map(Ki)))),s}function hi(e){return e.replace(/left|right|bottom|top/g,t=>ma[t])}function _a(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zo(e){return typeof e!="number"?_a(e):{top:e,right:e,bottom:e,left:e}}function Qt(e){const{x:t,y:i,width:n,height:o}=e;return{width:n,height:o,top:i,left:t,right:t+n,bottom:i+o,x:t,y:i}}function Bn(e,t,i){let{reference:n,floating:o}=e;const s=Rt(t),r=Qo(t),a=Jo(r),l=mt(t),d=s==="y",u=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2,h=n[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:n.y-o.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:c};break;case"left":p={x:n.x-o.width,y:c};break;default:p={x:n.x,y:n.y}}switch(ki(t)){case"start":p[r]-=h*(i&&d?-1:1);break;case"end":p[r]+=h*(i&&d?-1:1);break}return p}const xa=async(e,t,i)=>{const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,a=s.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(t));let d=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:c}=Bn(d,n,l),h=n,p={},g=0;for(let _=0;_j<=0)){var k,U;const j=(((k=s.flip)==null?void 0:k.index)||0)+1,ct=A[j];if(ct)return{data:{index:j,overflows:S},reset:{placement:ct}};let it=(U=S.filter(nt=>nt.overflows[0]<=0).sort((nt,q)=>nt.overflows[1]-q.overflows[1])[0])==null?void 0:U.placement;if(!it)switch(p){case"bestFit":{var vt;const nt=(vt=S.filter(q=>{if(C){const ot=Rt(q.placement);return ot===y||ot==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ot=>ot>0).reduce((ot,ge)=>ot+ge,0)]).sort((q,ot)=>q[1]-ot[1])[0])==null?void 0:vt[0];nt&&(it=nt);break}case"initialPlacement":it=a;break}if(o!==it)return{reset:{placement:it}}}return{}}}};function ts(e){const t=Jt(...e.map(s=>s.left)),i=Jt(...e.map(s=>s.top)),n=ht(...e.map(s=>s.right)),o=ht(...e.map(s=>s.bottom));return{x:t,y:i,width:n-t,height:o-i}}function $a(e){const t=e.slice().sort((o,s)=>o.y-s.y),i=[];let n=null;for(let o=0;on.height/2?i.push([s]):i[i.length-1].push(s),n=s}return i.map(o=>Qt(ts(o)))}const Ca=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:i,elements:n,rects:o,platform:s,strategy:r}=t,{padding:a=2,x:l,y:d}=Fe(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),c=$a(u),h=Qt(ts(u)),p=Zo(a);function g(){if(c.length===2&&c[0].left>c[1].right&&l!=null&&d!=null)return c.find(v=>l>v.left-p.left&&lv.top-p.top&&d=2){if(Rt(i)==="y"){const S=c[0],k=c[c.length-1],U=mt(i)==="top",vt=S.top,j=k.bottom,ct=U?S.left:k.left,it=U?S.right:k.right,nt=it-ct,q=j-vt;return{top:vt,bottom:j,left:ct,right:it,width:nt,height:q,x:ct,y:vt}}const v=mt(i)==="left",f=ht(...c.map(S=>S.right)),y=Jt(...c.map(S=>S.left)),x=c.filter(S=>v?S.left===y:S.right===f),w=x[0].top,E=x[x.length-1].bottom,C=y,A=f,N=A-C,$=E-w;return{top:w,bottom:E,left:C,right:A,width:N,height:$,x:C,y:w}}return h}const _=await s.getElementRects({reference:{getBoundingClientRect:g},floating:n.floating,strategy:r});return o.reference.x!==_.reference.x||o.reference.y!==_.reference.y||o.reference.width!==_.reference.width||o.reference.height!==_.reference.height?{reset:{rects:_}}:{}}}};async function Ea(e,t){const{placement:i,platform:n,elements:o}=e,s=await(n.isRTL==null?void 0:n.isRTL(o.floating)),r=mt(i),a=ki(i),l=Rt(i)==="y",d=["left","top"].includes(r)?-1:1,u=s&&l?-1:1,c=Fe(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...c};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*d}:{x:h*d,y:p*u}}const es=function(e){return{name:"offset",options:e,async fn(t){var i,n;const{x:o,y:s,placement:r,middlewareData:a}=t,l=await Ea(t,e);return r===((i=a.offset)==null?void 0:i.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:r}}}}},Aa=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:i,y:n,placement:o}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:v=>{let{x:f,y}=v;return{x:f,y}}},...l}=Fe(e,t),d={x:i,y:n},u=await Ko(t,l),c=Rt(mt(o)),h=Xo(c);let p=d[h],g=d[c];if(s){const v=h==="y"?"top":"left",f=h==="y"?"bottom":"right",y=p+u[v],x=p-u[f];p=Hn(y,p,x)}if(r){const v=c==="y"?"top":"left",f=c==="y"?"bottom":"right",y=g+u[v],x=g-u[f];g=Hn(y,g,x)}const _=a.fn({...t,[h]:p,[c]:g});return{..._,data:{x:_.x-i,y:_.y-n}}}}};function Ct(e){return is(e)?(e.nodeName||"").toLowerCase():"#document"}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(is(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function is(e){return e instanceof Node||e instanceof V(e).Node}function st(e){return e instanceof Element||e instanceof V(e).Element}function rt(e){return e instanceof HTMLElement||e instanceof V(e).HTMLElement}function Un(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function He(e){const{overflow:t,overflowX:i,overflowY:n,display:o}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function Sa(e){return["table","td","th"].includes(Ct(e))}function ka(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function yn(e){const t=_n(),i=st(e)?X(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(i.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(i.contain||"").includes(n))}function Oa(e){let t=Zt(e);for(;rt(t)&&!Oi(t);){if(yn(t))return t;if(ka(t))return null;t=Zt(t)}return null}function _n(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Oi(e){return["html","body","#document"].includes(Ct(e))}function X(e){return V(e).getComputedStyle(e)}function Ti(e){return st(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zt(e){if(Ct(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Un(e)&&e.host||At(e);return Un(t)?t.host:t}function ns(e){const t=Zt(e);return Oi(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&He(t)?t:ns(t)}function tn(e,t,i){var n;t===void 0&&(t=[]),i===void 0&&(i=!0);const o=ns(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),r=V(o);if(s){const a=Ta(r);return t.concat(r,r.visualViewport||[],He(o)?o:[],a&&i?tn(a):[])}return t.concat(o,tn(o,[],i))}function Ta(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function os(e){const t=X(e);let i=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:i,r=o?e.offsetHeight:n,a=ui(i)!==s||ui(n)!==r;return a&&(i=s,n=r),{width:i,height:n,$:a}}function ss(e){return st(e)?e:e.contextElement}function Yt(e){const t=ss(e);if(!rt(t))return $t(1);const i=t.getBoundingClientRect(),{width:n,height:o,$:s}=os(t);let r=(s?ui(i.width):i.width)/n,a=(s?ui(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const Ia=$t(0);function rs(e){const t=V(e);return!_n()||!t.visualViewport?Ia:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Na(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==V(e)?!1:t}function ke(e,t,i,n){t===void 0&&(t=!1),i===void 0&&(i=!1);const o=e.getBoundingClientRect(),s=ss(e);let r=$t(1);t&&(n?st(n)&&(r=Yt(n)):r=Yt(e));const a=Na(s,i,n)?rs(s):$t(0);let l=(o.left+a.x)/r.x,d=(o.top+a.y)/r.y,u=o.width/r.x,c=o.height/r.y;if(s){const h=V(s),p=n&&st(n)?V(n):n;let g=h,_=g.frameElement;for(;_&&n&&p!==g;){const v=Yt(_),f=_.getBoundingClientRect(),y=X(_),x=f.left+(_.clientLeft+parseFloat(y.paddingLeft))*v.x,w=f.top+(_.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,d*=v.y,u*=v.x,c*=v.y,l+=x,d+=w,g=V(_),_=g.frameElement}}return Qt({width:u,height:c,x:l,y:d})}const Pa=[":popover-open",":modal"];function as(e){return Pa.some(t=>{try{return e.matches(t)}catch{return!1}})}function Ma(e){let{elements:t,rect:i,offsetParent:n,strategy:o}=e;const s=o==="fixed",r=At(n),a=t?as(t.floating):!1;if(n===r||a&&s)return i;let l={scrollLeft:0,scrollTop:0},d=$t(1);const u=$t(0),c=rt(n);if((c||!c&&!s)&&((Ct(n)!=="body"||He(r))&&(l=Ti(n)),rt(n))){const h=ke(n);d=Yt(n),u.x=h.x+n.clientLeft,u.y=h.y+n.clientTop}return{width:i.width*d.x,height:i.height*d.y,x:i.x*d.x-l.scrollLeft*d.x+u.x,y:i.y*d.y-l.scrollTop*d.y+u.y}}function La(e){return Array.from(e.getClientRects())}function ls(e){return ke(At(e)).left+Ti(e).scrollLeft}function ja(e){const t=At(e),i=Ti(e),n=e.ownerDocument.body,o=ht(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=ht(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-i.scrollLeft+ls(e);const a=-i.scrollTop;return X(n).direction==="rtl"&&(r+=ht(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:a}}function Ra(e,t){const i=V(e),n=At(e),o=i.visualViewport;let s=n.clientWidth,r=n.clientHeight,a=0,l=0;if(o){s=o.width,r=o.height;const d=_n();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:r,x:a,y:l}}function Da(e,t){const i=ke(e,!0,t==="fixed"),n=i.top+e.clientTop,o=i.left+e.clientLeft,s=rt(e)?Yt(e):$t(1),r=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,d=n*s.y;return{width:r,height:a,x:l,y:d}}function Vn(e,t,i){let n;if(t==="viewport")n=Ra(e,i);else if(t==="document")n=ja(At(e));else if(st(t))n=Da(t,i);else{const o=rs(e);n={...t,x:t.x-o.x,y:t.y-o.y}}return Qt(n)}function cs(e,t){const i=Zt(e);return i===t||!st(i)||Oi(i)?!1:X(i).position==="fixed"||cs(i,t)}function za(e,t){const i=t.get(e);if(i)return i;let n=tn(e,[],!1).filter(a=>st(a)&&Ct(a)!=="body"),o=null;const s=X(e).position==="fixed";let r=s?Zt(e):e;for(;st(r)&&!Oi(r);){const a=X(r),l=yn(r);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&o&&["absolute","fixed"].includes(o.position)||He(r)&&!l&&cs(e,r))?n=n.filter(d=>d!==r):o=a,r=Zt(r)}return t.set(e,n),n}function Fa(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e;const s=[...i==="clippingAncestors"?za(t,this._c):[].concat(i),n],r=s[0],a=s.reduce((l,d)=>{const u=Vn(t,d,o);return l.top=ht(u.top,l.top),l.right=Jt(u.right,l.right),l.bottom=Jt(u.bottom,l.bottom),l.left=ht(u.left,l.left),l},Vn(t,r,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ha(e){const{width:t,height:i}=os(e);return{width:t,height:i}}function Ba(e,t,i){const n=rt(t),o=At(t),s=i==="fixed",r=ke(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=$t(0);if(n||!n&&!s)if((Ct(t)!=="body"||He(o))&&(a=Ti(t)),n){const c=ke(t,!0,s,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=ls(o));const d=r.left+a.scrollLeft-l.x,u=r.top+a.scrollTop-l.y;return{x:d,y:u,width:r.width,height:r.height}}function Wn(e,t){return!rt(e)||X(e).position==="fixed"?null:t?t(e):e.offsetParent}function ds(e,t){const i=V(e);if(!rt(e)||as(e))return i;let n=Wn(e,t);for(;n&&Sa(n)&&X(n).position==="static";)n=Wn(n,t);return n&&(Ct(n)==="html"||Ct(n)==="body"&&X(n).position==="static"&&!yn(n))?i:n||Oa(e)||i}const Ua=async function(e){const t=this.getOffsetParent||ds,i=this.getDimensions;return{reference:Ba(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await i(e.floating)}}};function Va(e){return X(e).direction==="rtl"}const Wa={convertOffsetParentRelativeRectToViewportRelativeRect:Ma,getDocumentElement:At,getClippingRect:Fa,getOffsetParent:ds,getElementRects:Ua,getClientRects:La,getDimensions:Ha,getScale:Yt,isElement:st,isRTL:Va},us=Aa,hs=wa,ps=Ca,ms=(e,t,i)=>{const n=new Map,o={platform:Wa,...i},s={...o.platform,_c:n};return xa(e,t,{...o,platform:s})};/** +import{M as Be,s as $n,A as Ni,e as Qo,_ as Ko,O as Zo,T as Bt,k as ct,N as ea,a as ts,y as ia,U as na,Q as oa,b as vt,C as pi}from"./index-6e07lNWw.js";import{V as Cn,c as Ii,C as ae,G as qn,F as sa,L as ra,d as Yn,e as aa,f as la,P as ni,g as _e,D as ca,A as da,O as ua,h as ha,I as pa,R as ma,i as es,j as is,k as ba,l as ns,m as fa,n as ga,o as os,p as ss,q as va,r as ya}from"./web-ifc-api-Dlf_dxms.js";import{n as _a,P as R,u as xa}from"./index-DDq_E_eW.js";var wa=Object.defineProperty,$a=(e,t,i)=>t in e?wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Nt=(e,t,i)=>($a(e,typeof t!="symbol"?t+"":t,i),i);const Jt=Math.min,ht=Math.max,mi=Math.round,$t=e=>({x:e,y:e}),Ca={left:"right",right:"left",bottom:"top",top:"bottom"},Aa={start:"end",end:"start"};function Xn(e,t,i){return ht(e,Jt(t,i))}function Ue(e,t){return typeof e=="function"?e(t):e}function mt(e){return e.split("-")[0]}function Pi(e){return e.split("-")[1]}function rs(e){return e==="x"?"y":"x"}function as(e){return e==="y"?"height":"width"}function jt(e){return["top","bottom"].includes(mt(e))?"y":"x"}function ls(e){return rs(jt(e))}function Ea(e,t,i){i===void 0&&(i=!1);const n=Pi(e),o=ls(e),s=as(o);let r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=bi(r)),[r,bi(r)]}function Sa(e){const t=bi(e);return[rn(e),t,rn(t)]}function rn(e){return e.replace(/start|end/g,t=>Aa[t])}function ka(e,t,i){const n=["left","right"],o=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(e){case"top":case"bottom":return i?t?o:n:t?n:o;case"left":case"right":return t?s:r;default:return[]}}function Ta(e,t,i,n){const o=Pi(e);let s=ka(mt(e),i==="start",n);return o&&(s=s.map(r=>r+"-"+o),t&&(s=s.concat(s.map(rn)))),s}function bi(e){return e.replace(/left|right|bottom|top/g,t=>Ca[t])}function Oa(e){return{top:0,right:0,bottom:0,left:0,...e}}function cs(e){return typeof e!="number"?Oa(e):{top:e,right:e,bottom:e,left:e}}function Qt(e){const{x:t,y:i,width:n,height:o}=e;return{width:n,height:o,top:i,left:t,right:t+n,bottom:i+o,x:t,y:i}}function Jn(e,t,i){let{reference:n,floating:o}=e;const s=jt(t),r=ls(t),a=as(r),l=mt(t),d=s==="y",u=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2,h=n[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:n.y-o.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:c};break;case"left":p={x:n.x-o.width,y:c};break;default:p={x:n.x,y:n.y}}switch(Pi(t)){case"start":p[r]-=h*(i&&d?-1:1);break;case"end":p[r]+=h*(i&&d?-1:1);break}return p}const Na=async(e,t,i)=>{const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,a=s.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(t));let d=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:c}=Jn(d,n,l),h=n,p={},b=0;for(let v=0;v$<=0)){var B,E;const $=(((B=s.flip)==null?void 0:B.index)||0)+1,et=N[$];if(et)return{data:{index:$,overflows:S},reset:{placement:et}};let ot=(E=S.filter(st=>st.overflows[0]<=0).sort((st,X)=>st.overflows[1]-X.overflows[1])[0])==null?void 0:E.placement;if(!ot)switch(p){case"bestFit":{var M;const st=(M=S.filter(X=>{if(C){const rt=jt(X.placement);return rt===_||rt==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(rt=>rt>0).reduce((rt,ve)=>rt+ve,0)]).sort((X,rt)=>X[1]-rt[1])[0])==null?void 0:M[0];st&&(ot=st);break}case"initialPlacement":ot=a;break}if(o!==ot)return{reset:{placement:ot}}}return{}}}};function us(e){const t=Jt(...e.map(s=>s.left)),i=Jt(...e.map(s=>s.top)),n=ht(...e.map(s=>s.right)),o=ht(...e.map(s=>s.bottom));return{x:t,y:i,width:n-t,height:o-i}}function Pa(e){const t=e.slice().sort((o,s)=>o.y-s.y),i=[];let n=null;for(let o=0;on.height/2?i.push([s]):i[i.length-1].push(s),n=s}return i.map(o=>Qt(us(o)))}const Ma=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:i,elements:n,rects:o,platform:s,strategy:r}=t,{padding:a=2,x:l,y:d}=Ue(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),c=Pa(u),h=Qt(us(u)),p=cs(a);function b(){if(c.length===2&&c[0].left>c[1].right&&l!=null&&d!=null)return c.find(y=>l>y.left-p.left&&ly.top-p.top&&d=2){if(jt(i)==="y"){const S=c[0],B=c[c.length-1],E=mt(i)==="top",M=S.top,$=B.bottom,et=E?S.left:B.left,ot=E?S.right:B.right,st=ot-et,X=$-M;return{top:M,bottom:$,left:et,right:ot,width:st,height:X,x:et,y:M}}const y=mt(i)==="left",g=ht(...c.map(S=>S.right)),_=Jt(...c.map(S=>S.left)),x=c.filter(S=>y?S.left===_:S.right===g),w=x[0].top,A=x[x.length-1].bottom,C=_,N=g,L=N-C,k=A-w;return{top:w,bottom:A,left:C,right:N,width:L,height:k,x:C,y:w}}return h}const v=await s.getElementRects({reference:{getBoundingClientRect:b},floating:n.floating,strategy:r});return o.reference.x!==v.reference.x||o.reference.y!==v.reference.y||o.reference.width!==v.reference.width||o.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}};async function La(e,t){const{placement:i,platform:n,elements:o}=e,s=await(n.isRTL==null?void 0:n.isRTL(o.floating)),r=mt(i),a=Pi(i),l=jt(i)==="y",d=["left","top"].includes(r)?-1:1,u=s&&l?-1:1,c=Ue(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...c};return a&&typeof b=="number"&&(p=a==="end"?b*-1:b),l?{x:p*u,y:h*d}:{x:h*d,y:p*u}}const hs=function(e){return{name:"offset",options:e,async fn(t){var i,n;const{x:o,y:s,placement:r,middlewareData:a}=t,l=await La(t,e);return r===((i=a.offset)==null?void 0:i.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:r}}}}},Ra=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:i,y:n,placement:o}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:y=>{let{x:g,y:_}=y;return{x:g,y:_}}},...l}=Ue(e,t),d={x:i,y:n},u=await ds(t,l),c=jt(mt(o)),h=rs(c);let p=d[h],b=d[c];if(s){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",_=p+u[y],x=p-u[g];p=Xn(_,p,x)}if(r){const y=c==="y"?"top":"left",g=c==="y"?"bottom":"right",_=b+u[y],x=b-u[g];b=Xn(_,b,x)}const v=a.fn({...t,[h]:p,[c]:b});return{...v,data:{x:v.x-i,y:v.y-n}}}}};function Ct(e){return ps(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Et(e){var t;return(t=(ps(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ps(e){return e instanceof Node||e instanceof q(e).Node}function at(e){return e instanceof Element||e instanceof q(e).Element}function lt(e){return e instanceof HTMLElement||e instanceof q(e).HTMLElement}function Qn(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function Ve(e){const{overflow:t,overflowX:i,overflowY:n,display:o}=Q(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function Da(e){return["table","td","th"].includes(Ct(e))}function ja(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function An(e){const t=En(),i=at(e)?Q(e):e;return i.transform!=="none"||i.perspective!=="none"||(i.containerType?i.containerType!=="normal":!1)||!t&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!t&&(i.filter?i.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(i.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(i.contain||"").includes(n))}function za(e){let t=Kt(e);for(;lt(t)&&!Mi(t);){if(An(t))return t;if(ja(t))return null;t=Kt(t)}return null}function En(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Mi(e){return["html","body","#document"].includes(Ct(e))}function Q(e){return q(e).getComputedStyle(e)}function Li(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kt(e){if(Ct(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qn(e)&&e.host||Et(e);return Qn(t)?t.host:t}function ms(e){const t=Kt(e);return Mi(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&Ve(t)?t:ms(t)}function an(e,t,i){var n;t===void 0&&(t=[]),i===void 0&&(i=!0);const o=ms(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),r=q(o);if(s){const a=Fa(r);return t.concat(r,r.visualViewport||[],Ve(o)?o:[],a&&i?an(a):[])}return t.concat(o,an(o,[],i))}function Fa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bs(e){const t=Q(e);let i=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=lt(e),s=o?e.offsetWidth:i,r=o?e.offsetHeight:n,a=mi(i)!==s||mi(n)!==r;return a&&(i=s,n=r),{width:i,height:n,$:a}}function fs(e){return at(e)?e:e.contextElement}function Xt(e){const t=fs(e);if(!lt(t))return $t(1);const i=t.getBoundingClientRect(),{width:n,height:o,$:s}=bs(t);let r=(s?mi(i.width):i.width)/n,a=(s?mi(i.height):i.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const Ha=$t(0);function gs(e){const t=q(e);return!En()||!t.visualViewport?Ha:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ba(e,t,i){return t===void 0&&(t=!1),!i||t&&i!==q(e)?!1:t}function Ie(e,t,i,n){t===void 0&&(t=!1),i===void 0&&(i=!1);const o=e.getBoundingClientRect(),s=fs(e);let r=$t(1);t&&(n?at(n)&&(r=Xt(n)):r=Xt(e));const a=Ba(s,i,n)?gs(s):$t(0);let l=(o.left+a.x)/r.x,d=(o.top+a.y)/r.y,u=o.width/r.x,c=o.height/r.y;if(s){const h=q(s),p=n&&at(n)?q(n):n;let b=h,v=b.frameElement;for(;v&&n&&p!==b;){const y=Xt(v),g=v.getBoundingClientRect(),_=Q(v),x=g.left+(v.clientLeft+parseFloat(_.paddingLeft))*y.x,w=g.top+(v.clientTop+parseFloat(_.paddingTop))*y.y;l*=y.x,d*=y.y,u*=y.x,c*=y.y,l+=x,d+=w,b=q(v),v=b.frameElement}}return Qt({width:u,height:c,x:l,y:d})}const Ua=[":popover-open",":modal"];function vs(e){return Ua.some(t=>{try{return e.matches(t)}catch{return!1}})}function Va(e){let{elements:t,rect:i,offsetParent:n,strategy:o}=e;const s=o==="fixed",r=Et(n),a=t?vs(t.floating):!1;if(n===r||a&&s)return i;let l={scrollLeft:0,scrollTop:0},d=$t(1);const u=$t(0),c=lt(n);if((c||!c&&!s)&&((Ct(n)!=="body"||Ve(r))&&(l=Li(n)),lt(n))){const h=Ie(n);d=Xt(n),u.x=h.x+n.clientLeft,u.y=h.y+n.clientTop}return{width:i.width*d.x,height:i.height*d.y,x:i.x*d.x-l.scrollLeft*d.x+u.x,y:i.y*d.y-l.scrollTop*d.y+u.y}}function Wa(e){return Array.from(e.getClientRects())}function ys(e){return Ie(Et(e)).left+Li(e).scrollLeft}function Ga(e){const t=Et(e),i=Li(e),n=e.ownerDocument.body,o=ht(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=ht(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-i.scrollLeft+ys(e);const a=-i.scrollTop;return Q(n).direction==="rtl"&&(r+=ht(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:a}}function qa(e,t){const i=q(e),n=Et(e),o=i.visualViewport;let s=n.clientWidth,r=n.clientHeight,a=0,l=0;if(o){s=o.width,r=o.height;const d=En();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:s,height:r,x:a,y:l}}function Ya(e,t){const i=Ie(e,!0,t==="fixed"),n=i.top+e.clientTop,o=i.left+e.clientLeft,s=lt(e)?Xt(e):$t(1),r=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,d=n*s.y;return{width:r,height:a,x:l,y:d}}function Kn(e,t,i){let n;if(t==="viewport")n=qa(e,i);else if(t==="document")n=Ga(Et(e));else if(at(t))n=Ya(t,i);else{const o=gs(e);n={...t,x:t.x-o.x,y:t.y-o.y}}return Qt(n)}function _s(e,t){const i=Kt(e);return i===t||!at(i)||Mi(i)?!1:Q(i).position==="fixed"||_s(i,t)}function Xa(e,t){const i=t.get(e);if(i)return i;let n=an(e,[],!1).filter(a=>at(a)&&Ct(a)!=="body"),o=null;const s=Q(e).position==="fixed";let r=s?Kt(e):e;for(;at(r)&&!Mi(r);){const a=Q(r),l=An(r);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&o&&["absolute","fixed"].includes(o.position)||Ve(r)&&!l&&_s(e,r))?n=n.filter(d=>d!==r):o=a,r=Kt(r)}return t.set(e,n),n}function Ja(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e;const s=[...i==="clippingAncestors"?Xa(t,this._c):[].concat(i),n],r=s[0],a=s.reduce((l,d)=>{const u=Kn(t,d,o);return l.top=ht(u.top,l.top),l.right=Jt(u.right,l.right),l.bottom=Jt(u.bottom,l.bottom),l.left=ht(u.left,l.left),l},Kn(t,r,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Qa(e){const{width:t,height:i}=bs(e);return{width:t,height:i}}function Ka(e,t,i){const n=lt(t),o=Et(t),s=i==="fixed",r=Ie(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=$t(0);if(n||!n&&!s)if((Ct(t)!=="body"||Ve(o))&&(a=Li(t)),n){const c=Ie(t,!0,s,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=ys(o));const d=r.left+a.scrollLeft-l.x,u=r.top+a.scrollTop-l.y;return{x:d,y:u,width:r.width,height:r.height}}function Zn(e,t){return!lt(e)||Q(e).position==="fixed"?null:t?t(e):e.offsetParent}function xs(e,t){const i=q(e);if(!lt(e)||vs(e))return i;let n=Zn(e,t);for(;n&&Da(n)&&Q(n).position==="static";)n=Zn(n,t);return n&&(Ct(n)==="html"||Ct(n)==="body"&&Q(n).position==="static"&&!An(n))?i:n||za(e)||i}const Za=async function(e){const t=this.getOffsetParent||xs,i=this.getDimensions;return{reference:Ka(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await i(e.floating)}}};function tl(e){return Q(e).direction==="rtl"}const el={convertOffsetParentRelativeRectToViewportRelativeRect:Va,getDocumentElement:Et,getClippingRect:Ja,getOffsetParent:xs,getElementRects:Za,getClientRects:Wa,getDimensions:Qa,getScale:Xt,isElement:at,isRTL:tl},ws=Ra,$s=Ia,Cs=Ma,As=(e,t,i)=>{const n=new Map,o={platform:el,...i},s={...o.platform,_c:n};return Na(e,t,{...o,platform:s})};/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const oi=globalThis,xn=oi.ShadowRoot&&(oi.ShadyCSS===void 0||oi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wn=Symbol(),Gn=new WeakMap;let bs=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==wn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(xn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Gn.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Gn.set(t,e))}return e}toString(){return this.cssText}};const Ga=e=>new bs(typeof e=="string"?e:e+"",void 0,wn),I=(e,...t)=>{const i=e.length===1?e[0]:t.reduce((n,o,s)=>n+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[s+1],e[0]);return new bs(i,e,wn)},qa=(e,t)=>{if(xn)e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of t){const n=document.createElement("style"),o=oi.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=i.cssText,e.appendChild(n)}},qn=xn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(const n of t.cssRules)i+=n.cssText;return Ga(i)})(e):e;/** + */const ai=globalThis,Sn=ai.ShadowRoot&&(ai.ShadyCSS===void 0||ai.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kn=Symbol(),to=new WeakMap;let Es=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==kn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Sn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=to.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&to.set(t,e))}return e}toString(){return this.cssText}};const il=e=>new Es(typeof e=="string"?e:e+"",void 0,kn),I=(e,...t)=>{const i=e.length===1?e[0]:t.reduce((n,o,s)=>n+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[s+1],e[0]);return new Es(i,e,kn)},nl=(e,t)=>{if(Sn)e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of t){const n=document.createElement("style"),o=ai.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=i.cssText,e.appendChild(n)}},eo=Sn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(const n of t.cssRules)i+=n.cssText;return il(i)})(e):e;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const{is:Ya,defineProperty:Xa,getOwnPropertyDescriptor:Ja,getOwnPropertyNames:Qa,getOwnPropertySymbols:Za,getPrototypeOf:Ka}=Object,Kt=globalThis,Yn=Kt.trustedTypes,tl=Yn?Yn.emptyScript:"",Xn=Kt.reactiveElementPolyfillSupport,$e=(e,t)=>e,pi={toAttribute(e,t){switch(t){case Boolean:e=e?tl:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},$n=(e,t)=>!Ya(e,t),Jn={attribute:!0,type:String,converter:pi,reflect:!1,hasChanged:$n};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Kt.litPropertyMetadata??(Kt.litPropertyMetadata=new WeakMap);class Gt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=Jn){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(t,i),!i.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(t,n,i);o!==void 0&&Xa(this.prototype,t,o)}}static getPropertyDescriptor(t,i,n){const{get:o,set:s}=Ja(this.prototype,t)??{get(){return this[i]},set(r){this[i]=r}};return{get(){return o==null?void 0:o.call(this)},set(r){const a=o==null?void 0:o.call(this);s.call(this,r),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Jn}static _$Ei(){if(this.hasOwnProperty($e("elementProperties")))return;const t=Ka(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($e("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($e("properties"))){const i=this.properties,n=[...Qa(i),...Za(i)];for(const o of n)this.createProperty(o,i[o])}const t=this[Symbol.metadata];if(t!==null){const i=litPropertyMetadata.get(t);if(i!==void 0)for(const[n,o]of i)this.elementProperties.set(n,o)}this._$Eh=new Map;for(const[i,n]of this.elementProperties){const o=this._$Eu(i,n);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)i.unshift(qn(o))}else t!==void 0&&i.push(qn(t));return i}static _$Eu(t,i){const n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(i=>i(this))}addController(t){var i;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var i;(i=this._$EO)==null||i.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const n of i.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return qa(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostDisconnected)==null?void 0:n.call(i)})}attributeChangedCallback(t,i,n){this._$AK(t,n)}_$EC(t,i){var n;const o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){const r=(((n=o.converter)==null?void 0:n.toAttribute)!==void 0?o.converter:pi).toAttribute(i,o.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,i){var n;const o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=o.getPropertyOptions(s),a=typeof r.converter=="function"?{fromAttribute:r.converter}:((n=r.converter)==null?void 0:n.fromAttribute)!==void 0?r.converter:pi;this._$Em=s,this[s]=a.fromAttribute(i,r.type),this._$Em=null}}requestUpdate(t,i,n){if(t!==void 0){if(n??(n=this.constructor.getPropertyOptions(t)),!(n.hasChanged??$n)(this[t],i))return;this.P(t,i,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,i,n){this._$AL.has(t)||this._$AL.set(t,i),n.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[s,r]of o)r.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],r)}let i=!1;const n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(t=this._$EO)==null||t.forEach(o=>{var s;return(s=o.hostUpdate)==null?void 0:s.call(o)}),this.update(n)):this._$EU()}catch(o){throw i=!1,this._$EU(),o}i&&this._$AE(n)}willUpdate(t){}_$AE(t){var i;(i=this._$EO)==null||i.forEach(n=>{var o;return(o=n.hostUpdated)==null?void 0:o.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(i=>this._$EC(i,this[i]))),this._$EU()}updated(t){}firstUpdated(t){}}Gt.elementStyles=[],Gt.shadowRootOptions={mode:"open"},Gt[$e("elementProperties")]=new Map,Gt[$e("finalized")]=new Map,Xn==null||Xn({ReactiveElement:Gt}),(Kt.reactiveElementVersions??(Kt.reactiveElementVersions=[])).push("2.0.4");/** + */const{is:ol,defineProperty:sl,getOwnPropertyDescriptor:rl,getOwnPropertyNames:al,getOwnPropertySymbols:ll,getPrototypeOf:cl}=Object,Zt=globalThis,io=Zt.trustedTypes,dl=io?io.emptyScript:"",no=Zt.reactiveElementPolyfillSupport,Ae=(e,t)=>e,fi={toAttribute(e,t){switch(t){case Boolean:e=e?dl:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},Tn=(e,t)=>!ol(e,t),oo={attribute:!0,type:String,converter:fi,reflect:!1,hasChanged:Tn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Zt.litPropertyMetadata??(Zt.litPropertyMetadata=new WeakMap);class qt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=oo){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(t,i),!i.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(t,n,i);o!==void 0&&sl(this.prototype,t,o)}}static getPropertyDescriptor(t,i,n){const{get:o,set:s}=rl(this.prototype,t)??{get(){return this[i]},set(r){this[i]=r}};return{get(){return o==null?void 0:o.call(this)},set(r){const a=o==null?void 0:o.call(this);s.call(this,r),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??oo}static _$Ei(){if(this.hasOwnProperty(Ae("elementProperties")))return;const t=cl(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ae("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ae("properties"))){const i=this.properties,n=[...al(i),...ll(i)];for(const o of n)this.createProperty(o,i[o])}const t=this[Symbol.metadata];if(t!==null){const i=litPropertyMetadata.get(t);if(i!==void 0)for(const[n,o]of i)this.elementProperties.set(n,o)}this._$Eh=new Map;for(const[i,n]of this.elementProperties){const o=this._$Eu(i,n);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)i.unshift(eo(o))}else t!==void 0&&i.push(eo(t));return i}static _$Eu(t,i){const n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(i=>i(this))}addController(t){var i;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var i;(i=this._$EO)==null||i.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const n of i.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return nl(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostDisconnected)==null?void 0:n.call(i)})}attributeChangedCallback(t,i,n){this._$AK(t,n)}_$EC(t,i){var n;const o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){const r=(((n=o.converter)==null?void 0:n.toAttribute)!==void 0?o.converter:fi).toAttribute(i,o.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,i){var n;const o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=o.getPropertyOptions(s),a=typeof r.converter=="function"?{fromAttribute:r.converter}:((n=r.converter)==null?void 0:n.fromAttribute)!==void 0?r.converter:fi;this._$Em=s,this[s]=a.fromAttribute(i,r.type),this._$Em=null}}requestUpdate(t,i,n){if(t!==void 0){if(n??(n=this.constructor.getPropertyOptions(t)),!(n.hasChanged??Tn)(this[t],i))return;this.P(t,i,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,i,n){this._$AL.has(t)||this._$AL.set(t,i),n.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[s,r]of o)r.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],r)}let i=!1;const n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(t=this._$EO)==null||t.forEach(o=>{var s;return(s=o.hostUpdate)==null?void 0:s.call(o)}),this.update(n)):this._$EU()}catch(o){throw i=!1,this._$EU(),o}i&&this._$AE(n)}willUpdate(t){}_$AE(t){var i;(i=this._$EO)==null||i.forEach(n=>{var o;return(o=n.hostUpdated)==null?void 0:o.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(i=>this._$EC(i,this[i]))),this._$EU()}updated(t){}firstUpdated(t){}}qt.elementStyles=[],qt.shadowRootOptions={mode:"open"},qt[Ae("elementProperties")]=new Map,qt[Ae("finalized")]=new Map,no==null||no({ReactiveElement:qt}),(Zt.reactiveElementVersions??(Zt.reactiveElementVersions=[])).push("2.0.4");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const mi=globalThis,bi=mi.trustedTypes,Qn=bi?bi.createPolicy("lit-html",{createHTML:e=>e}):void 0,fs="$lit$",xt=`lit$${Math.random().toFixed(9).slice(2)}$`,gs="?"+xt,el=`<${gs}>`,Dt=document,Oe=()=>Dt.createComment(""),Te=e=>e===null||typeof e!="object"&&typeof e!="function",Cn=Array.isArray,il=e=>Cn(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",Ui=`[ -\f\r]`,_e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zn=/-->/g,Kn=/>/g,Nt=RegExp(`>|${Ui}(?:([^\\s"'>=/]+)(${Ui}*=${Ui}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),to=/'/g,eo=/"/g,vs=/^(?:script|style|textarea|title)$/i,nl=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),m=nl(1),zt=Symbol.for("lit-noChange"),M=Symbol.for("lit-nothing"),io=new WeakMap,Mt=Dt.createTreeWalker(Dt,129);function ys(e,t){if(!Cn(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qn!==void 0?Qn.createHTML(t):t}const ol=(e,t)=>{const i=e.length-1,n=[];let o,s=t===2?"":t===3?"":"",r=_e;for(let a=0;a"?(r=o??_e,c=-1):u[1]===void 0?c=-2:(c=r.lastIndex-u[2].length,d=u[1],r=u[3]===void 0?Nt:u[3]==='"'?eo:to):r===eo||r===to?r=Nt:r===Zn||r===Kn?r=_e:(r=Nt,o=void 0);const p=r===Nt&&e[a+1].startsWith("/>")?" ":"";s+=r===_e?l+el:c>=0?(n.push(d),l.slice(0,c)+fs+l.slice(c)+xt+p):l+xt+(c===-2?a:p)}return[ys(e,s+(e[i]||"")+(t===2?"":t===3?"":"")),n]};class Ie{constructor({strings:t,_$litType$:i},n){let o;this.parts=[];let s=0,r=0;const a=t.length-1,l=this.parts,[d,u]=ol(t,i);if(this.el=Ie.createElement(d,n),Mt.currentNode=this.el.content,i===2||i===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=Mt.nextNode())!==null&&l.length0){o.textContent=bi?bi.emptyScript:"";for(let p=0;p2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=M}_$AI(t,i=this,n,o){const s=this.strings;let r=!1;if(s===void 0)t=te(this,t,i,0),r=!Te(t)||t!==this._$AH&&t!==zt,r&&(this._$AH=t);else{const a=t;let l,d;for(t=s[0],l=0;l{const n=(i==null?void 0:i.renderBefore)??t;let o=n._$litPart$;if(o===void 0){const s=(i==null?void 0:i.renderBefore)??null;n._$litPart$=o=new Be(t.insertBefore(Oe(),s),s,void 0,i??{})}return o._$AI(e),o};/** + */const gi=globalThis,vi=gi.trustedTypes,so=vi?vi.createPolicy("lit-html",{createHTML:e=>e}):void 0,Ss="$lit$",xt=`lit$${Math.random().toFixed(9).slice(2)}$`,ks="?"+xt,ul=`<${ks}>`,zt=document,Pe=()=>zt.createComment(""),Me=e=>e===null||typeof e!="object"&&typeof e!="function",On=Array.isArray,hl=e=>On(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",Yi=`[ +\f\r]`,xe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ro=/-->/g,ao=/>/g,It=RegExp(`>|${Yi}(?:([^\\s"'>=/]+)(${Yi}*=${Yi}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),lo=/'/g,co=/"/g,Ts=/^(?:script|style|textarea|title)$/i,pl=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),m=pl(1),Ft=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),uo=new WeakMap,Mt=zt.createTreeWalker(zt,129);function Os(e,t){if(!On(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return so!==void 0?so.createHTML(t):t}const ml=(e,t)=>{const i=e.length-1,n=[];let o,s=t===2?"":t===3?"":"",r=xe;for(let a=0;a"?(r=o??xe,c=-1):u[1]===void 0?c=-2:(c=r.lastIndex-u[2].length,d=u[1],r=u[3]===void 0?It:u[3]==='"'?co:lo):r===co||r===lo?r=It:r===ro||r===ao?r=xe:(r=It,o=void 0);const p=r===It&&e[a+1].startsWith("/>")?" ":"";s+=r===xe?l+ul:c>=0?(n.push(d),l.slice(0,c)+Ss+l.slice(c)+xt+p):l+xt+(c===-2?a:p)}return[Os(e,s+(e[i]||"")+(t===2?"":t===3?"":"")),n]};class Le{constructor({strings:t,_$litType$:i},n){let o;this.parts=[];let s=0,r=0;const a=t.length-1,l=this.parts,[d,u]=ml(t,i);if(this.el=Le.createElement(d,n),Mt.currentNode=this.el.content,i===2||i===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=Mt.nextNode())!==null&&l.length0){o.textContent=vi?vi.emptyScript:"";for(let p=0;p2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=D}_$AI(t,i=this,n,o){const s=this.strings;let r=!1;if(s===void 0)t=te(this,t,i,0),r=!Me(t)||t!==this._$AH&&t!==Ft,r&&(this._$AH=t);else{const a=t;let l,d;for(t=s[0],l=0;l{const n=(i==null?void 0:i.renderBefore)??t;let o=n._$litPart$;if(o===void 0){const s=(i==null?void 0:i.renderBefore)??null;n._$litPart$=o=new We(t.insertBefore(Pe(),s),s,void 0,i??{})}return o._$AI(e),o};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */let T=class extends Gt{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=ee(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this.o)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.o)==null||e.setConnected(!1)}render(){return zt}};var oo;T._$litElement$=!0,T.finalized=!0,(oo=globalThis.litElementHydrateSupport)==null||oo.call(globalThis,{LitElement:T});const so=globalThis.litElementPolyfillSupport;so==null||so({LitElement:T});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/** + */let O=class extends qt{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=ee(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this.o)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.o)==null||e.setConnected(!1)}render(){return Ft}};var po;O._$litElement$=!0,O.finalized=!0,(po=globalThis.litElementHydrateSupport)==null||po.call(globalThis,{LitElement:O});const mo=globalThis.litElementPolyfillSupport;mo==null||mo({LitElement:O});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const dl={attribute:!0,type:String,converter:pi,reflect:!1,hasChanged:$n},ul=(e=dl,t,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,e),n==="accessor"){const{name:r}=i;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,l,e)},init(a){return a!==void 0&&this.P(r,void 0,e),a}}}if(n==="setter"){const{name:r}=i;return function(a){const l=this[r];t.call(this,a),this.requestUpdate(r,l,e)}}throw Error("Unsupported decorator location: "+n)};function b(e){return(t,i)=>typeof i=="object"?ul(e,t,i):((n,o,s)=>{const r=o.hasOwnProperty(s);return o.constructor.createProperty(s,r?{...n,wrapped:!0}:n),r?Object.getOwnPropertyDescriptor(o,s):void 0})(e,t,i)}/** + */const _l={attribute:!0,type:String,converter:fi,reflect:!1,hasChanged:Tn},xl=(e=_l,t,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,e),n==="accessor"){const{name:r}=i;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,l,e)},init(a){return a!==void 0&&this.P(r,void 0,e),a}}}if(n==="setter"){const{name:r}=i;return function(a){const l=this[r];t.call(this,a),this.requestUpdate(r,l,e)}}throw Error("Unsupported decorator location: "+n)};function f(e){return(t,i)=>typeof i=="object"?xl(e,t,i):((n,o,s)=>{const r=o.hasOwnProperty(s);return o.constructor.createProperty(s,r?{...n,wrapped:!0}:n),r?Object.getOwnPropertyDescriptor(o,s):void 0})(e,t,i)}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function ae(e){return b({...e,state:!0,attribute:!1})}/** + */function le(e){return f({...e,state:!0,attribute:!1})}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const hl=e=>e.strings===void 0;/** + */const wl=e=>e.strings===void 0;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const _s={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},xs=e=>(...t)=>({_$litDirective$:e,values:t});class ws{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,n){this.t=t,this._$AM=i,this.i=n}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}/** + */const Ns={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Is=e=>(...t)=>({_$litDirective$:e,values:t});class Ps{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,n){this.t=t,this._$AM=i,this.i=n}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const Ce=(e,t)=>{var i;const n=e._$AN;if(n===void 0)return!1;for(const o of n)(i=o._$AO)==null||i.call(o,t,!1),Ce(o,t);return!0},fi=e=>{let t,i;do{if((t=e._$AM)===void 0)break;i=t._$AN,i.delete(e),e=t}while((i==null?void 0:i.size)===0)},$s=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(i===void 0)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),bl(t)}};function pl(e){this._$AN!==void 0?(fi(this),this._$AM=e,$s(this)):this._$AM=e}function ml(e,t=!1,i=0){const n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(n))for(let s=i;s{e.type==_s.CHILD&&(e._$AP??(e._$AP=ml),e._$AQ??(e._$AQ=pl))};class fl extends ws{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,i,n){super._$AT(t,i,n),$s(this),this.isConnected=t._$AU}_$AO(t,i=!0){var n,o;t!==this.isConnected&&(this.isConnected=t,t?(n=this.reconnected)==null||n.call(this):(o=this.disconnected)==null||o.call(this)),i&&(Ce(this,t),fi(this))}setValue(t){if(hl(this.t))this.t._$AI(t,this);else{const i=[...this.t._$AH];i[this.i]=t,this.t._$AI(i,this,0)}}disconnected(){}reconnected(){}}/** + */const Ee=(e,t)=>{var i;const n=e._$AN;if(n===void 0)return!1;for(const o of n)(i=o._$AO)==null||i.call(o,t,!1),Ee(o,t);return!0},yi=e=>{let t,i;do{if((t=e._$AM)===void 0)break;i=t._$AN,i.delete(e),e=t}while((i==null?void 0:i.size)===0)},Ms=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(i===void 0)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),Al(t)}};function $l(e){this._$AN!==void 0?(yi(this),this._$AM=e,Ms(this)):this._$AM=e}function Cl(e,t=!1,i=0){const n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(n))for(let s=i;s{e.type==Ns.CHILD&&(e._$AP??(e._$AP=Cl),e._$AQ??(e._$AQ=$l))};class El extends Ps{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,i,n){super._$AT(t,i,n),Ms(this),this.isConnected=t._$AU}_$AO(t,i=!0){var n,o;t!==this.isConnected&&(this.isConnected=t,t?(n=this.reconnected)==null||n.call(this):(o=this.disconnected)==null||o.call(this)),i&&(Ee(this,t),yi(this))}setValue(t){if(wl(this.t))this.t._$AI(t,this);else{const i=[...this.t._$AH];i[this.i]=t,this.t._$AI(i,this,0)}}disconnected(){}reconnected(){}}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ie=()=>new gl;class gl{}const Vi=new WeakMap,J=xs(class extends fl{render(e){return M}update(e,[t]){var i;const n=t!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=(i=e.options)==null?void 0:i.host,this.rt(this.ct=e.element)),M}rt(e){if(this.isConnected||(e=void 0),typeof this.Y=="function"){const t=this.ht??globalThis;let i=Vi.get(t);i===void 0&&(i=new WeakMap,Vi.set(t,i)),i.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),i.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){var e,t;return typeof this.Y=="function"?(e=Vi.get(this.ht??globalThis))==null?void 0:e.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/** + */const ie=()=>new Sl;class Sl{}const Xi=new WeakMap,W=Is(class extends El{render(e){return D}update(e,[t]){var i;const n=t!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=(i=e.options)==null?void 0:i.host,this.rt(this.ct=e.element)),D}rt(e){if(this.isConnected||(e=void 0),typeof this.Y=="function"){const t=this.ht??globalThis;let i=Xi.get(t);i===void 0&&(i=new WeakMap,Xi.set(t,i)),i.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),i.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){var e,t;return typeof this.Y=="function"?(e=Xi.get(this.ht??globalThis))==null?void 0:e.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/** * (c) Iconify * * For the full copyright and license information, please view the license.txt @@ -50,15 +50,176 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m * * @license MIT * @version 2.0.0 -*/const Cs=Object.freeze({left:0,top:0,width:16,height:16}),gi=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ue=Object.freeze({...Cs,...gi}),en=Object.freeze({...Ue,body:"",hidden:!1}),vl=Object.freeze({width:null,height:null}),Es=Object.freeze({...vl,...gi});function yl(e,t=0){const i=e.replace(/^-?[0-9.]*/,"");function n(o){for(;o<0;)o+=4;return o%4}if(i===""){const o=parseInt(e);return isNaN(o)?0:n(o)}else if(i!==e){let o=0;switch(i){case"%":o=25;break;case"deg":o=90}if(o){let s=parseFloat(e.slice(0,e.length-i.length));return isNaN(s)?0:(s=s/o,s%1===0?n(s):0)}}return t}const _l=/[\s,]+/;function xl(e,t){t.split(_l).forEach(i=>{switch(i.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}const As={...Es,preserveAspectRatio:""};function ro(e){const t={...As},i=(n,o)=>e.getAttribute(n)||o;return t.width=i("width",null),t.height=i("height",null),t.rotate=yl(i("rotate","")),xl(t,i("flip","")),t.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),t}function wl(e,t){for(const i in As)if(e[i]!==t[i])return!0;return!1}const Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ve=(e,t,i,n="")=>{const o=e.split(":");if(e.slice(0,1)==="@"){if(o.length<2||o.length>3)return null;n=o.shift().slice(1)}if(o.length>3||!o.length)return null;if(o.length>1){const a=o.pop(),l=o.pop(),d={provider:o.length>0?o[0]:n,prefix:l,name:a};return t&&!si(d)?null:d}const s=o[0],r=s.split("-");if(r.length>1){const a={provider:n,prefix:r.shift(),name:r.join("-")};return t&&!si(a)?null:a}if(i&&n===""){const a={provider:n,prefix:"",name:s};return t&&!si(a,i)?null:a}return null},si=(e,t)=>e?!!((e.provider===""||e.provider.match(Ee))&&(t&&e.prefix===""||e.prefix.match(Ee))&&e.name.match(Ee)):!1;function $l(e,t){const i={};!e.hFlip!=!t.hFlip&&(i.hFlip=!0),!e.vFlip!=!t.vFlip&&(i.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(i.rotate=n),i}function ao(e,t){const i=$l(e,t);for(const n in en)n in gi?n in e&&!(n in i)&&(i[n]=gi[n]):n in t?i[n]=t[n]:n in e&&(i[n]=e[n]);return i}function Cl(e,t){const i=e.icons,n=e.aliases||Object.create(null),o=Object.create(null);function s(r){if(i[r])return o[r]=[];if(!(r in o)){o[r]=null;const a=n[r]&&n[r].parent,l=a&&s(a);l&&(o[r]=[a].concat(l))}return o[r]}return Object.keys(i).concat(Object.keys(n)).forEach(s),o}function El(e,t,i){const n=e.icons,o=e.aliases||Object.create(null);let s={};function r(a){s=ao(n[a]||o[a],s)}return r(t),i.forEach(r),ao(e,s)}function Ss(e,t){const i=[];if(typeof e!="object"||typeof e.icons!="object")return i;e.not_found instanceof Array&&e.not_found.forEach(o=>{t(o,null),i.push(o)});const n=Cl(e);for(const o in n){const s=n[o];s&&(t(o,El(e,o,s)),i.push(o))}return i}const Al={provider:"",aliases:{},not_found:{},...Cs};function Wi(e,t){for(const i in t)if(i in e&&typeof e[i]!=typeof t[i])return!1;return!0}function ks(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Wi(e,Al))return null;const i=t.icons;for(const o in i){const s=i[o];if(!o.match(Ee)||typeof s.body!="string"||!Wi(s,en))return null}const n=t.aliases||Object.create(null);for(const o in n){const s=n[o],r=s.parent;if(!o.match(Ee)||typeof r!="string"||!i[r]&&!n[r]||!Wi(s,en))return null}return t}const vi=Object.create(null);function Sl(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Et(e,t){const i=vi[e]||(vi[e]=Object.create(null));return i[t]||(i[t]=Sl(e,t))}function En(e,t){return ks(t)?Ss(t,(i,n)=>{n?e.icons[i]=n:e.missing.add(i)}):[]}function kl(e,t,i){try{if(typeof i.body=="string")return e.icons[t]={...i},!0}catch{}return!1}function Ol(e,t){let i=[];return(typeof e=="string"?[e]:Object.keys(vi)).forEach(n=>{(typeof n=="string"&&typeof t=="string"?[t]:Object.keys(vi[n]||{})).forEach(o=>{const s=Et(n,o);i=i.concat(Object.keys(s.icons).map(r=>(n!==""?"@"+n+":":"")+o+":"+r))})}),i}let Ne=!1;function Os(e){return typeof e=="boolean"&&(Ne=e),Ne}function Pe(e){const t=typeof e=="string"?Ve(e,!0,Ne):e;if(t){const i=Et(t.provider,t.prefix),n=t.name;return i.icons[n]||(i.missing.has(n)?null:void 0)}}function Ts(e,t){const i=Ve(e,!0,Ne);if(!i)return!1;const n=Et(i.provider,i.prefix);return kl(n,i.name,t)}function lo(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Ne&&!t&&!e.prefix){let o=!1;return ks(e)&&(e.prefix="",Ss(e,(s,r)=>{r&&Ts(s,r)&&(o=!0)})),o}const i=e.prefix;if(!si({provider:t,prefix:i,name:"a"}))return!1;const n=Et(t,i);return!!En(n,e)}function co(e){return!!Pe(e)}function Tl(e){const t=Pe(e);return t?{...Ue,...t}:null}function Il(e){const t={loaded:[],missing:[],pending:[]},i=Object.create(null);e.sort((o,s)=>o.provider!==s.provider?o.provider.localeCompare(s.provider):o.prefix!==s.prefix?o.prefix.localeCompare(s.prefix):o.name.localeCompare(s.name));let n={provider:"",prefix:"",name:""};return e.forEach(o=>{if(n.name===o.name&&n.prefix===o.prefix&&n.provider===o.provider)return;n=o;const s=o.provider,r=o.prefix,a=o.name,l=i[s]||(i[s]=Object.create(null)),d=l[r]||(l[r]=Et(s,r));let u;a in d.icons?u=t.loaded:r===""||d.missing.has(a)?u=t.missing:u=t.pending;const c={provider:s,prefix:r,name:a};u.push(c)}),t}function Is(e,t){e.forEach(i=>{const n=i.loaderCallbacks;n&&(i.loaderCallbacks=n.filter(o=>o.id!==t))})}function Nl(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let i=!1;const n=e.provider,o=e.prefix;t.forEach(s=>{const r=s.icons,a=r.pending.length;r.pending=r.pending.filter(l=>{if(l.prefix!==o)return!0;const d=l.name;if(e.icons[d])r.loaded.push({provider:n,prefix:o,name:d});else if(e.missing.has(d))r.missing.push({provider:n,prefix:o,name:d});else return i=!0,!0;return!1}),r.pending.length!==a&&(i||Is([e],s.id),s.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),s.abort))})}))}let Pl=0;function Ml(e,t,i){const n=Pl++,o=Is.bind(null,i,n);if(!t.pending.length)return o;const s={id:n,icons:t,callback:e,abort:o};return i.forEach(r=>{(r.loaderCallbacks||(r.loaderCallbacks=[])).push(s)}),o}const nn=Object.create(null);function uo(e,t){nn[e]=t}function on(e){return nn[e]||nn[""]}function Ll(e,t=!0,i=!1){const n=[];return e.forEach(o=>{const s=typeof o=="string"?Ve(o,t,i):o;s&&n.push(s)}),n}var jl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Rl(e,t,i,n){const o=e.resources.length,s=e.random?Math.floor(Math.random()*o):e.index;let r;if(e.random){let C=e.resources.slice(0);for(r=[];C.length>1;){const A=Math.floor(Math.random()*C.length);r.push(C[A]),C=C.slice(0,A).concat(C.slice(A+1))}r=r.concat(C)}else r=e.resources.slice(s).concat(e.resources.slice(0,s));const a=Date.now();let l="pending",d=0,u,c=null,h=[],p=[];typeof n=="function"&&p.push(n);function g(){c&&(clearTimeout(c),c=null)}function _(){l==="pending"&&(l="aborted"),g(),h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function v(C,A){A&&(p=[]),typeof C=="function"&&p.push(C)}function f(){return{startTime:a,payload:t,status:l,queriesSent:d,queriesPending:h.length,subscribe:v,abort:_}}function y(){l="failed",p.forEach(C=>{C(void 0,u)})}function x(){h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function w(C,A,N){const $=A!=="success";switch(h=h.filter(S=>S!==C),l){case"pending":break;case"failed":if($||!e.dataAfterTimeout)return;break;default:return}if(A==="abort"){u=N,y();return}if($){u=N,h.length||(r.length?E():y());return}if(g(),x(),!e.random){const S=e.resources.indexOf(C.resource);S!==-1&&S!==e.index&&(e.index=S)}l="completed",p.forEach(S=>{S(N)})}function E(){if(l!=="pending")return;g();const C=r.shift();if(C===void 0){if(h.length){c=setTimeout(()=>{g(),l==="pending"&&(x(),y())},e.timeout);return}y();return}const A={status:"pending",resource:C,callback:(N,$)=>{w(A,N,$)}};h.push(A),d++,c=setTimeout(E,e.rotate),i(C,t,A.callback)}return setTimeout(E),f}function Ns(e){const t={...jl,...e};let i=[];function n(){i=i.filter(r=>r().status==="pending")}function o(r,a,l){const d=Rl(t,r,a,(u,c)=>{n(),l&&l(u,c)});return i.push(d),d}function s(r){return i.find(a=>r(a))||null}return{query:o,find:s,setIndex:r=>{t.index=r},getIndex:()=>t.index,cleanup:n}}function An(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Ni=Object.create(null),ei=["https://api.simplesvg.com","https://api.unisvg.com"],sn=[];for(;ei.length>0;)ei.length===1||Math.random()>.5?sn.push(ei.shift()):sn.push(ei.pop());Ni[""]=An({resources:["https://api.iconify.design"].concat(sn)});function ho(e,t){const i=An(t);return i===null?!1:(Ni[e]=i,!0)}function Pi(e){return Ni[e]}function Dl(){return Object.keys(Ni)}function po(){}const Gi=Object.create(null);function zl(e){if(!Gi[e]){const t=Pi(e);if(!t)return;const i=Ns(t),n={config:t,redundancy:i};Gi[e]=n}return Gi[e]}function Ps(e,t,i){let n,o;if(typeof e=="string"){const s=on(e);if(!s)return i(void 0,424),po;o=s.send;const r=zl(e);r&&(n=r.redundancy)}else{const s=An(e);if(s){n=Ns(s);const r=e.resources?e.resources[0]:"",a=on(r);a&&(o=a.send)}}return!n||!o?(i(void 0,424),po):n.query(t,o,i)().abort}const mo="iconify2",Me="iconify",Ms=Me+"-count",bo=Me+"-version",Ls=36e5,Fl=168,Hl=50;function rn(e,t){try{return e.getItem(t)}catch{}}function Sn(e,t,i){try{return e.setItem(t,i),!0}catch{}}function fo(e,t){try{e.removeItem(t)}catch{}}function an(e,t){return Sn(e,Ms,t.toString())}function ln(e){return parseInt(rn(e,Ms))||0}const jt={local:!0,session:!0},js={local:new Set,session:new Set};let kn=!1;function Bl(e){kn=e}let ii=typeof window>"u"?{}:window;function Rs(e){const t=e+"Storage";try{if(ii&&ii[t]&&typeof ii[t].length=="number")return ii[t]}catch{}jt[e]=!1}function Ds(e,t){const i=Rs(e);if(!i)return;const n=rn(i,bo);if(n!==mo){if(n){const a=ln(i);for(let l=0;l{const l=Me+a.toString(),d=rn(i,l);if(typeof d=="string"){try{const u=JSON.parse(d);if(typeof u=="object"&&typeof u.cached=="number"&&u.cached>o&&typeof u.provider=="string"&&typeof u.data=="object"&&typeof u.data.prefix=="string"&&t(u,a))return!0}catch{}fo(i,l)}};let r=ln(i);for(let a=r-1;a>=0;a--)s(a)||(a===r-1?(r--,an(i,r)):js[e].add(a))}function zs(){if(!kn){Bl(!0);for(const e in jt)Ds(e,t=>{const i=t.data,n=t.provider,o=i.prefix,s=Et(n,o);if(!En(s,i).length)return!1;const r=i.lastModified||-1;return s.lastModifiedCached=s.lastModifiedCached?Math.min(s.lastModifiedCached,r):r,!0})}}function Ul(e,t){const i=e.lastModifiedCached;if(i&&i>=t)return i===t;if(e.lastModifiedCached=t,i)for(const n in jt)Ds(n,o=>{const s=o.data;return o.provider!==e.provider||s.prefix!==e.prefix||s.lastModified===t});return!0}function Vl(e,t){kn||zs();function i(n){let o;if(!jt[n]||!(o=Rs(n)))return;const s=js[n];let r;if(s.size)s.delete(r=Array.from(s).shift());else if(r=ln(o),r>=Hl||!an(o,r+1))return;const a={cached:Math.floor(Date.now()/Ls),provider:e.provider,data:t};return Sn(o,Me+r.toString(),JSON.stringify(a))}t.lastModified&&!Ul(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),i("local")||i("session"))}function go(){}function Wl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Nl(e)}))}function Gl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:i,prefix:n}=e,o=e.iconsToLoad;delete e.iconsToLoad;let s;!o||!(s=on(i))||s.prepare(i,n,o).forEach(r=>{Ps(i,r,a=>{if(typeof a!="object")r.icons.forEach(l=>{e.missing.add(l)});else try{const l=En(e,a);if(!l.length)return;const d=e.pendingIcons;d&&l.forEach(u=>{d.delete(u)}),Vl(e,a)}catch(l){console.error(l)}Wl(e)})})}))}const On=(e,t)=>{const i=Ll(e,!0,Os()),n=Il(i);if(!n.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(n.loaded,n.missing,n.pending,go)}),()=>{l=!1}}const o=Object.create(null),s=[];let r,a;return n.pending.forEach(l=>{const{provider:d,prefix:u}=l;if(u===a&&d===r)return;r=d,a=u,s.push(Et(d,u));const c=o[d]||(o[d]=Object.create(null));c[u]||(c[u]=[])}),n.pending.forEach(l=>{const{provider:d,prefix:u,name:c}=l,h=Et(d,u),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(c)||(p.add(c),o[d][u].push(c))}),s.forEach(l=>{const{provider:d,prefix:u}=l;o[d][u].length&&Gl(l,o[d][u])}),t?Ml(t,n,s):go},ql=e=>new Promise((t,i)=>{const n=typeof e=="string"?Ve(e,!0):e;if(!n){i(e);return}On([n||e],o=>{if(o.length&&n){const s=Pe(n);if(s){t({...Ue,...s});return}}i(e)})});function Yl(e){try{const t=typeof e=="string"?JSON.parse(e):e;if(typeof t.body=="string")return{...t}}catch{}}function Xl(e,t){const i=typeof e=="string"?Ve(e,!0,!0):null;if(!i){const s=Yl(e);return{value:e,data:s}}const n=Pe(i);if(n!==void 0||!i.prefix)return{value:e,name:i,data:n};const o=On([i],()=>t(e,i,Pe(i)));return{value:e,name:i,loading:o}}function qi(e){return e.hasAttribute("inline")}let Fs=!1;try{Fs=navigator.vendor.indexOf("Apple")===0}catch{}function Jl(e,t){switch(t){case"svg":case"bg":case"mask":return t}return t!=="style"&&(Fs||e.indexOf("=0;){const o=e.indexOf(">",n),s=e.indexOf("",s);if(r===-1)break;i+=e.slice(o+1,s).trim(),e=e.slice(0,n).trim()+e.slice(r+1)}return{defs:i,content:e}}function tc(e,t){return e?""+e+""+t:t}function ec(e,t,i){const n=Kl(e);return tc(n.defs,t+n.content+i)}const ic=e=>e==="unset"||e==="undefined"||e==="none";function Hs(e,t){const i={...Ue,...e},n={...Es,...t},o={left:i.left,top:i.top,width:i.width,height:i.height};let s=i.body;[i,n].forEach(_=>{const v=[],f=_.hFlip,y=_.vFlip;let x=_.rotate;f?y?x+=2:(v.push("translate("+(o.width+o.left).toString()+" "+(0-o.top).toString()+")"),v.push("scale(-1 1)"),o.top=o.left=0):y&&(v.push("translate("+(0-o.left).toString()+" "+(o.height+o.top).toString()+")"),v.push("scale(1 -1)"),o.top=o.left=0);let w;switch(x<0&&(x-=Math.floor(x/4)*4),x=x%4,x){case 1:w=o.height/2+o.top,v.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:v.unshift("rotate(180 "+(o.width/2+o.left).toString()+" "+(o.height/2+o.top).toString()+")");break;case 3:w=o.width/2+o.left,v.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}x%2===1&&(o.left!==o.top&&(w=o.left,o.left=o.top,o.top=w),o.width!==o.height&&(w=o.width,o.width=o.height,o.height=w)),v.length&&(s=ec(s,'',""))});const r=n.width,a=n.height,l=o.width,d=o.height;let u,c;r===null?(c=a===null?"1em":a==="auto"?d:a,u=cn(c,l/d)):(u=r==="auto"?l:r,c=a===null?cn(u,d/l):a==="auto"?d:a);const h={},p=(_,v)=>{ic(v)||(h[_]=v.toString())};p("width",u),p("height",c);const g=[o.left,o.top,l,d];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:s}}function Tn(e,t){let i=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in t)i+=" "+n+'="'+t[n]+'"';return'"+e+""}function nc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function oc(e){return"data:image/svg+xml,"+nc(e)}function Bs(e){return'url("'+oc(e)+'")'}const sc=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let yi=sc();function rc(e){yi=e}function ac(){return yi}function lc(e,t){const i=Pi(e);if(!i)return 0;let n;if(!i.maxURL)n=0;else{let o=0;i.resources.forEach(r=>{o=Math.max(o,r.length)});const s=t+".json?icons=";n=i.maxURL-o-i.path.length-s.length}return n}function cc(e){return e===404}const dc=(e,t,i)=>{const n=[],o=lc(e,t),s="icons";let r={type:s,provider:e,prefix:t,icons:[]},a=0;return i.forEach((l,d)=>{a+=l.length+1,a>=o&&d>0&&(n.push(r),r={type:s,provider:e,prefix:t,icons:[]},a=l.length),r.icons.push(l)}),n.push(r),n};function uc(e){if(typeof e=="string"){const t=Pi(e);if(t)return t.path}return"/"}const hc=(e,t,i)=>{if(!yi){i("abort",424);return}let n=uc(t.provider);switch(t.type){case"icons":{const s=t.prefix,r=t.icons.join(","),a=new URLSearchParams({icons:r});n+=s+".json?"+a.toString();break}case"custom":{const s=t.uri;n+=s.slice(0,1)==="/"?s.slice(1):s;break}default:i("abort",400);return}let o=503;yi(e+n).then(s=>{const r=s.status;if(r!==200){setTimeout(()=>{i(cc(r)?"abort":"next",r)});return}return o=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?i("abort",s):i("next",o)});return}setTimeout(()=>{i("success",s)})}).catch(()=>{i("next",o)})},pc={prepare:dc,send:hc};function vo(e,t){switch(e){case"local":case"session":jt[e]=t;break;case"all":for(const i in jt)jt[i]=t;break}}const Yi="data-style";let Us="";function mc(e){Us=e}function yo(e,t){let i=Array.from(e.childNodes).find(n=>n.hasAttribute&&n.hasAttribute(Yi));i||(i=document.createElement("style"),i.setAttribute(Yi,Yi),e.appendChild(i)),i.textContent=":host{display:inline-block;vertical-align:"+(t?"-0.125em":"0")+"}span,svg{display:block}"+Us}function Vs(){uo("",pc),Os(!0);let e;try{e=window}catch{}if(e){if(zs(),e.IconifyPreload!==void 0){const t=e.IconifyPreload,i="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!lo(n))&&console.error(i)}catch{console.error(i)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(const i in t){const n="IconifyProviders["+i+"] is invalid.";try{const o=t[i];if(typeof o!="object"||!o||o.resources===void 0)continue;ho(i,o)||console.error(n)}catch{console.error(n)}}}}return{enableCache:t=>vo(t,!0),disableCache:t=>vo(t,!1),iconLoaded:co,iconExists:co,getIcon:Tl,listIcons:Ol,addIcon:Ts,addCollection:lo,calculateSize:cn,buildIcon:Hs,iconToHTML:Tn,svgToURL:Bs,loadIcons:On,loadIcon:ql,addAPIProvider:ho,appendCustomStyle:mc,_api:{getAPIConfig:Pi,setAPIModule:uo,sendAPIQuery:Ps,setFetch:rc,getFetch:ac,listAPIProviders:Dl}}}const dn={"background-color":"currentColor"},Ws={"background-color":"transparent"},_o={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},xo={"-webkit-mask":dn,mask:dn,background:Ws};for(const e in xo){const t=xo[e];for(const i in _o)t[e+"-"+i]=_o[i]}function wo(e){return e?e+(e.match(/^[-0-9.]+$/)?"px":""):"inherit"}function bc(e,t,i){const n=document.createElement("span");let o=e.body;o.indexOf("");const s=e.attributes,r=Tn(o,{...s,width:t.width+"",height:t.height+""}),a=Bs(r),l=n.style,d={"--svg":a,width:wo(s.width),height:wo(s.height),...i?dn:Ws};for(const u in d)l.setProperty(u,d[u]);return n}let Ae;function fc(){try{Ae=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ae=null}}function gc(e){return Ae===void 0&&fc(),Ae?Ae.createHTML(e):e}function vc(e){const t=document.createElement("span"),i=e.attributes;let n="";i.width||(n="width: inherit;"),i.height||(n+="height: inherit;"),n&&(i.style=n);const o=Tn(e.body,i);return t.innerHTML=gc(o),t.firstChild}function un(e){return Array.from(e.childNodes).find(t=>{const i=t.tagName&&t.tagName.toUpperCase();return i==="SPAN"||i==="SVG"})}function $o(e,t){const i=t.icon.data,n=t.customisations,o=Hs(i,n);n.preserveAspectRatio&&(o.attributes.preserveAspectRatio=n.preserveAspectRatio);const s=t.renderedMode;let r;switch(s){case"svg":r=vc(o);break;default:r=bc(o,{...Ue,...i},s==="mask")}const a=un(e);a?r.tagName==="SPAN"&&a.tagName===r.tagName?a.setAttribute("style",r.getAttribute("style")):e.replaceChild(r,a):e.appendChild(r)}function Co(e,t,i){const n=i&&(i.rendered?i:i.lastRender);return{rendered:!1,inline:t,icon:e,lastRender:n}}function yc(e="iconify-icon"){let t,i;try{t=window.customElements,i=window.HTMLElement}catch{return}if(!t||!i)return;const n=t.get(e);if(n)return n;const o=["icon","mode","inline","observe","width","height","rotate","flip"],s=class extends i{constructor(){super(),It(this,"_shadowRoot"),It(this,"_initialised",!1),It(this,"_state"),It(this,"_checkQueued",!1),It(this,"_connected",!1),It(this,"_observer",null),It(this,"_visible",!0);const a=this._shadowRoot=this.attachShadow({mode:"open"}),l=qi(this);yo(a,l),this._state=Co({value:""},l),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return o.slice(0)}attributeChangedCallback(a){switch(a){case"inline":{const l=qi(this),d=this._state;l!==d.inline&&(d.inline=l,yo(this._shadowRoot,l));break}case"observer":{this.observer?this.startObserver():this.stopObserver();break}default:this._queueCheck()}}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return qi(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(a){a?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const a=this._state;if(a.rendered){const l=this._shadowRoot;if(a.renderedMode==="svg")try{l.lastChild.setCurrentTime(0);return}catch{}$o(l,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,l=this.getAttribute("icon");if(l!==a.icon.value){this._iconChanged(l);return}if(!a.rendered||!this._visible)return;const d=this.getAttribute("mode"),u=ro(this);(a.attrMode!==d||wl(a.customisations,u)||!un(this._shadowRoot))&&this._renderIcon(a.icon,u,d)}_iconChanged(a){const l=Xl(a,(d,u,c)=>{const h=this._state;if(h.rendered||this.getAttribute("icon")!==d)return;const p={value:d,name:u,data:c};p.data?this._gotIconData(p):h.icon=p});l.data?this._gotIconData(l):this._state=Co(l,this._state.inline,this._state)}_forceRender(){if(!this._visible){const a=un(this._shadowRoot);a&&this._shadowRoot.removeChild(a);return}this._queueCheck()}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,ro(this),this.getAttribute("mode"))}_renderIcon(a,l,d){const u=Jl(a.data.body,d),c=this._state.inline;$o(this._shadowRoot,this._state={rendered:!0,icon:a,inline:c,customisations:l,attrMode:d,renderedMode:u})}startObserver(){if(!this._observer)try{this._observer=new IntersectionObserver(a=>{const l=a.some(d=>d.isIntersecting);l!==this._visible&&(this._visible=l,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};o.forEach(a=>{a in s.prototype||Object.defineProperty(s.prototype,a,{get:function(){return this.getAttribute(a)},set:function(l){l!==null?this.setAttribute(a,l):this.removeAttribute(a)}})});const r=Vs();for(const a in r)s[a]=s.prototype[a]=r[a];return t.define(e,s),s}yc()||Vs();var _c=Object.defineProperty,xc=Object.getOwnPropertyDescriptor,tt=(e,t,i,n)=>{for(var o=n>1?void 0:n?xc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&_c(t,i,o),o};const Gs=class extends T{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=ie(),this._tooltip=ie(),this._mouseLeave=!1,this.onClick=e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.showContextMenu=()=>{const e=this._contextMenu;e&&(e.visible=!0)},this.mouseLeave=!0}set loading(e){if(this._loading=e,e)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=e,this.icon="eos-icons:loading";else{const{disabled:t,icon:i}=this._stateBeforeLoading;this.disabled=t,this.icon=i}}get loading(){return this._loading}set mouseLeave(e){this._mouseLeave=e,e&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:e}=this._parent,{value:t}=this._tooltip;e&&t&&ms(e,t,{placement:"bottom",middleware:[es(10),ps(),hs(),us({padding:5})]}).then(i=>{const{x:n,y:o}=i;Object.assign(t.style,{left:`${n}px`,top:`${o}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const e=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},e)}click(){this.disabled||super.click()}get _contextMenu(){return this.querySelector("bim-context-menu")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.showContextMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.showContextMenu)}render(){const e=m` -
+*/const Ls=Object.freeze({left:0,top:0,width:16,height:16}),_i=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ge=Object.freeze({...Ls,..._i}),ln=Object.freeze({...Ge,body:"",hidden:!1}),kl=Object.freeze({width:null,height:null}),Rs=Object.freeze({...kl,..._i});function Tl(e,t=0){const i=e.replace(/^-?[0-9.]*/,"");function n(o){for(;o<0;)o+=4;return o%4}if(i===""){const o=parseInt(e);return isNaN(o)?0:n(o)}else if(i!==e){let o=0;switch(i){case"%":o=25;break;case"deg":o=90}if(o){let s=parseFloat(e.slice(0,e.length-i.length));return isNaN(s)?0:(s=s/o,s%1===0?n(s):0)}}return t}const Ol=/[\s,]+/;function Nl(e,t){t.split(Ol).forEach(i=>{switch(i.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}const Ds={...Rs,preserveAspectRatio:""};function bo(e){const t={...Ds},i=(n,o)=>e.getAttribute(n)||o;return t.width=i("width",null),t.height=i("height",null),t.rotate=Tl(i("rotate","")),Nl(t,i("flip","")),t.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),t}function Il(e,t){for(const i in Ds)if(e[i]!==t[i])return!0;return!1}const Se=/^[a-z0-9]+(-[a-z0-9]+)*$/,qe=(e,t,i,n="")=>{const o=e.split(":");if(e.slice(0,1)==="@"){if(o.length<2||o.length>3)return null;n=o.shift().slice(1)}if(o.length>3||!o.length)return null;if(o.length>1){const a=o.pop(),l=o.pop(),d={provider:o.length>0?o[0]:n,prefix:l,name:a};return t&&!li(d)?null:d}const s=o[0],r=s.split("-");if(r.length>1){const a={provider:n,prefix:r.shift(),name:r.join("-")};return t&&!li(a)?null:a}if(i&&n===""){const a={provider:n,prefix:"",name:s};return t&&!li(a,i)?null:a}return null},li=(e,t)=>e?!!((e.provider===""||e.provider.match(Se))&&(t&&e.prefix===""||e.prefix.match(Se))&&e.name.match(Se)):!1;function Pl(e,t){const i={};!e.hFlip!=!t.hFlip&&(i.hFlip=!0),!e.vFlip!=!t.vFlip&&(i.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(i.rotate=n),i}function fo(e,t){const i=Pl(e,t);for(const n in ln)n in _i?n in e&&!(n in i)&&(i[n]=_i[n]):n in t?i[n]=t[n]:n in e&&(i[n]=e[n]);return i}function Ml(e,t){const i=e.icons,n=e.aliases||Object.create(null),o=Object.create(null);function s(r){if(i[r])return o[r]=[];if(!(r in o)){o[r]=null;const a=n[r]&&n[r].parent,l=a&&s(a);l&&(o[r]=[a].concat(l))}return o[r]}return Object.keys(i).concat(Object.keys(n)).forEach(s),o}function Ll(e,t,i){const n=e.icons,o=e.aliases||Object.create(null);let s={};function r(a){s=fo(n[a]||o[a],s)}return r(t),i.forEach(r),fo(e,s)}function js(e,t){const i=[];if(typeof e!="object"||typeof e.icons!="object")return i;e.not_found instanceof Array&&e.not_found.forEach(o=>{t(o,null),i.push(o)});const n=Ml(e);for(const o in n){const s=n[o];s&&(t(o,Ll(e,o,s)),i.push(o))}return i}const Rl={provider:"",aliases:{},not_found:{},...Ls};function Ji(e,t){for(const i in t)if(i in e&&typeof e[i]!=typeof t[i])return!1;return!0}function zs(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Ji(e,Rl))return null;const i=t.icons;for(const o in i){const s=i[o];if(!o.match(Se)||typeof s.body!="string"||!Ji(s,ln))return null}const n=t.aliases||Object.create(null);for(const o in n){const s=n[o],r=s.parent;if(!o.match(Se)||typeof r!="string"||!i[r]&&!n[r]||!Ji(s,ln))return null}return t}const xi=Object.create(null);function Dl(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function At(e,t){const i=xi[e]||(xi[e]=Object.create(null));return i[t]||(i[t]=Dl(e,t))}function Nn(e,t){return zs(t)?js(t,(i,n)=>{n?e.icons[i]=n:e.missing.add(i)}):[]}function jl(e,t,i){try{if(typeof i.body=="string")return e.icons[t]={...i},!0}catch{}return!1}function zl(e,t){let i=[];return(typeof e=="string"?[e]:Object.keys(xi)).forEach(n=>{(typeof n=="string"&&typeof t=="string"?[t]:Object.keys(xi[n]||{})).forEach(o=>{const s=At(n,o);i=i.concat(Object.keys(s.icons).map(r=>(n!==""?"@"+n+":":"")+o+":"+r))})}),i}let Re=!1;function Fs(e){return typeof e=="boolean"&&(Re=e),Re}function De(e){const t=typeof e=="string"?qe(e,!0,Re):e;if(t){const i=At(t.provider,t.prefix),n=t.name;return i.icons[n]||(i.missing.has(n)?null:void 0)}}function Hs(e,t){const i=qe(e,!0,Re);if(!i)return!1;const n=At(i.provider,i.prefix);return jl(n,i.name,t)}function go(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Re&&!t&&!e.prefix){let o=!1;return zs(e)&&(e.prefix="",js(e,(s,r)=>{r&&Hs(s,r)&&(o=!0)})),o}const i=e.prefix;if(!li({provider:t,prefix:i,name:"a"}))return!1;const n=At(t,i);return!!Nn(n,e)}function vo(e){return!!De(e)}function Fl(e){const t=De(e);return t?{...Ge,...t}:null}function Hl(e){const t={loaded:[],missing:[],pending:[]},i=Object.create(null);e.sort((o,s)=>o.provider!==s.provider?o.provider.localeCompare(s.provider):o.prefix!==s.prefix?o.prefix.localeCompare(s.prefix):o.name.localeCompare(s.name));let n={provider:"",prefix:"",name:""};return e.forEach(o=>{if(n.name===o.name&&n.prefix===o.prefix&&n.provider===o.provider)return;n=o;const s=o.provider,r=o.prefix,a=o.name,l=i[s]||(i[s]=Object.create(null)),d=l[r]||(l[r]=At(s,r));let u;a in d.icons?u=t.loaded:r===""||d.missing.has(a)?u=t.missing:u=t.pending;const c={provider:s,prefix:r,name:a};u.push(c)}),t}function Bs(e,t){e.forEach(i=>{const n=i.loaderCallbacks;n&&(i.loaderCallbacks=n.filter(o=>o.id!==t))})}function Bl(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let i=!1;const n=e.provider,o=e.prefix;t.forEach(s=>{const r=s.icons,a=r.pending.length;r.pending=r.pending.filter(l=>{if(l.prefix!==o)return!0;const d=l.name;if(e.icons[d])r.loaded.push({provider:n,prefix:o,name:d});else if(e.missing.has(d))r.missing.push({provider:n,prefix:o,name:d});else return i=!0,!0;return!1}),r.pending.length!==a&&(i||Bs([e],s.id),s.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),s.abort))})}))}let Ul=0;function Vl(e,t,i){const n=Ul++,o=Bs.bind(null,i,n);if(!t.pending.length)return o;const s={id:n,icons:t,callback:e,abort:o};return i.forEach(r=>{(r.loaderCallbacks||(r.loaderCallbacks=[])).push(s)}),o}const cn=Object.create(null);function yo(e,t){cn[e]=t}function dn(e){return cn[e]||cn[""]}function Wl(e,t=!0,i=!1){const n=[];return e.forEach(o=>{const s=typeof o=="string"?qe(o,t,i):o;s&&n.push(s)}),n}var Gl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ql(e,t,i,n){const o=e.resources.length,s=e.random?Math.floor(Math.random()*o):e.index;let r;if(e.random){let C=e.resources.slice(0);for(r=[];C.length>1;){const N=Math.floor(Math.random()*C.length);r.push(C[N]),C=C.slice(0,N).concat(C.slice(N+1))}r=r.concat(C)}else r=e.resources.slice(s).concat(e.resources.slice(0,s));const a=Date.now();let l="pending",d=0,u,c=null,h=[],p=[];typeof n=="function"&&p.push(n);function b(){c&&(clearTimeout(c),c=null)}function v(){l==="pending"&&(l="aborted"),b(),h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function y(C,N){N&&(p=[]),typeof C=="function"&&p.push(C)}function g(){return{startTime:a,payload:t,status:l,queriesSent:d,queriesPending:h.length,subscribe:y,abort:v}}function _(){l="failed",p.forEach(C=>{C(void 0,u)})}function x(){h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function w(C,N,L){const k=N!=="success";switch(h=h.filter(S=>S!==C),l){case"pending":break;case"failed":if(k||!e.dataAfterTimeout)return;break;default:return}if(N==="abort"){u=L,_();return}if(k){u=L,h.length||(r.length?A():_());return}if(b(),x(),!e.random){const S=e.resources.indexOf(C.resource);S!==-1&&S!==e.index&&(e.index=S)}l="completed",p.forEach(S=>{S(L)})}function A(){if(l!=="pending")return;b();const C=r.shift();if(C===void 0){if(h.length){c=setTimeout(()=>{b(),l==="pending"&&(x(),_())},e.timeout);return}_();return}const N={status:"pending",resource:C,callback:(L,k)=>{w(N,L,k)}};h.push(N),d++,c=setTimeout(A,e.rotate),i(C,t,N.callback)}return setTimeout(A),g}function Us(e){const t={...Gl,...e};let i=[];function n(){i=i.filter(r=>r().status==="pending")}function o(r,a,l){const d=ql(t,r,a,(u,c)=>{n(),l&&l(u,c)});return i.push(d),d}function s(r){return i.find(a=>r(a))||null}return{query:o,find:s,setIndex:r=>{t.index=r},getIndex:()=>t.index,cleanup:n}}function In(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Di=Object.create(null),oi=["https://api.simplesvg.com","https://api.unisvg.com"],un=[];for(;oi.length>0;)oi.length===1||Math.random()>.5?un.push(oi.shift()):un.push(oi.pop());Di[""]=In({resources:["https://api.iconify.design"].concat(un)});function _o(e,t){const i=In(t);return i===null?!1:(Di[e]=i,!0)}function ji(e){return Di[e]}function Yl(){return Object.keys(Di)}function xo(){}const Qi=Object.create(null);function Xl(e){if(!Qi[e]){const t=ji(e);if(!t)return;const i=Us(t),n={config:t,redundancy:i};Qi[e]=n}return Qi[e]}function Vs(e,t,i){let n,o;if(typeof e=="string"){const s=dn(e);if(!s)return i(void 0,424),xo;o=s.send;const r=Xl(e);r&&(n=r.redundancy)}else{const s=In(e);if(s){n=Us(s);const r=e.resources?e.resources[0]:"",a=dn(r);a&&(o=a.send)}}return!n||!o?(i(void 0,424),xo):n.query(t,o,i)().abort}const wo="iconify2",je="iconify",Ws=je+"-count",$o=je+"-version",Gs=36e5,Jl=168,Ql=50;function hn(e,t){try{return e.getItem(t)}catch{}}function Pn(e,t,i){try{return e.setItem(t,i),!0}catch{}}function Co(e,t){try{e.removeItem(t)}catch{}}function pn(e,t){return Pn(e,Ws,t.toString())}function mn(e){return parseInt(hn(e,Ws))||0}const Rt={local:!0,session:!0},qs={local:new Set,session:new Set};let Mn=!1;function Kl(e){Mn=e}let si=typeof window>"u"?{}:window;function Ys(e){const t=e+"Storage";try{if(si&&si[t]&&typeof si[t].length=="number")return si[t]}catch{}Rt[e]=!1}function Xs(e,t){const i=Ys(e);if(!i)return;const n=hn(i,$o);if(n!==wo){if(n){const a=mn(i);for(let l=0;l{const l=je+a.toString(),d=hn(i,l);if(typeof d=="string"){try{const u=JSON.parse(d);if(typeof u=="object"&&typeof u.cached=="number"&&u.cached>o&&typeof u.provider=="string"&&typeof u.data=="object"&&typeof u.data.prefix=="string"&&t(u,a))return!0}catch{}Co(i,l)}};let r=mn(i);for(let a=r-1;a>=0;a--)s(a)||(a===r-1?(r--,pn(i,r)):qs[e].add(a))}function Js(){if(!Mn){Kl(!0);for(const e in Rt)Xs(e,t=>{const i=t.data,n=t.provider,o=i.prefix,s=At(n,o);if(!Nn(s,i).length)return!1;const r=i.lastModified||-1;return s.lastModifiedCached=s.lastModifiedCached?Math.min(s.lastModifiedCached,r):r,!0})}}function Zl(e,t){const i=e.lastModifiedCached;if(i&&i>=t)return i===t;if(e.lastModifiedCached=t,i)for(const n in Rt)Xs(n,o=>{const s=o.data;return o.provider!==e.provider||s.prefix!==e.prefix||s.lastModified===t});return!0}function tc(e,t){Mn||Js();function i(n){let o;if(!Rt[n]||!(o=Ys(n)))return;const s=qs[n];let r;if(s.size)s.delete(r=Array.from(s).shift());else if(r=mn(o),r>=Ql||!pn(o,r+1))return;const a={cached:Math.floor(Date.now()/Gs),provider:e.provider,data:t};return Pn(o,je+r.toString(),JSON.stringify(a))}t.lastModified&&!Zl(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),i("local")||i("session"))}function Ao(){}function ec(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Bl(e)}))}function ic(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:i,prefix:n}=e,o=e.iconsToLoad;delete e.iconsToLoad;let s;!o||!(s=dn(i))||s.prepare(i,n,o).forEach(r=>{Vs(i,r,a=>{if(typeof a!="object")r.icons.forEach(l=>{e.missing.add(l)});else try{const l=Nn(e,a);if(!l.length)return;const d=e.pendingIcons;d&&l.forEach(u=>{d.delete(u)}),tc(e,a)}catch(l){console.error(l)}ec(e)})})}))}const Ln=(e,t)=>{const i=Wl(e,!0,Fs()),n=Hl(i);if(!n.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(n.loaded,n.missing,n.pending,Ao)}),()=>{l=!1}}const o=Object.create(null),s=[];let r,a;return n.pending.forEach(l=>{const{provider:d,prefix:u}=l;if(u===a&&d===r)return;r=d,a=u,s.push(At(d,u));const c=o[d]||(o[d]=Object.create(null));c[u]||(c[u]=[])}),n.pending.forEach(l=>{const{provider:d,prefix:u,name:c}=l,h=At(d,u),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(c)||(p.add(c),o[d][u].push(c))}),s.forEach(l=>{const{provider:d,prefix:u}=l;o[d][u].length&&ic(l,o[d][u])}),t?Vl(t,n,s):Ao},nc=e=>new Promise((t,i)=>{const n=typeof e=="string"?qe(e,!0):e;if(!n){i(e);return}Ln([n||e],o=>{if(o.length&&n){const s=De(n);if(s){t({...Ge,...s});return}}i(e)})});function oc(e){try{const t=typeof e=="string"?JSON.parse(e):e;if(typeof t.body=="string")return{...t}}catch{}}function sc(e,t){const i=typeof e=="string"?qe(e,!0,!0):null;if(!i){const s=oc(e);return{value:e,data:s}}const n=De(i);if(n!==void 0||!i.prefix)return{value:e,name:i,data:n};const o=Ln([i],()=>t(e,i,De(i)));return{value:e,name:i,loading:o}}function Ki(e){return e.hasAttribute("inline")}let Qs=!1;try{Qs=navigator.vendor.indexOf("Apple")===0}catch{}function rc(e,t){switch(t){case"svg":case"bg":case"mask":return t}return t!=="style"&&(Qs||e.indexOf("=0;){const o=e.indexOf(">",n),s=e.indexOf("",s);if(r===-1)break;i+=e.slice(o+1,s).trim(),e=e.slice(0,n).trim()+e.slice(r+1)}return{defs:i,content:e}}function dc(e,t){return e?""+e+""+t:t}function uc(e,t,i){const n=cc(e);return dc(n.defs,t+n.content+i)}const hc=e=>e==="unset"||e==="undefined"||e==="none";function Ks(e,t){const i={...Ge,...e},n={...Rs,...t},o={left:i.left,top:i.top,width:i.width,height:i.height};let s=i.body;[i,n].forEach(v=>{const y=[],g=v.hFlip,_=v.vFlip;let x=v.rotate;g?_?x+=2:(y.push("translate("+(o.width+o.left).toString()+" "+(0-o.top).toString()+")"),y.push("scale(-1 1)"),o.top=o.left=0):_&&(y.push("translate("+(0-o.left).toString()+" "+(o.height+o.top).toString()+")"),y.push("scale(1 -1)"),o.top=o.left=0);let w;switch(x<0&&(x-=Math.floor(x/4)*4),x=x%4,x){case 1:w=o.height/2+o.top,y.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:y.unshift("rotate(180 "+(o.width/2+o.left).toString()+" "+(o.height/2+o.top).toString()+")");break;case 3:w=o.width/2+o.left,y.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}x%2===1&&(o.left!==o.top&&(w=o.left,o.left=o.top,o.top=w),o.width!==o.height&&(w=o.width,o.width=o.height,o.height=w)),y.length&&(s=uc(s,'',""))});const r=n.width,a=n.height,l=o.width,d=o.height;let u,c;r===null?(c=a===null?"1em":a==="auto"?d:a,u=bn(c,l/d)):(u=r==="auto"?l:r,c=a===null?bn(u,d/l):a==="auto"?d:a);const h={},p=(v,y)=>{hc(y)||(h[v]=y.toString())};p("width",u),p("height",c);const b=[o.left,o.top,l,d];return h.viewBox=b.join(" "),{attributes:h,viewBox:b,body:s}}function Rn(e,t){let i=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in t)i+=" "+n+'="'+t[n]+'"';return'"+e+""}function pc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function mc(e){return"data:image/svg+xml,"+pc(e)}function Zs(e){return'url("'+mc(e)+'")'}const bc=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let wi=bc();function fc(e){wi=e}function gc(){return wi}function vc(e,t){const i=ji(e);if(!i)return 0;let n;if(!i.maxURL)n=0;else{let o=0;i.resources.forEach(r=>{o=Math.max(o,r.length)});const s=t+".json?icons=";n=i.maxURL-o-i.path.length-s.length}return n}function yc(e){return e===404}const _c=(e,t,i)=>{const n=[],o=vc(e,t),s="icons";let r={type:s,provider:e,prefix:t,icons:[]},a=0;return i.forEach((l,d)=>{a+=l.length+1,a>=o&&d>0&&(n.push(r),r={type:s,provider:e,prefix:t,icons:[]},a=l.length),r.icons.push(l)}),n.push(r),n};function xc(e){if(typeof e=="string"){const t=ji(e);if(t)return t.path}return"/"}const wc=(e,t,i)=>{if(!wi){i("abort",424);return}let n=xc(t.provider);switch(t.type){case"icons":{const s=t.prefix,r=t.icons.join(","),a=new URLSearchParams({icons:r});n+=s+".json?"+a.toString();break}case"custom":{const s=t.uri;n+=s.slice(0,1)==="/"?s.slice(1):s;break}default:i("abort",400);return}let o=503;wi(e+n).then(s=>{const r=s.status;if(r!==200){setTimeout(()=>{i(yc(r)?"abort":"next",r)});return}return o=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?i("abort",s):i("next",o)});return}setTimeout(()=>{i("success",s)})}).catch(()=>{i("next",o)})},$c={prepare:_c,send:wc};function Eo(e,t){switch(e){case"local":case"session":Rt[e]=t;break;case"all":for(const i in Rt)Rt[i]=t;break}}const Zi="data-style";let tr="";function Cc(e){tr=e}function So(e,t){let i=Array.from(e.childNodes).find(n=>n.hasAttribute&&n.hasAttribute(Zi));i||(i=document.createElement("style"),i.setAttribute(Zi,Zi),e.appendChild(i)),i.textContent=":host{display:inline-block;vertical-align:"+(t?"-0.125em":"0")+"}span,svg{display:block}"+tr}function er(){yo("",$c),Fs(!0);let e;try{e=window}catch{}if(e){if(Js(),e.IconifyPreload!==void 0){const t=e.IconifyPreload,i="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!go(n))&&console.error(i)}catch{console.error(i)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(const i in t){const n="IconifyProviders["+i+"] is invalid.";try{const o=t[i];if(typeof o!="object"||!o||o.resources===void 0)continue;_o(i,o)||console.error(n)}catch{console.error(n)}}}}return{enableCache:t=>Eo(t,!0),disableCache:t=>Eo(t,!1),iconLoaded:vo,iconExists:vo,getIcon:Fl,listIcons:zl,addIcon:Hs,addCollection:go,calculateSize:bn,buildIcon:Ks,iconToHTML:Rn,svgToURL:Zs,loadIcons:Ln,loadIcon:nc,addAPIProvider:_o,appendCustomStyle:Cc,_api:{getAPIConfig:ji,setAPIModule:yo,sendAPIQuery:Vs,setFetch:fc,getFetch:gc,listAPIProviders:Yl}}}const fn={"background-color":"currentColor"},ir={"background-color":"transparent"},ko={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},To={"-webkit-mask":fn,mask:fn,background:ir};for(const e in To){const t=To[e];for(const i in ko)t[e+"-"+i]=ko[i]}function Oo(e){return e?e+(e.match(/^[-0-9.]+$/)?"px":""):"inherit"}function Ac(e,t,i){const n=document.createElement("span");let o=e.body;o.indexOf("");const s=e.attributes,r=Rn(o,{...s,width:t.width+"",height:t.height+""}),a=Zs(r),l=n.style,d={"--svg":a,width:Oo(s.width),height:Oo(s.height),...i?fn:ir};for(const u in d)l.setProperty(u,d[u]);return n}let ke;function Ec(){try{ke=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{ke=null}}function Sc(e){return ke===void 0&&Ec(),ke?ke.createHTML(e):e}function kc(e){const t=document.createElement("span"),i=e.attributes;let n="";i.width||(n="width: inherit;"),i.height||(n+="height: inherit;"),n&&(i.style=n);const o=Rn(e.body,i);return t.innerHTML=Sc(o),t.firstChild}function gn(e){return Array.from(e.childNodes).find(t=>{const i=t.tagName&&t.tagName.toUpperCase();return i==="SPAN"||i==="SVG"})}function No(e,t){const i=t.icon.data,n=t.customisations,o=Ks(i,n);n.preserveAspectRatio&&(o.attributes.preserveAspectRatio=n.preserveAspectRatio);const s=t.renderedMode;let r;switch(s){case"svg":r=kc(o);break;default:r=Ac(o,{...Ge,...i},s==="mask")}const a=gn(e);a?r.tagName==="SPAN"&&a.tagName===r.tagName?a.setAttribute("style",r.getAttribute("style")):e.replaceChild(r,a):e.appendChild(r)}function Io(e,t,i){const n=i&&(i.rendered?i:i.lastRender);return{rendered:!1,inline:t,icon:e,lastRender:n}}function Tc(e="iconify-icon"){let t,i;try{t=window.customElements,i=window.HTMLElement}catch{return}if(!t||!i)return;const n=t.get(e);if(n)return n;const o=["icon","mode","inline","observe","width","height","rotate","flip"],s=class extends i{constructor(){super(),Nt(this,"_shadowRoot"),Nt(this,"_initialised",!1),Nt(this,"_state"),Nt(this,"_checkQueued",!1),Nt(this,"_connected",!1),Nt(this,"_observer",null),Nt(this,"_visible",!0);const a=this._shadowRoot=this.attachShadow({mode:"open"}),l=Ki(this);So(a,l),this._state=Io({value:""},l),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return o.slice(0)}attributeChangedCallback(a){switch(a){case"inline":{const l=Ki(this),d=this._state;l!==d.inline&&(d.inline=l,So(this._shadowRoot,l));break}case"observer":{this.observer?this.startObserver():this.stopObserver();break}default:this._queueCheck()}}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return Ki(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(a){a?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const a=this._state;if(a.rendered){const l=this._shadowRoot;if(a.renderedMode==="svg")try{l.lastChild.setCurrentTime(0);return}catch{}No(l,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,l=this.getAttribute("icon");if(l!==a.icon.value){this._iconChanged(l);return}if(!a.rendered||!this._visible)return;const d=this.getAttribute("mode"),u=bo(this);(a.attrMode!==d||Il(a.customisations,u)||!gn(this._shadowRoot))&&this._renderIcon(a.icon,u,d)}_iconChanged(a){const l=sc(a,(d,u,c)=>{const h=this._state;if(h.rendered||this.getAttribute("icon")!==d)return;const p={value:d,name:u,data:c};p.data?this._gotIconData(p):h.icon=p});l.data?this._gotIconData(l):this._state=Io(l,this._state.inline,this._state)}_forceRender(){if(!this._visible){const a=gn(this._shadowRoot);a&&this._shadowRoot.removeChild(a);return}this._queueCheck()}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,bo(this),this.getAttribute("mode"))}_renderIcon(a,l,d){const u=rc(a.data.body,d),c=this._state.inline;No(this._shadowRoot,this._state={rendered:!0,icon:a,inline:c,customisations:l,attrMode:d,renderedMode:u})}startObserver(){if(!this._observer)try{this._observer=new IntersectionObserver(a=>{const l=a.some(d=>d.isIntersecting);l!==this._visible&&(this._visible=l,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};o.forEach(a=>{a in s.prototype||Object.defineProperty(s.prototype,a,{get:function(){return this.getAttribute(a)},set:function(l){l!==null?this.setAttribute(a,l):this.removeAttribute(a)}})});const r=er();for(const a in r)s[a]=s.prototype[a]=r[a];return t.define(e,s),s}Tc()||er();const Oc=I` + ::-webkit-scrollbar { + width: 0.4rem; + height: 0.4rem; + overflow: hidden; + } + + ::-webkit-scrollbar-thumb { + border-radius: 0.25rem; + background-color: var( + --bim-scrollbar--c, + color-mix(in lab, var(--bim-ui_main-base), white 15%) + ); + } + + ::-webkit-scrollbar-track { + background-color: var(--bim-scrollbar--bgc, var(--bim-ui_bg-base)); + } +`,Nc=I` + :root { + /* Grayscale Colors */ + --bim-ui_gray-0: hsl(210 10% 5%); + --bim-ui_gray-1: hsl(210 10% 10%); + --bim-ui_gray-2: hsl(210 10% 20%); + --bim-ui_gray-3: hsl(210 10% 30%); + --bim-ui_gray-4: hsl(210 10% 40%); + --bim-ui_gray-6: hsl(210 10% 60%); + --bim-ui_gray-7: hsl(210 10% 70%); + --bim-ui_gray-8: hsl(210 10% 80%); + --bim-ui_gray-9: hsl(210 10% 90%); + --bim-ui_gray-10: hsl(210 10% 95%); + + /* Brand Colors */ + --bim-ui_main-base: #6528d7; + --bim-ui_accent-base: #bcf124; + + /* Brand Colors Contrasts */ + --bim-ui_main-contrast: var(--bim-ui_gray-10); + --bim-ui_accent-contrast: var(--bim-ui_gray-0); + + /* Sizes */ + --bim-ui_size-4xs: 0.375rem; + --bim-ui_size-3xs: 0.5rem; + --bim-ui_size-2xs: 0.625rem; + --bim-ui_size-xs: 0.75rem; + --bim-ui_size-sm: 0.875rem; + --bim-ui_size-base: 1rem; + --bim-ui_size-lg: 1.125rem; + --bim-ui_size-xl: 1.25rem; + --bim-ui_size-2xl: 1.375rem; + --bim-ui_size-3xl: 1.5rem; + --bim-ui_size-4xl: 1.625rem; + --bim-ui_size-5xl: 1.75rem; + --bim-ui_size-6xl: 1.875rem; + --bim-ui_size-7xl: 2rem; + --bim-ui_size-8xl: 2.125rem; + --bim-ui_size-9xl: 2.25rem; + } + + /* Background Colors */ + @media (prefers-color-scheme: dark) { + :root { + --bim-ui_bg-base: var(--bim-ui_gray-0); + --bim-ui_bg-contrast-10: var(--bim-ui_gray-1); + --bim-ui_bg-contrast-20: var(--bim-ui_gray-2); + --bim-ui_bg-contrast-30: var(--bim-ui_gray-3); + --bim-ui_bg-contrast-40: var(--bim-ui_gray-4); + --bim-ui_bg-contrast-60: var(--bim-ui_gray-6); + --bim-ui_bg-contrast-80: var(--bim-ui_gray-8); + --bim-ui_bg-contrast-100: var(--bim-ui_gray-10); + } + } + + @media (prefers-color-scheme: light) { + :root { + --bim-ui_bg-base: var(--bim-ui_gray-10); + --bim-ui_bg-contrast-10: var(--bim-ui_gray-9); + --bim-ui_bg-contrast-20: var(--bim-ui_gray-8); + --bim-ui_bg-contrast-30: var(--bim-ui_gray-7); + --bim-ui_bg-contrast-40: var(--bim-ui_gray-6); + --bim-ui_bg-contrast-60: var(--bim-ui_gray-4); + --bim-ui_bg-contrast-80: var(--bim-ui_gray-2); + --bim-ui_bg-contrast-100: var(--bim-ui_gray-0); + --bim-ui_accent-base: #6528d7; + } + } + + html.bim-ui-dark { + --bim-ui_bg-base: var(--bim-ui_gray-0); + --bim-ui_bg-contrast-10: var(--bim-ui_gray-1); + --bim-ui_bg-contrast-20: var(--bim-ui_gray-2); + --bim-ui_bg-contrast-30: var(--bim-ui_gray-3); + --bim-ui_bg-contrast-40: var(--bim-ui_gray-4); + --bim-ui_bg-contrast-60: var(--bim-ui_gray-6); + --bim-ui_bg-contrast-80: var(--bim-ui_gray-8); + --bim-ui_bg-contrast-100: var(--bim-ui_gray-10); + } + + html.bim-ui-light { + --bim-ui_bg-base: var(--bim-ui_gray-10); + --bim-ui_bg-contrast-10: var(--bim-ui_gray-9); + --bim-ui_bg-contrast-20: var(--bim-ui_gray-8); + --bim-ui_bg-contrast-30: var(--bim-ui_gray-7); + --bim-ui_bg-contrast-40: var(--bim-ui_gray-6); + --bim-ui_bg-contrast-60: var(--bim-ui_gray-4); + --bim-ui_bg-contrast-80: var(--bim-ui_gray-2); + --bim-ui_bg-contrast-100: var(--bim-ui_gray-0); + --bim-ui_accent-base: #6528d7; + } + + [data-context-dialog]::backdrop { + background-color: transparent; + } +`,St={scrollbar:Oc,globalStyles:Nc},nr=class T{static set config(t){this._config={...T._config,...t}}static get config(){return T._config}static addGlobalStyles(){let t=document.querySelector("style[id='bim-ui']");if(t)return;t=document.createElement("style"),t.id="bim-ui",t.textContent=St.globalStyles.cssText;const i=document.head.firstChild;i?document.head.insertBefore(t,i):document.head.append(t)}static defineCustomElement(t,i){customElements.get(t)||customElements.define(t,i)}static registerComponents(){T.init()}static init(){T.addGlobalStyles(),T.defineCustomElement("bim-button",Rc),T.defineCustomElement("bim-checkbox",ce),T.defineCustomElement("bim-color-input",Ut),T.defineCustomElement("bim-context-menu",vn),T.defineCustomElement("bim-dropdown",bt),T.defineCustomElement("bim-grid",jn),T.defineCustomElement("bim-icon",Wc),T.defineCustomElement("bim-input",Xe),T.defineCustomElement("bim-label",ue),T.defineCustomElement("bim-number-input",Y),T.defineCustomElement("bim-option",H),T.defineCustomElement("bim-panel",Vt),T.defineCustomElement("bim-panel-section",he),T.defineCustomElement("bim-selector",pe),T.defineCustomElement("bim-table",tt),T.defineCustomElement("bim-tabs",Gt),T.defineCustomElement("bim-tab",J),T.defineCustomElement("bim-table-cell",vr),T.defineCustomElement("bim-table-children",_r),T.defineCustomElement("bim-table-group",wr),T.defineCustomElement("bim-table-row",Wt),T.defineCustomElement("bim-text-input",dt),T.defineCustomElement("bim-toolbar",Vi),T.defineCustomElement("bim-toolbar-group",Bi),T.defineCustomElement("bim-toolbar-section",fe),T.defineCustomElement("bim-viewport",Pr)}static newRandomId(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let n=0;n<10;n++){const o=Math.floor(Math.random()*t.length);i+=t.charAt(o)}return i}};nr._config={sectionLabelOnVerticalToolbar:!1};let Te=nr;class V extends O{constructor(){super(...arguments),this._lazyLoadObserver=null,this._visibleElements=[],this.ELEMENTS_BEFORE_OBSERVER=20,this.useObserver=!1,this.elements=new Set,this.observe=t=>{if(!this.useObserver)return;for(const n of t)this.elements.add(n);const i=t.slice(this.ELEMENTS_BEFORE_OBSERVER);for(const n of i)n.remove();this.observeLastElement()}}set visibleElements(t){this._visibleElements=this.useObserver?t:[],this.requestUpdate()}get visibleElements(){return this._visibleElements}getLazyObserver(){if(!this.useObserver)return null;if(this._lazyLoadObserver)return this._lazyLoadObserver;const t=new IntersectionObserver(i=>{const n=i[0];if(!n.isIntersecting)return;const o=n.target;t.unobserve(o);const s=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length,r=[...this.elements][s];r&&(this.visibleElements=[...this.visibleElements,r],t.observe(r))},{threshold:.5});return t}observeLastElement(){const t=this.getLazyObserver();if(!t)return;const i=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length-1,n=[...this.elements][i];n&&t.observe(n)}resetVisibleElements(){const t=this.getLazyObserver();if(t){for(const i of this.elements)t.unobserve(i);this.visibleElements=[],this.observeLastElement()}}static create(t,i){const n=document.createDocumentFragment();if(t.length===0)return ee(t(),n),n.firstElementChild;if(!i)throw new Error("UIComponent: Initial state is required for statefull components.");let o=i;const s=t,r=l=>(o={...o,...l},ee(s(o),n),o);r(i);const a=()=>o;return[n.firstElementChild,r,a]}}var Ic=Object.defineProperty,Pc=Object.getOwnPropertyDescriptor,or=(e,t,i,n)=>{for(var o=Pc(t,i),s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Ic(t,i,o),o},F;const Dn=(F=class extends O{constructor(){super(...arguments),this._previousContainer=null,this._visible=!1}get placement(){return this._placement}set placement(e){this._placement=e,this.updatePosition()}static removeMenus(){for(const e of F.menus)e instanceof F&&(e.visible=!1);F.dialog.close(),F.dialog.remove()}get visible(){return this._visible}set visible(e){var t;this._visible=e,e?(F.dialog.parentElement||document.body.append(F.dialog),this._previousContainer=this.parentElement,F.dialog.style.top=`${window.scrollY||document.documentElement.scrollTop}px`,F.dialog.append(this),F.dialog.showModal(),this.updatePosition(),this.dispatchEvent(new Event("visible"))):((t=this._previousContainer)==null||t.append(this),this._previousContainer=null,this.dispatchEvent(new Event("hidden")))}async updatePosition(){if(!(this.visible&&this._previousContainer))return;const e=this.placement??"right",t=await As(this._previousContainer,this,{placement:e,middleware:[hs(10),Cs(),$s(),ws({padding:5})]}),{x:i,y:n}=t;this.style.left=`${i}px`,this.style.top=`${n}px`}connectedCallback(){super.connectedCallback(),F.menus.push(this)}render(){return m` `}},F.styles=[St.scrollbar,I` + :host { + pointer-events: auto; + position: absolute; + top: 0; + left: 0; + z-index: 999; + overflow: auto; + max-height: 20rem; + min-width: 3rem; + flex-direction: column; + box-shadow: 1px 2px 8px 2px rgba(0, 0, 0, 0.15); + padding: 0.5rem; + border-radius: var(--bim-ui_size-4xs); + display: flex; + background-color: var( + --bim-context-menu--bgc, + var(--bim-ui_bg-contrast-20) + ); + } + + :host(:not([visible])) { + display: none; + } + `],F.dialog=V.create(()=>m` {e.target===F.dialog&&F.removeMenus()}} + @cancel=${()=>F.removeMenus()} + data-context-dialog + style=" + width: 0; + height: 0; + position: relative; + padding: 0; + border: none; + outline: none; + margin: none; + overflow: visible; + background-color: transparent; + " + >`),F.menus=[],F);or([f({type:String,reflect:!0})],Dn.prototype,"placement");or([f({type:Boolean,reflect:!0})],Dn.prototype,"visible");let vn=Dn;var Mc=Object.defineProperty,Lc=Object.getOwnPropertyDescriptor,it=(e,t,i,n)=>{for(var o=n>1?void 0:n?Lc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Mc(t,i,o),o},we;const K=(we=class extends O{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=ie(),this._tooltip=ie(),this._mouseLeave=!1,this.onClick=e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.showContextMenu=()=>{const e=this._contextMenu;if(e){const t=this.getAttribute("data-context-group");t&&e.setAttribute("data-context-group",t),this.closeNestedContexts();const i=Te.newRandomId();for(const n of e.children)n instanceof we&&n.setAttribute("data-context-group",i);e.visible=!0}},this.mouseLeave=!0}set loading(e){if(this._loading=e,e)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=e,this.icon="eos-icons:loading";else{const{disabled:t,icon:i}=this._stateBeforeLoading;this.disabled=t,this.icon=i}}get loading(){return this._loading}set mouseLeave(e){this._mouseLeave=e,e&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:e}=this._parent,{value:t}=this._tooltip;e&&t&&As(e,t,{placement:"bottom",middleware:[hs(10),Cs(),$s(),ws({padding:5})]}).then(i=>{const{x:n,y:o}=i;Object.assign(t.style,{left:`${n}px`,top:`${o}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const e=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},e)}closeNestedContexts(){const e=this.getAttribute("data-context-group");if(e)for(const t of vn.dialog.children){const i=t.getAttribute("data-context-group");if(t instanceof vn&&i===e){t.visible=!1,t.removeAttribute("data-context-group");for(const n of t.children)n instanceof we&&(n.closeNestedContexts(),n.removeAttribute("data-context-group"))}}}click(){this.disabled||super.click()}get _contextMenu(){return this.querySelector("bim-context-menu")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.showContextMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.showContextMenu)}render(){const e=m` +
${this.tooltipTitle?m`

${this.tooltipTitle}

`:null} ${this.tooltipText?m`

${this.tooltipText}

`:null}
- `;return m` -
+ `,t=m` + + + `;return m` +
${this.label||this.icon?m`
${this.label}${this.label}${this.label&&this._contextMenu?t:null}
`:null} ${this.tooltipTitle||this.tooltipText?e:null}
- `}};Gs.styles=I` + `}},we.styles=I` :host { --bim-label--c: var(--bim-ui_bg-contrast-100, white); display: block; @@ -153,8 +314,8 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m } :host([disabled]) { - --bim-label--c: var(--bim-ui_bg-contrast-80); - background-color: gray; + --bim-label--c: var(--bim-ui_bg-contrast-80) !important; + background-color: gray !important; } ::slotted(bim-button) { @@ -187,7 +348,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m :host(:not([tooltip-visible])) .tooltip { display: none; } - `;let Q=Gs;tt([b({type:String,reflect:!0})],Q.prototype,"label",2);tt([b({type:Boolean,attribute:"label-hidden",reflect:!0})],Q.prototype,"labelHidden",2);tt([b({type:Boolean,reflect:!0})],Q.prototype,"active",2);tt([b({type:Boolean,reflect:!0,attribute:"disabled"})],Q.prototype,"disabled",2);tt([b({type:String,reflect:!0})],Q.prototype,"icon",2);tt([b({type:Boolean,reflect:!0})],Q.prototype,"vertical",2);tt([b({type:Number,attribute:"tooltip-time",reflect:!0})],Q.prototype,"tooltipTime",2);tt([b({type:Boolean,attribute:"tooltip-visible",reflect:!0})],Q.prototype,"tooltipVisible",2);tt([b({type:String,attribute:"tooltip-title",reflect:!0})],Q.prototype,"tooltipTitle",2);tt([b({type:String,attribute:"tooltip-text",reflect:!0})],Q.prototype,"tooltipText",2);tt([b({type:Boolean,reflect:!0})],Q.prototype,"loading",1);var wc=Object.defineProperty,We=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&wc(t,i,o),o};const qs=class extends T{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(e){e.stopPropagation(),this.checked=e.target.checked,this.dispatchEvent(this.onValueChange)}render(){return m` + `,we);it([f({type:String,reflect:!0})],K.prototype,"label",2);it([f({type:Boolean,attribute:"label-hidden",reflect:!0})],K.prototype,"labelHidden",2);it([f({type:Boolean,reflect:!0})],K.prototype,"active",2);it([f({type:Boolean,reflect:!0,attribute:"disabled"})],K.prototype,"disabled",2);it([f({type:String,reflect:!0})],K.prototype,"icon",2);it([f({type:Boolean,reflect:!0})],K.prototype,"vertical",2);it([f({type:Number,attribute:"tooltip-time",reflect:!0})],K.prototype,"tooltipTime",2);it([f({type:Boolean,attribute:"tooltip-visible",reflect:!0})],K.prototype,"tooltipVisible",2);it([f({type:String,attribute:"tooltip-title",reflect:!0})],K.prototype,"tooltipTitle",2);it([f({type:String,attribute:"tooltip-text",reflect:!0})],K.prototype,"tooltipText",2);it([f({type:Boolean,reflect:!0})],K.prototype,"loading",1);let Rc=K;var Dc=Object.defineProperty,Ye=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Dc(t,i,o),o};const sr=class extends O{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(e){e.stopPropagation(),this.checked=e.target.checked,this.dispatchEvent(this.onValueChange)}render(){return m`
${this.label?m`${this.label} `:null}
- `}};qs.styles=I` + `}};sr.styles=I` :host { display: block; } @@ -231,7 +392,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m outline: var(--bim-checkbox--olw, 2px) solid var(--bim-checkbox--olc, var(--bim-ui_accent-base)); } - `;let le=qs;We([b({type:String,reflect:!0})],le.prototype,"icon");We([b({type:String,reflect:!0})],le.prototype,"name");We([b({type:String,reflect:!0})],le.prototype,"label");We([b({type:Boolean,reflect:!0})],le.prototype,"checked");We([b({type:Boolean,reflect:!0})],le.prototype,"inverted");var $c=Object.defineProperty,ce=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&$c(t,i,o),o};const Ys=class extends T{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=ie(),this._textInput=ie(),this.onValueChange=new Event("input"),this.onOpacityInput=e=>{const t=e.target;this.opacity=t.value,this.dispatchEvent(this.onValueChange)}}set value(e){const{color:t,opacity:i}=e;this.color=t,i&&(this.opacity=i)}get value(){const e={color:this.color};return this.opacity&&(e.opacity=this.opacity),e}onColorInput(e){e.stopPropagation();const{value:t}=this._colorInput;t&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}onTextInput(e){e.stopPropagation();const{value:t}=this._textInput;if(!t)return;const{value:i}=t;let n=i.replace(/[^a-fA-F0-9]/g,"");n.startsWith("#")||(n=`#${n}`),t.value=n.slice(0,7),t.value.length===7&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:e}=this._colorInput;e&&e.click()}render(){return m` + `;let ce=sr;Ye([f({type:String,reflect:!0})],ce.prototype,"icon");Ye([f({type:String,reflect:!0})],ce.prototype,"name");Ye([f({type:String,reflect:!0})],ce.prototype,"label");Ye([f({type:Boolean,reflect:!0})],ce.prototype,"checked");Ye([f({type:Boolean,reflect:!0})],ce.prototype,"inverted");var jc=Object.defineProperty,de=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&jc(t,i,o),o};const rr=class extends O{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=ie(),this._textInput=ie(),this.onValueChange=new Event("input"),this.onOpacityInput=e=>{const t=e.target;this.opacity=t.value,this.dispatchEvent(this.onValueChange)}}set value(e){const{color:t,opacity:i}=e;this.color=t,i&&(this.opacity=i)}get value(){const e={color:this.color};return this.opacity&&(e.opacity=this.opacity),e}onColorInput(e){e.stopPropagation();const{value:t}=this._colorInput;t&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}onTextInput(e){e.stopPropagation();const{value:t}=this._textInput;if(!t)return;const{value:i}=t;let n=i.replace(/[^a-fA-F0-9]/g,"");n.startsWith("#")||(n=`#${n}`),t.value=n.slice(0,7),t.value.length===7&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:e}=this._colorInput;e&&e.click()}render(){return m`
- `}};Ys.styles=I` + `}};rr.styles=I` :host { --bim-input--bgc: var(--bim-ui_bg-contrast-20); flex: 1; @@ -333,159 +494,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m bim-number-input { flex-grow: 0; } - `;let Bt=Ys;ce([b({type:String,reflect:!0})],Bt.prototype,"name");ce([b({type:String,reflect:!0})],Bt.prototype,"label");ce([b({type:String,reflect:!0})],Bt.prototype,"icon");ce([b({type:Boolean,reflect:!0})],Bt.prototype,"vertical");ce([b({type:Number,reflect:!0})],Bt.prototype,"opacity");ce([b({type:String,reflect:!0})],Bt.prototype,"color");const Cc=I` - ::-webkit-scrollbar { - width: 0.4rem; - height: 0.4rem; - overflow: hidden; - } - - ::-webkit-scrollbar-thumb { - border-radius: 0.25rem; - background-color: var( - --bim-scrollbar--c, - color-mix(in lab, var(--bim-ui_main-base), white 15%) - ); - } - - ::-webkit-scrollbar-track { - background-color: var(--bim-scrollbar--bgc, var(--bim-ui_bg-base)); - } -`,Ec=I` - :root { - /* Grayscale Colors */ - --bim-ui_gray-0: hsl(210 10% 5%); - --bim-ui_gray-1: hsl(210 10% 10%); - --bim-ui_gray-2: hsl(210 10% 20%); - --bim-ui_gray-3: hsl(210 10% 30%); - --bim-ui_gray-4: hsl(210 10% 40%); - --bim-ui_gray-6: hsl(210 10% 60%); - --bim-ui_gray-7: hsl(210 10% 70%); - --bim-ui_gray-8: hsl(210 10% 80%); - --bim-ui_gray-9: hsl(210 10% 90%); - --bim-ui_gray-10: hsl(210 10% 95%); - - /* Brand Colors */ - --bim-ui_main-base: #6528d7; - --bim-ui_accent-base: #bcf124; - - /* Brand Colors Contrasts */ - --bim-ui_main-contrast: var(--bim-ui_gray-10); - --bim-ui_accent-contrast: var(--bim-ui_gray-0); - - /* Sizes */ - --bim-ui_size-4xs: 0.375rem; - --bim-ui_size-3xs: 0.5rem; - --bim-ui_size-2xs: 0.625rem; - --bim-ui_size-xs: 0.75rem; - --bim-ui_size-sm: 0.875rem; - --bim-ui_size-base: 1rem; - --bim-ui_size-lg: 1.125rem; - --bim-ui_size-xl: 1.25rem; - --bim-ui_size-2xl: 1.375rem; - --bim-ui_size-3xl: 1.5rem; - --bim-ui_size-4xl: 1.625rem; - --bim-ui_size-5xl: 1.75rem; - --bim-ui_size-6xl: 1.875rem; - --bim-ui_size-7xl: 2rem; - --bim-ui_size-8xl: 2.125rem; - --bim-ui_size-9xl: 2.25rem; - } - - /* Background Colors */ - @media (prefers-color-scheme: dark) { - :root { - --bim-ui_bg-base: var(--bim-ui_gray-0); - --bim-ui_bg-contrast-10: var(--bim-ui_gray-1); - --bim-ui_bg-contrast-20: var(--bim-ui_gray-2); - --bim-ui_bg-contrast-30: var(--bim-ui_gray-3); - --bim-ui_bg-contrast-40: var(--bim-ui_gray-4); - --bim-ui_bg-contrast-60: var(--bim-ui_gray-6); - --bim-ui_bg-contrast-80: var(--bim-ui_gray-8); - --bim-ui_bg-contrast-100: var(--bim-ui_gray-10); - } - } - - @media (prefers-color-scheme: light) { - :root { - --bim-ui_bg-base: var(--bim-ui_gray-10); - --bim-ui_bg-contrast-10: var(--bim-ui_gray-9); - --bim-ui_bg-contrast-20: var(--bim-ui_gray-8); - --bim-ui_bg-contrast-30: var(--bim-ui_gray-7); - --bim-ui_bg-contrast-40: var(--bim-ui_gray-6); - --bim-ui_bg-contrast-60: var(--bim-ui_gray-4); - --bim-ui_bg-contrast-80: var(--bim-ui_gray-2); - --bim-ui_bg-contrast-100: var(--bim-ui_gray-0); - --bim-ui_accent-base: #6528d7; - } - } - - html.bim-ui-dark { - --bim-ui_bg-base: var(--bim-ui_gray-0); - --bim-ui_bg-contrast-10: var(--bim-ui_gray-1); - --bim-ui_bg-contrast-20: var(--bim-ui_gray-2); - --bim-ui_bg-contrast-30: var(--bim-ui_gray-3); - --bim-ui_bg-contrast-40: var(--bim-ui_gray-4); - --bim-ui_bg-contrast-60: var(--bim-ui_gray-6); - --bim-ui_bg-contrast-80: var(--bim-ui_gray-8); - --bim-ui_bg-contrast-100: var(--bim-ui_gray-10); - } - - html.bim-ui-light { - --bim-ui_bg-base: var(--bim-ui_gray-10); - --bim-ui_bg-contrast-10: var(--bim-ui_gray-9); - --bim-ui_bg-contrast-20: var(--bim-ui_gray-8); - --bim-ui_bg-contrast-30: var(--bim-ui_gray-7); - --bim-ui_bg-contrast-40: var(--bim-ui_gray-6); - --bim-ui_bg-contrast-60: var(--bim-ui_gray-4); - --bim-ui_bg-contrast-80: var(--bim-ui_gray-2); - --bim-ui_bg-contrast-100: var(--bim-ui_gray-0); - --bim-ui_accent-base: #6528d7; - } - - [data-context-dialog]::backdrop { - background-color: transparent; - } -`,St={scrollbar:Cc,globalStyles:Ec},Xs=class O{static set config(t){this._config={...O._config,...t}}static get config(){return O._config}static addGlobalStyles(){let t=document.querySelector("style[id='bim-ui']");if(t)return;t=document.createElement("style"),t.id="bim-ui",t.textContent=St.globalStyles.cssText;const i=document.head.firstChild;i?document.head.insertBefore(t,i):document.head.append(t)}static defineCustomElement(t,i){customElements.get(t)||customElements.define(t,i)}static registerComponents(){O.init()}static init(){O.addGlobalStyles(),O.defineCustomElement("bim-button",Q),O.defineCustomElement("bim-checkbox",le),O.defineCustomElement("bim-color-input",Bt),O.defineCustomElement("bim-context-menu",kc),O.defineCustomElement("bim-dropdown",bt),O.defineCustomElement("bim-grid",Nn),O.defineCustomElement("bim-icon",Lc),O.defineCustomElement("bim-input",Ge),O.defineCustomElement("bim-label",de),O.defineCustomElement("bim-number-input",W),O.defineCustomElement("bim-option",F),O.defineCustomElement("bim-panel",Ut),O.defineCustomElement("bim-panel-section",ue),O.defineCustomElement("bim-selector",he),O.defineCustomElement("bim-table",K),O.defineCustomElement("bim-tabs",Wt),O.defineCustomElement("bim-tab",Y),O.defineCustomElement("bim-table-cell",lr),O.defineCustomElement("bim-table-children",dr),O.defineCustomElement("bim-table-group",hr),O.defineCustomElement("bim-table-row",Vt),O.defineCustomElement("bim-text-input",lt),O.defineCustomElement("bim-toolbar",zi),O.defineCustomElement("bim-toolbar-group",Ri),O.defineCustomElement("bim-toolbar-section",be),O.defineCustomElement("bim-viewport",$r)}static newRandomId(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let n=0;n<10;n++){const o=Math.floor(Math.random()*t.length);i+=t.charAt(o)}return i}};Xs._config={sectionLabelOnVerticalToolbar:!1};let hn=Xs;class B extends T{constructor(){super(...arguments),this._lazyLoadObserver=null,this._visibleElements=[],this.ELEMENTS_BEFORE_OBSERVER=20,this.useObserver=!1,this.elements=new Set,this.observe=t=>{if(!this.useObserver)return;for(const n of t)this.elements.add(n);const i=t.slice(this.ELEMENTS_BEFORE_OBSERVER);for(const n of i)n.remove();this.observeLastElement()}}set visibleElements(t){this._visibleElements=this.useObserver?t:[],this.requestUpdate()}get visibleElements(){return this._visibleElements}getLazyObserver(){if(!this.useObserver)return null;if(this._lazyLoadObserver)return this._lazyLoadObserver;const t=new IntersectionObserver(i=>{const n=i[0];if(!n.isIntersecting)return;const o=n.target;t.unobserve(o);const s=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length,r=[...this.elements][s];r&&(this.visibleElements=[...this.visibleElements,r],t.observe(r))},{threshold:.5});return t}observeLastElement(){const t=this.getLazyObserver();if(!t)return;const i=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length-1,n=[...this.elements][i];n&&t.observe(n)}resetVisibleElements(){const t=this.getLazyObserver();if(t){for(const i of this.elements)t.unobserve(i);this.visibleElements=[],this.observeLastElement()}}static create(t,i){const n=document.createDocumentFragment();if(t.length===0)return ee(t(),n),n.firstElementChild;if(!i)throw new Error("UIComponent: Initial state is required for statefull components.");let o=i;const s=t,r=l=>(o={...o,...l},ee(s(o),n),o);r(i);const a=()=>o;return[n.firstElementChild,r,a]}}var Ac=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Js=(e,t,i,n)=>{for(var o=Sc(t,i),s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Ac(t,i,o),o},D;const In=(D=class extends T{constructor(){super(...arguments),this._previousContainer=null,this._visible=!1}get placement(){return this._placement}set placement(e){this._placement=e,this.updatePosition()}static removeMenus(){for(const e of D.menus)e instanceof D&&(e.visible=!1);D.dialog.close(),D.dialog.remove()}get visible(){return this._visible}set visible(e){var t;this._visible=e,e?(D.dialog.parentElement||document.body.append(D.dialog),this._previousContainer=this.parentElement,D.dialog.style.top=`${window.scrollY||document.documentElement.scrollTop}px`,D.dialog.append(this),D.dialog.showModal(),this.updatePosition(),this.dispatchEvent(new Event("visible"))):((t=this._previousContainer)==null||t.append(this),this._previousContainer=null,this.dispatchEvent(new Event("hidden")))}async updatePosition(){if(!(this.visible&&this._previousContainer))return;const e=this.placement??"right",t=await ms(this._previousContainer,this,{placement:e,middleware:[es(10),ps(),hs(),us({padding:5})]}),{x:i,y:n}=t;this.style.left=`${i}px`,this.style.top=`${n}px`}connectedCallback(){super.connectedCallback(),D.menus.push(this)}render(){return m` `}},D.styles=[St.scrollbar,I` - :host { - pointer-events: auto; - position: absolute; - top: 0; - left: 0; - z-index: 999; - overflow: auto; - max-height: 20rem; - min-width: 3rem; - flex-direction: column; - box-shadow: 1px 2px 8px 2px rgba(0, 0, 0, 0.15); - padding: 0.5rem; - border-radius: var(--bim-ui_size-4xs); - display: flex; - background-color: var( - --bim-context-menu--bgc, - var(--bim-ui_bg-contrast-20) - ); - } - - :host(:not([visible])) { - display: none; - } - `],D.dialog=B.create(()=>m` {e.target===D.dialog&&D.removeMenus()}} - @cancel=${()=>D.removeMenus()} - data-context-dialog - style=" - width: 0; - height: 0; - position: relative; - padding: 0; - border: none; - outline: none; - margin: none; - overflow: visible; - background-color: transparent; - " - >`),D.menus=[],D);Js([b({type:String,reflect:!0})],In.prototype,"placement");Js([b({type:Boolean,reflect:!0})],In.prototype,"visible");let kc=In;const _i=(e,t={},i=!0)=>{let n={};for(const o of e.children){const s=o,r=s.getAttribute("name")||s.getAttribute("label"),a=t[r];if(r){if("value"in s&&typeof s.value<"u"&&s.value!==null){const l=s.value;if(typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length===0)continue;n[r]=a?a(s.value):s.value}else if(i){const l=_i(s,t);if(Object.keys(l).length===0)continue;n[r]=a?a(l):l}}else i&&(n={...n,..._i(s,t)})}return n},Mi=e=>e==="true"||e==="false"?e==="true":e&&!isNaN(Number(e))&&e.trim()!==""?Number(e):e,Oc=[">=","<=","=",">","<","?","/","#"];function Eo(e){const t=Oc.find(r=>e.split(r).length===2),i=e.split(t).map(r=>r.trim()),[n,o]=i,s=o.startsWith("'")&&o.endsWith("'")?o.replace(/'/g,""):Mi(o);return{key:n,condition:t,value:s}}const pn=e=>{try{const t=[],i=e.split(/&(?![^()]*\))/).map(n=>n.trim());for(const n of i){const o=!n.startsWith("(")&&!n.endsWith(")"),s=n.startsWith("(")&&n.endsWith(")");if(o){const r=Eo(n);t.push(r)}if(s){const r={operator:"&",queries:n.replace(/^(\()|(\))$/g,"").split("&").map(a=>a.trim()).map((a,l)=>{const d=Eo(a);return l>0&&(d.operator="&"),d})};t.push(r)}}return t}catch{return null}},Ao=(e,t,i)=>{let n=!1;switch(t){case"=":n=e===i;break;case"?":n=String(e).includes(String(i));break;case"<":(typeof e=="number"||typeof i=="number")&&(n=e":(typeof e=="number"||typeof i=="number")&&(n=e>i);break;case">=":(typeof e=="number"||typeof i=="number")&&(n=e>=i);break;case"/":n=String(e).startsWith(String(i));break}return n};var Tc=Object.defineProperty,Ic=Object.getOwnPropertyDescriptor,kt=(e,t,i,n)=>{for(var o=n>1?void 0:n?Ic(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Tc(t,i,o),o};const Qs=class extends T{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?Mi(this.label):this.label}set value(e){this._value=e}render(){return m` + `;let Ut=rr;de([f({type:String,reflect:!0})],Ut.prototype,"name");de([f({type:String,reflect:!0})],Ut.prototype,"label");de([f({type:String,reflect:!0})],Ut.prototype,"icon");de([f({type:Boolean,reflect:!0})],Ut.prototype,"vertical");de([f({type:Number,reflect:!0})],Ut.prototype,"opacity");de([f({type:String,reflect:!0})],Ut.prototype,"color");const $i=(e,t={},i=!0)=>{let n={};for(const o of e.children){const s=o,r=s.getAttribute("name")||s.getAttribute("label"),a=t[r];if(r){if("value"in s&&typeof s.value<"u"&&s.value!==null){const l=s.value;if(typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length===0)continue;n[r]=a?a(s.value):s.value}else if(i){const l=$i(s,t);if(Object.keys(l).length===0)continue;n[r]=a?a(l):l}}else i&&(n={...n,...$i(s,t)})}return n},zi=e=>e==="true"||e==="false"?e==="true":e&&!isNaN(Number(e))&&e.trim()!==""?Number(e):e,zc=[">=","<=","=",">","<","?","/","#"];function Po(e){const t=zc.find(r=>e.split(r).length===2),i=e.split(t).map(r=>r.trim()),[n,o]=i,s=o.startsWith("'")&&o.endsWith("'")?o.replace(/'/g,""):zi(o);return{key:n,condition:t,value:s}}const yn=e=>{try{const t=[],i=e.split(/&(?![^()]*\))/).map(n=>n.trim());for(const n of i){const o=!n.startsWith("(")&&!n.endsWith(")"),s=n.startsWith("(")&&n.endsWith(")");if(o){const r=Po(n);t.push(r)}if(s){const r={operator:"&",queries:n.replace(/^(\()|(\))$/g,"").split("&").map(a=>a.trim()).map((a,l)=>{const d=Po(a);return l>0&&(d.operator="&"),d})};t.push(r)}}return t}catch{return null}},Mo=(e,t,i)=>{let n=!1;switch(t){case"=":n=e===i;break;case"?":n=String(e).includes(String(i));break;case"<":(typeof e=="number"||typeof i=="number")&&(n=e":(typeof e=="number"||typeof i=="number")&&(n=e>i);break;case">=":(typeof e=="number"||typeof i=="number")&&(n=e>=i);break;case"/":n=String(e).startsWith(String(i));break}return n};var Fc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,kt=(e,t,i,n)=>{for(var o=n>1?void 0:n?Hc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Fc(t,i,o),o};const ar=class extends O{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?zi(this.label):this.label}set value(e){this._value=e}render(){return m`
${this.img||this.icon||this.label?m`
${this.checkbox&&!this.noMark?m``:null}
- `}};Qs.styles=I` + `}};ar.styles=I` :host { --bim-label--c: var(--bim-ui_bg-contrast-100); display: block; @@ -566,7 +575,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m bim-label { pointer-events: none; } - `;let F=Qs;kt([b({type:String,reflect:!0})],F.prototype,"img",2);kt([b({type:String,reflect:!0})],F.prototype,"label",2);kt([b({type:String,reflect:!0})],F.prototype,"icon",2);kt([b({type:Boolean,reflect:!0})],F.prototype,"checked",2);kt([b({type:Boolean,reflect:!0})],F.prototype,"checkbox",2);kt([b({type:Boolean,attribute:"no-mark",reflect:!0})],F.prototype,"noMark",2);kt([b({converter:{fromAttribute(e){return e&&Mi(e)}}})],F.prototype,"value",1);kt([b({type:Boolean,reflect:!0})],F.prototype,"vertical",2);var Nc=Object.defineProperty,Pc=Object.getOwnPropertyDescriptor,Ot=(e,t,i,n)=>{for(var o=n>1?void 0:n?Pc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Nc(t,i,o),o};const Zs=class extends B{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this._contextMenu=ie(),this.onOptionClick=e=>{const t=e.target,i=this._value.has(t);if(!this.multiple&&!this.required&&!i)this._value=new Set([t]);else if(!this.multiple&&!this.required&&i)this._value=new Set([]);else if(!this.multiple&&this.required&&!i)this._value=new Set([t]);else if(this.multiple&&!this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&!this.required&&i){const n=[...this._value].filter(o=>o!==t);this._value=new Set(n)}else if(this.multiple&&this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&this.required&&i){const n=[...this._value].filter(s=>s!==t),o=new Set(n);o.size!==0&&(this._value=o)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(e){if(e){const{value:t}=this._contextMenu;if(!t)return;for(const i of this.elements)t.append(i);this._visible=!0}else{for(const t of this.elements)this.append(t);this._visible=!1,this.resetVisibleElements()}}get visible(){return this._visible}set value(e){if(this.required&&Object.keys(e).length===0)return;const t=new Set;for(const i of e){const n=this.findOption(i);if(n&&(t.add(n),!this.multiple&&Object.keys(e).length===1))break}this._value=t,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(e=>e instanceof F&&e.checked).map(e=>e.value)}get _options(){const e=new Set([...this.elements]);for(const t of this.children)t instanceof F&&e.add(t);return[...e]}onSlotChange(e){const t=e.target.assignedElements();this.observe(t);const i=new Set;for(const n of this.elements){if(!(n instanceof F)){n.remove();continue}n.checked&&i.add(n),n.removeEventListener("click",this.onOptionClick),n.addEventListener("click",this.onOptionClick)}this._value=i}updateOptionsState(){for(const e of this._options)e instanceof F&&(e.checked=this._value.has(e))}findOption(e){return this._options.find(t=>t instanceof F?t.label===e||t.value===e:!1)}render(){let e,t,i;if(this._value.size===0)e="Select an option...";else if(this._value.size===1){const n=[...this._value][0];e=(n==null?void 0:n.label)||(n==null?void 0:n.value),t=n==null?void 0:n.img,i=n==null?void 0:n.icon}else e=`Multiple (${this._value.size})`;return m` + `;let H=ar;kt([f({type:String,reflect:!0})],H.prototype,"img",2);kt([f({type:String,reflect:!0})],H.prototype,"label",2);kt([f({type:String,reflect:!0})],H.prototype,"icon",2);kt([f({type:Boolean,reflect:!0})],H.prototype,"checked",2);kt([f({type:Boolean,reflect:!0})],H.prototype,"checkbox",2);kt([f({type:Boolean,attribute:"no-mark",reflect:!0})],H.prototype,"noMark",2);kt([f({converter:{fromAttribute(e){return e&&zi(e)}}})],H.prototype,"value",1);kt([f({type:Boolean,reflect:!0})],H.prototype,"vertical",2);var Bc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,Tt=(e,t,i,n)=>{for(var o=n>1?void 0:n?Uc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Bc(t,i,o),o};const lr=class extends V{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this._contextMenu=ie(),this.onOptionClick=e=>{const t=e.target,i=this._value.has(t);if(!this.multiple&&!this.required&&!i)this._value=new Set([t]);else if(!this.multiple&&!this.required&&i)this._value=new Set([]);else if(!this.multiple&&this.required&&!i)this._value=new Set([t]);else if(this.multiple&&!this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&!this.required&&i){const n=[...this._value].filter(o=>o!==t);this._value=new Set(n)}else if(this.multiple&&this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&this.required&&i){const n=[...this._value].filter(s=>s!==t),o=new Set(n);o.size!==0&&(this._value=o)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(e){if(e){const{value:t}=this._contextMenu;if(!t)return;for(const i of this.elements)t.append(i);this._visible=!0}else{for(const t of this.elements)this.append(t);this._visible=!1,this.resetVisibleElements()}}get visible(){return this._visible}set value(e){if(this.required&&Object.keys(e).length===0)return;const t=new Set;for(const i of e){const n=this.findOption(i);if(n&&(t.add(n),!this.multiple&&Object.keys(e).length===1))break}this._value=t,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(e=>e instanceof H&&e.checked).map(e=>e.value)}get _options(){const e=new Set([...this.elements]);for(const t of this.children)t instanceof H&&e.add(t);return[...e]}onSlotChange(e){const t=e.target.assignedElements();this.observe(t);const i=new Set;for(const n of this.elements){if(!(n instanceof H)){n.remove();continue}n.checked&&i.add(n),n.removeEventListener("click",this.onOptionClick),n.addEventListener("click",this.onOptionClick)}this._value=i}updateOptionsState(){for(const e of this._options)e instanceof H&&(e.checked=this._value.has(e))}findOption(e){return this._options.find(t=>t instanceof H?t.label===e||t.value===e:!1)}render(){let e,t,i;if(this._value.size===0)e="Select an option...";else if(this._value.size===1){const n=[...this._value][0];e=(n==null?void 0:n.label)||(n==null?void 0:n.value),t=n==null?void 0:n.img,i=n==null?void 0:n.icon}else e=`Multiple (${this._value.size})`;return m` {this.visible&&(this.visible=!1)}} > @@ -600,7 +609,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m
- `}};Zs.styles=[St.scrollbar,I` + `}};lr.styles=[St.scrollbar,I` :host { --bim-input--bgc: var( --bim-dropdown--bgc, @@ -635,8 +644,8 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m bim-label { pointer-events: none; } - `];let bt=Zs;Ot([b({type:String,reflect:!0})],bt.prototype,"name",2);Ot([b({type:String,reflect:!0})],bt.prototype,"icon",2);Ot([b({type:String,reflect:!0})],bt.prototype,"label",2);Ot([b({type:Boolean,reflect:!0})],bt.prototype,"multiple",2);Ot([b({type:Boolean,reflect:!0})],bt.prototype,"required",2);Ot([b({type:Boolean,reflect:!0})],bt.prototype,"vertical",2);Ot([b({type:Boolean,reflect:!0})],bt.prototype,"visible",1);Ot([ae()],bt.prototype,"_value",2);var Mc=Object.defineProperty,Ks=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Mc(t,i,o),o};const tr=class extends T{constructor(){super(...arguments),this.floating=!1,this.layouts={}}getUniqueAreasFromTemplate(e){const t=e.split(` -`).map(i=>i.trim()).map(i=>i.split('"')[1]).filter(i=>i!==void 0).flatMap(i=>i.split(/\s+/));return[...new Set(t)].filter(i=>i!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this.layouts[this.layout]){this.innerHTML="";const e=this.layouts[this.layout],t=this.getUniqueAreasFromTemplate(e.template).map(i=>{const n=e.elements[i];return n&&(n.style.gridArea=i),n}).filter(i=>!!i);this.style.gridTemplate=e.template,this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange),this.append(...t)}}else this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return m``}};tr.styles=I` + `];let bt=lr;Tt([f({type:String,reflect:!0})],bt.prototype,"name",2);Tt([f({type:String,reflect:!0})],bt.prototype,"icon",2);Tt([f({type:String,reflect:!0})],bt.prototype,"label",2);Tt([f({type:Boolean,reflect:!0})],bt.prototype,"multiple",2);Tt([f({type:Boolean,reflect:!0})],bt.prototype,"required",2);Tt([f({type:Boolean,reflect:!0})],bt.prototype,"vertical",2);Tt([f({type:Boolean,reflect:!0})],bt.prototype,"visible",1);Tt([le()],bt.prototype,"_value",2);var Vc=Object.defineProperty,cr=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Vc(t,i,o),o};const dr=class extends O{constructor(){super(...arguments),this.floating=!1,this.layouts={}}getUniqueAreasFromTemplate(e){const t=e.split(` +`).map(i=>i.trim()).map(i=>i.split('"')[1]).filter(i=>i!==void 0).flatMap(i=>i.split(/\s+/));return[...new Set(t)].filter(i=>i!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this.layouts[this.layout]){this.innerHTML="";const e=this.layouts[this.layout],t=this.getUniqueAreasFromTemplate(e.template).map(i=>{const n=e.elements[i];return n&&(n.style.gridArea=i),n}).filter(i=>!!i);this.style.gridTemplate=e.template,this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange),this.append(...t)}}else this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return m``}};dr.styles=I` :host { display: grid; height: 100%; @@ -665,9 +674,9 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m background-color: var(--bim-ui_bg-contrast-20); gap: 1px; } - `;let Nn=tr;Ks([b({type:Boolean,reflect:!0})],Nn.prototype,"floating");Ks([b({type:String,reflect:!0})],Nn.prototype,"layout");const mn=class extends T{render(){return m` + `;let jn=dr;cr([f({type:Boolean,reflect:!0})],jn.prototype,"floating");cr([f({type:String,reflect:!0})],jn.prototype,"layout");const _n=class extends O{render(){return m` - `}};mn.styles=I` + `}};_n.styles=I` :host { height: var(--bim-icon--fz, var(--bim-ui_size-sm)); width: var(--bim-icon--fz, var(--bim-ui_size-sm)); @@ -679,14 +688,14 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m color: var(--bim-icon--c); transition: all 0.15s; } - `,mn.properties={icon:{type:String}};let Lc=mn;var jc=Object.defineProperty,Li=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&jc(t,i,o),o};const er=class extends T{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const e={};for(const t of this.children){const i=t;"value"in i?e[i.name||i.label]=i.value:"checked"in i&&(e[i.name||i.label]=i.checked)}return e}set value(e){const t=[...this.children];for(const i in e){const n=t.find(r=>{const a=r;return a.name===i||a.label===i});if(!n)continue;const o=n,s=e[i];typeof s=="boolean"?o.checked=s:o.value=s}}render(){return m` + `,_n.properties={icon:{type:String}};let Wc=_n;var Gc=Object.defineProperty,Fi=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Gc(t,i,o),o};const ur=class extends O{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const e={};for(const t of this.children){const i=t;"value"in i?e[i.name||i.label]=i.value:"checked"in i&&(e[i.name||i.label]=i.checked)}return e}set value(e){const t=[...this.children];for(const i in e){const n=t.find(r=>{const a=r;return a.name===i||a.label===i});if(!n)continue;const o=n,s=e[i];typeof s=="boolean"?o.checked=s:o.value=s}}render(){return m`
${this.label||this.icon?m`${this.label}`:null}
- `}};er.styles=I` + `}};ur.styles=I` :host { flex: 1; display: block; @@ -734,13 +743,13 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m :host(:not([vertical])[label]) .input { max-width: fit-content; } - `;let Ge=er;Li([b({type:String,reflect:!0})],Ge.prototype,"name");Li([b({type:String,reflect:!0})],Ge.prototype,"label");Li([b({type:String,reflect:!0})],Ge.prototype,"icon");Li([b({type:Boolean,reflect:!0})],Ge.prototype,"vertical");var Rc=Object.defineProperty,qe=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Rc(t,i,o),o};const ir=class extends T{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?Mi(this.textContent):this.textContent}render(){return m` + `;let Xe=ur;Fi([f({type:String,reflect:!0})],Xe.prototype,"name");Fi([f({type:String,reflect:!0})],Xe.prototype,"label");Fi([f({type:String,reflect:!0})],Xe.prototype,"icon");Fi([f({type:Boolean,reflect:!0})],Xe.prototype,"vertical");var qc=Object.defineProperty,Je=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&qc(t,i,o),o};const hr=class extends O{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?zi(this.textContent):this.textContent}render(){return m`
${this.img?m``:null} ${!this.iconHidden&&this.icon?m``:null}

- `}};ir.styles=I` + `}};hr.styles=I` :host { --bim-icon--c: var(--bim-label--c); color: var(--bim-label--c, var(--bim-ui_bg-contrast-60)); @@ -769,6 +778,9 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m margin: 0; text-overflow: ellipsis; overflow: hidden; + display: flex; + align-items: center; + gap: 0.125rem; } :host([label-hidden]) .parent p, @@ -796,7 +808,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 4) ); } - `;let de=ir;qe([b({type:String,reflect:!0})],de.prototype,"img");qe([b({type:Boolean,attribute:"label-hidden",reflect:!0})],de.prototype,"labelHidden");qe([b({type:String,reflect:!0})],de.prototype,"icon");qe([b({type:Boolean,attribute:"icon-hidden",reflect:!0})],de.prototype,"iconHidden");qe([b({type:Boolean,reflect:!0})],de.prototype,"vertical");var Dc=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,Z=(e,t,i,n)=>{for(var o=n>1?void 0:n?zc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Dc(t,i,o),o};const nr=class extends T{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=ie(),this.onValueChange=new Event("change")}set value(e){this.setValue(e.toString())}get value(){return this._value}onChange(e){e.stopPropagation();const{value:t}=this._input;t&&this.setValue(t.value)}setValue(e){const{value:t}=this._input;let i=e;if(i=i.replace(/[^0-9.-]/g,""),i=i.replace(/(\..*)\./g,"$1"),i.endsWith(".")||(i.lastIndexOf("-")>0&&(i=i[0]+i.substring(1).replace(/-/g,"")),i==="-"||i==="-0"))return;let n=Number(i);Number.isNaN(n)||(n=this.min!==void 0?Math.max(n,this.min):n,n=this.max!==void 0?Math.min(n,this.max):n,this.value!==n&&(this._value=n,t&&(t.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:e}=this._input;e&&Number.isNaN(Number(e.value))&&(e.value=this.value.toString())}onSliderMouseDown(e){document.body.style.cursor="w-resize";const{clientX:t}=e,i=this.value;let n=!1;const o=a=>{var l;n=!0;const{clientX:d}=a,u=this.step??1,c=((l=u.toString().split(".")[1])==null?void 0:l.length)||0,h=1/(this.sensitivity??1),p=(d-t)/h;if(Math.floor(Math.abs(p))!==Math.abs(p))return;const g=i+p*u;this.setValue(g.toFixed(c))},s=()=>{this.slider=!0,this.removeEventListener("blur",s)},r=()=>{document.removeEventListener("mousemove",o),document.body.style.cursor="default",n?n=!1:(this.addEventListener("blur",s),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}onFocus(e){e.stopPropagation();const t=i=>{i.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",t))};window.addEventListener("keydown",t)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max{for(var o=n>1?void 0:n?Xc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Yc(t,i,o),o};const pr=class extends O{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=ie(),this.onValueChange=new Event("change")}set value(e){this.setValue(e.toString())}get value(){return this._value}onChange(e){e.stopPropagation();const{value:t}=this._input;t&&this.setValue(t.value)}setValue(e){const{value:t}=this._input;let i=e;if(i=i.replace(/[^0-9.-]/g,""),i=i.replace(/(\..*)\./g,"$1"),i.endsWith(".")||(i.lastIndexOf("-")>0&&(i=i[0]+i.substring(1).replace(/-/g,"")),i==="-"||i==="-0"))return;let n=Number(i);Number.isNaN(n)||(n=this.min!==void 0?Math.max(n,this.min):n,n=this.max!==void 0?Math.min(n,this.max):n,this.value!==n&&(this._value=n,t&&(t.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:e}=this._input;e&&Number.isNaN(Number(e.value))&&(e.value=this.value.toString())}onSliderMouseDown(e){document.body.style.cursor="w-resize";const{clientX:t}=e,i=this.value;let n=!1;const o=a=>{var l;n=!0;const{clientX:d}=a,u=this.step??1,c=((l=u.toString().split(".")[1])==null?void 0:l.length)||0,h=1/(this.sensitivity??1),p=(d-t)/h;if(Math.floor(Math.abs(p))!==Math.abs(p))return;const b=i+p*u;this.setValue(b.toFixed(c))},s=()=>{this.slider=!0,this.removeEventListener("blur",s)},r=()=>{document.removeEventListener("mousemove",o),document.body.style.cursor="default",n?n=!1:(this.addEventListener("blur",s),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}onFocus(e){e.stopPropagation();const t=i=>{i.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",t))};window.addEventListener("keydown",t)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max${this.pref}`:null} ${this.slider?o:e} - `}};nr.styles=I` + `}};pr.styles=I` :host { --bim-input--bgc: var( --bim-number-input--bgc, @@ -933,14 +945,14 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m bim-label { pointer-events: none; } - `;let W=nr;Z([b({type:String,reflect:!0})],W.prototype,"name",2);Z([b({type:String,reflect:!0})],W.prototype,"icon",2);Z([b({type:String,reflect:!0})],W.prototype,"label",2);Z([b({type:String,reflect:!0})],W.prototype,"pref",2);Z([b({type:Number,reflect:!0})],W.prototype,"min",2);Z([b({type:Number,reflect:!0})],W.prototype,"value",1);Z([b({type:Number,reflect:!0})],W.prototype,"step",2);Z([b({type:Number,reflect:!0})],W.prototype,"sensitivity",2);Z([b({type:Number,reflect:!0})],W.prototype,"max",2);Z([b({type:String,reflect:!0})],W.prototype,"suffix",2);Z([b({type:Boolean,reflect:!0})],W.prototype,"vertical",2);Z([b({type:Boolean,reflect:!0})],W.prototype,"slider",2);var Fc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,Ye=(e,t,i,n)=>{for(var o=n>1?void 0:n?Hc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Fc(t,i,o),o};const or=class extends T{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(e){this._hidden=e,this.activationButton.active=!e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return _i(this,this.valueTransform)}set value(e){const t=[...this.children];for(const i in e){const n=t.find(s=>{const r=s;return r.name===i||r.label===i});if(!n)continue;const o=n;o.value=e[i]}}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>this.hidden=!this.hidden}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!0}expandSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,m` + `;let Y=pr;Z([f({type:String,reflect:!0})],Y.prototype,"name",2);Z([f({type:String,reflect:!0})],Y.prototype,"icon",2);Z([f({type:String,reflect:!0})],Y.prototype,"label",2);Z([f({type:String,reflect:!0})],Y.prototype,"pref",2);Z([f({type:Number,reflect:!0})],Y.prototype,"min",2);Z([f({type:Number,reflect:!0})],Y.prototype,"value",1);Z([f({type:Number,reflect:!0})],Y.prototype,"step",2);Z([f({type:Number,reflect:!0})],Y.prototype,"sensitivity",2);Z([f({type:Number,reflect:!0})],Y.prototype,"max",2);Z([f({type:String,reflect:!0})],Y.prototype,"suffix",2);Z([f({type:Boolean,reflect:!0})],Y.prototype,"vertical",2);Z([f({type:Boolean,reflect:!0})],Y.prototype,"slider",2);var Jc=Object.defineProperty,Qc=Object.getOwnPropertyDescriptor,Qe=(e,t,i,n)=>{for(var o=n>1?void 0:n?Qc(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=(n?r(t,i,o):r(o))||o);return n&&o&&Jc(t,i,o),o};const mr=class extends O{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(e){this._hidden=e,this.activationButton.active=!e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return $i(this,this.valueTransform)}set value(e){const t=[...this.children];for(const i in e){const n=t.find(s=>{const r=s;return r.name===i||r.label===i});if(!n)continue;const o=n;o.value=e[i]}}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>this.hidden=!this.hidden}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!0}expandSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,m`
${this.label||this.name||this.icon?m`${this.label}`:null}
- `}};or.styles=[St.scrollbar,I` + `}};mr.styles=[St.scrollbar,I` :host { display: flex; border-radius: var(--bim-ui_size-base); @@ -982,7 +994,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m ::slotted(bim-panel-section:not(:last-child)) { border-bottom: 1px solid var(--bim-ui_bg-contrast-20); } - `];let Ut=or;Ye([b({type:String,reflect:!0})],Ut.prototype,"icon",2);Ye([b({type:String,reflect:!0})],Ut.prototype,"name",2);Ye([b({type:String,reflect:!0})],Ut.prototype,"label",2);Ye([b({type:Boolean,reflect:!0})],Ut.prototype,"hidden",1);Ye([b({type:Boolean,attribute:"header-hidden",reflect:!0})],Ut.prototype,"headerHidden",2);var Bc=Object.defineProperty,Xe=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Bc(t,i,o),o};const sr=class extends T{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={}}get value(){const e=this.parentElement;let t;return e instanceof Ut&&(t=e.valueTransform),Object.values(this.valueTransform).length!==0&&(t=this.valueTransform),_i(this,t)}set value(e){const t=[...this.children];for(const i in e){const n=t.find(s=>{const r=s;return r.name===i||r.label===i});if(!n)continue;const o=n;o.value=e[i]}}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed)}render(){const e=this.label||this.icon||this.name||this.fixed,t=m`{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Kc(t,i,o),o};const br=class extends O{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={}}get value(){const e=this.parentElement;let t;return e instanceof Vt&&(t=e.valueTransform),Object.values(this.valueTransform).length!==0&&(t=this.valueTransform),$i(this,t)}set value(e){const t=[...this.children];for(const i in e){const n=t.find(s=>{const r=s;return r.name===i||r.label===i});if(!n)continue;const o=n;o.value=e[i]}}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed)}render(){const e=this.label||this.icon||this.name||this.fixed,t=m`
- `}};sr.styles=[St.scrollbar,I` + `}};br.styles=[St.scrollbar,I` :host { display: block; pointer-events: auto; @@ -1070,7 +1082,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m bim-label { pointer-events: none; } - `];let ue=sr;Xe([b({type:String,reflect:!0})],ue.prototype,"icon");Xe([b({type:String,reflect:!0})],ue.prototype,"label");Xe([b({type:String,reflect:!0})],ue.prototype,"name");Xe([b({type:Boolean,reflect:!0})],ue.prototype,"fixed");Xe([b({type:Boolean,reflect:!0})],ue.prototype,"collapsed");var Uc=Object.defineProperty,Je=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Uc(t,i,o),o};const rr=class extends T{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=e=>{this._value=e.target,this.dispatchEvent(this.onValueChange);for(const t of this.children)t instanceof F&&(t.checked=t===e.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(e){const t=this.findOption(e);if(t){for(const i of this._options)i.checked=i===t;this._value=t,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(e){const t=e.target.assignedElements();for(const i of t)i instanceof F&&(i.noMark=!0,i.removeEventListener("click",this.onOptionClick),i.addEventListener("click",this.onOptionClick))}findOption(e){return this._options.find(t=>t instanceof F?t.label===e||t.value===e:!1)}firstUpdated(){const e=[...this.children].find(t=>t instanceof F&&t.checked);e&&(this._value=e)}render(){return m` + `];let he=br;Ke([f({type:String,reflect:!0})],he.prototype,"icon");Ke([f({type:String,reflect:!0})],he.prototype,"label");Ke([f({type:String,reflect:!0})],he.prototype,"name");Ke([f({type:Boolean,reflect:!0})],he.prototype,"fixed");Ke([f({type:Boolean,reflect:!0})],he.prototype,"collapsed");var Zc=Object.defineProperty,Ze=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Zc(t,i,o),o};const fr=class extends O{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=e=>{this._value=e.target,this.dispatchEvent(this.onValueChange);for(const t of this.children)t instanceof H&&(t.checked=t===e.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(e){const t=this.findOption(e);if(t){for(const i of this._options)i.checked=i===t;this._value=t,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(e){const t=e.target.assignedElements();for(const i of t)i instanceof H&&(i.noMark=!0,i.removeEventListener("click",this.onOptionClick),i.addEventListener("click",this.onOptionClick))}findOption(e){return this._options.find(t=>t instanceof H?t.label===e||t.value===e:!1)}firstUpdated(){const e=[...this.children].find(t=>t instanceof H&&t.checked);e&&(this._value=e)}render(){return m` - `}};rr.styles=I` + `}};fr.styles=I` :host { --bim-input--bgc: var(--bim-ui_bg-contrast-20); --bim-input--g: 0; @@ -1095,7 +1107,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m --bim-label--c: var(--bim-ui_main-contrast); background-color: var(--bim-ui_main-base); } - `;let he=rr;Je([b({type:String,reflect:!0})],he.prototype,"name");Je([b({type:String,reflect:!0})],he.prototype,"icon");Je([b({type:String,reflect:!0})],he.prototype,"label");Je([b({type:Boolean,reflect:!0})],he.prototype,"vertical");Je([ae()],he.prototype,"_value");const Vc=()=>m` + `;let pe=fr;Ze([f({type:String,reflect:!0})],pe.prototype,"name");Ze([f({type:String,reflect:!0})],pe.prototype,"icon");Ze([f({type:String,reflect:!0})],pe.prototype,"label");Ze([f({type:Boolean,reflect:!0})],pe.prototype,"vertical");Ze([le()],pe.prototype,"_value");const td=()=>m` - `}};ar.styles=I` + `}};gr.styles=I` :host { padding: 0.375rem; display: flex; @@ -1238,7 +1250,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m justify-content: center; } - :host([data-column-index="0"]:not([data-no-indentation])) { + :host([data-column-index="0"]) { justify-content: normal; } @@ -1261,10 +1273,10 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m white-space: normal; text-align: center; } - `;let lr=ar;qc([b({type:String,reflect:!0})],lr.prototype,"column");var Yc=Object.defineProperty,Xc=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Yc(t,i,o),o};const cr=class extends T{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(e,t=!1){for(const i of this._groups)i.childrenHidden=typeof e>"u"?!i.childrenHidden:!e,t&&i.toggleChildren(e,t)}render(){return this._groups=[],m` + `;let vr=gr;nd([f({type:String,reflect:!0})],vr.prototype,"column");var od=Object.defineProperty,sd=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&od(t,i,o),o};const yr=class extends O{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(e,t=!1){for(const i of this._groups)i.childrenHidden=typeof e>"u"?!i.childrenHidden:!e,t&&i.toggleChildren(e,t)}render(){return this._groups=[],m` ${this.data.map(e=>{const t=document.createElement("bim-table-group");return this._groups.push(t),t.table=this.table,t.data=e,t})} - `}};cr.styles=I` + `}};yr.styles=I` :host { --bim-button--bgc: transparent; position: relative; @@ -1279,7 +1291,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m top: 0; bottom: 1.125rem; } - `;let dr=cr;Xc([b({type:Array,attribute:!1})],dr.prototype,"data");var Jc=Object.defineProperty,Qc=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Jc(t,i,o),o};const ur=class extends T{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(e,t=!1){this._children&&(this.childrenHidden=typeof e>"u"?!this.childrenHidden:!e,t&&this._children.toggleGroups(e,t))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const e=this.table.getGroupIndentation(this.data)??0,t=m` + `;let _r=yr;sd([f({type:Array,attribute:!1})],_r.prototype,"data");var rd=Object.defineProperty,ad=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&rd(t,i,o),o};const xr=class extends O{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(e,t=!1){this._children&&(this.childrenHidden=typeof e>"u"?!this.childrenHidden:!e,t&&this._children.toggleGroups(e,t))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const e=this.table.getGroupIndentation(this.data)??0,t=m` ${this.table.noIndentation?null:m` {n&&n(c)}} id="BBETO" icon="iconamoon:enter-duotone"> ${l} - `:l},Priority:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.priorities)??ri.priorities)[l];return m` + `:l},Priority:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.priorities)??ci.priorities)[l];return m` ${l} - `},Status:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.statuses)??ri.statuses)[l];return m` + `},Status:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.statuses)??ci.statuses)[l];return m` ${l} - `},Type:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.types)??ri.types)[l];return m` + `},Type:l=>{if(typeof l!="string")return l;const d=((i==null?void 0:i.types)??ci.types)[l];return m` ${l} - `},Author:l=>typeof l!="string"?l:ko(l,i),Assignee:l=>typeof l!="string"?l:ko(l,i)},a.data=[...s].map(l=>{var d;return{data:{Guid:l.guid,Title:l.title,Status:l.status,Description:l.description??"",Author:l.creationAuthor,Assignee:l.assignedTo??"",Date:l.creationDate.toDateString(),DueDate:((d=l.dueDate)==null?void 0:d.toDateString())??"",Type:l.type,Priority:l.priority??""}}})})}> + `},Author:l=>typeof l!="string"?l:Ro(l,i),Assignee:l=>typeof l!="string"?l:Ro(l,i)},a.data=[...s].map(l=>{var d;return{data:{Guid:l.guid,Title:l.title,Status:l.status,Description:l.description??"",Author:l.creationAuthor,Assignee:l.assignedTo??"",Date:l.creationDate.toDateString(),DueDate:((d=l.dueDate)==null?void 0:d.toDateString())??"",Type:l.type,Priority:l.priority??""}}})})}> There are no topics to display - `},Er=(e,t=!0)=>{const i=B.create(yd,e);if(t){const{components:n,topics:o}=e,[,s]=i,r=n.get(De);if(r.list.onItemUpdated.add(()=>s()),r.list.onItemDeleted.add(()=>s()),o)for(const a of o)a.relatedTopics.onItemAdded.add(()=>s()),a.relatedTopics.onItemDeleted.add(()=>s()),a.relatedTopics.onCleared.add(()=>s());else r.list.onItemSet.add(()=>s())}return i},_d=Object.freeze(Object.defineProperty({__proto__:null,topicsList:Er},Symbol.toStringTag,{value:"Module"})),xd=e=>{var t;const{components:i,topic:n,actions:o}=e,s={selectComponents:!0,colorizeComponent:!0,resetColors:!0,updateCamera:!0,delete:!0,unlink:!!n,...o},r=i.get(fn),a=((t=e.topic)==null?void 0:t.viewpoints)??r.list.keys(),l=[];for(const d of a){const u=r.list.get(d);u&&l.push(u)}return m` - {if(!d)return;const u=d;u.addEventListener("cellcreated",({detail:c})=>{const{cell:h}=c;h.style.padding="0.25rem"}),u.headersHidden=!0,u.hiddenColumns=["Guid"],u.columns=["Title",{name:"Actions",width:"auto"}],u.dataTransform={Actions:(c,h)=>{const{Guid:p}=h;if(!(p&&typeof p=="string"))return p;const g=r.list.get(p);return g?m` - g.go()}> + `},Lr=(e,t=!0)=>{const i=V.create(Td,e);if(t){const{components:n,topics:o}=e,[,s]=i,r=n.get(Be);if(r.list.onItemUpdated.add(()=>s()),r.list.onItemDeleted.add(()=>s()),o)for(const a of o)a.relatedTopics.onItemAdded.add(()=>s()),a.relatedTopics.onItemDeleted.add(()=>s()),a.relatedTopics.onCleared.add(()=>s());else r.list.onItemSet.add(()=>s())}return i},Od=Object.freeze(Object.defineProperty({__proto__:null,topicsList:Lr},Symbol.toStringTag,{value:"Module"})),Nd=e=>{var t;const{components:i,topic:n,actions:o}=e,s={selectComponents:!0,colorizeComponent:!0,resetColors:!0,updateCamera:!0,delete:!0,unlink:!!n,...o},r=i.get($n),a=((t=e.topic)==null?void 0:t.viewpoints)??r.list.keys(),l=[];for(const d of a){const u=r.list.get(d);u&&l.push(u)}return m` + {if(!d)return;const u=d;u.addEventListener("cellcreated",({detail:c})=>{const{cell:h}=c;h.style.padding="0.25rem"}),u.headersHidden=!0,u.hiddenColumns=["Guid"],u.columns=["Title",{name:"Actions",width:"auto"}],u.dataTransform={Actions:(c,h)=>{const{Guid:p}=h;if(!(p&&typeof p=="string"))return p;const b=r.list.get(p);return b?m` + b.go()}> ${Object.values(s).includes(!0)?m` - ${s.selectComponents?m`console.log(g.selection)}> `:null} - ${s.colorizeComponent?m`g.colorize()}> `:null} - ${s.resetColors?m`g.resetColors()}> `:null} - ${s.updateCamera?m`g.updateCamera()}> `:null} - ${s.unlink?m`n==null?void 0:n.viewpoints.delete(g.guid)}> `:null} - ${s.delete?m`r.list.delete(g.guid)}>`:null} + ${s.selectComponents?m`console.log(b.selection)}> `:null} + ${s.colorizeComponent?m`b.colorize()}> `:null} + ${s.resetColors?m`b.resetColors()}> `:null} + ${s.updateCamera?m`b.updateCamera()}> `:null} + ${s.unlink?m`n==null?void 0:n.viewpoints.delete(b.guid)}> `:null} + ${s.delete?m`r.list.delete(b.guid)}>`:null} `:null} `:p}},u.data=l.map((c,h)=>({data:{Guid:c.guid,Title:c.title??`Viewpoint ${e.topic?h+1:""}`,Actions:""}}))})}> No viewpoints to show - `},Mn=(e,t=!0)=>{const i=B.create(xd,e),{components:n,topic:o}=e;if(t){const[,s]=i,r=n.get(fn);r.list.onItemUpdated.add(()=>s()),r.list.onItemDeleted.add(()=>s()),r.list.onCleared.add(()=>s()),o?(o.viewpoints.onItemAdded.add(()=>s()),o.viewpoints.onItemDeleted.add(()=>s()),o.viewpoints.onCleared.add(()=>s())):r.list.onItemSet.add(()=>s())}return i},wd=Object.freeze(Object.defineProperty({__proto__:null,viewpointsList:Mn},Symbol.toStringTag,{value:"Module"})),$d={"jhon.doe@example.com":{name:"Jhon Doe",picture:"https://www.profilebakery.com/wp-content/uploads/2023/04/Profile-Image-AI.jpg"}},Cd=(e,t)=>{const i=(t??$d)[e],n=(i==null?void 0:i.name)??e,o=n.trim().split(/\s+/);let s,r;return o[0]&&o[0][0]&&(s=o[0][0].toUpperCase(),o[0][1]&&(r=o[0][1].toUpperCase())),o[1]&&o[1][0]&&(r=o[1][0].toUpperCase()),m` + `},Fn=(e,t=!0)=>{const i=V.create(Nd,e),{components:n,topic:o}=e;if(t){const[,s]=i,r=n.get($n);r.list.onItemUpdated.add(()=>s()),r.list.onItemDeleted.add(()=>s()),r.list.onCleared.add(()=>s()),o?(o.viewpoints.onItemAdded.add(()=>s()),o.viewpoints.onItemDeleted.add(()=>s()),o.viewpoints.onCleared.add(()=>s())):r.list.onItemSet.add(()=>s())}return i},Id=Object.freeze(Object.defineProperty({__proto__:null,viewpointsList:Fn},Symbol.toStringTag,{value:"Module"})),Pd={"jhon.doe@example.com":{name:"Jhon Doe",picture:"https://www.profilebakery.com/wp-content/uploads/2023/04/Profile-Image-AI.jpg"}},Md=(e,t)=>{const i=(t??Pd)[e],n=(i==null?void 0:i.name)??e,o=n.trim().split(/\s+/);let s,r;return o[0]&&o[0][0]&&(s=o[0][0].toUpperCase(),o[0][1]&&(r=o[0][1].toUpperCase())),o[1]&&o[1][0]&&(r=o[1][0].toUpperCase()),m`
${!(i!=null&&i.picture)&&(s||r)?m` ${n}
-`},Ed=e=>{const{topic:t,styles:i,viewpoint:n,actions:o}=e,s={delete:!0,...o};return m`{const{cell:a}=r;a.style.marginLeft="0"}} ${J(r=>{if(!r)return;const a=r;a.headersHidden=!0,a.hiddenColumns=["guid","author"],a.dataTransform={Comment:(d,u)=>{const{guid:c}=u;if(typeof c!="string")return d;const h=t.comments.get(c);if(!h)return d;const p=()=>{t.comments.delete(c)};return m` +`},Ld=e=>{const{topic:t,styles:i,viewpoint:n,actions:o}=e,s={delete:!0,...o};return m`{const{cell:a}=r;a.style.marginLeft="0"}} ${W(r=>{if(!r)return;const a=r;a.headersHidden=!0,a.hiddenColumns=["guid","author"],a.dataTransform={Comment:(d,u)=>{const{guid:c}=u;if(typeof c!="string")return d;const h=t.comments.get(c);if(!h)return d;const p=()=>{t.comments.delete(c)};return m`
- ${Cd(h.author,i)} + ${Md(h.author,i)} @ ${h.date.toDateString()}
@@ -1825,7 +1837,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m
${h.comment}
- `}};let l=t.comments.values();n&&(l=[...t.comments.values()].filter(d=>d.viewpoint===n)),a.data=[...l].map(d=>({data:{guid:d.guid,Comment:d.comment,author:(()=>{const u=i;if(!u)return d.author;const c=u[d.author];return(c==null?void 0:c.name)??d.author})()}}))})}>This topic has no comments`},Ar=(e,t=!0)=>{const i=B.create(Ed,e);if(t){const{topic:n}=e,[o,s]=i;n.comments.onItemSet.add(()=>s()),n.comments.onItemUpdated.add(()=>s()),n.comments.onItemDeleted.add(()=>s()),n.comments.onCleared.add(()=>s())}return i},Ad=Object.freeze(Object.defineProperty({__proto__:null,topicComments:Ar},Symbol.toStringTag,{value:"Module"})),ai={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},Ji={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},Qi=(e,t)=>{const i=((t==null?void 0:t.users)??ai.users)[e],n=(i==null?void 0:i.name)??e,o=n.trim().split(/\s+/);let s,r;return o[0]&&o[0][0]&&(s=o[0][0].toUpperCase(),o[0][1]&&(r=o[0][1].toUpperCase())),o[1]&&o[1][0]&&(r=o[1][0].toUpperCase()),m` + `}};let l=t.comments.values();n&&(l=[...t.comments.values()].filter(d=>d.viewpoint===n)),a.data=[...l].map(d=>({data:{guid:d.guid,Comment:d.comment,author:(()=>{const u=i;if(!u)return d.author;const c=u[d.author];return(c==null?void 0:c.name)??d.author})()}}))})}>This topic has no comments`},Rr=(e,t=!0)=>{const i=V.create(Ld,e);if(t){const{topic:n}=e,[o,s]=i;n.comments.onItemSet.add(()=>s()),n.comments.onItemUpdated.add(()=>s()),n.comments.onItemDeleted.add(()=>s()),n.comments.onCleared.add(()=>s())}return i},Rd=Object.freeze(Object.defineProperty({__proto__:null,topicComments:Rr},Symbol.toStringTag,{value:"Module"})),di={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},en={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},nn=(e,t)=>{const i=((t==null?void 0:t.users)??di.users)[e],n=(i==null?void 0:i.name)??e,o=n.trim().split(/\s+/);let s,r;return o[0]&&o[0][0]&&(s=o[0][0].toUpperCase(),o[0][1]&&(r=o[0][1].toUpperCase())),o[1]&&o[1][0]&&(r=o[1][0].toUpperCase()),m`
${!(i!=null&&i.picture)&&(s||r)?m` ${n}
-`},[xi,Sd]=B.create(e=>{const{topic:t}=e,i=document.createElement("bim-text-input");i.type="area";const n=()=>{i.value="",xi.close(),xi.remove()};return m` +`},[Ci,Dd]=V.create(e=>{const{topic:t}=e,i=document.createElement("bim-text-input");i.type="area";const n=()=>{i.value="",Ci.close(),Ci.remove()};return m` ${t?m` @@ -1860,7 +1872,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m `:m`No topic refereced`} - `},{}),[wi,kd]=B.create(e=>{const{components:t,topic:i}=e;let n;t&&(n=Mn({components:t,actions:{delete:!1,updateCamera:!1,colorizeComponent:!1,resetColors:!1,selectComponents:!1}})[0],n.selectableRows=!0);const o=()=>{wi.close(),wi.remove(),n==null||n.remove()};return m` + `},{}),[Ai,jd]=V.create(e=>{const{components:t,topic:i}=e;let n;t&&(n=Fn({components:t,actions:{delete:!1,updateCamera:!1,colorizeComponent:!1,resetColors:!1,selectComponents:!1}})[0],n.selectableRows=!0);const o=()=>{Ai.close(),Ai.remove(),n==null||n.remove()};return m` ${i?m` @@ -1887,7 +1899,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m `:m`No topic refereced`} - `},{}),[$i,Od]=B.create(e=>{const{components:t,topic:i}=e;let n;if(t){const s=[...t.get(De).list.values()].filter(r=>r!==i);n=Er({components:t,topics:s})[0],n.selectableRows=!0,n.hiddenColumns=["Guid","Author","Assignee","Date","DueDate"]}const o=()=>{$i.close(),$i.remove(),n==null||n.remove()};return m` + `},{}),[Ei,zd]=V.create(e=>{const{components:t,topic:i}=e;let n;if(t){const s=[...t.get(Be).list.values()].filter(r=>r!==i);n=Lr({components:t,topics:s})[0],n.selectableRows=!0,n.hiddenColumns=["Guid","Author","Assignee","Date","DueDate"]}const o=()=>{Ei.close(),Ei.remove(),n==null||n.remove()};return m` @@ -1912,7 +1924,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m - `},{}),Td=e=>{const{components:t,topic:i,styles:n,onUpdateInformation:o,actions:s,world:r}=e,a={update:!0,addComments:!0,linkViewpoints:!0,addViewpoints:!0,linkTopics:!0,...s},l=(n==null?void 0:n.priorities)??ai.priorities,d=(n==null?void 0:n.statuses)??ai.statuses,u=(n==null?void 0:n.types)??ai.types;let c;i!=null&&i.priority&&(c=l[i.priority]);let h;i!=null&&i.type&&(h=u[i.type]);let p;i!=null&&i.type&&(p=d[i.status]);let g,_,v;i&&(g=Ar({topic:i,styles:n==null?void 0:n.users})[0],_=Mn({components:t,topic:i})[0]);const f=()=>{if(!(i&&r))return;const E=t.get(fn).create(r);i.viewpoints.add(E.guid)},y=()=>{Sd({topic:i}),document.body.append(xi),xi.showModal()},x=()=>{kd({components:t,topic:i}),document.body.append(wi),wi.showModal()},w=()=>{Od({components:t,topic:i}),document.body.append($i),$i.showModal()};return m` + `},{}),Fd=e=>{const{components:t,topic:i,styles:n,onUpdateInformation:o,actions:s,world:r}=e,a={update:!0,addComments:!0,linkViewpoints:!0,addViewpoints:!0,linkTopics:!0,...s},l=(n==null?void 0:n.priorities)??di.priorities,d=(n==null?void 0:n.statuses)??di.statuses,u=(n==null?void 0:n.types)??di.types;let c;i!=null&&i.priority&&(c=l[i.priority]);let h;i!=null&&i.type&&(h=u[i.type]);let p;i!=null&&i.type&&(p=d[i.status]);let b,v,y;i&&(b=Rr({topic:i,styles:n==null?void 0:n.users})[0],v=Fn({components:t,topic:i})[0]);const g=()=>{if(!(i&&r))return;const A=t.get($n).create(r);i.viewpoints.add(A.guid)},_=()=>{Dd({topic:i}),document.body.append(Ci),Ci.showModal()},x=()=>{jd({components:t,topic:i}),document.body.append(Ai),Ai.showModal()},w=()=>{zd({components:t,topic:i}),document.body.append(Ei),Ei.showModal()};return m` ${i?m` @@ -1926,31 +1938,31 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m
Status - ${i.status}
Type - ${i.type}
${i.priority?m`
Priority - ${i.priority}
`:null}
Author - ${Qi(i.creationAuthor,n)} + ${nn(i.creationAuthor,n)}
${i.assignedTo?m`
Assignee - ${Qi(i.assignedTo,n)} + ${nn(i.assignedTo,n)}
`:null} ${i.dueDate?m`
@@ -1960,7 +1972,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m ${i.modifiedAuthor?m`
Modified By - ${Qi(i.modifiedAuthor,n)} + ${nn(i.modifiedAuthor,n)}
`:null} ${i.modifiedDate?m`
@@ -1977,70 +1989,80 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m `:null} - ${g} + ${b} ${a.addComments?m` - + `:null} - ${_} + ${v} ${a.linkViewpoints||a.addViewpoints?m`
- ${a.addViewpoints?m` `:null} + ${a.addViewpoints?m` `:null} ${a.linkViewpoints?m``:null}
`:null}
`:m`No topic selected!`} - `},Id=(e,t=!0)=>{const i=B.create(Td,e);if(t){const{components:n}=e,[o,s]=i;n.get(De).list.onItemUpdated.add(({value:r})=>{const{topic:a}=s(),{guid:l}=r;l===(a==null?void 0:a.guid)&&s()})}return i},Nd=Object.freeze(Object.defineProperty({__proto__:null,topicData:Id},Symbol.toStringTag,{value:"Module"}));({...Nd});const Pd=e=>{const{components:t,actions:i,tags:n}=e,o=(i==null?void 0:i.dispose)??!0,s=(i==null?void 0:i.download)??!0,r=(i==null?void 0:i.visibility)??!0,a=(n==null?void 0:n.schema)??!0,l=(n==null?void 0:n.viewDefinition)??!0,d=t.get(Ht),u=document.createElement("bim-table");u.addEventListener("cellcreated",({detail:h})=>{const{cell:p}=h;p.style.padding="0.25rem 0"}),u.hiddenColumns=["modelID"],u.headersHidden=!0;const c=[];for(const[,h]of d.groups){if(!h)continue;const p={data:{Name:h.name||h.uuid,modelID:h.uuid}};c.push(p)}return u.dataTransform={Name:(h,p)=>{const{modelID:g}=p;if(typeof g!="string")return h;const _=d.groups.get(g);if(!_)return g;const v={};for(const A of _.items)v[A.id]=A.ids;let f;const{schema:y}=_.ifcMetadata;a&&y&&(f=m` - ${y} - `);let x;if(l&&"viewDefinition"in _.ifcMetadata){const A=_.ifcMetadata.viewDefinition;x=m` - ${A.split(",").map(N=>m`${N}`)} - `}let w;o&&(w=m`d.disposeGroup(_)} icon="mdi:delete">`);let E;r&&(E=m`{const N=t.get(Uo),$=A.target;N.set($.hasAttribute("data-model-hidden"),v),$.toggleAttribute("data-model-hidden"),$.icon=$.hasAttribute("data-model-hidden")?"mdi:eye-off":"mdi:eye"}} icon="mdi:eye">`);let C;return s&&(C=m`{const A=document.createElement("input");A.type="file",A.accept=".ifc",A.multiple=!1,A.addEventListener("change",async()=>{if(!(A.files&&A.files.length===1))return;const N=A.files[0],$=await N.arrayBuffer(),S=await t.get(Yr).saveToIfc(_,new Uint8Array($)),k=new File([S],N.name),U=document.createElement("a");U.href=URL.createObjectURL(k),U.download=k.name,U.click(),URL.revokeObjectURL(U.href)}),A.click()}} icon="flowbite:download-solid">`),m` -
-
-
- ${h} + `},Hd=(e,t=!0)=>{const i=V.create(Fd,e);if(t){const{components:n}=e,[o,s]=i;n.get(Be).list.onItemUpdated.add(({value:r})=>{const{topic:a}=s(),{guid:l}=r;l===(a==null?void 0:a.guid)&&s()})}return i},Bd=Object.freeze(Object.defineProperty({__proto__:null,topicData:Hd},Symbol.toStringTag,{value:"Module"}));({...Bd});const Ud=e=>{const{components:t,actions:i,tags:n}=e,o=(i==null?void 0:i.dispose)??!0,s=(i==null?void 0:i.download)??!0,r=(i==null?void 0:i.visibility)??!0,a=(n==null?void 0:n.schema)??!0,l=(n==null?void 0:n.viewDefinition)??!0,d=t.get(Bt),u=({detail:c})=>{const{cell:h}=c;h.style.padding="0.25rem 0"};return m` + {if(!c)return;const h=c;h.hiddenColumns=["modelID"];const p=[];for(const[,b]of d.groups){if(!b)continue;const v={data:{Name:b.name||b.uuid,modelID:b.uuid}};p.push(v)}h.dataTransform={Name:(b,v)=>{const{modelID:y}=v;if(typeof y!="string")return b;const g=d.groups.get(y);if(!g)return y;const _={};for(const k of g.items)_[k.id]=k.ids;let x;const{schema:w}=g.ifcMetadata;a&&w&&(x=m` + ${w} + `);let A;if(l&&"viewDefinition"in g.ifcMetadata){const k=g.ifcMetadata.viewDefinition;A=m` + ${k.split(",").map(S=>m`${S}`)} + `}let C;o&&(C=m`d.disposeGroup(g)} icon="mdi:delete">`);let N;r&&(N=m`{const S=t.get(ts),B=k.target;S.set(B.hasAttribute("data-model-hidden"),_),B.toggleAttribute("data-model-hidden"),B.icon=B.hasAttribute("data-model-hidden")?"mdi:eye-off":"mdi:eye"}} icon="mdi:eye">`);let L;return s&&(L=m`{const k=document.createElement("input");k.type="file",k.accept=".ifc",k.multiple=!1,k.addEventListener("change",async()=>{if(!(k.files&&k.files.length===1))return;const S=k.files[0],B=await S.arrayBuffer(),E=await t.get(ia).saveToIfc(g,new Uint8Array(B)),M=new File([E],S.name),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download=M.name,$.click(),URL.revokeObjectURL($.href)}),k.click()}} icon="flowbite:download-solid">`),m` +
+
+
+ ${b} +
+
+ ${x} + ${A} +
-
- ${f} - ${x} +
+ ${L} + ${N} + ${C}
-
-
- ${C} - ${E} - ${w} -
-
- `}},u.data=c,m` -
- ${c.length===0?m`No models has been loaded yet`:u} -
- `},Md=(e,t=!0)=>{const i=B.create(Pd,e);if(t){const{components:n}=e,o=n.get(Ht),[,s]=i;o.onFragmentsLoaded.add(()=>setTimeout(()=>s())),o.onFragmentsDisposed.add(()=>s())}return i},Ld=Object.freeze(Object.defineProperty({__proto__:null,modelsList:Md},Symbol.toStringTag,{value:"Module"})),Sr=["Name","ContainedInStructure","ForLayerSet","LayerThickness","HasProperties","HasAssociations","HasAssignments","HasPropertySets","PredefinedType","Quantities","ReferencedSource","Identification",e=>e.includes("Value"),e=>e.startsWith("Material"),e=>e.startsWith("Relating"),e=>{const t=["IsGroupedBy","IsDecomposedBy"];return e.startsWith("Is")&&!t.includes(e)}];async function li(e,t,i,n=Sr,o=!1){const s=e.get(at),r=await t.getProperties(i);if(!r)return{data:{Entity:`${i} properties not found...`}};const a=s.relationMaps[t.uuid],l={data:{}};for(const d in r){const u=n.map(h=>typeof h=="string"?d===h:h(d)).includes(!0);if(!(d==="type"||u))continue;const c=r[d];if(c)if(c.type===5){l.children||(l.children=[]);const h=await li(e,t,c.value,n,o);l.children.push(h)}else if(typeof c=="object"&&!Array.isArray(c)){const{value:h,type:p}=c;if(o)p===1||p===2||p===3||(l.data[d]=h);else{const g=typeof h=="number"?Number(h.toFixed(3)):h;l.data[d]=g}}else if(Array.isArray(c))for(const h of c){if(h.type!==5)continue;l.children||(l.children=[]);const p=await li(e,t,h.value,n,o);l.children.push(p)}else if(d==="type"){const h=di[c];l.data.Entity=h}else l.data[d]=c}if(a&&a.get(r.expressID)){const d=a.get(r.expressID);for(const u of n){const c=[];if(typeof u=="string"){const h=s._inverseAttributes.indexOf(u);h!==-1&&c.push(h)}else{const h=s._inverseAttributes.filter(p=>u(p));for(const p of h){const g=s._inverseAttributes.indexOf(p);c.push(g)}}for(const h of c){const p=d.get(h);if(p)for(const g of p){const _=await li(e,t,g,n,o);l.children||(l.children=[]),l.children.push(_)}}}}return l}const jd=e=>{const{components:t,fragmentIdMap:i,attributesToInclude:n,editable:o,tableDefinition:s}=e,r=t.get(Ht);let a;return typeof n=="function"?a=n(Sr):a=n,m`{if(!l)return;const d=l,u=[],c=[];for(const h in i){const p=r.list.get(h);if(!(p&&p.group))continue;const g=p.group,_=c.find(v=>v.model===g);if(_)for(const v of i[h])_.expressIDs.add(v);else{const v={model:g,expressIDs:new Set(i[h])};c.push(v)}}for(const h of c){const{model:p,expressIDs:g}=h;for(const _ of g){const v=await li(t,p,_,a,o);u.push(v)}}d.dataTransform=s,d.data=u,d.columns=[{name:"Entity",width:"minmax(15rem, 1fr)"}]})}>`},Rd=e=>B.create(jd,e),Dd=Object.freeze(Object.defineProperty({__proto__:null,entityAttributes:Rd},Symbol.toStringTag,{value:"Module"}));let yt;const zd=e=>{const{components:t,classifications:i}=e,n=t.get(Gr),o=t.get(Uo);yt||(yt=document.createElement("bim-table"),yt.headersHidden=!0,yt.hiddenColumns=["system"],yt.columns=["Name",{name:"Actions",width:"auto"}],yt.dataTransform={Actions:(r,a)=>{const{system:l,Name:d}=a;if(!(typeof l=="string"&&typeof d=="string"))return r;const u=n.list[l];if(!(u&&u[d]))return r;const c=u[d],{map:h}=c;return m` +
+ `}},h.data=p})} @cellcreated=${u} headers-hidden no-indentation> + + No models has been loaded yet + + + `},Vd=(e,t=!0)=>{const i=V.create(Ud,e);if(t){const{components:n}=e,o=n.get(Bt),[,s]=i;o.onFragmentsLoaded.add(()=>setTimeout(()=>s())),o.onFragmentsDisposed.add(()=>s())}return i},Wd=Object.freeze(Object.defineProperty({__proto__:null,modelsList:Vd},Symbol.toStringTag,{value:"Module"})),Dr=["Name","ContainedInStructure","ForLayerSet","LayerThickness","HasProperties","HasAssociations","HasAssignments","HasPropertySets","PredefinedType","Quantities","ReferencedSource","Identification",e=>e.includes("Value"),e=>e.startsWith("Material"),e=>e.startsWith("Relating"),e=>{const t=["IsGroupedBy","IsDecomposedBy"];return e.startsWith("Is")&&!t.includes(e)}];async function ui(e,t,i,n=Dr,o=!1){const s=e.get(ct),r=await t.getProperties(i);if(!r)return{data:{Entity:`${i} properties not found...`}};const a=s.relationMaps[t.uuid],l={data:{}};for(const d in r){const u=n.map(h=>typeof h=="string"?d===h:h(d)).includes(!0);if(!(d==="type"||u))continue;const c=r[d];if(c)if(c.type===5){l.children||(l.children=[]);const h=await ui(e,t,c.value,n,o);l.children.push(h)}else if(typeof c=="object"&&!Array.isArray(c)){const{value:h,type:p}=c;if(o)p===1||p===2||p===3||(l.data[d]=h);else{const b=typeof h=="number"?Number(h.toFixed(3)):h;l.data[d]=b}}else if(Array.isArray(c))for(const h of c){if(h.type!==5)continue;l.children||(l.children=[]);const p=await ui(e,t,h.value,n,o);l.children.push(p)}else if(d==="type"){const h=pi[c];l.data.Entity=h}else l.data[d]=c}if(a&&a.get(r.expressID)){const d=a.get(r.expressID);for(const u of n){const c=[];if(typeof u=="string"){const h=s._inverseAttributes.indexOf(u);h!==-1&&c.push(h)}else{const h=s._inverseAttributes.filter(p=>u(p));for(const p of h){const b=s._inverseAttributes.indexOf(p);c.push(b)}}for(const h of c){const p=d.get(h);if(p)for(const b of p){const v=await ui(e,t,b,n,o);l.children||(l.children=[]),l.children.push(v)}}}}return l}const Gd=e=>{const{components:t,fragmentIdMap:i,attributesToInclude:n,editable:o,tableDefinition:s}=e,r=t.get(Bt);let a;return typeof n=="function"?a=n(Dr):a=n,m`{if(!l)return;const d=l,u=[],c=[];for(const h in i){const p=r.list.get(h);if(!(p&&p.group))continue;const b=p.group,v=c.find(y=>y.model===b);if(v)for(const y of i[h])v.expressIDs.add(y);else{const y={model:b,expressIDs:new Set(i[h])};c.push(y)}}for(const h of c){const{model:p,expressIDs:b}=h;for(const v of b){const y=await ui(t,p,v,a,o);u.push(y)}}d.dataTransform=s,d.data=u,d.columns=[{name:"Entity",width:"minmax(15rem, 1fr)"}]})}>`},qd=e=>V.create(Gd,e),Yd=Object.freeze(Object.defineProperty({__proto__:null,entityAttributes:qd},Symbol.toStringTag,{value:"Module"}));let yt;const Xd=e=>{const{components:t,classifications:i}=e,n=t.get(na),o=t.get(ts);yt||(yt=document.createElement("bim-table"),yt.headersHidden=!0,yt.hiddenColumns=["system"],yt.columns=["Name",{name:"Actions",width:"auto"}],yt.dataTransform={Actions:(r,a)=>{const{system:l,Name:d}=a;if(!(typeof l=="string"&&typeof d=="string"))return r;const u=n.list[l];if(!(u&&u[d]))return r;const c=u[d],{map:h}=c;return m`
- {const g=p.target;o.set(g.value,h)}}> + {const b=p.target;o.set(b.value,h)}}>
- `}});const s=[];for(const r of i){const a=typeof r=="string"?r:r.system,l=typeof r=="string"?r:r.label,d=n.list[a];d&&s.push({data:{Name:l,system:a},children:Object.keys(d).map(u=>({data:{Name:u,system:a,Actions:""}}))})}return yt.data=s,m`${yt}`},Fd=(e,t=!0)=>{const i=B.create(zd,e);if(t){const{components:n}=e,o=n.get(Ht),[,s]=i;o.onFragmentsDisposed.add(()=>s())}return i},Hd=Object.freeze(Object.defineProperty({__proto__:null,classificationTree:Fd},Symbol.toStringTag,{value:"Module"})),kr=async(e,t,i)=>{var n,o,s,r;const a=e.get(at),l={data:{Name:(n=i.Name)==null?void 0:n.value},children:[{data:{Name:"Identification",Value:(o=i.Identification)==null?void 0:o.value}},{data:{Name:"Name",Value:(s=i.Name)==null?void 0:s.value}},{data:{Name:"Description",Value:(r=i.Description)==null?void 0:r.value}}]},d=a.getEntityRelations(t,i.expressID,"IsNestedBy");if(!d)return l;l.children||(l.children=[]);const u=[];l.children.push({data:{Name:"Tasks"},children:u});for(const c of d){const h=await t.getProperties(c);if(!h)continue;const p=await kr(e,t,h);u.push(p)}return l},Bd=async(e,t,i)=>{const n=[];for(const o of i){const s=await kr(e,t,o);n.push(s)}return{data:{Name:"Tasks"},children:n}},Ud=async(e,t)=>{var i,n;const o={data:{Name:"Classifications"}};for(const s of t){const{value:r}=s.ReferencedSource,a=await e.getProperties(r);if(!a)continue;const l={data:{Name:a.Name.value},children:[{data:{Name:"Identification",Value:((i=s.Identification)==null?void 0:i.value)||((n=s.ItemReference)==null?void 0:n.value)}},{data:{Name:"Name",Value:s.Name.value}}]};o.children||(o.children=[]),o.children.push(l)}return o},Vd=async(e,t)=>{const i={data:{Name:"Materials"}};for(const n of t){if(n.type===Go){const o=n.ForLayerSet.value,s=await e.getProperties(o);if(!s)continue;for(const r of s.MaterialLayers){const{value:a}=r,l=await e.getProperties(a);if(!l)continue;const d=await e.getProperties(l.Material.value);if(!d)continue;const u={data:{Name:"Layer"},children:[{data:{Name:"Thickness",Value:l.LayerThickness.value}},{data:{Name:"Material",Value:d.Name.value}}]};i.children||(i.children=[]),i.children.push(u)}}if(n.type===Yo)for(const o of n.Materials){const{value:s}=o,r=await e.getProperties(s);if(!r)continue;const a={data:{Name:"Name",Value:r.Name.value}};i.children||(i.children=[]),i.children.push(a)}if(n.type===qo){const o={data:{Name:"Name",Value:n.Name.value}};i.children||(i.children=[]),i.children.push(o)}}return i},Wd=async(e,t)=>{const i={data:{Name:"PropertySets"}};for(const n of t){const o={data:{Name:n.Name.value}};if(n.type===Vo){for(const s of n.HasProperties){const{value:r}=s,a=await e.getProperties(r);if(!a)continue;const l=Object.keys(a).find(u=>u.includes("Value"));if(!(l&&a[l]))continue;const d={data:{Name:a.Name.value,Value:a[l].value}};o.children||(o.children=[]),o.children.push(d)}o.children&&(i.children||(i.children=[]),i.children.push(o))}}return i},Gd=async(e,t)=>{const i={data:{Name:"QuantitySets"}};for(const n of t){const o={data:{Name:n.Name.value}};if(n.type===Wo){for(const s of n.Quantities){const{value:r}=s,a=await e.getProperties(r);if(!a)continue;const l=Object.keys(a).find(u=>u.includes("Value"));if(!(l&&a[l]))continue;const d={data:{Name:a.Name.value,Value:a[l].value}};o.children||(o.children=[]),o.children.push(d)}o.children&&(i.children||(i.children=[]),i.children.push(o))}}return i},qd=["OwnerHistory","ObjectPlacement","CompositionType"],Or=async(e,t)=>{const i={groupName:"Attributes",includeClass:!1,...t},{groupName:n,includeClass:o}=i,s={data:{Name:n}};o&&(s.children||(s.children=[]),s.children.push({data:{Name:"Class",Value:di[e.type]}}));for(const r in e){if(qd.includes(r))continue;const a=e[r];if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.type===sa)continue;const l={data:{Name:r,Value:a.value}};s.children||(s.children=[]),s.children.push(l)}}return s},ne=(e,...t)=>{e.children||(e.children=[]),e.children.push(...t)},Yd=async(e,t,i,n)=>{const o=e.get(at).getEntityRelations(t,i,"IsDefinedBy");if(o){const s=[],r=[];for(const l of o){const d=await t.getProperties(l);d&&(d.type===Vo&&s.push(d),d.type===Wo&&r.push(d))}const a=await Wd(t,s);a.children&&ne(n,a),(await Gd(t,r)).children&&ne(n,a)}},Xd=async(e,t,i,n)=>{const o=e.get(at).getEntityRelations(t,i,"HasAssociations");if(o){const s=[],r=[];for(const d of o){const u=await t.getProperties(d);u&&(u.type===ra&&s.push(u),(u.type===Go||u.type===aa||u.type===la||u.type===qo||u.type===Yo)&&r.push(u))}const a=await Ud(t,s);a.children&&ne(n,a);const l=await Vd(t,r);l.children&&ne(n,l)}},Jd=async(e,t,i,n)=>{const o=e.get(at).getEntityRelations(t,i,"HasAssignments");if(o){const s=[];for(const a of o){const l=await t.getProperties(a);l&&l.type===ca&&s.push(l)}const r=await Bd(e,t,s);r.children&&ne(n,r)}},Qd=async(e,t,i,n)=>{const o=e.get(at).getEntityRelations(t,i,"ContainedInStructure");if(o&&o[0]){const s=o[0],r=await t.getProperties(s);if(r){const a=await Or(r,{groupName:"SpatialContainer"});ne(n,a)}}};let ni={};const Zd=async(e,t)=>{var i;const n=e.get(at),o=e.get(Ht),s=o.getModelIdMap(t);Object.keys(t).length===0&&(ni={});const r=[];for(const a in s){const l=o.groups.get(a);if(!l)continue;const d=n.relationMaps[l.uuid];if(!d)continue;a in ni||(ni[a]=new Map);const u=ni[a],c=s[a];for(const h of c){let p=u.get(h);if(p){r.push(p);continue}const g=await l.getProperties(h);if(!g)continue;p={data:{Name:(i=g.Name)==null?void 0:i.value}},r.push(p),u.set(h,p);const _=await Or(g,{includeClass:!0});p.children||(p.children=[]),p.children.push(_),d.get(h)&&(await Yd(e,l,h,p),await Xd(e,l,h,p),await Jd(e,l,h,p),await Qd(e,l,h,p))}}return r},Kd=new Event("datacomputed");let dt;const tu=e=>{const t={emptySelectionWarning:!0,...e},{components:i,fragmentIdMap:n,emptySelectionWarning:o}=t;if(!dt&&(dt=document.createElement("bim-table"),dt.columns=[{name:"Name",width:"12rem"}],dt.headersHidden=!0,dt.addEventListener("cellcreated",({detail:s})=>{const{cell:r}=s;r.column==="Name"&&!("Value"in r.rowData)&&(r.style.gridColumn="1 / -1")}),o)){const s=document.createElement("bim-label");s.style.setProperty("--bim-icon--c","gold"),s.slot="missing-data",s.icon="ic:round-warning",s.textContent="Select some elements to display its properties",dt.append(s)}return Zd(i,n).then(s=>{dt.data=s,s.length!==0&&dt.dispatchEvent(Kd)}),m`${dt}`},eu=e=>B.create(tu,e),iu=Object.freeze(Object.defineProperty({__proto__:null,elementProperties:eu},Symbol.toStringTag,{value:"Module"})),bn=async(e,t,i,n)=>{var o;const s=[],r=e.get(at),a=await t.getProperties(i);if(!a)return s;const{type:l}=a,d={data:{Entity:di[l],Name:(o=a.Name)==null?void 0:o.value,modelID:t.uuid,expressID:i}};for(const u of n){const c=r.getEntityRelations(t,i,u);if(!c)continue;d.children||(d.children=[]),d.data.relations=JSON.stringify(c);const h={};for(const p of c){const g=await bn(e,t,p,n);for(const _ of g)if(_.data.relations)d.children.push(_);else{const v=t.data.get(p);if(!v){d.children.push(_);continue}const f=v[1][1],y=di[f];y in h||(h[y]=[]),_.data.Entity=_.data.Name,delete _.data.Name,h[y].push(_)}}for(const p in h){const g=h[p],_=g.map(f=>f.data.expressID),v={data:{Entity:p,modelID:t.uuid,relations:JSON.stringify(_)},children:g};d.children.push(v)}}return s.push(d),s},nu=async(e,t,i,n)=>{const o=e.get(at),s=[];for(const r of t){let a;if(n)a={data:{Entity:r.name!==""?r.name:r.uuid},children:await bn(e,r,n,i)};else{const l=o.relationMaps[r.uuid],d=await r.getAllPropertiesOfType(oa);if(!(l&&d))continue;const{expressID:u}=Object.values(d)[0];a={data:{Entity:r.name!==""?r.name:r.uuid},children:await bn(e,r,u,i)}}s.push(a)}return s};let ut;const ou=(e,t)=>{const i=e.get(Ht),{modelID:n,expressID:o,relations:s}=t.data;if(!n)return null;const r=i.groups.get(n);return r?r.getFragmentMap([o,...JSON.parse(s??"[]")]):null},su=e=>{const{components:t,models:i,expressID:n}=e,o=e.selectHighlighterName??"select",s=e.hoverHighlighterName??"hover";ut||(ut=document.createElement("bim-table"),ut.hiddenColumns=["modelID","expressID","relations"],ut.columns=["Entity","Name"],ut.headersHidden=!0,ut.addEventListener("cellcreated",({detail:a})=>{const{cell:l}=a;l.column==="Entity"&&!("Name"in l.rowData)&&(l.style.gridColumn="1 / -1")})),ut.addEventListener("rowcreated",a=>{a.stopImmediatePropagation();const{row:l}=a.detail,d=t.get(ua),u=ou(t,l);u&&Object.keys(u).length!==0&&(l.onmouseover=()=>{s&&(l.style.backgroundColor="var(--bim-ui_bg-contrast-20)",d.highlightByID(s,u,!0,!1,d.selection[o]??{}))},l.onmouseout=()=>{l.style.backgroundColor="",d.clear(s)},l.onclick=()=>{o&&d.highlightByID(o,u,!0,!0)})});const r=e.inverseAttributes??["IsDecomposedBy","ContainsElements"];return nu(t,i,r,n).then(a=>ut.data=a),m`${ut}`},ru=(e,t=!0)=>{const i=B.create(su,e);if(t){const[,n]=i,{components:o}=e,s=o.get(Ht),r=o.get(at),a=()=>n({models:s.groups.values()});r.onRelationsIndexed.add(a),s.onFragmentsDisposed.add(a)}return i},au=Object.freeze(Object.defineProperty({__proto__:null,relationsTree:ru},Symbol.toStringTag,{value:"Module"})),xe=(e,t)=>[...e.get(Xr).list.values()].find(i=>i.world===t),lu=(e,t)=>m` - {const n=i.target;e.color=new ze(n.color)}} color=${t}> - `,cu=(e,t)=>{const{postproduction:i}=e,n=i.n8ao.configuration;return m` - {const s=o.target;n.color=new ze(s.color)}} color=${t}> - `},du=(e,t)=>{const{color:i,opacity:n}=JSON.parse(t),{postproduction:o}=e,{customEffects:s}=o;return m` - {const{color:a,opacity:l}=r.target;s.lineColor=new ze(a).getHex(),l&&(s.opacity=l/100)}} color=${i} opacity=${n*100}> - `},uu=(e,t)=>m` - {const n=i.target,o=new ze(n.color);e.material.uniforms.uColor.value=o}} color=${t}> - `,hu=(e,t)=>{const{postproduction:i}=e;return m` + `}});const s=[];for(const r of i){const a=typeof r=="string"?r:r.system,l=typeof r=="string"?r:r.label,d=n.list[a];d&&s.push({data:{Name:l,system:a},children:Object.keys(d).map(u=>({data:{Name:u,system:a,Actions:""}}))})}return yt.data=s,m`${yt}`},Jd=(e,t=!0)=>{const i=V.create(Xd,e);if(t){const{components:n}=e,o=n.get(Bt),[,s]=i;o.onFragmentsDisposed.add(()=>s())}return i},Qd=Object.freeze(Object.defineProperty({__proto__:null,classificationTree:Jd},Symbol.toStringTag,{value:"Module"})),jr=async(e,t,i)=>{var n,o,s,r;const a=e.get(ct),l={data:{Name:(n=i.Name)==null?void 0:n.value},children:[{data:{Name:"Identification",Value:(o=i.Identification)==null?void 0:o.value}},{data:{Name:"Name",Value:(s=i.Name)==null?void 0:s.value}},{data:{Name:"Description",Value:(r=i.Description)==null?void 0:r.value}}]},d=a.getEntityRelations(t,i.expressID,"IsNestedBy");if(!d)return l;l.children||(l.children=[]);const u=[];l.children.push({data:{Name:"Tasks"},children:u});for(const c of d){const h=await t.getProperties(c);if(!h)continue;const p=await jr(e,t,h);u.push(p)}return l},Kd=async(e,t,i)=>{const n=[];for(const o of i){const s=await jr(e,t,o);n.push(s)}return{data:{Name:"Tasks"},children:n}},Zd=async(e,t)=>{var i,n;const o={data:{Name:"Classifications"}};for(const s of t){const{value:r}=s.ReferencedSource,a=await e.getProperties(r);if(!a)continue;const l={data:{Name:a.Name.value},children:[{data:{Name:"Identification",Value:((i=s.Identification)==null?void 0:i.value)||((n=s.ItemReference)==null?void 0:n.value)}},{data:{Name:"Name",Value:s.Name.value}}]};o.children||(o.children=[]),o.children.push(l)}return o},tu=async(e,t)=>{const i={data:{Name:"Materials"}};for(const n of t){if(n.type===ns){const o=n.ForLayerSet.value,s=await e.getProperties(o);if(!s)continue;for(const r of s.MaterialLayers){const{value:a}=r,l=await e.getProperties(a);if(!l)continue;const d=await e.getProperties(l.Material.value);if(!d)continue;const u={data:{Name:"Layer"},children:[{data:{Name:"Thickness",Value:l.LayerThickness.value}},{data:{Name:"Material",Value:d.Name.value}}]};i.children||(i.children=[]),i.children.push(u)}}if(n.type===ss)for(const o of n.Materials){const{value:s}=o,r=await e.getProperties(s);if(!r)continue;const a={data:{Name:"Name",Value:r.Name.value}};i.children||(i.children=[]),i.children.push(a)}if(n.type===os){const o={data:{Name:"Name",Value:n.Name.value}};i.children||(i.children=[]),i.children.push(o)}}return i},eu={IFCLENGTHMEASURE:"LENGTHUNIT",IFCAREAMEASURE:"AREAUNIT",IFCVOLUMEMEASURE:"VOLUMEUNIT",IFCPLANEANGLEMEASURE:"PLANEANGLEUNIT"},iu={MILLIMETRE:{symbol:"mm",digits:0},METRE:{symbol:"m",digits:2},KILOMETRE:{symbol:"km",digits:2},SQUARE_METRE:{symbol:"m²",digits:2},CUBIC_METRE:{symbol:"m³",digits:2},DEGREE:{symbol:"°",digits:2},RADIAN:{symbol:"rad",digits:2},GRAM:{symbol:"g",digits:0},KILOGRAM:{symbol:"kg",digits:2},MILLISECOND:{symbol:"ms",digits:0},SECOND:{symbol:"s",digits:0}},zr=async(e,t)=>{var i,n,o;const s=Object.values(await e.getAllPropertiesOfType(ya))[0];let r;for(const a of s.Units){const l=await e.getProperties(a.value);if(l&&((i=l.UnitType)==null?void 0:i.value)===eu[t]){r=`${((n=l.Prefix)==null?void 0:n.value)??""}${((o=l.Name)==null?void 0:o.value)??""}`;break}}return r?iu[r]:null},nu=async(e,t,i)=>{const{displayUnits:n}=i,o={data:{Name:"PropertySets"}};for(const s of t){const r={data:{Name:s.Name.value}};if(s.type===es){for(const a of s.HasProperties){const{value:l}=a,d=await e.getProperties(l);if(!d)continue;const u=Object.keys(d).find(b=>b.includes("Value"));if(!(u&&d[u]))continue;let c=d[u].value,h="";if(n){const{name:b}=d[u],v=await zr(e,b)??{};h=v.symbol,c=d[u].value,typeof c=="number"&&v.digits&&(c=c.toFixed(v.digits))}const p={data:{Name:d.Name.value,Value:`${c} ${h??""}`}};r.children||(r.children=[]),r.children.push(p)}r.children&&(o.children||(o.children=[]),o.children.push(r))}}return o},ou=async(e,t,i)=>{const{displayUnits:n}=i,o={data:{Name:"QuantitySets"}};for(const s of t){const r={data:{Name:s.Name.value}};if(s.type===is){for(const a of s.Quantities){const{value:l}=a,d=await e.getProperties(l);if(!d)continue;const u=Object.keys(d).find(b=>b.includes("Value"));if(!(u&&d[u]))continue;let c=d[u].value,h="";if(n){const{name:b}=d[u],v=await zr(e,b)??{};h=v.symbol,c=d[u].value,typeof c=="number"&&v.digits&&(c=c.toFixed(v.digits))}const p={data:{Name:d.Name.value,Value:`${c} ${h??""}`}};r.children||(r.children=[]),r.children.push(p)}r.children&&(o.children||(o.children=[]),o.children.push(r))}}return o},su=["OwnerHistory","ObjectPlacement","CompositionType"],Fr=async(e,t)=>{const i={groupName:"Attributes",includeClass:!1,...t},{groupName:n,includeClass:o}=i,s={data:{Name:n}};o&&(s.children||(s.children=[]),s.children.push({data:{Name:"Class",Value:pi[e.type]}}));for(const r in e){if(su.includes(r))continue;const a=e[r];if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.type===ma)continue;const l={data:{Name:r,Value:a.value}};s.children||(s.children=[]),s.children.push(l)}}return s},ne=(e,...t)=>{e.children||(e.children=[]),e.children.push(...t)},ru=async(e,t,i,n,o)=>{const s=e.get(ct).getEntityRelations(t,i,"IsDefinedBy");if(s){const r=[],a=[];for(const u of s){const c=await t.getProperties(u);c&&(c.type===es&&r.push(c),c.type===is&&a.push(c))}const l=await nu(t,r,o);l.children&&ne(n,l);const d=await ou(t,a,o);d.children&&ne(n,d)}},au=async(e,t,i,n)=>{const o=e.get(ct).getEntityRelations(t,i,"HasAssociations");if(o){const s=[],r=[];for(const d of o){const u=await t.getProperties(d);u&&(u.type===ba&&s.push(u),(u.type===ns||u.type===fa||u.type===ga||u.type===os||u.type===ss)&&r.push(u))}const a=await Zd(t,s);a.children&&ne(n,a);const l=await tu(t,r);l.children&&ne(n,l)}},lu=async(e,t,i,n)=>{const o=e.get(ct).getEntityRelations(t,i,"HasAssignments");if(o){const s=[];for(const a of o){const l=await t.getProperties(a);l&&l.type===va&&s.push(l)}const r=await Kd(e,t,s);r.children&&ne(n,r)}},cu=async(e,t,i,n)=>{const o=e.get(ct).getEntityRelations(t,i,"ContainedInStructure");if(o&&o[0]){const s=o[0],r=await t.getProperties(s);if(r){const a=await Fr(r,{groupName:"SpatialContainer"});ne(n,a)}}};let ri={};const du=async(e,t,i)=>{var n;const o=e.get(ct),s=e.get(Bt),r=s.getModelIdMap(t);Object.keys(t).length===0&&(ri={});const a=[];for(const l in r){const d=s.groups.get(l);if(!d)continue;const u=o.relationMaps[d.uuid];if(!u)continue;l in ri||(ri[l]=new Map);const c=ri[l],h=r[l];for(const p of h){let b=c.get(p);if(b){a.push(b);continue}const v=await d.getProperties(p);if(!v)continue;b={data:{Name:(n=v.Name)==null?void 0:n.value}},a.push(b),c.set(p,b);const y=await Fr(v,{includeClass:!0});b.children||(b.children=[]),b.children.push(y),u.get(p)&&(await ru(e,d,p,b,i),await au(e,d,p,b),await lu(e,d,p,b),await cu(e,d,p,b))}}return a},uu=e=>{const t={emptySelectionWarning:!0,...e},{components:i,fragmentIdMap:n,emptySelectionWarning:o}=t;return m` + {const{cell:r}=s;r.column==="Name"&&!("Value"in r.rowData)&&(r.style.gridColumn="1 / -1")}} ${W(async s=>{if(!s)return;const r=s;r.columns=[{name:"Name",width:"12rem"}],r.headersHidden=!0,r.loadFunction=()=>du(i,n,e),await r.loadData(!0)&&r.dispatchEvent(new Event("datacomputed"))})}> + ${o?m` + + Select some elements to display its properties + + `:null} + + `},hu=e=>V.create(uu,e),pu=Object.freeze(Object.defineProperty({__proto__:null,elementProperties:hu},Symbol.toStringTag,{value:"Module"})),xn=async(e,t,i,n)=>{var o;const s=[],r=e.get(ct),a=await t.getProperties(i);if(!a)return s;const{type:l}=a,d={data:{Entity:pi[l],Name:(o=a.Name)==null?void 0:o.value,modelID:t.uuid,expressID:i}};for(const u of n){const c=r.getEntityRelations(t,i,u);if(!c)continue;d.children||(d.children=[]),d.data.relations=JSON.stringify(c);const h={};for(const p of c){const b=await xn(e,t,p,n);for(const v of b)if(v.data.relations)d.children.push(v);else{const y=t.data.get(p);if(!y){d.children.push(v);continue}const g=y[1][1],_=pi[g];_ in h||(h[_]=[]),v.data.Entity=v.data.Name,delete v.data.Name,h[_].push(v)}}for(const p in h){const b=h[p],v=b.map(g=>g.data.expressID),y={data:{Entity:p,modelID:t.uuid,relations:JSON.stringify(v)},children:b};d.children.push(y)}}return s.push(d),s},mu=async(e,t,i,n)=>{const o=e.get(ct),s=[];for(const r of t){let a;if(n)a={data:{Entity:r.name!==""?r.name:r.uuid},children:await xn(e,r,n,i)};else{const l=o.relationMaps[r.uuid],d=await r.getAllPropertiesOfType(pa);if(!(l&&d))continue;const{expressID:u}=Object.values(d)[0];a={data:{Entity:r.name!==""?r.name:r.uuid},children:await xn(e,r,u,i)}}s.push(a)}return s};let ut;const bu=(e,t)=>{const i=e.get(Bt),{modelID:n,expressID:o,relations:s}=t.data;if(!n)return null;const r=i.groups.get(n);return r?r.getFragmentMap([o,...JSON.parse(s??"[]")]):null},fu=e=>{const{components:t,models:i,expressID:n}=e,o=e.selectHighlighterName??"select",s=e.hoverHighlighterName??"hover";ut||(ut=document.createElement("bim-table"),ut.hiddenColumns=["modelID","expressID","relations"],ut.columns=["Entity","Name"],ut.headersHidden=!0,ut.addEventListener("cellcreated",({detail:a})=>{const{cell:l}=a;l.column==="Entity"&&!("Name"in l.rowData)&&(l.style.gridColumn="1 / -1")})),ut.addEventListener("rowcreated",a=>{a.stopImmediatePropagation();const{row:l}=a.detail,d=t.get(xa),u=bu(t,l);u&&Object.keys(u).length!==0&&(l.onmouseover=()=>{s&&(l.style.backgroundColor="var(--bim-ui_bg-contrast-20)",d.highlightByID(s,u,!0,!1,d.selection[o]??{}))},l.onmouseout=()=>{l.style.backgroundColor="",d.clear(s)},l.onclick=()=>{o&&d.highlightByID(o,u,!0,!0)})});const r=e.inverseAttributes??["IsDecomposedBy","ContainsElements"];return mu(t,i,r,n).then(a=>ut.data=a),m`${ut}`},gu=(e,t=!0)=>{const i=V.create(fu,e);if(t){const[,n]=i,{components:o}=e,s=o.get(Bt),r=o.get(ct),a=()=>n({models:s.groups.values()});r.onRelationsIndexed.add(a),s.onFragmentsDisposed.add(a)}return i},vu=Object.freeze(Object.defineProperty({__proto__:null,relationsTree:gu},Symbol.toStringTag,{value:"Module"})),$e=(e,t)=>[...e.get(Zo).list.values()].find(i=>i.world===t),yu=(e,t)=>m` + {const n=i.target;e.color=new ae(n.color)}} color=${t}> + `,_u=(e,t)=>{const{postproduction:i}=e,n=i.n8ao.configuration;return m` + {const s=o.target;n.color=new ae(s.color)}} color=${t}> + `},xu=(e,t)=>{const{color:i,opacity:n}=JSON.parse(t),{postproduction:o}=e,{customEffects:s}=o;return m` + {const{color:a,opacity:l}=r.target;s.lineColor=new ae(a).getHex(),l&&(s.opacity=l/100)}} color=${i} opacity=${n*100}> + `},wu=(e,t)=>m` + {const n=i.target,o=new ae(n.color);e.material.uniforms.uColor.value=o}} color=${t}> + `,$u=(e,t)=>{const{postproduction:i}=e;return m` {const o=n.target;i.setPasses({ao:o.checked})}} .checked=${t}> - `},pu=(e,t)=>{const{postproduction:i}=e;return m` + `},Cu=(e,t)=>{const{postproduction:i}=e;return m` {const o=n.target;i.setPasses({gamma:o.checked})}} .checked=${t}> - `},mu=(e,t)=>{const{postproduction:i}=e;return m` + `},Au=(e,t)=>{const{postproduction:i}=e;return m` {const o=n.target;i.setPasses({custom:o.checked})}} .checked=${t}> `},_t=(e,t,i,n=()=>{})=>m` @@ -2055,53 +2077,71 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m step=${l} @change="${h=>{const p=h.target.value;e[t]=p,c(p)}}" > - `},bu=e=>{const{components:t}=e,i=t.get(gn);return m`{var o,s,r,a,l;if(!n)return;const d=n;d.preserveStructureOnFilter=!0,d.dataTransform={Value:(c,h)=>{const p=h.World,g=i.list.get(p);if(!g)return c;const{scene:_,camera:v,renderer:f}=g,y=h.Name;if(y==="Grid"&&h.IsGridConfig&&typeof c=="boolean"){const x=xe(t,g);return x?_t(x,"visible",c):c}if(y==="Color"&&h.IsGridConfig&&typeof c=="string"){const x=xe(t,g);return x?uu(x,c):c}if(y==="Distance"&&h.IsGridConfig&&typeof c=="number"){const x=xe(t,g);return x?P(x.material.uniforms.uDistance,"value",c,{slider:!0,min:300,max:1e3}):c}if(y==="Size"&&h.IsGridConfig&&typeof c=="string"){const x=xe(t,g);if(!x)return c;const{x:w,y:E}=JSON.parse(c),C=P(x.material.uniforms.uSize1,"value",w,{slider:!0,suffix:"m",prefix:"A",min:1,max:20}),A=P(x.material.uniforms.uSize2,"value",E,{slider:!0,suffix:"m",prefix:"B",min:1,max:20});return m` -
${C}${A}
- `}if(y==="Near Frustum"&&v.three instanceof ti&&typeof c=="number"){const x=v.three;return P(v.three,"near",c,{slider:!0,min:.1,max:10,step:.1,onInputSet:()=>x.updateProjectionMatrix()})}if(y==="Far Frustum"&&v.three instanceof ti&&typeof c=="number"){const x=v.three;return P(v.three,"far",c,{slider:!0,min:300,max:2e3,step:10,onInputSet:()=>x.updateProjectionMatrix()})}if(y==="Field of View"&&v.three instanceof ti&&typeof c=="number"){const x=v.three;return P(v.three,"fov",c,{slider:!0,min:10,max:120,onInputSet:()=>x.updateProjectionMatrix()})}if(y==="Invert Drag"&&v.hasCameraControls()&&typeof c=="boolean")return _t(v.controls,"dollyDragInverted",c);if(y==="Dolly Speed"&&v.hasCameraControls()&&typeof c=="number")return P(v.controls,"dollySpeed",c,{slider:!0,min:.5,max:3,step:.1});if(y==="Truck Speed"&&v.hasCameraControls()&&typeof c=="number")return P(v.controls,"truckSpeed",c,{slider:!0,min:.5,max:6,step:.1});if(y==="Smooth Time"&&v.hasCameraControls()&&typeof c=="number")return P(v.controls,"smoothTime",c,{slider:!0,min:.01,max:2,step:.01});if(y==="Intensity"&&typeof c=="number"){if(h.Light&&typeof h.Light=="string"){const x=_.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof ye?P(x,"intensity",c,{slider:!0,min:0,max:10,step:.1}):c}if(h.IsAOConfig&&f instanceof L)return P(f.postproduction.n8ao.configuration,"intensity",c,{slider:!0,max:16,step:.1})}if(y==="Color"&&typeof c=="string"){const x=h.Light,w=_.three.children.find(E=>E.uuid===x);if(w&&w instanceof ye)return lu(w,c);if(h.IsAOConfig&&f instanceof L)return cu(f,c)}if(y==="Ambient Oclussion"&&typeof c=="boolean"&&h.IsAOConfig&&f instanceof L)return hu(f,c);if(y==="Half Resolution"&&h.IsAOConfig&&f instanceof L&&typeof c=="boolean")return _t(f.postproduction.n8ao.configuration,"halfRes",c);if(y==="Screen Space Radius"&&h.IsAOConfig&&f instanceof L&&typeof c=="boolean")return _t(f.postproduction.n8ao.configuration,"screenSpaceRadius",c);if(y==="Radius"&&h.IsAOConfig&&f instanceof L&&typeof c=="number")return P(f.postproduction.n8ao.configuration,"aoRadius",c,{slider:!0,max:2,step:.1});if(y==="Denoise Samples"&&h.IsAOConfig&&f instanceof L&&typeof c=="number")return P(f.postproduction.n8ao.configuration,"denoiseSamples",c,{slider:!0,min:1,max:16});if(y==="Samples"&&h.IsAOConfig&&f instanceof L&&typeof c=="number")return P(f.postproduction.n8ao.configuration,"aoSamples",c,{slider:!0,min:1,max:16});if(y==="Denoise Radius"&&h.IsAOConfig&&f instanceof L&&typeof c=="number")return P(f.postproduction.n8ao.configuration,"denoiseRadius",c,{slider:!0,min:0,max:16,step:.1});if(y==="Distance Falloff"&&h.IsAOConfig&&f instanceof L&&typeof c=="number")return P(f.postproduction.n8ao.configuration,"distanceFalloff",c,{slider:!0,min:0,max:4,step:.1});if(y==="Directional Light"&&h.Light&&typeof h.Light=="string"&&typeof c=="boolean"){const x=_.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof ye?_t(x,"visible",c):c}if(y==="Ambient Light"&&h.Light&&typeof h.Light=="string"&&typeof c=="boolean"){const x=_.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof ye?_t(x,"visible",c):c}if(y==="Position"&&h.Light&&typeof h.Light=="string"&&typeof c=="string"){const x=_.three.children.find(S=>S.uuid===h.Light);if(!(x&&x instanceof ye))return c;const{x:w,y:E,z:C}=JSON.parse(c),A=P(x.position,"x",w,{slider:!0,prefix:"X",suffix:"m",min:-50,max:50}),N=P(x.position,"y",E,{slider:!0,prefix:"Y",suffix:"m",min:-50,max:50}),$=P(x.position,"z",C,{slider:!0,prefix:"Z",suffix:"m",min:-50,max:50});return m` -
${A}${N}${$}
- `}return y==="Custom Effects"&&h.IsCEConfig&&f instanceof L&&typeof c=="boolean"?mu(f,c):y==="Color"&&h.IsOutlineConfig&&f instanceof L&&typeof c=="string"?du(f,c):y==="Tolerance"&&h.IsOutlineConfig&&f instanceof L&&typeof c=="number"?P(f.postproduction.customEffects,"tolerance",c,{slider:!0,min:0,max:6,step:.01}):y==="Outline"&&h.IsOutlineConfig&&f instanceof L&&typeof c=="boolean"?_t(f.postproduction.customEffects,"outlineEnabled",c):y==="Gloss"&&h.IsGlossConfig&&f instanceof L&&typeof c=="boolean"?_t(f.postproduction.customEffects,"glossEnabled",c):y==="Min"&&h.IsGlossConfig&&f instanceof L&&typeof c=="number"?P(f.postproduction.customEffects,"minGloss",c,{slider:!0,min:-.5,max:.5,step:.01}):y==="Max"&&h.IsGlossConfig&&f instanceof L&&typeof c=="number"?P(f.postproduction.customEffects,"maxGloss",c,{slider:!0,min:-.5,max:.5,step:.01}):y==="Exponent"&&h.IsGlossConfig&&f instanceof L&&typeof c=="number"?P(f.postproduction.customEffects,"glossExponent",c,{slider:!0,min:0,max:5,step:.01}):y==="Gamma Correction"&&h.IsGammaConfig&&f instanceof L&&typeof c=="boolean"?pu(f,c):c}},d.addEventListener("cellcreated",({detail:c})=>{const h=c.cell.parentNode;if(!h)return;const p=h.querySelector("bim-table-cell[column='Name']"),g=h.querySelector("bim-table-cell[column='Value']");p&&!g&&(p.style.gridColumn="1 / -1")});const u=[];for(const[,c]of i.list){const{scene:h,camera:p,renderer:g}=c,_=xe(t,c),v={data:{Name:c instanceof qr&&c.name||c.uuid},children:[]};if(h){const f={data:{Name:"Scene"}};if(_){const w={data:{Name:"Grid",Value:_.three.visible,World:c.uuid,IsGridConfig:!0},children:[{data:{Name:"Color",get Value(){return`#${_.material.uniforms.uColor.value.getHexString()}`},World:c.uuid,IsGridConfig:!0}},{data:{Name:"Size",get Value(){const E=_.material.uniforms.uSize1.value,C=_.material.uniforms.uSize2.value;return JSON.stringify({x:E,y:C})},World:c.uuid,IsGridConfig:!0}},{data:{Name:"Distance",Value:_.material.uniforms.uDistance.value,World:c.uuid,IsGridConfig:!0}}]};f.children||(f.children=[]),f.children.push(w)}const y=h.three.children.filter(w=>w instanceof ta);for(const w of y){const E={data:{Name:"Directional Light",Value:w.visible,World:c.uuid,Light:w.uuid},children:[{data:{Name:"Position",Value:JSON.stringify(w.position),World:c.uuid,Light:w.uuid}},{data:{Name:"Intensity",Value:w.intensity,World:c.uuid,Light:w.uuid}},{data:{Name:"Color",Value:`#${w.color.getHexString()}`,World:c.uuid,Light:w.uuid}}]};f.children||(f.children=[]),f.children.push(E)}const x=h.three.children.filter(w=>w instanceof ea);for(const w of x){const E={data:{Name:"Ambient Light",Value:w.visible,World:c.uuid,Light:w.uuid},children:[{data:{Name:"Intensity",Value:w.intensity,World:c.uuid,Light:w.uuid}},{data:{Name:"Color",Value:`#${w.color.getHexString()}`,World:c.uuid,Light:w.uuid}}]};f.children||(f.children=[]),f.children.push(E)}f.children&&((o=f.children)==null?void 0:o.length)>0&&((s=v.children)==null||s.push(f))}if(p.three instanceof ti){const f={data:{Name:"Perspective Camera"},children:[{data:{Name:"Near Frustum",Value:p.three.near,World:c.uuid}},{data:{Name:"Far Frustum",Value:p.three.far,World:c.uuid}},{data:{Name:"Field of View",Value:p.three.fov,World:c.uuid}}]};if(p.hasCameraControls()){const{controls:y}=p,x={dollyDragInverted:"Invert Drag",dollySpeed:"Dolly Speed",truckSpeed:"Truck Speed",smoothTime:"Smooth Time"};for(const w in x){const E=y[w];E!=null&&((r=f.children)==null||r.push({data:{Name:x[w],Value:E,World:c.uuid}}))}}(a=v.children)==null||a.push(f)}if(g instanceof L){const{postproduction:f}=g,y=f.n8ao.configuration,x={data:{Name:"Renderer"},children:[{data:{Name:"Gamma Correction",Value:f.settings.gamma??!1,World:c.uuid,IsGammaConfig:!0}},{data:{Name:"Ambient Oclussion",Value:f.settings.ao??!1,World:c.uuid,IsAOConfig:!0},children:[{data:{Name:"Samples",Value:y.aoSamples,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Color",Value:`#${y.color.getHexString()}`,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Half Resolution",Value:y.halfRes,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Screen Space Radius",Value:y.screenSpaceRadius,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Radius",Value:y.aoRadius,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Intensity",Value:y.intensity,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Distance Falloff",Value:y.distanceFalloff,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Denoise Samples",Value:y.denoiseSamples,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Denoise Radius",Value:y.denoiseRadius,World:c.uuid,IsAOConfig:!0}}]},{data:{Name:"Custom Effects",Value:f.settings.custom??!1,World:c.uuid,IsCEConfig:!0},children:[{data:{Name:"Gloss",Value:f.customEffects.glossEnabled,World:c.uuid,IsGlossConfig:!0},children:[{data:{Name:"Min",Value:f.customEffects.minGloss,World:c.uuid,IsGlossConfig:!0}},{data:{Name:"Max",Value:f.customEffects.maxGloss,World:c.uuid,IsGlossConfig:!0}},{data:{Name:"Exponent",Value:f.customEffects.glossExponent,World:c.uuid,IsGlossConfig:!0}}]},{data:{Name:"Outline",Value:f.customEffects.outlineEnabled,World:c.uuid,IsOutlineConfig:!0},children:[{data:{Name:"Color",get Value(){const w=new ze(f.customEffects.lineColor),E=f.customEffects.opacity;return JSON.stringify({color:`#${w.getHexString()}`,opacity:E})},World:c.uuid,IsOutlineConfig:!0}},{data:{Name:"Tolerance",Value:f.customEffects.tolerance,World:c.uuid,IsOutlineConfig:!0}}]}]}]};(l=v.children)==null||l.push(x)}u.push(v)}d.columns=[{name:"Name",width:"11rem"}],d.hiddenColumns=["World","Light","IsAOConfig","IsCEConfig","IsGlossConfig","IsOutlineConfig","IsGammaConfig","IsGridConfig"],d.data=u})} headers-hidden expanded>
`},fu=(e,t=!0)=>{const i=B.create(bu,e);if(t){const[n]=i,o=()=>i[1](),{components:s}=e,r=s.get(gn);r.onDisposed.add(n.remove);for(const[,a]of r.list)a.onDisposed.add(o);n.addEventListener("disconnected",()=>{r.onDisposed.remove(n.remove);for(const[,a]of r.list)a.onDisposed.remove(o)})}return i},gu=Object.freeze(Object.defineProperty({__proto__:null,worldsConfiguration:fu},Symbol.toStringTag,{value:"Module"}));({...Ld,...Dd,...Hd,...iu,...au,...gu,..._d,...Ad,...wd});/** + `},Eu=e=>{const{components:t}=e,i=t.get(Ni);return m` + {const o=n.cell.parentNode;if(!o)return;const s=o.querySelector("bim-table-cell[column='Name']"),r=o.querySelector("bim-table-cell[column='Value']");s&&!r&&(s.style.gridColumn="1 / -1")}} ${W(async n=>{var o,s,r,a,l;if(!n)return;const d=n;d.preserveStructureOnFilter=!0,d.dataTransform={Value:(c,h)=>{const p=h.World,b=i.list.get(p);if(!b)return c;const{scene:v,camera:y,renderer:g}=b,_=h.Name;if(_==="Grid"&&h.IsGridConfig&&typeof c=="boolean"){const x=$e(t,b);return x?_t(x,"visible",c):c}if(_==="Color"&&h.IsGridConfig&&typeof c=="string"){const x=$e(t,b);return x?wu(x,c):c}if(_==="Distance"&&h.IsGridConfig&&typeof c=="number"){const x=$e(t,b);return x?P(x.material.uniforms.uDistance,"value",c,{slider:!0,min:300,max:1e3}):c}if(_==="Size"&&h.IsGridConfig&&typeof c=="string"){const x=$e(t,b);if(!x)return c;const{x:w,y:A}=JSON.parse(c),C=P(x.material.uniforms.uSize1,"value",w,{slider:!0,suffix:"m",prefix:"A",min:1,max:20}),N=P(x.material.uniforms.uSize2,"value",A,{slider:!0,suffix:"m",prefix:"B",min:1,max:20});return m` +
${C}${N}
+ `}if(_==="Near Frustum"&&y.three instanceof ni&&typeof c=="number"){const x=y.three;return P(y.three,"near",c,{slider:!0,min:.1,max:10,step:.1,onInputSet:()=>x.updateProjectionMatrix()})}if(_==="Far Frustum"&&y.three instanceof ni&&typeof c=="number"){const x=y.three;return P(y.three,"far",c,{slider:!0,min:300,max:2e3,step:10,onInputSet:()=>x.updateProjectionMatrix()})}if(_==="Field of View"&&y.three instanceof ni&&typeof c=="number"){const x=y.three;return P(y.three,"fov",c,{slider:!0,min:10,max:120,onInputSet:()=>x.updateProjectionMatrix()})}if(_==="Invert Drag"&&y.hasCameraControls()&&typeof c=="boolean")return _t(y.controls,"dollyDragInverted",c);if(_==="Dolly Speed"&&y.hasCameraControls()&&typeof c=="number")return P(y.controls,"dollySpeed",c,{slider:!0,min:.5,max:3,step:.1});if(_==="Truck Speed"&&y.hasCameraControls()&&typeof c=="number")return P(y.controls,"truckSpeed",c,{slider:!0,min:.5,max:6,step:.1});if(_==="Smooth Time"&&y.hasCameraControls()&&typeof c=="number")return P(y.controls,"smoothTime",c,{slider:!0,min:.01,max:2,step:.01});if(_==="Intensity"&&typeof c=="number"){if(h.Light&&typeof h.Light=="string"){const x=v.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof _e?P(x,"intensity",c,{slider:!0,min:0,max:10,step:.1}):c}if(h.IsAOConfig&&g instanceof R)return P(g.postproduction.n8ao.configuration,"intensity",c,{slider:!0,max:16,step:.1})}if(_==="Color"&&typeof c=="string"){const x=h.Light,w=v.three.children.find(A=>A.uuid===x);if(w&&w instanceof _e)return yu(w,c);if(h.IsAOConfig&&g instanceof R)return _u(g,c)}if(_==="Ambient Oclussion"&&typeof c=="boolean"&&h.IsAOConfig&&g instanceof R)return $u(g,c);if(_==="Half Resolution"&&h.IsAOConfig&&g instanceof R&&typeof c=="boolean")return _t(g.postproduction.n8ao.configuration,"halfRes",c);if(_==="Screen Space Radius"&&h.IsAOConfig&&g instanceof R&&typeof c=="boolean")return _t(g.postproduction.n8ao.configuration,"screenSpaceRadius",c);if(_==="Radius"&&h.IsAOConfig&&g instanceof R&&typeof c=="number")return P(g.postproduction.n8ao.configuration,"aoRadius",c,{slider:!0,max:2,step:.1});if(_==="Denoise Samples"&&h.IsAOConfig&&g instanceof R&&typeof c=="number")return P(g.postproduction.n8ao.configuration,"denoiseSamples",c,{slider:!0,min:1,max:16});if(_==="Samples"&&h.IsAOConfig&&g instanceof R&&typeof c=="number")return P(g.postproduction.n8ao.configuration,"aoSamples",c,{slider:!0,min:1,max:16});if(_==="Denoise Radius"&&h.IsAOConfig&&g instanceof R&&typeof c=="number")return P(g.postproduction.n8ao.configuration,"denoiseRadius",c,{slider:!0,min:0,max:16,step:.1});if(_==="Distance Falloff"&&h.IsAOConfig&&g instanceof R&&typeof c=="number")return P(g.postproduction.n8ao.configuration,"distanceFalloff",c,{slider:!0,min:0,max:4,step:.1});if(_==="Directional Light"&&h.Light&&typeof h.Light=="string"&&typeof c=="boolean"){const x=v.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof _e?_t(x,"visible",c):c}if(_==="Ambient Light"&&h.Light&&typeof h.Light=="string"&&typeof c=="boolean"){const x=v.three.children.find(w=>w.uuid===h.Light);return x&&x instanceof _e?_t(x,"visible",c):c}if(_==="Position"&&h.Light&&typeof h.Light=="string"&&typeof c=="string"){const x=v.three.children.find(S=>S.uuid===h.Light);if(!(x&&x instanceof _e))return c;const{x:w,y:A,z:C}=JSON.parse(c),N=P(x.position,"x",w,{slider:!0,prefix:"X",suffix:"m",min:-50,max:50}),L=P(x.position,"y",A,{slider:!0,prefix:"Y",suffix:"m",min:-50,max:50}),k=P(x.position,"z",C,{slider:!0,prefix:"Z",suffix:"m",min:-50,max:50});return m` +
${N}${L}${k}
+ `}return _==="Custom Effects"&&h.IsCEConfig&&g instanceof R&&typeof c=="boolean"?Au(g,c):_==="Color"&&h.IsOutlineConfig&&g instanceof R&&typeof c=="string"?xu(g,c):_==="Tolerance"&&h.IsOutlineConfig&&g instanceof R&&typeof c=="number"?P(g.postproduction.customEffects,"tolerance",c,{slider:!0,min:0,max:6,step:.01}):_==="Outline"&&h.IsOutlineConfig&&g instanceof R&&typeof c=="boolean"?_t(g.postproduction.customEffects,"outlineEnabled",c):_==="Gloss"&&h.IsGlossConfig&&g instanceof R&&typeof c=="boolean"?_t(g.postproduction.customEffects,"glossEnabled",c):_==="Min"&&h.IsGlossConfig&&g instanceof R&&typeof c=="number"?P(g.postproduction.customEffects,"minGloss",c,{slider:!0,min:-.5,max:.5,step:.01}):_==="Max"&&h.IsGlossConfig&&g instanceof R&&typeof c=="number"?P(g.postproduction.customEffects,"maxGloss",c,{slider:!0,min:-.5,max:.5,step:.01}):_==="Exponent"&&h.IsGlossConfig&&g instanceof R&&typeof c=="number"?P(g.postproduction.customEffects,"glossExponent",c,{slider:!0,min:0,max:5,step:.01}):_==="Gamma Correction"&&h.IsGammaConfig&&g instanceof R&&typeof c=="boolean"?Cu(g,c):c}};const u=[];for(const[,c]of i.list){const{scene:h,camera:p,renderer:b}=c,v=$e(t,c),y={data:{Name:c instanceof oa&&c.name||c.uuid},children:[]};if(h){const g={data:{Name:"Scene"}};if(v){const w=`#${v.material.uniforms.uColor.value.getHexString()}`,A=JSON.stringify({x:v.material.uniforms.uSize1.value,y:v.material.uniforms.uSize2.value}),C={data:{Name:"Grid",Value:v.three.visible,World:c.uuid,IsGridConfig:!0},children:[{data:{Name:"Color",Value:w,World:c.uuid,IsGridConfig:!0}},{data:{Name:"Size",Value:A,World:c.uuid,IsGridConfig:!0}},{data:{Name:"Distance",Value:v.material.uniforms.uDistance.value,World:c.uuid,IsGridConfig:!0}}]};g.children||(g.children=[]),g.children.push(C)}const _=h.three.children.filter(w=>w instanceof ca);for(const w of _){const A={data:{Name:"Directional Light",Value:w.visible,World:c.uuid,Light:w.uuid},children:[{data:{Name:"Position",Value:JSON.stringify(w.position),World:c.uuid,Light:w.uuid}},{data:{Name:"Intensity",Value:w.intensity,World:c.uuid,Light:w.uuid}},{data:{Name:"Color",Value:`#${w.color.getHexString()}`,World:c.uuid,Light:w.uuid}}]};g.children||(g.children=[]),g.children.push(A)}const x=h.three.children.filter(w=>w instanceof da);for(const w of x){const A={data:{Name:"Ambient Light",Value:w.visible,World:c.uuid,Light:w.uuid},children:[{data:{Name:"Intensity",Value:w.intensity,World:c.uuid,Light:w.uuid}},{data:{Name:"Color",Value:`#${w.color.getHexString()}`,World:c.uuid,Light:w.uuid}}]};g.children||(g.children=[]),g.children.push(A)}g.children&&((o=g.children)==null?void 0:o.length)>0&&((s=y.children)==null||s.push(g))}if(p.three instanceof ni){const g={data:{Name:"Perspective Camera"},children:[{data:{Name:"Near Frustum",Value:p.three.near,World:c.uuid}},{data:{Name:"Far Frustum",Value:p.three.far,World:c.uuid}},{data:{Name:"Field of View",Value:p.three.fov,World:c.uuid}}]};if(p.hasCameraControls()){const{controls:_}=p,x={dollyDragInverted:"Invert Drag",dollySpeed:"Dolly Speed",truckSpeed:"Truck Speed",smoothTime:"Smooth Time"};for(const w in x){const A=_[w];A!=null&&((r=g.children)==null||r.push({data:{Name:x[w],Value:A,World:c.uuid}}))}}(a=y.children)==null||a.push(g)}if(b instanceof R){const{postproduction:g}=b,_=g.n8ao.configuration,x={data:{Name:"Renderer"},children:[{data:{Name:"Gamma Correction",Value:g.settings.gamma??!1,World:c.uuid,IsGammaConfig:!0}},{data:{Name:"Ambient Oclussion",Value:g.settings.ao??!1,World:c.uuid,IsAOConfig:!0},children:[{data:{Name:"Samples",Value:_.aoSamples,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Color",Value:`#${_.color.getHexString()}`,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Half Resolution",Value:_.halfRes,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Screen Space Radius",Value:_.screenSpaceRadius,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Radius",Value:_.aoRadius,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Intensity",Value:_.intensity,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Distance Falloff",Value:_.distanceFalloff,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Denoise Samples",Value:_.denoiseSamples,World:c.uuid,IsAOConfig:!0}},{data:{Name:"Denoise Radius",Value:_.denoiseRadius,World:c.uuid,IsAOConfig:!0}}]},{data:{Name:"Custom Effects",Value:g.settings.custom??!1,World:c.uuid,IsCEConfig:!0},children:[{data:{Name:"Gloss",Value:g.customEffects.glossEnabled,World:c.uuid,IsGlossConfig:!0},children:[{data:{Name:"Min",Value:g.customEffects.minGloss,World:c.uuid,IsGlossConfig:!0}},{data:{Name:"Max",Value:g.customEffects.maxGloss,World:c.uuid,IsGlossConfig:!0}},{data:{Name:"Exponent",Value:g.customEffects.glossExponent,World:c.uuid,IsGlossConfig:!0}}]},{data:{Name:"Outline",Value:g.customEffects.outlineEnabled,World:c.uuid,IsOutlineConfig:!0},children:[{data:{Name:"Color",get Value(){const w=new ae(g.customEffects.lineColor),A=g.customEffects.opacity;return JSON.stringify({color:`#${w.getHexString()}`,opacity:A})},World:c.uuid,IsOutlineConfig:!0}},{data:{Name:"Tolerance",Value:g.customEffects.tolerance,World:c.uuid,IsOutlineConfig:!0}}]}]}]};(l=y.children)==null||l.push(x)}u.push(y)}d.columns=[{name:"Name",width:"11rem"}],d.hiddenColumns=["World","Light","IsAOConfig","IsCEConfig","IsGlossConfig","IsOutlineConfig","IsGammaConfig","IsGridConfig"],d.data=u})} headers-hidden expanded> + + No worlds to configure + +
+ `},Su=(e,t=!0)=>{const i=V.create(Eu,e);if(t){const[,n]=i,{components:o}=e;o.get(Ni).list.onItemDeleted.add(()=>n())}return i},ku=Object.freeze(Object.defineProperty({__proto__:null,worldsConfiguration:Su},Symbol.toStringTag,{value:"Module"}));({...Wd,...Yd,...Qd,...pu,...vu,...ku,...Od,...Rd,...Id});/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Si=globalThis,ki=Si.trustedTypes,Do=ki?ki.createPolicy("lit-html",{createHTML:e=>e}):void 0,Hr="$lit$",wt=`lit$${Math.random().toFixed(9).slice(2)}$`,Br="?"+wt,Tu=`<${Br}>`,Ht=document,ze=()=>Ht.createComment(""),Fe=e=>e===null||typeof e!="object"&&typeof e!="function",Hn=Array.isArray,Ou=e=>Hn(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",on=`[ +\f\r]`,Ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jo=/-->/g,zo=/>/g,Pt=RegExp(`>|${on}(?:([^\\s"'>=/]+)(${on}*=${on}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),Fo=/'/g,Ho=/"/g,Ur=/^(?:script|style|textarea|title)$/i,Nu=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),Bn=Nu(1),oe=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),Bo=new WeakMap,Lt=Ht.createTreeWalker(Ht,129);function Vr(e,t){if(!Hn(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Do!==void 0?Do.createHTML(t):t}const Iu=(e,t)=>{const i=e.length-1,n=[];let o,s=t===2?"":t===3?"":"",r=Ce;for(let a=0;a"?(r=o??Ce,c=-1):u[1]===void 0?c=-2:(c=r.lastIndex-u[2].length,d=u[1],r=u[3]===void 0?Pt:u[3]==='"'?Ho:Fo):r===Ho||r===Fo?r=Pt:r===jo||r===zo?r=Ce:(r=Pt,o=void 0);const p=r===Pt&&e[a+1].startsWith("/>")?" ":"";s+=r===Ce?l+Tu:c>=0?(n.push(d),l.slice(0,c)+Hr+l.slice(c)+wt+p):l+wt+(c===-2?a:p)}return[Vr(e,s+(e[i]||"")+(t===2?"":t===3?"":"")),n]};class He{constructor({strings:t,_$litType$:i},n){let o;this.parts=[];let s=0,r=0;const a=t.length-1,l=this.parts,[d,u]=Iu(t,i);if(this.el=He.createElement(d,n),Lt.currentNode=this.el.content,i===2||i===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=Lt.nextNode())!==null&&l.length0){o.textContent=ki?ki.emptyScript:"";for(let p=0;p2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(t,i=this,n,o){const s=this.strings;let r=!1;if(s===void 0)t=se(this,t,i,0),r=!Fe(t)||t!==this._$AH&&t!==oe,r&&(this._$AH=t);else{const a=t;let l,d;for(t=s[0],l=0;l{const n=(i==null?void 0:i.renderBefore)??t;let o=n._$litPart$;if(o===void 0){const s=(i==null?void 0:i.renderBefore)??null;n._$litPart$=o=new ti(t.insertBefore(ze(),s),s,void 0,i??{})}return o._$AI(e),o};/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const zu=e=>e.strings===void 0;/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Fu={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Hu=e=>(...t)=>({_$litDirective$:e,values:t});let Bu=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this.t=e,this._$AM=t,this.i=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const Ci=globalThis,Ei=Ci.trustedTypes,Oo=Ei?Ei.createPolicy("lit-html",{createHTML:e=>e}):void 0,Tr="$lit$",wt=`lit$${Math.random().toFixed(9).slice(2)}$`,Ir="?"+wt,vu=`<${Ir}>`,Ft=document,Le=()=>Ft.createComment(""),je=e=>e===null||typeof e!="object"&&typeof e!="function",Ln=Array.isArray,yu=e=>Ln(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",Zi=`[ -\f\r]`,we=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,To=/-->/g,Io=/>/g,Pt=RegExp(`>|${Zi}(?:([^\\s"'>=/]+)(${Zi}*=${Zi}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),No=/'/g,Po=/"/g,Nr=/^(?:script|style|textarea|title)$/i,_u=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),Pr=_u(1),oe=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),Mo=new WeakMap,Lt=Ft.createTreeWalker(Ft,129);function Mr(e,t){if(!Ln(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Oo!==void 0?Oo.createHTML(t):t}const xu=(e,t)=>{const i=e.length-1,n=[];let o,s=t===2?"":t===3?"":"",r=we;for(let a=0;a"?(r=o??we,c=-1):u[1]===void 0?c=-2:(c=r.lastIndex-u[2].length,d=u[1],r=u[3]===void 0?Pt:u[3]==='"'?Po:No):r===Po||r===No?r=Pt:r===To||r===Io?r=we:(r=Pt,o=void 0);const p=r===Pt&&e[a+1].startsWith("/>")?" ":"";s+=r===we?l+vu:c>=0?(n.push(d),l.slice(0,c)+Tr+l.slice(c)+wt+p):l+wt+(c===-2?a:p)}return[Mr(e,s+(e[i]||"")+(t===2?"":t===3?"":"")),n]};class Re{constructor({strings:t,_$litType$:i},n){let o;this.parts=[];let s=0,r=0;const a=t.length-1,l=this.parts,[d,u]=xu(t,i);if(this.el=Re.createElement(d,n),Lt.currentNode=this.el.content,i===2||i===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=Lt.nextNode())!==null&&l.length0){o.textContent=Ei?Ei.emptyScript:"";for(let p=0;p2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=z}_$AI(t,i=this,n,o){const s=this.strings;let r=!1;if(s===void 0)t=se(this,t,i,0),r=!je(t)||t!==this._$AH&&t!==oe,r&&(this._$AH=t);else{const a=t;let l,d;for(t=s[0],l=0;l{const n=(i==null?void 0:i.renderBefore)??t;let o=n._$litPart$;if(o===void 0){const s=(i==null?void 0:i.renderBefore)??null;n._$litPart$=o=new Qe(t.insertBefore(Le(),s),s,void 0,i??{})}return o._$AI(e),o};/** + */const Oe=(e,t)=>{var i;const n=e._$AN;if(n===void 0)return!1;for(const o of n)(i=o._$AO)==null||i.call(o,t,!1),Oe(o,t);return!0},Ti=e=>{let t,i;do{if((t=e._$AM)===void 0)break;i=t._$AN,i.delete(e),e=t}while((i==null?void 0:i.size)===0)},Wr=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(i===void 0)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),Wu(t)}};function Uu(e){this._$AN!==void 0?(Ti(this),this._$AM=e,Wr(this)):this._$AM=e}function Vu(e,t=!1,i=0){const n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(n))for(let s=i;s{e.type==Fu.CHILD&&(e._$AP??(e._$AP=Vu),e._$AQ??(e._$AQ=Uu))};class Gu extends Bu{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,i,n){super._$AT(t,i,n),Wr(this),this.isConnected=t._$AU}_$AO(t,i=!0){var n,o;t!==this.isConnected&&(this.isConnected=t,t?(n=this.reconnected)==null||n.call(this):(o=this.disconnected)==null||o.call(this)),i&&(Oe(this,t),Ti(this))}setValue(t){if(zu(this.t))this.t._$AI(t,this);else{const i=[...this.t._$AH];i[this.i]=t,this.t._$AI(i,this,0)}}disconnected(){}reconnected(){}}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ku=()=>new Ou;class Ou{}const Tu=e=>{const{components:t,topic:i,onCancel:n,onSubmit:o,styles:s}=e,r=o??(()=>{}),a=t.get(De),l=(i==null?void 0:i.title)??null,d=(i==null?void 0:i.status)??null,u=(i==null?void 0:i.type)??null,c=(i==null?void 0:i.priority)??null,h=(i==null?void 0:i.assignedTo)??null,p=(i==null?void 0:i.labels)??null,g=(i==null?void 0:i.stage)??null,_=(i==null?void 0:i.description)??null,v=i!=null&&i.dueDate?i.dueDate.toISOString().split("T")[0]:null,f=new Set([...a.config.statuses]);d&&f.add(d);const y=new Set([...a.config.types]);u&&y.add(u);const x=new Set([...a.config.priorities]);c&&x.add(c);const w=new Set([...a.config.users]);h&&w.add(h);const E=new Set([...a.config.labels]);if(p)for(const $ of p)E.add($);const C=new Set([...a.config.stages]);g&&C.add(g);const A=ku(),N=async()=>{const{value:$}=A;if(!$)return;Object.values($.valueTransform).length===0&&($.valueTransform={dueDate:k=>{if(typeof k=="string"&&k.trim()!=="")return new Date(k)},status:k=>{if(Array.isArray(k)&&k.length!==0)return k[0]},type:k=>{if(Array.isArray(k)&&k.length!==0)return k[0]},priority:k=>{if(Array.isArray(k)&&k.length!==0)return k[0]},assignedTo:k=>{if(Array.isArray(k)&&k.length!==0)return k[0]}});const S=$.value;if(i)i.set(S),await r(i);else{const k=a.create(S);await r(k)}};return m` + */const wn=()=>new qu;class qu{}const sn=new WeakMap,Yu=Hu(class extends Gu{render(e){return j}update(e,[t]){var i;const n=t!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=(i=e.options)==null?void 0:i.host,this.rt(this.ct=e.element)),j}rt(e){if(this.isConnected||(e=void 0),typeof this.Y=="function"){const t=this.ht??globalThis;let i=sn.get(t);i===void 0&&(i=new WeakMap,sn.set(t,i)),i.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),i.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){var e,t;return typeof this.Y=="function"?(e=sn.get(this.ht??globalThis))==null?void 0:e.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Xu=e=>{const{components:t,topic:i,value:n,onCancel:o,onSubmit:s,styles:r}=e,a=s??(()=>{}),l=t.get(Be),d=(n==null?void 0:n.title)??(i==null?void 0:i.title)??vt.default.title,u=(n==null?void 0:n.status)??(i==null?void 0:i.status)??vt.default.status,c=(n==null?void 0:n.type)??(i==null?void 0:i.type)??vt.default.type,h=(n==null?void 0:n.priority)??(i==null?void 0:i.priority)??vt.default.priority,p=(n==null?void 0:n.assignedTo)??(i==null?void 0:i.assignedTo)??vt.default.assignedTo,b=(n==null?void 0:n.labels)??(i==null?void 0:i.labels)??vt.default.labels,v=(n==null?void 0:n.stage)??(i==null?void 0:i.stage)??vt.default.stage,y=(n==null?void 0:n.description)??(i==null?void 0:i.description)??vt.default.description,g=i!=null&&i.dueDate?i.dueDate.toISOString().split("T")[0]:null,_=new Set([...l.config.statuses]);u&&_.add(u);const x=new Set([...l.config.types]);c&&x.add(c);const w=new Set([...l.config.priorities]);h&&w.add(h);const A=new Set([...l.config.users]);p&&A.add(p);const C=new Set([...l.config.labels]);if(b)for(const E of b)C.add(E);const N=new Set([...l.config.stages]);v&&N.add(v);const L=wn(),k=async()=>{const{value:E}=L;if(!E)return;Object.values(E.valueTransform).length===0&&(E.valueTransform={dueDate:$=>{if(typeof $=="string"&&$.trim()!=="")return new Date($)},status:$=>{if(Array.isArray($)&&$.length!==0)return $[0]},type:$=>{if(Array.isArray($)&&$.length!==0)return $[0]},priority:$=>{if(Array.isArray($)&&$.length!==0)return $[0]},assignedTo:$=>{if(Array.isArray($)&&$.length!==0)return $[0]}});const M=E.value;if(i)i.set(M),await a(i);else{const $=l.create(M);await a($)}},S=wn(),B=E=>{const{value:M}=S;if(!M)return;const $=E.target;M.disabled=$.value.trim()===""};return m` - +
- + ${i?m` - ${[...f].map($=>m``)} + ${[..._].map(E=>m``)} `:m``}
- ${[...y].map($=>m``)} + ${[...x].map(E=>m``)} - ${[...x].map($=>m``)} + ${[...w].map(E=>m``)}
- ${[...E].map($=>m``)} + ${[...C].map(E=>m``)} - ${[...w].map($=>{const S=s!=null&&s.users?s.users[$]:null,k=S?S.name:$,U=S==null?void 0:S.picture;return m``})} + ${[...A].map(E=>{const M=r!=null&&r.users?r.users[E]:null,$=M?M.name:E,et=M==null?void 0:M.picture;return m``})}
- + - ${[...C].map($=>m``)} + ${[...N].map(E=>m``)}
- +
- - + +
- `},Iu=e=>B.create(Tu,e),Nu=Object.freeze(Object.defineProperty({__proto__:null,createTopic:Iu},Symbol.toStringTag,{value:"Module"}));({...Nu});/** + `},Ju=e=>V.create(Xu,e),Qu=Object.freeze(Object.defineProperty({__proto__:null,createTopic:Ju},Symbol.toStringTag,{value:"Module"}));({...Qu});/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ci=globalThis,jn=ci.ShadowRoot&&(ci.ShadyCSS===void 0||ci.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rn=Symbol(),jo=new WeakMap;let Lr=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Rn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(jn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=jo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&jo.set(t,e))}return e}toString(){return this.cssText}};const Pu=e=>new Lr(typeof e=="string"?e:e+"",void 0,Rn),jr=(e,...t)=>{const i=e.length===1?e[0]:t.reduce((n,o,s)=>n+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[s+1],e[0]);return new Lr(i,e,Rn)},Mu=(e,t)=>{if(jn)e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of t){const n=document.createElement("style"),o=ci.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=i.cssText,e.appendChild(n)}},Ro=jn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(const n of t.cssRules)i+=n.cssText;return Pu(i)})(e):e;/** + */const hi=globalThis,Un=hi.ShadowRoot&&(hi.ShadyCSS===void 0||hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vn=Symbol(),Vo=new WeakMap;let Gr=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Vn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Un&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Vo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Vo.set(t,e))}return e}toString(){return this.cssText}};const Ku=e=>new Gr(typeof e=="string"?e:e+"",void 0,Vn),Wn=(e,...t)=>{const i=e.length===1?e[0]:t.reduce((n,o,s)=>n+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[s+1],e[0]);return new Gr(i,e,Vn)},Zu=(e,t)=>{if(Un)e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of t){const n=document.createElement("style"),o=hi.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=i.cssText,e.appendChild(n)}},Wo=Un?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(const n of t.cssRules)i+=n.cssText;return Ku(i)})(e):e;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const{is:Lu,defineProperty:ju,getOwnPropertyDescriptor:Ru,getOwnPropertyNames:Du,getOwnPropertySymbols:zu,getPrototypeOf:Fu}=Object,re=globalThis,Do=re.trustedTypes,Hu=Do?Do.emptyScript:"",zo=re.reactiveElementPolyfillSupport,Se=(e,t)=>e,Ai={toAttribute(e,t){switch(t){case Boolean:e=e?Hu:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},Dn=(e,t)=>!Lu(e,t),Fo={attribute:!0,type:String,converter:Ai,reflect:!1,hasChanged:Dn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),re.litPropertyMetadata??(re.litPropertyMetadata=new WeakMap);class qt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=Fo){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(t,i),!i.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(t,n,i);o!==void 0&&ju(this.prototype,t,o)}}static getPropertyDescriptor(t,i,n){const{get:o,set:s}=Ru(this.prototype,t)??{get(){return this[i]},set(r){this[i]=r}};return{get(){return o==null?void 0:o.call(this)},set(r){const a=o==null?void 0:o.call(this);s.call(this,r),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Fo}static _$Ei(){if(this.hasOwnProperty(Se("elementProperties")))return;const t=Fu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Se("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Se("properties"))){const i=this.properties,n=[...Du(i),...zu(i)];for(const o of n)this.createProperty(o,i[o])}const t=this[Symbol.metadata];if(t!==null){const i=litPropertyMetadata.get(t);if(i!==void 0)for(const[n,o]of i)this.elementProperties.set(n,o)}this._$Eh=new Map;for(const[i,n]of this.elementProperties){const o=this._$Eu(i,n);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)i.unshift(Ro(o))}else t!==void 0&&i.push(Ro(t));return i}static _$Eu(t,i){const n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(i=>i(this))}addController(t){var i;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var i;(i=this._$EO)==null||i.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const n of i.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostDisconnected)==null?void 0:n.call(i)})}attributeChangedCallback(t,i,n){this._$AK(t,n)}_$EC(t,i){var n;const o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){const r=(((n=o.converter)==null?void 0:n.toAttribute)!==void 0?o.converter:Ai).toAttribute(i,o.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,i){var n;const o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=o.getPropertyOptions(s),a=typeof r.converter=="function"?{fromAttribute:r.converter}:((n=r.converter)==null?void 0:n.fromAttribute)!==void 0?r.converter:Ai;this._$Em=s,this[s]=a.fromAttribute(i,r.type),this._$Em=null}}requestUpdate(t,i,n){if(t!==void 0){if(n??(n=this.constructor.getPropertyOptions(t)),!(n.hasChanged??Dn)(this[t],i))return;this.P(t,i,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,i,n){this._$AL.has(t)||this._$AL.set(t,i),n.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[s,r]of o)r.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],r)}let i=!1;const n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(t=this._$EO)==null||t.forEach(o=>{var s;return(s=o.hostUpdate)==null?void 0:s.call(o)}),this.update(n)):this._$EU()}catch(o){throw i=!1,this._$EU(),o}i&&this._$AE(n)}willUpdate(t){}_$AE(t){var i;(i=this._$EO)==null||i.forEach(n=>{var o;return(o=n.hostUpdated)==null?void 0:o.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(i=>this._$EC(i,this[i]))),this._$EU()}updated(t){}firstUpdated(t){}}qt.elementStyles=[],qt.shadowRootOptions={mode:"open"},qt[Se("elementProperties")]=new Map,qt[Se("finalized")]=new Map,zo==null||zo({ReactiveElement:qt}),(re.reactiveElementVersions??(re.reactiveElementVersions=[])).push("2.0.4");/** + */const{is:th,defineProperty:eh,getOwnPropertyDescriptor:ih,getOwnPropertyNames:nh,getOwnPropertySymbols:oh,getPrototypeOf:sh}=Object,re=globalThis,Go=re.trustedTypes,rh=Go?Go.emptyScript:"",qo=re.reactiveElementPolyfillSupport,Ne=(e,t)=>e,Oi={toAttribute(e,t){switch(t){case Boolean:e=e?rh:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},Gn=(e,t)=>!th(e,t),Yo={attribute:!0,type:String,converter:Oi,reflect:!1,hasChanged:Gn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),re.litPropertyMetadata??(re.litPropertyMetadata=new WeakMap);class Yt extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=Yo){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(t,i),!i.noAccessor){const n=Symbol(),o=this.getPropertyDescriptor(t,n,i);o!==void 0&&eh(this.prototype,t,o)}}static getPropertyDescriptor(t,i,n){const{get:o,set:s}=ih(this.prototype,t)??{get(){return this[i]},set(r){this[i]=r}};return{get(){return o==null?void 0:o.call(this)},set(r){const a=o==null?void 0:o.call(this);s.call(this,r),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Yo}static _$Ei(){if(this.hasOwnProperty(Ne("elementProperties")))return;const t=sh(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ne("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ne("properties"))){const i=this.properties,n=[...nh(i),...oh(i)];for(const o of n)this.createProperty(o,i[o])}const t=this[Symbol.metadata];if(t!==null){const i=litPropertyMetadata.get(t);if(i!==void 0)for(const[n,o]of i)this.elementProperties.set(n,o)}this._$Eh=new Map;for(const[i,n]of this.elementProperties){const o=this._$Eu(i,n);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)i.unshift(Wo(o))}else t!==void 0&&i.push(Wo(t));return i}static _$Eu(t,i){const n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(i=>i(this))}addController(t){var i;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var i;(i=this._$EO)==null||i.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const n of i.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Zu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostDisconnected)==null?void 0:n.call(i)})}attributeChangedCallback(t,i,n){this._$AK(t,n)}_$EC(t,i){var n;const o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){const r=(((n=o.converter)==null?void 0:n.toAttribute)!==void 0?o.converter:Oi).toAttribute(i,o.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,i){var n;const o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=o.getPropertyOptions(s),a=typeof r.converter=="function"?{fromAttribute:r.converter}:((n=r.converter)==null?void 0:n.fromAttribute)!==void 0?r.converter:Oi;this._$Em=s,this[s]=a.fromAttribute(i,r.type),this._$Em=null}}requestUpdate(t,i,n){if(t!==void 0){if(n??(n=this.constructor.getPropertyOptions(t)),!(n.hasChanged??Gn)(this[t],i))return;this.P(t,i,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,i,n){this._$AL.has(t)||this._$AL.set(t,i),n.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[s,r]of o)r.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],r)}let i=!1;const n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(t=this._$EO)==null||t.forEach(o=>{var s;return(s=o.hostUpdate)==null?void 0:s.call(o)}),this.update(n)):this._$EU()}catch(o){throw i=!1,this._$EU(),o}i&&this._$AE(n)}willUpdate(t){}_$AE(t){var i;(i=this._$EO)==null||i.forEach(n=>{var o;return(o=n.hostUpdated)==null?void 0:o.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(i=>this._$EC(i,this[i]))),this._$EU()}updated(t){}firstUpdated(t){}}Yt.elementStyles=[],Yt.shadowRootOptions={mode:"open"},Yt[Ne("elementProperties")]=new Map,Yt[Ne("finalized")]=new Map,qo==null||qo({ReactiveElement:Yt}),(re.reactiveElementVersions??(re.reactiveElementVersions=[])).push("2.0.4");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */class Xt extends qt{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var t;const i=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=Su(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return oe}}var Ho;Xt._$litElement$=!0,Xt.finalized=!0,(Ho=globalThis.litElementHydrateSupport)==null||Ho.call(globalThis,{LitElement:Xt});const Bo=globalThis.litElementPolyfillSupport;Bo==null||Bo({LitElement:Xt});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/** + */class Dt extends Yt{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var t;const i=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=ju(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return oe}}var Xo;Dt._$litElement$=!0,Dt.finalized=!0,(Xo=globalThis.litElementHydrateSupport)==null||Xo.call(globalThis,{LitElement:Dt});const Jo=globalThis.litElementPolyfillSupport;Jo==null||Jo({LitElement:Dt});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const Bu={attribute:!0,type:String,converter:Ai,reflect:!1,hasChanged:Dn},Uu=(e=Bu,t,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,e),n==="accessor"){const{name:r}=i;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,l,e)},init(a){return a!==void 0&&this.P(r,void 0,e),a}}}if(n==="setter"){const{name:r}=i;return function(a){const l=this[r];t.call(this,a),this.requestUpdate(r,l,e)}}throw Error("Unsupported decorator location: "+n)};function G(e){return(t,i)=>typeof i=="object"?Uu(e,t,i):((n,o,s)=>{const r=o.hasOwnProperty(s);return o.constructor.createProperty(s,r?{...n,wrapped:!0}:n),r?Object.getOwnPropertyDescriptor(o,s):void 0})(e,t,i)}/** + */const ah={attribute:!0,type:String,converter:Oi,reflect:!1,hasChanged:Gn},lh=(e=ah,t,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,e),n==="accessor"){const{name:r}=i;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,l,e)},init(a){return a!==void 0&&this.P(r,void 0,e),a}}}if(n==="setter"){const{name:r}=i;return function(a){const l=this[r];t.call(this,a),this.requestUpdate(r,l,e)}}throw Error("Unsupported decorator location: "+n)};function G(e){return(t,i)=>typeof i=="object"?lh(e,t,i):((n,o,s)=>{const r=o.hasOwnProperty(s);return o.constructor.createProperty(s,r?{...n,wrapped:!0}:n),r?Object.getOwnPropertyDescriptor(o,s):void 0})(e,t,i)}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function Vu(e){return G({...e,state:!0,attribute:!1})}class Wu extends ia{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new na(.5,.5),this.addEventListener("removed",function(){this.traverse(function(i){i.element instanceof Element&&i.element.parentNode!==null&&i.element.parentNode.removeChild(i.element)})})}copy(t,i){return super.copy(t,i),this.element=t.element.cloneNode(!0),this.center=t.center,this}}new vn;new Si;new Si;new vn;new vn;class Gu{constructor(t,i){this._group=new zn,this._frustum=new Jr,this._frustumMat=new Si,this._regenerateDelay=200,this._regenerateCounter=0,this.material=new Qr({color:"#2e3338"}),this.numbers=new zn,this.maxRegenerateRetrys=4,this.gridsFactor=5,this._scaleX=1,this._scaleY=1,this._offsetX=0,this._offsetY=0,this._camera=t,this._container=i;const n=this.newGrid(-1),o=this.newGrid(-2);this.grids={main:n,secondary:o},this._group.add(o,n,this.numbers)}set scaleX(t){this._scaleX=t,this.regenerate()}get scaleX(){return this._scaleX}set scaleY(t){this._scaleY=t,this.regenerate()}get scaleY(){return this._scaleY}set offsetX(t){this._offsetX=t,this.regenerate()}get offsetX(){return this._offsetX}set offsetY(t){this._offsetY=t,this.regenerate()}get offsetY(){return this._offsetY}get(){return this._group}dispose(){const{main:t,secondary:i}=this.grids;t.removeFromParent(),i.removeFromParent(),t.geometry.dispose(),t.material.dispose(),i.geometry.dispose(),i.material.dispose()}regenerate(){if(!this.isGridReady()){if(this._regenerateCounter++,this._regenerateCounter>this.maxRegenerateRetrys)throw new Error("Grid could not be regenerated");setTimeout(()=>this.regenerate,this._regenerateDelay);return}this._regenerateCounter=0,this._camera.updateMatrix(),this._camera.updateMatrixWorld();const t=this._frustumMat.multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(t);const{planes:i}=this._frustum,n=i[0].constant*-i[0].normal.x,o=i[1].constant*-i[1].normal.x,s=i[2].constant*-i[2].normal.y,r=i[3].constant*-i[3].normal.y,a=Math.abs(n-o),l=Math.abs(r-s),{clientWidth:d,clientHeight:u}=this._container,c=Math.max(d,u),h=Math.max(a,l)/c,p=Math.ceil(Math.log10(a/this.scaleX)),g=Math.ceil(Math.log10(l/this.scaleY)),_=10**(p-2)*this.scaleX,v=10**(g-2)*this.scaleY,f=_*this.gridsFactor,y=v*this.gridsFactor,x=Math.ceil(l/y),w=Math.ceil(a/f),E=Math.ceil(l/v),C=Math.ceil(a/_),A=_*Math.ceil(o/_),N=v*Math.ceil(s/v),$=f*Math.ceil(o/f),S=y*Math.ceil(s/y),k=[...this.numbers.children];for(const H of k)H.removeFromParent();this.numbers.children=[];const U=[],vt=9*h,j=1e4,ct=$+this._offsetX,it=Math.round(Math.abs(ct/this.scaleX)*j)/j,nt=(w-1)*f,q=Math.round(Math.abs((ct+nt)/this.scaleX)*j)/j,ot=Math.max(it,q).toString().length*vt;let ge=Math.ceil(ot/f)*f;for(let H=0;H.01)continue;const Ke=this.newNumber((R+this._offsetX)/this.scaleX),Bi=12*h;Ke.position.set(R,s+Bi,0)}for(let H=0;H{for(var o=Yu(t,i),s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&qu(t,i,o),o};const Rr=class extends Xt{constructor(){super(...arguments),this._grid=null,this._world=null,this.resize=()=>{this._world&&this._grid&&this._grid.regenerate()}}set gridColor(t){if(this._gridColor=t,!(t&&this._grid))return;const i=Number(t.replace("#","0x"));Number.isNaN(i)||this._grid.material.color.setHex(i)}get gridColor(){return this._gridColor}set gridScaleX(t){this._gridScaleX=t,t&&this._grid&&(this._grid.scaleX=t)}get gridScaleX(){return this._gridScaleX}set gridScaleY(t){this._gridScaleY=t,t&&this._grid&&(this._grid.scaleY=t)}get gridScaleY(){return this._gridScaleY}get gridOffsetX(){var t;return((t=this._grid)==null?void 0:t.offsetX)||0}set gridOffsetX(t){this._grid&&(this._grid.offsetX=t)}get gridOffsetY(){var t;return((t=this._grid)==null?void 0:t.offsetY)||0}set gridOffsetY(t){this._grid&&(this._grid.offsetY=t)}set components(t){this.dispose();const i=t.get(gn).create();this._world=i,i.scene=new Ur(t),i.scene.setup(),i.renderer=new da(t,this);const n=new Vr(t);i.camera=n;const o=new Gu(n.threeOrtho,this);this._grid=o,i.scene.three.add(o.get()),n.controls.addEventListener("update",()=>o.regenerate()),setTimeout(async()=>{i.camera.updateAspect(),n.set("Plan"),await n.controls.setLookAt(0,0,100,0,0,0),await n.projection.set("Orthographic"),n.controls.dollySpeed=3,n.controls.draggingSmoothTime=.085,n.controls.maxZoom=1e3,n.controls.zoom(4)})}get world(){return this._world}dispose(){var t;(t=this.world)==null||t.dispose(),this._world=null,this._grid=null}connectedCallback(){super.connectedCallback(),new ResizeObserver(this.resize).observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}render(){return Pr``}};Rr.styles=jr` + */function ch(e){return G({...e,state:!0,attribute:!1})}class dh extends ua{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new ha(.5,.5),this.addEventListener("removed",function(){this.traverse(function(i){i.element instanceof Element&&i.element.parentNode!==null&&i.element.parentNode.removeChild(i.element)})})}copy(t,i){return super.copy(t,i),this.element=t.element.cloneNode(!0),this.center=t.center,this}}new Cn;new Ii;new Ii;new Cn;new Cn;class uh{constructor(t,i){this._group=new qn,this._frustum=new sa,this._frustumMat=new Ii,this._regenerateDelay=200,this._regenerateCounter=0,this.material=new ra({color:"#2e3338"}),this.numbers=new qn,this.maxRegenerateRetrys=4,this.gridsFactor=5,this._scaleX=1,this._scaleY=1,this._offsetX=0,this._offsetY=0,this._camera=t,this._container=i;const n=this.newGrid(-1),o=this.newGrid(-2);this.grids={main:n,secondary:o},this._group.add(o,n,this.numbers)}set scaleX(t){this._scaleX=t,this.regenerate()}get scaleX(){return this._scaleX}set scaleY(t){this._scaleY=t,this.regenerate()}get scaleY(){return this._scaleY}set offsetX(t){this._offsetX=t,this.regenerate()}get offsetX(){return this._offsetX}set offsetY(t){this._offsetY=t,this.regenerate()}get offsetY(){return this._offsetY}get(){return this._group}dispose(){const{main:t,secondary:i}=this.grids;t.removeFromParent(),i.removeFromParent(),t.geometry.dispose(),t.material.dispose(),i.geometry.dispose(),i.material.dispose()}regenerate(){if(!this.isGridReady()){if(this._regenerateCounter++,this._regenerateCounter>this.maxRegenerateRetrys)throw new Error("Grid could not be regenerated");setTimeout(()=>this.regenerate,this._regenerateDelay);return}this._regenerateCounter=0,this._camera.updateMatrix(),this._camera.updateMatrixWorld();const t=this._frustumMat.multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(t);const{planes:i}=this._frustum,n=i[0].constant*-i[0].normal.x,o=i[1].constant*-i[1].normal.x,s=i[2].constant*-i[2].normal.y,r=i[3].constant*-i[3].normal.y,a=Math.abs(n-o),l=Math.abs(r-s),{clientWidth:d,clientHeight:u}=this._container,c=Math.max(d,u),h=Math.max(a,l)/c,p=Math.ceil(Math.log10(a/this.scaleX)),b=Math.ceil(Math.log10(l/this.scaleY)),v=10**(p-2)*this.scaleX,y=10**(b-2)*this.scaleY,g=v*this.gridsFactor,_=y*this.gridsFactor,x=Math.ceil(l/_),w=Math.ceil(a/g),A=Math.ceil(l/y),C=Math.ceil(a/v),N=v*Math.ceil(o/v),L=y*Math.ceil(s/y),k=g*Math.ceil(o/g),S=_*Math.ceil(s/_),B=[...this.numbers.children];for(const U of B)U.removeFromParent();this.numbers.children=[];const E=[],M=9*h,$=1e4,et=k+this._offsetX,ot=Math.round(Math.abs(et/this.scaleX)*$)/$,st=(w-1)*g,X=Math.round(Math.abs((et+st)/this.scaleX)*$)/$,rt=Math.max(ot,X).toString().length*M;let ve=Math.ceil(rt/g)*g;for(let U=0;U.01)continue;const ii=this.newNumber((z+this._offsetX)/this.scaleX),qi=12*h;ii.position.set(z,s+qi,0)}for(let U=0;U{for(var o=ph(t,i),s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&hh(t,i,o),o};const qr=class extends Dt{constructor(){super(...arguments),this._grid=null,this._world=null,this.resize=()=>{this._world&&this._grid&&this._grid.regenerate()}}set gridColor(t){if(this._gridColor=t,!(t&&this._grid))return;const i=Number(t.replace("#","0x"));Number.isNaN(i)||this._grid.material.color.setHex(i)}get gridColor(){return this._gridColor}set gridScaleX(t){this._gridScaleX=t,t&&this._grid&&(this._grid.scaleX=t)}get gridScaleX(){return this._gridScaleX}set gridScaleY(t){this._gridScaleY=t,t&&this._grid&&(this._grid.scaleY=t)}get gridScaleY(){return this._gridScaleY}get gridOffsetX(){var t;return((t=this._grid)==null?void 0:t.offsetX)||0}set gridOffsetX(t){this._grid&&(this._grid.offsetX=t)}get gridOffsetY(){var t;return((t=this._grid)==null?void 0:t.offsetY)||0}set gridOffsetY(t){this._grid&&(this._grid.offsetY=t)}set components(t){this.dispose();const i=t.get(Ni).create();this._world=i,i.scene=new Qo(t),i.scene.setup(),i.renderer=new _a(t,this);const n=new Ko(t);i.camera=n;const o=new uh(n.threeOrtho,this);this._grid=o,i.scene.three.add(o.get()),n.controls.addEventListener("update",()=>o.regenerate()),setTimeout(async()=>{i.camera.updateAspect(),n.set("Plan"),await n.controls.setLookAt(0,0,100,0,0,0),await n.projection.set("Orthographic"),n.controls.dollySpeed=3,n.controls.draggingSmoothTime=.085,n.controls.maxZoom=1e3,n.controls.zoom(4)})}get world(){return this._world}dispose(){var t;(t=this.world)==null||t.dispose(),this._world=null,this._grid=null}connectedCallback(){super.connectedCallback(),new ResizeObserver(this.resize).observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}render(){return Bn``}};qr.styles=Wn` :host { position: relative; display: flex; @@ -2149,7 +2189,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m height: 100%; background-color: var(--bim-ui_bg-base); } - `;let fe=Rr;Ze([G({type:String,attribute:"grid-color",reflect:!0})],fe.prototype,"gridColor");Ze([G({type:Number,attribute:"grid-scale-x",reflect:!0})],fe.prototype,"gridScaleX");Ze([G({type:Number,attribute:"grid-scale-y",reflect:!0})],fe.prototype,"gridScaleY");Ze([G({type:Number,attribute:"grid-offset-x",reflect:!0})],fe.prototype,"gridOffsetX");Ze([G({type:Number,attribute:"grid-offset-y",reflect:!0})],fe.prototype,"gridOffsetY");var Xu=Object.defineProperty,Tt=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&Xu(t,i,o),o};const Dr=class extends Xt{constructor(){super(...arguments),this._defaults={size:60},this._cssMatrix3D="",this._matrix=new Si,this._onRightClick=new Event("rightclick"),this._onLeftClick=new Event("leftclick"),this._onTopClick=new Event("topclick"),this._onBottomClick=new Event("bottomclick"),this._onFrontClick=new Event("frontclick"),this._onBackClick=new Event("backclick"),this._camera=null,this._epsilon=t=>Math.abs(t)<1e-10?0:t}set camera(t){this._camera=t,this.updateOrientation()}get camera(){return this._camera}updateOrientation(){if(!this.camera)return;this._matrix.extractRotation(this.camera.matrixWorldInverse);const{elements:t}=this._matrix;this._cssMatrix3D=`matrix3d( + `;let ge=qr;ei([G({type:String,attribute:"grid-color",reflect:!0})],ge.prototype,"gridColor");ei([G({type:Number,attribute:"grid-scale-x",reflect:!0})],ge.prototype,"gridScaleX");ei([G({type:Number,attribute:"grid-scale-y",reflect:!0})],ge.prototype,"gridScaleY");ei([G({type:Number,attribute:"grid-offset-x",reflect:!0})],ge.prototype,"gridOffsetX");ei([G({type:Number,attribute:"grid-offset-y",reflect:!0})],ge.prototype,"gridOffsetY");var mh=Object.defineProperty,Ot=(e,t,i,n)=>{for(var o=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(o=r(t,i,o)||o);return o&&mh(t,i,o),o};const Yr=class extends Dt{constructor(){super(...arguments),this._defaults={size:60},this._cssMatrix3D="",this._matrix=new Ii,this._onRightClick=new Event("rightclick"),this._onLeftClick=new Event("leftclick"),this._onTopClick=new Event("topclick"),this._onBottomClick=new Event("bottomclick"),this._onFrontClick=new Event("frontclick"),this._onBackClick=new Event("backclick"),this._camera=null,this._epsilon=t=>Math.abs(t)<1e-10?0:t}set camera(t){this._camera=t,this.updateOrientation()}get camera(){return this._camera}updateOrientation(){if(!this.camera)return;this._matrix.extractRotation(this.camera.matrixWorldInverse);const{elements:t}=this._matrix;this._cssMatrix3D=`matrix3d( ${this._epsilon(t[0])}, ${this._epsilon(-t[1])}, ${this._epsilon(t[2])}, @@ -2166,7 +2206,7 @@ import{e as De,t as fn,a as gn,L as Ur,i as Vr,_ as Ht,J as at,E as Wr,b as Gr,m ${this._epsilon(-t[13])}, ${this._epsilon(t[14])}, ${this._epsilon(t[15])}) - `}render(){const t=this.size??this._defaults.size;return Pr` + `}render(){const t=this.size??this._defaults.size;return Bn` - `}};gr.styles=E` + `}};_o.styles=E` :host { padding: 0.375rem; display: flex; @@ -1238,7 +1250,7 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab justify-content: center; } - :host([data-column-index="0"]:not([data-no-indentation])) { + :host([data-column-index="0"]) { justify-content: normal; } @@ -1261,10 +1273,10 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab white-space: normal; text-align: center; } - `;let vr=gr;xl([h({type:String,reflect:!0})],vr.prototype,"column");var wl=Object.defineProperty,$l=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&wl(t,e,n),n};const yr=class extends w{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(t,e=!1){for(const r of this._groups)r.childrenHidden=typeof t>"u"?!r.childrenHidden:!t,e&&r.toggleChildren(t,e)}render(){return this._groups=[],f` + `;let xo=_o;wl([h({type:String,reflect:!0})],xo.prototype,"column");var $l=Object.defineProperty,El=(i,t,e,o)=>{for(var n=void 0,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=s(t,e,n)||n);return n&&$l(t,e,n),n};const wo=class extends w{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(t,e=!1){for(const o of this._groups)o.childrenHidden=typeof t>"u"?!o.childrenHidden:!t,e&&o.toggleChildren(t,e)}render(){return this._groups=[],f` ${this.data.map(t=>{const e=document.createElement("bim-table-group");return this._groups.push(e),e.table=this.table,e.data=t,e})} - `}};yr.styles=E` + `}};wo.styles=E` :host { --bim-button--bgc: transparent; position: relative; @@ -1279,7 +1291,7 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab top: 0; bottom: 1.125rem; } - `;let _r=yr;$l([h({type:Array,attribute:!1})],_r.prototype,"data");var El=Object.defineProperty,Cl=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&El(t,e,n),n};const xr=class extends w{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(t,e=!1){this._children&&(this.childrenHidden=typeof t>"u"?!this.childrenHidden:!t,e&&this._children.toggleGroups(t,e))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const t=this.table.getGroupIndentation(this.data)??0,e=f` + `;let $o=wo;El([h({type:Array,attribute:!1})],$o.prototype,"data");var Cl=Object.defineProperty,kl=(i,t,e,o)=>{for(var n=void 0,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=s(t,e,n)||n);return n&&Cl(t,e,n),n};const Eo=class extends w{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(t,e=!1){this._children&&(this.childrenHidden=typeof t>"u"?!this.childrenHidden:!t,e&&this._children.toggleGroups(t,e))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const t=this.table.getGroupIndentation(this.data)??0,e=f` ${this.table.noIndentation?null:f`
`} - `,r=document.createDocumentFragment();zt(e,r);let n=null;this.table.noIndentation||(n=document.createElement("div"),n.classList.add("branch","branch-horizontal"),n.style.left=`${t-1+(this.table.selectableRows?2.05:.5625)}rem`);let o=null;if(!this.table.noIndentation){const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("height","9.5"),a.setAttribute("width","7.5"),a.setAttribute("viewBox","0 0 4.6666672 7.3333333");const c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),a.append(c);const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("height","6.5"),d.setAttribute("width","9.5"),d.setAttribute("viewBox","0 0 5.9111118 5.0175439");const u=document.createElementNS("http://www.w3.org/2000/svg","path");u.setAttribute("d","M -0.33616196,1.922522 2.253838,4.5125219 c 0.39,0.39 1.02,0.39 1.41,0 L 6.2538379,1.922522 c 0.6200001,-0.63 0.18,-1.71000007 -0.7099999,-1.71000007 H 0.37383804 c -0.89999997,0 -1.33999997,1.08000007 -0.71,1.71000007 z"),d.append(u),o=document.createElement("div"),o.addEventListener("click",p=>{p.stopPropagation(),this.toggleChildren()}),o.classList.add("caret"),o.style.left=`${(this.table.selectableRows?1.5:.125)+t}rem`,this.childrenHidden?o.append(a):o.append(d)}const s=document.createElement("bim-table-row");this.data.children&&!this.childrenHidden&&s.append(r),s.table=this.table,s.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:s}})),o&&this.data.children&&s.append(o),t!==0&&(!this.data.children||this.childrenHidden)&&n&&s.append(n);let l;if(this.data.children){l=document.createElement("bim-table-children"),this._children=l,l.table=this.table,l.data=this.data.children;const a=document.createDocumentFragment();zt(e,a),l.append(a)}return f` + `,o=document.createDocumentFragment();zt(e,o);let n=null;this.table.noIndentation||(n=document.createElement("div"),n.classList.add("branch","branch-horizontal"),n.style.left=`${t-1+(this.table.selectableRows?2.05:.5625)}rem`);let r=null;if(!this.table.noIndentation){const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("height","9.5"),a.setAttribute("width","7.5"),a.setAttribute("viewBox","0 0 4.6666672 7.3333333");const c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),a.append(c);const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("height","6.5"),d.setAttribute("width","9.5"),d.setAttribute("viewBox","0 0 5.9111118 5.0175439");const u=document.createElementNS("http://www.w3.org/2000/svg","path");u.setAttribute("d","M -0.33616196,1.922522 2.253838,4.5125219 c 0.39,0.39 1.02,0.39 1.41,0 L 6.2538379,1.922522 c 0.6200001,-0.63 0.18,-1.71000007 -0.7099999,-1.71000007 H 0.37383804 c -0.89999997,0 -1.33999997,1.08000007 -0.71,1.71000007 z"),d.append(u),r=document.createElement("div"),r.addEventListener("click",p=>{p.stopPropagation(),this.toggleChildren()}),r.classList.add("caret"),r.style.left=`${(this.table.selectableRows?1.5:.125)+t}rem`,this.childrenHidden?r.append(a):r.append(d)}const s=document.createElement("bim-table-row");this.data.children&&!this.childrenHidden&&s.append(o),s.table=this.table,s.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:s}})),r&&this.data.children&&s.append(r),t!==0&&(!this.data.children||this.childrenHidden)&&n&&s.append(n);let l;if(this.data.children){l=document.createElement("bim-table-children"),this._children=l,l.table=this.table,l.data=this.data.children;const a=document.createDocumentFragment();zt(e,a),l.append(a)}return f`
${s} ${this.childrenHidden?null:l}
- `}};xr.styles=E` + `}};Eo.styles=E` :host { position: relative; } @@ -1331,15 +1343,15 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab .caret svg { fill: var(--bim-ui_bg-contrast-60); } - `;let wr=xr;Cl([h({type:Boolean,attribute:"children-hidden",reflect:!0})],wr.prototype,"childrenHidden");var kl=Object.defineProperty,It=(i,t,e,r)=>{for(var n=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=s(t,e,n)||n);return n&&kl(t,e,n),n};const $r=class extends w{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(t=>{this._intersecting=t[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.name)}get _columnWidths(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.width)}get _isSelected(){var t;return(t=this.table)==null?void 0:t.selection.has(this.data)}onSelectionChange(t){if(!this.table)return;const e=t.target;this.selected=e.value,e.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const t=this.table.getRowIndentation(this.data)??0,e=this.isHeader?this.data:this.table.applyDataTransform(this.data)??this.data,r=[];for(const n in e){if(this.hiddenColumns.includes(n))continue;const o=e[n];let s;if(typeof o=="string"||typeof o=="boolean"||typeof o=="number"?(s=document.createElement("bim-label"),s.textContent=String(o)):o instanceof HTMLElement?s=o:(s=document.createDocumentFragment(),zt(o,s)),!s)continue;const l=document.createElement("bim-table-cell");l.append(s),l.column=n,this._columnNames.indexOf(n)===0&&!this.isHeader&&(l.style.marginLeft=`${(this.table.noIndentation?0:t)+.75}rem`);const a=this._columnNames.indexOf(n);l.setAttribute("data-column-index",String(a)),l.toggleAttribute("data-no-indentation",a===0&&this.table.noIndentation),l.toggleAttribute("data-cell-header",this.isHeader),l.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:l}})),r.push(l)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,f` + `;let Co=Eo;kl([h({type:Boolean,attribute:"children-hidden",reflect:!0})],Co.prototype,"childrenHidden");var Sl=Object.defineProperty,Nt=(i,t,e,o)=>{for(var n=void 0,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=s(t,e,n)||n);return n&&Sl(t,e,n),n};const ko=class extends w{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(t=>{this._intersecting=t[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.name)}get _columnWidths(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.width)}get _isSelected(){var t;return(t=this.table)==null?void 0:t.selection.has(this.data)}onSelectionChange(t){if(!this.table)return;const e=t.target;this.selected=e.value,e.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const t=this.table.getRowIndentation(this.data)??0,e=this.isHeader?this.data:this.table.applyDataTransform(this.data)??this.data,o=[];for(const n in e){if(this.hiddenColumns.includes(n))continue;const r=e[n];let s;if(typeof r=="string"||typeof r=="boolean"||typeof r=="number"?(s=document.createElement("bim-label"),s.textContent=String(r)):r instanceof HTMLElement?s=r:(s=document.createDocumentFragment(),zt(r,s)),!s)continue;const l=document.createElement("bim-table-cell");l.append(s),l.column=n,this._columnNames.indexOf(n)===0&&(l.style.marginLeft=`${this.table.noIndentation?0:t+.75}rem`);const a=this._columnNames.indexOf(n);l.setAttribute("data-column-index",String(a)),l.toggleAttribute("data-no-indentation",a===0&&this.table.noIndentation),l.toggleAttribute("data-cell-header",this.isHeader),l.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:l}})),o.push(l)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,f` ${!this.isHeader&&this.table.selectableRows?f``:null} - ${r} + ${o} - `}render(){return f`${this._intersecting?this.compute():f``}`}};$r.styles=E` + `}render(){return f`${this._intersecting?this.compute():f``}`}};ko.styles=E` :host { position: relative; grid-area: Data; @@ -1360,14 +1372,14 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab var(--bim-ui_main-base) 10% ); } - `;let vt=$r;It([h({type:Boolean,reflect:!0})],vt.prototype,"selected");It([h({attribute:!1})],vt.prototype,"columns");It([h({attribute:!1})],vt.prototype,"hiddenColumns");It([h({attribute:!1})],vt.prototype,"data");It([h({type:Boolean,attribute:"is-header",reflect:!0})],vt.prototype,"isHeader");It([Lt()],vt.prototype,"_intersecting");var Sl=Object.defineProperty,Al=Object.getOwnPropertyDescriptor,U=(i,t,e,r)=>{for(var n=r>1?void 0:r?Al(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Sl(t,e,n),n};const Er=class extends w{constructor(){super(...arguments),this._columnsChange=new Event("columnschange"),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this.loadingErrorElement=null,this._stringFilterFunction=(t,e)=>Object.values(e.data).some(r=>String(r).toLowerCase().includes(t.toLowerCase())),this._queryFilterFunction=(t,e)=>{let r=!1;const n=ni(t)??[];for(const o of n){if("queries"in o){r=!1;break}const{condition:s,value:l}=o;let{key:a}=o;if(a.startsWith("[")&&a.endsWith("]")){const c=a.replace("[","").replace("]","");a=c,r=Object.keys(e.data).filter(d=>d.includes(c)).map(d=>on(e.data[d],s,l)).some(d=>d)}else r=on(e.data[a],s,l);if(!r)break}return r}}set columns(t){const e=[];for(const r of t){const n=typeof r=="string"?{name:r,width:`minmax(${this.minColWidth}, 1fr)`}:r;e.push(n)}this._columns=e,this.computeMissingColumns(this.data),this.dispatchEvent(this._columnsChange)}get columns(){return this._columns}get _headerRowData(){const t={};for(const e of this.columns)if(typeof e=="string")t[e]=e;else{const{name:r}=e;t[r]=r}return t}get value(){return this._filteredData}set queryString(t){this.toggleAttribute("data-processing",!0),this._queryString=t&&t.trim()!==""?t.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(t){this._data=t,this.updateFilteredData(),this.computeMissingColumns(t)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(t=>{setTimeout(()=>{t(this.data)})})}set hiddenColumns(t){this._hiddenColumns=t,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(ni(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(t){let e=!1;for(const r of t){const{children:n,data:o}=r;for(const s in o)this._columns.map(l=>typeof l=="string"?l:l.name).includes(s)||(this._columns.push({name:s,width:`minmax(${this.minColWidth}, 1fr)`}),e=!0);if(n){const s=this.computeMissingColumns(n);s&&!e&&(e=s)}}return e}generateText(t="comma",e=this.value,r="",n=!0){const o=this._textDelimiters[t];let s="";const l=this.columns.map(a=>a.name);if(n){this.indentationInText&&(s+=`Indentation${o}`);const a=`${l.join(o)} -`;s+=a}for(const[a,c]of e.entries()){const{data:d,children:u}=c,p=this.indentationInText?`${r}${a+1}${o}`:"",b=l.map(v=>d[v]??""),m=`${p}${b.join(o)} -`;s+=m,u&&(s+=this.generateText(t,c.children,`${r}${a+1}.`,!1))}return s}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}applyDataTransform(t){const e={};for(const r of Object.keys(this.dataTransform)){const n=this.columns.find(o=>o.name===r);n&&n.forceDataTransform&&(r in t||(t[r]=""))}for(const r in t){const n=this.dataTransform[r];n?e[r]=n(t[r],t):e[r]=t[r]}return e}downloadData(t="BIM Table Data",e="json"){let r=null;if(e==="json"&&(r=new File([JSON.stringify(this.value,void 0,2)],`${t}.json`)),e==="csv"&&(r=new File([this.csv],`${t}.csv`)),e==="tsv"&&(r=new File([this.tsv],`${t}.tsv`)),!r)return;const n=document.createElement("a");n.href=URL.createObjectURL(r),n.download=r.name,n.click(),URL.revokeObjectURL(n.href)}getRowIndentation(t,e=this.value,r=0){for(const n of e){if(n.data===t)return r;if(n.children){const o=this.getRowIndentation(t,n.children,r+1);if(o!==null)return o}}return null}getGroupIndentation(t,e=this.value,r=0){for(const n of e){if(n===t)return r;if(n.children){const o=this.getGroupIndentation(t,n.children,r+1);if(o!==null)return o}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(t=!1){if(this._filteredData.length!==0&&!t||!this.loadFunction)return!1;this.loading=!0;try{const e=await this.loadFunction();return this.data=e,this.loading=!1,this._errorLoading=!1,!0}catch(e){return this.loading=!1,this._filteredData.length!==0||(e instanceof Error&&this.loadingErrorElement&&e.message.trim()!==""&&(this.loadingErrorElement.textContent=e.message),this._errorLoading=!0),!1}}filter(t,e=this.filterFunction??this._stringFilterFunction,r=this.data){const n=[];for(const o of r)if(e(t,o)){if(this.preserveStructureOnFilter){const s={data:o.data};if(o.children){const l=this.filter(t,e,o.children);l.length&&(s.children=l)}n.push(s)}else if(n.push({data:o.data}),o.children){const s=this.filter(t,e,o.children);n.push(...s)}}else if(o.children){const s=this.filter(t,e,o.children);this.preserveStructureOnFilter&&s.length?n.push({data:o.data,children:s}):n.push(...s)}return n}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return vl();if(this._errorLoading)return f``;if(this._filteredData.length===0&&this._missingDataElement)return f``;const t=document.createElement("bim-table-row");t.table=this,t.isHeader=!0,t.data=this._headerRowData,t.style.gridArea="Header",t.style.position="sticky",t.style.top="0",t.style.zIndex="5";const e=document.createElement("bim-table-children");return e.table=this,e.data=this.value,e.style.gridArea="Body",e.style.backgroundColor="transparent",f` + `;let vt=ko;Nt([h({type:Boolean,reflect:!0})],vt.prototype,"selected");Nt([h({attribute:!1})],vt.prototype,"columns");Nt([h({attribute:!1})],vt.prototype,"hiddenColumns");Nt([h({attribute:!1})],vt.prototype,"data");Nt([h({type:Boolean,attribute:"is-header",reflect:!0})],vt.prototype,"isHeader");Nt([Lt()],vt.prototype,"_intersecting");var Al=Object.defineProperty,Ol=Object.getOwnPropertyDescriptor,U=(i,t,e,o)=>{for(var n=o>1?void 0:o?Ol(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&Al(t,e,n),n};const So=class extends w{constructor(){super(...arguments),this._columnsChange=new Event("columnschange"),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this.loadingErrorElement=null,this._stringFilterFunction=(t,e)=>Object.values(e.data).some(o=>String(o).toLowerCase().includes(t.toLowerCase())),this._queryFilterFunction=(t,e)=>{let o=!1;const n=ri(t)??[];for(const r of n){if("queries"in r){o=!1;break}const{condition:s,value:l}=r;let{key:a}=r;if(a.startsWith("[")&&a.endsWith("]")){const c=a.replace("[","").replace("]","");a=c,o=Object.keys(e.data).filter(d=>d.includes(c)).map(d=>ln(e.data[d],s,l)).some(d=>d)}else o=ln(e.data[a],s,l);if(!o)break}return o}}set columns(t){const e=[];for(const o of t){const n=typeof o=="string"?{name:o,width:`minmax(${this.minColWidth}, 1fr)`}:o;e.push(n)}this._columns=e,this.computeMissingColumns(this.data),this.dispatchEvent(this._columnsChange)}get columns(){return this._columns}get _headerRowData(){const t={};for(const e of this.columns)if(typeof e=="string")t[e]=e;else{const{name:o}=e;t[o]=o}return t}get value(){return this._filteredData}set queryString(t){this.toggleAttribute("data-processing",!0),this._queryString=t&&t.trim()!==""?t.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(t){this._data=t,this.updateFilteredData(),this.computeMissingColumns(t)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(t=>{setTimeout(()=>{t(this.data)})})}set hiddenColumns(t){this._hiddenColumns=t,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(ri(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(t){let e=!1;for(const o of t){const{children:n,data:r}=o;for(const s in r)this._columns.map(l=>typeof l=="string"?l:l.name).includes(s)||(this._columns.push({name:s,width:`minmax(${this.minColWidth}, 1fr)`}),e=!0);if(n){const s=this.computeMissingColumns(n);s&&!e&&(e=s)}}return e}generateText(t="comma",e=this.value,o="",n=!0){const r=this._textDelimiters[t];let s="";const l=this.columns.map(a=>a.name);if(n){this.indentationInText&&(s+=`Indentation${r}`);const a=`${l.join(r)} +`;s+=a}for(const[a,c]of e.entries()){const{data:d,children:u}=c,p=this.indentationInText?`${o}${a+1}${r}`:"",b=l.map(v=>d[v]??""),m=`${p}${b.join(r)} +`;s+=m,u&&(s+=this.generateText(t,c.children,`${o}${a+1}.`,!1))}return s}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}applyDataTransform(t){const e={};for(const o of Object.keys(this.dataTransform)){const n=this.columns.find(r=>r.name===o);n&&n.forceDataTransform&&(o in t||(t[o]=""))}for(const o in t){const n=this.dataTransform[o];n?e[o]=n(t[o],t):e[o]=t[o]}return e}downloadData(t="BIM Table Data",e="json"){let o=null;if(e==="json"&&(o=new File([JSON.stringify(this.value,void 0,2)],`${t}.json`)),e==="csv"&&(o=new File([this.csv],`${t}.csv`)),e==="tsv"&&(o=new File([this.tsv],`${t}.tsv`)),!o)return;const n=document.createElement("a");n.href=URL.createObjectURL(o),n.download=o.name,n.click(),URL.revokeObjectURL(n.href)}getRowIndentation(t,e=this.value,o=0){for(const n of e){if(n.data===t)return o;if(n.children){const r=this.getRowIndentation(t,n.children,o+1);if(r!==null)return r}}return null}getGroupIndentation(t,e=this.value,o=0){for(const n of e){if(n===t)return o;if(n.children){const r=this.getGroupIndentation(t,n.children,o+1);if(r!==null)return r}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(t=!1){if(this._filteredData.length!==0&&!t||!this.loadFunction)return!1;this.loading=!0;try{const e=await this.loadFunction();return this.data=e,this.loading=!1,this._errorLoading=!1,!0}catch(e){return this.loading=!1,this._filteredData.length!==0||(e instanceof Error&&this.loadingErrorElement&&e.message.trim()!==""&&(this.loadingErrorElement.textContent=e.message),this._errorLoading=!0),!1}}filter(t,e=this.filterFunction??this._stringFilterFunction,o=this.data){const n=[];for(const r of o)if(e(t,r)){if(this.preserveStructureOnFilter){const s={data:r.data};if(r.children){const l=this.filter(t,e,r.children);l.length&&(s.children=l)}n.push(s)}else if(n.push({data:r.data}),r.children){const s=this.filter(t,e,r.children);n.push(...s)}}else if(r.children){const s=this.filter(t,e,r.children);this.preserveStructureOnFilter&&s.length?n.push({data:r.data,children:s}):n.push(...s)}return n}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return yl();if(this._errorLoading)return f``;if(this._filteredData.length===0&&this._missingDataElement)return f``;const t=document.createElement("bim-table-row");t.table=this,t.isHeader=!0,t.data=this._headerRowData,t.style.gridArea="Header",t.style.position="sticky",t.style.top="0",t.style.zIndex="5";const e=document.createElement("bim-table-children");return e.table=this,e.data=this.value,e.style.gridArea="Body",e.style.backgroundColor="transparent",f`
- ${this.headersHidden?null:t} ${yl()} + ${this.headersHidden?null:t} ${_l()}
${e}
- `}};Er.styles=[lt.scrollbar,E` + `}};So.styles=[lt.scrollbar,E` :host { position: relative; overflow: auto; @@ -1404,7 +1416,7 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab flex-wrap: wrap; margin-bottom: 0.5rem; } - `];let N=Er;U([Lt()],N.prototype,"_filteredData",2);U([h({type:Boolean,attribute:"headers-hidden",reflect:!0})],N.prototype,"headersHidden",2);U([h({type:String,attribute:"min-col-width",reflect:!0})],N.prototype,"minColWidth",2);U([h({type:Array,attribute:!1})],N.prototype,"columns",1);U([h({type:Array,attribute:!1})],N.prototype,"data",1);U([h({type:Boolean,reflect:!0})],N.prototype,"expanded",2);U([h({type:Boolean,reflect:!0,attribute:"selectable-rows"})],N.prototype,"selectableRows",2);U([h({attribute:!1})],N.prototype,"selection",2);U([h({type:Boolean,attribute:"no-indentation",reflect:!0})],N.prototype,"noIndentation",2);U([h({type:Boolean,reflect:!0})],N.prototype,"loading",2);U([Lt()],N.prototype,"_errorLoading",2);var Ol=Object.defineProperty,Tl=Object.getOwnPropertyDescriptor,Me=(i,t,e,r)=>{for(var n=r>1?void 0:r?Tl(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ol(t,e,n),n};const Cr=class extends w{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set hidden(t){this._hidden=t,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:t}=this;if(t&&this.name===this._defaultName){const e=[...t.children].indexOf(this);this.name=`${this._defaultName}${e}`}}render(){return f` `}};Cr.styles=E` + `];let I=So;U([Lt()],I.prototype,"_filteredData",2);U([h({type:Boolean,attribute:"headers-hidden",reflect:!0})],I.prototype,"headersHidden",2);U([h({type:String,attribute:"min-col-width",reflect:!0})],I.prototype,"minColWidth",2);U([h({type:Array,attribute:!1})],I.prototype,"columns",1);U([h({type:Array,attribute:!1})],I.prototype,"data",1);U([h({type:Boolean,reflect:!0})],I.prototype,"expanded",2);U([h({type:Boolean,reflect:!0,attribute:"selectable-rows"})],I.prototype,"selectableRows",2);U([h({attribute:!1})],I.prototype,"selection",2);U([h({type:Boolean,attribute:"no-indentation",reflect:!0})],I.prototype,"noIndentation",2);U([h({type:Boolean,reflect:!0})],I.prototype,"loading",2);U([Lt()],I.prototype,"_errorLoading",2);var Tl=Object.defineProperty,zl=Object.getOwnPropertyDescriptor,Re=(i,t,e,o)=>{for(var n=o>1?void 0:o?zl(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&Tl(t,e,n),n};const Ao=class extends w{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set hidden(t){this._hidden=t,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:t}=this;if(t&&this.name===this._defaultName){const e=[...t.children].indexOf(this);this.name=`${this._defaultName}${e}`}}render(){return f` `}};Ao.styles=E` :host { display: block; height: 100%; @@ -1413,14 +1425,14 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab :host([hidden]) { display: none; } - `;let M=Cr;Me([h({type:String,reflect:!0})],M.prototype,"name",2);Me([h({type:String,reflect:!0})],M.prototype,"label",2);Me([h({type:String,reflect:!0})],M.prototype,"icon",2);Me([h({type:Boolean,reflect:!0})],M.prototype,"hidden",1);var zl=Object.defineProperty,Pl=Object.getOwnPropertyDescriptor,Ft=(i,t,e,r)=>{for(var n=r>1?void 0:r?Pl(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&zl(t,e,n),n};const kr=class extends w{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=t=>{const e=t.target;e instanceof M&&!e.hidden&&(e.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=e.name,e.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(t){this._tab=t;const e=[...this.children],r=e.find(n=>n instanceof M&&n.name===t);for(const n of e){if(!(n instanceof M))continue;n.hidden=r!==n;const o=this.getTabSwitcher(n.name);o&&o.toggleAttribute("data-active",!n.hidden)}}get tab(){return this._tab}getTabSwitcher(t){return this._switchers.find(e=>e.getAttribute("data-name")===t)}createSwitchers(){this._switchers=[];for(const t of this.children){if(!(t instanceof M))continue;const e=document.createElement("div");e.addEventListener("click",()=>{this.tab===t.name?this.toggleAttribute("tab",!1):this.tab=t.name}),e.setAttribute("data-name",t.name),e.className="switcher";const r=document.createElement("bim-label");r.textContent=t.label??"",r.icon=t.icon,e.append(r),this._switchers.push(e)}}onSlotChange(t){this.createSwitchers();const e=t.target.assignedElements(),r=e.find(n=>n instanceof M?this.tab?n.name===this.tab:!n.hidden:!1);r&&r instanceof M&&(this.tab=r.name);for(const n of e){if(!(n instanceof M)){n.remove();continue}n.removeEventListener("hiddenchange",this.onTabHiddenChange),r!==n&&(n.hidden=!0),n.addEventListener("hiddenchange",this.onTabHiddenChange)}}render(){return f` + `;let M=Ao;Re([h({type:String,reflect:!0})],M.prototype,"name",2);Re([h({type:String,reflect:!0})],M.prototype,"label",2);Re([h({type:String,reflect:!0})],M.prototype,"icon",2);Re([h({type:Boolean,reflect:!0})],M.prototype,"hidden",1);var jl=Object.defineProperty,Pl=Object.getOwnPropertyDescriptor,Ft=(i,t,e,o)=>{for(var n=o>1?void 0:o?Pl(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&jl(t,e,n),n};const Oo=class extends w{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=t=>{const e=t.target;e instanceof M&&!e.hidden&&(e.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=e.name,e.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(t){this._tab=t;const e=[...this.children],o=e.find(n=>n instanceof M&&n.name===t);for(const n of e){if(!(n instanceof M))continue;n.hidden=o!==n;const r=this.getTabSwitcher(n.name);r&&r.toggleAttribute("data-active",!n.hidden)}}get tab(){return this._tab}getTabSwitcher(t){return this._switchers.find(e=>e.getAttribute("data-name")===t)}createSwitchers(){this._switchers=[];for(const t of this.children){if(!(t instanceof M))continue;const e=document.createElement("div");e.addEventListener("click",()=>{this.tab===t.name?this.toggleAttribute("tab",!1):this.tab=t.name}),e.setAttribute("data-name",t.name),e.className="switcher";const o=document.createElement("bim-label");o.textContent=t.label??"",o.icon=t.icon,e.append(o),this._switchers.push(e)}}onSlotChange(t){this.createSwitchers();const e=t.target.assignedElements(),o=e.find(n=>n instanceof M?this.tab?n.name===this.tab:!n.hidden:!1);o&&o instanceof M&&(this.tab=o.name);for(const n of e){if(!(n instanceof M)){n.remove();continue}n.removeEventListener("hiddenchange",this.onTabHiddenChange),o!==n&&(n.hidden=!0),n.addEventListener("hiddenchange",this.onTabHiddenChange)}}render(){return f`
${this._switchers}
- `}};kr.styles=[lt.scrollbar,E` + `}};Oo.styles=[lt.scrollbar,E` * { box-sizing: border-box; } @@ -1531,11 +1543,11 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab border-radius: var(--bim-ui_size-2xs); background-color: var(--bim-ui_bg-base); } - `];let yt=kr;Ft([Lt()],yt.prototype,"_switchers",2);Ft([h({type:Boolean,reflect:!0})],yt.prototype,"bottom",2);Ft([h({type:Boolean,attribute:"switchers-hidden",reflect:!0})],yt.prototype,"switchersHidden",2);Ft([h({type:Boolean,reflect:!0})],yt.prototype,"floating",2);Ft([h({type:String,reflect:!0})],yt.prototype,"tab",1);Ft([h({type:Boolean,attribute:"switchers-full",reflect:!0})],yt.prototype,"switchersFull",2);/** + `];let yt=Oo;Ft([Lt()],yt.prototype,"_switchers",2);Ft([h({type:Boolean,reflect:!0})],yt.prototype,"bottom",2);Ft([h({type:Boolean,attribute:"switchers-hidden",reflect:!0})],yt.prototype,"switchersHidden",2);Ft([h({type:Boolean,reflect:!0})],yt.prototype,"floating",2);Ft([h({type:String,reflect:!0})],yt.prototype,"tab",1);Ft([h({type:Boolean,attribute:"switchers-full",reflect:!0})],yt.prototype,"switchersFull",2);/** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const sn=i=>i??A;var jl=Object.defineProperty,Ll=Object.getOwnPropertyDescriptor,K=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ll(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&jl(t,e,n),n};const Sr=class extends w{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(t){this._inputTypes.includes(t)&&(this._type=t)}get type(){return this._type}get query(){return ni(this.value)}onInputChange(t){t.stopPropagation();const e=t.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=e.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("input");e==null||e.focus()})}render(){return f` + */const an=i=>i??A;var Ll=Object.defineProperty,Ml=Object.getOwnPropertyDescriptor,K=(i,t,e,o)=>{for(var n=o>1?void 0:o?Ml(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&Ll(t,e,n),n};const To=class extends w{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(t){this._inputTypes.includes(t)&&(this._type=t)}get type(){return this._type}get query(){return ri(this.value)}onInputChange(t){t.stopPropagation();const e=t.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=e.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("input");e==null||e.focus()})}render(){return f` t in i?Mr(i,t,{enumerable:!0,configurab aria-label=${this.label||this.name||"Text Input"} .value=${this.value} .rows=${this.rows??5} - placeholder=${sn(this.placeholder)} + placeholder=${an(this.placeholder)} @input=${this.onInputChange} >`:f` `} - `}};Sr.styles=[lt.scrollbar,E` + `}};To.styles=[lt.scrollbar,E` :host { --bim-input--bgc: var(--bim-ui_bg-contrast-20); flex: 1; @@ -1592,7 +1604,7 @@ var Mr=Object.defineProperty,Rr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurab /* :host([disabled]) { --bim-input--bgc: var(--bim-ui_bg-contrast-20); } */ - `];let Q=Sr;K([h({type:String,reflect:!0})],Q.prototype,"icon",2);K([h({type:String,reflect:!0})],Q.prototype,"label",2);K([h({type:String,reflect:!0})],Q.prototype,"name",2);K([h({type:String,reflect:!0})],Q.prototype,"placeholder",2);K([h({type:String,reflect:!0})],Q.prototype,"value",2);K([h({type:Boolean,reflect:!0})],Q.prototype,"vertical",2);K([h({type:Number,reflect:!0})],Q.prototype,"debounce",2);K([h({type:Number,reflect:!0})],Q.prototype,"rows",2);K([h({type:String,reflect:!0})],Q.prototype,"type",1);var Ml=Object.defineProperty,Rl=Object.getOwnPropertyDescriptor,Ar=(i,t,e,r)=>{for(var n=r>1?void 0:r?Rl(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Ml(t,e,n),n};const Or=class extends w{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(t){this._vertical=t,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const t=this.children;for(const e of t)this.vertical?e.setAttribute("label-hidden",""):e.removeAttribute("label-hidden")}render(){return f` + `];let G=To;K([h({type:String,reflect:!0})],G.prototype,"icon",2);K([h({type:String,reflect:!0})],G.prototype,"label",2);K([h({type:String,reflect:!0})],G.prototype,"name",2);K([h({type:String,reflect:!0})],G.prototype,"placeholder",2);K([h({type:String,reflect:!0})],G.prototype,"value",2);K([h({type:Boolean,reflect:!0})],G.prototype,"vertical",2);K([h({type:Number,reflect:!0})],G.prototype,"debounce",2);K([h({type:Number,reflect:!0})],G.prototype,"rows",2);K([h({type:String,reflect:!0})],G.prototype,"type",1);var Rl=Object.defineProperty,Bl=Object.getOwnPropertyDescriptor,zo=(i,t,e,o)=>{for(var n=o>1?void 0:o?Bl(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&Rl(t,e,n),n};const jo=class extends w{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(t){this._vertical=t,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const t=this.children;for(const e of t)this.vertical?e.setAttribute("label-hidden",""):e.removeAttribute("label-hidden")}render(){return f`