@vertexvis/viewer 1.1.1-testing.4 → 1.1.1-testing.5

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 (181) hide show
  1. package/dist/cjs/{config-BY0v6BSK.js → config-OELTgslY.js} +3 -3
  2. package/dist/cjs/{config-BY0v6BSK.js.map → config-OELTgslY.js.map} +1 -1
  3. package/dist/cjs/{entities-CEaa12yP.js → entities-rj-TEPKc.js} +4 -4
  4. package/dist/cjs/{entities-CEaa12yP.js.map → entities-rj-TEPKc.js.map} +1 -1
  5. package/dist/cjs/{geometry_pb-EVfAEuPO.js → geometry_pb-asn2mNvW.js} +3 -3
  6. package/dist/cjs/{geometry_pb-EVfAEuPO.js.map → geometry_pb-asn2mNvW.js.map} +1 -1
  7. package/dist/cjs/index.cjs.js +5 -5
  8. package/dist/cjs/{queries-LthBzEHD.js → queries-e19TP_oF.js} +4 -4
  9. package/dist/cjs/{queries-LthBzEHD.js.map → queries-e19TP_oF.js.map} +1 -1
  10. package/dist/cjs/{regl-component-B_JaaVlv.js → regl-component-DjVaO3t3.js} +3 -3
  11. package/dist/cjs/{regl-component-B_JaaVlv.js.map → regl-component-DjVaO3t3.js.map} +1 -1
  12. package/dist/cjs/{representation_pb-B6XR10pQ.js → representation_pb-BVBPrHLf.js} +3 -3
  13. package/dist/cjs/{representation_pb-B6XR10pQ.js.map → representation_pb-BVBPrHLf.js.map} +1 -1
  14. package/dist/cjs/{streamAttributes-nCF7u7lv.js → streamAttributes-M3UUIO3l.js} +117 -94
  15. package/dist/cjs/streamAttributes-M3UUIO3l.js.map +1 -0
  16. package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +1 -1
  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 +2 -2
  19. package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js.map +1 -1
  20. package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
  21. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
  22. package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +2 -2
  23. package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +2 -2
  24. package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +2 -2
  25. package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +2 -2
  26. package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +4 -4
  27. package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -3
  28. package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +2 -2
  29. package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
  30. package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +3 -3
  31. package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
  32. package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +1 -1
  33. package/dist/cjs/vertex-viewer.cjs.entry.js +4 -4
  34. package/dist/collection/components/scene-tree-search/scene-tree-search.js +1 -1
  35. package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
  36. package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js +1 -1
  37. package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js.map +1 -1
  38. package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +2 -2
  39. package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
  40. package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js +1 -1
  41. package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js.map +1 -1
  42. package/dist/collection/workers/png-decoder-pool.js +4 -3
  43. package/dist/collection/workers/png-decoder-pool.js.map +1 -1
  44. package/dist/components/index.js +1 -1
  45. package/dist/components/{p-COznr3CH.js → p-5bk1mHRt.js} +2 -2
  46. package/dist/components/{p-D3bzgaCV.js → p-B8530k7R.js} +2 -2
  47. package/dist/components/{p-CWcvgy8e.js → p-BCuMPvZO.js} +2 -2
  48. package/dist/components/{p-DTwJX9HL.js → p-BgzjmANj.js} +2 -2
  49. package/dist/components/{p-DTwJX9HL.js.map → p-BgzjmANj.js.map} +1 -1
  50. package/dist/components/p-BjvjKoy7.js +5 -0
  51. package/dist/components/p-BjvjKoy7.js.map +1 -0
  52. package/dist/components/{p-Cxz4L6FA.js → p-Bwtyddca.js} +2 -2
  53. package/dist/components/{p-Ca253f0h.js → p-Bx42CNGV.js} +2 -2
  54. package/dist/components/p-C86HMDzi.js +5 -0
  55. package/dist/components/{p-Y8W_BXUk.js.map → p-C86HMDzi.js.map} +1 -1
  56. package/dist/components/p-CSVgoQU8.js +5 -0
  57. package/dist/components/{p-Cku0WCYo.js.map → p-CSVgoQU8.js.map} +1 -1
  58. package/dist/components/{p-D3in41xo.js → p-CTi-0-dI.js} +2 -2
  59. package/dist/components/{p-D1Vdomj_.js → p-D_h07qsA.js} +2 -2
  60. package/dist/components/{p-BNRm88jS.js → p-KidjtXKE.js} +2 -2
  61. package/dist/components/vertex-scene-tree-search.js +1 -1
  62. package/dist/components/vertex-scene-tree-table-cell.js +1 -1
  63. package/dist/components/vertex-scene-tree-table-cell.js.map +1 -1
  64. package/dist/components/vertex-scene-tree.js +1 -1
  65. package/dist/components/vertex-viewer-dom-renderer.js +1 -1
  66. package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
  67. package/dist/components/vertex-viewer-measurement-details.js +1 -1
  68. package/dist/components/vertex-viewer-measurement-distance.js +1 -1
  69. package/dist/components/vertex-viewer-measurement-overlays.js +1 -1
  70. package/dist/components/vertex-viewer-measurement-precise.js +1 -1
  71. package/dist/components/vertex-viewer-pin-group.js +1 -1
  72. package/dist/components/vertex-viewer-pin-label.js +1 -1
  73. package/dist/components/vertex-viewer-pin-tool.js +1 -1
  74. package/dist/components/vertex-viewer-transform-widget.js +1 -1
  75. package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
  76. package/dist/components/vertex-viewer-view-cube.js +1 -1
  77. package/dist/components/vertex-viewer.js +1 -1
  78. package/dist/esm/{config-ss9ha12b.js → config-Cqrcty7U.js} +3 -3
  79. package/dist/esm/{config-ss9ha12b.js.map → config-Cqrcty7U.js.map} +1 -1
  80. package/dist/esm/{entities-DEFAhYdV.js → entities-CawBZH7i.js} +4 -4
  81. package/dist/esm/{entities-DEFAhYdV.js.map → entities-CawBZH7i.js.map} +1 -1
  82. package/dist/esm/{geometry_pb-D7fM1PYG.js → geometry_pb-COdZQiRi.js} +3 -3
  83. package/dist/esm/{geometry_pb-D7fM1PYG.js.map → geometry_pb-COdZQiRi.js.map} +1 -1
  84. package/dist/esm/index.js +5 -5
  85. package/dist/esm/index.mjs +5 -5
  86. package/dist/esm/{queries-BcmE5Zbq.js → queries-B4XotYyr.js} +4 -4
  87. package/dist/esm/{queries-BcmE5Zbq.js.map → queries-B4XotYyr.js.map} +1 -1
  88. package/dist/esm/{regl-component-gIonUTBJ.js → regl-component-B1_h3_s8.js} +3 -3
  89. package/dist/esm/{regl-component-gIonUTBJ.js.map → regl-component-B1_h3_s8.js.map} +1 -1
  90. package/dist/esm/{representation_pb-Bf023NuN.js → representation_pb-C4MJfZMo.js} +3 -3
  91. package/dist/esm/{representation_pb-Bf023NuN.js.map → representation_pb-C4MJfZMo.js.map} +1 -1
  92. package/dist/esm/{streamAttributes-Bj2xDHfI.js → streamAttributes-BW9JzMeG.js} +116 -93
  93. package/dist/esm/streamAttributes-BW9JzMeG.js.map +1 -0
  94. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +1 -1
  95. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
  96. package/dist/esm/vertex-scene-tree-table-cell.entry.js +2 -2
  97. package/dist/esm/vertex-scene-tree-table-cell.entry.js.map +1 -1
  98. package/dist/esm/vertex-scene-tree.entry.js +2 -2
  99. package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
  100. package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +2 -2
  101. package/dist/esm/vertex-viewer-measurement-details.entry.js +2 -2
  102. package/dist/esm/vertex-viewer-measurement-distance.entry.js +2 -2
  103. package/dist/esm/vertex-viewer-measurement-line_2.entry.js +2 -2
  104. package/dist/esm/vertex-viewer-measurement-precise.entry.js +4 -4
  105. package/dist/esm/vertex-viewer-pin-group.entry.js +3 -3
  106. package/dist/esm/vertex-viewer-pin-label_2.entry.js +2 -2
  107. package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
  108. package/dist/esm/vertex-viewer-transform-widget.entry.js +3 -3
  109. package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
  110. package/dist/esm/vertex-viewer-view-cube.entry.js +1 -1
  111. package/dist/esm/vertex-viewer.entry.js +4 -4
  112. package/dist/types/workers/png-decoder-pool.d.ts +0 -1
  113. package/dist/viewer/index.esm.js +1 -1
  114. package/dist/viewer/{p-00540193.entry.js → p-1506f9a2.entry.js} +2 -2
  115. package/dist/viewer/{p-5cfb3047.entry.js → p-293d8f3f.entry.js} +2 -2
  116. package/dist/viewer/{p-9a39315d.entry.js → p-2faddbf8.entry.js} +2 -2
  117. package/dist/viewer/{p-7cb9c9bb.entry.js → p-36349a80.entry.js} +2 -2
  118. package/dist/viewer/p-36349a80.entry.js.map +1 -0
  119. package/dist/viewer/p-44395076.entry.js +5 -0
  120. package/dist/viewer/{p-e4913b06.entry.js.map → p-44395076.entry.js.map} +1 -1
  121. package/dist/viewer/{p-30a5748d.entry.js → p-45cc095e.entry.js} +2 -2
  122. package/dist/viewer/{p-d5a57757.entry.js → p-93311f46.entry.js} +2 -2
  123. package/dist/viewer/{p-CyiY_hsD.js → p-BEOO-Ypv.js} +2 -2
  124. package/dist/viewer/{p-CyiY_hsD.js.map → p-BEOO-Ypv.js.map} +1 -1
  125. package/dist/viewer/{p-CS8PfgcI.js → p-BJGbLthH.js} +2 -2
  126. package/dist/viewer/{p-CS8PfgcI.js.map → p-BJGbLthH.js.map} +1 -1
  127. package/dist/viewer/{p-D2IEHEGM.js → p-Br21pGVj.js} +2 -2
  128. package/dist/viewer/{p-D2IEHEGM.js.map → p-Br21pGVj.js.map} +1 -1
  129. package/dist/viewer/{p-kMZA0v7I.js → p-Bw_ryWU0.js} +2 -2
  130. package/dist/viewer/{p-kMZA0v7I.js.map → p-Bw_ryWU0.js.map} +1 -1
  131. package/dist/viewer/{p-DHK23fw4.js → p-C4_1Jc7H.js} +2 -2
  132. package/dist/viewer/{p-DHK23fw4.js.map → p-C4_1Jc7H.js.map} +1 -1
  133. package/dist/viewer/p-Cc3XhAoA.js +5 -0
  134. package/dist/viewer/p-Cc3XhAoA.js.map +1 -0
  135. package/dist/viewer/p-DYDhLlLS.js +5 -0
  136. package/dist/viewer/{p-_LpaX1ga.js.map → p-DYDhLlLS.js.map} +1 -1
  137. package/dist/viewer/{p-48020de1.entry.js → p-a94b626c.entry.js} +2 -2
  138. package/dist/viewer/{p-b79c295a.entry.js → p-ced98004.entry.js} +2 -2
  139. package/dist/viewer/{p-32a51a21.entry.js → p-dcb6ddfe.entry.js} +2 -2
  140. package/dist/viewer/p-dcb6ddfe.entry.js.map +1 -0
  141. package/dist/viewer/{p-cc835213.entry.js → p-ea45c3e9.entry.js} +2 -2
  142. package/dist/viewer/p-ebd9dd99.entry.js +5 -0
  143. package/dist/viewer/p-ebd9dd99.entry.js.map +1 -0
  144. package/dist/viewer/{p-edc2f914.entry.js → p-ecd594f2.entry.js} +2 -2
  145. package/dist/viewer/p-fec5a15d.entry.js +5 -0
  146. package/dist/viewer/p-fec5a15d.entry.js.map +1 -0
  147. package/dist/viewer/viewer.esm.js +1 -1
  148. package/package.json +9 -9
  149. package/dist/cjs/streamAttributes-nCF7u7lv.js.map +0 -1
  150. package/dist/components/p-Cku0WCYo.js +0 -5
  151. package/dist/components/p-CvEK3ZK1.js +0 -5
  152. package/dist/components/p-CvEK3ZK1.js.map +0 -1
  153. package/dist/components/p-Y8W_BXUk.js +0 -5
  154. package/dist/esm/streamAttributes-Bj2xDHfI.js.map +0 -1
  155. package/dist/viewer/p-32a51a21.entry.js.map +0 -1
  156. package/dist/viewer/p-4dd67d16.entry.js +0 -5
  157. package/dist/viewer/p-4dd67d16.entry.js.map +0 -1
  158. package/dist/viewer/p-7cb9c9bb.entry.js.map +0 -1
  159. package/dist/viewer/p-BhKTTmpL.js +0 -5
  160. package/dist/viewer/p-BhKTTmpL.js.map +0 -1
  161. package/dist/viewer/p-_LpaX1ga.js +0 -5
  162. package/dist/viewer/p-e4913b06.entry.js +0 -5
  163. package/dist/viewer/p-fd3a5837.entry.js +0 -5
  164. package/dist/viewer/p-fd3a5837.entry.js.map +0 -1
  165. /package/dist/components/{p-COznr3CH.js.map → p-5bk1mHRt.js.map} +0 -0
  166. /package/dist/components/{p-D3bzgaCV.js.map → p-B8530k7R.js.map} +0 -0
  167. /package/dist/components/{p-CWcvgy8e.js.map → p-BCuMPvZO.js.map} +0 -0
  168. /package/dist/components/{p-Cxz4L6FA.js.map → p-Bwtyddca.js.map} +0 -0
  169. /package/dist/components/{p-Ca253f0h.js.map → p-Bx42CNGV.js.map} +0 -0
  170. /package/dist/components/{p-D3in41xo.js.map → p-CTi-0-dI.js.map} +0 -0
  171. /package/dist/components/{p-D1Vdomj_.js.map → p-D_h07qsA.js.map} +0 -0
  172. /package/dist/components/{p-BNRm88jS.js.map → p-KidjtXKE.js.map} +0 -0
  173. /package/dist/viewer/{p-00540193.entry.js.map → p-1506f9a2.entry.js.map} +0 -0
  174. /package/dist/viewer/{p-5cfb3047.entry.js.map → p-293d8f3f.entry.js.map} +0 -0
  175. /package/dist/viewer/{p-9a39315d.entry.js.map → p-2faddbf8.entry.js.map} +0 -0
  176. /package/dist/viewer/{p-30a5748d.entry.js.map → p-45cc095e.entry.js.map} +0 -0
  177. /package/dist/viewer/{p-d5a57757.entry.js.map → p-93311f46.entry.js.map} +0 -0
  178. /package/dist/viewer/{p-48020de1.entry.js.map → p-a94b626c.entry.js.map} +0 -0
  179. /package/dist/viewer/{p-b79c295a.entry.js.map → p-ced98004.entry.js.map} +0 -0
  180. /package/dist/viewer/{p-cc835213.entry.js.map → p-ea45c3e9.entry.js.map} +0 -0
  181. /package/dist/viewer/{p-edc2f914.entry.js.map → p-ecd594f2.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{t as e,p as t,H as s,h as i,e as n}from"./p-Bb32XUUS.js";import{s as r}from"./p-B2_E6tqs.js";import{p as a}from"./p-COznr3CH.js";import{a as o,M as l}from"./p-D1Vdomj_.js";import"./p-5kcpg4MZ.js";import"./p-CWcvgy8e.js";import"./p-FRKLa468.js";import{E as h}from"./p-CvEK3ZK1.js";import{M as d}from"./p-BY3lpCm6.js";import{M as m}from"./p-DyL2wWm6.js";import{p as u}from"./p-2UsvOTHJ.js";import{a as p}from"./p-DxMDDbmh.js";import{g as c}from"./p-CPROw2BU.js";import{E as v}from"./p-CFus3r7d.js";import{d as f}from"./p-BZDn1Vuv.js";import{d as w}from"./p-D3in41xo.js";class y{get elementRect(){return this.rectObserver.rect}constructor(e,t){this.rectObserver=new v;this.handlePointerMove=async e=>{if(await this.isMeasurableEntityUnderPointer(e)){this.clearCursor();this.addCursor(p)}else{this.clearCursor()}};this.handlePointerDown=e=>{this.ifNoInteraction(e,(async()=>{if(await this.isMeasurableEntityUnderPointer(e)){this.measureEntityUnderPointer(e)}else{await this.controller.clearEntities()}}))};this.controller=e;this.measurableEntityTypes=t}initialize(e,t){this.element=e;this.api=t;this.rectObserver.observe(e);e.addEventListener("pointermove",this.handlePointerMove);e.addEventListener("pointerdown",this.handlePointerDown)}dispose(){var e,t,s;this.rectObserver.disconnect();(e=this.measurementInteraction)===null||e===void 0?void 0:e.dispose();this.clearCursor();(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointermove",this.handlePointerMove);(s=this.element)===null||s===void 0?void 0:s.removeEventListener("pointerdown",this.handlePointerDown);this.element=undefined;this.api=undefined}addCursor(e){this.cursor=this.ifInitialized((({api:t})=>t.addCursor(e)))}clearCursor(){var e;(e=this.cursor)===null||e===void 0?void 0:e.dispose();this.cursor=undefined}async isMeasurableEntityUnderPointer(e){var t;const s=c(e,this.elementRect);const i=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(s));return i!=null&&this.measurableEntityTypes.includes(i)}measureEntityUnderPointer(e){this.ifInitialized((async({api:t})=>{const s=c(e,this.elementRect);const[i]=await t.hitItems(s);const n=i!=null?o.fromHit(i):undefined;if(n!=null){await this.controller.addEntity(n)}else{await this.controller.clearEntities()}}))}ifInitialized(e){if(this.element!=null&&this.api!=null){return e({element:this.element,api:this.api})}else{throw new Error("Measurement interaction handler not initialized.")}}ifNoInteraction(e,t){const s=u.create(e.clientX,e.clientY);let i=false;const n=e=>{const t=u.create(e.clientX,e.clientY);const n=u.distance(s,t);i=n>2};const r=()=>{window.removeEventListener("pointermove",n);window.removeEventListener("pointerup",r);if(!i){t()}};window.addEventListener("pointermove",n);window.addEventListener("pointerup",r)}}const C=()=>`:host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const b=t(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.measurementModel=new d;this.measurementOverlays=new m;this.measurableEntityTypes=[h.PRECISE_SURFACE,h.IMPRECISE_SURFACE];this.configEnv="platprod"}connectedCallback(){this.setupInteractionHandler()}componentWillLoad(){this.setupController();this.setupInteractionHandler()}disconnectedCallback(){this.clearInteractionHandler()}handleMeasurableEntityTypesChanged(){this.setupInteractionHandler()}handleMeasurementControllerChanged(){this.setupInteractionHandler()}handleMeasurementModelChanged(){this.setupController()}handleViewerChanged(){this.setupInteractionHandler()}render(){return i(n,{key:"191b29e7710d24dc5462b10bf5fc947de5facf6c"},i("vertex-viewer-measurement-overlays",{key:"9da7740e1f54c300f6a76a7dc516054e40bbed05",viewer:this.viewer,measurementOverlays:this.measurementOverlays}))}setupController(){var e;const t=a(this.configEnv,this.config);const s=new r.SceneViewAPIClient(t.network.sceneViewHost);this.measurementController=new l(this.measurementModel,s,(()=>{var e;return(e=this.viewer)===null||e===void 0?void 0:e.token}),(e=this.viewer)===null||e===void 0?void 0:e.deviceId)}clearInteractionHandler(){var e;(e=this.registeredInteractionHandler)===null||e===void 0?void 0:e.then((e=>e.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var e;this.clearInteractionHandler();if(this.measurementController!=null){this.registeredInteractionHandler=(e=this.viewer)===null||e===void 0?void 0:e.registerInteractionHandler(new y(this.measurementController,this.measurableEntityTypes))}}static get watchers(){return{measurableEntityTypes:[{handleMeasurableEntityTypesChanged:0}],measurementController:[{handleMeasurementControllerChanged:0}],measurementModel:[{handleMeasurementModelChanged:1}],viewer:[{handleViewerChanged:0}]}}static get style(){return C()}},[1,"vertex-viewer-measurement-precise",{measurementModel:[16],measurementOverlays:[16],measurementController:[1040],measurableEntityTypes:[16],viewer:[16],configEnv:[1,"config-env"],config:[1]},undefined,{measurableEntityTypes:[{handleMeasurableEntityTypesChanged:0}],measurementController:[{handleMeasurementControllerChanged:0}],measurementModel:[{handleMeasurementModelChanged:1}],viewer:[{handleViewerChanged:0}]}]);function g(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-measurement-precise","vertex-viewer-measurement-line","vertex-viewer-measurement-overlays"];t.forEach((t=>{switch(t){case"vertex-viewer-measurement-precise":if(!customElements.get(e(t))){customElements.define(e(t),b)}break;case"vertex-viewer-measurement-line":if(!customElements.get(e(t))){f()}break;case"vertex-viewer-measurement-overlays":if(!customElements.get(e(t))){w()}break}}))}g();const M=b;const E=g;export{M as VertexViewerMeasurementPrecise,E as defineCustomElement};
4
+ import{t as e,p as t,H as s,h as i,e as n}from"./p-Bb32XUUS.js";import{s as r}from"./p-B2_E6tqs.js";import{p as a}from"./p-5bk1mHRt.js";import{a as o,M as l}from"./p-D_h07qsA.js";import"./p-5kcpg4MZ.js";import"./p-BCuMPvZO.js";import"./p-FRKLa468.js";import{E as h}from"./p-BjvjKoy7.js";import{M as d}from"./p-BY3lpCm6.js";import{M as m}from"./p-DyL2wWm6.js";import{p as u}from"./p-2UsvOTHJ.js";import{a as p}from"./p-DxMDDbmh.js";import{g as c}from"./p-CPROw2BU.js";import{E as v}from"./p-CFus3r7d.js";import{d as f}from"./p-BZDn1Vuv.js";import{d as w}from"./p-CTi-0-dI.js";class y{get elementRect(){return this.rectObserver.rect}constructor(e,t){this.rectObserver=new v;this.handlePointerMove=async e=>{if(await this.isMeasurableEntityUnderPointer(e)){this.clearCursor();this.addCursor(p)}else{this.clearCursor()}};this.handlePointerDown=e=>{this.ifNoInteraction(e,(async()=>{if(await this.isMeasurableEntityUnderPointer(e)){this.measureEntityUnderPointer(e)}else{await this.controller.clearEntities()}}))};this.controller=e;this.measurableEntityTypes=t}initialize(e,t){this.element=e;this.api=t;this.rectObserver.observe(e);e.addEventListener("pointermove",this.handlePointerMove);e.addEventListener("pointerdown",this.handlePointerDown)}dispose(){var e,t,s;this.rectObserver.disconnect();(e=this.measurementInteraction)===null||e===void 0?void 0:e.dispose();this.clearCursor();(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointermove",this.handlePointerMove);(s=this.element)===null||s===void 0?void 0:s.removeEventListener("pointerdown",this.handlePointerDown);this.element=undefined;this.api=undefined}addCursor(e){this.cursor=this.ifInitialized((({api:t})=>t.addCursor(e)))}clearCursor(){var e;(e=this.cursor)===null||e===void 0?void 0:e.dispose();this.cursor=undefined}async isMeasurableEntityUnderPointer(e){var t;const s=c(e,this.elementRect);const i=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(s));return i!=null&&this.measurableEntityTypes.includes(i)}measureEntityUnderPointer(e){this.ifInitialized((async({api:t})=>{const s=c(e,this.elementRect);const[i]=await t.hitItems(s);const n=i!=null?o.fromHit(i):undefined;if(n!=null){await this.controller.addEntity(n)}else{await this.controller.clearEntities()}}))}ifInitialized(e){if(this.element!=null&&this.api!=null){return e({element:this.element,api:this.api})}else{throw new Error("Measurement interaction handler not initialized.")}}ifNoInteraction(e,t){const s=u.create(e.clientX,e.clientY);let i=false;const n=e=>{const t=u.create(e.clientX,e.clientY);const n=u.distance(s,t);i=n>2};const r=()=>{window.removeEventListener("pointermove",n);window.removeEventListener("pointerup",r);if(!i){t()}};window.addEventListener("pointermove",n);window.addEventListener("pointerup",r)}}const C=()=>`:host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const b=t(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.measurementModel=new d;this.measurementOverlays=new m;this.measurableEntityTypes=[h.PRECISE_SURFACE,h.IMPRECISE_SURFACE];this.configEnv="platprod"}connectedCallback(){this.setupInteractionHandler()}componentWillLoad(){this.setupController();this.setupInteractionHandler()}disconnectedCallback(){this.clearInteractionHandler()}handleMeasurableEntityTypesChanged(){this.setupInteractionHandler()}handleMeasurementControllerChanged(){this.setupInteractionHandler()}handleMeasurementModelChanged(){this.setupController()}handleViewerChanged(){this.setupInteractionHandler()}render(){return i(n,{key:"191b29e7710d24dc5462b10bf5fc947de5facf6c"},i("vertex-viewer-measurement-overlays",{key:"9da7740e1f54c300f6a76a7dc516054e40bbed05",viewer:this.viewer,measurementOverlays:this.measurementOverlays}))}setupController(){var e;const t=a(this.configEnv,this.config);const s=new r.SceneViewAPIClient(t.network.sceneViewHost);this.measurementController=new l(this.measurementModel,s,(()=>{var e;return(e=this.viewer)===null||e===void 0?void 0:e.token}),(e=this.viewer)===null||e===void 0?void 0:e.deviceId)}clearInteractionHandler(){var e;(e=this.registeredInteractionHandler)===null||e===void 0?void 0:e.then((e=>e.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var e;this.clearInteractionHandler();if(this.measurementController!=null){this.registeredInteractionHandler=(e=this.viewer)===null||e===void 0?void 0:e.registerInteractionHandler(new y(this.measurementController,this.measurableEntityTypes))}}static get watchers(){return{measurableEntityTypes:[{handleMeasurableEntityTypesChanged:0}],measurementController:[{handleMeasurementControllerChanged:0}],measurementModel:[{handleMeasurementModelChanged:1}],viewer:[{handleViewerChanged:0}]}}static get style(){return C()}},[1,"vertex-viewer-measurement-precise",{measurementModel:[16],measurementOverlays:[16],measurementController:[1040],measurableEntityTypes:[16],viewer:[16],configEnv:[1,"config-env"],config:[1]},undefined,{measurableEntityTypes:[{handleMeasurableEntityTypesChanged:0}],measurementController:[{handleMeasurementControllerChanged:0}],measurementModel:[{handleMeasurementModelChanged:1}],viewer:[{handleViewerChanged:0}]}]);function M(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-measurement-precise","vertex-viewer-measurement-line","vertex-viewer-measurement-overlays"];t.forEach((t=>{switch(t){case"vertex-viewer-measurement-precise":if(!customElements.get(e(t))){customElements.define(e(t),b)}break;case"vertex-viewer-measurement-line":if(!customElements.get(e(t))){f()}break;case"vertex-viewer-measurement-overlays":if(!customElements.get(e(t))){w()}break}}))}M();const g=b;const j=M;export{g as VertexViewerMeasurementPrecise,j as defineCustomElement};
5
5
  //# sourceMappingURL=vertex-viewer-measurement-precise.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{V as o,d as s}from"./p-Cxz4L6FA.js";const t=o;const p=s;export{t as VertexViewerPinGroup,p as defineCustomElement};
4
+ import{V as o,d as s}from"./p-Bwtyddca.js";const t=o;const a=s;export{t as VertexViewerPinGroup,a as defineCustomElement};
5
5
  //# sourceMappingURL=vertex-viewer-pin-group.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{V as o,d as s}from"./p-DTwJX9HL.js";const t=o;const p=s;export{t as VertexViewerPinLabel,p as defineCustomElement};
4
+ import{V as o,d as s}from"./p-BgzjmANj.js";const t=o;const j=s;export{t as VertexViewerPinLabel,j as defineCustomElement};
5
5
  //# sourceMappingURL=vertex-viewer-pin-label.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{t as i,p as t,H as e,h as s,e as n}from"./p-Bb32XUUS.js";import{a as o,d as l,P as r}from"./p-DTwJX9HL.js";import{p as h}from"./p-2UsvOTHJ.js";import{b as d}from"./p-CDM7zNn0.js";import{l as a,p as u}from"./p-DxMDDbmh.js";import{g as v}from"./p-CPROw2BU.js";import{E as c}from"./p-CFus3r7d.js";import{E as p}from"./p-CvEK3ZK1.js";import{P as f}from"./p-D1akPoVm.js";import{g as m}from"./p-Bg-uS9BH.js";import{d as w}from"./p-BHyxBmg6.js";import{d as C}from"./p-Ca253f0h.js";import{d as b}from"./p-Bkm6H5uq.js";import{d as y}from"./p-Cxz4L6FA.js";import{d as g}from"./p-BFEV_v80.js";class x{get elementRect(){return this.rectObserver.rect}constructor(i,t,e){this.rectObserver=new c;this.droppableSurfaces=[p.PRECISE_SURFACE,p.IMPRECISE_SURFACE,p.GENERIC_GEOMETRY];this.handlePointerMove=async i=>{const t=await this.isDroppableSurface(i);const e=this.controller.getDraggable();if(e!=null&&t){this.handleDrag(e,i)}if(this.controller.getDraggable()==null&&this.controller.getToolMode()==="edit"&&t){this.addCursor(this.getCursorType())}else{this.clearCursor()}};this.handleDrag=async(i,t)=>{const e=v(t,this.elementRect);const s=await this.getWorldPositionForPoint(e);if(s!=null){this.controller.updateDraggable({...i,lastPoint:e},s)}};this.handlePointerDown=async i=>{const t=t=>{const s=h.distance(h.create(i.clientX,t.clientY),h.create(t.clientX,t.clientY));if(s<=2&&i.buttons!==2){if(this.controller.getToolMode()==="edit"){const t=v(i,this.elementRect);this.handlePlacePin(t)}}e()};const e=()=>{window.removeEventListener("pointerup",t)};window.addEventListener("pointerup",t);return{dispose:e}};this.handlePointerUp=async()=>{const i=this.controller.getDraggable();const t=i===null||i===void 0?void 0:i.lastPoint;this.controller.setDraggable(undefined);if(t!=null&&i!=null){this.ifInitialized((async({api:e})=>{var s,n,o,l,r,h;const[d]=await e.hitItems(t);if((d===null||d===void 0?void 0:d.hitPoint)!=null&&((s=d===null||d===void 0?void 0:d.hitPoint)===null||s===void 0?void 0:s.x)!=null&&((n=d===null||d===void 0?void 0:d.hitPoint)===null||n===void 0?void 0:n.y)!=null&&((o=d===null||d===void 0?void 0:d.hitPoint)===null||o===void 0?void 0:o.z)!=null){this.controller.updateDraggable({...i,lastPoint:t},{x:(l=d===null||d===void 0?void 0:d.hitPoint)===null||l===void 0?void 0:l.x,y:d===null||d===void 0?void 0:d.hitPoint.y,z:d===null||d===void 0?void 0:d.hitPoint.z},(h=(r=d===null||d===void 0?void 0:d.partId)===null||r===void 0?void 0:r.hex)!==null&&h!==void 0?h:undefined)}}))}};this.controller=i;this.xOffset=t;this.yOffset=e}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);i.addEventListener("pointermove",this.handlePointerMove);i.addEventListener("pointerdown",this.handlePointerDown);window.addEventListener("pointerup",this.handlePointerUp)}dispose(){var i,t;this.rectObserver.disconnect();this.clearCursor();(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointermove",this.handlePointerMove);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);window.removeEventListener("pointerup",this.handlePointerUp);this.element=undefined;this.api=undefined}async getWorldPositionForPoint(i){return this.ifInitialized((async({api:t})=>{const e=await t.getWorldPointFromViewport(i);return e}))}async handlePlacePin(i,t){this.ifInitialized((async({api:e})=>{var s,n,l,r,h,a;const[u]=await e.hitItems(i);if((u===null||u===void 0?void 0:u.hitPoint)!=null&&this.elementRect!=null){if((u===null||u===void 0?void 0:u.hitPoint)!=null&&(u===null||u===void 0?void 0:u.hitPoint.x)!=null&&(u===null||u===void 0?void 0:u.hitPoint.y)!=null&&(u===null||u===void 0?void 0:u.hitPoint.z)!=null){const e=t!=null?t.id:d.create();const v=this.controller.getStyleAttributes()!=null?{style:this.controller.getStyleAttributes()}:undefined;switch(this.controller.getToolType()){case"pin-icon":this.controller.setPin({type:"icon",id:e,worldPosition:{x:(s=u===null||u===void 0?void 0:u.hitPoint)===null||s===void 0?void 0:s.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(l=(n=u===null||u===void 0?void 0:u.itemId)===null||n===void 0?void 0:n.hex)!==null&&l!==void 0?l:undefined,attributes:v});break;case"pin-text":const d=t==null;const c=o(i,this.elementRect,d,this.xOffset,this.yOffset);this.controller.setPin({type:"text",id:e,worldPosition:{x:(r=u===null||u===void 0?void 0:u.hitPoint)===null||r===void 0?void 0:r.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(a=(h=u===null||u===void 0?void 0:u.itemId)===null||h===void 0?void 0:h.hex)!==null&&a!==void 0?a:undefined,label:{point:c},attributes:v});this.controller.setSelectedPinId(e);break}}}else{this.controller.setSelectedPinId()}}))}getCursorType(){switch(this.controller.getToolType()){case"pin-icon":return u;case"pin-text":return a}}addCursor(i){this.clearCursor();this.cursor=this.ifInitialized((({api:t})=>t.addCursor(i)))}async isDroppableSurface(i){var t;const e=v(i,this.elementRect);const s=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(e));return s!=null&&this.droppableSurfaces.includes(s)}ifInitialized(i){if(this.element!=null&&this.api!=null){return i({element:this.element,api:this.api})}else{throw new Error("Pins interaction handler not initialized.")}}clearCursor(){var i;(i=this.cursor)===null||i===void 0?void 0:i.dispose();this.cursor=undefined}}const P=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;--viewer-pin-tool-initial-label-offset-x:20;--viewer-pin-tool-initial-label-offset-y:20}`;const j=t(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.pinModel=new f;this.tool="pin-icon";this.mode="view";this.pins=[];this.stateMap={};this.handleSetProjectionMatrix=()=>{var i,t;this.projectionViewMatrix=(t=(i=this.viewer)===null||i===void 0?void 0:i.frame)===null||t===void 0?void 0:t.scene.camera.projectionViewMatrix}}watchModeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolMode(this.mode);this.setupInteractionHandler();if(this.mode==="edit"){this.setFeatureMaps();this.setCameraAndKeyboardControls()}else{this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}}watchTypeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolType(this.tool);this.setupInteractionHandler()}watchAccentColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setAccentColor(this.accentColor);this.setupInteractionHandler()}watchPrimaryColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setPrimaryColor(this.primaryColor);this.setupInteractionHandler()}watchPinsChange(){if(this.pins.length>0){this.setDepthBuffers();this.setFeatureMaps()}else{this.resetDepthBuffers();this.resetFeatureMaps()}}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls()}componentWillLoad(){this.updateViewport();this.setupController();this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();this.pinModel.onEntitiesChanged((i=>{this.pins=i}));this.pinModel.onSelectionChange((i=>{this.selectedPinId=i}));this.handleViewerChanged(this.viewer,undefined)}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.updateViewport()));this.resizeObserver.observe(this.hostEl)}disconnectedCallback(){this.clearInteractionHandler();this.clearModelListeners();this.resetDepthBuffers();this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}handleViewerChanged(i,t){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();if(t!=null){t.removeEventListener("frameDrawn",this.handleSetProjectionMatrix)}if(i!=null){i.addEventListener("frameDrawn",this.handleSetProjectionMatrix)}this.handleSetProjectionMatrix()}render(){return s(n,{key:"ce2867d4a624dabf607b9de837e73a0a0c40eaf9"},s("vertex-viewer-dom-renderer",{key:"7d2dc3d75ca1818ba7b9b292ccbe1db7ac5c7ac8",viewer:this.viewer,drawMode:"2d"},this.pins.map((i=>s("vertex-viewer-pin-group",{id:`pin-group-${i.id}`,"data-is-dom-group-element":true,pin:i,elementBounds:this.elementBounds,pinModel:this.pinModel,pinController:this.pinController,projectionViewMatrix:this.projectionViewMatrix,selected:this.selectedPinId===i.id})))))}setupController(){const i=this.accentColor||this.primaryColor?{accentColor:this.accentColor,primaryColor:this.primaryColor}:undefined;this.pinController=new r(this.pinModel,this.mode,this.tool,i)}clearInteractionHandler(){var i;(i=this.registeredInteractionHandler)===null||i===void 0?void 0:i.then((i=>i.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var i;const t=window.getComputedStyle(this.hostEl);const e=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-x").trim();const s=Number.isFinite(Number.parseInt(e))?Number.parseInt(e):20;const n=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-y").trim();const o=Number.isFinite(Number.parseInt(n))?Number.parseInt(n):20;this.clearInteractionHandler();if(this.pinController!=null){this.registeredInteractionHandler=(i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(new x(this.pinController,s,o))}}clearModelListeners(){var i,t,e;(i=this.onEntitiesChangedHandler)===null||i===void 0?void 0:i.dispose();this.onEntitiesChangedHandler=undefined;(t=this.onEntityAddedHandler)===null||t===void 0?void 0:t.dispose();this.onEntityAddedHandler=undefined;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()}updateViewport(){this.elementBounds=m(this.hostEl)}setDepthBuffers(){if(this.pins.length>0&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}setFeatureMaps(){if((this.pins.length>0||this.mode==="edit")&&this.viewer!=null&&this.viewer.featureMaps==null){this.stateMap.shouldClearFeatureMaps=true;this.viewer.featureMaps="final"}}resetFeatureMaps(){if(this.stateMap.shouldClearFeatureMaps&&this.viewer!=null){this.viewer.featureMaps=undefined;this.stateMap.shouldClearFeatureMaps=undefined}}setCameraAndKeyboardControls(){if(this.mode==="edit"&&this.viewer!=null){if(this.viewer.cameraControls){this.stateMap.shouldClearCameraControls=true;this.viewer.cameraControls=false}if(this.viewer.keyboardControls){this.stateMap.shouldClearKeyboardControls=true;this.viewer.keyboardControls=false}}}resetCameraAndKeyboardControls(){if(this.viewer!=null){if(this.stateMap.shouldClearCameraControls){this.viewer.cameraControls=true;this.stateMap.shouldClearCameraControls=undefined}if(this.stateMap.shouldClearKeyboardControls){this.viewer.keyboardControls=true;this.stateMap.shouldClearKeyboardControls=undefined}}}get hostEl(){return this}static get watchers(){return{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}}static get style(){return P()}},[1,"vertex-viewer-pin-tool",{pinController:[1040],pinModel:[16],viewer:[16],tool:[1025],mode:[1025],primaryColor:[1025,"primary-color"],accentColor:[1025,"accent-color"],pins:[32],selectedPinId:[32],elementBounds:[32],projectionViewMatrix:[32]},undefined,{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}]);function k(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-pin-tool","vertex-viewer-dom-element","vertex-viewer-dom-renderer","vertex-viewer-icon","vertex-viewer-pin-group","vertex-viewer-pin-label","vertex-viewer-pin-label-line"];t.forEach((t=>{switch(t){case"vertex-viewer-pin-tool":if(!customElements.get(i(t))){customElements.define(i(t),j)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(t))){w()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(t))){C()}break;case"vertex-viewer-icon":if(!customElements.get(i(t))){b()}break;case"vertex-viewer-pin-group":if(!customElements.get(i(t))){y()}break;case"vertex-viewer-pin-label":if(!customElements.get(i(t))){l()}break;case"vertex-viewer-pin-label-line":if(!customElements.get(i(t))){g()}break}}))}k();const E=j;const M=k;export{E as VertexViewerPinTool,M as defineCustomElement};
4
+ import{t as i,p as t,H as e,h as s,e as n}from"./p-Bb32XUUS.js";import{a as o,d as l,P as r}from"./p-BgzjmANj.js";import{p as h}from"./p-2UsvOTHJ.js";import{b as d}from"./p-CDM7zNn0.js";import{l as a,p as u}from"./p-DxMDDbmh.js";import{g as v}from"./p-CPROw2BU.js";import{E as c}from"./p-CFus3r7d.js";import{E as p}from"./p-BjvjKoy7.js";import{P as f}from"./p-D1akPoVm.js";import{g as m}from"./p-Bg-uS9BH.js";import{d as w}from"./p-BHyxBmg6.js";import{d as C}from"./p-Bx42CNGV.js";import{d as b}from"./p-Bkm6H5uq.js";import{d as y}from"./p-Bwtyddca.js";import{d as g}from"./p-BFEV_v80.js";class x{get elementRect(){return this.rectObserver.rect}constructor(i,t,e){this.rectObserver=new c;this.droppableSurfaces=[p.PRECISE_SURFACE,p.IMPRECISE_SURFACE,p.GENERIC_GEOMETRY];this.handlePointerMove=async i=>{const t=await this.isDroppableSurface(i);const e=this.controller.getDraggable();if(e!=null&&t){this.handleDrag(e,i)}if(this.controller.getDraggable()==null&&this.controller.getToolMode()==="edit"&&t){this.addCursor(this.getCursorType())}else{this.clearCursor()}};this.handleDrag=async(i,t)=>{const e=v(t,this.elementRect);const s=await this.getWorldPositionForPoint(e);if(s!=null){this.controller.updateDraggable({...i,lastPoint:e},s)}};this.handlePointerDown=async i=>{const t=t=>{const s=h.distance(h.create(i.clientX,t.clientY),h.create(t.clientX,t.clientY));if(s<=2&&i.buttons!==2){if(this.controller.getToolMode()==="edit"){const t=v(i,this.elementRect);this.handlePlacePin(t)}}e()};const e=()=>{window.removeEventListener("pointerup",t)};window.addEventListener("pointerup",t);return{dispose:e}};this.handlePointerUp=async()=>{const i=this.controller.getDraggable();const t=i===null||i===void 0?void 0:i.lastPoint;this.controller.setDraggable(undefined);if(t!=null&&i!=null){this.ifInitialized((async({api:e})=>{var s,n,o,l,r,h;const[d]=await e.hitItems(t);if((d===null||d===void 0?void 0:d.hitPoint)!=null&&((s=d===null||d===void 0?void 0:d.hitPoint)===null||s===void 0?void 0:s.x)!=null&&((n=d===null||d===void 0?void 0:d.hitPoint)===null||n===void 0?void 0:n.y)!=null&&((o=d===null||d===void 0?void 0:d.hitPoint)===null||o===void 0?void 0:o.z)!=null){this.controller.updateDraggable({...i,lastPoint:t},{x:(l=d===null||d===void 0?void 0:d.hitPoint)===null||l===void 0?void 0:l.x,y:d===null||d===void 0?void 0:d.hitPoint.y,z:d===null||d===void 0?void 0:d.hitPoint.z},(h=(r=d===null||d===void 0?void 0:d.partId)===null||r===void 0?void 0:r.hex)!==null&&h!==void 0?h:undefined)}}))}};this.controller=i;this.xOffset=t;this.yOffset=e}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);i.addEventListener("pointermove",this.handlePointerMove);i.addEventListener("pointerdown",this.handlePointerDown);window.addEventListener("pointerup",this.handlePointerUp)}dispose(){var i,t;this.rectObserver.disconnect();this.clearCursor();(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointermove",this.handlePointerMove);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);window.removeEventListener("pointerup",this.handlePointerUp);this.element=undefined;this.api=undefined}async getWorldPositionForPoint(i){return this.ifInitialized((async({api:t})=>{const e=await t.getWorldPointFromViewport(i);return e}))}async handlePlacePin(i,t){this.ifInitialized((async({api:e})=>{var s,n,l,r,h,a;const[u]=await e.hitItems(i);if((u===null||u===void 0?void 0:u.hitPoint)!=null&&this.elementRect!=null){if((u===null||u===void 0?void 0:u.hitPoint)!=null&&(u===null||u===void 0?void 0:u.hitPoint.x)!=null&&(u===null||u===void 0?void 0:u.hitPoint.y)!=null&&(u===null||u===void 0?void 0:u.hitPoint.z)!=null){const e=t!=null?t.id:d.create();const v=this.controller.getStyleAttributes()!=null?{style:this.controller.getStyleAttributes()}:undefined;switch(this.controller.getToolType()){case"pin-icon":this.controller.setPin({type:"icon",id:e,worldPosition:{x:(s=u===null||u===void 0?void 0:u.hitPoint)===null||s===void 0?void 0:s.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(l=(n=u===null||u===void 0?void 0:u.itemId)===null||n===void 0?void 0:n.hex)!==null&&l!==void 0?l:undefined,attributes:v});break;case"pin-text":const d=t==null;const c=o(i,this.elementRect,d,this.xOffset,this.yOffset);this.controller.setPin({type:"text",id:e,worldPosition:{x:(r=u===null||u===void 0?void 0:u.hitPoint)===null||r===void 0?void 0:r.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(a=(h=u===null||u===void 0?void 0:u.itemId)===null||h===void 0?void 0:h.hex)!==null&&a!==void 0?a:undefined,label:{point:c},attributes:v});this.controller.setSelectedPinId(e);break}}}else{this.controller.setSelectedPinId()}}))}getCursorType(){switch(this.controller.getToolType()){case"pin-icon":return u;case"pin-text":return a}}addCursor(i){this.clearCursor();this.cursor=this.ifInitialized((({api:t})=>t.addCursor(i)))}async isDroppableSurface(i){var t;const e=v(i,this.elementRect);const s=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(e));return s!=null&&this.droppableSurfaces.includes(s)}ifInitialized(i){if(this.element!=null&&this.api!=null){return i({element:this.element,api:this.api})}else{throw new Error("Pins interaction handler not initialized.")}}clearCursor(){var i;(i=this.cursor)===null||i===void 0?void 0:i.dispose();this.cursor=undefined}}const j=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;--viewer-pin-tool-initial-label-offset-x:20;--viewer-pin-tool-initial-label-offset-y:20}`;const P=t(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.pinModel=new f;this.tool="pin-icon";this.mode="view";this.pins=[];this.stateMap={};this.handleSetProjectionMatrix=()=>{var i,t;this.projectionViewMatrix=(t=(i=this.viewer)===null||i===void 0?void 0:i.frame)===null||t===void 0?void 0:t.scene.camera.projectionViewMatrix}}watchModeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolMode(this.mode);this.setupInteractionHandler();if(this.mode==="edit"){this.setFeatureMaps();this.setCameraAndKeyboardControls()}else{this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}}watchTypeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolType(this.tool);this.setupInteractionHandler()}watchAccentColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setAccentColor(this.accentColor);this.setupInteractionHandler()}watchPrimaryColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setPrimaryColor(this.primaryColor);this.setupInteractionHandler()}watchPinsChange(){if(this.pins.length>0){this.setDepthBuffers();this.setFeatureMaps()}else{this.resetDepthBuffers();this.resetFeatureMaps()}}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls()}componentWillLoad(){this.updateViewport();this.setupController();this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();this.pinModel.onEntitiesChanged((i=>{this.pins=i}));this.pinModel.onSelectionChange((i=>{this.selectedPinId=i}));this.handleViewerChanged(this.viewer,undefined)}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.updateViewport()));this.resizeObserver.observe(this.hostEl)}disconnectedCallback(){this.clearInteractionHandler();this.clearModelListeners();this.resetDepthBuffers();this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}handleViewerChanged(i,t){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();if(t!=null){t.removeEventListener("frameDrawn",this.handleSetProjectionMatrix)}if(i!=null){i.addEventListener("frameDrawn",this.handleSetProjectionMatrix)}this.handleSetProjectionMatrix()}render(){return s(n,{key:"ce2867d4a624dabf607b9de837e73a0a0c40eaf9"},s("vertex-viewer-dom-renderer",{key:"7d2dc3d75ca1818ba7b9b292ccbe1db7ac5c7ac8",viewer:this.viewer,drawMode:"2d"},this.pins.map((i=>s("vertex-viewer-pin-group",{id:`pin-group-${i.id}`,"data-is-dom-group-element":true,pin:i,elementBounds:this.elementBounds,pinModel:this.pinModel,pinController:this.pinController,projectionViewMatrix:this.projectionViewMatrix,selected:this.selectedPinId===i.id})))))}setupController(){const i=this.accentColor||this.primaryColor?{accentColor:this.accentColor,primaryColor:this.primaryColor}:undefined;this.pinController=new r(this.pinModel,this.mode,this.tool,i)}clearInteractionHandler(){var i;(i=this.registeredInteractionHandler)===null||i===void 0?void 0:i.then((i=>i.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var i;const t=window.getComputedStyle(this.hostEl);const e=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-x").trim();const s=Number.isFinite(Number.parseInt(e))?Number.parseInt(e):20;const n=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-y").trim();const o=Number.isFinite(Number.parseInt(n))?Number.parseInt(n):20;this.clearInteractionHandler();if(this.pinController!=null){this.registeredInteractionHandler=(i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(new x(this.pinController,s,o))}}clearModelListeners(){var i,t,e;(i=this.onEntitiesChangedHandler)===null||i===void 0?void 0:i.dispose();this.onEntitiesChangedHandler=undefined;(t=this.onEntityAddedHandler)===null||t===void 0?void 0:t.dispose();this.onEntityAddedHandler=undefined;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()}updateViewport(){this.elementBounds=m(this.hostEl)}setDepthBuffers(){if(this.pins.length>0&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}setFeatureMaps(){if((this.pins.length>0||this.mode==="edit")&&this.viewer!=null&&this.viewer.featureMaps==null){this.stateMap.shouldClearFeatureMaps=true;this.viewer.featureMaps="final"}}resetFeatureMaps(){if(this.stateMap.shouldClearFeatureMaps&&this.viewer!=null){this.viewer.featureMaps=undefined;this.stateMap.shouldClearFeatureMaps=undefined}}setCameraAndKeyboardControls(){if(this.mode==="edit"&&this.viewer!=null){if(this.viewer.cameraControls){this.stateMap.shouldClearCameraControls=true;this.viewer.cameraControls=false}if(this.viewer.keyboardControls){this.stateMap.shouldClearKeyboardControls=true;this.viewer.keyboardControls=false}}}resetCameraAndKeyboardControls(){if(this.viewer!=null){if(this.stateMap.shouldClearCameraControls){this.viewer.cameraControls=true;this.stateMap.shouldClearCameraControls=undefined}if(this.stateMap.shouldClearKeyboardControls){this.viewer.keyboardControls=true;this.stateMap.shouldClearKeyboardControls=undefined}}}get hostEl(){return this}static get watchers(){return{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}}static get style(){return j()}},[1,"vertex-viewer-pin-tool",{pinController:[1040],pinModel:[16],viewer:[16],tool:[1025],mode:[1025],primaryColor:[1025,"primary-color"],accentColor:[1025,"accent-color"],pins:[32],selectedPinId:[32],elementBounds:[32],projectionViewMatrix:[32]},undefined,{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}]);function B(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-pin-tool","vertex-viewer-dom-element","vertex-viewer-dom-renderer","vertex-viewer-icon","vertex-viewer-pin-group","vertex-viewer-pin-label","vertex-viewer-pin-label-line"];t.forEach((t=>{switch(t){case"vertex-viewer-pin-tool":if(!customElements.get(i(t))){customElements.define(i(t),P)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(t))){w()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(t))){C()}break;case"vertex-viewer-icon":if(!customElements.get(i(t))){b()}break;case"vertex-viewer-pin-group":if(!customElements.get(i(t))){y()}break;case"vertex-viewer-pin-label":if(!customElements.get(i(t))){l()}break;case"vertex-viewer-pin-label-line":if(!customElements.get(i(t))){g()}break}}))}B();const k=P;const E=B;export{k as VertexViewerPinTool,E as defineCustomElement};
5
5
  //# sourceMappingURL=vertex-viewer-pin-tool.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 i,t,p as s,H as n,d as o,e as l}from"./p-Bb32XUUS.js";import{p as e,v as h,r as a,b as r,a as d,m as u,h as v,g as c,q as f,e as w,c as p}from"./p-2UsvOTHJ.js";import{c as g}from"./p-C6gMOKYg.js";import{w as x,r as y}from"./p-Cd7kap5W.js";import{T as b}from"./p-C12jtCFb.js";import{A as m,D as z}from"./p-CvEK3ZK1.js";import{E as T}from"./p-CDM7zNn0.js";import{d as C,T as D,R,e as P,r as S,s as E,x as A,A as U,b as H,y as I,z as N,f as F,g as O,h as j,i as M,j as k}from"./p-BNRm88jS.js";function $(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function K(i,t){return t!=null?e.create(i.x-t.left,i.y-t.top):undefined}function B(i,t,s,n){const o=n!=null?h.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=a.at(a.create({origin:o,direction:t.scene.camera.direction}),h.magnitude(t.scene.camera.viewVector)*2);return a.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return a.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function J(i,t,s,n,o,l){return u.multiply(X(t,s,n,o,l),i)}function X(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>e.convertFrom(t-s);const r=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return u.makeTranslation(h.create(r(),0,0));case"y-translate":return u.makeTranslation(h.create(0,r(),0));case"z-translate":return u.makeTranslation(h.create(0,0,r()));case"x-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.left(),a())));case"y-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.down(),a())));case"z-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.forward(),a())));default:return u.makeIdentity()}}function _(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function q(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>u.makeRotation(f.fromMatrixRotation(t));const r=()=>u.multiply(u.invert(s),t);const c=()=>h.multiplyByTransformMatrixColumnMajor(h.fromMatrixPosition(r()),a());const w=()=>v.fromRotationMatrix(u.multiply(s,a()),_(i));switch(i){case"x-translate":return l.convertWorldValueToReal(c().x);case"y-translate":return l.convertWorldValueToReal(c().y);case"z-translate":return l.convertWorldValueToReal(c().z);case"x-rotate":return e.convertTo(d.normalizeRadians(w().x));case"y-rotate":return e.convertTo(d.normalizeRadians(w().y));case"z-rotate":return e.convertTo(d.normalizeRadians(w().z));default:return 0}}function L(i,t,s,n,o,l){return V(i,h.subtract(s,t),n,o,l)}function V(i,t,s,n,o){switch(o){case"x-translate":return W(i,t,h.right());case"y-translate":return W(i,t,h.up());case"z-translate":return W(i,t,h.back());case"xy-translate":return G(i,t,h.create(0,0,1));case"xz-translate":return G(i,t,h.create(0,1,0));case"yz-translate":return G(i,t,h.create(1,0,0));case"x-rotate":return Y(i,s,h.right(),n);case"y-rotate":return Y(i,s,h.up(),n);case"z-rotate":return Y(i,s,h.forward(),n);default:return i}}function Y(i,t,s,n){const o=Z(i,t,s);const l=f.fromAxisAngle(o,n);const e=u.transpose(u.makeRotation(l));return u.multiply(e,i)}function Z(i,t,s){const n=u.makeRotation(f.fromMatrixRotation(i));const o=h.multiplyByTransformMatrixRowMajor(s,n);const l=h.multiplyByTransformMatrixRowMajor(h.negate(s),n);return h.dot(t,o)>h.dot(t,l)?s:h.negate(s)}function W(i,t,s){const n=h.normalize(s);const o=u.makeRotation(f.fromMatrixRotation(i));const l=h.multiplyByTransformMatrixRowMajor(n,o);const e=h.project(t,l);const a=u.makeTranslation(e);return u.multiply(i,a)}function G(i,t,s){const n=h.normalize(s);const o=u.makeRotation(f.fromMatrixRotation(i));const l=h.multiplyByTransformMatrixRowMajor(n,o);const e=h.fromMatrixPosition(i);const a=r.fromNormalAndCoplanarPoint(l,e);const d=r.projectPoint(a,t);const v=h.add(d,h.scale(a.constant,a.normal));const c=u.makeTranslation(v);return u.multiply(i,c)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=c.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const l=c.topLeft(n);const h=e.add(l,e.create(n.width,0));const a=c.bottomRight(n);const r=e.subtract(a,e.create(n.width,0));const d=e.scale(o.reduce(((i,t)=>e.add(i,t)),e.create()),1/o.length,1/o.length);const u=[h,r,a].reduce(((i,t)=>e.distance(d,t)<e.distance(d,i)?t:i),l);switch(u){case l:return{point:u,placement:"top-left"};case h:return{point:u,placement:"top-right"};case r:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function ii(i,t,s,n,o,l){const e=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(e&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=d.toDegrees(i);const e=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=e-t;const h=d.toRadians(s);return h+n}else{const i=d.toRadians(e);return i+n}}else{return s}}const ti=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:e},h)=>{const a=oi(n,s!==null&&s!==void 0?s:w.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:{...a,height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined}},h,i("div",{class:"widget-input units"},e.unit.abbreviatedName))};const si=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:e,onBlur:h,onUndo:a})=>{const r=i=>{if(i.target!=null){const t=Number.parseFloat(i.target.value);if(!Number.isNaN(t)){o===null||o===void 0?void 0:o(Number.parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){e===null||e===void 0?void 0:e()}else if(i.key==="z"&&t&&a){i.preventDefault();a()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:r,onKeyDown:d,onBlur:h})};function ni(i,t){return Math.min(i,Math.max(0,t))}function oi(i,t,s,n,o=5){const{width:l,height:e}=i.dimensions;const h=t.width+o;const a=t.height+o;function r(i){return`${i}px`}switch(n){case"top-left":return{right:r(ni(l-h,l-s.x)),bottom:r(ni(e-a,e-s.y))};case"top-right":return{left:r(ni(l-h,s.x)),bottom:r(ni(e-a,e-s.y))};case"bottom-left":return{right:r(ni(l-h,l-s.x)),top:r(ni(e-a,s.y))};case"bottom-right":default:return{left:r(ni(l-h,s.x)),top:r(ni(e-a,s.y))}}}function li(i,t,s=3,n=1,o=1){return ai(i,t,h.back(),h.up(),s,n,o)}function ei(i,t,s=3,n=1,o=1){return ai(i,t,h.right(),h.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ai(i,t,h.right(),h.up(),s,n,o)}function ai(i,t,s,n,o,l=1,e=1){const r=h.multiplyByTransformMatrixRowMajor(h.add(s,n),u.makeRotation(f.fromMatrixRotation(i)));const v=h.multiplyByTransformMatrixRowMajor(s,u.makeRotation(f.fromMatrixRotation(i)));const c=h.multiplyByTransformMatrixRowMajor(n,u.makeRotation(f.fromMatrixRotation(i)));const w=10*e**.25;const p=h.fromMatrixPosition(i);const g=h.add(p,h.scale(o*w,r));const x=a.create({origin:g,direction:v});const y=a.create({origin:g,direction:c});const b=h.cross(v,c);const m=h.rotateAboutAxis(d.toRadians(45),a.at(y,-(o*l)),b,g);const z=h.rotateAboutAxis(d.toRadians(45),a.at(x,o*l),b,g);const T=h.rotateAboutAxis(d.toRadians(45),a.at(y,o*l),b,g);const D=h.rotateAboutAxis(d.toRadians(45),a.at(x,-(o*l)),b,g);return new C(h.dot(v,t.direction)!==-1&&h.dot(c,t.direction)!==-1,m,D,z,T,h.multiplyByTransformMatrixColumnMajor(m,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(D,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(z,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(T,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof D){return di(i,t,s,n)}return false}function di(i,t,s,n){return ui([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||ui([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function ui(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const e=h.subtract(i[1],i[0]);const a=h.subtract(i[2],i[0]);const r=p.epsilon((o=p.fromVectors([l.direction,l.origin,e,a]))!==null&&o!==void 0?o:p.create(e,a));const d=h.cross(l.direction,a);const u=h.dot(e,d);if(!(Math.abs(u)>=r)){return false}const v=h.subtract(l.origin,i[0]);const c=h.dot(v,d)/u;if(c<0||c>1){return false}const f=h.cross(v,e);const w=h.dot(l.direction,f)/u;if(w<0||c+w>1){return false}const g=h.dot(a,f)/u;return!Number.isNaN(g)&&(g>0||t.scene.camera.isOrthographic())}return false}class vi extends R{constructor(i,t={},s={}){var n,o,l,e,h,a,r,d,u,v,c,f,w,p;super(i);this.customization=t;this.disabledAxis={xTranslation:false,yTranslation:false,zTranslation:false,xyTranslation:false,xzTranslation:false,yzTranslation:false,xRotation:false,yRotation:false,zRotation:false};this.axisLines=[];this.rotationLines=[];this.translationMeshes=[];this.rotationMeshes=[];this.hoveredChanged=new T;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(e=t.colors)===null||e===void 0?void 0:e.hovered;this.outlineColor=(h=t.colors)===null||h===void 0?void 0:h.outline;this.disabledAxis.xTranslation=(a=s.xTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.yTranslation=(r=s.yTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&c.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis={...this.disabledAxis,...i};this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,e,h,a,r,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(e=i.outline)!==null&&e!==void 0?e:this.outlineColor;(h=this.xArrow)===null||h===void 0?void 0:h.updateFillColor(this.getXTranslationColor(),true);(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.getYTranslationColor(),true);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization={...this.customization,scalars:i};if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,e,h,a,r,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(e=this.zRotation)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(h=this.zxRotationLine)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(a=this.zyRotationLine)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.zRotation);(r=this.xArrow)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,e,h,a,r;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor(this.hoveredArrowFillColor)}else if(((h=this.hoveredElement)===null||h===void 0?void 0:h.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,e,h,a,r,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((e=this.xArrow)===null||e===void 0?void 0:e.initialFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor((a=this.zArrow)===null||a===void 0?void 0:a.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.initialFillColor)}}hasData(){return this.transform!=null}createOrUpdateElements(){if(this.transform!=null&&this.frame!=null){if(this.xArrow==null||this.yArrow==null||this.zArrow==null){this.createElements(this.transform,this.frame)}else{this.updateElements(this.transform,this.frame)}this.interactiveBounds=P(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=P(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f;this.reglCommand=S({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=E(this.reglCommand);const p=this.computeTriangleSize(h.fromMatrixPosition(i),t);this.xArrow=new D(w,"x-translate",A(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new D(w,"x-rotate",li(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new U(w,"x-axis",H(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new D(w,"y-translate",I(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new D(w,"y-rotate",ei(i,t.scene.camera,p,(e=this.customization.scalars)===null||e===void 0?void 0:e.yRotation,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new U(w,"y-axis",H(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new D(w,"z-translate",N(i,t.scene.camera,p,(r=this.customization.scalars)===null||r===void 0?void 0:r.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new U(w,"z-axis",H(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new D(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new D(w,"xy-translate",F(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new D(w,"xz-translate",O(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new D(w,"yz-translate",j(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);this.axisLines=[this.xAxis,this.yAxis,this.zAxis];this.translationMeshes=[this.xArrow,this.yArrow,this.zArrow,this.xyTranslation,this.xzTranslation,this.yzTranslation];this.rotationMeshes=[this.xRotation,this.yRotation,this.zRotation];this.updateDisabledOnDrawables();this.availableElements=[...this.axisLines,...this.rotationLines,...this.translationMeshes,...this.rotationMeshes]}getXRotationColor(){return this.xArrowFillColor}getYRotationColor(){return this.yArrowFillColor}getZRotationColor(){return this.zArrowFillColor}getXTranslationColor(){return this.xArrowFillColor}getYTranslationColor(){return this.yArrowFillColor}getZTranslationColor(){return this.zArrowFillColor}getTwoAxesTranslationColor(){return this.twoAxesSquareFillColor}createRotationLines(i,t,s){var n,o,l,e,a,r;const d=this.computeTriangleSize(h.fromMatrixPosition(t),s);const u=M(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=M(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=M(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=M(s.scene.camera,this.yRotation,(e=this.zArrow)===null||e===void 0?void 0:e.points.worldTip,d);const w=M(s.scene.camera,this.zRotation,(a=this.xArrow)===null||a===void 0?void 0:a.points.worldTip,d);const p=M(s.scene.camera,this.zRotation,(r=this.yArrow)===null||r===void 0?void 0:r.points.worldTip,d);if(u!=null){this.xyRotationLine=new k(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new k(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new k(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new k(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new k(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new k(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f,w,p,g,x,y,b,m,z,T,C,D,R,P,S,E,U,k,$;const K=this.computeTriangleSize(h.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(A(i,t.scene.camera,K,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(H(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(li(i,t.scene.camera,K,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(e=this.customization.scalars)===null||e===void 0?void 0:e.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(I(i,t.scene.camera,K,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation));(r=this.yAxis)===null||r===void 0?void 0:r.updatePoints(H(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(ei(i,t.scene.camera,K,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(N(i,t.scene.camera,K,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(H(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,K,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(g=this.customization.scalars)===null||g===void 0?void 0:g.zTranslation));(x=this.xyRotationLine)===null||x===void 0?void 0:x.updatePoints(M(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,K));(b=this.xzRotationLine)===null||b===void 0?void 0:b.updatePoints(M(t.scene.camera,this.xRotation,(m=this.zArrow)===null||m===void 0?void 0:m.points.worldTip,K));(z=this.yxRotationLine)===null||z===void 0?void 0:z.updatePoints(M(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,K));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(M(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,K));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(M(t.scene.camera,this.zRotation,(P=this.xArrow)===null||P===void 0?void 0:P.points.worldTip,K));(S=this.zyRotationLine)===null||S===void 0?void 0:S.updatePoints(M(t.scene.camera,this.zRotation,(E=this.yArrow)===null||E===void 0?void 0:E.points.worldTip,K));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(F(i,t.scene.camera,K,(U=this.customization.scalars)===null||U===void 0?void 0:U.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(O(i,t.scene.camera,K,(k=this.customization.scalars)===null||k===void 0?void 0:k.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(j(i,t.scene.camera,K,($=this.customization.scalars)===null||$===void 0?void 0:$.yzTranslation))}}}const ci=()=>`:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}`;const fi=s(class t extends n{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.positionChanged=o(this,"positionChanged");this.rotationChanged=o(this,"rotationChanged");this.interactionEnded=o(this,"interactionEnded");this.interactionStarted=o(this,"interactionStarted");this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.inputShouldFocus=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;y((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{y((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=K(e.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const l=K(e.create(i.clientX,i.clientY),o);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=l!=null?d.fromPoints(h,l):0;this.lastWorldPosition=B(l,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=K(e.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const l=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const h=B(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(h!=null&&o!=null&&l!=null){const i=d.fromPoints(l,o);const t=ii(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,h,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=h;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=K(e.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new m(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=d.normalizeRadians(s+d.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=J(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(u.multiply(u.invert(this.startingTransform),this.currentTransform)));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new vi(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{y((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=q(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${Number.parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new m(this.angleUnit)}return new z(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:u.makeIdentity();const s=u.transpose(u.makeRotation(f.fromMatrixRotation(t)));const n=u.makeTranslation(i);return u.multiply(s,n)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:u.makeIdentity();const s=u.makeRotation(f.fromMatrixRotation(t));const n=u.makeRotation(f.fromEuler(i));const o=u.multiply(s,t);return u.multiply(u.transpose(n),o)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){$(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=u.multiply(this.currentTransform,s);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new b(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:v.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&u.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,n,o,e,h;return i(l,{key:"fdc062cb3cafa311baca827e03a765052e1ab2c8"},i("canvas",{key:"c6c9d413e971ef3db3b3eed7e9ff6c8387fff1d1",ref:i=>{this.canvasRef=i},class:g("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((n=this.viewer)===null||n===void 0?void 0:n.viewport)&&i(ti,{key:"7eb3550df7db8c95f3597d1bd8d7b05c70e11696",ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(si,{key:"84e2ff6825856c6d5f0ffff1771861ed6087bedb",ref:i=>{this.inputRef=i},identifier:(e=(o=this.dragging)===null||o===void 0?void 0:o.identifier)!==null&&e!==void 0?e:(h=this.lastDragged)===null||h===void 0?void 0:h.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=L(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(u.multiply(u.invert(this.startingTransform),this.currentTransform))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return this}static get watchers(){return{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}}static get style(){return ci()}},[1,"vertex-viewer-transform-widget",{viewer:[16],position:[1040],rotation:[1040],controller:[1040],xRotationDisabled:[1028,"x-rotation-disabled"],yRotationDisabled:[1028,"y-rotation-disabled"],zRotationDisabled:[1028,"z-rotation-disabled"],xTranslationDisabled:[1028,"x-translation-disabled"],yTranslationDisabled:[1028,"y-translation-disabled"],zTranslationDisabled:[1028,"z-translation-disabled"],xyTranslationDisabled:[1028,"xy-translation-disabled"],xzTranslationDisabled:[1028,"xz-translation-disabled"],yzTranslationDisabled:[1028,"yz-translation-disabled"],showInputs:[4,"show-inputs"],distanceUnit:[1,"distance-unit"],angleUnit:[1,"angle-unit"],decimalPlaces:[2,"decimal-places"],rotationSnapDegrees:[2,"rotation-snap-degrees"],rotationSnapKey:[1,"rotation-snap-key"],translationHandleScalar:[2,"translation-handle-scalar"],rotationHandleScalar:[2,"rotation-handle-scalar"],interactionThrottle:[2,"interaction-throttle"],EXPERIMENTAL_undoKeybindings:[4,"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings"],hovered:[1040],inputPosition:[32],inputValue:[32],isEndingTransform:[32],inputShouldFocus:[32],EXPERIMENTAL_undo:[64]},undefined,{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}]);function wi(){if(typeof customElements==="undefined"){return}const i=["vertex-viewer-transform-widget"];i.forEach((i=>{switch(i){case"vertex-viewer-transform-widget":if(!customElements.get(t(i))){customElements.define(t(i),fi)}break}}))}wi();const pi=fi;const gi=wi;export{pi as VertexViewerTransformWidget,gi as defineCustomElement};
