@vertexvis/viewer 0.24.4-canary.9 → 0.24.4

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.
Files changed (236) hide show
  1. package/README.template.md +6 -0
  2. package/dist/cjs/{cursors-2dfb0ef3.js → cursors-17ad74ac.js} +2 -2
  3. package/dist/cjs/{cursors-2dfb0ef3.js.map → cursors-17ad74ac.js.map} +1 -1
  4. package/dist/cjs/dom-fc408b4c.js.map +1 -1
  5. package/dist/cjs/{index-5fa5a527.js → index-0abd8b0b.js} +2 -2
  6. package/dist/cjs/index-0abd8b0b.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +2 -2
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js.map +1 -1
  10. package/dist/cjs/{queries-cf96c8bc.js → queries-4580caa5.js} +8 -2
  11. package/dist/cjs/queries-4580caa5.js.map +1 -0
  12. package/dist/cjs/{shadow-css-8962c4a9.js → shadow-css-37297ac8.js} +1 -1
  13. package/dist/cjs/shadow-css-37297ac8.js.map +1 -0
  14. package/dist/cjs/{stencil-a3f4e15b.js → stencil-40ef9119.js} +2 -2
  15. package/dist/cjs/{stencil-a3f4e15b.js.map → stencil-40ef9119.js.map} +1 -1
  16. package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +8 -2
  17. package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
  18. package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
  19. package/dist/cjs/vertex-scene-tree-table-column.cjs.entry.js +1 -1
  20. package/dist/cjs/vertex-scene-tree-table-header.cjs.entry.js +1 -1
  21. package/dist/cjs/vertex-scene-tree-table-resize-divider.cjs.entry.js +1 -1
  22. package/dist/cjs/vertex-scene-tree-toolbar-group.cjs.entry.js +1 -1
  23. package/dist/cjs/vertex-scene-tree.cjs.entry.js +1 -1
  24. package/dist/cjs/vertex-viewer-annotation-callout.cjs.entry.js +1 -1
  25. package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +2 -2
  26. package/dist/cjs/vertex-viewer-button_3.cjs.entry.js +1 -1
  27. package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js +1 -1
  28. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
  29. package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
  30. package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +2 -2
  31. package/dist/cjs/vertex-viewer-icon.cjs.entry.js +1 -1
  32. package/dist/cjs/vertex-viewer-layer.cjs.entry.js +1 -1
  33. package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +1 -1
  34. package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +1 -1
  35. package/dist/cjs/vertex-viewer-markup.cjs.entry.js +1 -1
  36. package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +1 -1
  37. package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +2 -2
  38. package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +1 -1
  39. package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +2 -2
  40. package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -3
  41. package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
  42. package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +2 -2
  43. package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +2 -2
  44. package/dist/cjs/vertex-viewer-spinner.cjs.entry.js +1 -1
  45. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +1 -1
  46. package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +2 -2
  47. package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +2 -2
  48. package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js +4 -4
  49. package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js.map +1 -1
  50. package/dist/cjs/vertex-viewer.cjs.entry.js +22 -11
  51. package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
  52. package/dist/cjs/viewer.cjs.js +1 -1
  53. package/dist/cjs/viewer.cjs.js.map +1 -1
  54. package/dist/collection/components/scene-tree-search/scene-tree-search.js +21 -1
  55. package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
  56. package/dist/collection/components/viewer/viewer.js +18 -7
  57. package/dist/collection/components/viewer/viewer.js.map +1 -1
  58. package/dist/collection/components/viewer-pin-group/viewer-pin-group.css +5 -0
  59. package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js +3 -3
  60. package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js.map +1 -1
  61. package/dist/collection/lib/cursors.js +1 -1
  62. package/dist/collection/lib/cursors.js.map +1 -1
  63. package/dist/collection/lib/model-views/controller.js +7 -1
  64. package/dist/collection/lib/model-views/controller.js.map +1 -1
  65. package/dist/collection/lib/stream/stream.js +4 -3
  66. package/dist/collection/lib/stream/stream.js.map +1 -1
  67. package/dist/collection/testing/viewer.js +1 -1
  68. package/dist/collection/testing/viewer.js.map +1 -1
  69. package/dist/components/cursors.js +1 -1
  70. package/dist/components/cursors.js.map +1 -1
  71. package/dist/components/queries.js +7 -1
  72. package/dist/components/queries.js.map +1 -1
  73. package/dist/components/scene-tree-search.js +6 -0
  74. package/dist/components/scene-tree-search.js.map +1 -1
  75. package/dist/components/vertex-viewer-walk-mode-tool.js +3 -3
  76. package/dist/components/vertex-viewer-walk-mode-tool.js.map +1 -1
  77. package/dist/components/vertex-viewer.js +18 -7
  78. package/dist/components/vertex-viewer.js.map +1 -1
  79. package/dist/components/viewer-pin-group.js +1 -1
  80. package/dist/components/viewer-pin-group.js.map +1 -1
  81. package/dist/esm/{cursors-9e349d61.js → cursors-3806bc04.js} +2 -2
  82. package/dist/esm/{cursors-9e349d61.js.map → cursors-3806bc04.js.map} +1 -1
  83. package/dist/esm/dom-dba69343.js.map +1 -1
  84. package/dist/esm/{index-f3e96c9e.js → index-c12dc0cd.js} +2 -2
  85. package/dist/esm/index-c12dc0cd.js.map +1 -0
  86. package/dist/esm/index.js +2 -2
  87. package/dist/esm/index.mjs +2 -2
  88. package/dist/esm/loader.js +1 -1
  89. package/dist/esm/loader.js.map +1 -1
  90. package/dist/esm/loader.mjs +1 -1
  91. package/dist/esm/{queries-2f4a492c.js → queries-948a88f9.js} +8 -2
  92. package/dist/esm/queries-948a88f9.js.map +1 -0
  93. package/dist/esm/{shadow-css-9363884b.js → shadow-css-d5069bdf.js} +1 -1
  94. package/dist/esm/shadow-css-d5069bdf.js.map +1 -0
  95. package/dist/esm/{stencil-9d9f090f.js → stencil-38b2fc28.js} +2 -2
  96. package/dist/esm/{stencil-9d9f090f.js.map → stencil-38b2fc28.js.map} +1 -1
  97. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +8 -2
  98. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
  99. package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
  100. package/dist/esm/vertex-scene-tree-table-column.entry.js +1 -1
  101. package/dist/esm/vertex-scene-tree-table-header.entry.js +1 -1
  102. package/dist/esm/vertex-scene-tree-table-resize-divider.entry.js +1 -1
  103. package/dist/esm/vertex-scene-tree-toolbar-group.entry.js +1 -1
  104. package/dist/esm/vertex-scene-tree.entry.js +1 -1
  105. package/dist/esm/vertex-viewer-annotation-callout.entry.js +1 -1
  106. package/dist/esm/vertex-viewer-box-query-tool.entry.js +2 -2
  107. package/dist/esm/vertex-viewer-button_3.entry.js +1 -1
  108. package/dist/esm/vertex-viewer-default-toolbar.entry.js +1 -1
  109. package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
  110. package/dist/esm/vertex-viewer-dom-group.entry.js +1 -1
  111. package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +2 -2
  112. package/dist/esm/vertex-viewer-icon.entry.js +1 -1
  113. package/dist/esm/vertex-viewer-layer.entry.js +1 -1
  114. package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +1 -1
  115. package/dist/esm/vertex-viewer-markup-tool.entry.js +1 -1
  116. package/dist/esm/vertex-viewer-markup.entry.js +1 -1
  117. package/dist/esm/vertex-viewer-measurement-details.entry.js +1 -1
  118. package/dist/esm/vertex-viewer-measurement-distance.entry.js +2 -2
  119. package/dist/esm/vertex-viewer-measurement-line_2.entry.js +1 -1
  120. package/dist/esm/vertex-viewer-measurement-precise.entry.js +2 -2
  121. package/dist/esm/vertex-viewer-pin-group.entry.js +3 -3
  122. package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
  123. package/dist/esm/vertex-viewer-pin-label_2.entry.js +2 -2
  124. package/dist/esm/vertex-viewer-pin-tool.entry.js +2 -2
  125. package/dist/esm/vertex-viewer-spinner.entry.js +1 -1
  126. package/dist/esm/vertex-viewer-teleport-tool.entry.js +1 -1
  127. package/dist/esm/vertex-viewer-transform-widget.entry.js +2 -2
  128. package/dist/esm/vertex-viewer-view-cube.entry.js +2 -2
  129. package/dist/esm/vertex-viewer-walk-mode-tool.entry.js +4 -4
  130. package/dist/esm/vertex-viewer-walk-mode-tool.entry.js.map +1 -1
  131. package/dist/esm/vertex-viewer.entry.js +22 -11
  132. package/dist/esm/vertex-viewer.entry.js.map +1 -1
  133. package/dist/esm/viewer.js +1 -1
  134. package/dist/esm/viewer.js.map +1 -1
  135. package/dist/types/components/scene-tree-search/scene-tree-search.d.ts +5 -1
  136. package/dist/types/components/viewer/viewer.d.ts +3 -2
  137. package/dist/types/components.d.ts +9 -5
  138. package/dist/types/lib/stream/stream.d.ts +1 -1
  139. package/dist/types/testing/viewer.d.ts +1 -1
  140. package/dist/viewer/index.esm.js +1 -1
  141. package/dist/viewer/{p-0e0973f0.entry.js → p-03efd0d6.entry.js} +2 -2
  142. package/dist/viewer/{p-7f0eeb06.entry.js → p-0988832f.entry.js} +2 -2
  143. package/dist/viewer/{p-78a1be4e.entry.js → p-0aa04328.entry.js} +2 -2
  144. package/dist/viewer/p-18ce3f3b.entry.js +5 -0
  145. package/dist/viewer/{p-9bb550e2.entry.js.map → p-18ce3f3b.entry.js.map} +1 -1
  146. package/dist/viewer/{p-2ecdcd5d.entry.js → p-23f0bb30.entry.js} +2 -2
  147. package/dist/viewer/{p-06b8bca7.entry.js → p-296311d3.entry.js} +2 -2
  148. package/dist/viewer/{p-2172230d.entry.js → p-2fd66679.entry.js} +2 -2
  149. package/dist/viewer/{p-5540add8.entry.js → p-362f3e12.entry.js} +2 -2
  150. package/dist/viewer/{p-110f66c6.js → p-388f809e.js} +2 -2
  151. package/dist/viewer/p-388f809e.js.map +1 -0
  152. package/dist/viewer/{p-48b63c5f.entry.js → p-45044ff2.entry.js} +2 -2
  153. package/dist/viewer/{p-9fc2e56e.entry.js → p-45b5b5ed.entry.js} +2 -2
  154. package/dist/viewer/{p-f79933ae.entry.js → p-4bd1ea70.entry.js} +2 -2
  155. package/dist/viewer/{p-842cc51b.entry.js → p-4bf16450.entry.js} +2 -2
  156. package/dist/viewer/{p-a057d7f2.entry.js → p-56fa8168.entry.js} +2 -2
  157. package/dist/viewer/{p-8c367e87.entry.js → p-59f204e7.entry.js} +2 -2
  158. package/dist/viewer/p-59f204e7.entry.js.map +1 -0
  159. package/dist/viewer/{p-33033b58.entry.js → p-6cf6eb8a.entry.js} +2 -2
  160. package/dist/viewer/p-715255e1.entry.js +5 -0
  161. package/dist/viewer/p-715255e1.entry.js.map +1 -0
  162. package/dist/viewer/{p-5f9352c0.entry.js → p-75f5ae33.entry.js} +2 -2
  163. package/dist/viewer/{p-7eea3fb3.entry.js → p-7a87ae97.entry.js} +2 -2
  164. package/dist/viewer/{p-22b42d4b.entry.js → p-86e1ee86.entry.js} +2 -2
  165. package/dist/viewer/p-89d93218.entry.js +5 -0
  166. package/dist/viewer/p-89d93218.entry.js.map +1 -0
  167. package/dist/viewer/{p-07325d65.entry.js → p-8c53ed63.entry.js} +2 -2
  168. package/dist/viewer/p-991f7bac.js.map +1 -1
  169. package/dist/viewer/{p-983db3dd.entry.js → p-a009c6d9.entry.js} +2 -2
  170. package/dist/viewer/{p-dcb64250.entry.js → p-a3bc0b79.entry.js} +2 -2
  171. package/dist/viewer/{p-29318a17.entry.js → p-aece4279.entry.js} +2 -2
  172. package/dist/viewer/{p-be257155.js → p-b8c0f6ff.js} +1 -1
  173. package/dist/viewer/p-b8c0f6ff.js.map +1 -0
  174. package/dist/viewer/p-bab8266e.js +5 -0
  175. package/dist/viewer/p-bab8266e.js.map +1 -0
  176. package/dist/viewer/{p-05562c21.entry.js → p-bcddbdb2.entry.js} +2 -2
  177. package/dist/viewer/{p-40e8a5ea.entry.js → p-c3b071a3.entry.js} +2 -2
  178. package/dist/viewer/{p-fbfa1e82.entry.js → p-cd3f0870.entry.js} +2 -2
  179. package/dist/viewer/{p-d2677c13.entry.js → p-d9e75269.entry.js} +2 -2
  180. package/dist/viewer/p-e1eaedd8.js +5 -0
  181. package/dist/viewer/{p-a27a9775.entry.js → p-e70e2c04.entry.js} +2 -2
  182. package/dist/viewer/{p-ffa8a2dd.entry.js → p-ebea8f56.entry.js} +2 -2
  183. package/dist/viewer/{p-342dac8b.js → p-eda9f5d4.js} +2 -2
  184. package/dist/viewer/{p-342dac8b.js.map → p-eda9f5d4.js.map} +1 -1
  185. package/dist/viewer/{p-9d54d593.entry.js → p-f292e8ae.entry.js} +2 -2
  186. package/dist/viewer/{p-d024c250.entry.js → p-f8a9c4d2.entry.js} +2 -2
  187. package/dist/viewer/viewer.esm.js +1 -1
  188. package/dist/viewer/viewer.esm.js.map +1 -1
  189. package/package.json +7 -7
  190. package/readme.md +10 -4
  191. package/dist/cjs/index-5fa5a527.js.map +0 -1
  192. package/dist/cjs/queries-cf96c8bc.js.map +0 -1
  193. package/dist/cjs/shadow-css-8962c4a9.js.map +0 -1
  194. package/dist/esm/index-f3e96c9e.js.map +0 -1
  195. package/dist/esm/queries-2f4a492c.js.map +0 -1
  196. package/dist/esm/shadow-css-9363884b.js.map +0 -1
  197. package/dist/viewer/p-04bf6b89.js +0 -5
  198. package/dist/viewer/p-110f66c6.js.map +0 -1
  199. package/dist/viewer/p-51eff23a.entry.js +0 -5
  200. package/dist/viewer/p-51eff23a.entry.js.map +0 -1
  201. package/dist/viewer/p-629a5ae7.entry.js +0 -5
  202. package/dist/viewer/p-629a5ae7.entry.js.map +0 -1
  203. package/dist/viewer/p-8c367e87.entry.js.map +0 -1
  204. package/dist/viewer/p-9bb550e2.entry.js +0 -5
  205. package/dist/viewer/p-b2e80d7f.js +0 -5
  206. package/dist/viewer/p-b2e80d7f.js.map +0 -1
  207. package/dist/viewer/p-be257155.js.map +0 -1
  208. /package/dist/viewer/{p-0e0973f0.entry.js.map → p-03efd0d6.entry.js.map} +0 -0
  209. /package/dist/viewer/{p-7f0eeb06.entry.js.map → p-0988832f.entry.js.map} +0 -0
  210. /package/dist/viewer/{p-78a1be4e.entry.js.map → p-0aa04328.entry.js.map} +0 -0
  211. /package/dist/viewer/{p-2ecdcd5d.entry.js.map → p-23f0bb30.entry.js.map} +0 -0
  212. /package/dist/viewer/{p-06b8bca7.entry.js.map → p-296311d3.entry.js.map} +0 -0
  213. /package/dist/viewer/{p-2172230d.entry.js.map → p-2fd66679.entry.js.map} +0 -0
  214. /package/dist/viewer/{p-5540add8.entry.js.map → p-362f3e12.entry.js.map} +0 -0
  215. /package/dist/viewer/{p-48b63c5f.entry.js.map → p-45044ff2.entry.js.map} +0 -0
  216. /package/dist/viewer/{p-9fc2e56e.entry.js.map → p-45b5b5ed.entry.js.map} +0 -0
  217. /package/dist/viewer/{p-f79933ae.entry.js.map → p-4bd1ea70.entry.js.map} +0 -0
  218. /package/dist/viewer/{p-842cc51b.entry.js.map → p-4bf16450.entry.js.map} +0 -0
  219. /package/dist/viewer/{p-a057d7f2.entry.js.map → p-56fa8168.entry.js.map} +0 -0
  220. /package/dist/viewer/{p-33033b58.entry.js.map → p-6cf6eb8a.entry.js.map} +0 -0
  221. /package/dist/viewer/{p-5f9352c0.entry.js.map → p-75f5ae33.entry.js.map} +0 -0
  222. /package/dist/viewer/{p-7eea3fb3.entry.js.map → p-7a87ae97.entry.js.map} +0 -0
  223. /package/dist/viewer/{p-22b42d4b.entry.js.map → p-86e1ee86.entry.js.map} +0 -0
  224. /package/dist/viewer/{p-07325d65.entry.js.map → p-8c53ed63.entry.js.map} +0 -0
  225. /package/dist/viewer/{p-983db3dd.entry.js.map → p-a009c6d9.entry.js.map} +0 -0
  226. /package/dist/viewer/{p-dcb64250.entry.js.map → p-a3bc0b79.entry.js.map} +0 -0
  227. /package/dist/viewer/{p-29318a17.entry.js.map → p-aece4279.entry.js.map} +0 -0
  228. /package/dist/viewer/{p-05562c21.entry.js.map → p-bcddbdb2.entry.js.map} +0 -0
  229. /package/dist/viewer/{p-40e8a5ea.entry.js.map → p-c3b071a3.entry.js.map} +0 -0
  230. /package/dist/viewer/{p-fbfa1e82.entry.js.map → p-cd3f0870.entry.js.map} +0 -0
  231. /package/dist/viewer/{p-d2677c13.entry.js.map → p-d9e75269.entry.js.map} +0 -0
  232. /package/dist/viewer/{p-04bf6b89.js.map → p-e1eaedd8.js.map} +0 -0
  233. /package/dist/viewer/{p-a27a9775.entry.js.map → p-e70e2c04.entry.js.map} +0 -0
  234. /package/dist/viewer/{p-ffa8a2dd.entry.js.map → p-ebea8f56.entry.js.map} +0 -0
  235. /package/dist/viewer/{p-9d54d593.entry.js.map → p-f292e8ae.entry.js.map} +0 -0
  236. /package/dist/viewer/{p-d024c250.entry.js.map → p-f8a9c4d2.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{r as i,c as t,h as n,H as e,g as o}from"./p-110f66c6.js";import{p as a}from"./p-9d26f24e.js";import{c as s}from"./p-92793987.js";import{g as r}from"./p-95f6305a.js";import{t as l,c as h,a as d,P as v,g as p,b}from"./p-4637d762.js";import{r as c}from"./p-04bf6b89.js";import"./p-e5cc48b6.js";import"./p-6b00f7cd.js";function u(i){return window.getComputedStyle(i)}const w=":host{--viewer-annotations-pin-label-background-color:var(--viewer-annotations-pin-accent-color);--viewer-annotations-pin-label-border-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-focused-border-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-color:var(--white);--viewer-annotations-pin-label-padding-y:0.375em;--viewer-annotations-pin-label-padding-x:0.5em;--viewer-annotations-pin-label-border-width:2px;--viewer-annotations-pin-label-border-style:solid;--viewer-annotations-pin-label-border-radius:0.25em;--viewer-annotations-pin-label-min-width:2rem;--viewer-annotations-pin-label-max-width:25rem;--viewer-annotations-pin-label-max-height:50rem;overflow:hidden;pointer-events:none}:host([mode='']) .pin-label{color:var(--viewer-annotations-pin-label-color);background:var(--viewer-annotations-pin-label-background-color)}.pin-label-text{font-family:Arial, Helvetica, sans-serif;font-size:0.875rem;line-height:1rem;word-break:break-word;white-space:pre-wrap}.pin-label-input-wrapper{display:flex;position:absolute;pointer-events:auto;box-sizing:border-box;min-width:var(--viewer-annotations-pin-label-min-width);max-width:var(--viewer-annotations-pin-label-max-width);max-height:var(--viewer-annotations-pin-label-max-height);background:var(--viewer-annotations-pin-label-background-color);border-width:var(--viewer-annotations-pin-label-border-width);border-style:var(--viewer-annotations-pin-label-border-style);border-color:var(--viewer-annotations-pin-label-border-color);border-radius:var(--viewer-annotations-pin-label-border-radius)}.pin-label-input-wrapper.focused{min-width:var(--viewer-annotations-pin-label-max-width);border-color:var(--viewer-annotations-pin-label-focused-border-color)}.pin-input-drag-target{position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer}.pin-label-input{resize:none;position:relative;outline:none;border:none;word-break:break-word;padding:0 0 0 0;background-color:transparent;margin:var(--viewer-annotations-pin-label-padding-y) var(--viewer-annotations-pin-label-padding-x);width:var(--viewer-annotations-pin-label-min-width);flex-grow:1;overflow:hidden;max-width:calc(var(--viewer-annotations-pin-label-max-width) - calc(2 * var(--viewer-annotations-pin-label-padding-x)))}.pin-label-input.readonly{pointer-events:auto;color:black;cursor:pointer}.pin-label-hidden{position:absolute;visibility:hidden;pointer-events:none;width:auto;height:auto;box-sizing:border-box;border-width:var(--viewer-annotations-pin-label-border-width);border-style:var(--viewer-annotations-pin-label-border-style);border-color:var(--viewer-annotations-pin-label-border-color);margin:var(--viewer-annotations-pin-label-padding-y) 0;padding:0 var(--viewer-annotations-pin-label-padding-x);max-width:calc(var(--viewer-annotations-pin-label-max-width) - calc(2 * var(--viewer-annotations-pin-label-padding-x)))}";const m=class{constructor(n){i(this,n);this.labelChanged=t(this,"labelChanged",7);this.labelFocused=t(this,"labelFocused",7);this.labelBlurred=t(this,"labelBlurred",7);this.focused=false;this.textareaRows=1;this.computeContentSize=()=>{c((()=>{if(this.contentEl!=null){this.contentElBounds=this.contentEl.getBoundingClientRect();const i=u(this.contentEl);this.textareaRows=Math.max(1,Math.ceil((parseFloat(i.getPropertyValue("height"))-parseFloat(i.getPropertyValue("borderWidth"))*2)/parseFloat(i.getPropertyValue("lineHeight"))))}}))};this.handleInputKeyDown=i=>{i.stopPropagation();if(i.key==="Enter"&&(i.ctrlKey||i.metaKey||i.shiftKey)){this.textareaRows+=1;this.value+="\n"}else if(i.key==="Enter"){i.preventDefault();this.submit()}};this.handlePointerDown=i=>{var t;if(!this.focused){if(this.elementBounds!=null){if(i.buttons!==2){i.preventDefault();i.stopPropagation()}this.relativePointerDownPosition=l(r(i,this.elementBounds),this.elementBounds);this.pinPointerDownPosition=(t=this.pin)===null||t===void 0?void 0:t.label.point;window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}}};this.handlePointerMove=i=>{var t;if(this.elementBounds!=null&&this.relativePointerDownPosition&&this.pinPointerDownPosition!=null){i.preventDefault();i.stopPropagation();const n=r(i,this.elementBounds);const e=l(n,this.elementBounds);const o=a.subtract(e,this.relativePointerDownPosition);const s=this.pin!=null?Object.assign(Object.assign({},this.pin),{label:Object.assign(Object.assign({},this.pin.label),{point:a.add(this.pinPointerDownPosition,o)})}):undefined;if(s){(t=this.pinController)===null||t===void 0?void 0:t.updatePin(s);this.computeScreenPosition()}}};this.handlePointerUp=i=>{var t,n;if(((t=this.pinController)===null||t===void 0?void 0:t.getToolMode())==="edit"&&this.relativePointerDownPosition!=null&&this.elementBounds!=null){const t=h(this.relativePointerDownPosition,this.elementBounds);const e=a.distance(t,r(i,this.elementBounds));if(e<=2){this.focused=true;this.labelFocused.emit((n=this.pin)===null||n===void 0?void 0:n.id)}}this.relativePointerDownPosition=undefined;this.pinPointerDownPosition=undefined;window.removeEventListener("pointermove",this.handlePointerMove);window.removeEventListener("pointerup",this.handlePointerUp)};this.handleTextBlur=()=>{this.submit()};this.handleTextInput=i=>{const t=i.target;this.value=t.value};this.value=this.getPinText()}async setFocus(){var i,t,n;if(typeof((i=this.inputEl)===null||i===void 0?void 0:i.focus)==="function"){this.focused=true;this.labelFocused.emit((t=this.pin)===null||t===void 0?void 0:t.id);(n=this.inputEl)===null||n===void 0?void 0:n.focus()}}async submit(){var i,t;this.focused=false;this.labelBlurred.emit((i=this.pin)===null||i===void 0?void 0:i.id);if(this.pin!=null){(t=this.pinController)===null||t===void 0?void 0:t.updatePin(Object.assign(Object.assign({},this.pin),{label:{point:this.pin.label.point,text:this.value}}))}}watchFocusChange(){var i,t;this.labelChanged.emit();if(this.focused){(i=this.pinController)===null||i===void 0?void 0:i.setSelectedPinId((t=this.pin)===null||t===void 0?void 0:t.id)}}watchPinChange(){this.value=this.getPinText();this.computeScreenPosition()}watchElementBoundsChange(){this.computeScreenPosition()}componentWillLoad(){this.computeScreenPosition()}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>{this.labelChanged.emit()}));this.contentResizeObserver=new ResizeObserver(this.computeContentSize);if(this.hostEl!=null){this.resizeObserver.observe(this.hostEl)}if(this.contentEl!=null){this.contentResizeObserver.observe(this.contentEl)}if(this.pinController==null){this.pinController=new d(new v)}}disconnectedCallback(){var i,t;(i=this.resizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.contentResizeObserver)===null||t===void 0?void 0:t.disconnect()}componentDidRender(){if(this.focused&&this.inputEl!=null){this.setFocus()}}render(){var i,t,o;const{primaryColor:a,accentColor:r}=p(this.pin);return n(e,null,n("div",{class:s("pin-label-input-wrapper",{focused:this.focused}),onPointerDown:this.handlePointerDown,style:{top:`${((i=this.computedScreenPosition)===null||i===void 0?void 0:i.y.toString())||0}px`,left:`${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.x.toString())||0}px`,minWidth:this.computeMinWidth(),maxWidth:this.computeMaxWidth(),maxHeight:this.computeMaxHeight(),borderColor:a,background:r}},n("textarea",{id:`pin-label-input-${(o=this.pin)===null||o===void 0?void 0:o.id}`,class:s("pin-label-input","pin-label-text",{["readonly"]:!this.focused}),disabled:!this.focused,ref:i=>this.inputEl=i,value:this.value,rows:this.textareaRows,onKeyDown:this.handleInputKeyDown,onInput:this.handleTextInput,onBlur:this.handleTextBlur}),!this.focused&&n("div",{class:"pin-input-drag-target",onPointerDown:this.handlePointerDown})),n("div",{ref:i=>this.contentEl=i,class:s("pin-label-text","pin-label-hidden"),style:{maxWidth:this.computeMaxWidth(),maxHeight:this.computeMaxHeight()}},this.hiddenContent()))}hiddenContent(){return this.value.includes("\n")?this.value.split("\n").reduce(((i,t)=>[...i,t,n("br",null)]),[]):[this.value]}computeMinWidth(){if(this.contentElBounds!=null){const i=`${this.contentElBounds.width+8}px`;return`min(${i}, ${this.computeMaxWidth()})`}else{return`var(--viewer-annotations-pin-label-min-width)`}}computeMaxWidth(){const i=`var(--viewer-annotations-pin-label-max-width)`;return`min(${i}, ${this.computeRemainingWidth()})`}computeMaxHeight(){const i=`var(--viewer-annotations-pin-label-max-height)`;return`min(${i}, ${this.computeRemainingHeight()})`}computeRemainingWidth(){var i,t;return`calc(${((i=this.elementBounds)===null||i===void 0?void 0:i.width.toString())||0}px - ${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.x.toString())||0}px)`}computeRemainingHeight(){var i,t;return`calc(${((i=this.elementBounds)===null||i===void 0?void 0:i.height.toString())||0}px - ${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.y.toString())||0}px)`}getPinText(){var i;if(((i=this.pin)===null||i===void 0?void 0:i.label.text)!=null){this.value=this.pin.label.text}else{this.value=""}return this.value}computeScreenPosition(){this.computedScreenPosition=b(this.pin)&&this.elementBounds!=null&&this.pin.label.point!=null?h(this.pin.label.point,this.elementBounds):undefined}get hostEl(){return o(this)}static get watchers(){return{focused:["watchFocusChange"],pin:["watchPinChange"],elementBounds:["watchElementBoundsChange"]}}};m.style=w;const f=":host{--viewer-annotations-pin-label-line-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-line-width:1;overflow:hidden;pointer-events:none}.label-line{pointer-events:auto;stroke:var(--viewer-annotations-pin-label-line-color);stroke-width:var( --viewer-annotations-pin-label-line-width);cursor:default}.svg{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;height:100%;width:100%}";const g=class{constructor(t){i(this,t)}render(){var i,t,o,a;const{primaryColor:s}=p(this.pin);return n(e,null,n("svg",{class:"svg"},n("line",{class:"label-line",style:{stroke:s},x1:(i=this.labelPoint)===null||i===void 0?void 0:i.x,y1:(t=this.labelPoint)===null||t===void 0?void 0:t.y,x2:(o=this.pinPoint)===null||o===void 0?void 0:o.x,y2:(a=this.pinPoint)===null||a===void 0?void 0:a.y})))}};g.style=f;export{m as vertex_viewer_pin_label,g as vertex_viewer_pin_label_line};
