@webquark/core 1.0.2 → 1.1.0-dev.2

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