@esri/solutions-components 0.3.6 → 0.3.7

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/dist/cjs/buffer-tools_6.cjs.entry.js +8 -5
  2. package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
  3. package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
  4. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  5. package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
  6. package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
  7. package/dist/cjs/layer-table.cjs.entry.js +3 -3
  8. package/dist/cjs/map-card.cjs.entry.js +1 -1
  9. package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
  10. package/dist/cjs/public-notification.cjs.entry.js +16 -10
  11. package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
  12. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  13. package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
  14. package/dist/collection/components/buffer-tools/buffer-tools.js +2 -2
  15. package/dist/collection/components/map-draw-tools/map-draw-tools.js +2 -1
  16. package/dist/collection/components/public-notification/public-notification.js +14 -8
  17. package/dist/collection/components/refine-selection/refine-selection.js +4 -2
  18. package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
  19. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
  20. package/dist/collection/demos/new-public-notification.html +2 -1
  21. package/dist/collection/utils/interfaces.js +1 -1
  22. package/dist/collection/utils/interfaces.ts +2 -2
  23. package/dist/components/interfaces3.js +1 -1
  24. package/dist/components/map-draw-tools2.js +2 -1
  25. package/dist/components/public-notification.js +14 -8
  26. package/dist/components/refine-selection-tools2.js +4 -2
  27. package/dist/components/refine-selection2.js +4 -2
  28. package/dist/esm/buffer-tools_6.entry.js +8 -5
  29. package/dist/esm/calcite-combobox_3.entry.js +2 -2
  30. package/dist/esm/calcite-input-message_5.entry.js +6 -4
  31. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  32. package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
  33. package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
  34. package/dist/esm/layer-table.entry.js +3 -3
  35. package/dist/esm/map-card.entry.js +1 -1
  36. package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
  37. package/dist/esm/public-notification.entry.js +16 -10
  38. package/dist/esm/solution-configuration.entry.js +2 -2
  39. package/dist/esm/solution-contents_3.entry.js +2 -2
  40. package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
  41. package/dist/solutions-components/demos/new-public-notification.html +2 -1
  42. package/dist/solutions-components/p-05e64bd1.js +498 -2
  43. package/dist/solutions-components/p-08a95b33.entry.js +138 -0
  44. package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
  45. package/dist/solutions-components/p-0ef91144.entry.js +913 -0
  46. package/dist/solutions-components/p-0f523243.entry.js +1916 -0
  47. package/dist/solutions-components/p-11b9510e.entry.js +173 -0
  48. package/dist/solutions-components/p-1b875d94.entry.js +58 -0
  49. package/dist/solutions-components/p-1c567f3a.js +23 -16
  50. package/dist/solutions-components/p-1c883db9.entry.js +43 -0
  51. package/dist/solutions-components/p-1f225056.js +322 -0
  52. package/dist/solutions-components/p-1f499e67.entry.js +72 -0
  53. package/dist/solutions-components/p-20d3d758.entry.js +881 -0
  54. package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
  55. package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
  56. package/dist/solutions-components/p-2447798c.entry.js +155 -0
  57. package/dist/solutions-components/p-2525e691.entry.js +432 -0
  58. package/dist/solutions-components/p-2561f5b5.js +4092 -0
  59. package/dist/solutions-components/p-29f887c0.entry.js +234 -0
  60. package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
  61. package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
  62. package/dist/solutions-components/p-2e9ed892.js +46 -1
  63. package/dist/solutions-components/p-316f56db.js +219 -2
  64. package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
  65. package/dist/solutions-components/p-356f8b54.entry.js +138 -0
  66. package/dist/solutions-components/p-359c58de.entry.js +172 -0
  67. package/dist/solutions-components/p-37336c0d.entry.js +116 -0
  68. package/dist/solutions-components/p-374a5031.js +105 -2
  69. package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
  70. package/dist/solutions-components/p-3b010ce1.js +17 -1
  71. package/dist/solutions-components/p-4307dacd.js +194 -1
  72. package/dist/solutions-components/p-44da2507.js +405 -14
  73. package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
  74. package/dist/solutions-components/p-4894bbeb.js +53 -2
  75. package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
  76. package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
  77. package/dist/solutions-components/p-4e32bf8c.js +482 -1
  78. package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
  79. package/dist/solutions-components/p-508317b3.js +13 -2
  80. package/dist/solutions-components/p-54697d58.entry.js +198 -0
  81. package/dist/solutions-components/p-55c79103.entry.js +311 -0
  82. package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
  83. package/dist/solutions-components/p-59b48fde.entry.js +443 -0
  84. package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
  85. package/dist/solutions-components/p-621d0534.entry.js +123 -0
  86. package/dist/solutions-components/p-63f6e8f1.js +14 -1
  87. package/dist/solutions-components/p-66aeec57.entry.js +61 -0
  88. package/dist/solutions-components/p-69834f46.entry.js +618 -0
  89. package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
  90. package/dist/solutions-components/p-6e0da576.js +13 -1
  91. package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
  92. package/dist/solutions-components/p-6fe17794.js +9 -1
  93. package/dist/solutions-components/p-7024cb16.entry.js +72 -0
  94. package/dist/solutions-components/p-70535506.entry.js +226 -0
  95. package/dist/solutions-components/p-708a63a8.js +12 -1
  96. package/dist/solutions-components/p-729708a3.js +14 -1
  97. package/dist/solutions-components/p-73e23995.js +6 -1
  98. package/dist/solutions-components/p-74b29d75.entry.js +231 -0
  99. package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
  100. package/dist/solutions-components/p-77182c3a.js +3015 -1
  101. package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
  102. package/dist/solutions-components/p-79709c19.js +60 -3
  103. package/dist/solutions-components/p-7a46ef97.js +181 -2
  104. package/dist/solutions-components/p-7be159e6.entry.js +175 -0
  105. package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
  106. package/dist/solutions-components/p-7daea1df.js +41 -1
  107. package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
  108. package/dist/solutions-components/p-7fb45059.entry.js +43 -0
  109. package/dist/solutions-components/p-815533de.js +306 -3
  110. package/dist/solutions-components/p-816622ca.entry.js +248 -0
  111. package/dist/solutions-components/p-83166522.js +205 -2
  112. package/dist/solutions-components/p-83bd1991.entry.js +36 -0
  113. package/dist/solutions-components/p-856464d7.entry.js +572 -0
  114. package/dist/solutions-components/p-8c349bad.entry.js +347 -0
  115. package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
  116. package/dist/solutions-components/p-904c185a.entry.js +228 -0
  117. package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
  118. package/dist/solutions-components/p-9371145a.entry.js +477 -0
  119. package/dist/solutions-components/p-93d3119d.js +1948 -1
  120. package/dist/solutions-components/p-95ec8062.entry.js +173 -0
  121. package/dist/solutions-components/p-991ee695.js +109 -1
  122. package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
  123. package/dist/solutions-components/p-9a9955db.js +41 -1
  124. package/dist/solutions-components/p-9c1ebc90.js +35 -16
  125. package/dist/solutions-components/p-9eba5c66.js +399 -3
  126. package/dist/solutions-components/p-a033a507.entry.js +252 -0
  127. package/dist/solutions-components/p-a3773415.entry.js +1132 -0
  128. package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
  129. package/dist/solutions-components/p-a5b1ab03.js +33 -3
  130. package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
  131. package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
  132. package/dist/solutions-components/p-a8005026.entry.js +565 -0
  133. package/dist/solutions-components/p-a80b3880.js +14 -1
  134. package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
  135. package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
  136. package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
  137. package/dist/solutions-components/p-ae1fd76b.js +11 -1
  138. package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
  139. package/dist/solutions-components/p-b359dc78.js +41 -1
  140. package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
  141. package/dist/solutions-components/p-b75cc407.entry.js +145 -0
  142. package/dist/solutions-components/p-b911cb75.entry.js +71 -0
  143. package/dist/solutions-components/p-b965e177.entry.js +335 -0
  144. package/dist/solutions-components/p-b978636e.js +14 -1
  145. package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
  146. package/dist/solutions-components/p-bd67334c.js +122 -2
  147. package/dist/solutions-components/p-bde20dba.entry.js +212 -0
  148. package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
  149. package/dist/solutions-components/p-c023e6a1.js +2028 -2
  150. package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
  151. package/dist/solutions-components/p-c579ed60.entry.js +447 -0
  152. package/dist/solutions-components/p-c92bc231.js +101 -2
  153. package/dist/solutions-components/p-cc815aca.js +839 -16
  154. package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
  155. package/dist/solutions-components/p-cdc46c0c.js +1751 -2
  156. package/dist/solutions-components/p-d12e6992.entry.js +118 -0
  157. package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
  158. package/dist/solutions-components/p-d48a24e6.js +754 -2
  159. package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
  160. package/dist/solutions-components/p-dbc9a5a8.js +80 -0
  161. package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
  162. package/dist/solutions-components/p-de39206f.entry.js +113 -0
  163. package/dist/solutions-components/p-de5416e8.js +28 -1
  164. package/dist/solutions-components/p-df420d54.entry.js +213 -0
  165. package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
  166. package/dist/solutions-components/p-e4845fec.entry.js +152 -0
  167. package/dist/solutions-components/p-e611d8c8.js +28 -1
  168. package/dist/solutions-components/p-e947d3b0.js +5 -1
  169. package/dist/solutions-components/p-ea534300.js +41 -2
  170. package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
  171. package/dist/solutions-components/p-ed36c637.entry.js +85 -0
  172. package/dist/solutions-components/p-f0add71c.js +74 -0
  173. package/dist/solutions-components/p-f42e014b.js +171 -2
  174. package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
  175. package/dist/solutions-components/p-fc884dd6.js +28 -16
  176. package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
  177. package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
  178. package/dist/solutions-components/solutions-components.esm.js +20 -1
  179. package/dist/solutions-components/utils/interfaces.ts +2 -2
  180. package/dist/types/components/buffer-tools/buffer-tools.d.ts +2 -2
  181. package/dist/types/components/public-notification/public-notification.d.ts +9 -1
  182. package/dist/types/components.d.ts +2 -2
  183. package/package.json +1 -1
  184. package/dist/solutions-components/p-021432b8.entry.js +0 -12
  185. package/dist/solutions-components/p-03440b1e.entry.js +0 -11
  186. package/dist/solutions-components/p-0512635b.entry.js +0 -6
  187. package/dist/solutions-components/p-086ef115.entry.js +0 -29
  188. package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
  189. package/dist/solutions-components/p-0c088725.entry.js +0 -6
  190. package/dist/solutions-components/p-0f820c08.entry.js +0 -6
  191. package/dist/solutions-components/p-164780a0.entry.js +0 -6
  192. package/dist/solutions-components/p-179a68a0.entry.js +0 -6
  193. package/dist/solutions-components/p-184b5005.entry.js +0 -11
  194. package/dist/solutions-components/p-1d082fee.entry.js +0 -11
  195. package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
  196. package/dist/solutions-components/p-20a58e62.entry.js +0 -17
  197. package/dist/solutions-components/p-20b2458c.entry.js +0 -11
  198. package/dist/solutions-components/p-245d47c1.entry.js +0 -6
  199. package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
  200. package/dist/solutions-components/p-2cc72806.entry.js +0 -23
  201. package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
  202. package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
  203. package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
  204. package/dist/solutions-components/p-3109d940.entry.js +0 -6
  205. package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
  206. package/dist/solutions-components/p-3649acb3.entry.js +0 -18
  207. package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
  208. package/dist/solutions-components/p-3fa9b3c8.js +0 -36
  209. package/dist/solutions-components/p-40c41709.entry.js +0 -6
  210. package/dist/solutions-components/p-40e963c7.entry.js +0 -11
  211. package/dist/solutions-components/p-40f480da.entry.js +0 -11
  212. package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
  213. package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
  214. package/dist/solutions-components/p-506e4d78.entry.js +0 -6
  215. package/dist/solutions-components/p-576fdcab.entry.js +0 -6
  216. package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
  217. package/dist/solutions-components/p-65e177f1.entry.js +0 -6
  218. package/dist/solutions-components/p-67d710c2.entry.js +0 -6
  219. package/dist/solutions-components/p-7268b445.entry.js +0 -11
  220. package/dist/solutions-components/p-75ea4667.entry.js +0 -6
  221. package/dist/solutions-components/p-778c0a36.entry.js +0 -17
  222. package/dist/solutions-components/p-7a22509b.entry.js +0 -12
  223. package/dist/solutions-components/p-7bff51db.entry.js +0 -6
  224. package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
  225. package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
  226. package/dist/solutions-components/p-8060fb94.entry.js +0 -6
  227. package/dist/solutions-components/p-80a1b305.entry.js +0 -6
  228. package/dist/solutions-components/p-81eae877.entry.js +0 -12
  229. package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
  230. package/dist/solutions-components/p-851e04ae.entry.js +0 -6
  231. package/dist/solutions-components/p-9106950a.entry.js +0 -11
  232. package/dist/solutions-components/p-979804a4.entry.js +0 -11
  233. package/dist/solutions-components/p-9862baa8.entry.js +0 -11
  234. package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
  235. package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
  236. package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
  237. package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
  238. package/dist/solutions-components/p-a33c044e.entry.js +0 -6
  239. package/dist/solutions-components/p-a516c658.entry.js +0 -6
  240. package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
  241. package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
  242. package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
  243. package/dist/solutions-components/p-ad469b92.entry.js +0 -11
  244. package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
  245. package/dist/solutions-components/p-addc1156.entry.js +0 -11
  246. package/dist/solutions-components/p-ae846934.entry.js +0 -11
  247. package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
  248. package/dist/solutions-components/p-b4e476b7.js +0 -257
  249. package/dist/solutions-components/p-b668daf8.js +0 -21
  250. package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
  251. package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
  252. package/dist/solutions-components/p-be41429f.js +0 -21
  253. package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
  254. package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
  255. package/dist/solutions-components/p-c4afae53.entry.js +0 -12
  256. package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
  257. package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
  258. package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
  259. package/dist/solutions-components/p-d09a168c.entry.js +0 -6
  260. package/dist/solutions-components/p-d377f913.entry.js +0 -11
  261. package/dist/solutions-components/p-d4cefead.entry.js +0 -37
  262. package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
  263. package/dist/solutions-components/p-d8968487.entry.js +0 -11
  264. package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
  265. package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
  266. package/dist/solutions-components/p-ec27e493.entry.js +0 -11
  267. package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
  268. package/dist/solutions-components/p-ef21e195.entry.js +0 -23
  269. package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
  270. package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
  271. package/dist/solutions-components/p-f847291f.entry.js +0 -6
  272. package/dist/solutions-components/p-f90fd262.entry.js +0 -11
  273. package/dist/solutions-components/p-fc973005.entry.js +0 -6
  274. package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -0,0 +1,1916 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './p-c023e6a1.js';
