@webquark/core 1.0.1 → 1.1.0-dev.1

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 (716) hide show
  1. package/{readme.md → README.md} +14 -1
  2. package/dist/cjs/Leaflet.GoogleMutant-BCs2oiE0.js +769 -0
  3. package/dist/cjs/action.props-Bxf6g2CW.js +35 -0
  4. package/dist/cjs/collection-identity-CV5HLD9Z.js +141 -0
  5. package/dist/cjs/data-table-cell-BAv6IIYx.js +46 -0
  6. package/dist/cjs/{dom-CTqgGpWA.js → dom-Dk77oFF6.js} +15 -6
  7. package/dist/cjs/form-control-validity-D1ukC0_e.js +49 -0
  8. package/dist/cjs/{index-CLlvFbDw.js → index-D5SQkd__.js} +21 -3
  9. package/dist/cjs/index.cjs.js +21 -2
  10. package/dist/cjs/leaflet-maplibre-gl-RCEffFEM.js +434 -0
  11. package/dist/cjs/leaflet-src-B0ls4IKq.js +14522 -0
  12. package/dist/cjs/leaflet-src-BX4jwTf5.js +33 -0
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/map.types-DNrz8rJh.js +24 -0
  15. package/dist/cjs/q-alert.cjs.entry.js +52 -0
  16. package/dist/cjs/q-avatar.cjs.entry.js +101 -0
  17. package/dist/cjs/q-button_2.cjs.entry.js +375 -0
  18. package/dist/cjs/q-card.cjs.entry.js +31 -9
  19. package/dist/cjs/q-carousel.cjs.entry.js +121 -78
  20. package/dist/cjs/q-chip.cjs.entry.js +124 -0
  21. package/dist/cjs/q-conversation-bubble.cjs.entry.js +70 -0
  22. package/dist/cjs/q-data-table.cjs.entry.js +469 -118
  23. package/dist/cjs/q-dialog.cjs.entry.js +136 -22
  24. package/dist/cjs/q-dropdown.cjs.entry.js +318 -64
  25. package/dist/cjs/q-form.cjs.entry.js +509 -0
  26. package/dist/cjs/q-icon.cjs.entry.js +232 -100
  27. package/dist/cjs/q-input_2.cjs.entry.js +363 -0
  28. package/dist/cjs/q-link.cjs.entry.js +80 -0
  29. package/dist/cjs/q-map.cjs.entry.js +3328 -0
  30. package/dist/cjs/q-navbar.cjs.entry.js +194 -0
  31. package/dist/cjs/q-pagination.cjs.entry.js +68 -0
  32. package/dist/cjs/q-panel.cjs.entry.js +67 -0
  33. package/dist/cjs/q-quantity-selector.cjs.entry.js +112 -93
  34. package/dist/cjs/q-radio-group.cjs.entry.js +217 -0
  35. package/dist/cjs/q-reel.cjs.entry.js +86 -33
  36. package/dist/cjs/q-scrollable.cjs.entry.js +449 -0
  37. package/dist/cjs/q-sidepanel.cjs.entry.js +380 -114
  38. package/dist/cjs/q-step-diagram-item.cjs.entry.js +11 -17
  39. package/dist/cjs/q-step-diagram.cjs.entry.js +9 -10
  40. package/dist/cjs/q-syntax-box.cjs.entry.js +326 -173
  41. package/dist/cjs/q-tabs.cjs.entry.js +155 -0
  42. package/dist/cjs/q-textarea.cjs.entry.js +69 -9
  43. package/dist/cjs/q-thumbnail.cjs.entry.js +18 -11
  44. package/dist/cjs/q-toast.cjs.entry.js +400 -0
  45. package/dist/cjs/q-toggle.cjs.entry.js +57 -26
  46. package/dist/cjs/q-toolbar.cjs.entry.js +29 -0
  47. package/dist/cjs/toast-controller-CIXagxbV.js +111 -0
  48. package/dist/cjs/webquark.cjs.js +2 -2
  49. package/dist/collection/collection-manifest.json +37 -21
  50. package/dist/collection/components/actions/action.props.js +130 -0
  51. package/dist/collection/components/{button → actions/button}/button.css +191 -174
  52. package/dist/collection/components/{button → actions/button}/button.js +243 -89
  53. package/dist/collection/components/actions/button/button.types.js +1 -0
  54. package/dist/collection/components/actions/button/button.utils.js +9 -0
  55. package/dist/collection/components/actions/button/button.utils.unit.test.js +44 -0
  56. package/dist/collection/components/actions/chip/chip.css +219 -0
  57. package/dist/collection/components/actions/chip/chip.js +381 -0
  58. package/dist/collection/components/actions/chip/chip.types.js +1 -0
  59. package/dist/collection/components/actions/link/link.css +102 -0
  60. package/dist/collection/components/actions/link/link.js +313 -0
  61. package/dist/collection/components/actions/link/link.types.js +1 -0
  62. package/dist/collection/components/data-display/alert/alert.css +118 -0
  63. package/dist/collection/components/data-display/alert/alert.js +208 -0
  64. package/dist/collection/components/data-display/alert/alert.types.js +1 -0
  65. package/dist/collection/components/data-display/conversation-bubble/conversation-bubble.css +154 -0
  66. package/dist/collection/components/data-display/conversation-bubble/conversation-bubble.js +207 -0
  67. package/dist/collection/components/data-display/conversation-bubble/conversation-bubble.types.js +1 -0
  68. package/dist/collection/components/data-display/data-table/data-table-cell.js +40 -0
  69. package/dist/collection/components/{data-table → data-display/data-table}/data-table.css +158 -21
  70. package/dist/collection/components/data-display/data-table/data-table.js +748 -0
  71. package/dist/collection/components/data-display/data-table/data-table.types.js +1 -0
  72. package/dist/collection/components/data-display/data-table/internals/data-access.js +43 -0
  73. package/dist/collection/components/data-display/data-table/internals/render-row-actions.js +22 -0
  74. package/dist/collection/components/data-display/data-table/internals/render-sort-indicator.js +4 -0
  75. package/dist/collection/components/data-display/data-table/internals/render-table-body.js +47 -0
  76. package/dist/collection/components/data-display/data-table/internals/render-table-head.js +42 -0
  77. package/dist/collection/components/data-display/data-table/internals/render-toolbar.js +6 -0
  78. package/dist/collection/components/data-display/data-table/internals/row-events.js +27 -0
  79. package/dist/collection/components/data-display/data-table/internals/selection.js +31 -0
  80. package/dist/collection/components/data-display/data-table/internals/sort.js +57 -0
  81. package/dist/collection/components/data-display/data-table/internals/table-model.js +84 -0
  82. package/dist/collection/components/data-display/map/internals/base-layer.js +140 -0
  83. package/dist/collection/components/data-display/map/internals/bounds.js +66 -0
  84. package/dist/collection/components/data-display/map/internals/buffered-tile-layer.js +128 -0
  85. package/dist/collection/components/data-display/map/internals/cluster-collision.js +73 -0
  86. package/dist/collection/components/data-display/map/internals/google-maps.js +117 -0
  87. package/dist/collection/components/data-display/map/internals/google-mutant.js +51 -0
  88. package/dist/collection/components/data-display/map/internals/maplibre.js +50 -0
  89. package/dist/collection/components/data-display/map/internals/marker-cluster-index.js +136 -0
  90. package/dist/collection/components/data-display/map/internals/marker-controller.js +403 -0
  91. package/dist/collection/components/data-display/map/internals/marker-presentation.js +217 -0
  92. package/dist/collection/components/data-display/map/internals/marker-visibility.js +158 -0
  93. package/dist/collection/components/data-display/map/internals/markers.js +176 -0
  94. package/dist/collection/components/data-display/map/internals/tile-layer-readiness.js +67 -0
  95. package/dist/collection/components/data-display/map/internals/tile-preload-buffer.js +8 -0
  96. package/dist/collection/components/data-display/map/internals/vector-padding.js +8 -0
  97. package/dist/collection/components/data-display/map/map.css +711 -0
  98. package/dist/collection/components/data-display/map/map.js +1514 -0
  99. package/dist/collection/components/data-display/map/map.types.js +12 -0
  100. package/dist/collection/components/data-display/map/test/map.cmp.test.js +748 -0
  101. package/dist/collection/components/data-display/pagination/pagination.css +81 -0
  102. package/dist/collection/components/data-display/pagination/pagination.js +240 -0
  103. package/dist/collection/components/data-display/pagination/test/pagination.cmp.test.js +57 -0
  104. package/dist/collection/components/data-display/syntax-box/internals/clipboard.js +9 -0
  105. package/dist/collection/components/data-display/syntax-box/internals/editor-key-action.js +14 -0
  106. package/dist/collection/components/data-display/syntax-box/internals/value-sync.js +27 -0
  107. package/dist/collection/components/{syntax-box → data-display/syntax-box}/syntax-box.css +202 -206
  108. package/dist/collection/components/data-display/syntax-box/syntax-box.js +622 -0
  109. package/dist/collection/components/data-display/syntax-box/syntax-box.types.js +1 -0
  110. package/dist/collection/components/data-display/syntax-box/syntax-box.utils.js +1 -0
  111. package/dist/collection/components/indicators/progress/progress.css +223 -0
  112. package/dist/collection/components/indicators/progress/progress.js +275 -0
  113. package/dist/collection/components/indicators/progress/progress.types.js +1 -0
  114. package/dist/collection/components/{step-diagram → indicators/step-diagram}/step-diagram.css +21 -21
  115. package/dist/collection/components/{step-diagram → indicators/step-diagram}/step-diagram.js +42 -12
  116. package/dist/collection/components/indicators/step-diagram/step-diagram.types.js +1 -0
  117. package/dist/collection/components/{step-diagram-item → indicators/step-diagram-item}/step-diagram-item.css +252 -253
  118. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +153 -0
  119. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.types.js +1 -0
  120. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.utils.js +3 -0
  121. package/dist/collection/components/{dropdown → inputs/dropdown}/dropdown.css +344 -292
  122. package/dist/collection/components/inputs/dropdown/dropdown.js +986 -0
  123. package/dist/collection/components/inputs/dropdown/dropdown.types.js +1 -0
  124. package/dist/collection/components/inputs/dropdown/internals/options.js +30 -0
  125. package/dist/collection/components/inputs/dropdown/internals/position.js +35 -0
  126. package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +62 -0
  127. package/dist/collection/components/{input → inputs/input}/input.css +264 -276
  128. package/dist/collection/components/{input → inputs/input}/input.js +242 -83
  129. package/dist/collection/components/inputs/input/input.types.js +1 -0
  130. package/dist/collection/components/inputs/input/input.utils.js +3 -0
  131. package/dist/collection/components/inputs/quantity-selector/internals/number-value.js +64 -0
  132. package/dist/collection/components/{quantity-selector → inputs/quantity-selector}/quantity-selector.css +2 -2
  133. package/dist/collection/components/{quantity-selector → inputs/quantity-selector}/quantity-selector.js +75 -109
  134. package/dist/collection/components/inputs/quantity-selector/quantity-selector.types.js +1 -0
  135. package/dist/collection/components/inputs/radio-group/radio-group.css +177 -0
  136. package/dist/collection/components/inputs/radio-group/radio-group.js +558 -0
  137. package/dist/collection/components/inputs/radio-group/radio-group.types.js +1 -0
  138. package/dist/collection/components/inputs/radio-group/radio-group.utils.js +18 -0
  139. package/dist/collection/components/{textarea → inputs/textarea}/textarea.css +88 -83
  140. package/dist/collection/components/{textarea → inputs/textarea}/textarea.js +162 -18
  141. package/dist/collection/components/inputs/textarea/textarea.types.js +1 -0
  142. package/dist/collection/components/{toggle → inputs/toggle}/toggle.css +220 -212
  143. package/dist/collection/components/{toggle → inputs/toggle}/toggle.js +158 -51
  144. package/dist/collection/components/inputs/toggle/toggle.types.js +1 -0
  145. package/dist/collection/components/inputs/toggle/toggle.utils.js +3 -0
  146. package/dist/collection/components/{card → layout/card}/card.css +93 -96
  147. package/dist/collection/components/{card → layout/card}/card.js +40 -19
  148. package/dist/collection/components/layout/card/card.types.js +1 -0
  149. package/dist/collection/components/layout/card/card.utils.js +15 -0
  150. package/dist/collection/components/{carousel → layout/carousel}/carousel.css +168 -177
  151. package/dist/collection/components/{carousel → layout/carousel}/carousel.js +103 -105
  152. package/dist/collection/components/layout/carousel/carousel.types.js +1 -0
  153. package/dist/collection/components/layout/carousel/carousel.utils.js +1 -0
  154. package/dist/collection/components/layout/carousel/internals/metrics.js +59 -0
  155. package/dist/collection/components/layout/form/form.css +49 -0
  156. package/dist/collection/components/layout/form/form.js +613 -0
  157. package/dist/collection/components/layout/form/form.types.js +1 -0
  158. package/dist/collection/components/layout/form/internals/controls.js +79 -0
  159. package/dist/collection/components/layout/form/internals/enter-behavior.js +36 -0
  160. package/dist/collection/components/layout/form/internals/values.js +176 -0
  161. package/dist/collection/components/layout/form/test/form.cmp.test.js +157 -0
  162. package/dist/collection/components/layout/navbar/navbar.css +465 -0
  163. package/dist/collection/components/layout/navbar/navbar.js +547 -0
  164. package/dist/collection/components/layout/navbar/navbar.types.js +1 -0
  165. package/dist/collection/components/layout/navbar/navbar.utils.js +13 -0
  166. package/dist/collection/components/layout/navbar/test/navbar.cmp.test.js +53 -0
  167. package/dist/collection/components/layout/panel/panel.css +113 -0
  168. package/dist/collection/components/layout/panel/panel.js +265 -0
  169. package/dist/collection/components/layout/panel/panel.types.js +1 -0
  170. package/dist/collection/components/layout/scrollable/internals/metrics.js +61 -0
  171. package/dist/collection/components/layout/scrollable/internals/native-scrollbar.js +41 -0
  172. package/dist/collection/components/{scrollable → layout/scrollable}/scrollable.css +123 -122
  173. package/dist/collection/components/{scrollable → layout/scrollable}/scrollable.js +165 -136
  174. package/dist/collection/components/layout/scrollable/scrollable.types.js +1 -0
  175. package/dist/collection/components/layout/sidepanel/internals/drawer.js +60 -0
  176. package/dist/collection/components/layout/sidepanel/internals/groups.js +56 -0
  177. package/dist/collection/components/layout/sidepanel/internals/nav-items.js +26 -0
  178. package/dist/collection/components/layout/sidepanel/sidepanel.css +881 -0
  179. package/dist/collection/components/layout/sidepanel/sidepanel.js +813 -0
  180. package/dist/collection/components/layout/sidepanel/sidepanel.types.js +1 -0
  181. package/dist/collection/components/layout/sidepanel/sidepanel.utils.js +17 -0
  182. package/dist/collection/components/layout/tabs/tabs.css +248 -0
  183. package/dist/collection/components/layout/tabs/tabs.js +322 -0
  184. package/dist/collection/components/layout/tabs/tabs.types.js +1 -0
  185. package/dist/collection/components/layout/tabs/tabs.utils.js +31 -0
  186. package/dist/collection/components/layout/tabs/test/tabs.cmp.test.js +165 -0
  187. package/dist/collection/components/layout/toolbar/toolbar.css +145 -0
  188. package/dist/collection/components/layout/toolbar/toolbar.js +173 -0
  189. package/dist/collection/components/layout/toolbar/toolbar.types.js +1 -0
  190. package/dist/collection/components/media/avatar/avatar.css +71 -0
  191. package/dist/collection/components/media/avatar/avatar.js +302 -0
  192. package/dist/collection/components/media/avatar/avatar.types.js +1 -0
  193. package/dist/collection/components/{icon → media/icon}/icon.css +42 -39
  194. package/dist/collection/components/media/icon/icon.js +388 -0
  195. package/dist/collection/components/media/icon/icon.types.js +1 -0
  196. package/dist/collection/components/media/icon/internals/constants.js +3 -0
  197. package/dist/collection/components/media/icon/internals/fetch-icon.js +18 -0
  198. package/dist/collection/components/media/icon/internals/sanitize-svg.js +63 -0
  199. package/dist/collection/components/media/icon/internals/size.js +12 -0
  200. package/dist/collection/components/media/icon/internals/url.js +48 -0
  201. package/dist/collection/components/{reel → media/reel}/reel.css +193 -185
  202. package/dist/collection/components/{reel → media/reel}/reel.js +99 -34
  203. package/dist/collection/components/media/reel/reel.types.js +1 -0
  204. package/dist/collection/components/{thumbnail → media/thumbnail}/thumbnail.css +111 -109
  205. package/dist/collection/components/{thumbnail → media/thumbnail}/thumbnail.js +32 -19
  206. package/dist/collection/components/media/thumbnail/thumbnail.types.js +1 -0
  207. package/dist/collection/components/{dialog → overlays/dialog}/dialog.css +248 -240
  208. package/dist/collection/components/{dialog → overlays/dialog}/dialog.js +190 -58
  209. package/dist/collection/components/overlays/dialog/dialog.types.js +1 -0
  210. package/dist/collection/components/overlays/dialog/internals/backdrop.js +9 -0
  211. package/dist/collection/components/overlays/dialog/internals/lifecycle.js +53 -0
  212. package/dist/collection/components/overlays/toast/internals/icons.js +25 -0
  213. package/dist/collection/components/overlays/toast/internals/queue.js +64 -0
  214. package/dist/collection/components/overlays/toast/internals/timers.js +75 -0
  215. package/dist/collection/components/overlays/toast/test/toast.cmp.test.js +38 -0
  216. package/dist/collection/components/overlays/toast/test/toast.unit.test.js +104 -0
  217. package/dist/collection/components/overlays/toast/toast-controller.js +105 -0
  218. package/dist/collection/components/overlays/toast/toast.css +141 -0
  219. package/dist/collection/components/overlays/toast/toast.js +556 -0
  220. package/dist/collection/components/overlays/toast/toast.types.js +1 -0
  221. package/dist/collection/components/overlays/tooltip/internals/aria.js +27 -0
  222. package/dist/collection/components/overlays/tooltip/internals/positioning.js +69 -0
  223. package/dist/collection/components/overlays/tooltip/internals/scroll-listeners.js +18 -0
  224. package/dist/collection/components/{tooltip → overlays/tooltip}/tooltip.css +65 -65
  225. package/dist/collection/components/overlays/tooltip/tooltip.js +190 -0
  226. package/dist/collection/components/overlays/tooltip/tooltip.types.js +1 -0
  227. package/dist/collection/index.js +4 -0
  228. package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +42 -6
  229. package/dist/collection/playground/components/properties-panel/properties-panel.js +1 -1
  230. package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +4 -0
  231. package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +4 -0
  232. package/dist/collection/playground/components/theme-designer/theme-designer.js +6 -4
  233. package/dist/collection/playground/playground.bundled.js +759 -697
  234. package/dist/collection/playground/views/q-button-view/q-button-view.js +6 -6
  235. package/dist/collection/playground/views/q-input-view/q-input-view.js +6 -6
  236. package/dist/collection/utils/collection-identity.js +136 -0
  237. package/dist/collection/utils/collection-identity.unit.test.js +107 -0
  238. package/dist/collection/utils/dom.js +14 -6
  239. package/dist/collection/utils/form-control-validity.js +44 -0
  240. package/dist/components/index.js +1 -1
  241. package/dist/components/p-2bWqVyTo.js +1 -0
  242. package/dist/components/p-BEBDDqVT.js +1 -0
  243. package/dist/components/p-BIIQL66b.js +1 -0
  244. package/dist/components/p-BJiYCN3i.js +1 -0
  245. package/dist/components/p-BeeM-7Ku.js +5 -0
  246. package/dist/components/p-Bj2RJb2E.js +1 -0
  247. package/dist/components/p-ByfrUWx1.js +1 -0
  248. package/dist/components/p-CBVOdtO_.js +1 -0
  249. package/dist/components/p-CGZPmEUB.js +1 -0
  250. package/dist/components/p-CXcle-2Q.js +1 -0
  251. package/dist/components/p-Ccj0labf.js +1 -0
  252. package/dist/components/p-D-SCwJg6.js +1 -0
  253. package/dist/components/p-DCICQbw4.js +1 -0
  254. package/dist/components/p-DH-PVHhr.js +1 -0
  255. package/dist/components/p-DQhiqYeq.js +1 -0
  256. package/dist/components/p-Dd8ZWrLX.js +1 -0
  257. package/dist/components/p-DiOrwkX8.js +1 -0
  258. package/dist/components/p-DmqVhVoj.js +1 -0
  259. package/dist/components/p-WJHaLJS_.js +1 -0
  260. package/dist/components/p-xNd-aY2K.js +1 -0
  261. package/dist/components/{q-circular-progress.d.ts → q-alert.d.ts} +4 -4
  262. package/dist/components/q-alert.js +1 -0
  263. package/dist/components/q-avatar.d.ts +11 -0
  264. package/dist/components/q-avatar.js +1 -0
  265. package/dist/components/q-button.js +1 -1
  266. package/dist/components/q-card.js +1 -1
  267. package/dist/components/q-carousel.js +1 -1
  268. package/dist/components/q-chip.d.ts +11 -0
  269. package/dist/components/q-chip.js +1 -0
  270. package/dist/components/q-conversation-bubble.d.ts +11 -0
  271. package/dist/components/q-conversation-bubble.js +1 -0
  272. package/dist/components/q-data-table.js +1 -1
  273. package/dist/components/q-dialog.js +1 -1
  274. package/dist/components/q-dropdown.js +1 -1
  275. package/dist/components/q-form.d.ts +11 -0
  276. package/dist/components/q-form.js +1 -0
  277. package/dist/components/q-icon.js +1 -1
  278. package/dist/components/q-input.js +1 -1
  279. package/dist/components/q-link.d.ts +11 -0
  280. package/dist/components/q-link.js +1 -0
  281. package/dist/components/q-map.d.ts +11 -0
  282. package/dist/components/q-map.js +1 -0
  283. package/dist/components/q-navbar.d.ts +11 -0
  284. package/dist/components/q-navbar.js +1 -0
  285. package/dist/components/q-pagination.d.ts +11 -0
  286. package/dist/components/q-pagination.js +1 -0
  287. package/dist/components/q-panel.d.ts +11 -0
  288. package/dist/components/q-panel.js +1 -0
  289. package/dist/components/q-progress.d.ts +11 -0
  290. package/dist/components/q-progress.js +1 -0
  291. package/dist/components/q-quantity-selector.js +1 -1
  292. package/dist/components/q-radio-group.d.ts +11 -0
  293. package/dist/components/q-radio-group.js +1 -0
  294. package/dist/components/q-reel.js +1 -1
  295. package/dist/components/q-scrollable.js +1 -1
  296. package/dist/components/q-sidepanel.js +1 -1
  297. package/dist/components/q-step-diagram-item.js +1 -1
  298. package/dist/components/q-step-diagram.js +1 -1
  299. package/dist/components/q-syntax-box.js +1 -1
  300. package/dist/components/q-tabs.d.ts +11 -0
  301. package/dist/components/q-tabs.js +1 -0
  302. package/dist/components/q-textarea.js +1 -1
  303. package/dist/components/q-thumbnail.js +1 -1
  304. package/dist/components/q-toast.d.ts +11 -0
  305. package/dist/components/q-toast.js +1 -0
  306. package/dist/components/q-toggle.js +1 -1
  307. package/dist/components/q-toolbar.d.ts +11 -0
  308. package/dist/components/q-toolbar.js +1 -0
  309. package/dist/components/q-tooltip.js +1 -1
  310. package/dist/esm/Leaflet.GoogleMutant-BlvymWLE.js +767 -0
  311. package/dist/esm/action.props-CzaBbbcQ.js +32 -0
  312. package/dist/esm/collection-identity-CGZPmEUB.js +138 -0
  313. package/dist/esm/data-table-cell-DmqVhVoj.js +42 -0
  314. package/dist/esm/{dom-DoQvrOHk.js → dom-ByfrUWx1.js} +15 -7
  315. package/dist/esm/form-control-validity-Bj2RJb2E.js +46 -0
  316. package/dist/esm/{index-CYoQ4Zv3.js → index-DOk7gYkf.js} +21 -4
  317. package/dist/esm/index.js +5 -1
  318. package/dist/esm/leaflet-maplibre-gl-Cgb-1z8Q.js +432 -0
  319. package/dist/esm/leaflet-src-BR13bdVA.js +30 -0
  320. package/dist/esm/leaflet-src-BeeM-7Ku.js +14520 -0
  321. package/dist/esm/loader.js +3 -3
  322. package/dist/esm/map.types-WJHaLJS_.js +14 -0
  323. package/dist/esm/q-alert.entry.js +50 -0
  324. package/dist/esm/q-avatar.entry.js +99 -0
  325. package/dist/esm/q-button_2.entry.js +372 -0
  326. package/dist/esm/q-card.entry.js +31 -9
  327. package/dist/esm/q-carousel.entry.js +121 -78
  328. package/dist/esm/q-chip.entry.js +122 -0
  329. package/dist/esm/q-conversation-bubble.entry.js +68 -0
  330. package/dist/esm/q-data-table.entry.js +469 -118
  331. package/dist/esm/q-dialog.entry.js +136 -22
  332. package/dist/esm/q-dropdown.entry.js +318 -64
  333. package/dist/esm/q-form.entry.js +507 -0
  334. package/dist/esm/q-icon.entry.js +232 -100
  335. package/dist/esm/q-input_2.entry.js +360 -0
  336. package/dist/esm/q-link.entry.js +78 -0
  337. package/dist/esm/q-map.entry.js +3326 -0
  338. package/dist/esm/q-navbar.entry.js +192 -0
  339. package/dist/esm/q-pagination.entry.js +66 -0
  340. package/dist/esm/q-panel.entry.js +65 -0
  341. package/dist/esm/q-quantity-selector.entry.js +112 -93
  342. package/dist/esm/q-radio-group.entry.js +215 -0
  343. package/dist/esm/q-reel.entry.js +86 -33
  344. package/dist/esm/q-scrollable.entry.js +447 -0
  345. package/dist/esm/q-sidepanel.entry.js +380 -114
  346. package/dist/esm/q-step-diagram-item.entry.js +11 -17
  347. package/dist/esm/q-step-diagram.entry.js +9 -10
  348. package/dist/esm/q-syntax-box.entry.js +326 -173
  349. package/dist/esm/q-tabs.entry.js +153 -0
  350. package/dist/esm/q-textarea.entry.js +69 -9
  351. package/dist/esm/q-thumbnail.entry.js +18 -11
  352. package/dist/esm/q-toast.entry.js +398 -0
  353. package/dist/esm/q-toggle.entry.js +57 -26
  354. package/dist/esm/q-toolbar.entry.js +27 -0
  355. package/dist/esm/toast-controller-BIIQL66b.js +107 -0
  356. package/dist/esm/webquark.js +3 -3
  357. package/dist/playground/build/index.esm.js +1 -1
  358. package/dist/playground/build/p-011bab4c.entry.js +1 -0
  359. package/dist/playground/build/p-0571c3ae.entry.js +1 -0
  360. package/dist/playground/build/p-09e29cf9.entry.js +1 -0
  361. package/dist/playground/build/p-0aeed0be.entry.js +1 -0
  362. package/dist/playground/build/p-13b7bd40.entry.js +1 -0
  363. package/dist/playground/build/p-1d1ec52e.entry.js +1 -0
  364. package/dist/playground/build/p-254555b1.entry.js +1 -0
  365. package/dist/playground/build/p-28cc0172.entry.js +1 -0
  366. package/dist/playground/build/p-2bWqVyTo.js +1 -0
  367. package/dist/playground/build/p-33a45980.entry.js +1 -0
  368. package/dist/playground/build/p-33cfbd33.entry.js +1 -0
  369. package/dist/playground/build/p-4557f558.entry.js +1 -0
  370. package/dist/playground/build/p-48a8413d.entry.js +1 -0
  371. package/dist/playground/build/p-4d5d0313.entry.js +1 -0
  372. package/dist/playground/build/p-56644a7b.entry.js +1 -0
  373. package/dist/playground/build/p-58724642.entry.js +1 -0
  374. package/dist/playground/build/p-590cde02.entry.js +1 -0
  375. package/dist/playground/build/p-6cf356da.entry.js +1 -0
  376. package/dist/playground/build/p-6deac326.entry.js +1 -0
  377. package/dist/playground/build/p-6f1b98c2.entry.js +1 -0
  378. package/dist/playground/build/p-711576c8.entry.js +1 -0
  379. package/dist/playground/build/p-93ffb8ab.entry.js +1 -0
  380. package/dist/playground/build/p-94413975.entry.js +1 -0
  381. package/dist/playground/build/p-9d14b8ec.entry.js +1 -0
  382. package/dist/playground/build/p-BEBDDqVT.js +1 -0
  383. package/dist/playground/build/p-BIIQL66b.js +1 -0
  384. package/dist/playground/build/p-BeeM-7Ku.js +5 -0
  385. package/dist/playground/build/p-Bj2RJb2E.js +1 -0
  386. package/dist/playground/build/p-ByfrUWx1.js +1 -0
  387. package/dist/playground/build/p-CGZPmEUB.js +1 -0
  388. package/dist/playground/build/p-DD6AOr35.js +1 -0
  389. package/dist/playground/build/p-DNFGt02p.js +1 -0
  390. package/dist/playground/build/p-DOk7gYkf.js +2 -0
  391. package/dist/playground/build/p-DmqVhVoj.js +1 -0
  392. package/dist/playground/build/p-WJHaLJS_.js +1 -0
  393. package/dist/playground/build/p-a054f314.entry.js +1 -0
  394. package/dist/playground/build/p-ad1c341c.entry.js +1 -0
  395. package/dist/playground/build/p-b8a75199.entry.js +1 -0
  396. package/dist/playground/build/p-b8aa6763.entry.js +1 -0
  397. package/dist/playground/build/p-c2032ee1.entry.js +1 -0
  398. package/dist/playground/build/p-cddadb39.entry.js +1 -0
  399. package/dist/playground/build/p-cfaffa33.entry.js +1 -0
  400. package/dist/playground/build/p-dda5be3e.entry.js +1 -0
  401. package/dist/playground/build/p-f51a7a3c.entry.js +1 -0
  402. package/dist/playground/build/webquark.css +1 -1
  403. package/dist/playground/build/webquark.esm.js +1 -1
  404. package/dist/playground/css/base.css +122 -145
  405. package/dist/playground/index.html +29 -29
  406. package/dist/playground/playground/components.manifest.json +37 -20
  407. package/dist/playground/playground/specs/q-avatar.sandbox.json +24 -0
  408. package/dist/playground/playground/specs/q-button.sandbox.json +14 -3
  409. package/dist/playground/playground/specs/q-chip.sandbox.json +105 -0
  410. package/dist/playground/playground/specs/q-conversation-bubble.sandbox.json +26 -0
  411. package/dist/playground/playground/specs/q-data-table.sandbox.json +53 -0
  412. package/dist/playground/playground/specs/q-dropdown.sandbox.json +5 -0
  413. package/dist/playground/playground/specs/q-form.sandbox.json +20 -0
  414. package/dist/playground/playground/specs/q-link.sandbox.json +27 -0
  415. package/dist/playground/playground/specs/q-map.sandbox.json +203 -0
  416. package/dist/playground/playground/specs/q-navbar.sandbox.json +32 -0
  417. package/dist/playground/playground/specs/q-panel.sandbox.json +28 -0
  418. package/dist/playground/playground/specs/q-progress.sandbox.json +117 -0
  419. package/dist/playground/playground/specs/q-radio-group.sandbox.json +58 -0
  420. package/dist/playground/playground/specs/q-scrollable.sandbox.json +3 -3
  421. package/dist/playground/playground/specs/q-sidepanel.sandbox.json +7 -2
  422. package/dist/playground/playground/specs/q-syntax-box.sandbox.json +1 -1
  423. package/dist/playground/playground/specs/q-toast.sandbox.json +32 -0
  424. package/dist/playground/playground/specs/q-toggle.sandbox.json +3 -3
  425. package/dist/playground/playground/specs/q-toolbar.sandbox.json +26 -0
  426. package/dist/playground/playground.css +1 -1
  427. package/dist/playground/playground.js +759 -697
  428. package/dist/playground/views/q-button-view/q-button-view.css +1 -1
  429. package/dist/playground/views/q-button-view/q-button-view.html +1 -1
  430. package/dist/playground/views/q-button-view/q-button-view.js +6 -6
  431. package/dist/playground/views/q-input-view/q-input-view.css +1 -1
  432. package/dist/playground/views/q-input-view/q-input-view.html +1 -1
  433. package/dist/playground/views/q-input-view/q-input-view.js +6 -6
  434. package/dist/types/components/actions/action.props.d.ts +19 -0
  435. package/dist/types/components/actions/button/button.d.ts +61 -0
  436. package/dist/types/components/actions/button/button.types.d.ts +5 -0
  437. package/dist/types/components/actions/button/button.utils.d.ts +8 -0
  438. package/dist/types/components/actions/button/button.utils.unit.test.d.ts +1 -0
  439. package/dist/types/components/actions/chip/chip.d.ts +55 -0
  440. package/dist/types/components/actions/chip/chip.types.d.ts +13 -0
  441. package/dist/types/components/actions/link/link.d.ts +43 -0
  442. package/dist/types/components/actions/link/link.types.d.ts +3 -0
  443. package/dist/types/components/data-display/alert/alert.d.ts +32 -0
  444. package/dist/types/components/data-display/alert/alert.types.d.ts +2 -0
  445. package/dist/types/components/data-display/conversation-bubble/conversation-bubble.d.ts +38 -0
  446. package/dist/types/components/data-display/conversation-bubble/conversation-bubble.types.d.ts +1 -0
  447. package/dist/types/components/data-display/data-table/data-table-cell.d.ts +5 -0
  448. package/dist/types/components/data-display/data-table/data-table.d.ts +78 -0
  449. package/dist/types/components/data-display/data-table/data-table.types.d.ts +53 -0
  450. package/dist/types/components/data-display/data-table/internals/data-access.d.ts +9 -0
  451. package/dist/types/components/data-display/data-table/internals/render-row-actions.d.ts +9 -0
  452. package/dist/types/components/data-display/data-table/internals/render-sort-indicator.d.ts +5 -0
  453. package/dist/types/components/data-display/data-table/internals/render-table-body.d.ts +12 -0
  454. package/dist/types/components/data-display/data-table/internals/render-table-head.d.ts +8 -0
  455. package/dist/types/components/data-display/data-table/internals/render-toolbar.d.ts +9 -0
  456. package/dist/types/components/data-display/data-table/internals/row-events.d.ts +1 -0
  457. package/dist/types/components/data-display/data-table/internals/selection.d.ts +10 -0
  458. package/dist/types/components/data-display/data-table/internals/sort.d.ts +3 -0
  459. package/dist/types/components/data-display/data-table/internals/table-model.d.ts +52 -0
  460. package/dist/types/components/data-display/map/internals/base-layer.d.ts +63 -0
  461. package/dist/types/components/data-display/map/internals/bounds.d.ts +23 -0
  462. package/dist/types/components/data-display/map/internals/buffered-tile-layer.d.ts +10 -0
  463. package/dist/types/components/data-display/map/internals/cluster-collision.d.ts +15 -0
  464. package/dist/types/components/data-display/map/internals/google-maps.d.ts +9 -0
  465. package/dist/types/components/data-display/map/internals/google-mutant-module.d.ts +11 -0
  466. package/dist/types/components/data-display/map/internals/google-mutant.d.ts +18 -0
  467. package/dist/types/components/data-display/map/internals/maplibre.d.ts +14 -0
  468. package/dist/types/components/data-display/map/internals/marker-cluster-index.d.ts +36 -0
  469. package/dist/types/components/data-display/map/internals/marker-controller.d.ts +55 -0
  470. package/dist/types/components/data-display/map/internals/marker-presentation.d.ts +8 -0
  471. package/dist/types/components/data-display/map/internals/marker-visibility.d.ts +10 -0
  472. package/dist/types/components/data-display/map/internals/markers.d.ts +4 -0
  473. package/dist/types/components/data-display/map/internals/tile-layer-readiness.d.ts +11 -0
  474. package/dist/types/components/data-display/map/internals/tile-preload-buffer.d.ts +4 -0
  475. package/dist/types/components/data-display/map/internals/vector-padding.d.ts +4 -0
  476. package/dist/types/components/data-display/map/map.d.ts +171 -0
  477. package/dist/types/components/data-display/map/map.types.d.ts +122 -0
  478. package/dist/types/components/data-display/map/test/map.cmp.test.d.ts +1 -0
  479. package/dist/types/components/data-display/pagination/pagination.d.ts +33 -0
  480. package/dist/types/components/data-display/pagination/test/pagination.cmp.test.d.ts +2 -0
  481. package/dist/types/components/data-display/syntax-box/internals/clipboard.d.ts +2 -0
  482. package/dist/types/components/data-display/syntax-box/internals/editor-key-action.d.ts +12 -0
  483. package/dist/types/components/data-display/syntax-box/internals/value-sync.d.ts +18 -0
  484. package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +66 -0
  485. package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +2 -0
  486. package/dist/types/components/data-display/syntax-box/syntax-box.utils.d.ts +1 -0
  487. package/dist/types/components/indicators/progress/progress.d.ts +30 -0
  488. package/dist/types/components/indicators/progress/progress.types.d.ts +3 -0
  489. package/dist/types/components/indicators/step-diagram/step-diagram.d.ts +16 -0
  490. package/dist/types/components/indicators/step-diagram/step-diagram.types.d.ts +1 -0
  491. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.d.ts +24 -0
  492. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.types.d.ts +3 -0
  493. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.utils.d.ts +1 -0
  494. package/dist/types/components/inputs/dropdown/dropdown.d.ts +90 -0
  495. package/dist/types/components/inputs/dropdown/dropdown.types.d.ts +8 -0
  496. package/dist/types/components/inputs/dropdown/internals/options.d.ts +6 -0
  497. package/dist/types/components/inputs/dropdown/internals/position.d.ts +26 -0
  498. package/dist/types/components/inputs/dropdown/test/dropdown.cmp.test.d.ts +1 -0
  499. package/dist/types/components/inputs/input/input.d.ts +77 -0
  500. package/dist/types/components/inputs/input/input.types.d.ts +2 -0
  501. package/dist/types/components/inputs/input/input.utils.d.ts +1 -0
  502. package/dist/types/components/inputs/quantity-selector/internals/number-value.d.ts +13 -0
  503. package/dist/types/components/{quantity-selector → inputs/quantity-selector}/quantity-selector.d.ts +10 -9
  504. package/dist/types/components/inputs/quantity-selector/quantity-selector.types.d.ts +1 -0
  505. package/dist/types/components/inputs/radio-group/radio-group.d.ts +60 -0
  506. package/dist/types/components/inputs/radio-group/radio-group.types.d.ts +11 -0
  507. package/dist/types/components/inputs/radio-group/radio-group.utils.d.ts +2 -0
  508. package/dist/types/components/inputs/textarea/textarea.d.ts +59 -0
  509. package/dist/types/components/inputs/textarea/textarea.types.d.ts +1 -0
  510. package/dist/types/components/inputs/toggle/toggle.d.ts +56 -0
  511. package/dist/types/components/inputs/toggle/toggle.types.d.ts +2 -0
  512. package/dist/types/components/inputs/toggle/toggle.utils.d.ts +1 -0
  513. package/dist/types/components/layout/card/card.d.ts +24 -0
  514. package/dist/types/components/layout/card/card.types.d.ts +1 -0
  515. package/dist/types/components/layout/card/card.utils.d.ts +5 -0
  516. package/dist/types/components/{carousel → layout/carousel}/carousel.d.ts +19 -7
  517. package/dist/types/components/layout/carousel/carousel.types.d.ts +5 -0
  518. package/dist/types/components/layout/carousel/carousel.utils.d.ts +1 -0
  519. package/dist/types/components/layout/carousel/internals/metrics.d.ts +23 -0
  520. package/dist/types/components/layout/form/form.d.ts +69 -0
  521. package/dist/types/components/layout/form/form.types.d.ts +38 -0
  522. package/dist/types/components/layout/form/internals/controls.d.ts +5 -0
  523. package/dist/types/components/layout/form/internals/enter-behavior.d.ts +2 -0
  524. package/dist/types/components/layout/form/internals/values.d.ts +5 -0
  525. package/dist/types/components/layout/form/test/form.cmp.test.d.ts +4 -0
  526. package/dist/types/components/layout/navbar/navbar.d.ts +66 -0
  527. package/dist/types/components/layout/navbar/navbar.types.d.ts +31 -0
  528. package/dist/types/components/layout/navbar/navbar.utils.d.ts +2 -0
  529. package/dist/types/components/layout/navbar/test/navbar.cmp.test.d.ts +1 -0
  530. package/dist/types/components/layout/panel/panel.d.ts +33 -0
  531. package/dist/types/components/layout/panel/panel.types.d.ts +2 -0
  532. package/dist/types/components/layout/scrollable/internals/metrics.d.ts +26 -0
  533. package/dist/types/components/layout/scrollable/internals/native-scrollbar.d.ts +4 -0
  534. package/dist/types/components/layout/scrollable/scrollable.d.ts +67 -0
  535. package/dist/types/components/layout/scrollable/scrollable.types.d.ts +6 -0
  536. package/dist/types/components/layout/sidepanel/internals/drawer.d.ts +2 -0
  537. package/dist/types/components/layout/sidepanel/internals/groups.d.ts +7 -0
  538. package/dist/types/components/layout/sidepanel/internals/nav-items.d.ts +2 -0
  539. package/dist/types/components/layout/sidepanel/sidepanel.d.ts +92 -0
  540. package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +39 -0
  541. package/dist/types/components/layout/sidepanel/sidepanel.utils.d.ts +2 -0
  542. package/dist/types/components/layout/tabs/tabs.d.ts +29 -0
  543. package/dist/types/components/layout/tabs/tabs.types.d.ts +14 -0
  544. package/dist/types/components/layout/tabs/tabs.utils.d.ts +4 -0
  545. package/dist/types/components/layout/tabs/test/tabs.cmp.test.d.ts +1 -0
  546. package/dist/types/components/layout/toolbar/toolbar.d.ts +23 -0
  547. package/dist/types/components/layout/toolbar/toolbar.types.d.ts +1 -0
  548. package/dist/types/components/media/avatar/avatar.d.ts +37 -0
  549. package/dist/types/components/media/avatar/avatar.types.d.ts +2 -0
  550. package/dist/types/components/media/icon/icon.d.ts +41 -0
  551. package/dist/types/components/media/icon/icon.types.d.ts +5 -0
  552. package/dist/types/components/media/icon/internals/constants.d.ts +3 -0
  553. package/dist/types/components/media/icon/internals/fetch-icon.d.ts +1 -0
  554. package/dist/types/components/media/icon/internals/sanitize-svg.d.ts +2 -0
  555. package/dist/types/components/media/icon/internals/size.d.ts +2 -0
  556. package/dist/types/components/media/icon/internals/url.d.ts +11 -0
  557. package/dist/types/components/media/reel/reel.d.ts +34 -0
  558. package/dist/types/components/media/reel/reel.types.d.ts +3 -0
  559. package/dist/types/components/media/thumbnail/thumbnail.d.ts +21 -0
  560. package/dist/types/components/media/thumbnail/thumbnail.types.d.ts +7 -0
  561. package/dist/types/components/overlays/dialog/dialog.d.ts +71 -0
  562. package/dist/types/components/overlays/dialog/dialog.types.d.ts +1 -0
  563. package/dist/types/components/overlays/dialog/internals/backdrop.d.ts +2 -0
  564. package/dist/types/components/overlays/dialog/internals/lifecycle.d.ts +21 -0
  565. package/dist/types/components/overlays/toast/internals/icons.d.ts +2 -0
  566. package/dist/types/components/overlays/toast/internals/queue.d.ts +19 -0
  567. package/dist/types/components/overlays/toast/internals/timers.d.ts +12 -0
  568. package/dist/types/components/overlays/toast/test/toast.cmp.test.d.ts +2 -0
  569. package/dist/types/components/overlays/toast/test/toast.unit.test.d.ts +1 -0
  570. package/dist/types/components/overlays/toast/toast-controller.d.ts +9 -0
  571. package/dist/types/components/overlays/toast/toast.d.ts +44 -0
  572. package/dist/types/components/overlays/toast/toast.types.d.ts +30 -0
  573. package/dist/types/components/overlays/tooltip/internals/aria.d.ts +13 -0
  574. package/dist/types/components/overlays/tooltip/internals/positioning.d.ts +7 -0
  575. package/dist/types/components/overlays/tooltip/internals/scroll-listeners.d.ts +2 -0
  576. package/dist/types/components/overlays/tooltip/tooltip.d.ts +28 -0
  577. package/dist/types/components/overlays/tooltip/tooltip.types.d.ts +1 -0
  578. package/dist/types/components.d.ts +3600 -569
  579. package/dist/types/declarations.d.ts +5 -0
  580. package/dist/types/index.d.ts +10 -0
  581. package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +2 -0
  582. package/dist/types/utils/collection-identity.d.ts +55 -0
  583. package/dist/types/utils/collection-identity.unit.test.d.ts +1 -0
  584. package/dist/types/utils/dom.d.ts +1 -1
  585. package/dist/types/utils/form-control-validity.d.ts +14 -0
  586. package/dist/webquark/index.esm.js +1 -1
  587. package/dist/webquark/p-011bab4c.entry.js +1 -0
  588. package/dist/webquark/p-0571c3ae.entry.js +1 -0
  589. package/dist/webquark/p-09e29cf9.entry.js +1 -0
  590. package/dist/webquark/p-0aeed0be.entry.js +1 -0
  591. package/dist/webquark/p-13b7bd40.entry.js +1 -0
  592. package/dist/webquark/p-1d1ec52e.entry.js +1 -0
  593. package/dist/webquark/p-254555b1.entry.js +1 -0
  594. package/dist/webquark/p-28cc0172.entry.js +1 -0
  595. package/dist/webquark/p-2bWqVyTo.js +1 -0
  596. package/dist/webquark/p-33a45980.entry.js +1 -0
  597. package/dist/webquark/p-33cfbd33.entry.js +1 -0
  598. package/dist/webquark/p-4557f558.entry.js +1 -0
  599. package/dist/webquark/p-48a8413d.entry.js +1 -0
  600. package/dist/webquark/p-4d5d0313.entry.js +1 -0
  601. package/dist/webquark/p-56644a7b.entry.js +1 -0
  602. package/dist/webquark/p-58724642.entry.js +1 -0
  603. package/dist/webquark/p-590cde02.entry.js +1 -0
  604. package/dist/webquark/p-6cf356da.entry.js +1 -0
  605. package/dist/webquark/p-6deac326.entry.js +1 -0
  606. package/dist/webquark/p-6f1b98c2.entry.js +1 -0
  607. package/dist/webquark/p-711576c8.entry.js +1 -0
  608. package/dist/webquark/p-93ffb8ab.entry.js +1 -0
  609. package/dist/webquark/p-94413975.entry.js +1 -0
  610. package/dist/webquark/p-9d14b8ec.entry.js +1 -0
  611. package/dist/webquark/p-BEBDDqVT.js +1 -0
  612. package/dist/webquark/p-BIIQL66b.js +1 -0
  613. package/dist/webquark/p-BeeM-7Ku.js +5 -0
  614. package/dist/webquark/p-Bj2RJb2E.js +1 -0
  615. package/dist/webquark/p-ByfrUWx1.js +1 -0
  616. package/dist/webquark/p-CGZPmEUB.js +1 -0
  617. package/dist/webquark/p-DD6AOr35.js +1 -0
  618. package/dist/webquark/p-DNFGt02p.js +1 -0
  619. package/dist/webquark/p-DOk7gYkf.js +2 -0
  620. package/dist/webquark/p-DmqVhVoj.js +1 -0
  621. package/dist/webquark/p-WJHaLJS_.js +1 -0
  622. package/dist/webquark/p-a054f314.entry.js +1 -0
  623. package/dist/webquark/p-ad1c341c.entry.js +1 -0
  624. package/dist/webquark/p-b8a75199.entry.js +1 -0
  625. package/dist/webquark/p-b8aa6763.entry.js +1 -0
  626. package/dist/webquark/p-c2032ee1.entry.js +1 -0
  627. package/dist/webquark/p-cddadb39.entry.js +1 -0
  628. package/dist/webquark/p-cfaffa33.entry.js +1 -0
  629. package/dist/webquark/p-dda5be3e.entry.js +1 -0
  630. package/dist/webquark/p-f51a7a3c.entry.js +1 -0
  631. package/dist/webquark/webquark.css +1 -1
  632. package/dist/webquark/webquark.esm.js +1 -1
  633. package/package.json +29 -8
  634. package/scripts/webquark-serve.js +8 -6
  635. package/dist/cjs/q-button_3.cjs.entry.js +0 -603
  636. package/dist/cjs/q-circular-progress_2.cjs.entry.js +0 -255
  637. package/dist/collection/components/circular-progress/circular-progress.css +0 -85
  638. package/dist/collection/components/circular-progress/circular-progress.js +0 -122
  639. package/dist/collection/components/data-table/data-table.js +0 -481
  640. package/dist/collection/components/dropdown/dropdown.js +0 -606
  641. package/dist/collection/components/icon/icon.js +0 -297
  642. package/dist/collection/components/sidepanel/sidepanel.css +0 -371
  643. package/dist/collection/components/sidepanel/sidepanel.js +0 -460
  644. package/dist/collection/components/step-diagram-item/step-diagram-item.js +0 -131
  645. package/dist/collection/components/syntax-box/syntax-box.js +0 -534
  646. package/dist/collection/components/tooltip/tooltip.js +0 -249
  647. package/dist/components/p-91lJS0-v.js +0 -1
  648. package/dist/components/p-B7e76DLW.js +0 -1
  649. package/dist/components/p-BCSpNDGG.js +0 -1
  650. package/dist/components/p-BRNv11Jn.js +0 -1
  651. package/dist/components/p-CYfD9z8O.js +0 -1
  652. package/dist/components/p-DfTW9B7V.js +0 -1
  653. package/dist/components/p-DgaKWrjd.js +0 -1
  654. package/dist/components/p-DoQvrOHk.js +0 -1
  655. package/dist/components/q-circular-progress.js +0 -1
  656. package/dist/esm/q-button_3.entry.js +0 -599
  657. package/dist/esm/q-circular-progress_2.entry.js +0 -252
  658. package/dist/playground/build/p-095635d3.entry.js +0 -1
  659. package/dist/playground/build/p-1238a2cc.entry.js +0 -1
  660. package/dist/playground/build/p-389e2cd3.entry.js +0 -1
  661. package/dist/playground/build/p-4f133a25.entry.js +0 -1
  662. package/dist/playground/build/p-5c67a28e.entry.js +0 -1
  663. package/dist/playground/build/p-679fa494.entry.js +0 -1
  664. package/dist/playground/build/p-6dc7b987.entry.js +0 -1
  665. package/dist/playground/build/p-7083c5ff.entry.js +0 -1
  666. package/dist/playground/build/p-7f47861b.entry.js +0 -1
  667. package/dist/playground/build/p-8a94a0a2.entry.js +0 -1
  668. package/dist/playground/build/p-9afa3fe8.entry.js +0 -1
  669. package/dist/playground/build/p-9bb8ed97.entry.js +0 -1
  670. package/dist/playground/build/p-CYoQ4Zv3.js +0 -2
  671. package/dist/playground/build/p-DoQvrOHk.js +0 -1
  672. package/dist/playground/build/p-aa9be919.entry.js +0 -1
  673. package/dist/playground/build/p-b1e68119.entry.js +0 -1
  674. package/dist/playground/build/p-c8d6af8e.entry.js +0 -1
  675. package/dist/playground/build/p-f48dd3dd.entry.js +0 -1
  676. package/dist/playground/build/p-f7b5b155.entry.js +0 -1
  677. package/dist/playground/playground/specs/q-circular-progress.sandbox.json +0 -91
  678. package/dist/types/components/button/button.d.ts +0 -26
  679. package/dist/types/components/card/card.d.ts +0 -12
  680. package/dist/types/components/circular-progress/circular-progress.d.ts +0 -7
  681. package/dist/types/components/data-table/data-table.d.ts +0 -45
  682. package/dist/types/components/dialog/dialog.d.ts +0 -35
  683. package/dist/types/components/dropdown/dropdown.d.ts +0 -49
  684. package/dist/types/components/icon/icon.d.ts +0 -33
  685. package/dist/types/components/input/input.d.ts +0 -43
  686. package/dist/types/components/reel/reel.d.ts +0 -23
  687. package/dist/types/components/scrollable/scrollable.d.ts +0 -47
  688. package/dist/types/components/sidepanel/sidepanel.d.ts +0 -58
  689. package/dist/types/components/step-diagram/step-diagram.d.ts +0 -10
  690. package/dist/types/components/step-diagram-item/step-diagram-item.d.ts +0 -12
  691. package/dist/types/components/syntax-box/syntax-box.d.ts +0 -37
  692. package/dist/types/components/textarea/textarea.d.ts +0 -36
  693. package/dist/types/components/thumbnail/thumbnail.d.ts +0 -18
  694. package/dist/types/components/toggle/toggle.d.ts +0 -36
  695. package/dist/types/components/tooltip/tooltip.d.ts +0 -29
  696. package/dist/webquark/p-095635d3.entry.js +0 -1
  697. package/dist/webquark/p-1238a2cc.entry.js +0 -1
  698. package/dist/webquark/p-389e2cd3.entry.js +0 -1
  699. package/dist/webquark/p-4f133a25.entry.js +0 -1
  700. package/dist/webquark/p-5c67a28e.entry.js +0 -1
  701. package/dist/webquark/p-679fa494.entry.js +0 -1
  702. package/dist/webquark/p-6dc7b987.entry.js +0 -1
  703. package/dist/webquark/p-7083c5ff.entry.js +0 -1
  704. package/dist/webquark/p-7f47861b.entry.js +0 -1
  705. package/dist/webquark/p-8a94a0a2.entry.js +0 -1
  706. package/dist/webquark/p-9afa3fe8.entry.js +0 -1
  707. package/dist/webquark/p-9bb8ed97.entry.js +0 -1
  708. package/dist/webquark/p-CYoQ4Zv3.js +0 -2
  709. package/dist/webquark/p-DoQvrOHk.js +0 -1
  710. package/dist/webquark/p-aa9be919.entry.js +0 -1
  711. package/dist/webquark/p-b1e68119.entry.js +0 -1
  712. package/dist/webquark/p-c8d6af8e.entry.js +0 -1
  713. package/dist/webquark/p-f48dd3dd.entry.js +0 -1
  714. package/dist/webquark/p-f7b5b155.entry.js +0 -1
  715. /package/dist/cjs/{index-DGQOjEwT.js → utils-DGQOjEwT.js} +0 -0
  716. /package/dist/esm/{index-BJiYCN3i.js → utils-BJiYCN3i.js} +0 -0
