@vertexvis/viewer 0.15.2-testing.4 → 0.15.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/dist/cjs/_commonjsHelpers-dcc4cf71.js +1 -1
- package/dist/cjs/app-globals-2035678d.js +1 -1
- package/dist/cjs/browser.esm-5d246754.js +1 -1
- package/dist/cjs/bundle.esm-22b6f2d6.js +1 -1
- package/dist/cjs/bundle.esm-b43c197a.js +38280 -0
- package/dist/cjs/{config-4a86ae0b.js → config-3fc1c093.js} +2 -2
- package/dist/cjs/{cursors-85d403e9.js → cursors-02a06ec9.js} +7 -1
- package/dist/cjs/dom-8d90bfaf.js +1 -1
- package/dist/cjs/dom-92728e58.js +1 -1
- package/dist/cjs/dom-d1bbd67c.js +1 -1
- package/dist/cjs/dom-d57d3c3b.js +1 -1
- package/dist/cjs/elementRectObserver-9b28f182.js +1 -1
- package/dist/cjs/entities-9eb7e608.js +1 -1
- package/dist/cjs/{entities-496b61cd.js → entities-c1c3c6a3.js} +3 -3
- package/dist/cjs/errors-1b37642b.js +97 -0
- package/dist/cjs/grpc-web-client.umd-2af20c1b.js +1 -1
- package/dist/cjs/index-70db349e.js +1 -1
- package/dist/cjs/index-b9d13137.js +1 -1
- package/dist/cjs/index.cjs.js +9 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{mapper-216603b0.js → mapper-d4145b72.js} +2 -2
- package/dist/cjs/markup-4a2fc281.js +1 -1
- package/dist/cjs/{model-b61f4d20.js → model-19fb560a.js} +27 -6
- package/dist/cjs/model-20a70d27.js +1 -1
- package/dist/cjs/overlays-b03ec80b.js +1 -1
- package/dist/cjs/png-decoder-ef097f37.js +1 -1
- package/dist/cjs/results-178e89a3.js +1 -1
- package/dist/cjs/{scene-0ce59b26.js → scene-a94e6fa5.js} +276 -225
- package/dist/cjs/shadow-css-6b9daa41.js +1 -1
- package/dist/cjs/stencil-fc92b387.js +1 -1
- package/dist/cjs/{streamAttributes-7725f5c4.js → streamAttributes-cf0c513d.js} +5408 -39951
- package/dist/cjs/templates-e57b3741.js +1 -1
- package/dist/cjs/utils-2c8e2aa3.js +1 -1
- package/dist/cjs/utils-ea359796.js +1 -1
- package/dist/cjs/vertex-scene-tree-search_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-column.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-header.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-resize-divider.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-toolbar-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +158 -37
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +229 -49
- package/dist/cjs/vertex-viewer-button_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +3 -2
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-icon.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-layer.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +3 -2
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +5 -4
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +4 -3
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +7 -6
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +10 -5
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +15 -13
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +20 -9
- package/dist/cjs/vertex-viewer-spinner.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +6 -4
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +5 -4
- package/dist/cjs/vertex-viewer.cjs.entry.js +80 -53
- package/dist/cjs/viewer.cjs.js +2 -2
- package/dist/cjs/viewport-5ca619f7.js +1 -1
- package/dist/collection/components/scene-tree/lib/controller.js +108 -28
- package/dist/collection/components/scene-tree/lib/errors.js +35 -2
- package/dist/collection/components/scene-tree/scene-tree.js +12 -5
- package/dist/collection/components/viewer/viewer.js +17 -15
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.css +7 -2
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js +105 -18
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +5 -1
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.css +1 -1
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +14 -12
- package/dist/collection/components/viewer-pin-tool/utils.js +25 -4
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.css +12 -0
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js +9 -2
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +3 -2
- package/dist/collection/components/viewer-view-cube/viewer-view-cube.js +5 -5
- package/dist/collection/lib/cursors.js +6 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js +12 -2
- package/dist/collection/lib/interactions/mouseInteractions.js +5 -4
- package/dist/collection/lib/mappers/frameStreaming.js +11 -11
- package/dist/collection/lib/pins/interactions.js +9 -5
- package/dist/collection/lib/pins/model.js +2 -2
- package/dist/collection/lib/rendering/matrices.js +2 -4
- package/dist/collection/lib/scenes/camera.js +4 -2
- package/dist/collection/lib/scenes/mapper.js +98 -36
- package/dist/collection/lib/scenes/queries.js +89 -50
- package/dist/collection/lib/scenes/scene.js +15 -7
- package/dist/collection/lib/stream/stream.js +24 -12
- package/dist/collection/lib/transforms/drawable.js +2 -2
- package/dist/collection/lib/types/frame.js +4 -3
- package/dist/collection/lib/types/frameCamera.js +6 -1
- package/dist/collection/lib/types/index.js +3 -2
- package/dist/collection/lib/types/loadableResource.js +24 -4
- package/dist/collection/lib/types/sceneViewStateIdentifier.js +7 -0
- package/dist/collection/lib/volume-intersection/controller.js +71 -15
- package/dist/collection/lib/volume-intersection/interactions.js +54 -9
- package/dist/collection/lib/volume-intersection/model.js +27 -10
- package/dist/custom-elements/index.js +20207 -15976
- package/dist/custom-elements/png-decoder.js +1 -1
- package/dist/esm/_commonjsHelpers-11ca3be1.js +1 -1
- package/dist/esm/app-globals-40df99a0.js +1 -1
- package/dist/esm/{browser.esm-ae4ca1f1.js → browser.esm-07e7db8f.js} +2 -2
- package/dist/esm/bundle.esm-91404853.js +38273 -0
- package/dist/esm/{bundle.esm-ce2c7ad3.js → bundle.esm-92e615bf.js} +2 -2
- package/dist/esm/{config-6cdeb6ca.js → config-25384fe6.js} +3 -3
- package/dist/esm/{cursors-a8d4b3f4.js → cursors-127a3bb7.js} +8 -3
- package/dist/esm/dom-0440435d.js +1 -1
- package/dist/esm/dom-be140992.js +1 -1
- package/dist/esm/dom-e19ee80b.js +1 -1
- package/dist/esm/{dom-5b164305.js → dom-e436f0c0.js} +2 -2
- package/dist/esm/elementRectObserver-39cf7b95.js +1 -1
- package/dist/esm/{entities-6f3c5437.js → entities-0e325765.js} +4 -4
- package/dist/esm/entities-ce81dd7f.js +1 -1
- package/dist/esm/errors-a4cc9caa.js +85 -0
- package/dist/esm/grpc-web-client.umd-5409853c.js +1 -1
- package/dist/esm/index-26dfb2d0.js +1 -1
- package/dist/esm/index-e841d91b.js +1 -1
- package/dist/esm/index.js +15 -13
- package/dist/esm/index.mjs +15 -13
- package/dist/esm/loader.js +2 -2
- package/dist/esm/loader.mjs +2 -2
- package/dist/esm/{mapper-941ff03c.js → mapper-dd937684.js} +3 -3
- package/dist/esm/{markup-3c2900f3.js → markup-2dde1f10.js} +3 -3
- package/dist/esm/{model-fa9af61a.js → model-3cd8cd47.js} +2 -2
- package/dist/esm/{model-40bd1711.js → model-bfe1c4d8.js} +29 -8
- package/dist/esm/{overlays-cc3efc30.js → overlays-8f195eb3.js} +3 -3
- package/dist/esm/{png-decoder-d4b65417.js → png-decoder-45f38ea3.js} +2 -2
- package/dist/esm/{results-3b4df2cf.js → results-38baef59.js} +2 -2
- package/dist/esm/{scene-970f5000.js → scene-2543b3bd.js} +237 -178
- package/dist/esm/shadow-css-51dd7708.js +1 -1
- package/dist/esm/stencil-bfbf099f.js +1 -1
- package/dist/esm/{streamAttributes-24bd7b3a.js → streamAttributes-23270e27.js} +5419 -39956
- package/dist/esm/templates-022199c1.js +1 -1
- package/dist/esm/{utils-81347571.js → utils-2306c744.js} +2 -2
- package/dist/esm/{utils-559e1632.js → utils-f03802ef.js} +2 -2
- package/dist/esm/vertex-scene-tree-search_3.entry.js +3 -3
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-column.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-header.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-resize-divider.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-toolbar-group.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +160 -39
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +229 -49
- package/dist/esm/vertex-viewer-button_3.entry.js +1 -1
- package/dist/esm/vertex-viewer-default-toolbar.entry.js +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +6 -5
- package/dist/esm/vertex-viewer-dom-group.entry.js +3 -3
- package/dist/esm/vertex-viewer-icon.entry.js +1 -1
- package/dist/esm/vertex-viewer-layer.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +4 -4
- package/dist/esm/vertex-viewer-markup-tool.entry.js +5 -5
- package/dist/esm/vertex-viewer-markup.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurement-details.entry.js +5 -4
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +13 -12
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +8 -7
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +12 -11
- package/dist/esm/vertex-viewer-pin-group.entry.js +13 -8
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +18 -16
- package/dist/esm/vertex-viewer-pin-tool.entry.js +23 -12
- package/dist/esm/vertex-viewer-spinner.entry.js +1 -1
- package/dist/esm/vertex-viewer-transform-widget.entry.js +9 -7
- package/dist/esm/vertex-viewer-view-cube.entry.js +7 -6
- package/dist/esm/vertex-viewer.entry.js +65 -38
- package/dist/esm/viewer.js +2 -2
- package/dist/esm/{viewport-e39e2eba.js → viewport-f19fc583.js} +2 -2
- package/dist/types/components/scene-tree/lib/controller.d.ts +18 -3
- package/dist/types/components/scene-tree/lib/errors.d.ts +17 -2
- package/dist/types/components/viewer/viewer.d.ts +2 -0
- package/dist/types/components/viewer-box-query-tool/viewer-box-query-tool.d.ts +36 -2
- package/dist/types/components/viewer-pin-tool/utils.d.ts +1 -1
- package/dist/types/components.d.ts +11 -3
- package/dist/types/lib/cursors.d.ts +5 -0
- package/dist/types/lib/interactions/baseInteractionHandler.d.ts +1 -0
- package/dist/types/lib/interactions/mouseInteractions.d.ts +2 -1
- package/dist/types/lib/pins/interactions.d.ts +4 -2
- package/dist/types/lib/pins/model.d.ts +1 -1
- package/dist/types/lib/scenes/camera.d.ts +1 -1
- package/dist/types/lib/scenes/mapper.d.ts +5 -1
- package/dist/types/lib/scenes/queries.d.ts +45 -30
- package/dist/types/lib/scenes/scene.d.ts +10 -1
- package/dist/types/lib/types/frame.d.ts +1 -1
- package/dist/types/lib/types/index.d.ts +2 -1
- package/dist/types/lib/types/loadableResource.d.ts +8 -2
- package/dist/types/lib/types/sceneViewStateIdentifier.d.ts +15 -0
- package/dist/types/lib/volume-intersection/controller.d.ts +33 -5
- package/dist/types/lib/volume-intersection/interactions.d.ts +12 -1
- package/dist/types/lib/volume-intersection/model.d.ts +7 -0
- package/dist/viewer/index.esm.js +2 -2
- package/dist/viewer/{p-ad09c92e.entry.js → p-029fba92.entry.js} +1 -1
- package/dist/viewer/p-07aeee89.js +1 -1
- package/dist/viewer/{p-29986489.js → p-0a017be7.js} +2 -2
- package/dist/viewer/p-0c583cad.entry.js +4 -0
- package/dist/viewer/p-0d494d01.js +4 -0
- package/dist/viewer/p-0fdad1a5.js +1 -1
- package/dist/viewer/{p-3ca4a7c1.js → p-1812c82d.js} +2 -2
- package/dist/viewer/{p-7663a603.entry.js → p-191156ad.entry.js} +1 -1
- package/dist/viewer/{p-a57dc6e4.entry.js → p-1998284a.entry.js} +2 -2
- package/dist/viewer/p-27f715f8.entry.js +4 -0
- package/dist/viewer/{p-7f6251da.js → p-283aeac4.js} +2 -2
- package/dist/viewer/p-298b63c2.entry.js +4 -0
- package/dist/viewer/p-2ace066b.entry.js +4 -0
- package/dist/viewer/{p-597cc9b5.js → p-2b60a8b0.js} +2 -2
- package/dist/viewer/{p-050f912b.entry.js → p-2fd123c8.entry.js} +1 -1
- package/dist/viewer/p-305a8be6.entry.js +4 -0
- package/dist/viewer/p-31724d24.js +4 -0
- package/dist/viewer/p-32cc2209.js +4 -0
- package/dist/viewer/p-3829dd99.entry.js +4 -0
- package/dist/viewer/{p-6da8a28f.entry.js → p-3aae4bf1.entry.js} +2 -2
- package/dist/viewer/{p-99352cf0.js → p-42760392.js} +2 -2
- package/dist/viewer/p-440c8174.js +4 -0
- package/dist/viewer/{p-e422deaf.entry.js → p-4f25e367.entry.js} +2 -2
- package/dist/viewer/{p-a107b65e.entry.js → p-507b5aeb.entry.js} +2 -2
- package/dist/viewer/{p-52ab9ec0.js → p-51401063.js} +2 -2
- package/dist/viewer/{p-426970b3.entry.js → p-533b1c63.entry.js} +1 -1
- package/dist/viewer/{p-dcb9804c.entry.js → p-569ed94a.entry.js} +2 -2
- package/dist/viewer/p-5809b400.js +1 -1
- package/dist/viewer/p-6072cf84.js +4 -0
- package/dist/viewer/{p-e4a26a32.entry.js → p-6406a70a.entry.js} +1 -1
- package/dist/viewer/p-6bf0594b.entry.js +4 -0
- package/dist/viewer/p-72c59115.entry.js +4 -0
- package/dist/viewer/{p-d71652b0.entry.js → p-8ac7290a.entry.js} +1 -1
- package/dist/viewer/{p-f184bcab.entry.js → p-8afcbd99.entry.js} +1 -1
- package/dist/viewer/p-92fe4417.js +1 -1
- package/dist/viewer/{p-5746931d.entry.js → p-952a217d.entry.js} +1 -1
- package/dist/viewer/p-98e6a50e.js +1 -1
- package/dist/viewer/{p-99fd27e0.entry.js → p-9cb99ea8.entry.js} +1 -1
- package/dist/viewer/p-a2e9e8a5.js +4 -0
- package/dist/viewer/p-a380f0c2.js +1 -1
- package/dist/viewer/{p-661b5234.js → p-acfc5c50.js} +2 -2
- package/dist/viewer/{p-82bd25e8.entry.js → p-b3540dce.entry.js} +1 -1
- package/dist/viewer/p-b5ca30cd.js +4 -0
- package/dist/viewer/p-b74242dc.js +1 -1
- package/dist/viewer/p-bc1160cf.entry.js +4 -0
- package/dist/viewer/{p-c5e67a1e.entry.js → p-bd5a302c.entry.js} +2 -2
- package/dist/viewer/p-c738296e.js +1 -1
- package/dist/viewer/p-c8c4343b.js +1 -1
- package/dist/viewer/p-cd9ccb9e.entry.js +4 -0
- package/dist/viewer/{p-9e1384c9.js → p-cf689bbd.js} +2 -2
- package/dist/viewer/{p-70e5e8a8.js → p-d216a866.js} +2 -2
- package/dist/viewer/p-d4ed7b8d.js +4 -0
- package/dist/viewer/p-d6d5d5de.entry.js +4 -0
- package/dist/viewer/p-d6fce4c1.js +1 -1
- package/dist/viewer/p-df8fbe56.js +1 -1
- package/dist/viewer/p-dfe5a97d.js +1 -1
- package/dist/viewer/{p-00ce31a0.js → p-e1896ce4.js} +2 -2
- package/dist/viewer/p-e23af70c.js +4 -0
- package/dist/viewer/p-e4aa9cdb.js +1 -1
- package/dist/viewer/p-e929dd63.entry.js +4 -0
- package/dist/viewer/{p-65af7a89.js → p-fc7d8c03.js} +3 -3
- package/dist/viewer/viewer.esm.js +2 -2
- package/package.json +9 -9
- package/readme.md +4 -4
- package/dist/viewer/p-096e60bd.js +0 -4
- package/dist/viewer/p-0cf4f05d.entry.js +0 -4
- package/dist/viewer/p-0fcafbf9.js +0 -4
- package/dist/viewer/p-10145045.js +0 -4
- package/dist/viewer/p-1abfe4bf.js +0 -4
- package/dist/viewer/p-1bba9ade.entry.js +0 -4
- package/dist/viewer/p-24cda14a.entry.js +0 -4
- package/dist/viewer/p-27dbc865.js +0 -4
- package/dist/viewer/p-2b58afc3.entry.js +0 -4
- package/dist/viewer/p-51966cef.entry.js +0 -4
- package/dist/viewer/p-608925c5.entry.js +0 -4
- package/dist/viewer/p-68e192b9.js +0 -4
- package/dist/viewer/p-69a3fce8.entry.js +0 -4
- package/dist/viewer/p-74c772bb.entry.js +0 -4
- package/dist/viewer/p-990f98c2.js +0 -4
- package/dist/viewer/p-9dfe0b43.entry.js +0 -4
- package/dist/viewer/p-bb425931.entry.js +0 -4
- package/dist/viewer/p-bfacbaa8.entry.js +0 -4
- package/dist/viewer/p-c72da0fb.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import{r as e,h as r,H as i}from"./p-d6fce4c1.js";import{c as t}from"./p-07aeee89.js";import"./p-dfe5a97d.js";const s=class{constructor(r){e(this,r),this.dragging=!1,this.handlePointerDown=()=>{this.dragging=!0,window.addEventListener("pointerup",this.handlePointerUp)},this.handlePointerUp=()=>{this.dragging=!1,window.removeEventListener("pointerup",this.handlePointerUp)}}render(){return r(i,{onPointerDown:this.handlePointerDown,style:{height:this.dragging?"100%":"var(--header-height)",padding:this.dragging?"0 calc(var(--scene-tree-table-column-gap) / 2)":"calc(var(--header-height) / 8) calc(var(--scene-tree-table-column-gap) / 2)"}},r("slot",{name:"divider"},r("div",{class:t("divider",{dragging:this.dragging})})))}};s.style=":host{pointer-events:auto;display:flex;align-items:center;box-sizing:border-box;cursor:col-resize}.divider{width:1px;height:100%;background-color:var(--neutral-600);cursor:col-resize}.divider.dragging{background-color:var(--blue-600)}:host:hover .divider{background-color:var(--blue-600)}";export{s as vertex_scene_tree_table_resize_divider}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as i,h as s,H as e,g as n}from"./p-d6fce4c1.js";import{p as h,v as o,c as a,f as r,r as l,b as c,s as d,d as u}from"./p-d216a866.js";import{t as v,p as w,S as f,a as p,c as m,W as g}from"./p-32cc2209.js";import{E as y,m as C,c as b,o as P,u as I,a as T,b as D}from"./p-fc7d8c03.js";import{c as x}from"./p-07aeee89.js";import{p as S}from"./p-2b60a8b0.js";import{C as k}from"./p-1812c82d.js";import{g as E,c as O}from"./p-42760392.js";import{c as M,C as j,W as R,S as A,V as F,d as z,e as B,f as L}from"./p-440c8174.js";import{k as N,l as K,m as $,t as W,n as V,o as H,p as q,q as U,r as G,s as _,u as J,x as X,y as Y}from"./p-6072cf84.js";import{E as Q}from"./p-df8fbe56.js";import{V as Z}from"./p-0a017be7.js";import{f as tt,a as it,d as st,b as et,S as nt}from"./p-d4ed7b8d.js";import"./p-dfe5a97d.js";class ht{constructor(t){this.viewer=t,this.handleInteractionStarted=()=>{this.invalidateStencilBuffer(),this.pendingInteractionFinished=new Promise((t=>{this.pendingInteractionFinishedResolver=t}))},this.handleInteractionFinished=()=>{var t;null===(t=this.pendingInteractionFinishedResolver)||void 0===t||t.call(this),this.pendingInteractionFinished=void 0,this.pendingInteractionFinishedResolver=void 0},this.invalidateStencilBuffer=()=>{this.pendingStencilBuffer=void 0},t.addEventListener("interactionStarted",this.handleInteractionStarted),t.addEventListener("interactionFinished",this.handleInteractionFinished),t.addEventListener("frameReceived",(()=>{this.invalidateStencilBuffer()}))}async fetch(){var t;const i=await this.viewer.isSceneReady()?await this.viewer.scene():void 0,s=null!=i&&(i.crossSectioning().current().sectionPlanes.length>0||null!=this.viewer.featureLines),e=null===(t=this.viewer.frame)||void 0===t?void 0:t.scene.camera;if(s&&null!=this.viewer.stream&&null!=e){const t=await this.viewer.stream.getStencilBuffer({includeDepthBuffer:!0}),{stencilBuffer:i,depthBuffer:s,imageAttributes:n}=N(t),[h,o]=await Promise.all([K(new Uint8Array(i)),K(new Uint8Array(s))]);return ot.fromPng(h,n,i,$.fromPng(o,e,n))}}latest(){return null==this.pendingStencilBuffer&&(this.pendingStencilBuffer=this.fetch()),this.pendingStencilBuffer}async latestAfterInteraction(){return await this.pendingInteractionFinished,this.latest()}}class ot{constructor(t,i,s,e,n){this.imageAttr=t,this.imageBytes=i,this.pixelBytes=s,this.imageChannels=e,this.depthBuffer=n}static fromPng(t,i,s,e){if(t.data instanceof Uint8Array){if(1!==t.channels)throw new Error("Expected stencil PNG to have 1 color channel");return new ot(i,s,t.data,t.channels,e)}throw new Error("Expected stencil PNG to have depth of 8-bit")}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect,e=h.subtract(t,this.imageAttr.imageRect),n=1/this.imageAttr.imageScale,o=h.scale(e,n,n);if(o.x>=0&&o.y>=0&&o.x<i&&o.y<s){const t=Math.floor(o.x)+Math.floor(o.y)*i;return this.pixelBytes[t]}return 0}hitTest(t){return 0!==this.getValue(t)}snapToNearestPixel(t,i,s=(()=>!0)){const e=2*i,n=h.create(t.x-i,t.y-i),o=[];for(let a=0;a<e*e;a++){const r=a%e,l=Math.floor(a/e),c=h.add(n,{x:r,y:l});if(h.distance(c,t)<=i){const t=this.getValue(c);255===t&&s(t)&&o.push(c)}}const a=o.sort(((i,s)=>h.distance(i,t)-h.distance(s,t)))[0];return null!=a?h.create(Math.floor(a.x)+.5,Math.floor(a.y)+.5):t}}class at{constructor(t,i,s){this.stream=t,this.configProvider=i,this.imageScaleProvider=s}predicate(t){return t.altKey&&!t.shiftKey}async fn(t){var i;const s=this.imageScaleProvider(),e=await this.stream.hitItems({point:h.scale(t.position,(null==s?void 0:s.x)||1,(null==s?void 0:s.y)||1)},!0);null!=(null===(i=e.hitItems)||void 0===i?void 0:i.hits)&&e.hitItems.hits.length>0?await this.stream.flyTo({itemId:e.hitItems.hits[0].itemId,animation:{duration:v(this.configProvider().animation.durationMs)}}):console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}class rt{constructor(t,i,s,e,n,h,o,a,r,l,c){this.stream=t,this.cursors=i,this.getConfig=s,this.getScene=e,this.getFrame=n,this.getViewport=h,this.tapEmitter=o,this.doubleTapEmitter=a,this.longPressEmitter=r,this.interactionStartedEmitter=l,this.interactionFinishedEmitter=c,this.tap=this.tap.bind(this),this.doubleTap=this.doubleTap.bind(this),this.longPress=this.longPress.bind(this),this.emitTapEvent=this.emitTapEvent.bind(this)}addCursor(t,i){return this.cursors.add(t,i)}async getWorldPointFromViewport(t){const i=this.getViewport(),s=this.getFrame();if(null==s)throw new Error("Cannot get world point. Frame is undefined.");const e=await s.depthBuffer();return null!=e?i.transformPointToWorldSpace(t,e,.5):void 0}async getEntityTypeAtPoint(t){var i;const s=this.getViewport(),e=await(null===(i=this.getFrame())||void 0===i?void 0:i.featureMap());if(null!=e){const i=s.transformPointToFrame(t,e);return e.getEntityType(i)}return Q.NO_GEOMETRY}getRayFromPoint(t){const i=this.getViewport(),s=this.getFrame();if(null!=s)return i.transformPointToRay(t,s.image,s.scene.camera);throw new Error("Cannot get camera. Frame is undefined.")}async tap(t,i={},s=0){this.emitTapEvent(this.tapEmitter.emit,t,i,s)}async doubleTap(t,i={},s=0){this.emitTapEvent(this.doubleTapEmitter.emit,t,i,s)}async longPress(t,i={},s=0){this.emitTapEvent(this.longPressEmitter.emit,t,i,s)}async beginInteraction(){this.isInteracting()||(this.interactionStartedEmitter.emit(),this.currentCamera=this.getScene().camera(),await this.stream.beginInteraction())}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const e=o.normalize(o.subtract(i.lookAt,i.position));if(1===t.length&&"number"==typeof t[0]){const s=a.toRadians(-t[0]);return i.rotateAroundAxis(s,e)}if(1===t.length){const e=h.create(s.width/2,s.height/2),n=a.toDegrees(a.fromPoints(e,t[0])),r=null!=this.lastAngle?n-this.lastAngle:0;this.lastAngle=n;const l=o.normalize(o.subtract(i.lookAt,i.position)),c=a.toRadians(-r);return i.rotateAroundAxis(c,l)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:e,depthBuffer:n})=>{if(null==this.panData){const h=i.toFrameCamera(),o=h.direction,a=e.transformPointToRay(t,s.image,h),c=r.fromNormalAndCoplanarPoint(o,i.lookAt),d=l.intersectPlane(a,c);if(null==d)return console.warn("Cannot determine fallback for pan. Ray does not intersect plane."),i;const u=null!=n?this.getWorldPoint(t,n,d):d,v=r.fromNormalAndCoplanarPoint(o,u);this.panData={hitPt:u,hitPlane:v,startingCamera:h}}if(null!=this.panData){const{hitPt:n,hitPlane:h,startingCamera:a}=this.panData,r=e.transformPointToRay(t,s.image,a),c=l.intersectPlane(r,h);if(null!=c){const t=o.subtract(n,c);return i.update(a).moveBy(t)}}return i}))}async viewAll(){await this.getScene().camera().viewAll().render()}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=o.normalize(i.up),n=o.normalize(o.subtract(i.lookAt,i.position)),h=o.cross(e,n),a=o.cross(n,h),r=o.normalize({x:t.x*h.x+t.y*a.x,y:t.x*h.y+t.y*a.y,z:t.x*h.z+t.y*a.z}),l=o.cross(r,n),c=3*Math.PI*t.x/s.width,d=3*Math.PI*t.y/s.height,u=Math.abs(c)+Math.abs(d);return i.rotateAroundAxis(u,l)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:e,boundingBox:n,depthBuffer:h})=>{if(null==this.worldRotationPoint){const t=c.center(n);this.worldRotationPoint=null!=h?this.getWorldPoint(i,h,t):s.lookAt}const a=o.normalize(s.up),r=o.normalize(o.subtract(s.lookAt,s.position)),l=o.cross(a,r),d=o.cross(r,l),u=o.normalize({x:t.x*l.x+t.y*d.x,y:t.x*l.y+t.y*d.y,z:t.x*l.z+t.y*d.z}),v=o.cross(u,r),w=3*Math.PI*t.x/e.width,f=3*Math.PI*t.y/e.height,p=Math.abs(w)+Math.abs(f),m=s.rotateAroundAxisAtPoint(p,this.worldRotationPoint,v);return m.update({lookAt:o.add(o.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/o.magnitude(m.viewVector),m.viewVector),m.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=i.viewVector,n=o.normalize(e),h=o.magnitude(e),a=o.add(i.position,o.scale(3*h*t/s.height,n));return i.update({position:a})}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:e,frame:n,depthBuffer:h})=>{const a=n.scene.camera,c=a.direction,d=s.toFrameCamera(),u=e.transformPointToRay(t,n.image,d);if(null==this.zoomData){const i=r.fromNormalAndCoplanarPoint(c,a.lookAt),e=l.intersectPlane(u,i);if(null==e)return console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane."),s;const n=null!=h?this.getWorldPoint(t,h,e):e,o=r.fromNormalAndCoplanarPoint(c,n);this.zoomData={hitPt:n,hitPlane:o}}if(null!=this.zoomData){const{hitPt:t,hitPlane:n}=this.zoomData,h=o.distance(s.position,t),a=l.at(u,6*h*i/e.height),c=r.projectPoint(n,a),d=s.update({position:a,lookAt:c});if(o.distance(a,c)>=d.near)return d}return s}))}async pivotCamera(t,i){return this.transformCamera((({camera:s})=>{const{position:e,up:n,lookAt:h}=s,r=o.normalize(n),l=o.normalize(s.viewVector),c=o.cross(r,l),d=o.cross(l,c),u=o.rotateAboutAxis(a.toRadians(t),h,c,e),v=o.rotateAboutAxis(a.toRadians(i),u,d,e);return s.update(Object.assign(Object.assign({},s),{lookAt:v}))}))}async endInteraction(){this.isInteracting()&&(this.currentCamera=void 0,this.worldRotationPoint=void 0,this.panData=void 0,this.zoomData=void 0,this.resetLastAngle(),this.interactionFinishedEmitter.emit(),await this.stream.endInteraction())}resetLastAngle(){this.lastAngle=void 0}isInteracting(){return null!=this.currentCamera}pixelThreshold(t){return(this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold)*window.devicePixelRatio}async hitItems(t){var i;const s=await this.getScene().raycaster().hitItems(t);return null!==(i=null==s?void 0:s.hits)&&void 0!==i?i:[]}emitTapEvent(t,i,s={},e=0){const{altKey:n=!1,ctrlKey:h=!1,metaKey:o=!1,shiftKey:a=!1}=s;t({position:i,altKey:n,ctrlKey:h,metaKey:o,shiftKey:a,buttons:e})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const e=this.getViewport(),n=e.transformPointToFrame(t,i);return i.hitTest(n)?e.transformPointToWorldSpace(t,i):s}}class lt extends rt{constructor(t,i,s,e,n,h,o,a,r,l,c){super(t,i,s,e,n,h,o,a,r,l,c)}async getWorldPointFromViewport(t){const i=this.getViewport(),s=this.getFrame();if(null==s)throw new Error("Cannot get world point. Frame is undefined.");const e=await s.depthBuffer();return null!=e?i.transformPointToOrthographicWorldSpace(t,e,.5):void 0}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=i.viewVector,n=o.normalize(i.up),h=o.normalize(e),a=o.magnitude(e)*Math.tan(i.fovHeight),r=t.x*a/s.width,l=t.y/s.width*a,c=o.cross(n,h),d=o.cross(h,c),u=o.add(o.scale(r,c),o.scale(l,d));return i.moveBy(u)}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:e})=>{if(null==this.panData){const n=i.toFrameCamera(),h=n.direction,o=e.transformPointToOrthographicRay(t,s.image,n),a=r.fromNormalAndCoplanarPoint(h,i.lookAt),c=l.intersectPlane(o,a);if(null==c)return console.warn("Cannot determine fallback for pan. Ray does not intersect plane."),i;this.panData={hitPt:c,hitPlane:a,startingCamera:n}}if(null!=this.panData){const{hitPt:n,hitPlane:h,startingCamera:a}=this.panData,r=e.transformPointToOrthographicRay(t,s.image,a),c=l.intersectPlane(r,h);if(null!=c){const t=o.subtract(n,c);return i.update({lookAt:o.add(a.lookAt,t)})}}return i}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:e,frame:n,depthBuffer:a})=>{if(null==this.orthographicZoomData||h.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera(),h=i.direction,o=e.transformPointToOrthographicRay(t,n.image,i),c=r.fromNormalAndCoplanarPoint(h,i.lookAt),d=l.intersectPlane(o,c);if(null==d)return console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane."),s;const u=null!=a?this.getWorldPoint(t,a,d):d,v=r.fromNormalAndCoplanarPoint(h,u);this.orthographicZoomData={hitPt:u,hitPlane:v,startingScreenPt:t}}if(null!=this.orthographicZoomData){const{hitPt:t,hitPlane:n}=this.orthographicZoomData,h=s.fovHeight/e.height*2*i,a=Math.max(1,s.fovHeight-h),l=r.projectPoint(n,s.lookAt),c=o.scale((s.fovHeight-a)/s.fovHeight,o.subtract(t,l));return s.update({lookAt:o.add(s.lookAt,c),fovHeight:Math.max(1,s.fovHeight-h)})}return s}))}getWorldPoint(t,i,s){const e=this.getViewport(),n=e.transformPointToFrame(t,i);return i.hitTest(n)?e.transformPointToOrthographicWorldSpace(t,i):s}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}}class ct extends rt{constructor(t,i,s,e,n,h,o,a,r,l,c){super(t,i,s,e,n,h,o,a,r,l,c)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var e;const n=i.viewVector,h=o.normalize(i.up),a=o.normalize(n),r=o.magnitude(n)*Math.tan(null!==(e=i.fovY)&&void 0!==e?e:45),l=t.x*r/s.width,c=t.y/s.width*r,d=o.cross(h,a),u=o.cross(a,d),v=o.add(o.scale(l,d),o.scale(c,u));return i.moveBy(v)}))}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}}class dt{constructor(t,i,s,e){this.stream=t,this.configProvider=i,this.imageScaleProvider=s,this.sceneProvider=e}predicate(t){return t.altKey&&t.shiftKey}async fn(t){var i,s;const e=this.imageScaleProvider(),n=await this.stream.hitItems({point:h.scale(t.position,(null==e?void 0:e.x)||1,(null==e?void 0:e.y)||1)},!0);if(null!=(null===(i=n.hitItems)||void 0===i?void 0:i.hits)&&n.hitItems.hits.length>0&&null!=n.hitItems.hits[0].hitPoint){const i=this.sceneProvider().camera(),e=n.hitItems.hits[0];null!=e.hitPoint&&null!=e.hitPoint.x&&null!=e.hitPoint.y&&null!=e.hitPoint.z?await this.stream.flyTo({camera:W(i.update({lookAt:o.create(e.hitPoint.x,e.hitPoint.y,e.hitPoint.z)}).toFrameCamera()),animation:{duration:v(this.configProvider().animation.durationMs)}}):console.debug(`No hit position found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}, hit-id={${null===(s=e.itemId)||void 0===s?void 0:s.hex}}]`)}else console.debug(`No hit results found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}const ut=[.2,.15,.25,.25,.15];class vt{constructor(t,i,s,e,n,h,o,a,r,l){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.rotateInteraction=e,this.rotatePointInteraction=n,this.zoomInteraction=h,this.panInteraction=o,this.twistInteraction=a,this.pivotInteraction=r,this.getConfig=l,this.primaryInteraction=this.rotateInteraction,this.isDragging=!1,this.keyboardControls=!1,this.disableIndividualInteractions=!1,this.primaryInteractionTypeChange=new y,this.handleDownEvent=this.handleDownEvent.bind(this),this.handleMouseWheel=this.handleMouseWheel.bind(this),this.handleWindowMove=this.handleWindowMove.bind(this),this.handleWindowUp=this.handleWindowUp.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this)}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDownEvent),t.addEventListener("mousedown",this.handleDoubleClick),t.addEventListener("wheel",this.handleMouseWheel)}dispose(){var t,i,s;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDownEvent),null===(i=this.element)||void 0===i||i.removeEventListener("mousedown",this.handleDoubleClick),null===(s=this.element)||void 0===s||s.removeEventListener("wheel",this.handleMouseWheel),this.element=void 0}onPrimaryInteractionTypeChange(t){return this.primaryInteractionTypeChange.on(t)}setCurrentInteractionType(t){var i;switch(t){case"rotate":this.currentInteraction=this.rotateInteraction;break;case"zoom":this.currentInteraction=this.zoomInteraction;break;case"pan":this.currentInteraction=this.panInteraction;break;case"twist":this.currentInteraction=this.twistInteraction;break;case"rotate-point":this.currentInteraction=this.rotatePointInteraction;break;case"pivot":this.currentInteraction=this.pivotInteraction;break;default:this.currentInteraction=void 0}if(this.draggingInteraction){const t=this.draggingInteraction.getPosition();this.draggingInteraction=this.currentInteraction||this.primaryInteraction,null===(i=this.interactionApi)||void 0===i||i.resetLastAngle(),this.draggingInteraction.setPosition(t)}}getPrimaryInteractionType(){return this.primaryInteraction.getType()}getCurrentInteractionType(){return(this.currentInteraction||this.primaryInteraction).getType()}setPrimaryInteractionType(t){switch(t){case"rotate":this.primaryInteraction=this.rotateInteraction,this.lastPrimaryRotateInteraction=this.rotateInteraction;break;case"rotate-point":this.primaryInteraction=this.rotatePointInteraction,this.lastPrimaryRotateInteraction=this.rotatePointInteraction;break;case"zoom":this.primaryInteraction=this.zoomInteraction;break;case"pan":this.primaryInteraction=this.panInteraction;break;case"pivot":this.primaryInteraction=this.pivotInteraction}this.primaryInteractionTypeChange.emit()}setDefaultKeyboardControls(t){this.keyboardControls=t}handleDownEvent(t){t.preventDefault(),this.interactionTimer=window.setTimeout((()=>{this.downPosition=h.create(t.screenX,t.screenY),this.downPositionCanvas=this.getCanvasPosition(t),this.interactionTimer=void 0,null!=this.lastMoveEvent&&this.handleWindowMove(this.lastMoveEvent)}),this.getConfig().interactions.interactionDelay),window.addEventListener(this.moveEvent,this.handleWindowMove),window.addEventListener(this.upEvent,this.handleWindowUp)}handleWindowMove(t){if(null==this.interactionTimer){if(this.disableIndividualInteractions)return;const i=h.create(t.screenX,t.screenY),s=null!=this.interactionApi?this.interactionApi.pixelThreshold(this.isTouch(t)):2;null!=this.downPosition&&h.distance(i,this.downPosition)>=s&&!this.isDragging&&(this.beginDrag(t),this.isDragging=!0),this.isDragging&&this.drag(t)}this.lastMoveEvent=t}async handleWindowUp(t){this.isDragging&&(this.endDrag(t),this.isDragging=!1),null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0),window.removeEventListener(this.moveEvent,this.handleWindowMove),window.removeEventListener(this.upEvent,this.handleWindowUp),this.lastMoveEvent=void 0}async handleDoubleClick(t){2===t.detail&&4===t.buttons&&null!=this.interactionApi&&this.interactionApi.viewAll()}beginDrag(t){var i;this.keyboardControls&&t.metaKey&&t.shiftKey?this.currentInteraction=this.rotatePointInteraction:this.keyboardControls&&t.shiftKey&&t.altKey?this.currentInteraction=this.twistInteraction:this.keyboardControls&&t.shiftKey?this.currentInteraction=this.zoomInteraction:this.keyboardControls&&(t.metaKey||t.ctrlKey)?this.currentInteraction=this.panInteraction:this.keyboardControls&&t.altKey&&(this.currentInteraction=this.rotateInteraction),1===t.buttons?this.draggingInteraction=this.currentInteraction||this.primaryInteraction:2===t.buttons?this.draggingInteraction=this.panInteraction:4===t.buttons&&(this.draggingInteraction=null!==(i=this.lastPrimaryRotateInteraction)&&void 0!==i?i:this.rotateInteraction),null!=this.draggingInteraction&&null!=this.interactionApi&&null!=this.element&&(this.zoomInteraction.endDrag(t,this.interactionApi),this.draggingInteraction.beginDrag(t,this.downPositionCanvas||h.create(t.clientX,t.clientY),this.interactionApi,this.element))}drag(t){this.currentInteraction=this.keyboardControls&&t.altKey&&t.shiftKey?this.twistInteraction:void 0,this.draggingInteraction=this.currentInteraction||this.draggingInteraction||this.primaryInteraction,null!=this.draggingInteraction&&null!=this.interactionApi&&this.draggingInteraction.drag(t,this.interactionApi)}endDrag(t){this.keyboardControls&&this.currentInteraction===this.twistInteraction&&(this.currentInteraction=void 0),null!=this.draggingInteraction&&null!=this.interactionApi&&(this.draggingInteraction.endDrag(t,this.interactionApi),this.draggingInteraction=void 0)}handleMouseWheel(t){if(t.preventDefault(),null!=this.element&&null!=this.interactionApi&&4!==t.buttons){const i=-this.wheelDeltaToPixels(t.deltaY,t.deltaMode)/10,s=this.element.getBoundingClientRect(),e=E(t,s);ut.forEach(((t,s)=>{window.setTimeout((()=>{null!=this.interactionApi&&this.zoomInteraction.zoomToPoint(e,i*t,this.interactionApi)}),2*s)}))}}wheelDeltaToPixels(t,i){null==this.computedBodyStyle&&(this.computedBodyStyle=window.getComputedStyle(document.body));const s=null==this.computedBodyStyle.fontSize||""===this.computedBodyStyle.fontSize||isNaN(parseFloat(this.computedBodyStyle.fontSize))?19.2:1.2*parseFloat(this.computedBodyStyle.fontSize);return 1===i?null==this.computedBodyStyle.lineHeight||""===this.computedBodyStyle.lineHeight||isNaN(parseFloat(this.computedBodyStyle.lineHeight))?t*s:t*parseFloat(this.computedBodyStyle.lineHeight):2===i?null==this.computedBodyStyle.height||""===this.computedBodyStyle.height||isNaN(parseFloat(this.computedBodyStyle.height))?t*window.innerHeight:t*parseFloat(this.computedBodyStyle.height):t}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),e=null!=s?h.create(s.left,s.top):void 0;return null!=e?h.subtract(h.create(t.clientX,t.clientY),e):void 0}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class wt{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,e){}drag(t,i){}endDrag(t,i){null!=this.currentPosition&&(i.endInteraction(),this.currentPosition=void 0)}zoom(t,i){}}class ft extends wt{constructor(){super(...arguments),this.type="rotate"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.rotateCamera(e),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class pt extends wt{constructor(){super(...arguments),this.type="rotate-point"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),this.startingPosition=i,s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.startingPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.rotateCameraAtPoint(e,this.startingPosition),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class mt extends wt{constructor(t=1e3){super(),this.interactionTimeout=t,this.type="zoom",this.didTransformBegin=!1}beginDrag(t,i,s,e){if(null==this.currentPosition){this.currentPosition=h.create(t.clientX,t.clientY);const i=e.getBoundingClientRect(),n=E(t,i);this.startPt=n,s.beginInteraction()}}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.clientX,t.clientY),e=h.subtract(s,this.currentPosition);null!=this.startPt&&(i.zoomCameraToPoint(this.startPt,e.y),this.currentPosition=s)}}endDrag(t,i){super.endDrag(t,i),this.stopInteractionTimer(),this.didTransformBegin=!1,this.startPt=void 0}zoom(t,i){this.operateWithTimer(i,(()=>i.zoomCamera(t)))}zoomToPoint(t,i,s){this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,i)))}beginInteraction(t){this.didTransformBegin=!0,t.beginInteraction()}endInteraction(t){this.didTransformBegin=!1,t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer(),this.startInteractionTimer(t)}startInteractionTimer(t){this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0,this.endInteraction(t)}),this.interactionTimeout)}stopInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}operateWithTimer(t,i){this.didTransformBegin||this.beginInteraction(t),this.resetInteractionTimer(t),i()}}class gt extends wt{constructor(){super(...arguments),this.type="pan"}beginDrag(t,i,s,e){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),this.canvasRect=e.getBoundingClientRect(),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.canvasRect){const s=E(t,this.canvasRect);i.panCameraToScreenPoint(s),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class yt extends wt{constructor(){super(...arguments),this.type="twist"}beginDrag(t,i,s,e){this.currentPosition=h.create(t.offsetX,t.offsetY),this.canvasRect=e.getBoundingClientRect(),s.beginInteraction()}drag(t,i){const s=E(t,this.canvasRect);this.currentPosition=s,i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class Ct extends wt{constructor(){super(...arguments),this.type="pivot"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.pivotCamera(-.25*e.y,.25*e.x),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class bt extends vt{constructor(t,i=new ft,s=new pt,e=new mt,n=new gt,h=new yt,o=new Ct){super("mousedown","mouseup","mousemove",i,s,e,n,h,o,t)}}class Pt{initialize(t,i){this.element=t,this.interactionApi=i}dispose(){this.element=void 0}handleTwoPointTouchMove(t,i){var s,e,n,o;if(null!=this.currentPosition1&&null!=this.currentPosition2){const r=h.scale(h.add(h.subtract(t,this.currentPosition1),h.subtract(i,this.currentPosition2)),.25,.25),l=.5*(h.distance(t,i)-h.distance(this.currentPosition1,this.currentPosition2)),c=d.create(h.subtract(this.currentPosition1,this.currentPosition2),h.subtract(t,i)),u=a.toDegrees(Math.atan2(d.determinant(c),d.dot(c)));null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(e=this.interactionApi)||void 0===e||e.zoomCamera(l),null===(n=this.interactionApi)||void 0===n||n.panCameraByDelta(r),Math.abs(u)>.5&&(null===(o=this.interactionApi)||void 0===o||o.twistCamera(u))}this.currentPosition1=t,this.currentPosition2=i}}class It extends Pt{constructor(){super(),this.touchPoints={},this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("pointerdown",this.handlePointerDown),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=h.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},this.touchPoints),{[t.pointerId]:i}),1===Object.keys(this.touchPoints).length&&(window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp))}handlePointerMove(t){null!=this.touchPoints[t.pointerId]&&(this.touchPoints[t.pointerId]=h.create(t.screenX,t.screenY));const i=Object.keys(this.touchPoints);2===i.length&&this.handleTwoPointTouchMove(this.touchPoints[i[0]],this.touchPoints[i[1]])}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);1===s.length&&(null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.currentPosition1=void 0,this.currentPosition2=void 0),0===s.length&&(window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp))}}class Tt extends vt{constructor(t){super("pointerdown","pointerup","pointermove",new ft,new pt,new mt,new gt,new yt,new Ct,t),this.touchPoints=new Set,this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){this.downPosition=h.create(t.screenX,t.screenY),this.touchPoints.add(t.pointerId),1===this.touchPoints.size&&window.addEventListener("pointerup",this.handlePointerUp),2===this.touchPoints.size&&(this.disableIndividualInteractions=!0)}handlePointerUp(t){this.touchPoints.delete(t.pointerId),this.touchPoints.size<2&&(this.disableIndividualInteractions=!1),0===this.touchPoints.size&&window.removeEventListener("pointerup",this.handlePointerUp)}}class Dt{constructor(t,i,s,e){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.getConfig=e,this.handleDown=this.handleDown.bind(this),this.handleUp=this.handleUp.bind(this),this.handleMove=this.handleMove.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerEnd=this.handlePointerEnd.bind(this),this.clearPositions=this.clearPositions.bind(this),this.restartDoubleTapTimer=this.restartDoubleTapTimer.bind(this),this.clearDoubleTapTimer=this.clearDoubleTapTimer.bind(this),this.restartLongPressTimer=this.restartLongPressTimer.bind(this),this.clearLongPressTimer=this.clearLongPressTimer.bind(this),this.setPointerPositions=this.setPointerPositions.bind(this),this.emit=this.emit.bind(this)}dispose(){var t,i;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDown),null===(i=this.element)||void 0===i||i.removeEventListener("touchstart",this.handleTouchStart),this.element=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer()}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDown),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){1===t.touches.length&&(this.setPointerPositions(h.create(t.touches[0].clientX,t.touches[0].clientY)),this.restartLongPressTimer(),window.addEventListener("touchend",this.handleTouchEnd),window.addEventListener("touchmove",this.handleTouchMove))}handleTouchMove(t){t.touches.length>0&&this.handlePointerMove(h.create(t.touches[0].clientX,t.touches[0].clientY),!0)}handleTouchEnd(t){null!=this.pointerDownPosition&&(window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchmove",this.handleTouchMove)),this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(h.create(t.clientX,t.clientY)),this.buttons=t.buttons,this.restartLongPressTimer({altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}),window.addEventListener(this.upEvent,this.handleUp),window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(h.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){null!=this.pointerDownPosition&&(window.removeEventListener(this.upEvent,this.handleUp),window.removeEventListener(this.moveEvent,this.handleMove)),this.handlePointerEnd(h.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t)),this.buttons=void 0}handlePointerMove(t,i){var s;const e=(null===(s=this.interactionApi)||void 0===s?void 0:s.pixelThreshold(i))||2;null!=this.pointerDownPosition&&h.distance(t,this.pointerDownPosition)>=e&&null==this.interactionTimer&&this.clearPositions()}handlePointerEnd(t,i={},s=0,e=!1){var n,h;null!=t&&(null!=this.longPressTimer&&this.emit(null===(n=this.interactionApi)||void 0===n?void 0:n.tap)(t,i,s),null!=this.doubleTapTimer&&null!=this.secondPointerDownPosition&&(this.emit(null===(h=this.interactionApi)||void 0===h?void 0:h.doubleTap)(t,i,s,this.secondPointerDownPosition),this.clearDoubleTapTimer())),this.pointerDownPosition=void 0,this.clearLongPressTimer()}emit(t){return(i,s={},e=0,n,o=!1)=>{var a;const r=n||this.pointerDownPosition,l=(null===(a=this.interactionApi)||void 0===a?void 0:a.pixelThreshold(o))||1;let c;null!=this.interactionTimer?c=this.getCanvasPosition(r||i):null!=r&&h.distance(r,i)<=l&&(c=this.getCanvasPosition(i)),null!=c&&null!=t&&t(c,s,e)}}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),e=null!=s?h.create(s.left,s.top):void 0;return null!=e?h.subtract(h.create(t.x,t.y),e):void 0}clearPositions(){this.pointerDownPosition=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer(),this.clearInteractionTimer()}clearDoubleTapTimer(){null!=this.doubleTapTimer&&window.clearTimeout(this.doubleTapTimer),this.doubleTapTimer=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0}restartDoubleTapTimer(){this.clearDoubleTapTimer(),this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){null!=this.longPressTimer&&window.clearTimeout(this.longPressTimer),this.longPressTimer=void 0}restartLongPressTimer(t={}){this.clearLongPressTimer(),this.longPressTimer=window.setTimeout((()=>{var i;this.pointerDownPosition&&this.emit(null===(i=this.interactionApi)||void 0===i?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons),this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer(),this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}setPointerPositions(t){this.pointerDownPosition=t,this.restartInteractionTimer(),null==this.firstPointerDownPosition?(this.restartDoubleTapTimer(),this.firstPointerDownPosition=t):this.secondPointerDownPosition=t}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class xt extends Pt{constructor(){super(),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("touchstart",this.handleTouchStart),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){if(t.touches.length>=1){const i=t.touches[0],s=t.touches[1];this.currentPosition1=h.create(i.screenX,i.screenY),this.currentPosition2=null!=s?h.create(s.screenX,s.screenY):void 0,window.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){if(1===t.touches.length)this.handleOnePointTouchMove(t.touches[0]);else if(2===t.touches.length){const i=h.create(t.touches[0].clientX,t.touches[0].clientY),s=h.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.isInteracting=!1,window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd)}handleOnePointTouchMove(t){var i,s,e;const n=h.create(t.screenX,t.screenY);if(null!=this.currentPosition1){const t=h.subtract(n,this.currentPosition1),o=(null===(i=this.interactionApi)||void 0===i?void 0:i.pixelThreshold(!0))||2;(h.distance(n,this.currentPosition1)>=o||this.isInteracting)&&(null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(e=this.interactionApi)||void 0===e||e.rotateCamera(t),this.isInteracting=!0)}this.currentPosition1=n}}const St=new class{constructor(t,i=window.performance){this.name=t,this.perf=i,this.measures=new Set,this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(null!=(i=t)&&i.then instanceof Function&&i.catch instanceof Function&&i.finally instanceof Function){const i=this.begin();return t.finally((()=>this.end(i)))}if("function"==typeof t){const i=this.begin(),s=t();return this.end(i),s}throw new Error("Input must be a function or Promise");var i}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);return this.clearMeasurements(),t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;return this.measures.add(t),this.perf.mark(t),t}end(t){this.perf.measure(this.name,t),this.perf.clearMarks(t),this.measures.delete(t)}}("paint_time");function kt(t,i,s,e,n=1e3){let h,o,a=0,r=[];return s&&setInterval((()=>{if(null!=o){5===r.length?r=[...r.slice(1),o]:r.push(o);const t=r.reduce(((t,i)=>t+i))/r.length;console.debug(`Paint rate: ${o}fps`),console.debug(`Paint rate (avg): ${t}`),o=void 0}}),1e3),s=>(a++,null==h&&(h=setInterval((()=>{!function(t,i){const s=t.takeMeasurements();s.length>0&&i(s)}(t,e),0===a&&null!=h&&(clearInterval(h),h=void 0)}),n)),t.measure((async()=>{const t=await i(s);return o=null==o?1:o+1,t})).finally((()=>{a--})))}var Et;!function(t){t.DEVICE_ID="vertexvis:device-id"}(Et||(Et={}));class Ot extends f{constructor(t,i={}){var s,e,n;super(t,{loggingEnabled:i.loggingEnabled}),this.state={type:"disconnected"},this.stateChanged=new y,this.dimensions=u.create(0,0),this.streamAttributes={},this.frameBgColor=b.create(255,255,255),this.config=S("platprod"),this.options={tokenRefreshOffsetInSeconds:null!==(s=i.tokenRefreshOffsetInSeconds)&&void 0!==s?s:30,offlineThresholdInSeconds:null!==(e=i.offlineThresholdInSeconds)&&void 0!==e?e:30,loadTimeoutInSeconds:null!==(n=i.loadTimeoutInSeconds)&&void 0!==n?n:15}}getState(){return this.state}disconnect(){"disconnected"!==this.state.type&&"connection-failed"!==this.state.type&&(console.debug("Disconnecting websocket"),this.state.connection.dispose(),this.updateState({type:"disconnected"}))}async load(t,i,s,e=S("platprod")){return this.clientId=i,this.deviceId=s,this.config=e,"disconnected"===this.state.type||"connection-failed"===this.state.type?this.loadIfDisconnected(t):this.loadIfConnectingOrConnected(t,this.state)}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor,null!=t.dimensions&&t.dimensions!==this.dimensions&&(this.dimensions=t.dimensions,this.ifState("connected",(()=>this.updateDimensions({dimensions:this.dimensions})))),null!=t.streamAttributes&&this.streamAttributes!==t.streamAttributes&&(this.streamAttributes=t.streamAttributes,this.ifState("connected",(()=>this.updateStream({streamAttributes:Mt(this.streamAttributes)}))))}async loadIfConnectingOrConnected(t,i){var s;const{resource:e,subResource:n}=i.resource,h=tt(t),o=!P.isEqual(e,h.resource),a=!P.isEqual(n,h.subResource),r="connecting"===i.type||"reconnecting"===i.type,l="connected"===i.type,c=h.queries.find((t=>"supplied-id"===t.type));if(o||r&&a)return this.disconnect(),this.loadIfDisconnected(t);if(l&&a&&"scene-view-state"===(null===(s=h.subResource)||void 0===s?void 0:s.type)){const t=Object.assign(Object.assign({},null!=h.subResource.id?{sceneViewStateId:{hex:h.subResource.id}}:{}),null!=c?{sceneViewStateSuppliedId:{value:c.id}}:{});await this.loadSceneViewState(t),this.updateState(Object.assign(Object.assign({},i),{resource:h}))}}async loadIfDisconnected(t){try{await this.connectWithNewStream(tt(t))}catch(t){throw this.updateState(t instanceof j?{type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t}:t instanceof p?{type:"connection-failed",message:"Cannot load scene. Stream request failed to start stream.",error:t}:{type:"connection-failed",message:"Cannot load scene for unknown reason. See console logs.",error:t}),t}}connectWithNewStream(t){return this.openWebsocketStream(t,"connecting",(()=>this.requestNewStream(t)))}connectToExistingStream(t){return this.openWebsocketStream(t.resource,"reconnecting",(()=>this.requestReconnectStream(t)),{maxRetries:Number.POSITIVE_INFINITY})}async openWebsocketStream(t,i,s,{maxRetries:e=3}={}){const n=(h=function(t,i,s,e){return I.appendPath(null!=s?I.toString(I.parseAndAddParams("/ws",{clientId:s,deviceId:e})):`/stream-keys/${i.id}/session`,I.parse(t.network.renderingHost))}(this.config,t.resource,this.clientId,this.deviceId),{url:I.toString(h),protocols:["ws.vertexvis.com"]});var h;console.debug(`Initiating WS connection [uri=${n.url}]`);const o=new AbortController,a=(r=this.config,{EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},r.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:r.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},r.EXPERIMENTAL_adaptiveRendering),{enabled:r.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},r.EXPERIMENTAL_qualityOfService)});var r;this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose(),o.abort()}}});const l=await T.abort(o.signal,T.retry((()=>this.connect(n,a)),{maxRetries:e,delaysInMs:Ot.WS_RECONNECT_DELAYS})).catch((t=>{throw new R("Websocket connection failed.",t instanceof Error?t:void 0)}));if(!l.aborted)return this.requestNewOrExistingStream(t,l.result,s);this.updateState({type:"disconnected"})}async requestNewOrExistingStream(t,i,s){const e=this.requestClock(),n=await s();console.debug(`Stream connected [stream-id=${n.streamId}, scene-id=${n.sceneId}, scene-view-id=${n.sceneViewId}]`);const h=this.onRequest((t=>{const i=t.request.drawFrame;if(null!=i){const t=q(n.worldOrientation)(i);"connected"===this.state.type&&this.updateState(Object.assign(Object.assign({},this.state),{frame:t}))}})),o=this.reconnectWhenNeeded(),a=this.refreshTokenWhenExpired(n.token),r=this.acknowledgeFrameRequests(),l=null==n.frame?await this.waitForFrame(n.worldOrientation,this.options.loadTimeoutInSeconds):n.frame,c=await e;console.debug(`Synchronized clocks [local-time=${c.knownLocalTime.toISOString()}, remote-time=${c.knownRemoteTime.toISOString()}]`),this.updateState({type:"connected",connection:{dispose:()=>{o.dispose(),h.dispose(),a.dispose(),r.dispose(),i.dispose()}},resource:t,streamId:n.streamId,deviceId:n.deviceId,sceneId:n.sceneId,sceneViewId:n.sceneViewId,worldOrientation:n.worldOrientation,token:n.token,frame:l,clock:c})}async requestNewStream(t){var i,s;const e=t.queries.find((t=>"supplied-id"===t.type)),n=U(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.dimensions,frameBackgroundColor:jt(this.frameBgColor),streamAttributes:Mt(this.streamAttributes),sceneViewStateId:"scene-view-state"===(null===(i=t.subResource)||void 0===i?void 0:i.type)&&null!=t.subResource.id?{hex:t.subResource.id}:void 0,sceneViewStateSuppliedId:"scene-view-state"===(null===(s=t.subResource)||void 0===s?void 0:s.type)&&null!=e?{value:e.id}:void 0}));return{resource:t,streamId:n.streamId,sceneId:n.sceneId,sceneViewId:n.sceneViewId,deviceId:n.sessionId,token:n.token,worldOrientation:n.worldOrientation,frame:void 0}}async requestReconnectStream(t){const i=G(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.dimensions,frameBackgroundColor:jt(this.frameBgColor),streamAttributes:Mt(this.streamAttributes)}));return Object.assign(Object.assign({},t),{token:i.token})}async requestClock(){const t=_(await this.syncTime({requestTime:m()}));return new it(t)}reconnectWhenNeeded(){const t=this.onClose((()=>{"connected"===this.state.type&&this.closeAndReconnect(this.state)})),i=this.onRequest((t=>{null!=t.request.gracefulReconnection&&"connected"===this.state.type&&(console.debug("Received request for graceful reconnect. Closing connection and attempting reconnect."),this.closeAndReconnect(this.state))})),s=this.reconnectWhenOffline();return{dispose:()=>{t.dispose(),i.dispose(),s.dispose()}}}refreshTokenWhenExpired(t){let i;const s=t=>{const{tokenRefreshOffsetInSeconds:e}=this.options,n=t.remainingTimeInMs(e);i=window.setTimeout((async()=>{const t=await this.refreshToken(),i=J(t);s(i),"connected"===this.state.type&&this.updateState(Object.assign(Object.assign({},this.state),{token:i}))}),n)};return s(t),{dispose:()=>clearTimeout(i)}}reconnectWhenOffline(){let t;const i=()=>window.clearTimeout(t),s=()=>{i();const s=this.options.offlineThresholdInSeconds;console.debug(`Detected that host is offline. Will attempt reconnect in ${s}s.`),t=window.setTimeout((()=>{"connected"===this.state.type&&this.closeAndReconnect(this.state)}),1e3*s)};return window.addEventListener("offline",(()=>s())),window.addEventListener("online",(()=>{console.debug("Detected that host is online."),i()})),{dispose:()=>{i(),window.removeEventListener("offline",s),window.removeEventListener("online",i)}}}closeAndReconnect(t){return t.connection.dispose(),this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await T.timeout(1e3*i,new Promise((i=>{s=this.onRequest((e=>{try{const n=e.request.drawFrame;if(null!=n){const s=q(t)(n);i(s)}}finally{null==s||s.dispose()}}))})))}catch(t){throw new A(`Frame timed out after ${i/1e3}s`,t instanceof Error?t:void 0)}finally{null==s||s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(function(t,i){const s=function(t){let i=!1;return s=>{const e=t();if(null!=e){const t=e.remoteTime(new Date(Date.now())),n=v(s,t);return w(n).getTime()>=0?n:void(i||(console.warn(`Possible erroneous send to receive timing. Muting for 60s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${e.knownRemoteTime.toISOString()}]`),i=!0,setTimeout((()=>i=!1),6e4)))}}}(i);return e=i=>{return e=()=>e=>{const n=w(e.sentAtTime);null!=n&&t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(n)}})},t=>{const{drawFrame:i}=t.request;null!=i&&e()(t)};var e},t=>{var i;const s=null===(i=t.request.requestId)||void 0===i?void 0:i.value;null!=s&&e(s)(t)};var e}(this,(()=>"connected"===this.state.type?this.state.clock:void 0)))}updateState(t){this.state!==t&&(this.state=t,this.stateChanged.emit(this.state))}ifState(t,i){if(this.state.type===t)return i()}onStateChanged(t){return this.stateChanged.on(t)}}Ot.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const Mt=C.ifInvalidThrow(V),jt=C.ifInvalidThrow(H),Rt=class{constructor(s){t(this,s),this.tap=i(this,"tap",7),this.doubletap=i(this,"doubletap",7),this.longpress=i(this,"longpress",7),this.frameReceived=i(this,"frameReceived",7),this.frameDrawn=i(this,"frameDrawn",7),this.tokenExpired=i(this,"tokenExpired",7),this.connectionChange=i(this,"connectionChange",7),this.sceneReady=i(this,"sceneReady",7),this.sceneChanged=i(this,"sceneChanged",7),this.interactionStarted=i(this,"interactionStarted",7),this.interactionFinished=i(this,"interactionFinished",7),this.cameraTypeChanged=i(this,"cameraTypeChanged",7),this.deviceIdChange=i(this,"deviceIdChange",7),this.dimensionschange=i(this,"dimensionschange",7),this.configEnv="platprod",this.cameraControls=!0,this.cameraType="perspective",this.keyboardControls=!0,this.rotateAroundTapPoint=!0,this.experimentalGhostingOpacity=0,this.noDefaultLights=!1,this.experimentalRenderingOptions="",this.selectionMaterial=st,this.resizeDebounce=100,this.stencilBuffer=new ht(this.hostElement),this.viewport=Z.fromDimensions(u.create(0,0)),this.stateMap={cursorManager:new k,streamState:{type:"disconnected"}},this.interactionHandlers=[],this.defaultInteractionHandlerDisposables=[],this.tapKeyInteractions=[],this.defaultTapKeyInteractions=[],this.internalFrameDrawnDispatcher=new y,this.handleElementResize=this.handleElementResize.bind(this)}componentWillLoad(){var t;this.updateResolvedConfig(),this.calculateComponentDimensions(),this.resizeObserver=new ResizeObserver(this.handleElementResize),this.registerSlotChangeListeners(),this.stream=null!==(t=this.stream)&&void 0!==t?t:new Ot(new g,{loggingEnabled:this.getResolvedConfig().flags.logWsMessages}),this.addStreamListeners(),this.updateStreamAttributes(),this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}componentDidLoad(){var t;this.interactionApi=this.createInteractionApi(),null!=this.containerElement&&(null===(t=this.resizeObserver)||void 0===t||t.observe(this.containerElement)),null!=this.src&&this.load(this.src).catch((t=>{console.error("Error loading scene",t)})),this.initializeDefaultInteractionHandlers(),this.injectViewerApi()}render(){var t;return s(e,null,s("div",{class:"viewer-container",style:{cursor:O(null!==(t=this.cursor)&&void 0!==t?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.containerElement=t,class:x("canvas-container",{"enable-pointer-events ":null!=window.PointerEvent})},s("canvas",{ref:t=>{this.canvasElement=t,this.stateMap.interactionTarget=t},class:"canvas"}),null!=this.errorMessage?s("div",{class:"error-message"},this.errorMessage):null),s("slot",null)))}async dispatchFrameDrawn(t){this.frame=t,this.internalFrameDrawnDispatcher.emit(t),this.frameDrawn.emit(t)}async registerInteractionHandler(t){return this.interactionHandlers.push(t),this.initializeInteractionHandler(t),{dispose:()=>{const i=this.interactionHandlers.indexOf(t);-1!==i&&(this.interactionHandlers[i].dispose(),this.interactionHandlers.splice(i,1))}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget_DEPRECATED(){if(null!=this.stateMap.interactionTarget)return this.stateMap.interactionTarget;throw new Error("Interaction target is undefined.")}async addCursor(t,i){return this.stateMap.cursorManager.add(t,i)}async getInteractionHandlers(){return this.interactionHandlers}async getKeyInteractions(){return this.tapKeyInteractions}async getBaseInteractionHandler(){return this.baseInteractionHandler}async getJwt(){return this.token}handleSrcChanged(t){null!=t?this.load(t):this.unload()}handleCameraControlsChanged(){this.initializeDefaultCameraInteractionHandlers()}handleKeyboardControlsChanged(){this.initializeDefaultKeyboardInteractionHandlers()}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributes(),this.rotateAroundTapPoint?null===(t=this.baseInteractionHandler)||void 0===t||t.setPrimaryInteractionType("rotate-point"):null===(i=this.baseInteractionHandler)||void 0===i||i.setPrimaryInteractionType("rotate")}handleCameraTypeChanged(t,i){t!==i&&this.updateCameraType()}handleDepthBuffersChanged(){this.updateStreamAttributes()}handleExperimentalGhostingOpacityChanged(){this.updateStreamAttributes()}handleNoDefaultLightsChanged(){this.updateStreamAttributes()}handleExperimentalRenderingOptionsChanged(){this.updateStreamAttributes()}handleFeatureLinesChanged(){this.updateStreamAttributes()}handleFeatureHighlightingChanged(){this.updateStreamAttributes()}handleFeatureMapsChanged(){this.updateStreamAttributes()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t){var i;if(null==this.stream||null==this.dimensions)throw new F("Cannot load scene. Viewer has not been initialized.");this.calculateComponentDimensions(),this.stream.update({streamAttributes:this.getStreamAttributes(),config:S(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()}),await(null===(i=this.stream)||void 0===i?void 0:i.load(t,this.clientId,this.getDeviceId(),this.getResolvedConfig())),this.sceneReady.emit()}async unload(){if(null!=this.stream&&(this.stream.disconnect(),this.frame=void 0,this.errorMessage=void 0),null!=this.canvasElement){const t=this.canvasElement.getContext("2d");null!=t&&t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}async scene(){return this.createScene()}async isSceneReady(){return"connected"===this.stateMap.streamState.type}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}emitConnectionChange(t){this.connectionChange.emit(t)}handleElementResize(t){t.length>0&&null!=this.dimensions&&!u.isEqual(t[0].contentRect,this.viewport)&&(null!=this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=void 0),this.isResizing||(this.resizeTimer=setTimeout((()=>{this.isResizing=!0,this.isResizeUpdate=!0,this.recalculateComponentDimensions()}),this.resizeDebounce)))}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((()=>this.injectViewerApi())),this.mutationObserver.observe(this.hostElement,{childList:!0,subtree:!0})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}t(this.hostElement).filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}calculateComponentDimensions(){var t;const i=this.getBounds();if(null!=(null==i?void 0:i.width)&&null!=(null==i?void 0:i.height)){const s=u.create(i.width,i.height),e=u.scaleFit(2073600,s);this.hostDimensions=s,this.dimensions=null!=e?u.create(e.width,e.height):void 0,this.viewport=Z.fromDimensions(null!==(t=this.getCanvasDimensions())&&void 0!==t?t:u.create(0,0))}}recalculateComponentDimensions(){var t;this.isResizing&&(this.calculateComponentDimensions(),this.isResizing=!1,"connected"===(null===(t=this.stream)||void 0===t?void 0:t.getState().type)&&this.updateDimensions(this.dimensions))}reportPerformance(t){if("connected"===this.stateMap.streamState.type){const i={timings:t.map((t=>({receiveToPaintDuration:v(t.duration)})))};this.getStream().recordPerformance(i,!1)}}addStreamListeners(){this.stateMap.streamListeners=this.getStream().stateChanged.on((t=>{this.handleStreamStateChanged(this.stateMap.streamState,t)}))}handleStreamStateChanged(t,i){this.stateMap.streamState=i,"connecting"===i.type?this.handleConnecting(t,i):"connected"===i.type?this.handleConnected(t,i):"connection-failed"===i.type?this.handleConnectionFailed(t,i):"disconnected"===i.type&&this.handleDisconnected(t,i)}handleConnecting(t,i){"connecting"!==t.type&&(this.token=void 0,this.errorMessage=void 0,this.emitConnectionChange({status:"connecting"}))}handleConnected(t,i){this.token=i.token.token,"connected"!==t.type&&(this.errorMessage=void 0,this.canvasRenderer=kt(St,function(){const t=function(){let t=-1;return async i=>{if(i.frame.sequenceNumber>t){const n=await(s=i.frame.image.imageBytes,null!=window.createImageBitmap?async function(t){const i=new Blob([t]),s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}(s):(e=s,new Promise(((t,i)=>{const s=new Blob([e]),n=URL.createObjectURL(s),h=new Image;h.addEventListener("load",(()=>{t({image:h,dispose:()=>{}}),URL.revokeObjectURL(n)})),h.addEventListener("error",(()=>{i(new M("Failed to load image data")),URL.revokeObjectURL(n)})),h.src=n}))));return t=i.frame.sequenceNumber,n}var s,e}}(),i=function(){let t=-1;return async(i,s)=>{var e;if(null!=s&&i.frame.sequenceNumber>t)return t=i.frame.sequenceNumber,null===(e=i.beforeDraw)||void 0===e||e.call(i),function(t,i){const s=i.viewport.calculateDrawRect(i.frame.image);i.canvas.clearRect(0,0,i.canvasDimensions.width,i.canvasDimensions.height),i.canvas.drawImage(t.image,s.x,s.y,s.width,s.height)}(s,i),s.dispose(),i.frame;null==s||s.dispose()}}();return async s=>{var e,n;if(null===(n=null===(e=s.predicate)||void 0===e?void 0:e.call(s))||void 0===n||n)return t(s).then((t=>i(s,t)))}}(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t))),this.emitConnectionChange({status:"connected",jwt:i.token.token}),this.deviceIdChange.emit(i.deviceId)),this.frame!==i.frame&&this.updateFrame(i.frame),this.updateDimensions(this.dimensions)}handleConnectionFailed(t,i){"connection-failed"!==t.type&&(this.token=void 0,this.errorMessage=i.message)}handleDisconnected(t,i){"disconnected"!==t.type&&(this.token=void 0,this.errorMessage=void 0,this.emitConnectionChange({status:"disconnected"}))}updateDimensions(t){var i;null===(i=this.stream)||void 0===i||i.update({dimensions:t}),this.dimensionschange.emit(t)}async updateFrame(t){const i=this.getCanvasDimensions();if(null!=this.canvasElement&&null!=i&&this.frame!==t){const s=this.canvasElement.getContext("2d");if(null!=s){const e=this.frame;this.frame=t,this.updateInteractionApi(e);const n={canvas:s,canvasDimensions:i,dimensions:this.dimensions,frame:this.frame,viewport:this.viewport,beforeDraw:()=>{this.updateCanvasDimensions(i),this.isResizeUpdate=!1},predicate:()=>!this.isResizeUpdate||null==this.dimensions||u.isEqual(this.dimensions,n.frame.image.imageAttr.frameDimensions)};this.frameReceived.emit(this.frame),this.frame.scene.hasChanged&&this.sceneChanged.emit();const h=await this.canvasRenderer(n);null!=h&&this.dispatchFrameDrawn(h)}}}async initializeDefaultInteractionHandlers(){var t;await this.initializeDefaultCameraInteractionHandlers(),await this.initializeDefaultTapInteractionHandler(),this.initializeDefaultKeyboardInteractionHandlers(),this.rotateAroundTapPoint&&(null===(t=this.baseInteractionHandler)||void 0===t||t.setPrimaryInteractionType("rotate-point"))}clearDefaultCameraInteractionHandlers(){this.defaultInteractionHandlerDisposables.forEach((t=>t.dispose())),this.defaultInteractionHandlerDisposables=[]}clearDefaultKeyboardInteractions(){this.defaultTapKeyInteractions.forEach((t=>{const i=this.tapKeyInteractions.indexOf(t);-1!==i&&this.tapKeyInteractions.splice(i,1)})),this.tapKeyInteractions=[]}async initializeDefaultCameraInteractionHandlers(){var t,i;if(this.clearDefaultCameraInteractionHandlers(),this.cameraControls)if(null!=window.PointerEvent){this.baseInteractionHandler=null!==(t=this.baseInteractionHandler)&&void 0!==t?t:new Tt((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler),s=await this.registerInteractionHandler(new It);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=null!==(i=this.baseInteractionHandler)&&void 0!==i?i:new bt((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler),s=await this.registerInteractionHandler(new xt);this.defaultInteractionHandlerDisposables=[t,s]}}initializeDefaultKeyboardInteractionHandlers(){var t;if(this.clearDefaultKeyboardInteractions(),this.keyboardControls&&null!=this.stream){null===(t=this.baseInteractionHandler)||void 0===t||t.setDefaultKeyboardControls(this.keyboardControls);const i=new at(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale())),s=new dt(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()),(()=>this.createScene()));this.registerTapKeyInteraction(i),this.registerTapKeyInteraction(s),this.defaultTapKeyInteractions=[i,s]}}async initializeDefaultTapInteractionHandler(){if(null==this.tapHandlerDisposable)if(null!=window.PointerEvent){const t=new Dt("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new Dt("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}initializeInteractionHandler(t){if(null==this.stateMap.interactionTarget)throw new z("Cannot initialize interaction handler. Interaction target is undefined.");if(null==this.interactionApi)throw new z("Cannot initialize interaction handler. Interaction APi is undefined.");t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(null==this.stream)throw new B("Cannot create interaction API. Component has not been initialized.");return null==this.frame||this.frame.scene.camera.isPerspective()?new ct(this.stream,this.stateMap.cursorManager,(()=>this.getResolvedConfig().interactions),(()=>this.createScene()),(()=>this.frame),(()=>this.viewport),this.tap,this.doubletap,this.longpress,this.interactionStarted,this.interactionFinished):new lt(this.stream,this.stateMap.cursorManager,(()=>this.getResolvedConfig().interactions),(()=>this.createScene()),(()=>this.frame),(()=>this.viewport),this.tap,this.doubletap,this.longpress,this.interactionStarted,this.interactionFinished)}handleCursorChanged(){window.requestAnimationFrame((()=>{this.cursor=this.stateMap.cursorManager.getActiveCursor()}))}createScene(){if("connected"!==this.stateMap.streamState.type)throw new L("Cannot create scene. Viewer stream is not connected.");const{frame:t,sceneId:i,sceneViewId:s,worldOrientation:e}=this.stateMap.streamState,n="string"==typeof this.selectionMaterial?et(this.selectionMaterial):this.selectionMaterial;return new nt(this.getStream(),t,q(e),(()=>this.getImageScale()),this.viewport,i,s,n)}getBackgroundColor(){if(null!=this.containerElement)return function(t){const i=window.getComputedStyle(t);return b.fromCss(i.backgroundColor)}(this.containerElement)}getBounds(){return this.hostElement.getBoundingClientRect()}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(null!=this.dimensions&&null!=t)return h.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}getStreamAttributes(){return{depthBuffers:this.getDepthBufferStreamAttributesValue(),experimentalGhosting:this.experimentalGhostingOpacity,noDefaultLights:this.noDefaultLights,featureLines:this.featureLines,featureHighlighting:this.featureHighlighting,featureMaps:this.featureMaps,experimentalRenderingOptions:this.experimentalRenderingOptions}}updateCanvasDimensions(t){null!=this.canvasElement&&(this.canvasElement.width=t.width,this.canvasElement.height=t.height)}updateStreamAttributes(){var t;null===(t=this.stream)||void 0===t||t.update({streamAttributes:this.getStreamAttributes()})}updateInteractionApi(t){if(null!=this.frame){const i=(null==t||t.scene.camera.isPerspective())&&this.frame.scene.camera.isOrthographic(),s=(null==t||t.scene.camera.isOrthographic())&&this.frame.scene.camera.isPerspective();(i||s)&&(this.interactionApi=this.createInteractionApi(),this.cameraType=this.frame.scene.camera.isPerspective()?"perspective":"orthographic",this.cameraTypeChanged.emit(this.cameraType),this.interactionHandlers.forEach((t=>this.initializeInteractionHandler(t))))}}updateCameraType(){var t,i;null!=this.frame&&("orthographic"===this.cameraType&&this.frame.scene.camera.isPerspective()?null===(t=this.stream)||void 0===t||t.replaceCamera({camera:W(X(this.frame.scene.camera,this.frame.scene.boundingBox))}):"perspective"===this.cameraType&&this.frame.scene.camera.isOrthographic()&&(null===(i=this.stream)||void 0===i||i.replaceCamera({camera:W(Y(this.frame.scene.camera))})))}getDepthBufferStreamAttributesValue(){var t;return null!==(t=this.depthBuffers)&&void 0!==t?t:this.rotateAroundTapPoint?"final":void 0}updateResolvedConfig(){this.resolvedConfig=S(this.configEnv,this.config)}getResolvedConfig(){return At("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return At("Stream is undefined",(()=>this.stream))}getDeviceId(){if(null==this.deviceId){try{this.deviceId=function(t,i,s=window.localStorage){const e=s.getItem(Et.DEVICE_ID);if(null!=e)return i(JSON.parse(e))}(0,(t=>t["device-id"]))}catch(t){console.warn("Cannot read device ID. Local storage is not supported.")}if(null==this.deviceId){this.deviceId=D.create();try{!function(t,i,s=window.localStorage){const e=s.getItem(t);if(null!=e){const n=Object.assign(Object.assign({},JSON.parse(e)),i);s.setItem(t,JSON.stringify(n))}else s.setItem(t,JSON.stringify(i))}(Et.DEVICE_ID,{"device-id":this.deviceId})}catch(t){console.warn("Cannot write device ID. Local storage is not supported.")}}}return this.deviceId}get hostElement(){return n(this)}static get watchers(){return{src:["handleSrcChanged"],cameraControls:["handleCameraControlsChanged"],keyboardControls:["handleKeyboardControlsChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],cameraType:["handleCameraTypeChanged"],depthBuffers:["handleDepthBuffersChanged"],experimentalGhostingOpacity:["handleExperimentalGhostingOpacityChanged"],noDefaultLights:["handleNoDefaultLightsChanged"],experimentalRenderingOptions:["handleExperimentalRenderingOptionsChanged"],featureLines:["handleFeatureLinesChanged"],featureHighlighting:["handleFeatureHighlightingChanged"],featureMaps:["handleFeatureMapsChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function At(t,i){const s=i();if(null!=s)return s;throw new Error(t)}Rt.style=":host{--image-background:var(--image-background);--viewer-background:var(--viewer-background);display:block;position:relative;width:300px;height:300px;min-width:1px;min-height:1px}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative;background:var(--image-background, var(--viewer-background, #ffffff))}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden;background:var(--viewer-background, #ffffff)}.error-message{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";export{Rt as vertex_viewer}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as i,F as t,r as n}from"./p-d6fce4c1.js";import{p as e,m as o,v as s}from"./p-d216a866.js";import"./p-1812c82d.js";import"./p-51401063.js";import"./p-92fe4417.js";import"./p-6072cf84.js";import"./p-df8fbe56.js";import{V as r}from"./p-0a017be7.js";import{g as l,i as a,b as p,P as h,a as d,c as v}from"./p-e23af70c.js";import{c}from"./p-07aeee89.js";import"./p-fc7d8c03.js";import"./p-dfe5a97d.js";import"./p-32cc2209.js";const u=({pin:n,selected:e})=>{const{primaryColor:o}=l(n);return i(t,null,p(n)&&i("div",{id:"pin-anchor",class:c("pin-anchor",{selected:e}),style:{background:o}}),a(n)&&i("vertex-viewer-icon",{name:"pin-fill",size:"lg",class:c("pin",{"pin-selected":e}),style:{color:o}}))};function w(i,t,n){const o=[{x:i.x+n.width/2,y:i.y},{x:i.x+n.width/2,y:i.y+n.height},{x:i.x,y:i.y+n.height/2},{x:i.x+n.width,y:i.y+n.height/2}],s=o.map((i=>e.distance(i,t)));return o[s.indexOf(Math.min(...s))]}const b=class{constructor(i){n(this,i),this.matrix=o.makeIdentity(),this.projectionViewMatrix=o.makeIdentity(),this.pinModel=new h,this.selected=!1,this.invalidateStateCounter=0,this.invalidateState=()=>{this.invalidateStateCounter=this.invalidateStateCounter+1}}componentDidLoad(){var i;this.setLabelObserver(),null==this.pinController&&(this.pinController=new d(this.pinModel)),this.selected&&(null===(i=this.labelEl)||void 0===i||i.setFocus())}disconnectedCallback(){var i,t;null===(i=this.labelEl)||void 0===i||i.removeEventListener("labelChanged",this.invalidateState),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}render(){var n;if(null==this.pin)throw new Error("Unable to draw pin");const{pinPoint:e,labelPoint:o}=this.computePinPoints(this.pin);return i(t,null,i("vertex-viewer-dom-element",{"data-testid":`drawn-pin-${this.pin.id}`,position:this.pin.worldPosition,onPointerDown:i=>{2!==i.buttons&&i.stopPropagation(),this.selectPin(),this.handleAnchorPointerDown()}},i(u,{pin:this.pin,selected:this.selected})),p(this.pin)&&i(t,null,i("vertex-viewer-pin-label-line",{id:`pin-label-line-${null===(n=this.pin)||void 0===n?void 0:n.id}`,pinPoint:e,pin:this.pin,labelPoint:o,onPointerDown:()=>this.selectPin()}),i("vertex-viewer-pin-label",{pin:this.pin,ref:i=>this.labelEl=i,elementBounds:this.elementBounds,pinController:this.pinController,onPointerDown:()=>this.selectPin()})))}setLabelObserver(){null!=this.labelEl&&(this.labelEl.addEventListener("labelChanged",this.invalidateState),this.resizeObserver=new ResizeObserver((()=>this.invalidateState())),this.resizeObserver.observe(this.labelEl))}computePinPoints(i){return null!=this.elementBounds&&null!=this.pin?p(this.pin)&&null!=this.pin.label.point?this.computeTextPinPoints(this.pin,this.elementBounds):this.computeDefaultPinPoints(this.pin,this.elementBounds):{pinPoint:i.worldPosition}}computeDefaultPinPoints(i,t){return{pinPoint:this.getFromWorldPosition(i.worldPosition,this.projectionViewMatrix,t)}}computeTextPinPoints(i,t){var n,e,o,s;const{pinPoint:r}=this.computeDefaultPinPoints(i,t);return{pinPoint:r,labelPoint:w(v(i.label.point,t),r,{width:(null===(e=null===(n=this.labelEl)||void 0===n?void 0:n.firstElementChild)||void 0===e?void 0:e.clientWidth)||0,height:(null===(s=null===(o=this.labelEl)||void 0===o?void 0:o.firstElementChild)||void 0===s?void 0:s.clientHeight)||0})}}handleAnchorPointerDown(){var i,t;null!=this.elementBounds&&"edit"===(null===(i=this.pinController)||void 0===i?void 0:i.getToolMode())&&null!=this.pin&&(null===(t=this.pinController)||void 0===t||t.setDraggable({id:this.pin.id}))}selectPin(){var i,t;null===(i=this.pinController)||void 0===i||i.setSelectedPinId(null===(t=this.pin)||void 0===t?void 0:t.id)}getFromWorldPosition(i,t,n){const e=s.transformMatrix(i,t);return r.fromDimensions(n).transformVectorToViewport(e)}};b.style=":host{--viewer-annotations-pin-primary-color:var(--blue-700);--viewer-annotations-pin-accent-color:var(--blue-200);--viewer-annotations-pin-dot-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-font-size:0.75rem;--viewer-annotations-pin-selected-stroke:var(--white);--viewer-annotations-pin-selected-border:2px solid var(--white);--viewer-annotations-pin-label-border:2px solid var(--black);--viewer-annotations-pin-selected-stroke:var(--white);font-size:var(--viewer-annotations-pin-font-size);position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.pin-anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block;width:9px;height:9px;box-sizing:border-box;border:var(--viewer-annotations-pin-label-border);background:var(--viewer-annotations-pin-dot-color);pointer-events:auto;cursor:pointer}.selected{width:13px;height:13px;border:var(--viewer-annotations-pin-selected-border)}.pin{color:var(--viewer-annotations-pin-color);cursor:pointer}.pin-selected{stroke-width:1;stroke:var(--viewer-annotations-pin-selected-stroke)}";export{b as vertex_viewer_pin_group}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import{r as t,h as o,H as e,g as s}from"./p-d6fce4c1.js";const r=class{constructor(o){t(this,o),this.stretchOff=!1}render(){return o(e,null,o("slot",null))}get hostEl(){return s(this)}};r.style=":host{pointer-events:none;overflow:hidden}:host(:not([stretch-off])){position:absolute;left:0;right:0;top:0;bottom:0}";export{r as vertex_viewer_layer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import{r as i,c as t,h as s,H as l,g as e}from"./p-d6fce4c1.js";import{c as n}from"./p-07aeee89.js";import"./p-dfe5a97d.js";const o=class{constructor(s){i(this,s),this.expandToggled=t(this,"expandToggled",7),this.visibilityToggled=t(this,"visibilityToggled",7),this.selectionToggled=t(this,"selectionToggled",7),this.placeholder="--",this.hovered=!1,this.displayValue=()=>null==this.value||""===this.value.trim()?this.placeholder:this.value,this.handleCellPointerEnter=()=>{var i,t,s;null===(i=this.hoverController)||void 0===i||i.setHovered(null===(s=null===(t=this.node)||void 0===t?void 0:t.id)||void 0===s?void 0:s.hex)},this.handleCellPointerLeave=()=>{var i;null===(i=this.hoverController)||void 0===i||i.setHovered(void 0)},this.handleCellPointerUp=i=>{this.isScrolling||null==this.node||null==this.tree||(null!=this.selectionHandler?this.selectionHandler(i,this.node,this.tree):this.performDefaultSelectionOperation(i),this.selectionToggled.emit({node:this.node,originalEvent:i}))},this.toggleExpansion=i=>{null!=this.tree&&null!=this.node&&(null!=this.expansionHandler?this.expansionHandler(i,this.node,this.tree):this.performDefaultExpansionOperation(this.node,this.tree),this.expandToggled.emit({node:this.node,originalEvent:i}))},this.toggleVisibility=i=>{null!=this.tree&&null!=this.node&&(null!=this.visibilityHandler?this.visibilityHandler(i,this.node,this.tree):this.performDefaultVisibilityOperation(this.node,this.tree),this.visibilityToggled.emit({node:this.node,originalEvent:i}))},this.performDefaultSelectionOperation=i=>{var t,s,l,e,n,o;i.defaultPrevented||0!==i.button||((i.ctrlKey||i.metaKey)&&(null===(t=this.node)||void 0===t?void 0:t.selected)?null===(s=this.tree)||void 0===s||s.deselectItem(this.node):(null===(l=this.node)||void 0===l?void 0:l.selected)?null===(e=this.tree)||void 0===e||e.selectItem(this.node,{recurseParent:!0}):(null===(n=this.node)||void 0===n?void 0:n.selected)||null===(o=this.tree)||void 0===o||o.selectItem(this.node,{append:i.ctrlKey||i.metaKey,range:i.shiftKey}))},this.performDefaultVisibilityOperation=(i,t)=>{t.toggleItemVisibility(i)},this.performDefaultExpansionOperation=(i,t)=>{t.toggleExpandItem(i)}}componentDidLoad(){var i;this.hoverListener=null===(i=this.hoverController)||void 0===i?void 0:i.stateChanged((i=>{var t,s;this.hovered=i===(null===(s=null===(t=this.node)||void 0===t?void 0:t.id)||void 0===s?void 0:s.hex)}))}disconnectedCallback(){var i;null===(i=this.hoverListener)||void 0===i||i.dispose()}componentWillRender(){var i,t,s,l,e;this.toggleAttribute("is-hovered",this.hovered),this.toggleAttribute("is-hidden",!(null===(i=this.node)||void 0===i?void 0:i.visible)),this.toggleAttribute("is-selected",!!(null===(t=this.node)||void 0===t?void 0:t.selected)),this.toggleAttribute("is-partial",!!(null===(s=this.node)||void 0===s?void 0:s.partiallyVisible)),this.toggleAttribute("is-leaf",!!(null===(l=this.node)||void 0===l?void 0:l.isLeaf)),this.toggleAttribute("is-filter-hit",!!(null===(e=this.node)||void 0===e?void 0:e.filterHit))}render(){var i,t,e,o,a,h,d,r,v,c,g,u;return s(l,{onPointerEnter:this.handleCellPointerEnter,onPointerLeave:this.handleCellPointerLeave,onPointerUp:this.handleCellPointerUp},s("div",{class:"wrapper"},s("div",{class:"no-shrink"},s("slot",{name:"left-gutter"})),this.expandToggle&&s("button",{class:"expand-btn no-shrink","data-test-id":"expand-"+(null===(i=this.node)||void 0===i?void 0:i.name),onPointerUp:i=>{i.preventDefault(),this.toggleExpansion(i)}},!(null===(t=this.node)||void 0===t?void 0:t.isLeaf)&&s("div",{class:n("icon",{"icon-expanded":!(null===(e=this.node)||void 0===e?void 0:e.isLeaf)&&(null===(o=this.node)||void 0===o?void 0:o.expanded),"icon-collapsed":!(null===(a=this.node)||void 0===a?void 0:a.isLeaf)&&!(null===(h=this.node)||void 0===h?void 0:h.expanded)})})),s("div",{class:"content"},null!=this.value&&""!==this.value.trim()?s("slot",null,this.displayValue()):s("slot",{name:"placeholder"},this.placeholder)),this.visibilityToggle&&s("button",{class:"visibility-btn no-shrink","data-test-id":"visibility-btn-"+(null===(d=this.node)||void 0===d?void 0:d.name),onPointerUp:i=>{null==i||i.preventDefault(),this.toggleVisibility(i)}},s("div",{class:n("icon",{"icon-visible":this.hovered&&!(null===(r=this.node)||void 0===r?void 0:r.partiallyVisible)&&(null===(v=this.node)||void 0===v?void 0:v.visible),"icon-hidden":!(null===(c=this.node)||void 0===c?void 0:c.partiallyVisible)&&!(null===(g=this.node)||void 0===g?void 0:g.visible),"icon-partial":null===(u=this.node)||void 0===u?void 0:u.partiallyVisible})})),s("div",{class:"no-shrink"},s("slot",{name:"right-gutter"})),!this.visibilityToggle&&s("div",{class:"column-spacer"})))}toggleAttribute(i,t){t?this.hostEl.setAttribute(i,""):this.hostEl.removeAttribute(i)}get hostEl(){return e(this)}};o.style="button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}:host{display:flex;align-items:center;box-sizing:border-box;--scene-tree-cell-background-hover:var(--blue-200);--scene-tree-cell-background-selected:var(--blue-300);--scene-tree-cell-text-positioning:left;--scene-tree-cell-padding:0.25rem 0}:host([is-hovered]){background:var(--scene-tree-cell-background-hover)}:host([is-selected]){background:var(--scene-tree-cell-background-selected)}.wrapper{display:flex;align-items:center;box-sizing:border-box;width:100%;height:100%;padding:var(--scene-tree-cell-padding)}.content{width:100%;text-align:var(--scene-tree-cell-text-positioning);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.column-spacer{width:var(--scene-tree-table-column-gap)}.expand-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;min-height:24px}.no-shrink{flex-shrink:0}:host([is-leaf]) .expand-btn{visibility:hidden;cursor:default}.visibility-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px}.icon{width:14px;height:14px}.icon-expanded{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M11.88,9.17l-3.5-4a.51.51,0,0,0-.76,0l-3.5,4A.5.5,0,0,0,4.5,10h7a.5.5,0,0,0,.38-.83Z' transform='rotate(180 8 8)' /%3E%3C/svg%3E\")}.icon-collapsed{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M10.83,7.62l-4-3.5A.5.5,0,0,0,6,4.5v7a.5.5,0,0,0,.83.38l4-3.5a.51.51,0,0,0,0-.76Z' /%3E%3C/svg%3E\")}.icon-visible{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M8 5a3 3 0 103 3 3 3 0 00-3-3zm4.65-1.17A8.53 8.53 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.57 6.57 0 002.84 4.06A8.53 8.53 0 008 13.5a8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.57 6.57 0 00-2.84-4.06zm-.55 7.5A7.52 7.52 0 018 12.5a7.52 7.52 0 01-4.1-1.17A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.52 7.52 0 014.1 1.17A5.49 5.49 0 0114.47 8a5.49 5.49 0 01-2.37 3.33z' /%3E%3C/svg%3E\")}.icon-hidden{background-image:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M13.35 2.65a.48.48 0 00-.7 0l-.78.77a8.71 8.71 0 00-8.52.41A6.57 6.57 0 00.51 7.89v.22a6.58 6.58 0 002.71 4l-.57.58a.49.49 0 00.7.7l10-10a.48.48 0 000-.74zM9.73 5.56a3 3 0 00-4.17 4.17l-1.62 1.62A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.67 7.67 0 013.12.67zm3.61-1.2l-.72.72A5.45 5.45 0 0114.47 8a5.49 5.49 0 01-2.37 3.33A7.52 7.52 0 018 12.5a8.15 8.15 0 01-2.41-.38l-.78.78a8.9 8.9 0 003.19.6 8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.56 6.56 0 00-2.15-3.53z' /%3E%3C/svg%3E%0A\")}.icon-partial{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M4.12 11.46A5.62 5.62 0 011.52 8 5.57 5.57 0 013.9 4.67 7.52 7.52 0 018 3.5a7.7 7.7 0 013.33.75l.74-.74A8.67 8.67 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.54 6.54 0 002.88 4.08z' fill='%23444'/%3E%3Cpath d='M8 5a3 3 0 00-3 3 3 3 0 00.69 1.89l4.2-4.2A3 3 0 008 5zM5.88 5.88zM9.2 12.41a.51.51 0 00-.42.57.5.5 0 00.56.42.5.5 0 00.43-.57.51.51 0 00-.57-.42zM6.77 12.41a.5.5 0 00-.57.42.49.49 0 00.41.57.5.5 0 10.15-1zM14.48 5.61a.5.5 0 00-.7-.12.49.49 0 00-.12.69.5.5 0 00.82-.57zM11.5 11.68a.5.5 0 00-.22.67.51.51 0 00.68.22.5.5 0 00-.46-.89zM15.07 7.77a.52.52 0 00-.62.35.51.51 0 00.35.62.5.5 0 00.61-.35.52.52 0 00-.34-.62zM13.36 10.21a.5.5 0 10.76.64.49.49 0 00-.06-.7.51.51 0 00-.7.06z' fill='%23444'/%3E%3C/svg%3E\")}";export{o as vertex_scene_tree_table_cell}
|