@roomle/embedding-lib 5.33.0 → 5.34.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/md/web/embedding/CHANGELOG.md +38 -48
- package/index.d.ts +0 -1
- package/package.json +1 -1
- package/packages/common/src/utils/configurations.d.ts +1 -1
- package/packages/common/src/utils/domain.d.ts +17 -0
- package/packages/common/src/utils/id-inferrer.d.ts +1 -1
- package/packages/common/src/utils/init-data.d.ts +3 -2
- package/packages/common/src/utils/noop.d.ts +1 -0
- package/packages/embedding-lib/src/connector.d.ts +1 -0
- package/packages/embedding-lib/src/embedding-lib.d.ts +2 -95
- package/packages/embedding-lib/src/examples/utils/drag-listeners.d.ts +1 -3
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/create-catalog.d.ts +1 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts +2 -2
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/nobilia-api-options.d.ts +2 -6
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/state.d.ts +5 -5
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/{util.d.ts → utils.d.ts} +0 -7
- package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +4 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-requests.d.ts +8 -0
- package/packages/embedding-lib/src/plugins/drag-in.d.ts +1 -1
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +1 -2
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +1 -2
- package/packages/embedding-lib/src/plugins/strategy/types.d.ts +1 -1
- package/packages/embedding-lib/src/types.d.ts +92 -0
- package/packages/web-sdk/packages/common-core/mock/mock-utils.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/cameracontrol/camera-control-3d.d.ts +2 -1
- package/packages/web-sdk/packages/common-core/src/cameracontrol/planner-3d-camera-behaviour.d.ts +0 -1
- package/packages/web-sdk/packages/common-core/src/configurator-kernel-access.d.ts +3 -4
- package/packages/web-sdk/packages/common-core/src/main.d.ts +3 -3
- package/packages/web-sdk/packages/common-core/src/rapi-access.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/roomle-sdk.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/services/cache-holder.d.ts +1 -2
- package/packages/web-sdk/packages/common-core/src/services/common-kernel-access.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/services/hdr-environment-loader.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/services/idb-manager.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/utils/browser-helper.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/utils/common-utils.d.ts +3 -3
- package/packages/web-sdk/packages/common-core/src/utils/external-objects.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/utils/init-data.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/utils/shims.d.ts +1 -4
- package/packages/web-sdk/packages/common-core/src/utils/threejs-utils.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/view-model/configurator-plan-object-view-model.d.ts +2 -1
- package/packages/web-sdk/packages/common-core/src/view-model/configurator-view-model.d.ts +4 -4
- package/packages/web-sdk/packages/common-core/src/view-model/plan-element-view-model.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/view-model/plan-object-view-model.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/webgl/mesh-generator.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/environment-definition.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/light-source-detection.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/outline-renderer.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/baked-ground-contact-shadow-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/gbuffer-render-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/ground-reflection-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/outline-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/render-pass.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/scene-render-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/screen-space-shadow-map-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/shadow-and-ao-pass.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/render-pass-manager.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/render-utility.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/scene-renderer.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/shader-utility.d.ts +5 -5
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/shaders/ao-shader.d.ts +5 -5
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/shaders/poisson-denoise-shader.d.ts +4 -4
- package/packages/web-sdk/packages/common-core/src/webgl/roomle-webgl-renderer.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/webgl/scene-manager.d.ts +161 -0
- package/packages/web-sdk/packages/configurator-core/src/configurator-main.d.ts +2 -1
- package/packages/web-sdk/packages/configurator-core/src/configurator.d.ts +2 -2
- package/packages/web-sdk/packages/configurator-core/src/roomle-configurator.d.ts +5 -5
- package/packages/web-sdk/packages/configurator-core/src/services/configurator-ui-callback.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/component-dimensioning.d.ts +1 -10
- package/packages/web-sdk/packages/configurator-core/src/utils/dimensioning-helper.d.ts +0 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/global-definitions.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/raycast-helper.d.ts +4 -1
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +10 -4
- package/packages/web-sdk/packages/glb-viewer-core/src/glb-viewer-main.d.ts +1 -1
- package/packages/web-sdk/packages/glb-viewer-core/src/glb-viewer.d.ts +2 -2
- package/packages/web-sdk/packages/glb-viewer-core/src/roomle-glb-viewer.d.ts +3 -3
- package/packages/web-sdk/packages/glb-viewer-core/src/utils/global-definitions.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/api.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/callbacks.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/debug-logging.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/external-object-api.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/glue-logic.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/{loader.d.ts → hi-api-types.d.ts} +7 -9
- package/packages/web-sdk/packages/homag-intelligence/src/hi-object-selection.d.ts +2 -2
- package/packages/web-sdk/packages/homag-intelligence/src/hi-tag-catalog-callbacks.d.ts +0 -1
- package/packages/web-sdk/packages/homag-intelligence/src/homag-intelligence.d.ts +3 -3
- package/packages/web-sdk/packages/homag-intelligence/src/model/oc-scripts-domain.model.d.ts +2 -1
- package/packages/web-sdk/packages/homag-intelligence/src/orders.d.ts +1 -1
- package/packages/web-sdk/packages/index.d.ts +36 -0
- package/packages/web-sdk/packages/material-viewer/src/material-viewer-main.d.ts +2 -1
- package/packages/web-sdk/packages/material-viewer/src/material-viewer.d.ts +1 -1
- package/packages/web-sdk/packages/material-viewer/src/roomle-material-viewer.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/mock/planner-mock-helper.d.ts +6 -6
- package/packages/web-sdk/packages/planner-core/src/lights/lamp-light.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/lights/point-lamp-light.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/lights/rect-area-light.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/planner-main.d.ts +2 -1
- package/packages/web-sdk/packages/planner-core/src/planner.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/src/roomle-planner-ui-callback.d.ts +5 -3
- package/packages/web-sdk/packages/planner-core/src/roomle-planner.d.ts +9 -10
- package/packages/web-sdk/packages/planner-core/src/services/planner-kernel-access.d.ts +4 -5
- package/packages/web-sdk/packages/planner-core/src/utils/dimensions-helper.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/utils/global-definitions.d.ts +3 -3
- package/packages/web-sdk/packages/planner-core/src/utils/map-to-ui-plan-objects.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/utils/planner-scene-utils.d.ts +4 -4
- package/packages/web-sdk/packages/planner-core/src/utils/planner-selection-handler.d.ts +4 -2
- package/packages/web-sdk/packages/planner-core/src/view-model/ceiling-plan-element-view-model.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/view-model/construction-plan-object-view-model.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/view-model/floor-plan-element-view-model.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/src/view-model/measurement-line-plan-element-view-model.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/src/view-model/node-plan-element-view-model.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/view-model/plan-view-model.d.ts +5 -5
- package/packages/web-sdk/packages/planner-core/src/view-model/static-plan-object-view-model.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/src/view-model/wall-attic-plan-element-view-model.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/view-model/wall-plan-element-view-model.d.ts +2 -2
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-element-highlighter.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-event-handler.d.ts +4 -3
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-manager.d.ts +6 -6
- package/packages/web-sdk/packages/tools-core/src/tools-core.d.ts +1 -1
- package/packages/web-sdk/packages/typings/configurator-kernel-container.d.ts +1 -2
- package/packages/web-sdk/packages/typings/external-objects.d.ts +3 -3
- package/packages/web-sdk/packages/typings/global-definitions.d.ts +6 -2
- package/packages/web-sdk/packages/typings/kernel.d.ts +5 -8
- package/packages/web-sdk/packages/typings/planner-kernel-container.d.ts +1 -2
- package/packages/web-sdk/packages/typings/planner.d.ts +2 -2
- package/packages/web-sdk/packages/typings/shims.d.ts +0 -5
- package/roomle-embedding-lib.es.js +49 -54
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +7 -7
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/src/common/components/EmbeddedAdditionalInfo.vue.d.ts +3 -3
- package/src/common/components/EmbeddedExternalCatalog.vue.d.ts +5 -5
- package/src/common/components/EmbeddedInfoWrapper.vue.d.ts +14 -11
- package/src/common/components/ExpandableIcons.vue.d.ts +9 -7
- package/src/common/components/IconButton.vue.d.ts +1 -1
- package/src/common/components/Layer.vue.d.ts +4 -2
- package/src/common/components/Layout.vue.d.ts +8 -6
- package/src/common/components/SelectionButton.vue.d.ts +6 -4
- package/src/common/components/ShowCustomView.vue.d.ts +12 -10
- package/src/common/components/SwitchButton.vue.d.ts +11 -9
- package/src/common/components/Tooltip.vue.d.ts +26 -24
- package/src/common/components/action-buttons/-utils/ActionButton.vue.d.ts +6 -4
- package/src/common/components/flying-menu/FlyingMenu.vue.d.ts +2 -2
- package/src/common/components/helpers.d.ts +1 -0
- package/src/common/components/inputs/NumericInputWrapper.vue.d.ts +6 -4
- package/src/common/components/inputs/SelectDropdown.vue.d.ts +2 -2
- package/src/common/components/notifications/LoadSavedPlanNotification.vue.d.ts +2 -0
- package/src/common/components/notifications/NotificationCard.vue.d.ts +6 -4
- package/src/common/components/overlays/PartList.vue.d.ts +66 -65
- package/src/common/components/overlays/part-list/PartListEntry.vue.d.ts +9 -9
- package/src/common/components/overlays/part-list/PartListHeader.vue.d.ts +3 -2
- package/src/common/components/overlays/part-list/PartListPrint.vue.d.ts +7 -4
- package/src/common/components/overlays/part-list/PartListRow.vue.d.ts +2 -2
- package/src/common/components/overlays/part-list/partlist-setup.d.ts +2 -4
- package/src/common/components/parameters/ColorParameter.vue.d.ts +10 -2208
- package/src/common/components/side-bar/NavigationButtonsWrapper.vue.d.ts +4 -2
- package/src/common/components/side-bar/ResponsiveSidebarWrapper.vue.d.ts +9 -6
- package/src/common/components/side-bar/SidebarItem.vue.d.ts +18 -9
- package/src/common/components/side-bar/SidebarItemLabel.vue.d.ts +8 -2
- package/src/common/components/side-bar/TabbedNav.vue.d.ts +7 -6
- package/src/common/components/side-bar/TabbedNavMenu.vue.d.ts +3 -2
- package/src/common/components/side-bar/utils/configurator-sidebar-components.d.ts +72 -2310
- package/src/common/components/side-bar/utils/types.d.ts +1 -2
- package/src/common/components/tool-tip/MoreInfoTooltipContent.vue.d.ts +9 -4
- package/src/common/components/tool-tip/ParameterTooltip.vue.d.ts +6 -4
- package/src/common/components/utils/-utils/notifications.d.ts +1 -1
- package/src/common/components/utils/CollapsibleButtonsContainer.vue.d.ts +3 -1
- package/src/common/components/utils/HeightToggle.vue.d.ts +3 -1
- package/src/common/composables/use-configurator-actions-visibility.d.ts +1 -1
- package/src/common/composables/use-fetch-root-tag.d.ts +1 -1
- package/src/common/composables/use-item-variants.d.ts +1 -1
- package/src/common/composables/use-keyboard-resize.d.ts +1 -0
- package/src/common/composables/use-materials-and-ral-colors.d.ts +3 -2
- package/src/common/composables/use-materials-grouped.d.ts +1 -1
- package/src/common/composables/use-measurement-styles.d.ts +1 -2
- package/src/common/composables/use-planner-actions-visibility.d.ts +1 -2
- package/src/common/composables/use-product-price.d.ts +1 -1
- package/src/common/composables/use-sdk-event-emitter-listener.d.ts +1 -7
- package/src/common/composables/use-selected-object-center.d.ts +2 -1
- package/src/common/composables/use-selected-plan-element.d.ts +1 -0
- package/src/common/composables/use-shared-sidebar-setup.d.ts +20 -28
- package/src/common/composables/use-static-item-parameters.d.ts +1 -0
- package/src/common/composables/use-wall-dimensions-cache.d.ts +1 -1
- package/src/common/store/common-ui-store.d.ts +10 -9
- package/src/common/store/index.d.ts +1 -1
- package/src/common/utils/catalog-builder.d.ts +2 -3
- package/src/common/utils/color.d.ts +1 -0
- package/src/common/utils/helper.d.ts +5 -5
- package/src/common/utils/parameters.d.ts +1 -3
- package/src/common/utils/root-tags.d.ts +1 -1
- package/src/common/utils/types.d.ts +1 -3
- package/src/common/utils/ui-actions.d.ts +2 -3
- package/src/configurator/business-logic/roomle-sdk-wrapper.d.ts +1 -8
- package/src/configurator/business-logic/sdk-connector-configurator.d.ts +1 -3
- package/src/configurator/business-logic/sdk-connector.d.ts +1 -10
- package/src/configurator/business-logic/ui-callback.d.ts +1 -1
- package/src/configurator/components/addons/PossibleChildren.vue.d.ts +2 -0
- package/src/configurator/components/grid-view/-utils/CollapsedView.vue.d.ts +25 -22
- package/src/configurator/components/grid-view/-utils/ExpandedHeader.vue.d.ts +8 -6
- package/src/configurator/components/grid-view/-utils/ExpandedView.vue.d.ts +21 -20
- package/src/configurator/components/grid-view/-utils/GridViewElement.vue.d.ts +3 -2
- package/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +1 -2
- package/src/configurator/components/grid-view/-utils/GridViewMaterialElement.vue.d.ts +4 -2
- package/src/configurator/components/grid-view/-utils/GridViewThumbnailsElement.vue.d.ts +4 -2
- package/src/configurator/components/grid-view/-utils/GridViewTooltipElement.vue.d.ts +4 -2
- package/src/configurator/components/grid-view/GridView.vue.d.ts +15 -13
- package/src/configurator/components/overlays/LoadProduct.vue.d.ts +6 -4
- package/src/configurator/components/overlays/SaveDraft.vue.d.ts +6 -4
- package/src/configurator/components/overlays/ar/OpenARView.vue.d.ts +15 -12
- package/src/configurator/components/parameters/ParameterGroupButton.vue.d.ts +7 -5
- package/src/configurator/components/parameters/ParameterGroups.vue.d.ts +6 -4
- package/src/configurator/components/parameters/types/DisabledParameters.vue.d.ts +2 -2
- package/src/configurator/components/parameters/types/MaterialParameter.vue.d.ts +2 -0
- package/src/configurator/components/parameters/types/OptionsParameter.vue.d.ts +2 -0
- package/src/configurator/components/parameters/types/OptionsParameterValue.vue.d.ts +8 -6
- package/src/configurator/components/parameters/types/ParameterGroupPills.vue.d.ts +9 -7
- package/src/configurator/components/parameters/types/ProductVariant.vue.d.ts +13 -12
- package/src/configurator/components/parameters/types/RangeParameter.vue.d.ts +1 -0
- package/src/configurator/components/parameters/types/ThumbnailsParameter.vue.d.ts +13 -12
- package/src/configurator/components/utils/-utils/SceneOffsetResizer.d.ts +1 -2
- package/src/configurator/components/utils/AspectRatioBox.vue.d.ts +4 -2
- package/src/configurator/components/utils/HeightContainer.vue.d.ts +9 -7
- package/src/configurator/components/utils/InteractionsContainer.vue.d.ts +11 -9
- package/src/configurator/components/utils/PopUp.vue.d.ts +8 -6
- package/src/configurator/components/utils/SearchInput.vue.d.ts +8 -6
- package/src/configurator/components/utils/WordWrap.vue.d.ts +3 -2
- package/src/configurator/embedding/drag-handler.d.ts +1 -1
- package/src/configurator/embedding/example/Embedding.vue.d.ts +5 -4
- package/src/configurator/embedding/example/GlbConfSwitch.vue.d.ts +3 -2
- package/src/configurator/embedding/example/GlbConfSwitchSecret.vue.d.ts +2 -1
- package/src/configurator/embedding/exposed-api.d.ts +1 -9
- package/src/configurator/embedding/exposed-callbacks.d.ts +1 -3
- package/src/configurator/embedding/helper.d.ts +2 -4
- package/src/configurator/embedding/roomle-configurator-api.d.ts +1 -4
- package/src/configurator/embedding/types.d.ts +1 -3
- package/src/configurator/plugins/libs-plugin.d.ts +0 -1
- package/src/configurator/store/core-data-store.d.ts +23 -22
- package/src/configurator/store/ui-state.d.ts +1 -5
- package/src/planner/business-logic/general-room-parameters.d.ts +2 -0
- package/src/planner/business-logic/rooms.d.ts +1 -4
- package/src/planner/business-logic/sdk-connector-planner.d.ts +2 -7
- package/src/planner/components/DraggableButton.vue.d.ts +12 -10
- package/src/planner/components/ObjectList.vue.d.ts +3 -2
- package/src/planner/components/RotationIndicator.vue.d.ts +10 -5
- package/src/planner/components/catalog/CatalogLevels.vue.d.ts +4 -2
- package/src/planner/components/catalog/CatalogNavigation.vue.d.ts +2 -2
- package/src/planner/components/catalog/ProductCard.vue.d.ts +4 -2
- package/src/planner/components/catalog/ProductGrid.vue.d.ts +2 -2
- package/src/planner/components/measurements/MeasurementDisplayComponent.vue.d.ts +25 -20
- package/src/planner/components/measurements/ShowConstructionMeasurements.vue.d.ts +2 -0
- package/src/planner/components/measurements/ShowFloorsAreasData.vue.d.ts +2 -0
- package/src/planner/components/measurements/ShowMeasurementLineDimension.vue.d.ts +2 -0
- package/src/planner/components/measurements/ShowObjectMeasurements.vue.d.ts +7 -4
- package/src/planner/components/measurements/ShowWallAtticMeasurements.vue.d.ts +2 -0
- package/src/planner/components/measurements/ShowWallMeasurements.vue.d.ts +5 -2
- package/src/planner/components/measurements/utils/AtticLine.vue.d.ts +2 -2
- package/src/planner/components/measurements/utils/MeasurementText.vue.d.ts +6 -4
- package/src/planner/components/overlays/ProductList.vue.d.ts +6 -5
- package/src/planner/components/overlays/ProductSettings.vue.d.ts +4 -3
- package/src/planner/components/overlays/RoomSidebar.vue.d.ts +3 -3
- package/src/planner/components/overlays/product-list/ProductListEntry.vue.d.ts +6 -4
- package/src/planner/components/overlays/product-list/ProductListType.vue.d.ts +6 -4
- package/src/planner/components/overlays/product-list/ProductsTotalPrice.vue.d.ts +1 -0
- package/src/planner/components/overlays/product-settings/ProductPositions.vue.d.ts +2 -0
- package/src/planner/components/overlays/product-settings/ProductRangeControl.vue.d.ts +22 -48
- package/src/planner/components/overlays/product-settings/ProductRotation.vue.d.ts +2 -0
- package/src/planner/components/overlays/product-settings/ProductSettingsInfos.vue.d.ts +9 -6
- package/src/planner/components/overlays/product-settings/ProductSize.vue.d.ts +2 -0
- package/src/planner/components/overlays/product-settings/ProductXYZChanger.vue.d.ts +2 -0
- package/src/planner/components/overlays/rooms/ConstructionVariants.vue.d.ts +5 -2
- package/src/planner/components/overlays/rooms/DoorParametersSetting.vue.d.ts +4 -3
- package/src/planner/components/overlays/rooms/ElementLengthScaling.vue.d.ts +22 -57
- package/src/planner/components/overlays/rooms/RoomFloorAndWallSettings.vue.d.ts +8 -7
- package/src/planner/components/overlays/rooms/RoomGeneralSettings.vue.d.ts +4 -3
- package/src/planner/components/overlays/rooms/RoomRangeParameter.vue.d.ts +1 -0
- package/src/planner/components/overlays/rooms/RoomsList.vue.d.ts +5 -4
- package/src/planner/components/overlays/rooms/SampleRooms.vue.d.ts +3 -3
- package/src/planner/components/overlays/rooms/SlopingRoof.vue.d.ts +5 -2
- package/src/planner/components/overlays/rooms/SlopingRoofDirection.vue.d.ts +7 -4
- package/src/planner/components/overlays/rooms/WallGeneralSettings.vue.d.ts +6 -4
- package/src/planner/components/overlays/rooms/WindowParametersSetting.vue.d.ts +4 -3
- package/src/planner/components/utils/ConfiguratorParameter.vue.d.ts +23 -0
- package/src/planner/components/utils/InteractionHeader.vue.d.ts +4 -2
- package/src/planner/components/utils/MeasurementsString.vue.d.ts +10 -6
- package/src/planner/store/planner-core-data.d.ts +1 -1
- package/src/planner/store/planner-ui-state.d.ts +1 -4
- package/src/planner/utils/interaction.d.ts +4 -1
- package/src/planner/utils/planner-sidebar.d.ts +1 -2
- package/src/viewer/business-logic/sdk-connector-viewer.d.ts +1 -1
- package/src/viewer/components/ViewerMain.vue.d.ts +4 -4
- package/src/viewer/components/ViewerSidebar.vue.d.ts +2 -2
- package/packages/web-sdk/packages/benchmark/budgeteer-measure.d.ts +0 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/fonts.d.ts +0 -4
- package/src/common/components/flying-menu/FlyingMenuToggles.vue.d.ts +0 -16
- package/src/common/components/flying-menu/MergeProductButtons.vue.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class H {
|
|
2
2
|
_side;
|
|
3
3
|
// for better debugging (who handles message? iframe or website?)
|
|
4
4
|
_incomingMessageBus = null;
|
|
@@ -108,11 +108,11 @@ class P {
|
|
|
108
108
|
* Copyright 2019 Google LLC
|
|
109
109
|
* SPDX-License-Identifier: Apache-2.0
|
|
110
110
|
*/
|
|
111
|
-
const
|
|
112
|
-
canHandle: (e) => G(e) && e[
|
|
111
|
+
const W = Symbol("Comlink.proxy"), X = Symbol("Comlink.endpoint"), j = Symbol("Comlink.releaseProxy"), S = Symbol("Comlink.finalizer"), w = Symbol("Comlink.thrown"), G = (e) => typeof e == "object" && e !== null || typeof e == "function", Z = {
|
|
112
|
+
canHandle: (e) => G(e) && e[W],
|
|
113
113
|
serialize(e) {
|
|
114
114
|
const { port1: t, port2: s } = new MessageChannel();
|
|
115
|
-
return
|
|
115
|
+
return P(e, t), [s, [s]];
|
|
116
116
|
},
|
|
117
117
|
deserialize(e) {
|
|
118
118
|
return e.start(), re(e);
|
|
@@ -143,7 +143,7 @@ function te(e, t) {
|
|
|
143
143
|
return !0;
|
|
144
144
|
return !1;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function P(e, t = globalThis, s = ["*"]) {
|
|
147
147
|
t.addEventListener("message", function r(n) {
|
|
148
148
|
if (!n || !n.data)
|
|
149
149
|
return;
|
|
@@ -174,7 +174,7 @@ function H(e, t = globalThis, s = ["*"]) {
|
|
|
174
174
|
case "ENDPOINT":
|
|
175
175
|
{
|
|
176
176
|
const { port1: d, port2: h } = new MessageChannel();
|
|
177
|
-
|
|
177
|
+
P(e, h), l = ae(d, [d]);
|
|
178
178
|
}
|
|
179
179
|
break;
|
|
180
180
|
case "RELEASE":
|
|
@@ -187,10 +187,10 @@ function H(e, t = globalThis, s = ["*"]) {
|
|
|
187
187
|
l = { value: u, [w]: 0 };
|
|
188
188
|
}
|
|
189
189
|
Promise.resolve(l).catch((u) => ({ value: u, [w]: 0 })).then((u) => {
|
|
190
|
-
const [g, d] =
|
|
191
|
-
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t),
|
|
190
|
+
const [g, d] = M(u);
|
|
191
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t), S in e && typeof e[S] == "function" && e[S]());
|
|
192
192
|
}).catch((u) => {
|
|
193
|
-
const [g, d] =
|
|
193
|
+
const [g, d] = M({
|
|
194
194
|
value: new TypeError("Unserializable return value"),
|
|
195
195
|
[w]: 0
|
|
196
196
|
});
|
|
@@ -217,7 +217,7 @@ function re(e, t) {
|
|
|
217
217
|
} finally {
|
|
218
218
|
s.delete(o.id);
|
|
219
219
|
}
|
|
220
|
-
}),
|
|
220
|
+
}), A(e, s, [], t);
|
|
221
221
|
}
|
|
222
222
|
function _(e) {
|
|
223
223
|
if (e)
|
|
@@ -241,7 +241,7 @@ function ne(e, t) {
|
|
|
241
241
|
function oe(e) {
|
|
242
242
|
O && O.unregister(e);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function A(e, t, s = [], r = function() {
|
|
245
245
|
}) {
|
|
246
246
|
let n = !1;
|
|
247
247
|
const o = new Proxy(r, {
|
|
@@ -259,11 +259,11 @@ function b(e, t, s = [], r = function() {
|
|
|
259
259
|
}).then(m);
|
|
260
260
|
return c.then.bind(c);
|
|
261
261
|
}
|
|
262
|
-
return
|
|
262
|
+
return A(e, t, [...s, i]);
|
|
263
263
|
},
|
|
264
264
|
set(a, i, c) {
|
|
265
265
|
_(n);
|
|
266
|
-
const [l, u] =
|
|
266
|
+
const [l, u] = M(c);
|
|
267
267
|
return p(e, t, {
|
|
268
268
|
type: "SET",
|
|
269
269
|
path: [...s, i].map((g) => g.toString()),
|
|
@@ -278,8 +278,8 @@ function b(e, t, s = [], r = function() {
|
|
|
278
278
|
type: "ENDPOINT"
|
|
279
279
|
}).then(m);
|
|
280
280
|
if (l === "bind")
|
|
281
|
-
return
|
|
282
|
-
const [u, g] =
|
|
281
|
+
return A(e, t, s.slice(0, -1));
|
|
282
|
+
const [u, g] = v(c);
|
|
283
283
|
return p(e, t, {
|
|
284
284
|
type: "APPLY",
|
|
285
285
|
path: s.map((d) => d.toString()),
|
|
@@ -288,7 +288,7 @@ function b(e, t, s = [], r = function() {
|
|
|
288
288
|
},
|
|
289
289
|
construct(a, i) {
|
|
290
290
|
_(n);
|
|
291
|
-
const [c, l] =
|
|
291
|
+
const [c, l] = v(i);
|
|
292
292
|
return p(e, t, {
|
|
293
293
|
type: "CONSTRUCT",
|
|
294
294
|
path: s.map((u) => u.toString()),
|
|
@@ -301,8 +301,8 @@ function b(e, t, s = [], r = function() {
|
|
|
301
301
|
function ie(e) {
|
|
302
302
|
return Array.prototype.concat.apply([], e);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
const t = e.map(
|
|
304
|
+
function v(e) {
|
|
305
|
+
const t = e.map(M);
|
|
306
306
|
return [t.map((s) => s[0]), ie(t.map((s) => s[1]))];
|
|
307
307
|
}
|
|
308
308
|
const $ = /* @__PURE__ */ new WeakMap();
|
|
@@ -310,9 +310,9 @@ function ae(e, t) {
|
|
|
310
310
|
return $.set(e, t), e;
|
|
311
311
|
}
|
|
312
312
|
function ce(e) {
|
|
313
|
-
return Object.assign(e, { [
|
|
313
|
+
return Object.assign(e, { [W]: !0 });
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function M(e) {
|
|
316
316
|
for (const [t, s] of z)
|
|
317
317
|
if (s.canHandle(e)) {
|
|
318
318
|
const [r, n] = s.serialize(e);
|
|
@@ -350,7 +350,7 @@ function p(e, t, s, r) {
|
|
|
350
350
|
function le() {
|
|
351
351
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
352
352
|
}
|
|
353
|
-
const T = ".",
|
|
353
|
+
const T = ".", R = {
|
|
354
354
|
REQUEST_BOOT: "requestBoot",
|
|
355
355
|
SETUP: "setup",
|
|
356
356
|
WEBSITE_READY: "websiteReady"
|
|
@@ -398,7 +398,7 @@ const T = ".", A = {
|
|
|
398
398
|
}
|
|
399
399
|
const { hostname: s } = new URL(t);
|
|
400
400
|
return s;
|
|
401
|
-
}, he = (e) => !!(de.includes(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com")),
|
|
401
|
+
}, he = (e) => !!(de.includes(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com")), C = [
|
|
402
402
|
"language",
|
|
403
403
|
"browserLanguage",
|
|
404
404
|
"userLanguage",
|
|
@@ -409,8 +409,8 @@ const T = ".", A = {
|
|
|
409
409
|
return e.substr(0, 2);
|
|
410
410
|
if (Array.isArray(t.languages) && t.languages.length > 0)
|
|
411
411
|
return t.languages[0].substr(0, 2);
|
|
412
|
-
for (let s = 0, r =
|
|
413
|
-
const n = t[
|
|
412
|
+
for (let s = 0, r = C.length; s < r; s++) {
|
|
413
|
+
const n = t[C[s]];
|
|
414
414
|
if (n)
|
|
415
415
|
return n.substr(0, 2);
|
|
416
416
|
}
|
|
@@ -458,7 +458,7 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
458
458
|
rotationSnapDegrees: 10,
|
|
459
459
|
interactionsCollapsed: !1
|
|
460
460
|
}, we = "(idle)", ye = (e) => (I(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace(
|
|
461
|
-
|
|
461
|
+
Se,
|
|
462
462
|
Te
|
|
463
463
|
)), e), I = (e) => {
|
|
464
464
|
if (!e)
|
|
@@ -475,15 +475,15 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
475
475
|
t.configuratorId = e.id;
|
|
476
476
|
const s = e.settings || {};
|
|
477
477
|
return !t.overrideTenant && e.tenant && (t.overrideTenant = e.tenant), pe(s, t);
|
|
478
|
-
},
|
|
478
|
+
}, Me = () => {
|
|
479
479
|
const e = _e(Ee);
|
|
480
480
|
e.locale || (e.locale = me()), e.id === we && delete e.id;
|
|
481
481
|
const t = fe();
|
|
482
482
|
return t && he(t) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = void 0, e.emails = !1, e;
|
|
483
|
-
},
|
|
483
|
+
}, Se = "<CONF_ID>", Te = "#CONFIGURATIONID#", Re = (e) => {
|
|
484
484
|
e.featureFlags || (e.featureFlags = {}), typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
|
|
485
|
-
},
|
|
486
|
-
class
|
|
485
|
+
}, x = () => /(android)/i.test(navigator.userAgent);
|
|
486
|
+
class D {
|
|
487
487
|
_messageHandler = null;
|
|
488
488
|
isSetupDone = !1;
|
|
489
489
|
viewName = "main";
|
|
@@ -602,14 +602,14 @@ const k = () => {
|
|
|
602
602
|
() => e.style.setProperty(N, q()),
|
|
603
603
|
0
|
|
604
604
|
);
|
|
605
|
-
},
|
|
605
|
+
}, B = "rml-styles", be = 450, N = "--rml-full-height", f = {
|
|
606
606
|
CONTAINER: "rml-container",
|
|
607
607
|
FILL: "rml-fill",
|
|
608
608
|
POSITION: "rml-pos",
|
|
609
609
|
TRANSITION: "rml-transition",
|
|
610
610
|
ANDROID_HEIGHT: "rml-android-height",
|
|
611
611
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
612
|
-
},
|
|
612
|
+
}, b = /* @__PURE__ */ new Map(), Ae = (e) => {
|
|
613
613
|
const t = {
|
|
614
614
|
/**
|
|
615
615
|
* The 'get' trap is fired when a property is accessed on the proxy.
|
|
@@ -628,12 +628,8 @@ const k = () => {
|
|
|
628
628
|
}
|
|
629
629
|
};
|
|
630
630
|
return new Proxy(e, t);
|
|
631
|
-
}, Ie = {
|
|
632
|
-
HIDE: "hide",
|
|
633
|
-
SHOW_ATTRIBUTES: "attributes",
|
|
634
|
-
SHOW_ARTICLES: "articles"
|
|
635
631
|
};
|
|
636
|
-
class
|
|
632
|
+
class Ie extends D {
|
|
637
633
|
static createPlanner(t, s, r, n = []) {
|
|
638
634
|
return this._create(
|
|
639
635
|
t,
|
|
@@ -643,7 +639,7 @@ class Ne extends x {
|
|
|
643
639
|
);
|
|
644
640
|
}
|
|
645
641
|
static async connect(t, s = []) {
|
|
646
|
-
const r = new
|
|
642
|
+
const r = new D();
|
|
647
643
|
r.viewName = t;
|
|
648
644
|
const { resolve: n, promise: o } = k(), { resolve: a, promise: i } = k(), c = ({
|
|
649
645
|
message: g,
|
|
@@ -660,7 +656,7 @@ class Ne extends x {
|
|
|
660
656
|
if (r.isSetupDone)
|
|
661
657
|
return r.executeMessage({ message: g, args: d });
|
|
662
658
|
}
|
|
663
|
-
}, l = new
|
|
659
|
+
}, l = new H(
|
|
664
660
|
"custom-view-" + t,
|
|
665
661
|
window,
|
|
666
662
|
window.parent,
|
|
@@ -725,7 +721,7 @@ class Ne extends x {
|
|
|
725
721
|
this.hiMessageHandler && window.removeEventListener("message", this.hiMessageHandler), this.hiMessageHandler = (s) => {
|
|
726
722
|
if (s.data.type === "connect_hi" && s.data.port) {
|
|
727
723
|
const r = s.data.port;
|
|
728
|
-
r.start?.(),
|
|
724
|
+
r.start?.(), P(Ae(t), r);
|
|
729
725
|
}
|
|
730
726
|
}, window.addEventListener("message", this.hiMessageHandler);
|
|
731
727
|
}
|
|
@@ -733,10 +729,10 @@ class Ne extends x {
|
|
|
733
729
|
return new Promise(async (o, a) => {
|
|
734
730
|
try {
|
|
735
731
|
const i = L(
|
|
736
|
-
|
|
732
|
+
Me(),
|
|
737
733
|
ye(r)
|
|
738
734
|
);
|
|
739
|
-
|
|
735
|
+
Re(i);
|
|
740
736
|
const c = await ue(
|
|
741
737
|
t,
|
|
742
738
|
i
|
|
@@ -765,12 +761,12 @@ class Ne extends x {
|
|
|
765
761
|
throw new Error(
|
|
766
762
|
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
767
763
|
);
|
|
768
|
-
if (
|
|
764
|
+
if (b.has(s))
|
|
769
765
|
throw new Error("There is already an instance on this DOM element");
|
|
770
|
-
if (!!!document.getElementById(
|
|
766
|
+
if (!!!document.getElementById(B)) {
|
|
771
767
|
const l = r.zIndex || 9999999, u = document.createElement("style");
|
|
772
|
-
u.type = "text/css", u.id =
|
|
773
|
-
const g = "transition:all ease-in-out " +
|
|
768
|
+
u.type = "text/css", u.id = B;
|
|
769
|
+
const g = "transition:all ease-in-out " + be + "ms;", d = ["-webkit-", "-o-"].reduce(
|
|
774
770
|
(K, Q) => K += Q + g,
|
|
775
771
|
""
|
|
776
772
|
) + g, h = q();
|
|
@@ -784,18 +780,18 @@ class Ne extends x {
|
|
|
784
780
|
`, document.head.appendChild(u);
|
|
785
781
|
}
|
|
786
782
|
this._executeMessage = this._executeMessage.bind(this);
|
|
787
|
-
const i = new
|
|
783
|
+
const i = new H(
|
|
788
784
|
"website",
|
|
789
785
|
window,
|
|
790
786
|
null,
|
|
791
787
|
this._executeMessage
|
|
792
788
|
);
|
|
793
|
-
this.setMessageHandler(i), this._onResize = this._onResize.bind(this),
|
|
789
|
+
this.setMessageHandler(i), this._onResize = this._onResize.bind(this), x() && window.addEventListener("resize", this._onResize), this._container = s, this._initData = r, this._configuratorSettings = t;
|
|
794
790
|
const c = this._createIframe();
|
|
795
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = o, this._container.appendChild(c), this._iframe = c, this.setupPlugins(n, this._iframe),
|
|
791
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = o, this._container.appendChild(c), this._iframe = c, this.setupPlugins(n, this._iframe), b.set(s, !0);
|
|
796
792
|
}
|
|
797
793
|
teardown() {
|
|
798
|
-
this._container &&
|
|
794
|
+
this._container && b.delete(this._container);
|
|
799
795
|
const t = this._container.querySelector("iframe");
|
|
800
796
|
t && this._container.removeChild(t), window.removeEventListener("resize", this._onResize);
|
|
801
797
|
}
|
|
@@ -808,14 +804,14 @@ class Ne extends x {
|
|
|
808
804
|
U(this._iframe);
|
|
809
805
|
}
|
|
810
806
|
_onUseFullPage() {
|
|
811
|
-
this._iframe.classList.add(f.POSITION), document.documentElement.classList.add(f.OVERFLOW_HIDDEN), window.document.body.classList.add(f.OVERFLOW_HIDDEN),
|
|
807
|
+
this._iframe.classList.add(f.POSITION), document.documentElement.classList.add(f.OVERFLOW_HIDDEN), window.document.body.classList.add(f.OVERFLOW_HIDDEN), x() && (U(this._iframe), this._iframe.classList.add(f.ANDROID_HEIGHT));
|
|
812
808
|
}
|
|
813
809
|
_onBackToWebsite() {
|
|
814
810
|
this._iframe.classList.remove(f.POSITION), this._iframe.classList.remove(f.ANDROID_HEIGHT), document.documentElement.classList.remove(f.OVERFLOW_HIDDEN), window.document.body.classList.remove(f.OVERFLOW_HIDDEN);
|
|
815
811
|
}
|
|
816
812
|
_executeMessage({ message: t, args: s }, r) {
|
|
817
813
|
if (r.source && r.source === this._iframe?.contentWindow)
|
|
818
|
-
return t ===
|
|
814
|
+
return t === R.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : t === R.SETUP ? (this.handleSetup(s[0]), F(
|
|
819
815
|
this.ui.callbacks,
|
|
820
816
|
"onUseFullPage",
|
|
821
817
|
this._onUseFullPage
|
|
@@ -828,11 +824,10 @@ class Ne extends x {
|
|
|
828
824
|
console.error("MessageHandler not set");
|
|
829
825
|
return;
|
|
830
826
|
}
|
|
831
|
-
this._messageHandler.sendMessage(
|
|
827
|
+
this._messageHandler.sendMessage(R.WEBSITE_READY);
|
|
832
828
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message: t, args: s });
|
|
833
829
|
}
|
|
834
830
|
}
|
|
835
831
|
export {
|
|
836
|
-
Ie as
|
|
837
|
-
Ne as default
|
|
832
|
+
Ie as default
|
|
838
833
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const T={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},P=()=>/(android)/i.test(navigator.userAgent);class A{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const L=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},N=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},k=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(C,k()),0)},I="rml-styles",C="--rml-full-height",H="rml-container",x="rml-fill",B="rml-pos",D="rml-android-height",U="rml-overflow-hidden",F=new Map,j={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class z extends A{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new A;r.viewName=t;const{resolve:n,promise:a}=L(),{resolve:i,promise:o}=L(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(e){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(T);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(F.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(I)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=I;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=k();t.innerHTML=`\n .${H}{${C}:${a};}\n .${B}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${x}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${C},1vh)*100)}\n .${U}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),P()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),F.set(s,!0)}teardown(){this._container&&F.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(H),e.classList.add(x),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(B),document.documentElement.classList.add(U),window.document.body.classList.add(U),P()&&(R(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(B),this._iframe.classList.remove(D),document.documentElement.classList.remove(U),window.document.body.classList.remove(U)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),N(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),N(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as HI_PANEL_ACTION,z as default};
|
|
1
|
+
class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const P={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},L=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&L(t),Array.isArray(t))for(const e of t)L(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},O=()=>/(android)/i.test(navigator.userAgent);class T{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const A=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},k=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},N=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(I,N()),0)},C="rml-styles",I="--rml-full-height",x="rml-container",H="rml-fill",B="rml-pos",D="rml-android-height",U="rml-overflow-hidden",F=new Map;class j extends T{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new T;r.viewName=t;const{resolve:n,promise:a}=A(),{resolve:i,promise:o}=A(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(e){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(P);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(L(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(F.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(C)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=C;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=N();t.innerHTML=`\n .${x}{${I}:${a};}\n .${B}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${H}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${I},1vh)*100)}\n .${U}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),O()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),F.set(s,!0)}teardown(){this._container&&F.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(x),e.classList.add(H),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(B),document.documentElement.classList.add(U),window.document.body.classList.add(U),O()&&(R(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(B),this._iframe.classList.remove(D),document.documentElement.classList.remove(U),window.document.body.classList.remove(U)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as default};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
(function(_,D){typeof exports=="object"&&typeof module<"u"?D(
|
|
1
|
+
(function(_,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=D())})(this,(function(){"use strict";class _{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,r,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=r,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((r,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return r(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return i.port1.close(),i.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?r(c.result):r(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&(typeof t.data=="string"||t.data.type!=="connect_hi")&&e)try{const r=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const n=this._execMessage(r,t);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:i}))},i=>{e.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(r){e.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/const tt=Symbol("Comlink.proxy"),Nt=Symbol("Comlink.endpoint"),xt=Symbol("Comlink.releaseProxy"),G=Symbol("Comlink.finalizer"),b=Symbol("Comlink.thrown"),et=s=>typeof s=="object"&&s!==null||typeof s=="function",Pt={canHandle:s=>et(s)&&s[tt],serialize(s){const{port1:t,port2:e}=new MessageChannel;return H(s,t),[e,[e]]},deserialize(s){return s.start(),Ut(s)}},Gt={canHandle:s=>et(s)&&b in s,serialize({value:s}){let t;return s instanceof Error?t={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:t={isError:!1,value:s},[t,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},st=new Map([["proxy",Pt],["throw",Gt]]);function Ht(s,t){for(const e of s)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function H(s,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Ht(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(p);let l;try{const u=a.slice(0,-1).reduce((h,g)=>h[g],s),d=a.reduce((h,g)=>h[g],s);switch(o){case"GET":l=d;break;case"SET":u[a.slice(-1)[0]]=p(n.data.value),l=!0;break;case"APPLY":l=d.apply(u,c);break;case"CONSTRUCT":{const h=new d(...c);l=Xt(h)}break;case"ENDPOINT":{const{port1:h,port2:g}=new MessageChannel;H(s,g),l=Wt(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[b]:0}}Promise.resolve(l).catch(u=>({value:u,[b]:0})).then(u=>{const[d,h]=M(u);t.postMessage(Object.assign(Object.assign({},d),{id:i}),h),o==="RELEASE"&&(t.removeEventListener("message",r),rt(t),G in s&&typeof s[G]=="function"&&s[G]())}).catch(u=>{const[d,h]=M({value:new TypeError("Unserializable return value"),[b]:0});t.postMessage(Object.assign(Object.assign({},d),{id:i}),h)})}),t.start&&t.start()}function Ft(s){return s.constructor.name==="MessagePort"}function rt(s){Ft(s)&&s.close()}function Ut(s,t){const e=new Map;return s.addEventListener("message",function(n){const{data:i}=n;if(!i||!i.id)return;const o=e.get(i.id);if(o)try{o(i)}finally{e.delete(i.id)}}),F(s,e,[],t)}function I(s){if(s)throw new Error("Proxy has been released and is not useable")}function nt(s){return T(s,new Map,{type:"RELEASE"}).then(()=>{rt(s)})}const A=new WeakMap,O="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const t=(A.get(s)||0)-1;A.set(s,t),t===0&&nt(s)});function Bt(s,t){const e=(A.get(t)||0)+1;A.set(t,e),O&&O.register(s,t,s)}function Yt(s){O&&O.unregister(s)}function F(s,t,e=[],r=function(){}){let n=!1;const i=new Proxy(r,{get(o,a){if(I(n),a===xt)return()=>{Yt(i),nt(s),t.clear(),n=!0};if(a==="then"){if(e.length===0)return{then:()=>i};const c=T(s,t,{type:"GET",path:e.map(l=>l.toString())}).then(p);return c.then.bind(c)}return F(s,t,[...e,a])},set(o,a,c){I(n);const[l,u]=M(c);return T(s,t,{type:"SET",path:[...e,a].map(d=>d.toString()),value:l},u).then(p)},apply(o,a,c){I(n);const l=e[e.length-1];if(l===Nt)return T(s,t,{type:"ENDPOINT"}).then(p);if(l==="bind")return F(s,t,e.slice(0,-1));const[u,d]=it(c);return T(s,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:u},d).then(p)},construct(o,a){I(n);const[c,l]=it(a);return T(s,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:c},l).then(p)}});return Bt(i,s),i}function kt(s){return Array.prototype.concat.apply([],s)}function it(s){const t=s.map(M);return[t.map(e=>e[0]),kt(t.map(e=>e[1]))]}const ot=new WeakMap;function Wt(s,t){return ot.set(s,t),s}function Xt(s){return Object.assign(s,{[tt]:!0})}function M(s){for(const[t,e]of st)if(e.canHandle(s)){const[r,n]=e.serialize(s);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:s},ot.get(s)||[]]}function p(s){switch(s.type){case"HANDLER":return st.get(s.name).deserialize(s.value);case"RAW":return s.value}}function T(s,t,e,r){return new Promise(n=>{const i=zt();t.set(i,n),s.start&&s.start(),s.postMessage(Object.assign({id:i},e),r)})}function zt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const U=".",B={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},R={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},$t=async(s,t)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=e+"/configurators/"+s,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:r,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(d)},c=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),l=await fetch(c),{configurator:u}=await l.json();return u},Vt=()=>{try{return window.self!==window.top}catch{return!0}},jt=["127.0.0.1","localhost","0.0.0.0"],qt=()=>{const s=Vt();let t=window.location.href;if(s){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},Kt=s=>!!(jt.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),at=["language","browserLanguage","userLanguage","systemLanguage"],Jt=(s=null)=>{const t=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=at.length;e<r;e++){const n=t[at[e]];if(n)return n.substr(0,2)}return"en"},Qt=(s,t)=>{const e=JSON.parse(JSON.stringify(s));return Y(e,t)},Y=(s,t)=>{for(const e in t)try{t[e].constructor===Object?s[e]=Y(s[e],t[e]):s[e]=t[e]}catch{s[e]=t[e]}return s};var ct=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s.PARAMETER_GROUPS="parameter_groups",s))(ct||{});const Zt=s=>JSON.parse(JSON.stringify(s)),te={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[ct.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},ee="(idle)",se=s=>(k(s),s?.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ie,oe)),s),k=s=>{if(!s)return;const t=Object.keys(s);for(const e of t){const r=s[e];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&k(r),Array.isArray(r))for(const n of r)k(n);(r==="true"||r==="false")&&(s[e]=r==="true")}},re=(s,t)=>{t.configuratorId=s.id;const e=s.settings||{};return!t.overrideTenant&&s.tenant&&(t.overrideTenant=s.tenant),Qt(e,t)},ne=()=>{const s=Zt(te);s.locale||(s.locale=Jt()),s.id===ee&&delete s.id;const t=qt();return t&&Kt(t)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=void 0,s.emails=!1,s},ie="<CONF_ID>",oe="#CONFIGURATIONID#",ae=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},lt=()=>/(android)/i.test(navigator.userAgent);class ut{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:r}=t;e.forEach(n=>{const i=n.split(U),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),r.forEach(n=>{const i=n.split(U),o=i[0],a=i[1],c=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][c]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const r=t.split(U),n=r[0],i=r[1],o=r.length===3?r[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...e);return a instanceof Promise?a.then(c=>({result:c})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,r="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>me).then(({DragIn:a})=>{const c=new a(this.ui,e,r,this.viewName);c.init().then(()=>{this.plugins.dragIn=c,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const c=new a(this.ui,e,r,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const ht=()=>{let s,t;return{promise:new Promise((r,n)=>{s=r,t=n}),resolve:s,reject:t}},dt=(s,t,e)=>{let r=null;Object.defineProperty(s,t,{get(){return r||e},set(n){n?.mute?r=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=n)}})},gt=()=>window.innerHeight*.01+"px",mt=s=>{s&&setTimeout(()=>s.style.setProperty(W,gt()),0)},_t="rml-styles",ce=450,W="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},X=new Map,le=s=>{const t={get(e,r,n){const i=Reflect.get(e,r,n);return i!==void 0?i:(console.warn(`[Homag Intelligence Callbacks] Method '${String(r)}' is not implemented. Executing a no-op.`),(...o)=>{})}};return new Proxy(s,t)},ue={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class he extends ut{static createPlanner(t,e,r,n=[]){return this._create(t,e,r,n)}static async connect(t,e=[]){const r=new ut;r.viewName=t;const{resolve:n,promise:i}=ht(),{resolve:o,promise:a}=ht(),c=({message:d,args:h})=>{switch(d){case R.REGISTER_CUSTOM_VIEW_DONE:n();break;case R.RETURN_METHODS:r.handleSetup(h[0]),o();break;default:if(r.isSetupDone)return r.executeMessage({message:d,args:h})}},l=new D("custom-view-"+t,window,window.parent,c);r.setMessageHandler(l);const u=[t];return l.sendMessage(R.REGISTER_CUSTOM_VIEW,u),await i,l.sendMessage(R.GET_METHODS,u),await a,r.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(t,e,r,n=[]){return this._create(t,e,r,n)}static create(t,e,r,n){return this._create(t,e,r,n)}static createViewer(t,e,r,n=[]){return this._create(t,e,r,n)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=e=>{if(e.data.type==="connect_hi"&&e.data.port){const r=e.data.port;r.start?.(),H(le(t),r)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(t,e,r,n){return new Promise(async(i,o)=>{try{const a=Y(ne(),se(r));ae(a);const c=await $t(t,a);r=re(c,a);const l=new this(c,e,r,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,r,n,i){if(super(),!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(X.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(_t)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=_t;const d="transition:all ease-in-out "+ce+"ms;",h=["-webkit-","-o-"].reduce((E,f)=>E+=f+d,"")+d,g=gt();u.innerHTML=`
|
|
5
|
+
*/const D=Symbol("Comlink.proxy"),Lt=Symbol("Comlink.endpoint"),Nt=Symbol("Comlink.releaseProxy"),G=Symbol("Comlink.finalizer"),b=Symbol("Comlink.thrown"),tt=s=>typeof s=="object"&&s!==null||typeof s=="function",xt={canHandle:s=>tt(s)&&s[D],serialize(s){const{port1:t,port2:e}=new MessageChannel;return H(s,t),[e,[e]]},deserialize(s){return s.start(),Ft(s)}},Pt={canHandle:s=>tt(s)&&b in s,serialize({value:s}){let t;return s instanceof Error?t={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:t={isError:!1,value:s},[t,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},et=new Map([["proxy",xt],["throw",Pt]]);function Gt(s,t){for(const e of s)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function H(s,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Gt(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(p);let l;try{const u=a.slice(0,-1).reduce((h,g)=>h[g],s),d=a.reduce((h,g)=>h[g],s);switch(o){case"GET":l=d;break;case"SET":u[a.slice(-1)[0]]=p(n.data.value),l=!0;break;case"APPLY":l=d.apply(u,c);break;case"CONSTRUCT":{const h=new d(...c);l=Wt(h)}break;case"ENDPOINT":{const{port1:h,port2:g}=new MessageChannel;H(s,g),l=kt(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[b]:0}}Promise.resolve(l).catch(u=>({value:u,[b]:0})).then(u=>{const[d,h]=M(u);t.postMessage(Object.assign(Object.assign({},d),{id:i}),h),o==="RELEASE"&&(t.removeEventListener("message",r),st(t),G in s&&typeof s[G]=="function"&&s[G]())}).catch(u=>{const[d,h]=M({value:new TypeError("Unserializable return value"),[b]:0});t.postMessage(Object.assign(Object.assign({},d),{id:i}),h)})}),t.start&&t.start()}function Ht(s){return s.constructor.name==="MessagePort"}function st(s){Ht(s)&&s.close()}function Ft(s,t){const e=new Map;return s.addEventListener("message",function(n){const{data:i}=n;if(!i||!i.id)return;const o=e.get(i.id);if(o)try{o(i)}finally{e.delete(i.id)}}),F(s,e,[],t)}function I(s){if(s)throw new Error("Proxy has been released and is not useable")}function rt(s){return w(s,new Map,{type:"RELEASE"}).then(()=>{st(s)})}const A=new WeakMap,O="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const t=(A.get(s)||0)-1;A.set(s,t),t===0&&rt(s)});function Ut(s,t){const e=(A.get(t)||0)+1;A.set(t,e),O&&O.register(s,t,s)}function Bt(s){O&&O.unregister(s)}function F(s,t,e=[],r=function(){}){let n=!1;const i=new Proxy(r,{get(o,a){if(I(n),a===Nt)return()=>{Bt(i),rt(s),t.clear(),n=!0};if(a==="then"){if(e.length===0)return{then:()=>i};const c=w(s,t,{type:"GET",path:e.map(l=>l.toString())}).then(p);return c.then.bind(c)}return F(s,t,[...e,a])},set(o,a,c){I(n);const[l,u]=M(c);return w(s,t,{type:"SET",path:[...e,a].map(d=>d.toString()),value:l},u).then(p)},apply(o,a,c){I(n);const l=e[e.length-1];if(l===Lt)return w(s,t,{type:"ENDPOINT"}).then(p);if(l==="bind")return F(s,t,e.slice(0,-1));const[u,d]=nt(c);return w(s,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:u},d).then(p)},construct(o,a){I(n);const[c,l]=nt(a);return w(s,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:c},l).then(p)}});return Ut(i,s),i}function Yt(s){return Array.prototype.concat.apply([],s)}function nt(s){const t=s.map(M);return[t.map(e=>e[0]),Yt(t.map(e=>e[1]))]}const it=new WeakMap;function kt(s,t){return it.set(s,t),s}function Wt(s){return Object.assign(s,{[D]:!0})}function M(s){for(const[t,e]of et)if(e.canHandle(s)){const[r,n]=e.serialize(s);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:s},it.get(s)||[]]}function p(s){switch(s.type){case"HANDLER":return et.get(s.name).deserialize(s.value);case"RAW":return s.value}}function w(s,t,e,r){return new Promise(n=>{const i=Xt();t.set(i,n),s.start&&s.start(),s.postMessage(Object.assign({id:i},e),r)})}function Xt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const U=".",B={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},R={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},zt=async(s,t)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=e+"/configurators/"+s,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:r,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(d)},c=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),l=await fetch(c),{configurator:u}=await l.json();return u},$t=()=>{try{return window.self!==window.top}catch{return!0}},Vt=["127.0.0.1","localhost","0.0.0.0"],jt=()=>{const s=$t();let t=window.location.href;if(s){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},qt=s=>!!(Vt.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),ot=["language","browserLanguage","userLanguage","systemLanguage"],Kt=(s=null)=>{const t=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=ot.length;e<r;e++){const n=t[ot[e]];if(n)return n.substr(0,2)}return"en"},Jt=(s,t)=>{const e=JSON.parse(JSON.stringify(s));return Y(e,t)},Y=(s,t)=>{for(const e in t)try{t[e].constructor===Object?s[e]=Y(s[e],t[e]):s[e]=t[e]}catch{s[e]=t[e]}return s};var at=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s.PARAMETER_GROUPS="parameter_groups",s))(at||{});const Qt=s=>JSON.parse(JSON.stringify(s)),Zt={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[at.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},te="(idle)",ee=s=>(k(s),s?.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ne,ie)),s),k=s=>{if(!s)return;const t=Object.keys(s);for(const e of t){const r=s[e];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&k(r),Array.isArray(r))for(const n of r)k(n);(r==="true"||r==="false")&&(s[e]=r==="true")}},se=(s,t)=>{t.configuratorId=s.id;const e=s.settings||{};return!t.overrideTenant&&s.tenant&&(t.overrideTenant=s.tenant),Jt(e,t)},re=()=>{const s=Qt(Zt);s.locale||(s.locale=Kt()),s.id===te&&delete s.id;const t=jt();return t&&qt(t)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=void 0,s.emails=!1,s},ne="<CONF_ID>",ie="#CONFIGURATIONID#",oe=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},ct=()=>/(android)/i.test(navigator.userAgent);class lt{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:r}=t;e.forEach(n=>{const i=n.split(U),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),r.forEach(n=>{const i=n.split(U),o=i[0],a=i[1],c=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][c]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const r=t.split(U),n=r[0],i=r[1],o=r.length===3?r[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...e);return a instanceof Promise?a.then(c=>({result:c})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,r="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>de).then(({DragIn:a})=>{const c=new a(this.ui,e,r,this.viewName);c.init().then(()=>{this.plugins.dragIn=c,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const c=new a(this.ui,e,r,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const ut=()=>{let s,t;return{promise:new Promise((r,n)=>{s=r,t=n}),resolve:s,reject:t}},ht=(s,t,e)=>{let r=null;Object.defineProperty(s,t,{get(){return r||e},set(n){n?.mute?r=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=n)}})},dt=()=>window.innerHeight*.01+"px",gt=s=>{s&&setTimeout(()=>s.style.setProperty(W,dt()),0)},mt="rml-styles",ae=450,W="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},X=new Map,ce=s=>{const t={get(e,r,n){const i=Reflect.get(e,r,n);return i!==void 0?i:(console.warn(`[Homag Intelligence Callbacks] Method '${String(r)}' is not implemented. Executing a no-op.`),(...o)=>{})}};return new Proxy(s,t)};class le extends lt{static createPlanner(t,e,r,n=[]){return this._create(t,e,r,n)}static async connect(t,e=[]){const r=new lt;r.viewName=t;const{resolve:n,promise:i}=ut(),{resolve:o,promise:a}=ut(),c=({message:d,args:h})=>{switch(d){case R.REGISTER_CUSTOM_VIEW_DONE:n();break;case R.RETURN_METHODS:r.handleSetup(h[0]),o();break;default:if(r.isSetupDone)return r.executeMessage({message:d,args:h})}},l=new _("custom-view-"+t,window,window.parent,c);r.setMessageHandler(l);const u=[t];return l.sendMessage(R.REGISTER_CUSTOM_VIEW,u),await i,l.sendMessage(R.GET_METHODS,u),await a,r.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(t,e,r,n=[]){return this._create(t,e,r,n)}static create(t,e,r,n){return this._create(t,e,r,n)}static createViewer(t,e,r,n=[]){return this._create(t,e,r,n)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=e=>{if(e.data.type==="connect_hi"&&e.data.port){const r=e.data.port;r.start?.(),H(ce(t),r)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(t,e,r,n){return new Promise(async(i,o)=>{try{const a=Y(re(),ee(r));oe(a);const c=await zt(t,a);r=se(c,a);const l=new this(c,e,r,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,r,n,i){if(super(),!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(X.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(mt)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=mt;const d="transition:all ease-in-out "+ae+"ms;",h=["-webkit-","-o-"].reduce((E,f)=>E+=f+d,"")+d,g=dt();u.innerHTML=`
|
|
6
6
|
.${m.CONTAINER}{${W}:${g};}
|
|
7
7
|
.${m.POSITION}{position:fixed;top:0;left:0;z-index:${l};opacity:0}
|
|
8
8
|
.${m.TRANSITION}{${h}}
|
|
9
9
|
.${m.FILL}{width:100%;height:100%;opacity:1}
|
|
10
10
|
.${m.ANDROID_HEIGHT}{height:calc(var(${W},1vh)*100)}
|
|
11
11
|
.${m.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
12
|
-
`,document.head.appendChild(u)}this._executeMessage=this._executeMessage.bind(this);const a=new
|
|
12
|
+
`,document.head.appendChild(u)}this._executeMessage=this._executeMessage.bind(this);const a=new _("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),ct()&&window.addEventListener("resize",this._onResize),this._container=e,this._initData=r,this._configuratorSettings=t;const c=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(c),this._iframe=c,this.setupPlugins(n,this._iframe),X.set(e,!0)}teardown(){this._container&&X.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){const t=document.createElement("iframe");let e=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(e=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(e=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(e=this._initData.overrideServerUrl),t.src=e,t.classList.add(m.CONTAINER),t.classList.add(m.FILL),t}_onResize(){gt(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),ct()&&(gt(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:t,args:e},r){if(r.source&&r.source===this._iframe?.contentWindow)return t===B.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(r.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===B.SETUP?(this.handleSetup(e[0]),ht(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),ht(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(B.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}class ue{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,r,n){this._instance=t,this._mainDomElement=e,this._mode=r,this._viewName=n}async init(){return Promise.resolve()}}const v="rml-drag-in-styles",C="rml-drag-in-drag-element",L="rml-drag-in-overlay",N="rml-drag-in-drag-ghost",_t="rml-drag-in-fade-in",ft="rml-drag-in-fade-out",z={DISPLAY_NONE:"rml-display-none"},pt=.5,yt="250ms",Et="forwards",Dt=`@keyframes ${_t} {from{opacity: 0;}to {opacity: ${pt};}}`,wt=`@keyframes ${ft} {from{opacity: ${pt};}to {opacity: 0;}}`,Tt=`${_t} ${yt} ${Et}`,St=`${ft} ${yt} ${Et}`,x="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",$=112,V=112;class he extends ue{options={};_customDragSignal=new AbortController;_injectStyles(){if(!!!document.getElementById(v)){const e=document.createElement("style");e.type="text/css",e.id=v,e.innerHTML=`
|
|
13
13
|
.${z.DISPLAY_NONE}{display:none}
|
|
14
14
|
.${L}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
15
15
|
.${N}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|
|
16
|
-
${
|
|
16
|
+
${Dt}
|
|
17
17
|
${wt}
|
|
18
|
-
`,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+N);e||(e=document.createElement("div"),e.classList.add(N),e.innerText=" ",t.appendChild(e))}constructor(t,e,r,n){super(t,e,r,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),this._mode==="website")try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>
|
|
19
|
-
${
|
|
18
|
+
`,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+N);e||(e=document.createElement("div"),e.classList.add(N),e.innerText=" ",t.appendChild(e))}constructor(t,e,r,n){super(t,e,r,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),this._mode==="website")try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>we);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw console.error('Could not load Dragin strategy "FromWebsite"'),t}else if(this._mode==="custom-view")try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>Me);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw console.error('Could not load Dragin strategy "FromCustomView"'),t}else throw new Error("Unsupported mode")}get isDragging(){return this._strategy.isDragging}dragStart(t,e,r="rml_id"){this._strategy.dragStart(t,e,r)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,r="rml_id"){this._strategy.touchStart(t,e,r)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:r,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const i=this._customDragSignal.signal,o=l=>{l.target.getAttribute("data-rml-draggable")==="true"&&t(l)},a=l=>{this._strategy.releaseInput(l),this._strategy.isDragging&&e(l)},c=l=>{r(l)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(l=>{l.draggable=!1}),document.addEventListener("mousedown",o,{signal:i}),document.addEventListener("mouseup",a,{signal:i}),document.addEventListener("mousemove",c,{signal:i}),document.addEventListener("mouseleave",a,{signal:i}),document.addEventListener("touchstart",o,{signal:i}),document.addEventListener("touchend",a,{signal:i}),document.addEventListener("touchmove",c,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const de=Object.freeze(Object.defineProperty({__proto__:null,DragIn:he},Symbol.toStringTag,{value:"Module"}));class ge{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),r=Date.now();if(e&&r-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:r}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:r}]of this._computedStyleCache.entries())t-r>=this._maxLifetime&&this._computedStyleCache.delete(e);this._computedStyleCache.size===0&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const y=s=>window.TouchEvent&&s instanceof window.TouchEvent;let j;const P=s=>(j||(j=new ge),j.get(s)),bt=(s,t,e)=>{const r=parseFloat(s),n=window.devicePixelRatio||1;if(t==="px")return r;if(t==="%"){const o=e===document.documentElement?window.innerWidth:e.offsetWidth;return r/100*o}if(t==="rem"){const o=parseFloat(P(document.documentElement).fontSize);return r*o}if(t==="em"){const o=parseFloat(P(e).fontSize);return r*o}if(t==="vh"||t==="vw"||t==="vmin"||t==="vmax"){const o={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return r/100*o[t]}const i={cm:37.7952755906,mm:3.77952755906,in:96};return t in i?r*i[t]*n:(console.warn("Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"),0)},It=(s,t,e={x:0,y:0})=>{const r=s.getBoundingClientRect(),i=P(s).transform;let o=0,a=0;if(i!=="none"){const h=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,g=i.match(h);g&&(o=bt(g[1],g[2],s),a=bt(g[3],g[4],s))}const{clientX:c,clientY:l}=T(t,e),u=c-r.left-o+s.scrollLeft,d=l-r.top-a+s.scrollTop;return{x:u,y:d}},T=(s,t=null)=>{const{clientX:e,clientY:r}=y(s)?me(s):s,n=e>0?e:t?t.x:e,i=r>0?r:t?t.y:r;return{clientX:n,clientY:i}},me=s=>{if(s.touches.length){let{clientX:e,clientY:r}=s.touches[0];if(s.touches.length>1){const n=s.touches[1],i=n.clientX,o=n.clientY;e=(e+i)/2,r=(r+o)/2}return{clientX:e,clientY:r}}const t=s.changedTouches[0];return{clientX:t.clientX,clientY:t.clientY}},q=500,K=10,_e=100,At=15,J=(s,t=0)=>y(s)?{clientX:s.touches[t].clientX,clientY:s.touches[t].clientY}:{clientX:s.clientX,clientY:s.clientY},Ot=s=>s&&y(s)?s.touches.length>0:!0;class Mt{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=q;_firstTouch=null;_lastTouch=null;_epsilon=K;constructor(t,{onTouchDragStart:e},r={}){this._payload=t,this._onTouchDragStart=e,this._delay=typeof r.delay=="number"?r.delay:q,this._epsilon=typeof r.epsilon=="number"?r.epsilon:K}onStart(t){Ot(t)&&(this._touchDragTimeOut||(this._firstTouch=J(t,y(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=J(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){Ot(t)&&(this._lastTouch=J(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}const Rt=(s,t,e=0,r=0)=>{const n=t.x+t.width+e,i=t.x-e,o=t.y+t.height+r,a=t.y-r,{x:c,y:l}=s;return c>=i&&c<=n&&l>=a&&l<=o},vt=(s,t,e,r=0,n=0)=>{if(!(!e||!e.hiddenIn&&!e.visibleIn))return e.visibleIn?Rt({x:s,y:t},e.visibleIn,r,n):e.hiddenIn?!Rt({x:s,y:t},e.hiddenIn,-r,-n):!1},fe=()=>{if(!!!document.getElementById(v)){const t=document.createElement("style");t.type="text/css",t.id=v,t.innerHTML=`
|
|
19
|
+
${Dt}
|
|
20
20
|
${wt}
|
|
21
|
-
`,document.head.appendChild(t)}},Ee=({x:s,y:t},e)=>{let r=document.getElementById(C);if(!r){if(r=document.createElement("div"),e.ghost?.element)r.appendChild(e.ghost.element);else{const n=document.createElement("img");n.src=e.ghost?.url||x,n.width=e.ghost?.width||$,n.height=e.ghost?.height||V,r.appendChild(n)}r.id=C,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.willChange="transform",r.style.transform="translate3d(0, 0, 0)",r.style.zIndex="9999",r.style.opacity="0.5",Ct(s,t,e.ghost||{},e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)||(r.style.display="none"),r.style.pointerEvents="none",document.body.appendChild(r)}},De=({x:s,y:t},e)=>{const r=document.getElementById(C);if(!r)return;let n=e.ghost?.width,i=e.ghost?.height;typeof n>"u"&&(n=r.getBoundingClientRect().width||$),typeof i>"u"&&(i=r.getBoundingClientRect().height||V);const o=s-n/2,a=t-i/2;r.style.transform=`translate3d(${o}px, ${a}px, 0)`,e.ghost&&(Ct(s,t,e.ghost,e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)?r.style.animation!=St&&(r.style.animation=St):r.style.animation!=bt&&(r.style.animation=bt))};class Te{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,r){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!r.ghost?.external&&r.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{ye();const n={x:t,y:e};!r.ghost&&this._dragGhostElement&&(r.ghost={}),r.ghost&&!r.ghost.element&&this._dragGhostElement&&(r.ghost.element=this._dragGhostElement),Ee(n,r),De(n,r),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(C);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class we{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,r){this._instance=t,this._mainDomElement=e,this._options=r||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,r="rml_id"){const n=this._mainDomElement.parentNode;if(P(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+L);o||(o=document.createElement("div"),o.classList.add(L),n.appendChild(o)),o.classList.remove(z.DISPLAY_NONE),e.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const c=n.querySelector("."+N);this._currentDrag.event=e;const l=e.target,u=l.cloneNode(!0),d=l.getBoundingClientRect();u.style.width=`${d.width}px`,u.style.height=`${d.height}px`,this._currentDrag.ghost=new Te(u),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:g}=w(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-d.left,this._currentDrag.offset.y=g-d.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(c,0,0);const{x:E,y:f}=At(n,this._currentDrag.event||e,this._firefoxDragPosition),S=Math.max(1,E),Ce=Math.max(1,f);this.isDragging=!0,this._instance.dragInObject(t,S,Ce,r)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:r,y:n}=At(e,t,this._firefoxDragPosition);if(r===0&&n===0)return;const i=Math.max(1,r),o=Math.max(1,n);if(i===1&&o===1)return;let a=i,c=o;if(y(t)){const f=this._options.settings?.fingerSize||0;a=Math.max(2,i+f),c=Math.max(2,o-f)}const{x:l,y:u,options:d}=this._onBeforeUpdateDrag(a,c,{}),h=d||{settings:{},ghost:{}};h.ghost||(h.ghost={}),h.ghost.visibleIn&&h.ghost.hiddenIn||(h.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g=typeof l=="number"?l:a,E=typeof u=="number"?u:c;if(this._currentDrag.ghost){const{clientX:f,clientY:S}=w(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(f,S,h)}this._instance.updateDrag(g,E,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+L);e&&e.classList.add(z.DISPLAY_NONE)}touchStart(t,e,r="rml_id"){e.preventDefault();const n=(o,a)=>{this.dragStart(t,a,r)},i={};typeof this._options?.settings?.touchDragDelay=="number"&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new Rt(void 0,{onTouchDragStart:n},i),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}const Se=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:we},Symbol.toStringTag,{value:"Module"})),be=s=>`[data-rml-custom-view="${s}"]`,Q=s=>{s.preventDefault(),s.stopPropagation()},Ie=(s,t,e,r)=>{const n=e-s,i=r-t;return Math.sqrt(n*n+i*i)};class Ae{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon=typeof e.epsilon=="number"?e.epsilon:Ot,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&Ie(this._startX,this._startY,this._lastX,this._lastY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const Z="data-rml-old-draggable",Oe=void 0,Lt=(s,t)=>{const e=y(s),r={delay:e?q:pe,epsilon:e?K:Ot};if(!t)return r;if(!e&&!(s instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),r;const{delayKey:n,epsilonKey:i}=e?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof t[n]=="number"&&(r.delay=t.touchDragDelay),typeof t[i]=="number"&&(r.epsilon=t.touchDragEpsilon),r},Me=s=>{let t="",e=$,r=V;if(!s)return{url:x,width:e,height:r};const n=s;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),c=n.getAttribute("data-rml-ghost-height");o?t=o:!o&&n instanceof HTMLImageElement&&n.src&&(t=n.src),t?(e=i.width,r=i.height):t=x,e=a?parseInt(a,10):e,r=c?parseInt(c,10):r}return{url:t||x,width:e,height:r}};class Re{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r,n){this._instance=t,this._options=r||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,r="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Z,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Q),this._startTarget.addEventListener("dragstart",Q)),this._currentBb=await this._instance.getBoundingClientRect(be(this._viewName));const{clientX:n,clientY:i}=w(e),o=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,o,a,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:r}=w(t),{url:n,width:i,height:o}=Me(this._startTarget),a=this._currentBb.x+e,c=this._currentBb.y+r,l=this._options||{},u={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:i,height:o},mode:"custom-view"},{x:d,y:h,options:g}=this._onBeforeUpdateDrag(a,c,u),E=typeof d=="number"?d:a,f=typeof h=="number"?h:c,S=g||u;this._instance.updateDrag(E,f,S)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,r){this._instance.disableEvents(),this._startTarget=e.target;const n=(i,o)=>{this._dragStart(t,o,r)};this._currentCustomDrag=y(e)?new Rt(Oe,{onTouchDragStart:n},Lt(e,this._options)):new Ae({onCustomDragStart:i=>this._dragStart(t,i,r)},Lt(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,r="rml_id"){this.dragStart(t,e,r)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(Z)==="true",this._startTarget.removeAttribute(Z),this._startTarget.removeEventListener("dragstart",Q))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const ve=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Re},Symbol.toStringTag,{value:"Module"}));_.HI_PANEL_ACTION=ue,_.default=he,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
21
|
+
`,document.head.appendChild(t)}},pe=({x:s,y:t},e)=>{let r=document.getElementById(C);if(!r){if(r=document.createElement("div"),e.ghost?.element)r.appendChild(e.ghost.element);else{const n=document.createElement("img");n.src=e.ghost?.url||x,n.width=e.ghost?.width||$,n.height=e.ghost?.height||V,r.appendChild(n)}r.id=C,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.willChange="transform",r.style.transform="translate3d(0, 0, 0)",r.style.zIndex="9999",r.style.opacity="0.5",vt(s,t,e.ghost||{},e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)||(r.style.display="none"),r.style.pointerEvents="none",document.body.appendChild(r)}},ye=({x:s,y:t},e)=>{const r=document.getElementById(C);if(!r)return;let n=e.ghost?.width,i=e.ghost?.height;typeof n>"u"&&(n=r.getBoundingClientRect().width||$),typeof i>"u"&&(i=r.getBoundingClientRect().height||V);const o=s-n/2,a=t-i/2;r.style.transform=`translate3d(${o}px, ${a}px, 0)`,e.ghost&&(vt(s,t,e.ghost,e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)?r.style.animation!=Tt&&(r.style.animation=Tt):r.style.animation!=St&&(r.style.animation=St))};class Ee{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,r){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!r.ghost?.external&&r.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{fe();const n={x:t,y:e};!r.ghost&&this._dragGhostElement&&(r.ghost={}),r.ghost&&!r.ghost.element&&this._dragGhostElement&&(r.ghost.element=this._dragGhostElement),pe(n,r),ye(n,r),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(C);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class De{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,r){this._instance=t,this._mainDomElement=e,this._options=r||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,r="rml_id"){const n=this._mainDomElement.parentNode;if(P(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+L);o||(o=document.createElement("div"),o.classList.add(L),n.appendChild(o)),o.classList.remove(z.DISPLAY_NONE),e.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const c=n.querySelector("."+N);this._currentDrag.event=e;const l=e.target,u=l.cloneNode(!0),d=l.getBoundingClientRect();u.style.width=`${d.width}px`,u.style.height=`${d.height}px`,this._currentDrag.ghost=new Ee(u),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:g}=T(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-d.left,this._currentDrag.offset.y=g-d.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(c,0,0);const{x:E,y:f}=It(n,this._currentDrag.event||e,this._firefoxDragPosition),S=Math.max(1,E),Re=Math.max(1,f);this.isDragging=!0,this._instance.dragInObject(t,S,Re,r)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:r,y:n}=It(e,t,this._firefoxDragPosition);if(r===0&&n===0)return;const i=Math.max(1,r),o=Math.max(1,n);if(i===1&&o===1)return;let a=i,c=o;if(y(t)){const f=this._options.settings?.fingerSize||0;a=Math.max(2,i+f),c=Math.max(2,o-f)}const{x:l,y:u,options:d}=this._onBeforeUpdateDrag(a,c,{}),h=d||{settings:{},ghost:{}};h.ghost||(h.ghost={}),h.ghost.visibleIn&&h.ghost.hiddenIn||(h.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g=typeof l=="number"?l:a,E=typeof u=="number"?u:c;if(this._currentDrag.ghost){const{clientX:f,clientY:S}=T(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(f,S,h)}this._instance.updateDrag(g,E,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+L);e&&e.classList.add(z.DISPLAY_NONE)}touchStart(t,e,r="rml_id"){e.preventDefault();const n=(o,a)=>{this.dragStart(t,a,r)},i={};typeof this._options?.settings?.touchDragDelay=="number"&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new Mt(void 0,{onTouchDragStart:n},i),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}const we=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:De},Symbol.toStringTag,{value:"Module"})),Te=s=>`[data-rml-custom-view="${s}"]`,Q=s=>{s.preventDefault(),s.stopPropagation()},Se=(s,t,e,r)=>{const n=e-s,i=r-t;return Math.sqrt(n*n+i*i)};class be{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon=typeof e.epsilon=="number"?e.epsilon:At,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&Se(this._startX,this._startY,this._lastX,this._lastY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const Z="data-rml-old-draggable",Ie=void 0,Ct=(s,t)=>{const e=y(s),r={delay:e?q:_e,epsilon:e?K:At};if(!t)return r;if(!e&&!(s instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),r;const{delayKey:n,epsilonKey:i}=e?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof t[n]=="number"&&(r.delay=t.touchDragDelay),typeof t[i]=="number"&&(r.epsilon=t.touchDragEpsilon),r},Ae=s=>{let t="",e=$,r=V;if(!s)return{url:x,width:e,height:r};const n=s;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),c=n.getAttribute("data-rml-ghost-height");o?t=o:!o&&n instanceof HTMLImageElement&&n.src&&(t=n.src),t?(e=i.width,r=i.height):t=x,e=a?parseInt(a,10):e,r=c?parseInt(c,10):r}return{url:t||x,width:e,height:r}};class Oe{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r,n){this._instance=t,this._options=r||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,r="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Z,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Q),this._startTarget.addEventListener("dragstart",Q)),this._currentBb=await this._instance.getBoundingClientRect(Te(this._viewName));const{clientX:n,clientY:i}=T(e),o=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,o,a,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:r}=T(t),{url:n,width:i,height:o}=Ae(this._startTarget),a=this._currentBb.x+e,c=this._currentBb.y+r,l=this._options||{},u={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:i,height:o},mode:"custom-view"},{x:d,y:h,options:g}=this._onBeforeUpdateDrag(a,c,u),E=typeof d=="number"?d:a,f=typeof h=="number"?h:c,S=g||u;this._instance.updateDrag(E,f,S)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,r){this._instance.disableEvents(),this._startTarget=e.target;const n=(i,o)=>{this._dragStart(t,o,r)};this._currentCustomDrag=y(e)?new Mt(Ie,{onTouchDragStart:n},Ct(e,this._options)):new be({onCustomDragStart:i=>this._dragStart(t,i,r)},Ct(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,r="rml_id"){this.dragStart(t,e,r)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(Z)==="true",this._startTarget.removeAttribute(Z),this._startTarget.removeEventListener("dragstart",Q))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const Me=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Oe},Symbol.toStringTag,{value:"Module"}));return le}));
|