@@ -0,0 +1,3328 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-D5SQkd__.js');
4
+ var map_types = require('./map.types-DNrz8rJh.js');
5
+
6
+ function isTilePreloadBufferRelevant(requestedProvider, activeProvider) {
7
+ return requestedProvider === 'tiles' || activeProvider === 'tiles';
8
+ }
9
+ function isVectorPaddingRelevant(requestedProvider, activeProvider) {
10
+ return requestedProvider === 'vector' || activeProvider === 'vector';
11
+ }
12
+ /** Coordinates asynchronous provider creation and atomic base-layer replacement. */
13
+ class MapBaseLayerController {
14
+ operations;
15
+ revision = 0;
16
+ active;
17
+ pendingAttachController;
18
+ constructor(operations) {
19
+ this.operations = operations;
20
+ }
21
+ getActiveState() {
22
+ return {
23
+ activeProvider: this.active?.provider,
24
+ usingFallback: this.active?.usingFallback ?? false,
25
+ };
26
+ }
27
+ async sync(config) {
28
+ const revision = ++this.revision;
29
+ this.abortPendingAttach();
30
+ if (!this.isConfigured(config)) {
31
+ this.clearActiveLayer();
32
+ return { kind: 'empty', activeProvider: undefined, usingFallback: false };
33
+ }
34
+ const primary = await this.createCandidate(config.requestedProvider, config, revision);
35
+ if (primary.kind === 'stale')
36
+ return primary;
37
+ const primaryResult = primary.kind === 'ready'
38
+ ? await this.commit(primary.candidate, config.requestedProvider, false, revision)
39
+ : primary;
40
+ if (primaryResult.kind === 'stale' || primaryResult.kind === 'ready')
41
+ return primaryResult;
42
+ if (config.requestedProvider === 'tiles' || !config.tileUrl.trim()) {
43
+ return { kind: 'error', error: primaryResult.error, ...this.getActiveState() };
44
+ }
45
+ const fallback = await this.createCandidate('tiles', config, revision);
46
+ if (fallback.kind === 'stale')
47
+ return fallback;
48
+ if (fallback.kind === 'error') {
49
+ return { kind: 'error', error: primaryResult.error, fallbackError: fallback.error, ...this.getActiveState() };
50
+ }
51
+ const result = await this.commit(fallback.candidate, 'tiles', true, revision);
52
+ if (result.kind === 'ready')
53
+ return { ...result, warning: primaryResult.error };
54
+ if (result.kind === 'error') {
55
+ return { kind: 'error', error: primaryResult.error, fallbackError: result.error, ...this.getActiveState() };
56
+ }
57
+ return result;
58
+ }
59
+ destroy() {
60
+ this.revision += 1;
61
+ this.abortPendingAttach();
62
+ this.clearActiveLayer();
63
+ }
64
+ isConfigured(config) {
65
+ if (config.requestedProvider === 'google') {
66
+ return config.googleApiAvailable || config.googleApiKey.trim().length > 0;
67
+ }
68
+ if (config.requestedProvider === 'vector') {
69
+ return config.vectorStyleUrl.trim().length > 0;
70
+ }
71
+ return config.tileUrl.trim().length > 0;
72
+ }
73
+ async createCandidate(provider, config, revision) {
74
+ try {
75
+ const candidate = provider === 'google'
76
+ ? await this.operations.createGoogle(config)
77
+ : provider === 'vector'
78
+ ? await this.operations.createVector(config)
79
+ : this.operations.createTiles(config);
80
+ if (revision !== this.revision) {
81
+ this.removeLayer(candidate);
82
+ return { kind: 'stale' };
83
+ }
84
+ return { kind: 'ready', candidate };
85
+ }
86
+ catch (error) {
87
+ return revision === this.revision ? { kind: 'error', error } : { kind: 'stale' };
88
+ }
89
+ }
90
+ async commit(candidate, provider, usingFallback, revision) {
91
+ if (revision !== this.revision) {
92
+ this.removeLayer(candidate);
93
+ return { kind: 'stale' };
94
+ }
95
+ const attachController = new AbortController();
96
+ this.pendingAttachController = attachController;
97
+ try {
98
+ await this.operations.attach(candidate, provider, {
99
+ replacing: this.active !== undefined,
100
+ signal: attachController.signal,
101
+ });
102
+ }
103
+ catch (error) {
104
+ this.clearPendingAttach(attachController);
105
+ this.removeLayer(candidate);
106
+ if (revision !== this.revision || attachController.signal.aborted) {
107
+ return { kind: 'stale' };
108
+ }
109
+ return { kind: 'error', error, ...this.getActiveState() };
110
+ }
111
+ this.clearPendingAttach(attachController);
112
+ if (revision !== this.revision) {
113
+ this.removeLayer(candidate);
114
+ return { kind: 'stale' };
115
+ }
116
+ const previous = this.active;
117
+ this.active = { layer: candidate, provider, usingFallback };
118
+ if (previous?.layer !== candidate)
119
+ this.removeLayer(previous?.layer);
120
+ return { kind: 'ready', activeProvider: provider, usingFallback };
121
+ }
122
+ clearActiveLayer() {
123
+ this.removeLayer(this.active?.layer);
124
+ this.active = undefined;
125
+ }
126
+ abortPendingAttach() {
127
+ this.pendingAttachController?.abort();
128
+ this.pendingAttachController = undefined;
129
+ }
130
+ clearPendingAttach(controller) {
131
+ if (this.pendingAttachController === controller) {
132
+ this.pendingAttachController = undefined;
133
+ }
134
+ }
135
+ removeLayer(layer) {
136
+ if (!layer)
137
+ return;
138
+ try {
139
+ layer.remove();
140
+ }
141
+ catch {
142
+ // Cleanup is best-effort; Leaflet may already have detached the layer.
143
+ }
144
+ }
145
+ }
146
+
147
+ const TILE_SEAM_OVERLAP_PX = 1;
148
+ function createRasterTileLayerOptions(minZoom, maxZoom, preloadBuffer, loadingPolicy = 'full-batch') {
149
+ return {
150
+ attribution: '',
151
+ minZoom,
152
+ maxZoom,
153
+ ...(loadingPolicy === 'progressive'
154
+ ? { updateWhenZooming: true }
155
+ : {}),
156
+ ...(preloadBuffer > 0
157
+ ? {
158
+ updateInterval: 50,
159
+ updateWhenIdle: false,
160
+ updateWhenZooming: true,
161
+ }
162
+ : {}),
163
+ };
164
+ }
165
+ /**
166
+ * Extends Leaflet's requested tile bounds so raster imagery is already loaded
167
+ * just outside the visible viewport.
168
+ */
169
+ function createBufferedTileLayer(leaflet, tileUrl, options, preloadBuffer, loadingPolicy = 'full-batch') {
170
+ const layer = leaflet.tileLayer(tileUrl, options);
171
+ const initializeTile = layer._initTile.bind(layer);
172
+ layer._initTile = tile => {
173
+ initializeTile(tile);
174
+ const tileSize = layer.getTileSize();
175
+ tile.style.width = `${tileSize.x + TILE_SEAM_OVERLAP_PX}px`;
176
+ tile.style.height = `${tileSize.y + TILE_SEAM_OVERLAP_PX}px`;
177
+ };
178
+ if (loadingPolicy === 'progressive') {
179
+ configureProgressiveTileLayer(requireProgressiveTileLayer(layer));
180
+ }
181
+ if (preloadBuffer === 0)
182
+ return layer;
183
+ const getVisiblePixelBounds = layer._getTiledPixelBounds.bind(layer);
184
+ layer._getTiledPixelBounds = center => {
185
+ const bounds = getVisiblePixelBounds(center);
186
+ const tileSize = layer.getTileSize();
187
+ const horizontalBuffer = tileSize.x * preloadBuffer;
188
+ const verticalBuffer = tileSize.y * preloadBuffer;
189
+ return new leaflet.Bounds(bounds.min.subtract([horizontalBuffer, verticalBuffer]), bounds.max.add([horizontalBuffer, verticalBuffer]));
190
+ };
191
+ return layer;
192
+ }
193
+ function requireProgressiveTileLayer(layer) {
194
+ const candidate = layer;
195
+ if (typeof candidate._pruneTiles !== 'function' ||
196
+ typeof candidate._tileCoordsToKey !== 'function' ||
197
+ typeof candidate._tileReady !== 'function' ||
198
+ typeof candidate._updateOpacity !== 'function' ||
199
+ typeof candidate.onAdd !== 'function') {
200
+ throw progressiveLoadingUnsupported();
201
+ }
202
+ return candidate;
203
+ }
204
+ function configureProgressiveTileLayer(layer) {
205
+ const addToMap = layer.onAdd.bind(layer);
206
+ let configured = false;
207
+ layer.onAdd = map => {
208
+ const result = addToMap(map);
209
+ requireProgressiveTileRecords(layer);
210
+ if (!configured) {
211
+ keepLoadedParentsUntilChildrenSucceed(layer);
212
+ configured = true;
213
+ }
214
+ return result;
215
+ };
216
+ }
217
+ function requireProgressiveTileRecords(layer) {
218
+ if (layer._tiles === null ||
219
+ typeof layer._tiles !== 'object' ||
220
+ Array.isArray(layer._tiles)) {
221
+ throw progressiveLoadingUnsupported();
222
+ }
223
+ return layer._tiles;
224
+ }
225
+ function progressiveLoadingUnsupported() {
226
+ return new Error('Progressive raster loading is not supported by this Leaflet tile layer.');
227
+ }
228
+ /**
229
+ * Leaflet already retains loaded parents while children are pending. A failed
230
+ * image is normally marked active, which can prematurely prune that parent;
231
+ * progressive layers keep failed children inactive so the coarser tile stays
232
+ * visible underneath.
233
+ */
234
+ function keepLoadedParentsUntilChildrenSucceed(layer) {
235
+ const finishTile = layer._tileReady.bind(layer);
236
+ const pruneTiles = layer._pruneTiles.bind(layer);
237
+ const updateOpacity = layer._updateOpacity.bind(layer);
238
+ const withoutPruning = (operation) => {
239
+ const activePruneTiles = layer._pruneTiles;
240
+ layer._pruneTiles = () => undefined;
241
+ try {
242
+ operation();
243
+ }
244
+ finally {
245
+ layer._pruneTiles = activePruneTiles;
246
+ }
247
+ };
248
+ const keepFailedChildrenInactive = () => {
249
+ for (const tile of Object.values(layer._tiles)) {
250
+ if (tile.progressiveLoadFailed)
251
+ tile.active = false;
252
+ }
253
+ };
254
+ layer._tileReady = (coords, error, tile) => {
255
+ const tileRecord = layer._tiles[layer._tileCoordsToKey(coords)];
256
+ if (!error) {
257
+ if (tileRecord)
258
+ tileRecord.progressiveLoadFailed = false;
259
+ finishTile(coords, error, tile);
260
+ return;
261
+ }
262
+ withoutPruning(() => finishTile(coords, error, tile));
263
+ if (tileRecord) {
264
+ tileRecord.progressiveLoadFailed = true;
265
+ tileRecord.active = false;
266
+ }
267
+ pruneTiles();
268
+ };
269
+ layer._updateOpacity = () => {
270
+ withoutPruning(updateOpacity);
271
+ keepFailedChildrenInactive();
272
+ pruneTiles();
273
+ };
274
+ }
275
+
276
+ function isRecord$1(value) {
277
+ return typeof value === 'object' && value !== null;
278
+ }
279
+ function parseBoundsInput(bounds) {
280
+ if (typeof bounds !== 'string')
281
+ return { parsed: bounds, invalidJson: false };
282
+ if (!bounds.trim())
283
+ return { parsed: undefined, invalidJson: false };
284
+ try {
285
+ return { parsed: JSON.parse(bounds), invalidJson: false };
286
+ }
287
+ catch {
288
+ return { invalidJson: true };
289
+ }
290
+ }
291
+ function isLatitude(value) {
292
+ return typeof value === 'number' && Number.isFinite(value) && value >= -90 && value <= 90;
293
+ }
294
+ function isLongitude(value) {
295
+ return typeof value === 'number' && Number.isFinite(value) && value >= -180 && value <= 180;
296
+ }
297
+ function resolveMapBounds(input) {
298
+ const { parsed: bounds, invalidJson } = parseBoundsInput(input);
299
+ if (invalidJson)
300
+ return { kind: 'invalid', message: 'maxBounds must be valid JSON or a bounds object.' };
301
+ if (bounds === undefined)
302
+ return { kind: 'clear' };
303
+ if (!isRecord$1(bounds))
304
+ return { kind: 'invalid', message: 'maxBounds must be a bounds object.' };
305
+ const { southLatitude, westLongitude, northLatitude, eastLongitude } = bounds;
306
+ if (!isLatitude(southLatitude) || !isLatitude(northLatitude)) {
307
+ return { kind: 'invalid', message: 'maxBounds latitude values must be finite numbers from -90 to 90.' };
308
+ }
309
+ if (!isLongitude(westLongitude) || !isLongitude(eastLongitude)) {
310
+ return { kind: 'invalid', message: 'maxBounds longitude values must be finite numbers from -180 to 180.' };
311
+ }
312
+ if (southLatitude >= northLatitude) {
313
+ return { kind: 'invalid', message: 'maxBounds southLatitude must be below northLatitude.' };
314
+ }
315
+ if (westLongitude >= eastLongitude) {
316
+ return { kind: 'invalid', message: 'maxBounds westLongitude must be below eastLongitude; antimeridian-crossing bounds are not supported.' };
317
+ }
318
+ const normalized = { southLatitude, westLongitude, northLatitude, eastLongitude };
319
+ return {
320
+ kind: 'valid',
321
+ bounds: normalized,
322
+ leafletBounds: [
323
+ [normalized.southLatitude, normalized.westLongitude],
324
+ [normalized.northLatitude, normalized.eastLongitude],
325
+ ],
326
+ };
327
+ }
328
+ function getInitialLeafletMapBounds(resolution) {
329
+ return resolution.kind === 'valid' ? resolution.leafletBounds : undefined;
330
+ }
331
+ function getMapBoundsViscosity(value) {
332
+ const viscosity = Number.isFinite(value) ? value : 1;
333
+ return Math.max(0, Math.min(1, viscosity));
334
+ }
335
+ function applyMapBounds(map, resolution, viscosity) {
336
+ map.options.maxBoundsViscosity = getMapBoundsViscosity(viscosity);
337
+ if (resolution.kind === 'invalid')
338
+ return false;
339
+ map.setMaxBounds(resolution.kind === 'valid' ? resolution.leafletBounds : undefined);
340
+ return true;
341
+ }
342
+
343
+ const GOOGLE_MAPS_VERSION = 'quarterly';
344
+ const GOOGLE_MAPS_SCRIPT_URL = 'https://maps.googleapis.com/maps/api/js';
345
+ let configuredApiKey;
346
+ let googleMapsLoadPromise;
347
+ let callbackSequence = 0;
348
+ /** Returns whether the Maps JavaScript API has exposed the constructor GoogleMutant needs. */
349
+ function hasGoogleMapsApi() {
350
+ if (typeof window === 'undefined')
351
+ return false;
352
+ return typeof window.google?.maps?.Map === 'function';
353
+ }
354
+ /** Returns whether Google Maps is loaded or exposes an application-owned library importer. */
355
+ function hasGoogleMapsConfiguration() {
356
+ if (hasGoogleMapsApi())
357
+ return true;
358
+ if (typeof window === 'undefined')
359
+ return false;
360
+ return typeof window.google?.maps?.importLibrary === 'function';
361
+ }
362
+ /**
363
+ * Loads Google Maps once per browser realm, reusing an application-owned API
364
+ * and allowing a fresh key after a failed WebQuark-owned script attempt.
365
+ */
366
+ function loadGoogleMapsApi(apiKey) {
367
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
368
+ return Promise.reject(new Error('QMap: Google Maps is only available in a browser environment.'));
369
+ }
370
+ if (hasGoogleMapsApi())
371
+ return Promise.resolve();
372
+ const normalizedApiKey = apiKey.trim();
373
+ const externalImporter = window.google?.maps?.importLibrary;
374
+ if (googleMapsLoadPromise) {
375
+ if (configuredApiKey && normalizedApiKey && configuredApiKey !== normalizedApiKey) {
376
+ return Promise.reject(new Error('QMap: Google Maps is already loading with a different API key.'));
377
+ }
378
+ return googleMapsLoadPromise;
379
+ }
380
+ if (externalImporter) {
381
+ googleMapsLoadPromise = loadWithExternalImporter(externalImporter);
382
+ return googleMapsLoadPromise;
383
+ }
384
+ if (!normalizedApiKey)
385
+ return Promise.reject(new Error('QMap: A Google Maps API key is required.'));
386
+ configuredApiKey = normalizedApiKey;
387
+ googleMapsLoadPromise = loadWithScript(normalizedApiKey).catch((cause) => {
388
+ configuredApiKey = undefined;
389
+ googleMapsLoadPromise = undefined;
390
+ throw new Error('QMap: Google Maps failed to load.', { cause });
391
+ });
392
+ return googleMapsLoadPromise;
393
+ }
394
+ function loadWithExternalImporter(importLibrary) {
395
+ googleMapsLoadPromise = importLibrary('maps')
396
+ .then(() => assertGoogleMapsApi())
397
+ .catch((cause) => {
398
+ googleMapsLoadPromise = undefined;
399
+ throw new Error('QMap: Google Maps failed to load.', { cause });
400
+ });
401
+ return googleMapsLoadPromise;
402
+ }
403
+ function loadWithScript(apiKey) {
404
+ const targetWindow = window;
405
+ const previousGoogle = targetWindow.google;
406
+ const previousMaps = previousGoogle?.maps;
407
+ const callbackName = `__webquarkGoogleMapsReady${++callbackSequence}`;
408
+ const callbackHost = targetWindow;
409
+ const script = document.createElement('script');
410
+ const params = new URLSearchParams({ callback: callbackName, key: apiKey, loading: 'async', v: GOOGLE_MAPS_VERSION });
411
+ script.async = true;
412
+ script.defer = true;
413
+ script.src = `${GOOGLE_MAPS_SCRIPT_URL}?${params.toString()}`;
414
+ script.dataset.webquarkGoogleMaps = 'true';
415
+ const nonce = document.querySelector('script[nonce]')?.nonce;
416
+ if (nonce)
417
+ script.nonce = nonce;
418
+ return new Promise((resolve, reject) => {
419
+ const cleanup = (failed) => {
420
+ delete callbackHost[callbackName];
421
+ script.onerror = null;
422
+ if (failed) {
423
+ script.remove();
424
+ restoreGoogleMapsNamespace(targetWindow, previousGoogle, previousMaps);
425
+ }
426
+ };
427
+ callbackHost[callbackName] = () => {
428
+ try {
429
+ assertGoogleMapsApi();
430
+ cleanup(false);
431
+ resolve();
432
+ }
433
+ catch (error) {
434
+ cleanup(true);
435
+ reject(error);
436
+ }
437
+ };
438
+ script.onerror = () => {
439
+ cleanup(true);
440
+ reject(new Error('The Google Maps script could not be loaded.'));
441
+ };
442
+ document.head.append(script);
443
+ });
444
+ }
445
+ function assertGoogleMapsApi() {
446
+ if (!hasGoogleMapsApi())
447
+ throw new Error('The Maps library loaded without exposing google.maps.Map.');
448
+ }
449
+ function restoreGoogleMapsNamespace(targetWindow, previousGoogle, previousMaps) {
450
+ if (!previousGoogle) {
451
+ delete targetWindow.google;
452
+ return;
453
+ }
454
+ targetWindow.google = previousGoogle;
455
+ if (previousMaps)
456
+ previousGoogle.maps = previousMaps;
457
+ else
458
+ delete previousGoogle.maps;
459
+ }
460
+
461
+ let googleMutantConstructorPromise;
462
+ /**
463
+ * Lazily loads GoogleMutant's ESM constructor without leaving Leaflet on the
464
+ * global object.
465
+ *
466
+ * GoogleMutant 0.16.0's ESM file still executes its legacy `L.gridLayer`
467
+ * factory footer. Supplying the exact ESM Leaflet namespace during module
468
+ * evaluation avoids its `L is not defined` error; both incidental globals are
469
+ * restored immediately afterwards. Consumers must instantiate the returned
470
+ * default constructor rather than the legacy factory, whose ESM registration
471
+ * is incomplete in 0.16.0.
472
+ */
473
+ function loadGoogleMutantConstructor(leaflet) {
474
+ if (!googleMutantConstructorPromise) {
475
+ googleMutantConstructorPromise = importGoogleMutantConstructor(leaflet).catch((error) => {
476
+ googleMutantConstructorPromise = undefined;
477
+ throw error;
478
+ });
479
+ }
480
+ return googleMutantConstructorPromise;
481
+ }
482
+ async function importGoogleMutantConstructor(leaflet) {
483
+ if (typeof window === 'undefined') {
484
+ throw new Error('QMap: GoogleMutant is only available in a browser environment.');
485
+ }
486
+ const globals = globalThis;
487
+ const factoryHost = leaflet.gridLayer;
488
+ const hasOwn = Object.prototype.hasOwnProperty;
489
+ const hadLeafletGlobal = hasOwn.call(globals, 'L');
490
+ const previousLeafletGlobal = globals.L;
491
+ const hadGoogleMutantFactory = hasOwn.call(factoryHost, 'googleMutant');
492
+ const previousGoogleMutantFactory = factoryHost.googleMutant;
493
+ globals.L = leaflet;
494
+ try {
495
+ const module = await Promise.resolve().then(function () { return require('./Leaflet.GoogleMutant-BCs2oiE0.js'); });
496
+ if (typeof module.default !== 'function') {
497
+ throw new Error('QMap: GoogleMutant did not expose its default constructor.');
498
+ }
499
+ return module.default;
500
+ }
501
+ finally {
502
+ if (hadGoogleMutantFactory)
503
+ factoryHost.googleMutant = previousGoogleMutantFactory;
504
+ else
505
+ delete factoryHost.googleMutant;
506
+ if (hadLeafletGlobal)
507
+ globals.L = previousLeafletGlobal;
508
+ else
509
+ delete globals.L;
510
+ }
511
+ }
512
+
513
+ const VECTOR_STYLE_LOAD_TIMEOUT_MS = 15_000;
514
+ let mapLibreLayerFactoryPromise;
515
+ /** Lazily loads MapLibre's Leaflet adapter and returns its registered layer factory. */
516
+ function loadMapLibreLayerFactory(leaflet) {
517
+ if (!mapLibreLayerFactoryPromise) {
518
+ mapLibreLayerFactoryPromise = importMapLibreLayerFactory(leaflet).catch((error) => {
519
+ mapLibreLayerFactoryPromise = undefined;
520
+ throw error;
521
+ });
522
+ }
523
+ return mapLibreLayerFactoryPromise;
524
+ }
525
+ async function importMapLibreLayerFactory(leaflet) {
526
+ if (typeof window === 'undefined') {
527
+ throw new Error('QMap: the vector provider is only available in a browser environment.');
528
+ }
529
+ await Promise.resolve().then(function () { return require('./leaflet-maplibre-gl-RCEffFEM.js'); }).then(function (n) { return n.leafletMaplibreGl; });
530
+ const factory = leaflet.maplibreGL;
531
+ if (typeof factory !== 'function') {
532
+ throw new Error('QMap: MapLibre did not register its Leaflet layer factory.');
533
+ }
534
+ return factory;
535
+ }
536
+ /** Waits until the vector style has loaded so provider fallback remains transactional. */
537
+ function waitForMapLibreLayerReady(layer) {
538
+ const getMaplibreMap = layer.getMaplibreMap;
539
+ if (typeof getMaplibreMap !== 'function') {
540
+ return Promise.reject(new Error('QMap: the vector layer did not expose its MapLibre map.'));
541
+ }
542
+ const map = getMaplibreMap.call(layer);
543
+ if (map.loaded())
544
+ return Promise.resolve();
545
+ return new Promise((resolve, reject) => {
546
+ const handleLoad = () => finish(resolve);
547
+ const handleError = (event) => {
548
+ finish(() => reject(event.error ?? new Error('QMap: the vector style failed to load.')));
549
+ };
550
+ const timeout = window.setTimeout(() => {
551
+ finish(() => reject(new Error('QMap: the vector style timed out while loading.')));
552
+ }, VECTOR_STYLE_LOAD_TIMEOUT_MS);
553
+ const finish = (complete) => {
554
+ window.clearTimeout(timeout);
555
+ map.off('load', handleLoad);
556
+ map.off('error', handleError);
557
+ complete();
558
+ };
559
+ map.on('load', handleLoad);
560
+ map.on('error', handleError);
561
+ });
562
+ }
563
+
564
+ const ARRAY_TYPES = [
565
+ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,
566
+ Int32Array, Uint32Array, Float32Array, Float64Array
567
+ ];
568
+
569
+ /** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */
570
+ /** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array} TypedArray */
571
+
572
+ const VERSION = 1; // serialized format version
573
+ const HEADER_SIZE = 8;
574
+
575
+ // Shared scratch stack for iterative DFS in range/within. Sized for the worst case:
576
+ // 3 ints per frame * (treeHeight + 1), with treeHeight ≤ ceil(log2(2^32 / 3)) ≈ 31.
577
+ const STACK = new Uint32Array(96);
578
+
579
+ class KDBush {
580
+
581
+ /**
582
+ * Creates an index from raw `ArrayBuffer` data.
583
+ * @param {ArrayBufferLike} data
584
+ */
585
+ static from(data) {
586
+ // @ts-expect-error duck typing array buffers
587
+ if (!data || data.byteLength === undefined || data.buffer) {
588
+ throw new Error('Data must be an instance of ArrayBuffer or SharedArrayBuffer.');
589
+ }
590
+ const [magic, versionAndType] = new Uint8Array(data, 0, 2);
591
+ if (magic !== 0xdb) {
592
+ throw new Error('Data does not appear to be in a KDBush format.');
593
+ }
594
+ const version = versionAndType >> 4;
595
+ if (version !== VERSION) {
596
+ throw new Error(`Got v${version} data when expected v${VERSION}.`);
597
+ }
598
+ const ArrayType = ARRAY_TYPES[versionAndType & 0x0f];
599
+ if (!ArrayType) {
600
+ throw new Error('Unrecognized array type.');
601
+ }
602
+ const [nodeSize] = new Uint16Array(data, 2, 1);
603
+ const [numItems] = new Uint32Array(data, 4, 1);
604
+
605
+ return new KDBush(numItems, nodeSize, ArrayType, undefined, data);
606
+ }
607
+
608
+ /**
609
+ * Creates an index that will hold a given number of items.
610
+ * @param {number} numItems
611
+ * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
612
+ * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
613
+ * @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used for storage (`ArrayBuffer` by default).
614
+ * @param {ArrayBufferLike} [data] (For internal use only)
615
+ */
616
+ constructor(numItems, nodeSize = 64, ArrayType = Float64Array, ArrayBufferType = ArrayBuffer, data) {
617
+ if (isNaN(numItems) || numItems < 0) throw new Error(`Unexpected numItems value: ${numItems}.`);
618
+
619
+ this.numItems = +numItems;
620
+ this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
621
+ this.ArrayType = ArrayType;
622
+ this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
623
+
624
+ const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);
625
+ const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT;
626
+ const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT;
627
+ const padCoords = (8 - idsByteSize % 8) % 8;
628
+
629
+ if (arrayTypeIndex < 0) {
630
+ throw new Error(`Unexpected typed array class: ${ArrayType}.`);
631
+ }
632
+
633
+ if (data) { // reconstruct an index from a buffer
634
+ this.data = data;
635
+ // @ts-expect-error TS can't handle SharedArrayBuffer overloads
636
+ this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
637
+ // @ts-expect-error TS can't handle SharedArrayBuffer overloads
638
+ this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
639
+ this._pos = numItems * 2;
640
+ this._finished = true;
641
+
642
+ } else { // initialize a new index
643
+ const data = this.data = new ArrayBufferType(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords);
644
+ // @ts-expect-error TS can't handle SharedArrayBuffer overloads
645
+ this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
646
+ // @ts-expect-error TS can't handle SharedArrayBuffer overloads
647
+ this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
648
+ this._pos = 0;
649
+ this._finished = false;
650
+
651
+ // set header
652
+ new Uint8Array(data, 0, 2).set([0xdb, (VERSION << 4) + arrayTypeIndex]);
653
+ new Uint16Array(data, 2, 1)[0] = nodeSize;
654
+ new Uint32Array(data, 4, 1)[0] = numItems;
655
+ }
656
+ }
657
+
658
+ /**
659
+ * Add a point to the index.
660
+ * @param {number} x
661
+ * @param {number} y
662
+ * @returns {number} An incremental index associated with the added item (starting from `0`).
663
+ */
664
+ add(x, y) {
665
+ const index = this._pos >> 1;
666
+ this.ids[index] = index;
667
+ this.coords[this._pos++] = x;
668
+ this.coords[this._pos++] = y;
669
+ return index;
670
+ }
671
+
672
+ /**
673
+ * Perform indexing of the added points.
674
+ */
675
+ finish() {
676
+ const numAdded = this._pos >> 1;
677
+ if (numAdded !== this.numItems) {
678
+ throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
679
+ }
680
+ // kd-sort both arrays for efficient search
681
+ sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0);
682
+
683
+ this._finished = true;
684
+ return this;
685
+ }
686
+
687
+ /**
688
+ * Search the index for items within a given bounding box.
689
+ * @param {number} minX
690
+ * @param {number} minY
691
+ * @param {number} maxX
692
+ * @param {number} maxY
693
+ * @returns {number[]} An array of indices correponding to the found items.
694
+ */
695
+ range(minX, minY, maxX, maxY) {
696
+ if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');
697
+
698
+ const {ids, coords, nodeSize} = this;
699
+ STACK[0] = 0;
700
+ STACK[1] = ids.length - 1;
701
+ STACK[2] = 0;
702
+ let sp = 3;
703
+ const result = [];
704
+
705
+ // recursively search for items in range in the kd-sorted arrays
706
+ while (sp > 0) {
707
+ const axis = STACK[--sp];
708
+ const right = STACK[--sp];
709
+ const left = STACK[--sp];
710
+
711
+ // if we reached "tree node", search linearly
712
+ if (right - left <= nodeSize) {
713
+ for (let i = left; i <= right; i++) {
714
+ const x = coords[2 * i];
715
+ const y = coords[2 * i + 1];
716
+ if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);
717
+ }
718
+ continue;
719
+ }
720
+
721
+ // otherwise find the middle index
722
+ const m = (left + right) >> 1;
723
+
724
+ // include the middle item if it's in range
725
+ const x = coords[2 * m];
726
+ const y = coords[2 * m + 1];
727
+ if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);
728
+
729
+ // queue search in halves that intersect the query
730
+ if (axis === 0 ? minX <= x : minY <= y) {
731
+ STACK[sp++] = left;
732
+ STACK[sp++] = m - 1;
733
+ STACK[sp++] = 1 - axis;
734
+ }
735
+ if (axis === 0 ? maxX >= x : maxY >= y) {
736
+ STACK[sp++] = m + 1;
737
+ STACK[sp++] = right;
738
+ STACK[sp++] = 1 - axis;
739
+ }
740
+ }
741
+
742
+ return result;
743
+ }
744
+
745
+ /**
746
+ * Search the index for items within a given radius.
747
+ * @param {number} qx
748
+ * @param {number} qy
749
+ * @param {number} r Query radius.
750
+ * @returns {number[]} An array of indices correponding to the found items.
751
+ */
752
+ within(qx, qy, r) {
753
+ const result = /** @type {number[]} */ ([]);
754
+ this.withinInto(qx, qy, r, result);
755
+ return result;
756
+ }
757
+
758
+ /**
759
+ * Search the index for items within a given radius, writing matching ids into `out`
760
+ * via indexed assignment (`out[i] = id`). Accepts any indexed-writable container —
761
+ * a typed array sized to the expected upper bound (allocation-free, fast) or a plain
762
+ * `Array` (which will grow as needed). Returns the number of matches written.
763
+ * @param {number} qx
764
+ * @param {number} qy
765
+ * @param {number} r Query radius.
766
+ * @param {number[] | TypedArray} out Container to write matching ids into.
767
+ * @returns {number} The number of matches written to `out`.
768
+ */
769
+ withinInto(qx, qy, r, out) {
770
+ if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');
771
+
772
+ const {ids, coords, nodeSize} = this;
773
+ STACK[0] = 0;
774
+ STACK[1] = ids.length - 1;
775
+ STACK[2] = 0;
776
+ let sp = 3;
777
+ let count = 0;
778
+ const r2 = r * r;
779
+
780
+ // recursively search for items within radius in the kd-sorted arrays
781
+ while (sp > 0) {
782
+ const axis = STACK[--sp];
783
+ const right = STACK[--sp];
784
+ const left = STACK[--sp];
785
+
786
+ // if we reached "tree node", search linearly
787
+ if (right - left <= nodeSize) {
788
+ for (let i = left; i <= right; i++) {
789
+ if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) out[count++] = ids[i];
790
+ }
791
+ continue;
792
+ }
793
+
794
+ // otherwise find the middle index
795
+ const m = (left + right) >> 1;
796
+
797
+ // include the middle item if it's in range
798
+ const x = coords[2 * m];
799
+ const y = coords[2 * m + 1];
800
+ if (sqDist(x, y, qx, qy) <= r2) out[count++] = ids[m];
801
+
802
+ // queue search in halves that intersect the query
803
+ if (axis === 0 ? qx - r <= x : qy - r <= y) {
804
+ STACK[sp++] = left;
805
+ STACK[sp++] = m - 1;
806
+ STACK[sp++] = 1 - axis;
807
+ }
808
+ if (axis === 0 ? qx + r >= x : qy + r >= y) {
809
+ STACK[sp++] = m + 1;
810
+ STACK[sp++] = right;
811
+ STACK[sp++] = 1 - axis;
812
+ }
813
+ }
814
+
815
+ return count;
816
+ }
817
+ }
818
+
819
+ /**
820
+ * @param {Uint16Array | Uint32Array} ids
821
+ * @param {TypedArray} coords
822
+ * @param {number} nodeSize
823
+ * @param {number} left
824
+ * @param {number} right
825
+ * @param {number} axis
826
+ */
827
+ function sort(ids, coords, nodeSize, left, right, axis) {
828
+ if (right - left <= nodeSize) return;
829
+
830
+ const m = (left + right) >> 1; // middle index
831
+
832
+ // sort ids and coords around the middle index so that the halves lie
833
+ // either left/right or top/bottom correspondingly (taking turns)
834
+ select(ids, coords, m, left, right, axis);
835
+
836
+ // recursively kd-sort first half and second half on the opposite axis
837
+ sort(ids, coords, nodeSize, left, m - 1, 1 - axis);
838
+ sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
839
+ }
840
+
841
+ /**
842
+ * Custom Floyd-Rivest selection algorithm: sort ids and coords so that
843
+ * [left..k-1] items are smaller than k-th item (on either x or y axis)
844
+ * @param {Uint16Array | Uint32Array} ids
845
+ * @param {TypedArray} coords
846
+ * @param {number} k
847
+ * @param {number} left
848
+ * @param {number} right
849
+ * @param {number} axis
850
+ */
851
+ function select(ids, coords, k, left, right, axis) {
852
+
853
+ while (right > left) {
854
+ if (right - left > 600) {
855
+ const n = right - left + 1;
856
+ const m = k - left + 1;
857
+ const z = Math.log(n);
858
+ const s = 0.5 * Math.exp(2 * z / 3);
859
+ const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
860
+ const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
861
+ const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
862
+ select(ids, coords, k, newLeft, newRight, axis);
863
+ }
864
+
865
+ const t = coords[2 * k + axis];
866
+ let i = left;
867
+ let j = right;
868
+
869
+ swapItem(ids, coords, left, k);
870
+ if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);
871
+
872
+ while (i < j) {
873
+ swapItem(ids, coords, i, j);
874
+ i++;
875
+ j--;
876
+ while (coords[2 * i + axis] < t) i++;
877
+ while (coords[2 * j + axis] > t) j--;
878
+ }
879
+
880
+ if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
881
+ else {
882
+ j++;
883
+ swapItem(ids, coords, j, right);
884
+ }
885
+
886
+ if (j <= k) left = j + 1;
887
+ if (k <= j) right = j - 1;
888
+ }
889
+ }
890
+
891
+ /**
892
+ * @param {Uint16Array | Uint32Array} ids
893
+ * @param {TypedArray} coords
894
+ * @param {number} i
895
+ * @param {number} j
896
+ */
897
+ function swapItem(ids, coords, i, j) {
898
+ swap(ids, i, j);
899
+ swap(coords, 2 * i, 2 * j);
900
+ swap(coords, 2 * i + 1, 2 * j + 1);
901
+ }
902
+
903
+ /**
904
+ * @param {TypedArray} arr
905
+ * @param {number} i
906
+ * @param {number} j
907
+ */
908
+ function swap(arr, i, j) {
909
+ const tmp = arr[i];
910
+ arr[i] = arr[j];
911
+ arr[j] = tmp;
912
+ }
913
+
914
+ /**
915
+ * @param {number} ax
916
+ * @param {number} ay
917
+ * @param {number} bx
918
+ * @param {number} by
919
+ */
920
+ function sqDist(ax, ay, bx, by) {
921
+ const dx = ax - bx;
922
+ const dy = ay - by;
923
+ return dx * dx + dy * dy;
924
+ }
925
+
926
+ const defaultOptions = {
927
+ minZoom: 0, // min zoom to generate clusters on
928
+ maxZoom: 16, // max zoom level to cluster the points on
929
+ minPoints: 2, // minimum points to form a cluster
930
+ radius: 40, // cluster radius in pixels
931
+ extent: 512, // tile extent (radius is calculated relative to it)
932
+ nodeSize: 64, // size of the KD-tree leaf node, affects performance
933
+ log: false, // whether to log timing info
934
+
935
+ // whether to generate numeric ids for input features (in vector tiles)
936
+ generateId: false,
937
+
938
+ // a reduce function for calculating custom cluster properties
939
+ reduce: null, // (accumulated, props) => { accumulated.sum += props.sum; }
940
+
941
+ // properties to use for individual points when running the reducer
942
+ map: props => props // props => ({sum: props.my_value})
943
+ };
944
+
945
+ const fround = Math.fround || (tmp => ((x) => { tmp[0] = +x; return tmp[0]; }))(new Float32Array(1));
946
+
947
+ const OFFSET_ZOOM = 2;
948
+ const OFFSET_ID = 3;
949
+ const OFFSET_PARENT = 4;
950
+ const OFFSET_NUM = 5;
951
+ const OFFSET_PROP = 6;
952
+
953
+ class Supercluster {
954
+ constructor(options) {
955
+ this.options = Object.assign(Object.create(defaultOptions), options);
956
+ this.trees = new Array(this.options.maxZoom + 1);
957
+ this.stride = this.options.reduce ? 7 : 6;
958
+ this.clusterProps = [];
959
+ }
960
+
961
+ load(points) {
962
+ const {log, minZoom, maxZoom} = this.options;
963
+
964
+ if (log) console.time('total time');
965
+
966
+ const timerId = `prepare ${ points.length } points`;
967
+ if (log) console.time(timerId);
968
+
969
+ this.points = points;
970
+
971
+ // generate a cluster object for each point and index input points into a KD-tree
972
+ const data = [];
973
+
974
+ for (let i = 0; i < points.length; i++) {
975
+ const p = points[i];
976
+ if (!p.geometry) continue;
977
+
978
+ const [lng, lat] = p.geometry.coordinates;
979
+ const x = fround(lngX(lng));
980
+ const y = fround(latY(lat));
981
+ // store internal point/cluster data in flat numeric arrays for performance
982
+ data.push(
983
+ x, y, // projected point coordinates
984
+ Infinity, // the last zoom the point was processed at
985
+ i, // index of the source feature in the original input array
986
+ -1, // parent cluster id
987
+ 1 // number of points in a cluster
988
+ );
989
+ if (this.options.reduce) data.push(0); // noop
990
+ }
991
+ let tree = this.trees[maxZoom + 1] = this._createTree(data);
992
+
993
+ if (log) console.timeEnd(timerId);
994
+
995
+ // cluster points on max zoom, then cluster the results on previous zoom, etc.;
996
+ // results in a cluster hierarchy across zoom levels
997
+ for (let z = maxZoom; z >= minZoom; z--) {
998
+ const now = +Date.now();
999
+
1000
+ // create a new set of clusters for the zoom and index them with a KD-tree
1001
+ tree = this.trees[z] = this._createTree(this._cluster(tree, z));
1002
+
1003
+ if (log) console.log('z%d: %d clusters in %dms', z, tree.numItems, +Date.now() - now);
1004
+ }
1005
+
1006
+ if (log) console.timeEnd('total time');
1007
+
1008
+ return this;
1009
+ }
1010
+
1011
+ getClusters(bbox, zoom) {
1012
+ let minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180;
1013
+ const minLat = Math.max(-90, Math.min(90, bbox[1]));
1014
+ let maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180;
1015
+ const maxLat = Math.max(-90, Math.min(90, bbox[3]));
1016
+
1017
+ if (bbox[2] - bbox[0] >= 360) {
1018
+ minLng = -180;
1019
+ maxLng = 180;
1020
+ } else if (minLng > maxLng) {
1021
+ const easternHem = this.getClusters([minLng, minLat, 180, maxLat], zoom);
1022
+ const westernHem = this.getClusters([-180, minLat, maxLng, maxLat], zoom);
1023
+ return easternHem.concat(westernHem);
1024
+ }
1025
+
1026
+ const tree = this.trees[this._limitZoom(zoom)];
1027
+ const ids = tree.range(lngX(minLng), latY(maxLat), lngX(maxLng), latY(minLat));
1028
+ const data = tree.data;
1029
+ const clusters = [];
1030
+ for (const id of ids) {
1031
+ const k = this.stride * id;
1032
+ clusters.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]);
1033
+ }
1034
+ return clusters;
1035
+ }
1036
+
1037
+ getChildren(clusterId) {
1038
+ const originId = this._getOriginId(clusterId);
1039
+ const originZoom = this._getOriginZoom(clusterId);
1040
+ const errorMsg = 'No cluster with the specified id.';
1041
+
1042
+ const tree = this.trees[originZoom];
1043
+ if (!tree) throw new Error(errorMsg);
1044
+
1045
+ const data = tree.data;
1046
+ if (originId * this.stride >= data.length) throw new Error(errorMsg);
1047
+
1048
+ const r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1));
1049
+ const x = data[originId * this.stride];
1050
+ const y = data[originId * this.stride + 1];
1051
+ const ids = tree.within(x, y, r);
1052
+ const children = [];
1053
+ for (const id of ids) {
1054
+ const k = id * this.stride;
1055
+ if (data[k + OFFSET_PARENT] === clusterId) {
1056
+ children.push(data[k + OFFSET_NUM] > 1 ? getClusterJSON(data, k, this.clusterProps) : this.points[data[k + OFFSET_ID]]);
1057
+ }
1058
+ }
1059
+
1060
+ if (children.length === 0) throw new Error(errorMsg);
1061
+
1062
+ return children;
1063
+ }
1064
+
1065
+ getLeaves(clusterId, limit, offset) {
1066
+ limit = limit || 10;
1067
+ offset = offset || 0;
1068
+
1069
+ const leaves = [];
1070
+ this._appendLeaves(leaves, clusterId, limit, offset, 0);
1071
+
1072
+ return leaves;
1073
+ }
1074
+
1075
+ getTile(z, x, y) {
1076
+ const tree = this.trees[this._limitZoom(z)];
1077
+ const z2 = Math.pow(2, z);
1078
+ const {extent, radius} = this.options;
1079
+ const p = radius / extent;
1080
+ const top = (y - p) / z2;
1081
+ const bottom = (y + 1 + p) / z2;
1082
+
1083
+ const tile = {
1084
+ features: []
1085
+ };
1086
+
1087
+ this._addTileFeatures(
1088
+ tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom),
1089
+ tree.data, x, y, z2, tile);
1090
+
1091
+ if (x === 0) {
1092
+ this._addTileFeatures(
1093
+ tree.range(1 - p / z2, top, 1, bottom),
1094
+ tree.data, z2, y, z2, tile);
1095
+ }
1096
+ if (x === z2 - 1) {
1097
+ this._addTileFeatures(
1098
+ tree.range(0, top, p / z2, bottom),
1099
+ tree.data, -1, y, z2, tile);
1100
+ }
1101
+
1102
+ return tile.features.length ? tile : null;
1103
+ }
1104
+
1105
+ getClusterExpansionZoom(clusterId) {
1106
+ let expansionZoom = this._getOriginZoom(clusterId) - 1;
1107
+ while (expansionZoom <= this.options.maxZoom) {
1108
+ const children = this.getChildren(clusterId);
1109
+ expansionZoom++;
1110
+ if (children.length !== 1) break;
1111
+ clusterId = children[0].properties.cluster_id;
1112
+ }
1113
+ return expansionZoom;
1114
+ }
1115
+
1116
+ _appendLeaves(result, clusterId, limit, offset, skipped) {
1117
+ const children = this.getChildren(clusterId);
1118
+
1119
+ for (const child of children) {
1120
+ const props = child.properties;
1121
+
1122
+ if (props && props.cluster) {
1123
+ if (skipped + props.point_count <= offset) {
1124
+ // skip the whole cluster
1125
+ skipped += props.point_count;
1126
+ } else {
1127
+ // enter the cluster
1128
+ skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped);
1129
+ // exit the cluster
1130
+ }
1131
+ } else if (skipped < offset) {
1132
+ // skip a single point
1133
+ skipped++;
1134
+ } else {
1135
+ // add a single point
1136
+ result.push(child);
1137
+ }
1138
+ if (result.length === limit) break;
1139
+ }
1140
+
1141
+ return skipped;
1142
+ }
1143
+
1144
+ _createTree(data) {
1145
+ const tree = new KDBush(data.length / this.stride | 0, this.options.nodeSize, Float32Array);
1146
+ for (let i = 0; i < data.length; i += this.stride) tree.add(data[i], data[i + 1]);
1147
+ tree.finish();
1148
+ tree.data = data;
1149
+ return tree;
1150
+ }
1151
+
1152
+ _addTileFeatures(ids, data, x, y, z2, tile) {
1153
+ for (const i of ids) {
1154
+ const k = i * this.stride;
1155
+ const isCluster = data[k + OFFSET_NUM] > 1;
1156
+
1157
+ let tags, px, py;
1158
+ if (isCluster) {
1159
+ tags = getClusterProperties(data, k, this.clusterProps);
1160
+ px = data[k];
1161
+ py = data[k + 1];
1162
+ } else {
1163
+ const p = this.points[data[k + OFFSET_ID]];
1164
+ tags = p.properties;
1165
+ const [lng, lat] = p.geometry.coordinates;
1166
+ px = lngX(lng);
1167
+ py = latY(lat);
1168
+ }
1169
+
1170
+ const f = {
1171
+ type: 1,
1172
+ geometry: [[
1173
+ Math.round(this.options.extent * (px * z2 - x)),
1174
+ Math.round(this.options.extent * (py * z2 - y))
1175
+ ]],
1176
+ tags
1177
+ };
1178
+
1179
+ // assign id
1180
+ let id;
1181
+ if (isCluster || this.options.generateId) {
1182
+ // optionally generate id for points
1183
+ id = data[k + OFFSET_ID];
1184
+ } else {
1185
+ // keep id if already assigned
1186
+ id = this.points[data[k + OFFSET_ID]].id;
1187
+ }
1188
+
1189
+ if (id !== undefined) f.id = id;
1190
+
1191
+ tile.features.push(f);
1192
+ }
1193
+ }
1194
+
1195
+ _limitZoom(z) {
1196
+ return Math.max(this.options.minZoom, Math.min(Math.floor(+z), this.options.maxZoom + 1));
1197
+ }
1198
+
1199
+ _cluster(tree, zoom) {
1200
+ const {radius, extent, reduce, minPoints} = this.options;
1201
+ const r = radius / (extent * Math.pow(2, zoom));
1202
+ const data = tree.data;
1203
+ const nextData = [];
1204
+ const stride = this.stride;
1205
+
1206
+ // loop through each point
1207
+ for (let i = 0; i < data.length; i += stride) {
1208
+ // if we've already visited the point at this zoom level, skip it
1209
+ if (data[i + OFFSET_ZOOM] <= zoom) continue;
1210
+ data[i + OFFSET_ZOOM] = zoom;
1211
+
1212
+ // find all nearby points
1213
+ const x = data[i];
1214
+ const y = data[i + 1];
1215
+ const neighborIds = tree.within(data[i], data[i + 1], r);
1216
+
1217
+ const numPointsOrigin = data[i + OFFSET_NUM];
1218
+ let numPoints = numPointsOrigin;
1219
+
1220
+ // count the number of points in a potential cluster
1221
+ for (const neighborId of neighborIds) {
1222
+ const k = neighborId * stride;
1223
+ // filter out neighbors that are already processed
1224
+ if (data[k + OFFSET_ZOOM] > zoom) numPoints += data[k + OFFSET_NUM];
1225
+ }
1226
+
1227
+ // if there were neighbors to merge, and there are enough points to form a cluster
1228
+ if (numPoints > numPointsOrigin && numPoints >= minPoints) {
1229
+ let wx = x * numPointsOrigin;
1230
+ let wy = y * numPointsOrigin;
1231
+
1232
+ let clusterProperties;
1233
+ let clusterPropIndex = -1;
1234
+
1235
+ // encode both zoom and point index on which the cluster originated -- offset by total length of features
1236
+ const id = ((i / stride | 0) << 5) + (zoom + 1) + this.points.length;
1237
+
1238
+ for (const neighborId of neighborIds) {
1239
+ const k = neighborId * stride;
1240
+
1241
+ if (data[k + OFFSET_ZOOM] <= zoom) continue;
1242
+ data[k + OFFSET_ZOOM] = zoom; // save the zoom (so it doesn't get processed twice)
1243
+
1244
+ const numPoints2 = data[k + OFFSET_NUM];
1245
+ wx += data[k] * numPoints2; // accumulate coordinates for calculating weighted center
1246
+ wy += data[k + 1] * numPoints2;
1247
+
1248
+ data[k + OFFSET_PARENT] = id;
1249
+
1250
+ if (reduce) {
1251
+ if (!clusterProperties) {
1252
+ clusterProperties = this._map(data, i, true);
1253
+ clusterPropIndex = this.clusterProps.length;
1254
+ this.clusterProps.push(clusterProperties);
1255
+ }
1256
+ reduce(clusterProperties, this._map(data, k));
1257
+ }
1258
+ }
1259
+
1260
+ data[i + OFFSET_PARENT] = id;
1261
+ nextData.push(wx / numPoints, wy / numPoints, Infinity, id, -1, numPoints);
1262
+ if (reduce) nextData.push(clusterPropIndex);
1263
+
1264
+ } else { // left points as unclustered
1265
+ for (let j = 0; j < stride; j++) nextData.push(data[i + j]);
1266
+
1267
+ if (numPoints > 1) {
1268
+ for (const neighborId of neighborIds) {
1269
+ const k = neighborId * stride;
1270
+ if (data[k + OFFSET_ZOOM] <= zoom) continue;
1271
+ data[k + OFFSET_ZOOM] = zoom;
1272
+ for (let j = 0; j < stride; j++) nextData.push(data[k + j]);
1273
+ }
1274
+ }
1275
+ }
1276
+ }
1277
+
1278
+ return nextData;
1279
+ }
1280
+
1281
+ // get index of the point from which the cluster originated
1282
+ _getOriginId(clusterId) {
1283
+ return (clusterId - this.points.length) >> 5;
1284
+ }
1285
+
1286
+ // get zoom of the point from which the cluster originated
1287
+ _getOriginZoom(clusterId) {
1288
+ return (clusterId - this.points.length) % 32;
1289
+ }
1290
+
1291
+ _map(data, i, clone) {
1292
+ if (data[i + OFFSET_NUM] > 1) {
1293
+ const props = this.clusterProps[data[i + OFFSET_PROP]];
1294
+ return clone ? Object.assign({}, props) : props;
1295
+ }
1296
+ const original = this.points[data[i + OFFSET_ID]].properties;
1297
+ const result = this.options.map(original);
1298
+ return clone && result === original ? Object.assign({}, result) : result;
1299
+ }
1300
+ }
1301
+
1302
+ function getClusterJSON(data, i, clusterProps) {
1303
+ return {
1304
+ type: 'Feature',
1305
+ id: data[i + OFFSET_ID],
1306
+ properties: getClusterProperties(data, i, clusterProps),
1307
+ geometry: {
1308
+ type: 'Point',
1309
+ coordinates: [xLng(data[i]), yLat(data[i + 1])]
1310
+ }
1311
+ };
1312
+ }
1313
+
1314
+ function getClusterProperties(data, i, clusterProps) {
1315
+ const count = data[i + OFFSET_NUM];
1316
+ const abbrev =
1317
+ count >= 10000 ? `${Math.round(count / 1000) }k` :
1318
+ count >= 1000 ? `${Math.round(count / 100) / 10 }k` : count;
1319
+ const propIndex = data[i + OFFSET_PROP];
1320
+ const properties = propIndex === -1 ? {} : Object.assign({}, clusterProps[propIndex]);
1321
+ return Object.assign(properties, {
1322
+ cluster: true,
1323
+ cluster_id: data[i + OFFSET_ID],
1324
+ point_count: count,
1325
+ point_count_abbreviated: abbrev
1326
+ });
1327
+ }
1328
+
1329
+ // longitude/latitude to spherical mercator in [0..1] range
1330
+ function lngX(lng) {
1331
+ return lng / 360 + 0.5;
1332
+ }
1333
+ function latY(lat) {
1334
+ const sin = Math.sin(lat * Math.PI / 180);
1335
+ const y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);
1336
+ return y < 0 ? 0 : y > 1 ? 1 : y;
1337
+ }
1338
+
1339
+ // spherical mercator to longitude/latitude
1340
+ function xLng(x) {
1341
+ return (x - 0.5) * 360;
1342
+ }
1343
+ function yLat(y) {
1344
+ const y2 = (180 - y * 360) * Math.PI / 180;
1345
+ return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;
1346
+ }
1347
+
1348
+ const MARKER_VARIANTS = new Set(map_types.Q_MAP_MARKER_VARIANTS);
1349
+ const MARKER_KINDS = new Set(map_types.Q_MAP_MARKER_KINDS);
1350
+ const MARKER_RINGS = new Set(map_types.Q_MAP_MARKER_RINGS);
1351
+ const MARKER_SIZES = new Set(map_types.Q_MAP_MARKER_SIZES);
1352
+ const CALLOUT_PLACEMENTS = new Set(map_types.Q_MAP_MARKER_CALLOUT_PLACEMENTS);
1353
+ const CALLOUT_STAT_LAYOUTS = new Set(map_types.Q_MAP_MARKER_CALLOUT_STAT_LAYOUTS);
1354
+ const CALLOUT_VISIBILITIES = new Set(map_types.Q_MAP_MARKER_CALLOUT_VISIBILITIES);
1355
+ const MAX_CALLOUT_STATS = 6;
1356
+ function isRecord(value) {
1357
+ return typeof value === 'object' && value !== null;
1358
+ }
1359
+ function parseMarkerInput(markers) {
1360
+ if (Array.isArray(markers))
1361
+ return markers;
1362
+ try {
1363
+ const parsed = JSON.parse(markers);
1364
+ return Array.isArray(parsed) ? parsed : [];
1365
+ }
1366
+ catch {
1367
+ return [];
1368
+ }
1369
+ }
1370
+ function isMarkerId(value) {
1371
+ return (typeof value === 'string' && value.trim().length > 0) || (typeof value === 'number' && Number.isFinite(value));
1372
+ }
1373
+ function getMarkerVariant(value) {
1374
+ return typeof value === 'string' && MARKER_VARIANTS.has(value) ? value : 'default';
1375
+ }
1376
+ function getOptionalEnum(value, allowed) {
1377
+ return typeof value === 'string' && allowed.has(value) ? value : undefined;
1378
+ }
1379
+ function getOptionalText(value) {
1380
+ if (typeof value !== 'string')
1381
+ return undefined;
1382
+ const normalized = value.trim();
1383
+ return normalized.length > 0 ? normalized : undefined;
1384
+ }
1385
+ function getOptionalFiniteNumber(value) {
1386
+ return typeof value === 'number' && Number.isFinite(value)
1387
+ ? value
1388
+ : undefined;
1389
+ }
1390
+ function normalizeBadge(value) {
1391
+ if (!isRecord(value))
1392
+ return undefined;
1393
+ const ariaLabel = getOptionalText(value.ariaLabel);
1394
+ const icon = getOptionalText(value.icon);
1395
+ const text = getOptionalText(value.text);
1396
+ if (!ariaLabel || (!icon && !text))
1397
+ return undefined;
1398
+ return {
1399
+ ariaLabel,
1400
+ variant: getMarkerVariant(value.variant),
1401
+ ...(icon ? { icon } : {}),
1402
+ ...(text ? { text } : {}),
1403
+ };
1404
+ }
1405
+ function normalizeClusterGroup(value) {
1406
+ return getOptionalText(value) ?? map_types.Q_MAP_DEFAULT_CLUSTER_GROUP;
1407
+ }
1408
+ function getMapMarkerClusterGroup(marker) {
1409
+ return normalizeClusterGroup(marker.clusterGroup);
1410
+ }
1411
+ function normalizeCalloutStatus(value) {
1412
+ if (!isRecord(value))
1413
+ return undefined;
1414
+ const label = getOptionalText(value.label);
1415
+ if (!label)
1416
+ return undefined;
1417
+ return {
1418
+ label,
1419
+ variant: getMarkerVariant(value.variant),
1420
+ };
1421
+ }
1422
+ function normalizeCalloutStat(value) {
1423
+ if (!isRecord(value))
1424
+ return undefined;
1425
+ const label = getOptionalText(value.label);
1426
+ const statValue = typeof value.value === 'number' && Number.isFinite(value.value)
1427
+ ? value.value
1428
+ : getOptionalText(value.value);
1429
+ if (!label || statValue === undefined)
1430
+ return undefined;
1431
+ return {
1432
+ label,
1433
+ value: statValue,
1434
+ layout: getOptionalEnum(value.layout, CALLOUT_STAT_LAYOUTS) ?? 'compact',
1435
+ };
1436
+ }
1437
+ function normalizeCalloutStats(value) {
1438
+ if (!Array.isArray(value))
1439
+ return undefined;
1440
+ const stats = value
1441
+ .map(normalizeCalloutStat)
1442
+ .filter((stat) => stat !== undefined)
1443
+ .slice(0, MAX_CALLOUT_STATS);
1444
+ return stats.length > 0 ? stats : undefined;
1445
+ }
1446
+ function normalizeCallout(value) {
1447
+ if (!isRecord(value))
1448
+ return undefined;
1449
+ const title = getOptionalText(value.title);
1450
+ if (!title)
1451
+ return undefined;
1452
+ const subtitle = getOptionalText(value.subtitle);
1453
+ const meta = getOptionalText(value.meta);
1454
+ const stats = normalizeCalloutStats(value.stats);
1455
+ const status = normalizeCalloutStatus(value.status);
1456
+ const placement = getOptionalEnum(value.placement, CALLOUT_PLACEMENTS) ?? 'auto';
1457
+ const visibility = getOptionalEnum(value.visibility, CALLOUT_VISIBILITIES) ?? 'always';
1458
+ return {
1459
+ title,
1460
+ variant: getMarkerVariant(value.variant),
1461
+ placement,
1462
+ visibility,
1463
+ ...(subtitle ? { subtitle } : {}),
1464
+ ...(meta ? { meta } : {}),
1465
+ ...(stats ? { stats } : {}),
1466
+ ...(status ? { status } : {}),
1467
+ };
1468
+ }
1469
+ function normalizeMarker(value) {
1470
+ if (!isRecord(value) || !isMarkerId(value.id))
1471
+ return undefined;
1472
+ if (typeof value.latitude !== 'number' || !Number.isFinite(value.latitude) || value.latitude < -90 || value.latitude > 90)
1473
+ return undefined;
1474
+ if (typeof value.longitude !== 'number' || !Number.isFinite(value.longitude) || value.longitude < -180 || value.longitude > 180)
1475
+ return undefined;
1476
+ const label = typeof value.label === 'string' && value.label.trim().length > 0 ? value.label : String(value.id);
1477
+ const imageUrl = getOptionalText(value.imageUrl);
1478
+ const fallbackText = getOptionalText(value.fallbackText);
1479
+ const icon = getOptionalText(value.icon);
1480
+ const iconSize = getOptionalFiniteNumber(value.iconSize);
1481
+ const iconOffsetX = getOptionalFiniteNumber(value.iconOffsetX);
1482
+ const iconOffsetY = getOptionalFiniteNumber(value.iconOffsetY);
1483
+ const requestedKind = getOptionalEnum(value.kind, MARKER_KINDS);
1484
+ const kind = requestedKind === 'icon' && !icon ? 'dot' : requestedKind;
1485
+ const size = getOptionalEnum(value.size, MARKER_SIZES);
1486
+ const ring = getOptionalEnum(value.ring, MARKER_RINGS);
1487
+ const badge = normalizeBadge(value.badge);
1488
+ const callout = normalizeCallout(value.callout);
1489
+ return {
1490
+ id: value.id,
1491
+ latitude: value.latitude,
1492
+ longitude: value.longitude,
1493
+ label,
1494
+ clusterable: value.clusterable !== false,
1495
+ clusterGroup: normalizeClusterGroup(value.clusterGroup),
1496
+ variant: getMarkerVariant(value.variant),
1497
+ ...(imageUrl ? { imageUrl } : {}),
1498
+ ...(fallbackText ? { fallbackText } : {}),
1499
+ ...(kind ? { kind } : {}),
1500
+ ...(icon ? { icon } : {}),
1501
+ ...(iconSize !== undefined ? { iconSize } : {}),
1502
+ ...(iconOffsetX !== undefined ? { iconOffsetX } : {}),
1503
+ ...(iconOffsetY !== undefined ? { iconOffsetY } : {}),
1504
+ ...(size ? { size } : {}),
1505
+ ...(ring ? { ring } : {}),
1506
+ ...(value.pulse === true ? { pulse: true } : {}),
1507
+ ...(badge ? { badge } : {}),
1508
+ ...(callout ? { callout } : {}),
1509
+ };
1510
+ }
1511
+ function getMapMarkerKey(id) {
1512
+ return typeof id === 'number' ? `number:${id}` : `string:${id}`;
1513
+ }
1514
+ function getMapMarkers(markers) {
1515
+ const uniqueMarkers = new Map();
1516
+ for (const value of parseMarkerInput(markers)) {
1517
+ const marker = normalizeMarker(value);
1518
+ if (marker)
1519
+ uniqueMarkers.set(getMapMarkerKey(marker.id), marker);
1520
+ }
1521
+ return [...uniqueMarkers.values()];
1522
+ }
1523
+
1524
+ function clampInteger(value, minimum, maximum) {
1525
+ return Math.max(minimum, Math.min(maximum, Math.round(value)));
1526
+ }
1527
+ function normalizeMapMarkerClusteringOptions(enabled, radius, minPoints, requestedMaxZoom, mapMaxZoom) {
1528
+ const normalizedMapMaxZoom = Number.isFinite(mapMaxZoom) ? Math.max(0, Math.floor(mapMaxZoom)) : 19;
1529
+ return {
1530
+ enabled,
1531
+ radius: Number.isFinite(radius) ? clampInteger(radius, 1, 200) : 48,
1532
+ minPoints: Number.isFinite(minPoints) ? clampInteger(minPoints, 2, 1000) : 2,
1533
+ maxZoom: Number.isFinite(requestedMaxZoom)
1534
+ ? clampInteger(requestedMaxZoom, 0, normalizedMapMaxZoom)
1535
+ : Math.max(0, normalizedMapMaxZoom - 1),
1536
+ };
1537
+ }
1538
+ function sourceSignature(markers, options) {
1539
+ return `${options.radius}:${options.minPoints}:${options.maxZoom}:${markers
1540
+ .map(marker => `${getMapMarkerKey(marker.id)}@${marker.longitude},${marker.latitude}`)
1541
+ .sort()
1542
+ .join('|')}`;
1543
+ }
1544
+ function isClusterFeature(feature) {
1545
+ return 'cluster' in feature.properties && feature.properties.cluster === true;
1546
+ }
1547
+ function createClusterIndex(markers, options) {
1548
+ const index = new Supercluster({
1549
+ radius: options.radius,
1550
+ minPoints: options.minPoints,
1551
+ maxZoom: options.maxZoom,
1552
+ });
1553
+ index.load(markers.map(marker => ({
1554
+ type: 'Feature',
1555
+ geometry: {
1556
+ type: 'Point',
1557
+ coordinates: [marker.longitude, marker.latitude],
1558
+ },
1559
+ properties: {
1560
+ markerKey: getMapMarkerKey(marker.id),
1561
+ },
1562
+ })));
1563
+ return index;
1564
+ }
1565
+ /** Keeps the clustering library private and returns deterministic q-map records. */
1566
+ class MapMarkerClusterIndex {
1567
+ clusterGroups = new Map();
1568
+ standaloneMarkers = new Map();
1569
+ load(markers, options) {
1570
+ const ordered = [...markers].sort((left, right) => getMapMarkerKey(left.id).localeCompare(getMapMarkerKey(right.id)));
1571
+ this.standaloneMarkers.clear();
1572
+ const groupedMarkers = new Map();
1573
+ for (const marker of ordered) {
1574
+ const key = getMapMarkerKey(marker.id);
1575
+ if (marker.clusterable === false) {
1576
+ this.standaloneMarkers.set(key, marker);
1577
+ }
1578
+ else {
1579
+ const clusterGroup = getMapMarkerClusterGroup(marker);
1580
+ const groupMarkers = groupedMarkers.get(clusterGroup) ?? [];
1581
+ groupMarkers.push(marker);
1582
+ groupedMarkers.set(clusterGroup, groupMarkers);
1583
+ }
1584
+ }
1585
+ const nextClusterGroups = new Map();
1586
+ const orderedGroups = [...groupedMarkers].sort(([left], [right]) => left.localeCompare(right));
1587
+ for (const [clusterGroup, groupMarkers] of orderedGroups) {
1588
+ const groupMarkerMap = new Map(groupMarkers.map(marker => [getMapMarkerKey(marker.id), marker]));
1589
+ const signature = sourceSignature(groupMarkers, options);
1590
+ const current = this.clusterGroups.get(clusterGroup);
1591
+ nextClusterGroups.set(clusterGroup, {
1592
+ index: current?.signature === signature
1593
+ ? current.index
1594
+ : createClusterIndex(groupMarkers, options),
1595
+ markers: groupMarkerMap,
1596
+ signature,
1597
+ });
1598
+ }
1599
+ this.clusterGroups = nextClusterGroups;
1600
+ }
1601
+ getViewportItems(bounds, zoom, selectedMarkerId) {
1602
+ const selectedKey = selectedMarkerId === undefined ? undefined : getMapMarkerKey(selectedMarkerId);
1603
+ const items = new Map();
1604
+ for (const [clusterGroup, group] of this.clusterGroups) {
1605
+ for (const feature of group.index.getClusters(bounds, Math.max(0, Math.floor(zoom)))) {
1606
+ if (!isClusterFeature(feature)) {
1607
+ const marker = group.markers.get(feature.properties.markerKey);
1608
+ if (marker) {
1609
+ const key = getMapMarkerKey(marker.id);
1610
+ items.set(key, { kind: 'marker', key, marker });
1611
+ }
1612
+ continue;
1613
+ }
1614
+ const sourceClusterId = feature.properties.cluster_id;
1615
+ const markerKeys = group.index
1616
+ .getLeaves(sourceClusterId, Infinity)
1617
+ .map(leaf => leaf.properties.markerKey)
1618
+ .filter(key => group.markers.has(key))
1619
+ .sort();
1620
+ const markerIds = markerKeys
1621
+ .map(key => group.markers.get(key)?.id)
1622
+ .filter((id) => id !== undefined);
1623
+ const clusterId = String(sourceClusterId);
1624
+ const key = `cluster:${encodeURIComponent(clusterGroup)}:${clusterId}`;
1625
+ items.set(key, {
1626
+ kind: 'cluster',
1627
+ key,
1628
+ clusterId,
1629
+ clusterGroup,
1630
+ markerIds,
1631
+ markerKeys,
1632
+ latitude: feature.geometry.coordinates[1],
1633
+ longitude: feature.geometry.coordinates[0],
1634
+ count: markerIds.length,
1635
+ expansionZoom: group.index.getClusterExpansionZoom(sourceClusterId),
1636
+ containsSelection: selectedKey !== undefined && markerKeys.includes(selectedKey),
1637
+ });
1638
+ }
1639
+ }
1640
+ for (const [key, marker] of this.standaloneMarkers) {
1641
+ if (!isMarkerInBounds(marker, bounds))
1642
+ continue;
1643
+ items.set(key, { kind: 'marker', key, marker });
1644
+ }
1645
+ return [...items.values()].sort((left, right) => left.key.localeCompare(right.key));
1646
+ }
1647
+ clear() {
1648
+ this.clusterGroups.clear();
1649
+ this.standaloneMarkers.clear();
1650
+ }
1651
+ }
1652
+ function isMarkerInBounds(marker, [west, south, east, north]) {
1653
+ return (marker.longitude >= west &&
1654
+ marker.longitude <= east &&
1655
+ marker.latitude >= south &&
1656
+ marker.latitude <= north);
1657
+ }
1658
+
1659
+ const COLLISION_FOOTPRINT_DIAMETER_RATIO = 0.75;
1660
+ const COLLISION_RESOLUTION_PASSES = 12;
1661
+ const COLLISION_EPSILON = 0.01;
1662
+ /**
1663
+ * Separates every visible map marker and cluster while allowing their full
1664
+ * circles to overlap. The collision footprint is 75% of the rendered diameter.
1665
+ */
1666
+ function resolveMapMarkerCollisionOffsets(items) {
1667
+ const nodes = items
1668
+ .filter(item => (Number.isFinite(item.x)
1669
+ && Number.isFinite(item.y)
1670
+ && Number.isFinite(item.diameter)
1671
+ && item.diameter > 0))
1672
+ .map(item => ({
1673
+ ...item,
1674
+ collisionRadius: item.diameter * COLLISION_FOOTPRINT_DIAMETER_RATIO * 0.5,
1675
+ offset: { x: 0, y: 0 },
1676
+ }))
1677
+ .sort((left, right) => left.key.localeCompare(right.key));
1678
+ const largestCollisionRadius = Math.max(0, ...nodes.map(node => node.collisionRadius));
1679
+ for (let pass = 0; pass < COLLISION_RESOLUTION_PASSES; pass += 1) {
1680
+ let adjusted = false;
1681
+ const ordered = [...nodes].sort((left, right) => (centerX(left) - centerX(right)
1682
+ || centerY(left) - centerY(right)
1683
+ || left.key.localeCompare(right.key)));
1684
+ for (let leftIndex = 0; leftIndex < ordered.length; leftIndex += 1) {
1685
+ const left = ordered[leftIndex];
1686
+ if (!left)
1687
+ continue;
1688
+ for (let rightIndex = leftIndex + 1; rightIndex < ordered.length; rightIndex += 1) {
1689
+ const right = ordered[rightIndex];
1690
+ if (!right)
1691
+ continue;
1692
+ const xDistance = centerX(right) - centerX(left);
1693
+ if (xDistance >= left.collisionRadius + largestCollisionRadius)
1694
+ break;
1695
+ const xDelta = centerX(right) - centerX(left);
1696
+ const yDelta = centerY(right) - centerY(left);
1697
+ const distance = Math.hypot(xDelta, yDelta);
1698
+ const minimumDistance = left.collisionRadius + right.collisionRadius;
1699
+ if (distance + COLLISION_EPSILON >= minimumDistance)
1700
+ continue;
1701
+ const direction = distance > COLLISION_EPSILON
1702
+ ? { x: xDelta / distance, y: yDelta / distance }
1703
+ : stableCollisionDirection(left.key, right.key);
1704
+ const pushDistance = (minimumDistance - distance) * 0.5;
1705
+ left.offset.x -= direction.x * pushDistance;
1706
+ left.offset.y -= direction.y * pushDistance;
1707
+ right.offset.x += direction.x * pushDistance;
1708
+ right.offset.y += direction.y * pushDistance;
1709
+ adjusted = true;
1710
+ }
1711
+ }
1712
+ if (!adjusted)
1713
+ break;
1714
+ }
1715
+ return new Map(nodes.map(node => [node.key, node.offset]));
1716
+ }
1717
+ function centerX(node) {
1718
+ return node.x + node.offset.x;
1719
+ }
1720
+ function centerY(node) {
1721
+ return node.y + node.offset.y;
1722
+ }
1723
+ function stableCollisionDirection(leftKey, rightKey) {
1724
+ let hash = 2_166_136_261;
1725
+ for (const character of `${leftKey}\u0000${rightKey}`) {
1726
+ hash ^= character.charCodeAt(0);
1727
+ hash = Math.imul(hash, 16_777_619);
1728
+ }
1729
+ const angle = ((hash >>> 0) % 360) * (Math.PI / 180);
1730
+ return { x: Math.cos(angle), y: Math.sin(angle) };
1731
+ }
1732
+
1733
+ const KIND_CLASSES = ['kind-dot', 'kind-avatar', 'kind-icon'];
1734
+ const RING_CLASSES = ['ring-none', 'ring-solid', 'ring-dashed'];
1735
+ const ICON_SIZE_PROPERTY = '--q-map-marker-icon-size';
1736
+ const ICON_OFFSET_X_PROPERTY = '--q-map-marker-icon-offset-x';
1737
+ const ICON_OFFSET_Y_PROPERTY = '--q-map-marker-icon-offset-y';
1738
+ function createIcon(document, className) {
1739
+ const icon = document.createElement('q-icon');
1740
+ icon.className = className;
1741
+ icon.setAttribute('size', '100%');
1742
+ icon.setAttribute('aria-hidden', 'true');
1743
+ return icon;
1744
+ }
1745
+ function updateIcon(icon, name) {
1746
+ icon.hidden = !name;
1747
+ if (name)
1748
+ icon.setAttribute('name', name);
1749
+ else
1750
+ icon.removeAttribute('name');
1751
+ }
1752
+ function createMarkerContent(document) {
1753
+ const surface = document.createElement('span');
1754
+ surface.className = 'q-map-marker';
1755
+ surface.setAttribute('part', 'marker');
1756
+ const content = document.createElement('span');
1757
+ content.className = 'q-map-marker__content';
1758
+ content.setAttribute('aria-hidden', 'true');
1759
+ const center = document.createElement('span');
1760
+ center.className = 'q-map-marker__center';
1761
+ const fallback = document.createElement('span');
1762
+ fallback.className = 'q-map-marker__fallback';
1763
+ fallback.hidden = true;
1764
+ const image = document.createElement('img');
1765
+ image.className = 'q-map-marker__image';
1766
+ image.alt = '';
1767
+ image.decoding = 'async';
1768
+ image.draggable = false;
1769
+ image.hidden = true;
1770
+ image.setAttribute('aria-hidden', 'true');
1771
+ image.addEventListener('load', () => {
1772
+ if (image.dataset.source !== image.getAttribute('src'))
1773
+ return;
1774
+ image.hidden = false;
1775
+ center.classList.add('has-image');
1776
+ });
1777
+ image.addEventListener('error', () => {
1778
+ if (image.dataset.source !== image.getAttribute('src'))
1779
+ return;
1780
+ image.hidden = true;
1781
+ center.classList.remove('has-image');
1782
+ });
1783
+ const icon = createIcon(document, 'q-map-marker__icon');
1784
+ icon.hidden = true;
1785
+ const badge = document.createElement('span');
1786
+ badge.className = 'q-map-marker__badge';
1787
+ badge.setAttribute('part', 'marker-badge');
1788
+ badge.hidden = true;
1789
+ const badgeIcon = createIcon(document, 'q-map-marker__badge-icon');
1790
+ badgeIcon.hidden = true;
1791
+ const badgeText = document.createElement('span');
1792
+ badgeText.className = 'q-map-marker__badge-text';
1793
+ badgeText.hidden = true;
1794
+ center.append(fallback, image, icon);
1795
+ badge.append(badgeIcon, badgeText);
1796
+ content.append(center, badge);
1797
+ surface.append(content);
1798
+ return surface;
1799
+ }
1800
+ function updateImage(center, image, imageUrl) {
1801
+ if (!imageUrl) {
1802
+ image.hidden = true;
1803
+ image.removeAttribute('src');
1804
+ delete image.dataset.source;
1805
+ center.classList.remove('has-image');
1806
+ return;
1807
+ }
1808
+ if (image.dataset.source === imageUrl)
1809
+ return;
1810
+ image.hidden = true;
1811
+ center.classList.remove('has-image');
1812
+ image.dataset.source = imageUrl;
1813
+ image.src = imageUrl;
1814
+ }
1815
+ function getMarkerAccessibleLabel(marker) {
1816
+ return marker.badge ? `${marker.label}. ${marker.badge.ariaLabel}` : marker.label;
1817
+ }
1818
+ function updateMarkerPresentation(element, marker, selected) {
1819
+ for (const variant of map_types.Q_MAP_MARKER_VARIANTS)
1820
+ element.classList.remove(`variant-${variant}`);
1821
+ element.classList.remove(...KIND_CLASSES, ...RING_CLASSES);
1822
+ element.classList.add(`variant-${marker.variant ?? 'default'}`, `ring-${marker.ring ?? 'none'}`);
1823
+ const kind = marker.kind === 'icon' && !marker.icon ? 'dot' : marker.kind;
1824
+ if (kind)
1825
+ element.classList.add(`kind-${kind}`);
1826
+ element.classList.toggle('is-pulsing', marker.pulse === true);
1827
+ element.classList.toggle('is-selected', selected);
1828
+ syncFinitePixelProperty(element, ICON_SIZE_PROPERTY, marker.iconSize);
1829
+ syncFinitePixelProperty(element, ICON_OFFSET_X_PROPERTY, marker.iconOffsetX);
1830
+ syncFinitePixelProperty(element, ICON_OFFSET_Y_PROPERTY, marker.iconOffsetY);
1831
+ const center = element.querySelector('.q-map-marker__center');
1832
+ const fallback = center?.querySelector('.q-map-marker__fallback');
1833
+ const image = center?.querySelector('.q-map-marker__image');
1834
+ const icon = center?.querySelector('.q-map-marker__icon');
1835
+ if (!center || !fallback || !image || !icon)
1836
+ return;
1837
+ const avatarContent = kind === 'avatar' || kind === undefined;
1838
+ const fallbackText = avatarContent ? marker.fallbackText ?? '' : '';
1839
+ const imageUrl = avatarContent ? marker.imageUrl : undefined;
1840
+ const iconName = kind === 'icon' ? marker.icon : undefined;
1841
+ fallback.textContent = fallbackText;
1842
+ fallback.hidden = !fallbackText;
1843
+ updateImage(center, image, imageUrl);
1844
+ updateIcon(icon, iconName);
1845
+ element.classList.toggle('has-content', Boolean(fallbackText || imageUrl || iconName));
1846
+ const badge = element.querySelector('.q-map-marker__badge');
1847
+ const badgeIcon = badge?.querySelector('.q-map-marker__badge-icon');
1848
+ const badgeText = badge?.querySelector('.q-map-marker__badge-text');
1849
+ if (!badge || !badgeIcon || !badgeText)
1850
+ return;
1851
+ for (const variant of map_types.Q_MAP_MARKER_VARIANTS)
1852
+ badge.classList.remove(`variant-${variant}`);
1853
+ badge.hidden = !marker.badge;
1854
+ badge.classList.add(`variant-${marker.badge?.variant ?? 'default'}`);
1855
+ updateIcon(badgeIcon, marker.badge?.icon);
1856
+ badgeText.textContent = marker.badge?.text ?? '';
1857
+ badgeText.hidden = !marker.badge?.text;
1858
+ }
1859
+ function syncFinitePixelProperty(element, property, value) {
1860
+ if (!Number.isFinite(value)) {
1861
+ element.style.removeProperty(property);
1862
+ return;
1863
+ }
1864
+ element.style.setProperty(property, `${Object.is(value, -0) ? 0 : value}px`);
1865
+ }
1866
+ function createClusterContent(document) {
1867
+ const surface = document.createElement('span');
1868
+ surface.className = 'q-map-cluster';
1869
+ surface.setAttribute('part', 'cluster');
1870
+ const content = document.createElement('span');
1871
+ content.className = 'q-map-cluster__content';
1872
+ content.setAttribute('aria-hidden', 'true');
1873
+ const count = document.createElement('span');
1874
+ count.className = 'q-map-cluster__count';
1875
+ content.append(count);
1876
+ surface.append(content);
1877
+ return surface;
1878
+ }
1879
+ function updateClusterPresentation(element, count, containsSelection) {
1880
+ const countElement = element.querySelector('.q-map-cluster__count');
1881
+ if (countElement)
1882
+ countElement.textContent = count > 999 ? `${Math.floor(count / 100) / 10}k` : String(count);
1883
+ element.classList.toggle('contains-selection', containsSelection);
1884
+ }
1885
+ function createCalloutContent(document) {
1886
+ const content = document.createElement('div');
1887
+ content.className = 'q-map-callout__content';
1888
+ content.setAttribute('aria-hidden', 'true');
1889
+ const heading = document.createElement('span');
1890
+ heading.className = 'q-map-callout__heading';
1891
+ const title = document.createElement('span');
1892
+ title.className = 'q-map-callout__title';
1893
+ const status = document.createElement('span');
1894
+ status.className = 'q-map-callout__status';
1895
+ status.hidden = true;
1896
+ const subtitle = document.createElement('span');
1897
+ subtitle.className = 'q-map-callout__subtitle';
1898
+ subtitle.hidden = true;
1899
+ const meta = document.createElement('span');
1900
+ meta.className = 'q-map-callout__meta';
1901
+ meta.hidden = true;
1902
+ const stats = document.createElement('dl');
1903
+ stats.className = 'q-map-callout__stats';
1904
+ stats.hidden = true;
1905
+ heading.append(title, status);
1906
+ content.append(heading, subtitle, meta, stats);
1907
+ return content;
1908
+ }
1909
+ function updateCalloutContent(element, callout) {
1910
+ const title = element.querySelector('.q-map-callout__title');
1911
+ const subtitle = element.querySelector('.q-map-callout__subtitle');
1912
+ const status = element.querySelector('.q-map-callout__status');
1913
+ const meta = element.querySelector('.q-map-callout__meta');
1914
+ const stats = element.querySelector('.q-map-callout__stats');
1915
+ if (!title || !subtitle || !status || !meta || !stats)
1916
+ return;
1917
+ for (const variant of map_types.Q_MAP_MARKER_VARIANTS)
1918
+ element.classList.remove(`variant-${variant}`);
1919
+ element.classList.add(`variant-${callout.variant ?? 'default'}`);
1920
+ title.textContent = callout.title;
1921
+ subtitle.textContent = callout.subtitle ?? '';
1922
+ subtitle.hidden = !callout.subtitle;
1923
+ for (const variant of map_types.Q_MAP_MARKER_VARIANTS)
1924
+ status.classList.remove(`variant-${variant}`);
1925
+ status.classList.add(`variant-${callout.status?.variant ?? 'default'}`);
1926
+ status.textContent = callout.status?.label ?? '';
1927
+ status.hidden = !callout.status;
1928
+ meta.textContent = callout.meta ?? '';
1929
+ meta.hidden = !callout.meta;
1930
+ updateCalloutStats(stats, callout.stats ?? []);
1931
+ }
1932
+ function updateCalloutStats(element, stats) {
1933
+ const items = stats.map((stat) => {
1934
+ const item = element.ownerDocument.createElement('div');
1935
+ item.className = `q-map-callout__stat layout-${stat.layout ?? 'compact'}`;
1936
+ const label = element.ownerDocument.createElement('dt');
1937
+ label.className = 'q-map-callout__stat-label';
1938
+ label.textContent = stat.label;
1939
+ const value = element.ownerDocument.createElement('dd');
1940
+ value.className = 'q-map-callout__stat-value';
1941
+ value.textContent = String(stat.value);
1942
+ item.append(label, value);
1943
+ return item;
1944
+ });
1945
+ element.textContent = '';
1946
+ element.append(...items);
1947
+ element.hidden = items.length === 0;
1948
+ }
1949
+
1950
+ const STANDALONE_MARKER_Z_INDEX_OFFSET = 2_000;
1951
+ const DEFAULT_MARKER_DIAMETER = 20;
1952
+ const DEFAULT_CLUSTER_DIAMETER = 32;
1953
+ const MARKER_SIZE_CLASSES = map_types.Q_MAP_MARKER_SIZES.map(size => markerSizeClassName(size));
1954
+ /** Owns marker normalization, clustering, stable reconciliation, accessibility, and cleanup. */
1955
+ class MapMarkerController {
1956
+ options;
1957
+ layers = new Map();
1958
+ markers = new Map();
1959
+ clusterIndex = new MapMarkerClusterIndex();
1960
+ visibleItems = new Map();
1961
+ pendingFocusMarkerKey;
1962
+ handleViewportChange = () => this.reconcile();
1963
+ constructor(options) {
1964
+ this.options = options;
1965
+ options.map.on('moveend zoomend', this.handleViewportChange);
1966
+ }
1967
+ sync(markers) {
1968
+ const normalized = getMapMarkers(markers);
1969
+ this.markers.clear();
1970
+ for (const marker of normalized)
1971
+ this.markers.set(getMapMarkerKey(marker.id), marker);
1972
+ const clustering = this.options.getClusteringOptions();
1973
+ if (clustering.enabled)
1974
+ this.clusterIndex.load(normalized, clustering);
1975
+ else
1976
+ this.clusterIndex.clear();
1977
+ this.reconcile();
1978
+ }
1979
+ syncSelection() {
1980
+ this.reconcile();
1981
+ }
1982
+ getVisibilityTarget(markerId) {
1983
+ const markerKey = getMapMarkerKey(markerId);
1984
+ const marker = this.markers.get(markerKey);
1985
+ if (!marker)
1986
+ return undefined;
1987
+ const directLayer = this.layers.get(markerKey);
1988
+ if (directLayer?.kind === 'marker') {
1989
+ return {
1990
+ latitude: marker.latitude,
1991
+ longitude: marker.longitude,
1992
+ rendered: { kind: directLayer.kind, element: directLayer.element },
1993
+ };
1994
+ }
1995
+ for (const layer of this.layers.values()) {
1996
+ if (!layer.markerKeys.includes(markerKey))
1997
+ continue;
1998
+ return {
1999
+ latitude: marker.latitude,
2000
+ longitude: marker.longitude,
2001
+ rendered: { kind: layer.kind, element: layer.element },
2002
+ };
2003
+ }
2004
+ return { latitude: marker.latitude, longitude: marker.longitude };
2005
+ }
2006
+ destroy() {
2007
+ this.options.map.off('moveend zoomend', this.handleViewportChange);
2008
+ for (const key of [...this.layers.keys()])
2009
+ this.remove(key);
2010
+ this.visibleItems.clear();
2011
+ this.markers.clear();
2012
+ this.clusterIndex.clear();
2013
+ }
2014
+ reconcile() {
2015
+ const focusIntent = this.captureFocusIntent();
2016
+ const items = this.getVisibleItems();
2017
+ this.visibleItems = new Map(items.map(item => [item.key, item]));
2018
+ for (const key of [...this.layers.keys()]) {
2019
+ if (!this.visibleItems.has(key))
2020
+ this.remove(key);
2021
+ }
2022
+ for (const item of items) {
2023
+ const current = this.layers.get(item.key);
2024
+ if (current && current.kind !== item.kind)
2025
+ this.remove(item.key);
2026
+ const record = this.layers.get(item.key) ?? this.add(item);
2027
+ if (record)
2028
+ this.update(record, item);
2029
+ }
2030
+ this.syncCollisionOffsets(items);
2031
+ const preservedFocus = focusIntent
2032
+ && this.layers.get(focusIntent.renderKey)?.element === focusIntent.element;
2033
+ if (this.pendingFocusMarkerKey) {
2034
+ const restored = this.restoreFocus(this.pendingFocusMarkerKey);
2035
+ if (restored)
2036
+ this.pendingFocusMarkerKey = undefined;
2037
+ }
2038
+ else if (focusIntent && !preservedFocus) {
2039
+ if (!this.restoreFocus(focusIntent.markerKey))
2040
+ this.options.map.getContainer().focus();
2041
+ }
2042
+ }
2043
+ getVisibleItems() {
2044
+ const clustering = this.options.getClusteringOptions();
2045
+ if (!clustering.enabled) {
2046
+ return [...this.markers].map(([key, marker]) => ({ kind: 'marker', key, marker }));
2047
+ }
2048
+ const bounds = this.options.map.getBounds().pad(0.2);
2049
+ const south = Math.max(-90, bounds.getSouth());
2050
+ const north = Math.min(90, bounds.getNorth());
2051
+ const west = Math.max(-180, bounds.getWest());
2052
+ const east = Math.min(180, bounds.getEast());
2053
+ const safeBounds = east > west
2054
+ ? [west, south, east, north]
2055
+ : [-180, south, 180, north];
2056
+ return this.clusterIndex.getViewportItems(safeBounds, this.options.map.getZoom(), this.options.getSelectedMarkerId());
2057
+ }
2058
+ add(item) {
2059
+ const document = this.options.map.getContainer().ownerDocument;
2060
+ const surface = item.kind === 'marker'
2061
+ ? createMarkerContent(document)
2062
+ : createClusterContent(document);
2063
+ const className = item.kind === 'marker'
2064
+ ? 'q-map-marker-position'
2065
+ : 'q-map-cluster-position';
2066
+ const label = item.kind === 'marker' ? item.marker.label : `${item.count} map markers`;
2067
+ const layer = this.options.leaflet.marker([this.getLatitude(item), this.getLongitude(item)], {
2068
+ bubblingMouseEvents: false,
2069
+ icon: this.options.leaflet.divIcon({
2070
+ className,
2071
+ html: surface,
2072
+ iconAnchor: [0, 0],
2073
+ iconSize: [0, 0],
2074
+ }),
2075
+ keyboard: false,
2076
+ riseOnHover: true,
2077
+ riseOffset: 1000,
2078
+ title: label,
2079
+ zIndexOffset: this.getZIndexOffset(item),
2080
+ });
2081
+ layer.addTo(this.options.map);
2082
+ const element = layer.getElement();
2083
+ if (!element) {
2084
+ layer.remove();
2085
+ return undefined;
2086
+ }
2087
+ if (!element.contains(surface)) {
2088
+ layer.remove();
2089
+ return undefined;
2090
+ }
2091
+ const click = (event) => {
2092
+ event.stopPropagation();
2093
+ this.activate(item.key, event);
2094
+ };
2095
+ const keydown = (event) => {
2096
+ if (event.key !== 'Enter' && event.key !== ' ')
2097
+ return;
2098
+ event.preventDefault();
2099
+ event.stopPropagation();
2100
+ this.activate(item.key, event);
2101
+ };
2102
+ surface.addEventListener('click', click);
2103
+ surface.addEventListener('keydown', keydown);
2104
+ const record = {
2105
+ kind: item.kind,
2106
+ layer,
2107
+ element: surface,
2108
+ markerKeys: [],
2109
+ click,
2110
+ keydown,
2111
+ };
2112
+ this.layers.set(item.key, record);
2113
+ return record;
2114
+ }
2115
+ update(record, item) {
2116
+ record.layer.setLatLng([this.getLatitude(item), this.getLongitude(item)]);
2117
+ record.layer.setZIndexOffset(this.getZIndexOffset(item));
2118
+ record.markerKeys = item.kind === 'marker'
2119
+ ? [getMapMarkerKey(item.marker.id)]
2120
+ : item.markerKeys;
2121
+ if (item.kind === 'marker') {
2122
+ const selected = this.isSelected(item.marker.id);
2123
+ this.syncMarkerSize(record, item.marker.size);
2124
+ updateMarkerPresentation(record.element, item.marker, selected);
2125
+ record.element.setAttribute('role', 'button');
2126
+ record.element.setAttribute('tabindex', '0');
2127
+ record.element.setAttribute('aria-label', getMarkerAccessibleLabel(item.marker));
2128
+ record.element.setAttribute('aria-pressed', selected ? 'true' : 'false');
2129
+ record.element.setAttribute('data-marker-id', item.key);
2130
+ record.element.setAttribute('title', item.marker.label);
2131
+ this.syncCallout(record, item.marker, selected);
2132
+ return;
2133
+ }
2134
+ this.unbindCallout(record);
2135
+ updateClusterPresentation(record.element, item.count, item.containsSelection);
2136
+ record.element.setAttribute('role', 'button');
2137
+ record.element.setAttribute('tabindex', '0');
2138
+ record.element.setAttribute('aria-label', `${item.count} map markers${item.containsSelection ? ', including the selected marker' : ''}`);
2139
+ record.element.setAttribute('part', `cluster ${clusterGroupPartName(item.clusterGroup)}`);
2140
+ record.element.setAttribute('data-cluster-id', item.clusterId);
2141
+ record.element.setAttribute('data-cluster-group', item.clusterGroup);
2142
+ record.element.setAttribute('title', `${item.count} map markers`);
2143
+ record.element.removeAttribute('aria-pressed');
2144
+ }
2145
+ getZIndexOffset(item) {
2146
+ return item.kind === 'marker' && item.marker.clusterable === false
2147
+ ? STANDALONE_MARKER_Z_INDEX_OFFSET
2148
+ : 0;
2149
+ }
2150
+ syncMarkerSize(record, size) {
2151
+ const position = record.layer.getElement();
2152
+ if (!position)
2153
+ return;
2154
+ position.classList.remove(...MARKER_SIZE_CLASSES);
2155
+ if (size)
2156
+ position.classList.add(markerSizeClassName(size));
2157
+ }
2158
+ syncCollisionOffsets(items) {
2159
+ const collisionItems = [];
2160
+ for (const item of items) {
2161
+ const record = this.layers.get(item.key);
2162
+ if (!record || record.kind !== item.kind)
2163
+ continue;
2164
+ const point = this.options.map.latLngToContainerPoint([
2165
+ this.getLatitude(item),
2166
+ this.getLongitude(item),
2167
+ ]);
2168
+ const position = record.layer.getElement();
2169
+ const bounds = position?.getBoundingClientRect();
2170
+ const diameter = Math.max(bounds?.width ?? 0, bounds?.height ?? 0)
2171
+ || (item.kind === 'cluster'
2172
+ ? DEFAULT_CLUSTER_DIAMETER
2173
+ : DEFAULT_MARKER_DIAMETER);
2174
+ collisionItems.push({
2175
+ key: item.key,
2176
+ x: point.x,
2177
+ y: point.y,
2178
+ diameter,
2179
+ });
2180
+ }
2181
+ const offsets = resolveMapMarkerCollisionOffsets(collisionItems);
2182
+ for (const item of collisionItems) {
2183
+ const record = this.layers.get(item.key);
2184
+ if (!record)
2185
+ continue;
2186
+ const offset = offsets.get(item.key);
2187
+ if (!offset || (Math.abs(offset.x) < 0.01 && Math.abs(offset.y) < 0.01)) {
2188
+ record.element.style.removeProperty('translate');
2189
+ this.syncCalloutCollisionOffset(record, 0, 0);
2190
+ continue;
2191
+ }
2192
+ record.element.style.setProperty('translate', `${formatCollisionOffset(offset.x)}px ${formatCollisionOffset(offset.y)}px`);
2193
+ this.syncCalloutCollisionOffset(record, offset.x, offset.y);
2194
+ }
2195
+ }
2196
+ syncCalloutCollisionOffset(record, x, y) {
2197
+ const tooltip = record.layer.getTooltip();
2198
+ if (!tooltip)
2199
+ return;
2200
+ const normalizedX = formatCollisionOffset(x);
2201
+ const normalizedY = formatCollisionOffset(y);
2202
+ const collisionOffset = `${normalizedX}:${normalizedY}`;
2203
+ if (record.calloutCollisionOffset === collisionOffset
2204
+ || (record.calloutCollisionOffset === undefined
2205
+ && normalizedX === 0
2206
+ && normalizedY === 0))
2207
+ return;
2208
+ record.calloutCollisionOffset = collisionOffset;
2209
+ tooltip.options.offset = this.options.leaflet.point(normalizedX, normalizedY);
2210
+ tooltip.update();
2211
+ }
2212
+ syncCallout(record, marker, selected) {
2213
+ const callout = marker.callout;
2214
+ const visible = callout && (callout.visibility !== 'selected' || selected);
2215
+ if (!callout || !visible) {
2216
+ this.unbindCallout(record);
2217
+ return;
2218
+ }
2219
+ const placement = callout.placement ?? 'auto';
2220
+ if (record.calloutBound && record.calloutPlacement !== placement)
2221
+ this.unbindCallout(record);
2222
+ record.calloutContent ??= createCalloutContent(record.element.ownerDocument);
2223
+ updateCalloutContent(record.calloutContent, callout);
2224
+ record.calloutPlacement = placement;
2225
+ if (!record.calloutBound) {
2226
+ record.layer.bindTooltip(record.calloutContent, {
2227
+ className: 'q-map-callout',
2228
+ direction: placement,
2229
+ interactive: false,
2230
+ opacity: 1,
2231
+ permanent: true,
2232
+ });
2233
+ record.calloutBound = true;
2234
+ }
2235
+ record.layer.setTooltipContent(record.calloutContent);
2236
+ record.layer.openTooltip();
2237
+ const tooltip = record.layer.getTooltip()?.getElement();
2238
+ tooltip?.setAttribute('part', 'marker-callout');
2239
+ tooltip?.setAttribute('aria-hidden', 'true');
2240
+ }
2241
+ unbindCallout(record) {
2242
+ if (!record.calloutBound)
2243
+ return;
2244
+ record.layer.unbindTooltip();
2245
+ record.calloutBound = false;
2246
+ record.calloutCollisionOffset = undefined;
2247
+ }
2248
+ activate(key, originalEvent) {
2249
+ const item = this.visibleItems.get(key);
2250
+ if (!item)
2251
+ return;
2252
+ if (item.kind === 'marker') {
2253
+ this.options.onMarkerSelect(item.marker, originalEvent);
2254
+ return;
2255
+ }
2256
+ this.activateCluster(item, originalEvent);
2257
+ }
2258
+ activateCluster(item, originalEvent) {
2259
+ const expansionZoom = Math.min(this.options.map.getMaxZoom(), Math.max(this.options.map.getZoom() + 1, item.expansionZoom));
2260
+ const prevented = this.options.onClusterSelect({
2261
+ clusterId: item.clusterId,
2262
+ clusterGroup: item.clusterGroup,
2263
+ markerIds: item.markerIds,
2264
+ latitude: item.latitude,
2265
+ longitude: item.longitude,
2266
+ expansionZoom,
2267
+ originalEvent,
2268
+ });
2269
+ if (prevented)
2270
+ return;
2271
+ if (originalEvent instanceof KeyboardEvent) {
2272
+ const selected = this.options.getSelectedMarkerId();
2273
+ const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2274
+ this.pendingFocusMarkerKey = selectedKey && item.markerKeys.includes(selectedKey)
2275
+ ? selectedKey
2276
+ : item.markerKeys[0];
2277
+ }
2278
+ this.options.map.setView([item.latitude, item.longitude], expansionZoom, {
2279
+ animate: !this.options.prefersReducedMotion(),
2280
+ });
2281
+ }
2282
+ captureFocusIntent() {
2283
+ for (const [renderKey, record] of this.layers) {
2284
+ const root = record.element.getRootNode();
2285
+ if (root.activeElement !== record.element)
2286
+ continue;
2287
+ const selected = this.options.getSelectedMarkerId();
2288
+ const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2289
+ return {
2290
+ element: record.element,
2291
+ renderKey,
2292
+ markerKey: selectedKey && record.markerKeys.includes(selectedKey)
2293
+ ? selectedKey
2294
+ : record.markerKeys[0],
2295
+ };
2296
+ }
2297
+ return undefined;
2298
+ }
2299
+ restoreFocus(markerKey) {
2300
+ const marker = this.layers.get(markerKey);
2301
+ if (marker?.kind === 'marker') {
2302
+ marker.element.focus();
2303
+ return true;
2304
+ }
2305
+ for (const record of this.layers.values()) {
2306
+ if (record.kind === 'cluster' && record.markerKeys.includes(markerKey)) {
2307
+ record.element.focus();
2308
+ return true;
2309
+ }
2310
+ }
2311
+ return false;
2312
+ }
2313
+ isSelected(id) {
2314
+ const selectedId = this.options.getSelectedMarkerId();
2315
+ return selectedId !== undefined && getMapMarkerKey(selectedId) === getMapMarkerKey(id);
2316
+ }
2317
+ getLatitude(item) {
2318
+ return item.kind === 'marker' ? item.marker.latitude : item.latitude;
2319
+ }
2320
+ getLongitude(item) {
2321
+ return item.kind === 'marker' ? item.marker.longitude : item.longitude;
2322
+ }
2323
+ remove(key) {
2324
+ const record = this.layers.get(key);
2325
+ if (!record)
2326
+ return;
2327
+ record.element.removeEventListener('click', record.click);
2328
+ record.element.removeEventListener('keydown', record.keydown);
2329
+ this.unbindCallout(record);
2330
+ record.layer.remove();
2331
+ this.layers.delete(key);
2332
+ }
2333
+ }
2334
+ function markerSizeClassName(size) {
2335
+ return `size-${size}`;
2336
+ }
2337
+ function clusterGroupPartName(clusterGroup) {
2338
+ const normalizedGroup = clusterGroup
2339
+ .toLowerCase()
2340
+ .replace(/[^a-z0-9_-]+/g, '-')
2341
+ .replace(/-+/g, '-')
2342
+ .replace(/^-|-$/g, '');
2343
+ return `cluster-group-${normalizedGroup || 'default'}`;
2344
+ }
2345
+ function formatCollisionOffset(value) {
2346
+ return Math.round(value * 100) / 100;
2347
+ }
2348
+
2349
+ const GEOMETRY_EPSILON = 0.01;
2350
+ const SELECTED_MARKER_RING_OUTSET = 3;
2351
+ const CLUSTER_RING_OUTSET = 4;
2352
+ const SELECTED_CLUSTER_RING_OUTSET = 7;
2353
+ /** Finds the shortest screen-space translation that fully exposes a target. */
2354
+ function getMinimalVisibleTranslation(target, viewport, occlusions) {
2355
+ const normalizedTarget = normalizeRect(target);
2356
+ const normalizedViewport = normalizeRect(viewport);
2357
+ if (!normalizedTarget || !normalizedViewport)
2358
+ return undefined;
2359
+ if (getWidth(normalizedTarget) > getWidth(normalizedViewport) + GEOMETRY_EPSILON
2360
+ || getHeight(normalizedTarget) > getHeight(normalizedViewport) + GEOMETRY_EPSILON)
2361
+ return undefined;
2362
+ const clippedOcclusions = occlusions
2363
+ .map(normalizeRect)
2364
+ .filter((rect) => rect !== undefined)
2365
+ .map(rect => intersectRects(rect, normalizedViewport))
2366
+ .filter((rect) => rect !== undefined);
2367
+ const xCandidates = new Set([
2368
+ 0,
2369
+ normalizedViewport.left - normalizedTarget.left,
2370
+ normalizedViewport.right - normalizedTarget.right,
2371
+ ]);
2372
+ const yCandidates = new Set([
2373
+ 0,
2374
+ normalizedViewport.top - normalizedTarget.top,
2375
+ normalizedViewport.bottom - normalizedTarget.bottom,
2376
+ ]);
2377
+ for (const occlusion of clippedOcclusions) {
2378
+ xCandidates.add(occlusion.left - normalizedTarget.right);
2379
+ xCandidates.add(occlusion.right - normalizedTarget.left);
2380
+ yCandidates.add(occlusion.top - normalizedTarget.bottom);
2381
+ yCandidates.add(occlusion.bottom - normalizedTarget.top);
2382
+ }
2383
+ let best;
2384
+ let bestDistance = Number.POSITIVE_INFINITY;
2385
+ for (const x of xCandidates) {
2386
+ for (const y of yCandidates) {
2387
+ const translated = translateRect(normalizedTarget, x, y);
2388
+ if (!containsRect(normalizedViewport, translated))
2389
+ continue;
2390
+ if (clippedOcclusions.some(occlusion => overlapsRect(translated, occlusion)))
2391
+ continue;
2392
+ const distance = x * x + y * y;
2393
+ if (distance + GEOMETRY_EPSILON < bestDistance) {
2394
+ best = { x, y };
2395
+ bestDistance = distance;
2396
+ }
2397
+ }
2398
+ }
2399
+ return best;
2400
+ }
2401
+ function isRectFullyVisible(target, viewport, occlusions) {
2402
+ const normalizedTarget = normalizeRect(target);
2403
+ const normalizedViewport = normalizeRect(viewport);
2404
+ if (!normalizedTarget || !normalizedViewport)
2405
+ return false;
2406
+ if (!containsRect(normalizedViewport, normalizedTarget))
2407
+ return false;
2408
+ return !occlusions.some(occlusion => {
2409
+ const normalizedOcclusion = normalizeRect(occlusion);
2410
+ return normalizedOcclusion ? overlapsRect(normalizedTarget, normalizedOcclusion) : false;
2411
+ });
2412
+ }
2413
+ /** Measures the intentional marker/cluster footprint without pulse or callout overflow. */
2414
+ function getRenderedMapItemRect(element, kind) {
2415
+ const elementBounds = fromDomRect(element.getBoundingClientRect());
2416
+ if (kind === 'marker') {
2417
+ const ringOutset = Math.max(getMarkerRingOutset(element), element.classList.contains('is-selected') ? SELECTED_MARKER_RING_OUTSET : 0);
2418
+ let bounds = expandRect(elementBounds, ringOutset);
2419
+ const badge = element.querySelector('.q-map-marker__badge:not([hidden])');
2420
+ if (badge)
2421
+ bounds = unionRects(bounds, fromDomRect(badge.getBoundingClientRect()));
2422
+ return bounds;
2423
+ }
2424
+ return expandRect(elementBounds, element.classList.contains('contains-selection')
2425
+ ? SELECTED_CLUSTER_RING_OUTSET
2426
+ : CLUSTER_RING_OUTSET);
2427
+ }
2428
+ function normalizeRect(rect) {
2429
+ const { top, right, bottom, left } = rect;
2430
+ if (![top, right, bottom, left].every(Number.isFinite))
2431
+ return undefined;
2432
+ if (right <= left || bottom <= top)
2433
+ return undefined;
2434
+ return { top, right, bottom, left };
2435
+ }
2436
+ function getWidth(rect) {
2437
+ return rect.right - rect.left;
2438
+ }
2439
+ function getHeight(rect) {
2440
+ return rect.bottom - rect.top;
2441
+ }
2442
+ function fromDomRect(rect) {
2443
+ return {
2444
+ top: rect.top,
2445
+ right: rect.right,
2446
+ bottom: rect.bottom,
2447
+ left: rect.left,
2448
+ };
2449
+ }
2450
+ function getMarkerRingOutset(element) {
2451
+ if (!element.classList.contains('ring-solid') && !element.classList.contains('ring-dashed'))
2452
+ return 0;
2453
+ const view = element.ownerDocument.defaultView;
2454
+ if (!view)
2455
+ return 7;
2456
+ const style = view.getComputedStyle(element, '::after');
2457
+ const outsets = [style.top, style.right, style.bottom, style.left]
2458
+ .map(value => Number.parseFloat(value))
2459
+ .filter(Number.isFinite)
2460
+ .map(value => Math.max(0, -value));
2461
+ return Math.max(7, ...outsets);
2462
+ }
2463
+ function expandRect(rect, outset) {
2464
+ return {
2465
+ top: rect.top - outset,
2466
+ right: rect.right + outset,
2467
+ bottom: rect.bottom + outset,
2468
+ left: rect.left - outset,
2469
+ };
2470
+ }
2471
+ function unionRects(first, second) {
2472
+ return {
2473
+ top: Math.min(first.top, second.top),
2474
+ right: Math.max(first.right, second.right),
2475
+ bottom: Math.max(first.bottom, second.bottom),
2476
+ left: Math.min(first.left, second.left),
2477
+ };
2478
+ }
2479
+ function translateRect(rect, x, y) {
2480
+ return {
2481
+ top: rect.top + y,
2482
+ right: rect.right + x,
2483
+ bottom: rect.bottom + y,
2484
+ left: rect.left + x,
2485
+ };
2486
+ }
2487
+ function intersectRects(first, second) {
2488
+ return normalizeRect({
2489
+ top: Math.max(first.top, second.top),
2490
+ right: Math.min(first.right, second.right),
2491
+ bottom: Math.min(first.bottom, second.bottom),
2492
+ left: Math.max(first.left, second.left),
2493
+ });
2494
+ }
2495
+ function containsRect(container, target) {
2496
+ return target.left >= container.left - GEOMETRY_EPSILON
2497
+ && target.top >= container.top - GEOMETRY_EPSILON
2498
+ && target.right <= container.right + GEOMETRY_EPSILON
2499
+ && target.bottom <= container.bottom + GEOMETRY_EPSILON;
2500
+ }
2501
+ function overlapsRect(first, second) {
2502
+ return first.left < second.right - GEOMETRY_EPSILON
2503
+ && first.right > second.left + GEOMETRY_EPSILON
2504
+ && first.top < second.bottom - GEOMETRY_EPSILON
2505
+ && first.bottom > second.top + GEOMETRY_EPSILON;
2506
+ }
2507
+
2508
+ const DEFAULT_TILE_PRELOAD_BUFFER = 0;
2509
+ const MAX_TILE_PRELOAD_BUFFER = 4;
2510
+ /** Normalizes the number of offscreen raster-tile rows and columns to preload. */
2511
+ function normalizeTilePreloadBuffer(value) {
2512
+ if (!Number.isFinite(value))
2513
+ return DEFAULT_TILE_PRELOAD_BUFFER;
2514
+ return Math.min(MAX_TILE_PRELOAD_BUFFER, Math.max(0, Math.round(value)));
2515
+ }
2516
+
2517
+ const TILE_LAYER_READY_TIMEOUT_MS = 10_000;
2518
+ /** Waits for enough of a replacement raster layer to be safely presented. */
2519
+ function waitForInitialTileLayerReady(layer, options = {}) {
2520
+ const { loadingPolicy = 'full-batch', signal, startLoading, timeoutMs = TILE_LAYER_READY_TIMEOUT_MS, } = options;
2521
+ return new Promise((resolve, reject) => {
2522
+ if (signal?.aborted) {
2523
+ reject(createAbortError());
2524
+ return;
2525
+ }
2526
+ let timeout;
2527
+ let settled = false;
2528
+ const cleanup = () => {
2529
+ layer.off('load', handleLoad);
2530
+ layer.off('tileload', handleTileLoad);
2531
+ layer.off('tileerror', handleTileError);
2532
+ signal?.removeEventListener('abort', handleAbort);
2533
+ if (timeout !== undefined)
2534
+ clearTimeout(timeout);
2535
+ };
2536
+ const settle = (error) => {
2537
+ if (settled)
2538
+ return;
2539
+ settled = true;
2540
+ cleanup();
2541
+ if (error)
2542
+ reject(error);
2543
+ else
2544
+ resolve();
2545
+ };
2546
+ const handleLoad = () => loadingPolicy === 'full-batch'
2547
+ ? settle()
2548
+ : settle(new Error('Raster tiles failed to load.'));
2549
+ const handleTileLoad = () => {
2550
+ if (loadingPolicy === 'progressive')
2551
+ settle();
2552
+ };
2553
+ const handleTileError = () => {
2554
+ if (loadingPolicy === 'full-batch') {
2555
+ settle(new Error('Raster tiles failed to load.'));
2556
+ }
2557
+ };
2558
+ const handleAbort = () => settle(createAbortError());
2559
+ layer.on('load', handleLoad);
2560
+ layer.on('tileload', handleTileLoad);
2561
+ layer.on('tileerror', handleTileError);
2562
+ signal?.addEventListener('abort', handleAbort, { once: true });
2563
+ timeout = setTimeout(() => settle(new Error('Raster tile loading timed out.')), Math.max(0, timeoutMs));
2564
+ if (startLoading) {
2565
+ try {
2566
+ startLoading();
2567
+ if (!layer.isLoading())
2568
+ settle();
2569
+ }
2570
+ catch (error) {
2571
+ settle(toError(error));
2572
+ }
2573
+ }
2574
+ });
2575
+ }
2576
+ function createAbortError() {
2577
+ const error = new Error('Raster tile loading was cancelled.');
2578
+ error.name = 'AbortError';
2579
+ return error;
2580
+ }
2581
+ function toError(error) {
2582
+ return error instanceof Error ? error : new Error(String(error));
2583
+ }
2584
+
2585
+ const DEFAULT_VECTOR_PADDING = 0.2;
2586
+ const MAX_VECTOR_PADDING = 0.5;
2587
+ /** Normalizes the relative MapLibre viewport padding used for off-screen tile loading. */
2588
+ function normalizeVectorPadding(value) {
2589
+ if (!Number.isFinite(value))
2590
+ return DEFAULT_VECTOR_PADDING;
2591
+ return Math.max(0, Math.min(MAX_VECTOR_PADDING, value));
2592
+ }
2593
+
2594
+ const mapCss = () => `:host{display:block;width:100%;height:var(--q-map-height, 100%);min-width:0;min-height:var(--q-map-min-height, 240px);box-sizing:border-box}.map-surface{position:relative;width:100%;height:100%;min-height:inherit;box-sizing:border-box;overflow:hidden;background:var(--q-map-bg, var(--q-bg-surface-1, #1f2937));border:var(--q-map-border, var(--q-border, 1px solid var(--q-border-color, #374151)));border-radius:var(--q-map-radius, var(--q-radius-lg, 11px))}.map-canvas{width:100%;height:100%;min-height:inherit;background:inherit;outline:none}.map-canvas:focus-visible{box-shadow:inset 0 0 0 2px var(--q-color-primary, #60a5fa)}.map-icon-registration{display:none}.map-empty{position:absolute;z-index:900;top:50%;left:50%;max-width:calc(100% - 32px);padding:8px 12px;transform:translate(-50%, -50%);border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-bg-base, #111827);color:var(--q-fg-muted, #9ca3af);box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.2));font-family:var(--q-font-family, inherit);font-size:var(--q-font-size-sm, 0.8rem);line-height:1.4;text-align:center;pointer-events:none}.map-error{color:var(--q-color-danger, #ef4444)}.map-attribution{position:absolute;z-index:1000;right:0;bottom:0;max-width:calc(100% - 8px);padding:2px 6px;overflow:hidden;background:var(--q-map-attribution-bg, var(--q-bg-base, #111827));color:var(--q-map-attribution-color, var(--q-fg-muted, #9ca3af));font-family:var(--q-font-family, inherit);font-size:var(--q-font-size-xs, 0.7rem);line-height:1.4;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}a.map-attribution:hover,a.map-attribution:focus-visible{color:var(--q-fg-base, #f9fafb);text-decoration:underline}a.map-attribution:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:-2px}.visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-tooltip-pane{position:absolute;top:0;left:0}.leaflet-container{overflow:hidden;-webkit-tap-highlight-color:transparent;touch-action:none}.maplibregl-map{position:relative;overflow:hidden;-webkit-tap-highlight-color:transparent}.maplibregl-canvas{position:absolute;top:0;left:0}.maplibregl-control-container{display:none}.leaflet-zoom-animated{transform-origin:0 0}.leaflet-tile-container.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform 250ms cubic-bezier(0, 0, 0.25, 1);will-change:transform}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{display:block;user-select:none;-webkit-user-drag:none}.leaflet-container .leaflet-tile-pane img,.leaflet-container .leaflet-tile{width:auto;max-width:none !important;max-height:none !important;padding:0}.leaflet-tile-pane{filter:var(--q-map-tile-filter, none)}.leaflet-tile{visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{position:relative;z-index:800;float:left;clear:both;pointer-events:auto}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive{pointer-events:auto}.leaflet-grab{cursor:grab}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-marker-draggable{cursor:grabbing}.leaflet-interactive{cursor:pointer}.leaflet-bar{overflow:hidden;border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-bg-base, #111827);box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.2))}.leaflet-bar a{display:block;width:30px;height:30px;border-bottom:1px solid var(--q-border-color, #374151);background:var(--q-bg-base, #111827);color:var(--q-fg-base, #f9fafb);font:700 18px/30px var(--q-font-family, sans-serif);text-align:center;text-decoration:none}.leaflet-bar a:last-child{border-bottom:0}.leaflet-bar a:hover,.leaflet-bar a:focus-visible{background:var(--q-bg-surface-2, #374151);color:var(--q-color-primary, #60a5fa)}.leaflet-bar a:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:-2px}.leaflet-bar a.leaflet-disabled{color:var(--q-fg-disabled, #6b7280);cursor:default}.q-map-marker-position{--q-map-marker-rendered-size:var(--q-map-marker-size, 20px);width:var(--q-map-marker-rendered-size) !important;height:var(--q-map-marker-rendered-size) !important;margin-top:calc(var(--q-map-marker-rendered-size) * -0.5) !important;margin-left:calc(var(--q-map-marker-rendered-size) * -0.5) !important}.q-map-marker-position.size-small{--q-map-marker-rendered-size:var(--q-map-marker-size-small, 16px)}.q-map-marker-position.size-medium{--q-map-marker-rendered-size:var(--q-map-marker-size-medium, var(--q-map-marker-size, 20px))}.q-map-marker-position.size-large{--q-map-marker-rendered-size:var(--q-map-marker-size-large, 24px)}.q-map-marker{position:relative;display:grid;width:100%;height:100%;place-items:center;box-sizing:border-box;border:3px solid var(--q-bg-base, #111827);border-radius:50%;background:var(--q-map-marker-color, var(--q-color-primary, #60a5fa));box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.3));outline:none;transition:box-shadow 160ms ease}.q-map-marker.variant-success{background:var(--q-map-marker-success, var(--q-color-success, #22c55e))}.q-map-marker.variant-warning{background:var(--q-map-marker-warning, var(--q-color-warning, #f59e0b))}.q-map-marker.variant-danger{background:var(--q-map-marker-danger, var(--q-color-danger, #ef4444))}.q-map-marker.variant-muted{background:var(--q-map-marker-muted, var(--q-fg-muted, #9ca3af))}.q-map-marker.is-selected{box-shadow:0 0 0 3px var(--q-map-marker-selected-color, var(--q-fg-base, #f9fafb)), var( --q-map-marker-selected-shadow, var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3)) )}.q-map-marker:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:4px}.q-map-marker__center{display:grid;width:30%;height:30%;place-items:center;overflow:hidden;border-radius:50%;background:var(--q-bg-base, #111827);pointer-events:none}.q-map-marker.has-content{padding:var(--q-map-marker-content-gap, 2px)}.q-map-marker.has-content .q-map-marker__center{width:100%;height:100%;background:var(--q-map-marker-content-bg, var(--q-bg-base, #111827));color:var(--q-map-marker-content-color, var(--q-fg-base, #f9fafb));font:700 clamp(0.5rem, calc(var(--q-map-marker-rendered-size, var(--q-map-marker-size, 20px)) * 0.25), 0.75rem) / 1 var(--q-font-family, sans-serif)}.q-map-marker__fallback,.q-map-marker__image{grid-area:1 / 1}.q-map-marker__fallback{max-width:100%;overflow:hidden;text-overflow:clip;white-space:nowrap}.q-map-marker__image{display:block;width:100%;height:100%;border-radius:inherit;object-fit:cover}.q-map-marker__image[hidden]{display:none}.q-map-marker__content{position:relative;z-index:1;display:grid;width:100%;height:100%;place-items:center;pointer-events:none}.q-map-marker.kind-icon{border-radius:var(--q-radius-md, 8px)}.q-map-marker.kind-icon .q-map-marker__center{border-radius:calc(var(--q-radius-md, 8px) - 3px)}.q-map-marker__icon{width:var(--q-map-marker-icon-size, 58%) !important;height:var(--q-map-marker-icon-size, 58%) !important;transform:translate( var(--q-map-marker-icon-offset-x, 0), var(--q-map-marker-icon-offset-y, 0) );color:var(--q-map-marker-content-color, var(--q-fg-base, #f9fafb));pointer-events:none}.q-map-marker__icon[hidden]{display:none}.q-map-marker.ring-solid::after,.q-map-marker.ring-dashed::after{position:absolute;z-index:0;inset:-7px;box-sizing:border-box;border:2px solid var(--q-map-marker-ring-color, currentColor);border-radius:inherit;content:'';pointer-events:none}.q-map-marker.ring-dashed::after{border-style:dashed}.q-map-marker.is-pulsing::before{position:absolute;z-index:0;inset:-4px;border:2px solid var(--q-map-marker-pulse-color, var(--q-color-primary, #60a5fa));border-radius:inherit;content:'';pointer-events:none;animation:q-map-marker-pulse 1.8s ease-out infinite}@keyframes q-map-marker-pulse{0%{opacity:0.85;transform:scale(0.9)}75%,100%{opacity:0;transform:scale(1.8)}}.q-map-marker__badge{position:absolute;z-index:3;right:-7px;bottom:-6px;display:inline-flex;min-width:14px;height:14px;padding:0 3px;align-items:center;justify-content:center;gap:2px;box-sizing:border-box;border:2px solid var(--q-bg-base, #111827);border-radius:999px;background:var(--q-map-marker-color, var(--q-color-primary, #60a5fa));color:var(--q-fg-base, #f9fafb);font:700 8px/1 var(--q-font-family, sans-serif);white-space:nowrap}.q-map-marker__badge[hidden]{display:none}.q-map-marker__badge.variant-success{background:var(--q-map-marker-success, var(--q-color-success, #22c55e))}.q-map-marker__badge.variant-warning{background:var(--q-map-marker-warning, var(--q-color-warning, #f59e0b))}.q-map-marker__badge.variant-danger{background:var(--q-map-marker-danger, var(--q-color-danger, #ef4444))}.q-map-marker__badge.variant-muted{background:var(--q-map-marker-muted, var(--q-fg-muted, #9ca3af))}.q-map-marker__badge-icon{width:8px !important;height:8px !important}.q-map-marker__badge-icon[hidden],.q-map-marker__badge-text[hidden]{display:none}.q-map-cluster-position{width:var(--q-map-marker-cluster-size, 32px) !important;height:var(--q-map-marker-cluster-size, 32px) !important;margin-top:calc(var(--q-map-marker-cluster-size, 32px) * -0.5) !important;margin-left:calc(var(--q-map-marker-cluster-size, 32px) * -0.5) !important}.q-map-cluster{position:relative;display:grid;width:100%;height:100%;place-items:center;box-sizing:border-box;border:2px solid color-mix(in srgb, var(--q-color-primary, #60a5fa) 70%, white);border-radius:50%;background:color-mix(in srgb, var(--q-color-primary, #60a5fa) 24%, var(--q-bg-base, #111827));box-shadow:0 0 0 4px color-mix(in srgb, var(--q-color-primary, #60a5fa) 18%, transparent), var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3));color:var(--q-fg-base, #f9fafb);outline:none;transition:box-shadow 160ms ease}.q-map-cluster.contains-selection{box-shadow:0 0 0 3px var(--q-map-marker-selected-color, var(--q-fg-base, #f9fafb)), 0 0 0 7px color-mix(in srgb, var(--q-color-primary, #60a5fa) 28%, transparent), var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3))}.q-map-cluster:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:4px}.q-map-cluster__content{display:grid;width:100%;height:100%;place-items:center;pointer-events:none}.q-map-cluster__count{font:700 0.7rem/1 var(--q-font-family, sans-serif)}.leaflet-tooltip{position:absolute;box-sizing:border-box;white-space:nowrap;pointer-events:none;user-select:none}.q-map-callout{width:var(--q-map-marker-callout-width, var(--q-map-marker-callout-max-width, 220px));max-width:calc(100vw - 24px);padding:7px 9px;border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-map-marker-callout-bg, color-mix(in srgb, var(--q-bg-base, #111827) 94%, transparent));color:var(--q-fg-base, #f9fafb);box-shadow:var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3));font-family:var(--q-font-family, sans-serif)}.q-map-callout.leaflet-tooltip-top{margin-top:-20px}.q-map-callout.leaflet-tooltip-bottom{margin-top:20px}.q-map-callout.leaflet-tooltip-left{margin-left:-20px}.q-map-callout.leaflet-tooltip-right{margin-left:20px}.q-map-callout__content{display:grid;min-width:0;gap:2px}.q-map-callout__heading{display:flex;min-width:0;align-items:center;gap:6px}.q-map-callout__title,.q-map-callout__subtitle,.q-map-callout__meta{overflow:hidden;text-overflow:ellipsis}.q-map-callout__title{flex:1 1 auto;min-width:0;color:inherit;font-size:var(--q-font-size-sm, 0.8rem);font-weight:700}.q-map-callout__subtitle,.q-map-callout__meta{color:var(--q-fg-muted, #9ca3af);font-size:var(--q-font-size-xs, 0.7rem)}.q-map-callout__subtitle{min-width:0}.q-map-callout__status{--q-map-marker-callout-status-accent:var(--q-color-primary, #60a5fa);display:inline-flex;flex:none;max-width:var(--q-map-marker-callout-status-max-width, 45%);margin-inline-start:auto;min-height:18px;padding:2px 6px;align-items:center;overflow:hidden;box-sizing:border-box;border:1px solid color-mix(in srgb, var(--q-map-marker-callout-status-accent) 34%, transparent);border-radius:999px;background:color-mix(in srgb, var(--q-map-marker-callout-status-accent) 16%, transparent);color:var(--q-map-marker-callout-status-accent);font-size:var(--q-font-size-xs, 0.7rem);font-weight:600;line-height:1;text-overflow:ellipsis;white-space:nowrap}.q-map-callout__status.variant-success{--q-map-marker-callout-status-accent:var(--q-color-success, #34d399)}.q-map-callout__status.variant-warning{--q-map-marker-callout-status-accent:var(--q-color-warning, #fbbf24)}.q-map-callout__status.variant-danger{--q-map-marker-callout-status-accent:var(--q-color-danger, #f87171)}.q-map-callout__status.variant-muted{--q-map-marker-callout-status-accent:var(--q-fg-muted, #9ca3af)}.q-map-callout__meta{color:var(--q-map-marker-callout-meta-color, var(--q-color-primary, #60a5fa))}.q-map-callout__stats{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:6px 8px;margin:4px 0 0;padding:5px 0 0;border-top:1px solid color-mix(in srgb, var(--q-border-color, #374151) 70%, transparent)}.q-map-callout__stat{min-width:0}.q-map-callout__stat.layout-wide{grid-column:1 / -1}.q-map-callout__stat-label,.q-map-callout__stat-value{margin:0;overflow:hidden;text-overflow:ellipsis}.q-map-callout__stat-label{color:var(--q-fg-muted, #9ca3af);font-size:var(--q-font-size-2xs, 0.625rem);line-height:1.2;white-space:nowrap}.q-map-callout__stat-value{margin-top:1px;color:inherit;font-size:var(--q-font-size-xs, 0.7rem);font-weight:600;line-height:1.25;white-space:nowrap}.q-map-callout__stat.layout-wide .q-map-callout__stat-value{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal}.q-map-callout__subtitle[hidden],.q-map-callout__status[hidden],.q-map-callout__meta[hidden],.q-map-callout__stats[hidden]{display:none}@media (prefers-reduced-motion: reduce){.q-map-marker,.q-map-cluster{transition:none}.q-map-marker.is-pulsing::before{opacity:0.65;animation:none;transform:none}}`;
2595
+
2596
+ const GOOGLE_MAP_TYPES = ['roadmap', 'satellite', 'terrain', 'hybrid'];
2597
+ const SMOOTH_ZOOM_DELTA = 0.5;
2598
+ const SMOOTH_ZOOM_SNAP = 0.25;
2599
+ const SMOOTH_WHEEL_DEBOUNCE_MS = 16;
2600
+ const SMOOTH_WHEEL_PIXELS_PER_LEVEL = 120;
2601
+ const VECTOR_SYMBOL_FADE_DURATION_MS = 750;
2602
+ const MARKER_VISIBILITY_ATTEMPTS = 3;
2603
+ const MARKER_VISIBILITY_MIN_ANIMATION_MS = 275;
2604
+ const MARKER_VISIBILITY_SETTLE_TIMEOUT_MS = 500;
2605
+ const QMap = class {
2606
+ constructor(hostRef) {
2607
+ index.registerInstance(this, hostRef);
2608
+ this.qReady = index.createEvent(this, "qReady");
2609
+ this.qMapClick = index.createEvent(this, "qMapClick");
2610
+ this.qMarkerSelect = index.createEvent(this, "qMarkerSelect");
2611
+ this.qClusterSelect = index.createEvent(this, "qClusterSelect");
2612
+ this.qStatusChange = index.createEvent(this, "qStatusChange");
2613
+ this.qError = index.createEvent(this, "qError");
2614
+ }
2615
+ get el() { return index.getElement(this); }
2616
+ /** Rendered for raster tiles and styled vectors. */
2617
+ attribution = '';
2618
+ /** Links attribution only for HTTP(S) URLs. */
2619
+ attributionUrl = '';
2620
+ /** Accepts an array or JSON and reconciles markers using type-stable IDs. */
2621
+ markers = [];
2622
+ /** Preserves stable source IDs while grouping nearby markers. */
2623
+ clusterMarkers = false;
2624
+ /** Screen-pixel radius clamped from 1 to 200. */
2625
+ clusterRadius = 48;
2626
+ clusterMinPoints = 2;
2627
+ /** Defaults to one below `maxZoom`. */
2628
+ clusterMaxZoom;
2629
+ /** Finite values are clamped to the geographic range. */
2630
+ centerLatitude = 0;
2631
+ /** Finite values are clamped to the geographic range. */
2632
+ centerLongitude = 0;
2633
+ /** Clamped between the normalized zoom limits. */
2634
+ zoom = 2;
2635
+ zoomControls = true;
2636
+ /** Non-finite values normalize to zero. */
2637
+ minZoom = 0;
2638
+ /** Never resolves below `minZoom`. */
2639
+ maxZoom = 19;
2640
+ /** Accepts an object or JSON; malformed updates preserve the last valid bounds. */
2641
+ maxBounds;
2642
+ /** Clamped from zero to one. */
2643
+ maxBoundsViscosity = 1;
2644
+ /** Controls the selected visual and `aria-pressed` state. */
2645
+ selectedMarkerId;
2646
+ /** Non-tile provider failures may fall back to `tileUrl`. */
2647
+ provider = 'tiles';
2648
+ /** Tile template used by the tiles provider and optional provider fallback. */
2649
+ tileUrl = '';
2650
+ /** Preloads zero to four raster-tile rows and columns beyond the viewport. */
2651
+ tilePreloadBuffer = DEFAULT_TILE_PRELOAD_BUFFER;
2652
+ /** Selects full-batch or progressive raster replacement and zoom loading. */
2653
+ rasterTileLoadingPolicy = 'full-batch';
2654
+ /** MapLibre Style Specification URL for the vector provider. */
2655
+ vectorStyleUrl = '';
2656
+ /** Extends rendering beyond the viewport; clamped from zero to one-half. */
2657
+ vectorPadding = DEFAULT_VECTOR_PADDING;
2658
+ /** Browser-restricted key used only when WebQuark loads Google Maps. */
2659
+ googleApiKey = '';
2660
+ /** Unsupported values normalize to `roadmap`. */
2661
+ googleMapType = 'roadmap';
2662
+ /** Accessible name for the interactive map region. */
2663
+ ariaLabel = 'Interactive map';
2664
+ /** Emitted after Leaflet setup and the initial provider attempt complete. */
2665
+ qReady;
2666
+ /** Excludes drags and interactive-layer clicks. */
2667
+ qMapClick;
2668
+ /** Does not mutate `selectedMarkerId`. */
2669
+ qMarkerSelect;
2670
+ /** Emitted before the default center-and-zoom action; cancel to prevent it. */
2671
+ qClusterSelect;
2672
+ /** Includes the active fallback provider. */
2673
+ qStatusChange;
2674
+ /** Reports serializable configuration and initialization failures. */
2675
+ qError;
2676
+ providerStatus = 'initializing';
2677
+ activeProvider;
2678
+ usingFallback = false;
2679
+ errorMessage;
2680
+ leaflet;
2681
+ map;
2682
+ canvas;
2683
+ resizeObserver;
2684
+ resizeFrame;
2685
+ initializationToken = 0;
2686
+ markerVisibilityToken = 0;
2687
+ cancelMarkerVisibilityPan;
2688
+ layerController;
2689
+ markerController;
2690
+ lastInvalidBoundsInput;
2691
+ reportedRequestedProvider;
2692
+ baseLayerSyncQueued = false;
2693
+ hasLoaded = false;
2694
+ connected = false;
2695
+ connectedCallback() {
2696
+ this.connected = true;
2697
+ if (this.hasLoaded)
2698
+ void this.initializeMap();
2699
+ }
2700
+ componentDidLoad() {
2701
+ this.hasLoaded = true;
2702
+ void this.initializeMap();
2703
+ }
2704
+ disconnectedCallback() {
2705
+ this.connected = false;
2706
+ this.initializationToken += 1;
2707
+ this.destroyMap();
2708
+ }
2709
+ /** Minimally pans to fully expose a marker or its current cluster without changing zoom. */
2710
+ async ensureMarkerVisible(markerId, occlusions) {
2711
+ const operationToken = ++this.markerVisibilityToken;
2712
+ this.cancelMarkerVisibilityPan?.();
2713
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2714
+ return 'unavailable';
2715
+ let panned = false;
2716
+ for (let attempt = 0; attempt < MARKER_VISIBILITY_ATTEMPTS; attempt += 1) {
2717
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2718
+ return 'unavailable';
2719
+ const map = this.map;
2720
+ const canvas = this.canvas;
2721
+ const controller = this.markerController;
2722
+ if (!map || !canvas || !controller)
2723
+ return 'unavailable';
2724
+ const target = controller.getVisibilityTarget(markerId);
2725
+ if (!target)
2726
+ return 'unavailable';
2727
+ const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2728
+ const obstacles = this.getMarkerVisibilityOcclusions(occlusions);
2729
+ const targetRect = target.rendered
2730
+ ? getRenderedMapItemRect(target.rendered.element, target.rendered.kind)
2731
+ : this.getCoordinateRect(target.latitude, target.longitude, viewport);
2732
+ if (target.rendered && isRectFullyVisible(targetRect, viewport, obstacles)) {
2733
+ return panned ? 'panned' : 'visible';
2734
+ }
2735
+ const translation = getMinimalVisibleTranslation(targetRect, viewport, obstacles);
2736
+ if (!translation)
2737
+ return 'constrained';
2738
+ if (Math.abs(translation.x) < 0.01 && Math.abs(translation.y) < 0.01) {
2739
+ controller.syncSelection();
2740
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2741
+ return 'unavailable';
2742
+ await this.waitForMarkerLayout();
2743
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2744
+ return 'unavailable';
2745
+ continue;
2746
+ }
2747
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2748
+ return 'unavailable';
2749
+ await this.panByMarkerTranslation(map, translation.x, translation.y, operationToken);
2750
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2751
+ return 'unavailable';
2752
+ panned = true;
2753
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2754
+ return 'unavailable';
2755
+ await this.waitForMarkerLayout();
2756
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2757
+ return 'unavailable';
2758
+ }
2759
+ if (!this.isMarkerVisibilityCurrent(operationToken))
2760
+ return 'unavailable';
2761
+ const map = this.map;
2762
+ const canvas = this.canvas;
2763
+ const target = this.markerController?.getVisibilityTarget(markerId);
2764
+ if (!map || !canvas || !target)
2765
+ return 'unavailable';
2766
+ if (!target.rendered)
2767
+ return 'constrained';
2768
+ const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2769
+ const targetRect = getRenderedMapItemRect(target.rendered.element, target.rendered.kind);
2770
+ return isRectFullyVisible(targetRect, viewport, this.getMarkerVisibilityOcclusions(occlusions)) ? (panned ? 'panned' : 'visible') : 'constrained';
2771
+ }
2772
+ handleBaseLayerChange() {
2773
+ this.scheduleBaseLayerSync();
2774
+ }
2775
+ handleTilePreloadBufferChange() {
2776
+ const requestedProvider = this.getProvider();
2777
+ const activeProvider = this.layerController?.getActiveState().activeProvider;
2778
+ if (isTilePreloadBufferRelevant(requestedProvider, activeProvider)) {
2779
+ this.scheduleBaseLayerSync();
2780
+ }
2781
+ }
2782
+ handleVectorPaddingChange() {
2783
+ const requestedProvider = this.getProvider();
2784
+ const activeProvider = this.layerController?.getActiveState().activeProvider;
2785
+ if (isVectorPaddingRelevant(requestedProvider, activeProvider)) {
2786
+ this.scheduleBaseLayerSync();
2787
+ }
2788
+ }
2789
+ scheduleBaseLayerSync() {
2790
+ if (!this.map) {
2791
+ void this.initializeMap();
2792
+ return;
2793
+ }
2794
+ if (this.baseLayerSyncQueued)
2795
+ return;
2796
+ this.baseLayerSyncQueued = true;
2797
+ queueMicrotask(() => {
2798
+ this.baseLayerSyncQueued = false;
2799
+ if (this.connected && this.map)
2800
+ void this.syncBaseLayer();
2801
+ });
2802
+ }
2803
+ handleMarkersChange() {
2804
+ this.markerController?.sync(this.markers);
2805
+ }
2806
+ handleMarkerClusteringChange() {
2807
+ this.markerController?.sync(this.markers);
2808
+ }
2809
+ handleSelectedMarkerChange() {
2810
+ this.markerController?.syncSelection();
2811
+ }
2812
+ handleViewChange() {
2813
+ this.syncView(true);
2814
+ }
2815
+ handleZoomLimitsChange() {
2816
+ if (!this.map)
2817
+ return;
2818
+ const { minimum, maximum } = this.getZoomLimits();
2819
+ this.map.setMinZoom(minimum);
2820
+ this.map.setMaxZoom(maximum);
2821
+ this.syncView();
2822
+ void this.syncBaseLayer();
2823
+ this.markerController?.sync(this.markers);
2824
+ }
2825
+ handleBoundsChange() {
2826
+ this.syncBounds(true);
2827
+ }
2828
+ handleZoomControlsChange() {
2829
+ if (!this.map)
2830
+ return;
2831
+ this.destroyMap();
2832
+ void this.initializeMap();
2833
+ }
2834
+ setCanvas = (element) => {
2835
+ this.canvas = element ?? undefined;
2836
+ };
2837
+ handleMapClick = (event) => {
2838
+ this.qMapClick.emit({
2839
+ latitude: event.latlng.lat,
2840
+ longitude: event.latlng.lng,
2841
+ originalEvent: event.originalEvent,
2842
+ });
2843
+ };
2844
+ async initializeMap() {
2845
+ if (this.map || !this.canvas || !this.connected || typeof window === 'undefined')
2846
+ return;
2847
+ const token = ++this.initializationToken;
2848
+ this.setProviderStatus('initializing', undefined, false, true);
2849
+ try {
2850
+ const leaflet = this.leaflet ?? (await Promise.resolve().then(function () { return require('./leaflet-src-BX4jwTf5.js'); }).then(function (n) { return n.leafletSrc; }));
2851
+ this.leaflet = leaflet;
2852
+ if (token !== this.initializationToken || !this.canvas || !this.connected || !this.el.isConnected)
2853
+ return;
2854
+ const { minimum, maximum } = this.getZoomLimits();
2855
+ const boundsResolution = resolveMapBounds(this.maxBounds);
2856
+ const smoothMotion = !this.prefersReducedMotion();
2857
+ this.map = leaflet.map(this.canvas, {
2858
+ attributionControl: false,
2859
+ fadeAnimation: smoothMotion,
2860
+ inertia: false,
2861
+ keyboard: true,
2862
+ markerZoomAnimation: smoothMotion,
2863
+ maxBounds: getInitialLeafletMapBounds(boundsResolution),
2864
+ maxBoundsViscosity: getMapBoundsViscosity(this.maxBoundsViscosity),
2865
+ maxZoom: maximum,
2866
+ minZoom: minimum,
2867
+ trackResize: false,
2868
+ wheelDebounceTime: smoothMotion ? SMOOTH_WHEEL_DEBOUNCE_MS : 40,
2869
+ wheelPxPerZoomLevel: smoothMotion ? SMOOTH_WHEEL_PIXELS_PER_LEVEL : 60,
2870
+ zoomAnimation: smoothMotion,
2871
+ zoomControl: this.zoomControls,
2872
+ zoomDelta: smoothMotion ? SMOOTH_ZOOM_DELTA : 1,
2873
+ zoomSnap: smoothMotion ? SMOOTH_ZOOM_SNAP : 1,
2874
+ });
2875
+ if (boundsResolution.kind === 'invalid')
2876
+ this.reportInvalidBounds(boundsResolution.message);
2877
+ else
2878
+ this.lastInvalidBoundsInput = undefined;
2879
+ this.bindMapEvents(this.map);
2880
+ this.createControllers(this.map, leaflet);
2881
+ this.syncView();
2882
+ await this.syncBaseLayer();
2883
+ if (token !== this.initializationToken || !this.map || !this.connected)
2884
+ return;
2885
+ this.markerController?.sync(this.markers);
2886
+ this.observeResize();
2887
+ this.map.invalidateSize({ animate: false, pan: false });
2888
+ this.qReady.emit();
2889
+ }
2890
+ catch (error) {
2891
+ if (token !== this.initializationToken)
2892
+ return;
2893
+ this.destroyMap();
2894
+ this.errorMessage = 'Map failed to initialize.';
2895
+ this.setProviderStatus('error', undefined, false);
2896
+ this.reportError('leaflet-initialization-failed', error, false);
2897
+ }
2898
+ }
2899
+ bindMapEvents(map) {
2900
+ map.on('click', this.handleMapClick);
2901
+ }
2902
+ unbindMapEvents(map) {
2903
+ map.off('click', this.handleMapClick);
2904
+ }
2905
+ createControllers(map, leaflet) {
2906
+ this.layerController = new MapBaseLayerController({
2907
+ attach: async (layer, provider, context) => {
2908
+ if (provider === 'tiles') {
2909
+ const tileLayer = layer;
2910
+ if (context.replacing) {
2911
+ await waitForInitialTileLayerReady(tileLayer, {
2912
+ loadingPolicy: this.getRasterTileLoadingPolicy(),
2913
+ signal: context.signal,
2914
+ startLoading: () => layer.addTo(map),
2915
+ });
2916
+ }
2917
+ else {
2918
+ layer.addTo(map);
2919
+ }
2920
+ }
2921
+ else {
2922
+ layer.addTo(map);
2923
+ }
2924
+ if (provider === 'vector')
2925
+ await waitForMapLibreLayerReady(layer);
2926
+ },
2927
+ createGoogle: async (config) => {
2928
+ await loadGoogleMapsApi(config.googleApiKey);
2929
+ const GoogleMutant = await loadGoogleMutantConstructor(leaflet);
2930
+ return new GoogleMutant({
2931
+ type: config.googleMapType,
2932
+ minZoom: config.minZoom,
2933
+ maxZoom: config.maxZoom,
2934
+ });
2935
+ },
2936
+ createTiles: config => {
2937
+ const loadingPolicy = this.getRasterTileLoadingPolicy();
2938
+ return createBufferedTileLayer(leaflet, config.tileUrl, createRasterTileLayerOptions(config.minZoom, config.maxZoom, config.tilePreloadBuffer, loadingPolicy), config.tilePreloadBuffer, loadingPolicy);
2939
+ },
2940
+ createVector: async (config) => {
2941
+ const createMapLibreLayer = await loadMapLibreLayerFactory(leaflet);
2942
+ return createMapLibreLayer({
2943
+ attributionControl: false,
2944
+ fadeDuration: VECTOR_SYMBOL_FADE_DURATION_MS,
2945
+ interactive: false,
2946
+ maxTileCacheZoomLevels: 6,
2947
+ maxZoom: config.maxZoom,
2948
+ minZoom: config.minZoom,
2949
+ padding: config.vectorPadding,
2950
+ style: config.vectorStyleUrl,
2951
+ updateInterval: 16,
2952
+ });
2953
+ },
2954
+ });
2955
+ this.markerController = new MapMarkerController({
2956
+ map,
2957
+ leaflet,
2958
+ getSelectedMarkerId: () => this.selectedMarkerId,
2959
+ getClusteringOptions: () => normalizeMapMarkerClusteringOptions(this.clusterMarkers, this.clusterRadius, this.clusterMinPoints, this.clusterMaxZoom, map.getMaxZoom()),
2960
+ prefersReducedMotion: () => this.prefersReducedMotion(),
2961
+ onMarkerSelect: (marker, originalEvent) => this.qMarkerSelect.emit({ marker, originalEvent }),
2962
+ onClusterSelect: detail => this.qClusterSelect.emit(detail).defaultPrevented,
2963
+ });
2964
+ }
2965
+ async syncBaseLayer() {
2966
+ const controller = this.layerController;
2967
+ if (!controller)
2968
+ return;
2969
+ const requestedProvider = this.getProvider();
2970
+ const current = controller.getActiveState();
2971
+ this.errorMessage = undefined;
2972
+ this.setProviderStatus('initializing', current.activeProvider, current.usingFallback);
2973
+ const { minimum, maximum } = this.getZoomLimits();
2974
+ const result = await controller.sync({
2975
+ requestedProvider,
2976
+ tileUrl: this.tileUrl.trim(),
2977
+ tilePreloadBuffer: normalizeTilePreloadBuffer(this.tilePreloadBuffer),
2978
+ vectorStyleUrl: this.vectorStyleUrl.trim(),
2979
+ vectorPadding: normalizeVectorPadding(this.vectorPadding),
2980
+ googleApiKey: this.googleApiKey.trim(),
2981
+ googleApiAvailable: hasGoogleMapsConfiguration(),
2982
+ googleMapType: this.getGoogleMapType(),
2983
+ minZoom: minimum,
2984
+ maxZoom: maximum,
2985
+ });
2986
+ if (controller !== this.layerController || result.kind === 'stale')
2987
+ return;
2988
+ if (result.kind === 'empty') {
2989
+ this.setProviderStatus('empty', undefined, false);
2990
+ return;
2991
+ }
2992
+ if (result.kind === 'ready') {
2993
+ if (result.warning)
2994
+ this.reportError('provider-initialization-failed', result.warning, true);
2995
+ this.setProviderStatus('ready', result.activeProvider, result.usingFallback);
2996
+ return;
2997
+ }
2998
+ this.reportError('provider-initialization-failed', result.error, true);
2999
+ if (result.fallbackError)
3000
+ this.reportError('fallback-initialization-failed', result.fallbackError, true);
3001
+ this.errorMessage = result.activeProvider
3002
+ ? 'The requested map provider failed. The previous map remains available.'
3003
+ : 'Map imagery failed to load.';
3004
+ this.setProviderStatus('error', result.activeProvider, result.usingFallback);
3005
+ }
3006
+ getZoomLimits() {
3007
+ const minimum = Number.isFinite(this.minZoom) ? this.minZoom : 0;
3008
+ const requestedMaximum = Number.isFinite(this.maxZoom) ? this.maxZoom : 19;
3009
+ return { minimum, maximum: Math.max(minimum, requestedMaximum) };
3010
+ }
3011
+ getCenter() {
3012
+ const latitude = Number.isFinite(this.centerLatitude) ? Math.max(-90, Math.min(90, this.centerLatitude)) : 0;
3013
+ const longitude = Number.isFinite(this.centerLongitude) ? Math.max(-180, Math.min(180, this.centerLongitude)) : 0;
3014
+ return [latitude, longitude];
3015
+ }
3016
+ getZoom() {
3017
+ const { minimum, maximum } = this.getZoomLimits();
3018
+ const zoom = Number.isFinite(this.zoom) ? this.zoom : minimum;
3019
+ return Math.max(minimum, Math.min(maximum, zoom));
3020
+ }
3021
+ getProvider() {
3022
+ return this.provider === 'google' || this.provider === 'vector' ? this.provider : 'tiles';
3023
+ }
3024
+ getRasterTileLoadingPolicy() {
3025
+ return this.rasterTileLoadingPolicy === 'progressive'
3026
+ ? 'progressive'
3027
+ : 'full-batch';
3028
+ }
3029
+ getGoogleMapType() {
3030
+ return GOOGLE_MAP_TYPES.includes(this.googleMapType) ? this.googleMapType : 'roadmap';
3031
+ }
3032
+ syncView(animate = false) {
3033
+ this.map?.setView(this.getCenter(), this.getZoom(), {
3034
+ animate: animate && !this.prefersReducedMotion(),
3035
+ });
3036
+ }
3037
+ getMarkerVisibilityOcclusions(occlusions) {
3038
+ const obstacles = [...occlusions];
3039
+ const root = this.el.shadowRoot;
3040
+ if (!root)
3041
+ return obstacles;
3042
+ for (const element of Array.from(root.querySelectorAll('.leaflet-control, .map-attribution'))) {
3043
+ const style = element.ownerDocument.defaultView?.getComputedStyle(element);
3044
+ if (style?.display === 'none' || style?.visibility === 'hidden')
3045
+ continue;
3046
+ const rect = element.getBoundingClientRect();
3047
+ if (rect.width <= 0 || rect.height <= 0)
3048
+ continue;
3049
+ obstacles.push(this.toViewportRect(rect));
3050
+ }
3051
+ return obstacles;
3052
+ }
3053
+ getCoordinateRect(latitude, longitude, viewport) {
3054
+ const point = this.map?.latLngToContainerPoint([latitude, longitude]);
3055
+ const x = viewport.left + (point?.x ?? 0);
3056
+ const y = viewport.top + (point?.y ?? 0);
3057
+ return {
3058
+ top: y - 0.5,
3059
+ right: x + 0.5,
3060
+ bottom: y + 0.5,
3061
+ left: x - 0.5,
3062
+ };
3063
+ }
3064
+ toViewportRect(rect) {
3065
+ return {
3066
+ top: rect.top,
3067
+ right: rect.right,
3068
+ bottom: rect.bottom,
3069
+ left: rect.left,
3070
+ };
3071
+ }
3072
+ async panByMarkerTranslation(map, x, y, operationToken) {
3073
+ const animate = !this.prefersReducedMotion();
3074
+ await new Promise(resolve => {
3075
+ const view = this.el.ownerDocument.defaultView;
3076
+ const startedAt = Date.now();
3077
+ let settled = false;
3078
+ let settleTimeout;
3079
+ let animationTimeout;
3080
+ const complete = () => {
3081
+ if (settled)
3082
+ return;
3083
+ settled = true;
3084
+ map.off('moveend', finish);
3085
+ if (settleTimeout !== undefined)
3086
+ view?.clearTimeout(settleTimeout);
3087
+ if (animationTimeout !== undefined)
3088
+ view?.clearTimeout(animationTimeout);
3089
+ if (this.cancelMarkerVisibilityPan === cancel) {
3090
+ this.cancelMarkerVisibilityPan = undefined;
3091
+ }
3092
+ resolve();
3093
+ };
3094
+ const finish = () => {
3095
+ if (settled)
3096
+ return;
3097
+ map.off('moveend', finish);
3098
+ if (settleTimeout !== undefined)
3099
+ view?.clearTimeout(settleTimeout);
3100
+ const remainingAnimation = animate
3101
+ ? Math.max(0, MARKER_VISIBILITY_MIN_ANIMATION_MS - (Date.now() - startedAt))
3102
+ : 0;
3103
+ if (remainingAnimation > 0 && view) {
3104
+ animationTimeout = view.setTimeout(complete, remainingAnimation);
3105
+ }
3106
+ else
3107
+ complete();
3108
+ };
3109
+ const cancel = () => {
3110
+ if (settled)
3111
+ return;
3112
+ map.stop();
3113
+ complete();
3114
+ };
3115
+ if (!this.isMarkerVisibilityCurrent(operationToken)) {
3116
+ complete();
3117
+ return;
3118
+ }
3119
+ this.cancelMarkerVisibilityPan = cancel;
3120
+ map.once('moveend', finish);
3121
+ settleTimeout = view?.setTimeout(finish, MARKER_VISIBILITY_SETTLE_TIMEOUT_MS);
3122
+ map.panBy([
3123
+ -roundPanOffset(x),
3124
+ -roundPanOffset(y),
3125
+ ], { animate });
3126
+ });
3127
+ }
3128
+ async waitForMarkerLayout() {
3129
+ await new Promise(resolve => {
3130
+ const view = this.el.ownerDocument.defaultView;
3131
+ if (!view || typeof view.requestAnimationFrame !== 'function') {
3132
+ queueMicrotask(resolve);
3133
+ return;
3134
+ }
3135
+ view.requestAnimationFrame(() => resolve());
3136
+ });
3137
+ }
3138
+ isMarkerVisibilityCurrent(operationToken) {
3139
+ return operationToken === this.markerVisibilityToken && this.connected;
3140
+ }
3141
+ prefersReducedMotion() {
3142
+ return typeof window !== 'undefined'
3143
+ && typeof window.matchMedia === 'function'
3144
+ && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3145
+ }
3146
+ syncBounds(reportInvalid) {
3147
+ if (!this.map)
3148
+ return;
3149
+ const resolution = resolveMapBounds(this.maxBounds);
3150
+ applyMapBounds(this.map, resolution, this.maxBoundsViscosity);
3151
+ if (resolution.kind === 'invalid') {
3152
+ if (reportInvalid)
3153
+ this.reportInvalidBounds(resolution.message);
3154
+ }
3155
+ else {
3156
+ this.lastInvalidBoundsInput = undefined;
3157
+ }
3158
+ }
3159
+ reportInvalidBounds(message) {
3160
+ if (this.lastInvalidBoundsInput === this.maxBounds)
3161
+ return;
3162
+ this.lastInvalidBoundsInput = this.maxBounds;
3163
+ this.reportError('invalid-max-bounds', new Error(message), true);
3164
+ }
3165
+ setProviderStatus(status, activeProvider, usingFallback, force = false) {
3166
+ const changed = status !== this.providerStatus
3167
+ || activeProvider !== this.activeProvider
3168
+ || usingFallback !== this.usingFallback
3169
+ || this.getProvider() !== this.reportedRequestedProvider;
3170
+ this.providerStatus = status;
3171
+ this.activeProvider = activeProvider;
3172
+ this.usingFallback = usingFallback;
3173
+ this.reportedRequestedProvider = this.getProvider();
3174
+ if (changed || force) {
3175
+ this.qStatusChange.emit({
3176
+ status,
3177
+ requestedProvider: this.getProvider(),
3178
+ activeProvider,
3179
+ usingFallback,
3180
+ });
3181
+ }
3182
+ }
3183
+ reportError(code, error, recoverable) {
3184
+ this.qError.emit({
3185
+ code,
3186
+ message: error instanceof Error ? error.message : String(error),
3187
+ requestedProvider: this.getProvider(),
3188
+ recoverable,
3189
+ });
3190
+ }
3191
+ observeResize() {
3192
+ if (!this.canvas || typeof ResizeObserver === 'undefined')
3193
+ return;
3194
+ this.resizeObserver?.disconnect();
3195
+ this.resizeObserver = new ResizeObserver(() => this.scheduleResize());
3196
+ this.resizeObserver.observe(this.canvas);
3197
+ }
3198
+ scheduleResize() {
3199
+ if (this.resizeFrame !== undefined)
3200
+ cancelAnimationFrame(this.resizeFrame);
3201
+ this.resizeFrame = requestAnimationFrame(() => {
3202
+ this.resizeFrame = undefined;
3203
+ this.map?.invalidateSize({ animate: false, debounceMoveend: true, pan: false });
3204
+ this.syncBounds(false);
3205
+ });
3206
+ }
3207
+ destroyMap() {
3208
+ this.markerVisibilityToken += 1;
3209
+ this.cancelMarkerVisibilityPan?.();
3210
+ this.cancelMarkerVisibilityPan = undefined;
3211
+ this.resizeObserver?.disconnect();
3212
+ this.resizeObserver = undefined;
3213
+ if (this.resizeFrame !== undefined) {
3214
+ cancelAnimationFrame(this.resizeFrame);
3215
+ this.resizeFrame = undefined;
3216
+ }
3217
+ this.markerController?.destroy();
3218
+ this.markerController = undefined;
3219
+ this.layerController?.destroy();
3220
+ this.layerController = undefined;
3221
+ const map = this.map;
3222
+ if (map) {
3223
+ this.unbindMapEvents(map);
3224
+ map.remove();
3225
+ }
3226
+ this.map = undefined;
3227
+ }
3228
+ renderAttribution() {
3229
+ if (this.activeProvider !== 'tiles' && this.activeProvider !== 'vector')
3230
+ return null;
3231
+ const attribution = this.attribution.trim();
3232
+ if (!attribution)
3233
+ return null;
3234
+ const attributionUrl = this.getAttributionUrl();
3235
+ if (!attributionUrl)
3236
+ return index.h("span", { class: "map-attribution", part: "attribution" }, attribution);
3237
+ return (index.h("a", { class: "map-attribution", part: "attribution", href: attributionUrl, target: "_blank", rel: "noopener noreferrer" }, attribution, index.h("span", { class: "visually-hidden" }, " (opens in a new tab)")));
3238
+ }
3239
+ getAttributionUrl() {
3240
+ const value = this.attributionUrl.trim();
3241
+ if (!value)
3242
+ return undefined;
3243
+ try {
3244
+ const url = new URL(value, this.el.ownerDocument.baseURI);
3245
+ return url.protocol === 'https:' || url.protocol === 'http:' ? value : undefined;
3246
+ }
3247
+ catch {
3248
+ return undefined;
3249
+ }
3250
+ }
3251
+ render() {
3252
+ return (index.h("div", { key: 'e8f0a6a23f0c2e874424e35b088bd3091ecb23b6', class: "map-surface", part: "surface" }, index.h("div", { key: 'fe43fc91c3c263d01cfcee5c094df092fd74c6c5', class: "map-canvas", part: "canvas", role: "region", "aria-label": this.ariaLabel, "aria-busy": this.providerStatus === 'initializing' ? 'true' : undefined, ref: this.setCanvas }), index.h("q-icon", { key: '39e345de020fec0c182422351b406f41758bae82', class: "map-icon-registration", "aria-hidden": "true" }), this.providerStatus === 'empty' && (index.h("div", { key: 'd6aa4d764750615fe1c74b800c092f12c9fb4a9b', class: "map-empty", part: "empty", role: "status" }, index.h("slot", { key: '4935d5cf52f507765594a42678a783bb08dce870', name: "empty" }, "Map provider is not configured."))), this.providerStatus === 'error' && (index.h("div", { key: 'a728fe92b6349a754701277fa60ec69c8b9d83a5', class: "map-empty map-error", part: "error", role: "alert" }, index.h("slot", { key: '8190ca2bc3c40b43f85c3505ce9e61c46929ebfb', name: "error" }, this.errorMessage ?? 'Map imagery is unavailable.'))), this.renderAttribution()));
3253
+ }
3254
+ static get watchers() { return {
3255
+ "provider": [{
3256
+ "handleBaseLayerChange": 0
3257
+ }],
3258
+ "tileUrl": [{
3259
+ "handleBaseLayerChange": 0
3260
+ }],
3261
+ "rasterTileLoadingPolicy": [{
3262
+ "handleBaseLayerChange": 0
3263
+ }],
3264
+ "vectorStyleUrl": [{
3265
+ "handleBaseLayerChange": 0
3266
+ }],
3267
+ "googleApiKey": [{
3268
+ "handleBaseLayerChange": 0
3269
+ }],
3270
+ "googleMapType": [{
3271
+ "handleBaseLayerChange": 0
3272
+ }],
3273
+ "tilePreloadBuffer": [{
3274
+ "handleTilePreloadBufferChange": 0
3275
+ }],
3276
+ "vectorPadding": [{
3277
+ "handleVectorPaddingChange": 0
3278
+ }],
3279
+ "markers": [{
3280
+ "handleMarkersChange": 0
3281
+ }],
3282
+ "clusterMarkers": [{
3283
+ "handleMarkerClusteringChange": 0
3284
+ }],
3285
+ "clusterRadius": [{
3286
+ "handleMarkerClusteringChange": 0
3287
+ }],
3288
+ "clusterMinPoints": [{
3289
+ "handleMarkerClusteringChange": 0
3290
+ }],
3291
+ "clusterMaxZoom": [{
3292
+ "handleMarkerClusteringChange": 0
3293
+ }],
3294
+ "selectedMarkerId": [{
3295
+ "handleSelectedMarkerChange": 0
3296
+ }],
3297
+ "centerLatitude": [{
3298
+ "handleViewChange": 0
3299
+ }],
3300
+ "centerLongitude": [{
3301
+ "handleViewChange": 0
3302
+ }],
3303
+ "zoom": [{
3304
+ "handleViewChange": 0
3305
+ }],
3306
+ "minZoom": [{
3307
+ "handleZoomLimitsChange": 0
3308
+ }],
3309
+ "maxZoom": [{
3310
+ "handleZoomLimitsChange": 0
3311
+ }],
3312
+ "maxBounds": [{
3313
+ "handleBoundsChange": 0
3314
+ }],
3315
+ "maxBoundsViscosity": [{
3316
+ "handleBoundsChange": 0
3317
+ }],
3318
+ "zoomControls": [{
3319
+ "handleZoomControlsChange": 0
3320
+ }]
3321
+ }; }
3322
+ };
3323
+ function roundPanOffset(value) {
3324
+ return Math.sign(value) * Math.ceil(Math.abs(value));
3325
+ }
3326
+ QMap.style = mapCss();
3327
+
3328
+ exports.q_map = QMap;