7
+ import { l as loadModules } from './p-1c567f3a.js';
8
+ import { g as getLocaleComponentStrings } from './p-44da2507.js';
9
+ import { b as getElementDir, g as getElementProp, t as toAriaBoolean, i as isPrimaryPointerButton, h as intersects } from './p-83166522.js';
10
+ import { c as connectLabel, d as disconnectLabel } from './p-bd67334c.js';
11
+ import { a as afterConnectDefaultValueSet, c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from './p-316f56db.js';
12
+ import { u as updateHostInteraction } from './p-7daea1df.js';
13
+ import { g as guid } from './p-a80b3880.js';
14
+ import { d as decimalPlaces, c as clamp } from './p-63f6e8f1.js';
15
+ import { i as isActivationKey } from './p-73e23995.js';
16
+ import { n as numberStringFormatter, c as connectLocalized, d as disconnectLocalized } from './p-9eba5c66.js';
17
+ import { s as state } from './p-9c1ebc90.js';
18
+ import { h as ESelectionType, g as ERefineMode, f as ESelectionMode } from './p-dbc9a5a8.js';
19
+ import { a as getMapLayerView, f as queryFeaturesByGeometry, h as highlightFeatures } from './p-1f225056.js';
20
+ import './p-3b010ce1.js';
21
+ import './p-729708a3.js';
22
+ import './p-9a9955db.js';
23
+ import './p-4307dacd.js';
24
+
25
+ const bufferToolsCss = ":host{display:block}.c-container{display:inline-flex}.flex-1{flex:\"1\"}.padding-end-1{-webkit-padding-end:1rem;padding-inline-end:1rem}";
26
+
27
+ const BufferTools = class {
28
+ constructor(hostRef) {
29
+ registerInstance(this, hostRef);
30
+ this.bufferComplete = createEvent(this, "bufferComplete", 7);
31
+ this.distanceChanged = createEvent(this, "distanceChanged", 7);
32
+ this.unitChanged = createEvent(this, "unitChanged", 7);
33
+ this.appearance = "text";
34
+ this.distance = 0;
35
+ this.geometries = [];
36
+ this.sliderMax = 100;
37
+ this.sliderMin = 0;
38
+ this.sliderTicks = 10;
39
+ this.unionResults = true;
40
+ this.unit = "meters";
41
+ this._translations = undefined;
42
+ }
43
+ //--------------------------------------------------------------------------
44
+ //
45
+ // Watch handlers
46
+ //
47
+ //--------------------------------------------------------------------------
48
+ /**
49
+ * Called each time the geometries prop is changed.
50
+ * Buffer each of the geometries.
51
+ *
52
+ */
53
+ geometriesWatchHandler(v, oldV) {
54
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
55
+ this._buffer();
56
+ }
57
+ }
58
+ //--------------------------------------------------------------------------
59
+ //
60
+ // Functions (lifecycle)
61
+ //
62
+ //--------------------------------------------------------------------------
63
+ /**
64
+ * StencilJS: Called once just after the component is first connected to the DOM.
65
+ *
66
+ * @returns Promise when complete
67
+ */
68
+ async componentWillLoad() {
69
+ await this._getTranslations();
70
+ await this._initModules();
71
+ }
72
+ /**
73
+ * Renders the component.
74
+ */
75
+ render() {
76
+ return (h(Host, null, this.appearance === "text" ? this._getTextBoxDisplay() : this._getSliderDisplay()));
77
+ }
78
+ //--------------------------------------------------------------------------
79
+ //
80
+ // Functions (protected)
81
+ //
82
+ //--------------------------------------------------------------------------
83
+ /**
84
+ * Load esri javascript api modules
85
+ *
86
+ * @returns Promise resolving when function is done
87
+ *
88
+ * @protected
89
+ */
90
+ async _initModules() {
91
+ const [geometryEngine] = await loadModules([
92
+ "esri/geometry/geometryEngine"
93
+ ]);
94
+ this._geometryEngine = geometryEngine;
95
+ }
96
+ /**
97
+ * Gets the nodes for each of the possible distance units
98
+ *
99
+ * @returns An array of option nodes
100
+ *
101
+ * @protected
102
+ */
103
+ _getUnits() {
104
+ const units = {
105
+ "feet": this._translations.feet,
106
+ "meters": this._translations.meters,
107
+ "miles": this._translations.miles,
108
+ "kilometers": this._translations.kilometers
109
+ };
110
+ return Object.keys(units).map(u => {
111
+ return (h("calcite-option", { label: units[u], selected: this.unit === u, value: u }));
112
+ });
113
+ }
114
+ /**
115
+ * Store the user defined distance value and create a buffer
116
+ *
117
+ * @param event the event from the calcite input control
118
+ *
119
+ * @protected
120
+ */
121
+ _setDistance(event) {
122
+ this.distanceChanged.emit({
123
+ oldValue: this.distance,
124
+ newValue: event.detail.value
125
+ });
126
+ this.distance = event.detail.value;
127
+ if (this.distance > 0) {
128
+ this._buffer();
129
+ }
130
+ else {
131
+ this.bufferComplete.emit(undefined);
132
+ }
133
+ }
134
+ /**
135
+ * Store the user defined unit value and create a buffer
136
+ *
137
+ * @protected
138
+ */
139
+ _setUnit(unit) {
140
+ this.unitChanged.emit({
141
+ oldValue: this.unit,
142
+ newValue: unit
143
+ });
144
+ this.unit = unit;
145
+ this._buffer();
146
+ }
147
+ /**
148
+ * Create buffer geometry based on the user defined unit and distance
149
+ *
150
+ * @protected
151
+ */
152
+ _buffer() {
153
+ if (this._bufferTimeout) {
154
+ clearTimeout(this._bufferTimeout);
155
+ }
156
+ this._bufferTimeout = setTimeout(() => {
157
+ var _a;
158
+ // needs to be wgs 84 or Web Mercator
159
+ if (((_a = this.geometries) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.unit && this.distance > 0) {
160
+ const buffer = this._geometryEngine.geodesicBuffer(this.geometries, this.distance, this.unit, this.unionResults);
161
+ this.bufferComplete.emit(buffer);
162
+ }
163
+ }, 400);
164
+ }
165
+ /**
166
+ * Render distance and unit as calcite input and select controls
167
+ * This option will be used when the "appearance" prop is set to "text"
168
+ *
169
+ * @returns a node with the supporting controls
170
+ *
171
+ * @protected
172
+ */
173
+ _getTextBoxDisplay() {
174
+ return (h("div", { class: "c-container" }, h("calcite-input", { class: "padding-end-1", "number-button-type": "vertical", onCalciteInputInput: (evt) => this._setDistance(evt), placeholder: "0", type: "number", value: this.distance ? this.distance.toString() : undefined }), h("calcite-select", { class: "flex-1", label: "label", onCalciteSelectChange: () => this._setUnit(this._unitElement.value), ref: (el) => { this._unitElement = el; } }, this._getUnits())));
175
+ }
176
+ /**
177
+ * Render distance control as a slider
178
+ * This option will be used when the "appearance" prop is set to "slider"
179
+ *
180
+ * @returns a node with the supporting control
181
+ *
182
+ * @protected
183
+ */
184
+ _getSliderDisplay() {
185
+ return (h("div", null, h("calcite-slider", { labelHandles: true, max: this.sliderMax, min: this.sliderMin, ticks: this.sliderTicks })));
186
+ }
187
+ /**
188
+ * Fetches the component's translations
189
+ *
190
+ * @returns Promise when complete
191
+ * @protected
192
+ */
193
+ async _getTranslations() {
194
+ const messages = await getLocaleComponentStrings(this.el);
195
+ this._translations = messages[0];
196
+ }
197
+ /** Provides access to protected methods for unit testing.
198
+ *
199
+ * @param methodName Name of protected method to run
200
+ * @param arg1 First argument to forward to method, e.g., for "_setDistance", `CustomEvent`
201
+ * @returns
202
+ */
203
+ _testAccess(methodName, arg1) {
204
+ switch (methodName) {
205
+ case "_setUnit":
206
+ return this._setUnit(arg1);
207
+ case "_setDistance":
208
+ return this._setDistance(arg1);
209
+ }
210
+ return null;
211
+ }
212
+ get el() { return getElement(this); }
213
+ static get watchers() { return {
214
+ "geometries": ["geometriesWatchHandler"]
215
+ }; }
216
+ };
217
+ BufferTools.style = bufferToolsCss;
218
+
219
+ const radioGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:flex;background-color:var(--calcite-ui-foreground-1);inline-size:-moz-fit-content;inline-size:fit-content;outline:1px solid var(--calcite-ui-border-input);outline-offset:-1px}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([layout=vertical]){flex-direction:column;align-items:flex-start;align-self:flex-start}:host([width=full]){inline-size:100%;min-inline-size:-moz-fit-content;min-inline-size:fit-content}:host([width=full]) ::slotted(calcite-radio-group-item){flex:1 1 auto}:host([width=full][layout=vertical]) ::slotted(calcite-radio-group-item){justify-content:flex-start}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
220
+
221
+ const RadioGroup = class {
222
+ constructor(hostRef) {
223
+ registerInstance(this, hostRef);
224
+ this.calciteRadioGroupChange = createEvent(this, "calciteRadioGroupChange", 6);
225
+ //--------------------------------------------------------------------------
226
+ //
227
+ // Properties
228
+ //
229
+ //--------------------------------------------------------------------------
230
+ /** Specifies the appearance style of the component. */
231
+ this.appearance = "solid";
232
+ /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
233
+ this.disabled = false;
234
+ /**
235
+ * When `true`, the component must have a value in order for the form to submit.
236
+ *
237
+ * @internal
238
+ */
239
+ this.required = false;
240
+ /** Defines the layout of the component. */
241
+ this.layout = "horizontal";
242
+ /** Specifies the size of the component. */
243
+ this.scale = "m";
244
+ /** The component's `selectedItem` value. */
245
+ this.value = null;
246
+ /** Specifies the width of the component. */
247
+ this.width = "auto";
248
+ //--------------------------------------------------------------------------
249
+ //
250
+ // Event Listeners
251
+ //
252
+ //--------------------------------------------------------------------------
253
+ this.handleClick = (event) => {
254
+ if (event.target.localName === "calcite-radio-group-item") {
255
+ this.selectItem(event.target, true);
256
+ }
257
+ };
258
+ }
259
+ valueHandler(value) {
260
+ const items = this.getItems();
261
+ items.forEach((item) => (item.checked = item.value === value));
262
+ }
263
+ handleSelectedItemChange(newItem, oldItem) {
264
+ this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value;
265
+ if (newItem === oldItem) {
266
+ return;
267
+ }
268
+ const items = this.getItems();
269
+ const match = Array.from(items)
270
+ .filter((item) => item === newItem)
271
+ .pop();
272
+ if (match) {
273
+ this.selectItem(match);
274
+ }
275
+ else if (items[0]) {
276
+ items[0].tabIndex = 0;
277
+ }
278
+ }
279
+ //--------------------------------------------------------------------------
280
+ //
281
+ // Lifecycle
282
+ //
283
+ //--------------------------------------------------------------------------
284
+ componentWillLoad() {
285
+ const items = this.getItems();
286
+ const lastChecked = Array.from(items)
287
+ .filter((item) => item.checked)
288
+ .pop();
289
+ if (lastChecked) {
290
+ this.selectItem(lastChecked);
291
+ }
292
+ else if (items[0]) {
293
+ items[0].tabIndex = 0;
294
+ }
295
+ }
296
+ componentDidLoad() {
297
+ afterConnectDefaultValueSet(this, this.value);
298
+ }
299
+ connectedCallback() {
300
+ connectLabel(this);
301
+ connectForm(this);
302
+ }
303
+ disconnectedCallback() {
304
+ disconnectLabel(this);
305
+ disconnectForm(this);
306
+ }
307
+ componentDidRender() {
308
+ updateHostInteraction(this);
309
+ }
310
+ render() {
311
+ return (h(Host, { onClick: this.handleClick, role: "radiogroup" }, h("slot", null), h(HiddenFormInputSlot, { component: this })));
312
+ }
313
+ handleSelected(event) {
314
+ event.preventDefault();
315
+ this.selectItem(event.target);
316
+ event.stopPropagation();
317
+ }
318
+ handleKeyDown(event) {
319
+ const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
320
+ const { key } = event;
321
+ const { el, selectedItem } = this;
322
+ if (keys.indexOf(key) === -1) {
323
+ return;
324
+ }
325
+ let adjustedKey = key;
326
+ if (getElementDir(el) === "rtl") {
327
+ if (key === "ArrowRight") {
328
+ adjustedKey = "ArrowLeft";
329
+ }
330
+ if (key === "ArrowLeft") {
331
+ adjustedKey = "ArrowRight";
332
+ }
333
+ }
334
+ const items = this.getItems();
335
+ let selectedIndex = -1;
336
+ items.forEach((item, index) => {
337
+ if (item === selectedItem) {
338
+ selectedIndex = index;
339
+ }
340
+ });
341
+ switch (adjustedKey) {
342
+ case "ArrowLeft":
343
+ case "ArrowUp":
344
+ event.preventDefault();
345
+ const previous = selectedIndex < 1 ? items.item(items.length - 1) : items.item(selectedIndex - 1);
346
+ this.selectItem(previous, true);
347
+ return;
348
+ case "ArrowRight":
349
+ case "ArrowDown":
350
+ event.preventDefault();
351
+ const next = selectedIndex === -1 ? items.item(1) : items.item(selectedIndex + 1) || items.item(0);
352
+ this.selectItem(next, true);
353
+ return;
354
+ case " ":
355
+ event.preventDefault();
356
+ this.selectItem(event.target, true);
357
+ return;
358
+ default:
359
+ return;
360
+ }
361
+ }
362
+ // --------------------------------------------------------------------------
363
+ //
364
+ // Methods
365
+ //
366
+ // --------------------------------------------------------------------------
367
+ /** Sets focus on the component. */
368
+ async setFocus() {
369
+ var _a;
370
+ (_a = (this.selectedItem || this.getItems()[0])) === null || _a === void 0 ? void 0 : _a.focus();
371
+ }
372
+ //--------------------------------------------------------------------------
373
+ //
374
+ // Private Methods
375
+ //
376
+ //--------------------------------------------------------------------------
377
+ onLabelClick() {
378
+ this.setFocus();
379
+ }
380
+ getItems() {
381
+ return this.el.querySelectorAll("calcite-radio-group-item");
382
+ }
383
+ selectItem(selected, emit = false) {
384
+ if (selected === this.selectedItem) {
385
+ return;
386
+ }
387
+ const items = this.getItems();
388
+ let match = null;
389
+ items.forEach((item) => {
390
+ const matches = item.value === selected.value;
391
+ if ((matches && !item.checked) || (!matches && item.checked)) {
392
+ item.checked = matches;
393
+ }
394
+ item.tabIndex = matches ? 0 : -1;
395
+ if (matches) {
396
+ match = item;
397
+ if (emit) {
398
+ this.calciteRadioGroupChange.emit(match.value);
399
+ }
400
+ }
401
+ });
402
+ this.selectedItem = match;
403
+ if (match) {
404
+ match.focus();
405
+ }
406
+ }
407
+ get el() { return getElement(this); }
408
+ static get watchers() { return {
409
+ "value": ["valueHandler"],
410
+ "selectedItem": ["handleSelectedItemChange"]
411
+ }; }
412
+ };
413
+ RadioGroup.style = radioGroupCss;
414
+
415
+ /*!
416
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
417
+ * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
418
+ * v1.0.0-beta.97
419
+ */
420
+ const SLOTS = {
421
+ input: "input"
422
+ };
423
+ const CSS$1 = {
424
+ radioGroupItemIcon: "radio-group-item-icon"
425
+ };
426
+
427
+ const radioGroupItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:flex;cursor:pointer;align-self:stretch;font-weight:var(--calcite-font-weight-normal);transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-animation-timing) ease-in-out}:host label{pointer-events:none;margin:0.125rem;box-sizing:border-box;display:flex;flex:1 1 0%;align-items:center;color:var(--calcite-ui-text-3);transition:background-color var(--calcite-internal-animation-timing-fast) ease-in-out, border-color var(--calcite-internal-animation-timing-fast) ease-in-out, color var(--calcite-internal-animation-timing-fast) ease-in-out}.label--horizontal{justify-content:center}:host{outline-color:transparent}:host(:focus){outline:2px solid var(--calcite-ui-brand);outline-offset:-1px}.label--scale-s{padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-block:0.125rem}.label--scale-m{padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-block:0.375rem}.label--scale-l{padding-inline:1rem;padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host(:hover) label{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host(:active) label{background-color:var(--calcite-ui-foreground-3)}:host([checked]) label{cursor:default;border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-brand);color:var(--calcite-ui-background)}:host([checked]) .label--outline{border-color:var(--calcite-ui-brand);background-color:var(--calcite-ui-foreground-1);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand);color:var(--calcite-ui-brand)}::slotted(input){display:none}@media (forced-colors: active){:host([checked]) label{background-color:highlight}:host([checked]) .label--outline{outline:2px solid transparent;outline-offset:2px}:host([checked]) label:not([class~=label--outline]) .radio-group-item-icon{color:highlightText}}.radio-group-item-icon{position:relative;margin:0px;display:inline-flex;line-height:inherit}:host([icon-position=start]) .label--scale-s .radio-group-item-icon{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}:host([icon-position=end]) .label--scale-s .radio-group-item-icon{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}:host([icon-position=start]) .label--scale-m .radio-group-item-icon{-webkit-margin-end:0.75rem;margin-inline-end:0.75rem}:host([icon-position=end]) .label--scale-m .radio-group-item-icon{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:0.75rem;margin-inline-start:0.75rem}:host([icon-position=start]) .label--scale-l .radio-group-item-icon{-webkit-margin-end:1rem;margin-inline-end:1rem}:host([icon-position=end]) .label--scale-l .radio-group-item-icon{-webkit-margin-end:unset;margin-inline-end:unset;-webkit-margin-start:1rem;margin-inline-start:1rem}:host([icon-start]) .label--scale-s .radio-group-item-icon{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}:host([icon-end]) .label--scale-s .radio-group-item-icon{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}:host([icon-start]) .label--scale-m .radio-group-item-icon{-webkit-margin-end:0.75rem;margin-inline-end:0.75rem}:host([icon-end]) .label--scale-m .radio-group-item-icon{-webkit-margin-start:0.75rem;margin-inline-start:0.75rem}:host([icon-start]) .label--scale-l .radio-group-item-icon{-webkit-margin-end:1rem;margin-inline-end:1rem}:host([icon-end]) .label--scale-l .radio-group-item-icon{-webkit-margin-start:1rem;margin-inline-start:1rem}";
428
+
429
+ const RadioGroupItem = class {
430
+ constructor(hostRef) {
431
+ registerInstance(this, hostRef);
432
+ this.calciteInternalRadioGroupItemChange = createEvent(this, "calciteInternalRadioGroupItemChange", 6);
433
+ //--------------------------------------------------------------------------
434
+ //
435
+ // Properties
436
+ //
437
+ //--------------------------------------------------------------------------
438
+ /** When `true`, the component is checked. */
439
+ this.checked = false;
440
+ /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
441
+ this.iconFlipRtl = false;
442
+ /**
443
+ * Specifies the placement of the icon.
444
+ *
445
+ * @deprecated Use either `iconStart` or `iconEnd` but do not combine them with `icon` and `iconPosition`.
446
+ */
447
+ this.iconPosition = "start";
448
+ }
449
+ handleCheckedChange() {
450
+ this.calciteInternalRadioGroupItemChange.emit();
451
+ }
452
+ render() {
453
+ const { checked, value } = this;
454
+ const scale = getElementProp(this.el, "scale", "m");
455
+ const appearance = getElementProp(this.el, "appearance", "solid");
456
+ const layout = getElementProp(this.el, "layout", "horizontal");
457
+ const iconStartEl = this.iconStart ? (h("calcite-icon", { class: CSS$1.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconStart, key: "icon-start", scale: "s" })) : null;
458
+ const iconEndEl = this.iconEnd ? (h("calcite-icon", { class: CSS$1.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconEnd, key: "icon-end", scale: "s" })) : null;
459
+ const iconEl = (h("calcite-icon", { class: CSS$1.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.icon, key: "icon", scale: "s" }));
460
+ const iconAtStart = this.icon && this.iconPosition === "start" && !this.iconStart ? iconEl : null;
461
+ const iconAtEnd = this.icon && this.iconPosition === "end" && !this.iconEnd ? iconEl : null;
462
+ return (h(Host, { "aria-checked": toAriaBoolean(checked), "aria-label": value, role: "radio" }, h("label", { class: {
463
+ "label--scale-s": scale === "s",
464
+ "label--scale-m": scale === "m",
465
+ "label--scale-l": scale === "l",
466
+ "label--horizontal": layout === "horizontal",
467
+ "label--outline": appearance === "outline"
468
+ } }, iconAtStart, this.iconStart ? iconStartEl : null, h("slot", null, value), h("slot", { name: SLOTS.input }), iconAtEnd, this.iconEnd ? iconEndEl : null)));
469
+ }
470
+ get el() { return getElement(this); }
471
+ static get watchers() { return {
472
+ "checked": ["handleCheckedChange"]
473
+ }; }
474
+ };
475
+ RadioGroupItem.style = radioGroupItemCss;
476
+
477
+ /*!
478
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
479
+ * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
480
+ * v1.0.0-beta.97
481
+ */
482
+ const CSS = {
483
+ handleLabel: "handle__label",
484
+ handleLabelMinValue: "handle__label--minValue",
485
+ handleLabelValue: "handle__label--value",
486
+ tickMin: "tick__label--min",
487
+ tickMax: "tick__label--max"
488
+ };
489
+
490
+ const sliderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}.scale--s{--calcite-slider-handle-size:10px;--calcite-slider-handle-extension-height:6.5px;--calcite-slider-container-font-size:var(--calcite-font-size--3)}.scale--s .handle__label,.scale--s .tick__label{line-height:.75rem}.scale--m{--calcite-slider-handle-size:14px;--calcite-slider-handle-extension-height:8px;--calcite-slider-container-font-size:var(--calcite-font-size--2)}.scale--m .handle__label,.scale--m .tick__label{line-height:1rem}.scale--l{--calcite-slider-handle-size:16px;--calcite-slider-handle-extension-height:10.5px;--calcite-slider-container-font-size:var(--calcite-font-size--1)}.scale--l .handle__label,.scale--l .tick__label{line-height:1rem}.handle__label,.tick__label{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);font-size:var(--calcite-slider-container-font-size)}:host{display:block}.container{position:relative;display:block;overflow-wrap:normal;word-break:normal;padding-inline:calc(var(--calcite-slider-handle-size) * 0.5);padding-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-inline:0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n )}:host([disabled]) .track__range,:host([disabled]) .tick--active{background-color:var(--calcite-ui-text-3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-6px}.scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-8px}.scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-9px}:host([precise]:not([has-histogram])) .container .thumb--value{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}.thumb-container{position:relative;max-inline-size:100%}.thumb{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:flex;cursor:pointer;flex-direction:column;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}.thumb .handle__label.static,.thumb .handle__label.transformed{position:absolute;inset-block:0px;opacity:0}.thumb .handle__label.hyphen::after{content:\"—\";display:inline-block;inline-size:1em}.thumb .handle__label.hyphen--wrap{display:flex}.thumb .handle{box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;block-size:var(--calcite-slider-handle-size);inline-size:var(--calcite-slider-handle-size);box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease}.thumb .handle-extension{inline-size:0.125rem;block-size:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-ui-text-3)}.thumb:hover .handle{box-shadow:0 0 0 3px var(--calcite-ui-brand) inset}.thumb:hover .handle-extension{background-color:var(--calcite-ui-brand)}.thumb:focus .handle{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}.thumb:focus .handle-extension{background-color:var(--calcite-ui-brand)}.thumb.thumb--minValue{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-2px}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-23px}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-30px}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-32px}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{-webkit-margin-before:0.5em;margin-block-start:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{-webkit-margin-after:0.5em;margin-block-end:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-33px}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-44px}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-49px}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-ui-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise:after,.thumb:focus.thumb--precise:after,.thumb--active.thumb--precise:after{background-color:var(--calcite-ui-brand)}.track{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-ui-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range:after{position:absolute;inline-size:100%;content:\"\";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){.thumb{outline-width:0;outline-offset:0}.handle{outline:2px solid transparent;outline-offset:2px}.thumb:focus .handle,.thumb .handle-extension,.thumb:hover .handle-extension,.thumb:focus .handle-extension,.thumb:active .handle-extension{background-color:canvasText}.track{background-color:canvasText}.track__range{background-color:highlight}}.tick{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);inset-block-start:-2px;pointer-events:none;-webkit-margin-start:calc(-1 * 0.125rem);margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-ui-brand)}.tick__label{pointer-events:none;-webkit-margin-before:0.875rem;margin-block-start:0.875rem;display:flex;justify-content:center}.tick__label--min{transition:opacity var(--calcite-animation-timing)}.tick__label--max{transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.graph{color:var(--calcite-ui-foreground-3);block-size:48px}:host([label-ticks][ticks]) .container{-webkit-padding-after:calc(0.875rem + var(--calcite-slider-container-font-size));padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{-webkit-padding-after:calc(var(--calcite-slider-full-handle-height) + 1em);padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{-webkit-padding-after:calc(var(--calcite-slider-handle-size) * 0.5 + 1em);padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{-webkit-padding-after:var(--calcite-slider-full-handle-height);padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{-webkit-padding-before:var(--calcite-slider-full-handle-height);padding-block-start:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{-webkit-padding-after:var(--calcite-slider-full-handle-height);padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{-webkit-padding-before:calc(var(--calcite-slider-full-handle-height) + 4px);padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{-webkit-padding-before:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{-webkit-padding-after:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
491
+
492
+ function isRange(value) {
493
+ return Array.isArray(value);
494
+ }
495
+ const Slider = class {
496
+ constructor(hostRef) {
497
+ registerInstance(this, hostRef);
498
+ this.calciteSliderInput = createEvent(this, "calciteSliderInput", 6);
499
+ this.calciteSliderChange = createEvent(this, "calciteSliderChange", 6);
500
+ this.calciteSliderUpdate = createEvent(this, "calciteSliderUpdate", 6);
501
+ //--------------------------------------------------------------------------
502
+ //
503
+ // Properties
504
+ //
505
+ //--------------------------------------------------------------------------
506
+ /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
507
+ this.disabled = false;
508
+ /**
509
+ * When `true`, number values are displayed with a group separator corresponding to the language and country format.
510
+ */
511
+ this.groupSeparator = false;
512
+ /** When `true`, indicates a histogram is present. */
513
+ this.hasHistogram = false;
514
+ /** When `true`, displays label handles with their numeric value. */
515
+ this.labelHandles = false;
516
+ /** When `true` and `ticks` is specified, displays label tick marks with their numeric value. */
517
+ this.labelTicks = false;
518
+ /** The component's maximum selectable value. */
519
+ this.max = 100;
520
+ /** The component's minimum selectable value. */
521
+ this.min = 0;
522
+ /**
523
+ * When `true`, the slider will display values from high to low.
524
+ *
525
+ * Note that this value will be ignored if the slider has an associated histogram.
526
+ */
527
+ this.mirrored = false;
528
+ /** When `true`, sets a finer point for handles. */
529
+ this.precise = false;
530
+ /**
531
+ * When `true`, the component must have a value in order for the form to submit.
532
+ */
533
+ this.required = false;
534
+ /** When `true`, enables snap selection in coordination with `step` via a mouse. */
535
+ this.snap = false;
536
+ /** Specifies the interval to move with the up, or down keys. */
537
+ this.step = 1;
538
+ /** The component's value. */
539
+ this.value = 0;
540
+ /**
541
+ * Specifies the size of the component.
542
+ */
543
+ this.scale = "m";
544
+ this.activeProp = "value";
545
+ this.guid = `calcite-slider-${guid()}`;
546
+ this.effectiveLocale = "";
547
+ this.minMaxValueRange = null;
548
+ this.minValueDragRange = null;
549
+ this.maxValueDragRange = null;
550
+ this.tickValues = [];
551
+ this.dragUpdate = (event) => {
552
+ event.preventDefault();
553
+ if (this.dragProp) {
554
+ const value = this.translate(event.clientX || event.pageX);
555
+ if (isRange(this.value) && this.dragProp === "minMaxValue") {
556
+ if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
557
+ const newMinValue = value - this.minValueDragRange;
558
+ const newMaxValue = value + this.maxValueDragRange;
559
+ if (newMaxValue <= this.max &&
560
+ newMinValue >= this.min &&
561
+ newMaxValue - newMinValue === this.minMaxValueRange) {
562
+ this.setValue({
563
+ minValue: this.clamp(newMinValue, "minValue"),
564
+ maxValue: this.clamp(newMaxValue, "maxValue")
565
+ });
566
+ }
567
+ }
568
+ else {
569
+ this.minValueDragRange = value - this.minValue;
570
+ this.maxValueDragRange = this.maxValue - value;
571
+ this.minMaxValueRange = this.maxValue - this.minValue;
572
+ }
573
+ }
574
+ else {
575
+ this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
576
+ }
577
+ }
578
+ };
579
+ this.pointerUpDragEnd = (event) => {
580
+ if (!isPrimaryPointerButton(event)) {
581
+ return;
582
+ }
583
+ this.dragEnd(event);
584
+ };
585
+ this.dragEnd = (event) => {
586
+ this.removeDragListeners();
587
+ this.focusActiveHandle(event.clientX);
588
+ if (this.lastDragPropValue != this[this.dragProp]) {
589
+ this.emitChange();
590
+ }
591
+ this.dragProp = null;
592
+ this.lastDragPropValue = null;
593
+ this.minValueDragRange = null;
594
+ this.maxValueDragRange = null;
595
+ this.minMaxValueRange = null;
596
+ };
597
+ /**
598
+ * Set the reference of the track Element
599
+ *
600
+ * @internal
601
+ * @param node
602
+ */
603
+ this.storeTrackRef = (node) => {
604
+ this.trackEl = node;
605
+ };
606
+ /**
607
+ * Returns a string representing the localized label value based if the groupSeparator prop is parsed.
608
+ *
609
+ * @param value
610
+ */
611
+ this.determineGroupSeparator = (value) => {
612
+ if (typeof value === "number") {
613
+ numberStringFormatter.numberFormatOptions = {
614
+ locale: this.effectiveLocale,
615
+ numberingSystem: this.numberingSystem,
616
+ useGrouping: this.groupSeparator
617
+ };
618
+ return numberStringFormatter.localize(value.toString());
619
+ }
620
+ };
621
+ }
622
+ histogramWatcher(newHistogram) {
623
+ this.hasHistogram = !!newHistogram;
624
+ }
625
+ valueHandler() {
626
+ this.setMinMaxFromValue();
627
+ }
628
+ minMaxValueHandler() {
629
+ this.setValueFromMinMax();
630
+ }
631
+ //--------------------------------------------------------------------------
632
+ //
633
+ // Lifecycle
634
+ //
635
+ //--------------------------------------------------------------------------
636
+ connectedCallback() {
637
+ connectLocalized(this);
638
+ this.setMinMaxFromValue();
639
+ this.setValueFromMinMax();
640
+ connectLabel(this);
641
+ connectForm(this);
642
+ }
643
+ disconnectedCallback() {
644
+ disconnectLabel(this);
645
+ disconnectForm(this);
646
+ disconnectLocalized(this);
647
+ this.removeDragListeners();
648
+ }
649
+ componentWillLoad() {
650
+ this.tickValues = this.generateTickValues();
651
+ if (!isRange(this.value)) {
652
+ this.value = this.clamp(this.value);
653
+ }
654
+ afterConnectDefaultValueSet(this, this.value);
655
+ if (this.snap && !isRange(this.value)) {
656
+ this.value = this.getClosestStep(this.value);
657
+ }
658
+ if (this.histogram) {
659
+ this.hasHistogram = true;
660
+ }
661
+ }
662
+ componentDidRender() {
663
+ if (this.labelHandles) {
664
+ this.adjustHostObscuredHandleLabel("value");
665
+ if (isRange(this.value)) {
666
+ this.adjustHostObscuredHandleLabel("minValue");
667
+ if (!(this.precise && !this.hasHistogram)) {
668
+ this.hyphenateCollidingRangeHandleLabels();
669
+ }
670
+ }
671
+ }
672
+ this.hideObscuredBoundingTickLabels();
673
+ updateHostInteraction(this);
674
+ }
675
+ render() {
676
+ const id = this.el.id || this.guid;
677
+ const maxProp = isRange(this.value) ? "maxValue" : "value";
678
+ const value = isRange(this.value) ? this.maxValue : this.value;
679
+ const displayedValue = this.determineGroupSeparator(value);
680
+ const displayedMinValue = this.determineGroupSeparator(this.minValue);
681
+ const min = this.minValue || this.min;
682
+ const useMinValue = this.shouldUseMinValue();
683
+ const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
684
+ const maxInterval = this.getUnitInterval(value) * 100;
685
+ const mirror = this.shouldMirror();
686
+ const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
687
+ const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
688
+ const valueIsRange = isRange(this.value);
689
+ const handleLabelMinValueClasses = `${CSS.handleLabel} ${CSS.handleLabelMinValue}`;
690
+ const handleLabelValueClasses = `${CSS.handleLabel} ${CSS.handleLabelValue}`;
691
+ const handle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
692
+ thumb: true,
693
+ "thumb--value": true,
694
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
695
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" })));
696
+ const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
697
+ thumb: true,
698
+ "thumb--value": true,
699
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
700
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), h("div", { class: "handle" })));
701
+ const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
702
+ thumb: true,
703
+ "thumb--value": true,
704
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
705
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
706
+ const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
707
+ thumb: true,
708
+ "thumb--value": true,
709
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
710
+ "thumb--precise": true
711
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" }), h("div", { class: "handle-extension" })));
712
+ const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
713
+ thumb: true,
714
+ "thumb--value": true,
715
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
716
+ "thumb--precise": true
717
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" })));
718
+ const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
719
+ thumb: true,
720
+ "thumb--value": true,
721
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
722
+ "thumb--precise": true
723
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), h("div", { class: "handle" }), h("div", { class: "handle-extension" })));
724
+ const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
725
+ thumb: true,
726
+ "thumb--value": true,
727
+ "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
728
+ "thumb--precise": true
729
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), h("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
730
+ const minHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
731
+ thumb: true,
732
+ "thumb--minValue": true,
733
+ "thumb--active": this.dragProp === "minValue"
734
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" })));
735
+ const minLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
736
+ thumb: true,
737
+ "thumb--minValue": true,
738
+ "thumb--active": this.dragProp === "minValue"
739
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue), h("div", { class: "handle" })));
740
+ const minHistogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
741
+ thumb: true,
742
+ "thumb--minValue": true,
743
+ "thumb--active": this.dragProp === "minValue"
744
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
745
+ const minPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
746
+ thumb: true,
747
+ "thumb--minValue": true,
748
+ "thumb--active": this.dragProp === "minValue",
749
+ "thumb--precise": true
750
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" })));
751
+ const minLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": this.minValue, class: {
752
+ thumb: true,
753
+ "thumb--minValue": true,
754
+ "thumb--active": this.dragProp === "minValue",
755
+ "thumb--precise": true
756
+ }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), h("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
757
+ return (h(Host, { id: id, onTouchStart: this.handleTouchStart }, h("div", { class: {
758
+ ["container"]: true,
759
+ ["container--range"]: valueIsRange,
760
+ [`scale--${this.scale}`]: true
761
+ } }, this.renderGraph(), h("div", { class: "track", ref: this.storeTrackRef }, h("div", { class: "track__range", onPointerDown: (event) => this.pointerDownDragStart(event, "minMaxValue"), style: {
762
+ left: `${mirror ? 100 - maxInterval : minInterval}%`,
763
+ right: `${mirror ? minInterval : 100 - maxInterval}%`
764
+ } }), h("div", { class: "ticks" }, this.tickValues.map((tick) => {
765
+ const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
766
+ let activeTicks = tick >= min && tick <= value;
767
+ if (useMinValue) {
768
+ activeTicks = tick >= this.minValue && tick <= this.maxValue;
769
+ }
770
+ return (h("span", { class: {
771
+ tick: true,
772
+ "tick--active": activeTicks
773
+ }, style: {
774
+ left: mirror ? "" : tickOffset,
775
+ right: mirror ? tickOffset : ""
776
+ } }, this.renderTickLabel(tick)));
777
+ }))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
778
+ !this.precise &&
779
+ this.labelHandles &&
780
+ valueIsRange &&
781
+ minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
782
+ !this.precise &&
783
+ this.labelHandles &&
784
+ valueIsRange &&
785
+ minHistogramLabeledHandle, !this.precise && !this.labelHandles && handle, !this.hasHistogram && !this.precise && this.labelHandles && labeledHandle, !this.hasHistogram && this.precise && !this.labelHandles && preciseHandle, this.hasHistogram && this.precise && !this.labelHandles && histogramPreciseHandle, !this.hasHistogram && this.precise && this.labelHandles && labeledPreciseHandle, this.hasHistogram && !this.precise && this.labelHandles && histogramLabeledHandle, this.hasHistogram &&
786
+ this.precise &&
787
+ this.labelHandles &&
788
+ histogramLabeledPreciseHandle, h(HiddenFormInputSlot, { component: this })))));
789
+ }
790
+ renderGraph() {
791
+ return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
792
+ }
793
+ renderTickLabel(tick) {
794
+ const valueIsRange = isRange(this.value);
795
+ const isMinTickLabel = tick === this.min;
796
+ const isMaxTickLabel = tick === this.max;
797
+ const displayedTickValue = this.determineGroupSeparator(tick);
798
+ const tickLabel = (h("span", { class: {
799
+ tick__label: true,
800
+ [CSS.tickMin]: isMinTickLabel,
801
+ [CSS.tickMax]: isMaxTickLabel
802
+ } }, displayedTickValue));
803
+ if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
804
+ return tickLabel;
805
+ }
806
+ if (this.labelTicks &&
807
+ !this.hasHistogram &&
808
+ valueIsRange &&
809
+ !this.precise &&
810
+ !this.labelHandles) {
811
+ return tickLabel;
812
+ }
813
+ if (this.labelTicks &&
814
+ !this.hasHistogram &&
815
+ valueIsRange &&
816
+ !this.precise &&
817
+ this.labelHandles) {
818
+ return tickLabel;
819
+ }
820
+ if (this.labelTicks &&
821
+ !this.hasHistogram &&
822
+ valueIsRange &&
823
+ this.precise &&
824
+ (isMinTickLabel || isMaxTickLabel)) {
825
+ return tickLabel;
826
+ }
827
+ if (this.labelTicks && this.hasHistogram && !this.precise && !this.labelHandles) {
828
+ return tickLabel;
829
+ }
830
+ if (this.labelTicks &&
831
+ this.hasHistogram &&
832
+ this.precise &&
833
+ !this.labelHandles &&
834
+ (isMinTickLabel || isMaxTickLabel)) {
835
+ return tickLabel;
836
+ }
837
+ if (this.labelTicks &&
838
+ this.hasHistogram &&
839
+ !this.precise &&
840
+ this.labelHandles &&
841
+ (isMinTickLabel || isMaxTickLabel)) {
842
+ return tickLabel;
843
+ }
844
+ if (this.labelTicks &&
845
+ this.hasHistogram &&
846
+ this.precise &&
847
+ this.labelHandles &&
848
+ (isMinTickLabel || isMaxTickLabel)) {
849
+ return tickLabel;
850
+ }
851
+ return null;
852
+ }
853
+ //--------------------------------------------------------------------------
854
+ //
855
+ // Event Listeners
856
+ //
857
+ //--------------------------------------------------------------------------
858
+ keyDownHandler(event) {
859
+ const mirror = this.shouldMirror();
860
+ const { activeProp, max, min, pageStep, step } = this;
861
+ const value = this[activeProp];
862
+ const { key } = event;
863
+ if (isActivationKey(key)) {
864
+ event.preventDefault();
865
+ return;
866
+ }
867
+ let adjustment;
868
+ if (key === "ArrowUp" || key === "ArrowRight") {
869
+ const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
870
+ adjustment = value + step * directionFactor;
871
+ }
872
+ else if (key === "ArrowDown" || key === "ArrowLeft") {
873
+ const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
874
+ adjustment = value - step * directionFactor;
875
+ }
876
+ else if (key === "PageUp") {
877
+ if (pageStep) {
878
+ adjustment = value + pageStep;
879
+ }
880
+ }
881
+ else if (key === "PageDown") {
882
+ if (pageStep) {
883
+ adjustment = value - pageStep;
884
+ }
885
+ }
886
+ else if (key === "Home") {
887
+ adjustment = min;
888
+ }
889
+ else if (key === "End") {
890
+ adjustment = max;
891
+ }
892
+ if (isNaN(adjustment)) {
893
+ return;
894
+ }
895
+ event.preventDefault();
896
+ const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
897
+ this.setValue({
898
+ [activeProp]: this.clamp(fixedDecimalAdjustment, activeProp)
899
+ });
900
+ }
901
+ pointerDownHandler(event) {
902
+ if (!isPrimaryPointerButton(event)) {
903
+ return;
904
+ }
905
+ const x = event.clientX || event.pageX;
906
+ const position = this.translate(x);
907
+ let prop = "value";
908
+ if (isRange(this.value)) {
909
+ const inRange = position >= this.minValue && position <= this.maxValue;
910
+ if (inRange && this.lastDragProp === "minMaxValue") {
911
+ prop = "minMaxValue";
912
+ }
913
+ else {
914
+ const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
915
+ prop = closerToMax || position > this.maxValue ? "maxValue" : "minValue";
916
+ }
917
+ }
918
+ this.lastDragPropValue = this[prop];
919
+ this.dragStart(prop);
920
+ const isThumbActive = this.el.shadowRoot.querySelector(".thumb:active");
921
+ if (!isThumbActive) {
922
+ this.setValue({ [prop]: this.clamp(position, prop) });
923
+ }
924
+ this.focusActiveHandle(x);
925
+ }
926
+ handleTouchStart(event) {
927
+ // needed to prevent extra click at the end of a handle drag
928
+ event.preventDefault();
929
+ }
930
+ //--------------------------------------------------------------------------
931
+ //
932
+ // Public Methods
933
+ //
934
+ //--------------------------------------------------------------------------
935
+ /** Sets focus on the component. */
936
+ async setFocus() {
937
+ const handle = this.minHandle ? this.minHandle : this.maxHandle;
938
+ handle === null || handle === void 0 ? void 0 : handle.focus();
939
+ }
940
+ //--------------------------------------------------------------------------
941
+ //
942
+ // Private Methods
943
+ //
944
+ //--------------------------------------------------------------------------
945
+ setValueFromMinMax() {
946
+ const { minValue, maxValue } = this;
947
+ if (typeof minValue === "number" && typeof maxValue === "number") {
948
+ this.value = [minValue, maxValue];
949
+ }
950
+ }
951
+ setMinMaxFromValue() {
952
+ const { value } = this;
953
+ if (isRange(value)) {
954
+ this.minValue = value[0];
955
+ this.maxValue = value[1];
956
+ }
957
+ }
958
+ onLabelClick() {
959
+ this.setFocus();
960
+ }
961
+ shouldMirror() {
962
+ return this.mirrored && !this.hasHistogram;
963
+ }
964
+ shouldUseMinValue() {
965
+ if (!isRange(this.value)) {
966
+ return false;
967
+ }
968
+ return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
969
+ }
970
+ generateTickValues() {
971
+ const ticks = [];
972
+ let current = this.min;
973
+ while (this.ticks && current < this.max + this.ticks) {
974
+ ticks.push(Math.min(current, this.max));
975
+ current = current + this.ticks;
976
+ }
977
+ return ticks;
978
+ }
979
+ pointerDownDragStart(event, prop) {
980
+ if (!isPrimaryPointerButton(event)) {
981
+ return;
982
+ }
983
+ this.dragStart(prop);
984
+ }
985
+ dragStart(prop) {
986
+ this.dragProp = prop;
987
+ this.lastDragProp = this.dragProp;
988
+ this.activeProp = prop;
989
+ document.addEventListener("pointermove", this.dragUpdate);
990
+ document.addEventListener("pointerup", this.pointerUpDragEnd);
991
+ document.addEventListener("pointercancel", this.dragEnd);
992
+ }
993
+ focusActiveHandle(valueX) {
994
+ switch (this.dragProp) {
995
+ case "minValue":
996
+ this.minHandle.focus();
997
+ break;
998
+ case "maxValue":
999
+ case "value":
1000
+ this.maxHandle.focus();
1001
+ break;
1002
+ case "minMaxValue":
1003
+ this.getClosestHandle(valueX).focus();
1004
+ break;
1005
+ }
1006
+ }
1007
+ emitInput() {
1008
+ this.calciteSliderInput.emit();
1009
+ this.calciteSliderUpdate.emit();
1010
+ }
1011
+ emitChange() {
1012
+ this.calciteSliderChange.emit();
1013
+ }
1014
+ removeDragListeners() {
1015
+ document.removeEventListener("pointermove", this.dragUpdate);
1016
+ document.removeEventListener("pointerup", this.pointerUpDragEnd);
1017
+ document.removeEventListener("pointercancel", this.dragEnd);
1018
+ }
1019
+ /**
1020
+ * Set prop value(s) if changed at the component level
1021
+ *
1022
+ * @param {object} values - a set of key/value pairs delineating what properties in the component to update
1023
+ */
1024
+ setValue(values) {
1025
+ let valueChanged;
1026
+ Object.keys(values).forEach((propName) => {
1027
+ const newValue = values[propName];
1028
+ if (!valueChanged) {
1029
+ const oldValue = this[propName];
1030
+ valueChanged = oldValue !== newValue;
1031
+ }
1032
+ this[propName] = newValue;
1033
+ });
1034
+ if (!valueChanged) {
1035
+ return;
1036
+ }
1037
+ const dragging = this.dragProp;
1038
+ if (!dragging) {
1039
+ this.emitChange();
1040
+ }
1041
+ this.emitInput();
1042
+ }
1043
+ /**
1044
+ * If number is outside range, constrain to min or max
1045
+ *
1046
+ * @param value
1047
+ * @param prop
1048
+ * @internal
1049
+ */
1050
+ clamp(value, prop) {
1051
+ value = clamp(value, this.min, this.max);
1052
+ // ensure that maxValue and minValue don't swap positions
1053
+ if (prop === "maxValue") {
1054
+ value = Math.max(value, this.minValue);
1055
+ }
1056
+ if (prop === "minValue") {
1057
+ value = Math.min(value, this.maxValue);
1058
+ }
1059
+ return value;
1060
+ }
1061
+ /**
1062
+ * Translate a pixel position to value along the range
1063
+ *
1064
+ * @param x
1065
+ * @internal
1066
+ */
1067
+ translate(x) {
1068
+ const range = this.max - this.min;
1069
+ const { left, width } = this.trackEl.getBoundingClientRect();
1070
+ const percent = (x - left) / width;
1071
+ const mirror = this.shouldMirror();
1072
+ const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
1073
+ let value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
1074
+ if (this.snap && this.step) {
1075
+ value = this.getClosestStep(value);
1076
+ }
1077
+ return value;
1078
+ }
1079
+ /**
1080
+ * Get closest allowed value along stepped values
1081
+ *
1082
+ * @param num
1083
+ * @internal
1084
+ */
1085
+ getClosestStep(num) {
1086
+ num = Number(this.clamp(num).toFixed(decimalPlaces(this.step)));
1087
+ if (this.step) {
1088
+ const step = Math.round(num / this.step) * this.step;
1089
+ num = Number(this.clamp(step).toFixed(decimalPlaces(this.step)));
1090
+ }
1091
+ return num;
1092
+ }
1093
+ getClosestHandle(valueX) {
1094
+ return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
1095
+ ? this.minHandle
1096
+ : this.maxHandle;
1097
+ }
1098
+ getDistanceX(el, valueX) {
1099
+ return Math.abs(el.getBoundingClientRect().left - valueX);
1100
+ }
1101
+ getFontSizeForElement(element) {
1102
+ return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
1103
+ }
1104
+ /**
1105
+ * Get position of value along range as fractional value
1106
+ *
1107
+ * @param num
1108
+ * @return {number} number in the unit interval [0,1]
1109
+ * @internal
1110
+ */
1111
+ getUnitInterval(num) {
1112
+ num = this.clamp(num);
1113
+ const range = this.max - this.min;
1114
+ return (num - this.min) / range;
1115
+ }
1116
+ adjustHostObscuredHandleLabel(name) {
1117
+ const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
1118
+ const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
1119
+ const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
1120
+ const labelStaticBounds = labelStatic.getBoundingClientRect();
1121
+ const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
1122
+ label.style.transform = `translateX(${labelStaticOffset}px)`;
1123
+ labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
1124
+ }
1125
+ hyphenateCollidingRangeHandleLabels() {
1126
+ const { shadowRoot } = this.el;
1127
+ const mirror = this.shouldMirror();
1128
+ const leftModifier = mirror ? "value" : "minValue";
1129
+ const rightModifier = mirror ? "minValue" : "value";
1130
+ const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
1131
+ const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
1132
+ const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
1133
+ const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
1134
+ const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
1135
+ const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
1136
+ const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
1137
+ const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
1138
+ const labelFontSize = this.getFontSizeForElement(leftValueLabel);
1139
+ const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
1140
+ const hyphenLabel = leftValueLabel;
1141
+ const labelOffset = labelFontSize / 2;
1142
+ if (labelTransformedOverlap > 0) {
1143
+ hyphenLabel.classList.add("hyphen", "hyphen--wrap");
1144
+ if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
1145
+ // Neither handle overlaps the host boundary
1146
+ let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
1147
+ leftValueLabelTranslate =
1148
+ Math.sign(leftValueLabelTranslate) === -1
1149
+ ? Math.abs(leftValueLabelTranslate)
1150
+ : -leftValueLabelTranslate;
1151
+ const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
1152
+ leftValueLabelTranslate -
1153
+ labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
1154
+ leftValueLabelTranslate -
1155
+ labelOffset);
1156
+ let rightValueLabelTranslate = labelTransformedOverlap / 2;
1157
+ const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
1158
+ if (leftValueLabelTransformedHostOffset !== 0) {
1159
+ leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
1160
+ rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
1161
+ }
1162
+ if (rightValueLabelTransformedHostOffset !== 0) {
1163
+ leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
1164
+ rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
1165
+ }
1166
+ leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
1167
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
1168
+ rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
1169
+ rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
1170
+ }
1171
+ else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
1172
+ // labels overlap host boundary on the left side
1173
+ leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
1174
+ rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
1175
+ rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
1176
+ }
1177
+ else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
1178
+ // labels overlap host boundary on the right side
1179
+ let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
1180
+ leftValueLabelTranslate =
1181
+ Math.sign(leftValueLabelTranslate) === -1
1182
+ ? Math.abs(leftValueLabelTranslate)
1183
+ : -leftValueLabelTranslate;
1184
+ leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
1185
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
1186
+ }
1187
+ }
1188
+ else {
1189
+ hyphenLabel.classList.remove("hyphen", "hyphen--wrap");
1190
+ leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
1191
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
1192
+ rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
1193
+ rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
1194
+ }
1195
+ }
1196
+ /**
1197
+ * Hides bounding tick labels that are obscured by either handle.
1198
+ */
1199
+ hideObscuredBoundingTickLabels() {
1200
+ const valueIsRange = isRange(this.value);
1201
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
1202
+ return;
1203
+ }
1204
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
1205
+ return;
1206
+ }
1207
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
1208
+ return;
1209
+ }
1210
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
1211
+ return;
1212
+ }
1213
+ if (!this.hasHistogram && valueIsRange && !this.precise) {
1214
+ return;
1215
+ }
1216
+ if (this.hasHistogram && !this.precise && !this.labelHandles) {
1217
+ return;
1218
+ }
1219
+ const minHandle = this.el.shadowRoot.querySelector(".thumb--minValue");
1220
+ const maxHandle = this.el.shadowRoot.querySelector(".thumb--value");
1221
+ const minTickLabel = this.el.shadowRoot.querySelector(".tick__label--min");
1222
+ const maxTickLabel = this.el.shadowRoot.querySelector(".tick__label--max");
1223
+ if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
1224
+ minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
1225
+ maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
1226
+ }
1227
+ if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
1228
+ minTickLabel.style.opacity =
1229
+ this.isMinTickLabelObscured(minTickLabel, minHandle) ||
1230
+ this.isMinTickLabelObscured(minTickLabel, maxHandle)
1231
+ ? "0"
1232
+ : "1";
1233
+ maxTickLabel.style.opacity =
1234
+ this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
1235
+ (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
1236
+ ? "0"
1237
+ : "1";
1238
+ }
1239
+ }
1240
+ /**
1241
+ * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
1242
+ *
1243
+ * @param leftBounds
1244
+ * @param rightBounds
1245
+ * @internal
1246
+ */
1247
+ getHostOffset(leftBounds, rightBounds) {
1248
+ const hostBounds = this.el.getBoundingClientRect();
1249
+ const buffer = 7;
1250
+ if (leftBounds + buffer < hostBounds.left) {
1251
+ return hostBounds.left - leftBounds - buffer;
1252
+ }
1253
+ if (rightBounds - buffer > hostBounds.right) {
1254
+ return -(rightBounds - hostBounds.right) + buffer;
1255
+ }
1256
+ return 0;
1257
+ }
1258
+ /**
1259
+ * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
1260
+ * a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
1261
+ *
1262
+ * @param leftLabel
1263
+ * @param rightLabel
1264
+ */
1265
+ getRangeLabelOverlap(leftLabel, rightLabel) {
1266
+ const leftLabelBounds = leftLabel.getBoundingClientRect();
1267
+ const rightLabelBounds = rightLabel.getBoundingClientRect();
1268
+ const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
1269
+ const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
1270
+ return Math.max(rangeLabelOverlap, 0);
1271
+ }
1272
+ /**
1273
+ * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
1274
+ *
1275
+ * @param minLabel
1276
+ * @param handle
1277
+ */
1278
+ isMinTickLabelObscured(minLabel, handle) {
1279
+ const minLabelBounds = minLabel.getBoundingClientRect();
1280
+ const handleBounds = handle.getBoundingClientRect();
1281
+ return intersects(minLabelBounds, handleBounds);
1282
+ }
1283
+ /**
1284
+ * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
1285
+ *
1286
+ * @param maxLabel
1287
+ * @param handle
1288
+ */
1289
+ isMaxTickLabelObscured(maxLabel, handle) {
1290
+ const maxLabelBounds = maxLabel.getBoundingClientRect();
1291
+ const handleBounds = handle.getBoundingClientRect();
1292
+ return intersects(maxLabelBounds, handleBounds);
1293
+ }
1294
+ get el() { return getElement(this); }
1295
+ static get watchers() { return {
1296
+ "histogram": ["histogramWatcher"],
1297
+ "value": ["valueHandler"],
1298
+ "minValue": ["minMaxValueHandler"],
1299
+ "maxValue": ["minMaxValueHandler"]
1300
+ }; }
1301
+ };
1302
+ Slider.style = sliderCss;
1303
+
1304
+ const mapDrawToolsCss = ":host{display:block}.border{outline:1px solid var(--calcite-ui-border-input)}";
1305
+
1306
+ const MapDrawTools = class {
1307
+ constructor(hostRef) {
1308
+ registerInstance(this, hostRef);
1309
+ this.sketchGraphicsChange = createEvent(this, "sketchGraphicsChange", 7);
1310
+ this.active = false;
1311
+ this.border = false;
1312
+ this.mapView = undefined;
1313
+ this.pointSymbol = undefined;
1314
+ this.polylineSymbol = undefined;
1315
+ this.polygonSymbol = undefined;
1316
+ this.graphics = [];
1317
+ this._translations = undefined;
1318
+ }
1319
+ //--------------------------------------------------------------------------
1320
+ //
1321
+ // Watch handlers
1322
+ //
1323
+ //--------------------------------------------------------------------------
1324
+ /**
1325
+ * Called each time the graphics prop is changed.
1326
+ *
1327
+ */
1328
+ graphicsWatchHandler(v, oldV) {
1329
+ if (v && v.length > 0 && JSON.stringify(v) !== JSON.stringify(oldV) && this._sketchGraphicsLayer) {
1330
+ this._sketchGraphicsLayer.removeAll();
1331
+ this._sketchGraphicsLayer.addMany(v);
1332
+ }
1333
+ }
1334
+ /**
1335
+ * Called each time the mapView prop is changed.
1336
+ *
1337
+ */
1338
+ mapViewWatchHandler(v, oldV) {
1339
+ if (v && v !== oldV) {
1340
+ this._init();
1341
+ }
1342
+ }
1343
+ //--------------------------------------------------------------------------
1344
+ //
1345
+ // Methods (public)
1346
+ //
1347
+ //--------------------------------------------------------------------------
1348
+ /**
1349
+ * Clears the user drawn graphics
1350
+ *
1351
+ * @returns Promise that resolves when the operation is complete
1352
+ */
1353
+ async clear() {
1354
+ this._clearSketch();
1355
+ }
1356
+ //--------------------------------------------------------------------------
1357
+ //
1358
+ // Functions (lifecycle)
1359
+ //
1360
+ //--------------------------------------------------------------------------
1361
+ /**
1362
+ * StencilJS: Called once just after the component is first connected to the DOM.
1363
+ *
1364
+ * @returns Promise when complete
1365
+ */
1366
+ async componentWillLoad() {
1367
+ await this._getTranslations();
1368
+ await this._initModules();
1369
+ }
1370
+ /**
1371
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
1372
+ *
1373
+ * @returns Promise when complete
1374
+ */
1375
+ componentDidLoad() {
1376
+ this._init();
1377
+ }
1378
+ /**
1379
+ * Renders the component.
1380
+ */
1381
+ render() {
1382
+ const drawClass = this.border ? "border" : "";
1383
+ return (h(Host, null, h("div", { class: drawClass }, h("div", { ref: (el) => { this._sketchElement = el; } }))));
1384
+ }
1385
+ //--------------------------------------------------------------------------
1386
+ //
1387
+ // Functions (protected)
1388
+ //
1389
+ //--------------------------------------------------------------------------
1390
+ /**
1391
+ * Load esri javascript api modules
1392
+ *
1393
+ * @returns Promise resolving when function is done
1394
+ *
1395
+ * @protected
1396
+ */
1397
+ async _initModules() {
1398
+ const [GraphicsLayer, Sketch] = await loadModules([
1399
+ "esri/layers/GraphicsLayer",
1400
+ "esri/widgets/Sketch"
1401
+ ]);
1402
+ this.GraphicsLayer = GraphicsLayer;
1403
+ this.Sketch = Sketch;
1404
+ }
1405
+ /**
1406
+ * Initialize the graphics layer and the tools that support creating new graphics
1407
+ *
1408
+ * @protected
1409
+ */
1410
+ _init() {
1411
+ if (this.mapView && this._sketchElement) {
1412
+ this._initGraphicsLayer();
1413
+ this._initDrawTools();
1414
+ }
1415
+ }
1416
+ /**
1417
+ * Create or find the graphics layer and add any existing graphics
1418
+ *
1419
+ * @protected
1420
+ */
1421
+ _initGraphicsLayer() {
1422
+ const title = this._translations.sketchLayer;
1423
+ const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
1424
+ if (sketchIndex > -1) {
1425
+ this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
1426
+ }
1427
+ else {
1428
+ this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
1429
+ state.managedLayers.push(title);
1430
+ this.mapView.map.layers.add(this._sketchGraphicsLayer);
1431
+ }
1432
+ if (this.graphics && this.graphics.length > 0) {
1433
+ this._sketchGraphicsLayer.addMany(this.graphics);
1434
+ }
1435
+ }
1436
+ /**
1437
+ * Initialize the skecth widget and store the associated symbols for each geometry type
1438
+ *
1439
+ * @protected
1440
+ */
1441
+ _initDrawTools() {
1442
+ this._sketchWidget = new this.Sketch({
1443
+ layer: this._sketchGraphicsLayer,
1444
+ view: this.mapView,
1445
+ container: this._sketchElement,
1446
+ creationMode: "single",
1447
+ defaultCreateOptions: {
1448
+ "mode": "hybrid"
1449
+ }
1450
+ });
1451
+ this.pointSymbol = this._sketchWidget.viewModel.pointSymbol;
1452
+ this.polylineSymbol = this._sketchWidget.viewModel.polylineSymbol;
1453
+ this.polygonSymbol = this._sketchWidget.viewModel.polygonSymbol;
1454
+ this._sketchWidget.visibleElements = {
1455
+ selectionTools: {
1456
+ "lasso-selection": false,
1457
+ "rectangle-selection": false
1458
+ }, createTools: {
1459
+ "circle": false
1460
+ },
1461
+ undoRedoMenu: false
1462
+ };
1463
+ this._sketchWidget.on("update", (evt) => {
1464
+ if (evt.state === "start") {
1465
+ this.graphics = evt.graphics;
1466
+ this.sketchGraphicsChange.emit(this.graphics);
1467
+ }
1468
+ if (evt.state === "active") {
1469
+ clearTimeout(this._selectionTimer);
1470
+ this._selectionTimer = setTimeout(() => {
1471
+ this.graphics = evt.graphics;
1472
+ this.sketchGraphicsChange.emit(this.graphics);
1473
+ }, 500);
1474
+ }
1475
+ });
1476
+ this._sketchWidget.on("delete", () => {
1477
+ this.graphics = [];
1478
+ this.sketchGraphicsChange.emit(this.graphics);
1479
+ });
1480
+ this._sketchWidget.on("undo", (evt) => {
1481
+ this.graphics = evt.graphics;
1482
+ this.sketchGraphicsChange.emit(this.graphics);
1483
+ });
1484
+ this._sketchWidget.on("redo", (evt) => {
1485
+ this.graphics = evt.graphics;
1486
+ this.sketchGraphicsChange.emit(this.graphics);
1487
+ });
1488
+ this._sketchWidget.on("create", (evt) => {
1489
+ if (evt.state === "complete") {
1490
+ this.graphics = [evt.graphic];
1491
+ this.sketchGraphicsChange.emit(this.graphics);
1492
+ }
1493
+ });
1494
+ }
1495
+ /**
1496
+ * Clear any stored graphics and remove all graphics from the graphics layer
1497
+ *
1498
+ * @protected
1499
+ */
1500
+ _clearSketch() {
1501
+ this.graphics = [];
1502
+ this._sketchGraphicsLayer.removeAll();
1503
+ }
1504
+ /**
1505
+ * Fetches the component's translations
1506
+ *
1507
+ * @protected
1508
+ */
1509
+ async _getTranslations() {
1510
+ const translations = await getLocaleComponentStrings(this.el);
1511
+ this._translations = translations[0];
1512
+ }
1513
+ get el() { return getElement(this); }
1514
+ static get watchers() { return {
1515
+ "graphics": ["graphicsWatchHandler"],
1516
+ "mapView": ["mapViewWatchHandler"]
1517
+ }; }
1518
+ };
1519
+ MapDrawTools.style = mapDrawToolsCss;
1520
+
1521
+ const refineSelectionToolsCss = ":host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir=\"rtl\"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-ui-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:\"Avenir Next\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;line-height:1.3em;background-color:var(--calcite-ui-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110,110,110,.3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110,110,110,.3)}";
1522
+
1523
+ const RefineSelectionTools = class {
1524
+ constructor(hostRef) {
1525
+ registerInstance(this, hostRef);
1526
+ this.refineSelectionGraphicsChange = createEvent(this, "refineSelectionGraphicsChange", 7);
1527
+ this.refineSelectionIdsChange = createEvent(this, "refineSelectionIdsChange", 7);
1528
+ /**
1529
+ * {<layer id>: Graphic[]}: Collection of graphics returned from queries to the layer
1530
+ */
1531
+ this._featuresCollection = {};
1532
+ /**
1533
+ * IRefineOperation[]: Array to maintain the possible redo operations
1534
+ */
1535
+ this._redoStack = [];
1536
+ /**
1537
+ * IRefineOperation[]: Array to maintain the possible undo operations
1538
+ */
1539
+ this._undoStack = [];
1540
+ this.active = false;
1541
+ this.border = false;
1542
+ this.enabledLayerIds = [];
1543
+ this.graphics = undefined;
1544
+ this.ids = [];
1545
+ this.layerView = undefined;
1546
+ this.layerViews = [];
1547
+ this.mapView = undefined;
1548
+ this.mode = undefined;
1549
+ this.refineMode = undefined;
1550
+ this.useLayerPicker = true;
1551
+ this._selectEnabled = false;
1552
+ this._selectionMode = undefined;
1553
+ this._translations = undefined;
1554
+ }
1555
+ //--------------------------------------------------------------------------
1556
+ //
1557
+ // Watch handlers
1558
+ //
1559
+ //--------------------------------------------------------------------------
1560
+ /**
1561
+ * Called each time the ids prop is changed.
1562
+ * Highlight the features based on the provided ids
1563
+ */
1564
+ idsWatchHandler(v, oldV) {
1565
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
1566
+ void this._highlightFeatures(v);
1567
+ }
1568
+ }
1569
+ //--------------------------------------------------------------------------
1570
+ //
1571
+ // Methods (public)
1572
+ //
1573
+ //--------------------------------------------------------------------------
1574
+ /**
1575
+ * Reset the ids collection
1576
+ *
1577
+ * @returns Promise when complete
1578
+ */
1579
+ async reset() {
1580
+ this.ids = [];
1581
+ }
1582
+ /**
1583
+ * Clear current highlight handle
1584
+ *
1585
+ * @returns Promise when complete
1586
+ */
1587
+ async clearHighlight() {
1588
+ this._clearHighlight();
1589
+ }
1590
+ //--------------------------------------------------------------------------
1591
+ //
1592
+ // Functions (lifecycle)
1593
+ //
1594
+ //--------------------------------------------------------------------------
1595
+ /**
1596
+ * StencilJS: Called once just after the component is first connected to the DOM.
1597
+ */
1598
+ async componentWillLoad() {
1599
+ await this._getTranslations();
1600
+ await this._initModules();
1601
+ }
1602
+ /**
1603
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
1604
+ */
1605
+ componentDidLoad() {
1606
+ this._init();
1607
+ }
1608
+ /**
1609
+ * StencilJS: Called every time the component is disconnected from the DOM, ie,
1610
+ * it can be dispatched more than once, DO not confuse with a "onDestroy" kind of event.
1611
+ */
1612
+ disconnectedCallback() {
1613
+ this.active = false;
1614
+ }
1615
+ /**
1616
+ * Called every time the component is connected to the DOM.
1617
+ * When the component is first connected, this method is called before componentWillLoad.
1618
+ */
1619
+ connectedCallback() {
1620
+ this.active = true;
1621
+ if (this.ids.length > 0) {
1622
+ this._selectEnabled = true;
1623
+ void this._highlightFeatures(this.ids);
1624
+ }
1625
+ }
1626
+ /**
1627
+ * Renders the component.
1628
+ */
1629
+ render() {
1630
+ const showLayerPickerClass = this.useLayerPicker ? "div-visible" : "div-not-visible";
1631
+ const drawClass = this.border ? " border" : "";
1632
+ const showUndoRedo = this.refineMode === ERefineMode.ALL ? "div-visible" : "div-not-visible";
1633
+ return (h(Host, null, h("div", null, h("map-layer-picker", { class: showLayerPickerClass, enabledLayerIds: this.enabledLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); }, selectedLayerIds: this.layerViews.map(l => l.layer.id), selectionMode: "single" }), h("div", { class: "margin-top-1" + drawClass }, h("div", { class: "esri-sketch esri-widget" }, h("div", { class: "esri-sketch__panel" }, h("div", { class: "esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: !this._selectEnabled, icon: "select", onClick: () => this._setSelectionMode(ESelectionType.POINT), scale: "s", text: this._translations.select })), h("div", { class: "esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: !this._selectEnabled, icon: "line", onClick: () => this._setSelectionMode(ESelectionType.LINE), scale: "s", text: this._translations.selectLine }), h("calcite-action", { disabled: !this._selectEnabled, icon: "polygon", onClick: () => this._setSelectionMode(ESelectionType.POLY), scale: "s", text: this._translations.selectPolygon }), h("calcite-action", { disabled: !this._selectEnabled, icon: "rectangle", onClick: () => this._setSelectionMode(ESelectionType.RECT), scale: "s", text: this._translations.selectRectangle })), h("div", { class: showUndoRedo + " esri-sketch__tool-section esri-sketch__section" }, h("calcite-action", { disabled: this._undoStack.length === 0, icon: "undo", onClick: () => this._undo(), scale: "s", text: this._translations.undo }), h("calcite-action", { disabled: this._redoStack.length === 0, icon: "redo", onClick: () => this._redo(), scale: "s", text: this._translations.redo }))))))));
1634
+ }
1635
+ //--------------------------------------------------------------------------
1636
+ //
1637
+ // Functions (protected)
1638
+ //
1639
+ //--------------------------------------------------------------------------
1640
+ /**
1641
+ * Initialize the graphics layer and skecth view model
1642
+ *
1643
+ * @returns Promise when the operation has completed
1644
+ * @protected
1645
+ */
1646
+ _init() {
1647
+ this._initGraphicsLayer();
1648
+ this._initSketchViewModel();
1649
+ }
1650
+ /**
1651
+ * Load esri javascript api modules
1652
+ *
1653
+ * @returns Promise resolving when function is done
1654
+ *
1655
+ * @protected
1656
+ */
1657
+ async _initModules() {
1658
+ const [GraphicsLayer, SketchViewModel] = await loadModules([
1659
+ "esri/layers/GraphicsLayer",
1660
+ "esri/widgets/Sketch/SketchViewModel"
1661
+ ]);
1662
+ this.GraphicsLayer = GraphicsLayer;
1663
+ this.SketchViewModel = SketchViewModel;
1664
+ }
1665
+ /**
1666
+ * Initialize the skecth view model
1667
+ *
1668
+ * @returns Promise when the operation has completed
1669
+ * @protected
1670
+ */
1671
+ _initSketchViewModel() {
1672
+ this._sketchViewModel = new this.SketchViewModel({
1673
+ layer: this._sketchGraphicsLayer,
1674
+ defaultUpdateOptions: {
1675
+ tool: "reshape",
1676
+ toggleToolOnClick: false
1677
+ },
1678
+ view: this.mapView
1679
+ });
1680
+ this._sketchViewModel.on("create", (event) => {
1681
+ if (event.state === "complete" && this.active) {
1682
+ this._featuresCollection = {};
1683
+ this._sketchGeometry = event.graphic.geometry;
1684
+ void this._selectFeatures(this._sketchGeometry);
1685
+ }
1686
+ });
1687
+ }
1688
+ /**
1689
+ * Clear any skecth graphics
1690
+ *
1691
+ * @returns Promise when the operation has completed
1692
+ * @protected
1693
+ */
1694
+ _clear() {
1695
+ this._sketchGeometry = null;
1696
+ this._sketchViewModel.cancel();
1697
+ this._sketchGraphicsLayer.removeAll();
1698
+ }
1699
+ /**
1700
+ * Initialize the graphics layer
1701
+ *
1702
+ * @returns Promise when the operation has completed
1703
+ * @protected
1704
+ */
1705
+ _initGraphicsLayer() {
1706
+ const title = this._translations.sketchLayer;
1707
+ const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
1708
+ if (sketchIndex > -1) {
1709
+ this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
1710
+ }
1711
+ else {
1712
+ this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
1713
+ state.managedLayers.push(title);
1714
+ this.mapView.map.layers.add(this._sketchGraphicsLayer);
1715
+ }
1716
+ if (this.graphics && this.graphics.length > 0) {
1717
+ this._sketchGraphicsLayer.addMany(this.graphics);
1718
+ }
1719
+ }
1720
+ /**
1721
+ * Clear selection based on map click
1722
+ *
1723
+ * @protected
1724
+ */
1725
+ _initHitTest() {
1726
+ if (this._hitTestHandle) {
1727
+ this._hitTestHandle.remove();
1728
+ }
1729
+ this._hitTestHandle = this.mapView.on("click", (event) => {
1730
+ event.stopPropagation();
1731
+ const opts = {
1732
+ include: this.layerViews.map(lv => lv.layer)
1733
+ };
1734
+ void this.mapView.hitTest(event, opts).then((response) => {
1735
+ let graphics = [];
1736
+ if (response.results.length > 0) {
1737
+ graphics = response.results.reduce((prev, cur) => {
1738
+ const g = cur === null || cur === void 0 ? void 0 : cur.graphic;
1739
+ if (g) {
1740
+ prev.push(g);
1741
+ }
1742
+ return prev;
1743
+ }, []);
1744
+ }
1745
+ this.refineSelectionGraphicsChange.emit(graphics);
1746
+ this._clear();
1747
+ });
1748
+ });
1749
+ }
1750
+ /**
1751
+ * Gets the layer views from the map when the layer selection changes
1752
+ *
1753
+ * @returns Promise resolving when function is done
1754
+ *
1755
+ * @protected
1756
+ */
1757
+ async _layerSelectionChange(evt) {
1758
+ if (Array.isArray(evt.detail) && evt.detail.length > 0) {
1759
+ this._selectEnabled = true;
1760
+ const layerPromises = evt.detail.map(id => {
1761
+ return getMapLayerView(this.mapView, id);
1762
+ });
1763
+ return Promise.all(layerPromises).then((layerViews) => {
1764
+ this.layerViews = layerViews;
1765
+ });
1766
+ }
1767
+ else {
1768
+ this._selectEnabled = false;
1769
+ }
1770
+ }
1771
+ /**
1772
+ * Store the current selection mode
1773
+ *
1774
+ * @protected
1775
+ */
1776
+ _setSelectionMode(mode) {
1777
+ this._selectionMode = mode;
1778
+ if (this._hitTestHandle) {
1779
+ this._hitTestHandle.remove();
1780
+ }
1781
+ switch (this._selectionMode) {
1782
+ case ESelectionType.POINT:
1783
+ this._sketchViewModel.create("point");
1784
+ //this._initHitTest();
1785
+ break;
1786
+ case ESelectionType.LINE:
1787
+ this._sketchViewModel.create("polyline");
1788
+ break;
1789
+ case ESelectionType.POLY:
1790
+ this._sketchViewModel.create("polygon");
1791
+ break;
1792
+ case ESelectionType.RECT:
1793
+ this._sketchViewModel.create("rectangle");
1794
+ break;
1795
+ }
1796
+ }
1797
+ /**
1798
+ * Select features based on the input geometry
1799
+ *
1800
+ * @param geom the geometry used for selection
1801
+ *
1802
+ * @returns Promise resolving when function is done
1803
+ *
1804
+ * @protected
1805
+ */
1806
+ async _selectFeatures(geom) {
1807
+ const queryFeaturePromises = this.layerViews.map(layerView => {
1808
+ this._featuresCollection[layerView.layer.id] = [];
1809
+ return queryFeaturesByGeometry(0, layerView.layer, geom, this._featuresCollection);
1810
+ });
1811
+ return Promise.all(queryFeaturePromises).then(async (response) => {
1812
+ let graphics = [];
1813
+ response.forEach(r => {
1814
+ Object.keys(r).forEach(k => {
1815
+ graphics = graphics.concat(r[k]);
1816
+ });
1817
+ });
1818
+ if (this.refineMode === ERefineMode.SUBSET) {
1819
+ this.refineSelectionGraphicsChange.emit(graphics);
1820
+ }
1821
+ else {
1822
+ const oids = Array.isArray(graphics) ? graphics.map(g => { var _a; return g.attributes[(_a = g === null || g === void 0 ? void 0 : g.layer) === null || _a === void 0 ? void 0 : _a.objectIdField]; }) : [];
1823
+ await this._updateIds(oids, this.mode, this._undoStack, this.mode);
1824
+ }
1825
+ this._clear();
1826
+ });
1827
+ }
1828
+ /**
1829
+ * Highlight any selected features in the map
1830
+ *
1831
+ * @returns Promise resolving when function is done
1832
+ * @protected
1833
+ */
1834
+ async _highlightFeatures(ids, updateExtent = false) {
1835
+ this._clearHighlight();
1836
+ if (ids.length > 0) {
1837
+ state.highlightHandle = await highlightFeatures(ids, this.layerViews[0], this.mapView, updateExtent);
1838
+ }
1839
+ }
1840
+ /**
1841
+ * Clear any highlighted features in the map
1842
+ *
1843
+ * @protected
1844
+ */
1845
+ _clearHighlight() {
1846
+ var _a;
1847
+ (_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
1848
+ }
1849
+ /**
1850
+ * Update the ids for any ADD or REMOVE operation and highlight the features.
1851
+ *
1852
+ * @param oids the ids to add or remove
1853
+ * @param mode ADD or REMOVE this will control if the ids are added or removed
1854
+ * @param operationStack the undo or redo stack to push the operation to
1855
+ * @param operationMode ADD or REMOVE the mode of the individual refine operation
1856
+ *
1857
+ * @returns Promise resolving when function is done
1858
+ *
1859
+ * @protected
1860
+ */
1861
+ async _updateIds(oids, mode, operationStack, operationMode) {
1862
+ console.log("_updateIds");
1863
+ const idUpdates = { addIds: [], removeIds: [] };
1864
+ if (mode === ESelectionMode.ADD) {
1865
+ idUpdates.addIds = oids.filter(id => this.ids.indexOf(id) < 0);
1866
+ this.ids = [...this.ids, ...idUpdates.addIds];
1867
+ operationStack.push({ mode: operationMode, ids: idUpdates.addIds });
1868
+ }
1869
+ else {
1870
+ idUpdates.removeIds = oids.filter(id => this.ids.indexOf(id) > -1);
1871
+ this.ids = this.ids.filter(id => idUpdates.removeIds.indexOf(id) < 0);
1872
+ operationStack.push({ mode: operationMode, ids: idUpdates.removeIds });
1873
+ }
1874
+ await this._highlightFeatures(this.ids).then(() => {
1875
+ this.refineSelectionIdsChange.emit(idUpdates);
1876
+ });
1877
+ }
1878
+ /**
1879
+ * Undo the most current ADD or REMOVE operation
1880
+ *
1881
+ * @returns Promise resolving when function is done
1882
+ *
1883
+ * @protected
1884
+ */
1885
+ _undo() {
1886
+ const undoOp = this._undoStack.pop();
1887
+ void this._updateIds(undoOp.ids, undoOp.mode === ESelectionMode.ADD ? ESelectionMode.REMOVE : ESelectionMode.ADD, this._redoStack, undoOp.mode);
1888
+ }
1889
+ /**
1890
+ * Redo the most current ADD or REMOVE operation
1891
+ *
1892
+ * @returns Promise resolving when function is done
1893
+ *
1894
+ * @protected
1895
+ */
1896
+ _redo() {
1897
+ const redoOp = this._redoStack.pop();
1898
+ void this._updateIds(redoOp.ids, redoOp.mode, this._undoStack, redoOp.mode);
1899
+ }
1900
+ /**
1901
+ * Fetches the component's translations
1902
+ *
1903
+ * @protected
1904
+ */
1905
+ async _getTranslations() {
1906
+ const translations = await getLocaleComponentStrings(this.el);
1907
+ this._translations = translations[0];
1908
+ }
1909
+ get el() { return getElement(this); }
1910
+ static get watchers() { return {
1911
+ "ids": ["idsWatchHandler"]
1912
+ }; }
1913
+ };
1914
+ RefineSelectionTools.style = refineSelectionToolsCss;
1915
+
1916
+ export { BufferTools as buffer_tools, RadioGroup as calcite_radio_group, RadioGroupItem as calcite_radio_group_item, Slider as calcite_slider, MapDrawTools as map_draw_tools, RefineSelectionTools as refine_selection_tools };