architwin 1.0.9

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 (274) hide show
  1. package/README.md +530 -0
  2. package/bundle/LICENSE.md +17 -0
  3. package/bundle/css/core.css +21 -0
  4. package/bundle/css/late.css +22 -0
  5. package/bundle/css/showcase.css +406 -0
  6. package/bundle/css/unsupported_browser.css +1 -0
  7. package/bundle/cursors/grab.png +0 -0
  8. package/bundle/cursors/grabbing.png +0 -0
  9. package/bundle/cursors/rbe-default.png +0 -0
  10. package/bundle/cursors/rbe-finish-room.png +0 -0
  11. package/bundle/cursors/rbe-moving.png +0 -0
  12. package/bundle/cursors/rbe-place-door.png +0 -0
  13. package/bundle/cursors/rbe-place-node.png +0 -0
  14. package/bundle/cursors/rbe-place-opening.png +0 -0
  15. package/bundle/cursors/zoom-in.png +0 -0
  16. package/bundle/cursors/zoom-out.png +0 -0
  17. package/bundle/fonts/ibm-plex-sans-100.woff +0 -0
  18. package/bundle/fonts/ibm-plex-sans-100.woff2 +0 -0
  19. package/bundle/fonts/ibm-plex-sans-100italic.woff +0 -0
  20. package/bundle/fonts/ibm-plex-sans-100italic.woff2 +0 -0
  21. package/bundle/fonts/ibm-plex-sans-200.woff +0 -0
  22. package/bundle/fonts/ibm-plex-sans-200.woff2 +0 -0
  23. package/bundle/fonts/ibm-plex-sans-200italic.woff +0 -0
  24. package/bundle/fonts/ibm-plex-sans-200italic.woff2 +0 -0
  25. package/bundle/fonts/ibm-plex-sans-300.woff +0 -0
  26. package/bundle/fonts/ibm-plex-sans-300.woff2 +0 -0
  27. package/bundle/fonts/ibm-plex-sans-300italic.woff +0 -0
  28. package/bundle/fonts/ibm-plex-sans-300italic.woff2 +0 -0
  29. package/bundle/fonts/ibm-plex-sans-500.woff +0 -0
  30. package/bundle/fonts/ibm-plex-sans-500.woff2 +0 -0
  31. package/bundle/fonts/ibm-plex-sans-500italic.woff +0 -0
  32. package/bundle/fonts/ibm-plex-sans-500italic.woff2 +0 -0
  33. package/bundle/fonts/ibm-plex-sans-600.woff +0 -0
  34. package/bundle/fonts/ibm-plex-sans-600.woff2 +0 -0
  35. package/bundle/fonts/ibm-plex-sans-600italic.woff +0 -0
  36. package/bundle/fonts/ibm-plex-sans-600italic.woff2 +0 -0
  37. package/bundle/fonts/ibm-plex-sans-700.woff +0 -0
  38. package/bundle/fonts/ibm-plex-sans-700.woff2 +0 -0
  39. package/bundle/fonts/ibm-plex-sans-700italic.woff +0 -0
  40. package/bundle/fonts/ibm-plex-sans-700italic.woff2 +0 -0
  41. package/bundle/fonts/ibm-plex-sans-italic.woff +0 -0
  42. package/bundle/fonts/ibm-plex-sans-italic.woff2 +0 -0
  43. package/bundle/fonts/ibm-plex-sans-regular.woff +0 -0
  44. package/bundle/fonts/ibm-plex-sans-regular.woff2 +0 -0
  45. package/bundle/fonts/mp-font.svg +2079 -0
  46. package/bundle/fonts/mp-font.woff +0 -0
  47. package/bundle/fonts/mp-font.woff2 +0 -0
  48. package/bundle/fonts/roboto-100.woff +0 -0
  49. package/bundle/fonts/roboto-100.woff2 +0 -0
  50. package/bundle/fonts/roboto-100italic.woff +0 -0
  51. package/bundle/fonts/roboto-100italic.woff2 +0 -0
  52. package/bundle/fonts/roboto-300.woff +0 -0
  53. package/bundle/fonts/roboto-300.woff2 +0 -0
  54. package/bundle/fonts/roboto-300italic.woff +0 -0
  55. package/bundle/fonts/roboto-300italic.woff2 +0 -0
  56. package/bundle/fonts/roboto-500.woff +0 -0
  57. package/bundle/fonts/roboto-500.woff2 +0 -0
  58. package/bundle/fonts/roboto-500italic.woff +0 -0
  59. package/bundle/fonts/roboto-500italic.woff2 +0 -0
  60. package/bundle/fonts/roboto-700.woff +0 -0
  61. package/bundle/fonts/roboto-700.woff2 +0 -0
  62. package/bundle/fonts/roboto-700italic.woff +0 -0
  63. package/bundle/fonts/roboto-700italic.woff2 +0 -0
  64. package/bundle/fonts/roboto-900.woff +0 -0
  65. package/bundle/fonts/roboto-900.woff2 +0 -0
  66. package/bundle/fonts/roboto-900italic.woff +0 -0
  67. package/bundle/fonts/roboto-900italic.woff2 +0 -0
  68. package/bundle/fonts/roboto-italic.woff +0 -0
  69. package/bundle/fonts/roboto-italic.woff2 +0 -0
  70. package/bundle/fonts/roboto-regular.woff +0 -0
  71. package/bundle/fonts/roboto-regular.woff2 +0 -0
  72. package/bundle/images/360_placement_pin_mask.png +0 -0
  73. package/bundle/images/Desktop-help-play-button.svg +1 -0
  74. package/bundle/images/Desktop-help-spacebar.png +0 -0
  75. package/bundle/images/MP-logo_H_lock-RGB_color-black.svg +24 -0
  76. package/bundle/images/NoteColor.png +0 -0
  77. package/bundle/images/chrome.png +0 -0
  78. package/bundle/images/edge.png +0 -0
  79. package/bundle/images/escape.png +0 -0
  80. package/bundle/images/exterior.png +0 -0
  81. package/bundle/images/exterior_hover.png +0 -0
  82. package/bundle/images/firefox.png +0 -0
  83. package/bundle/images/headset-quest-2.png +0 -0
  84. package/bundle/images/interior.png +0 -0
  85. package/bundle/images/interior_hover.png +0 -0
  86. package/bundle/images/login-screen-background.jpg +0 -0
  87. package/bundle/images/matterport-app-icon.svg +9 -0
  88. package/bundle/images/matterport-logo-light.svg +1 -0
  89. package/bundle/images/mattertag-disc-128-free.v1.png +0 -0
  90. package/bundle/images/mobile-help-play-button.svg +1 -0
  91. package/bundle/images/nav_help_360.png +0 -0
  92. package/bundle/images/nav_help_click_inside.png +0 -0
  93. package/bundle/images/nav_help_gesture_drag.png +0 -0
  94. package/bundle/images/nav_help_gesture_drag_two_finger.png +0 -0
  95. package/bundle/images/nav_help_gesture_pinch.png +0 -0
  96. package/bundle/images/nav_help_gesture_position.png +0 -0
  97. package/bundle/images/nav_help_gesture_position_two_finger.png +0 -0
  98. package/bundle/images/nav_help_gesture_tap.png +0 -0
  99. package/bundle/images/nav_help_inside_key.png +0 -0
  100. package/bundle/images/nav_help_keyboard_all.png +0 -0
  101. package/bundle/images/nav_help_keyboard_left_right.png +0 -0
  102. package/bundle/images/nav_help_keyboard_up_down.png +0 -0
  103. package/bundle/images/nav_help_mouse_click.png +0 -0
  104. package/bundle/images/nav_help_mouse_drag_left.png +0 -0
  105. package/bundle/images/nav_help_mouse_drag_right.png +0 -0
  106. package/bundle/images/nav_help_mouse_position_left.png +0 -0
  107. package/bundle/images/nav_help_mouse_position_right.png +0 -0
  108. package/bundle/images/nav_help_mouse_zoom.png +0 -0
  109. package/bundle/images/nav_help_tap_inside.png +0 -0
  110. package/bundle/images/nav_help_zoom_keys.png +0 -0
  111. package/bundle/images/objectColor.png +0 -0
  112. package/bundle/images/outlineBasic1024.png +0 -0
  113. package/bundle/images/outlineBasic2048.png +0 -0
  114. package/bundle/images/outlineBasic4096.png +0 -0
  115. package/bundle/images/outlineBasic512.png +0 -0
  116. package/bundle/images/outlineEnhanced1024.png +0 -0
  117. package/bundle/images/outlineEnhanced2048.png +0 -0
  118. package/bundle/images/outlineEnhanced4096.png +0 -0
  119. package/bundle/images/outlineEnhanced512.png +0 -0
  120. package/bundle/images/pinAnchor.png +0 -0
  121. package/bundle/images/pinIconDefault.png +0 -0
  122. package/bundle/images/safari.png +0 -0
  123. package/bundle/images/scope.svg +3 -0
  124. package/bundle/images/selected_sweep_glow.png +0 -0
  125. package/bundle/images/showcase-password-background.jpg +0 -0
  126. package/bundle/images/surface_grid_planar_256.png +0 -0
  127. package/bundle/images/tagColor.png +0 -0
  128. package/bundle/images/unsupported-browser.jpg +0 -0
  129. package/bundle/images/uv_grid_opengl.jpg +0 -0
  130. package/bundle/images/vert_arrows.png +0 -0
  131. package/bundle/js/136.js +18 -0
  132. package/bundle/js/136.js.LICENSE.txt +20 -0
  133. package/bundle/js/143.js +2 -0
  134. package/bundle/js/143.js.LICENSE.txt +20 -0
  135. package/bundle/js/145.js +2 -0
  136. package/bundle/js/145.js.LICENSE.txt +20 -0
  137. package/bundle/js/189.js +2 -0
  138. package/bundle/js/189.js.LICENSE.txt +20 -0
  139. package/bundle/js/217.js +2 -0
  140. package/bundle/js/217.js.LICENSE.txt +20 -0
  141. package/bundle/js/313.js +2 -0
  142. package/bundle/js/313.js.LICENSE.txt +20 -0
  143. package/bundle/js/316.js +2 -0
  144. package/bundle/js/316.js.LICENSE.txt +27 -0
  145. package/bundle/js/321.js +2 -0
  146. package/bundle/js/321.js.LICENSE.txt +20 -0
  147. package/bundle/js/324.js +2 -0
  148. package/bundle/js/324.js.LICENSE.txt +20 -0
  149. package/bundle/js/325.js +2 -0
  150. package/bundle/js/325.js.LICENSE.txt +20 -0
  151. package/bundle/js/330.js +2 -0
  152. package/bundle/js/330.js.LICENSE.txt +20 -0
  153. package/bundle/js/335.js +2 -0
  154. package/bundle/js/335.js.LICENSE.txt +20 -0
  155. package/bundle/js/376.js +2 -0
  156. package/bundle/js/376.js.LICENSE.txt +20 -0
  157. package/bundle/js/422.js +2 -0
  158. package/bundle/js/422.js.LICENSE.txt +22 -0
  159. package/bundle/js/493.js +2 -0
  160. package/bundle/js/493.js.LICENSE.txt +27 -0
  161. package/bundle/js/512.js +2 -0
  162. package/bundle/js/512.js.LICENSE.txt +20 -0
  163. package/bundle/js/519.js +2 -0
  164. package/bundle/js/519.js.LICENSE.txt +20 -0
  165. package/bundle/js/521.js +2 -0
  166. package/bundle/js/521.js.LICENSE.txt +20 -0
  167. package/bundle/js/525.js +2 -0
  168. package/bundle/js/525.js.LICENSE.txt +20 -0
  169. package/bundle/js/607.js +2 -0
  170. package/bundle/js/607.js.LICENSE.txt +27 -0
  171. package/bundle/js/644.js +2 -0
  172. package/bundle/js/644.js.LICENSE.txt +63 -0
  173. package/bundle/js/648.js +2 -0
  174. package/bundle/js/648.js.LICENSE.txt +20 -0
  175. package/bundle/js/66.js +2 -0
  176. package/bundle/js/66.js.LICENSE.txt +20 -0
  177. package/bundle/js/662.js +2 -0
  178. package/bundle/js/662.js.LICENSE.txt +20 -0
  179. package/bundle/js/668.js +2 -0
  180. package/bundle/js/668.js.LICENSE.txt +20 -0
  181. package/bundle/js/718.js +2 -0
  182. package/bundle/js/718.js.LICENSE.txt +20 -0
  183. package/bundle/js/764.js +2 -0
  184. package/bundle/js/764.js.LICENSE.txt +29 -0
  185. package/bundle/js/833.js +20 -0
  186. package/bundle/js/833.js.LICENSE.txt +20 -0
  187. package/bundle/js/858.js +2 -0
  188. package/bundle/js/858.js.LICENSE.txt +20 -0
  189. package/bundle/js/916.js +2 -0
  190. package/bundle/js/916.js.LICENSE.txt +20 -0
  191. package/bundle/js/924.js +2 -0
  192. package/bundle/js/924.js.LICENSE.txt +20 -0
  193. package/bundle/js/932.js +2 -0
  194. package/bundle/js/932.js.LICENSE.txt +20 -0
  195. package/bundle/js/948.js +2 -0
  196. package/bundle/js/948.js.LICENSE.txt +20 -0
  197. package/bundle/js/958.js +2 -0
  198. package/bundle/js/958.js.LICENSE.txt +20 -0
  199. package/bundle/js/JPEGDecoder.worker.worker.js.LICENSE.txt +29 -0
  200. package/bundle/js/JPEGEncoder.worker.worker.js.LICENSE.txt +29 -0
  201. package/bundle/js/PNGDecoder.worker.worker.js.LICENSE.txt +20 -0
  202. package/bundle/js/PNGEncoder.worker.worker.js.LICENSE.txt +20 -0
  203. package/bundle/js/browser-check.js +2 -0
  204. package/bundle/js/browser-check.js.LICENSE.txt +18 -0
  205. package/bundle/js/showcase.js +6 -0
  206. package/bundle/js/showcase.js.LICENSE.txt +144 -0
  207. package/bundle/locale/messages/strings_de.json +1 -0
  208. package/bundle/locale/messages/strings_es.json +1 -0
  209. package/bundle/locale/messages/strings_fr.json +1 -0
  210. package/bundle/locale/messages/strings_it.json +1 -0
  211. package/bundle/locale/messages/strings_ja.json +1 -0
  212. package/bundle/locale/messages/strings_ko.json +1 -0
  213. package/bundle/locale/messages/strings_nl.json +1 -0
  214. package/bundle/locale/messages/strings_pt.json +1 -0
  215. package/bundle/locale/messages/strings_ru.json +1 -0
  216. package/bundle/locale/messages/strings_zh-CN.json +1 -0
  217. package/bundle/locale/messages/strings_zh-TW.json +1 -0
  218. package/bundle/locale/strings.json +1 -0
  219. package/bundle/sdk/cursors/grab.png +0 -0
  220. package/bundle/sdk/cursors/grabbing.png +0 -0
  221. package/bundle/sdk/cursors/rbe-default.png +0 -0
  222. package/bundle/sdk/cursors/rbe-finish-room.png +0 -0
  223. package/bundle/sdk/cursors/rbe-moving.png +0 -0
  224. package/bundle/sdk/cursors/rbe-place-door.png +0 -0
  225. package/bundle/sdk/cursors/rbe-place-node.png +0 -0
  226. package/bundle/sdk/cursors/rbe-place-opening.png +0 -0
  227. package/bundle/sdk/cursors/zoom-in.png +0 -0
  228. package/bundle/sdk/cursors/zoom-out.png +0 -0
  229. package/bundle/sdk/sandbox.html +1 -0
  230. package/bundle/sdk/sdk-client.js +1 -0
  231. package/bundle/sdk/sdk-interface.js +1 -0
  232. package/bundle/sdk.d.ts +5312 -0
  233. package/bundle/showcase.html +114 -0
  234. package/bundle/terms/terms-de-DE.html +69 -0
  235. package/bundle/terms/terms-en-GB.html +62 -0
  236. package/bundle/terms/terms-en-US.html +62 -0
  237. package/bundle/terms/terms-es-MX.html +66 -0
  238. package/bundle/terms/terms-fr-FR.html +65 -0
  239. package/bundle/terms/terms-it-IT.html +65 -0
  240. package/bundle/terms/terms-ja-JP.html +64 -0
  241. package/bundle/terms/terms-ko-KR.html +65 -0
  242. package/bundle/terms/terms-nl-NL.html +65 -0
  243. package/bundle/terms/terms-pt-BR.html +75 -0
  244. package/bundle/terms/terms-ru-RU.html +72 -0
  245. package/bundle/terms/terms-zh-CN.html +65 -0
  246. package/bundle/terms/terms-zh-TW.html +84 -0
  247. package/bundle/vendors/three/0.146.0/libs/basis/README.md +32 -0
  248. package/bundle/vendors/three/0.146.0/libs/basis/basis_transcoder.js +1 -0
  249. package/bundle/vendors/three/0.146.0/libs/basis/basis_transcoder.wasm +0 -0
  250. package/bundle/vendors/three/0.146.0/libs/basis/no-dynamic-execution.patch +11 -0
  251. package/bundle/vendors/three/0.146.0/libs/draco/README.md +32 -0
  252. package/bundle/vendors/three/0.146.0/libs/draco/draco_decoder.js +1 -0
  253. package/bundle/vendors/three/0.146.0/libs/draco/draco_decoder.wasm +0 -0
  254. package/bundle/vendors/three/0.146.0/libs/draco/draco_encoder.js +1 -0
  255. package/bundle/vendors/three/0.146.0/libs/draco/draco_wasm_wrapper.js +1 -0
  256. package/bundle/vendors/three/0.146.0/libs/draco/gltf/draco_decoder.js +1 -0
  257. package/bundle/vendors/three/0.146.0/libs/draco/gltf/draco_decoder.wasm +0 -0
  258. package/bundle/vendors/three/0.146.0/libs/draco/gltf/draco_encoder.js +1 -0
  259. package/bundle/vendors/three/0.146.0/libs/draco/gltf/draco_wasm_wrapper.js +1 -0
  260. package/bundle/vendors/three/0.146.0/three.cjs +2 -0
  261. package/bundle/vendors/three/0.146.0/three.cjs.LICENSE.txt +5 -0
  262. package/bundle/vendors/three/0.146.0/three.js +2 -0
  263. package/bundle/vendors/three/0.146.0/three.js.LICENSE.txt +5 -0
  264. package/bundle/vendors/three/0.146.0/three.min.js +2 -0
  265. package/bundle/vendors/three/0.146.0/three.min.js.LICENSE.txt +5 -0
  266. package/bundle/vendors/three/0.146.0/three.module.js +2 -0
  267. package/bundle/vendors/three/0.146.0/three.module.js.LICENSE.txt +5 -0
  268. package/bundle/version.txt +1 -0
  269. package/lib/architwin.d.ts +24 -0
  270. package/lib/architwin.min.js +1 -0
  271. package/lib/types.d.ts +123 -0
  272. package/lib/types.js +2 -0
  273. package/package.json +26 -0
  274. package/tsconfig.json +11 -0
@@ -0,0 +1,18 @@
1
+ /*! For license information please see 136.js.LICENSE.txt */
2
+ (self.webpackChunkmp_webgl=self.webpackChunkmp_webgl||[]).push([[136],{42606:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>b});var n=i(97542),s=i(69170),a=i(74903),o=i(9037),r=i(53954),d=i(65636),l=i(93642),h=i(49219),c=i(92001),m=i(14439),u=i(96042),p=i(34029),g=i(32597),v=i(43736),y=i(71776),w=i(45786),f=i(53203);class b extends n.Y{constructor(){super(...arguments),this.name="quick-menus"}async init(e,t){this.settingsModule=await t.getModuleBySymbol(s.y.SETTINGS),this.scanInfoDataModule=await t.getModuleBySymbol(s.y.SCAN_INFO),this.settingsGui=this.settingsModule.getSettingsGui();const i=await t.getModuleBySymbol(s.y.DEEP_LINKS),n=await t.market.waitForData(r.Z),b=await t.market.waitForData(p.e),T=await t.market.waitForData(o.M);this.uIndex=this.settingsGui.addPanel("Link to location",[g.R.U],{allowSubGroups:!1,width:400,ratio:90});const D=[38,38,40,40,37,39,37,39,66,65,g.R.O];this.oIndex=this.settingsGui.addPanel("Scan Info",D,{allowSubGroups:!1,width:400,ratio:75}),this.pIndex=this.settingsGui.addPanel("Quick settings",[g.R.P],{allowSubGroups:!1}),this.settingsGui.loadPromise.then((()=>{this.settingsGui.addControl(this.uIndex,"","Link",{}),this.settingsGui.addButton(this.uIndex,"","Copy to clipboard",(()=>{const e=document.createElement("input");e.type="text",e.value=this.buildLink(i),document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)})),this.settingsGui.toggle(this.uIndex),this.settingsGui.addControl(this.oIndex,"","Scan ID",{}),this.settingsGui.addControl(this.oIndex,"","Anchor ID",{}),this.settingsGui.addControl(this.oIndex,"","Created",{}),this.settingsGui.addControl(this.oIndex,"","Time of Day",{}),this.settingsGui.addControl(this.oIndex,"","Alignment",{}),this.settingsGui.addControl(this.oIndex,"","Options",{}),this.settingsGui.addControl(this.oIndex,"","Camera",{}),this.settingsGui.addControl(this.oIndex,"","Camera Types",{}),this.settingsGui.addControl(this.oIndex,"","Sensor Serials",{}),this.settingsGui.addControl(this.oIndex,"","Serial Number",{}),this.settingsGui.addControl(this.oIndex,"","Mount Calibration",{}),this.settingsGui.addControl(this.oIndex,"","Software Version",{}),this.settingsGui.addButton(this.oIndex,"","Copy Scan ID",(async()=>{if(n.currentSweep){const e=await this.scanInfoDataModule.getScanInfo(n.currentSweep);if(e){const t=document.createElement("input");t.type="text",t.value=e.id,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}})),this.settingsGui.addButton(this.oIndex,"","Download Scan",(async()=>{if(n.currentSweep){const e=await this.scanInfoDataModule.getScanDownloadURL(n.currentSweep);e&&window.open(e)}})),this.settingsGui.toggle(this.oIndex);const e=l.WI*(180/Math.PI)*60;this.settingsGui.addControl(this.pIndex,"",c.U,!0),this.settingsGui.addControl(this.pIndex,"",v.s,!0),this.settingsGui.addControl(this.pIndex,"",y.re,!0),this.settingsGui.addControl(this.pIndex,"",w.b,!0),this.settingsGui.addSlider(this.pIndex,"",f.NR,f.Kb,0,100,1),this.settingsGui.addSlider(this.pIndex,"",h.lookAccelerationKey,e,.25,10,2),this.settingsGui.addSlider(this.pIndex,"",a.baseTransitionSpeedKey,d.ZP.camera.baseTransitionTime,1,5e3,0);const t=b.tryGetProperty(m.EU,m.Im);this.settingsGui.addSlider(this.pIndex,"",m.WQ,(0,u.JG)(t),.5,10,2),this.settingsGui.toggle(this.pIndex),this.settingsModule.registerSetting("Quick settings",h.lookAccelerationKey,e,!1),this.settingsModule.registerSetting("Quick settings",a.baseTransitionSpeedKey,d.ZP.camera.baseTransitionTime,!1),this.settingsModule.registerSetting("Quick settings",f.NR,f.Kb,!1),this.settingsGui.onToggle(this.uIndex,(e=>{e&&this.settingsGui.updateSetting(this.uIndex,"Link",this.buildLink(i))})),this.settingsGui.onToggle(this.oIndex,(e=>{e&&this.refreshScanInfo(n)})),T.pose.onChanged((()=>{this.settingsGui.isLoaded&&this.settingsGui.isVisible(this.uIndex)&&this.settingsGui.updateSetting(this.uIndex,"Link",this.buildLink(i)),this.settingsGui.isLoaded&&this.settingsGui.isVisible(this.oIndex)&&this.refreshScanInfo(n)})),b.onPropertyChanged(m.WQ,(e=>{b.setProperty(m.EU,(0,u.HG)(e))}))}))}refreshScanInfo(e){e.currentSweep?this.scanInfoDataModule.getScanInfo(e.currentSweep).then((e=>{this.updateScanInfo(e)})):this.updateScanInfo(void 0)}updateScanInfo(e){this.settingsGui.updateSetting(this.oIndex,"Scan ID",e?e.id:""),this.settingsGui.updateSetting(this.oIndex,"Anchor ID",e?e.anchorId:""),this.settingsGui.updateSetting(this.oIndex,"Created",e?e.created:""),this.settingsGui.updateSetting(this.oIndex,"Time of Day",e?e.timeOfDay:""),this.settingsGui.updateSetting(this.oIndex,"Alignment",e?e.alignment:""),this.settingsGui.updateSetting(this.oIndex,"Options",e?JSON.stringify(e.options):""),this.settingsGui.updateSetting(this.oIndex,"Camera",e?`${e.camera.vendor} ${e.camera.model}`:""),this.settingsGui.updateSetting(this.oIndex,"Camera Types",e?JSON.stringify(e.camera.cameraTypes):""),this.settingsGui.updateSetting(this.oIndex,"Sensor Serials",e?JSON.stringify(e.camera.sensorSerialNumbers):""),this.settingsGui.updateSetting(this.oIndex,"Serial Number",e?e.camera.serialNumber:""),this.settingsGui.updateSetting(this.oIndex,"Mount Calibration",e?e.camera.mountCalibrationVersion:""),this.settingsGui.updateSetting(this.oIndex,"Software Version",e?e.camera.softwareVersion:"")}buildLink(e){return decodeURIComponent(e.creator.createDeepLink().href)}}},95724:(e,t,i)=>{"use strict";i.d(t,{o:()=>n});class n{constructor(e){this.config=e}serialize(e){const{serializer:t}=this.config;if(!e||!Array.isArray(e)||!t)return null;const i=[];for(const n of e){const e=t.serialize(n);e&&i.push(e)}return i}deserialize(e){const{deserializer:t}=this.config;if(!e||!Array.isArray(e)||!t)return null;const i=[];for(const n of e){const e=t.deserialize(n);e&&i.push(e)}return i}}},2290:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AnnotationAttachmentClickedMessage:()=>c.q,AnnotationBlockClickedMessage:()=>c.i,AnnotationType:()=>m.J,AnnotationsViewData:()=>r.A,CloseAnnotationCommand:()=>d.Aj,CloseBillboardCommand:()=>d.G5,CloseDockedAnnotationCommand:()=>d.JD,CloseOtherAnnotationsCommand:()=>d.yL,DockAnnotationCommand:()=>d.bd,PreviewAnnotationCommand:()=>d.Kw,SelectAnnotationCommand:()=>d.oM,default:()=>u});var n=i(97542),s=i(40964),a=i(54244),o=i(80742),r=i(16935),d=i(43470),l=i(96154);class h extends n.Y{constructor(){super(...arguments),this.name="annotations",this.handleDockAnnotation=async e=>{const t=this.viewData,{dockedAnnotation:i}=t,{id:n,annotationType:s,force:a}=e;(this.viewData.getCapabilities(n).dock||a)&&((null==i?void 0:i.id)!==n||(null==i?void 0:i.annotationType)!==s?t.atomic((()=>{t.setDockedAnnotation(n,s),t.setBillboardAnnotation(null)})):this.log.debug("Annotation is already docked"))},this.handleSelectAnnotation=async e=>{const t=this.viewData,{billboardAnnotation:i,billboardSelected:n}=t,{id:s,annotationType:a,force:o}=e;(this.viewData.getCapabilities(s).select||o)&&(n&&(null==i?void 0:i.id)===s&&(null==i?void 0:i.annotationType)===a?this.log.debug("Annotation is already selected"):t.atomic((()=>{t.setBillboardAnnotation(s,a,!0),t.setDockedAnnotation(null)})))},this.handlePreviewAnnotation=async e=>{this.viewData.getCapabilities(e.id).preview&&this.viewData.setBillboardAnnotation(e.id,e.annotationType,!1)},this.handleCloseBillboard=async()=>{this.viewData.setBillboardAnnotation(null)},this.handleCloseDockedAnnotation=async()=>{this.viewData.setDockedAnnotation(null)},this.handleClosingOtherAnnotations=async e=>{const{exceptType:t,exceptId:i}=e;this.closeOtherAnnotations(t,i)},this.closeOtherAnnotations=(e,t)=>{const i=this.viewData,{billboardAnnotation:n,dockedAnnotation:s}=i,a=n&&!this.isMatchingAnnotation(n,e,t),o=s&&!this.isMatchingAnnotation(s,e,t);i.atomic((()=>{n&&a&&i.setBillboardAnnotation(null),s&&o&&i.setDockedAnnotation(null)}))},this.handleCloseAnnotation=async e=>{const t=this.viewData,{billboardAnnotation:i,dockedAnnotation:n}=t,{id:s,annotationType:a}=e;t.atomic((()=>{s===(null==i?void 0:i.id)&&a===(null==i?void 0:i.annotationType)&&t.setBillboardAnnotation(null),s===(null==n?void 0:n.id)&&a===(null==n?void 0:n.annotationType)&&t.setDockedAnnotation(null)}))},this.handleDockedAnnotationChanged=()=>{this.viewData.dockedAnnotation?this.engine.broadcast(new s.ro):this.engine.broadcast(new s.A)}}async init(e,t){this.viewData=new r.A,this.engine=t,[this.applicationData,this.layersData]=await Promise.all([t.market.waitForData(a.pu),t.market.waitForData(o.R)]),this.bindings.push(t.commandBinder.addBinding(d.bd,this.handleDockAnnotation),t.commandBinder.addBinding(d.oM,this.handleSelectAnnotation),t.commandBinder.addBinding(d.Kw,this.handlePreviewAnnotation),t.commandBinder.addBinding(d.Aj,this.handleCloseAnnotation),t.commandBinder.addBinding(d.G5,this.handleCloseBillboard),t.commandBinder.addBinding(d.JD,this.handleCloseDockedAnnotation),t.commandBinder.addBinding(d.yL,this.handleClosingOtherAnnotations),t.subscribe(l.oR,this.handleCloseBillboard),this.applicationData.onPropertyChanged("application",this.closeOtherAnnotations),this.layersData.onPropertyChanged("currentViewId",this.handleCloseBillboard),this.viewData.onDockedAnnotationChanged(this.handleDockedAnnotationChanged)),t.market.register(this,r.A,this.viewData)}dispose(e){this.bindings.forEach((e=>{e.cancel()})),this.bindings=[],super.dispose(e)}onUpdate(){}isMatchingAnnotation(e,t,i){return!(!i&&!t)&&((!i||i===e.id)&&(!t||t===e.annotationType))}}var c=i(5604),m=i(86283);const u=h},49671:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Attachment:()=>o.P,AttachmentCategory:()=>r.G$,AttachmentEmbedStatus:()=>r._V,AttachmentUploadDoneMessage:()=>d.RE,AttachmentUploadError:()=>r.kV,AttachmentUploadProgressMessage:()=>d.Vj,AttachmentViewerCommand:()=>x.xW,AttachmentsData:()=>M.b,AttachmentsStore:()=>f,CancelAttachmentChangesCommand:()=>x.Ze,CancelAttachmentUploadCommand:()=>x.sE,CloseAttachmentViewerMessage:()=>d.Rd,ConfirmAttachmentChangesCommand:()=>x.iu,EmbedMediaCommand:()=>x.wu,EmbeddingDoneMessage:()=>d.v8,ExternalAttachmentDeserializer:()=>p.d,ExternalAttachmentSerializer:()=>u,FileAttachmentDeserializer:()=>g.O,FileAttachmentStorage:()=>O,FileUploadDeserializer:()=>S,FileUploadSerializer:()=>k,LoadEmbeddedMediaCommand:()=>x.st,MediaType:()=>r.DD,RemoveAttachmentCommand:()=>x.$T,RemoveFailureCommand:()=>x.Rh,ResetAttachmentChangesCommand:()=>x.x9,UploadAttachmentsCommand:()=>x.It,ViewAttachmentsMessage:()=>d.O,default:()=>j});var n=i(97542),s=i(92558),a=i(5823),o=i(71608),r=i(32347),d=i(13794),l=i(17788),h=i(73123),c=i(97998),m=i(21149);class u{constructor(){this.getAttachmentDetails=e=>e.mediaType?{mediaType:(0,m.m)(e.mediaType),srcUrl:e.src,thumbnailUrl:e.src,width:e.width,height:e.height}:null,this.validate=e=>!!e&&void 0!==e.mediaType}serialize(e){const t=this.getAttachmentDetails(e);return t&&this.validate(t)?t:null}}var p=i(63665),g=i(65222),v=i(36159),y=i(63437);const w=new c.Z("AttachmentsStore");class f extends l.u{constructor(e){super(e),this.embedSerializer=new u,this.embedDeserializer=new p.d,this.fileDeserializer=new g.O}create(e){if(0===e.length)return Promise.resolve(null);const t=e[0].parentId,i=e[0].parentType;if(e.find((e=>e.parentId!==t||e.parentType!==i)))throw new Error("Cannot attach to different parents in one request");const n=this.getViewId(),s=[],o=[];let d,l;if(e.forEach((e=>{if(e.category===r.G$.EXTERNAL){const t=this.embedSerializer.serialize(e);if(!t)throw w.error("Failure attaching external attachment:",e),new Error("Could not attach External Attachment");s.push(t)}else e.category===r.G$.UPLOAD&&o.push(e.id)})),i!==a.ud.COMMENT)throw new Error(`Cannot attach to attachment to a ${i}`);return d=v.AddCommentAttachments,l="addCommentAttachments",this.mutate(d,{modelId:n,parentId:t,externalAttachments:s,fileAttachments:o}).then((e=>{const t=[],i=(0,h.q)(e,`data.${l}.externalAttachments`);if(i&&Array.isArray(i))for(const e of i){const i=this.embedDeserializer.deserialize(e);i&&t.push(i)}const n=(0,h.q)(e,`data.${l}.fileAttachments`);if(n&&Array.isArray(n))for(const e of n){const i=this.fileDeserializer.deserialize(e);i&&t.push(i)}return t.reduce(((e,t)=>(e[t.id]=t,e)),{})}))}async remove(e){const{id:t,parentId:i,parentType:n}=e,s=this.getViewId(),a=await this.mutate(y.RemoveFileAttachment,{modelId:s,attachmentId:t,parentType:n,parentId:i}),o=(0,h.q)(a,"data.removeFileAttachment")||!1;return o||w.error("remove file attachment failed!"),o}async delete(e,t,i){const n=this.getViewId();return Promise.all(e.map((e=>this.mutate(y.DeleteExternalAttachment,{modelId:n,attachmentId:e,parentType:i,parentId:t}))))}getViewId(){if(!this.viewId)throw new Error("Invalid valid id!");return this.viewId}}var b=i(66746),T=i(27553),D=i(95548),C=i(63422);var P=i(44602),A=i(9133),I=i(56367);const E=new c.Z("file-upload-deserializer");class S{deserialize(e){if(!e||!this.validate(e))return E.debug("Deserialized invalid file attachment data from MDS",e),null;const t=new o.P;return t.id=e.id,t.created=(0,A.p)(e.created),e.mimeType&&(t.mimeType=e.mimeType,t.mediaType=(0,m.id)(e.mimeType)),t.thumbnailUrl=new I.n(e.url||"",(0,A.p)(e.validUntil,null)),t.url=new I.n(e.url||"",(0,A.p)(e.validUntil,null)),t.filename=e.filename||"",t.bytes=e.bytes||0,t.category=r.G$.UPLOAD,t.width=e.imageWidth||0,t.height=e.imageHeight||0,t}validate(e){return["id","created","url","filename","mimeType","validUntil"].every((t=>t in e))}}class k{constructor(){}serialize(e){return{filename:e.file.name,contents:{filename:e.file.name,blob:e.file}}}}const N=new c.Z("FileAttachmentStorage");class O extends class{constructor(e){const{baseUrl:t}=e;this.config=e,this.context=e.context,this.client=new T.w({baseUrl:t,server:C.wO})}async create(...e){throw new b.n}async read(e={}){throw new b.n}async update(...e){throw new b.n}async delete(...e){throw new b.n}async query(e,t,i={}){if(!this.context.baseViewId)throw new D.SN("Cannot read Attachments, no model view configured");return this.client.query(e,t,i)}async mutate(e,t,i){const{readonly:n}=this.config;if(n)throw new D.pp("Cannot write Attachments, model is in read-only mode");if(!this.context.baseViewId)throw new D.SN("Cannot write Attachments, no model view configured");return this.client.mutate(e,t,i)}}{constructor(e){super(e),this.uploadDeserializer=new S,this.uploadSerializer=new k}async create(e,t){const i=this.context.baseViewId,n=this.uploadSerializer.serialize(e);let s;try{s=await this.client.upload(P.UploadFileAttachmentToModel,"UploadFileAttachmentToModel",Object.assign(Object.assign({},n),{modelId:i,organizationId:this.config.organizationId}),t,e.xhr)}catch(t){return N.error(t),t.code.includes("quota.exceeded")?e.error=r.kV.OVER_QUOTA:e.error=r.kV.UPLOAD_FAILED,e.progress=100,e}if(s.errors&&s.errors.length>0)N.error(s.errors),e.error=r.kV.UPLOAD_FAILED;else{const t=(0,h.q)(s,"data.uploadFileAttachmentToModel")||null;if(t){const i=this.uploadDeserializer.deserialize(t);i?(N.info("upload successful!"),e.attachment=i):(N.error("cannot create attachment"),e.error=r.kV.UPLOAD_FAILED)}else N.error("upload failed!"),e.error=r.kV.UPLOAD_FAILED}return e.progress=100,e}async delete(e){const t=await this.client.mutate(P.DeleteFileAttachment,{id:e}),i=(0,h.q)(t,"data.deleteFileAttachment")||!1;return i?N.info("upload deleted!"):N.error("upload deletion failed!"),i}}var M=i(97163),x=i(35446),R=i(36892),V=i(56382);function B(e){switch(e){case V.ht.PHOTO:return r.DD.IMAGE;case V.ht.VIDEO:return r.DD.VIDEO;case V.ht.RICH:return r.DD.RICH;default:return}}function L(e){const{height:t,width:i,thumbnail_height:n,thumbnail_width:s,cache_age:a}=e,o=(void 0===t||void 0===i)&&(s&&n),r=e.type===V.ht.PHOTO?e.url:void 0,d=e.thumbnail_url||r,l=a?new Date(Date.now()+1e3*a):null;return{width:o?s:i,height:o?n:t,mediaType:B(e.type),url:new I.n(r||"",l),thumbnailUrl:new I.n(d||"",l)}}var F=i(80742);class H extends n.Y{constructor(){super(...arguments),this.name="attachments-module",this.loadEmbeddedAttachment=async e=>this.getUpdatedEmbed(e.attachment),this.embedMedia=async e=>{let t,i=null;const n=await this.oEmbedConsumer.getOEmbedData(e.src);return n?(i=new o.P,i.id=(0,s.fV)(),i.parentType=e.parentType,i.parentId=e.parentId,i.src=e.src,i.category=r.G$.EXTERNAL,Object.assign(i,L(n)),this.attachmentsData.addPending(i),t=r._V.EMBED_SUCCESS):t=r._V.EMBED_FAIL,this.engine.broadcast(new d.v8(i,t,e.parentId,e.parentType)),i},this.uploadAttachments=async e=>{const{parentType:t,parentId:i,files:n}=e,s=this.attachmentsData;n.forEach((e=>{this.uploadAttachment(e,i,t).then((e=>{s.atomic((()=>{e.error?(s.removeUpload(e.id),s.addFailure(e)):e.attachment&&(e.attachment.parentId=i,e.attachment.parentType=t,s.removeUpload(e.id),s.addPending(e.attachment))})),this.engine.broadcast(new d.RE(e))}))}))},this.onProgress=(e,t)=>{if(!e.lengthComputable)return;const i=e.total>0?Math.floor(e.loaded/e.total*100):100,n=Object.assign(Object.assign({},t),{progress:i});this.attachmentsData.updateUpload(n),this.engine.broadcast(new d.Vj(n))},this.removeFailure=async e=>{this.attachmentsData.removeFailure(e.id)},this.removeAttachment=async e=>{if(!this.fileAttachmentStorage)return void this.log.error("No file attachment store");const{attachment:t}=e,i=this.attachmentsData,n=i.getPendingAttachment(t.id);n?(n.category===r.G$.UPLOAD&&await this.fileAttachmentStorage.delete(t.id),i.removePendingAttachment(t.id)):i.markAttachmentForDelete(t)},this.confirmAttachmentChanges=async e=>{const t=this.attachmentsData,{pendings:i,removals:n}=t,{parentId:s,parentType:o,prevParentId:d}=e,l=i.length>0||n.length>0;if(i.length>0){const e=d||s;t.iteratePending((t=>{d&&t.parentId===e&&t.parentType===o&&(t.parentId=s)}));const n=o!==a.ud.MATTERTAG?i.values:i.values.filter((e=>e.category===r.G$.UPLOAD));await this.attachmentsStore.create(n)}if(n.length>0){const e=o!==a.ud.MATTERTAG?n.values:n.values.filter((e=>e.category===r.G$.UPLOAD));e.length>0&&await this.deleteAttachments(e,s,o)}return this.resetAttachmentData(),l},this.cancelAttachmentUpload=async e=>{const{uploads:t}=this.attachmentsData,i=null==t?void 0:t.get(e.uploadId);(null==i?void 0:i.xhr)&&(i.xhr.abort(),this.attachmentsData.removeUpload(e.uploadId))},this.cancelAttachmentChanges=async()=>{const e=this.attachmentsData,{pendings:t,uploads:i,removals:n}=e;0===t.length&&0===n.length&&0===i.length||(this.fileAttachmentStorage?(t.values.forEach((e=>{e.category===r.G$.UPLOAD&&this.fileAttachmentStorage.delete(e.id)})),i.length&&i.values.map((e=>this.cancelAttachmentUpload({uploadId:e.id}))),this.resetAttachmentData()):this.log.error("No file attachment store"))},this.deleteAttachments=async(e,t,i)=>{if(!this.fileAttachmentStorage)return void this.log.error("No file attachment store");if(0===e.length)return;const n=[],s=[];this.attachmentsData.atomic((()=>{e.forEach((e=>{e.category===r.G$.UPLOAD?n.push(e):e.category===r.G$.EXTERNAL&&s.push(e.id)}))})),n.length>0&&await Promise.all(n.map((e=>this.attachmentsStore.remove(e)))),s.length>0&&await this.attachmentsStore.delete(s,t,i)},this.handleAttachmentViewerCommand=async e=>{const{open:t,attachments:i,attachmentId:n}=e;t&&i?this.openAttachmentViewer(i,n):this.closeAttachmentViewer()}}async init(e,t){this.engine=t;const i=await t.market.waitForData(F.R),{organizationId:n,oEmbedConsumer:s}=e;this.attachmentsStore=new f({context:i.mdsContext,readonly:!1});const a=()=>{this.attachmentsStore.setStoreViewId(i.getNonworkshopViewId())};a(),this.bindings.push(i.onPropertyChanged("currentViewId",a)),n&&(this.fileAttachmentStorage=new O({context:i.mdsContext,readonly:!1,organizationId:n})),this.oEmbedConsumer=await s,this.attachmentsData=new M.b,this.bindings.push(t.commandBinder.addBinding(x.It,this.uploadAttachments),t.commandBinder.addBinding(x.wu,this.embedMedia),t.commandBinder.addBinding(x.st,this.loadEmbeddedAttachment),t.commandBinder.addBinding(x.iu,this.confirmAttachmentChanges),t.commandBinder.addBinding(x.sE,this.cancelAttachmentUpload),t.commandBinder.addBinding(x.Ze,this.cancelAttachmentChanges),t.commandBinder.addBinding(x.x9,(async()=>this.resetAttachmentData())),t.commandBinder.addBinding(x.$T,this.removeAttachment),t.commandBinder.addBinding(x.Rh,this.removeFailure),t.commandBinder.addBinding(x.xW,this.handleAttachmentViewerCommand)),t.market.register(this,M.b,this.attachmentsData)}async getUpdatedEmbed(e){if(e.category===r.G$.EXTERNAL){const t=await this.oEmbedConsumer.getOEmbedData(e.src);return Object.assign(e,L(t)),t}return null}async uploadAttachment(e,t,i){const n={file:e,id:(0,s.fV)(),progress:0,error:null,attachment:null,parentId:t,parentType:i,xhr:new XMLHttpRequest};if(!this.fileAttachmentStorage)return this.log.error("No file attachment store"),n.error=r.kV.PERMISSION_DENIED,Promise.resolve(n);const a=e.size;return 0===a?(n.error=r.kV.EMPTY_FILE,Promise.resolve(n)):a>R.z6?(n.error=r.kV.FILE_TOO_LARGE,Promise.resolve(n)):(this.attachmentsData.addUpload(n),this.fileAttachmentStorage.create(n,(e=>this.onProgress(e,n))))}resetAttachmentData(){const e=this.attachmentsData;e.atomic((()=>{e.clearPending(),e.clearRemovals(),e.clearUploads(),e.clearFailures()}))}openAttachmentViewer(e,t){this.viewerOpen=!0,this.engine.broadcast(new d.O(e,t))}closeAttachmentViewer(){this.viewerOpen&&(this.viewerOpen=!1,this.engine.broadcast(new d.Rd))}}const j=H},63665:(e,t,i)=>{"use strict";i.d(t,{d:()=>h});var n=i(97998),s=i(56367),a=i(9133),o=i(21149),r=i(71608),d=i(32347);const l=new n.Z("external-attachment-deserializer");class h{constructor(){}deserialize(e){if(!e||!this.validate(e))return l.debug("Deserialized invalid external attachment data from MDS",e),null;const t=new r.P;return t.id=e.id,t.created=(0,a.p)(e.created),t.src=e.url||"",t.thumbnailUrl=new s.n(e.thumbnailUrl||"",(0,a.p)(e.validUntil,null)),t.url=new s.n(e.url||"",(0,a.p)(e.validUntil,null)),e.mediaType&&(t.mediaType=(0,o.bY)(e.mediaType)),t.category=d.G$.EXTERNAL,e.width&&(t.width=e.width),e.height&&(t.height=e.height),t.parentType=e.parentDetails.type,t.parentId=e.parentDetails.parent.id,t}validate(e){if(!e)return!1;const t=["id","created","modified","mediaType","parentDetails"].filter((t=>!(t in e))),i=0===t.length;return i||l.debug("Attachment invalid:",{missingFields:t}),i}}},65222:(e,t,i)=>{"use strict";i.d(t,{O:()=>h});var n=i(97998),s=i(9133),a=i(21149),o=i(71608),r=i(32347),d=i(56367);const l=new n.Z("file-attachment-deserializer");class h{constructor(){}deserialize(e){if(!e||!this.validate(e))return l.debug("Deserialized invalid file attachment data from MDS",e),null;const t=new o.P;return t.id=e.id,t.created=(0,s.p)(e.created),e.mimeType&&(t.mimeType=e.mimeType,t.mediaType=(0,a.id)(e.mimeType)),t.category=r.G$.UPLOAD,t.thumbnailUrl=new d.n(e.url||"",(0,s.p)(e.validUntil,null)),t.url=new d.n(e.url||"",(0,s.p)(e.validUntil,null)),t.filename=e.filename||"",t.bytes=e.bytes||0,t.width=e.imageWidth||0,t.height=e.imageHeight||0,t}validate(e){if(!e)return!1;return["id","created","url","mimeType","filename"].every((t=>t in e))}}},26702:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>y});var n=i(97542),s=i(69170),a=i(81396),o=i(12529),r=i(77597);const d=new a.Vector3(0,1,0),l=16724312,h=[{innerRadius:0,outerRadius:.42,color:l,opacity:.7},{innerRadius:.67,outerRadius:1,color:l,opacity:.7}];class c{constructor(e,t,i){this.scene=e,this.sweepData=t,this.mesh=new r.f({radius:.25,normal:d,rings:h}),this.mesh.name="CurrentPanoMarker",this.mesh.renderOrder=o.z.panoMarker,this.mesh.layers.mask=i.mask}init(){}dispose(){this.mesh.dispose()}render(){const e=this.sweepData.currentAlignedSweepObject;e&&this.move(e.floorPosition)}activate(){this.scene.add(this.mesh)}deactivate(){this.scene.remove(this.mesh)}move(e){this.mesh.position.copy(e).setY(e.y+c.floorOffset)}}c.floorOffset=.01;var m=i(23254),u=i(53954),p=i(19663);class g extends p.m{constructor(e){super(),this.id="TOGGLE_PANO_MARKER",this.payload={enabled:e}}}var v=i(95882);class y extends n.Y{constructor(){super(...arguments),this.name="current-pano-marker",this.state={markerEnabled:!1,transitionPromise:null}}async init(e,t){const i=(await t.getModuleBySymbol(s.y.WEBGL_RENDERER)).getScene(),n=t.claimRenderLayer(this.name),[a,o]=await Promise.all([t.market.waitForData(u.Z),t.market.waitForData(m.O)]);this.engine=t,this.sweepData=a,this.viewmodeData=o,this.markerRenderer=new c(i,a,n),this.bindings.push(t.commandBinder.addBinding(g,(async({enabled:e})=>this.setCommandOverride(e))),this.viewmodeData.makeModeChangeSubscription((()=>this.updateMarker())),this.sweepData.makeSweepChangeSubscription((()=>this.updateMarker()))),this.updateMarker()}setCommandOverride(e){this.state.commandOverride=e,this.updateMarker()}async updateMarker(){const{commandOverride:e}=this.state,t=this.viewmodeData.currentMode,i=this.sweepData.currentAlignedSweepObject,n=!1===e||(0,v.Bw)(t)||t===v.Ey.Transition;return this.toggleMarker(!!i&&!n)}async toggleMarker(e){const{markerEnabled:t,transitionPromise:i}=this.state;if(i&&await i,t===e)return;const n=e?this.enableMarker():this.disableMarker();return this.state.transitionPromise=n.finally((()=>{this.state.markerEnabled=e,this.state.transitionPromise=null})),this.state.transitionPromise}async enableMarker(){return this.engine.addComponent(this,this.markerRenderer)}async disableMarker(){return this.engine.removeComponent(this,this.markerRenderer)}}},95512:(e,t,i)=>{"use strict";i.d(t,{y:()=>s});var n=i(19663);class s extends n.m{constructor(e){super(),this.payload={disable:e}}}},79565:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>u});var n=i(97542),s=i(69170),a=i(95882),o=i(23254),r=i(2473),d=i(5135),l=i(53954),h=i(95512),c=i(34029),m=i(45786);class u extends n.Y{constructor(){super(...arguments),this.name="cursor-controller",this.visibilityRules=[],this.disabled=!1}async init(e,t){this.bindings.push(t.commandBinder.addBinding(h.y,(async e=>{this.disabled=e.disable}))),[this.cursorMesh,this.cursorModule]=await Promise.all([t.getModuleBySymbol(s.y.CURSOR_MESH),t.getModuleBySymbol(s.y.CURSORS)]),this.visibilityRules.push((()=>{const e=t.market.tryGetData(o.O);return!!e&&(0,a.Bw)(e.closestMode)}),(()=>{const e=t.market.tryGetData(l.Z);return!!e&&!e.isSweepUnaligned(e.currentSweep)}),(()=>{const e=t.market.tryGetData(r.k);return!!e&&!e.isTourActive()}),(()=>{const e=t.market.tryGetData(d.Z);return!!e&&!e.isMobile()}),(()=>{const e=t.market.tryGetData(c.e);return!!e&&e.tryGetProperty(m.b,!0)}))}onUpdate(){this.updateCursorVisibility()}addVisibilityRule(e){this.visibilityRules.push(e)}removeVisibilityRule(e){const t=this.visibilityRules.indexOf(e);-1!==t&&this.visibilityRules.splice(t,1)}setFadeProps(e){this.cursorModule.setFadeProps(e)}updateCursorVisibility(){const e=!this.disabled&&this.visibilityRules.reduce(((e,t)=>e&&t()),!0);this.cursorMesh.setVisible(e)}setTexture(e){this.cursorModule.setTexture(e)}}},45786:(e,t,i)=>{"use strict";i.d(t,{b:()=>n});const n="features/cursor"},30747:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>h});var n=i(69170),s=i(97542),a=i(81396),o=i(93411),r=i(13310),d=i(67678),l=i(85992);class h extends s.Y{constructor(){super(...arguments),this.name="cursor-data",this.fadeOutDelay=700,this.fadeOutDuration=700,this.fadeInDuration=300,this.movementThreshold=.003,this.cursorState=new r.Y,this.position=new a.Vector2,this.timeToFade=0}async init(e,t){this.input=await t.getModuleBySymbol(n.y.INPUT),this.raycasterData=await t.market.waitForData(l.P),t.market.register(this,r.Y,this.cursorState),this.bindings.push(this.input.registerHandler(d.mE,this.onPointerMove.bind(this))),this.fadeInDuration>this.fadeOutDelay&&this.log.warn("fadeInDuration should be less than fadeOutDelay!")}onUpdate(e){let t=!1;this.timeToFade>0&&(this.timeToFade-=e,this.timeToFade<=0&&(t=!0)),this.cursorState.opacity.tick(e),this.cursorState.commit(),t&&this.cursorState.opacity.modifyAnimation(1,0,this.fadeOutDuration)}setFadeProps(e){const{fadeOut:t,fadeIn:i}=e;this.fadeOutDuration=t&&t.duration?t.duration:this.fadeOutDuration,this.fadeOutDelay=t&&t.delay?t.delay:this.fadeOutDelay,this.fadeInDuration=i&&i.duration?i.duration:this.fadeInDuration}setTexture(e){this.cursorState.texture=e}onPointerMove(){if(null!==this.raycasterData.hit&&this.raycasterData.pointerNdcPosition.distanceToSquared(this.position)>this.movementThreshold){this.position.copy(this.raycasterData.pointerNdcPosition),this.timeToFade=this.fadeOutDelay;const e=(0,o.t)(0,this.fadeInDuration,1-this.cursorState.opacity.value);this.cursorState.opacity.modifyAnimation(this.cursorState.opacity.value,1,e),this.cursorState.commit()}}dispose(e){super.dispose(e)}}},13310:(e,t,i)=>{"use strict";i.d(t,{Y:()=>a});var n=i(89557),s=i(67992);class a extends s.V{constructor(){super(),this.name="cursor",this.opacity=new n.z(0),this.texture=null}}},85042:(e,t,i)=>{"use strict";var n;i.d(t,{L:()=>n}),function(e){e[e.Reticle=0]="Reticle",e[e.GridPlane=1]="GridPlane"}(n||(n={}))},90763:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>p});var n=i(97542),s=i(69170),a=i(81396),o=i(13310),r=i(85992),d=i(17878),l=i(85042),h=i(12529),c=i(77597);const m=[{outerRadius:.977,innerRadius:.926,color:16777215,opacity:1},{outerRadius:.898,innerRadius:.648,color:16777215,opacity:.73}];class u{constructor(e,t=d.o.ALL){this.scene=e,this.layer=t,this.supportsMobile=!1,this.style=l.L.Reticle,this.bindings=[],this.onCursorDataUpdated=e=>{this.mesh.configure({opacity:e.opacity.value,texture:e.texture})},this.onPositionUpdate=e=>{if(e.hit&&e.hit.face){const t=e.hit.point.clone(),i=e.hit.face.normal;this.container.position.copy(t),this.mesh.configure({normal:i})}},this.container=new a.Group,this.container.name="cursor",this.mesh=new c.f({radius:.2,rings:m}),this.container.add(this.mesh),this.mesh.renderOrder=h.z.reticule,this.mesh.layers.mask=this.layer.mask}init(){}render(){}dispose(){this.mesh.dispose(),this.container.children.forEach((e=>{if(e.isMesh&&e!==this.mesh){e.geometry.dispose();const t=e.material;t.dispose(),t.map&&t.map.dispose()}}))}async activate(e){const t=await e.market.waitForData(o.Y),i=await e.market.waitForData(r.P);this.bindings.push(t.onChanged(this.onCursorDataUpdated),i.onChanged(this.onPositionUpdate)),this.scene.add(this.container)}deactivate(){for(const e of this.bindings)e.cancel();this.bindings.length=0,this.scene.remove(this.container)}setVisible(e){this.container.visible=e}}class p extends n.Y{constructor(){super(...arguments),this.name="cursor-mesh",this.setVisible=e=>{this.cursor&&this.cursor.setVisible(e)}}async init(e,t){const i=(await t.getModuleBySymbol(s.y.WEBGL_RENDERER)).getScene(),n=t.claimRenderLayer(this.name);this.cursor=new u(i,n),t.addComponent(this,this.cursor)}get container(){return this.cursor.container}}},95810:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>d});var n=i(97542),s=i(69170),a=i(53058),o=i(81396),r=i(90304);class d extends n.Y{constructor(){super(...arguments),this.name="fat-caster",this.rayAssembly=new Array(d.rayCount),this.rayPlaneOrientation=new o.Quaternion,this.rayVisuals=[]}async init(e,t){this.config={debug:!!e.debug},this.raycaster=await t.getModuleBySymbol(s.y.RAYCASTER);for(let e=0;e<d.rayCount;++e)this.rayAssembly[e]=new o.Ray;if(e.debug){const e=(await t.getModuleBySymbol(s.y.WEBGL_RENDERER)).getScene();for(let t=0;t<d.rayCount;++t){this.rayVisuals[t]=new o.ArrowHelper(new o.Vector3,new o.Vector3);const i=this.rayVisuals[t];i.remove(i.cone),i.setLength(1e3),e.add(this.rayVisuals[t])}}}async dispose(e){const t=(await e.getModuleBySymbol(s.y.WEBGL_RENDERER)).getScene();for(const e of this.rayVisuals)t.remove(e)}get ray(){return this.raycaster.pointer.pointerRay.clone()}cast(e,t,i=a.a.Filter.AVERAGE){const n=this.ray;return this.updateRayAssembly(n.origin,n.direction,e),this.castRays(t,i)}castRays(e,t){const i=[];let n=null;for(const t of this.rayAssembly){const s=this.raycaster.picking.pick(t.origin,t.direction,e);s&&(t===this.rayAssembly[0]&&(n=s),s.point.add(this.rayAssembly[0].origin).sub(t.origin),i.push(s))}return t(i,n,this.rayAssembly)}updateRayAssembly(e,t,i){for(const e of this.rayAssembly)e.direction.copy(t);if(this.rayPlaneOrientation.setFromUnitVectors(r.f.FORWARD,t),this.rayAssembly[0].origin.copy(e),this.rayAssembly[1].origin.copy(r.f.RIGHT).multiplyScalar(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[2].origin.copy(r.f.UP).multiplyScalar(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[3].origin.copy(r.f.LEFT).multiplyScalar(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[4].origin.copy(r.f.DOWN).multiplyScalar(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[5].origin.copy(r.f.UP).add(r.f.RIGHT).setLength(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[6].origin.copy(r.f.UP).add(r.f.LEFT).setLength(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[7].origin.copy(r.f.DOWN).add(r.f.RIGHT).setLength(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.rayAssembly[8].origin.copy(r.f.DOWN).add(r.f.LEFT).setLength(i).applyQuaternion(this.rayPlaneOrientation).add(e),this.config.debug)for(let e=0;e<this.rayVisuals.length;++e){const i=this.rayVisuals[e];i.setDirection(t),i.position.copy(this.rayAssembly[e].origin)}}}d.rayCount=9},53058:(e,t,i)=>{"use strict";i.d(t,{a:()=>n});var n,s=i(81396);!function(e){let t;!function(e){const t=e=>{for(const t of e)if(t.face)return{point:t.point,object:t.object,distance:t.distance,face:t.face};return null},i=(e,t)=>e.distance-t.distance;e.CENTER_FIRST=(e,i)=>i&&i.face?{point:i.point,normal:i.face.normal,object:i.object,distance:i.distance,face:i.face}:t(e),e.CLOSEST=e=>t(e.sort(i)),e.AVERAGE=e=>{if(0===e.length)return null;const t={point:new s.Vector3,face:{a:0,b:1,c:2,normal:new s.Vector3,materialIndex:0},distance:0,object:e[0].object};for(const i of e)t.face&&i.face&&(t.point.add(i.point),t.face.normal.add(i.face.normal));return t.point.divideScalar(e.length),t.face&&t.face.normal.divideScalar(e.length).normalize(),t};e.CENTER_GROUP=t=>(i,s,a)=>{if(s){const n=[s];for(let e=1;e<i.length&&e<3;++e){const o=i[e];if(o.face){const i=Math.abs(a[e].direction.dot(o.face.normal));s.point.distanceTo(o.point)*i<=t&&n.push(o)}}if(n.length>=3){const t=e.AVERAGE(n,null,a);if(t&&t.face&&s.face)return t.face.normal=s.face.normal,t}}const o=n(i,a,t);return o?e.AVERAGE(o,null,a):e.CENTER_FIRST(i,s,a)};const n=(e,t,n)=>{const s=e.slice().sort(i),a=[s[0]];let o;for(o=1;o<s.length&&a.length<3;++o){const e=s[o];if(e.face){const i=Math.abs(t[o].direction.dot(e.face.normal));a[0].point.distanceTo(e.point)*i>n&&(a.length=0),a.push(e)}}return a.length<3?null:a}}(t=e.Filter||(e.Filter={}))}(n||(n={}))},69582:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GetFloorIntersectCommand:()=>n.Z,default:()=>w});var n=i(29900),s=i(97542),a=i(69170),o=i(947),r=i(9037),d=i(59370),l=i(76957),h=i(23254),c=i(95882),m=i(82814),u=i(16769),p=i(67944),g=i(81396),v=i(90304);class y extends s.Y{constructor(){super(...arguments),this.name="floor-caster",this.cameraPosition=new g.Vector3,this.forwardPosition=new g.Vector3,this.targetPlane=new g.Plane}async init(e,t){this.engine=t,[this.renderer,this.cameraData,this.viewmodeData,this.raycaster,this.floorsData,this.meshQuery]=await Promise.all([t.getModuleBySymbol(a.y.WEBGL_RENDERER),t.market.waitForData(r.M),t.market.waitForData(h.O),t.getModuleBySymbol(a.y.RAYCASTER),t.market.waitForData(l.i),t.getModuleBySymbol(a.y.MESH_QUERY)]),t.commandBinder.addBinding(n.Z,(e=>this.castToFloor(e.screenPosition,e.height,e.includeHiddenFloors)))}async castToFloor(e,t,i=!0){await this.engine.after(o.A.End);const n=this.renderer.getScene().camera,s=(0,d.z5)(e.x,e.y,this.cameraData.width,this.cameraData.height);let a,r=null;this.cameraPosition.set(s.x,s.y,-1).unproject(n),this.forwardPosition.set(s.x,s.y,1).unproject(n);const l=this.raycaster.picking.cast(this.cameraPosition,this.forwardPosition.clone().sub(this.cameraPosition).normalize(),i?u.T0:u.Pv)[0];if(l&&l.object instanceof m.S){r=l&&l.point||null;const e=this.meshQuery.floorIdFromObject(l.object);e?a=this.floorsData.getFloor(e):r&&(a=this.floorsData.getClosestFloorAtHeight(r.y))}if(void 0!==t){this.cameraPosition.copy(this.cameraData.pose.position);const e=(0,d.st)(this.cameraData,s);if(this.viewmodeData.currentMode!==c.Ey.Floorplan){const i=(0,p.n0)(this.cameraPosition,e);this.targetPlane.set(v.f.DOWN,t),r=(0,p.Fe)(this.cameraPosition,i,this.targetPlane)||null}else e.y=t,r=e}const h=a?a.index:-1;return{position:r,floor:h,floorIndex:h}}}const w=y},74082:(e,t,i)=>{"use strict";i.d(t,{$:()=>r});var n=i(49947),s=i(7159),a=i(30643),o=i(31362);class r{constructor(e){this.capabilites={links:{enable:e.supportLinks,keepLabels:e.keepLinkLabels}}}parse(e,t){const i=[];if(!e)return[];return e.split("[").map((function(e,t){return 0===t?e:"["+e})).forEach((e=>{const n=this.findLink(e);n?-1===n.url.indexOf("javascript:")&&(this.addLinkChunk(i,n,t),this.addTextChunk(i,e.slice(n.markdown.length))):this.addTextChunk(i,e)})),i}findLink(e){const t=e.match(/\[([^\]]*)\]\((.*)\)/);if(!t)return null;const i=t[2];let n=1,s=0;for(;s<i.length&&("("===i[s]?n++:")"===i[s]&&n--,0!==n);)s++;const a=i.length-s;return{markdown:t[0].substring(0,t[0].length-a),label:t[1],url:this.conditionallyEncode(t[2].substring(0,s))}}conditionallyEncode(e){return this.needsEncoding(e)?encodeURI(e):e}needsEncoding(e){if(e.match(o.jx))return!0;let t=e;try{t=decodeURI(e)}catch(e){}return!1}addTextChunk(e,t){0!==t.length&&e.push({type:a.z.text,text:t})}addLinkChunk(e,t,i){if(!this.capabilites.links.enable)return void(this.capabilites.links.keepLabels&&this.addTextChunk(e,t.label));const o={label:t.label,url:t.url,type:n.U.EXT_LINK};-1===o.url.indexOf("://")&&(o.url="http://"+o.url);const r=-1!==o.url.indexOf("matterport.com/show"),d=-1!==o.url.indexOf(window.location.host+"/show");if(r||d){const e=-1!==o.url.indexOf(i),t=s.K.deserialize(o.url);e&&t?(o.type=n.U.NAVIGATION,o.navigationData=t):(o.type=n.U.MODEL,o.url+="&play=1")}e.push({type:a.z.link,link:o})}static getNumLinks(e){let t=0;return e.forEach((e=>{"link"===e.type&&void 0!==e.link&&t++})),t}}},88669:(e,t,i)=>{"use strict";i.d(t,{U:()=>l});var n=i(81396),s=i(15462),a=i(30643),o=i(78283),r=i(75287),d=i(10385);class l extends r.T{constructor(e){super(),this.sid="",this.layerId="",this.created=new Date,this.modified=new Date,this.enabled=!0,this.label="",this.description="",this.parsedDescription=[],this.anchorPosition=new n.Vector3,this.anchorNormal=new n.Vector3(0,1,0),this.stemVector=new n.Vector3(0,0,(0,o._F)(1)),this.stemHeight=(0,o._F)(1),this.stemVisible=!0,this.fileAttachments=new d.d,this.externalAttachments=new d.d,this.sandboxAttachments=new d.d,this.color=s.I.MATTERTAG_BLUE.clone(),this.mediaType=a.z.none,this.mediaSrc="",this.keywords=[],e&&Object.assign(this,e)}copy(e){this.anchorNormal.copy(e.anchorNormal),this.anchorPosition.copy(e.anchorPosition),this.color.copy(e.color),this.created.setTime(e.created.getTime()),this.description=e.description,this.enabled=e.enabled,this.layerId=e.layerId,this.floorId=e.floorId,this.roomId=e.roomId,this.label=e.label,this.mediaType=e.mediaType,this.mediaSrc=e.mediaSrc,this.modified.setTime(e.modified.getTime()),this.sid=e.sid,this.stemVector.copy(e.stemVector),this.stemHeight=e.stemHeight,this.stemVisible=e.stemVisible,this.fileAttachments=e.fileAttachments,this.externalAttachments=e.externalAttachments,this.sandboxAttachments=e.sandboxAttachments,this.objectAnnotationId=e.objectAnnotationId,this.keywords=e.keywords,this.icon=e.icon,this.parsedDescription=[];for(const t of e.parsedDescription)this.parsedDescription.push({link:t.link&&{label:t.link.label.slice(),url:t.link.url.slice(),type:t.link.type,navigationData:t.link.navigationData&&{floorVisibility:t.link.navigationData.floorVisibility,mode:t.link.navigationData.mode,sweepIndex:t.link.navigationData.sweepIndex,panoId:t.link.navigationData.panoId,position:t.link.navigationData.position&&t.link.navigationData.position.clone(),quaternion:t.link.navigationData.quaternion.clone(),zoom:t.link.navigationData.zoom}},text:t.text,type:t.type});return this.commit(),this}clone(){return(new l).copy(this)}refresh(e){this.fileAttachments.forEach((t=>{const i=e[t.id];i&&(t.thumbnailUrl.refreshFrom(i.thumbnailUrl),t.url.refreshFrom(i.url))}))}getPin(){const{anchorPosition:e,color:t,stemVisible:i,floorId:n,roomId:s,stemVector:a,stemHeight:o}=this;return{anchorPosition:e,color:`#${t.getHexString()}`,floorId:n,roomId:s,stemEnabled:i,stemNormal:a,stemLength:o}}updateFromOptions(e,t,i){void 0!==e.color&&(this.color=new n.Color(e.color.r,e.color.g,e.color.b)),void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.stemHeight&&(this.stemHeight=e.stemHeight,this.stemVector.copy(this.anchorNormal).setLength(e.stemHeight)),void 0!==e.stemVisible&&(this.stemVisible=e.stemVisible),void 0!==e.label&&(this.label=e.label.slice()),void 0!==e.description&&(this.description=e.description,this.parsedDescription=t.parse(this.description,i)),void 0!==e.floorId&&(this.floorId=e.floorId),void 0!==e.normal&&(this.anchorNormal.copy(e.normal).normalize(),this.stemVector.copy(e.normal).setLength(this.stemHeight)),void 0!==e.position&&this.anchorPosition.copy(e.position),void 0!==e.keywords&&(this.keywords=e.keywords.slice()),Object.prototype.hasOwnProperty.call(e,"icon")&&(this.icon=e.icon),void 0!==e.objectAnnotationId&&(this.objectAnnotationId=e.objectAnnotationId)}}},48448:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>ie});var n=i(97542),s=i(69170),a=i(88669),o=i(39880),r=i(79728),d=i(45905),l=i(90632),h=i(85979),c=i(635),m=i(71954),u=i(64567),p=i(2541),g=i(19648),v=i(47620),y=i(30643),w=i(85679),f=i(74082),b=i(41999),T=i(95724),D=i(17788),C=i(97998),P=i(73123),A=i(63665),I=i(65222),E=i(5823),S=i(40731);const k=new C.Z("mds-mattertag-serializer");class N{constructor(e,t){this.updateSerializer=e,this.mediaSerializer=t}serialize(e,t){const i=this.mediaSerializer.serialize(e),n=this.updateSerializer.serialize(e,t),s=null!==i?Object.assign(Object.assign({},i),n):n;return this.validate(s)?s:null}validate(e){if(!e)return!1;const t=["label","description","mediaUrl"].some((t=>t in e)),i=["floorId","enabled","anchorPosition"].filter((t=>!(t in e))),n=0===i.length,s=!!e.anchorPosition&&(0,S.u)(e.anchorPosition),a=n&&t&&s;return a||k.debug("Invalid MattertagDetails:",{missingFields:i,validPosition:s}),a}}var O=i(9133),M=i(2569),x=i(81396),R=i(37519),V=i(29282);const B=new C.Z("mds-mattertag-serializer");class L{constructor(e,t){this.fileAttachmentDeserializer=e,this.externalAttachmentDeserializer=t}deserialize(e){var t,i;if(!e||!this.validate(e))return B.debug("Deserialized invalid Mattertag data from MDS",e),null;const n=e.anchorPosition?M.ep.fromVisionVector(e.anchorPosition):void 0,s=e.stemNormal?M.ep.fromVisionVector(e.stemNormal):void 0,o=new a.U;if(o.sid=e.id,o.layerId=(null===(t=e.layer)||void 0===t?void 0:t.id)||"",o.label=e.label||"",o.description=e.description||"",o.enabled=!!e.enabled,e.color&&(o.color=new x.Color(e.color)),o.created=(0,O.p)(e.created),o.modified=(0,O.p)(e.modified),e.floor&&e.floor.id&&(o.floorId=e.floor.id),e.room&&e.room.id&&(o.roomId=e.room.id),n&&(o.anchorPosition=n),e.media&&(o.mediaSrc=e.media),e.mediaType&&(o.mediaType=(0,v.m7)(e.mediaType)),o.fileAttachments.replace(this.getFileAttachments(o,e)),o.externalAttachments.replace(this.getExternalAttachments(o,e)),(0,R.hj)(e.stemLength)&&(o.stemHeight=e.stemLength),s&&s instanceof x.Vector3){const t=s.clone().setLength(o.stemHeight);o.anchorNormal=s,o.stemVector=t,o.stemVisible=!!e.stemEnabled}else o.stemVector=new x.Vector3(0,0,0),o.stemVisible=!!e.stemEnabled;return o.objectAnnotationId=null===(i=e.objectAnnotation)||void 0===i?void 0:i.id,o.keywords=e.keywords||[],(0,V.r)(e.icon)&&(o.icon=e.icon),o}validate(e){if(!e)return!1;return["id","created","modified","enabled"].every((t=>t in e))}getFileAttachments(e,t){return this.fileAttachmentDeserializer?this.deserializeFileAttachments(t).sort(((e,t)=>e.created.getTime()-t.created.getTime())):[]}getExternalAttachments(e,t){if(!this.externalAttachmentDeserializer)return[];const i=this.deserializeExternalAttachments(t);if(t.media&&t.mediaType){const n=(0,v.Nc)(e.sid,t.media,t.mediaType);n&&i.push(n)}return i.sort(((e,t)=>e.created.getTime()-t.created.getTime()))}deserializeExternalAttachments(e){const t=e.externalAttachments||[],i=[];return t.forEach((t=>{var n;const s=null===(n=this.externalAttachmentDeserializer)||void 0===n?void 0:n.deserialize(t);s&&(s.parentId=e.id,s.parentType=E.ud.MATTERTAG,i.push(s))})),i}deserializeFileAttachments(e){const t=e.fileAttachments||[],i=[];return t.forEach((t=>{var n;const s=null===(n=this.fileAttachmentDeserializer)||void 0===n?void 0:n.deserialize(t);s&&(s.parentId=e.id,s.parentType=E.ud.MATTERTAG,i.push(s))})),i}}class F{serialize(e){return this.validate(e)?{sid:e.sid}:null}validate(e){const t=null!==e&&!!e.mediaType&&e.mediaType===y.z.none;return null!==e&&!!e.sid&&t}}const H=new C.Z("mds-mattertag-serializer");class j{serialize(e){const t=this.extractMedia(e);return this.validate(t)?t:null}validate(e){if(!e)return!1;const t=["mediaUrl","mediaType"].every((t=>t in e)),i=void 0!==e.mediaType&&["rich","photo","video"].includes(e.mediaType),n=t&&i;return n||H.debug("invalid media",e,{hasRequiredFields:t,hasValidMediaType:i}),n}extractMedia(e){const t={};return e.mediaSrc&&(t.mediaUrl=e.mediaSrc),e.mediaType&&e.mediaType in U&&(t.mediaType=e.mediaType),t.mediaUrl&&t.mediaType?t:null}}const U={[y.z.photo]:[E.L0.PHOTO],[y.z.rich]:[E.L0.RICH],[y.z.video]:[E.L0.VIDEO]};var G=i(69984);const z=new C.Z("mds-mattertag-serializer");class _{serialize(e,t){var i;if(!e)return null;const n={};return void 0!==e.enabled&&(n.enabled=e.enabled),void 0!==e.stemVisible&&(n.stemEnabled=e.stemVisible),void 0!==e.label&&(n.label=e.label),void 0!==e.description&&(n.description=e.description),void 0!==e.color&&(0,G.D5)(e.color)&&(n.color=(0,G.Ex)(e.color)),void 0!==e.anchorPosition&&(0,S.u)(e.anchorPosition)&&(n.anchorPosition=M.ep.toVisionVector(e.anchorPosition)),void 0!==e.anchorNormal&&(0,S.u)(e.anchorNormal)&&(n.stemNormal=M.ep.toVisionVector(e.anchorNormal)),void 0!==e.stemHeight&&(n.stemLength=e.stemHeight),Object.prototype.hasOwnProperty.call(e,"icon")&&(n.icon=null!==(i=e.icon)&&void 0!==i?i:""),void 0!==e.keywords&&(n.keywords=e.keywords),e.floorId&&(n.floorId=e.floorId),e.roomId&&(n.roomId=e.roomId),e.layerId&&t&&(n.layerId=e.layerId),e.objectAnnotationId&&(n.objectAnnotationId=e.objectAnnotationId),n&&this.validate(n)?n:null}validate(e){if(!e)return!1;const t=["layerId","floorId","roomId","color","label","description","enabled","stemEnabled","stemLength","stemNormal","stemDirection","anchorPosition","objectAnnotationId","keywords","icon"],i=Object.keys(e).length>0,n=Object.keys(e).every((e=>t.includes(e))),s=n&&i;return s||z.debug("Invalid MattertagPatch:",{hasContents:i,hasValidFields:n,data:e}),s}}class ${serialize(e){const t=e.fileAttachments;return void 0===t?null:{fileAttachments:t.map((e=>e.id))}}}var K=i(82686);const W=new C.Z("MdsMattertagStore");class J extends D.u{constructor(e){super(e),this.layeredType=E.SF.MATTERTAG,this.prefetchKey="data.model.mattertags";const t=new A.d;this.fileAttachmentDeserializer=new I.O,this.fileAttachmentSerializer=new $,this.patchSerializer=new _,this.mediaUpdateSerializer=new j,this.mediaRemovalSerializer=new F,this.createSerializer=new N(this.patchSerializer,this.mediaUpdateSerializer),this.tagDeserializer=new L(this.fileAttachmentDeserializer,t),this.deserializer=new T.o({deserializer:this.tagDeserializer})}async read(e){const{includeDisabled:t=!1}=this.config,i={modelId:this.getViewId(),includeDisabled:t,prefetchKey:this.prefetchKey,includeLayers:this.readLayerId()};return this.query(K.GetMattertags,i,e).then((e=>{var t,i;const n=null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.mattertags;if(!n||!Array.isArray(n))return null;return(this.deserializer.deserialize(n)||[]).reduce(((e,t)=>(e[t.sid]=t,e)),{})}))}async refreshFileAttachments(e){const{includeDisabled:t=!1}=this.config,i={modelId:this.getViewId(),includeDisabled:t};return this.query(K.RefreshTagFileAttachments,i,e).then((e=>{var t,i;const n=null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.mattertags;if(!n||!Array.isArray(n))return{};const s=[];for(const e of n){if(!e.id||!e.fileAttachments)throw W.error("Failure refreshing tag file attachments"),new Error("Failure refreshing tag file attachments");e.fileAttachments.forEach((e=>{const t=this.fileAttachmentDeserializer.deserialize(e);t&&s.push(t)}))}return s.reduce(((e,t)=>(e[t.id]=t,e)),{})}))}async create(e){const t=this.getViewId(),i=[];for(const n of e){const e=this.createSerializer.serialize(n,this.writeLayerId(n.layerId));if(!e)throw W.error("Failure saving tag:",n.sid,n),new Error("Could not save Mattertag");const s=n.sid;let o=", $data: MattertagDetails!";const r={modelId:t,mattertagId:s,data:e},d=this.fileAttachmentSerializer.serialize(n);d&&(o+=", $fileAttachments: [ID!]",r.fileAttachments=d.fileAttachments);const l=`\n addMattertag(\n modelId: $modelId,\n mattertagId: "${s}",\n mattertag: $data) {\n id\n created\n modified\n }\n ${d?`addMattertagAttachments(\n modelId: $modelId,\n mattertagId: "${s}",\n fileAttachments: $fileAttachments) {\n id\n }`:""}\n `,h=b.gql`
3
+ mutation AddMattertag($modelId: ID! ${o}) {
4
+ ${l}
5
+ }
6
+ `,c=await this.mutate(h,r),m=(0,P.q)(c,"data.addMattertag"),u=(new a.U).copy(n);u.sid=m.id,u.commit(),i.push(u)}return i}async update(e,t){if(!e||0===e.length)return;let i="";const n={},s=this.getViewId();n.modelId=s;let a="";for(const t of e){const e=t.sid,s=this.mediaUpdateSerializer.serialize(t),o=this.mediaRemovalSerializer.serialize(t),r=this.patchSerializer.serialize(t,!1),d=r||o||s,l=this.fileAttachmentSerializer.serialize(t);if(!(r||s||o||l))return void W.debug(`Nothing to update for tag ${e}`,t);if(d){const t=r||{};i+=`, $patch${e}: MattertagPatch!`,o&&(t.mediaUrl=""),s&&(t.mediaUrl=s.mediaUrl,t.mediaType=s.mediaType),n[`patch${e}`]=t}l&&(i+=`, $fileAttachments${e}: [ID!]`,n[`fileAttachments${e}`]=l.fileAttachments),n[`mediaType${e}`]=s&&s.mediaType,n[`mediaUrl${e}`]=s&&s.mediaUrl;a+=`\n update${e}:\n ${d?`patchMattertag(\n modelId: $modelId,\n mattertagId: "${e}",\n patch: $patch${e}) {\n id\n }`:""}\n ${l?`addMattertagAttachments(\n modelId: $modelId,\n mattertagId: "${e}",\n fileAttachments: $fileAttachments${e}) {\n id\n }`:""}\n `}for(const{attachment:e}of t)(null==e?void 0:e.id)&&(null==e?void 0:e.parentId)&&e.parentType?(i+=`, $parentType${e.id}: ParentType!`,n[`parentType${e.id}`]=e.parentType,a+=`\n unattach${e.id}:\n removeFileAttachment(modelId: $modelId,\n attachmentId: "${e.id}",\n parentType: $parentType${e.id},\n parentId: "${e.parentId}") `):W.debug("MattertagStore.update: unable to remove file attachment");const o=b.gql`
7
+ mutation tagUpdate($modelId: ID! ${i}) {
8
+ ${a}
9
+ }
10
+ `;await this.mutate(o,n)}async delete(e){if(!e||0===e.length)return;const t=this.getViewId();let i="";for(const t of e){if(!t||t&&!t.sid)throw new Error("MattertagStore.delete failed");i+=`delete${t.sid}: deleteMattertag(modelId: $modelId, mattertagId: "${t.sid}") `}const n=b.gql`
11
+ mutation batchDeleteMattertag($modelId: ID!) {
12
+ ${i}
13
+ }
14
+ `;return this.mutate(n,{modelId:t}).then((()=>{}))}}var Y=i(9037),q=i(59370),Z=i(59279),Q=i(79232),X=i(33824),ee=i(5666),te=i(80742);class ie extends n.Y{constructor(){super(...arguments),this.name="mattertag-data",this.monitor=null,this.filesToUnattach=[],this.getDiscPositions=(()=>{const e=[],t={},i={},n=new x.Vector3;return async s=>(e.length=0,s.tags.forEach((s=>{const a=this.data.getTag(s);a&&(i[s]||(i[s]=new x.Vector3),i[s].copy(a.anchorPosition).add(a.stemVector),t[s]||(t[s]=new x.Vector2),(0,q.q9)(this.cameraData,i[s],t[s],n),e.push({sid:s,screen:n.z>1?null:t[s],world:i[s]}))})),e)})(),this.addTag=async e=>{const t=[];return this.data.atomic((()=>{for(const i of e){const{positionOptions:e,standardOptions:n,mediaOptions:s}=i,a=Object.assign(Object.assign({},e),n),r=this.createTag(i.id||(0,o.O1)(11),a,[],s);r.modified=new Date,r.commit(),t.push(r.sid)}})),t},this.editTag=async e=>{const{sid:t,positionOptions:i,standardOptions:n,mediaOptions:s}=e,a=Object.assign(Object.assign({},i),n),o=this.data.getTag(t);o&&(this.updateTag(o,a,s),o.modified=new Date,o.commit())},this.removeTag=async e=>{const t=this.data.getTag(e.sid);if(void 0!==t&&this.data.removeTag(e.sid))return t&&t.objectAnnotationId&&this.engine.commandBinder.issueCommand(new ee.SO(t.objectAnnotationId)),e.sid},this.saveNewTag=async e=>{const{id:t,properties:i,embed:n,fileAttachments:s}=e,a=n?{mediaSrc:n.src,mediaType:(0,v.F5)(n.mediaType)}:void 0;return this.createTag(t,i,s,a),this.engine.commandBinder.issueCommand(new c.VQ({dataTypes:[r.g.MATTERTAGS]}))},this.saveTag=async e=>{const{id:t,properties:i,pendingAttachments:n,removedAttachments:s,embed:a}=e,o=this.data.getTag(t);if(!o)return void this.log.debug("Cannot save non-existent tag");const d=a?(0,v.F5)(a.mediaType):y.z.none,l=a?a.src:"";void 0!==a&&(l===o.mediaSrc&&d!==o.mediaType||this.updateExternalAttachment(o,a));const h=void 0!==a?{mediaSrc:l,mediaType:d}:void 0;return this.updateTag(o,i,h),n.forEach((e=>{o.fileAttachments.push(e)})),this.removeFileAttachments(o,s),this.data.addTag(o),this.data.updateOnStaleCallbacks(t),this.engine.commandBinder.issueCommand(new c.VQ({dataTypes:[r.g.MATTERTAGS]}))}}async init(e,t){const{readonly:i,baseUrl:n}=e;this.engine=t,this.config=e,this.descParser=new f.$({supportLinks:!0,keepLinkLabels:!0}),[this.meshQueryModule,this.cameraData,this.layersData]=await Promise.all([t.getModuleBySymbol(s.y.MESH_QUERY),t.market.waitForData(Y.M),t.market.waitForData(te.R)]),this.store=new J({context:this.layersData.mdsContext,readonly:i,includeDisabled:!i,baseUrl:n});const a=await t.getModuleBySymbol(s.y.STORAGE);if(this.data=new w.n,this.bindings.push(this.store.onNewData((async i=>{this.initializeTagData(i,t.market,e.parserOptions)})),t.commandBinder.addBinding(g.cH,this.getDiscPositions),t.commandBinder.addBinding(g.Fz,this.addTag),t.commandBinder.addBinding(g.Ek,this.editTag),t.commandBinder.addBinding(g.Gn,this.removeTag)),await this.store.refresh(),!i){this.bindings.push(t.commandBinder.addBinding(g.Mm,this.saveNewTag),t.commandBinder.addBinding(g.qq,this.saveTag),a.onSave((()=>this.save()),{dataType:r.g.MATTERTAGS}),a.onPublish((()=>this.onAfterPublish()),{dataType:r.g.MATTERTAGS,phase:d.Q.AFTER}));const e=await t.market.waitForData(l.Q);e.setRevertableType(r.g.MATTERTAGS),e.setPublishableType(r.g.MATTERTAGS),this.monitor=new u.c(this.data.collection,{aggregationType:p.E.Manual,shallow:!0}),this.configureTrash()}t.market.register(this,w.n,this.data)}dispose(e){this.store.dispose(),super.dispose(e)}async save(){if(this.monitor&&this.monitor.commitChanges(),!this.store||!this.monitor)return void this.log.warn("Mattertags changes will NOT be saved");const e=this.monitor.getDiffRecord();this.monitor.clearDiffRecord();const t=e.map((e=>{var t;const i=e.diff.layerId||(null===(t=this.data.getTag(e.index))||void 0===t?void 0:t.layerId);return Object.assign({layerId:i},e)})).filter((e=>!this.layersData.isInMemoryLayer(e.layerId))),i=t.filter((e=>e.action===m.KI.removed)).map((e=>({sid:e.index,layerId:e.layerId}))),n=t.filter((e=>e.action===m.KI.added)).map((e=>this.data.getTag(e.index))),s=t.filter((e=>e.action===m.KI.updated)).map((e=>{const t=Object.assign({sid:e.index,layerId:e.layerId},e.diff);return"mediaSrc"in t&&(t.mediaType=this.data.getTag(e.index).mediaType),t.objectAnnotationId=this.data.getTag(e.index).objectAnnotationId,t}));await this.store.delete(i),await this.store.create(n),await this.store.update(s,this.filesToUnattach)}clearDiffRecord(){this.monitor&&this.monitor.clearDiffRecord()}initializeTagData(e,t,i){var n;const s=i?new f.$(i):this.descParser;this.data.atomic((()=>{this.layersData.replaceBackendLayers(this.data.collection,{})})),this.data.atomic((()=>{for(const t in e){const i=e[t];i.parsedDescription=s.parse(e[t].description,this.layersData.currentViewId),this.meshQueryModule.inferMeshIdsFromPoint(i,i.anchorPosition),this.data.addTag(i)}})),this.data.onStale=()=>this.store.refreshFileAttachments(),this.data.updateOnStaleCallbacks(),null===(n=this.monitor)||void 0===n||n.clearDiffRecord()}createTag(e,t,i,n){let s=e;for(;this.data.getTag(s);)s=(0,o.O1)(11);const r=new a.U;if(r.sid=s,r.layerId=this.layersData.activeLayerId,n){const e=(0,v.gj)(n.mediaType);if(n.mediaSrc&&e){const t=(0,v.Nc)(s,n.mediaSrc,e);t&&r.externalAttachments.push(t)}}return t.objectAnnotationId&&(r.objectAnnotationId=t.objectAnnotationId),t.keywords&&(r.keywords=t.keywords),i.forEach((e=>{r.fileAttachments.push(e)})),this.updateTag(r,t,n),this.data.addTag(r),this.data.updateOnStaleCallbacks(s),r}updateTag(e,t,i){e.updateFromOptions(t,this.descParser,this.layersData.currentViewId),void 0!==(null==i?void 0:i.mediaType)&&(e.mediaType=i.mediaType),void 0!==(null==i?void 0:i.mediaSrc)&&(e.mediaSrc=i.mediaSrc.slice())}removeFileAttachments(e,t){const{fileAttachments:i}=e;t.forEach((t=>{const n=i.findIndex((e=>e.id===t.id));-1!==n?(i.splice(n,1),this.filesToUnattach.push({attachment:t,layerId:e.layerId})):this.log.debug("Attempting to remove an attachment that is not in the tag")}))}updateExternalAttachment(e,t){const{mediaSrc:i}=e;i&&e.externalAttachments.replace([]),t&&e.externalAttachments.replace([t])}async onAfterPublish(){this.verifyDataIntegrity()}async verifyDataIntegrity(){const e="data-integrity"===(0,Z.eY)("error",""),t=this.data.getTagCount(),i=await this.store.read().catch((e=>{this.log.debug("Mattertag integrity check failed",e)}))||{},n=Object.keys(i).length;(n!==t||e)&&this.engine.broadcast(new h.Qq(`Unexpected tag count after publish (${n}/${t})`,r.g.MATTERTAGS,e))}async configureTrash(){const{readonly:e}=this.config,{commandBinder:t}=this.engine;if(e)return;const i=r.g.MATTERTAGS,n=new L,s={objectType:i,create:e=>new Q.F({label:e.label||(0,o.aS)(e.description||"",100)||"Mattertag",objectId:e.id,objectType:i,created:new Date,value:e}),restore:e=>{const t=n.deserialize(e.value);t&&this.data.addTag(t)}},a=await t.issueCommandWhenBound(new X.B(s));this.bindings.push(a)}}},47620:(e,t,i)=>{"use strict";i.d(t,{F5:()=>h,Nc:()=>u,gj:()=>c,m7:()=>l});var n=i(30643),s=i(32347),a=i(71608),o=i(92558),r=i(56367),d=i(5823);function l(e){const t={[d.L0.VIDEO]:n.z.video,[d.L0.PHOTO]:n.z.photo,[d.L0.RICH]:n.z.rich};return e in t?t[e]:n.z.none}function h(e){switch(e){case s.DD.VIDEO:return n.z.video;case s.DD.IMAGE:return n.z.photo;case s.DD.RICH:return n.z.rich}return n.z.none}function c(e){switch(e){case n.z.video:return d.L0.VIDEO;case n.z.photo:return d.L0.PHOTO;case n.z.rich:return d.L0.RICH}return null}function m(e){return{[d.L0.VIDEO]:s.DD.VIDEO,[d.L0.PHOTO]:s.DD.IMAGE,[d.L0.RICH]:s.DD.RICH}[e]}function u(e,t,i){return t?new a.P({id:(0,o.fV)(),created:new Date,parentId:e,parentType:d.ud.MATTERTAG,mediaType:m(i),src:t,url:new r.n(t,null),thumbnailUrl:new r.n(t,null),category:s.G$.EXTERNAL}):null}},42304:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AddCommentCommand:()=>te.Df,CancelCommentChangesCommand:()=>te.oH,CancelNewNoteCommand:()=>te.gc,CloseNoteCommand:()=>te._N,Comment:()=>fe,DeleteCommentCommand:()=>te.mH,DeleteNoteCommand:()=>te.sG,EditCommentCommand:()=>te.x4,FilterVisibleNotesCommand:()=>te.Gx,FocusCommentMessage:()=>ie.J,HashtagData:()=>ee.c,Note:()=>Y,NoteColorVariant:()=>z.Y,NoteResolutionChangeMessage:()=>ie.h,NotesData:()=>Q,NotesFilter:()=>z.$,NotesModeToggleCommand:()=>te.yK,NotesPhase:()=>G.U,NotesViewData:()=>X.X,NotesVisibilityFilterEnabledCommand:()=>te.GV,OpenNoteCommentCommand:()=>te.yP,ResolveNoteCommand:()=>te.yp,SaveNewNoteCommand:()=>te.FB,SaveNoteAppearanceCommand:()=>te.oE,SaveNoteChangesCommand:()=>te.kd,StartNewNoteCommand:()=>te.VI,ToggleNoteToolEditorCommand:()=>te.df,ToggleNotesFilterCommand:()=>te.RO,UpdateCommentCommand:()=>te.Uw,default:()=>Fe});var n=i(97542),s=i(69170),a=i(35895),o=i(5823),r=i(87926);const d=i.p+"images/NoteColor.png";var l=i(39880),h=i(64918),c=i(52528),m=i(95160),u=i(76631),p=i(40964),g=i(89549),v=i(91380),y=i(92211),w=i(20436),f=i(66197),b=i(5686),T=i(10374),D=i(53954),C=i(23254),P=i(34029),A=i(5135),I=i(79727),E=i(80742),S=i(14630),k=i(64773),N=i(12039),O=i(72936),M=i(62612),x=i(60083),R=i(13132),V=i(43470),B=i(86283),L=i(16935),F=i(5604),H=i(44877),j=i(35446),U=i(21149),G=i(38965),z=i(22744),_=i(81396),$=i(75287),K=i(10385),W=i(67622),J=i(39693);class Y extends $.T{constructor(e){super(),this.id="",this.layerId="",this.color=J.Rn,this.anchorPosition=new _.Vector3,this.stemNormal=new _.Vector3,this.stemLength=J.ZP.stem.length,this.stemEnabled=!0,this.created=new Date,this.modified=new Date,this.lastCommentMs=(new Date).getTime(),this.resolved=!1,this.user=(0,W.Q)(""),this.comments=(0,K.C)([]),e&&Object.assign(this,e)}copy(e){return this.id=e.id,this.user=e.user,this.resolved=e.resolved,this.color=e.color,this.floorId=e.floorId,this.roomId=e.roomId,this.anchorPosition.copy(e.anchorPosition),this.stemNormal.copy(e.stemNormal),this.stemLength=e.stemLength,this.stemEnabled=e.stemEnabled,this.created.setTime(e.created.getTime()),this.modified.setTime(e.modified.getTime()),this.lastCommentMs=e.lastCommentMs,this.comments.replace(e.comments.values()),this.commit(),this}getComment(e){return this.comments.find((t=>t.id===e))||null}updateComment(e){const t=this.comments.findIndex((t=>t.id===e.id));-1!==t&&(e.assetId=this.id,this.comments.update(t,e))}deleteComment(e){const t=this.comments.findIndex((t=>t.id===e));-1!==t&&this.comments.splice(t,1)}}var q=i(67992),Z=i(15637);class Q extends q.V{constructor(e){super(),this.name="notes-data",this.notes=(0,Z.q)(e)}iterate(e){for(const t of this.notes)e(t)}updateNote(e){this.notes.has(e.id)?this.notes.get(e.id).copy(e):this.notes.set(e.id,e)}updateNoteProperties(e,t){if(this.notes.has(e)){const i=this.notes.get(e);let n=!1;void 0!==t.resolved&&t.resolved!==i.resolved&&(i.resolved=t.resolved,n=!0),void 0!==t.color&&t.color!==i.color&&(i.color=t.color,n=!0),void 0!==t.anchorPosition&&t.anchorPosition!==i.anchorPosition&&(i.anchorPosition=t.anchorPosition,n=!0),void 0!==t.stemNormal&&t.stemNormal!==i.stemNormal&&(i.stemNormal=t.stemNormal,n=!0),void 0!==t.stemLength&&t.stemLength!==i.stemLength&&(i.stemLength=t.stemLength,n=!0),void 0!==t.stemEnabled&&t.stemEnabled!==i.stemEnabled&&(i.stemEnabled=t.stemEnabled,n=!0),void 0!==t.floorId&&t.floorId!==i.floorId&&(i.floorId=t.floorId,n=!0),void 0!==t.roomId&&t.roomId!==i.roomId&&(i.roomId=t.roomId,n=!0),n&&i.commit()}}removeNote(e){this.notes.has(e)&&(this.notes.delete(e),this.commit())}getNote(e){return this.notes.get(e)}getNoteProperties(e){const t=this.notes.get(e);if(!t)return null;return Object.assign({},t)}get collection(){return this.notes}}var X=i(66291),ee=i(10359),te=i(24696),ie=i(35004),ne=i(17788),se=i(95548),ae=i(97998),oe=i(63665),re=i(65222),de=i(40731),le=i(2569);const he=new ae.Z("mds-note-serialize");class ce{constructor(){this.getNoteDetails=(e,t,i)=>{const n={enabled:!0,floorId:"",roomId:void 0};void 0!==e.floorId&&""!==e.floorId&&(n.floorId=e.floorId),void 0!==e.roomId&&""!==e.roomId&&(n.roomId=e.roomId),void 0!==e.color&&""!==e.color&&(n.color=e.color),void 0!==e.stemEnabled&&(n.stemEnabled=e.stemEnabled),void 0!==e.stemLength&&(n.stemLength=e.stemLength),void 0!==e.anchorPosition&&(0,de.u)(e.anchorPosition)&&(n.anchorPosition=le.ep.toVisionVector(e.anchorPosition)),void 0!==e.stemNormal&&(0,de.u)(e.stemNormal)&&(n.stemNormal=le.ep.toVisionVector(e.stemNormal)),void 0!==e.resolved&&(n.resolution=e.resolved?o.d7.RESOLVED:o.d7.OPEN),i&&e.layerId&&(n.layerId=e.layerId);const s={text:t};return n.comment=s,Object.keys(n).length>0?n:null},this.validate=e=>{if(!e)return!1;const t=["floorId","roomId","enabled"].filter((t=>!(t in e))),i=0===t.length,n=!!e.floorId&&"string"==typeof e.floorId,s=!!e.anchorPosition&&(0,de.u)(e.anchorPosition),a=i&&n&&s;return a||he.debug("Note invalid:",{missingFields:t,validPosition:s}),a}}serialize(e,t,i){const n=this.getNoteDetails(e,t,i);return this.validate(n)?n:null}}class me{constructor(){this.getNotePatch=(e,t)=>{if(!e)return null;const i={};return void 0!==e.floorId&&""!==e.floorId&&(i.floorId=e.floorId),void 0!==e.roomId&&""!==e.roomId&&(i.roomId=e.roomId),void 0!==e.color&&""!==e.color&&(i.color=e.color),void 0!==e.stemEnabled&&(i.stemEnabled=e.stemEnabled),void 0!==e.stemLength&&(i.stemLength=e.stemLength),void 0!==e.anchorPosition&&(0,de.u)(e.anchorPosition)&&(i.anchorPosition=le.ep.toVisionVector(e.anchorPosition)),void 0!==e.stemNormal&&(0,de.u)(e.stemNormal)&&(i.stemNormal=le.ep.toVisionVector(e.stemNormal.normalize())),t&&e.layerId&&(i.layerId=e.layerId),Object.keys(i).length>0?i:null},this.validate=e=>{if(!e)return!1;const t=["floorId","roomId","color","anchorPosition","stemNormal","stemLength","stemEnabled","stemNormal","enabled"];return Object.keys(e).every((e=>t.includes(e)))}}serialize(e,t){const i=this.getNotePatch(e,t);return i&&this.validate(i)?i:null}}var ue=i(9133),pe=i(37519);function ge(e){const t=Object.assign({modelAccess:o.x6.PUBLIC},e);return t.__typename&&delete t.__typename,t}const ve=new ae.Z("mds-note-deserializer");class ye{constructor(e,t){this.commentDeserializer=e,this.userData=t,this.validate=e=>{if(!e)return!1;const t=["id","created","modified","floor","resolution"].filter((t=>!(t in e))),i=0===t.length,n=!(!e.floor||!e.floor.id);return i&&n||ve.debug("Note invalid:",{missingFields:t,validFloor:n}),i&&n}}deserialize(e){var t;if(!e||!this.validate(e)||!e.floor)return ve.debug("Deserialized invalid Note data from MDS",e),null;const i=new Y;i.id=e.id,i.layerId=(null===(t=e.layer)||void 0===t?void 0:t.id)||"",i.floorId=e.floor.id,e.room&&e.room.id&&(i.roomId=e.room.id),i.resolved=e.resolution===o.d7.RESOLVED,i.created=(0,ue.p)(e.created),i.modified=(0,ue.p)(e.modified),i.user=this.userData.loadContributor(ge(e.createdBy)),i.lastCommentMs=(0,ue.p)(e.lastCommentAt).getTime();const n=this.deserializeComments(e);if(!(n.length>0))return ve.error("Note without a comment:",i.id),null;i.comments.replace(n),e.color&&(i.color=e.color);const s=e.anchorPosition?le.ep.fromVisionVector(e.anchorPosition):void 0;s&&(i.anchorPosition=s),(0,pe.hj)(e.stemLength)&&(i.stemLength=e.stemLength);const a=e.stemNormal?le.ep.fromVisionVector(e.stemNormal):void 0;return a?(i.stemNormal=a,i.stemEnabled=!!e.stemEnabled):(i.stemNormal=new _.Vector3(0,0,0),i.stemEnabled=!!e.stemEnabled),i}deserializeComments(e){var t;const i=(null===(t=e.comments)||void 0===t?void 0:t.results)||[],n=[];return i.forEach((t=>{const i=this.commentDeserializer.deserialize(t);i&&(i.assetId=e.id,n.push(i))})),n}}class we{constructor(){this.validate=e=>!!e}serialize(e){if(void 0===e.text)return null;const t={text:e.text};return t&&this.validate(t)?t:null}}class fe extends $.T{constructor(e){super(),this.id="",this.assetId="",this.text="",this.user=(0,W.Q)(""),this.created=new Date,this.modified=new Date,this.edited=!1,this.attachments=(0,K.C)([]),e&&Object.assign(this,e)}copy(e){return this.id=e.id,this.user=e.user,this.assetId=e.assetId,this.created.setTime(e.created.getTime()),this.modified.setTime(e.modified.getTime()),this.text=e.text,this.edited=e.edited,this.attachments=e.attachments,this.commit(),this}}const be=new ae.Z("mds-comment-deserializer");class Te{constructor(e,t,i){this.fileDeserializer=e,this.embedDeserializer=t,this.userData=i}deserialize(e){if(!e||!this.validate(e))return be.debug("Deserialized invalid Comment data from MDS",e),null;const t=new fe;t.id=e.id,t.created=(0,ue.p)(e.created),t.modified=(0,ue.p)(e.modified),e.text&&(t.text=e.text),t.edited=e.edited,t.user=this.userData.loadContributor(ge(e.createdBy));const i=this.deserializeExternalAttachments(e),n=this.deserializeFileAttachments(e),s=i.concat(n).sort(((e,t)=>e.created.getTime()-t.created.getTime()));return s.length>0&&t.attachments.replace(s),t}deserializeExternalAttachments(e){const t=e.externalAttachments||[],i=[];return t.forEach((t=>{const n=this.embedDeserializer.deserialize(t);n&&(n.parentId=e.id,n.parentType=o.ud.COMMENT,i.push(n))})),i}deserializeFileAttachments(e){const t=e.fileAttachments||[],i=[];return t.forEach((t=>{const n=this.fileDeserializer.deserialize(t);n&&(n.parentId=e.id,n.parentType=o.ud.COMMENT,i.push(n))})),i}validate(e){if(!e)return!1;const t=["id","created","modified","edited","createdBy"].filter((t=>!(t in e))),i=0===t.length;return i||be.debug("Comment invalid:",{missingFields:t}),i}}var De=i(44571),Ce=i(36159);const Pe=new ae.Z("MdsNoteStore");class Ae extends ne.u{constructor(e,t){super(e),this.userData=t,this.prefetchKey="data.model.notes",this.layeredType=o.SF.NOTE,this.embedDeserializer=new oe.d,this.fileDeserializer=new re.O,this.commentDeserializer=new Te(this.fileDeserializer,this.embedDeserializer,this.userData),this.deserializer=new ye(this.commentDeserializer,this.userData),this.createSerializer=new ce,this.patchSerializer=new me,this.commentSerializer=new we}async read(e){const t={modelId:this.getViewId(),ids:null,includeLayers:this.readLayerId()};return this.query(De.GetNotes,t,e).then((e=>{var t,i;const n=null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.notes;if(!n||!Array.isArray(n))return{};const s=[];for(const e of n){const t=this.deserializer.deserialize(e);t&&s.push(t)}return s.reduce(((e,t)=>(e[t.id]=t,e)),{})}))}async readNote(e,t){const i={modelId:this.getViewId(),ids:[e],includeLayers:this.readLayerId()};return this.query(De.GetNotes,i,t).then((e=>{var t,i;const n=null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.notes;return n&&Array.isArray(n)&&1===n.length?this.deserializer.deserialize(n[0]):null}))}async create(e,t){var i;const n=this.getViewId(),s=this.createSerializer.serialize(e,t,this.writeLayerId(e.layerId));if(!s)throw Pe.error("Failure creating note:",e.id,e),new Error("Could not create Note");const a={modelId:n,data:s,includeLayers:this.readLayerId()},o=await this.mutate(De.AddNote,a).catch((e=>{throw new se.w0(e)}));if(null===(i=o.data)||void 0===i?void 0:i.addNote){const e=this.deserializer.deserialize(o.data.addNote);if(e)return e.layerId&&await this.context.updateForAutoProvisionedLayer(e.layerId),e}throw new Error("Unable to create new Note")}async update(e){const t=this.getViewId(),i=e.id,n=this.patchSerializer.serialize(e,!1);if(!n||!i)throw Pe.error("Failure updating note:",i),new Error("Could not update Note");const s={modelId:t,noteId:i,data:n,includeLayers:this.readLayerId()};return this.mutate(De.PatchNote,s).then((e=>{var t,i;return(null===(t=e.data)||void 0===t?void 0:t.patchNote)?this.deserializer.deserialize(null===(i=e.data)||void 0===i?void 0:i.patchNote):null}))}async updateResolution(e,t){const i={modelId:this.getViewId(),noteId:e};return t?this.mutate(De.ResolveNote,i).then((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t.resolveNote})):this.mutate(De.ReopenNote,i).then((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t.reopenNote}))}async delete(e){const t=this.getViewId();for(const i of e)await this.mutate(De.DeleteNote,{modelId:t,noteId:i.id})}async createComment(e,t){const i=this.getViewId(),n=this.commentSerializer.serialize(t);if(!n)throw Pe.error("Failure creating comment:",t),new Error("Could not create Comment");const s={modelId:i,noteId:e,data:n};return this.mutate(De.AddNoteComment,s).then((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.addNoteComment)?this.commentDeserializer.deserialize(e.data.addNoteComment):null}))}async updateComment(e){const t=this.getViewId(),i=e.id,n=this.commentSerializer.serialize(e);if(!n||!i)throw Pe.error("Failure updating comment:",i),new Error("Could not update Comment");const s={modelId:t,commentId:i,data:n};return this.mutate(Ce.PatchComment,s).then((e=>{var t,i;return(null===(t=e.data)||void 0===t?void 0:t.patchComment)?this.commentDeserializer.deserialize(null===(i=e.data)||void 0===i?void 0:i.patchComment):null}))}async deleteComment(e){const t=this.getViewId();if(!e||!(null==e?void 0:e.id))throw new Error("MdsNoteStore.deleteComment failed");const i={modelId:t,commentId:e.id};await this.mutate(Ce.DeleteComment,i)}}var Ie=i(54244),Ee=i(89570),Se=i(71166),ke=i(56163),Ne=i(35221);class Oe extends ke.K{constructor(e,t,i,n,s,a,r){super(e,t,i),this.comment=n,this.note=s,this.textParser=a,this.asWholeNote=r,this.id=this.comment.id,this.parentId=this.note.id,this.title=this.comment.user.name,this.description=this.textParser.getPlainText(this.comment.text),this.icon="icon-comment",this.typeId=o.SF.NOTE,this.floorId=this.note.floorId,this.layerId=this.note.layerId,this.dateBucket=this.getNoteOrCommentDateBucket(),this.color=this.note.color,this.resolved=this.note.resolved,this.numAttachments=this.comment.attachments.length,this.numComments=this.note.comments.length,this.user=this.comment.user,this.enabled=!this.note.resolved,this.onSelect=async(e,t,i)=>{super.onSelect(),await this.commandBinder.issueCommand(new V.yL);const n=t===u.w1.NOTES||i||e;this.commandBinder.issueCommand(new te.yP(this.note.id,n,!1,this.comment.id))}}supportsLayeredCopyMove(){return!0}supportsBatchDelete(){return!0}getNoteOrCommentDateBucket(){return(0,Ne.f)(new Date(this.asWholeNote?this.note.lastCommentMs:this.comment.created))}}var Me=i(38399);const{NOTES:xe}=Me.Z.SHOWCASE;var Re=i(635),Ve=i(79728),Be=i(28022);class Le extends n.Y{constructor(){super(...arguments),this.name="notes",this.activated=!1,this.registered=!1,this.activeBindings=[],this.refreshPromise=null,this.pollOnNotes=()=>{let e;return(0,a.k1)((()=>{clearInterval(e),e=window.setInterval((()=>{this.refreshNotes()}),1e3*J.GR)}),(()=>{window.clearInterval(e)}),!0)},this.modelViewChanged=()=>{this.cancelNoteCreation(!0)},this.updatePerSettings=()=>{const e=this.settingsData.tryGetProperty(J.Mp,!1),t=!this.in360View(),i=!this.interactionmodeData.isVR(),n=t&&i&&e,s=n?this.getFilteredNoteIds(!1):[];this.engine.commandBinder.issueCommand(new O.kb(M.Er.NOTE,n?1:0,s)),n||this.closeNoteBillboard()},this.toggleNotesMode=async e=>{e.opened?this.activateTool():this.deactivateTool()},this.togglePinAssetEditor=async e=>{this.viewData.setActiveNotation(null),e.opened?this.changeNotesPhase(G.U.EDITING):this.viewData.notesPhase===G.U.EDITING&&this.changeNotesPhase(G.U.OPEN)},this.toggleNotesFilter=async e=>{const{filter:t,enabled:i}=e;i?this.viewData.setNotesFilter(t):this.viewData.setNotesFilter(z.$.ALL)},this.openNoteToComment=async e=>{const{noteId:t,commentId:i,dock:n,edit:s,transition:a}=e,o=this.viewData,r=o.getNoteView(t);if(!r)return void this.log.error(`Missing note ${t}`);const{notesFilter:d}=o,l=d===z.$.RESOLVED;d!==z.$.ALL&&r.resolved!==l&&o.setNotesFilter(z.$.ALL);const c=n||s,m=this.toolsData.toolPanelLayout===u.wS.SIDE_PANEL?h.n.FadeToBlack:h.n.Instant;await this.openNote(t,a||m,c,i,s),this.openAnnotation(t,c)},this.onAppChange=()=>{this.deactivateTool(),this.updatePerSettings(),this.displayNotes()},this.onNotesPhaseChanged=()=>{let e=!0;const t=this.toolsData.toolPanelLayout===u.wS.BOTTOM_PANEL;switch(this.viewData.notesPhase){case G.U.EDITING:case G.U.CREATING:e=!1;break;case G.U.OPENING:case G.U.OPEN:e=!t}this.engine.broadcast(new p.ps(e))},this.changeNotesPhase=e=>{e!==this.viewData.notesPhase&&this.viewData.setNotesPhase(e)},this.onCloseNote=async()=>{this.closeNote()},this.pinAddCancelled=e=>{e.pinType===M.Er.NOTE&&this.cancelNoteCreation(!1)},this.onCancelNewNote=async()=>{this.cancelNoteCreation(!0)},this.cancelNoteCreation=e=>{var t;if(!this.userData.isCommenter())return;const i=this.viewData,n=null===(t=i.openNoteView)||void 0===t?void 0:t.id;n&&(e&&this.engine.commandBinder.issueCommand(new O.tT(n,M.Er.NOTE)),this.engine.commandBinder.issueCommand(new V.Aj(n,B.J.NOTE))),this.cancelAttachmentChanges(),i.setActiveNotation(null),i.setOpenNoteView(null),i.setFocusedComment(null),i.isNewNote=!1,i.commit(),this.changeNotesPhase(G.U.IDLE)},this.notesWereChanged=()=>{this.parseNotes(),this.updateNoteViewData(),this.displayNotes()},this.onNoteFilterChanged=()=>{this.viewData.setOpenNoteView(null),this.viewData.setFocusedComment(null),this.updateNoteViewData(),this.displayNotes()},this.onViewModeOrFloorChanged=()=>{this.updatePerSettings()},this.onLayersChanged=()=>{this.closeNoteBillboard(),this.displayNotes()},this.onOpenNoteViewChanged=()=>{const e=this.viewData.openNoteView;e&&this.updateNotePin(e)},this.startNoteCreation=async()=>{if(!this.userData.isCommenter())return;this.toolsData.softOpening&&await this.engine.commandBinder.issueCommand(new g.z2(u.w1.NOTES,!1));const e=this.viewData,t=this.appData.application===Ie.Mx.WORKSHOP;let i=(0,l.O1)(11);for(;this.notesData.getNote(i);)i=(0,l.O1)(11);const n=new Y;n.user=this.userData.getCurrentUser(),n.id=i,n.floorId=this.floorsViewData.getHighestVisibleFloorId(),n.layerId=this.layersData.getNotesLayerId(t);const s=e.createNoteView(n);e.isNewNote=!0,e.commit(),this.changeNotesPhase(G.U.CREATING),e.setOpenNoteView(s),e.setFocusedComment(null),this.engine.commandBinder.issueCommand(new O.fM(n.id,this.getPinUpdate(n),M.Er.NOTE,s.backgroundTexture))},this.saveNewNote=async e=>{if(!this.userData.isCommenter())return;const{text:t}=e,i=this.viewData,n=i.getPendingNote();if(n){if(this.layersData.isInMemoryLayer(n.layerId)){const e=new Y(n);return this.notesData.updateNote(e),i.setActiveNotation(null),i.isNewNote=!1,i.commit(),void this.updateNoteViewData()}const e=await this.store.create(n,t);if(!e)return void this.log.error("MDS Note saved failed");const s=e.comments.get(0);if(!s)throw new Error("No root comment in the new note");const a=await this.confirmAttachmentChanges(s.id,n.id);this.notesData.updateNote(e),a&&await this.refreshNote(e.id),this.parseMarkdown(t),i.setOpenNoteView(i.getNoteView(e.id));const o=i.openNoteView;if(o){const t=(0,H.CM)(this.userData,B.J.NOTE,o.user);this.engine.commandBinder.issueCommand(new O.Ar(e.id,M.Er.NOTE,t)),this.engine.commandBinder.issueCommand(new O.OL(n.id,M.Er.NOTE))}i.setActiveNotation(null),i.isNewNote=!1,i.commit(),this.updateNoteViewData()}else this.log.debug("No pending note")},this.pinMoved=async e=>{const{id:t,pinType:i,pinPos:n}=e,s=this.viewData.openNoteView;if(s&&i===M.Er.NOTE&&t===s.id){const e=this.notesData.getNote(t);if(e){if(this.layersData.isInMemoryLayer(e.layerId))return;const{anchorPosition:i,stemNormal:s,floorId:a,roomId:o}=n;this.store.update({id:t,anchorPosition:i,stemNormal:s,floorId:a,roomId:o}).then((e=>{e&&this.notesData.updateNote(e)}))}else this.log.debug("Cannot move a non-existent note")}},this.pinPlaced=e=>{const t=this.viewData.openNoteView;t&&e.pinType===M.Er.NOTE&&e.id===t.id&&(this.viewData.updateOpenNoteView(e.pinPos),this.changeNotesPhase(G.U.OPEN),this.viewData.setActiveNotation(t.id),this.openAnnotation(t.id,!0))},this.onEditComment=async e=>{this.viewData.setActiveNotation(e.id)},this.handlePinFocusChange=async()=>{const{openNoteView:e,isNewNote:t}=this.viewData;if(t)return;const{commandBinder:i}=this.engine,{focusedPin:n,selectedPinId:s}=this.pinsViewData,{billboardAnnotation:a,billboardSelected:o}=this.annotationsViewData;if(!n)return void(a&&a.annotationType===B.J.NOTE&&a.id!==s&&this.closeNoteBillboard());const r=(null==e?void 0:e.id)===(null==a?void 0:a.id)&&o,d=e&&(null==e?void 0:e.id)===(null==n?void 0:n.id);if(e&&r&&!d&&this.closeNote(),n.pinType===M.Er.NOTE){const t=this.viewData.getNoteView(n.id);if(!t)return void this.log.debug("Focused pin changed, but no note view.");t.id!==(null==e?void 0:e.id)&&i.issueCommand(new V.Kw(t.id,B.J.NOTE))}},this.handleAnnotationsChanged=async()=>{const{openNoteView:e,isNewNote:t,focusedComment:i}=this.viewData;if(t)return;const{dockedAnnotation:n,selectedAnnotation:s}=this.annotationsViewData,a=n||s,o=(null==n?void 0:n.annotationType)===B.J.NOTE&&n,r=(null==s?void 0:s.annotationType)===B.J.NOTE&&s,d=o||r,l=!!o;d&&d.id!==(null==e?void 0:e.id)?await this.openNote(d.id,null,l):e&&e.id!==(null==a?void 0:a.id)&&this.closeNote(),l?(this.activated||await this.engine.commandBinder.issueCommand(new g.z2(u.w1.NOTES,!0)),i&&this.engine.broadcast(new ie.J(i.id))):this.toolsData.softOpening&&await this.engine.commandBinder.issueCommand(new g.CH(u.w1.NOTES))},this.handlePinSelectionChange=async()=>{const{openNoteView:e,activeNotation:t}=this.viewData,{selectedPinId:i}=this.pinsViewData;if(t||(null==e?void 0:e.id)===i)return;const n=i?this.pinsViewData.getPin(i):null;if(!e||n&&n.pinType===M.Er.NOTE){if(i&&n&&n.pinType===M.Er.NOTE){const e=!0;await this.openNote(i,h.n.Interpolate,e),this.openAnnotation(i,e)}}else{const e=!this.toolsData.softOpening;this.activated&&!e?this.deactivateTool():this.closeNote()}},this.handleViewingAttachment=e=>{const{annotationType:t,id:i,attachmentId:n}=e;if(t!==B.J.NOTE)return;const s=this.viewData.getNoteAttachments(i),a=s.find((e=>e.id===n));if(a&&(0,U.lV)(a)){const e=s.filter((e=>(0,U.lV)(e)));this.engine.commandBinder.issueCommand(new j.xW(!0,e,n))}},this.deleteNote=async e=>{const t=e.noteId,i=this.notesData.getNote(t);if(i){this.engine.commandBinder.issueCommand(new y.rE),this.layersData.isInMemoryLayer(i.layerId)||this.store.delete([i]),this.notesData.removeNote(t);const e=this.viewData.openNoteView;e&&e.id===t&&this.closeNote(),this.engine.commandBinder.issueCommand(new O.OL(t,M.Er.NOTE))}else this.log.debug("Cannot delete a non-existent note")},this.onResolveNoteCommand=async e=>{const{noteId:t,resolved:i}=e;i?await this.resolveNote(t):await this.reopenNote(t)},this.onSaveNoteChanges=async e=>{const{noteId:t,text:i}=e,n=this.notesData.getNote(t);if(n){const e=n.comments.get(0);if(e)return this.updateNoteComment(t,e.id,i);this.log.warn("no root comment")}else this.log.debug("Cannot update a non-existent note")},this.cancelCommentChanges=async e=>{this.cancelAttachmentChanges(),this.viewData.setActiveNotation(null)},this.saveNoteAppearance=async e=>{const t=this.notesData,{noteId:i,properties:n}=e,s=t.getNote(i);if(s){const e=this.viewData,{openNoteView:a}=e;if(Object.keys(n)){const o=this.layersData.isInMemoryLayer(s.layerId)?Object.assign(s,n):await this.store.update(Object.assign({id:i},n));o&&(this.updateNotePin(o),t.updateNote(o),(null==a?void 0:a.id)===i&&e.updateOpenNoteView(n))}}else this.log.debug("Cannot update a non-existent note")},this.addComment=async e=>{const{noteId:t,text:i,replyId:n}=e,s=this.notesData.getNote(t);if(s){s.resolved&&(this.viewData.setNotesFilter(z.$.ALL),this.reopenNote(s.id));const e=await this.store.createComment(t,{text:i});return e?(this.viewData.setActiveNotation(null),this.parseMarkdown(i),await this.confirmAttachmentChanges(e.id,n),await this.refreshNote(s.id),this.refreshNotes(),e):(this.log.error("Cannot create MDS comment"),null)}return this.log.debug("Cannot add a comment to a non-existent note"),null},this.onUpdateComment=async e=>{const{noteId:t,commentId:i,text:n}=e;return this.updateNoteComment(t,i,n)},this.deleteComment=async e=>{const{commentId:t,noteId:i}=e,n=this.notesData.getNote(i);if(n){const e=n.getComment(t);e&&(this.layersData.isInMemoryLayer(n.layerId)||await this.store.deleteComment(e),n.deleteComment(t)),this.refreshNotes()}else this.log.debug("Cannot delete a comment in a non-existent note")},this.notationBlockClicked=async e=>{const{annotationType:t,block:i}=e;t===B.J.NOTE&&(i.blockType!==m.C.USER&&i.blockType!==m.C.HASH||(this.activated&&!this.toolsData.softOpening||await this.engine.commandBinder.issueCommand(new g.z2(u.w1.NOTES,!1)),this.engine.commandBinder.issueCommand(new Se.H1(i.text||"")),i.text&&this.closeNote()))},this.filterVisibleNotes=async e=>{const{idVisibility:t}=this.viewData;t.clear(),e.ids.forEach((e=>t.add(e))),this.viewData.commit(),this.displayNotes()},this.noteVisbilityFilterEnabled=async e=>{this.viewData.idVisibilityEnabled=e.enabled,this.viewData.commit(),this.displayNotes()}}async init(e,t){const[i,n,a,l]=await Promise.all([t.market.waitForData(P.e),t.market.waitForData(A.Z),t.market.waitForData(w.m),t.market.waitForData(Ie.pu)]);if(!a.isLoggedIn()||n.isVR()||!i.tryGetProperty(J.IA,!1))return;this.engine=t,this.config=e,this.interactionmodeData=n,this.userData=a,this.settingsData=i,this.appData=l;const[h,m,u,p,g,y,f]=await Promise.all([t.market.waitForData(v.t),t.market.waitForData(D.Z),t.market.waitForData(C.O),t.market.waitForData(I.c),t.market.waitForData(L.A),t.getModuleBySymbol(s.y.DEEP_LINKS),t.market.waitForData(E.R)]);this.toolsData=h,this.sweepData=m,this.viewmodeData=u,this.floorsViewData=p,this.annotationsViewData=g,this.linkHandler=y,this.layersData=f;const{readonly:b,baseUrl:N}=this.config;this.store=new Ae({context:f.mdsContext,readonly:b,includeDisabled:!0,baseUrl:N},this.userData);const O=()=>{this.store.setStoreViewId(f.getNonworkshopViewId())};O(),this.bindings.push(this.store.onNewData(this.loadNewNotes.bind(this)),f.onPropertyChanged("currentViewId",O),f.onPropertyChanged("activeLayerId",(()=>this.updatePendingNote()))),this.notesData=new Q({}),this.textParser=new c.v({links:!0,hashtags:!0,users:this.userData}),this.backgroundTexture=(0,r.p)(d),this.viewData=new X.X(this.notesData,this.textParser,this.linkHandler,this.backgroundTexture),this.hashtagData=new ee.c,t.market.register(this,ee.c,this.hashtagData),this.pinsViewData=await t.market.waitForData(x.B),this.bindings.push(i.onPropertyChanged(J.Mp,this.updatePerSettings),t.commandBinder.addBinding(te.yK,this.toggleNotesMode),t.commandBinder.addBinding(te.sG,this.modifyInsideSaveCommand(this.deleteNote)),this.pinsViewData.onFocusedPinChanged(this.handlePinFocusChange),this.pinsViewData.onSelectedPinChanged(this.handlePinSelectionChange),g.onChanged(this.handleAnnotationsChanged),t.subscribe(F.q,this.handleViewingAttachment),t.subscribe(F.i,this.notationBlockClicked),t.commandBinder.addBinding(te.yP,this.openNoteToComment),t.subscribe(T.bS,this.onAppChange),u.makeModeChangeSubscription(this.onViewModeOrFloorChanged),p.makeFloorChangeSubscription(this.onViewModeOrFloorChanged),t.subscribe(S.Z,this.updatePerSettings),t.subscribe(k.m,this.updatePerSettings),this.layersData.onCurrentLayersChanged(this.onLayersChanged),t.commandBinder.addBinding(te.Gx,this.filterVisibleNotes),t.commandBinder.addBinding(te.GV,this.noteVisbilityFilterEnabled),this.pollOnNotes(),this.viewData.onOpenNoteViewChanged(this.onOpenNoteViewChanged),this.notesData.onChanged(this.notesWereChanged),this.notesData.collection.onElementChanged({onAdded:this.updateNotePin.bind(this),onUpdated:this.updateNotePin.bind(this),onRemoved:this.removeNotePin.bind(this)}),t.subscribe(Be.YB,this.modelViewChanged)),t.market.register(this,X.X,this.viewData),this.updatePerSettings(),this.parseNotes(),async function(e,t,i,n,s,a,r){let d=n.application===Ie.Mx.WORKSHOP;const l=(n,a,o,r=[])=>{const l=[],h=t.getFilteredNotesMap().values,c=!o,m=[];return 0===r.length&&h.forEach((t=>{if(!d&&!i.layerToggled(t.layerId))return;let o=0;t.comments.forEach(((r,d)=>{c&&d>0||n(r.user.name,s.getPlainText(r.text))&&(o++,l.push(new Oe(e,i,a,r,t,s,c)))})),o>0&&m.push(t.id)})),e.issueCommand(new te.Gx(m)),l},h=t=>{e.issueCommand(new te.GV(!!t))},c=e=>new Ee.V(t.getFilteredNotesMap().onChanged(e),a.onChanged(e)),m={renew:()=>{e.issueCommandWhenBound(new Se.c6({id:o.SF.NOTE,groupPhraseKey:xe.SEARCH_GROUP_HEADER_NOTES,groupMatchingPhraseKey:xe.SEARCH_GROUP_HEADER,getSimpleMatches:l,registerChangeObserver:c,onSearchActivatedChanged:h,groupOrder:50,groupIcon:"comment-outline"}))},cancel:()=>{e.issueCommandWhenBound(new Se.Pe(o.SF.NOTE))}},u=()=>{d=n.application===Ie.Mx.WORKSHOP,r.tryGetProperty(J.IA,!1)||d?m.renew():m.cancel()},p=n.onPropertyChanged("application",u),g=r.onPropertyChanged(J.IA,u);return u(),new Ee.V(m,p,g)}(t.commandBinder,this.viewData,this.layersData,l,this.textParser,this.userData,this.settingsData).then((e=>this.bindings.push(e))),await this.refreshNotes(),t.market.register(this,Q,this.notesData)}dispose(e){this.deactivateTool(),this.bindings.forEach((e=>{e.cancel()})),this.bindings=[],this.activeBindings=[],this.engine.commandBinder.issueCommand(new O.zM(M.Er.NOTE)),this.backgroundTexture.dispose(),this.store.dispose(),super.dispose(e)}onUpdate(){}async refreshNotes(){if(this.refreshPromise)return;const e=this.viewData,{isNewNote:t,notesPhase:i}=e;t||i===G.U.EDITING||(this.refreshPromise=this.store.refresh().finally((()=>{this.refreshPromise=null})))}loadNewNotes(e){var t;const{viewData:i}=this,n=Object.values(e),s=null===(t=i.openNoteView)||void 0===t?void 0:t.id,{collection:a}=this.notesData;this.notesData.atomic((()=>{const t=a.keys.filter((t=>!this.layersData.isInMemoryLayer(a.get(t).layerId)&&!e[t]));t.length&&t.forEach((e=>{e===s&&(this.log.debug("Open note was deleted"),i.setOpenNoteView(null),i.setFocusedComment(null),i.setActiveNotation(null),i.setNotesPhase(G.U.IDLE)),a.delete(e)})),n.length&&n.forEach((e=>{this.notesData.updateNote(e)}))}))}async refreshNote(e){if(this.refreshPromise)return;const t=this.notesData.getNote(e);if(this.layersData.isInMemoryLayer(null==t?void 0:t.layerId))this.notesData.updateNote(t);else{const t=await this.store.readNote(e);t&&this.notesData.updateNote(t)}}activateTool(){this.activated||(this.engine.commandBinder.issueCommand(new V.yL(B.J.NOTE)),this.userData.isCommenter()&&this.engine.commandBinder.issueCommand(new O.Ki(!0)),this.changeNotesPhase(G.U.IDLE),this.updateNoteViewData(),this.registered?this.activeBindings.forEach((e=>{e.renew()})):this.registerHandlers(),this.activated=!0)}deactivateTool(e){var t;if(!this.activated)return;this.engine.commandBinder.issueCommand(new O.iK);const{isNewNote:i,openNoteView:n}=this.viewData,s=(null===(t=this.annotationsViewData.dockedAnnotation)||void 0===t?void 0:t.annotationType)===B.J.NOTE;i?this.cancelNoteCreation(!0):n&&(e||s)&&this.closeNote(),this.changeNotesPhase(G.U.CLOSED),this.engine.commandBinder.issueCommand(new O.Ki(!1)),this.activeBindings.forEach((e=>{e.cancel()})),this.activated=!1}registerHandlers(){const e=this.engine.commandBinder;this.activeBindings.push(this.engine.subscribe(R.b0,this.pinPlaced),this.engine.subscribe(R.bV,this.modifyInsideSaveCommand(this.pinMoved)),this.engine.subscribe(R.hu,this.pinAddCancelled),e.addBinding(te.VI,this.startNoteCreation),e.addBinding(te.FB,this.modifyInsideSaveCommand(this.saveNewNote)),e.addBinding(te.gc,this.onCancelNewNote),e.addBinding(te._N,this.onCloseNote),e.addBinding(te.kd,this.modifyInsideSaveCommand(this.onSaveNoteChanges)),e.addBinding(te.oH,this.cancelCommentChanges),e.addBinding(te.x4,this.onEditComment),e.addBinding(te.yp,this.modifyInsideSaveCommand(this.onResolveNoteCommand)),e.addBinding(te.Df,this.modifyInsideSaveCommand(this.addComment)),e.addBinding(te.Uw,this.modifyInsideSaveCommand(this.onUpdateComment)),e.addBinding(te.mH,this.modifyInsideSaveCommand(this.deleteComment)),e.addBinding(te.oE,this.modifyInsideSaveCommand(this.saveNoteAppearance)),e.addBinding(te.df,this.togglePinAssetEditor),e.addBinding(te.RO,this.toggleNotesFilter),this.viewData.onNotesFilterChanged(this.onNoteFilterChanged),this.viewData.onNotesPhaseChanged(this.onNotesPhaseChanged)),this.registered=!0}async parseNotes(){const e=[],t=[];return this.notesData.iterate((i=>{i.comments.forEach((i=>{const n=this.getUserMentionsAndHashtags(i.text);n.emails.forEach((t=>{e.push({email:t,userStatus:f.J.MENTIONED})})),t.push(...n.hashtags)}))})),this.hashtagData.addHashtags(t),this.engine.commandBinder.issueCommand(new b.Vu(e))}async parseMarkdown(e){const t=[],i=this.getUserMentionsAndHashtags(e);return i.emails.forEach((e=>{t.push({email:e,userStatus:f.J.MENTIONED})})),this.hashtagData.addHashtags(i.hashtags),this.engine.commandBinder.issueCommand(new b.Vu(t))}getUserMentionsAndHashtags(e){const t=[],i=[];for(const n of this.textParser.parse(e))n.blockType===m.C.USER&&n.value?t.push(n.value):n.blockType===m.C.HASH&&i.push(n.text);return{emails:t,hashtags:i}}closeNoteBillboard(){const{billboardAnnotation:e}=this.annotationsViewData;e&&e.annotationType===B.J.NOTE&&this.engine.commandBinder.issueCommand(new V.Aj(e.id,B.J.NOTE))}openAnnotation(e,t){t?this.engine.commandBinder.issueCommand(new V.bd(e,B.J.NOTE)):this.engine.commandBinder.issueCommand(new V.oM(e,B.J.NOTE))}in360View(){const e=this.sweepData.currentSweep?this.sweepData.currentSweep:"";return this.viewmodeData.isInside()&&this.sweepData.isSweepUnaligned(e)}async closeNote(){var e;const{commandBinder:t}=this.engine,{openNoteView:i,notesPhase:n}=this.viewData;if(this.viewData.setActiveNotation(null),this.viewData.setOpenNoteView(null),this.viewData.setFocusedComment(null),n!==G.U.CLOSED&&this.changeNotesPhase(G.U.IDLE),i){const n=i.id;this.cancelAttachmentChanges(),t.issueCommand(new Se.IL(null)),t.issueCommand(new j.xW(!1));const s=this.notesData.getNote(n);s&&(t.issueCommand(new O.RH(n,M.Er.NOTE)),t.issueCommand(new O.ik(n,M.Er.NOTE,this.getNoteVisibility(n,s.layerId,i.resolved))));(null===(e=this.annotationsViewData.dockedAnnotation)||void 0===e?void 0:e.annotationType)===B.J.NOTE&&await t.issueCommand(new V.JD)}}updateNoteViewData(){this.viewData.updateNoteViews()}getFilteredNoteIds(e){const t=[];return this.notesData.iterate((i=>{this.getNoteVisibility(i.id,i.layerId,i.resolved)===e&&t.push(i.id)})),t}getNoteVisibility(e,t,i){const{notesFilter:n,openNoteView:s,idVisibilityEnabled:a,idVisibility:o}=this.viewData,r=this.appData.application===Ie.Mx.WORKSHOP||this.layersData.layerToggled(t),d=this.layersData.layerVisible(t),l=(null==s?void 0:s.id)===e,h=!a||o.has(e),c=n===z.$.ALL||i&&n===z.$.RESOLVED||!i&&n===z.$.OPEN;return r&&(l||c&&h&&d)}displayNotes(){const e=[];this.notesData.iterate((t=>{const i=this.getPinUpdate(t);e.push(i)})),this.engine.commandBinder.issueCommand(new O.mE(e))}updateNotePin(e){const t=this.getPinUpdate(e);this.engine.commandBinder.issueCommand(new O.mE([t]))}getPinUpdate(e){const{id:t,layerId:i,resolved:n,anchorPosition:s,color:a,stemEnabled:o,floorId:r,roomId:d,stemNormal:l,stemLength:h}=e;return{id:t,anchorPosition:s,color:a,floorId:r,roomId:d,stemEnabled:o,stemNormal:l,stemLength:h,pinType:M.Er.NOTE,backgroundTexture:this.backgroundTexture,icon:M.Qk[M.Er.NOTE],visible:this.getNoteVisibility(t,i,n)}}removeNotePin(e){this.engine.commandBinder.issueCommand(new O.OL(e.id,M.Er.NOTE))}async confirmAttachmentChanges(e,t){return this.engine.commandBinder.issueCommand(new j.iu(e,o.ud.COMMENT,t))}async cancelAttachmentChanges(){return this.engine.commandBinder.issueCommand(new j.Ze)}updatePendingNote(){const e=this.viewData.getPendingNote(),t=this.appData.application===Ie.Mx.WORKSHOP;e&&t&&!this.layersData.isInMemoryLayer(e.layerId)&&(e.layerId=this.layersData.getNotesLayerId(t))}setFocusedNoteComment(e,t){if(t){const i=this.viewData.getComment(e,t);this.viewData.setFocusedComment(i)}else this.viewData.setFocusedComment(null)}async openNote(e,t,i,n,s){var a;const r=(null===(a=this.annotationsViewData.dockedAnnotation)||void 0===a?void 0:a.annotationType)===B.J.NOTE,d=null!==i?i:r;return this.engine.commandBinder.issueCommand(new Se.IL(e,o.SF.NOTE)),d?this.dockNote(e,t,n,s):this.selectNote(e,t,n)}async selectNote(e,t,i){var n;const{commandBinder:s}=this.engine;this.setFocusedNoteComment(e,i);const a=this.viewData.getNoteView(e);if(a){const{openNoteView:i}=this.viewData,o=(null==i?void 0:i.id)===e,r=(null===(n=this.annotationsViewData.dockedAnnotation)||void 0===n?void 0:n.id)===e;if(o&&!r&&i)return void this.log.debug("Note is already selected");this.activated&&await s.issueCommand(new g.CH(u.w1.NOTES)),s.issueCommand(new j.xW(!1)),i&&(s.issueCommand(new V.Aj(i.id,B.J.NOTE)),s.issueCommand(new O.RH(i.id,M.Er.NOTE))),this.viewData.setOpenNoteView(a),await s.issueCommand(new O.Ar(e,M.Er.NOTE,!1)),null!==t&&await s.issueCommand(new N.OR({pinPosition:a,transition:t}))}else this.log.debug("Cannot select a non-existent note")}async dockNote(e,t,i,n=!1){var s;const{toolsData:a,viewData:o,engine:r,activated:d,userData:l}=this,h=o.getNoteView(e);if(h){const{openNoteView:c,focusedComment:m}=this.viewData,p=(null==c?void 0:c.id)===e,v=(null===(s=this.annotationsViewData.dockedAnnotation)||void 0===s?void 0:s.id)===e;if(a.toolCollapsed&&r.commandBinder.issueCommand(new g.Fg(!1)),this.setFocusedNoteComment(e,i),p&&v)return void(o.focusedComment&&i!==(null==m?void 0:m.id)&&this.engine.broadcast(new ie.J(o.focusedComment.id)));r.commandBinder.issueCommand(new y.rE),d||await r.commandBinder.issueCommand(new g.z2(u.w1.NOTES,!0)),p||o.setOpenNoteView(h);const w=(0,H.CM)(l,B.J.NOTE,h.user);if(r.commandBinder.issueCommand(new O.Ar(e,M.Er.NOTE,w)),this.changeNotesPhase(G.U.OPENING),null!==t&&await r.commandBinder.issueCommand(new N.OR({pinPosition:h,transition:t})),this.changeNotesPhase(G.U.OPEN),n){const t=h.comments.get(0);let n=i?o.getComment(e,i):void 0;if(n||(n=t),!n)throw new Error("No root comment in the note");const s=(0,H.CM)(l,B.J.NOTE,n.user);o.setActiveNotation(s?n.id:null)}else o.setActiveNotation(null)}else this.log.debug("Cannot open a non-existent note")}async resolveNote(e){const t=this.notesData.getNote(e);if(t){if(t.resolved)return;this.closeNote(),await(0,l.gw)(350),this.engine.broadcast(new ie.h(e,!0));!!this.layersData.isInMemoryLayer(t.layerId)||await this.store.updateResolution(e,!0)?this.notesData.updateNoteProperties(e,{resolved:!0}):this.log.error("Resolving note failed")}else this.log.debug("Cannot resolve a non-existent note")}async reopenNote(e){const t=this.notesData.getNote(e);if(t){if(!t.resolved)return;this.viewData.updateOpenNoteView({resolved:!1});!!this.layersData.isInMemoryLayer(t.layerId)||await this.store.updateResolution(e,!1)?this.notesData.updateNoteProperties(e,{resolved:!1}):this.log.error("Reopen note failed")}else this.log.debug("Cannot reopen a non-existent note")}modifyInsideSaveCommand(e){return async(...t)=>{await this.engine.commandBinder.issueCommand(new Re.VQ({dataTypes:[Ve.g.NOTES],onCallback:()=>e(...t),skipDirtyUpdate:!0}))}}async updateNoteComment(e,t,i){const n=this.notesData.getNote(e);if(n){const s=this.layersData.isInMemoryLayer(n.layerId),a=n.getComment(t);if(a)if(a.user.id===this.userData.getCurrentUserId()){const r=!s&&await this.confirmAttachmentChanges(t,o.ud.COMMENT),d=i!==a.text;if(d){if(s)a.text=i;else{const e=await this.store.updateComment({id:t,text:i});e&&n.updateComment(e)}this.parseMarkdown(i)}(r||d)&&(await this.refreshNote(n.id),n.resolved&&(this.viewData.setNotesFilter(z.$.ALL),this.reopenNote(e))),this.viewData.setActiveNotation(null)}else this.log.debug("Cannot update another user's comment");else this.log.debug("Cannot update a non-existent comment")}else this.log.debug("Cannot update a comment in a non-existent note")}}const Fe=Le},48072:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>ue});var n=i(97542),s=i(69170),a=i(81396),o=i(5823),r=i(635),d=i(79728),l=i(64918),h=i(12039),c=i(62612),m=i(72936),u=i(60083),p=i(43470),g=i(16935),v=i(5666),y=i(59512),w=i(54244),f=i(89570),b=i(71166),T=i(56163),D=i(35221);class C extends T.K{constructor(e,t,i,n,s){var a,r,d;super(e,t,i),this.suggestion=n,this.mattertag=s,this.id=this.suggestion.id,this.title=this.suggestion.displayLabel,this.description=this.suggestion.displayCategory,this.icon="icon-simple-tag",this.color=this.suggestion.color,this.enabled=this.suggestion.visible,this.typeId=o.SF.OBJECTANNOTATION,this.floorId=this.suggestion.floorId,this.dateBucket=(0,D.f)(this.suggestion.created),this.layerId=this.suggestion.layerId,this.onSelect=()=>{super.onSelect(),this.commandBinder.issueCommand(new v.w$(this.suggestion.id))},this.title=(null===(a=this.mattertag)||void 0===a?void 0:a.label)?this.mattertag.label:this.suggestion.displayLabel,this.description=(null===(r=this.mattertag)||void 0===r?void 0:r.description)?this.mattertag.description:this.suggestion.displayCategory,this.color=(null===(d=this.mattertag)||void 0===d?void 0:d.color)?`#${this.mattertag.color.getHexString()}`:this.suggestion.color}supportsLayeredCopyMove(){return!0}supportsBatchDelete(){return!0}}var P=i(85893),A=i(67294),I=i(33558),E=i(38399),S=i(66102),k=i(86283),N=i(78116),O=i(36375);const{WORKSHOP:M,HIDE:x,SHOW:R}=E.Z;function V({item:e,onToggle:t}){const{commandBinder:i}=(0,A.useContext)(I.I),n=(0,S.b)(),{enabled:s,id:a,typeId:o}=e,r=!e.isLayerVisible(),d=!s||r?"eye-hide":"eye-show",l=(0,O.k)(),h=r?n.t(M.LAYERS.HIDDEN_LAYER_ITEM_TOOLTIP):s?n.t(x):n.t(R);return(0,P.jsx)(N.zx,{icon:d,dimmed:!s,variant:N.Wu.TERTIARY,onClick:e=>{e.stopPropagation(),r||(s&&l===a&&i.issueCommand(new b.IL(null,o)),t(!s))},tooltip:h})}const{OBJECT_TAG_SUGGESTION:B}=E.Z.WORKSHOP,L=({item:e})=>{const{id:t,typeId:i}=e,{analytics:n,commandBinder:s,editMode:a}=(0,A.useContext)(I.I),r=(0,S.b)();if(!a||i!==o.SF.OBJECTANNOTATION)return null;function d(e){n.track("showcase_gui",{tool:"object_tags",gui_action:e})}return(0,P.jsxs)(N.hE,{children:[(0,P.jsx)(V,{item:e,onToggle:e=>{s.issueCommand(new v.Q_(t,e)),d(e?"object_tags_show_click":"object_tags_hide_click")}}),(0,P.jsxs)(N.xz,Object.assign({icon:"more-vert",menuArrow:!0,menuClassName:"search-result-menu"},{children:[(0,P.jsx)(N.zx,{label:r.t(B.SEARCH_ITEM_EDIT),onClick:()=>{s.issueCommand(new b.IL(t,i)),s.issueCommand(new v.OD(t)),d("object_tags_edit_click")},variant:N.Wu.TERTIARY,size:N.qE.SMALL}),(0,P.jsx)(N.zx,{className:"menu-delete-btn",label:r.t(B.SEARCH_ITEM_DELETE),onClick:()=>{s.issueCommand(new v.SO(t)),s.issueCommand(new m.OL(t,c.Er.OBJECT)),s.issueCommand(new p.Aj(t,k.J.OBJECT)),d("object_tags_delete_click")},variant:N.Wu.TERTIARY,size:N.qE.SMALL})]}))]})};var F=i(27839);const{OBJECT_TAG_SUGGESTION:H}=E.Z.WORKSHOP,j=({group:e})=>{const{analytics:t,commandBinder:i,editMode:n}=(0,A.useContext)(I.I),s=(0,S.b)(),a=(0,F._)(),{matches:o}=e;if(!n)return null;if(0===o.length)return null;const r=o.filter((e=>e.enabled)).length,d=r===o.length,l=0===r;function h(e){t.track("showcase_gui",{tool:"object_tags",gui_action:e})}const c=!a||!a.canBatchDeleteInActiveView();return(0,P.jsx)(N.hE,{children:(0,P.jsxs)(N.xz,Object.assign({icon:"more-vert",menuArrow:!0,menuClassName:"search-result-menu"},{children:[(0,P.jsx)(N.zx,{label:s.t(H.SEARCH_GROUP_HIDE_ALL),onClick:()=>{i.issueCommand(new v.cO(!1,...o.map((e=>e.id)))),h("hide_all_click")},variant:N.Wu.TERTIARY,size:N.qE.SMALL,disabled:l}),(0,P.jsx)(N.zx,{label:s.t(H.SEARCH_GROUP_SHOW_ALL),onClick:()=>{i.issueCommand(new v.cO(!0,...o.map((e=>e.id)))),h("show_all_click")},variant:N.Wu.TERTIARY,size:N.qE.SMALL,disabled:d}),c&&(0,P.jsx)(N.zx,{className:"menu-delete-btn",label:s.t(H.SEARCH_GROUP_DELETE_ALL),onClick:()=>{i.issueCommand(new v.SO(...o.map((e=>e.id)))),h("delete_all_click")},variant:N.Wu.TERTIARY,size:N.qE.SMALL})]}))})};var U=i(69665),G=i(2569),z=i(17788),_=i(95724),$=i(75287),K=i(45611);class W extends $.T{constructor(e){super(),this.created=new Date,this.modified=new Date,this.sweeps=[],this.position=new a.Vector3,this.stemDirection=new a.Vector3,this.stemLength=K.Kn,this.stemEnabled=!1,this.enabled=!0,e&&(Object.assign(this,e),this.keywords=e.keywords||[])}get displayLabel(){return this.localizedName?this.localizedName:this.label}get displayCategory(){return this.localizedCategory?this.localizedCategory:""}get visible(){return this.enabled}set visible(e){this.enabled=e,this.commit()}getMattertagOptions(){return{color:new a.Color(this.color),description:this.displayCategory,enabled:!0,floorId:this.floorId,label:this.displayLabel,normal:this.stemDirection.clone(),objectAnnotationId:this.id,position:this.position.clone(),stemHeight:this.stemLength,stemVisible:!0,keywords:this.keywords.slice()}}getPin(e){return{id:this.id,floorId:this.floorId,anchorPosition:this.position.clone(),stemNormal:this.stemDirection.clone(),stemEnabled:!1,stemLength:K.Kn,color:e?`#${e.color.getHexString()}`:this.color,roomId:this.roomId}}toTagView(e){return{id:this.id,label:e?e.label:this.displayLabel,description:e?e.description:this.displayCategory,enabled:this.enabled,backgroundTexture:me,attachments:(null==e?void 0:e.fileAttachments.values())||[],created:this.created,modified:this.modified,stemEnabled:this.stemEnabled,color:this.color,anchorPosition:this.position.clone(),stemNormal:this.stemDirection.clone(),stemLength:this.stemLength,floorId:this.floorId,roomId:this.roomId,layerId:this.layerId,keywords:e?null==e?void 0:e.keywords.slice():this.keywords.slice(),icon:"simple-tag-small"}}}var J=i(9133),Y=i(97998);const q=Object.freeze({pink:"#f78da7",plum:"#9c4b92",purple:"#673ab7",teal:"#03687d",cerulean:"#03a9f4",ocean:"#00bcd4",fog:"#abb8c3",iron:"#607d8b",forest:"#417505",emerald:"#51a868",mint:"#37d67a",lime:"#cddc39",canary:"#fbcd00",sunflower:"#ffac17",tangerine:"#ff6900",sunset:"#f44336",sierra:"#d44441",magenta:"#e91e63"});var Z;!function(e){e.APPLIANCE="Appliance",e.CONSUMER_ELECTRONICS="Consumer Electronics",e.FIXTURE="Fixture",e.FURNITURE="Furniture",e.LIGHTING="Lighting"}(Z||(Z={}));const Q="WORKSHOP.OBJECT_TAG_SUGGESTION.VISION.";class X{constructor(e){this.locale=e,this.locale=e,this.log=new Y.Z("Object-tag-deserializer"),this.keywordList=Object.values(Z)}deserialize(e){var t,i,n,s;if(!e||!this.validate(e))return null;const a=e.region,o=(null==a?void 0:a.anchorPosition)?G.ep.fromVisionVector(a.anchorPosition):void 0,r=(null==a?void 0:a.stemNormal)?G.ep.fromVisionVector(a.stemNormal):void 0,d=new W;d.id=e.id,d.confidence=null!==(t=e.confidence)&&void 0!==t?t:0,d.created=(0,J.p)(e.created),d.modified=(0,J.p)(e.modified),d.enabled=e.enabled,(null===(i=e.region)||void 0===i?void 0:i.stemLength)&&(d.stemLength=e.region.stemLength),d.sweeps=[],e.panos&&e.panos.forEach((e=>{e&&e.id&&d.sweeps.push(e.id)})),e.floor&&e.floor.id&&(d.floorId=e.floor.id),e.room&&e.room.id&&(d.roomId=e.room.id),e.layer&&e.layer.id&&(d.layerId=e.layer.id),o&&(d.position=o),r&&(d.stemDirection=r),d.mattertagId=null===(n=e.tag)||void 0===n?void 0:n.id;let l=e.keywords||[],h=e.label||"";if(e.classification){const t=e.classification,i=Q+this.formatStringToPhraseKey(t.label);this.locale.has(i)&&(d.localizedName=this.locale.t(i));const{defaultKeywords:n}=t;if(n&&n.length>0){const e=n[n.length-1],t=Q+this.formatStringToPhraseKey(e);this.locale.has(t)&&(d.localizedCategory=this.locale.t(t))}t.label&&(h=t.label),t.defaultKeywords&&(l=t.defaultKeywords);const s=[];for(const e of l){const t=Q+this.formatStringToPhraseKey(e);this.locale.has(t)?s.push(this.locale.t(t)):s.push(e)}l=s}return d.keywords=l,d.label=h,this.postProcess(d,null===(s=e.classification)||void 0===s?void 0:s.defaultKeywords),d}formatStringToPhraseKey(e){return e.trim().replace(/\s/,"_").toUpperCase()}validate(e){if(!e)return!1;const t=["id","label","created","modified","region"];for(const i of t){if(!(i in e))return this.log.error("Missing field: ",i),!1}return!0}postProcess(e,t){let[i,n]=e.label.split(".").slice(1);if(i&&!e.localizedCategory){const t=Q+i.toUpperCase();this.locale.has(t)?e.localizedCategory=this.locale.t(t):e.localizedCategory=i}if(n&&!e.localizedName){const t=Q+n.toUpperCase();this.locale.has(t)?e.localizedName=this.locale.t(t):e.localizedName=n}if(t&&t.length>0)for(const e of this.keywordList)if(t.includes(e)){i=e;break}e.color=this.getCategoryColor(i)}getCategoryColor(e){switch(e){case"appliances":return q.cerulean;case"consumer_electronics":return q.emerald;case"fixtures":return q.sunset;case Z.APPLIANCE:return q.cerulean;case Z.CONSUMER_ELECTRONICS:return q.emerald;case Z.FIXTURE:return q.sunset;case Z.FURNITURE:return q.canary;case Z.LIGHTING:return q.fog;default:return q.forest}}}class ee extends z.u{constructor(e,t,i){super(e),this.classifications=[],this.layeredType=o.SF.OBJECTANNOTATION,this.confidence=i||.9,this.objectDeserializer=new X(t),this.deserializer=new _.o({deserializer:this.objectDeserializer})}async read(e){const t={modelId:this.getViewId(),minConfidence:this.confidence,includeDisabled:!0,inferenceEvents:null,ids:null,includeLayers:this.readLayerId()};return this.query(U.GetObjectAnnotations,t,e).then((e=>{var t,i;const n=null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.objectAnnotations;if(!n||!Array.isArray(n))return null;return(this.deserializer.deserialize(n)||[]).reduce(((e,t)=>(e[t.id]=t,e)),{})}))}async toggleEnabled(e,t){const i={modelId:this.getViewId(),objectAnnotationId:e,data:{enabled:t},includeLayers:this.readLayerId()};return this.mutate(U.PatchObjectAnnotation,i).then((e=>{var t;const i=null===(t=e.data)||void 0===t?void 0:t.patchObjectAnnotation;if(i){const e=this.objectDeserializer.deserialize(i);if(e)return e}throw new Error("Could not update Object Annotation")}))}async toggleAllEnabled(e,...t){const i={modelId:this.getViewId(),objectAnnotationIds:t,setEnabled:e,includeLayers:this.readLayerId()};return this.mutate(U.SetBulkObjectAnnotationsEnabled,i).then((e=>{var t;const i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.setBulkObjectAnnotationsEnabled;if(!i)throw new Error("Could not update Object Annotations");return i.map((e=>e.id))}))}async deleteObjectAnnotation(e){const t={modelId:this.getViewId(),objectAnnotationId:e};return this.mutate(U.DeleteObjectAnnotation,t).then((e=>{var t;return!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteObjectAnnotation)}))}async createObjectTag(e){const t={label:e.label,keywords:e.keywords||[],floorId:e.floorId,layerId:this.writeLayerId(e.layerId)?e.layerId:void 0,enabled:!0,vectorRegion:{anchorPosition:G.ep.toVisionVector(e.position),stemNormal:G.ep.toVisionVector(e.stemDirection),stemLength:e.stemLength}},i={modelId:this.getViewId(),objectAnnotation:t,includeLayers:this.readLayerId()};return this.mutate(U.AddObjectAnnotation,i).then((e=>{var t;const i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.addObjectAnnotation;if(i){const e=this.objectDeserializer.deserialize(i);if(e)return e}throw new Error("Could not create Object Annotation")}))}}var te=i(87926);const ie=i.p+"images/objectColor.png";var ne=i(29883),se=i(85679),ae=i(43037),oe=i(39880),re=i(19648),de=i(89549),le=i(76631),he=i(66917),ce=i(80742);const me=(0,te.p)(ie);class ue extends n.Y{constructor(){super(...arguments),this.name="object-tag-suggestions-data",this.visibilityEnabled=!1,this.idVisibility=new Set,this.onPinSelectionChange=e=>{const{commandBinder:t}=this.engine,{billboardAnnotation:i}=this.annotationsViewData,n=e?this.data.getObjectTag(e):null;n?(t.issueCommand(new b.IL(n.id,o.SF.OBJECTANNOTATION)),t.issueCommand(new p.Kw(n.id,k.J.OBJECT))):i&&i.annotationType===k.J.OBJECT&&t.issueCommand(new p.Aj(i.id,k.J.OBJECT))},this.onPinFocusChange=async()=>{const{commandBinder:e}=this.engine,{focusedPin:t,selectedPinId:i}=this.pinsViewData,{billboardAnnotation:n,dockedAnnotation:s}=this.annotationsViewData;if(!t)return void(n&&n.annotationType===k.J.OBJECT&&n.id!==i&&await e.issueCommand(new p.Aj(n.id,k.J.OBJECT)));const a=i?this.pinsViewData.getPin(i):null;a&&a.pinType===c.Er.OBJECT&&(e.issueCommand(new m.RH(a.id,c.Er.OBJECT)),e.issueCommand(new b.IL(null))),t.pinType===c.Er.OBJECT&&t.id!==(null==s?void 0:s.id)&&e.issueCommand(new p.Kw(t.id,k.J.OBJECT))},this.onLayersChanged=()=>{this.unselectObjectPin(),this.unselectObjectSearchResult(),this.displayObjects()},this.toggleObjectAnnotations=async e=>{const{enabled:t}=e;this.visibilityEnabled=t,this.engine.commandBinder.issueCommand(new m.qN(c.Er.OBJECT,t)),t||(this.unselectObjectPin(),this.unselectObjectSearchResult()),this.displayObjects()},this.selectedItemChanged=()=>{const{activeItemId:e,selectedType:t}=this.searchData;if(e&&t===o.SF.OBJECTANNOTATION){const t=this.data.getObjectTag(e);t&&this.updatePin(t)}},this.setAllObjectTagsEnabled=async e=>{const{ids:t,enabled:i}=e;0!==t.length&&(await this.store.toggleAllEnabled(i,...t),this.data.atomic((()=>{for(const e of this.data.collection)t.includes(e.id)&&(e.enabled=i,e.commit())})),this.unselectObjectPin(),this.unselectObjectSearchResult())},this.toggleObjectTagEnabled=async e=>{const{id:t,enabled:i}=e,n=this.data.getObjectTag(t);if(!n)throw new Error("Object tag not found!");if(n.enabled===i)return;await this.store.toggleEnabled(t,i)&&(n.enabled=i,n.commit(),this.unselectObjectPin(t),this.unselectObjectSearchResult(t))},this.deleteTags=async e=>{const{ids:t}=e;if(0===t.length)return;const i=this.annotationsViewData.billboardAnnotation;(null==i?void 0:i.annotationType)===k.J.OBJECT&&this.engine.commandBinder.issueCommand(new p.Aj(i.id,i.annotationType));for(const e of t){if(!await this.store.deleteObjectAnnotation(e))throw new Error("Could not delete Object Annotation");{this.data.removeObjectTag(e);const t=this.data.getObjectTag(e);t&&t.mattertagId&&await this.engine.commandBinder.issueCommand(new ae.T3(t.mattertagId,"search_menu_object_tag"))}}},this.createObjectTag=async e=>{const{id:t,options:i,pendingAttachments:n,embed:s}=e,r=new W,d=null==i?void 0:i.color,l=d?`#${new a.Color(d.r,d.g,d.b).getHexString()}`:"#ffffff";r.label=i.label||"",r.floorId=i.floorId||"",r.keywords=i.keywords||[],r.stemDirection=i.normal||new a.Vector3,r.stemLength=i.stemHeight?Math.max(i.stemHeight,K.Kn):K.Kn,r.position=i.position||new a.Vector3,r.color=l,r.layerId=this.layersData.activeLayerId;const h=await this.store.createObjectTag(r);if(!h)return;const{commandBinder:u}=this.engine;i.objectAnnotationId=h.id,r.mattertagId=t,await u.issueCommand(new ae.QG(t,i,n,void 0,s)),h.mattertagId=t,this.data.updateObjectTag(h),u.issueCommand(new m.tE(h.id,c.Er.OBJECT,this.getPinUpdate(r))),await u.issueCommand(new de.CH(le.w1.TAGS)),u.issueCommand(new he.M),await u.issueCommand(new de.z2(le.w1.LAYERS)),u.issueCommand(new he.I),u.issueCommand(new b.IL(r.id,o.SF.OBJECTANNOTATION)),await u.issueCommand(new v.w$(h.id))},this.dockObjectTag=async e=>{const{id:t}=e,i=this.data.getObjectTag(t);if(!i)return;const{commandBinder:n}=this.engine;if(!i.mattertagId){const e=i.getMattertagOptions(),t=(0,oe.O1)(11);n.issueCommand(new re.Mm(t,e)),i.mattertagId=t}n.issueCommand(new ae.lt(i.mattertagId,{dock:!0,objectTag:!0}))}}async init(e,t){super.init(e,t),this.engine=t,[this.locale,this.pinsViewData,this.annotationsViewData,this.mattertagsData,this.layersData,this.searchData,this.appData]=await Promise.all([t.getModuleBySymbol(s.y.LOCALE),t.market.waitForData(u.B),t.market.waitForData(g.A),t.market.waitForData(se.n),t.market.waitForData(ce.R),t.market.waitForData(ne.T),t.market.waitForData(w.pu)]),this.store=new ee({context:this.layersData.mdsContext,readonly:!1,baseUrl:e.baseUrl},this.locale,e.minConfidence),this.engine.commandBinder.issueCommand(new m.qN(c.Er.OBJECT,!1)),this.data=new y.h,this.store.onNewData(this.loadNewData.bind(this));const{commandBinder:i}=this.engine;this.bindings.push(i.addBinding(v.AN,this.toggleObjectAnnotations),i.addBinding(v.yJ,(async e=>this.filterObjectTagSuggestions(e.ids))),i.addBinding(v.w$,(async({id:e})=>this.navigateToSuggestion(e))),i.addBinding(v.cO,this.modifyInsideSaveCommand(this.setAllObjectTagsEnabled)),i.addBinding(v.Q_,this.modifyInsideSaveCommand(this.toggleObjectTagEnabled)),i.addBinding(v.SO,this.modifyInsideSaveCommand(this.deleteTags)),i.addBinding(v.I2,this.modifyInsideSaveCommand(this.createObjectTag)),i.addBinding(v.OD,(async e=>this.dockObjectTag(e))),this.appData.onChanged((()=>this.displayObjects())),this.layersData.onCurrentLayersChanged(this.onLayersChanged),this.searchData.onPropertyChanged("activeItemId",this.selectedItemChanged),this.pinsViewData.onSelectedPinChanged(this.onPinSelectionChange),this.pinsViewData.onFocusedPinChanged((()=>this.onPinFocusChange())),this.data.onChanged((()=>this.displayObjects())),this.data.collection.onElementChanged({onAdded:this.updatePin.bind(this),onUpdated:this.updatePin.bind(this),onRemoved:this.removePin.bind(this)})),await this.store.refresh(),this.engine.market.register(this,y.h,this.data),async function(e,t,i,n){const s=await e.market.waitForData(w.pu);let a=s.application===w.Mx.WORKSHOP;const r=(s,o,r,l=[])=>{const h=[];return t.iterate((t=>{if(!(a||t.visible&&n.layerToggled(t.layerId)))return;const r=[t.displayLabel,t.displayCategory],d=[...t.keywords],c=t.mattertagId?i.getTag(t.mattertagId):void 0;c&&(r.length=0,d.length=0,r.push(c.label,c.description),d.push(...c.keywords));const m=r.filter((e=>!!e));let u=s(...m);u&&l.length>0&&(u=d.length>0&&d.some((e=>l.includes(e)))),u&&h.push(new C(e.commandBinder,n,o,t,c))})),e.commandBinder.issueCommand(new v.yJ(h.map((e=>e.id)))),d(h),h},d=e=>{e.sort(((e,t)=>{var i;const n=e,s=t,a=null===(i=n.description)||void 0===i?void 0:i.localeCompare(s.description);return 0!==a?a:n.title.localeCompare(s.title)}))},l=t=>{e.commandBinder.issueCommand(new v.AN(!!t))},h=()=>{let e=[];return t.iterate((t=>{t.visible&&t.keywords.length&&!t.mattertagId&&(e=e.concat(t.keywords))})),e},c=e=>new f.V(t.onChanged(e),i.onChanged(e)),m=()=>{e.commandBinder.issueCommandWhenBound(new b.c6({id:o.SF.OBJECTANNOTATION,groupPhraseKey:"WORKSHOP.OBJECT_TAG_SUGGESTION.SEARCH_GROUP_HEADER",getSimpleMatches:r,registerChangeObserver:c,onSearchActivatedChanged:l,getKeywords:h,groupOrder:90,groupIcon:"snap",groupActionsFC:j,itemActionsFC:L}))},u=()=>{e.commandBinder.issueCommandWhenBound(new b.Pe(o.SF.OBJECTANNOTATION))},p={renew:m,cancel:u},g=e=>{a=e===w.Mx.WORKSHOP,u(),m()},y=s.onPropertyChanged("application",g);return g(s.application),new f.V(p,y)}(t,this.data,this.mattertagsData,this.layersData).then((e=>this.bindings.push(e)))}loadNewData(e){this.data.atomic((()=>{this.layersData.replaceBackendLayers(this.data.collection,e||{})}))}dispose(e){super.dispose(e),this.data&&e.market.unregister(this,y.h)}modifyInsideSaveCommand(e){return async(...t)=>{await this.engine.commandBinder.issueCommand(new r.VQ({dataTypes:[d.g.OBJECT_ANNOTATIONS],onCallback:()=>e(...t),skipDirtyUpdate:!0}))}}displayObjects(){const e=[];this.data.collection.values.forEach((t=>{e.push(this.getPinUpdate(t))})),this.engine.commandBinder.issueCommand(new m.mE(e))}removePin(e){this.engine.commandBinder.issueCommand(new m.OL(e.id,c.Er.OBJECT))}updatePin(e){const t=this.getPinUpdate(e);this.engine.commandBinder.issueCommand(new m.mE([t]))}getPinUpdate(e){const t=this.mattertagsData.getTag(e.mattertagId||""),i=e.getPin(t);return Object.assign({id:e.id,pinType:c.Er.OBJECT,backgroundTexture:me,visible:this.getObjectVisibility(e.id,e.layerId,e.visible),scale:new a.Vector3(.75,.75,.75),icon:"simple-tag-small"},i)}getObjectVisibility(e,t,i){if(!this.visibilityEnabled)return!1;const{activeItemId:n,selectedType:s}=this.searchData,a=this.appData.application===w.Mx.WORKSHOP||this.layersData.layerToggled(t),r=this.layersData.layerVisible(t),d=this.idVisibility.has(e),l=n===e&&s===o.SF.OBJECTANNOTATION;return a&&(l||i&&d&&r)}async filterObjectTagSuggestions(e){this.idVisibility.clear(),e.forEach((e=>this.idVisibility.add(e))),this.displayObjects()}async navigateToSuggestion(e){const t=this.data.getObjectTag(e);if(!t)return;const i={anchorPosition:t.position.clone(),stemNormal:t.stemDirection.clone(),stemLength:t.stemLength,stemEnabled:!0,color:"",floorId:t.floorId,roomId:t.roomId};await this.engine.commandBinder.issueCommand(new h.OR({pinPosition:i,transition:l.n.FadeToBlack})),this.engine.commandBinder.issueCommand(new m.Ar(e,c.Er.OBJECT,!1))}unselectObjectPin(e){const{selectedPinId:t}=this.pinsViewData;if(t){const i=this.pinsViewData.getPin(t);i&&(i.pinType!==c.Er.OBJECT||e&&e!==t||this.engine.commandBinder.issueCommand(new m.RH(t,c.Er.OBJECT)))}}unselectObjectSearchResult(e){const{selectedType:t,activeItemId:i}=this.searchData;i&&t===o.SF.OBJECTANNOTATION&&(e&&e!==i||this.engine.commandBinder.issueCommand(new b.IL(null)))}}},66338:(e,t,i)=>{"use strict";i.d(t,{W:()=>a});var n=i(67992),s=i(15637);class a extends n.V{constructor(e){super(),this.name="ordered-list-data",this.lists=(0,s.q)(e)}replace(e){this.lists.replace(e)}getOrderedLists(){return this.lists.values}getOrderedList(e){return this.lists.get(e)}updateOrderedList(e){this.lists.has(e.name)?this.lists.get(e.name).copy(e):this.lists.set(e.name,e)}}},43846:(e,t,i)=>{"use strict";i.d(t,{Bd:()=>a,ui:()=>o,wg:()=>s});var n=i(19663);class s extends n.m{constructor(e,t){super(),this.payload={name:e,entries:t}}}class a extends n.m{constructor(e,t){super(),this.payload={name:e,entries:t}}}class o extends n.m{constructor(e,t,i){super(),this.payload={id:e,name:t,entries:i}}}},24102:(e,t,i)=>{"use strict";var n;i.d(t,{l:()=>n}),function(e){e.TAG="tag"}(n||(n={}))},51366:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CreateOrderedListCommand:()=>T.Bd,MdsOrderedListDeserializer:()=>y,MdsOrderedListStore:()=>f,OrderedList:()=>l,OrderedListData:()=>b.W,OrderedListEntryType:()=>P.l,SaveNamedOrderedListCommand:()=>T.wg,TAG_ORDERED_LIST_NAME:()=>A.q,UpdateOrderedListCommand:()=>T.ui,default:()=>I});var n=i(97542),s=i(69170),a=i(79728),o=i(635),r=i(90632),d=i(75287);class l extends d.T{constructor(e){super(),this.id="",this.name="",this.description="",this.entries=[],this.layerId="",e&&Object.assign(this,e)}copy(e){return this.id=e.id,this.name=e.name,e.description&&(this.description=e.description),this.entries=e.entries.slice(),this.commit(),this}}var h=i(17788),c=i(95548),m=i(41999),u=i(73123),p=i(97998),g=i(22001);const v=new p.Z("ordered-list-deserializer");class y{deserialize(e){var t,i,n;return e&&this.validate(e)?new l({id:e.id,name:null!==(t=e.label)&&void 0!==t?t:"",layerId:null!==(n=null===(i=e.layer)||void 0===i?void 0:i.id)&&void 0!==n?n:"",entries:e.entries.filter((e=>!!e)).map((e=>({id:e.id,type:e.type})))}):(v.debug("Deserialized invalid ordered list data from Mds",e),null)}validate(e){return["id","label","entries"].every((t=>t in e))}}const w=new p.Z("MdsOrderedListStore");class f extends h.u{constructor(e){super(e),this.prefetchKey="data.model.orderedLists",this.deserializer=new y}async read(){const e={modelId:this.getViewId(),includeLayers:this.readLayerId()};return this.query(g.GetOrderedLists,e).then((e=>{var t,i;const n=null===(i=null===(t=e.data)||void 0===t?void 0:t.model)||void 0===i?void 0:i.orderedLists;if(!n||!Array.isArray(n))return w.debug("GetOrderedLists failed"),{};return n.reduce(((e,t)=>{const i=this.deserializer.deserialize(t);return i&&(e[i.name]&&w.debug(`Duplicate orderedList found with label: ${i.name}`),e[i.name]=i),e}),{})}))}async create(e,t){return 0===e.length?[]:Promise.all(e.map((e=>this.createOrderedList(e,t))))}async createOrderedList(e,t){var i;const n={modelId:this.getViewId(),label:e.name,description:e.description,entries:e.entries,includeLayers:this.readLayerId()};let s;if(t&&this.writeLayerId(t)){const e=Object.assign({layerId:t},n);s=await this.mutate(g.AddOrderedListWithLayer,e).catch((e=>{throw new c.w0(e)}))}else s=await this.mutate(g.AddOrderedList,n).catch((e=>{throw new c.w0(e)}));if(null===(i=s.data)||void 0===i?void 0:i.addOrderedList){const e=this.deserializer.deserialize(s.data.addOrderedList);if(e)return e.layerId&&await this.context.updateForAutoProvisionedLayer(e.layerId),e}throw new Error("Unable to create new OrderedList")}async update(e){if(0===e.length)return;const t=this.getViewId();let i="";const n={};n.modelId=t;let s="";for(const t of e){const e=t.id;i+=`\n , $label${e}: String!\n , $description${e}: String!\n , $entries${e}: [EntryInput!]\n `,n[`label${e}`]=t.name,n[`description${e}`]=t.description,n[`entries${e}`]=t.entries,s+=`\n update${e}:\n patchOrderedList(modelId: $modelId,\n orderedListId: "${e}",\n label: $label${e},\n description: $description${e},\n entries: $entries${e}) {\n id\n label\n entries {\n id\n type\n }\n }\n `}const a=m.gql`
15
+ mutation orderedListsUpdate($modelId: ID! ${i}) {
16
+ ${s}
17
+ }
18
+ `;return this.mutate(a,n).then((e=>{w.debug(Object.assign({type:"patchOrderedList"},Object.values((0,u.q)(e,"data"))))}))}}var b=i(66338),T=i(43846),D=i(80742);class C extends n.Y{constructor(){super(...arguments),this.name="ordered-lists",this.saveNamedOrderedList=async e=>{const{name:t,entries:i}=e;let n=this.data.getOrderedList(t);return n?n.entries=i:n=new l({name:t,entries:i}),this.data.updateOrderedList(n),this.engine.commandBinder.issueCommand(new o.VQ({dataTypes:[a.g.ORDERED_LISTS]}))}}async init(e,t){const{baseUrl:i,workshop:n}=e;if(this.engine=t,this.layersData=await t.market.waitForData(D.R),this.store=new f({context:this.layersData.mdsContext,baseUrl:i,readonly:!n}),this.bindings.push(this.store.onNewData((async e=>{this.data.replace(e)}))),this.data=new b.W({}),await this.store.refresh(),n){const e=await t.getModuleBySymbol(s.y.STORAGE);this.bindings.push(t.commandBinder.addBinding(T.wg,this.saveNamedOrderedList),e.onSave((()=>this.save()),{dataType:a.g.ORDERED_LISTS}));const i=await t.market.waitForData(r.Q);i.setPublishableType(a.g.ORDERED_LISTS),i.setRevertableType(a.g.ORDERED_LISTS)}t.market.register(this,b.W,this.data)}dispose(e){this.store.dispose(),super.dispose(e)}onUpdate(){}async save(){const e=this.data.getOrderedLists(),t=[],i=[];e.forEach((e=>{""===e.id?t.push(e):i.push(e)}));return Promise.all([this.store.create(t,this.layersData.getOrderedListsLayerId()),this.store.update(i)]).then((e=>{e[0].forEach((e=>{e&&this.data.updateOrderedList(e)}))}))}}var P=i(24102),A=i(25561);const I=C},25561:(e,t,i)=>{"use strict";i.d(t,{q:()=>n});const n="mp.tags"},100:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CancelNewPinCommand:()=>$.tT,ChangePinOpacityByTypeCommand:()=>$.kb,ChangePinOpacityCommand:()=>$._Y,ChangePinOpacityScaleCommand:()=>$.nP,ChangePinVisibilityByTypeCommand:()=>$.qN,ChangePinVisibilityCommand:()=>$.ik,ClearPinSelectionCommand:()=>$.iK,ClickOffPinCommand:()=>$.yR,CreatePinCommand:()=>$.fM,EnablePinCreationCommand:()=>$.Ki,MovePinCommand:()=>$.I$,NewPinReadyMessage:()=>K.cd,PinAddCancelledMessage:()=>K.hu,PinAnchorMesh:()=>_,PinClickedMessage:()=>K.F7,PinColorVariant:()=>F.K_,PinEditor:()=>Z,PinEditorState:()=>F.V8,PinHeadMesh:()=>H.$,PinHoverChangeMessage:()=>K.tP,PinMovedMessage:()=>K.bV,PinPlacedMessage:()=>K.b0,PinPlacementCancelledMessage:()=>K.pe,PinPreviewDirection:()=>F.Od,PinRenderer:()=>se,PinType:()=>F.Er,PinsViewData:()=>D.B,PlacePinCommand:()=>$.ip,RemovePinCommand:()=>$.OL,RemovePinsByTypeCommand:()=>$.zM,SelectPinCommand:()=>$.Ar,UnselectPinCommand:()=>$.RH,UpdatePinCommand:()=>$.tE,UpdatePinViewsCommand:()=>$.mE,default:()=>ke});var n=i(81396),s=i(97542),a=i(69170),o=i(59370),r=i(31362),d=i(54244),l=i(5332),h=i(79727),c=i(5135),m=i(9037),u=i(53954),p=i(23254),g=i(95882),v=i(95512),y=i(38987),w=i(34956),f=i(14630),b=i(10699),T=i(79596),D=i(60083),C=i(89570),P=i(53058),A=i(82814);var I=i(94046),E=i(97998),S=i(72996),k=i(16769),N=i(16782),O=i(67678),M=i(86819),x=i(80592),R=i(62017),V=i(89553),B=i(6667),L=i(32597),F=i(62612),H=i(33160),j=i(12529),U=i(87926);const G=i.p+"images/pinAnchor.png";var z=i(84958);class _ extends n.Mesh{constructor(e){super(new n.PlaneGeometry(z.Z.anchor.size,z.Z.anchor.size),new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,map:_.getTexture(),side:n.DoubleSide})),this.visible=!1,this.layers.mask=e.mask,this.renderOrder=j.z.pins}static getTexture(){return _.anchorTexture||(_.anchorTexture=(0,U.p)(G)),_.anchorTexture}}var $=i(72936),K=i(13132),W=i(76957),J=i(35826),Y=i(12039),q=i(51411);class Z{constructor(e,t,i,s){this.viewData=e,this.engine=t,this.input=i,this.pinRenderer=s,this.editEnabled=!1,this.handlersRegistered=!1,this.bindings=[],this.externalBehaviorsBlocked=!1,this.touchDevice=(0,r.Jm)(),this.longPressCreateThreshold=500,this.ndcPoint=new n.Vector3,this.movingPin=!1,this.anchored=!1,this.inAnchorClick=!1,this.startingPinData=void 0,this.log=new E.Z("pin-editor"),this.stopEventPropagation=()=>!0,this.updateMeshPreviewSphere=async(e,t)=>{this.engine.commandBinder.issueCommand(new q.n(e,t))},this.startPinCreation=()=>{this.editEnabled&&(this.addingHandlers.renew(),this.touchDevice||this.engine.commandBinder.issueCommand(new y.u(w.C.XHAIR)),this.engine.commandBinder.issueCommand(new J.ZD))},this.endPinCreation=()=>{this.editEnabled&&(this.draggingHandlers.cancel(),this.addingHandlers.cancel(),this.clearLongPressTimeout(),this.allowExternalBehaviors(!0),this.engine.commandBinder.issueCommand(new y.u(w.C.DEFAULT)),this.engine.commandBinder.issueCommand(new J.zd))},this.onSelectedPinChanged=()=>{const{selectedPinId:e}=this.viewData;e?this.selectedHandlers.renew():this.selectedHandlers.cancel(),this.updateAnchorMesh()},this.onPinStateUpdated=()=>{const e=this.viewData.pinEditorState;switch(this.updateAnchorMesh(),e){case F.V8.PLACING:this.draggingHandlers.renew();break;case F.V8.IDLE:this.allowExternalBehaviors(!0)}},this.updateAnchorMesh=()=>{if(!this.editEnabled)return;const{pinEditorState:e,isPinEditable:t,selectedPinId:i}=this.viewData,n=i?this.viewData.getPin(i):null;n&&e!==F.V8.CREATING?([F.V8.PLACING,F.V8.PLACED].includes(e)||t?(this.pinRenderer.showAnchorMesh(n.pinType,n.id,n),this.anchored=!0):this.removePinAnchorMesh(),this.editableSelectedHandlers.renew()):(this.editableSelectedHandlers.cancel(),this.anchored&&this.removePinAnchorMesh(),this.updateMeshPreviewSphere(!1))},this.clearLongPressTimeout=()=>{this.longPressStart=0,-1!==this.longPressTimeout&&window.clearTimeout(this.longPressTimeout),this.longPressTimeout=-1},this.placePin=()=>{this.viewData.pinEditorState===F.V8.PLACING&&(this.engine.commandBinder.issueCommand(new y.u(w.C.DEFAULT)),this.engine.commandBinder.issueCommand(new $.ip),this.engine.broadcast(new K.cd),this.updateMeshPreviewSphere(!1))},this.onDragEvent=e=>{e.buttons!==N.r.PRIMARY&&(this.touchDevice||this.viewData.selectedPinId)||this.positionPin(e)},this.onDragEnd=e=>{const{creatingNewPin:t,pinEditorState:i,selectedPinId:n}=this.viewData,s=n?this.viewData.getPin(n):null;t&&!this.touchDevice&&i===F.V8.PLACING||(s&&!t&&(this.engine.commandBinder.issueCommand(new $.I$(s.id,this.copyPinData(s),this.startingPinData)),this.updateMeshPreviewSphere(!1)),this.doneMovingPin(),this.inAnchorClick=!1)},this.positionPin=(()=>{const e=new n.Vector3;return async t=>{if(this.touchDevice&&t.buttons!==N.r.PRIMARY)return!1;const i=this.viewData,{pinEditorState:n,selectedPinId:s}=i;if(n===F.V8.CREATING)this.engine.commandBinder.issueCommand(new v.y(!0));else if(n!==F.V8.PLACING&&!this.movingPin)return!1;const a=s?i.getPin(s):null;if(!a)return!1;this.saveScreenPosition(t.position.x,t.position.y);const o=this.getModelIntersection();if(o&&o.face){this.engine.commandBinder.issueCommand(new y.u(w.C.XHAIR)),i.setCanPlace(!0);const t=((e,t,i)=>{var n;return null!==(n=t.floorIdFromObject(i.object))&&void 0!==n?n:e.getClosestFloorAtHeight(i.point.y).id})(this.floorsData,this.meshQuery,o);if(null===t)return!1;const s=this.meshQuery.mdsRoomIdFromObject(o.object);e.copy(a.stemNormal).setLength(a.stemLength),this.updateMeshPreviewSphere(!0,a.anchorPosition);const r={anchorPosition:a.anchorPosition.copy(o.point),stemNormal:a.stemNormal.copy(o.face.normal).normalize(),floorId:t,roomId:s};return this.engine.commandBinder.issueCommand(new $.tE(a.id,a.pinType,r)),n===F.V8.CREATING&&i.setPinEditorState(F.V8.PLACING),!0}return this.engine.commandBinder.issueCommand(new y.u(w.C.NOPE)),i.setCanPlace(!1),!1}})(),this.allowExternalBehaviors=async e=>{e||this.externalBehaviorsBlocked?e&&this.externalBehaviorsBlocked&&(this.dragInterceptor.cancel(),this.engine.commandBinder.issueCommand(new Y.Lp),this.externalBehaviorsBlocked=!1):(this.dragInterceptor.renew(),this.engine.commandBinder.issueCommand(new Y.ZK),this.externalBehaviorsBlocked=!0)},this.getModelIntersection=()=>{const e=.5*z.Z.anchor.size;return this.fatcaster.cast(e,(e=>!!(0,k.Pv)(e)&&(!this.viewmodeData.isDollhouse()&&!this.viewmodeData.isFloorplan()||this.floorsViewData.isCurrentMeshGroupOrAllFloors(e.meshGroup))),P.a.Filter.CENTER_GROUP(e))},this.onPointerButton=e=>{e.down||this.viewData.pinEditorState!==F.V8.PLACED||(this.allowExternalBehaviors(!0),this.engine.commandBinder.issueCommand(new v.y(!1)))},this.onAnchorDragBegin=e=>{const{isPinEditable:t,pinEditorState:i,selectedPinId:n}=this.viewData,s=n?this.viewData.getPin(n):null;!s||e.buttons!==N.r.PRIMARY||i!==F.V8.PLACED&&i!==F.V8.IDLE||(t?(this.movingPin=!0,this.startingPinData=this.copyPinData(s),this.allowExternalBehaviors(!1),this.draggingHandlers.renew(),this.engine.commandBinder.issueCommand(new y.u(w.C.GRABBING)),this.engine.commandBinder.issueCommand(new v.y(!0)),this.inAnchorClick=!0):this.log.debug("onAnchorSelect called on a non-editable pin"))},this.doneMovingPin=()=>{this.viewData.selectedPinId&&this.movingPin&&(this.draggingHandlers.cancel(),this.engine.commandBinder.issueCommand(new y.u(null)),this.engine.commandBinder.issueCommand(new v.y(!1)),this.movingPin=!1,this.startingPinData=void 0,this.allowExternalBehaviors(!0),this.updateMeshPreviewSphere(!1))},this.onClickElsewhere=e=>{const{selectedPinId:t,pinEditorState:i}=this.viewData;if(!(i===F.V8.CREATING&&t||this.inAnchorClick))return t&&(this.movingPin?this.doneMovingPin():this.engine.commandBinder.issueCommand(new $.yR)),!0},this.onLongPressStart=async e=>{if(e.buttons!==N.r.PRIMARY)return;const t=this.viewData;t.pinEditorState===F.V8.CREATING&&(this.longPressStart=Date.now(),t.setPinEditorState(F.V8.PRESSING),this.allowExternalBehaviors(!1),this.saveScreenPosition(e.position.x,e.position.y),this.longPressTimeout=window.setTimeout((async()=>{t.setPinEditorState(F.V8.PLACING);await this.positionPin(e)||(t.setPinEditorState(F.V8.CREATING),t.setCanPlace(!1)),this.longPressTimeout=-1}),this.longPressCreateThreshold))},this.onLongPressEnd=()=>{const e=this.viewData.pinEditorState;e===F.V8.PRESSING?(this.log.debug("Did not press long enough"),this.endPinCreation()):e===F.V8.PLACING&&this.placePin()},this.onPointerEvent=e=>{const t=this.viewData.pinEditorState;t!==F.V8.PLACING&&t!==F.V8.CREATING||this.positionPin(e)},this.onClickToPlacePin=()=>{this.placePin()},this.onKeyEvent=e=>{if(e.state===B.M.PRESSED)switch(e.key){case L.R.ESCAPE:this.viewData.creatingNewPin&&this.engine.broadcast(new K.pe)}},Promise.all([t.market.waitForData(m.M),t.market.waitForData(W.i),t.market.waitForData(h.c),t.market.waitForData(p.O),t.getModuleBySymbol(a.y.FAT_RAYCAST),t.getModuleBySymbol(a.y.MESH_QUERY)]).then((([t,n,s,a,o,r])=>{this.cameraData=t,this.floorsData=n,this.floorsViewData=s,this.viewmodeData=a,this.fatcaster=o,this.meshQuery=r,this.bindings.push(i.registerPriorityHandler(O.er,H.$,this.stopEventPropagation),e.onSelectedPinChanged(this.onSelectedPinChanged)),this.selectedHandlers=new C.V(i.registerPriorityHandler(M.R,A.S,this.onClickElsewhere),i.registerPriorityHandler(M.R,I.i,this.onClickElsewhere)),this.selectedHandlers.cancel()}))}dispose(){var e,t,i,n,s;this.removePinAnchorMesh(),this.updateMeshPreviewSphere(!1),null===(e=this.dragInterceptor)||void 0===e||e.cancel(),null===(t=this.addingHandlers)||void 0===t||t.cancel(),null===(i=this.draggingHandlers)||void 0===i||i.cancel(),null===(n=this.selectedHandlers)||void 0===n||n.cancel(),null===(s=this.editableSelectedHandlers)||void 0===s||s.cancel(),this.bindings.forEach((e=>{e.cancel()}))}update(){if(!this.editEnabled)return;const e=this.viewData;if(this.touchDevice&&e.pinEditorState===F.V8.PRESSING){const t=Math.min(1,(Date.now()-this.longPressStart)/this.longPressCreateThreshold);e.setProgress(t)}}toggleEditing(e){e!==this.editEnabled&&(this.editEnabled=e,e?(this.handlersRegistered?this.creationHandlers.renew():this.registerHandlers(),this.updateAnchorMesh()):(this.inAnchorClick=!1,this.anchored=!1,this.movingPin=!1,this.creationHandlers.cancel(),this.allowExternalBehaviors(!0),this.removePinAnchorMesh(),this.updateMeshPreviewSphere(!1)),this.dragInterceptor.cancel(),this.draggingHandlers.cancel(),this.addingHandlers.cancel(),this.editableSelectedHandlers.cancel())}registerHandlers(){const e=this.input,t=this.viewData;this.creationHandlers=new C.V(t.onPinEditorStateChanged(this.onPinStateUpdated)),this.dragInterceptor=new C.V(e.registerPriorityHandler(x._t,A.S,(()=>!0)),e.registerPriorityHandler(x._t,I.i,(()=>!0))),this.draggingHandlers=new C.V(e.registerUnfilteredHandler(x._t,this.onDragEvent),e.registerUnfilteredHandler(x._R,this.onDragEnd)),this.editableSelectedHandlers=new C.V(e.registerMeshHandler(x.E0,S.s.isType(_),this.onAnchorDragBegin)),this.touchDevice?this.addingHandlers=new C.V(e.registerHandler(O.er,this.onPointerButton),e.registerUnfilteredHandler(R.Vh,this.onLongPressStart),e.registerUnfilteredHandler(R.pt,this.onLongPressEnd)):this.addingHandlers=new C.V(e.registerHandler(V.e,this.onKeyEvent),e.registerHandler(O.er,this.onPointerButton),e.registerUnfilteredHandler(M.R,this.onClickToPlacePin),e.registerHandler(O.mE,this.onPointerEvent))}removePinAnchorMesh(){this.pinRenderer.hideAnchorMesh(),this.anchored=!1}copyPinData(e){return{anchorPosition:e.anchorPosition.clone(),stemNormal:e.stemNormal.clone(),floorId:e.floorId,roomId:e.roomId,stemLength:e.stemLength,stemEnabled:e.stemEnabled,color:e.color}}saveScreenPosition(e,t){this.ndcPoint.set(e,t,0);const i=(0,o.fi)(this.cameraData.width,this.cameraData.height,this.ndcPoint);this.viewData.setScreenPosition(i)}}var Q=i(23612),X=i(4510),ee=i(7402),te=i(23885),ie=i(55763);class ne extends n.Mesh{constructor(e){super(new n.PlaneGeometry(z.Z.anchor.size,z.Z.anchor.size),new ie.Dx),this.visible=!1,this.layers.mask=e.mask,this.renderOrder=j.z.pinSelectedHalo}}class se{constructor(e,t,i,s){this.input=e,this.layer=t,this.commandBinder=i,this.raycaster=s,this.container=new n.Object3D,this.floorIdToContainer=new Map,this.hexColorToColor=new Map,this.bindings=[],this.anchor=null,this.selected=null,this.haloEasing=(0,te.tf)(.5,.52,0,1.98),this.pinsWithOverrideTexture=new Set,this.iconsEnabled=!1,this.updateAnchorPosition=(()=>{const e=new n.Vector3,t=new n.Vector3,i=new n.Vector3;return n=>{const s=this.anchorMesh;if(!s)return;const a=this.raycaster.picking;e.copy(n.stemNormal).normalize(),t.copy(e).multiplyScalar(.2).add(n.anchorPosition),i.copy(e).multiplyScalar(-1);const o=a.pick(t,i,(e=>e instanceof ee.g));if(o){const e=Math.min(.2,o.distance);s.position.copy(t).add(i.multiplyScalar(.999*e))}else s.position.copy(t).add(i.multiplyScalar(.999*n.stemLength));s.lookAt(t)}})(),this.onAnchorHover=()=>{this.commandBinder.issueCommand(new y.u(w.C.GRAB)),this.commandBinder.issueCommand(new v.y(!0))},this.onAnchorUnhover=()=>{this.commandBinder.issueCommand(new y.u(null)),this.commandBinder.issueCommand(new v.y(!1))}}init(){this.container.name="PinContainer",this.container.layers.mask=this.layer.mask,this.anchorMesh=new _(this.layer),this.anchorMesh.name="Anchor Mesh",this.container.add(this.anchorMesh),this.selectedMesh=new ne(this.layer),this.selectedMesh.name="Selected Mesh",this.container.add(this.selectedMesh)}dispose(){this.container.parent&&this.container.parent.remove(this.container);for(const e of[this.anchorMesh,this.selectedMesh])e&&e.parent&&e.parent.remove(e)}activate(e){this.bindings.length>0||this.bindings.push(this.input.registerMeshHandler(Q.z,S.s.isType(_),this.onAnchorHover),this.input.registerMeshHandler(Q.A,S.s.isType(_),this.onAnchorUnhover))}deactivate(e){for(const e of this.bindings)e.cancel();this.bindings.length=0}render(e){if(!this.selected)return;const{animation:t,hideWhenDoneAnimating:i}=this.selected,s=this.selectedMesh;if(s&&s.visible&&t){const e=this.pinHeadTransform(this.selected.id),a=new n.Vector3,o=new n.Quaternion,r=new n.Vector3;e.decompose(a,o,r),r.multiplyScalar(t.getUpdatedValue()),i&&!t.isAnimating?(s.visible=!1,this.selected=null):(s.position.copy(a),s.quaternion.copy(o),s.scale.copy(r))}}updatePin(e,t,i,n,s,a){this.anchorMesh&&this.anchorMesh.visible&&this.anchor&&this.anchor.pinType===t&&this.anchor.id===e&&this.updateAnchorPosition(i)}removePin(e){this.selected&&this.selected.id===e&&this.clearSelected()}removePinsByType(e){this.removePinsByPredicate((t=>t===e))}removePinsByPredicate(e){}setPinVisible(e,t){}setPinColorVariant(e,t){}setPinColorVariants(e,t){}setPinColorVariantByType(e,t,i){}setPinOpacity(e,t){}setPinOpacityByType(e,t,i){}fadePinOpacity(e,t){}fadePinOpacityByType(e,t,i=[]){}setPinRenderOverrides(e,t,i){t?(this.pinsWithOverrideTexture.add(e),this.selected&&this.selected.id===e&&this.clearSelected()):this.pinsWithOverrideTexture.delete(e)}setFloorsHidden(e){this.floorIdToContainer.forEach(((t,i)=>{t.visible=!e(i)}))}setPinTypeVisible(e,t){this.floorIdToContainer.forEach((i=>{i.userData.typeContainers[e].visible=t}))}showAnchorMesh(e,t,i){this.anchor={pinType:e,id:t},this.anchorMesh&&!this.anchorMesh.visible&&(this.anchorMesh.visible=!0,this.input.registerMesh(this.anchorMesh,!1)),this.updateAnchorPosition(i)}hideAnchorMesh(){this.anchorMesh&&this.anchorMesh.visible&&(this.anchorMesh.visible=!1,this.input.unregisterMesh(this.anchorMesh))}showSelectedMesh(e,t){const i=this.selected&&this.selected.pinType===e&&this.selected.id===t;this.selected&&i||this.pinsWithOverrideTexture.has(t)||(this.selected={pinType:e,id:t,hideWhenDoneAnimating:!1,animation:new X.Z({startValue:10,endValue:14,duration:300,easingFunction:this.haloEasing})},this.selectedMesh.visible=!0)}hideSelectedMesh(){this.selected&&(this.selected.animation=new X.Z({startValue:14,endValue:10,duration:300}),this.selected.hideWhenDoneAnimating=!0)}getFloorContainer(e){let t=this.floorIdToContainer.get(e);if(t)return t;t=new n.Object3D,t.name="Floor "+e,t.userData.typeContainers={},t.layers.mask=this.layer.mask;for(const e of Object.values(F.Er)){const i=new n.Object3D;i.name=e,i.layers.mask=this.layer.mask,t.add(i),t.userData.typeContainers[e]=i}return this.container.add(t),this.floorIdToContainer.set(e,t),t.userData.floorId=e,t}getColor(e){let t=this.hexColorToColor.get(e);if(t)return t;const i=new n.Color(e),s={h:0,s:0,l:0};i.getHSL(s);return t={baseColor:i,hoverColor:(new n.Color).setHSL(s.h,s.s,.8*s.l),dimmedColor:(new n.Color).setHSL(s.h,.5*s.s,s.l)},this.hexColorToColor.set(e,t),t}getViewportScale(e){return Math.sqrt(Math.min(e.width,e.height)/z.Z.pinHeadMesh.scale.baseViewportSize)}clearSelected(){this.selectedMesh.visible=!1,this.selected=null}}class ae extends n.Line{constructor(e,t,i,s,a){const o=new n.BufferGeometry,r=new Float32Array(6);r[0]=r[1]=r[2]=0,r[3]=e.x,r[4]=e.y,r[5]=e.z,o.setAttribute("position",new n.BufferAttribute(r,3));const d=new ie.l0;super(o,d),this.geometry=o,this.layers.mask=i.mask,this.visible=t,this.vector=e.clone(),this.onBeforeRender=(e,t,i,n,o)=>{const r=o;r.uniforms.pinHeadMatrix.value.copy(s.matrixWorld),r.uniforms.resolution.value.set(a.width,a.height),r.uniformsNeedUpdate=!0},this.pinStemMaterial=d}dispose(){this.geometry.dispose()}updatePosition(e){this.vector.copy(e.stemNormal).setLength(Math.max(e.stemLength,.01));const t=this.geometry.getAttribute("position");t.setXYZ(1,this.vector.x,this.vector.y,this.vector.z),t.needsUpdate=!0}}var oe=i(39689),re=i(89557);class de extends n.Object3D{constructor(e,t,i,s,a,o,r,d,l,h,c){super(),this.pinId=e,this.pinType=t,this.pinColor=s,this.stemVector=new n.Vector3,this.stemEnabled=!0,this.currentColorVariant=F.K_.DEFAULT,this.baseOpacity=1,this.opacityScale=1,this.pinHeadGeometryInst=new n.PlaneGeometry(z.l,z.l),this.pinHeadGeometryInst.setAttribute("instanceUvOffset",new n.BufferAttribute(a,2)),this.pinHeadGeometryInst.setAttribute("instanceUvScale",new n.BufferAttribute(o,1)),this.pinHeadGeometryInst.setAttribute("instanceStrokeWidth",new n.BufferAttribute(c,1)),de.pinHeadGeometry||(de.pinHeadGeometry=new n.PlaneGeometry(z.l,z.l));const m=(new n.Color).copy(s.baseColor);this.pinHeadMeshMaterial=new ie.Nv(m,l,h,1),this.pinHeadMesh=new H.$(e,this.pinHeadGeometryInst,this.pinHeadMeshMaterial,r),this.add(this.pinHeadMesh),this.stemMesh=new ae(i.stemNormal,i.stemEnabled,r,this.pinHeadMesh,d),this.add(this.stemMesh),this.updateMeshPosition(i),this.opacityAnimation=new re.z(1)}dispose(){this.remove(this.pinHeadMesh),this.pinHeadMesh.material.dispose(),this.pinHeadMesh.dispose(),this.remove(this.stemMesh),this.stemMesh.dispose()}static disposeAll(){de.pinHeadGeometry.dispose()}updateFromPin(e,t,i,s,a,o,r){this.position.copy(e.anchorPosition),this.pinHeadMesh.updatePosition(e),this.stemVector.copy(e.stemNormal).setLength(e.stemLength),this.stemEnabled=e.stemEnabled,this.stemMesh.updatePosition(e),this.stemMesh.visible=e.stemEnabled,this.pinHeadGeometryInst.setAttribute("instanceUvOffset",new n.BufferAttribute(i,2)),this.pinHeadGeometryInst.setAttribute("instanceUvScale",new n.BufferAttribute(s,1)),this.pinHeadGeometryInst.setAttribute("instanceStrokeWidth",new n.BufferAttribute(r,1)),t!==this.pinColor&&(this.pinColor=t,this.setColorVariant(this.currentColorVariant));const d=this.pinHeadMeshMaterial.uniforms;d.bg.value===a&&d.mask.value===o||(d.bg.value=a,d.mask.value=o,this.pinHeadMeshMaterial.uniformsNeedUpdate=!0)}setColorVariant(e){const t=(0,oe.k)(this.pinColor,e);this.pinHeadMeshMaterial.uniforms.color.value.copy(t),this.currentColorVariant=e}setOpacity(e){this.baseOpacity=e,this.updateOpacity()}setOpacityScale(e){this.opacityScale=e,this.updateOpacity()}fadeOpacity(e){e>0&&(this.visible=!0),this.opacityAnimation.modifyAnimation(this.opacityAnimation.value,e,300).onComplete((()=>{e<=0&&(this.visible=!1)}))}setVisibility(e,t){this.visible=e,this.pinHeadMesh.visible=e,this.stemMesh.visible=e&&t}setStemEnabled(e){this.stemMesh.visible=this.visible&&e}updateMeshPosition(e){this.position.copy(e.anchorPosition),this.pinHeadMesh.updatePosition(e),this.stemMesh.updatePosition(e)}update(e,t,i,n){this.pinHeadMesh.update(t,i,n);const s=this.opacityAnimation.active;this.opacityAnimation.tick(e),s&&this.updateOpacity()}setRenderOverrides(e,t){this.pinHeadMesh.material=e?new ie.m0(e,!1):this.pinHeadMeshMaterial,t?this.pinHeadMesh.geomScale.copy(t):this.pinHeadMesh.geomScale.set(1,1,1),this.setOpacity(this.pinHeadMeshMaterial.opacity)}updateOpacity(){const e=this.opacityAnimation.value*this.baseOpacity*this.opacityScale;if(this.pinHeadMeshMaterial.opacity=e,this.pinHeadMeshMaterial.uniforms.alpha.value=e,this.pinHeadMesh.material!==this.pinHeadMeshMaterial){this.pinHeadMesh.material.opacity=e;const t=this.pinHeadMesh.material;t&&t.uniforms&&t.uniforms.alpha&&(t.uniforms.alpha.value=e)}this.stemMesh.pinStemMaterial.uniforms.alpha.value=e}}var le=i(81346);class he extends se{constructor(e,t,i,n,s,a,o,r){super(e,n,s,a),this.camera=t,this.canvasData=i,this.codepointMap=r,this.idToMesh=new Map,this.inputCallbacks=o}dispose(){super.dispose(),this.removePinsByPredicate((()=>!0)),de.disposeAll()}activate(e){this.bindings.length>0||(super.activate(e),this.bindings.push(this.input.registerPriorityHandler(M.R,H.$,((e,t)=>{const i=t.parent;return this.inputCallbacks.onClick(i.pinId,i.pinType),!0}))),(0,r.Jm)()||(this.bindings.push(this.input.registerMeshHandler(Q.z,S.s.isType(H.$),((e,t)=>{const i=t.parent;this.inputCallbacks.onHover(i.pinId,i.pinType)}))),this.bindings.push(this.input.registerMeshHandler(Q.A,S.s.isType(H.$),((e,t)=>{const i=t.parent;this.inputCallbacks.onUnhover(i.pinId,i.pinType)})))))}render(e){const t=this.getViewportScale(this.canvasData);this.idToMesh.forEach((i=>{i.update(e,this.camera,t,this.canvasData)})),super.render(e)}updatePin(e,t,i,n,s,a){var o,r;super.updatePin(e,t,i,n,s,a);const d=this.getColor(i.color),l=(0,oe.m)(t,i.icon,this.iconsEnabled),h=le.f[l],c=this.codepointMap[+h],m=new Float32Array(8),u=new Float32Array(4),p=new Float32Array(4);if(c){const{u:e,v:t,uvScale:i}=c;u[0]=i,u[1]=i,u[2]=i,u[3]=i,m[0]=e,m[2]=e,m[4]=e,m[6]=e,m[1]=t,m[3]=t,m[5]=t,m[7]=t}const g=t===F.Er.OBJECT?0:.06;p[0]=g,p[1]=g,p[2]=g,p[3]=g;let v=this.idToMesh.get(e);v||(v=new de(e,t,i,d,m,u,this.layer,this.canvasData,n,s,p),this.idToMesh.set(e,v),this.input.registerMesh(v.pinHeadMesh,!1)),void 0!==a&&(v.visible=a),v.updateFromPin(i,d,m,u,n,s,p);const y=i.floorId;v.parent&&(null===(o=v.parent)||void 0===o?void 0:o.userData.floorId)===y||(v.parent&&(null===(r=v.parent)||void 0===r||r.remove(v)),this.getFloorContainer(y).userData.typeContainers[t].add(v))}removePin(e){var t;super.removePin(e);const i=this.idToMesh.get(e);i&&(this.idToMesh.delete(e),null===(t=i.parent)||void 0===t||t.remove(i),this.input.unregisterMesh(i.pinHeadMesh),i.dispose())}removePinsByPredicate(e){this.idToMesh.forEach(((t,i)=>{e(t.pinType)&&this.removePin(i)}))}setPinVisible(e,t){const i=this.idToMesh.get(e);i&&(i.visible=t)}setPinColorVariant(e,t){const i=this.idToMesh.get(e);i&&i.setColorVariant(t)}setPinColorVariants(e,t){this.idToMesh.forEach((i=>{i.pinId!==t&&i.setColorVariant(e)}))}setPinColorVariantByType(e,t,i){this.idToMesh.forEach((n=>{n.pinType===e&&n.pinId!==i&&n.setColorVariant(t)}))}setPinOpacity(e,t){const i=this.idToMesh.get(e);i&&i.setOpacity(t)}setPinOpacityScale(e,t){const i=this.idToMesh.get(e);i&&i.setOpacityScale(t)}fadePinOpacity(e,t){const i=this.idToMesh.get(e);i&&i.fadeOpacity(t)}setPinOpacityByType(e,t,i){this.idToMesh.forEach((n=>{n.pinType===e&&n.pinId!==i&&n.setOpacity(t)}))}fadePinOpacityByType(e,t,i=[]){this.idToMesh.forEach((n=>{n.pinType!==e||i.includes(n.pinId)||n.fadeOpacity(t)}))}setPinRenderOverrides(e,t,i){super.setPinRenderOverrides(e,t,i);const n=this.idToMesh.get(e);n&&n.setRenderOverrides(t,i)}pinHeadTransform(e){const t=this.idToMesh.get(e);return t?t.pinHeadMesh.matrixWorld:new n.Matrix4}}var ce=i(66372),me=i(49827),ue=i(21646),pe=i(90304),ge=i(79183);const ve=new ie.uW,ye=new E.Z("InstancedPinHeads");class we extends n.InstancedMesh{constructor(e){const t=new n.BufferGeometry,i=new Float32Array(6);i[0]=i[1]=i[2]=0,i[3]=1,i[4]=1,i[5]=1,t.setAttribute("position",new n.BufferAttribute(i,3));const s=new Float32Array(3*e),a=new n.InstancedBufferAttribute(s,3);t.setAttribute("stemVector",a);const o=new Float32Array(e),r=new n.InstancedBufferAttribute(o,1);t.setAttribute("instanceAlpha",r);const d=[],l=[];for(let i=0;i<4;i++){const s=new Float32Array(4*e),a=new n.InstancedBufferAttribute(s,4);t.setAttribute(`pinHeadMatrixCol${i}`,a),d.push(s),l.push(a)}super(t,ve,e),this.maxCount=e,this.stemVectorArray=s,this.stemVectorAttrib=a,this.pinHeadMatrixArray=d,this.pinHeadMatrixAttrib=l,this.opacityArray=o,this.opacityAttrib=r,this.renderOrder=j.z.lines,this.posMatrix=new n.Matrix4,this.isLine=!0,this.isMesh=!1}update(e,t){let i=0;for(const t of e){if(!t.visible||!t.stemEnabled||t.stemLength<.001)continue;if(i>=this.maxCount){ye.error("Instance count is too small!");continue}this.posMatrix.setPosition(t.anchorPosition),this.setMatrixAt(i,this.posMatrix),this.opacityArray[i]=t.opacity*t.opacityAnimation.value*t.opacityScale;const e=3*i;t.pinHeadObjPosition.toArray(this.stemVectorArray,e);let n=0;for(let e=0;e<4;e++)for(let s=0;s<4;s++)this.pinHeadMatrixArray[e][s+4*i]=t.pinHeadMatrix.elements[n++];i++}this.count=i,this.visible=this.count>0,this.instanceMatrix.needsUpdate=!0,this.stemVectorAttrib.needsUpdate=!0;for(const e of this.pinHeadMatrixAttrib)e.needsUpdate=!0;this.opacityAttrib.needsUpdate=!0,ve.uniforms.resolution.value.set(t.width,t.height),ve.uniformsNeedUpdate=!0}}const fe=new E.Z("InstancedPinRenderer");class be extends se{constructor(e,t,i,s,a,o,r,d){super(e,s,a,o),this.camera=t,this.canvasData=i,this.codepointMap=d,this.pins=new Map,this.idToPin=new Map,this.keyToRenderObjs=new Map,this.updatePinHeadMatrix=(()=>{const e=new n.Vector3,t=new n.Vector3,i=new n.Vector3,s=new n.Vector3,a=new n.Vector3,o=new n.Vector3,r=new n.Vector3;return n=>{const d=z.Z.pinHeadMesh.scale,l=this.getViewportScale(this.canvasData),h=1+d.responsiveness/100*(l-1);this.camera.getWorldPosition(o);const c=this.camera.quaternion,m=this.canvasData;for(const l of n){r.copy(l.pinHeadObjPosition).add(l.anchorPosition);const n=o.distanceTo(r),u=d.maxSize-(d.maxSize-d.minSize)*(0,ce.C)(n,d.nearBound,d.farBound);t.copy(r).project(this.camera),i.set(m.width/2,m.height/2,1).multiply(t),s.set(u/2,0,0).add(i),a.set(2/m.width,2/m.height,1).multiply(s);const p=a.unproject(this.camera).distanceTo(r)*h,g=(0,me.uZ)(p,ue.Z.epsilon,p),v=l.geomScale||pe.f.UNIT;e.set(g*v.x,g*v.y,g*v.z),l.pinHeadMatrix.compose(r,c,e)}}})(),this.inputCallbacks=r}dispose(){super.dispose()}activate(e){this.bindings.length>0||(super.activate(e),this.bindings.push(this.input.registerPriorityHandler(M.R,ge.z,((e,t,i)=>{if(!i||void 0===i.instanceId)return!0;const n=t.renderedPins[i.instanceId];return this.inputCallbacks.onClick(n.id,n.pinType),!0}))),(0,r.Jm)()||(this.bindings.push(this.input.registerMeshHandler(Q.z,S.s.isType(ge.z),((e,t,i)=>{if(!i||void 0===i.instanceId)return;const n=t.renderedPins[i.instanceId];this.lastHoverId=n.id,this.lastHoverType=n.pinType,this.inputCallbacks.onHover(n.id,n.pinType)}))),this.bindings.push(this.input.registerMeshHandler(Q.A,S.s.isType(ge.z),(()=>{this.inputCallbacks.onUnhover(this.lastHoverId,this.lastHoverType)})))))}render(e){var t,i,n,s;for(const a of this.pins.values()){const o=Array.from(a.values());if(0===o.length)continue;const r=this.keyFromPin(o[0]),d=this.keyToRenderObjs.get(r);if(!d){fe.error("Expecting renderObjs for this key.",this.keyToRenderObjs,this.keyFromPin(o[0]));continue}let{lines:l,pinHeads:h}=d;if(o.forEach((t=>t.opacityAnimation.tick(e))),this.updatePinHeadMatrix(o),l.maxCount<o.length){const e=l.parent;if(!e){fe.error("Expecting a parent.");continue}e.remove(l),l.dispose(),e.remove(h),this.input.unregisterMesh(h);const{backgroundTexture:t,maskTexture:i,overrideTexture:n}=o[0];h.dispose(),Object.assign(d,this.createInstances(e,d.id,o.length+16,t,i,n)),l=d.lines,h=d.pinHeads}l.update(o,this.canvasData),(null===(t=o[0].maskTexture)||void 0===t?void 0:t.uuid)&&(null===(s=null===(n=null===(i=h.material.uniforms)||void 0===i?void 0:i.mask)||void 0===n?void 0:n.value)||void 0===s?void 0:s.uuid)&&o[0].maskTexture.uuid!==h.material.uniforms.mask.value.uuid&&h.updateMaskTexture(o[0].maskTexture),h.update(o)}super.render(e)}updatePin(e,t,i,s,a,o){var r;super.updatePin(e,t,i,s,a,o);let d=this.idToPin.get(e);const l=i.floorId,h=this.getColor(i.color).baseColor,c=`${l}_${t}_${(null===(r=null==d?void 0:d.overrideTexture)||void 0===r?void 0:r.uuid)||s.uuid}`,m=(0,oe.m)(t,i.icon,this.iconsEnabled),u=le.f[m],p=this.codepointMap[+u],g=t===F.Er.OBJECT?0:.06;if(!d){d=Object.assign(Object.assign({id:e},i),{visible:!0,opacity:1,opacityScale:1,pinType:t,opacityAnimation:new re.z(0),backgroundTexture:s,maskTexture:a,pinHeadMatrix:new n.Matrix4,pinHeadObjPosition:new n.Vector3,pinColor:h,colorVariant:F.K_.DEFAULT,overrideTexture:null,geomScale:null,pinIconUVOffset:p,pinStrokeWidth:g,needsEntryAnimation:!0}),this.idToPin.set(e,d);let o=this.pins.get(c);o||(o=new Map,this.pins.set(c,o)),o.set(e,d),this.createRenderObjsForPin(d)}const v=this.keyFromPin(d);Object.assign(d,i,{pinType:t,textureId:s.uuid,maskTexture:a}),this.changePinHeadGroupIfNeeded(v,c,d),d.pinHeadObjPosition.copy(d.stemNormal).setLength(d.stemLength),d.pinColor=(0,oe.k)(this.getColor(d.color),d.colorVariant),d.pinIconUVOffset=p,d.pinStrokeWidth=g,void 0!==o&&this.setPinVisible(e,o),p&&d.needsEntryAnimation&&(d.opacityAnimation.modifyAnimation(d.opacityAnimation.value,1,500,te.ad),d.opacityAnimation.onComplete((()=>{d&&(d.needsEntryAnimation=!1)})))}removePin(e){super.removePin(e);const t=this.idToPin.get(e);if(!t)return;this.idToPin.delete(e);const i=this.keyFromPin(t),n=this.pins.get(i);n&&(n.delete(e),this.cleanupRenderObjIfNeeded(i))}removePinsByPredicate(e){this.idToPin.forEach(((t,i)=>{e(t.pinType)&&this.removePin(i)}))}setPinVisible(e,t){const i=this.idToPin.get(e);i?i.visible=t:fe.error("setPinVisible on a pin that doesn't exist.",e)}setPinColorVariant(e,t){const i=this.idToPin.get(e);i?(i.colorVariant=t,i.pinColor=(0,oe.k)(this.getColor(i.color),t)):fe.error("setPinColorVariant on a pin that doesn't exist.")}setPinColorVariants(e,t){this.idToPin.forEach(((i,n)=>{n!==t&&this.setPinColorVariant(n,e)}))}setPinColorVariantByType(e,t,i){this.idToPin.forEach(((n,s)=>{n.pinType===e&&s!==i&&this.setPinColorVariant(s,t)}))}setPinOpacity(e,t){const i=this.idToPin.get(e);i?i.opacity=t:fe.error("setPinOpacity on a pin that doesn't exist.")}setPinOpacityScale(e,t){const i=this.idToPin.get(e);i?i.opacityScale=t:fe.error("setPinOpacityScale on a pin that doesn't exist.")}fadePinOpacity(e,t){const i=this.idToPin.get(e);i?(t>0&&this.setPinVisible(e,!0),i.opacityAnimation.modifyAnimation(i.opacityAnimation.value,t,300).onComplete((()=>{i.opacityAnimation.endValue<=0&&this.setPinVisible(e,!1)}))):fe.error("setPinVisible on a pin that doesn't exist.",e)}setPinOpacityByType(e,t,i){this.idToPin.forEach(((n,s)=>{n.pinType===e&&s!==i&&this.setPinOpacity(s,t)}))}fadePinOpacityByType(e,t,i=[]){this.idToPin.forEach(((n,s)=>{n.pinType!==e||i.includes(s)||this.fadePinOpacity(s,t)}))}setPinRenderOverrides(e,t,i){super.setPinRenderOverrides(e,t,i);const n=this.idToPin.get(e);if(!n)return void fe.error("setPinRenderOverrides on a pin that doesn't exist.");const s=this.keyFromPin(n);if(!this.keyToRenderObjs.get(s))return void fe.error("Expecting renderObjs while setting override material");n.overrideTexture=t,n.geomScale=i;const a=this.keyFromPin(n);this.changePinHeadGroupIfNeeded(s,a,n)}pinHeadTransform(e){const t=this.idToPin.get(e);return t?t.pinHeadMatrix:(fe.error("pinHeadTransform on a pin that doesn't exist."),new n.Matrix4)}keyFromPin(e){return`${e.floorId}_${e.pinType}_${e.overrideTexture?e.overrideTexture.uuid:e.backgroundTexture.uuid}`}createRenderObjsForPin(e){const{backgroundTexture:t,maskTexture:i,overrideTexture:n}=e,s=this.keyFromPin(e);if(this.keyToRenderObjs.get(s))return;const a=this.getFloorContainer(e.floorId).userData.typeContainers[e.pinType];a.userData||(a.userData={});const o=e.overrideTexture?e.overrideTexture.uuid:e.backgroundTexture.uuid;if(!a.userData[o]){const e=this.createInstances(a,o,16,t,i,n);a.userData[o]=e,this.keyToRenderObjs.set(s,e)}}createInstances(e,t,i,n,s,a){const o=new we(i);o.layers.mask=this.layer.mask,e.add(o);const r=new ge.z(i,a||n,a?null:s,!a);return r.layers.mask=this.layer.mask,e.add(r),this.input.registerMesh(r,!1),{lines:o,pinHeads:r,id:t}}changePinHeadGroupIfNeeded(e,t,i){if(e!==t){let n=this.pins.get(t);n||(n=new Map,this.pins.set(t,n)),n.set(i.id,i),this.createRenderObjsForPin(i);const s=this.pins.get(e);s&&(null==s||s.delete(i.id),this.cleanupRenderObjIfNeeded(e))}}cleanupRenderObjIfNeeded(e){const t=this.pins.get(e),i=this.keyToRenderObjs.get(e);if(t&&0===t.size&&i){const t=i.lines.parent;if(this.input.unregisterMesh(i.pinHeads),this.pins.delete(e),this.keyToRenderObjs.delete(e),!t)return void fe.error("Expecting pinTypeObj!");t.userData[i.id]=void 0,t.remove(i.lines),t.remove(i.pinHeads)}}}var Te=i(80742),De=i(67557);const Ce=i.p+"images/pinIconDefault.png";var Pe=i(34029);const Ae=Object.values(F.Qk),Ie=e=>e.map((e=>String.fromCharCode(+le.f[e]))),Ee={fontPath:"fonts/mp-font.woff",fontWeight:700,fontFamily:"mp-font",fontStyle:"normal",fontSize:120,squareSize:128,width:4096,height:4096,transparent:!0,defaultCharset:De.Tz.NONE,initialChars:Ie(Ae),outline:!1,outlineWidth:0,texturePadding:0};class Se extends s.Y{constructor(){super(...arguments),this.name="pins",this.editActivated=!1,this.editBindings=[],this.touchDevice=(0,r.Jm)(),this.worldPosition=new n.Vector3,this.fontManager=De.Qi.instance,this.visibilityChanged=()=>{const e=!this.in360View(),t=!this.interactionmodeData.isVR();this.pinRenderer.container.visible=e&&t;const{floorsViewData:i}=this,n=this.viewmode===g.Ey.Dollhouse||this.viewmode===g.Ey.Floorplan,s=i.transition.progress.active?()=>!0:i.isHidden;this.pinRenderer.setFloorsHidden(n?s:()=>!1)},this.viewmodeChanged=e=>{this.viewmode=e.toMode,this.visibilityChanged()},this.onEnablePinEditing=async e=>{e.enabled?this.enableEditing():this.disableEditing()},this.updateCurrentPin=()=>{const{pinEditorState:e,focusedPin:t,selectedPinId:i}=this.viewData;if(e!==F.V8.CREATING){const e=i?this.viewData.getPin(i):null,n=t||e;if(this.pinEditor.updateAnchorMesh(),n){const{id:e,pinType:t,backgroundTexture:i}=n;this.pinRenderer.updatePin(e,t,n,i,this.iconMaskTexture),this.pinRenderer.setPinColorVariant(e,F.K_.HIGHLIGHTED),this.pinRenderer.setPinColorVariants(F.K_.DEFAULT,e)}else this.pinRenderer.setPinColorVariants(F.K_.DEFAULT)}},this.onUpdatePin=async e=>{const{id:t,pinType:i,properties:n}=e,s=this.viewData.getPin(t);if(s&&s.pinType===i){const{focusedPin:e,selectedPinId:i}=this.viewData,a=i?this.viewData.getPin(i):null,o=Object.assign(Object.assign({},s),n);this.viewData.updatePin(o),this.pinRenderer.updatePin(o.id,o.pinType,o,o.backgroundTexture,this.iconMaskTexture),(null==a?void 0:a.id)===t&&(this.saveScreenPosition(o),this.updateCurrentPin()),(null==e?void 0:e.id)===t&&this.saveScreenPosition(o),o.icon&&this.addIconsToAtlas([o.icon])}else this.log.debug(`Cannot update non-existent ${i} pin`)},this.onUpdatePinViews=async e=>{const{pinViews:t}=e,i=[];t.forEach((e=>{this.viewData.updatePin(e),this.pinRenderer.updatePin(e.id,e.pinType,e,e.backgroundTexture,this.iconMaskTexture,e.visible),this.viewData.selectedPinId===e.id&&(this.viewData.updatePin(e),this.updateCurrentPin()),void 0!==e.opacity&&this.pinRenderer.setPinOpacity(e.id,e.opacity),void 0!==e.scale&&this.pinRenderer.setPinRenderOverrides(e.id,null,e.scale),e.icon&&i.push(e.icon)})),this.addIconsToAtlas(i)},this.addIconsToAtlas=(e=Ae)=>{const t=Ie(e);this.fontManager.getFont(this.fontId).addCharsIfNeeded(t.join(""))},this.refreshPins=()=>{this.viewData.iteratePins(((e,t)=>{this.pinRenderer.updatePin(e.id,e.pinType,e,e.backgroundTexture,this.iconMaskTexture)}))},this.onChangePinVisibility=async e=>{const{id:t,pinType:i,visible:n}=e,s=this.viewData.getPin(t);if(s&&s.pinType===i){this.pinRenderer.setPinVisible(t,n);const{selectedPinId:e,focusedPin:i}=this.viewData;n||e!==t||this.changeSelectedPin(null),n||(null==i?void 0:i.id)!==t||this.viewData.setFocusedPin(null)}else this.log.debug(`Cannot change visibility of non-existent ${i} pin`)},this.onChangePinVisibilityByType=async e=>{const{pinType:t,visible:i}=e;this.pinRenderer.setPinTypeVisible(t,i)},this.onChangePinOpacity=async e=>{const{id:t,pinType:i,opacity:n}=e,s=this.viewData.getPin(t);s&&s.pinType===i?this.pinRenderer.setPinOpacity(t,n):this.log.debug(`Cannot change opacity of non-existent ${i} pin`)},this.onChangePinOpacityScale=async e=>{const{id:t,pinType:i,scale:n}=e,s=this.viewData.getPin(t);s&&s.pinType===i?this.pinRenderer.setPinOpacityScale(t,n):this.log.debug(`Cannot change opacity scaling of non-existent ${i} pin`)},this.onChangePinOpacityByType=async e=>{const{pinType:t,opacity:i,skipIds:n}=e;this.pinRenderer.fadePinOpacityByType(t,i,n)},this.onUnselectPin=async e=>{const{pinType:t,id:i}=e,{selectedPinId:n}=this.viewData,s=n?this.viewData.getPin(n):null;(null==s?void 0:s.pinType)===t&&(null==s?void 0:s.id)===i&&this.changeSelectedPin(null)},this.clearPinSelection=async()=>{this.changeSelectedPin(null)},this.onStartPinCreation=async e=>{const{id:t,pin:i,pinType:n,backgroundTexture:s}=e,a=this.viewData,o=Object.assign(Object.assign({id:t,pinType:n},i),{backgroundTexture:s});a.setEditablePin(!0),a.setPinEditorState(F.V8.CREATING),this.changeSelectedPin(o),this.pinEditor.startPinCreation()},this.saveScreenPosition=(()=>{const e=new n.Vector3;return t=>{const i=this.viewData;e.copy(t.stemNormal).setLength(t.stemLength),this.worldPosition.copy(t.anchorPosition).add(e);const n=(0,o.q9)(this.cameraData,this.worldPosition);i.setScreenPosition(n.ndcPosition.z>1?null:n.screenPosition)}})(),this.onCameraUpdate=()=>{const{creatingNewPin:e,focusedPin:t,selectedPinId:i}=this.viewData,n=i?this.viewData.getPin(i):null;!e&&t?this.saveScreenPosition(t):n&&this.saveScreenPosition(n)},this.handleSweepChange=()=>this.handleSweepAndViewModeChange(),this.handleViewModeChange=()=>this.handleSweepAndViewModeChange(),this.cancelPinCreation=()=>{const{creatingNewPin:e,selectedPinId:t}=this.viewData;if(this.changeSelectedPin(null),t){const i=t?this.viewData.getPin(t):null;e&&i&&(this.engine.broadcast(new K.hu(i.id,i.pinType)),this.removePin(i.id,i.pinType),this.pinEditor.endPinCreation())}this.resetEditingState()},this.onPinPlacementCancelled=()=>{this.cancelPinCreation()},this.onCancelNewPin=async()=>{this.cancelPinCreation()},this.onViewChange=()=>{this.cancelPinCreation()},this.handleRemovingPin=async e=>{const{pinType:t,id:i}=e;this.removePin(i,t)},this.handleRemovingPinsByType=async e=>{const{pinType:t}=e,{focusedPin:i,selectedPinId:n}=this.viewData,s=n?this.viewData.getPin(n):null;(null==s?void 0:s.pinType)===t&&this.changeSelectedPin(null),(null==i?void 0:i.pinType)===t&&this.viewData.setFocusedPin(null),this.viewData.removePinsByType(t),this.pinRenderer.removePinsByType(t)},this.onPinClicked=e=>{const{pinType:t,id:i}=e,{creatingNewPin:n,selectedPinId:s}=this.viewData,a=s?this.viewData.getPin(s):null,o=i===(null==a?void 0:a.id)&&t===(null==a?void 0:a.pinType);if(a&&o){if(n)return;this.changeSelectedPin(null)}else if(n)this.cancelPinCreation();else{if(!(i===(null==a?void 0:a.id)&&t===(null==a?void 0:a.pinType))){const e=this.viewData.getPin(i);e&&this.changeSelectedPin(e)}}},this.onHoverChanged=e=>{const{pinType:t,id:i,hovering:n}=e,{creatingNewPin:s,focusedPin:a,selectedPinId:o}=this.viewData;if(!s)if(n){const e=this.viewData.getPin(i);if(!e)return void this.log.debug("Cannot find pin to focus");const n=o?this.viewData.getPin(o):null;if(this.viewData.setFocusedPin(e),n&&n.id===i&&n.pinType===t)return;this.saveScreenPosition(e),this.pinRenderer.setPinColorVariantByType(t,F.K_.DEFAULT,null==a?void 0:a.id),this.pinRenderer.setPinColorVariant(i,F.K_.HIGHLIGHTED)}else a&&(this.pinRenderer.setPinColorVariant(a.id,F.K_.DEFAULT),this.viewData.setFocusedPin(null))},this.onSelectPin=async e=>{const{id:t,pinType:i,editable:n}=e,s=this.viewData,{selectedPinId:a,isPinEditable:o}=s;if(s.setPinEditorState(F.V8.IDLE),t===a&&n===o)return void this.log.debug("Pin is already selected");const r=this.viewData.getPin(t);r&&r.pinType===i?(s.setEditablePin(n),this.changeSelectedPin(r)):this.log.debug(`Cannot select ${i} pin`)},this.clickOffPin=async()=>{this.viewData.creatingNewPin||this.changeSelectedPin(null)},this.movePin=async e=>{const{isPinEditable:t,selectedPinId:i}=this.viewData;if(!t)return;const{pos:n,previousPos:s,id:a}=e,o=i?this.viewData.getPin(i):null;if(o&&o.id===a){const t=Object.assign(Object.assign({},o),e.pos);this.viewData.updatePin(t),this.updateCurrentPin(),this.engine.broadcast(new K.bV(o.id,o.pinType,n,s))}else this.log.debug("Cannot move the pin, not open for edit")},this.placePin=async e=>{const{isPinEditable:t,canPlace:i,selectedPinId:n}=this.viewData;if(!t)return;const s=n?this.viewData.getPin(n):null;s&&i?(this.viewData.setPinEditorState(F.V8.PLACED),this.engine.broadcast(new K.b0(s.id,s.pinType,s))):(this.log.debug("Cannot place pin because there is no open pin"),this.cancelPinCreation())}}async init(e,t){var i;this.engine=t;const[n,s,o,r,g,C]=await Promise.all([t.getModuleBySymbol(a.y.INPUT),t.getModuleBySymbol(a.y.WEBGL_RENDERER),t.market.waitForData(l.W),t.market.waitForData(d.pu),t.getModuleBySymbol(a.y.RAYCASTER),t.market.waitForData(Te.R)]);this.input=n;const P={onClick:(e,i)=>{t.broadcast(new K.F7(e,i))},onHover:(e,i)=>{t.broadcast(new K.tP(e,!0,i)),t.commandBinder.issueCommand(new y.u(w.C.FINGER)),t.commandBinder.issueCommand(new v.y(!0))},onUnhover(e,i){t.broadcast(new K.tP(e,!1,i)),t.commandBinder.issueCommand(new y.u(null)),t.commandBinder.issueCommand(new v.y(!1))}},A=t.claimRenderLayer(this.name);this.defaultPinMaskTexture=(0,U.p)(Ce),this.iconMaskTexture=this.defaultPinMaskTexture;const I=`${null!==(i=(await t.market.waitForData(Pe.e)).getProperty("assetBasePath"))&&void 0!==i?i:""}`;this.fontId=this.fontManager.getFontId(Object.assign(Object.assign({},Ee),{fontPath:`${I}${Ee.fontPath}`}));const{font:E,codepointMap:S}=this.fontManager.getFontAndCodepoints(this.fontId);E.textures[0]&&(this.iconMaskTexture=E.textures[0]),this.bindings.push(E.onChanged((()=>{const e=this.fontManager.getFontAndCodepoints(this.fontId);e.font.textures[0]&&(this.iconMaskTexture=e.font.textures[0]),this.pinRenderer.codepointMap=e.codepointMap,this.refreshPins()}))),this.pinRenderer=s.supportsInstancing()?new be(n,s.getCamera(),o,A,t.commandBinder,g,P,S):new he(n,s.getCamera(),o,A,t.commandBinder,g,P,S),this.pinRenderer.iconsEnabled=e.tagIconsEnabled,s.getScene().add(this.pinRenderer.container),t.addComponent(this,this.pinRenderer),[this.floorsViewData,this.viewmodeData,this.interactionmodeData,this.sweepData,this.cameraData]=await Promise.all([t.market.waitForData(h.c),t.market.waitForData(p.O),t.market.waitForData(c.Z),t.market.waitForData(u.Z),t.market.waitForData(m.M)]),this.viewData=new D.B,this.pinEditor=new Z(this.viewData,this.engine,this.input,this.pinRenderer),this.floorsViewData.iterate((e=>this.pinRenderer.getFloorContainer(e.id))),this.viewmode=this.viewmodeData.currentMode,this.bindings.push(t.commandBinder.addBinding($.Ki,this.onEnablePinEditing),t.commandBinder.addBinding($.Ar,this.onSelectPin),t.commandBinder.addBinding($.RH,this.onUnselectPin),t.commandBinder.addBinding($.iK,this.clearPinSelection),t.commandBinder.addBinding($.yR,this.clickOffPin),t.commandBinder.addBinding($.tE,this.onUpdatePin),t.commandBinder.addBinding($.mE,this.onUpdatePinViews),t.commandBinder.addBinding($.ik,this.onChangePinVisibility),t.commandBinder.addBinding($.qN,this.onChangePinVisibilityByType),t.commandBinder.addBinding($._Y,this.onChangePinOpacity),t.commandBinder.addBinding($.nP,this.onChangePinOpacityScale),t.commandBinder.addBinding($.kb,this.onChangePinOpacityByType),t.commandBinder.addBinding($.fM,this.onStartPinCreation),t.commandBinder.addBinding($.OL,this.handleRemovingPin),t.commandBinder.addBinding($.zM,this.handleRemovingPinsByType),t.commandBinder.addBinding($.I$,this.movePin),this.interactionmodeData.onChanged(this.visibilityChanged),this.floorsViewData.onChanged(this.visibilityChanged),this.viewmodeData.makeModeChangeSubscription(this.visibilityChanged),t.subscribe(f.Z,this.visibilityChanged),t.subscribe(T.a,this.viewmodeChanged),t.subscribe(b.Z,this.viewmodeChanged),t.subscribe(K.F7,this.onPinClicked),this.viewData.onPinEditorStateChanged(this.updateCurrentPin),this.viewData.onSelectedPinChanged(this.updateCurrentPin),this.viewData.onFocusedPinChanged(this.updateCurrentPin),this.viewData.onPinEditableChanged(this.updateCurrentPin),this.cameraData.onChanged(this.onCameraUpdate),C.onPropertyChanged("currentViewId",this.onViewChange)),this.touchDevice||this.bindings.push(t.subscribe(K.tP,this.onHoverChanged));let k=r.application;this.bindings.push(r.onPropertyChanged("application",(e=>{e!==k&&(this.visibilityChanged(),this.viewData.creatingNewPin?this.cancelPinCreation():(this.changeSelectedPin(null),this.viewData.setFocusedPin(null),this.resetEditingState()),k=e)}))),this.visibilityChanged(),t.market.register(this,D.B,this.viewData)}dispose(e){this.disableEditing(),this.pinEditor.dispose(),this.pinRenderer.dispose(),this.bindings.forEach((e=>{e.cancel()})),this.bindings=[],this.editBindings=[],super.dispose(e)}onUpdate(){this.editActivated&&this.pinEditor.update()}in360View(){const e=this.sweepData.currentSweep?this.sweepData.currentSweep:"";return this.viewmodeData.isInside()&&this.sweepData.isSweepUnaligned(e)}enableEditing(){if(!this.editActivated){if(this.editActivated=!0,this.pinEditor.toggleEditing(!0),0===this.editBindings.length){const e=this.engine,t=e.commandBinder;this.editBindings.push(t.addBinding($.ip,this.placePin),t.addBinding($.tT,this.onCancelNewPin),this.sweepData.makeSweepChangeSubscription(this.handleSweepChange),e.subscribe(b.Z,this.handleViewModeChange),e.subscribe(K.pe,this.onPinPlacementCancelled))}else this.editBindings.forEach((e=>{e.renew()}));this.handleSweepAndViewModeChange()}}disableEditing(){this.editActivated&&(this.editActivated=!1,this.pinEditor.toggleEditing(!1),this.cancelPinCreation(),this.editBindings.forEach((e=>{e.cancel()})))}changeSelectedPin(e){const{selectedPinId:t}=this.viewData;if(((null==e?void 0:e.id)||null)===t)return void this.log.debug("Pin selection did not change");(t?this.viewData.getPin(t):null)&&this.pinRenderer.hideSelectedMesh(),e?(this.saveScreenPosition(e),this.viewData.setSelectedPinId(e.id),this.pinRenderer.showSelectedMesh(e.pinType,e.id)):(this.viewData.setScreenPosition(null),this.viewData.setSelectedPinId(null))}handleSweepAndViewModeChange(){const e=this.viewData,t=!this.in360View();e.creatingNewPin&&!t?this.cancelPinCreation():e.setCanAdd(t)}resetEditingState(){const e=this.viewData;e.setPinEditorState(F.V8.IDLE),e.setEditablePin(!1),e.setCanPlace(!0),e.setCanAdd(!this.in360View())}removePin(e,t){const{focusedPin:i,selectedPinId:n}=this.viewData;n===e&&this.changeSelectedPin(null),(null==i?void 0:i.id)===e&&(null==i?void 0:i.pinType)===t&&this.viewData.setFocusedPin(null),this.viewData.removePin(e),this.pinRenderer.removePin(e)}}const ke=Se},49657:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>m});var n,s=i(97542),a=i(69170),o=i(53954),r=i(46368),d=i(9699),l=i(39880);!function(e){e[e.None=0]="None",e[e.Queued=1]="Queued",e[e.Rendering=2]="Rendering",e[e.Rendered=3]="Rendered"}(n||(n={}));class h{constructor(e){this.statusMap={},this.active=[],this.queued=[],this.panoRenderer=e,this.disablePreRendering()}init(){}dispose(){}activate(e){}deactivate(e){this.disablePreRendering()}enablePreRendering(){this.enabled=!0}disablePreRendering(){this.enabled=!1}render(){}beforeRender(){this.enabled&&this.processQueued()}tryPreRender(e){return this.getPreRenderState(e)===n.None&&(this.queued.push(e),this.statusMap[e]=n.Queued,!0)}getPreRenderState(e){const t=this.statusMap[e];return void 0!==t?t:n.None}processQueued(){let e=0;for(const t of Object.keys(this.statusMap))this.statusMap[t]===n.Rendering&&e++;if(0===e&&this.queued.length>0){const e=this.queued.shift();if(e){this.active.push(e),this.statusMap[e]=n.Rendering;this.panoRenderer.activateSweep(e).then((()=>{this.onRendered(e)}))}}}cleanup(e=[]){const t=(0,l.ow)(e),i=[];for(const e of this.queued)t[e]?i.push(e):this.statusMap[e]=n.None;this.queued.length=0,this.queued.push.apply(this.queued,i);const s=[];for(const e of this.active)t[e]?s.push(e):this.statusMap[e]=n.None;this.active.length=0,this.active.push.apply(this.active,s)}onRendered(e){this.statusMap[e]=n.Rendered}}var c=i(34029);class m extends s.Y{constructor(){super(...arguments),this.name="prerenderer-module",this.lastPrerendered=null}async init(e,t){if((await t.market.waitForData(c.e)).getOverrideParam("pre",!0)||e.preRenderTourPanos){this.sweepData=await t.market.waitForData(o.Z);const e=await t.getModuleBySymbol(a.y.SWEEP_PANO);this.panoRenderer=e.getRenderer(),this.preRenderer=new h(this.panoRenderer),t.addComponent(this,this.preRenderer),this.bindings.push(t.subscribe(r.Z,(e=>{this.preRenderer.enablePreRendering(),this.lastPrerendered=null,e.sweepIds&&e.sweepIds.length>=3&&(this.lastPrerendered=e.sweepIds[2],this.preRenderer.tryPreRender(this.lastPrerendered)),this.cleanup(this.sweepData),this.currentRestrictedSweeps=e.sweepIds}))),this.bindings.push(t.subscribe(d.Z,(e=>{this.preRenderer.disablePreRendering(),this.cleanup(this.sweepData,!0),this.currentRestrictedSweeps=null})))}}getCurrentSweeps(){return this.currentRestrictedSweeps||[]}cleanup(e,t=!1){const i=[];e.transition.active?(e.transition.from&&i.push(e.transition.from),e.transition.to&&i.push(e.transition.to)):e.currentSweep&&i.push(e.currentSweep),this.lastPrerendered&&i.push(this.lastPrerendered),t&&this.panoRenderer.freeAllTextures(i),this.preRenderer.cleanup(i)}}},74909:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>y});var n=i(97542),s=i(69170),a=i(56692),o=i(92901),r=i(81396),d=i(35895),l=i(89570),h=i(67678),c=i(86819),m=i(72996);const u=new r.Vector2;class p{constructor(e,t){this.inputIni=e,this.rendererModule=t,this.registrations=new Map,this.hovered=new Map,this.checkPointerLeave=()=>{if(this.hovered.size){const e=v(this.inputIni.getCurrentRayHits());this.hovered.forEach(((t,i)=>{var n,s,a,o,r,d;if(!e.find((e=>e.object===i))){this.hovered.delete(i);const l=Object.assign(Object.assign({},t),{intersections:e});null===(a=null===(n=i.__r3f)||void 0===n?void 0:(s=n.handlers).onPointerOut)||void 0===a||a.call(s,l),null===(d=null===(o=i.__r3f)||void 0===o?void 0:(r=o.handlers).onPointerLeave)||void 0===d||d.call(r,l)}}))}},this.checkPointerMissed=()=>{var e,t,i;const n=new Set(this.inputIni.getCurrentRayHits().map((e=>e.object)));for(const s of this.registrations.keys())n.has(s)||null===(i=null===(e=s.__r3f)||void 0===e?void 0:(t=e.handlers).onPointerMissed)||void 0===i||i.call(t,new MouseEvent("click",this.lastPointerUp.nativeEvent))},this.handlers=[this.initMeshHandlers(),e.registerUnfilteredHandler(h.mE,this.checkPointerLeave),e.registerUnfilteredHandler(c.R,this.checkPointerMissed),e.registerUnfilteredHandler(h.er,(e=>{e.down?this.lastPointerDown=e:this.lastPointerUp=e}))]}dispose(){[...this.handlers,...this.registrations.values()].forEach((e=>e.cancel()))}registerObject3D(e){const t=this.registrations.get(e);if(t)return t;const i=(0,d.k1)((()=>{this.registrations.set(e,i),this.inputIni.registerMesh(e,!1,(t=>function(e){let t=e;for(;t&&!g(t);)t=t.parent;return t}(t)===e))}),(()=>{this.registrations.delete(e),this.hovered.delete(e),this.inputIni.unregisterMesh(e)}),!1);return i.renew(),i}initMeshHandlers(){const e=new WeakMap,t=(t,i,n)=>{var s,a,o,d,l,m,p,y,w,f,b,T;let D=null;for(let e=i;e;e=e.parent)g(e)&&(D||(D=[])).push(e);if(!D)return!1;const C=this.rendererModule.getCamera(),P=new r.Vector2(t.position.x,t.position.y);let A;n||(n=e.get(i)||{});let I=0;if(t instanceof c.R){const{x:e,y:t}=this.lastPointerDown.clientPosition,{x:i,y:n}=this.lastPointerUp.clientPosition;I=u.set(i-e,n-t).length(),A=new MouseEvent("click",this.lastPointerUp.nativeEvent)}else A=t.nativeEvent;const E=v(this.inputIni.getCurrentRayHits()),S={};for(const e in A)"function"!=typeof A[e]&&(S[e]=A[e]);const k=Object.assign(Object.assign(Object.assign({},S),n),{intersections:E,camera:C,delta:I,eventObject:i,nativeEvent:A,sourceEvent:A,pointer:P,ray:this.inputIni.getCurrentPointerRay(),stopPropagation:()=>{k.stopped=!0,this.handleStopPropagation(k.eventObject,E),t.stopPropagation(),t.preventDefault()},stopped:!1,unprojectedPoint:new r.Vector3(P.x,P.y,0).unproject(C),spaceX:P.x,spaceY:P.y});for(const i of D){e.set(i,n);const r=i.__r3f;if(r&&g(i)&&(k.eventObject=i,t instanceof h.er?t.down?null===(a=(s=r.handlers).onPointerDown)||void 0===a||a.call(s,k):null===(d=(o=r.handlers).onPointerUp)||void 0===d||d.call(o,k):t instanceof h.mE?(this.hovered.has(i)||(this.hovered.set(i,k),null===(m=(l=r.handlers).onPointerOver)||void 0===m||m.call(l,k),null===(y=(p=r.handlers).onPointerEnter)||void 0===y||y.call(p,k)),null===(f=(w=r.handlers).onPointerMove)||void 0===f||f.call(w,k)):t instanceof c.R&&(null===(T=(b=r.handlers).onClick)||void 0===T||T.call(b,k)),k.stopped))return!0}return!1},i=[h.er,h.mE,c.R];return new l.V(...i.map((e=>this.inputIni.registerMeshHandler(e,m.s.isAny(),t))))}handleStopPropagation(e,t){if(this.hovered.has(e)){const i=t.findIndex((t=>t.object===e));if(i>-1){const e=[];for(let n=i+1;n<t.length;n++)for(let i=t[n].object;i;i=i.parent){const t=this.hovered.get(i);t&&e.push({obj:i,origEvent:t})}e.forEach((({obj:e,origEvent:i})=>{var n,s,a;const o=Object.assign(Object.assign({},i),{intersections:t,eventObject:e});this.hovered.delete(e);const r=null===(n=e.__r3f)||void 0===n?void 0:n.handlers;null===(s=null==r?void 0:r.onPointerOut)||void 0===s||s.call(r,o),null===(a=null==r?void 0:r.onPointerLeave)||void 0===a||a.call(r,o)}))}}}}function g(e){const t=e.__r3f;return!!t&&(t.hasOwnProperty("eventCount")?(t.eventCount||0)>0:t.handlers&&Object.keys(t.handlers).length>0)}function v(e){const t=new Set;return e.filter((e=>{const i=t.has(e.object);return t.add(e.object),!i}))}class y extends n.Y{constructor(){super(...arguments),this.name="react-three-fiber-external",this.onPlayerResized=e=>{var t;null===(t=this.externalCallbacks)||void 0===t||t.onSizeChange(e.width,e.height)},this.onPixelRatioChanged=e=>{var t;null===(t=this.externalCallbacks)||void 0===t||t.onPixelRatioChange(e.pixelRatio)}}async init(e,t){this.bindings.push(t.subscribe(a.a,this.onPlayerResized),t.subscribe(o.Vx,this.onPixelRatioChanged));const[i,n]=await Promise.all([t.getModuleBySymbol(s.y.INPUT),t.getModuleBySymbol(s.y.WEBGL_RENDERER)]);this.rendererModule=n,this.eventsAdapter=new p(i,n)}dispose(e){this.eventsAdapter.dispose(),super.dispose(e)}onUpdate(e){var t;null===(t=this.externalCallbacks)||void 0===t||t.onFrame()}registerExternalR3F(e){if(this.externalCallbacks)throw new Error("registerExternalR3F called twice");return this.externalCallbacks=e,{renderer:this.rendererModule.threeRenderer,scene:this.rendererModule.getScene().scene,camera:this.rendererModule.getCamera(),registerMeshEvents:e=>this.eventsAdapter.registerObject3D(e)}}}},74642:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>v});var n=i(97542),s=i(69170),a=i(5332),o=i(17878),r=i(31362),d=i(41603),l=i(68191),h=i(81396),c=i(41187),m=i(23254),u=i(41326),p=i(64918),g=i(95882);class v extends n.Y{constructor(){super(...arguments),this.name="screenshots-module",this.capturer=new y}async init(e,t){this.engine=t,[this.settingsModule,this.canvas,this.renderer,this.renderToTexture]=await Promise.all([t.getModuleBySymbol(s.y.SETTINGS),t.market.waitForData(a.W),t.getModuleBySymbol(s.y.WEBGL_RENDERER),t.getModuleBySymbol(s.y.RENDER_TO_TEXTURE)]),this.settingsModule.registerButton("Debug","Take screenshot",(async()=>{const e=Date.now();await this.takeAndDownloadScreenshot({height:this.canvas.height,width:this.canvas.width},`image_${e}.jpg`,o.o.ALL)})),this.settingsModule.registerButton("Debug","Take 4k screenshot",(async()=>{const e=Date.now();await this.takeAndDownloadScreenshot({height:2304,width:4096},`image_${e}.jpg`,o.o.ALL)})),this.settingsModule.registerButton("Debug","Take 8k screenshot",(async()=>{const e=Date.now();await this.takeAndDownloadScreenshot({height:4608,width:8192},`image_${e}.jpg`,o.o.ALL)})),this.settingsModule.registerButton("Debug","Take 16k screenshot",(async()=>{const e=Date.now();await this.takeAndDownloadScreenshot({height:9e3,width:16e3},`image_${e}.jpg`,o.o.ALL)})),this.settingsModule.registerButton("Debug","Take FB 3D screenshot",(async()=>{const e=Date.now(),t=this.engine.getRenderLayer("model-mesh"),i=this.engine.getRenderLayer("skybox"),n=t.clone();n.addLayers(i);const s=(await this.engine.market.waitForData(m.O)).currentMode;try{await this.takeAndDownloadScreenshot({height:this.canvas.height,width:this.canvas.width},`image_${e}.jpg`,n),await this.engine.commandBinder.issueCommand(new l.U(l.U.modes.Depth)),await this.engine.commandBinder.issueCommand(new u._i(u.BD.MESH,p.n.Instant)),await this.takeAndDownloadScreenshot({height:Math.floor(this.canvas.height/4),width:Math.floor(this.canvas.width/4)},`image_${e}_depth.jpg`,t)}catch(e){throw this.log.error("Could not take screenshot"),e}finally{await this.engine.commandBinder.issueCommand(new l.U(null)),await this.engine.commandBinder.issueCommand(new u._i(u.KP[s||g.Ey.Panorama]))}}))}async takeAndDownloadScreenshot(e,t,i){this.renderTarget||(this.renderTarget=await this.engine.commandBinder.issueCommandWhenBound(new c.oM));const n=await this.capturer.capture(i,e,this.renderer,this.renderToTexture,this.renderTarget);(0,r.Hx)((0,d.Xk)(n),t)}}class y{constructor(){this.captureCamera=new h.Camera}async capture(e,t,i,n,s){const{camera:a,scene:o}=i.getScene();return a.getWorldPosition(this.captureCamera.position),a.getWorldQuaternion(this.captureCamera.quaternion),this.captureCamera.projectionMatrix.copy(a.projectionMatrix),this.captureCamera.layers.mask=e.mask,s.setSize(t.width,t.height),n.render(s.target,o,this.captureCamera),await(0,d.vP)(s)}}},56163:(e,t,i)=>{"use strict";i.d(t,{K:()=>r});var n=i(52528),s=i(71166),a=i(63319);const o=new n.v({});class r{constructor(e,t,i){this.commandBinder=e,this.layersData=t,this.dataTypeGroup=i,this.textParser=o,this.enabled=!0,this.bindings=[]}getGroupingId(e){switch(e){case a.HH.TYPE:return this.getTypeId();case a.HH.FLOOR:return this.getFloorId();case a.HH.LAYER:return this.getLayerGroupId();case a.HH.DATE:return this.dateBucket}}getFloorId(){return this.floorId}getDateBucket(){return this.dateBucket}getTypeId(){return this.typeId}supportsBatchDelete(){return!1}supportsLayeredCopyMove(){return!1}getLayerGroupId(){var e,t;const i=null===(e=this.layersData)||void 0===e?void 0:e.getBaseLayerId(),n=null===(t=this.layersData)||void 0===t?void 0:t.getViewLayerId();return this.layerId&&n&&this.layerId===i?n:this.layerId}isLayerVisible(){return!this.layersData||!this.layerId||this.layersData.layerVisible(this.layerId)}onSelect(e,t,i){this.commandBinder.issueCommand(new s.IL(this.id,this.typeId))}registerBindings(){}cancelBindings(){this.bindings.forEach((e=>e.cancel()))}}},36375:(e,t,i)=>{"use strict";i.d(t,{k:()=>a});var n=i(73085),s=i(29883);const a=(0,n.M)(s.T,"activeItemId",null)},59287:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ChangeSearchGroupingCommand:()=>u.SN,ClearSearchFiltersCommand:()=>u.Hf,DeregisterSearchGroupCommand:()=>u.Pe,RegisterSearchGroupCommand:()=>u.c6,SearchModeToggleCommand:()=>u.Xv,SelectSearchResultCommand:()=>u.IL,SetSearchFilterCommand:()=>u.Z4,ToggleSearchFilterCommand:()=>u.Mp,ToggleSearchQueryKeywordCommand:()=>u.M8,UpdateSearchQueryCommand:()=>u.H1,UpdateSearchQueryKeywordsCommand:()=>u.FZ,default:()=>he});var n=i(97542),s=i(69170),a=i(38399),o=i(80361),r=i(10374),d=i(54244),l=i(91380),h=i(76631),c=i(89549),m=i(50892),u=i(71166);class p{constructor(e){this.engine=e,this.initialized=!1}async activate(){const{commandBinder:e}=this.engine;this.initialized||(this.initialized=!0),await e.issueCommand(new u.Xv(!0))}async deactivate(){const{commandBinder:e}=this.engine;await e.issueCommand(new u.Xv(!1))}}var g=i(85893),v=i(67294),y=i(33558),w=i(66102),f=i(73085),b=i(29883);const T=(0,f.M)(b.T,"grouping",b.T.defaultGrouping);var D=i(46362),C=i(36375),P=i(25071),A=i(78116),I=i(51978);const E=(0,f.M)(b.T,"searchMode",!1);var S=i(76087),k=i(63319);const{SEARCH:N}=a.Z.SHOWCASE;function O({phraseKeys:e={},grouping:t,onGroupBy:i}){var n,s,a,o,r,d,l,h;const c=(0,w.b)(),m=(0,I.y)(S.Wp,!1),u=E(),p=[k.HH.DATE,k.HH.FLOOR];"boolean"==typeof u&&p.unshift(k.HH.TYPE),m&&p.push(k.HH.LAYER);const v={[k.HH.TYPE]:{textKey:c.t((null===(n=e[k.HH.TYPE])||void 0===n?void 0:n.textKey)||N.GROUP_TYPE),selectedTextKey:c.t((null===(s=e[k.HH.TYPE])||void 0===s?void 0:s.selectedTextKey)||N.GROUP_TYPE_SELECTED)},[k.HH.FLOOR]:{textKey:c.t((null===(a=e[k.HH.FLOOR])||void 0===a?void 0:a.textKey)||N.GROUP_FLOOR),selectedTextKey:c.t((null===(o=e[k.HH.FLOOR])||void 0===o?void 0:o.selectedTextKey)||N.GROUP_FLOOR_SELECTED)},[k.HH.LAYER]:{textKey:c.t((null===(r=e[k.HH.LAYER])||void 0===r?void 0:r.textKey)||N.GROUP_LAYER),selectedTextKey:c.t((null===(d=e[k.HH.LAYER])||void 0===d?void 0:d.selectedTextKey)||N.GROUP_LAYER_SELECTED)},[k.HH.DATE]:{textKey:c.t((null===(l=e[k.HH.DATE])||void 0===l?void 0:l.textKey)||N.GROUP_DATE),selectedTextKey:c.t((null===(h=e[k.HH.DATE])||void 0===h?void 0:h.selectedTextKey)||N.GROUP_DATE_SELECTED)}},y=v[t].selectedTextKey;return(0,g.jsx)(A.xz,Object.assign({className:"grouping-sort-menu-button",variant:A.Wu.TERTIARY,label:y,caret:!0},{children:p.map((e=>(0,g.jsx)(A.zx,{label:v[e].textKey,size:A.qE.SMALL,variant:A.Wu.TERTIARY,onClick:()=>i(e)},e)))}))}var M=i(64618),x=i(94184),R=i.n(x),V=i(43470),B=i(6335),L=i(6608);function F({item:e}){const{imgUrl:t,color:i,icon:n}=e;return t?(0,g.jsx)(B.X,{className:"thumbnail-image",resource:t}):n?(0,g.jsx)(L.C,{badgeStyle:void 0!==i?{background:i,borderColor:i}:{},iconClass:n}):null}var H=i(77230),j=i(16589),U=i(44472);function G({item:e}){const{textParser:t,title:i,description:n}=e,s=(0,H.A)();let a=i;a&&(a=(0,j.vr)(a,s));let o=n;return o&&(o=(0,j.zf)(o,s)),(0,g.jsxs)("div",Object.assign({className:"item-details"},{children:[(0,g.jsx)("div",Object.assign({className:"item-header"},{children:(0,g.jsx)(U.S,{text:a||"",textParser:t,markers:j.PP})})),t&&(0,g.jsx)("div",Object.assign({className:"item-description"},{children:(0,g.jsx)(U.S,{text:o||"",textParser:t,markers:j.PP})}))]}))}const{SEARCH:z}=a.Z.SHOWCASE,_=({item:e})=>{const t=(0,w.b)();if(!e){const e=t.t(z.EMPTY_LIST_MESSAGE);return(0,g.jsx)(A.gQ,{message:e})}const{dataTypeGroup:i}=e;return(null==i?void 0:i.itemFC)?(0,g.jsx)(i.itemFC,{item:e}):(0,g.jsx)($,{item:e},e.id)};function $({item:e,className:t}){const i=(0,C.k)(),n=e.id,s=!!i&&n===i,{analytics:a,commandBinder:o}=(0,v.useContext)(y.I),r=(0,g.jsx)(F,{item:e}),d=(0,g.jsx)(G,{item:e});return(0,g.jsx)(A.HC,{id:n,className:R()("search-result-item",t),title:d,active:s,disabled:!e.enabled,onClick:async()=>{const t="search_item_"+e.typeId.toLowerCase()+"_click";a.track("showcase_gui",{tool:"search",gui_action:t}),o.issueCommand(new c.qy(!0)),await o.issueCommand(new V.yL),e.onSelect()},badge:r||void 0},n)}var K=i(41407),W=i(32279),J=i(37190),Y=i(49571),q=i(43363);function Z({id:e,icon:t,label:i,selected:n}){const{commandBinder:s}=(0,v.useContext)(y.I);return(0,g.jsx)(q.e,{id:e,icon:t,label:i,selected:n,onToggled:t=>{t.stopPropagation(),"ALL"===e?n||s.issueCommand(new u.Hf):s.issueCommand(new u.Mp(e,!n))}})}i(52424);const{SEARCH:Q}=a.Z.SHOWCASE;function X(){const e=(0,w.b)(),t=Object.values((0,W.b)()),i=(0,J.b)(),n=0===i.length,s=(0,v.useRef)(null),o=t.sort(((e,t)=>(e.groupOrder||Y.Xs)-(t.groupOrder||Y.Xs))).map((t=>{const{id:s,groupIcon:a,groupPhraseKey:o}=t,r=e.t(o),d=!n&&i.includes(s);return(0,g.jsx)(Z,{id:s,icon:a,label:r,selected:d},s)})),r=e.t(Q.FILTER_SEARCH),d=e.t(Q.FILTER_SEARCH_ALL);return(0,g.jsx)("div",Object.assign({className:"search-filter",onClick:e=>e.stopPropagation()},{children:(0,g.jsxs)(A.xz,Object.assign({ref:s,icon:"filter",variant:A.Wu.TERTIARY,size:A.qE.SMALL,menuClassName:"search-filter-menu"},{children:[(0,g.jsxs)("div",Object.assign({className:"search-filter-menu-header"},{children:[(0,g.jsx)("div",{children:r}),(0,g.jsx)(A.zx,{icon:"close",ariaLabel:e.t(a.Z.CLOSE),variant:A.Wu.TERTIARY,onClick:()=>{s.current&&s.current.closeMenu()}})]})),(0,g.jsx)(Z,{id:"ALL",icon:"fullscreen",label:d,selected:n}),o]}))}))}var ee=i(82588),te=i(84309);const{SEARCH:ie}=a.Z.SHOWCASE;function ne(){const{commandBinder:e}=(0,v.useContext)(y.I),t=T(),i=(0,D.s)(),n=(0,C.k)(),s=(0,w.b)();const a=i.length,o=s.t(ie.ITEMS,a),r=s.t(ie.EMPTY_LIST_MESSAGE),d=(0,g.jsx)(ee.B,{filter:(0,g.jsx)(X,{}),filterPills:!0,shareEnabled:!0});return(0,g.jsxs)(te.L,Object.assign({toolId:h.w1.SEARCH,className:"search-tool-panel",title:o,subheader:d,subheaderCollapsedHeight:P._U},{children:[(0,g.jsx)(A.w0,Object.assign({className:"list-panel-controls"},{children:(0,g.jsx)(O,{grouping:t,onGroupBy:function(t){e.issueCommand(new u.SN(t))}})})),(0,g.jsx)("div",Object.assign({className:"panel-list search-panel-list"},{children:0===a?(0,g.jsx)(A.gQ,{message:r}):(0,g.jsx)(K.D,{renderGroup:M.v,renderItem:_,activeItemId:n,grouping:t,excludeEmptyGroups:!0})}))]}))}class se{constructor(){this.renderPanel=()=>(0,g.jsx)(ne,{})}}function ae(...e){return!0}function oe(...e){return!1}class re{constructor(e){this.searchData=e,this.subscriptions=[],this.isSearchingGroup=e=>{const t=this.searchData.searchMode;return!0===t||t===e},this.onFiltersChanged=()=>{this.updateAvailableKeywords(),this.clearUnavailableKeywordFilters(),this.searchData.getSearchDataTypeList().forEach(this.updateMatches),this.updateResults()},this.updateAvailableKeywords=()=>{const e=this.getActiveSearchDataTypeList().reduce(((e,{getKeywords:t})=>{if(t){t().forEach((t=>{e[t]?e[t]++:e[t]=1}))}return e}),{});this.searchData.setKeywordCounts(e)},this.updateMatches=e=>{const{id:t,getSimpleMatches:i}=e,n=this.searchData.getTypeFilters(),s=this.searchData.getQuery(),a=0===n.length||n.includes(t)?function(e){if(!e)return ae;const t=e.toLowerCase();return(...e)=>function(e,...t){return t.some((t=>t.toLowerCase().includes(e)))}(t,...e)}(s):oe,o=this.searchData.getKeywordFilters();e.matches=i(a,e,s,o)},this.activationChanged=e=>{e?this.updateAllMatchesAndResults():this.searchData.getSearchDataTypeList().forEach(this.revealItems)},this.revealItems=e=>{e.getSimpleMatches(ae,e,"",[])},this.updateAllMatchesAndResults=(0,o.D)((()=>{this.updateAvailableKeywords(),this.searchData.getSearchDataTypeList().forEach(this.updateMatches),this.updateResults()}),200),this.subscriptions.push(e.onPropertyChanged("query",this.updateAllMatchesAndResults),e.onPropertyChanged("keywordFilters",this.updateAllMatchesAndResults),e.onPropertyChanged("searchMode",this.activationChanged),e.typeFilters.onChanged(this.onFiltersChanged))}dispose(){const e=e=>e.cancel();this.subscriptions.forEach(e),this.searchData.getSearchDataTypeList().forEach((t=>t.subscriptions.forEach(e)))}registerSearchGroup(e,t,i){const n=()=>{this.updateMatches(e),this.updateResults(),this.updateAvailableKeywords()};n();let s=!1,a=!1;const r=(0,o.D)((()=>{a?(n(),s=!1):s=!0}),200);t&&e.subscriptions.push(t(r));const d=t=>{const n=a;a=this.isSearchingGroup(e.id),i&&n!==a&&i(a&&t),a&&s&&r()};e.subscriptions.push(this.searchData.onPropertyChanged("searchMode",d)),d(this.searchData.searchMode)}deregisterSearchGroup(e){e.subscriptions.forEach((e=>e.cancel())),this.updateResults()}clearUnavailableKeywordFilters(){const e=this.searchData.getTypeFilters().length>0,t=this.getActiveSearchDataTypeList().find((e=>!!e.getKeywords));e&&!t&&this.searchData.setKeywordFilters([])}getActiveSearchDataTypeList(){const e=this.searchData.typeFilters;return this.searchData.getSearchDataTypeList().filter((t=>0===e.length||e.includes(t.id)))}updateResults(){const e=this.searchData.getSearchDataTypeList().reduce(((e,t)=>(e.push(...t.matches),e)),[]);this.searchData.setResults(e)}}const{TOOLS:de}=a.Z;class le extends n.Y{constructor(){super(...arguments),this.name="search",this.searchData=new b.T,this.hasStartedTrackingQueries=!1,this.onApplicationChange=async()=>{this.updateFeatureEnablement(),this.addTool()},this.registerSearchGroup=async e=>{const{id:t,groupPhraseKey:i,groupMatchingPhraseKey:n,getSimpleMatches:s,getKeywords:a,groupOrder:o,groupIcon:r,registerChangeObserver:d,onSearchActivatedChanged:l,itemFC:h,itemActionsFC:c,groupActionsFC:m}=e;if(this.searchData.dataTypeGroups[t])return void this.log.debug("Search group already registered");const u={id:t,groupPhraseKey:i,groupMatchingPhraseKey:n,getSimpleMatches:s,getKeywords:a,groupOrder:o,groupIcon:r,matches:[],subscriptions:[],itemFC:h,itemActionsFC:c,groupActionsFC:m};this.searchData.dataTypeGroups[t]=u,this.searchResultsUpdater.registerSearchGroup(u,d,l)},this.deregisterSearchGroup=async e=>{const{id:t}=e,i=this.searchData.dataTypeGroups[t];i?(delete this.searchData.dataTypeGroups[t],this.searchResultsUpdater.deregisterSearchGroup(i)):this.log.debug("Search group not found to deregister")},this.toggleSearchMode=async e=>{const{opened:t}=e;if(t){const e="string"==typeof t?t:void 0;this.activateSearchMode(e),e&&this.setTypeFilter(e)}else this.deactivateSearchMode()},this.updateQuery=async e=>{this.searchData.setQuery(e.query),this.searchData.commit(),this.activateSearchMode()},this.updateQueryKeywords=async e=>{this.searchData.setKeywordFilters(e.keywords),this.activateSearchMode()},this.toggleQueryKeyword=async({keywordId:e})=>{const t=[...this.searchData.getKeywordFilters()];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),this.searchData.setKeywordFilters(t)},this.selectSearchResult=async e=>{const{id:t,typeId:i}=e,{activeItemId:n,selectedType:s}=this.searchData;t===n&&i===s||(this.searchData.activeItemId=t,this.searchData.selectedType=t&&i||null,this.searchData.commit())},this.changeGrouping=async e=>{this.searchData.grouping=e.grouping,this.searchData.commit()},this.toggleSearchFilter=async e=>{const{groupId:t,enabled:i}=e;this.searchData.toggleSearchFilter(t,i);this.searchData.getTypeFilters().length===Object.keys(this.searchData.dataTypeGroups).length&&this.searchData.clearTypeFilters()},this.trackQuery=(0,o.D)((()=>{const e=this.searchData.query.substring(0,1e3),t=this.searchData.getKeywordFilters().map((e=>e.trim())).sort().join(",");if(!e&&!t)return;const i=!this.hasStartedTrackingQueries&&e===this.config.urlQuery;this.analytics.track("space_search_queried",{query:e,queryKeywords:t,submittedByUrlParam:i}),this.hasStartedTrackingQueries=!0}),1e3)}async init(e,t){if(this.config=e,this.engine=t,[this.toolsData,this.appData,this.analytics]=await Promise.all([t.market.waitForData(l.t),t.market.waitForData(d.pu),t.getModuleBySymbol(s.y.ANALYTICS)]),this.bindings.push(t.subscribe(r.bS,this.onApplicationChange),this.searchData.onPropertyChanged("query",this.trackQuery),this.searchData.onPropertyChanged("keywordFilters",this.trackQuery),t.commandBinder.addBinding(u.Xv,this.toggleSearchMode),t.commandBinder.addBinding(u.H1,this.updateQuery),t.commandBinder.addBinding(u.FZ,this.updateQueryKeywords),t.commandBinder.addBinding(u.M8,this.toggleQueryKeyword),t.commandBinder.addBinding(u.SN,this.changeGrouping),t.commandBinder.addBinding(u.Z4,(async e=>this.setTypeFilter(e.groupId))),t.commandBinder.addBinding(u.Mp,this.toggleSearchFilter),t.commandBinder.addBinding(u.Hf,(async()=>this.searchData.clearTypeFilters())),t.commandBinder.addBinding(u.IL,this.selectSearchResult),t.commandBinder.addBinding(u.c6,this.registerSearchGroup),t.commandBinder.addBinding(u.Pe,this.deregisterSearchGroup)),this.searchResultsUpdater=new re(this.searchData),this.updateFeatureEnablement(),this.config.showcaseSearchEnabled&&(void 0!==e.urlQuery||void 0!==e.urlQueryKeywords||void 0!==e.urlQueryFilters)){const t=decodeURIComponent(e.urlQuery||"");this.searchData.setQuery(t),this.searchData.commit();const i=decodeURIComponent(e.urlQueryFilters||"").trim(),n=i?i.split(","):[];n.length>0&&this.searchData.setTypeFilters(n);const s=decodeURIComponent(e.urlQueryKeywords||"").trim(),a=s?s.split(","):[];a.length>0&&this.searchData.setKeywordFilters(a);const o=this.toolsData.getTool(h.w1.LAYERS)?h.w1.LAYERS:h.w1.SEARCH;this.engine.commandBinder.issueCommand(new c.tT(o,!0))}t.market.register(this,b.T,this.searchData)}dispose(e){super.dispose(e),this.searchResultsUpdater&&this.searchResultsUpdater.dispose()}updateFeatureEnablement(){(this.appData.application===d.Mx.WORKSHOP||this.config.showcaseSearchEnabled)&&this.addTool()}addTool(){if(!this.toolsData.getTool(h.w1.SEARCH)){if(this.appData.application===d.Mx.WORKSHOP)return;const e=new m.U({id:h.w1.SEARCH,namePhraseKey:de.SEARCH,panel:!0,panelLeft:!0,icon:"icon-magnifying-glass",analytic:"search_mode",dimmed:!1,enabled:!0,hidesAppBar:!0,order:1,ui:new se,manager:new p(this.engine)});this.engine.commandBinder.issueCommand(new c.MV([e]))}}setTypeFilter(e){e?this.searchData.setTypeFilter(e):this.searchData.clearTypeFilters()}activateSearchMode(e){const t=e||!0;this.searchData.searchMode!==t&&(this.searchData.searchMode=t,this.searchData.commit())}deactivateSearchMode(){this.searchData.searchMode&&(this.searchData.clearTypeFilters(),this.searchData.searchMode=!1,this.searchData.activeItemId=null,this.searchData.commit())}}const he=le},76979:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>z});var n=i(97542),s=i(69170),a=i(53954),o=i(9037),r=i(95882),d=i(23254),l=i(41187),h=i(41603),c=i(27646),m=i(20387),u=i(71239),p=i(17878),g=i(76609),v=i(69505),y=i(50090),w=i(19663);const f=16/9,b=.5625;class T extends w.m{constructor(e){super(),this.id="CAPTURE_SNAPSHOT",this.payload={maxSize:e.maxSize||g.SL.ULTRAHIGH,aspect:e.aspect||f,category:e.category||y.i.USER,onProgress:e.onProgress,waitForUpload:void 0===e.waitForUpload||e.waitForUpload}}}class D extends w.m{constructor(e){super(),this.id="EQUIRECTANGULAR_SNAPSHOT",this.payload={onProgress:e.onProgress,waitForUpload:void 0===e.waitForUpload||e.waitForUpload}}}var C=i(37082),P=i(42418),A=i(90304),I=i(67944),E=i(98010);class S extends E.v{constructor(e){super(),this.error=e}}var k=i(2224);class N extends k.y{constructor(e,t="72002"){super(e),this.name="SnapshotCaptureError"}}class O extends k.y{constructor(e,t="73002"){super(e),this.name="SnapshotUploadError"}}var M,x=i(79727),R=i(63252),V=i(39880),B=i(12039),L=i(8728);!function(e){e.CAPTURING="capturing",e.UPLOADING="uploading",e.ERROR="error",e.DONE="done"}(M||(M={}));var F=i(58368),H=i(66917),j=i(91380),U=i(76631);const G=u.Xd.uploadIntervalDelay;class z extends n.Y{constructor(){super(...arguments),this.name="snapshots-editor"}async init(e,t){this.engine=t,[this.renderer,this.sweepTilingModule]=await Promise.all([t.getModuleBySymbol(s.y.WEBGL_RENDERER),t.getModuleBySymbol(s.y.SWEEP_PANO)]),[this.sweepData,this.viewmodeData,this.cameraData,this.floorsViewData]=await Promise.all([t.market.waitForData(a.Z),t.market.waitForData(d.O),t.market.waitForData(o.M),t.market.waitForData(x.c),t.market.waitForData(P.P)]),[this.snapshotTarget,this.snapshotOverlayTarget]=await Promise.all([t.commandBinder.issueCommandWhenBound(new l.oM),t.commandBinder.issueCommandWhenBound(new l.oM)]);const i=await t.market.waitForData(j.t);this.bindings.push(i.onToolChanged(this.onToolChanged.bind(this))),this.bindings.push(t.commandBinder.addBinding(T,(async e=>{const i=e.onProgress||(0,C.Y)(0);i.value=10,t.commandBinder.issueCommand(new B.ZK),t.commandBinder.issueCommand(new H.M);const n=await this.queryIdealResolution(e.maxSize,e.aspect);this.snapshotTarget.setSize(n.width,n.height),this.snapshotOverlayTarget.setSize(n.width,n.height),await this.fetchHighestAvailable(!1,e.maxSize,(e=>i.value=Math.max(10,e))),await(0,V.gw)(2*G),await this.takeScreenshot();const s=this.sweepData.getSweep(this.sweepData.currentSweep);this.viewmodeData.currentMode===r.Ey.Panorama&&await this.sweepTilingModule.resetSweep(s.id),t.commandBinder.issueCommand(new B.Lp),t.commandBinder.issueCommand(new H.I);let a=e.category;s&&(s.alignmentType===R.z9.UNALIGNED||s.placementType===R.hU.MANUAL)&&a===y.i.USER&&(a=y.i.UNALIGNED);const o=this.uploadAndAddSnapshot(a).then((e=>e&&e.sid)).catch((e=>{throw this.log.error(e),this.engine.broadcast(new S(e)),e}));return e.waitForUpload?o:null})));const n=A.f.FORWARD.clone(),c=A.f.FORWARD.clone();this.bindings.push(t.commandBinder.addBinding(D,(async e=>{const i=e.onProgress||(0,C.Y)(0);i.value=10,t.commandBinder.issueCommand(new B.ZK),await(0,V.gw)(50);const s=this.queryIdealEqResolution();this.snapshotTarget.setSize(s.width,s.height);const a=this.sweepData.getSweep(this.sweepData.currentSweep);n.copy(A.f.FORWARD).applyQuaternion(a.rotation).setY(0),c.copy(A.f.FORWARD).applyQuaternion(this.cameraData.pose.rotation).setY(0);const o=(0,I.k2)(n,c)+Math.PI;await this.fetchHighestAvailable(!0,g.SL.ULTRAHIGH,(e=>i.value=Math.max(10,e))),await this.takeEquirectangular(o),await this.sweepTilingModule.resetSweep(a.id),t.commandBinder.issueCommand(new B.Lp);const r=(0,h.fY)(this.snapshotTarget.width,this.snapshotTarget.height,o,0),d=this.uploadAndAddSnapshot(y.i.PANORAMA,r).then((e=>e&&e.sid)).catch((e=>{throw this.log.error(e),this.engine.broadcast(new S(e)),e}));return e.waitForUpload?d:null})))}onToolChanged(e){this.sweepTilingModule.setPreloadQuality(e===U.w1.PHOTOS||e===U.w1.START_LOCATION?this.sweepTilingModule.panoSizeClass.ULTRAHIGH:null)}async uploadAndAddSnapshot(e,t){const i=this.createSnapshot(e);i.state=M.CAPTURING,i.imageBlob=(0,h.Xk)(await(0,h.vP)(this.snapshotTarget,t)),i.state=M.UPLOADING;try{return await this.engine.commandBinder.issueCommand(new F.nM(i))}catch(e){throw i.state=M.ERROR,this.log.error(e),new O(e)}}createSnapshot(e){const t=this.viewmodeData.isInside();let i=(0,V.DZ)(new Date);if(t){const e=this.sweepData.getSweep(this.sweepData.currentSweep).name;e&&(i=e)}const n=new L.a;return n.name=i,n.category=e,n.is360=t&&!this.sweepData.currentAlignedSweepObject,n.metadata={cameraMode:this.viewmodeData.currentMode,cameraPosition:this.cameraData.pose.position.clone(),cameraQuaternion:this.cameraData.pose.rotation.clone(),orthoZoom:this.viewmodeData.currentMode===r.Ey.Floorplan?this.cameraData.zoom():-1,ssZoom:this.cameraData.zoom(),scanId:t?this.sweepData.currentSweep:void 0,floorId:this.floorsViewData.currentFloorId,floorVisibility:this.floorsViewData.getFloorsVisibility()},n}async queryIdealResolution(e=g.SL.ULTRAHIGH,t){let i=3840,n=i*b;const s=this.renderer.maxTextureSize;if(i>s&&(this.log.warn(`The active gl context does not support 4k x 2k equirectangular capture\nCapture is limited to a max size of ${s}`),i=s,n=i*b),this.viewmodeData.currentMode===r.Ey.Panorama){const a=await this.sweepTilingModule.availableResolution(this.sweepData.currentSweepObject,e),o=c.Z.getPanoSize(a)*(this.cameraData.fovY()*v.MN)/90;i=Math.min(Math.round(o*t),s),n=Math.round(i/t)}return Promise.resolve({width:i,height:n})}queryIdealEqResolution(){let e=4096,t=.5*e;if(this.viewmodeData.currentMode!==r.Ey.Panorama)throw new N("Equirectangular capture is only supported in Panorama mode");const i=this.renderer.maxTextureSize;return e>i&&this.log.warn(`The active gl context does not support 4k x 2k equirectangular capture\nCapture is limited to a max size of ${i}`),e=Math.min(i,e),t=.5*e,{width:e,height:t}}fetchHighestAvailable(e,t=g.SL.ULTRAHIGH,i){if(this.viewmodeData.currentMode===r.Ey.Panorama){const n=this.sweepData.currentSweepObject,s=e?m.v.FullPanorama:m.v.CurrentView;return this.sweepTilingModule.requestResolution(n,t,s,!0).then((e=>{const t=this.sweepTilingModule.waitForQueue(s,e);return i&&t.progress((e=>i(e*z.captureProgressFudgeFactor))),t.nativePromise()}))}return i&&i(z.captureProgressFudgeFactor),Promise.resolve()}takeScreenshot(){const e=p.o.ALL;e.removeLayers(this.engine.getRenderLayer("grid-underlay")),e.removeLayers(this.engine.getRenderLayer("cursor-mesh")),e.removeLayers(this.engine.getRenderLayer("current-pano-marker"));const t=this.renderer.getScene().scene,i=this.renderer.getScene().camera,n=i.layers.mask;return i.layers.mask=e.mask,this.engine.commandBinder.issueCommand(new l.vU(this.snapshotTarget,t,i)).then((()=>{i.layers.mask=n}))}takeEquirectangular(e){const t=this.sweepData.currentSweep,i=this.sweepTilingModule.getRenderer(),n=i.useTexture(t),s=this.engine.commandBinder.issueCommand(new l.fZ(this.snapshotTarget,n,e));return i.freeTexture(t),s}}z.captureProgressFudgeFactor=90},9699:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(98010);class s extends n.v{constructor(){super()}}},46368:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(98010);class s extends n.v{constructor(e){super(),this.sweepIds=e}}},65594:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>h});var n=i(81396),s=i(97542),a=i(53954),o=i(26306);const r=Object.freeze({sweeps:{maxNeighborDistance:50}});var d=i(46368),l=i(9699);class h extends s.Y{constructor(){super(...arguments),this.name="sweep-path"}async init(e,t){this.engine=t,this.sweepData=await t.market.waitForData(a.Z),this.validNeighbors={},this.maxNeighborDistance=e.maxNeighborDistance||r.sweeps.maxNeighborDistance,this.buildDistanceMap()}setRestrictedSweeps(e,t=0){if(this.restrictedSweeps=[],e){for(let i=t;i<e.length;i++)this.restrictedSweeps.push(e[i].id);this.engine.broadcast(new d.Z(this.restrictedSweeps))}else this.restrictedSweeps=void 0,this.engine.broadcast(new l.Z)}findShortestPath(e,t,i,n,s,a,r=5e3){const d=this.sweepData.getSweep(e),l=this.sweepData.getSweep(t),h=this,c=(0,o.K)({start:d,isEnd:e=>e===l,*neighbors(e){for(const t of e.neighbours)yield h.sweepData.getSweep(t)},distance:(e,t)=>h.getDistance(e.id,t.id),heuristic:(e,t)=>1,timeout:r});return c.status===o.h.Success&&c.path.length<s?(this.addSweepsNearPath(c.path,i),this.filterCloseSweepsFromPath(c.path,n)):null}addSweepsNearPath(e,t){const i=new n.Vector3,s=new n.Vector3,a=new n.Vector3,o=new n.Vector3,r=new n.Vector3,d=new n.Vector3,l=[],h=new n.Vector3,c=(e,t,i)=>(a.copy(t).sub(e),a.dot(i)),m=(e,t)=>c(h,e.position,i)-c(h,t.position,i);let u=0;for(;u<e.length-1;){const n=e[u].id,c=e[u+1].id,p=this.sweepData.getSweep(n),g=this.sweepData.getSweep(c);h.copy(p.position),l.length=0,i.copy(g.position).sub(h).normalize();const v=this.findConnectedSweeps(p,this.maxNeighborDistance),y=this.findConnectedSweeps(g,this.maxNeighborDistance),w=v.concat(y);for(const e of w){const n=a.copy(e.position).sub(h).dot(i);if(n>0){r.copy(i),r.multiplyScalar(n),o.copy(a),o.sub(r);if(o.length()<t){s.copy(i).negate(),d.copy(e.position).sub(g.position);d.dot(s)>0&&l.push(e)}}}if(l.length>0){l.sort(m);for(let t=e.length+l.length-1;t>=u+l.length;t--)e[t]=e[t-l.length];for(let t=0;t<l.length;t++)e[t+u+1]=l[t]}u+=l.length+1}}findConnectedSweeps(e,t,i=2){const n=[];return this._findConnectedSweeps(e,e,t,n,{},i,0),n}_findConnectedSweeps(e,t,i,n,s,a,o){const r=this.getValidNeighbors(e.id);for(const e of r)if(!s[e.id]){e.position.distanceTo(t.position)<i&&(n.push(e),s[e.id]=!0,o<a&&this._findConnectedSweeps(e,t,i,n,s,a,o+1))}}getValidNeighbors(e,t){let i=this.validNeighbors[e];if(!i){i=[],this.validNeighbors[e]=i;const n=this.sweepData.getSweep(e),s=n.neighbours;for(const a of s){const s=this.sweepData.getSweep(a),o=this.getDistance(e,a);if(!s.enabled)continue;if(o>this.maxNeighborDistance)continue;let r=!0;if(t){const e=s.position.clone().sub(n.position).normalize();r=0===t(n.position,e,o).length}r&&i.push(s)}}return i}filterCloseSweepsFromPath(e,t){const i=[];let n=null,s=!1;for(const a of e)s=n&&a.position.distanceTo(n.position)<t||!1,n&&s||(i.push(a),n=a);return i.length<2?e:(s&&e.length>1&&(i[i.length-1]=e[e.length-1]),i)}getCurveForPath(e){let t=0;const i=[0];for(let n=1;n<e.length;n++)t+=e[n-1].distanceTo(e[n]),i.push(t);const s=[0];for(let n=1;n<e.length;n++)s.push(i[n]/t);const a=new n.CatmullRomCurve3(e,!1);return{curve:new n.CatmullRomCurve3(a.getSpacedPoints(2*t).concat(e[e.length-1])),totalLength:t,sourceDistances:i,normalSourceDistances:s}}buildDistanceMap(){const e={},t=new n.Vector3(0,0,0);this.sweepData.iterate((i=>{const n={},s=i.neighbours;for(const e of s){const s=this.sweepData.getSweep(e);t.copy(i.position).sub(s.position);let a,o=Math.max(0,Math.abs(t.y)-.2),r=Math.sqrt(t.x*t.x+t.z*t.z);o>0?(o=Math.pow(4*o,2),r=Math.pow(r,2),a=Math.sqrt(o*o+r*r)):a=t.length(),n[s.id]=a}e[i.id]=n})),this.distanceMap=e}getDistance(e,t){return this.distanceMap[e][t]}}},49011:(e,t,i)=>{"use strict";i.d(t,{m1:()=>g,Vp:()=>w});var n=i(81396),s=i(77256),a=i.n(s),o=i(62118),r=i.n(o);class d extends n.RawShaderMaterial{constructor(e,t){const i=n.UniformsUtils.clone(d.uniforms);i.tMask.value=e,i.tPinHole.value=t,super({vertexShader:a(),fragmentShader:r(),uniforms:i,name:"PinMaterial",transparent:!0})}}d.uniforms={tMask:{type:"t",value:null},tPinHole:{type:"t",value:null},pinColor:{type:"c",value:new n.Color},opacity:{type:"f",value:1}};var l=i(87926),h=i(49827),c=i(12529),m=i(15462),u=i(87928);const p=i.p+"images/360_placement_pin_mask.png";class g extends n.Mesh{}let v;const y=()=>v||(v=(0,l.p)(p),v);class w extends u.E{constructor(e,t,i,n){const s=new d(y(),t);super(w.geometry,s),this.layers.mask=n.mask,this.name="PinMesh",this.cameraData=i,this._collider=new g(w.colliderGeometry,w.colliderMaterial),this._collider.name="PinMeshCollider",this._collider.material.visible=!1,this.add(this._collider),this.opacityProgress=0,this.shouldHide=!0,this.uniforms=s.uniforms,this.unhover(),this.selected=0,this.visible=!1,this.position.copy(e),this.renderOrder=c.z.pins360}updatePosition(e){this.position.copy(e)}get collider(){return this._collider}render(e){this.quaternion.copy(this.cameraData.pose.rotation),null===this.uniforms.tPinHole.value?this.opacityProgress=0:!this.shouldHide&&this.opacityProgress<1?this.opacityProgress+=e/w.FADE_DURATION:this.shouldHide&&this.opacityProgress>0&&(this.opacityProgress-=e/w.FADE_DURATION),this.opacityProgress=(0,h.uZ)(this.opacityProgress,0,1),this.uniforms.opacity.value=this.opacityProgress,this.visible=0!==this.opacityProgress}activate(){this.shouldHide=!1}deactivate(){this.shouldHide=!0}dispose(){this.collider.geometry.dispose(),this.collider.material.dispose()}setPinHover(e,t=!0,i=!0){const n=Math.min(Math.max(e,0),1);this.selected!==n&&(i&&this.uniforms.pinColor.value.copy(m.I.WHITE).lerp(m.I.MP_BRAND,n),t&&n>0&&n<=1&&(this.material.depthTest=!1),0===n&&(this.material.depthTest=!0),this.selected=n)}unhover(){this.uniforms.pinColor.value.copy(m.I.WHITE)}}w.FADE_DURATION=500,w.geometry=new n.PlaneGeometry(1.5,1.5),w.colliderGeometry=new n.SphereGeometry(1.5*.65),w.colliderMaterial=new n.MeshBasicMaterial({transparent:!0,opacity:.5,depthWrite:!1,color:16724312})},3054:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>R});var n=i(97542),s=i(69170),a=i(81396),o=i(49011),r=i(98010);class d extends r.v{constructor(e,t){super(),this.sweepId=e,this.selected=t}}class l extends r.v{constructor(e,t,i){super(),this.sweepId=e,this.pinIndex=t,this.placed=i}}var h=i(63252),c=i(76609),m=i(98169),u=i(23612),p=i(97998),g=i(35826),v=i(72996);const y=new p.Z("pin-mesh");class w{constructor(e,t,i,n,s,o){this.sweepViewData=e,this.scene=t,this.sweepTextureLoader=i,this.input=n,this.layer=o,this.container=new a.Object3D,this.bindings=[],this.visibilityFilter=()=>!0,this.updatePlacementType=(e,t)=>{this.dataToMeshMap[e.id]||e.placementType!==h.hU.MANUAL?this.dataToMeshMap[e.id]&&e.placementType!==h.hU.MANUAL&&(this.removePinMesh(e),this.engine.broadcast(new l(e.id,t,!1))):(this.createPinMesh(e,this.cameraData),this.engine.broadcast(new l(e.id,t,!0)))},this.hoverSweep=(e,t)=>{this.issueCommand(new g.kR(e,t,0));const i=this.sweepViewData.selectedSweep===e;this.highlightPin(e,t||i)},this.meshes=[],this.meshToDataMap={},this.dataToMeshMap={},this.cameraData=s,e.iterate((t=>{t.alignmentType!==h.z9.ALIGNED&&(t.placementType===h.hU.MANUAL&&this.createPinMesh(t,s),this.bindings.push(t.onChanged((()=>{const i=e.getIndexByAlignment(!1,t.id);this.updatePlacementType(t,i),m.H7(t)&&this.updatePinMeshPosition(t.id,t.position)}))))}))}updatePinMeshPosition(e,t){this.mapSweepToMesh(e).updatePosition(t)}mapSweepToMesh(e){return this.dataToMeshMap[e]}mapColliderToSweep(e){const t=e.hasOwnProperty("collider")?e:e.parent;if(t){const e=this.meshToDataMap[t.id];if(e)return e.sweep}return null}filter(e){this.visibilityFilter=e;for(const e of this.meshes)this.filterMesh(e)}init(){}dispose(){for(const e in this.meshToDataMap){const t=this.meshToDataMap[e];this.removePinMesh(t.sweep)}}render(e){for(const t of this.meshes)t.render(e)}activate(e){this.engine=e,this.issueCommand=e.commandBinder.issueCommand.bind(e.commandBinder),this.bindings.push(this.input.registerMeshHandler(u.z,v.s.isType(o.m1),((e,t)=>this.onHoverEvent(t,!0)))),this.bindings.push(this.input.registerMeshHandler(u.A,v.s.isType(o.m1),((e,t)=>this.onHoverEvent(t,!1)))),this.scene.add(this.container)}deactivate(e){for(const e of this.bindings)e.cancel();this.bindings.length=0,this.scene.remove(this.container)}getMeshes(){return this.meshToDataMap}highlightPin(e,t){this.dataToMeshMap[e]&&this.dataToMeshMap[e].setPinHover(t?1:0,!1)}lockSelection(e,t){return t&&(this.engine.broadcast(new d(e.id,!0)),this.hoverSweep(e.id,!0)),!0}createPinMesh(e,t){const i=new o.Vp(e.position,null,t,this.layer);this.meshes.push(i),this.dataToMeshMap[e.id]=i,this.meshToDataMap[i.id]={id:i.id,sweep:e},this.container.add(i),this.filterMesh(i),this.sweepTextureLoader.loadFace(e,c.SL.BASE,1,{flipY:!0}).then((e=>{i.material.uniforms.tPinHole.value=e})).catch((t=>{y.error(`${e.id} failed to load texture: ${t}`)}))}removePinMesh(e){const t=this.dataToMeshMap[e.id],i=this.meshes.findIndex((e=>e.id===t.id));this.meshes.splice(i,1),this.container.remove(t),this.deactivateMesh(t),delete this.meshToDataMap[t.id],delete this.dataToMeshMap[e.id],t.dispose()}filterMesh(e){const t=this.meshToDataMap[e.id];if(t){const i=t.sweep;this.visibilityFilter(i)?this.activateMesh(e):this.deactivateMesh(e)}}onHoverEvent(e,t){const i=this.mapColliderToSweep(e);i&&this.hoverSweep(i.id,t)}activateMesh(e){this.input.registerMesh(e.collider,!1),e.activate()}deactivateMesh(e){this.input.unregisterMesh(e.collider);const t=this.meshToDataMap[e.id];t&&(this.hoverSweep(t.sweep.id,!1),e.deactivate())}}w.MENU_CLEAR_DEBOUNCE=100;var f=i(66777),b=i(19663);class T extends b.m{constructor(e){super(),this.id="PIN_UNSELECT",this.payload={id:e}}}var D=i(54244),C=i(9037),P=i(23254),A=i(34029),I=i(95882),E=i(79727),S=i(21973),k=i(71161),N=i(56159);class O extends r.v{constructor(e){super(),this.sweepId=e}}class M extends r.v{constructor(e){super(),this.sweepId=e}}var x=i(43736);class R extends n.Y{constructor(){super(...arguments),this.name="sweep-pin-mesh",this.onChange=()=>{const e=this.sweepViewData,t=e.selectedSweep,i=e.toolState===k._.ROTATING||e.toolState===k._.ROTATED;this.pinRenderer.filter((e=>{if(!this.settingsData.tryGetProperty(x.s,!0))return!1;if(i&&t===e.id)return!1;if(this.viewmodeData.transition.active&&(0,I.Bw)(this.viewmodeData.transition.to))return!1;const n=!this.nextFloor||this.nextFloor===e.floorId||!e.floorId,s=this.config.showPinsInFloorplanDollhouse||this.applicationData.application===D.Mx.WORKSHOP,a=this.viewmodeData.closestMode===I.Ey.Dollhouse||this.viewmodeData.closestMode===I.Ey.Floorplan;return n&&a&&s}))},this.onSelectedPinChange=()=>{const e=this.sweepViewData.selectedSweep;e&&(this.engine.commandBinder.issueCommand(new g.iF(e,!0,0)),this.pinRenderer.highlightPin(e,!0))}}async init(e,t){var i;[this.model,this.webglRenderer,this.input,this.sweepViewData,this.cameraData,this.settingsData,this.viewmodeData,this.floorsViewData,this.applicationData]=await Promise.all([t.getModuleBySymbol(s.y.MODEL_DATA),t.getModuleBySymbol(s.y.WEBGL_RENDERER),t.getModuleBySymbol(s.y.INPUT),t.market.waitForData(S.D),t.market.waitForData(C.M),t.market.waitForData(A.e),t.market.waitForData(P.O),t.market.waitForData(E.c),t.market.waitForData(D.pu)]);const n=t.claimRenderLayer(this.name),a=this.webglRenderer.getScene().scene;this.config={showPinsInFloorplanDollhouse:null===(i=e&&e.showPinsInFloorplanDollhouse)||void 0===i||i},this.engine=t;const o=new f.Z(this.model.getSignedUrls());this.pinRenderer=new w(this.sweepViewData,a,o,this.input,this.cameraData,n),t.addComponent(this,this.pinRenderer),this.bindings.push(this.applicationData.onPropertyChanged("application",this.onChange),this.settingsData.onPropertyChanged(x.s,this.onChange),this.viewmodeData.onChanged(this.onChange),this.sweepViewData.onSelectedSweepChanged(this.onSelectedPinChange),t.subscribe(N.S,(e=>{this.nextFloor=e.to,this.onChange()})),t.subscribe(O,this.onChange),t.subscribe(M,this.onChange),t.commandBinder.addBinding(T,(async e=>{this.pinRenderer.highlightPin(e.id,!1)}))),this.nextFloor=this.floorsViewData.currentFloorId,this.onChange()}mapColliderToSweep(e){return this.pinRenderer.mapColliderToSweep(e)}selectPinMesh(e,t){return this.pinRenderer.lockSelection(e,t)}highlightPinMesh(e,t){this.pinRenderer.highlightPin(e,t)}mapSweepToMesh(e){return this.pinRenderer.mapSweepToMesh(e)}updatePosition(e,t){this.pinRenderer.updatePinMeshPosition(e,t)}}},39531:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>g});var n=i(97542),s=i(69170),a=i(49011),o=i(38987),r=i(34956),d=i(95882),l=i(64918),h=i(23254),c=i(81396),m=i(86819),u=i(23612),p=i(72996);class g extends n.Y{constructor(){super(...arguments),this.name="sweep-pin-navigation"}async init(e,t){const[i,n,g,v]=await Promise.all([t.getModuleBySymbol(s.y.SWEEP_PIN),t.getModuleBySymbol(s.y.VIEWMODE),t.market.waitForData(h.O),t.getModuleBySymbol(s.y.INPUT)]),y=new c.Quaternion;this.bindings.push(v.registerMeshHandler(m.R,p.s.isType(a.m1),((e,t,s)=>{const a=i.mapColliderToSweep(t);return!(!a||g.transition.active)&&(y.set(0,0,0,1).multiply(a.rotation),o=a.id,r=y,g.currentMode&&g.currentMode!==d.Ey.Panorama&&n.switchToMode(d.Ey.Panorama,l.n.FadeToBlack,{sweepID:o,rotation:r}),!0);var o,r})),v.registerMeshHandler(u.z,p.s.isType(a.m1),((e,n)=>{i.mapColliderToSweep(n)&&t.commandBinder.issueCommand(new o.u(r.C.FINGER))})),v.registerMeshHandler(u.A,p.s.isType(a.m1),((e,n)=>{i.mapColliderToSweep(n)&&t.commandBinder.issueCommand(new o.u(null))})))}}},51159:(e,t,i)=>{"use strict";i.d(t,{p:()=>b,Y:()=>v});var n=i(81396),s=i(35490),a=i.n(s),o=i(8346),r=i.n(o);class d extends n.RawShaderMaterial{constructor(e,t){const i=n.UniformsUtils.clone(d.uniforms);i.tNoHover.value=e,i.tHover.value=t,i.tPortal.value=null,super({vertexShader:a(),fragmentShader:r(),uniforms:i,name:"PortalMaterial",transparent:!0})}}d.uniforms={tNoHover:{type:"t",value:null},tHover:{type:"t",value:null},tPortal:{type:"t",vlaue:null},progress:{type:"f",value:1},opacity:{type:"f",value:1}};var l=i(87926);const h=i.p+"images/exterior.png",c=i.p+"images/exterior_hover.png",m=i.p+"images/interior.png",u=i.p+"images/interior_hover.png";let p;const g={get:()=>p||(p={toExteriorTexture:(0,l.p)(h),toExteriorHoverTexture:(0,l.p)(c),toInteriorTexture:(0,l.p)(m),toInteriorHoverTexture:(0,l.p)(u)},p)};var v,y=i(49827),w=i(12529),f=i(23331);!function(e){e[e.HIDE=0]="HIDE",e[e.SHOW=1]="SHOW",e[e.ONTOP=2]="ONTOP"}(v||(v={}));class b extends n.Mesh{constructor(e,t){const i=new d(g.get().toInteriorTexture,g.get().toInteriorHoverTexture);super(b.geometry,i),this.layers.mask=t.mask,this.uniforms=i.uniforms,this.renderOrder=w.z.portals,this.setState(v.HIDE),this.update(e)}update(e){if(this.portalData=e,this.position.copy(e.position),null!==e.lookDirection){const t=e.lookDirection.clone().add(e.position);this.lookAt(t)}this.hoverProgress=0,this.hovered=!1,e.toExterior?(this.uniforms.tNoHover.value=g.get().toExteriorTexture,this.uniforms.tHover.value=g.get().toExteriorHoverTexture):(this.uniforms.tNoHover.value=g.get().toInteriorTexture,this.uniforms.tHover.value=g.get().toInteriorHoverTexture)}resetMesh(e=0,t=!1,i=!1){this.uniforms.opacity.value=e,this.visible=0!==e,this.material.depthTest=t,this.material.depthWrite=i}setHover(e){this.hovered=e}setState(e){switch(e){case v.HIDE:this.resetMesh(0,!0,!0);break;case v.SHOW:this.resetMesh(1,!0,!0);break;case v.ONTOP:this.resetMesh(1)}}render(e,t){var i;if(this.hovered&&this.hoverProgress<1?this.hoverProgress+=e/300:!this.hovered&&this.hoverProgress>0&&(this.hoverProgress-=e/300),this.hoverProgress=(0,y.uZ)(this.hoverProgress,0,1),this.uniforms.progress.value=this.hoverProgress,null===(i=this.portalData)||void 0===i?void 0:i.billboard){const e=t.pose.position,i=this.position.copy(this.portalData.position),n=e.distanceTo(i);n<f.nm?i.lerpVectors(e,i,f.nm/n):n>f.iz&&i.lerpVectors(e,i,f.iz/n),this.lookAt(t.pose.position)}}updatePortalTexture(e){this.uniforms.tPortal.value=e}raycast(e,t){if(!this.visible)return;const i=[];super.raycast(e,i),i.length>0&&(i[0].distance/=1e4,t.push(i[0]))}}b.geometry=new n.PlaneGeometry(f.vX,f.vX)},9162:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>S});var n=i(97542),s=i(69170),a=i(76609),o=i(81396),r=i(29837),d=i.n(r),l=i(45405),h=i.n(l);class c extends o.RawShaderMaterial{constructor(){const e=o.UniformsUtils.clone(c.uniforms);super({vertexShader:d(),fragmentShader:h(),uniforms:e,name:"PortalViewportMaterial",side:o.BackSide})}updateTexture(e){this.uniforms.tMap.value=e}}c.uniforms={tMap:{type:"t",value:null}};class m{constructor(e,t,i,n){this.tempLookDirection=new o.Vector3,this.worldCamera=n,this.camera=new o.Camera,this.renderSize=i,this.sweepTextureLoader=e,this.textureRenderer=t,this.renderTargets={},this.renderCube=new o.Mesh(new o.BoxGeometry(4,4,4),new c)}async getPortalTexture(e,t,i){const n=this.renderTargets[e.id]||this.textureRenderer.createRenderTarget2D(this.renderSize,this.renderSize),s=await this.sweepTextureLoader.load(e,a.SL.BASE);return this.renderCube.material.updateTexture(s),this.renderCube.quaternion.copy(t),this.camera.projectionMatrix.copy(this.worldCamera.projectionMatrix),this.worldCamera.getWorldPosition(this.tempLookDirection),this.camera.lookAt(this.tempLookDirection.sub(i).negate()),this.textureRenderer.render(n,this.renderCube,this.camera),n.texture}releasePortalTexture(e){const t=this.renderTargets[e];t&&this.textureRenderer.disposeRenderTarget2D(t)}}var u=i(51159),p=i(70903),g=i(23612),v=i(86819),y=i(72996),w=i(48476);class f{constructor(e,t,i,n,s){this.container=new o.Object3D,this.bindings=[],this.visibilityFilter=e=>u.Y.HIDE,this.scene=e,this.input=t,this.layer=n,this.cameraData=s,this.viewportLoader=i,this.meshes=[],this.activeMeshes={},this.meshToDataMap={},this.dataToMeshMap={},this.activeTexturePromises={},this.meshPool=new p.L}addPortal(e){let t;const i=this.meshPool.get();i?(t=i.object,t.update(e)):t=this.meshPool.add(new u.p(e,this.layer)).object,this.meshes.push(t),this.container.add(t),this.meshToDataMap[t.id]=e,this.dataToMeshMap[e.index]=t,this.activateMesh(t,this.visibilityFilter(e))}removePortal(e){const t=this.dataToMeshMap[e.index];if(t){this.meshPool.free(t);const i=this.meshes.findIndex((e=>e.id===t.id));this.meshes.splice(i,1),this.container.remove(t),this.deactivateMesh(t),delete this.meshToDataMap[t.id],delete this.dataToMeshMap[e.index]}}init(){}activate(e){this.broadcast=e.broadcast.bind(e),this.bindings.push(this.input.registerMeshHandler(g.z,y.s.isType(u.p),((e,t)=>{this.onPuckSelect(t)}))),this.bindings.push(this.input.registerMeshHandler(g.A,y.s.isType(u.p),((e,t)=>{this.onPuckDeselect(t)}))),this.bindings.push(this.input.registerMeshHandler(v.R,y.s.isType(u.p),((e,t)=>{this.onPuckClick(t)}))),this.scene.add(this.container)}dispose(){for(const e of Object.keys(this.meshToDataMap)){const t=this.meshToDataMap[e],i=this.dataToMeshMap[t.index];this.removePortal(t),i.material.dispose(),i.geometry.dispose()}}deactivate(e){for(const e of this.bindings)e.cancel();this.bindings.length=0,this.scene.remove(this.container)}render(e){for(const t of this.meshes)t.render(e,this.cameraData)}filter(e){this.visibilityFilter=e;for(const t of this.meshes){const i=e(this.meshToDataMap[t.id]);i===u.Y.HIDE?this.deactivateMesh(t):this.activateMesh(t,i)}}mapSweepToMesh(e){for(const t in this.meshToDataMap){const i=this.meshToDataMap[t];if(i.toSweep.id===e&&i.toExterior&&i.fromInterior)return this.dataToMeshMap[i.index]}return null}activateMesh(e,t=0){this.activeMeshes[e.id]||(this.input.registerMesh(e,!1),this.activeMeshes[e.id]=!0),e.setState(t)}deactivateMesh(e){this.input.unregisterMesh(e),this.activeMeshes[e.id]=!1,this.onPuckDeselect(e),e.setState(u.Y.HIDE)}onPuckClick(e){this.broadcast(new w.K(this.meshToDataMap[e.id]))}onPuckSelect(e){this.broadcast(new w.x(!0));const t=this.meshToDataMap[e.id].toSweep,i=this.viewportLoader.getPortalTexture(t,t.rotation,e.position);this.activeTexturePromises[e.id]=i,i.then((t=>{this.activeTexturePromises.hasOwnProperty(e.id)&&i===this.activeTexturePromises[e.id]&&(e.updatePortalTexture(t),e.setHover(!0))}))}onPuckDeselect(e){this.broadcast(new w.x(!1)),e.setHover(!1),this.viewportLoader.releasePortalTexture(this.meshToDataMap[e.id].toSweep.id),delete this.activeTexturePromises[e.id]}}var b=i(23331),T=i(16769),D=i(53954),C=i(9037),P=i(63252),A=i(66777),I=i(98169),E=i(81248);class S extends n.Y{constructor(){super(...arguments),this.name="sweep-portal-mesh",this.portalCount=0}async init(e,t){const[i,n,a,o,r,d,l]=await Promise.all([t.getModuleBySymbol(s.y.MODEL_DATA),t.getModuleBySymbol(s.y.RAYCASTER),t.getModuleBySymbol(s.y.INPUT),t.getModuleBySymbol(s.y.RENDER_TO_TEXTURE),t.getModuleBySymbol(s.y.WEBGL_RENDERER),t.market.waitForData(D.Z),t.market.waitForData(C.M)]),h=t.claimRenderLayer(this.name);this.portalData={};const c=r.getScene().camera,u=new A.Z(i.getSignedUrls());this.raycaster=n;const p=new m(u,o,256,c),g=r.getScene().scene;this.portalRenderer=new f(g,a,p,h,l),await Promise.all([t.getModuleBySymbol(s.y.MESH_API_FIXUP)]);const v=P.hU.MANUAL,y=d.filter((e=>I.H7(e)));d.iterate((e=>{this.portalData[e.id]||(this.portalData[e.id]=[]),I.H7(e)&&this.addPortals(e,this.portalRenderer,d,y);let t=e.placementType;this.bindings.push(e.onPropertyChanged("placementType",(i=>{t!==v&&i===v&&this.addPortals(e,this.portalRenderer,d,y),t===v&&i!==v&&this.removePortals(e.id,this.portalRenderer),t=i}))),this.bindings.push(e.onChanged((()=>{I.H7(e)&&(this.removePortals(e.id,this.portalRenderer),this.addPortals(e,this.portalRenderer,d,y))})))})),t.addComponent(this,this.portalRenderer)}filter(e){this.portalRenderer.filter(e)}getPortalToExterior(e){return this.portalRenderer.mapSweepToMesh(e)}removePortals(e,t){for(const i of this.portalData[e])t.removePortal(i);this.portalData[e]=[]}addPortals(e,t,i,n){const s=this.nearestAlignedSweep(e,i);if(s){const i=this.entryLinks(e,s),a=this.neighborLinks(e,n);this.portalData[e.id]=i.concat(a);for(const i of this.portalData[e.id])t.addPortal(i)}else this.log.debug(`Couldn't find the nearest sweep for a 360 on floor ${e.floorId}; not adding portals`)}nearestAlignedSweep(e,t){const i=[I.ff(e),I._k(),I._T(),I.b1(e)],n=[E.TE(e.position)],s=t.sortByScore(i,n)[0];return s?s.sweep:null}modelIntersection(e,t,i=1/0){const n=(new o.Vector3).copy(e.position).sub(t.position).setY(0).normalize(),s=this.raycaster.picking.pick(t.position,n,T.T0);return{intersect:s&&s.distance<=i?s:null,rayDirection:n}}entryLinks(e,t){const i=[],n=e.position.distanceTo(t.position),s=this.modelIntersection(e,t,n+b.vX);let a,r,d=!1;s.intersect&&s.intersect.face?(a=s.intersect.face.normal.clone().setY(0).normalize(),Math.abs(s.rayDirection.dot(a))<.3&&a.copy(s.rayDirection).multiplyScalar(-1),r=s.intersect.point.clone().addScaledVector(a,b.AF)):(a=null,d=!0,r=e.position.clone()),r.y=t.position.y,i.push({index:this.portalCount++,toSweep:e,fromSweep:t,position:r,lookDirection:a,billboard:d,toExterior:!0,fromInterior:!0});const l=(new o.Vector3).lerpVectors(e.position,t.position,2/n).setY(e.position.y);return i.push({index:this.portalCount++,toSweep:t,fromSweep:e,position:l,lookDirection:a?a.clone().negate():null,billboard:d,toExterior:!1,fromInterior:!1}),i}neighborLinks(e,t){const i=[];for(const n of t)if(e!==n&&n.floorId===e.floorId&&e.position.distanceTo(n.position)<b.M0){const t=e.position.distanceTo(n.position);if(this.modelIntersection(e,n,t).intersect||this.modelIntersection(n,e,t).intersect)continue;const s=e.position.clone().sub(n.position).setY(0).normalize(),a=n.position.clone(),o=b.iz;t>o&&a.addScaledVector(s,t-o),i.push({index:this.portalCount++,toSweep:n,fromSweep:e,position:a,lookDirection:s,billboard:!1,toExterior:!0,fromInterior:!1})}return i}}},48476:(e,t,i)=>{"use strict";i.d(t,{K:()=>s,x:()=>a});var n=i(98010);class s extends n.v{constructor(e){super(),this.toSweep=e.toSweep,this.toExterior=e.toExterior,this.fromInterior=e.fromInterior,this.meshPosition=e.position}}class a extends n.v{constructor(e){super(),this.hovered=e}}},23331:(e,t,i)=>{"use strict";i.d(t,{AF:()=>s,M0:()=>n,iz:()=>r,nm:()=>o,vX:()=>a});const n=15,s=.1,a=.3,o=.75,r=4},87295:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>f});const n=(0,i(78283)._F)(20);var s=i(97542),a=i(69170),o=i(63252),r=i(95882),d=i(64918),l=i(9037),h=i(53954),c=i(23254),m=i(51159),u=i(48476),p=i(12039),g=i(34029),v=i(43736),y=i(34956),w=i(38987);class f extends s.Y{constructor(){super(...arguments),this.name="sweep-portal-navigation",this.onChange=()=>{this.portalRenderer.filter((e=>{if(!this.settingsData.tryGetProperty(v.s,!0))return m.Y.HIDE;if(!(0,r.Bw)(this.viewmodeData.closestMode))return m.Y.HIDE;const t=this.sweepData.getSweep(this.sweepData.currentSweep||"");if(t)if(t.alignmentType===o.z9.ALIGNED){if(e.fromInterior&&e.toExterior&&e.position.distanceTo(t.position)<n)return m.Y.SHOW}else if(t.placementType===o.hU.MANUAL&&e.fromSweep.id===t.id)return m.Y.ONTOP;return m.Y.HIDE}))}}async init(e,t){this.engine=t,[this.portalRenderer,this.cameraData,this.viewmodeModule,this.viewmodeData,this.sweepData,this.settingsData]=await Promise.all([t.getModuleBySymbol(a.y.SWEEP_PORTAL),t.market.waitForData(l.M),t.getModuleBySymbol(a.y.VIEWMODE),t.market.waitForData(c.O),t.market.waitForData(h.Z),t.market.waitForData(g.e)]);const i=(e,i)=>{this.viewmodeData.currentMode&&this.cameraData.canTransition()&&(this.viewmodeData.currentMode!==r.Ey.Panorama?this.viewmodeModule.switchToMode(r.Ey.Panorama,d.n.FadeToBlack,{sweepID:e,rotation:i}):t.commandBinder.issueCommand(new p.ju({sweep:e,rotation:i,transition:d.n.FadeToBlack})))};this.settingsData.onPropertyChanged(v.s,this.onChange),this.bindings.push(t.subscribe(u.K,(e=>{i(e.toSweep.id)})),t.subscribe(u.x,(e=>this.onPortalHover(e.hovered))),this.viewmodeData.onChanged(this.onChange),this.sweepData.onChanged(this.onChange)),this.onChange()}onPortalHover(e){const t=e?y.C.FINGER:null;this.engine.commandBinder.issueCommand(new w.u(t))}}},94053:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CancelNewTagCommand:()=>x.$g,CloseTagCommand:()=>x.xb,DeleteTagCommand:()=>x.T3,EditTagCommand:()=>x.zt,FilterVisibleTagsCommand:()=>x.Sq,OpenTagCommand:()=>x.lt,SaveCustomTagOrderCommand:()=>x.$B,SaveTagCommand:()=>x.QG,SaveTagVisibilityCommand:()=>x.bg,SetTagOrderByCommand:()=>x.kT,SetTagsModeCommand:()=>x.Li,StartNewTagCommand:()=>x.$J,TagOrderBy:()=>M.D,TagsMode:()=>M.U,TagsToolToggleCommand:()=>x.yU,TagsViewData:()=>ue.n,TagsVisibilityFilterEnabledCommand:()=>x.aI,ToggleDirtyTagStateCommand:()=>x.q4,default:()=>ke});var n=i(81396),s=i(97542),a=i(69170),o=i(5823),r=i(38399),d=i(39880),l=i(87926);const h=i.p+"images/tagColor.png";var c=i(79728),m=i(635),u=i(64918),p=i(12039),g=i(52528),v=i(74082),y=i(14630),w=i(64773),f=i(47620),b=i(30643),T=i(54244),D=i(89570),C=i(56163),P=i(35221),A=i(43470),I=i(86283),E=i(39689),S=i(62612),k=i(19280);class N extends C.K{constructor(e,t,i,s,a,r,d,l){super(e,t,i),this.containerData=s,this.tag=a,this.tagIconsEnabled=d,this.defaultTagLabel=l,this.id=this.tag.id,this.title=this.tag.label||this.textParser.getPlainText(this.tag.description)||this.defaultTagLabel,this.description=this.tag.label?this.textParser.getPlainText(this.tag.description):"",this.icon=`icon-${(0,E.m)(S.Er.MATTERTAG,this.tag.icon,this.tagIconsEnabled)}`,this.typeId=o.SF.MATTERTAG,this.floorId=this.tag.floorId,this.layerId=this.tag.layerId,this.dateBucket=(0,P.f)(this.tag.created),this.color=function(e){const t=new n.Color(e);return`rgb(${255*t.r}, ${255*t.g}, ${255*t.b})`}(this.tag.color),this.enabled=this.tag.enabled,this.onSelect=async()=>{await this.commandBinder.issueCommand(new A.yL),await this.commandBinder.issueCommand(new p.OR({pinPosition:this.tag,transition:u.n.FadeToBlack})),(0,k.p)(this.containerData.size)?this.commandBinder.issueCommand(new A.bd(this.id,I.J.TAG)):this.commandBinder.issueCommand(new A.oM(this.id,I.J.TAG))},this.textParser=r}supportsLayeredCopyMove(){return!0}supportsBatchDelete(){return!0}}var O=i(59279),M=i(12150),x=i(43037),R=i(71166),V=i(48945);const{TAGS:B}=r.Z.SHOWCASE,L=new g.v({links:!0}),F="0"===(0,O.eY)("mt");function H(e,t,i,n,s,a,r,d){let l=r.application===T.Mx.WORKSHOP;const h=a.tryGetProperty(V.RV,!1),c=(t,a,o,r=[])=>{const c=[];return(i.tagOrder===M.D.ALPHABETICAL?i.getAlphabeticTagViewMapFilter().values:i.getOrderedTagViewMapFilter().values).forEach((i=>{if(!(l||i.enabled&&n.layerToggled(i.layerId)))return;if(i.objectAnnotationId)return;let o=t(i.label,L.getPlainText(i.description));o&&r.length>0&&(o=i.keywords.length>0&&i.keywords.some((e=>r.includes(e)))),o&&c.push(new N(e,n,a,s,i,L,h,d))})),e.issueCommand(new x.Sq(c.map((e=>e.id)))),c},m=t=>{e.issueCommand(new x.aI(!!t))},u=e=>new D.V(i.getOrderedTagViewMapFilter().onChanged(e),i.onPropertyChanged("tagOrder",e)),p={renew:()=>{e.issueCommandWhenBound(new R.c6({id:o.SF.MATTERTAG,groupPhraseKey:B.SEARCH_GROUP_HEADER,getSimpleMatches:c,registerChangeObserver:u,onSearchActivatedChanged:m,getKeywords:t.getTagKeywords.bind(t),groupOrder:20,groupIcon:"toolbar-mattertags"}))},cancel:()=>{e.issueCommandWhenBound(new R.Pe(o.SF.MATTERTAG))}},g=e=>{l=e===T.Mx.WORKSHOP;!F||l?p.renew():p.cancel()},v=r.onPropertyChanged("application",g);return g(r.application),new D.V(p,v)}var j,U=i(98010);class G extends U.v{constructor(e,t,i){super(),this.sid=e,this.position=t,this.distanceFromCamera=i}}class z extends U.v{constructor(e,t){super(),this.sid=e,this.removeMethod=t}}class _ extends U.v{constructor(e,t){super(),this.sid=e,this.characterCount=t}}class $ extends U.v{constructor(e,t,i){super(),this.sid=e,this.characterCount=t,this.tagDescriptionChunks=i}}class K extends U.v{constructor(e,t,i){super(),this.sid=e,this.mediaType=t,this.mediaSrc=i}}class W extends U.v{constructor(e,t,i){super(),this.sid=e,this.property=t,this.value=i}}class J extends U.v{constructor(e,t,i,n){super(),this.sid=e,this.position=t,this.distanceFromCamera=i,this.distanceMoved=n}}!function(e){e.DISC_COLOR="disc_color",e.STEM_VISIBLE="stem_visible",e.STEM_LENGTH="stem_length",e.TITLE="title",e.DESCRIPTION="description",e.MEDIA="media",e.LINKS="links",e.ENABLED="enabled",e.KEYWORDS="keywords"}(j||(j={}));var Y=i(72936),q=i(60083),Z=i(13132),Q=i(16935),X=i(5604),ee=i(76631),te=i(40964),ie=i(89549),ne=i(91380),se=i(92211),ae=i(24102),oe=i(43846),re=i(66338),de=i(25561),le=i(71776),he=i(19648),ce=i(88669),me=i(85679),ue=i(61774),pe=i(35446),ge=i(21149),ve=i(79727),ye=i(53954),we=i(34029),fe=i(23254),be=i(55318),Te=i(9037),De=i(76957),Ce=i(80742),Pe=i(28022),Ae=i(55502),Ie=i(51397),Ee=i(2367);class Se extends s.Y{constructor(){super(...arguments),this.name="tags-module",this.opening=null,this.activated=!1,this.registered=!1,this.activeBindings=[],this.updatePerSettings=()=>{const e=this.settingsData.tryGetProperty(le.re,!1),t=!this.in360View()&&e;this.engine.commandBinder.issueCommand(new Y.qN(S.Er.MATTERTAG,t)),t||this.closeTagBillboard()},this.tagsToolToggled=async e=>{e.opened?this.activateTool():this.deactivateTool()},this.updateViewingControls=()=>{const{openTagView:e}=this.viewData,t=this.toolsData.toolPanelLayout===ee.wS.BOTTOM_PANEL,i=!this.activated||!t&&!e;this.engine.broadcast(new te.ps(i))},this.onCloseTag=async()=>{this.closeTag()},this.pinAddCancelled=e=>{e.pinType===S.Er.MATTERTAG&&this.cancelTagCreation(!1)},this.onCancelNewTag=async()=>{this.cancelTagCreation(!0)},this.cancelTagCreation=e=>{var t;const i=this.viewData,n=null===(t=i.openTagView)||void 0===t?void 0:t.id;this.cancelAttachmentChanges(),i.setOpenTagView(null),i.creatingTag=!1,i.commit(),n&&(e&&this.engine.commandBinder.issueCommand(new Y.tT(n,S.Er.MATTERTAG)),this.engine.commandBinder.issueCommand(new A.Aj(n,I.J.TAG)))},this.tagsWereChanged=()=>{this.updateTagViews(),this.displayTags()},this.updateTagViews=()=>{this.viewData.updateTagViews(this.getCustomTagOrder())},this.onTagRemoved=e=>{const t=e.objectAnnotationId?S.Er.OBJECT:S.Er.MATTERTAG;this.engine.commandBinder.issueCommand(new Y.OL(e.sid,t))},this.handleModelViewChange=()=>{if(this.viewData.openTagView)if(this.viewData.creatingTag)this.cancelTagCreation(!0);else{this.tagsData.getTag(this.viewData.openTagView.id)||this.closeTag()}},this.onLayersChanged=()=>{this.closeTagBillboard(),this.displayTags()},this.onOpenTagViewChanged=()=>{const e=this.viewData.openTagView;e&&this.updateTagPin(e)},this.startTagCreation=async()=>{const e=this.viewData;e.setTagsMode(M.U.DEFAULT),await this.closeTag();let t=(0,d.O1)(11);for(;this.tagsData.getTag(t);)t=(0,d.O1)(11);const i=new ce.U;i.sid=t,i.floorId=this.floorsViewData.getHighestVisibleFloor().id,i.layerId=this.layersData.activeLayerId;const n=e.createTagView(i);e.creatingTag=!0,e.commit(),e.setOpenTagView(n),this.engine.commandBinder.issueCommand(new Y.fM(n.id,this.getPinUpdate(n),S.Er.MATTERTAG,n.backgroundTexture))},this.saveTag=async e=>{const{id:t,properties:i,pendingAttachments:n,removedAttachments:s,embed:a}=e,o=this.viewData,{openTagView:r,creatingTag:d}=o;if(!r)return void this.log.debug("No open tag");const l=Object.assign({},r,i);this.trackChanges(t,l,a),d?(o.creatingTag=!1,o.commit(),await this.engine.commandBinder.issueCommand(new he.Mm(t,l,n,a))):await this.engine.commandBinder.issueCommand(new he.qq(t,l,n,s,a)),l.objectAnnotationId||this.selectPin(t,!0),await this.engine.commandBinder.issueCommand(new pe.x9),this.closeTag()},this.saveTagVisibility=async e=>{const{id:t,visible:i}=e,n=this.tagsData.getTag(t);if(!n)throw new Error("Tag not found!");this.engine.commandBinder.issueCommand(new Y.ik(t,S.Er.MATTERTAG,this.getTagVisibility(t,n.layerId,i)));const s={enabled:i};return this.trackChanges(t,s),i||this.closeTag(),this.engine.commandBinder.issueCommand(new he.qq(t,s))},this.onToggleTagDirty=async e=>{this.viewData.dirtyTagState=e.dirty,this.viewData.commit()},this.onDeleteTag=async e=>{const t=e.id;this.tagsData.getTag(t)?(this.engine.commandBinder.issueCommand(new se.rE),this.engine.broadcast(new z(t,e.removalMethod)),this.engine.commandBinder.issueCommand(new he.Gn(t)).then((()=>{this.saveTags().then((()=>{this.engine.commandBinder.issueCommand(new Y.OL(t,S.Er.MATTERTAG));const e=this.viewData.openTagView;e&&e.id===t&&this.closeTag()}))})),this.engine.commandBinder.issueCommand(new pe.x9)):this.log.debug("Cannot delete a non-existent tag")},this.onEditTag=async e=>{const{tagId:t}=e;this.tagsData.getTag(t)?(await this.engine.commandBinder.issueCommand(new pe.x9),await this.openTag(t,u.n.FadeToBlack,!0,!0),this.openAnnotation(t,!0),this.selectPin(t,!0)):this.log.debug("Cannot edit a non-existent tag")},this.onSaveCustomTagOrder=async e=>{const{ids:t}=e,i=t.map((e=>({id:e,type:ae.l.TAG})));await this.engine.commandBinder.issueCommand(new oe.wg(de.q,i)),this.viewData.updateTagViews(t)},this.pinMoved=e=>{const{id:t,pinType:i,pinPos:n,previousPos:s}=e,a=this.viewData.openTagView;if(a&&i===S.Er.MATTERTAG&&t===a.id){if(this.tagsData.getTag(t)){const e={position:n.anchorPosition,normal:n.stemNormal,floorId:n.floorId};this.engine.broadcast(new J(t,e.position,e.position.distanceTo(this.cameraData.pose.position),s?e.position.distanceTo(s.anchorPosition):0)),this.engine.commandBinder.issueCommand(new he.qq(t,e))}else this.log.debug("Cannot move a non-existent tag")}},this.pinPlaced=e=>{const{openTagView:t}=this.viewData;t&&e.pinType===S.Er.MATTERTAG&&e.id===t.id&&(Object.assign(t,e.pinPos),this.openAnnotation(t.id,!0))},this.handlePinFocusChange=async()=>{const{openTagView:e,creatingTag:t}=this.viewData;if(t)return;const{commandBinder:i}=this.engine,{focusedPin:n,selectedPinId:s}=this.pinsViewData,{billboardAnnotation:a}=this.annotationsViewData;if(!n)return void(a&&a.annotationType===I.J.TAG&&a.id!==s&&await i.issueCommand(new A.Aj(a.id,I.J.TAG)));const o=this.getSelectedTag(),r=o&&(null==o?void 0:o.id)===(null==e?void 0:e.id),d=e&&(null==e?void 0:e.id)===(null==n?void 0:n.id);if(e&&r&&!d&&this.closeTag(),n.pinType===S.Er.MATTERTAG){const t=this.viewData.getTagView(n.id);if(!t)return void this.log.debug("Focused pin changed, but no tag view.");t.id!==(null==e?void 0:e.id)&&(i.issueCommand(new A.Kw(t.id,I.J.TAG)),this.engine.broadcast(new Ae.dJ(t.id,Ie.V.HOVER)))}},this.handlePinSelectionChange=async()=>{const{openTagView:e,dirtyTagState:t}=this.viewData,{selectedPinId:i}=this.pinsViewData;if(t||(null==e?void 0:e.id)===i)return;const n=i?this.pinsViewData.getPin(i):null,s=this.appData.application===T.Mx.WORKSHOP;if(e&&!n)!s&&this.activated?this.deactivateTool():this.closeTag();else if(n&&n.pinType===S.Er.MATTERTAG){const e=this.isTagDocked(),t=s&&this.activated&&!!e,i=(0,k.p)(this.containerData.size)||t;this.engine.broadcast(new Ae.dJ(n.id,Ie.V.OPEN)),await this.openTag(n.id,u.n.Interpolate,i),this.openAnnotation(n.id,i)}},this.handleAnnotationsChanged=async()=>{const{openTagView:e,creatingTag:t}=this.viewData;if(t||this.opening)return;const i=this.getDockedTag(),n=this.getSelectedTag(),s=i||n,a=!!i,{dockedAnnotation:o}=this.annotationsViewData;e&&!s&&(null==o?void 0:o.annotationType)!==I.J.OBJECT?this.closeTag():s&&s.id!==(null==e?void 0:e.id)&&(await this.openTag(s.id,u.n.Interpolate,a),this.selectPin(s.id,a)),a?this.activated||await this.engine.commandBinder.issueCommand(new ie.z2(ee.w1.TAGS,!0)):this.toolsData.softOpening&&await this.engine.commandBinder.issueCommand(new ie.CH(ee.w1.TAGS))},this.handleViewingAttachment=e=>{const{annotationType:t,id:i,attachmentId:n}=e;if(t!==I.J.TAG)return;const s=this.viewData.getTagView(i);if(!s)return void this.log.debug("Cannot view attachment for a non-existent tag");const a=s.attachments,o=a.find((e=>e.id===n));if(o&&(0,ge.lV)(o)){const e=a.filter((e=>(0,ge.lV)(e)));this.engine.commandBinder.issueCommand(new pe.xW(!0,e,n))}},this.onOpenTag=async e=>{const{tagId:t,dock:i,transition:n,objectTag:s,forceOpen:a}=e,o=this.annotationsViewData.getCapabilities(t).dock,r=!(!i||!o),d=null===i&&this.isTagDocked()&&o,l=r||d||!(!i||!a);l&&s?this.dockObjectTag(t):(await this.openTag(t,n,l,!1),this.openAnnotation(t,l,a),this.selectPin(t,l))},this.filterVisibleTags=async e=>{const{idVisibility:t}=this.viewData;t.clear(),e.ids.forEach((e=>t.add(e))),this.viewData.commit(),this.displayTags()},this.tagVisbilityFilterEnabled=async e=>{this.viewData.idVisibilityEnabled=e.enabled,this.viewData.commit(),this.displayTags()},this.setTagOrderBy=async({order:e})=>{e!==this.viewData.tagOrder&&(this.viewData.tagOrder=e,this.viewData.commit())},this.setTagsMode=async({mode:e})=>{e===M.U.REORDERING&&this.closeTag(),this.viewData.setTagsMode(e)}}async init(e,t){const[i,n,s,o,d,c,m,u,p,f,b,D,C]=await Promise.all([t.market.waitForData(Te.M),t.market.waitForData(me.n),t.market.waitForData(ne.t),t.market.waitForData(ye.Z),t.market.waitForData(we.e),t.market.waitForData(fe.O),t.market.waitForData(Q.A),t.market.waitForData(T.pu),t.market.waitForData(ve.c),t.market.waitForData(re.W),t.market.waitForData(Ce.R),t.market.waitForData(Ee.V),t.getModuleBySymbol(a.y.LOCALE)]),[P,A,I]=await Promise.all([t.market.waitForData(De.i),t.market.waitForData(be.O),t.getModuleBySymbol(a.y.DEEP_LINKS)]);this.cameraData=i,this.tagsData=n,this.toolsData=s,this.sweepData=o,this.settingsData=d,this.viewmodeData=c,this.annotationsViewData=m,this.appData=u,this.floorsViewData=p,this.orderedListData=f,this.layersData=b,this.containerData=D,this.engine=t,this.backgroundTexture=(0,l.p)(h),this.descriptionParser=new v.$({supportLinks:!0,keepLinkLabels:!0});const E=new g.v({links:!0,hashtags:!1}),S=this.getCustomTagOrder(),k=C.t(r.Z.WORKSHOP.MATTERTAGS.DEFAULT_TAG_TITLE);this.viewData=new ue.n(this.tagsData,P,A,S,E,I,k,this.backgroundTexture,e.objectTagsEnabled),this.pinsViewData=await t.market.waitForData(q.B),this.bindings.push(d.onPropertyChanged(le.re,this.updatePerSettings),t.commandBinder.addBinding(x.yU,this.tagsToolToggled),t.subscribe(X.q,this.handleViewingAttachment),t.subscribe(y.Z,this.updatePerSettings),t.subscribe(w.m,this.updatePerSettings),c.makeModeChangeSubscription(this.updatePerSettings),t.commandBinder.addBinding(x.xb,this.onCloseTag),t.commandBinder.addBinding(x.lt,this.onOpenTag),t.commandBinder.addBinding(x.Li,this.setTagsMode),t.commandBinder.addBinding(x.kT,this.setTagOrderBy),t.commandBinder.addBinding(x.QG,this.saveTag),t.commandBinder.addBinding(x.q4,this.onToggleTagDirty),t.commandBinder.addBinding(x.T3,this.onDeleteTag),t.commandBinder.addBinding(x.bg,this.saveTagVisibility),t.commandBinder.addBinding(x.zt,this.onEditTag),this.pinsViewData.onSelectedPinChanged(this.handlePinSelectionChange),this.pinsViewData.onFocusedPinChanged(this.handlePinFocusChange),this.annotationsViewData.onChanged(this.handleAnnotationsChanged),this.viewData.onOpenTagViewChanged(this.onOpenTagViewChanged),this.orderedListData.onChanged(this.updateTagViews),this.tagsData.onChanged(this.tagsWereChanged),this.tagsData.collection.onElementChanged({onRemoved:this.onTagRemoved}),this.appData.onChanged((()=>this.displayTags())),this.layersData.onCurrentLayersChanged(this.onLayersChanged),this.layersData.onPropertyChanged("activeLayerId",(()=>this.updatePendingTag())),t.commandBinder.addBinding(x.Sq,this.filterVisibleTags),t.commandBinder.addBinding(x.aI,this.tagVisbilityFilterEnabled),t.subscribe(Pe.YB,this.handleModelViewChange)),t.market.register(this,ue.n,this.viewData),this.updatePerSettings(),this.displayTags();const N=H(t.commandBinder,this.tagsData,this.viewData,this.layersData,D,this.settingsData,this.appData,k);this.bindings.push(N)}dispose(e){this.deactivateTool(!0),this.bindings.forEach((e=>{e.cancel()})),this.bindings=[],this.activeBindings=[],this.engine.commandBinder.issueCommand(new Y.zM(S.Er.MATTERTAG)),this.backgroundTexture.dispose(),super.dispose(e)}onUpdate(){}activateTool(){this.activated||(this.engine.commandBinder.issueCommand(new A.yL(I.J.TAG)),this.engine.commandBinder.issueCommand(new Y.Ki(!0)),this.registered?this.activeBindings.forEach((e=>{e.renew()})):this.registerHandlers(),this.activated=!0,this.updateViewingControls())}deactivateTool(e){if(!this.activated)return;const{creatingTag:t,openTagView:i,tagsMode:n}=this.viewData;n!==M.U.DEFAULT&&this.viewData.setTagsMode(M.U.DEFAULT),this.engine.commandBinder.issueCommand(new Y.iK),t?this.cancelTagCreation(!0):i&&this.closeTag(),this.engine.commandBinder.issueCommand(new Y.Ki(!1)),this.activeBindings.forEach((e=>{e.cancel()})),this.activated=!1,this.updateViewingControls(),this.engine.commandBinder.issueCommand(new pe.x9)}registerHandlers(){const e=this.engine.commandBinder;this.activeBindings.push(this.engine.subscribe(Z.b0,this.pinPlaced),this.engine.subscribe(Z.bV,this.pinMoved),this.engine.subscribe(Z.hu,this.pinAddCancelled),e.addBinding(x.$J,this.startTagCreation),e.addBinding(x.$g,this.onCancelNewTag),e.addBinding(x.$B,this.onSaveCustomTagOrder),this.viewData.onOpenTagViewChanged(this.updateViewingControls),this.viewData.onPropertyChanged("creatingTag",this.updateViewingControls),this.viewData.onPropertyChanged("tagsMode",(()=>this.displayTags()))),this.registered=!0}closeTagBillboard(){const{billboardAnnotation:e}=this.annotationsViewData;e&&e.annotationType===I.J.TAG&&this.engine.commandBinder.issueCommand(new A.Aj(e.id,I.J.TAG))}in360View(){const e=this.sweepData.currentSweep?this.sweepData.currentSweep:"";return this.viewmodeData.isInside()&&this.sweepData.isSweepUnaligned(e)}async closeTag(){const{commandBinder:e}=this.engine,t=this.viewData,{openTagView:i}=t;if(i){const{id:n,layerId:s,enabled:a}=i;t.setOpenTagView(null),this.cancelAttachmentChanges(),e.issueCommand(new R.IL(null)),e.issueCommand(new pe.xW(!1));const o=this.tagsData.getTag(n);o&&(e.issueCommand(new Y.RH(n,S.Er.MATTERTAG)),o.objectAnnotationId?e.issueCommand(new Y.OL(n,S.Er.MATTERTAG)):e.issueCommand(new Y.ik(n,S.Er.MATTERTAG,this.getTagVisibility(n,s,a)))),await e.issueCommand(new A.Aj(n,I.J.TAG))}this.engine.commandBinder.issueCommand(new pe.x9)}getTagVisibility(e,t,i){const{openTagView:n,idVisibilityEnabled:s,idVisibility:a,tagsMode:o}=this.viewData,r=this.appData.application===T.Mx.WORKSHOP||this.layersData.layerToggled(t),d=this.layersData.layerVisible(t),l=o===M.U.REORDERING,h=!s||a.has(e),c=(null==n?void 0:n.id)===e;return r&&(c||i&&l||i&&h&&d)}displayTags(){const e=[];this.viewData.getOrderedTags(!1).forEach((t=>{if(!t.objectAnnotationId){const i=this.getPinUpdate(t);e.push(i)}})),this.engine.commandBinder.issueCommand(new Y.mE(e))}updateTagPin(e){if(!e.objectAnnotationId){const t=this.getPinUpdate(e);this.engine.commandBinder.issueCommand(new Y.mE([t]))}}getPinUpdate(e){const{id:t,layerId:i,enabled:n,anchorPosition:s,color:a,icon:o,stemEnabled:r,floorId:d,roomId:l,stemNormal:h,stemLength:c}=e;return{id:t,anchorPosition:s,color:a,floorId:d,roomId:l,stemEnabled:r,stemNormal:h,stemLength:c,pinType:S.Er.MATTERTAG,backgroundTexture:this.backgroundTexture,icon:o,visible:this.getTagVisibility(t,i,n)}}updatePendingTag(){const{creatingTag:e,openTagView:t}=this.viewData;e&&t&&(this.layersData.isInMemoryLayer(t.layerId)||(t.layerId=this.layersData.activeLayerId))}async cancelAttachmentChanges(){return this.engine.commandBinder.issueCommand(new pe.Ze)}getCustomTagOrder(){const e=this.orderedListData.getOrderedList(de.q);return e?e.entries.map((e=>e.id)):[]}async saveTags(){this.engine.commandBinder.issueCommand(new m.VQ({dataTypes:[c.g.MATTERTAGS]}))}openAnnotation(e,t,i=!1){const n=this.annotationsViewData.getCapabilities(e);t?(n.dock||i)&&this.engine.commandBinder.issueCommand(new A.bd(e,I.J.TAG,i)):(n.preview||i)&&this.engine.commandBinder.issueCommand(new A.oM(e,I.J.TAG,i))}async selectPin(e,t=!1){const i=t&&this.activated&&this.appData.application===T.Mx.WORKSHOP;t?this.engine.broadcast(new Ae.dJ(e,Ie.V.DOCKED)):this.engine.broadcast(new Ae.dJ(e,Ie.V.OPEN)),await this.engine.commandBinder.issueCommand(new Y.Ar(e,S.Er.MATTERTAG,i))}dockObjectTag(e){const t=this.viewData.getTagView(e);this.engine.commandBinder.issueCommand(new A.bd(e,I.J.OBJECT)),this.viewData.setOpenTagView(t),this.selectPin(e,!0),this.toolsData.toolCollapsed&&this.engine.commandBinder.issueCommand(new ie.Fg(!1))}async openTag(e,t,i,n){const s=this.viewData,a=s.getTagView(e);if(a){const{openTagView:r,tagsMode:d}=this.viewData,{commandBinder:l}=this.engine,{dockedAnnotation:h,selectedAnnotation:c}=this.annotationsViewData;i&&d===M.U.REORDERING&&s.setTagsMode(M.U.DEFAULT),i&&this.toolsData.toolCollapsed&&this.activated&&l.issueCommand(new ie.Fg(!1));const m=(null==r?void 0:r.id)===e;if(m&&this.activated===i)return void this.log.debug("Tag is already open and "+(i?"docked":"undocked"));if(i!==!!h){const t=this.annotationsViewData.getCapabilities(e);i?t.dock&&!this.activated&&await this.engine.commandBinder.issueCommand(new ie.z2(ee.w1.TAGS,!0)):h&&await this.engine.commandBinder.issueCommand(new A.Aj(h.id,h.annotationType))}if(!m&&this.opening!==e){this.opening=e,l.issueCommand(new se.rE),c&&c.id!==e&&await this.engine.commandBinder.issueCommand(new A.Aj(c.id,c.annotationType)),s.setOpenTagView(a);const i=s.getCapabilities(e);null!==t&&i.focus&&!n&&await this.engine.commandBinder.issueCommand(new p.OR({pinPosition:a,transition:t})).then((()=>{this.engine.broadcast(new Ae.QY(a.id))})),this.engine.commandBinder.issueCommand(new R.IL(a.id,o.SF.MATTERTAG)),setTimeout((()=>{this.opening=null}),0)}}else this.log.debug("Cannot open a non-existent tag")}isTagDocked(){const{dockedAnnotation:e}=this.annotationsViewData;return(null==e?void 0:e.annotationType)===I.J.TAG}getDockedTag(){const{dockedAnnotation:e}=this.annotationsViewData;return e&&e.annotationType===I.J.TAG?this.viewData.getTagView(e.id):null}getSelectedTag(){const{billboardAnnotation:e,billboardSelected:t}=this.annotationsViewData;return e&&t&&e.annotationType===I.J.TAG||(null==e?void 0:e.annotationType)===I.J.OBJECT?this.viewData.getTagView(e.id):null}trackChanges(e,t,i){const s=this.tagsData.getTag(e),{position:a,color:o,description:r,label:d,stemHeight:l,stemVisible:h,enabled:c,keywords:m}=t;if(!s&&a)return void this.engine.broadcast(new G(e,a,a.distanceTo(this.cameraData.pose.position)));if(void 0!==c&&s.enabled!==c&&this.engine.broadcast(new W(e,j.ENABLED,c)),o){const t=new n.Color(o.r,o.g,o.b).getHexString();s.color.getHexString()!==t&&this.engine.broadcast(new W(e,j.DISC_COLOR,`#${t}`))}if(void 0!==l&&s.stemHeight!==l&&this.engine.broadcast(new W(e,j.STEM_LENGTH,l)),void 0!==h&&s.stemVisible!==h&&this.engine.broadcast(new W(e,j.STEM_VISIBLE,h)),void 0!==d&&s.label!==d&&(this.engine.broadcast(new W(e,j.TITLE,d.length)),this.engine.broadcast(new _(e,d.length))),void 0!==r&&s.description!==r){this.engine.broadcast(new W(e,j.DESCRIPTION,r.length));const t=this.descriptionParser.parse(r,this.layersData.getNonworkshopViewId());this.engine.broadcast(new $(e,r.length,t));const i=v.$.getNumLinks(t);v.$.getNumLinks(s.parsedDescription)!==i&&this.engine.broadcast(new W(e,j.LINKS,i))}if(i){const t=i?i.src:"",n=i?(0,f.F5)(i.mediaType):b.z.none;s.mediaSrc===t&&s.mediaType===n||(this.engine.broadcast(new W(e,j.MEDIA,n)),this.engine.broadcast(new K(e,n,t)))}const u=s.keywords.every((e=>m&&m.includes(e)));if((null==m?void 0:m.length)!==s.keywords.length||!u){const t=(null==m?void 0:m.length)||0;this.engine.broadcast(new W(e,j.KEYWORDS,t))}}}const ke=Se},79232:(e,t,i)=>{"use strict";i.d(t,{F:()=>a});var n=i(75287),s=i(39880);class a extends n.T{constructor(e){super(),this.id=(0,s.O1)(11),e&&Object.assign(this,e)}}},33824:(e,t,i)=>{"use strict";i.d(t,{B:()=>s,p:()=>a});var n=i(19663);class s extends n.m{constructor(e){super(),this.id="REGISTER_DELETED_OBJECT_TYPE_COMMAND",this.payload=e}}class a extends n.m{constructor(e){super(),this.id="RESTORE_DELETED_OBJECT_COMMAND",this.payload={id:e}}}},70903:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});class n{constructor(e){this.comparer=e||this.defaultComparer,this.poolArray=[]}add(e){const t=this.createObjectDescriptor(e);return t.object=e,t.inUse=!0,this.addObjectDescriptorToPool(t),t}get(e){for(const t of this.poolArray)if(!t.inUse&&this.comparer(t,e))return t.inUse=!0,t;return null}free(e){for(const t of this.poolArray)if(t.object===e)return t.inUse=!1,!0;return!1}all(){return this.poolArray}remove(e){const t=this.poolArray.findIndex((t=>t.object===e));return-1!==t&&(this.poolArray.splice(t,1),!0)}defaultComparer(e,t){return!0}createObjectDescriptor(e){return{object:e,inUse:!1}}addObjectDescriptorToPool(e){this.poolArray.push(e)}}},77597:(e,t,i)=>{"use strict";i.d(t,{f:()=>l});var n=i(81396);const s={extensions:{derivatives:!0},defines:{RING_COUNT:0,USE_TEXTURE:!1},uniforms:{discRadius:{value:.2},discNormal:{value:new n.Vector3(0,0,1)},ringRadii:{value:[]},ringColors:{value:[]},opacity:{value:1},texture:{value:null}},vertexShader:i(29535),fragmentShader:i(37198),side:n.FrontSide,transparent:!0};var a=i(93377);const o=new n.Color,r=[{outerRadius:1,innerRadius:.75,color:16777215,opacity:1}];class d extends a.b{constructor(e=r){super(Object.assign(Object.assign({},s),{defines:Object.assign({},s.defines),uniforms:n.UniformsUtils.clone(s.uniforms)})),this.setRings(e),Object.defineProperty(this,"opacity",{set(e){this.uniforms.opacity.value=e},get(){return this.uniforms.opacity.value}})}setDiscNormal(e){this.uniforms.discNormal.value.copy(e)}setDiscRadius(e){this.uniforms.discRadius.value=e}setRings(e){e=e||[],this.defines.RING_COUNT!==e.length&&(this.defines.RING_COUNT=e.length,this.needsUpdate=!0),this.uniforms.ringRadii.value=e.map((({innerRadius:e,outerRadius:t})=>new n.Vector2(e||-1,t))),this.uniforms.ringColors.value=e.map((({color:e,opacity:t})=>(o.set(e),new n.Vector4(o.r,o.g,o.b,t))))}setTexture(e){this.defines.USE_TEXTURE!==!!e&&(this.defines.USE_TEXTURE=!!e,this.needsUpdate=!0),this.uniforms.texture.value=e}getTexture(){return this.uniforms.texture.value}}class l extends n.Mesh{constructor(e){super(new n.SphereGeometry(Math.sqrt(2),8,6),new d),e&&this.configure(e)}configure(e){const{radius:t,normal:i,rings:n,texture:s,opacity:a}=e,{material:o}=this;void 0!==t&&(this.scale.setScalar(t),o.setDiscRadius(t)),void 0!==i&&o.setDiscNormal(i),void 0!==n&&o.setRings(n),void 0!==s&&o.setTexture(s),void 0!==a&&(o.opacity=a)}dispose(){var e;null===(e=this.material.getTexture())||void 0===e||e.dispose(),this.geometry.dispose()}}},62118:e=>{e.exports="precision highp float;precision highp int;varying vec2 vUv;uniform sampler2D tMask;uniform sampler2D tPinHole;uniform vec3 pinColor;uniform float opacity;void main(){vec4 maskColor=texture2D(tMask,vUv);vec4 pinHoleColor=vec4(texture2D(tPinHole,vec2(vUv.x,vUv.y-0.11)).xyz,1.);float redness=maskColor.r-maskColor.b;vec4 mixedPinColor=mix(vec4(pinColor,1.),pinHoleColor,redness);mixedPinColor.a=min(mixedPinColor.a,maskColor.a)*opacity;gl_FragColor=mixedPinColor;}"},77256:e=>{e.exports="precision highp float;precision highp int;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;attribute vec3 position;attribute vec2 uv;varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}"},45405:e=>{e.exports="precision highp float;precision highp int;uniform samplerCube tMap;varying vec3 vUvw;void main(){vec4 color=textureCube(tMap,vec3(-vUvw.x,vUvw.yz));gl_FragColor=vec4(color.rgb,1.);}"},29837:e=>{e.exports="precision highp float;precision highp int;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;attribute vec3 position;varying vec3 vUvw;void main(){vUvw=position;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}"},8346:e=>{e.exports="precision highp float;precision highp int;varying vec2 vUv;uniform float progress;uniform float opacity;uniform sampler2D tNoHover;uniform sampler2D tHover;uniform sampler2D tPortal;void main(){vec4 noHoverColor=texture2D(tNoHover,vUv);vec4 hoverColor=texture2D(tHover,vUv);vec4 portalColor=texture2D(tPortal,vUv);float xToCtr=2.*vUv.x-1.;float yToCtr=2.*vUv.y-1.;float withinRadius=step(xToCtr*xToCtr+yToCtr*yToCtr,0.9);vec4 mixedPortalColor=mix(hoverColor,portalColor,withinRadius);mixedPortalColor=mix(mixedPortalColor,hoverColor,hoverColor.a);mixedPortalColor=mix(noHoverColor,mixedPortalColor,progress);mixedPortalColor.a=min(mixedPortalColor.a,opacity);gl_FragColor=mixedPortalColor;}"},35490:e=>{e.exports="precision highp float;precision highp int;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;attribute vec3 position;attribute vec2 uv;varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}"},37198:e=>{e.exports="precision highp float;precision highp int;uniform mat4 viewMatrix;uniform vec3 cameraPosition;uniform float opacity;uniform float discRadius;uniform vec3 discNormal;varying vec3 vFragWorldPos;varying vec3 vCenterWorldPos;\n#ifdef USE_TEXTURE\nuniform sampler2D texture;\n#else\nuniform vec2 ringRadii[RING_COUNT];uniform vec4 ringColors[RING_COUNT];\n#endif\nfloat rayDistToPlane(vec3 rayOrigin,vec3 rayDir,vec3 planeOrigin,vec3 planeNormal){float planeConstant=-dot(planeOrigin,planeNormal);float denom=dot(planeNormal,rayDir);return denom==0.?-1e9:-(dot(rayOrigin,planeNormal)+planeConstant)/denom;}vec4 getColorAtRay(vec3 rayOrigin,vec3 rayDir){vec4 color=vec4(0.);float intersectDist=rayDistToPlane(rayOrigin,rayDir,vCenterWorldPos,discNormal);vec3 intersect=rayOrigin+rayDir*intersectDist;\n#ifdef USE_TEXTURE\nif(intersectDist>0.){vec3 stableDir=abs(discNormal.y)>0.8?normalize((vCenterWorldPos-rayOrigin)*vec3(1.,0.,1.))*sign(discNormal.y):vec3(0.,1.,0.);vec3 xAxis=normalize(cross(stableDir,discNormal));vec3 yAxis=normalize(cross(discNormal,xAxis));intersect-=vCenterWorldPos;vec2 uv=vec2(dot(xAxis,intersect),dot(yAxis,intersect))/discRadius/2.+0.5;if(clamp(uv,vec2(0.),vec2(1.))==uv){color=texture2D(texture,uv);}}\n#else\nfloat fragRadius=intersectDist>0.?distance(intersect,vCenterWorldPos):1e9;if(fragRadius<=discRadius*2.){for(int i=0;i<RING_COUNT;i++){vec2 radii=ringRadii[i]*discRadius;vec4 ringColor=ringColors[i];float ringDist=min(fragRadius-radii[0],radii[1]-fragRadius);\n#if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\nfloat delta=length(vec2(dFdx(fragRadius),dFdy(fragRadius)))*0.70710678;ringColor.a*=smoothstep(-delta,delta,ringDist);\n#else\nringColor.a*=step(0.,ringDist);\n#endif\ncolor=vec4(color.rgb,1.)*color.a+ringColor*(1.-color.a);}}\n#endif\nreturn color;}void main(){vec3 rayDir=normalize(vFragWorldPos-cameraPosition);gl_FragColor=getColorAtRay(cameraPosition,rayDir);gl_FragColor.a*=opacity;if(gl_FragColor.a==0.){discard;}}"},29535:e=>{e.exports="precision highp float;precision highp int;uniform mat4 modelMatrix;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;uniform mat4 viewMatrix;uniform mat3 normalMatrix;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;varying vec3 vCenterWorldPos;varying vec3 vFragWorldPos;void main(){vCenterWorldPos=(modelMatrix*vec4(0.,0.,0.,1.)).xyz;vFragWorldPos=(modelMatrix*vec4(position,1.)).xyz;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}"},44602:e=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"FileAttachments"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"fileAttachmentsByModelId"},arguments:[{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"results"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"FileAttachmentDetails"},directives:[]}]}}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteFileAttachment"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteFileAttachment"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],directives:[]}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"FileAttachmentDetails"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"FileAttachment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"created"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"filename"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"validUntil"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"bytes"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mimeType"},arguments:[],directives:[]},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ImageFileAttachment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"imageWidth"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"imageHeight"},arguments:[],directives:[]}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UploadFileAttachmentToModel"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"organizationId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"contents"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"FileUpload"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"filename"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"uploadFileAttachmentToModel"},arguments:[{kind:"Argument",name:{kind:"Name",value:"organizationId"},value:{kind:"Variable",name:{kind:"Name",value:"organizationId"}}},{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}},{kind:"Argument",name:{kind:"Name",value:"contents"},value:{kind:"Variable",name:{kind:"Name",value:"contents"}}},{kind:"Argument",name:{kind:"Name",value:"filename"},value:{kind:"Variable",name:{kind:"Name",value:"filename"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"FileAttachmentDetails"},directives:[]}]}}]}}],loc:{start:0,end:757}};t.loc.source={body:"# read all attachments for the specified model\nquery FileAttachments($modelId: ID!) {\n fileAttachmentsByModelId(modelId: $modelId) {\n results { ...FileAttachmentDetails }\n }\n}\n\nmutation DeleteFileAttachment($id: ID!) {\n deleteFileAttachment(id: $id)\n}\n\nfragment FileAttachmentDetails on FileAttachment {\n id\n created\n filename\n url\n validUntil\n bytes\n mimeType\n ...on ImageFileAttachment {\n imageWidth\n imageHeight\n }\n}\n\nmutation UploadFileAttachmentToModel($organizationId: ID!, $modelId: ID!, $contents: FileUpload!, $filename: String!) {\n uploadFileAttachmentToModel(organizationId: $organizationId, modelId: $modelId,\n contents: $contents, filename: $filename) {\n ...FileAttachmentDetails\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,t){if("FragmentSpread"===e.kind)t.add(e.name.value);else if("VariableDefinition"===e.kind){var n=e.type;"NamedType"===n.kind&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,t)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,t)})),e.definitions&&e.definitions.forEach((function(e){i(e,t)}))}var n={};function s(e,t){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==t)return n}}function a(e,t){var i={kind:e.kind,definitions:[s(e,t)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var a=n[t]||new Set,o=new Set,r=new Set;for(a.forEach((function(e){r.add(e)}));r.size>0;){var d=r;r=new Set,d.forEach((function(e){o.has(e)||(o.add(e),(n[e]||new Set).forEach((function(e){r.add(e)})))}))}return o.forEach((function(t){var n=s(e,t);n&&i.definitions.push(n)})),i}t.definitions.forEach((function(e){if(e.name){var t=new Set;i(e,t),n[e.name.value]=t}})),e.exports=t,e.exports.FileAttachments=a(t,"FileAttachments"),e.exports.DeleteFileAttachment=a(t,"DeleteFileAttachment"),e.exports.FileAttachmentDetails=a(t,"FileAttachmentDetails"),e.exports.UploadFileAttachmentToModel=a(t,"UploadFileAttachmentToModel")},69665:e=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetObjectAnnotations"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"inferenceEvents"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"minConfidence"}},type:{kind:"NamedType",name:{kind:"Name",value:"Float"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ids"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"includeDisabled"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"includeLayers"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"model"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"objectAnnotations"},arguments:[{kind:"Argument",name:{kind:"Name",value:"inferenceEvents"},value:{kind:"Variable",name:{kind:"Name",value:"inferenceEvents"}}},{kind:"Argument",name:{kind:"Name",value:"minimumConfidenceOverride"},value:{kind:"Variable",name:{kind:"Name",value:"minConfidence"}}},{kind:"Argument",name:{kind:"Name",value:"ids"},value:{kind:"Variable",name:{kind:"Name",value:"ids"}}},{kind:"Argument",name:{kind:"Name",value:"includeDisabled"},value:{kind:"Variable",name:{kind:"Name",value:"includeDisabled"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ObjectAnnotationInfo"},directives:[]}]}}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddObjectAnnotation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"objectAnnotation"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ObjectAnnotationDetails"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"includeLayers"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"addObjectAnnotation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}},{kind:"Argument",name:{kind:"Name",value:"objectAnnotation"},value:{kind:"Variable",name:{kind:"Name",value:"objectAnnotation"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ObjectAnnotationInfo"},directives:[]}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"PatchObjectAnnotation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ObjectAnnotationPatch"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"includeLayers"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"patchObjectAnnotation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}},{kind:"Argument",name:{kind:"Name",value:"objectAnnotationId"},value:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationId"}}},{kind:"Argument",name:{kind:"Name",value:"patch"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ObjectAnnotationInfo"},directives:[]}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SetBulkObjectAnnotationsEnabled"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationIds"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"setEnabled"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"includeLayers"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"setBulkObjectAnnotationsEnabled"},arguments:[{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}},{kind:"Argument",name:{kind:"Name",value:"objectAnnotationIds"},value:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationIds"}}},{kind:"Argument",name:{kind:"Name",value:"setEnabled"},value:{kind:"Variable",name:{kind:"Name",value:"setEnabled"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"ObjectAnnotationInfo"},directives:[]}]}}]}},{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteObjectAnnotation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"modelId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteObjectAnnotation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"modelId"},value:{kind:"Variable",name:{kind:"Name",value:"modelId"}}},{kind:"Argument",name:{kind:"Name",value:"objectAnnotationId"},value:{kind:"Variable",name:{kind:"Name",value:"objectAnnotationId"}}}],directives:[]}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"ObjectAnnotationInfo"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ObjectAnnotation"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"created"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"modified"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"model"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"floor"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"room"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"layer"},arguments:[],directives:[{kind:"Directive",name:{kind:"Name",value:"include"},arguments:[{kind:"Argument",name:{kind:"Name",value:"if"},value:{kind:"Variable",name:{kind:"Name",value:"includeLayers"}}}]}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"enabled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"label"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"confidence"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"panos"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"region"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VectorRegion"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"anchorPosition"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"x"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"y"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"z"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"stemNormal"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"x"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"y"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"z"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"stemLength"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"tag"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"keywords"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"classification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"label"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"defaultKeywords"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:2011}};t.loc.source={body:"# Object Tag Suggestions\n# Reference: https://matterport-confluence.atlassian.net/wiki/spaces/PP/pages/2678521926/Datafication+Object+Detection+Schema+Proposal\n\nquery GetObjectAnnotations($modelId: ID!, $inferenceEvents: [ID!], $minConfidence: Float, $ids: [ID!], $includeDisabled: Boolean, $includeLayers: Boolean!) {\n model(id: $modelId) {\n objectAnnotations(inferenceEvents: $inferenceEvents, minimumConfidenceOverride: $minConfidence, ids: $ids, includeDisabled: $includeDisabled) {\n ...ObjectAnnotationInfo\n }\n }\n}\n\nmutation AddObjectAnnotation($modelId: ID!, $objectAnnotation: ObjectAnnotationDetails!, $includeLayers: Boolean!) {\n addObjectAnnotation(modelId: $modelId, objectAnnotation: $objectAnnotation) {\n ...ObjectAnnotationInfo\n }\n}\n\n# Update a single object annotation\nmutation PatchObjectAnnotation($modelId: ID!, $objectAnnotationId: ID!, $data: ObjectAnnotationPatch!, $includeLayers: Boolean!) {\n patchObjectAnnotation(modelId: $modelId, , objectAnnotationId: $objectAnnotationId, patch: $data) {\n ...ObjectAnnotationInfo\n }\n}\n\nmutation SetBulkObjectAnnotationsEnabled($modelId: ID! $objectAnnotationIds:[ID!]!, $setEnabled: Boolean!, $includeLayers: Boolean!) {\n setBulkObjectAnnotationsEnabled(modelId: $modelId, objectAnnotationIds: $objectAnnotationIds, setEnabled: $setEnabled) {\n ...ObjectAnnotationInfo\n }\n}\n\nmutation DeleteObjectAnnotation($modelId: ID!, $objectAnnotationId: ID!) {\n deleteObjectAnnotation(modelId: $modelId, objectAnnotationId: $objectAnnotationId)\n}\n\nfragment ObjectAnnotationInfo on ObjectAnnotation {\n id\n created\n modified\n model {\n id\n }\n floor {\n id\n }\n room {\n id\n }\n layer @include(if: $includeLayers) { id } \n enabled\n label\n confidence\n panos {\n id\n }\n region {\n ... on VectorRegion {\n anchorPosition {\n x, y, z\n }\n stemNormal {\n x, y, z\n }\n stemLength\n }\n }\n tag {\n id\n }\n keywords\n classification {\n id,\n label,\n defaultKeywords\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,t){if("FragmentSpread"===e.kind)t.add(e.name.value);else if("VariableDefinition"===e.kind){var n=e.type;"NamedType"===n.kind&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,t)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,t)})),e.definitions&&e.definitions.forEach((function(e){i(e,t)}))}var n={};function s(e,t){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==t)return n}}function a(e,t){var i={kind:e.kind,definitions:[s(e,t)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var a=n[t]||new Set,o=new Set,r=new Set;for(a.forEach((function(e){r.add(e)}));r.size>0;){var d=r;r=new Set,d.forEach((function(e){o.has(e)||(o.add(e),(n[e]||new Set).forEach((function(e){r.add(e)})))}))}return o.forEach((function(t){var n=s(e,t);n&&i.definitions.push(n)})),i}t.definitions.forEach((function(e){if(e.name){var t=new Set;i(e,t),n[e.name.value]=t}})),e.exports=t,e.exports.GetObjectAnnotations=a(t,"GetObjectAnnotations"),e.exports.AddObjectAnnotation=a(t,"AddObjectAnnotation"),e.exports.PatchObjectAnnotation=a(t,"PatchObjectAnnotation"),e.exports.SetBulkObjectAnnotationsEnabled=a(t,"SetBulkObjectAnnotationsEnabled"),e.exports.DeleteObjectAnnotation=a(t,"DeleteObjectAnnotation"),e.exports.ObjectAnnotationInfo=a(t,"ObjectAnnotationInfo")}}]);