4
+ import{h as i,t,p as s,H as n,d as o,e as l}from"./p-Bb32XUUS.js";import{p as e,v as h,r as a,b as r,a as d,m as u,h as v,g as c,q as f,e as w,c as p}from"./p-2UsvOTHJ.js";import{c as g}from"./p-C6gMOKYg.js";import{w as x,r as y}from"./p-Cd7kap5W.js";import{T as b}from"./p-C12jtCFb.js";import{A as m,D as z}from"./p-BjvjKoy7.js";import{E as T}from"./p-CDM7zNn0.js";import{d as D,T as C,R,e as P,r as S,s as E,x as A,A as U,b as H,y as I,z as N,f as j,g as F,h as O,i as M,j as k}from"./p-KidjtXKE.js";function $(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function K(i,t){return t!=null?e.create(i.x-t.left,i.y-t.top):undefined}function X(i,t,s,n){const o=n!=null?h.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=a.at(a.create({origin:o,direction:t.scene.camera.direction}),h.magnitude(t.scene.camera.viewVector)*2);return a.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return a.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function B(i,t,s,n,o,l){return u.multiply(J(t,s,n,o,l),i)}function J(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>e.convertFrom(t-s);const r=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return u.makeTranslation(h.create(r(),0,0));case"y-translate":return u.makeTranslation(h.create(0,r(),0));case"z-translate":return u.makeTranslation(h.create(0,0,r()));case"x-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.left(),a())));case"y-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.down(),a())));case"z-rotate":return u.transpose(u.makeRotation(f.fromAxisAngle(h.forward(),a())));default:return u.makeIdentity()}}function _(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function q(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>u.makeRotation(f.fromMatrixRotation(t));const r=()=>u.multiply(u.invert(s),t);const c=()=>h.multiplyByTransformMatrixColumnMajor(h.fromMatrixPosition(r()),a());const w=()=>v.fromRotationMatrix(u.multiply(s,a()),_(i));switch(i){case"x-translate":return l.convertWorldValueToReal(c().x);case"y-translate":return l.convertWorldValueToReal(c().y);case"z-translate":return l.convertWorldValueToReal(c().z);case"x-rotate":return e.convertTo(d.normalizeRadians(w().x));case"y-rotate":return e.convertTo(d.normalizeRadians(w().y));case"z-rotate":return e.convertTo(d.normalizeRadians(w().z));default:return 0}}function L(i,t,s,n,o,l){return V(i,h.subtract(s,t),n,o,l)}function V(i,t,s,n,o){switch(o){case"x-translate":return W(i,t,h.right());case"y-translate":return W(i,t,h.up());case"z-translate":return W(i,t,h.back());case"xy-translate":return G(i,t,h.create(0,0,1));case"xz-translate":return G(i,t,h.create(0,1,0));case"yz-translate":return G(i,t,h.create(1,0,0));case"x-rotate":return Y(i,s,h.right(),n);case"y-rotate":return Y(i,s,h.up(),n);case"z-rotate":return Y(i,s,h.forward(),n);default:return i}}function Y(i,t,s,n){const o=Z(i,t,s);const l=f.fromAxisAngle(o,n);const e=u.transpose(u.makeRotation(l));return u.multiply(e,i)}function Z(i,t,s){const n=u.makeRotation(f.fromMatrixRotation(i));const o=h.multiplyByTransformMatrixRowMajor(s,n);const l=h.multiplyByTransformMatrixRowMajor(h.negate(s),n);return h.dot(t,o)>h.dot(t,l)?s:h.negate(s)}function W(i,t,s){const n=h.normalize(s);const o=u.makeRotation(f.fromMatrixRotation(i));const l=h.multiplyByTransformMatrixRowMajor(n,o);const e=h.project(t,l);const a=u.makeTranslation(e);return u.multiply(i,a)}function G(i,t,s){const n=h.normalize(s);const o=u.makeRotation(f.fromMatrixRotation(i));const l=h.multiplyByTransformMatrixRowMajor(n,o);const e=h.fromMatrixPosition(i);const a=r.fromNormalAndCoplanarPoint(l,e);const d=r.projectPoint(a,t);const v=h.add(d,h.scale(a.constant,a.normal));const c=u.makeTranslation(v);return u.multiply(i,c)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=c.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const l=c.topLeft(n);const h=e.add(l,e.create(n.width,0));const a=c.bottomRight(n);const r=e.subtract(a,e.create(n.width,0));const d=e.scale(o.reduce(((i,t)=>e.add(i,t)),e.create()),1/o.length,1/o.length);const u=[h,r,a].reduce(((i,t)=>e.distance(d,t)<e.distance(d,i)?t:i),l);switch(u){case l:return{point:u,placement:"top-left"};case h:return{point:u,placement:"top-right"};case r:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function ii(i,t,s,n,o,l){const e=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(e&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=d.toDegrees(i);const e=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=e-t;const h=d.toRadians(s);return h+n}else{const i=d.toRadians(e);return i+n}}else{return s}}const ti=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:e},h)=>{const a=oi(n,s!==null&&s!==void 0?s:w.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:{...a,height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined}},h,i("div",{class:"widget-input units"},e.unit.abbreviatedName))};const si=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:e,onBlur:h,onUndo:a})=>{const r=i=>{if(i.target!=null){const t=Number.parseFloat(i.target.value);if(!Number.isNaN(t)){o===null||o===void 0?void 0:o(Number.parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){e===null||e===void 0?void 0:e()}else if(i.key==="z"&&t&&a){i.preventDefault();a()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:r,onKeyDown:d,onBlur:h,"aria-label":"Transform widget input"})};function ni(i,t){return Math.min(i,Math.max(0,t))}function oi(i,t,s,n,o=5){const{width:l,height:e}=i.dimensions;const h=t.width+o;const a=t.height+o;function r(i){return`${i}px`}switch(n){case"top-left":return{right:r(ni(l-h,l-s.x)),bottom:r(ni(e-a,e-s.y))};case"top-right":return{left:r(ni(l-h,s.x)),bottom:r(ni(e-a,e-s.y))};case"bottom-left":return{right:r(ni(l-h,l-s.x)),top:r(ni(e-a,s.y))};case"bottom-right":default:return{left:r(ni(l-h,s.x)),top:r(ni(e-a,s.y))}}}function li(i,t,s=3,n=1,o=1){return ai(i,t,h.back(),h.up(),s,n,o)}function ei(i,t,s=3,n=1,o=1){return ai(i,t,h.right(),h.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ai(i,t,h.right(),h.up(),s,n,o)}function ai(i,t,s,n,o,l=1,e=1){const r=h.multiplyByTransformMatrixRowMajor(h.add(s,n),u.makeRotation(f.fromMatrixRotation(i)));const v=h.multiplyByTransformMatrixRowMajor(s,u.makeRotation(f.fromMatrixRotation(i)));const c=h.multiplyByTransformMatrixRowMajor(n,u.makeRotation(f.fromMatrixRotation(i)));const w=10*e**.25;const p=h.fromMatrixPosition(i);const g=h.add(p,h.scale(o*w,r));const x=a.create({origin:g,direction:v});const y=a.create({origin:g,direction:c});const b=h.cross(v,c);const m=h.rotateAboutAxis(d.toRadians(45),a.at(y,-(o*l)),b,g);const z=h.rotateAboutAxis(d.toRadians(45),a.at(x,o*l),b,g);const T=h.rotateAboutAxis(d.toRadians(45),a.at(y,o*l),b,g);const C=h.rotateAboutAxis(d.toRadians(45),a.at(x,-(o*l)),b,g);return new D(h.dot(v,t.direction)!==-1&&h.dot(c,t.direction)!==-1,m,C,z,T,h.multiplyByTransformMatrixColumnMajor(m,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(C,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(z,t.projectionViewMatrix),h.multiplyByTransformMatrixColumnMajor(T,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof C){return di(i,t,s,n)}return false}function di(i,t,s,n){return ui([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||ui([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function ui(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const e=h.subtract(i[1],i[0]);const a=h.subtract(i[2],i[0]);const r=p.epsilon((o=p.fromVectors([l.direction,l.origin,e,a]))!==null&&o!==void 0?o:p.create(e,a));const d=h.cross(l.direction,a);const u=h.dot(e,d);if(!(Math.abs(u)>=r)){return false}const v=h.subtract(l.origin,i[0]);const c=h.dot(v,d)/u;if(c<0||c>1){return false}const f=h.cross(v,e);const w=h.dot(l.direction,f)/u;if(w<0||c+w>1){return false}const g=h.dot(a,f)/u;return!Number.isNaN(g)&&(g>0||t.scene.camera.isOrthographic())}return false}class vi extends R{constructor(i,t={},s={}){var n,o,l,e,h,a,r,d,u,v,c,f,w,p;super(i);this.customization=t;this.disabledAxis={xTranslation:false,yTranslation:false,zTranslation:false,xyTranslation:false,xzTranslation:false,yzTranslation:false,xRotation:false,yRotation:false,zRotation:false};this.axisLines=[];this.rotationLines=[];this.translationMeshes=[];this.rotationMeshes=[];this.hoveredChanged=new T;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(e=t.colors)===null||e===void 0?void 0:e.hovered;this.outlineColor=(h=t.colors)===null||h===void 0?void 0:h.outline;this.disabledAxis.xTranslation=(a=s.xTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.yTranslation=(r=s.yTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&c.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis={...this.disabledAxis,...i};this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,e,h,a,r,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(e=i.outline)!==null&&e!==void 0?e:this.outlineColor;(h=this.xArrow)===null||h===void 0?void 0:h.updateFillColor(this.getXTranslationColor(),true);(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.getYTranslationColor(),true);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization={...this.customization,scalars:i};if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,e,h,a,r,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(e=this.zRotation)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(h=this.zxRotationLine)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(a=this.zyRotationLine)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.zRotation);(r=this.xArrow)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,e,h,a,r;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor(this.hoveredArrowFillColor)}else if(((h=this.hoveredElement)===null||h===void 0?void 0:h.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,e,h,a,r,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((e=this.xArrow)===null||e===void 0?void 0:e.initialFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor((a=this.zArrow)===null||a===void 0?void 0:a.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.initialFillColor)}}hasData(){return this.transform!=null}createOrUpdateElements(){if(this.transform!=null&&this.frame!=null){if(this.xArrow==null||this.yArrow==null||this.zArrow==null){this.createElements(this.transform,this.frame)}else{this.updateElements(this.transform,this.frame)}this.interactiveBounds=P(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=P(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f;this.reglCommand=S({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=E(this.reglCommand);const p=this.computeTriangleSize(h.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",A(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",li(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new U(w,"x-axis",H(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",I(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",ei(i,t.scene.camera,p,(e=this.customization.scalars)===null||e===void 0?void 0:e.yRotation,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new U(w,"y-axis",H(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",N(i,t.scene.camera,p,(r=this.customization.scalars)===null||r===void 0?void 0:r.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new U(w,"z-axis",H(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",j(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",F(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",O(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);this.axisLines=[this.xAxis,this.yAxis,this.zAxis];this.translationMeshes=[this.xArrow,this.yArrow,this.zArrow,this.xyTranslation,this.xzTranslation,this.yzTranslation];this.rotationMeshes=[this.xRotation,this.yRotation,this.zRotation];this.updateDisabledOnDrawables();this.availableElements=[...this.axisLines,...this.rotationLines,...this.translationMeshes,...this.rotationMeshes]}getXRotationColor(){return this.xArrowFillColor}getYRotationColor(){return this.yArrowFillColor}getZRotationColor(){return this.zArrowFillColor}getXTranslationColor(){return this.xArrowFillColor}getYTranslationColor(){return this.yArrowFillColor}getZTranslationColor(){return this.zArrowFillColor}getTwoAxesTranslationColor(){return this.twoAxesSquareFillColor}createRotationLines(i,t,s){var n,o,l,e,a,r;const d=this.computeTriangleSize(h.fromMatrixPosition(t),s);const u=M(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=M(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=M(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=M(s.scene.camera,this.yRotation,(e=this.zArrow)===null||e===void 0?void 0:e.points.worldTip,d);const w=M(s.scene.camera,this.zRotation,(a=this.xArrow)===null||a===void 0?void 0:a.points.worldTip,d);const p=M(s.scene.camera,this.zRotation,(r=this.yArrow)===null||r===void 0?void 0:r.points.worldTip,d);if(u!=null){this.xyRotationLine=new k(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new k(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new k(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new k(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new k(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new k(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f,w,p,g,x,y,b,m,z,T,D,C,R,P,S,E,U,k,$;const K=this.computeTriangleSize(h.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(A(i,t.scene.camera,K,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(H(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(li(i,t.scene.camera,K,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(e=this.customization.scalars)===null||e===void 0?void 0:e.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(I(i,t.scene.camera,K,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation));(r=this.yAxis)===null||r===void 0?void 0:r.updatePoints(H(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(ei(i,t.scene.camera,K,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(N(i,t.scene.camera,K,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(H(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,K,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(g=this.customization.scalars)===null||g===void 0?void 0:g.zTranslation));(x=this.xyRotationLine)===null||x===void 0?void 0:x.updatePoints(M(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,K));(b=this.xzRotationLine)===null||b===void 0?void 0:b.updatePoints(M(t.scene.camera,this.xRotation,(m=this.zArrow)===null||m===void 0?void 0:m.points.worldTip,K));(z=this.yxRotationLine)===null||z===void 0?void 0:z.updatePoints(M(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,K));(D=this.yzRotationLine)===null||D===void 0?void 0:D.updatePoints(M(t.scene.camera,this.yRotation,(C=this.zArrow)===null||C===void 0?void 0:C.points.worldTip,K));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(M(t.scene.camera,this.zRotation,(P=this.xArrow)===null||P===void 0?void 0:P.points.worldTip,K));(S=this.zyRotationLine)===null||S===void 0?void 0:S.updatePoints(M(t.scene.camera,this.zRotation,(E=this.yArrow)===null||E===void 0?void 0:E.points.worldTip,K));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(j(i,t.scene.camera,K,(U=this.customization.scalars)===null||U===void 0?void 0:U.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(F(i,t.scene.camera,K,(k=this.customization.scalars)===null||k===void 0?void 0:k.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(O(i,t.scene.camera,K,($=this.customization.scalars)===null||$===void 0?void 0:$.yzTranslation))}}}const ci=()=>`:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}`;const fi=s(class t extends n{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.positionChanged=o(this,"positionChanged");this.rotationChanged=o(this,"rotationChanged");this.interactionEnded=o(this,"interactionEnded");this.interactionStarted=o(this,"interactionStarted");this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.inputShouldFocus=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;y((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{y((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=K(e.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const l=K(e.create(i.clientX,i.clientY),o);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=l!=null?d.fromPoints(h,l):0;this.lastWorldPosition=X(l,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=K(e.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const l=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const h=X(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(h!=null&&o!=null&&l!=null){const i=d.fromPoints(l,o);const t=ii(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,h,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=h;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=K(e.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new m(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=d.normalizeRadians(s+d.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=B(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(u.multiply(u.invert(this.startingTransform),this.currentTransform)));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new vi(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{y((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=q(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${Number.parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new m(this.angleUnit)}return new z(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:u.makeIdentity();const s=u.transpose(u.makeRotation(f.fromMatrixRotation(t)));const n=u.makeTranslation(i);return u.multiply(s,n)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:u.makeIdentity();const s=u.makeRotation(f.fromMatrixRotation(t));const n=u.makeRotation(f.fromEuler(i));const o=u.multiply(s,t);return u.multiply(u.transpose(n),o)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){$(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=u.multiply(this.currentTransform,s);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=v.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new b(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:v.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&u.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,n,o,e,h;return i(l,{key:"fdc062cb3cafa311baca827e03a765052e1ab2c8"},i("canvas",{key:"c6c9d413e971ef3db3b3eed7e9ff6c8387fff1d1",ref:i=>{this.canvasRef=i},class:g("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((n=this.viewer)===null||n===void 0?void 0:n.viewport)&&i(ti,{key:"7eb3550df7db8c95f3597d1bd8d7b05c70e11696",ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(si,{key:"84e2ff6825856c6d5f0ffff1771861ed6087bedb",ref:i=>{this.inputRef=i},identifier:(e=(o=this.dragging)===null||o===void 0?void 0:o.identifier)!==null&&e!==void 0?e:(h=this.lastDragged)===null||h===void 0?void 0:h.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=L(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(u.multiply(u.invert(this.startingTransform),this.currentTransform))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return this}static get watchers(){return{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}}static get style(){return ci()}},[1,"vertex-viewer-transform-widget",{viewer:[16],position:[1040],rotation:[1040],controller:[1040],xRotationDisabled:[1028,"x-rotation-disabled"],yRotationDisabled:[1028,"y-rotation-disabled"],zRotationDisabled:[1028,"z-rotation-disabled"],xTranslationDisabled:[1028,"x-translation-disabled"],yTranslationDisabled:[1028,"y-translation-disabled"],zTranslationDisabled:[1028,"z-translation-disabled"],xyTranslationDisabled:[1028,"xy-translation-disabled"],xzTranslationDisabled:[1028,"xz-translation-disabled"],yzTranslationDisabled:[1028,"yz-translation-disabled"],showInputs:[4,"show-inputs"],distanceUnit:[1,"distance-unit"],angleUnit:[1,"angle-unit"],decimalPlaces:[2,"decimal-places"],rotationSnapDegrees:[2,"rotation-snap-degrees"],rotationSnapKey:[1,"rotation-snap-key"],translationHandleScalar:[2,"translation-handle-scalar"],rotationHandleScalar:[2,"rotation-handle-scalar"],interactionThrottle:[2,"interaction-throttle"],EXPERIMENTAL_undoKeybindings:[4,"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings"],hovered:[1040],inputPosition:[32],inputValue:[32],isEndingTransform:[32],inputShouldFocus:[32],EXPERIMENTAL_undo:[64]},undefined,{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}]);function wi(){if(typeof customElements==="undefined"){return}const i=["vertex-viewer-transform-widget"];i.forEach((i=>{switch(i){case"vertex-viewer-transform-widget":if(!customElements.get(t(i))){customElements.define(t(i),fi)}break}}))}wi();const pi=fi;const gi=wi;export{pi as VertexViewerTransformWidget,gi as defineCustomElement};
5
5
  //# sourceMappingURL=vertex-viewer-transform-widget.js.map