5
- //# sourceMappingURL=p-7eea3fb3.entry.js.map
4
+ import{r as i,c as t,h as n,H as e,g as o}from"./p-388f809e.js";import{p as a}from"./p-9d26f24e.js";import{c as s}from"./p-92793987.js";import{g as r}from"./p-95f6305a.js";import{t as l,c as h,a as d,P as v,g as p,b}from"./p-4637d762.js";import{r as c}from"./p-e1eaedd8.js";import"./p-e5cc48b6.js";import"./p-6b00f7cd.js";function u(i){return window.getComputedStyle(i)}const w=":host{--viewer-annotations-pin-label-background-color:var(--viewer-annotations-pin-accent-color);--viewer-annotations-pin-label-border-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-focused-border-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-color:var(--white);--viewer-annotations-pin-label-padding-y:0.375em;--viewer-annotations-pin-label-padding-x:0.5em;--viewer-annotations-pin-label-border-width:2px;--viewer-annotations-pin-label-border-style:solid;--viewer-annotations-pin-label-border-radius:0.25em;--viewer-annotations-pin-label-min-width:2rem;--viewer-annotations-pin-label-max-width:25rem;--viewer-annotations-pin-label-max-height:50rem;overflow:hidden;pointer-events:none}:host([mode='']) .pin-label{color:var(--viewer-annotations-pin-label-color);background:var(--viewer-annotations-pin-label-background-color)}.pin-label-text{font-family:Arial, Helvetica, sans-serif;font-size:0.875rem;line-height:1rem;word-break:break-word;white-space:pre-wrap}.pin-label-input-wrapper{display:flex;position:absolute;pointer-events:auto;box-sizing:border-box;min-width:var(--viewer-annotations-pin-label-min-width);max-width:var(--viewer-annotations-pin-label-max-width);max-height:var(--viewer-annotations-pin-label-max-height);background:var(--viewer-annotations-pin-label-background-color);border-width:var(--viewer-annotations-pin-label-border-width);border-style:var(--viewer-annotations-pin-label-border-style);border-color:var(--viewer-annotations-pin-label-border-color);border-radius:var(--viewer-annotations-pin-label-border-radius)}.pin-label-input-wrapper.focused{min-width:var(--viewer-annotations-pin-label-max-width);border-color:var(--viewer-annotations-pin-label-focused-border-color)}.pin-input-drag-target{position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer}.pin-label-input{resize:none;position:relative;outline:none;border:none;word-break:break-word;padding:0 0 0 0;background-color:transparent;margin:var(--viewer-annotations-pin-label-padding-y) var(--viewer-annotations-pin-label-padding-x);width:var(--viewer-annotations-pin-label-min-width);flex-grow:1;overflow:hidden;max-width:calc(var(--viewer-annotations-pin-label-max-width) - calc(2 * var(--viewer-annotations-pin-label-padding-x)))}.pin-label-input.readonly{pointer-events:auto;color:black;cursor:pointer}.pin-label-hidden{position:absolute;visibility:hidden;pointer-events:none;width:auto;height:auto;box-sizing:border-box;border-width:var(--viewer-annotations-pin-label-border-width);border-style:var(--viewer-annotations-pin-label-border-style);border-color:var(--viewer-annotations-pin-label-border-color);margin:var(--viewer-annotations-pin-label-padding-y) 0;padding:0 var(--viewer-annotations-pin-label-padding-x);max-width:calc(var(--viewer-annotations-pin-label-max-width) - calc(2 * var(--viewer-annotations-pin-label-padding-x)))}";const m=class{constructor(n){i(this,n);this.labelChanged=t(this,"labelChanged",7);this.labelFocused=t(this,"labelFocused",7);this.labelBlurred=t(this,"labelBlurred",7);this.focused=false;this.textareaRows=1;this.computeContentSize=()=>{c((()=>{if(this.contentEl!=null){this.contentElBounds=this.contentEl.getBoundingClientRect();const i=u(this.contentEl);this.textareaRows=Math.max(1,Math.ceil((parseFloat(i.getPropertyValue("height"))-parseFloat(i.getPropertyValue("borderWidth"))*2)/parseFloat(i.getPropertyValue("lineHeight"))))}}))};this.handleInputKeyDown=i=>{i.stopPropagation();if(i.key==="Enter"&&(i.ctrlKey||i.metaKey||i.shiftKey)){this.textareaRows+=1;this.value+="\n"}else if(i.key==="Enter"){i.preventDefault();this.submit()}};this.handlePointerDown=i=>{var t;if(!this.focused){if(this.elementBounds!=null){if(i.buttons!==2){i.preventDefault();i.stopPropagation()}this.relativePointerDownPosition=l(r(i,this.elementBounds),this.elementBounds);this.pinPointerDownPosition=(t=this.pin)===null||t===void 0?void 0:t.label.point;window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}}};this.handlePointerMove=i=>{var t;if(this.elementBounds!=null&&this.relativePointerDownPosition&&this.pinPointerDownPosition!=null){i.preventDefault();i.stopPropagation();const n=r(i,this.elementBounds);const e=l(n,this.elementBounds);const o=a.subtract(e,this.relativePointerDownPosition);const s=this.pin!=null?Object.assign(Object.assign({},this.pin),{label:Object.assign(Object.assign({},this.pin.label),{point:a.add(this.pinPointerDownPosition,o)})}):undefined;if(s){(t=this.pinController)===null||t===void 0?void 0:t.updatePin(s);this.computeScreenPosition()}}};this.handlePointerUp=i=>{var t,n;if(((t=this.pinController)===null||t===void 0?void 0:t.getToolMode())==="edit"&&this.relativePointerDownPosition!=null&&this.elementBounds!=null){const t=h(this.relativePointerDownPosition,this.elementBounds);const e=a.distance(t,r(i,this.elementBounds));if(e<=2){this.focused=true;this.labelFocused.emit((n=this.pin)===null||n===void 0?void 0:n.id)}}this.relativePointerDownPosition=undefined;this.pinPointerDownPosition=undefined;window.removeEventListener("pointermove",this.handlePointerMove);window.removeEventListener("pointerup",this.handlePointerUp)};this.handleTextBlur=()=>{this.submit()};this.handleTextInput=i=>{const t=i.target;this.value=t.value};this.value=this.getPinText()}async setFocus(){var i,t,n;if(typeof((i=this.inputEl)===null||i===void 0?void 0:i.focus)==="function"){this.focused=true;this.labelFocused.emit((t=this.pin)===null||t===void 0?void 0:t.id);(n=this.inputEl)===null||n===void 0?void 0:n.focus()}}async submit(){var i,t;this.focused=false;this.labelBlurred.emit((i=this.pin)===null||i===void 0?void 0:i.id);if(this.pin!=null){(t=this.pinController)===null||t===void 0?void 0:t.updatePin(Object.assign(Object.assign({},this.pin),{label:{point:this.pin.label.point,text:this.value}}))}}watchFocusChange(){var i,t;this.labelChanged.emit();if(this.focused){(i=this.pinController)===null||i===void 0?void 0:i.setSelectedPinId((t=this.pin)===null||t===void 0?void 0:t.id)}}watchPinChange(){this.value=this.getPinText();this.computeScreenPosition()}watchElementBoundsChange(){this.computeScreenPosition()}componentWillLoad(){this.computeScreenPosition()}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>{this.labelChanged.emit()}));this.contentResizeObserver=new ResizeObserver(this.computeContentSize);if(this.hostEl!=null){this.resizeObserver.observe(this.hostEl)}if(this.contentEl!=null){this.contentResizeObserver.observe(this.contentEl)}if(this.pinController==null){this.pinController=new d(new v)}}disconnectedCallback(){var i,t;(i=this.resizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.contentResizeObserver)===null||t===void 0?void 0:t.disconnect()}componentDidRender(){if(this.focused&&this.inputEl!=null){this.setFocus()}}render(){var i,t,o;const{primaryColor:a,accentColor:r}=p(this.pin);return n(e,null,n("div",{class:s("pin-label-input-wrapper",{focused:this.focused}),onPointerDown:this.handlePointerDown,style:{top:`${((i=this.computedScreenPosition)===null||i===void 0?void 0:i.y.toString())||0}px`,left:`${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.x.toString())||0}px`,minWidth:this.computeMinWidth(),maxWidth:this.computeMaxWidth(),maxHeight:this.computeMaxHeight(),borderColor:a,background:r}},n("textarea",{id:`pin-label-input-${(o=this.pin)===null||o===void 0?void 0:o.id}`,class:s("pin-label-input","pin-label-text",{["readonly"]:!this.focused}),disabled:!this.focused,ref:i=>this.inputEl=i,value:this.value,rows:this.textareaRows,onKeyDown:this.handleInputKeyDown,onInput:this.handleTextInput,onBlur:this.handleTextBlur}),!this.focused&&n("div",{class:"pin-input-drag-target",onPointerDown:this.handlePointerDown})),n("div",{ref:i=>this.contentEl=i,class:s("pin-label-text","pin-label-hidden"),style:{maxWidth:this.computeMaxWidth(),maxHeight:this.computeMaxHeight()}},this.hiddenContent()))}hiddenContent(){return this.value.includes("\n")?this.value.split("\n").reduce(((i,t)=>[...i,t,n("br",null)]),[]):[this.value]}computeMinWidth(){if(this.contentElBounds!=null){const i=`${this.contentElBounds.width+8}px`;return`min(${i}, ${this.computeMaxWidth()})`}else{return`var(--viewer-annotations-pin-label-min-width)`}}computeMaxWidth(){const i=`var(--viewer-annotations-pin-label-max-width)`;return`min(${i}, ${this.computeRemainingWidth()})`}computeMaxHeight(){const i=`var(--viewer-annotations-pin-label-max-height)`;return`min(${i}, ${this.computeRemainingHeight()})`}computeRemainingWidth(){var i,t;return`calc(${((i=this.elementBounds)===null||i===void 0?void 0:i.width.toString())||0}px - ${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.x.toString())||0}px)`}computeRemainingHeight(){var i,t;return`calc(${((i=this.elementBounds)===null||i===void 0?void 0:i.height.toString())||0}px - ${((t=this.computedScreenPosition)===null||t===void 0?void 0:t.y.toString())||0}px)`}getPinText(){var i;if(((i=this.pin)===null||i===void 0?void 0:i.label.text)!=null){this.value=this.pin.label.text}else{this.value=""}return this.value}computeScreenPosition(){this.computedScreenPosition=b(this.pin)&&this.elementBounds!=null&&this.pin.label.point!=null?h(this.pin.label.point,this.elementBounds):undefined}get hostEl(){return o(this)}static get watchers(){return{focused:["watchFocusChange"],pin:["watchPinChange"],elementBounds:["watchElementBoundsChange"]}}};m.style=w;const f=":host{--viewer-annotations-pin-label-line-color:var(--viewer-annotations-pin-primary-color);--viewer-annotations-pin-label-line-width:1;overflow:hidden;pointer-events:none}.label-line{pointer-events:auto;stroke:var(--viewer-annotations-pin-label-line-color);stroke-width:var( --viewer-annotations-pin-label-line-width);cursor:default}.svg{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;height:100%;width:100%}";const g=class{constructor(t){i(this,t)}render(){var i,t,o,a;const{primaryColor:s}=p(this.pin);return n(e,null,n("svg",{class:"svg"},n("line",{class:"label-line",style:{stroke:s},x1:(i=this.labelPoint)===null||i===void 0?void 0:i.x,y1:(t=this.labelPoint)===null||t===void 0?void 0:t.y,x2:(o=this.pinPoint)===null||o===void 0?void 0:o.x,y2:(a=this.pinPoint)===null||a===void 0?void 0:a.y})))}};g.style=f;export{m as vertex_viewer_pin_label,g as vertex_viewer_pin_label_line};
5
+ //# sourceMappingURL=p-7a87ae97.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{h as e,F as t,r as i,c as s,f as n,H as o,g as r}from"./p-110f66c6.js";import{x as a}from"./p-9d26f24e.js";import{a as l,w as d,S as c,b as h,c as u}from"./p-f8951894.js";import{p as v}from"./p-635347ea.js";import{i as f}from"./p-992ec5f0.js";import{g as p}from"./p-490d9553.js";import{i as w}from"./p-e4f95584.js";import{S as m}from"./p-adf28726.js";import"./p-5ca72d4a.js";import"./p-e5cc48b6.js";import"./p-ba120f65.js";import"./p-6b00f7cd.js";import"./p-f49b5881.js";import"./p-e656bd4c.js";import"./p-3060996e.js";import"./p-0d971ad6.js";window.requestIdleCallback=window.requestIdleCallback||function(e){var t=Date.now();return setTimeout((function(){e({didTimeout:false,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1)};window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)};const y=({details:i},s)=>e("div",{class:"error"},e("div",{class:"error-section error-message"},e("span",null,i.message),i.link&&e(t,null,e("span",null," See our "),e("a",{href:i.link,target:"_blank"},"documentation")," ",e("span",null," for more information."))),e("div",{class:"error-section"},s));const b=500;async function g(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).show())).execute({suppliedCorrelationId:i})}async function x(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).hide())).execute({suppliedCorrelationId:i})}async function C(e,t,{append:i=false,suppliedCorrelationId:s}){const n=await e.scene();return n.elements((e=>[...i?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withItemId(t))).select()])).execute({suppliedCorrelationId:s})}async function I(e,t,i,{append:s=true,suppliedCorrelationId:n}){const o=await e.scene();return o.elements((e=>[...s?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withSceneTreeRange({start:t,end:i}))).select()])).execute({suppliedCorrelationId:n})}async function R(e,t,i,s,n,{append:o=false,suppliedCorrelationId:r}){const a=await e.scene();return a.elements((e=>[...o?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withMetadata(t,i,s,n))).select()])).execute({suppliedCorrelationId:r})}async function j(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).deselect())).execute({suppliedCorrelationId:i})}async function E(e,t,{suppliedCorrelationId:i,animationDurationMs:s}={}){const n=await e.scene();await n.elements((e=>[e.items.where((e=>e.all())).hide(),e.items.where((e=>e.withItemId(t))).show()])).execute({suppliedCorrelationId:i});const o=await n.camera().flyTo((e=>e.withItemId(t))).render({animation:{milliseconds:s!==null&&s!==void 0?s:b}});await o.onAnimationCompleted.once()}const M="button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}:host{--scene-tree-toolbar-separator:1px solid var(--neutral-300);--scene-tree-default-font-family:unset;--scene-tree-default-font-size:unset;--scene-tree-default-font-color:unset;--scene-tree-secondary-font-color:unset;--scene-tree-selected-row-background-color:unset;--scene-tree-hovered-row-background-color:unset;--scene-tree-row-background-color:unset;--scene-tree-row-background-color-depth-n:unset;--scene-tree-overlay-z-index:3000;width:300px;height:100%;user-select:none;-webkit-user-select:none;cursor:default;display:flex;flex-direction:column;position:relative}.rows-scroll{position:relative;height:var(--scene-tree-row-height, 0);flex-grow:1}.rows{position:relative}.row{position:absolute;display:flex;align-items:center;width:100%;height:var(--scene-tree-row-height);padding:var(--scene-tree-row-padding);box-sizing:border-box}.row:hover{background-color:var(--scene-tree-row-hover-color)}.row.is-selected{background-color:var(--scene-tree-row-selected-color)}.expand-toggle{cursor:pointer;width:16px}.row-text{margin-left:0.25rem;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.visibility-btn{display:flex;align-items:center;visibility:hidden;padding:4px}.visibility-btn.is-hidden{visibility:visible}.row:hover .visibility-btn{visibility:visible}.error,.empty-results{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;font-size:0.875rem;width:100%;height:100%;padding:1rem;box-sizing:border-box;justify-content:center;background-color:white;z-index:var(--scene-tree-overlay-z-index)}.error-section{margin-top:1rem}.error-message{text-align:center}.search-toolbar,slot[name='header']::slotted(*){border-bottom:var(--scene-tree-toolbar-separator)}slot[name='footer']::slotted(:not(:last-child)){border-top:var(--scene-tree-toolbar-separator)}.header{display:flex;flex-direction:column}.footer{display:flex;flex-direction:column}.loading{position:absolute;top:150px;left:50%;transform:translate(-50%, -50%);text-align:center}";const k=25;const S=class{constructor(e){i(this,e);this.connectionError=s(this,"connectionError",7);this.firstRowRendered=s(this,"firstRowRendered",7);this.overScanCount=25;this.configEnv="platprod";this.searchOptions={};this.metadataSearchExactMatch=false;this.metadataSearchKeys=[];this.metadataKeys=[];this.operationAnimationDuration=500;this.rows=[];this.totalRows=0;this.showLoader=false;this.showEmptyResults=false;this.stateMap={componentLoaded:false};this.hasPartialFilterResults=false;this.refreshingResults=false;this.attemptingRetry=false;this.firstCellRendered=false}async invalidateRows(){n(this.getLayoutElement())}async scrollToIndex(e,t={}){const{animate:i,position:s="middle"}=t;const n=Math.max(0,Math.min(e,this.totalRows));const o=this.getScrollToPosition(n,s);await this.getLayoutElement().scrollToPosition(o,{behavior:i?"smooth":undefined})}async scrollToItem(e,t={}){var i;const s=this.totalRows;const n=await((i=this.controller)===null||i===void 0?void 0:i.expandParentNodes(e));if(n!=null&&s!==this.totalRows){return new Promise((e=>{const i=this.getLayoutElement();const s=async()=>{i.removeEventListener("layoutRendered",s);await this.scrollToIndex(n,t);e()};i.addEventListener("layoutRendered",s)}))}else if(n!=null){await this.scrollToIndex(n,t)}}async expandAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.expandAll())}async collapseAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.collapseAll())}async expandItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(!t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.expandNode(e))}}))}async collapseItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.collapseNode(e))}}))}async toggleExpandItem(e){await this.performRowOperation(e,(async({node:e})=>{if(e.expanded){await this.collapseItem(e)}else{await this.expandItem(e)}}))}async toggleItemVisibility(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible||i.partiallyVisible){await x(e,t)}else{await g(e,t)}}))}async hideItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible){await x(e,t)}}))}async showItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(!i.visible){await g(e,t)}}))}async selectItem(e,t={}){var{recurseParent:i}=t,s=a(t,["recurseParent"]);await this.performRowOperation(e,(async({viewer:t,id:n})=>{var o,r,a,l;const d=await((o=this.controller)===null||o===void 0?void 0:o.fetchNodeAncestors(n))||[];const c=(r=this.stateMap.selectionPath)===null||r===void 0?void 0:r.includes(n);const h=this.getNodeFromRowOrIndex(e);const u=d.length>0?d[0].selected:true;const v=h.selected&&!u;if(i&&(c||v)){const e=d.find((({selected:e})=>!e));if(e!=null){await this.selectItem(e,s);this.lastSelectedItemId=n}else{await C(t,n,s);this.lastSelectedItemId=n}}else if(s.range&&this.lastSelectedItemId!=null){const e=await((a=this.controller)===null||a===void 0?void 0:a.expandParentNodes(n));const i=await((l=this.controller)===null||l===void 0?void 0:l.expandParentNodes(this.lastSelectedItemId));if(i&&e){const n=Math.min(i,e);const o=Math.max(i,e);await I(t,n,o,s)}}else{await C(t,n,s);this.lastSelectedItemId=n}this.stateMap.selectionPath=[...d.map((({id:e})=>(e===null||e===void 0?void 0:e.hex)||"")),n]}))}async deselectItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.selected){this.lastSelectedItemId=undefined;await j(e,t)}}))}async isolateItem(e){await this.performRowOperation(e,(async({viewer:e,id:t})=>{await E(e,t,{animationDurationMs:this.operationAnimationDuration})}))}async getRowAtIndex(e){return this.rows[e]}async getRowForItemId(e){var t;const i=await((t=this.controller)===null||t===void 0?void 0:t.expandParentNodes(e));if(i!=null){return this.rows[i]}else{return undefined}}async getRowForEvent(e){const{clientY:t,target:i}=e;if(i!=null&&this.errorDetails==null&&p(this.el,i)&&f(i)){return this.getRowAtClientY(t)}else{return undefined}}getRowAtClientY(e){const t=this.getLayoutElement();const i=t.layoutOffset;const s=Math.floor((e-i+t.scrollOffset)/t.rowHeight);return this.getRowAtIndex(s)}async filterItems(e,t={}){var i;const s=Object.assign(Object.assign({},t),{metadataSearchKeys:t.columns});const n=this.getMetadataSearchKeys(s);return(i=this.controller)===null||i===void 0?void 0:i.filter(e,Object.assign(Object.assign({},t),{columns:n}))}async selectFilteredItems(e,t){var i,s,n,o,r,a;if(this.viewer!=null){const l=(s=(i=this.searchOptions)===null||i===void 0?void 0:i.metadataSearchKeys)!==null&&s!==void 0?s:this.metadataSearchKeys;const d=l.length>0?l:this.metadataKeys;const c=d.length>0?d:["VERTEX_SCENE_ITEM_NAME"];const h=(o=(n=this.searchOptions)===null||n===void 0?void 0:n.exactMatch)!==null&&o!==void 0?o:this.metadataSearchExactMatch;const u=(a=(r=this.searchOptions)===null||r===void 0?void 0:r.removeHiddenItems)!==null&&a!==void 0?a:false;await R(this.viewer,e,c,h,u,Object.assign({append:false},t))}}async fetchMetadataKeys(){var e,t;return(t=(e=this.controller)===null||e===void 0?void 0:e.fetchMetadataKeys())!==null&&t!==void 0?t:[]}disconnectedCallback(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();(i=this.controller)===null||i===void 0?void 0:i.cancel()}connectedCallback(){this.connectToViewer()}componentWillLoad(){var e;if(this.controller==null){const{sceneTreeHost:t}=this.getConfig().network;const i=new l(t,this.getConfig().flags.grpcUseStreamingWebSocketTransport?{transport:d}:undefined);this.controller=new c(i,100);(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}this.stateMap.onStateChangeDisposable=this.controller.onStateChange.on((e=>this.handleControllerStateChange(e)));this.connectToViewer()}async componentDidLoad(){var e;this.ensureLayoutDefined();this.updateLayoutElement();const t=this.getLayoutElement();const i=new ResizeObserver((()=>{this.invalidateRows()}));i.observe(t);this.stateMap.resizeObserver=i;this.stateMap.componentLoaded=true;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys);if(this.viewer==null){this.errorDetails=new h("MISSING_VIEWER",u.MISSING_VIEWER)}}componentWillRender(){this.updateLayoutElement()}render(){return e(o,null,e("div",{class:"header"},e("slot",{name:"header"},e("vertex-scene-tree-toolbar",{class:"search-toolbar"},e("vertex-scene-tree-search",{controller:this.controller})))),e("slot",{name:"partial-filter-results-banner"},this.hasPartialFilterResults&&e("vertex-scene-tree-notification-banner",{message:this.refreshingResults?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>{var e;return(e=this.controller)===null||e===void 0?void 0:e.refreshFilter()}})),this.errorDetails!=null&&this.renderError(this.errorDetails),this.errorDetails==null&&e("div",{class:"rows-scroll"},this.showLoader&&e("slot",{name:"loading"},e("vertex-viewer-spinner",{class:"loading",size:"md"})),e("slot",null),this.showEmptyResults&&e("slot",{name:"empty-results"},e("div",{class:"empty-results"},"No Results Found."))),e("div",{class:"footer"},e("slot",{name:"footer"})))}renderError(t){if(t.code!==u.SCENE_TREE_DISABLED){return e(y,{details:t},e("button",{class:"button button-secondary",onClick:()=>this.retryConnectToViewer(),disabled:this.attemptingRetry},"Retry"))}else{return e(y,{details:t})}}handleViewerChanged(e,t){if(!this.stateMap.componentLoaded){return}this.connectToViewer()}handleControllerChanged(e){var t;if(!this.stateMap.componentLoaded){return}(t=this.stateMap.onStateChangeDisposable)===null||t===void 0?void 0:t.dispose();this.stateMap.onStateChangeDisposable=e.onStateChange.on((e=>this.handleControllerStateChange(e)));e.setMetadataKeys(this.metadataKeys)}handleMetadataKeysChanged(){var e;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}retryConnectToViewer(){this.attemptingRetry=true;this.errorDetails=undefined;this.connectToViewer()}connectToViewer(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();if(this.viewer==null&&this.viewerSelector!=null){this.viewer=document.querySelector(this.viewerSelector)}if(this.viewer!=null){const e=async()=>{const e=this.getLayoutElement();await e.attemptComputeCellHeight()};this.viewer.addEventListener("sceneReady",e);this.stateMap.viewerDisposable=(i=this.controller)===null||i===void 0?void 0:i.connectToViewer(this.viewer);this.stateMap.viewerSceneReadyDisposable={dispose:()=>{var t;return(t=this.viewer)===null||t===void 0?void 0:t.removeEventListener("sceneReady",e)}}}else{this.attemptingRetry=false}}scheduleClearUnusedData(){if(this.stateMap.idleCallbackId!=null){window.cancelIdleCallback(this.stateMap.idleCallbackId)}this.stateMap.idleCallbackId=window.requestIdleCallback((e=>{var t,i,s;const n=(t=e.timeRemaining)===null||t===void 0?void 0:t.call(e);if(n==null||n>=k){const e=this.getLayoutElement();const t=e.viewportStartIndex;const n=e.viewportEndIndex;const[o,r]=((i=this.controller)===null||i===void 0?void 0:i.getPageIndexesForRange(t,n))||[];if(o!=null&&r!=null){(s=this.controller)===null||s===void 0?void 0:s.invalidatePagesOutsideRange(o,r,50)}}else{this.scheduleClearUnusedData()}}))}handleControllerStateChange(e){this.showLoader=!!e.shouldShowLoading;this.showEmptyResults=!!e.shouldShowEmptyResults;this.rows=e.rows;this.totalRows=e.totalRows;this.hasPartialFilterResults=!!e.isPartialFilterResponse;this.refreshingResults=!!e.isSearching;if(e.connection.type==="failure"){this.errorDetails=e.connection.details;this.connectionError.emit(e.connection.details)}else if(e.connection.type==="disconnected"){this.errorDetails=new h("DISCONNECTED",u.DISCONNECTED)}else{this.errorDetails=undefined}if(e.connection.type==="connected"||e.connection.type==="failure"){this.attemptingRetry=false}}getNodeFromRowOrIndex(e){const t=typeof e==="number"?this.rows[e]:e;if(t==null){throw new Error(`Cannot perform scene tree operation. Row not found.`)}return w(t)?t.node:t}async performRowOperation(e,t){const i=this.getNodeFromRowOrIndex(e);if(i.id==null){throw new Error(`Cannot perform scene tree operation. ID is undefined.`)}if(this.viewer==null){throw new Error(`Cannot perform scene tree operation. Cannot get reference to viewer.`)}await t({viewer:this.viewer,id:i.id.hex,node:i})}async handleSearch(e){var t,i,s,n;const o=this.getMetadataSearchKeys(this.searchOptions);const r=(i=(t=this.searchOptions)===null||t===void 0?void 0:t.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;const a=(n=(s=this.searchOptions)===null||s===void 0?void 0:s.removeHiddenItems)!==null&&n!==void 0?n:false;try{await this.filterItems(e.detail,{columns:o,exactMatch:r,removeHiddenItems:a})}catch(e){console.error("Failed to filter tree with exception: ",e)}}async handleCellLoaded(){if(!this.firstCellRendered&&this.rows.length>0){this.firstCellRendered=true;this.firstRowRendered.emit()}}getScrollToPosition(e,t){var i;const s=this.getLayoutElement();const n=Math.max(0,Math.min(e,this.totalRows-1));const o=(i=s.layoutHeight)!==null&&i!==void 0?i:0;const r=s.rowHeight;if(t==="start"){return n*r}else if(t==="middle"){const e=n*r+r/2;return e-o/2}else{const e=n*r+r;return e-o}}getConfig(){return v(this.configEnv,this.config)}ensureLayoutDefined(){let e=this.el.querySelector("vertex-scene-tree-table-layout");if(e==null){e=document.createElement("vertex-scene-tree-table-layout");e.innerHTML=`\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value="{{row.node.name}}" expand-toggle isolate-button visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;this.el.appendChild(e)}this.stateMap.layoutEl=e}updateLayoutElement(){const e=this.stateMap.layoutEl;if(e!=null){e.rows=this.rows;e.tree=this.el;e.totalRows=this.totalRows;e.controller=this.controller;e.rowData=this.rowData}else if(!this.stateMap.componentLoaded&&this.totalRows>0){console.debug("Scene tree has rows, but the component has not yet rendered")}}getLayoutElement(){if(this.stateMap.layoutEl!=null){return this.stateMap.layoutEl}else{throw new Error("Layout element is undefined")}}getMetadataSearchKeys(e){var t,i;const s=(t=e===null||e===void 0?void 0:e.metadataSearchKeys)!==null&&t!==void 0?t:this.metadataSearchKeys;const n=(i=e===null||e===void 0?void 0:e.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;if(n){const e=s.length>0?s:[m];return e}else if(s.length>0){return s}return undefined}get el(){return r(this)}static get watchers(){return{viewer:["handleViewerChanged"],controller:["handleControllerChanged"],metadataKeys:["handleMetadataKeysChanged"]}}};S.style=M;export{S as vertex_scene_tree};
5
- //# sourceMappingURL=p-22b42d4b.entry.js.map
4
+ import{h as e,F as t,r as i,c as s,f as n,H as o,g as r}from"./p-388f809e.js";import{x as a}from"./p-9d26f24e.js";import{a as l,w as d,S as c,b as h,c as u}from"./p-f8951894.js";import{p as v}from"./p-635347ea.js";import{i as f}from"./p-992ec5f0.js";import{g as p}from"./p-490d9553.js";import{i as w}from"./p-e4f95584.js";import{S as m}from"./p-adf28726.js";import"./p-5ca72d4a.js";import"./p-e5cc48b6.js";import"./p-ba120f65.js";import"./p-6b00f7cd.js";import"./p-f49b5881.js";import"./p-e656bd4c.js";import"./p-3060996e.js";import"./p-0d971ad6.js";window.requestIdleCallback=window.requestIdleCallback||function(e){var t=Date.now();return setTimeout((function(){e({didTimeout:false,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1)};window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)};const y=({details:i},s)=>e("div",{class:"error"},e("div",{class:"error-section error-message"},e("span",null,i.message),i.link&&e(t,null,e("span",null," See our "),e("a",{href:i.link,target:"_blank"},"documentation")," ",e("span",null," for more information."))),e("div",{class:"error-section"},s));const b=500;async function g(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).show())).execute({suppliedCorrelationId:i})}async function x(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).hide())).execute({suppliedCorrelationId:i})}async function C(e,t,{append:i=false,suppliedCorrelationId:s}){const n=await e.scene();return n.elements((e=>[...i?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withItemId(t))).select()])).execute({suppliedCorrelationId:s})}async function I(e,t,i,{append:s=true,suppliedCorrelationId:n}){const o=await e.scene();return o.elements((e=>[...s?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withSceneTreeRange({start:t,end:i}))).select()])).execute({suppliedCorrelationId:n})}async function R(e,t,i,s,n,{append:o=false,suppliedCorrelationId:r}){const a=await e.scene();return a.elements((e=>[...o?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withMetadata(t,i,s,n))).select()])).execute({suppliedCorrelationId:r})}async function j(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).deselect())).execute({suppliedCorrelationId:i})}async function E(e,t,{suppliedCorrelationId:i,animationDurationMs:s}={}){const n=await e.scene();await n.elements((e=>[e.items.where((e=>e.all())).hide(),e.items.where((e=>e.withItemId(t))).show()])).execute({suppliedCorrelationId:i});const o=await n.camera().flyTo((e=>e.withItemId(t))).render({animation:{milliseconds:s!==null&&s!==void 0?s:b}});await o.onAnimationCompleted.once()}const M="button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}:host{--scene-tree-toolbar-separator:1px solid var(--neutral-300);--scene-tree-default-font-family:unset;--scene-tree-default-font-size:unset;--scene-tree-default-font-color:unset;--scene-tree-secondary-font-color:unset;--scene-tree-selected-row-background-color:unset;--scene-tree-hovered-row-background-color:unset;--scene-tree-row-background-color:unset;--scene-tree-row-background-color-depth-n:unset;--scene-tree-overlay-z-index:3000;width:300px;height:100%;user-select:none;-webkit-user-select:none;cursor:default;display:flex;flex-direction:column;position:relative}.rows-scroll{position:relative;height:var(--scene-tree-row-height, 0);flex-grow:1}.rows{position:relative}.row{position:absolute;display:flex;align-items:center;width:100%;height:var(--scene-tree-row-height);padding:var(--scene-tree-row-padding);box-sizing:border-box}.row:hover{background-color:var(--scene-tree-row-hover-color)}.row.is-selected{background-color:var(--scene-tree-row-selected-color)}.expand-toggle{cursor:pointer;width:16px}.row-text{margin-left:0.25rem;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.visibility-btn{display:flex;align-items:center;visibility:hidden;padding:4px}.visibility-btn.is-hidden{visibility:visible}.row:hover .visibility-btn{visibility:visible}.error,.empty-results{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;font-size:0.875rem;width:100%;height:100%;padding:1rem;box-sizing:border-box;justify-content:center;background-color:white;z-index:var(--scene-tree-overlay-z-index)}.error-section{margin-top:1rem}.error-message{text-align:center}.search-toolbar,slot[name='header']::slotted(*){border-bottom:var(--scene-tree-toolbar-separator)}slot[name='footer']::slotted(:not(:last-child)){border-top:var(--scene-tree-toolbar-separator)}.header{display:flex;flex-direction:column}.footer{display:flex;flex-direction:column}.loading{position:absolute;top:150px;left:50%;transform:translate(-50%, -50%);text-align:center}";const k=25;const S=class{constructor(e){i(this,e);this.connectionError=s(this,"connectionError",7);this.firstRowRendered=s(this,"firstRowRendered",7);this.overScanCount=25;this.configEnv="platprod";this.searchOptions={};this.metadataSearchExactMatch=false;this.metadataSearchKeys=[];this.metadataKeys=[];this.operationAnimationDuration=500;this.rows=[];this.totalRows=0;this.showLoader=false;this.showEmptyResults=false;this.stateMap={componentLoaded:false};this.hasPartialFilterResults=false;this.refreshingResults=false;this.attemptingRetry=false;this.firstCellRendered=false}async invalidateRows(){n(this.getLayoutElement())}async scrollToIndex(e,t={}){const{animate:i,position:s="middle"}=t;const n=Math.max(0,Math.min(e,this.totalRows));const o=this.getScrollToPosition(n,s);await this.getLayoutElement().scrollToPosition(o,{behavior:i?"smooth":undefined})}async scrollToItem(e,t={}){var i;const s=this.totalRows;const n=await((i=this.controller)===null||i===void 0?void 0:i.expandParentNodes(e));if(n!=null&&s!==this.totalRows){return new Promise((e=>{const i=this.getLayoutElement();const s=async()=>{i.removeEventListener("layoutRendered",s);await this.scrollToIndex(n,t);e()};i.addEventListener("layoutRendered",s)}))}else if(n!=null){await this.scrollToIndex(n,t)}}async expandAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.expandAll())}async collapseAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.collapseAll())}async expandItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(!t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.expandNode(e))}}))}async collapseItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.collapseNode(e))}}))}async toggleExpandItem(e){await this.performRowOperation(e,(async({node:e})=>{if(e.expanded){await this.collapseItem(e)}else{await this.expandItem(e)}}))}async toggleItemVisibility(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible||i.partiallyVisible){await x(e,t)}else{await g(e,t)}}))}async hideItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible){await x(e,t)}}))}async showItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(!i.visible){await g(e,t)}}))}async selectItem(e,t={}){var{recurseParent:i}=t,s=a(t,["recurseParent"]);await this.performRowOperation(e,(async({viewer:t,id:n})=>{var o,r,a,l;const d=await((o=this.controller)===null||o===void 0?void 0:o.fetchNodeAncestors(n))||[];const c=(r=this.stateMap.selectionPath)===null||r===void 0?void 0:r.includes(n);const h=this.getNodeFromRowOrIndex(e);const u=d.length>0?d[0].selected:true;const v=h.selected&&!u;if(i&&(c||v)){const e=d.find((({selected:e})=>!e));if(e!=null){await this.selectItem(e,s);this.lastSelectedItemId=n}else{await C(t,n,s);this.lastSelectedItemId=n}}else if(s.range&&this.lastSelectedItemId!=null){const e=await((a=this.controller)===null||a===void 0?void 0:a.expandParentNodes(n));const i=await((l=this.controller)===null||l===void 0?void 0:l.expandParentNodes(this.lastSelectedItemId));if(i&&e){const n=Math.min(i,e);const o=Math.max(i,e);await I(t,n,o,s)}}else{await C(t,n,s);this.lastSelectedItemId=n}this.stateMap.selectionPath=[...d.map((({id:e})=>(e===null||e===void 0?void 0:e.hex)||"")),n]}))}async deselectItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.selected){this.lastSelectedItemId=undefined;await j(e,t)}}))}async isolateItem(e){await this.performRowOperation(e,(async({viewer:e,id:t})=>{await E(e,t,{animationDurationMs:this.operationAnimationDuration})}))}async getRowAtIndex(e){return this.rows[e]}async getRowForItemId(e){var t;const i=await((t=this.controller)===null||t===void 0?void 0:t.expandParentNodes(e));if(i!=null){return this.rows[i]}else{return undefined}}async getRowForEvent(e){const{clientY:t,target:i}=e;if(i!=null&&this.errorDetails==null&&p(this.el,i)&&f(i)){return this.getRowAtClientY(t)}else{return undefined}}getRowAtClientY(e){const t=this.getLayoutElement();const i=t.layoutOffset;const s=Math.floor((e-i+t.scrollOffset)/t.rowHeight);return this.getRowAtIndex(s)}async filterItems(e,t={}){var i;const s=Object.assign(Object.assign({},t),{metadataSearchKeys:t.columns});const n=this.getMetadataSearchKeys(s);return(i=this.controller)===null||i===void 0?void 0:i.filter(e,Object.assign(Object.assign({},t),{columns:n}))}async selectFilteredItems(e,t){var i,s,n,o,r,a;if(this.viewer!=null){const l=(s=(i=this.searchOptions)===null||i===void 0?void 0:i.metadataSearchKeys)!==null&&s!==void 0?s:this.metadataSearchKeys;const d=l.length>0?l:this.metadataKeys;const c=d.length>0?d:["VERTEX_SCENE_ITEM_NAME"];const h=(o=(n=this.searchOptions)===null||n===void 0?void 0:n.exactMatch)!==null&&o!==void 0?o:this.metadataSearchExactMatch;const u=(a=(r=this.searchOptions)===null||r===void 0?void 0:r.removeHiddenItems)!==null&&a!==void 0?a:false;await R(this.viewer,e,c,h,u,Object.assign({append:false},t))}}async fetchMetadataKeys(){var e,t;return(t=(e=this.controller)===null||e===void 0?void 0:e.fetchMetadataKeys())!==null&&t!==void 0?t:[]}disconnectedCallback(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();(i=this.controller)===null||i===void 0?void 0:i.cancel()}connectedCallback(){this.connectToViewer()}componentWillLoad(){var e;if(this.controller==null){const{sceneTreeHost:t}=this.getConfig().network;const i=new l(t,this.getConfig().flags.grpcUseStreamingWebSocketTransport?{transport:d}:undefined);this.controller=new c(i,100);(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}this.stateMap.onStateChangeDisposable=this.controller.onStateChange.on((e=>this.handleControllerStateChange(e)));this.connectToViewer()}async componentDidLoad(){var e;this.ensureLayoutDefined();this.updateLayoutElement();const t=this.getLayoutElement();const i=new ResizeObserver((()=>{this.invalidateRows()}));i.observe(t);this.stateMap.resizeObserver=i;this.stateMap.componentLoaded=true;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys);if(this.viewer==null){this.errorDetails=new h("MISSING_VIEWER",u.MISSING_VIEWER)}}componentWillRender(){this.updateLayoutElement()}render(){return e(o,null,e("div",{class:"header"},e("slot",{name:"header"},e("vertex-scene-tree-toolbar",{class:"search-toolbar"},e("vertex-scene-tree-search",{controller:this.controller})))),e("slot",{name:"partial-filter-results-banner"},this.hasPartialFilterResults&&e("vertex-scene-tree-notification-banner",{message:this.refreshingResults?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>{var e;return(e=this.controller)===null||e===void 0?void 0:e.refreshFilter()}})),this.errorDetails!=null&&this.renderError(this.errorDetails),this.errorDetails==null&&e("div",{class:"rows-scroll"},this.showLoader&&e("slot",{name:"loading"},e("vertex-viewer-spinner",{class:"loading",size:"md"})),e("slot",null),this.showEmptyResults&&e("slot",{name:"empty-results"},e("div",{class:"empty-results"},"No Results Found."))),e("div",{class:"footer"},e("slot",{name:"footer"})))}renderError(t){if(t.code!==u.SCENE_TREE_DISABLED){return e(y,{details:t},e("button",{class:"button button-secondary",onClick:()=>this.retryConnectToViewer(),disabled:this.attemptingRetry},"Retry"))}else{return e(y,{details:t})}}handleViewerChanged(e,t){if(!this.stateMap.componentLoaded){return}this.connectToViewer()}handleControllerChanged(e){var t;if(!this.stateMap.componentLoaded){return}(t=this.stateMap.onStateChangeDisposable)===null||t===void 0?void 0:t.dispose();this.stateMap.onStateChangeDisposable=e.onStateChange.on((e=>this.handleControllerStateChange(e)));e.setMetadataKeys(this.metadataKeys)}handleMetadataKeysChanged(){var e;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}retryConnectToViewer(){this.attemptingRetry=true;this.errorDetails=undefined;this.connectToViewer()}connectToViewer(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();if(this.viewer==null&&this.viewerSelector!=null){this.viewer=document.querySelector(this.viewerSelector)}if(this.viewer!=null){const e=async()=>{const e=this.getLayoutElement();await e.attemptComputeCellHeight()};this.viewer.addEventListener("sceneReady",e);this.stateMap.viewerDisposable=(i=this.controller)===null||i===void 0?void 0:i.connectToViewer(this.viewer);this.stateMap.viewerSceneReadyDisposable={dispose:()=>{var t;return(t=this.viewer)===null||t===void 0?void 0:t.removeEventListener("sceneReady",e)}}}else{this.attemptingRetry=false}}scheduleClearUnusedData(){if(this.stateMap.idleCallbackId!=null){window.cancelIdleCallback(this.stateMap.idleCallbackId)}this.stateMap.idleCallbackId=window.requestIdleCallback((e=>{var t,i,s;const n=(t=e.timeRemaining)===null||t===void 0?void 0:t.call(e);if(n==null||n>=k){const e=this.getLayoutElement();const t=e.viewportStartIndex;const n=e.viewportEndIndex;const[o,r]=((i=this.controller)===null||i===void 0?void 0:i.getPageIndexesForRange(t,n))||[];if(o!=null&&r!=null){(s=this.controller)===null||s===void 0?void 0:s.invalidatePagesOutsideRange(o,r,50)}}else{this.scheduleClearUnusedData()}}))}handleControllerStateChange(e){this.showLoader=!!e.shouldShowLoading;this.showEmptyResults=!!e.shouldShowEmptyResults;this.rows=e.rows;this.totalRows=e.totalRows;this.hasPartialFilterResults=!!e.isPartialFilterResponse;this.refreshingResults=!!e.isSearching;if(e.connection.type==="failure"){this.errorDetails=e.connection.details;this.connectionError.emit(e.connection.details)}else if(e.connection.type==="disconnected"){this.errorDetails=new h("DISCONNECTED",u.DISCONNECTED)}else{this.errorDetails=undefined}if(e.connection.type==="connected"||e.connection.type==="failure"){this.attemptingRetry=false}}getNodeFromRowOrIndex(e){const t=typeof e==="number"?this.rows[e]:e;if(t==null){throw new Error(`Cannot perform scene tree operation. Row not found.`)}return w(t)?t.node:t}async performRowOperation(e,t){const i=this.getNodeFromRowOrIndex(e);if(i.id==null){throw new Error(`Cannot perform scene tree operation. ID is undefined.`)}if(this.viewer==null){throw new Error(`Cannot perform scene tree operation. Cannot get reference to viewer.`)}await t({viewer:this.viewer,id:i.id.hex,node:i})}async handleSearch(e){var t,i,s,n;const o=this.getMetadataSearchKeys(this.searchOptions);const r=(i=(t=this.searchOptions)===null||t===void 0?void 0:t.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;const a=(n=(s=this.searchOptions)===null||s===void 0?void 0:s.removeHiddenItems)!==null&&n!==void 0?n:false;try{await this.filterItems(e.detail,{columns:o,exactMatch:r,removeHiddenItems:a})}catch(e){console.error("Failed to filter tree with exception: ",e)}}async handleCellLoaded(){if(!this.firstCellRendered&&this.rows.length>0){this.firstCellRendered=true;this.firstRowRendered.emit()}}getScrollToPosition(e,t){var i;const s=this.getLayoutElement();const n=Math.max(0,Math.min(e,this.totalRows-1));const o=(i=s.layoutHeight)!==null&&i!==void 0?i:0;const r=s.rowHeight;if(t==="start"){return n*r}else if(t==="middle"){const e=n*r+r/2;return e-o/2}else{const e=n*r+r;return e-o}}getConfig(){return v(this.configEnv,this.config)}ensureLayoutDefined(){let e=this.el.querySelector("vertex-scene-tree-table-layout");if(e==null){e=document.createElement("vertex-scene-tree-table-layout");e.innerHTML=`\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value="{{row.node.name}}" expand-toggle isolate-button visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;this.el.appendChild(e)}this.stateMap.layoutEl=e}updateLayoutElement(){const e=this.stateMap.layoutEl;if(e!=null){e.rows=this.rows;e.tree=this.el;e.totalRows=this.totalRows;e.controller=this.controller;e.rowData=this.rowData}else if(!this.stateMap.componentLoaded&&this.totalRows>0){console.debug("Scene tree has rows, but the component has not yet rendered")}}getLayoutElement(){if(this.stateMap.layoutEl!=null){return this.stateMap.layoutEl}else{throw new Error("Layout element is undefined")}}getMetadataSearchKeys(e){var t,i;const s=(t=e===null||e===void 0?void 0:e.metadataSearchKeys)!==null&&t!==void 0?t:this.metadataSearchKeys;const n=(i=e===null||e===void 0?void 0:e.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;if(n){const e=s.length>0?s:[m];return e}else if(s.length>0){return s}return undefined}get el(){return r(this)}static get watchers(){return{viewer:["handleViewerChanged"],controller:["handleControllerChanged"],metadataKeys:["handleMetadataKeysChanged"]}}};S.style=M;export{S as vertex_scene_tree};
5
+ //# sourceMappingURL=p-86e1ee86.entry.js.map
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{r as t,c as i,h as s,H as n,g as e}from"./p-388f809e.js";import{p as o,v as h,c as a,g as r,r as c,b as l,y as d,d as u}from"./p-9d26f24e.js";import{S as f}from"./p-9018d76e.js";import{t as p,p as m,a as w,S as v,c as g,W as y}from"./p-3060996e.js";import{m as b,E as C,b as P,c as S,o as I,u as T,a as A}from"./p-6b00f7cd.js";import{c as k}from"./p-92793987.js";import{u as j,c as D,p as O,C as x,W as E,S as M,V as R,M as B,d as z,e as $}from"./p-ba120f65.js";import{s as L,p as V,f as F}from"./p-7af4e8a6.js";import{r as K,c as H,a as N}from"./p-3a522068.js";import{p as W,q,r as U,m as _,s as J,x as X,k as G,y as Z,z as Q,u as Y,t as tt,B as it,n as st,C as nt,E as et,G as ot,H as ht,I as at,J as rt,K as ct,M as lt,N as dt,P as ut,Q as ft,R as pt,T as mt,U as wt,V as vt,W as gt}from"./p-e656bd4c.js";import{t as yt,m as bt,n as Ct,j as Pt,M as St,k as It,S as Tt}from"./p-bab8266e.js";import{p as At}from"./p-635347ea.js";import{C as kt}from"./p-eda9f5d4.js";import{g as jt,c as Dt}from"./p-95f6305a.js";import{E as Ot}from"./p-0d971ad6.js";import{V as xt}from"./p-148e5f47.js";import{B as Et,M as Mt}from"./p-e57aebc1.js";import{w as Rt}from"./p-e1eaedd8.js";import"./p-5ca72d4a.js";import"./p-e5cc48b6.js";import"./p-e3945092.js";import"./p-f49b5881.js";const Bt=0;const zt=255;class $t{constructor(t){this.viewer=t;this.handleInteractionStarted=()=>{this.invalidateStencilBuffer();this.pendingInteractionFinished=new Promise((t=>{this.pendingInteractionFinishedResolver=t}))};this.handleInteractionFinished=()=>{var t;(t=this.pendingInteractionFinishedResolver)===null||t===void 0?void 0:t.call(this);this.pendingInteractionFinished=undefined;this.pendingInteractionFinishedResolver=undefined};this.invalidateStencilBuffer=()=>{this.pendingStencilBuffer=undefined};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();const s=i?await this.viewer.scene():undefined;const n=s!=null?s.crossSectioning().current().sectionPlanes.length>0||this.viewer.featureLines!=null:false;const e=(t=this.viewer.frame)===null||t===void 0?void 0:t.scene.camera;if(n&&this.viewer.stream!=null&&e!=null){const t=await this.viewer.stream.getStencilBuffer({includeDepthBuffer:true});const{stencilBuffer:i,depthBuffer:s,imageAttributes:n}=W(t);const[o,h]=await Promise.all([q(new Uint8Array(i)),q(new Uint8Array(s))]);return Lt.fromPng(o,n,i,U.fromPng(h,e,n))}else return undefined}latest(){if(this.pendingStencilBuffer==null){this.pendingStencilBuffer=this.fetch()}return this.pendingStencilBuffer}async latestAfterInteraction(){await this.pendingInteractionFinished;return this.latest()}}class Lt{constructor(t,i,s,n,e){this.imageAttr=t;this.imageBytes=i;this.pixelBytes=s;this.imageChannels=n;this.depthBuffer=e}static fromPng(t,i,s,n){if(!(t.data instanceof Uint8Array)){throw new Error("Expected stencil PNG to have depth of 8-bit")}else if(t.channels!==1){throw new Error("Expected stencil PNG to have 1 color channel")}else{return new Lt(i,s,t.data,t.channels,n)}}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect;const n=o.subtract(t,this.imageAttr.imageRect);const e=1/this.imageAttr.imageScale;const h=o.scale(n,e,e);if(h.x>=0&&h.y>=0&&h.x<i&&h.y<s){const t=Math.floor(h.x)+Math.floor(h.y)*i;const s=this.pixelBytes[t];return s}else return 0}hitTest(t){return this.getValue(t)!==Bt}snapToNearestPixel(t,i,s=(()=>true)){const n=i*2;const e=o.create(t.x-i,t.y-i);const h=[];for(let a=0;a<n*n;a++){const r=a%n;const c=Math.floor(a/n);const l=o.add(e,{x:r,y:c});if(o.distance(l,t)<=i){const t=this.getValue(l);if(t===zt&&s(t)){h.push(l)}}}const a=h.sort(((i,s)=>o.distance(i,t)-o.distance(s,t)));const r=a[0];return r!=null?o.create(Math.floor(r.x)+.5,Math.floor(r.y)+.5):t}}function Vt(t){return t!=null&&t["then"]instanceof Function&&t["catch"]instanceof Function&&t["finally"]instanceof Function}function Ft(t){return new Promise((i=>setTimeout(i,t)))}const Kt=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",_),b.mapRequiredProp("createdAt",J),b.mapRequiredProp("modifiedAt",J),b.mapProp("name",X),b.mapProp("suppliedId",X))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,name:n,suppliedId:e})));const Ht=b.ifInvalidThrow(Kt);const Nt=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",_),b.mapRequiredProp("createdAt",J),b.mapRequiredProp("modifiedAt",J),b.mapProp("suppliedId",X),b.mapRequiredProp("data",(t=>{if(t.callout!=null){return qt(t.callout)}else if(t.customJson!=null){return Ut(t.customJson)}else{throw new Error("Undefined or unknown annotation data.")}})))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,suppliedId:n,data:e})));const Wt=b.ifInvalidThrow(Nt);const qt=b.defineMapper(b.read(b.mapRequiredProp("position",G),b.mapProp("icon",X),b.mapProp("primaryColor",X),b.mapProp("accentColor",X)),(([t,i,s,n])=>({type:"callout",position:t,icon:i,primaryColor:s,accentColor:n})));const Ut=b.defineMapper(b.read(b.requiredProp("type"),b.mapRequiredProp("jsonData",(t=>JSON.parse(t)))),(([t,i])=>({type:"custom",jsonType:t,jsonData:i})));class _t{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s;this.onStateChange=new C}async addAnnotationSet(t){await K((async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.CreateSceneViewAnnotationSetRequest;const o=new j.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.createSceneViewAnnotationSet(e,n,i)}));return this.fetch()}disconnect(){if(this.connection!=null){this.connection.dispose();this.connection=undefined}}connect(t=1e4){this.disconnect();const i=this.pollAnnotationState(t);this.connection={dispose:()=>i.abort()}}async fetch(t={}){const i=await this.fetchAnnotationSetsAsArray();const s=await this.fetchAnnotationsAsArray(i);const n=(await Promise.all(s)).reduce(((t,[i,s])=>({annotations:Object.assign(Object.assign({},t.annotations),{[i.id]:s})})),{annotations:{}});if(t.signal==null||!t.signal.aborted){this.updateState(n)}return n}async removeAnnotationSet(t){await K((async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.DeleteSceneViewAnnotationSetRequest;const o=new j.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.deleteSceneViewAnnotationSet(e,n,i)}));return this.fetch()}pollAnnotationState(t){const i=new AbortController;const s=async t=>{await this.fetch({signal:i.signal});if(!i.signal.aborted){await Ft(t);await s(t)}};P.abort(i.signal,s(t));return i}fetchAnnotationSets(){return N((t=>async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.ListSceneViewAnnotationSetsRequest;if(t!=null){const i=new V.Pager;i.setCursor(t);i.setLimit(100);e.setPage(i)}this.client.listSceneViewAnnotationSets(e,n,i)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}async fetchAnnotationSetsAsArray(){return(await P.asArray(this.fetchAnnotationSets())).flatMap((t=>t.getSceneAnnotationSetsList())).map((t=>Ht(t)))}fetchAnnotations(t){return N((i=>async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneAnnotationsRequest;const h=yt(t);o.setSceneAnnotationSetId(h);if(i!=null){const t=new V.Pager;t.setCursor(i);t.setLimit(100);o.setPage(t)}this.client.listSceneAnnotations(o,e,s)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}fetchAnnotationsAsArray(t){const i=t.map((async t=>{const i=(await P.asArray(this.fetchAnnotations(t.id))).flatMap((t=>t.getSceneAnnotationsList())).map((t=>Wt(t)));return[t,i]}));return Promise.all(i)}updateState(t){this.state=t;this.onStateChange.emit(t)}}const Jt=b.defineMapper(b.read(b.mapRequiredProp("color",Z),b.getProp("thickness")),(([t,i])=>({color:t,thickness:i})));const Xt=b.defineMapper(b.read(b.mapRequiredProp("color",Z)),(([t])=>({color:t})));const Gt=b.defineMapper(b.read(b.pickFirst(b.mapProp("arrow",b.ifDefined((t=>Object.assign(Object.assign({},t),{type:"arrow-end"})))),b.mapProp("circle",b.ifDefined((t=>Object.assign(Object.assign({},t),{type:"circle-end"})))),b.mapProp("dash",b.ifDefined((t=>Object.assign(Object.assign({},t),{type:"dash-end"})))))),(([t])=>t!==null&&t!==void 0?t:undefined));const Zt=b.defineMapper(b.read(b.mapRequiredProp("startPosition",Q),b.mapRequiredProp("endPosition",Q),b.mapProp("strokeStyle",b.ifDefined(Jt)),b.mapProp("fillStyle",b.ifDefined(Xt)),b.mapProp("startShape",b.ifDefined(Gt)),b.mapProp("endShape",b.ifDefined(Gt))),(([t,i,s,n,e,o])=>({type:"line-2d",startPosition:t,endPosition:i,strokeStyle:s,fillStyle:n,startShape:e!==null&&e!==void 0?e:undefined,endShape:o!==null&&o!==void 0?o:undefined})));const Qt=b.defineMapper(b.read(b.mapRequiredProp("topLeft",Q),b.mapRequiredProp("bottomRight",Q),b.mapProp("strokeStyle",b.ifDefined(Jt)),b.mapProp("fillStyle",b.ifDefined(Xt))),(([t,i,s,n])=>({type:"oval-2d",topLeftPosition:t,bottomRightPosition:i,strokeStyle:s,fillStyle:n})));const Yt=b.defineMapper(b.read(b.mapRequiredProp("positionsList",b.mapArray(Q)),b.mapProp("strokeStyle",b.ifDefined(Jt)),b.mapProp("fillStyle",b.ifDefined(Xt))),(([t,i,s])=>({type:"freeform-2d",positions:t,strokeStyle:i,fillStyle:s})));const ti=b.defineMapper(b.read(b.mapRequiredProp("primaryColor",Z),b.mapRequiredProp("accentColor",Z),b.mapRequiredProp("position",G),b.mapProp("sceneItemId",b.ifDefined(_))),(([t,i,s,n])=>({type:"pin-2d",primaryColor:t,accentColor:i,position:s,sceneItemId:n!==null&&n!==void 0?n:undefined})));const ii=b.defineMapper(b.read(b.mapRequiredProp("primaryColor",Z),b.mapRequiredProp("accentColor",Z),b.mapRequiredProp("anchorPosition",G),b.mapRequiredProp("textPosition",Q),b.getProp("text"),b.mapProp("sceneItemId",b.ifDefined(_))),(([t,i,s,n,e,o])=>({type:"callout",primaryColor:t,accentColor:i,anchorPosition:s,textPosition:n,text:e,sceneItemId:o!==null&&o!==void 0?o:undefined})));const si=b.defineMapper(b.read(b.pickFirst(b.mapProp("line2d",b.ifDefined(Zt)),b.mapProp("oval",b.ifDefined(Qt)),b.mapProp("freeform",b.ifDefined(Yt)),b.mapProp("pin",b.ifDefined(ti)),b.mapProp("callout",b.ifDefined(ii)))),(([t])=>t!==null&&t!==void 0?t:undefined));const ni=b.defineMapper(b.read(b.mapRequiredProp("itemsList",b.mapArray(si))),(([t])=>({items:t.filter((t=>t!=null))})));const ei=b.defineMapper(b.read(b.mapRequiredProp("canvas",b.mapRequiredProp("document",b.mapRequiredProp("v1",ni)))),(([t])=>t));const oi=b.ifInvalidThrow(ei);class hi{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getCanvas({canvasId:t,sceneViewStateId:i}){if(t!=null&&i!=null){throw new Error("Invalid request. Only one lookup ID between `canvasId` and `sceneViewStateId` can be provided.")}const s=await K((async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.GetCanvasRequest;if(t!=null){const i=yt(t);o.setCanvasId(i)}else if(i!=null){const t=yt(i);o.setSceneViewStateId(t)}this.client.getCanvas(o,e,s)}));return oi(s.toObject())}}class ai{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();const n=await this.stream.hitItems({point:o.scale(t.position,(s===null||s===void 0?void 0:s.x)||1,(s===null||s===void 0?void 0:s.y)||1)},true);if(((i=n.hitItems)===null||i===void 0?void 0:i.hits)!=null&&n.hitItems.hits.length>0){await this.stream.flyTo({itemId:n.hitItems.hits[0].itemId,animation:{duration:p(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}}class ri{constructor(t,i,s,n,e,o,h,a,r,c,l){this.stream=t;this.cursors=i;this.getConfig=s;this.getScene=n;this.getFrame=e;this.getViewport=o;this.tapEmitter=h;this.doubleTapEmitter=a;this.longPressEmitter=r;this.interactionStartedEmitter=c;this.interactionFinishedEmitter=l;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();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async getEntityTypeAtPoint(t){var i;const s=this.getViewport();const n=await((i=this.getFrame())===null||i===void 0?void 0:i.featureMap());if(n!=null){const i=s.transformPointToFrame(t,n);return n.getEntityType(i)}else{return Ot.NO_GEOMETRY}}getRayFromPoint(t){const i=this.getViewport();const s=this.getFrame();if(s!=null){return i.transformPointToRay(t,s.image,s.scene.camera)}else 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(){if(!this.isInteracting()){this.interactionStartedEmitter.emit();this.sceneLoadingPromise=this.getScene();this.currentCamera=(await this.sceneLoadingPromise).camera();this.sceneLoadingPromise=undefined;await this.stream.beginInteraction()}}async transformCamera(...t){var i;const s=t[0];const n=t[1];if(this.isInteracting()){const t=await this.getScene();const e=this.getViewport();const o=this.getFrame();const h=await(o===null||o===void 0?void 0:o.depthBuffer());this.currentCamera=this.currentCamera!=null&&e!=null&&o!=null?s({camera:this.currentCamera,viewport:e,scale:t.scale(),boundingBox:t.boundingBox(),frame:o,depthBuffer:h}):undefined;await((i=this.currentCamera)===null||i===void 0?void 0:i.render(n))}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const n=h.normalize(h.subtract(i.lookAt,i.position));if(t.length===1&&typeof t[0]==="number"){const s=a.toRadians(-t[0]);return i.rotateAroundAxis(s,n)}else if(t.length===1){const n=o.create(s.width/2,s.height/2);const e=a.toDegrees(a.fromPoints(n,t[0]));const r=this.lastAngle!=null?e-this.lastAngle:0;this.lastAngle=e;const c=h.normalize(h.subtract(i.lookAt,i.position));const l=a.toRadians(-r);return i.rotateAroundAxis(l,c)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,depthBuffer:e})=>{if(this.panData==null){const o=i.toFrameCamera();const h=o.direction;const a=n.transformPointToRay(t,s.image,o);const l=r.fromNormalAndCoplanarPoint(h,i.lookAt);const d=c.intersectPlane(a,l);if(d==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}const u=e!=null?this.getWorldPoint(t,e,d):d;const f=r.fromNormalAndCoplanarPoint(h,u);this.panData={hitPt:u,hitPlane:f,startingCamera:o}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const r=n.transformPointToRay(t,s.image,a);const l=c.intersectPlane(r,o);if(l!=null){const t=h.subtract(e,l);return i.update(a).moveBy(t)}}return i}))}async viewAll(){await(await this.getScene()).camera().viewAll().render()}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=h.normalize(i.up);const e=h.normalize(h.subtract(i.lookAt,i.position));const o=h.cross(n,e);const a=h.cross(e,o);const r=h.normalize({x:t.x*o.x+t.y*a.x,y:t.x*o.y+t.y*a.y,z:t.x*o.z+t.y*a.z});const c=h.cross(r,e);const l=9.5*t.x/s.width;const d=9.5*t.y/s.height;const u=Math.abs(l)+Math.abs(d);return i.rotateAroundAxis(u,c)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,depthBuffer:e})=>{if(this.worldRotationPoint==null){this.worldRotationPoint=e!=null?this.getWorldPoint(i,e,s.lookAt):s.lookAt}const o=h.normalize(s.up);const a=h.normalize(h.subtract(s.lookAt,s.position));const r=h.cross(o,a);const c=h.cross(a,r);const l=h.normalize({x:t.x*r.x+t.y*c.x,y:t.x*r.y+t.y*c.y,z:t.x*r.z+t.y*c.z});const d=h.cross(l,a);const u=9.5*t.x/n.width;const f=9.5*t.y/n.height;const p=Math.abs(u)+Math.abs(f);const m=s.rotateAroundAxisAtPoint(p,this.worldRotationPoint,d);return m.update({lookAt:h.add(h.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/h.magnitude(m.viewVector),m.viewVector),m.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s,frame:n,boundingBox:e})=>{if(s!=null&&n!=null){const o=i===null||i===void 0?void 0:i.toFrameCamera().isPerspective();if(o){const n=i.viewVector;const e=h.magnitude(n);const o=3*e*(t/s.height);const a=h.normalize(n);const r=h.scale(o,a);const c=h.add(i.position,r);const l=i.update({position:c});return l}else{const o=i;const a=i.toFrameCamera();const d=a.direction;const u=s.transformPointToRay(s.center,n.image,a);const f=4*(t/s.height);const p=h.magnitude(l.diagonal(e))*1e-5;const m=Math.max(p,o.fovHeight*(1-f));const w=r.fromNormalAndCoplanarPoint(d,a.lookAt);const v=c.intersectPlane(u,w);if(v!=null){const t=r.projectPoint(w,o.lookAt);const s=(o.fovHeight-m)/o.fovHeight;const n=h.scale(s,h.subtract(v,t));const e=h.add(o.lookAt,n);const a=i.update({lookAt:e,rotationPoint:e,fovHeight:m});return a}}}return i}))}async pivotCamera(t,i){return this.transformCamera((({camera:s})=>{const{position:n,up:e,lookAt:o}=s;const r=h.normalize(e);const c=h.normalize(s.viewVector);const l=h.cross(r,c);const d=h.cross(c,l);const u=h.rotateAboutAxis(a.toRadians(t),o,l,n);const f=h.rotateAboutAxis(a.toRadians(i),u,d,n);return s.update(Object.assign(Object.assign({},s),{lookAt:f}))}))}async endInteraction(){await this.sceneLoadingPromise;if(this.isInteracting()){this.currentCamera=undefined;this.worldRotationPoint=undefined;this.panData=undefined;this.zoomData=undefined;this.resetLastAngle();this.interactionFinishedEmitter.emit();await this.stream.endInteraction()}}resetLastAngle(){this.lastAngle=undefined}isInteracting(){return this.currentCamera!=null}pixelThreshold(t){const i=this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold;return i*window.devicePixelRatio}async hitItems(t){var i;const s=await(await this.getScene()).raycaster().hitItems(t);return(i=s===null||s===void 0?void 0:s.hits)!==null&&i!==void 0?i:[]}emitTapEvent(t,i,s={},n=0){const{altKey:e=false,ctrlKey:o=false,metaKey:h=false,shiftKey:a=false}=s;t({position:i,altKey:e,ctrlKey:o,metaKey:h,shiftKey:a,buttons:n})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}class ci extends ri{constructor(t,i,s,n,e,o,h,a,r,c,l){super(t,i,s,n,e,o,h,a,r,c,l)}async getWorldPointFromViewport(t){const i=this.getViewport();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=i.viewVector;const e=h.normalize(i.up);const a=h.normalize(n);const r=o.scale(t,.5,.5);const c=h.magnitude(n);const l=r.x*c/s.width;const d=r.y*c/s.height;const u=h.cross(e,a);const f=h.cross(a,u);const p=h.add(h.scale(l,u),h.scale(d,f));return i.moveBy(p)}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,boundingBox:e})=>{if(this.panData==null){const e=i.toFrameCamera();const o=e.direction;const h=n.transformPointToRay(t,s.image,e);const a=r.fromNormalAndCoplanarPoint(o,i.lookAt);const l=c.intersectPlane(h,a);if(l==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}this.panData={hitPt:l,hitPlane:a,startingCamera:e}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const r=n.transformPointToRay(t,s.image,a);const l=c.intersectPlane(r,o);if(l!=null){const t=h.subtract(e,l);const s=h.add(a.lookAt,t);return i.update({lookAt:s,rotationPoint:s})}}return i}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:a,boundingBox:d})=>{if(this.orthographicZoomData==null||o.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera();const o=i.direction;const h=n.transformPointToRay(t,e.image,i);const l=r.fromNormalAndCoplanarPoint(o,i.lookAt);const d=c.intersectPlane(h,l);if(d==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const u=a!=null?this.getWorldPoint(t,a,d):d;const f=r.fromNormalAndCoplanarPoint(o,u);this.orthographicZoomData={hitPt:u,hitPlane:f,startingScreenPt:t}}if(this.orthographicZoomData!=null){const{hitPt:t,hitPlane:e}=this.orthographicZoomData;const o=4*(i/n.height);const a=h.magnitude(l.diagonal(d))*1e-5;const c=Math.max(a,s.fovHeight*(1-o));const u=r.projectPoint(e,s.lookAt);const f=(s.fovHeight-c)/s.fovHeight;const p=h.scale(f,h.subtract(t,u));const m=h.add(s.lookAt,p);return s.update({lookAt:m,rotationPoint:m,fovHeight:c})}return s}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{var e;const o=h.normalize(i.up);const a=h.normalize(h.subtract(i.lookAt,i.position));const r=h.cross(o,a);const c=h.cross(a,r);const d=h.normalize({x:t.x*r.x+t.y*c.x,y:t.x*r.y+t.y*c.y,z:t.x*r.z+t.y*c.z});const u=h.cross(d,a);const f=9.5*t.x/s.width;const p=9.5*t.y/s.height;const m=Math.abs(f)+Math.abs(p);const w=i.rotationPoint!=null&&((e=i.rotationPoint)===null||e===void 0?void 0:e.x)!=null?i.rotationPoint:i.lookAt;const v=i.rotateAroundAxisAtPoint(m,w,u);const g=Y(v.lookAt,v.viewVector,l.center(n));return v.update({lookAt:g})}))}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}const li=.2;class di extends ri{constructor(t,i,s,n,e,o,h,a,r,c,l){super(t,i,s,n,e,o,h,a,r,c,l)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var n;const e=i.viewVector;const a=h.normalize(i.up);const r=h.normalize(e);const c=o.scale(t,.25,.25);const l=h.magnitude(e)*Math.tan((n=i.fovY)!==null&&n!==void 0?n:45);const d=c.x*l/s.width;const u=c.y/s.width*l;const f=h.cross(a,r);const p=h.cross(r,f);const m=h.add(h.scale(d,f),h.scale(u,p));return i.moveBy(m)}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:a})=>{const l=e.scene.camera;const d=l.direction;const u=s.toFrameCamera();const f=n.transformPointToRay(t,e.image,u);if(this.zoomData==null){const i=r.fromNormalAndCoplanarPoint(d,l.lookAt);const n=c.intersectPlane(f,i);if(n==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const e=o!=null?this.getWorldPoint(t,o,n):n;const h=r.fromNormalAndCoplanarPoint(d,e);this.zoomData={hitPt:e,hitPlane:h}}if(this.zoomData!=null){const{hitPlane:t}=this.zoomData;const{position:e,distance:o,isPastHitPlane:l,keepCurrent:d}=this.computeZoomDistances(i,s,n,a,f,this.zoomData);if(l&&!d){const t=c.create({origin:e,direction:h.normalize(s.viewVector)});return s.update({position:e,lookAt:c.at(t,o)})}else if(!d){return s.update({position:e,lookAt:r.projectPoint(t,e)})}}return s}))}walk(t){this.transformCamera((({camera:i,boundingBox:s})=>{const{position:n,up:e,lookAt:o}=i;const a=h.normalize(e);const r=h.normalize(i.viewVector);const c=Math.min(...h.toArray(l.lengths(s)));const d=h.scale(c,t);const u=h.cross(a,r);const f=h.cross(u,a);const p=h.scale(d.x,h.normalize(u));const m=h.scale(d.y,h.normalize(a));const w=h.scale(d.z,h.normalize(f));const v=h.negate(h.add(p,m,w));return i.update(Object.assign(Object.assign({},i),{position:h.add(n,v),lookAt:h.add(o,v)}))}))}computeZoomDistances(t,i,s,n,e,o){const a=this.getConfig();const{hitPt:r,hitPlane:l}=o;const d=a.useMinimumPerspectiveZoomDistance?this.computeZoomMinimumDistance(i,n):-1;const u=h.distance(i.position,r);const f=Math.max(d,u);const p=6*f*t/s.height;const m=c.at(e,p);const w=c.create({origin:m,direction:h.normalize(i.viewVector)});const v=c.intersectPlane(w,l);if(v==null&&a.useMinimumPerspectiveZoomDistance){const i=6*d*t/s.height;const n=c.at(e,i);return{position:n,distance:d,isPastHitPlane:true,keepCurrent:false}}else if(v==null){return{position:i.position,distance:f,isPastHitPlane:true,keepCurrent:true}}return{position:m,distance:f,isPastHitPlane:false,keepCurrent:false}}computeZoomMinimumDistance(t,i){const s=Math.abs(i.min.x)+Math.abs(i.max.x);const n=Math.abs(i.min.y)+Math.abs(i.max.y);const e=Math.abs(i.min.z)+Math.abs(i.max.z);const o=Math.max(s,n,e);const a=Math.abs(h.dot(h.normalize(t.viewVector),h.right()));const r=Math.abs(h.dot(h.normalize(t.viewVector),h.up()));const c=Math.abs(h.dot(h.normalize(t.viewVector),h.back()));const l=s*a;const d=n*r;const u=e*c;const f=o/s;const p=o/n;const m=o/e;return(l+d+u)/(f+p+m)*li}}class ui{constructor(t,i,s,n){this.stream=t;this.configProvider=i;this.imageScaleProvider=s;this.sceneProvider=n}predicate(t){return t.altKey&&t.shiftKey}async fn(t){var i,s;const n=this.imageScaleProvider();const e=await this.stream.hitItems({point:o.scale(t.position,(n===null||n===void 0?void 0:n.x)||1,(n===null||n===void 0?void 0:n.y)||1)},true);if(((i=e.hitItems)===null||i===void 0?void 0:i.hits)!=null&&e.hitItems.hits.length>0&&e.hitItems.hits[0].hitPoint!=null){const i=await this.sceneProvider();const n=(await this.sceneProvider()).camera();const o=e.hitItems.hits[0];if(o.hitPoint!=null&&o.hitPoint.x!=null&&o.hitPoint.y!=null&&o.hitPoint.z!=null){const t=h.create(o.hitPoint.x,o.hitPoint.y,o.hitPoint.z);const s=await this.getLookAtPoint(i,t,n.viewVector);await this.stream.flyTo({camera:tt(n.update({lookAt:s,rotationPoint:s}).toFrameCamera()),animation:{duration:p(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit position found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}, hit-id={${(s=o.itemId)===null||s===void 0?void 0:s.hex}}]`)}}else{console.debug(`No hit results found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}getLookAtPoint(t,i,s){if(t.isOrthographic()){return Y(i,s,l.center(t.boundingBox()))}else{return i}}}class fi{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,n){}drag(t,i){}endDrag(t,i){if(this.currentPosition!=null){i.endInteraction();this.currentPosition=undefined}}async zoom(t,i){}}class pi extends fi{constructor(){super(...arguments);this.type="rotate"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCamera(n);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class mi extends fi{constructor(){super(...arguments);this.type="rotate-point"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.startingPosition=i;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.startingPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class wi extends fi{constructor(t){super();this.interactionConfigProvider=t;this.type="zoom";this.didTransformBegin=false}async beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.clientX,t.clientY);const i=n.getBoundingClientRect();const e=jt(t,i);this.startPt=e;await s.beginInteraction()}}async drag(t,i){if(this.currentPosition!=null){const s=o.create(t.clientX,t.clientY);const n=o.subtract(s,this.currentPosition);if(this.startPt!=null){await i.zoomCameraToPoint(this.startPt,n.y);this.currentPosition=s}}}endDrag(t,i){super.endDrag(t,i);this.stopInteractionTimer();this.didTransformBegin=false;this.startPt=undefined}async zoom(t,i){await this.operateWithTimer(i,(()=>i.zoomCamera(this.getDirectionalDelta(t))))}async zoomToPoint(t,i,s){await this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,this.getDirectionalDelta(i))))}async beginInteraction(t){this.didTransformBegin=true;await t.beginInteraction()}async endInteraction(t){this.didTransformBegin=false;await t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer();this.startInteractionTimer(t)}getDirectionalDelta(t){return this.interactionConfigProvider().reverseMouseWheelDirection?-t:t}getInteractionDelay(){return this.interactionConfigProvider().mouseWheelInteractionEndDebounce}startInteractionTimer(t){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.endInteraction(t)}),this.getInteractionDelay())}stopInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}async operateWithTimer(t,i){if(!this.didTransformBegin){await this.beginInteraction(t)}this.resetInteractionTimer(t);i()}}class vi extends fi{constructor(){super(...arguments);this.type="pan"}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.canvasRect!=null){const s=jt(t,this.canvasRect);i.panCameraToScreenPoint(s);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class gi extends fi{constructor(){super(...arguments);this.type="twist"}beginDrag(t,i,s,n){this.currentPosition=o.create(t.offsetX,t.offsetY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}drag(t,i){const s=jt(t,this.canvasRect);this.currentPosition=s;i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class yi extends fi{constructor(){super(...arguments);this.type="pivot"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.pivotCamera(-.25*n.y,.25*n.x);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class bi extends Et{constructor(t,i=new pi,s=new mi,n=new wi((()=>t().interactions)),e=new vi,o=new gi,h=new yi){super("mousedown","mouseup","mousemove",i,s,n,e,o,h,t)}}function Ci(t){window.requestAnimationFrame(t)}class Pi{constructor(){this.previousFirstPoints=[];this.previousSecondPoints=[]}initialize(t,i){this.element=t;this.interactionApi=i}dispose(){this.element=undefined}beginTwoPointTouch(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i]}handleTwoPointTouchMove(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i];Ci((()=>{var t,i,s,n;if(this.previousFirstPoints.length>1&&this.previousSecondPoints.length>1&&this.previousFirstPoints.length===this.previousSecondPoints.length){const e=this.previousFirstPoints;const h=this.previousSecondPoints;this.previousFirstPoints=this.previousFirstPoints.slice(-1);this.previousSecondPoints=this.previousSecondPoints.slice(-1);const a=e.reduce(((t,i,s)=>{if(s<e.length-1){const n=e[s+1];const o=h[s];const a=h[s+1];return{deltas:[...t.deltas,this.computeDelta(i,o,n,a)],zooms:[...t.zooms,this.computeZoom(i,o,n,a)],angles:[...t.angles,this.computeAngle(i,o,n,a)]}}return t}),{deltas:[],zooms:[],angles:[]});const r=a.deltas.reduce(((t,i)=>o.add(t,i)),o.create());const c=a.zooms.reduce(((t,i)=>t+i),0);const l=a.angles.reduce(((t,i)=>t+i),0);const d=o.create((e[e.length-1].x+h[h.length-1].x)/2,(e[e.length-1].y+h[h.length-1].y)/2);(t=this.interactionApi)===null||t===void 0?void 0:t.beginInteraction();(i=this.interactionApi)===null||i===void 0?void 0:i.zoomCameraToPoint(d,c);(s=this.interactionApi)===null||s===void 0?void 0:s.panCameraByDelta(r);(n=this.interactionApi)===null||n===void 0?void 0:n.twistCamera(l)}}))}endTwoPointTouch(){this.previousFirstPoints=[];this.previousSecondPoints=[]}computeDelta(t,i,s,n){return o.add(o.subtract(s,t),o.subtract(n,i))}computeZoom(t,i,s,n){const e=o.distance(s,n)-o.distance(t,i);return e*.5}computeAngle(t,i,s,n){const e=d.create(o.subtract(t,i),o.subtract(s,n));return a.toDegrees(Math.atan2(d.determinant(e),d.dot(e)))}}class Si extends Pi{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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);super.dispose()}initialize(t,i){super.initialize(t,i);t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=o.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},this.touchPoints),{[t.pointerId]:i});const s=Object.keys(this.touchPoints);if(s.length===1){window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}else if(s.length===2){this.beginTwoPointTouch(this.touchPoints[0],this.touchPoints[1])}}handlePointerMove(t){if(this.touchPoints[t.pointerId]!=null){this.touchPoints[t.pointerId]=o.create(t.screenX,t.screenY)}const i=Object.keys(this.touchPoints);if(i.length===2){const t=this.touchPoints[i[0]];const s=this.touchPoints[i[1]];this.handleTwoPointTouchMove(t,s)}}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);if(s.length===1){(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction()}if(s.length===0){window.removeEventListener("pointermove",this.handlePointerMove);window.removeEventListener("pointerup",this.handlePointerUp)}this.endTwoPointTouch()}}class Ii extends Mt{constructor(t,i=new pi,s=new mi,n=new wi((()=>t().interactions)),e=new vi,o=new gi,h=new yi){super("pointerdown","pointerup","pointermove",i,s,n,e,o,h,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)}addEventListenersToElement(t){t.addEventListener(this.downEvent,this.handleDownEvent);t.addEventListener("wheel",this.handleMouseWheel,{passive:false});return{dispose:()=>{t.removeEventListener(this.downEvent,this.handleDownEvent);t.removeEventListener("wheel",this.handleMouseWheel)}}}handlePointerDown(t){this.downPosition=o.create(t.screenX,t.screenY);this.touchPoints.add(t.pointerId);if(this.touchPoints.size===1){window.addEventListener("pointerup",this.handlePointerUp)}if(this.touchPoints.size===2){this.disableIndividualInteractions=true}}handlePointerUp(t){this.touchPoints.delete(t.pointerId);if(this.touchPoints.size<2){this.disableIndividualInteractions=false}if(this.touchPoints.size===0){window.removeEventListener("pointerup",this.handlePointerUp)}}}class Ti{constructor(t,i,s,n){this.downEvent=t;this.upEvent=i;this.moveEvent=s;this.getConfig=n;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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener(this.downEvent,this.handleDown);(i=this.element)===null||i===void 0?void 0:i.removeEventListener("touchstart",this.handleTouchStart);this.element=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer()}initialize(t,i){this.element=t;this.interactionApi=i;t.addEventListener(this.downEvent,this.handleDown);t.addEventListener("touchstart",this.handleTouchStart,{passive:true})}handleTouchStart(t){if(t.touches.length===1){this.setPointerPositions(o.create(t.touches[0].clientX,t.touches[0].clientY));this.restartLongPressTimer();window.addEventListener("touchend",this.handleTouchEnd);window.addEventListener("touchmove",this.handleTouchMove)}}handleTouchMove(t){if(t.touches.length>0){this.handlePointerMove(o.create(t.touches[0].clientX,t.touches[0].clientY),true)}}handleTouchEnd(t){if(this.pointerDownPosition!=null){window.removeEventListener("touchend",this.handleTouchEnd);window.removeEventListener("touchmove",this.handleTouchMove)}this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(o.create(t.clientX,t.clientY));this.buttons=t.buttons;const i={altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey};this.restartLongPressTimer(i);window.addEventListener(this.upEvent,this.handleUp);window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(o.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){if(this.pointerDownPosition!=null){window.removeEventListener(this.upEvent,this.handleUp);window.removeEventListener(this.moveEvent,this.handleMove)}this.handlePointerEnd(o.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t));this.buttons=undefined}handlePointerMove(t,i){var s;const n=((s=this.interactionApi)===null||s===void 0?void 0:s.pixelThreshold(i))||2;if(this.pointerDownPosition!=null&&o.distance(t,this.pointerDownPosition)>=n&&this.interactionTimer==null){this.clearPositions()}}handlePointerEnd(t,i={},s=0,n=false){var e,o;if(t!=null){if(this.longPressTimer!=null){this.emit((e=this.interactionApi)===null||e===void 0?void 0:e.tap)(t,i,s)}if(this.doubleTapTimer!=null&&this.secondPointerDownPosition!=null){this.emit((o=this.interactionApi)===null||o===void 0?void 0:o.doubleTap)(t,i,s,this.secondPointerDownPosition);this.clearDoubleTapTimer()}}this.pointerDownPosition=undefined;this.clearLongPressTimer()}emit(t){return(i,s={},n=0,e,h=false)=>{var a;const r=e||this.pointerDownPosition;const c=((a=this.interactionApi)===null||a===void 0?void 0:a.pixelThreshold(h))||1;let l;if(this.interactionTimer!=null){l=this.getCanvasPosition(r||i)}else if(r!=null&&o.distance(r,i)<=c){l=this.getCanvasPosition(i)}if(l!=null&&t!=null){t(l,s,n)}}}getCanvasPosition(t){var i;const s=(i=this.element)===null||i===void 0?void 0:i.getBoundingClientRect();const n=s!=null?o.create(s.left,s.top):undefined;return n!=null?o.subtract(o.create(t.x,t.y),n):undefined}clearPositions(){this.pointerDownPosition=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer();this.clearInteractionTimer()}clearDoubleTapTimer(){if(this.doubleTapTimer!=null){window.clearTimeout(this.doubleTapTimer)}this.doubleTapTimer=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined}restartDoubleTapTimer(){this.clearDoubleTapTimer();this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){if(this.longPressTimer!=null){window.clearTimeout(this.longPressTimer)}this.longPressTimer=undefined}restartLongPressTimer(t={}){this.clearLongPressTimer();this.longPressTimer=window.setTimeout((()=>{var i;if(this.pointerDownPosition){this.emit((i=this.interactionApi)===null||i===void 0?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons)}this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer();this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=undefined}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}setPointerPositions(t){this.pointerDownPosition=t;this.restartInteractionTimer();if(this.firstPointerDownPosition==null){this.restartDoubleTapTimer();this.firstPointerDownPosition=t}else{this.secondPointerDownPosition=t}}isTouch(t){return window.PointerEvent!=null&&t instanceof PointerEvent?t.pointerType==="touch":false}}class Ai extends Pi{constructor(){super();this.handleTouchStart=this.handleTouchStart.bind(this);this.handleTouchMove=this.handleTouchMove.bind(this);this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;(t=this.element)===null||t===void 0?void 0: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){t.preventDefault();const i=t.touches[0];this.currentPosition1=o.create(i.screenX,i.screenY);if(t.touches[1]!=null){this.beginTwoPointTouch(this.currentPosition1,o.create(t.touches[1].screenX,t.touches[1].screenY))}window.addEventListener("touchmove",this.handleTouchMove,{passive:false});window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){t.preventDefault();if(t.touches.length===1){this.handleOnePointTouchMove(t.touches[0])}else if(t.touches.length===2){const i=o.create(t.touches[0].clientX,t.touches[0].clientY);const s=o.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;t.preventDefault();(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction();this.isInteracting=false;window.removeEventListener("touchmove",this.handleTouchMove);window.removeEventListener("touchend",this.handleTouchEnd);this.endTwoPointTouch()}handleOnePointTouchMove(t){var i,s,n;const e=o.create(t.screenX,t.screenY);if(this.currentPosition1!=null){const t=o.subtract(e,this.currentPosition1);const h=((i=this.interactionApi)===null||i===void 0?void 0:i.pixelThreshold(true))||2;if(o.distance(e,this.currentPosition1)>=h||this.isInteracting){(s=this.interactionApi)===null||s===void 0?void 0:s.beginInteraction();(n=this.interactionApi)===null||n===void 0?void 0:n.rotateCamera(t);this.isInteracting=true}}this.currentPosition1=e}}class ki{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(Vt(t)){const i=this.begin();return t.finally((()=>this.end(i)))}else if(typeof t==="function"){const i=this.begin();const s=t();this.end(i);return s}else{throw new Error("Input must be a function or Promise")}}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);this.clearMeasurements();return t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;this.measures.add(t);this.perf.mark(t);return t}end(t){this.perf.measure(this.name,t);this.perf.clearMarks(t);this.measures.delete(t)}}const ji=new ki("paint_time");function Di(t){return new Promise(((i,s)=>{const n=new Blob([t]);const e=URL.createObjectURL(n);const o=new Image;o.addEventListener("load",(()=>{i({image:o,dispose:()=>undefined});URL.revokeObjectURL(e)}));o.addEventListener("error",(()=>{s(new D("Failed to load image data"));URL.revokeObjectURL(e)}));o.src=e}))}async function Oi(t){const i=new Blob([t]);const s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}function xi(t){if(window.createImageBitmap!=null){return Oi(t)}else{return Di(t)}}const Ei=1e3;function Mi(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)}function Ri(t,i){const s=t.takeMeasurements();if(s.length>0){i(s)}}function Bi(t,i,s,n,e=Ei){let o;let h=0;let a;let r=[];function c(){h++;if(o==null){o=setInterval((()=>{Ri(t,n);if(h===0){d()}}),e)}}function l(){h--}function d(){if(o!=null){clearInterval(o);o=undefined}}if(s){setInterval((()=>{if(a!=null){if(r.length===5){r=[...r.slice(1),a]}else{r.push(a)}const t=r.reduce(((t,i)=>t+i))/r.length;console.debug(`Paint rate: ${a}fps`);console.debug(`Paint rate (avg): ${t}`);a=undefined}}),1e3)}return s=>{c();return t.measure((async()=>{const t=await i(s);a=a==null?1:a+1;return t})).finally((()=>l()))}}function zi(){let t=[];function i(i){if(i!=null){const s=i.copy({correlationIds:[...i.correlationIds,...t.filter((t=>!i.correlationIds.includes(t)))]});t=[];return s}return i}function s(){let t=-1;return async i=>{if(i.frame.sequenceNumber>t){const s=await xi(i.frame.image.imageBytes);t=i.frame.sequenceNumber;return s}}}function n(){let t=-1;return async(i,s)=>{var n;if(s!=null&&i.frame.sequenceNumber>t){t=i.frame.sequenceNumber;(n=i.beforeDraw)===null||n===void 0?void 0:n.call(i);Mi(s,i);s.dispose();return i.frame}s===null||s===void 0?void 0:s.dispose()}}const e=s();const o=n();return async s=>{var n,h;const a=(h=(n=s.predicate)===null||n===void 0?void 0:n.call(s))!==null&&h!==void 0?h:true;t=[...t,...s.frame.correlationIds];if(a){return e(s).then((t=>o(s,t).then(i)))}}}function $i(t){return i=>{var s;const n=(s=i.request.requestId)===null||s===void 0?void 0:s.value;if(n!=null){t(n)(i)}}}function Li(t){return i=>{const{drawFrame:s}=i.request;if(s!=null){t(s)(i)}}}const Vi=1*60;function Fi(t){let i=false;return s=>{const n=t();if(n!=null){const t=n.remoteTime(new Date(Date.now()));const e=p(s,t);const o=m(e).getTime();if(o>=0){return e}else{if(!i){console.warn(`Possible erroneous send to receive timing. Muting for ${Vi}s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`);i=true;setTimeout((()=>i=false),Vi*1e3)}return undefined}}}}function Ki(t,i){const s=Fi(i);return $i((i=>Li((n=>n=>{const e=m(n.sentAtTime);if(e!=null){t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})}}))))}const Hi=b.defineMapper(b.read(b.requiredProp("d"),b.requiredProp("ns"),b.mapRequiredProp("ka",it),b.mapRequiredProp("kd",it),b.mapRequiredProp("ks",it),b.mapRequiredProp("ke",it)),(([t,i,s,n,e,o])=>({opacity:t,glossiness:i,ambient:s,diffuse:n,specular:e,emissive:o})));const Ni=b.defineMapper(b.read(b.mapRequiredProp("defaultMaterial",(()=>bt)),b.mapRequiredProp("colorMaterial",Hi)),(([t,i])=>({defaultMaterial:t,colorMaterial:i})));const Wi=b.defineMapper(b.read(b.requiredProp("name"),b.requiredProp("category")),(([t,i])=>({name:t,category:i})));const qi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"string",value:t})));const Ui=b.mapProp("string",b.ifDefined(qi));const _i=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"long",value:t})));const Ji=b.mapProp("pb_long",b.ifDefined(_i));const Xi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"double",value:t})));const Gi=b.mapProp("pb_double",b.ifDefined(Xi));const Zi=b.defineMapper(b.read(b.requiredProp("value")),(([t])=>({type:"timestamp",value:t})));const Qi=b.mapProp("date",b.ifDefined(Zi));const Yi=b.compose(b.pickFirst(Ui,Ji,Gi,Qi),b.required("value"));const ts=b.defineMapper(b.read(b.requiredProp("id"),b.mapProp("key",b.ifDefined(Wi)),b.mapProp("value",b.ifDefined(Yi))),(([t,i,s])=>({id:t,key:i,value:s})));const is=b.defineMapper(b.read(b.mapProp("cursor",st),b.mapRequiredProp("entriesList",b.mapArray(ts))),(([t,i])=>({paging:{next:t},entries:i})));const ss=b.ifInvalidThrow(is);const ns=b.defineMapper(b.read(b.mapRequiredProp("id",_),b.mapRequiredProp("createdAt",nt),b.mapProp("materialOverride",b.ifDefined(Ni)),b.mapProp("transform",b.ifDefined(et)),b.mapProp("isVisible",b.ifDefined(ot)),b.mapProp("isSelected",b.ifDefined(ot)),b.mapProp("isPhantom",b.ifDefined(ot)),b.mapProp("endItem",b.ifDefined(ot))),(([t,i,s,n,e,o,h,a])=>({id:t,createdAt:i,materialOverride:s,transform:n,isVisible:e,isSelected:o,isPhantom:h,endItem:a})));const es=b.defineMapper(b.read(b.mapRequiredProp("id",_),b.mapRequiredProp("createdAt",nt),b.mapRequiredProp("name",X),b.mapProp("parentId",b.ifDefined(_)),b.mapProp("suppliedId",b.ifDefined(X)),b.mapProp("boundingBox",b.ifDefined(ht)),b.mapProp("worldTransform",b.ifDefined(et)),b.mapProp("override",b.ifDefined(ns))),(([t,i,s,n,e,o,h,a])=>({id:t,createdAt:i,name:s,parentId:n!==null&&n!==void 0?n:undefined,suppliedId:e,boundingBox:o,worldTransform:h,override:a})));const os=b.ifInvalidThrow(b.defineMapper(b.read(b.mapProp("item",b.ifDefined(es))),(([t])=>t!==null&&t!==void 0?t:undefined)));class hs{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getSceneViewItem(t,i,s){const n=await K((async n=>{const e=this.deviceIdProvider();const o=await H(this.jwtProvider,e);const h=new L.GetSceneViewItemRequest;h.setSceneItemId(yt(t));h.setViewId(yt(i));const a=new F.FieldMask;if(s.includeBoundingBox){a.addPaths("bounding_box")}if(s.includeWorldTransform){a.addPaths("world_transform")}if(s.includeOverride){a.addPaths("override")}h.setAdditionalFields(a);this.client.getSceneViewItem(h,o,n)}));return os(n.toObject())}async listSceneItemMetadata(t,i){const s=await K((async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneItemMetadataRequest;o.setItemId(yt(t));const h=new O.Pager;if(i.size!=null){h.setLimit(i.size)}if(i.cursor!=null){h.setCursor(i.cursor)}o.setPager(h);this.client.listSceneItemMetadata(o,e,s)}));return ss(s.toObject())}}var as;(function(t){t["DEVICE_ID"]="vertexvis:device-id"})(as||(as={}));function rs(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){const e=Object.assign(Object.assign({},JSON.parse(n)),i);s.setItem(t,JSON.stringify(e))}else{s.setItem(t,JSON.stringify(i))}}function cs(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){return i(JSON.parse(n))}}var ls=function t(i,s){if(i===s)return true;if(i&&s&&typeof i=="object"&&typeof s=="object"){if(i.constructor!==s.constructor)return false;var n,e,o;if(Array.isArray(i)){n=i.length;if(n!=s.length)return false;for(e=n;e--!==0;)if(!t(i[e],s[e]))return false;return true}if(i.constructor===RegExp)return i.source===s.source&&i.flags===s.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===s.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===s.toString();o=Object.keys(i);n=o.length;if(n!==Object.keys(s).length)return false;for(e=n;e--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[e]))return false;for(e=n;e--!==0;){var h=o[e];if(!t(i[h],s[h]))return false}return true}return i!==i&&s!==s};function ds(t,i,s,n){return P.retry((()=>{if(!t.aborted){return i()}return Promise.resolve(s)}),n)}class us extends w{constructor(t,i={}){var s,n,e,o,h;super(t,{loggingEnabled:i.loggingEnabled});this.state={type:"disconnected"};this.stateChanged=new C;this.dimensions=u.create(0,0);this.streamAttributes={};this.enableTemporalRefinement=(s=i.enableTemporalRefinement)!==null&&s!==void 0?s:true;this.frameBgColor=S.create(255,255,255);this.config=At("platprod");this.options={tokenRefreshOffsetInSeconds:(n=i.tokenRefreshOffsetInSeconds)!==null&&n!==void 0?n:30,offlineThresholdInSeconds:(e=i.offlineThresholdInSeconds)!==null&&e!==void 0?e:30,loadTimeoutInSeconds:(o=i.loadTimeoutInSeconds)!==null&&o!==void 0?o:15,enableTemporalRefinement:(h=i.enableTemporalRefinement)!==null&&h!==void 0?h:true}}isPaused(){return this.pausedState!=null}getState(){return this.state}disconnect(){if(this.state.type!=="disconnected"&&this.state.type!=="connection-failed"){console.debug("Disconnecting websocket");this.state.connection.dispose();this.updateState({type:"disconnected"})}}async load(t,i,s,n=At("platprod"),e){this.clientId=i;this.deviceId=s;this.config=n;if(this.state.type==="disconnected"){await this.loadIfDisconnected(t,e)}else if(this.state.type==="connection-failed"){await this.loadIfDisconnected(t,e)}else{await this.loadIfConnectingOrConnected(t,this.state,e)}return this.state}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor;if(t.dimensions!=null&&!ls(t.dimensions,this.dimensions)){this.dimensions=t.dimensions;this.ifState("connected",(()=>this.updateDimensions({dimensions:this.getDimensions()})))}const i=!ls(this.streamAttributes,t.streamAttributes);if(t.streamAttributes!=null&&i){this.streamAttributes=t.streamAttributes;this.ifState("connected",(()=>this.updateStream({streamAttributes:fs(this.streamAttributes)})))}if(t.enableTemporalRefinement!=null&&t.enableTemporalRefinement!==this.enableTemporalRefinement){this.enableTemporalRefinement=t.enableTemporalRefinement;if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}}pause(){if(this.state.type==="connected"){this.pausedState=this.state;console.debug(`Stream paused [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);this.disconnect()}}async resume(){if(this.pausedState!=null){console.debug(`Stream resumed [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);await this.connectToExistingStream(this.pausedState);this.pausedState=undefined}}async loadIfConnectingOrConnected(t,i,s){var n;const{resource:e,subResource:o}=i.resource;const h=Ct(t);const a=!I.isEqual(e,h.resource);const r=!I.isEqual(o,h.subResource);const c=i.type==="connecting"||i.type==="reconnecting";const l=i.type==="connected";if(a||c&&r){this.disconnect();return this.loadIfDisconnected(t)}else if(l&&r&&((n=h.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"){const t=h.queries.find((t=>t.type==="supplied-id"));const n=Object.assign(Object.assign(Object.assign({},h.subResource.id!=null?{sceneViewStateId:{hex:h.subResource.id}}:{}),t!=null?{sceneViewStateSuppliedId:{value:t.id}}:{}),s!=null?{cameraType:ms(s)}:{});await this.loadSceneViewState(n);this.updateState(Object.assign(Object.assign({},i),{resource:h}))}}async loadIfDisconnected(t,i){try{await this.connectWithNewStream(Ct(t),i)}catch(t){if(t instanceof x){this.updateState({type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t})}else if(t instanceof v){this.updateState({type:"connection-failed",message:`Cannot load scene. Stream request failed to start stream.`,error:t})}else{this.updateState({type:"connection-failed",message:`Cannot load scene for unknown reason. See console logs.`,error:t})}throw t}}connectWithNewStream(t,i){return this.openWebsocketStream(t,"connecting",(()=>this.requestNewStream(t,i)))}connectToExistingStream(t){return this.openWebsocketStream(t.resource,"reconnecting",(()=>this.requestReconnectStream(t)),{maxRetries:Number.POSITIVE_INFINITY})}async openWebsocketStream(t,i,s,{maxRetries:n=3}={}){var e;const o=vs(gs(this.config,t.resource,this.clientId,this.deviceId));console.debug(`Initiating WS connection [uri=${o.url}]`);(e=this.abortController)===null||e===void 0?void 0:e.abort();const h=new AbortController;this.abortController=h;const a=ws(this.config);this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose();h.abort()}}});const r=await P.abort(h.signal,ds(h.signal,(()=>this.connect(o,a)),{dispose:()=>{}},{maxRetries:n,delaysInMs:us.WS_RECONNECT_DELAYS})).catch((t=>{throw new E("Websocket connection failed.",t instanceof Error?t:undefined)}));if(!r.aborted){return this.requestNewOrExistingStream(t,r.result,s)}else{this.updateState({type:"disconnected"})}}async requestNewOrExistingStream(t,i,s){const n=this.requestClock();const e=await s();console.debug(`Stream connected [stream-id=${e.streamId}, scene-id=${e.sceneId}, scene-view-id=${e.sceneViewId}]`);const o=this.onRequest((t=>{const i=t.request.drawFrame;if(i!=null){const t=lt(e.worldOrientation)(i);if(this.state.type==="connected"){if(t.depthBufferBytes!=null||this.state.frame.temporalRefinementCorrelationId!==t.temporalRefinementCorrelationId){this.updateState(Object.assign(Object.assign({},this.state),{frame:t,fallbackDepthBufferBytes:t.depthBufferBytes}))}else{this.updateState(Object.assign(Object.assign({},this.state),{frame:t.copy({depthBufferBytes:this.state.fallbackDepthBufferBytes})}))}}}}));const h=this.reconnectWhenNeeded();const a=this.refreshTokenWhenExpired(e.token);const r=this.acknowledgeFrameRequests();const c=e.frame==null?await this.waitForFrame(e.worldOrientation,this.options.loadTimeoutInSeconds):e.frame;const l=await n;console.debug(`Synchronized clocks [local-time=${l.knownLocalTime.toISOString()}, remote-time=${l.knownRemoteTime.toISOString()}]`);this.updateState({type:"connected",connection:{dispose:()=>{h.dispose();o.dispose();a.dispose();r.dispose();i.dispose()}},resource:t,streamId:e.streamId,deviceId:e.deviceId,sceneId:e.sceneId,sceneViewId:e.sceneViewId,worldOrientation:e.worldOrientation,token:e.token,frame:c,clock:l,fallbackDepthBufferBytes:undefined})}async requestNewStream(t,i){var s,n;const e=t.queries.find((t=>t.type==="supplied-id"));const o=dt(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.getDimensions(),frameBackgroundColor:ps(this.frameBgColor),clientSupportsTemporalRefinement:this.enableTemporalRefinement,streamAttributes:fs(this.streamAttributes),sceneViewStateId:((s=t.subResource)===null||s===void 0?void 0:s.type)==="scene-view-state"&&t.subResource.id!=null?{hex:t.subResource.id}:undefined,sceneViewStateSuppliedId:((n=t.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"&&e!=null?{value:e.id}:undefined,cameraType:i!=null?ms(i):undefined}));return{resource:t,streamId:o.streamId,sceneId:o.sceneId,sceneViewId:o.sceneViewId,deviceId:o.sessionId,token:o.token,worldOrientation:o.worldOrientation,frame:undefined,fallbackDepthBufferBytes:undefined}}async requestReconnectStream(t){const i=ut(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.getDimensions(),frameBackgroundColor:ps(this.frameBgColor),streamAttributes:fs(this.streamAttributes),clientSupportsTemporalRefinement:this.enableTemporalRefinement}));return Object.assign(Object.assign({},t),{token:i.token})}async requestClock(){const t=ft(await this.syncTime({requestTime:g()}));return new Pt(t)}reconnectWhenNeeded(){const t=this.onClose((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}));const i=this.onRequest((t=>{const i=t.request.gracefulReconnection!=null;if(i&&this.state.type==="connected"){console.debug("Received request for graceful reconnect. Closing connection and attempting reconnect.");this.closeAndReconnect(this.state)}}));const s=this.reconnectWhenOffline();return{dispose:()=>{t.dispose();i.dispose();s.dispose()}}}refreshTokenWhenExpired(t){let i;const s=t=>{const{tokenRefreshOffsetInSeconds:n}=this.options;const e=t.remainingTimeInMs(n);i=window.setTimeout((async()=>{const t=await this.refreshToken();const i=pt(t);s(i);if(this.state.type==="connected"){this.updateState(Object.assign(Object.assign({},this.state),{token:i}))}}),e)};s(t);return{dispose:()=>clearTimeout(i)}}reconnectWhenOffline(){let t;const i=()=>window.clearTimeout(t);const s=()=>{i();const s=this.options.offlineThresholdInSeconds;console.debug(`Detected that host is offline. Will attempt reconnect in ${s}s.`);t=window.setTimeout((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}),s*1e3)};const n=()=>{console.debug("Detected that host is online.");i()};const e=()=>s();window.addEventListener("offline",e);window.addEventListener("online",n);return{dispose:()=>{i();window.removeEventListener("offline",e);window.removeEventListener("online",n)}}}closeAndReconnect(t){t.connection.dispose();return this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await P.timeout(i*1e3,new Promise((i=>{s=this.onRequest((n=>{try{const e=n.request.drawFrame;if(e!=null){const s=lt(t)(e);i(s)}}finally{s===null||s===void 0?void 0:s.dispose()}}))})))}catch(t){throw new M(`Frame timed out after ${i}s`,t instanceof Error?t:undefined)}finally{s===null||s===void 0?void 0:s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(Ki(this,(()=>this.state.type==="connected"?this.state.clock:undefined)))}updateState(t){if(this.state!==t){this.state=t;this.stateChanged.emit(this.state)}}getDimensions(){if(u.area(this.dimensions)===0){return u.create(1,1)}return this.dimensions}ifState(t,i){if(this.state.type===t){return i()}}onStateChanged(t){return this.stateChanged.on(t)}}us.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const fs=b.ifInvalidThrow(at);const ps=b.ifInvalidThrow(rt);const ms=b.ifInvalidThrow(ct);function ws(t){return{EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},t.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:t.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},t.EXPERIMENTAL_adaptiveRendering),{enabled:t.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},t.EXPERIMENTAL_qualityOfService)}}function vs(t){return{url:T.toString(t),protocols:["ws.vertexvis.com"]}}function gs(t,i,s,n){if(s!=null){return T.appendPath(T.toString(T.parseAndAddParams("/ws",{clientId:s,deviceId:n})),T.parse(t.network.renderingHost))}else{return T.appendPath(`/stream-keys/${i.id}/session`,T.parse(t.network.renderingHost))}}class ys{constructor(t){this.callback=t;this.handleVisibilityChange=this.handleVisibilityChange.bind(this);this.emitVisibilityChange=this.emitVisibilityChange.bind(this);this.mutationObservers=[]}isVisible(t){if("checkVisibility"in t){return t.checkVisibility({visibilityProperty:true,opacityProperty:true})}return true}observe(t){this.targetElement=t;this.watchElementVisibility(t)}unobserve(){if(this.targetElement!=null){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}this.targetElement=undefined}disconnect(){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}watchElementVisibility(t){if(t!=null){const i=new MutationObserver(this.handleVisibilityChange);i.observe(t,{attributes:true,attributeFilter:["style","class","hidden"]});this.mutationObservers=[...this.mutationObservers,i];this.watchElementVisibility(t.parentElement)}}handleVisibilityChange(){if(this.targetElement!=null){this.emitVisibilityChange(this.targetElement)}}emitVisibilityChange(t){const i=t!=null?this.isVisible(t):true;console.debug(`Detected visibility change [visible={${i}}]`);this.callback(i)}}const bs=15e3;function Cs(t){return t.getBoundingClientRect()}function Ps(t,i){const s=window.getComputedStyle(t);const n=s.getPropertyValue(i);return n!==""?n:undefined}const Ss=":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;user-select:none;-webkit-user-select:none}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden}.error-message{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";const Is=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.annotationStateChanged=i(this,"annotationStateChanged",7);this.deviceIdChange=i(this,"deviceIdChange",7);this.dimensionschange=i(this,"dimensionschange",7);this.configEnv="platprod";this.cameraControls=true;this.cameraType="perspective";this.keyboardControls=true;this.rotateAroundTapPoint=true;this.phantom={opacity:.1};this.noDefaultLights=false;this.enableTemporalRefinement=true;this.experimentalRenderingOptions="";this.crossSectioning={endCapEnabled:true,endCapColor:undefined};this.resizeDebounce=100;this.stencilBuffer=new $t(this.hostElement);this.viewport=xt.fromDimensions(u.create(0,0));this.experimentalSkipVisibilityCheck=false;this.stateMap={cursorManager:new kt,streamState:{type:"disconnected"}};this.isVisible=false;this.interactionHandlers=[];this.defaultInteractionHandlerDisposables=[];this.tapKeyInteractions=[];this.defaultTapKeyInteractions=[];this.internalFrameDrawnDispatcher=new C;this.handleElementResize=this.handleElementResize.bind(this);this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}connectedCallback(){var t,i;this.visibilityObserver=new ys(this.handleVisibilityChange);this.isVisible=this.visibilityObserver.isVisible(this.hostElement);if(!this.isVisible){(t=this.visibilityObserver)===null||t===void 0?void 0:t.observe(this.hostElement)}(i=this.stream)===null||i===void 0?void 0:i.resume()}componentWillLoad(){var t;this.updateResolvedConfig();this.calculateComponentDimensions();this.resizeObserver=new ResizeObserver(this.handleElementResize);this.registerSlotChangeListeners();const i=this.getResolvedConfig();const s=new f(i.network.sceneViewHost);this.annotations=new _t(s,(()=>this.token),(()=>this.deviceId));this.annotations.onStateChange.on((t=>{this.annotationStateChanged.emit(t);const i=Object.keys(t.annotations).length;this.handleAnnotationSetsChange(i)}));this.stream=(t=this.stream)!==null&&t!==void 0?t:new us(new y,{loggingEnabled:i.flags.logWsMessages,enableTemporalRefinement:this.enableTemporalRefinement});this.addStreamListeners();this.modelViews=new St(s,this.stream,(()=>this.token),(()=>this.deviceId));this.pmi=new It(s,(()=>this.token),(()=>this.deviceId));this.sceneItems=new hs(s,(()=>this.token),(()=>this.deviceId));this.canvases=new hi(s,(()=>this.token),(()=>this.deviceId));this.updateStreamAttributes();this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}async componentDidLoad(){var t,i,s;this.interactionApi=this.createInteractionApi();this.isVisible=(i=(t=this.visibilityObserver)===null||t===void 0?void 0:t.isVisible(this.hostElement))!==null&&i!==void 0?i:true;if(this.canvasContainerElement!=null){(s=this.resizeObserver)===null||s===void 0?void 0:s.observe(this.canvasContainerElement)}this.loadOrResumeStream().catch((t=>{console.error("Error loading scene",t)}));await this.initializeDefaultInteractionHandlers();this.injectViewerApi()}disconnectedCallback(){var t,i,s;(t=this.visibilityObserver)===null||t===void 0?void 0:t.disconnect();(i=this.annotations)===null||i===void 0?void 0:i.disconnect();(s=this.stream)===null||s===void 0?void 0:s.pause()}render(){var t;return s(n,null,s("div",{ref:t=>this.viewerContainerElement=t,class:"viewer-container",style:{cursor:Dt((t=this.cursor)!==null&&t!==void 0?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.canvasContainerElement=t,class:k("canvas-container",{"enable-pointer-events ":window.PointerEvent!=null})},s("canvas",{ref:t=>{this.canvasElement=t;this.stateMap.interactionTarget=t},class:"canvas"}),this.errorMessage!=null?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){this.interactionHandlers.push(t);this.initializeInteractionHandler(t);return{dispose:()=>{const i=this.interactionHandlers.indexOf(t);if(i!==-1){this.interactionHandlers[i].dispose();this.interactionHandlers.splice(i,1)}}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget_DEPRECATED(){if(this.stateMap.interactionTarget!=null){return this.stateMap.interactionTarget}else 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){if(t!=null){this.load(t,{cameraType:this.cameraType})}else{this.unload()}}handleCameraControlsChanged(){this.initializeDefaultCameraInteractionHandlers()}handleKeyboardControlsChanged(){this.initializeDefaultKeyboardInteractionHandlers()}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributes();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}else{(i=this.baseInteractionHandler)===null||i===void 0?void 0:i.setPrimaryInteractionType("rotate")}}handleCameraTypeChanged(t,i){if(t!==i){this.updateCameraType()}}handleStreamAttributesChanged(){this.updateStreamAttributes()}handleEnableTemporalRefinementChanged(){this.updateEnableTemporalRefinement()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t,i){var s,n;const e=this.experimentalSkipVisibilityCheck||this.isVisible;if(!e){console.debug("Detected the viewer is hidden. Delaying load until visible.");return}if(this.stream!=null&&this.dimensions!=null){const{EXPERIMENTAL_annotationPollingIntervalInMs:e}=this.getResolvedConfig();this.calculateComponentDimensions();this.stream.update({streamAttributes:this.getStreamAttributes(),config:At(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()});const o=await((s=this.stream)===null||s===void 0?void 0:s.load(t,this.clientId,this.getDeviceId(),this.getResolvedConfig(),i===null||i===void 0?void 0:i.cameraType));if(o.type==="connected"){this.sceneReady.emit();if(e!==undefined){(n=this.annotations)===null||n===void 0?void 0:n.connect(e)}}}else{throw new R("Cannot load scene. Viewer has not been initialized.")}}async unload(){var t;if(this.stream!=null){(t=this.annotations)===null||t===void 0?void 0:t.disconnect();this.stream.disconnect();this.frame=undefined;this.errorMessage=undefined}if(this.canvasElement!=null){const t=this.canvasElement.getContext("2d");if(t!=null){t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}}async reload(){if(this.src!=null){await this.unload();await this.load(this.src,{cameraType:this.cameraType})}}async scene(){return this.createScene()}async isSceneReady(){return this.stateMap.streamState.type==="connected"}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}emitConnectionChange(t){if(t.status==="connected"){if(t.jwt.length===0){throw new B("JWT is empty")}}this.connectionChange.emit(t)}handleElementResize(t){const i=t.length>0&&this.dimensions!=null&&!u.isEqual(t[0].contentRect,this.viewport);if(i){if(this.resizeTimer!=null){clearTimeout(this.resizeTimer);this.resizeTimer=undefined}if(!this.isResizing){this.resizeTimer=setTimeout((()=>{this.isResizing=true;this.isResizeUpdate=true;this.recalculateComponentDimensions()}),this.resizeDebounce)}}}handleVisibilityChange(t){var i;this.isVisible=t;if(this.isVisible){(i=this.visibilityObserver)===null||i===void 0?void 0:i.disconnect();this.loadOrResumeStream()}}async loadOrResumeStream(){var t,i,s;const n=(i=(t=this.stream)===null||t===void 0?void 0:t.isPaused())!==null&&i!==void 0?i:false;if(this.src!=null&&!n){await this.load(this.src,{cameraType:this.cameraType})}else if(n){(s=this.stream)===null||s===void 0?void 0:s.resume()}}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((t=>this.injectViewerApi()));this.mutationObserver.observe(this.hostElement,{childList:true,subtree:true});this.styleObserver=new MutationObserver((t=>this.syncViewerStyles()));this.styleObserver.observe(this.hostElement,{attributes:true,attributeFilter:["style"]})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}const i=t(this.hostElement);i.filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}syncViewerStyles(){var t;const i=this.getBackgroundColor();(t=this.stream)===null||t===void 0?void 0:t.update({frameBgColor:i,streamAttributes:this.getStreamAttributes()})}calculateComponentDimensions(){var t;const i=2073600;const s=this.getBounds();if((s===null||s===void 0?void 0:s.width)!=null&&(s===null||s===void 0?void 0:s.height)!=null){const n=u.create(s.width,s.height);const e=u.scaleFit(i,n);this.hostDimensions=n;this.dimensions=e!=null?u.create(e.width,e.height):undefined;this.viewport=xt.fromDimensions((t=this.getCanvasDimensions())!==null&&t!==void 0?t:u.create(0,0))}}recalculateComponentDimensions(){var t;if(this.isResizing){this.calculateComponentDimensions();this.isResizing=false;if(((t=this.stream)===null||t===void 0?void 0:t.getState().type)==="connected"){this.updateDimensions(this.dimensions)}}}reportPerformance(t){if(this.stateMap.streamState.type==="connected"){const i={timings:t.map((t=>({receiveToPaintDuration:p(t.duration)})))};this.getStream().recordPerformance(i,false)}}addStreamListeners(){this.stateMap.streamListeners=this.getStream().stateChanged.on((t=>{this.handleStreamStateChanged(this.stateMap.streamState,t)}))}handleStreamStateChanged(t,i){this.stateMap.streamState=i;if(i.type==="connecting"){this.handleConnecting(t,i)}else if(i.type==="connected"){this.handleConnected(t,i)}else if(i.type==="connection-failed"){this.handleConnectionFailed(t,i)}else if(i.type==="disconnected"){this.handleDisconnected(t,i)}}handleConnecting(t,i){if(t.type!=="connecting"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"connecting"})}}handleConnected(t,i){var s;this.token=i.token.token;if(t.type!=="connected"){this.errorMessage=undefined;this.canvasRenderer=Bi(ji,zi(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t)));this.emitConnectionChange({status:"connected",jwt:i.token.token});this.deviceIdChange.emit(i.deviceId)}if(((s=this.frame)===null||s===void 0?void 0:s.getId())!==i.frame.getId()){this.updateFrame(i.frame)}this.updateDimensions(this.dimensions)}handleConnectionFailed(t,i){if(t.type!=="connection-failed"){this.token=undefined;this.errorMessage=i.message;this.emitConnectionChange({status:"connection-failed",errorMessage:i.message})}}handleDisconnected(t,i){if(t.type!=="disconnected"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"disconnected"})}}updateDimensions(t){var i;(i=this.stream)===null||i===void 0?void 0:i.update({dimensions:t});this.dimensionschange.emit(t)}async updateFrame(t){var i;const s=this.getCanvasDimensions();if(this.canvasElement!=null&&s!=null&&((i=this.frame)===null||i===void 0?void 0:i.getId())!==t.getId()){const i=this.canvasElement.getContext("2d");if(i!=null){const n=this.frame;this.frame=mt(t,n);this.updateInteractionApi(n);const e={canvas:i,canvasDimensions:s,dimensions:this.dimensions,frame:this.frame,viewport:this.viewport,beforeDraw:()=>{this.updateCanvasDimensions(s);this.isResizeUpdate=false},predicate:()=>{if(this.isResizeUpdate){return this.dimensions==null||u.isEqual(this.dimensions,e.frame.image.imageAttr.frameDimensions)}return true}};this.frameReceived.emit(this.frame);if(this.frame.scene.hasChanged){this.sceneChanged.emit()}const o=await this.canvasRenderer(e);if(o!=null){this.updateViewerBackground();this.dispatchFrameDrawn(o)}}}}updateViewerBackground(){const t=this.getBackgroundColor();Rt((()=>{var i,s;(i=this.viewerContainerElement)===null||i===void 0?void 0:i.style.setProperty("background",t!=null?S.toHexString(t):"#ffffff");(s=this.canvasContainerElement)===null||s===void 0?void 0:s.style.setProperty("background",t!=null?S.toHexString(t):"#ffffff")}))}async initializeDefaultInteractionHandlers(){var t;await this.initializeDefaultCameraInteractionHandlers();await this.initializeDefaultTapInteractionHandler();this.initializeDefaultKeyboardInteractionHandlers();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}}clearDefaultCameraInteractionHandlers(){this.defaultInteractionHandlerDisposables.forEach((t=>t.dispose()));this.defaultInteractionHandlerDisposables=[]}clearDefaultKeyboardInteractions(){this.defaultTapKeyInteractions.forEach((t=>{const i=this.tapKeyInteractions.indexOf(t);if(i!==-1){this.tapKeyInteractions.splice(i,1)}}));this.tapKeyInteractions=[]}async initializeDefaultCameraInteractionHandlers(){var t,i;this.clearDefaultCameraInteractionHandlers();if(this.cameraControls){if(window.PointerEvent!=null){this.baseInteractionHandler=(t=this.baseInteractionHandler)!==null&&t!==void 0?t:new Ii((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new Si);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=(i=this.baseInteractionHandler)!==null&&i!==void 0?i:new bi((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new Ai);this.defaultInteractionHandlerDisposables=[t,s]}}}initializeDefaultKeyboardInteractionHandlers(){var t;this.clearDefaultKeyboardInteractions();if(this.keyboardControls&&this.stream!=null){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setDefaultKeyboardControls(this.keyboardControls);const i=new ai(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()));const s=new ui(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()),(()=>this.createScene()));this.registerTapKeyInteraction(i);this.registerTapKeyInteraction(s);this.defaultTapKeyInteractions=[i,s]}}async initializeDefaultTapInteractionHandler(){if(this.tapHandlerDisposable==null){if(window.PointerEvent!=null){const t=new Ti("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new Ti("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}}initializeInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new z("Cannot initialize interaction handler. Interaction target is undefined.")}if(this.interactionApi==null){throw new z("Cannot initialize interaction handler. Interaction APi is undefined.")}t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(this.stream==null){throw new $("Cannot create interaction API. Component has not been initialized.")}return this.frame==null||this.frame.scene.camera.isPerspective()?new di(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 ci(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()}))}async createScene(){const t=await this.waitForConnectedState();const i=wt();const{frame:s,sceneId:n,sceneViewId:e,worldOrientation:o}=t;return new Tt(this.getStream(),s,lt(o),i,(()=>this.getImageScale()),this.viewport,n,e)}getBackgroundColor(){if(this.canvasContainerElement!=null){const t=Ps(this.hostElement,"--image-background");const i=Ps(this.hostElement,"--viewer-background");const s=t!==null&&t!==void 0?t:i;return s!=null?S.fromCss(s):S.create(255,255,255)}}getBounds(){return Cs(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(this.dimensions!=null&&t!=null){return o.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}}getStreamAttributes(){return{depthBuffers:this.getDepthBufferStreamAttributesValue(),experimentalRenderingOptions:this.experimentalRenderingOptions,featureHighlighting:this.featureHighlighting,featureLines:this.featureLines,featureMaps:this.featureMaps,frames:{frameBackgroundColor:this.getBackgroundColor()},noDefaultLights:this.noDefaultLights,phantom:this.phantom,sceneComparison:this.sceneComparison,selectionHighlighting:this.selectionHighlighting,crossSectioning:this.crossSectioning}}updateCanvasDimensions(t){if(this.canvasElement!=null){this.canvasElement.width=t.width;this.canvasElement.height=t.height}}updateStreamAttributes(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({streamAttributes:this.getStreamAttributes()})}updateEnableTemporalRefinement(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({enableTemporalRefinement:this.enableTemporalRefinement})}updateInteractionApi(t){if(this.frame!=null){const i=(t==null||t.scene.camera.isPerspective())&&this.frame.scene.camera.isOrthographic();const s=(t==null||t.scene.camera.isOrthographic())&&this.frame.scene.camera.isPerspective();if(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;if(this.frame!=null){if(this.cameraType==="orthographic"&&this.frame.scene.camera.isPerspective()){(t=this.stream)===null||t===void 0?void 0:t.replaceCamera({camera:tt(vt(this.frame.scene.camera,this.frame.scene.boundingBox))})}else if(this.cameraType==="perspective"&&this.frame.scene.camera.isOrthographic()){(i=this.stream)===null||i===void 0?void 0:i.replaceCamera({camera:tt(gt(this.frame.scene.camera))})}}}handleAnnotationSetsChange(t){if(t>0&&this.getDepthBufferStreamAttributesValue()==null){this.stateMap.depthBuffersOverrideForAnnotations=true;this.updateStreamAttributes()}else if(t===0&&this.stateMap.depthBuffersOverrideForAnnotations){this.stateMap.depthBuffersOverrideForAnnotations=false;this.updateStreamAttributes()}}getDepthBufferStreamAttributesValue(){var t;const i=(t=this.depthBuffers)!==null&&t!==void 0?t:this.rotateAroundTapPoint||this.stateMap.depthBuffersOverrideForAnnotations?"final":undefined;return i}updateResolvedConfig(){this.resolvedConfig=At(this.configEnv,this.config)}getResolvedConfig(){return Ts("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return Ts("Stream is undefined",(()=>this.stream))}getDeviceId(){if(this.deviceId==null){try{this.deviceId=cs(as.DEVICE_ID,(t=>t["device-id"]))}catch(t){console.warn("Cannot read device ID. Local storage is not supported.")}if(this.deviceId==null){this.deviceId=A.create();try{rs(as.DEVICE_ID,{["device-id"]:this.deviceId})}catch(t){console.warn("Cannot write device ID. Local storage is not supported.")}}}return this.deviceId}async waitForConnectedState(){if(this.stateMap.streamState.type!=="connected"){console.debug("Stream was not in a connected state. Waiting for successful connection.");return new Promise(((t,i)=>{const s=this.getStream().onStateChanged((i=>{if(i.type==="connected"){t(i)}}));setTimeout((()=>{s.dispose();i(new Error("Timed out waiting for connected state."))}),bs)}))}return this.stateMap.streamState}get hostElement(){return e(this)}static get watchers(){return{src:["handleSrcChanged"],cameraControls:["handleCameraControlsChanged"],keyboardControls:["handleKeyboardControlsChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],cameraType:["handleCameraTypeChanged"],experimentalRenderingOptions:["handleStreamAttributesChanged"],depthBuffers:["handleStreamAttributesChanged"],featureHighlighting:["handleStreamAttributesChanged"],featureLines:["handleStreamAttributesChanged"],featureMaps:["handleStreamAttributesChanged"],noDefaultLights:["handleStreamAttributesChanged"],phantom:["handleStreamAttributesChanged"],sceneComparison:["handleStreamAttributesChanged"],crossSectioning:["handleStreamAttributesChanged"],selectionHighlighting:["handleStreamAttributesChanged"],enableTemporalRefinement:["handleEnableTemporalRefinementChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function Ts(t,i){const s=i();if(s!=null){return s}else throw new Error(t)}Is.style=Ss;export{Is as vertex_viewer};
5
+ //# sourceMappingURL=p-89d93218.entry.js.map