@florasync/leaflet-geokit 0.8.2 → 0.9.0

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 (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +140 -11
  3. package/dist/django/index.js +8999 -5044
  4. package/dist/django/index.js.map +1 -1
  5. package/dist/leaflet-geokit.es.js +21508 -5914
  6. package/dist/leaflet-geokit.es.js.map +1 -1
  7. package/dist/leaflet-geokit.external.es.js +18022 -2425
  8. package/dist/leaflet-geokit.external.es.js.map +1 -1
  9. package/dist/leaflet-geokit.umd.js +270 -19
  10. package/dist/leaflet-geokit.umd.js.map +1 -1
  11. package/dist/preact/index-DCKj0r6a.js +8545 -0
  12. package/dist/preact/index-DCKj0r6a.js.map +1 -0
  13. package/dist/preact/index.js +1 -1
  14. package/dist/preact-bundled/index.js +9001 -5036
  15. package/dist/preact-bundled/index.js.map +1 -1
  16. package/dist/react/index-DCKj0r6a.js +8545 -0
  17. package/dist/react/index-DCKj0r6a.js.map +1 -0
  18. package/dist/react/index.js +1 -1
  19. package/dist/react-bundled/index.js +9043 -5078
  20. package/dist/react-bundled/index.js.map +1 -1
  21. package/dist/types/components/LeafletDrawMapElement.d.ts +40 -1
  22. package/dist/types/external.d.ts +6 -0
  23. package/dist/types/index.d.ts +6 -0
  24. package/dist/types/lib/LayerRegistry.d.ts +19 -0
  25. package/dist/types/lib/MapController.d.ts +91 -1
  26. package/dist/types/lib/draw/L.Draw.Move.d.ts +1 -0
  27. package/dist/types/lib/draw/move-pointer.d.ts +12 -0
  28. package/dist/types/lib/layer-cake/LayerCakeManager.d.ts +9 -1
  29. package/dist/types/lib/layer-style-panel.d.ts +3 -0
  30. package/dist/types/lib/providers.d.ts +64 -0
  31. package/dist/types/lib/snapping.d.ts +30 -0
  32. package/dist/types/lib/tool-buttons.d.ts +2 -0
  33. package/dist/types/lib/tool-capabilities.d.ts +27 -0
  34. package/dist/types/lib/toolbar-accessibility.d.ts +3 -0
  35. package/dist/types/lib/toolbar-layout.d.ts +14 -0
  36. package/dist/types/lib/toolbar-styles.d.ts +2 -0
  37. package/dist/types/types/events.d.ts +14 -0
  38. package/dist/types/types/layers.d.ts +65 -0
  39. package/dist/types/types/public.d.ts +157 -2
  40. package/dist/types/utils/geojson-pipeline.d.ts +51 -0
  41. package/dist/types/utils/geojson.d.ts +15 -2
  42. package/dist/types/utils/grower-geometry.d.ts +107 -0
  43. package/docs/accessibility.md +142 -0
  44. package/docs/geojson-pipelines.md +145 -0
  45. package/docs/google-maps-adapter-spike.md +77 -0
  46. package/docs/grower-geometry.md +237 -0
  47. package/docs/layers.md +136 -0
  48. package/docs/providers.md +191 -0
  49. package/docs/snapping-and-measurements.md +42 -0
  50. package/docs/tool-capabilities.md +131 -0
  51. package/docs/tool-lifecycle.md +124 -0
  52. package/docs/toolbar-styling.md +118 -0
  53. package/package.json +24 -3
  54. package/dist/preact/index-DCGBWrrm.js +0 -4580
  55. package/dist/preact/index-DCGBWrrm.js.map +0 -1
  56. package/dist/react/index-DCGBWrrm.js +0 -4580
  57. package/dist/react/index-DCGBWrrm.js.map +0 -1
@@ -1,4580 +0,0 @@
1
- var Ge = Object.defineProperty;
2
- var He = (a, t, e) => t in a ? Ge(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var h = (a, t, e) => He(a, typeof t != "symbol" ? t + "" : t, e);
4
- import * as x from "leaflet";
5
- import "leaflet-draw";
6
- import "leaflet-ruler";
7
- const L = {
8
- Ready: "leaflet-draw:ready",
9
- Created: "leaflet-draw:created",
10
- Edited: "leaflet-draw:edited",
11
- Deleted: "leaflet-draw:deleted",
12
- Error: "leaflet-draw:error",
13
- Ingest: "leaflet-draw:ingest",
14
- Export: "leaflet-draw:export"
15
- }, K = {
16
- Status: "leaflet-geokit:status",
17
- Diagnostic: "leaflet-geokit:diagnostic"
18
- }, fe = {
19
- trace: 10,
20
- debug: 20,
21
- info: 30,
22
- warn: 40,
23
- error: 50
24
- };
25
- function Ve(a, t) {
26
- return a === "silent" ? !1 : fe[t] >= fe[a];
27
- }
28
- function Je() {
29
- try {
30
- return (/* @__PURE__ */ new Date()).toISOString();
31
- } catch {
32
- return "";
33
- }
34
- }
35
- function J(a, t = "debug", e = console) {
36
- let r = t;
37
- const o = (n) => (...s) => {
38
- try {
39
- if (!Ve(r, n)) return;
40
- const l = `[${Je()}][${a}][${n.toUpperCase()}]`, c = e[n];
41
- typeof c == "function" ? c(l, ...s) : e.log(l, ...s);
42
- } catch {
43
- }
44
- };
45
- return {
46
- get level() {
47
- return r;
48
- },
49
- setLevel(n) {
50
- r = n;
51
- },
52
- trace: o("trace"),
53
- debug: o("debug"),
54
- info: o("info"),
55
- warn: o("warn"),
56
- error: o("error"),
57
- child(n) {
58
- return J(`${a}:${n}`, r, e);
59
- }
60
- };
61
- }
62
- const Ze = '.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.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{float:left;clear:both}.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-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}', je = `.leaflet-draw-section{position:relative}.leaflet-draw-toolbar{margin-top:12px}.leaflet-draw-toolbar-top{margin-top:0}.leaflet-draw-toolbar-notop a:first-child{border-top-right-radius:0}.leaflet-draw-toolbar-nobottom a:last-child{border-bottom-right-radius:0}.leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAAeCAYAAACWuCNnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAG7AAABuwBHnU4NQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAbvSURBVHic7dtdbBxXFQfw/9nZ3SRKwAP7UFFUQOoHqGnUoEAoNghX9tyxVcpD1X0J+WgiUQmpfUB5ACSgG1qJIKASqBIUIauqAbWseIlqb+bOWHVR6y0FKZBEqdIUQROIREGRx3FFvR/38ODZst3a3nE8Ywfv+T2t7hzdM3fle/bOnWtACCGEEEIIIYQQQgghhBBCCCGEEEIIIcRa0EbfgBDdFItFKwzDAa3175LuWylVAvBIR/MxrXUp6Vxx9dp4VyObVEdKKW591lonXgiVUg6AHzPzk9ls9meVSmUh6RzXkz179uQKhcIgM+8CACI6U6vVnp+enm6knXt4ePiuTCbzWQAwxlSDIHg57ZwroDAMnwKwz3XdBzzPG08hxzsTNprQG2lTjtd13WFmfghAP4A+AJcATFiW9YNKpfL3uP0kUliiX4SG1pqUUpx0wXJd9/PMXAGwPWq6yMyPz8/P/7xarf4nyVwt7QV4JWkU52i8YwBu6bh0wRhzJAiCF5POCQCDg4N2Pp//NYDRjkuTxph9QRCESeYrFov5ubm5R5n5AIAPtV1aYOb7BgYGTpZKJeO67lFmPsbM9/i+/8Ja8y6zylhOYquPXhsvAJRKpczMzMwTAIaJ6LFGo+HNzs5eKRQKNxPRAWb+CoAjWuvn4vS35skWFasxAAdbbUlOYqVUPwAPwI4lLr8J4KeWZT1eqVTmksoZ5d2QghUVKx/AlmVCFph5yPf9l5LMCwBKqUksFqszRHQcAJj5GwB2MfOE7/tfTDKf4zjHiejrAE4CuNhqZ+bf2rY9FYbhGBH92/O8o47j3Oj7/uUk86+3XhsvACilHmPmgW3btn3pxIkTVzuvj4yMfNoY85wxZiQIglPd+lvTZIuq5xiAQwCe6evr218ul5tr6bNd9GiiAbyvS+hFrfVHk8oLbEzBih4Dz+G9K6t3IaLXFhYWdib5eBh911UA8wBu1lq/CQBDQ0M3WJb1OoAdRPQZz/NeSSqnUuofAKpa6/vb26MfwacA7AdwFcCdWuu/JpU3yl1C91VHoquNXhvvyMjIx4wxr1iWtbNSqfxruTjHcR4AcMj3/bu79XnNe1hpFyvHcXYT0QS6FysASHR1tVEKhcIguhQrAGDm23K53BcATCWV27KsAWYGgPOtYgUAU1NT/1RKnQewxxjzOQCJFSwANwI4297QtmLfD+AtZr43m83OJ5iz3bGU+l1OT43XGFNk5mdXKlYAYNv2eBiG31dK3aS1vrRSbOZabqRYLFppFisAIKJxAB+MGf56krk30O64gZlMJnZsHMxsoo8fHxoauqHVHn3+BAAQUaxV57Xq2F54i5nvIaJXm81mYoX5etID491JRH/sFlQul5tEdMoYc3u32FUXrLYvObViBQDM/MQqwi8knX8jEJHpHrXIGJNo8WDm1spph2VZgeu6+5RSX7YsK8D/Xnb8Psmcnebm5h7G4uS9ysxutOH8VQC70sy7UTb7eImImTnWlgkzUyaT6fr3v6qC1fGL8EytVjuQRrECANu2fwHg1TixzPyXNO5hvTHz6VWE/znJ3L7vzxBRa9PzDmb+FYBfArgjajvd39+f9vGGKwACZh5te6mwmc8KburxMvO5TCbzqW5xxWLRArDbsqyu8z32HtZSxSrNM0Hlcrnpum6JmZ+NEb4pHglrtdrz+Xz+AoBbu4Ser9fra37d3YEBfBvAkq+XmfmbpVIp9grwWnie9zSAp9PMcT3Z7OPNZrO/aTQaf1BKfbd9X7RTGIaHmPlcnPNYsVZYSikOw7AB4CAzj/f19e1fjwOMnueVEeMxJJfLbYqCNT093TDGHAGw0qHYBQBH0vj+Pc+bYOb3HFRk5nHf9yeTzgfgMhF9uEvMTQD+71/vR3pqvJOTk28AeBJAeXR09P1LxbiuuxfA9wB8LU6fsVdYrUOhtm0fTusxcAlMRN+KziUt5SqAM3v37r00OZnGfFp/QRC86DjOUCaTGWPm2zoun8fiIbuZtPLX6/UH8/n8rQDuippertfrD6aRKyqOR5VS81ji8Z+IbmfmgwB+mEb+9dZr4wWA/v7+R6rV6k+azeYpx3EezeVyJ7dv335lfn7+lkajcZCZDzPzYd/3/xSnv9gFq3UuaR2LFQDA87xAKVUB8BEAZ6N9nrNEdEZr/TcArLVOPG8aJ9jj8n3/pcHBwZ1btmx5519zmPl0vV5/Ie2V7fT09Nujo6Nus9kcA4CtW7ce1lq/nUYu27a/Mzs7CyI6gMVX/u/CzJeZ+Ue2bcc9pb1aXc8lJZms18YLANE2wkOu694N4OFGo3E8DMMPAHiDiCaY+ZOb4YCsEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhEjYfwGO+b5dFNs4OgAAAABJRU5ErkJggg==);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e");background-repeat:no-repeat;background-size:300px 30px;background-clip:padding-box}.leaflet-retina .leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAA8CAYAAAC6nMS5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAA16SURBVHic7d1/jBxneQfw7zNzvotdn+9sVQkxoRKoammBqqpbk6uT5mLfvHPn42yn1VFRVCEhoFH5IYpoSaUCKi1NcGkcfrbCVRFKEwG2aHLn83pmLvY2CTqT1AmCOBE0EOT4B0nBPw/snb2dp3/sLr6s77i923dud/a+H8ny7tzMo8f3eud99p133gGIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiFYGaXYCRETUPMYYrWe/MAzZX2QQ27d5OpqdABFROxgZGVlz5cqVrzuOc18QBJPNzofsYvvSYrVcgTVftZ2l6npgYODXHMc5oKoHHcfZHQTB2WbnRETpGRkZWVMoFA6IyO2qutX3/R1Z64TnO8fWOwLSzti+mSKDg4M3l0qlnSJyG4CbAFwP4ByAlwE8paoPX3fddcH4+PjP00yk5QqsrDPGvAZAHsBrReRNqvpeY8x/iMg9QRCcaXJ6ZIHv+xtUdReAHQBej/IHGABOAnhORMY6OjoempiYONe0JC3zPM84jjOqqrfi6r/3RQCPAdgXhmHUvOyaa3R01L1w4cJBALdVNq1W1THP87woir7ZzNyocWzf7PA8b4uI7E6S5A9Frqknb6j8eZOIvKNQKPzU9/1/dhznvlwuV0gjn5YbFapW09Vqu/Z9K9u2bdsNruvmUe50axUAfMV13X/I5XInlzcze2x/28lCu1b19fWt7u7u/hCAvwGwboHdL6jq7unp6T1TU1OXlyG9VAwODv5mkiR7Ady6wK6Plkqldz/yyCPfX468bBkaGuqamZm5E8DbReQNANYscMiLIrI1CILnZ280xrwHwL+hck4VkacBDLTS6HVaIxWt/Blm+zauldu3atOmTas2bNjwWRG5s7LplKp+VUQOuq77/bVr17589uzZ9SKy0XGcAVUdFZE/qOx7zHXdXWn0yy31i6sMw/4MyF6BZYy5XlWPiMhvL7BrrKpfcxznE7Uf4ixYqQWW53kbATw060NZr28nSbJzcnLyRBp5pcnzvNtE5CEAvXUecg7ArjAMH00xLWuGhoZuKpVKEwB+p85DXnRd9/ZcLvcDAOjv778un88XAChwtRMWkW+jxTpfYOV1wGxfO1q1fav6+vpWr1u3blxVtwH4uar+/fT09OcW+mJrjBkBcC+AXwdwBoAJw/AZm7m1zC+uUlyNA9g6189buZH7+/t/tbOz8wiANy7isKKqftV13U8eOnToe2nlZttKLLAqJ+qjAF69xBAnZ2Zmbj58+PApm3mlqTJydRTXFldHAUxVXvcBuLnm5+dU9c1RFP1v2jk2YmhoqKtUKj2B+jvfE0mS3D45OflD4OqcHADPh2H4F6h0wp7nva1YLOby+fz5dDKnerB9Vwzxff8BVX0bgFMAdoZheKzeg4eHh9cXi8WvAfAAvOC67ptzudz/WUvOVqBGVO7OmBCR/vn2adWOuL+/v7ezs3MSwKYlhkgAHBSRjwdB8JTF1FKx0gqsymXBxwH8XoOh/ieO41vz+fwVG3mlzRjzKF55WfA8gD8LwzA3ez/P87aLyIMAeqrbVDUfRdHty5Pp0hhjPgDgM9X3qnq/iNwPYM5RCdd1T1RPvLM63+q/ce/sTpiaj+27Mvi+f6eq/iuAi67r9uVyuWcXG6NSjB8B0KeqE1EUvcVWfk3v3OYZuXosjuPt+Xx+ull51WNgYKBHRKIlXDaaS6Kq+6Mo+lMLsVKz0gosz/M+KiKfsBTub8MwvMdSrNQYYzwAYc3m7bXFVZXv+8OqemD2NlUdiKLokbRybJQx5lsANlfefi4Mww/UedyvADgI4I9mbxeRDwdB8C92s0yHrc9wK3922b6Na+X2BYD+/v61nZ2dz6M8cX00DMP9S421ffv2V83MzDwHoNfmucuxEWSpslxcjYyMrHEcZ8xScQUAjoj8vqVYZIHv+xtE5MMWQ941PDy83mK8VIjIW2s2HZ2vuAKAIAgmADyxQIxWM3uu5J56DhgZGVkDYBw1nS+ApwB82VJeZAfbt82tWrXqPSgXV481UlwBwMGDB3+sqncDgIh81EZ+QBMLrKwXV5Uh5NoPYqMyN+m9nanqHVj4bsHF6InjeKfFeKmoLMUw+/2Ct6KLyOM1m2x/NmxbW30RhuGPFtp5jstGVU+JiNdqE57rEYahzB6lWOz7Fsf2be/2hYj8SeXlvTbiFYvFLwK4DOAWY8z1NmI2pcDKcnE1OjraWSgU9uPaD2LDRKSlJwavQCO2A4rIDtsxU7BxsQeoau2Jeak3BDTDL72kUm/n63neaFoJUkPYvm3G9/0NKN9gc7mrq6t2OsOSVGqPSQCuiAzaiLnsBVaWiysAuHDhwn4AQ2nEVtUfpBGXluwNKcRcaBmPVpDMfiMiW+o4pnafZM69MmYxnW9lsj9lCNs3m1T1tSjXL89aXo39WCX+62wEW9YCK+vFVcXLKcbmJcLW8qoUYmZhZOfFmvc3e563fb6djTFvwdUJxfPFyJx6O1/f999a6Xz5ZIwMYftm2o2Vv60+HUVETldeLnoUfy7LVmC1SXEFVf0YgFSeX5QkCQus9tfyIzsicnSObQ/6vj9cu71SXP1nPTGyplAo5FDT+arqk3Ecb5s9J0dV2flmENs3u0REgTmnJjRkVjwrd2Iuy3+adimuACCKotPGmC8A+GvLoZOZmZkXLMekBojIaVX9DcthTy+8S3MlSTIuIu+q2dyjqgeMMU8A+CYAUdUtAOa8izZJkvG081wG19xN5jjO4ByLTLrLlRBZxfbNrjMAICI3LrTjIlVHrqyMjKU+gtVOxVVVHMf/hHkWrGvAiawsQrlSqOqiF61rRkzbOjo6AsxfCG4G8FcAPvhLlih5qVgsWpl42kIyezcZ1YXtmy0/QvlqwG9V1i6zZRMAiIiV+dCpFljtWFwBQOUbzqcth+XlwdZjfRRGRMZsx7St8mT5zzcQ4r52+LKgqp9S1U8B+GTtZSPKPrZvdlXaagrAalU1NmJWCrVtAEqO4xyyETO1S4TtWlxVXbp06b7u7u6/BHCTjXiqygKrxYjIQ6p6L2Y9BqZB51etWtXyBRYAuK77hVKp9H5cnUxarzOu634xjZyWWxRFdzU7B0oP2zfbVPUbIrLFcZwPAfivRuOJyPtUdbWq5m09jzCVEax2L64AYGpq6rKq/qOteI7jsMBqMUEQnFXV3bbiqerdExMT52zFS1Mul7soIovugETkI7lc7mIaORERVRWLxS8BeElVb/F9v6EnR/i+f6Oq3gUAjuPYejSavQLLGKPVP4VC4Wd4ZXF1pKura7Bdiquq3t7efwfwnKVwLLBa0PT09B5U1kZp0BPFYvGzFuIsmyAI7kf5uWz1OhgEwTV3FLaoX5yLKosWLknNsZcayohsYvu2uUo98TEAUNW9vu8vad3CoaGhLlX9BoBeAONBEByxleNyLNPwWBzHOywvBtYS9u3bV1LVj1sKxwKrBU1NTV12XXcXgFMNhDmpqndkcF6SisifAzhRx76n4jh+Byzd3rwMjldfqOqSV+xPkmT2yvzH592RlhvbdwUIw3AvgAcArFPVcHBwcFHPBvZ9f0OpVDqA8qrwL8Rx/E6b+VkvsGqfZ9ROlwXnEkXRfgDfajCMXrx48Yc28iH7crncSVXdrKpPLvZYEXk6SZItURS1/PIMcwmC4KzjOCMAam9dn+0SgJ35fP4ny5SWDQ/Mer3HGLPoTtgYMyIiv3gOmqpmZfRuJWD7rgwax/G7UH7EzcYkSf7bGHNXX1/f6oUO9H1/Z+WcPoDysgw7bJ/DUl8Hq52LqwoVkb9T1WiRx8UoX158RlWfnJqaupxCbmRJFEWn+/r6buvu7v4ggI9g4Ynv50XknkKh8JkMjly9wqFDh77j+/6oqo4BqD1xXRaRPw6CwMZl1GXjuu6XSqXSOwH8LoD1AMaMMecA1PtF53WV4wCUC+menp699jOlpWD7rhz5fP5Kf3//UFdX132q+l4Ad3d3d7/fGPN1EZlQ1e/19PS8dPbs2fWu694kIgOqOqqqm4Dy4rKlUumOw4cPN3KVYk7WVkE1xsx5aSBLT+duhDEmQrkSnssZlIeXnxWRY6p6PI7j41nveFeq4eHh9XEc7xSRnQBej6t3kp5EuWh+OI7jh+dYsDDTfN/frKrjAKpPmv9pkiS7JicnH29mXku1devWV3d0dBxAuRNeMhF5ulgsjqRxgk7DfOfqxWr1czvbtzGt3r5zGRwc7FPV3ap6y0L7ishPAHx63bp1e/bt2xenkQ8LLEuMMZtE5JCqfhfAMwCeSZLkO2vWrDk+NjbGyZHUFjzP2yginwcAVX1fVi99Vo2OjnaeP3/+3SLydgBvBNBd56GXAHxXVR/s7e3dm9YJOg0rqQNm+y5dFtp3HmKM2QxgF8qr9b8GwA0AzgH4MYBjIjJ28eLFkFeOiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIhWgv8Hnffz4dmwY9cAAAAASUVORK5CYII=);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e")}.leaflet-draw a{display:block;text-align:center;text-decoration:none}.leaflet-draw a .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.leaflet-draw-actions{display:none;list-style:none;margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap}.leaflet-touch .leaflet-draw-actions{left:32px}.leaflet-right .leaflet-draw-actions{right:26px;left:auto}.leaflet-touch .leaflet-right .leaflet-draw-actions{right:32px;left:auto}.leaflet-draw-actions li{display:inline-block}.leaflet-draw-actions li:first-child a{border-left:0}.leaflet-draw-actions li:last-child a{-webkit-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.leaflet-right .leaflet-draw-actions li:last-child a{-webkit-border-radius:0;border-radius:0}.leaflet-right .leaflet-draw-actions li:first-child a{-webkit-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.leaflet-draw-actions a{background-color:#919187;border-left:1px solid #AAA;color:#fff;font:11px/19px Helvetica Neue,Arial,Helvetica,sans-serif;line-height:28px;text-decoration:none;padding-left:10px;padding-right:10px;height:28px}.leaflet-touch .leaflet-draw-actions a{font-size:12px;line-height:30px;height:30px}.leaflet-draw-actions-bottom{margin-top:0}.leaflet-draw-actions-top{margin-top:1px}.leaflet-draw-actions-top a,.leaflet-draw-actions-bottom a{height:27px;line-height:27px}.leaflet-draw-actions a:hover{background-color:#a0a098}.leaflet-draw-actions-top.leaflet-draw-actions-bottom a{height:26px;line-height:26px}.leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:-2px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:0 -1px}.leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-31px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-29px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-62px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-60px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-92px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-90px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-122px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-120px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-273px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-271px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-152px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-150px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-182px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-180px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-212px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-210px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-242px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-240px -2px}.leaflet-mouse-marker{background-color:#fff;cursor:crosshair}.leaflet-draw-tooltip{background:#363636;background:#00000080;border:1px solid transparent;-webkit-border-radius:4px;border-radius:4px;color:#fff;font:12px/18px Helvetica Neue,Arial,Helvetica,sans-serif;margin-left:20px;margin-top:-21px;padding:4px 8px;position:absolute;visibility:hidden;white-space:nowrap;z-index:6}.leaflet-draw-tooltip:before{border-right:6px solid black;border-right-color:#00000080;border-top:6px solid transparent;border-bottom:6px solid transparent;content:"";position:absolute;top:7px;left:-7px}.leaflet-error-draw-tooltip{background-color:#f2dede;border:1px solid #e6b6bd;color:#b94a48}.leaflet-error-draw-tooltip:before{border-right-color:#e6b6bd}.leaflet-draw-tooltip-single{margin-top:-12px}.leaflet-draw-tooltip-subtext{color:#f8d5e4}.leaflet-draw-guide-dash{font-size:1%;opacity:.6;position:absolute;width:5px;height:5px}.leaflet-edit-marker-selected{background-color:#fe57a11a;border:4px dashed rgba(254,87,161,.6);-webkit-border-radius:4px;border-radius:4px;box-sizing:content-box}.leaflet-edit-move{cursor:move}.leaflet-edit-resize{cursor:pointer}.leaflet-oldie .leaflet-draw-toolbar{border:1px solid #999}`, Ye = ".leaflet-ruler{height:35px;width:35px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:center}.leaflet-ruler:hover{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=)}.leaflet-ruler-clicked{height:35px;width:35px;background-repeat:no-repeat;background-position:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=);border-color:#7fff00!important}.leaflet-bar{background-color:#fff}.leaflet-control{cursor:pointer}.result-tooltip{background-color:#fff;border-width:medium;border-color:#de0000;font-size:smaller}.moving-tooltip{background-color:#ffffffb3;background-clip:padding-box;opacity:.5;border:dotted;border-color:red;font-size:smaller}.plus-length{padding-left:45px}", qe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==", Ke = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=", Qe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC", We = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='430'%20height='430'%20style='width:100%25;height:100%25;transform:translate3d(0,0,0);content-visibility:visible'%20viewBox='0%200%20430%20430'%3e%3cdefs%3e%3cclipPath%20id='i'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='e'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='p'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='f'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='m'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='g'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='j'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='h'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cfilter%20id='t'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='r'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'%20stdDeviation='52.5%2052.5'/%3e%3c/filter%3e%3cfilter%20id='n'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='k'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cmask%20id='u'%20mask-type='alpha'%3e%3cuse%20xmlns:ns1='http://www.w3.org/1999/xlink'%20ns1:href='%23a'/%3e%3c/mask%3e%3cmask%20id='q'%20mask-type='alpha'%3e%3cuse%20xmlns:ns2='http://www.w3.org/1999/xlink'%20ns2:href='%23b'/%3e%3c/mask%3e%3cmask%20id='o'%20mask-type='alpha'%3e%3cuse%20xmlns:ns3='http://www.w3.org/1999/xlink'%20ns3:href='%23c'/%3e%3c/mask%3e%3cmask%20id='l'%20mask-type='alpha'%3e%3cuse%20xmlns:ns4='http://www.w3.org/1999/xlink'%20ns4:href='%23d'/%3e%3c/mask%3e%3cg%20id='a'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23e)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='b'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='12'%20clip-path='url(%23f)'%20style='display:block'%3e%3cpath%20stroke='%2308A88A'%20d='M44.446-66.518a79.998%2079.998%200%200%200-101.012%209.952A79.998%2079.998%200%201%200%2056.569%2056.569%2080.005%2080.005%200%200%200%2073.91-30.615a80.001%2080.001%200%200%200-29.464-35.903z'%20class='secondary'%20style='display:block'%20transform='translate(215%20214)'/%3e%3cpath%20stroke='%23121331'%20d='m141.409%2025.241%208.727%205.041s0%200%200%200a22.3%2022.3%200%200%201%2010.411%2013.542%2022.32%2022.32%200%200%201-2.221%2016.937l-26.515%2045.924a22.325%2022.325%200%200%201-30.497%208.172l-8.754-5.059a143.414%20143.414%200%200%201-43.718%2025.286v10.108a22.302%2022.302%200%200%201-13.778%2020.612%2022.303%2022.303%200%200%201-8.539%201.696h-53.029a22.303%2022.303%200%200%201-15.779-6.531%2022.302%2022.302%200%200%201-6.537-15.777v-10.073a143.416%20143.416%200%200%201-43.719-25.285l-8.754%205.059a22.325%2022.325%200%200%201-30.497-8.172l-26.523-45.924a22.315%2022.315%200%200%201-2.238-16.943A22.31%2022.31%200%200%201-150.142%2030.3l8.727-5.041a145.097%20145.097%200%200%201%200-50.518l-8.727-5.041a22.294%2022.294%200%200%201-10.409-13.554%2022.306%2022.306%200%200%201%202.238-16.943l26.514-45.924a22.325%2022.325%200%200%201%2030.497-8.172l8.754%205.059a143.416%20143.416%200%200%201%2043.719-25.285v-10.073a22.302%2022.302%200%200%201%206.537-15.777%2022.3%2022.3%200%200%201%2015.779-6.531h53.02a22.307%2022.307%200%200%201%2022.317%2022.308v10.037a143.41%20143.41%200%200%201%2043.718%2025.285l8.754-5.059a22.325%2022.325%200%200%201%2030.497%208.172l26.515%2045.942a22.313%2022.313%200%200%201-1.618%2024.757%2022.294%2022.294%200%200%201-6.554%205.74l-8.727%205.041a145.097%20145.097%200%200%201%200%2050.518z'%20class='primary'%20style='display:block'%20transform='rotate(-120%20169.576%2045.095)'/%3e%3c/g%3e%3cg%20id='c'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23g)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='d'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23h)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3c/defs%3e%3cg%20clip-path='url(%23i)'%3e%3cg%20clip-path='url(%23j)'%20filter='url(%23k)'%20mask='url(%23l)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23m)'%20filter='url(%23n)'%20mask='url(%23o)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23p)'%20mask='url(%23q)'%20style='display:block'%3e%3cg%20filter='url(%23r)'%20transform='rotate(-94%20238.762%20-16.565)%20scale(2.4)'%3e%3cg%20class='design'%3e%3cpath%20fill='%234BE1EC'%20d='M0-250c137.975%200%20250%20112.025%20250%20250S137.975%20250%200%20250-250%20137.975-250%200-137.975-250%200-250z'%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20fill='%23CB5EEE'%20d='M113.242-295.384c97.478%200%20176.5%2079.022%20176.5%20176.5s-79.022%20176.5-176.5%20176.5c-43.948%200-74.396-34.057-105.29-60.631-37.631-32.369-71.21-62.338-71.21-115.869%200-97.478%2079.022-176.5%20176.5-176.5z'%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23s)'%20filter='url(%23t)'%20mask='url(%23u)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Le = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-1.67%2047.336%2047.336'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group_42'%20data-name='Group%2042'%20transform='translate(-172.455%20-364.36)'%3e%3cpath%20id='Rectangle_17'%20data-name='Rectangle%2017'%20d='M4.351,0H40.984a4.351,4.351,0,0,1,4.351,4.351V22.117a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(173.455%20384.243)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_90'%20data-name='Path%2090'%20d='M218.79,390.249a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.778,3.778,0,0,1-3.777-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cg%20id='Group_41'%20data-name='Group%2041'%3e%3cpath%20id='Rectangle_18'%20data-name='Rectangle%2018'%20d='M4.351,0H26.473a4.351,4.351,0,0,1,4.351,4.351V17.883a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(180.71%20365.36)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_91'%20data-name='Path%2091'%20d='M211.234,370.794a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Xe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC", $e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=";
63
- function et(a) {
64
- const t = "data-leaflet-styles";
65
- if (a.querySelector(`style[${t}]`)) return;
66
- const e = document.createElement("style");
67
- e.setAttribute(t, "true"), e.textContent = `
68
- /* --- Leaflet core CSS --- */
69
- ${Ze}
70
-
71
- /* --- Leaflet.draw CSS --- */
72
- ${je}
73
-
74
- /* --- Leaflet.ruler CSS --- */
75
- ${Ye}
76
-
77
- /* --- Fix Leaflet.ruler icons (broken relative paths in inlined CSS) --- */
78
- .leaflet-ruler {
79
- width: 30px !important; /* Match Leaflet Draw default size approx */
80
- height: 30px !important;
81
- background-color: #fff; /* Ensure visibility */
82
- background-image: url(${Xe}) !important;
83
- background-size: 16px 16px; /* Scale icon to fit */
84
- }
85
- .leaflet-ruler:hover,
86
- .leaflet-ruler-clicked {
87
- background-image: url(${$e}) !important;
88
- }
89
-
90
- /* --- Custom overrides for marker/handle sizes --- */
91
- .leaflet-draw-handle,
92
- .leaflet-editing-icon,
93
- .leaflet-draw-marker-icon {
94
- width: 12px !important;
95
- height: 12px !important;
96
- margin-left: -6px !important;
97
- margin-top: -6px !important;
98
- }
99
-
100
- /* --- Ruler settings control --- */
101
- .leaflet-ruler-settings-control {
102
- display: flex;
103
- flex-direction: column;
104
- }
105
- .leaflet-ruler-settings-button {
106
- width: 30px;
107
- height: 30px;
108
- border: none;
109
- background-color: #fff;
110
- background-repeat: no-repeat;
111
- background-position: center;
112
- background-size: 22px 22px;
113
- cursor: pointer;
114
- padding: 0;
115
- border-radius: 4px;
116
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
117
- background-image: url(${We});
118
- transition: background-color 0.15s ease, box-shadow 0.15s ease;
119
- }
120
- .leaflet-ruler-settings-button:hover {
121
- background-color: #f4f4f4;
122
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
123
- }
124
- .leaflet-ruler-settings-button:focus-visible {
125
- outline: 2px solid #2c7be5;
126
- outline-offset: 2px;
127
- }
128
-
129
- /* --- Measurement modal --- */
130
- .leaflet-ruler-modal-overlay {
131
- position: absolute;
132
- inset: 0;
133
- display: flex;
134
- align-items: center;
135
- justify-content: center;
136
- background: rgba(0, 0, 0, 0.4);
137
- z-index: 500;
138
- opacity: 0;
139
- pointer-events: none;
140
- transition: opacity 0.2s ease;
141
- padding: 16px;
142
- }
143
- .leaflet-ruler-modal-overlay.is-open {
144
- opacity: 1;
145
- pointer-events: auto;
146
- }
147
- .leaflet-ruler-modal {
148
- background: #fff;
149
- border-radius: 8px;
150
- width: min(320px, 100%);
151
- padding: 16px;
152
- box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
153
- }
154
- .leaflet-ruler-modal-title {
155
- margin: 0 0 8px;
156
- font-size: 16px;
157
- font-weight: 600;
158
- }
159
- .leaflet-ruler-modal-description {
160
- margin: 0 0 12px;
161
- font-size: 13px;
162
- color: #444;
163
- }
164
- .leaflet-ruler-modal-options {
165
- display: flex;
166
- flex-direction: column;
167
- gap: 8px;
168
- }
169
- .leaflet-ruler-modal-option {
170
- display: flex;
171
- gap: 8px;
172
- align-items: flex-start;
173
- font-size: 14px;
174
- }
175
- .leaflet-ruler-modal-option input[type="radio"] {
176
- margin-top: 4px;
177
- }
178
- .leaflet-ruler-modal-option span {
179
- line-height: 1.25;
180
- }
181
- .leaflet-ruler-modal-actions {
182
- margin-top: 16px;
183
- display: flex;
184
- justify-content: flex-end;
185
- }
186
- .leaflet-ruler-modal-close {
187
- border: none;
188
- background: #2c7be5;
189
- color: #fff;
190
- border-radius: 4px;
191
- padding: 6px 12px;
192
- cursor: pointer;
193
- font-size: 14px;
194
- }
195
- .leaflet-ruler-modal-close:hover {
196
- background: #1a56c2;
197
- }
198
-
199
- /* --- Layer Cake draw tool icon + manager UI --- */
200
- .leaflet-draw-toolbar a.leaflet-draw-draw-cake {
201
- background-image: url(${Le}) !important;
202
- background-size: 18px 18px !important;
203
- background-position: 50% 50% !important;
204
- background-repeat: no-repeat !important;
205
- background-color: #fff;
206
- }
207
-
208
- .layer-cake-controls__container {
209
- display: flex;
210
- gap: 6px;
211
- background: white;
212
- padding: 5px;
213
- border-radius: 4px;
214
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
215
- }
216
-
217
- .layer-cake-controls button {
218
- border: 1px solid #ccc;
219
- background: white;
220
- padding: 4px 8px;
221
- border-radius: 3px;
222
- font-size: 12px;
223
- cursor: pointer;
224
- }
225
-
226
- .layer-cake-controls button:hover {
227
- background: #f4f4f4;
228
- }
229
-
230
- /* --- Layer Cake measurement tooltips --- */
231
- .cake-label {
232
- background-color: rgba(255, 255, 255, 0.95) !important;
233
- border: 2px solid #8A2BE2 !important;
234
- border-radius: 4px !important;
235
- color: #333 !important;
236
- font-size: 13px !important;
237
- font-weight: 600 !important;
238
- padding: 4px 8px !important;
239
- white-space: nowrap !important;
240
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
241
- }
242
-
243
- .cake-label::before {
244
- border-right-color: #8A2BE2 !important;
245
- }
246
-
247
- /* --- Move tool mode cursor styles --- */
248
- .leaflet-draw-move-mode {
249
- cursor: default !important;
250
- }
251
-
252
- .leaflet-draw-move-mode .leaflet-interactive {
253
- cursor: grab !important;
254
- }
255
-
256
- .leaflet-draw-move-mode .leaflet-interactive:active {
257
- cursor: grabbing !important;
258
- }
259
- `, a.appendChild(e);
260
- }
261
- function tt(a) {
262
- const t = "data-leaflet-custom-styles";
263
- if (a.querySelector(`style[${t}]`)) return;
264
- const e = document.createElement("style");
265
- e.setAttribute(t, "true"), e.textContent = `
266
- /* Ensure Layer Cake toolbar icon uses project asset instead of draw sprite sheet */
267
- .leaflet-draw-toolbar a.leaflet-draw-draw-cake {
268
- background-image: url(${Le}) !important;
269
- background-size: 18px 18px !important;
270
- background-position: 50% 50% !important;
271
- background-repeat: no-repeat !important;
272
- background-color: #fff;
273
- }
274
- `, a.appendChild(e);
275
- }
276
- function rt() {
277
- var a, t;
278
- (t = (a = x.Icon.Default).mergeOptions) == null || t.call(a, {
279
- iconRetinaUrl: qe,
280
- iconUrl: Ke,
281
- shadowUrl: Qe
282
- });
283
- }
284
- function ot(a) {
285
- const { root: t, skipStyles: e } = a;
286
- try {
287
- e || (et(t), rt()), tt(t);
288
- } catch {
289
- }
290
- }
291
- let U;
292
- const at = new Uint8Array(16);
293
- function it() {
294
- if (!U && (U = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !U))
295
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
296
- return U(at);
297
- }
298
- const M = [];
299
- for (let a = 0; a < 256; ++a)
300
- M.push((a + 256).toString(16).slice(1));
301
- function nt(a, t = 0) {
302
- return M[a[t + 0]] + M[a[t + 1]] + M[a[t + 2]] + M[a[t + 3]] + "-" + M[a[t + 4]] + M[a[t + 5]] + "-" + M[a[t + 6]] + M[a[t + 7]] + "-" + M[a[t + 8]] + M[a[t + 9]] + "-" + M[a[t + 10]] + M[a[t + 11]] + M[a[t + 12]] + M[a[t + 13]] + M[a[t + 14]] + M[a[t + 15]];
303
- }
304
- const st = typeof crypto != "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ge = {
305
- randomUUID: st
306
- };
307
- function de(a, t, e) {
308
- if (ge.randomUUID && !a)
309
- return ge.randomUUID();
310
- a = a || {};
311
- const r = a.random || (a.rng || it)();
312
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, nt(r);
313
- }
314
- function Z(a) {
315
- var e, r;
316
- const t = (r = a.id) != null ? r : (e = a.properties) == null ? void 0 : e.id;
317
- if (t != null)
318
- return String(t);
319
- }
320
- const lt = /^(.*)::(\d+)$/;
321
- function me(a) {
322
- const t = Z(a);
323
- if (!t) return null;
324
- const e = lt.exec(t);
325
- return e ? {
326
- baseId: e[1],
327
- childIndex: Number(e[2]),
328
- feature: a
329
- } : null;
330
- }
331
- function ct(a, t) {
332
- const e = t && typeof t == "object" ? { ...t } : {};
333
- return e.id = a, e;
334
- }
335
- function dt(a, t) {
336
- const e = [...t].sort((s, l) => s.childIndex - l.childIndex), r = e[0].feature, o = ct(a, r.properties), i = e.map((s) => s.feature.geometry).filter((s) => s != null);
337
- let n;
338
- return i.length === 0 ? n = {
339
- type: "GeometryCollection",
340
- geometries: []
341
- } : i.length === 1 ? n = i[0] : i.every((s) => s.type === "Point") ? n = {
342
- type: "MultiPoint",
343
- coordinates: i.map((s) => s.coordinates)
344
- } : i.every((s) => s.type === "LineString") ? n = {
345
- type: "MultiLineString",
346
- coordinates: i.map((s) => s.coordinates)
347
- } : i.every((s) => s.type === "Polygon") ? n = {
348
- type: "MultiPolygon",
349
- coordinates: i.map((s) => s.coordinates)
350
- } : n = {
351
- type: "GeometryCollection",
352
- geometries: i
353
- }, {
354
- type: "Feature",
355
- id: a,
356
- properties: o,
357
- geometry: n
358
- };
359
- }
360
- function ut(a, t) {
361
- const e = (r) => {
362
- switch (r.type) {
363
- case "Point":
364
- t(r.coordinates);
365
- break;
366
- case "MultiPoint":
367
- case "LineString":
368
- for (const o of r.coordinates) t(o);
369
- break;
370
- case "MultiLineString":
371
- case "Polygon":
372
- for (const o of r.coordinates)
373
- for (const i of o) t(i);
374
- break;
375
- case "MultiPolygon":
376
- for (const o of r.coordinates)
377
- for (const i of o)
378
- for (const n of i) t(n);
379
- break;
380
- case "GeometryCollection":
381
- for (const o of r.geometries) e(o);
382
- break;
383
- }
384
- };
385
- e(a);
386
- }
387
- function ht(a) {
388
- const t = a.geometry;
389
- if (!t) return null;
390
- let e = 1 / 0, r = 1 / 0, o = -1 / 0, i = -1 / 0, n = !1;
391
- return ut(t, (s) => {
392
- const [l, c] = s;
393
- typeof l != "number" || typeof c != "number" || (n = !0, l < e && (e = l), c < r && (r = c), l > o && (o = l), c > i && (i = c));
394
- }), n ? [e, r, o, i] : null;
395
- }
396
- function pt(a) {
397
- let t = 1 / 0, e = 1 / 0, r = -1 / 0, o = -1 / 0, i = !1;
398
- for (const n of a.features) {
399
- const s = ht(n);
400
- s && (i = !0, t = Math.min(t, s[0]), e = Math.min(e, s[1]), r = Math.max(r, s[2]), o = Math.max(o, s[3]));
401
- }
402
- return i ? [t, e, r, o] : null;
403
- }
404
- function ft(a) {
405
- const [t, e, r, o] = a;
406
- return [
407
- [e, t],
408
- [o, r]
409
- ];
410
- }
411
- function gt(a) {
412
- var e;
413
- const t = [];
414
- for (const r of a.features) {
415
- if (!r || r.type !== "Feature") continue;
416
- const o = (e = r.properties) != null ? e : {}, i = Z(r), n = (l, c) => {
417
- const d = o && typeof o == "object" ? { ...o } : {}, u = i !== void 0 ? `${i}::${c}` : void 0;
418
- return u !== void 0 && (d.id = u), {
419
- type: "Feature",
420
- id: u,
421
- properties: d,
422
- geometry: l
423
- };
424
- }, s = r.geometry;
425
- if (s)
426
- switch (s.type) {
427
- case "MultiPolygon":
428
- for (const [l, c] of s.coordinates.entries())
429
- t.push(
430
- n({ type: "Polygon", coordinates: c }, l)
431
- );
432
- break;
433
- case "MultiLineString":
434
- for (const [l, c] of s.coordinates.entries())
435
- t.push(
436
- n(
437
- { type: "LineString", coordinates: c },
438
- l
439
- )
440
- );
441
- break;
442
- case "MultiPoint":
443
- for (const [l, c] of s.coordinates.entries())
444
- t.push(
445
- n({ type: "Point", coordinates: c }, l)
446
- );
447
- break;
448
- case "GeometryCollection":
449
- for (const [l, c] of s.geometries.entries())
450
- t.push(n(c, l));
451
- break;
452
- default:
453
- t.push(r);
454
- break;
455
- }
456
- }
457
- return { type: "FeatureCollection", features: t };
458
- }
459
- function mt(a, t = {}) {
460
- var n;
461
- if (((n = t.adapter) != null ? n : "editing") !== "source") return a;
462
- const r = /* @__PURE__ */ new Map();
463
- for (const s of a.features) {
464
- const l = me(s);
465
- if (!l) continue;
466
- const c = r.get(l.baseId);
467
- c ? c.push(l) : r.set(l.baseId, [l]);
468
- }
469
- if (r.size === 0) return a;
470
- const o = /* @__PURE__ */ new Set(), i = [];
471
- for (const s of a.features) {
472
- const l = me(s);
473
- if (!l) {
474
- i.push(s);
475
- continue;
476
- }
477
- o.has(l.baseId) || (o.add(l.baseId), i.push(
478
- dt(l.baseId, r.get(l.baseId))
479
- ));
480
- }
481
- return {
482
- type: "FeatureCollection",
483
- features: i
484
- };
485
- }
486
- function Me(a) {
487
- return (a == null ? void 0 : a.type) === "Polygon";
488
- }
489
- function Ce(a) {
490
- return (a == null ? void 0 : a.type) === "MultiPolygon";
491
- }
492
- function yt(a) {
493
- const t = a.geometry;
494
- return t ? Me(t) ? [t.coordinates] : Ce(t) ? t.coordinates : [] : [];
495
- }
496
- function bt(a, t) {
497
- var o, i;
498
- const e = [];
499
- for (const n of a) {
500
- const s = yt(n);
501
- s.length > 0 && e.push(...s);
502
- }
503
- if (e.length === 0) return null;
504
- const r = (i = t != null ? t : (o = a[0]) == null ? void 0 : o.properties) != null ? i : {};
505
- return e.length === 1 ? {
506
- type: "Feature",
507
- properties: { ...r },
508
- geometry: {
509
- type: "Polygon",
510
- coordinates: e[0]
511
- }
512
- } : {
513
- type: "Feature",
514
- properties: { ...r },
515
- geometry: {
516
- type: "MultiPolygon",
517
- coordinates: e
518
- }
519
- };
520
- }
521
- class At {
522
- constructor(t = J("feature-store", "debug")) {
523
- h(this, "log");
524
- h(this, "features");
525
- this.log = t, this.features = /* @__PURE__ */ new Map();
526
- }
527
- size() {
528
- return this.features.size;
529
- }
530
- has(t) {
531
- return this.features.has(t);
532
- }
533
- get(t) {
534
- return this.features.get(t);
535
- }
536
- /**
537
- * Add features to the store; returns the assigned/normalized ids in order.
538
- */
539
- add(t) {
540
- var i, n, s, l;
541
- const e = [], r = (n = (i = performance.now) == null ? void 0 : i.call(performance)) != null ? n : Date.now();
542
- for (const c of t.features) {
543
- const d = this.ensureId(c), u = { ...c, id: d };
544
- this.features.set(d, u), e.push(d);
545
- }
546
- const o = ((l = (s = performance.now) == null ? void 0 : s.call(performance)) != null ? l : Date.now()) - r;
547
- return this.log.debug("add", {
548
- count: t.features.length,
549
- ids: e,
550
- elapsedMs: Math.round(o)
551
- }), e;
552
- }
553
- /**
554
- * Update a feature by id. If the feature does not exist, this is a no-op.
555
- * The provided feature will overwrite the stored one with the given id.
556
- */
557
- update(t, e) {
558
- if (!this.features.has(t)) {
559
- this.log.warn("update:missing", { id: t });
560
- return;
561
- }
562
- const r = { ...e, id: t };
563
- this.features.set(t, r), this.log.debug("update", { id: t });
564
- }
565
- /**
566
- * Remove a feature by id. No-op if missing.
567
- */
568
- remove(t) {
569
- this.features.delete(t) ? this.log.debug("remove", { id: t }) : this.log.warn("remove:missing", { id: t });
570
- }
571
- /**
572
- * Clear all features.
573
- */
574
- clear() {
575
- const t = this.features.size;
576
- this.features.clear(), this.log.debug("clear", { count: t });
577
- }
578
- /**
579
- * Export snapshot as FeatureCollection.
580
- */
581
- toFeatureCollection() {
582
- return {
583
- type: "FeatureCollection",
584
- features: Array.from(this.features.values())
585
- };
586
- }
587
- /**
588
- * Compute bounds for current data as [[south, west], [north, east]] or null if empty.
589
- */
590
- bounds() {
591
- const t = this.toFeatureCollection();
592
- if (t.features.length === 0) return null;
593
- const e = pt(t);
594
- return e ? ft(e) : null;
595
- }
596
- /**
597
- * Ensure the feature has an id; returns the resolved id.
598
- */
599
- ensureId(t) {
600
- const e = Z(t);
601
- if (e) return String(e);
602
- const r = de();
603
- return t.id = r, t.properties && typeof t.properties == "object" && (t.properties.id = r), r;
604
- }
605
- }
606
- const j = {
607
- polygon: {
608
- selectors: ["a.leaflet-draw-draw-polygon"],
609
- dataTool: "polygon"
610
- },
611
- polyline: {
612
- selectors: ["a.leaflet-draw-draw-polyline"],
613
- dataTool: "polyline"
614
- },
615
- rectangle: {
616
- selectors: ["a.leaflet-draw-draw-rectangle"],
617
- dataTool: "rectangle"
618
- },
619
- circle: {
620
- selectors: ["a.leaflet-draw-draw-circle"],
621
- dataTool: "circle"
622
- },
623
- marker: {
624
- selectors: ["a.leaflet-draw-draw-marker"],
625
- dataTool: "marker"
626
- },
627
- layerCake: {
628
- selectors: ["a.leaflet-draw-draw-cake"],
629
- dataTool: "layer-cake"
630
- },
631
- move: {
632
- selectors: ["a.leaflet-draw-draw-move"],
633
- dataTool: "move"
634
- },
635
- select: {
636
- selectors: [],
637
- dataTool: "select"
638
- },
639
- edit: {
640
- selectors: ["a.leaflet-draw-edit-edit"],
641
- dataTool: "edit"
642
- },
643
- delete: {
644
- selectors: ["a.leaflet-draw-edit-remove"],
645
- dataTool: "delete"
646
- },
647
- ruler: {
648
- selectors: [".leaflet-ruler", "a.leaflet-ruler"],
649
- dataTool: "ruler"
650
- },
651
- measurementSettings: {
652
- selectors: [".leaflet-ruler-settings-button"],
653
- dataTool: "measurement-settings"
654
- },
655
- layerStyle: {
656
- selectors: [],
657
- dataTool: "layer-style"
658
- },
659
- save: {
660
- selectors: [],
661
- dataTool: "save"
662
- }
663
- }, vt = Object.keys(j), _e = "leaflet-geokit-tool-button-icon", Ie = ".leaflet-geokit-cake-icon, .leaflet-geokit-move-icon", wt = "[data-geokit-managed-toolbar='true']", xt = "[data-geokit-tool-popover='true']", kt = "[data-geokit-tool][aria-expanded='true']", te = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakMap();
664
- function Q(a, t, e = {}) {
665
- R(a);
666
- for (const r of vt) {
667
- const o = j[r];
668
- for (const i of Et(a, o.selectors)) {
669
- i.setAttribute("data-geokit-tool", o.dataTool), Lt(i);
670
- const n = t == null ? void 0 : t[r];
671
- n && Mt(i, n, r), Te(i, r, {
672
- source: "leaflet-toolbar",
673
- activate: !1,
674
- onTrigger: e.onTrigger
675
- });
676
- }
677
- }
678
- Bt(a, t, e);
679
- }
680
- function Et(a, t) {
681
- const e = /* @__PURE__ */ new Set();
682
- for (const r of t)
683
- a.querySelectorAll(r).forEach((o) => {
684
- e.add(o);
685
- });
686
- return [...e];
687
- }
688
- function Lt(a) {
689
- const t = te.get(a);
690
- t && (a.removeEventListener("click", t), te.delete(a)), delete a.__geokitToolButtonConfig;
691
- const e = Y(a.dataset.geokitToolButtonClass);
692
- e.length > 0 && a.classList.remove(...e), delete a.dataset.geokitToolButtonClass, a.removeAttribute("data-geokit-custom-tool-button"), a.dataset.geokitOriginalTitle !== void 0 && ye(a, "title", a.dataset.geokitOriginalTitle), a.dataset.geokitOriginalAriaLabel !== void 0 && ye(
693
- a,
694
- "aria-label",
695
- a.dataset.geokitOriginalAriaLabel
696
- ), a.dataset.geokitOriginalStyleBackgroundImage !== void 0 && ae(
697
- a,
698
- "background-image",
699
- a.dataset.geokitOriginalStyleBackgroundImage,
700
- a.dataset.geokitOriginalStyleBackgroundImagePriority
701
- ), a.dataset.geokitOriginalStylePosition !== void 0 && ae(
702
- a,
703
- "position",
704
- a.dataset.geokitOriginalStylePosition,
705
- a.dataset.geokitOriginalStylePositionPriority
706
- ), Array.from(a.children).forEach((r) => {
707
- r instanceof HTMLElement && r.dataset.geokitToolButtonIcon === "true" && r.remove();
708
- }), a.querySelectorAll(Ie).forEach((r) => {
709
- r.hidden = !1;
710
- }), a.removeAttribute("aria-expanded");
711
- }
712
- function ye(a, t, e) {
713
- e ? a.setAttribute(t, e) : a.removeAttribute(t);
714
- }
715
- function ae(a, t, e, r) {
716
- e ? a.style.setProperty(t, e, r) : a.style.removeProperty(t);
717
- }
718
- function Mt(a, t, e) {
719
- var i;
720
- Ct(a), a.__geokitToolButtonConfig = t, a.setAttribute("data-geokit-custom-tool-button", "true"), t.title && a.setAttribute("title", t.title);
721
- const r = (i = t.ariaLabel) != null ? i : t.title;
722
- r && a.setAttribute("aria-label", r);
723
- const o = Y(t.className);
724
- o.length > 0 && (a.classList.add(...o), a.dataset.geokitToolButtonClass = o.join(" ")), t.iconUrl ? N(a, t, { tool: e }) : (t.iconHtml || t.renderIcon) && N(a, t, { tool: e });
725
- }
726
- function Ct(a) {
727
- var t, e;
728
- a.dataset.geokitOriginalTitle === void 0 && (a.dataset.geokitOriginalTitle = (t = a.getAttribute("title")) != null ? t : ""), a.dataset.geokitOriginalAriaLabel === void 0 && (a.dataset.geokitOriginalAriaLabel = (e = a.getAttribute("aria-label")) != null ? e : ""), a.dataset.geokitOriginalStyleBackgroundImage === void 0 && (a.dataset.geokitOriginalStyleBackgroundImage = a.style.getPropertyValue("background-image"), a.dataset.geokitOriginalStyleBackgroundImagePriority = a.style.getPropertyPriority("background-image")), a.dataset.geokitOriginalStylePosition === void 0 && (a.dataset.geokitOriginalStylePosition = a.style.getPropertyValue("position"), a.dataset.geokitOriginalStylePositionPriority = a.style.getPropertyPriority("position"));
729
- }
730
- function Y(a) {
731
- return a ? a.split(/\s+/).map((t) => t.trim()).filter(Boolean) : [];
732
- }
733
- function _t(a) {
734
- return !!(a.iconUrl || a.iconHtml || a.renderIcon);
735
- }
736
- function N(a, t, e = {}) {
737
- var l, c;
738
- const [r, o] = It(t.iconSize);
739
- a.style.setProperty("background-image", "none", "important"), a.style.setProperty("position", "relative", "important"), a.querySelectorAll(Ie).forEach((d) => {
740
- d.hidden = !0;
741
- });
742
- const i = document.createElement("span");
743
- i.className = _e, i.dataset.geokitToolButtonIcon = "true", i.setAttribute("aria-hidden", "true"), i.style.setProperty("position", "absolute", "important"), i.style.setProperty("display", "block", "important"), i.style.setProperty("left", "50%", "important"), i.style.setProperty("top", "50%", "important"), i.style.setProperty("width", `${r}px`, "important"), i.style.setProperty("height", `${o}px`, "important"), i.style.setProperty("transform", "translate(-50%, -50%)", "important"), i.style.setProperty("pointer-events", "none", "important");
744
- const n = (c = t.renderIcon) == null ? void 0 : c.call(t, {
745
- tool: (l = e.tool) != null ? l : "polygon",
746
- groupId: e.groupId,
747
- button: a
748
- });
749
- if (n instanceof HTMLElement || typeof SVGElement != "undefined" && n instanceof SVGElement)
750
- i.appendChild(n);
751
- else if (typeof n == "string" && n.trim())
752
- i.innerHTML = n, be(i);
753
- else if (t.iconHtml)
754
- i.innerHTML = t.iconHtml, be(i);
755
- else if (t.iconUrl) {
756
- const d = document.createElement("img");
757
- d.src = t.iconUrl, d.alt = "", d.decoding = "async", d.draggable = !1, d.style.setProperty("display", "block", "important"), d.style.setProperty("width", "100%", "important"), d.style.setProperty("height", "100%", "important"), d.style.setProperty("object-fit", "contain", "important"), i.appendChild(d);
758
- }
759
- a.appendChild(i);
760
- }
761
- function be(a) {
762
- const t = a.firstElementChild;
763
- t && (t.style.setProperty("display", "block", "important"), t.style.setProperty("width", "100%", "important"), t.style.setProperty("height", "100%", "important"), t.style.setProperty("color", "currentColor", "important"));
764
- }
765
- function It(a) {
766
- const t = a == null ? void 0 : a[0], e = a == null ? void 0 : a[1];
767
- return typeof t == "number" && Number.isFinite(t) && t > 0 && typeof e == "number" && Number.isFinite(e) && e > 0 ? [t, e] : [18, 18];
768
- }
769
- function Te(a, t, e) {
770
- const r = (o) => {
771
- var s;
772
- const i = Tt(a), n = St(a);
773
- i != null && i.popover ? zt(a, t, i, {
774
- container: n,
775
- groupId: e.groupId
776
- }) : R(n), (s = e.onTrigger) == null || s.call(e, t, {
777
- source: e.source,
778
- groupId: e.groupId,
779
- activate: e.activate
780
- }), e.activate && (o.preventDefault(), o.stopPropagation());
781
- };
782
- a.addEventListener("click", r), te.set(a, r);
783
- }
784
- function Tt(a) {
785
- const t = a.__geokitToolButtonConfig;
786
- if (t) return t;
787
- const e = a.dataset.geokitToolButtonConfig;
788
- if (!e) return null;
789
- try {
790
- return JSON.parse(e);
791
- } catch {
792
- return null;
793
- }
794
- }
795
- function St(a) {
796
- var e;
797
- const t = a.closest("[data-geokit-map-container]");
798
- return (e = t != null ? t : a.parentElement) != null ? e : a;
799
- }
800
- function Bt(a, t, e) {
801
- var i;
802
- a.setAttribute("data-geokit-map-container", "true"), a.querySelectorAll(wt).forEach((n) => n.remove());
803
- const r = (i = e.toolbarGroups) != null ? i : [], o = r.some(
804
- (n) => (n == null ? void 0 : n.hideDefaultToolbar) !== !1
805
- );
806
- Ot(a, o), r.forEach((n) => {
807
- var c;
808
- if (!(n != null && n.id) || !Array.isArray(n.tools) || n.tools.length === 0)
809
- return;
810
- const s = document.createElement("div");
811
- s.dataset.geokitManagedToolbar = "true", s.dataset.geokitToolbarGroup = n.id, s.className = "leaflet-geokit-toolbar-group leaflet-bar", s.setAttribute("role", "toolbar"), s.setAttribute("aria-label", (c = n.ariaLabel) != null ? c : n.id), Pt(s, n.position, n.offset);
812
- const l = Y(n.className);
813
- l.length > 0 && s.classList.add(...l), n.tools.forEach((d, u) => {
814
- const p = Dt(d, n, u, t == null ? void 0 : t[d]);
815
- Te(p, d, {
816
- source: "toolbar",
817
- activate: !0,
818
- groupId: n.id,
819
- onTrigger: e.onTrigger
820
- }), s.appendChild(p);
821
- }), a.appendChild(s);
822
- });
823
- }
824
- function Ot(a, t) {
825
- a.toggleAttribute("data-geokit-default-toolbar-hidden", t), a.querySelectorAll(
826
- ".leaflet-draw-toolbar, .leaflet-ruler, .leaflet-ruler-settings-control"
827
- ).forEach((e) => {
828
- t ? (e.dataset.geokitOriginalDisplay === void 0 && (e.dataset.geokitOriginalDisplay = e.style.display, e.dataset.geokitOriginalDisplayPriority = e.style.getPropertyPriority("display")), e.style.setProperty("display", "none", "important")) : e.dataset.geokitOriginalDisplay !== void 0 && (ae(
829
- e,
830
- "display",
831
- e.dataset.geokitOriginalDisplay,
832
- e.dataset.geokitOriginalDisplayPriority
833
- ), delete e.dataset.geokitOriginalDisplay, delete e.dataset.geokitOriginalDisplayPriority);
834
- });
835
- }
836
- function Dt(a, t, e, r) {
837
- var s, l, c, d, u;
838
- const o = document.createElement("button");
839
- o.type = "button", o.dataset.geokitTool = (l = (s = j[a]) == null ? void 0 : s.dataTool) != null ? l : a, o.dataset.geokitToolbarGroup = t.id, o.dataset.geokitToolbarPosition = (c = t.position) != null ? c : "topright", o.dataset.geokitToolInstance = Ft(
840
- t.id,
841
- a,
842
- e
843
- ), o.className = "leaflet-geokit-toolbar-button", o.style.setProperty("display", "block", "important"), o.style.setProperty("width", "34px", "important"), o.style.setProperty("height", "34px", "important"), o.style.setProperty("padding", "0", "important"), o.style.setProperty("border", "0", "important"), o.style.setProperty("border-bottom", "1px solid #ccc", "important"), o.style.setProperty("background", "#fff", "important"), o.style.setProperty("cursor", "pointer", "important"), o.style.setProperty("position", "relative", "important");
844
- const i = (d = r == null ? void 0 : r.title) != null ? d : Se(a);
845
- o.title = i, o.setAttribute("aria-label", (u = r == null ? void 0 : r.ariaLabel) != null ? u : i);
846
- const n = Y(r == null ? void 0 : r.className);
847
- if (n.length > 0 && o.classList.add(...n), r && (o.__geokitToolButtonConfig = r, _t(r) && N(o, r, { tool: a, groupId: t.id })), !o.querySelector(`.${_e}`)) {
848
- const p = {
849
- iconHtml: Gt(a),
850
- iconSize: [20, 20]
851
- };
852
- N(o, p, { tool: a, groupId: t.id });
853
- }
854
- return o;
855
- }
856
- function Pt(a, t = "topright", e) {
857
- const [r, o] = Ht(e);
858
- a.style.setProperty("position", "absolute", "important"), a.style.setProperty("z-index", "1000", "important"), a.style.setProperty("background", "#fff", "important"), a.style.setProperty(
859
- "box-shadow",
860
- "0 1px 5px rgba(0,0,0,0.35)",
861
- "important"
862
- );
863
- const [i, n] = t.startsWith("bottom") ? ["bottom", t.endsWith("right") ? "right" : "left"] : ["top", t.endsWith("right") ? "right" : "left"];
864
- a.style.setProperty(i, `${o}px`, "important"), a.style.setProperty(n, `${r}px`, "important");
865
- }
866
- function zt(a, t, e, r) {
867
- var s, l, c, d, u, p, g, m;
868
- if (!e.popover) return;
869
- R(r.container);
870
- const o = document.createElement("div");
871
- if (o.dataset.geokitToolPopover = "true", o.dataset.geokitTool = (l = (s = j[t]) == null ? void 0 : s.dataTool) != null ? l : t, a.dataset.geokitToolInstance && (o.dataset.geokitToolInstance = a.dataset.geokitToolInstance), r.groupId && (o.dataset.geokitToolbarGroup = r.groupId), o.setAttribute("role", "dialog"), o.setAttribute(
872
- "aria-label",
873
- (d = (c = e.popover.ariaLabel) != null ? c : e.popover.title) != null ? d : Se(t)
874
- ), o.style.setProperty("position", "absolute", "important"), o.style.setProperty("z-index", "10001", "important"), o.style.setProperty("max-width", "260px", "important"), o.style.setProperty("padding", "10px 12px", "important"), o.style.setProperty(
875
- "border",
876
- "1px solid rgba(0,0,0,0.22)",
877
- "important"
878
- ), o.style.setProperty("border-radius", "8px", "important"), o.style.setProperty("background", "#fff", "important"), o.style.setProperty(
879
- "box-shadow",
880
- "0 8px 24px rgba(0,0,0,0.24)",
881
- "important"
882
- ), o.style.setProperty("font", "13px system-ui, sans-serif", "important"), o.style.setProperty("line-height", "1.35", "important"), e.popover.title) {
883
- const f = document.createElement("strong");
884
- f.textContent = e.popover.title, f.style.setProperty("display", "block", "important"), f.style.setProperty("margin-bottom", "4px", "important"), o.appendChild(f);
885
- }
886
- if (e.popover.body) {
887
- const f = document.createElement("div");
888
- f.textContent = e.popover.body, o.appendChild(f);
889
- }
890
- if (e.popover.html) {
891
- const f = document.createElement("div");
892
- f.innerHTML = e.popover.html, o.appendChild(f);
893
- }
894
- const i = (p = (u = e.popover).render) == null ? void 0 : p.call(u, {
895
- tool: t,
896
- groupId: r.groupId,
897
- button: a,
898
- popover: o
899
- }), n = typeof DocumentFragment != "undefined" && i instanceof DocumentFragment;
900
- if (i instanceof HTMLElement || n)
901
- o.appendChild(i);
902
- else if (typeof i == "string" && i.trim()) {
903
- const f = document.createElement("div");
904
- f.innerHTML = i, o.appendChild(f);
905
- }
906
- r.container.appendChild(o), Rt(r.container, a, o), a.setAttribute("aria-expanded", "true"), oe.set(o, {
907
- tool: t,
908
- groupId: r.groupId,
909
- button: a,
910
- config: e
911
- }), Ut(r.container, a, o), (m = (g = e.popover).onOpen) == null || m.call(g, {
912
- tool: t,
913
- groupId: r.groupId,
914
- button: a,
915
- popover: o
916
- });
917
- }
918
- function Rt(a, t, e) {
919
- const r = a.getBoundingClientRect(), o = t.getBoundingClientRect(), i = Math.max(
920
- 8,
921
- Math.min(
922
- o.left - r.left,
923
- r.width - e.offsetWidth - 8
924
- )
925
- ), n = Math.max(
926
- 8,
927
- Math.min(
928
- o.bottom - r.top + 8,
929
- r.height - e.offsetHeight - 8
930
- )
931
- );
932
- e.style.setProperty("left", `${i}px`, "important"), e.style.setProperty("top", `${n}px`, "important");
933
- }
934
- function Ut(a, t, e) {
935
- const r = (n) => {
936
- n.key === "Escape" && R(a);
937
- }, o = (n) => {
938
- const s = n.target;
939
- s instanceof Node && (e.contains(s) || t.contains(s) || R(a));
940
- };
941
- document.addEventListener("keydown", r, !0);
942
- const i = window.setTimeout(() => {
943
- e.isConnected && document.addEventListener("pointerdown", o, !0);
944
- }, 0);
945
- re.set(e, {
946
- keydown: r,
947
- pointerdown: o,
948
- pointerdownTimer: i
949
- });
950
- }
951
- function R(a) {
952
- a.querySelectorAll(xt).forEach((t) => {
953
- var o, i, n;
954
- const e = oe.get(t);
955
- e == null || e.button.removeAttribute("aria-expanded"), e || (o = Nt(a, t)) == null || o.removeAttribute(
956
- "aria-expanded"
957
- );
958
- const r = re.get(t);
959
- r && (window.clearTimeout(r.pointerdownTimer), document.removeEventListener("keydown", r.keydown, !0), document.removeEventListener(
960
- "pointerdown",
961
- r.pointerdown,
962
- !0
963
- ), re.delete(t)), t.remove(), e && ((n = (i = e.config.popover) == null ? void 0 : i.onClose) == null || n.call(i, {
964
- tool: e.tool,
965
- groupId: e.groupId,
966
- button: e.button,
967
- popover: t
968
- }), oe.delete(t));
969
- });
970
- }
971
- function Nt(a, t) {
972
- const e = a.querySelectorAll(
973
- kt
974
- );
975
- for (const r of e)
976
- if (t.dataset.geokitToolInstance && r.dataset.geokitToolInstance === t.dataset.geokitToolInstance || r.dataset.geokitTool === t.dataset.geokitTool && r.dataset.geokitToolbarGroup === t.dataset.geokitToolbarGroup)
977
- return r;
978
- return null;
979
- }
980
- function Ft(a, t, e) {
981
- return `${a}:${t}:${e}`;
982
- }
983
- function Se(a) {
984
- return {
985
- polygon: "Draw polygon",
986
- polyline: "Draw line",
987
- rectangle: "Draw rectangle",
988
- circle: "Draw circle",
989
- marker: "Place marker",
990
- layerCake: "Draw layer cake",
991
- move: "Move feature",
992
- select: "Select feature",
993
- edit: "Edit features",
994
- delete: "Delete features",
995
- ruler: "Measure distance",
996
- measurementSettings: "Measurement settings",
997
- layerStyle: "Layer style",
998
- save: "Save map geometry"
999
- }[a];
1000
- }
1001
- function Gt(a) {
1002
- const t = "currentColor", e = "none";
1003
- return {
1004
- polygon: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8" stroke-linejoin="round"><path d="M5.5 7.2 9.2 4.8 18.5 8.3 16.1 18.2 6.3 15.7Z"/><circle cx="5.5" cy="7.2" r="1.2" fill="currentColor"/><circle cx="18.5" cy="8.3" r="1.2" fill="currentColor"/><circle cx="16.1" cy="18.2" r="1.2" fill="currentColor"/></svg>`,
1005
- polyline: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.8 16.7 9.2 9.5 14.4 13.1 19 6.1"/><circle cx="4.8" cy="16.7" r="1.3" fill="currentColor"/><circle cx="14.4" cy="13.1" r="1.3" fill="currentColor"/><circle cx="19" cy="6.1" r="1.3" fill="currentColor"/></svg>`,
1006
- rectangle: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8"><rect x="5.5" y="6.5" width="13" height="11" rx="2"/><path d="M8.5 10h7"/></svg>`,
1007
- circle: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8"><circle cx="12" cy="12" r="6.8"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>`,
1008
- marker: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.7" stroke-linejoin="round"><path d="M12 3.4a6 6 0 0 0-6 6c0 4.2 4.5 9.4 5.6 10.5a.6.6 0 0 0 .8 0C13.5 18.8 18 13.6 18 9.4a6 6 0 0 0-6-6Z"/><circle cx="12" cy="9.5" r="2.1" fill="currentColor" stroke="none"/></svg>`,
1009
- layerCake: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.7" stroke-linecap="round"><ellipse cx="12" cy="7.6" rx="6.8" ry="2.7"/><path d="M5.2 11c1.3 1.2 3.8 2 6.8 2s5.5-.8 6.8-2M6.3 15c1.3.9 3.3 1.5 5.7 1.5s4.4-.6 5.7-1.5"/></svg>`,
1010
- move: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v16M4 12h16M12 4l-2 2M12 4l2 2M20 12l-2-2M20 12l-2 2M12 20l-2-2M12 20l2-2M4 12l2-2M4 12l2 2"/></svg>`,
1011
- select: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8" stroke-linejoin="round"><path d="M6 4.8 18.5 12 13 13.4 10.2 19Z"/></svg>`,
1012
- edit: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.7" stroke-linejoin="round"><path d="m6 17.8 3.5-.7 7.7-7.7-2.8-2.8-7.7 7.7Z"/><path d="m12.9 7.9 2.8 2.8"/></svg>`,
1013
- delete: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M7.5 8.2h9l-.8 10a1.7 1.7 0 0 1-1.7 1.5h-4a1.7 1.7 0 0 1-1.7-1.5Z"/><path d="M9.5 8.2V6.8c0-.7.6-1.3 1.3-1.3h2.4c.7 0 1.3.6 1.3 1.3v1.4M10.5 11.5v4.8M13.5 11.5v4.8"/></svg>`,
1014
- ruler: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.7" stroke-linejoin="round"><path d="M5.2 17.8 17.8 5.2l1.7 1.7L6.9 19.5H5.2Z"/><path d="m12.2 8 1.5 1.5M9.9 10.3l1.5 1.5M7.6 12.6l1.5 1.5"/></svg>`,
1015
- measurementSettings: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.6" stroke-linecap="round"><circle cx="12" cy="12" r="3.2"/><path d="M12 4.8v2M12 17.2v2M4.8 12h2M17.2 12h2M7 7l1.4 1.4M15.6 15.6 17 17M17 7l-1.4 1.4M8.4 15.6 7 17"/></svg>`,
1016
- layerStyle: '<svg viewBox="0 0 24 24" fill="none"><path d="M5 6h14v3H5z" fill="currentColor" opacity=".9"/><path d="M5 11h14v3H5z" fill="currentColor" opacity=".65"/><path d="M5 16h14v3H5z" fill="currentColor" opacity=".4"/></svg>',
1017
- save: `<svg viewBox="0 0 24 24" fill="${e}" stroke="${t}" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"><path d="M5.5 4.8h11.2l1.8 1.8v12.6h-13Z"/><path d="M8 4.8v5h7v-5M8.2 19.2v-5.4h7.6v5.4"/><path d="M10 16.4h4"/></svg>`
1018
- }[a];
1019
- }
1020
- function Ht(a) {
1021
- const t = a == null ? void 0 : a[0], e = a == null ? void 0 : a[1];
1022
- return typeof t == "number" && Number.isFinite(t) && t >= 0 && typeof e == "number" && Number.isFinite(e) && e >= 0 ? [t, e] : [10, 10];
1023
- }
1024
- const Ae = /* @__PURE__ */ new WeakSet();
1025
- function Vt(a = x) {
1026
- var r;
1027
- if (Ae.has(a)) return;
1028
- const t = a.DrawToolbar;
1029
- if (!((r = t == null ? void 0 : t.prototype) != null && r.getModeHandlers)) return;
1030
- const e = t.prototype.getModeHandlers;
1031
- t.prototype.getModeHandlers = function(o) {
1032
- var n, s, l, c;
1033
- const i = e.call(this, o);
1034
- if ((n = this.options) != null && n.cake) {
1035
- const d = (s = a.Draw) == null ? void 0 : s.Cake;
1036
- if (!d) return i;
1037
- i.push({
1038
- enabled: !0,
1039
- handler: new d(o, this.options.cake),
1040
- title: "Draw Layer Cake (Subtractive Zones)"
1041
- });
1042
- }
1043
- if ((l = this.options) != null && l.move) {
1044
- const d = (c = a.Draw) == null ? void 0 : c.Move;
1045
- if (!d) return i;
1046
- i.push({
1047
- enabled: !0,
1048
- handler: new d(o, this.options.move),
1049
- title: "Move/Translate Features"
1050
- });
1051
- }
1052
- return i;
1053
- }, Ae.add(a);
1054
- }
1055
- const H = class H extends x.Draw.Circle {
1056
- constructor(t, e) {
1057
- super(t, e), this.type = H.TYPE;
1058
- }
1059
- addHooks() {
1060
- super.addHooks();
1061
- const t = this._tooltip;
1062
- t != null && t.updateContent && t.updateContent({
1063
- text: "Click and drag to draw the Layer Cake base",
1064
- subtext: "Release mouse to finish base layer"
1065
- });
1066
- }
1067
- };
1068
- h(H, "TYPE", "cake");
1069
- let F = H;
1070
- x.Draw.Cake = F;
1071
- function Jt(a) {
1072
- const t = a.Draw;
1073
- if (!t || t.Cake) return;
1074
- const r = class r extends t.Circle {
1075
- constructor(i, n) {
1076
- super(i, n), this.type = r.TYPE;
1077
- }
1078
- addHooks() {
1079
- super.addHooks();
1080
- const i = this._tooltip;
1081
- i != null && i.updateContent && i.updateContent({
1082
- text: "Click and drag to draw the Layer Cake base",
1083
- subtext: "Release mouse to finish base layer"
1084
- });
1085
- }
1086
- };
1087
- h(r, "TYPE", "cake");
1088
- let e = r;
1089
- t.Cake = e;
1090
- }
1091
- const V = class V extends x.Draw.Feature {
1092
- constructor(e, r) {
1093
- super(e, r);
1094
- h(this, "_featureGroup");
1095
- h(this, "_selectedLayer", null);
1096
- h(this, "_originalLatLngs", null);
1097
- h(this, "_dragStartLatLng", null);
1098
- h(this, "_isDragging", !1);
1099
- h(this, "_pendingMove", null);
1100
- this.type = V.TYPE, this._featureGroup = (r == null ? void 0 : r.featureGroup) || new x.FeatureGroup();
1101
- }
1102
- enable() {
1103
- this._enabled || super.enable();
1104
- }
1105
- disable() {
1106
- this._enabled && (this._cleanupDragging(), super.disable());
1107
- }
1108
- addHooks() {
1109
- const e = this._map;
1110
- if (!e) return;
1111
- x.DomUtil.addClass(e.getContainer(), "leaflet-draw-move-mode"), this._featureGroup.eachLayer((o) => {
1112
- this._enableLayerHover(o);
1113
- });
1114
- const r = this._tooltip;
1115
- r != null && r.updateContent && r.updateContent({
1116
- text: "Click and drag a feature to move it",
1117
- subtext: ""
1118
- });
1119
- }
1120
- removeHooks() {
1121
- const e = this._map;
1122
- e && (x.DomUtil.removeClass(e.getContainer(), "leaflet-draw-move-mode"), this._featureGroup.eachLayer((r) => {
1123
- this._disableLayerHover(r);
1124
- }), this._cleanupDragging());
1125
- }
1126
- _enableLayerHover(e) {
1127
- e.on && (e.on("mouseover", this._onLayerMouseOver, this), e.on("mouseout", this._onLayerMouseOut, this), e.on("mousedown", this._onLayerMouseDown, this));
1128
- }
1129
- _disableLayerHover(e) {
1130
- e.off && (e.off("mouseover", this._onLayerMouseOver, this), e.off("mouseout", this._onLayerMouseOut, this), e.off("mousedown", this._onLayerMouseDown, this));
1131
- }
1132
- _onLayerMouseOver(e) {
1133
- if (this._isDragging) return;
1134
- const r = e.target;
1135
- if (r.getElement) {
1136
- const o = r.getElement();
1137
- o && (o.style.cursor = "grab");
1138
- } else r._path && (r._path.style.cursor = "grab");
1139
- }
1140
- _onLayerMouseOut(e) {
1141
- if (this._isDragging) return;
1142
- const r = e.target;
1143
- if (r.getElement) {
1144
- const o = r.getElement();
1145
- o && (o.style.cursor = "");
1146
- } else r._path && (r._path.style.cursor = "");
1147
- }
1148
- _onLayerMouseDown(e) {
1149
- if (this._isDragging) return;
1150
- x.DomEvent.stopPropagation(e.originalEvent), x.DomEvent.preventDefault(e.originalEvent);
1151
- const r = e.target;
1152
- if (this._selectedLayer = r, this._isDragging = !0, this._dragStartLatLng = e.latlng, this._storeOriginalLatLngs(r), r.getElement) {
1153
- const i = r.getElement();
1154
- i && (i.style.cursor = "grabbing");
1155
- } else r._path && (r._path.style.cursor = "grabbing");
1156
- this._map.on("mousemove", this._onMouseMove, this), this._map.on("mouseup", this._onMouseUp, this);
1157
- const o = r.toGeoJSON();
1158
- this._pendingMove = {
1159
- layer: r,
1160
- originalGeoJSON: o,
1161
- newGeoJSON: o
1162
- // Will be updated on mouseup
1163
- };
1164
- }
1165
- _storeOriginalLatLngs(e) {
1166
- e.getLatLng ? this._originalLatLngs = e.getLatLng() : e.getLatLngs && (this._originalLatLngs = JSON.parse(
1167
- JSON.stringify(e.getLatLngs())
1168
- ));
1169
- }
1170
- _onMouseMove(e) {
1171
- if (!this._isDragging || !this._selectedLayer || !this._dragStartLatLng)
1172
- return;
1173
- const r = this._selectedLayer, o = {
1174
- lat: e.latlng.lat - this._dragStartLatLng.lat,
1175
- lng: e.latlng.lng - this._dragStartLatLng.lng
1176
- };
1177
- if (r.setLatLng) {
1178
- const i = x.latLng(
1179
- this._originalLatLngs.lat + o.lat,
1180
- this._originalLatLngs.lng + o.lng
1181
- );
1182
- r.setLatLng(i);
1183
- } else if (r.setLatLngs) {
1184
- const i = this._offsetLatLngs(this._originalLatLngs, o);
1185
- r.setLatLngs(i);
1186
- }
1187
- }
1188
- _offsetLatLngs(e, r) {
1189
- return e instanceof x.LatLng || e.lat !== void 0 && e.lng !== void 0 ? x.latLng(e.lat + r.lat, e.lng + r.lng) : Array.isArray(e) ? e.map((o) => this._offsetLatLngs(o, r)) : e;
1190
- }
1191
- _onMouseUp(e) {
1192
- var o, i;
1193
- if (!this._isDragging || !this._selectedLayer) return;
1194
- this._pendingMove && (this._pendingMove.newGeoJSON = this._selectedLayer.toGeoJSON());
1195
- const r = this._selectedLayer;
1196
- if (r.getElement) {
1197
- const n = r.getElement();
1198
- n && (n.style.cursor = "grab");
1199
- } else r._path && (r._path.style.cursor = "grab");
1200
- this._map.fire("draw:moveend", {
1201
- layer: this._selectedLayer,
1202
- originalGeoJSON: (o = this._pendingMove) == null ? void 0 : o.originalGeoJSON,
1203
- newGeoJSON: (i = this._pendingMove) == null ? void 0 : i.newGeoJSON
1204
- }), this._map.off("mousemove", this._onMouseMove, this), this._map.off("mouseup", this._onMouseUp, this), this._isDragging = !1;
1205
- }
1206
- _cleanupDragging() {
1207
- if (this._selectedLayer) {
1208
- const e = this._selectedLayer;
1209
- if (e.getElement) {
1210
- const r = e.getElement();
1211
- r && (r.style.cursor = "");
1212
- } else e._path && (e._path.style.cursor = "");
1213
- }
1214
- this._map.off("mousemove", this._onMouseMove, this), this._map.off("mouseup", this._onMouseUp, this), this._selectedLayer = null, this._originalLatLngs = null, this._dragStartLatLng = null, this._isDragging = !1, this._pendingMove = null;
1215
- }
1216
- /**
1217
- * Confirm the pending move and dispatch the final event.
1218
- */
1219
- confirmMove() {
1220
- this._pendingMove && (this._map.fire("draw:moveconfirmed", {
1221
- layer: this._pendingMove.layer,
1222
- originalGeoJSON: this._pendingMove.originalGeoJSON,
1223
- newGeoJSON: this._pendingMove.newGeoJSON
1224
- }), this._cleanupDragging());
1225
- }
1226
- /**
1227
- * Cancel the pending move and revert the layer to its original position.
1228
- */
1229
- cancelMove() {
1230
- if (!this._pendingMove) return;
1231
- const e = this._pendingMove.layer;
1232
- e.setLatLng && this._originalLatLngs ? e.setLatLng(this._originalLatLngs) : e.setLatLngs && this._originalLatLngs && e.setLatLngs(this._originalLatLngs), this._cleanupDragging();
1233
- }
1234
- /**
1235
- * Check if there's a pending move awaiting confirmation.
1236
- */
1237
- hasPendingMove() {
1238
- return this._pendingMove !== null;
1239
- }
1240
- };
1241
- h(V, "TYPE", "move");
1242
- let ie = V;
1243
- x.Draw.Move = ie;
1244
- function Zt(a) {
1245
- const t = a.Draw;
1246
- if (!t || t.Move) return;
1247
- const r = class r extends t.Feature {
1248
- constructor(n, s) {
1249
- super(n, s);
1250
- h(this, "_featureGroup");
1251
- h(this, "_selectedLayer", null);
1252
- h(this, "_originalLatLngs", null);
1253
- h(this, "_dragStartLatLng", null);
1254
- h(this, "_isDragging", !1);
1255
- h(this, "_pendingMove", null);
1256
- this.type = r.TYPE, this._featureGroup = (s == null ? void 0 : s.featureGroup) || new x.FeatureGroup();
1257
- }
1258
- enable() {
1259
- this._enabled || super.enable();
1260
- }
1261
- disable() {
1262
- this._enabled && (this._cleanupDragging(), super.disable());
1263
- }
1264
- addHooks() {
1265
- const n = this._map;
1266
- if (!n) return;
1267
- a.DomUtil.addClass(n.getContainer(), "leaflet-draw-move-mode"), this._featureGroup.eachLayer((l) => {
1268
- this._enableLayerHover(l);
1269
- });
1270
- const s = this._tooltip;
1271
- s != null && s.updateContent && s.updateContent({
1272
- text: "Click and drag a feature to move it",
1273
- subtext: ""
1274
- });
1275
- }
1276
- removeHooks() {
1277
- const n = this._map;
1278
- n && (a.DomUtil.removeClass(n.getContainer(), "leaflet-draw-move-mode"), this._featureGroup.eachLayer((s) => {
1279
- this._disableLayerHover(s);
1280
- }), this._cleanupDragging());
1281
- }
1282
- _enableLayerHover(n) {
1283
- n.on && (n.on("mouseover", this._onLayerMouseOver, this), n.on("mouseout", this._onLayerMouseOut, this), n.on("mousedown", this._onLayerMouseDown, this));
1284
- }
1285
- _disableLayerHover(n) {
1286
- n.off && (n.off("mouseover", this._onLayerMouseOver, this), n.off("mouseout", this._onLayerMouseOut, this), n.off("mousedown", this._onLayerMouseDown, this));
1287
- }
1288
- _onLayerMouseOver(n) {
1289
- if (this._isDragging) return;
1290
- const s = n.target;
1291
- if (s.getElement) {
1292
- const l = s.getElement();
1293
- l && (l.style.cursor = "grab");
1294
- } else s._path && (s._path.style.cursor = "grab");
1295
- }
1296
- _onLayerMouseOut(n) {
1297
- if (this._isDragging) return;
1298
- const s = n.target;
1299
- if (s.getElement) {
1300
- const l = s.getElement();
1301
- l && (l.style.cursor = "");
1302
- } else s._path && (s._path.style.cursor = "");
1303
- }
1304
- _onLayerMouseDown(n) {
1305
- if (this._isDragging) return;
1306
- a.DomEvent.stopPropagation(n.originalEvent), a.DomEvent.preventDefault(n.originalEvent);
1307
- const s = n.target;
1308
- if (this._selectedLayer = s, this._isDragging = !0, this._dragStartLatLng = n.latlng, this._storeOriginalLatLngs(s), s.getElement) {
1309
- const c = s.getElement();
1310
- c && (c.style.cursor = "grabbing");
1311
- } else s._path && (s._path.style.cursor = "grabbing");
1312
- this._map.on("mousemove", this._onMouseMove, this), this._map.on("mouseup", this._onMouseUp, this);
1313
- const l = s.toGeoJSON();
1314
- this._pendingMove = {
1315
- layer: s,
1316
- originalGeoJSON: l,
1317
- newGeoJSON: l
1318
- };
1319
- }
1320
- _storeOriginalLatLngs(n) {
1321
- n.getLatLng ? this._originalLatLngs = n.getLatLng() : n.getLatLngs && (this._originalLatLngs = JSON.parse(
1322
- JSON.stringify(n.getLatLngs())
1323
- ));
1324
- }
1325
- _onMouseMove(n) {
1326
- if (!this._isDragging || !this._selectedLayer || !this._dragStartLatLng)
1327
- return;
1328
- const s = this._selectedLayer, l = {
1329
- lat: n.latlng.lat - this._dragStartLatLng.lat,
1330
- lng: n.latlng.lng - this._dragStartLatLng.lng
1331
- };
1332
- if (s.setLatLng) {
1333
- const c = a.latLng(
1334
- this._originalLatLngs.lat + l.lat,
1335
- this._originalLatLngs.lng + l.lng
1336
- );
1337
- s.setLatLng(c);
1338
- } else if (s.setLatLngs) {
1339
- const c = this._offsetLatLngs(this._originalLatLngs, l);
1340
- s.setLatLngs(c);
1341
- }
1342
- }
1343
- _offsetLatLngs(n, s) {
1344
- return n instanceof a.LatLng || n.lat !== void 0 && n.lng !== void 0 ? a.latLng(n.lat + s.lat, n.lng + s.lng) : Array.isArray(n) ? n.map((l) => this._offsetLatLngs(l, s)) : n;
1345
- }
1346
- _onMouseUp(n) {
1347
- var l, c;
1348
- if (!this._isDragging || !this._selectedLayer) return;
1349
- this._pendingMove && (this._pendingMove.newGeoJSON = this._selectedLayer.toGeoJSON());
1350
- const s = this._selectedLayer;
1351
- if (s.getElement) {
1352
- const d = s.getElement();
1353
- d && (d.style.cursor = "grab");
1354
- } else s._path && (s._path.style.cursor = "grab");
1355
- this._map.fire("draw:moveend", {
1356
- layer: this._selectedLayer,
1357
- originalGeoJSON: (l = this._pendingMove) == null ? void 0 : l.originalGeoJSON,
1358
- newGeoJSON: (c = this._pendingMove) == null ? void 0 : c.newGeoJSON
1359
- }), this._map.off("mousemove", this._onMouseMove, this), this._map.off("mouseup", this._onMouseUp, this), this._isDragging = !1;
1360
- }
1361
- _cleanupDragging() {
1362
- if (this._selectedLayer) {
1363
- const n = this._selectedLayer;
1364
- if (n.getElement) {
1365
- const s = n.getElement();
1366
- s && (s.style.cursor = "");
1367
- } else n._path && (n._path.style.cursor = "");
1368
- }
1369
- this._map.off("mousemove", this._onMouseMove, this), this._map.off("mouseup", this._onMouseUp, this), this._selectedLayer = null, this._originalLatLngs = null, this._dragStartLatLng = null, this._isDragging = !1, this._pendingMove = null;
1370
- }
1371
- confirmMove() {
1372
- this._pendingMove && (this._map.fire("draw:moveconfirmed", {
1373
- layer: this._pendingMove.layer,
1374
- originalGeoJSON: this._pendingMove.originalGeoJSON,
1375
- newGeoJSON: this._pendingMove.newGeoJSON
1376
- }), this._cleanupDragging());
1377
- }
1378
- cancelMove() {
1379
- if (!this._pendingMove) return;
1380
- const n = this._pendingMove.layer;
1381
- n.setLatLng && this._originalLatLngs ? n.setLatLng(this._originalLatLngs) : n.setLatLngs && this._originalLatLngs && n.setLatLngs(this._originalLatLngs), this._cleanupDragging();
1382
- }
1383
- hasPendingMove() {
1384
- return this._pendingMove !== null;
1385
- }
1386
- };
1387
- h(r, "TYPE", "move");
1388
- let e = r;
1389
- t.Move = e;
1390
- }
1391
- const jt = 63710088e-1;
1392
- function W(a) {
1393
- return a * Math.PI / 180;
1394
- }
1395
- function ve(a) {
1396
- return a * 180 / Math.PI;
1397
- }
1398
- function Yt(a, t, e) {
1399
- const r = t / jt, o = W(e), i = W(a.lat), n = W(a.lng), s = Math.sin(i), l = Math.cos(i), c = Math.sin(r), d = Math.cos(r), u = s * d + l * c * Math.cos(o), p = Math.asin(u), g = Math.sin(o) * c * l, m = d - s * u, f = n + Math.atan2(g, m);
1400
- return { lat: ve(p), lng: ve(f) };
1401
- }
1402
- function qt(a) {
1403
- let t = 0;
1404
- for (let e = 0; e < a.length - 1; e++) {
1405
- const [r, o] = a[e], [i, n] = a[e + 1];
1406
- t += r * n - i * o;
1407
- }
1408
- return t / 2;
1409
- }
1410
- function ne(a) {
1411
- const t = a[0], e = a.at(-1);
1412
- return !t || !e || t[0] === e[0] && t[1] === e[1] ? a : [...a, t];
1413
- }
1414
- function se(a, t) {
1415
- const e = ne(a);
1416
- if (qt(e) < 0 === t) return e;
1417
- const i = [...e].reverse();
1418
- return ne(i);
1419
- }
1420
- function le(a, t, e) {
1421
- if (e < 4) throw new Error("steps must be >= 4");
1422
- const r = [];
1423
- for (let o = 0; o < e; o++) {
1424
- const i = o / e * 360, n = Yt(a, t, i);
1425
- r.push([n.lng, n.lat]);
1426
- }
1427
- return ne(r);
1428
- }
1429
- function Kt(a) {
1430
- const { id: t, center: e, radiusMeters: r, layerIndex: o, steps: i } = a, n = se(le(e, r, i), !1);
1431
- return {
1432
- type: "Feature",
1433
- properties: {
1434
- id: t,
1435
- layer_index: o,
1436
- radius_outer: r,
1437
- type: "core",
1438
- _meta: {
1439
- lat: e.lat,
1440
- lng: e.lng,
1441
- radius: r
1442
- }
1443
- },
1444
- geometry: { type: "Polygon", coordinates: [n] }
1445
- };
1446
- }
1447
- function Qt(a) {
1448
- const {
1449
- id: t,
1450
- center: e,
1451
- radiusOuterMeters: r,
1452
- radiusInnerMeters: o,
1453
- layerIndex: i,
1454
- steps: n
1455
- } = a, s = se(
1456
- le(e, r, n),
1457
- !1
1458
- ), l = se(
1459
- le(e, o, n),
1460
- !0
1461
- );
1462
- return {
1463
- type: "Feature",
1464
- properties: {
1465
- id: t,
1466
- layer_index: i,
1467
- radius_outer: r,
1468
- type: "ring",
1469
- _meta: {
1470
- lat: e.lat,
1471
- lng: e.lng,
1472
- radius: r
1473
- }
1474
- },
1475
- geometry: { type: "Polygon", coordinates: [s, l] }
1476
- };
1477
- }
1478
- function Wt(a) {
1479
- const { circles: t, steps: e = 64 } = a, r = [...t].sort((i, n) => i.getRadius() - n.getRadius()), o = [];
1480
- return r.forEach((i, n) => {
1481
- const s = i.getLatLng(), l = i.getRadius(), c = de();
1482
- if (n === 0) {
1483
- o.push(
1484
- Kt({ id: c, center: s, radiusMeters: l, layerIndex: n, steps: e })
1485
- );
1486
- return;
1487
- }
1488
- const u = r[n - 1].getRadius();
1489
- o.push(
1490
- Qt({
1491
- id: c,
1492
- center: s,
1493
- radiusOuterMeters: l,
1494
- radiusInnerMeters: u,
1495
- layerIndex: n,
1496
- steps: e
1497
- })
1498
- );
1499
- }), { type: "FeatureCollection", features: o };
1500
- }
1501
- function P(a) {
1502
- a.preventDefault(), a.stopPropagation();
1503
- }
1504
- function Xt(a) {
1505
- var c, d;
1506
- const { root: t, addButtonId: e, saveButtonId: r, onAddRing: o, onSave: i } = a, n = (c = t.querySelector) == null ? void 0 : c.call(t, `#${e}`), s = (d = t.querySelector) == null ? void 0 : d.call(t, `#${r}`);
1507
- if (!n || !s) return;
1508
- const l = "data-cake-controls-bound";
1509
- if (!(n.hasAttribute(l) || s.hasAttribute(l))) {
1510
- n.setAttribute(l, "true"), s.setAttribute(l, "true");
1511
- for (const u of [n, s])
1512
- u.addEventListener("pointerdown", P), u.addEventListener("mousedown", P), u.addEventListener("touchstart", P);
1513
- n.addEventListener("click", (u) => {
1514
- P(u), o();
1515
- }), s.addEventListener("click", (u) => {
1516
- P(u), i();
1517
- });
1518
- }
1519
- }
1520
- function $t(a) {
1521
- var e;
1522
- const t = (e = a.options) != null ? e : {};
1523
- t.original || (t.original = { ...t }), t.editing || (t.editing = { ...t });
1524
- }
1525
- function z(a, t) {
1526
- if (t === "imperial") {
1527
- const e = a * 3.28084;
1528
- return e >= 5280 ? `${(e / 5280).toFixed(2)} mi` : `${Math.round(e)} ft`;
1529
- }
1530
- return a >= 1e3 ? `${(a / 1e3).toFixed(2)} km` : `${Math.round(a)} m`;
1531
- }
1532
- class er {
1533
- constructor(t, e, r, o = "metric") {
1534
- h(this, "map");
1535
- h(this, "layers", []);
1536
- h(this, "controlsGroup");
1537
- h(this, "onSave");
1538
- h(this, "sessionId", de().slice(0, 8));
1539
- h(this, "baseCircleOptions");
1540
- h(this, "detachMapListeners", []);
1541
- h(this, "renderScheduled", !1);
1542
- h(this, "measurementSystem");
1543
- this.map = t, this.onSave = r, this.measurementSystem = o, this.controlsGroup = x.layerGroup().addTo(t), this.baseCircleOptions = { ...e.options }, delete this.baseCircleOptions.editing, delete this.baseCircleOptions.original, this.addLayer(e), this.installEditEventBridges(), this.renderControls();
1544
- }
1545
- installEditEventBridges() {
1546
- var d, u, p, g, m, f, A, v;
1547
- const t = x, e = (u = (d = t == null ? void 0 : t.Draw) == null ? void 0 : d.Event) == null ? void 0 : u.EDITMOVE, r = (g = (p = t == null ? void 0 : t.Draw) == null ? void 0 : p.Event) == null ? void 0 : g.EDITRESIZE, o = (f = (m = t == null ? void 0 : t.Draw) == null ? void 0 : m.Event) == null ? void 0 : f.EDITSTART, i = (v = (A = t == null ? void 0 : t.Draw) == null ? void 0 : A.Event) == null ? void 0 : v.EDITSTOP;
1548
- if (!e || !r) return;
1549
- const n = (y) => {
1550
- const b = y == null ? void 0 : y.layer;
1551
- b && this.layers.includes(b) && this.syncCenters(b);
1552
- }, s = (y) => {
1553
- const b = y == null ? void 0 : y.layer;
1554
- b && this.layers.includes(b) && (this.updateLabels(b), this.requestRenderControls());
1555
- }, l = (y) => {
1556
- var k;
1557
- const b = y == null ? void 0 : y.layer;
1558
- if (!b || !this.layers.includes(b)) return;
1559
- const w = b;
1560
- ((k = w.getTooltip) == null ? void 0 : k.call(w)) && this.updateLabels(w);
1561
- }, c = () => {
1562
- this.layers.forEach((y) => {
1563
- var w;
1564
- const b = (w = y.getTooltip) == null ? void 0 : w.call(y);
1565
- b && (y.setTooltipContent(
1566
- z(y.getRadius(), this.measurementSystem)
1567
- ), b.options.offset = [10, 0], b.options.direction = "right", y.closeTooltip(), y.openTooltip());
1568
- });
1569
- };
1570
- this.map.on(e, n), this.map.on(r, s), o && (this.map.on(o, l), this.detachMapListeners.push(() => this.map.off(o, l))), i && (this.map.on(i, c), this.detachMapListeners.push(() => this.map.off(i, c))), this.detachMapListeners.push(() => this.map.off(e, n)), this.detachMapListeners.push(() => this.map.off(r, s));
1571
- }
1572
- requestRenderControls() {
1573
- if (this.renderScheduled) return;
1574
- this.renderScheduled = !0, (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (e) => setTimeout(() => e(0), 0))(() => {
1575
- this.renderScheduled = !1, this.renderControls();
1576
- });
1577
- }
1578
- addLayer(t) {
1579
- this.layers.push(t), t.addTo(this.map), t.bindTooltip(
1580
- z(t.getRadius(), this.measurementSystem),
1581
- {
1582
- permanent: !0,
1583
- direction: "right",
1584
- className: "cake-label",
1585
- offset: [10, 0]
1586
- }
1587
- );
1588
- const e = t.editing;
1589
- setTimeout(() => {
1590
- var r, o, i, n, s;
1591
- try {
1592
- if ((r = t.redraw) == null || r.call(t), $t(t), (o = e == null ? void 0 : e.enabled) != null && o.call(e)) {
1593
- (i = e.updateMarkers) == null || i.call(e), this.requestRenderControls();
1594
- return;
1595
- }
1596
- (n = e == null ? void 0 : e.enable) == null || n.call(e), (s = e == null ? void 0 : e.updateMarkers) == null || s.call(e), this.requestRenderControls();
1597
- } catch {
1598
- }
1599
- }, 0);
1600
- }
1601
- addRing() {
1602
- if (this.layers.length >= 10) return;
1603
- const t = this.getLargestCircle();
1604
- if (!t) return;
1605
- const e = t.getRadius() * 1.5, r = x.circle(t.getLatLng(), {
1606
- ...this.baseCircleOptions,
1607
- radius: e
1608
- });
1609
- this.addLayer(r), this.renderControls();
1610
- }
1611
- save() {
1612
- const t = Wt({ circles: this.layers });
1613
- this.onSave(t), this.destroy();
1614
- }
1615
- getLargestCircle() {
1616
- return this.layers.length === 0 ? null : this.layers.reduce(
1617
- (t, e) => t.getRadius() > e.getRadius() ? t : e
1618
- );
1619
- }
1620
- syncCenters(t) {
1621
- const e = t.getLatLng();
1622
- this.layers.forEach((r) => {
1623
- var o, i, n;
1624
- r !== t && (r.setLatLng(e), (o = r.redraw) == null || o.call(r), (n = (i = r.editing) == null ? void 0 : i.updateMarkers) == null || n.call(i));
1625
- }), this.requestRenderControls();
1626
- }
1627
- /**
1628
- * Update the label for the active circle being resized.
1629
- * Shows both total radius and delta (ring width) from the next smaller circle.
1630
- * Positions the tooltip on the left side to avoid toolbar interference.
1631
- */
1632
- updateLabels(t) {
1633
- var n;
1634
- const e = t.getRadius();
1635
- let r = z(e, this.measurementSystem);
1636
- const o = this.layers.filter(
1637
- (s) => s !== t && s.getRadius() < e
1638
- );
1639
- if (o.length > 0) {
1640
- const s = o.reduce(
1641
- (d, u) => d.getRadius() > u.getRadius() ? d : u
1642
- ), l = e - s.getRadius(), c = z(l, this.measurementSystem);
1643
- r = `${z(e, this.measurementSystem)} (+${c})`;
1644
- }
1645
- const i = (n = t.getTooltip) == null ? void 0 : n.call(t);
1646
- if (i) {
1647
- t.setTooltipContent(r);
1648
- const l = t.getBounds().getSouthWest();
1649
- l.lat = t.getLatLng().lat, i.options.direction = "left", i.options.offset = [-10, 0], i.setLatLng(l), t.closeTooltip(), t.openTooltip();
1650
- }
1651
- }
1652
- renderControls() {
1653
- this.controlsGroup.clearLayers();
1654
- const t = this.getLargestCircle();
1655
- if (!t) return;
1656
- const r = t.getBounds().getNorthEast(), o = `cake-add-${this.sessionId}`, i = `cake-save-${this.sessionId}`, n = x.divIcon({
1657
- className: "layer-cake-controls",
1658
- html: `
1659
- <div class="layer-cake-controls__container">
1660
- <button id="${o}" type="button">➕ Ring</button>
1661
- <button id="${i}" type="button" class="layer-cake-controls__save">💾 Save</button>
1662
- </div>
1663
- `,
1664
- iconSize: [140, 40],
1665
- iconAnchor: [-10, 20]
1666
- });
1667
- x.marker(r, {
1668
- icon: n,
1669
- interactive: !0,
1670
- keyboard: !1,
1671
- bubblingMouseEvents: !1
1672
- }).addTo(this.controlsGroup), setTimeout(() => {
1673
- const s = this.map.getContainer();
1674
- Xt({
1675
- root: s,
1676
- addButtonId: o,
1677
- saveButtonId: i,
1678
- onAddRing: () => this.addRing(),
1679
- onSave: () => this.save()
1680
- });
1681
- }, 0);
1682
- }
1683
- destroy() {
1684
- this.detachMapListeners.forEach((t) => {
1685
- try {
1686
- t();
1687
- } catch {
1688
- }
1689
- }), this.detachMapListeners = [], this.layers.forEach((t) => this.map.removeLayer(t)), this.layers = [], this.controlsGroup.clearLayers(), this.map.removeLayer(this.controlsGroup);
1690
- }
1691
- }
1692
- const tr = `<?xml version="1.0" encoding="utf-8"?>
1693
- \r<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
1694
- <svg width="800px" height="800px" viewBox="0 -1.67 47.336 47.336" xmlns="http://www.w3.org/2000/svg">\r
1695
- <g id="Group_42" data-name="Group 42" transform="translate(-172.455 -364.36)">\r
1696
- <path id="Rectangle_17" data-name="Rectangle 17" d="M4.351,0H40.984a4.351,4.351,0,0,1,4.351,4.351V22.117a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z" transform="translate(173.455 384.243)" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>\r
1697
- <path id="Path_90" data-name="Path 90" d="M218.79,390.249a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.778,3.778,0,0,1-3.777-3.778" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>\r
1698
- <g id="Group_41" data-name="Group 41">\r
1699
- <path id="Rectangle_18" data-name="Rectangle 18" d="M4.351,0H26.473a4.351,4.351,0,0,1,4.351,4.351V17.883a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z" transform="translate(180.71 365.36)" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>\r
1700
- <path id="Path_91" data-name="Path 91" d="M211.234,370.794a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>\r
1701
- </g>\r
1702
- </g>\r
1703
- </svg>`, rr = `<?xml version="1.0" encoding="utf-8"?>
1704
- <!-- Four-way directional arrow icon for move tool -->
1705
- <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
1706
- <g fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1707
- <!-- Up arrow -->
1708
- <path d="M12 2 L12 22"/>
1709
- <path d="M12 2 L9 5"/>
1710
- <path d="M12 2 L15 5"/>
1711
- <!-- Down arrow -->
1712
- <path d="M12 22 L9 19"/>
1713
- <path d="M12 22 L15 19"/>
1714
- <!-- Left arrow -->
1715
- <path d="M2 12 L22 12"/>
1716
- <path d="M2 12 L5 9"/>
1717
- <path d="M2 12 L5 15"/>
1718
- <!-- Right arrow -->
1719
- <path d="M22 12 L19 9"/>
1720
- <path d="M22 12 L19 15"/>
1721
- </g>
1722
- </svg>
1723
- `, Be = 6378137, S = 6356752314245e-6, T = 1 / 298.257223563, or = Math.PI / 180, ar = 180 / Math.PI, G = 1e9;
1724
- function ir(a) {
1725
- const t = BigInt(Math.round(a * G));
1726
- return Number(t) / G;
1727
- }
1728
- function B(a) {
1729
- return ir(a) * or;
1730
- }
1731
- function we(a) {
1732
- const t = a * ar % 360;
1733
- return t < 0 ? t + 360 : t;
1734
- }
1735
- function ce(a) {
1736
- const t = BigInt(Math.round(a * G));
1737
- return Number(t) / G;
1738
- }
1739
- function nr(a, t, e, r) {
1740
- const o = sr(a, t, e, r);
1741
- if (o.converged)
1742
- return {
1743
- meters: ce(o.distanceMeters),
1744
- bearingDegrees: we(o.bearingRad),
1745
- algorithm: "vincenty",
1746
- iterations: o.iterations
1747
- };
1748
- const i = lr(a, t, e, r);
1749
- return {
1750
- meters: ce(i.distanceMeters),
1751
- bearingDegrees: we(i.bearingRad),
1752
- algorithm: "karney",
1753
- iterations: o.iterations
1754
- };
1755
- }
1756
- function sr(a, t, e, r) {
1757
- const o = B(a), i = B(e), n = B(r - t), s = Math.atan((1 - T) * Math.tan(o)), l = Math.atan((1 - T) * Math.tan(i)), c = Math.sin(s), d = Math.cos(s), u = Math.sin(l), p = Math.cos(l);
1758
- let g = n, m = 0, f = 0;
1759
- const A = 200;
1760
- let v = 0, y = 0, b = 0, w = 0, E = 0;
1761
- for (; Math.abs(g - m) > 1e-12 && f < A; ) {
1762
- const ue = Math.sin(g), he = Math.cos(g);
1763
- if (v = Math.sqrt(
1764
- (p * ue) ** 2 + (d * u - c * p * he) ** 2
1765
- ), v === 0)
1766
- return {
1767
- distanceMeters: 0,
1768
- bearingRad: 0,
1769
- iterations: f,
1770
- converged: !0
1771
- };
1772
- y = c * u + d * p * he, b = Math.atan2(v, y);
1773
- const pe = d * p * ue / v;
1774
- w = 1 - pe ** 2, E = w === 0 ? 0 : y - 2 * c * u / w;
1775
- const q = T / 16 * w * (4 + T * (4 - 3 * w));
1776
- m = g, g = n + (1 - q) * T * pe * (b + q * v * (E + q * y * (-1 + 2 * E ** 2))), f += 1;
1777
- }
1778
- if (f >= A)
1779
- return {
1780
- distanceMeters: Number.NaN,
1781
- bearingRad: 0,
1782
- iterations: f,
1783
- converged: !1
1784
- };
1785
- const k = (Be ** 2 - S ** 2) / S ** 2 * w, C = 1 + k / 16384 * (4096 + k * (-768 + k * (320 - 175 * k))), _ = k / 1024 * (256 + k * (-128 + k * (74 - 47 * k))), D = _ * v * (E + _ / 4 * (y * (-1 + 2 * E ** 2) - _ / 6 * E * (-3 + 4 * v ** 2) * (-3 + 4 * E ** 2))), Ne = S * C * (b - D), Fe = Math.atan2(
1786
- p * Math.sin(g),
1787
- d * u - c * p * Math.cos(g)
1788
- );
1789
- return {
1790
- distanceMeters: Ne,
1791
- bearingRad: Fe,
1792
- iterations: f,
1793
- converged: !0
1794
- };
1795
- }
1796
- function lr(a, t, e, r) {
1797
- const o = B(a), i = B(e), n = B(r - t), s = Math.atan((1 - T) * Math.tan(o)), l = Math.atan((1 - T) * Math.tan(i)), c = Math.sin(s), d = Math.cos(s), u = Math.sin(l), p = Math.cos(l), g = Math.sqrt(
1798
- (p * Math.sin(n)) ** 2 + (d * u - c * p * Math.cos(n)) ** 2
1799
- ), m = c * u + d * p * Math.cos(n), f = Math.atan2(g, m);
1800
- if (f === 0)
1801
- return { distanceMeters: 0, bearingRad: 0 };
1802
- const v = 1 - (d * p * Math.sin(n) / Math.sin(f)) ** 2, y = v === 0 ? 0 : m - 2 * c * u / v, b = (Be ** 2 - S ** 2) / S ** 2 * v, w = 1 + b / 16384 * (4096 + b * (-768 + b * (320 - 175 * b))), E = b / 1024 * (256 + b * (-128 + b * (74 - 47 * b))), k = E * g * (y + E / 4 * (m * (-1 + 2 * y ** 2) - E / 6 * y * (-3 + 4 * g ** 2) * (-3 + 4 * y ** 2))), C = S * w * (f - k), _ = Math.atan2(
1803
- p * Math.sin(n),
1804
- d * u - c * p * Math.cos(n)
1805
- );
1806
- return { distanceMeters: C, bearingRad: _ };
1807
- }
1808
- const cr = {
1809
- position: "topleft",
1810
- circleMarker: {
1811
- color: "red",
1812
- radius: 2
1813
- },
1814
- lineStyle: {
1815
- color: "red",
1816
- dashArray: "1,6"
1817
- },
1818
- angleUnit: {
1819
- display: "°",
1820
- decimal: 2,
1821
- factor: null,
1822
- label: "Bearing:"
1823
- }
1824
- }, dr = {
1825
- display: "km",
1826
- decimal: 2,
1827
- factor: null,
1828
- label: "Distance (km):"
1829
- }, ur = {
1830
- display: "mi",
1831
- decimal: 2,
1832
- factor: 0.621371,
1833
- label: "Distance (mi):"
1834
- };
1835
- function hr(a) {
1836
- const t = a === "imperial" ? { ...ur } : { ...dr };
1837
- return {
1838
- ...cr,
1839
- lengthUnit: t
1840
- };
1841
- }
1842
- const pr = {
1843
- metric: "Meters / Kilometers",
1844
- imperial: "Feet / Miles"
1845
- };
1846
- function X(a, t = {}) {
1847
- var i, n;
1848
- const e = !!((i = a == null ? void 0 : a.Control) != null && i.Draw), r = !!a.draw, o = e && r;
1849
- return o || (n = t.onError) == null || n.call(
1850
- t,
1851
- "Leaflet.draw is not available on the provided Leaflet instance"
1852
- ), o;
1853
- }
1854
- let xe = !1;
1855
- const fr = {
1856
- polygon: "tool:polygon:created",
1857
- polyline: "tool:polyline:created",
1858
- rectangle: "tool:rectangle:created",
1859
- circle: "tool:circle:created",
1860
- marker: "tool:marker:created"
1861
- };
1862
- class gr {
1863
- constructor(t) {
1864
- h(this, "container");
1865
- h(this, "logger");
1866
- h(this, "options");
1867
- // Active Leaflet namespace (injected or bundled fallback)
1868
- h(this, "L");
1869
- // Data store (id-centric)
1870
- h(this, "store");
1871
- // Leaflet entities
1872
- h(this, "map", null);
1873
- h(this, "tileLayer", null);
1874
- h(this, "drawnItems", null);
1875
- // Keep 'any' here to avoid type friction across different @types/leaflet-draw versions
1876
- h(this, "drawControl", null);
1877
- h(this, "rulerControl", null);
1878
- h(this, "measurementControl", null);
1879
- h(this, "measurementSystem", "metric");
1880
- h(this, "measurementModalOverlay", null);
1881
- h(this, "measurementModalDialog", null);
1882
- h(this, "measurementModalRadios", {});
1883
- h(this, "measurementModalKeydownHandler", null);
1884
- // Detacher for our polygon close-on-first-vertex patch
1885
- h(this, "detachPolygonFinishPatch", null);
1886
- // Context menu for vertex deletion
1887
- h(this, "vertexMenuEl", null);
1888
- h(this, "vertexMenuCleanup", null);
1889
- h(this, "vertexEditSurfaceCleanup", null);
1890
- h(this, "activeCakeSession", null);
1891
- // Move tool UI elements
1892
- h(this, "moveConfirmationUI", null);
1893
- h(this, "activeMoveHandler", null);
1894
- h(this, "markerIconConfig", null);
1895
- h(this, "markerIcon", null);
1896
- h(this, "toolButtonConfig", null);
1897
- h(this, "toolbarGroups", null);
1898
- var e, r, o, i;
1899
- this.options = t, this.container = t.container, this.logger = ((e = t.logger) != null ? e : J("controller", "debug")).child(
1900
- "map"
1901
- ), this.L = this.resolveLeaflet(t), this.store = new At(this.logger.child("store")), this.setMarkerIconConfig((r = t.markerIconConfig) != null ? r : null, {
1902
- reapplyExistingLayers: !1,
1903
- syncDrawControl: !1
1904
- }), this.toolButtonConfig = (o = t.toolButtonConfig) != null ? o : null, this.toolbarGroups = (i = t.toolbarGroups) != null ? i : null, this.logger.debug("ctor", {
1905
- config: t.map,
1906
- controls: t.controls,
1907
- readOnly: t.readOnly,
1908
- useExternalLeaflet: t.useExternalLeaflet
1909
- }), Jt(this.L), Zt(this.L), Vt(this.L);
1910
- }
1911
- emitToolEvent(t, e) {
1912
- var o, i;
1913
- try {
1914
- (i = (o = this.options.toolHooks) == null ? void 0 : o[t]) == null || i.call(o, e);
1915
- } catch (n) {
1916
- this._error(`tool hook failed: ${t}`, n);
1917
- }
1918
- const r = this.options.toolEventEmitter;
1919
- if (r)
1920
- try {
1921
- if (typeof r.emit == "function") {
1922
- r.emit(t, e);
1923
- return;
1924
- }
1925
- typeof r.dispatchEvent == "function" && r.dispatchEvent(
1926
- new CustomEvent(t, {
1927
- detail: e
1928
- })
1929
- );
1930
- } catch (n) {
1931
- this._error(`tool emitter failed: ${t}`, n);
1932
- }
1933
- }
1934
- setToolObservers(t) {
1935
- this.options.toolHooks = t.toolHooks, this.options.toolEventEmitter = t.toolEventEmitter;
1936
- }
1937
- setMarkerIconConfig(t, e = {}) {
1938
- const { reapplyExistingLayers: r = !0, syncDrawControl: o = !0 } = e;
1939
- this.options.markerIconConfig = t, this.markerIconConfig = t, this.markerIcon = this.createMarkerIcon(t), o && this.syncDrawMarkerOptions(), r && this.reapplyMarkerIconsToExistingLayers();
1940
- }
1941
- setToolButtonConfig(t) {
1942
- this.options.toolButtonConfig = t != null ? t : null, this.toolButtonConfig = t != null ? t : null, this.applyToolButtonCustomizations();
1943
- }
1944
- setToolbarGroups(t) {
1945
- this.options.toolbarGroups = t != null ? t : null, this.toolbarGroups = t != null ? t : null, this.applyToolButtonCustomizations();
1946
- }
1947
- activateTool(t, e = {}) {
1948
- var o, i, n;
1949
- const r = (o = e.source) != null ? o : "api";
1950
- try {
1951
- if (t === "select")
1952
- return this.deactivateTool({ source: r, groupId: e.groupId });
1953
- if (t === "save") {
1954
- const l = this.store.toFeatureCollection();
1955
- return (n = (i = this.options.callbacks) == null ? void 0 : i.onSaved) == null || n.call(i, {
1956
- geoJSON: l,
1957
- featureCount: l.features.length
1958
- }), this.emitToolEvent("tool:save", {
1959
- geoJSON: l,
1960
- featureCount: l.features.length
1961
- }), this.emitToolTrigger({
1962
- tool: t,
1963
- source: r,
1964
- groupId: e.groupId,
1965
- handled: !0
1966
- }), !0;
1967
- }
1968
- if (t === "layerStyle")
1969
- return this.emitToolTrigger({
1970
- tool: t,
1971
- source: r,
1972
- groupId: e.groupId,
1973
- handled: !0
1974
- }), !0;
1975
- if (t === "measurementSettings")
1976
- return this.toggleMeasurementModal(!0), this.emitToolTrigger({
1977
- tool: t,
1978
- source: r,
1979
- groupId: e.groupId,
1980
- handled: !0
1981
- }), !0;
1982
- if (t === "ruler") {
1983
- const l = this.triggerRulerTool();
1984
- return this.emitToolTrigger({
1985
- tool: t,
1986
- source: r,
1987
- groupId: e.groupId,
1988
- handled: l,
1989
- error: l ? void 0 : "Ruler control is not available"
1990
- }), l;
1991
- }
1992
- const s = this.findLeafletDrawHandler(t);
1993
- return !s || typeof s.enable != "function" ? (this.emitToolTrigger({
1994
- tool: t,
1995
- source: r,
1996
- groupId: e.groupId,
1997
- handled: !1,
1998
- error: `Tool "${t}" is not available on this map`
1999
- }), !1) : (s.enable(), this.emitToolTrigger({
2000
- tool: t,
2001
- source: r,
2002
- groupId: e.groupId,
2003
- handled: !0
2004
- }), !0);
2005
- } catch (s) {
2006
- const l = `Failed to activate tool "${t}"`;
2007
- return this._error(l, s), this.emitToolTrigger({
2008
- tool: t,
2009
- source: r,
2010
- groupId: e.groupId,
2011
- handled: !1,
2012
- error: s instanceof Error ? s.message : l
2013
- }), !1;
2014
- }
2015
- }
2016
- triggerTool(t, e = {}) {
2017
- return this.activateTool(t, e);
2018
- }
2019
- deactivateTool(t = {}) {
2020
- var r;
2021
- const e = (r = t.source) != null ? r : "api";
2022
- try {
2023
- return this.disableActiveToolHandlers(), this.toggleMeasurementModal(!1), this.emitToolTrigger({
2024
- tool: "select",
2025
- source: e,
2026
- groupId: t.groupId,
2027
- handled: !0
2028
- }), !0;
2029
- } catch (o) {
2030
- const i = "Failed to deactivate active map tools";
2031
- return this._error(i, o), this.emitToolTrigger({
2032
- tool: "select",
2033
- source: e,
2034
- groupId: t.groupId,
2035
- handled: !1,
2036
- error: o instanceof Error ? o.message : i
2037
- }), !1;
2038
- }
2039
- }
2040
- resolveLeaflet(t) {
2041
- if (!t.useExternalLeaflet)
2042
- return x;
2043
- if (t.leaflet && X(t.leaflet))
2044
- return this.logger.debug("leaflet-runtime:external-injected"), t.leaflet;
2045
- const r = globalThis.L;
2046
- return r && X(r) ? (this.logger.debug("leaflet-runtime:external-global"), r) : (this.logger.warn("leaflet-runtime:external-fallback-bundled", {
2047
- message: "External Leaflet requested but Draw APIs were missing; falling back to bundled Leaflet/Draw"
2048
- }), x);
2049
- }
2050
- // ---------------- Lifecycle ----------------
2051
- async init() {
2052
- var e, r, o, i, n, s;
2053
- const t = (r = (e = performance.now) == null ? void 0 : e.call(performance)) != null ? r : Date.now();
2054
- try {
2055
- await this.destroy();
2056
- const {
2057
- latitude: l,
2058
- longitude: c,
2059
- zoom: d,
2060
- minZoom: u,
2061
- maxZoom: p,
2062
- tileUrl: g,
2063
- tileAttribution: m,
2064
- preferCanvas: f = !0,
2065
- // Default to Canvas rendering for better performance
2066
- useExternalLeaflet: A
2067
- } = this.options.map, v = [l, c], y = this.L;
2068
- A && X(y, {
2069
- onError: (C) => this.logger.warn("external-leaflet-missing-draw", { message: C })
2070
- }), this.map = y.map(this.container, {
2071
- zoomControl: !0,
2072
- minZoom: u,
2073
- preferCanvas: f
2074
- }).setView(v, d), this.setTileLayer(
2075
- {
2076
- urlTemplate: g,
2077
- attribution: m != null ? m : "",
2078
- maxZoom: p
2079
- },
2080
- {
2081
- onTileError: (C) => {
2082
- var _, D;
2083
- (D = (_ = this.options.callbacks) == null ? void 0 : _.onTileError) == null || D.call(_, C);
2084
- }
2085
- }
2086
- ), this.drawnItems = y.featureGroup().addTo(this.map);
2087
- const b = this.buildDrawOptions(
2088
- this.options.controls,
2089
- !!this.options.readOnly
2090
- ), w = y.Control.Draw;
2091
- this.drawControl = new w(b), this.map.addControl(this.drawControl), this.applyLayerCakeToolbarIcon(), this.applyMoveToolbarIcon(), this.restoreVisibleLayersFromStore(), this.options.controls.ruler && (this.logger.debug("init:ruler", {
2092
- available: typeof y.control.ruler == "function"
2093
- }), typeof y.control.ruler == "function" ? (this.addRulerControl(), this.installMeasurementSettingsControl()) : this.logger.warn("init:ruler:missing", {
2094
- msg: "L.control.ruler is not defined"
2095
- })), this.applyToolButtonCustomizations(), this.patchLeafletDrawBugs(), this.installPolygonFinishPatch(), this.installVertexEditSurfaceMenu(), this.map.invalidateSize(), setTimeout(() => {
2096
- var C;
2097
- try {
2098
- (C = this.map) == null || C.invalidateSize();
2099
- } catch {
2100
- }
2101
- }, 0), this.bindDrawEvents();
2102
- const E = ((i = (o = performance.now) == null ? void 0 : o.call(performance)) != null ? i : Date.now()) - t;
2103
- this.logger.debug("init:ready", { elapsedMs: Math.round(E) });
2104
- const k = this.store.bounds();
2105
- (s = (n = this.options.callbacks) == null ? void 0 : n.onReady) == null || s.call(n, k ? { bounds: k } : {});
2106
- } catch (l) {
2107
- this._error("Failed to initialize Leaflet map", l, {
2108
- code: "map_init_failed",
2109
- recoverable: !1
2110
- });
2111
- }
2112
- }
2113
- async destroy() {
2114
- var t, e, r, o;
2115
- try {
2116
- Q(this.container, null, { toolbarGroups: null }), this.map && (this.map.off(), this.map.remove());
2117
- } catch (i) {
2118
- this._error("Failed to remove Leaflet map", i);
2119
- }
2120
- try {
2121
- (t = this.detachPolygonFinishPatch) == null || t.call(this);
2122
- } catch {
2123
- }
2124
- this.detachPolygonFinishPatch = null;
2125
- try {
2126
- (e = this.vertexMenuCleanup) == null || e.call(this);
2127
- } catch {
2128
- }
2129
- this.vertexMenuEl = null, this.vertexMenuCleanup = null;
2130
- try {
2131
- (r = this.vertexEditSurfaceCleanup) == null || r.call(this);
2132
- } catch {
2133
- }
2134
- this.vertexEditSurfaceCleanup = null;
2135
- try {
2136
- this.hideMoveConfirmationUI();
2137
- } catch {
2138
- }
2139
- this.drawControl = null, this.rulerControl = null, this.measurementControl = null, this.removeMeasurementModal(), this.drawnItems = null, this.tileLayer = null;
2140
- try {
2141
- (o = this.activeCakeSession) == null || o.destroy();
2142
- } catch {
2143
- }
2144
- this.activeCakeSession = null, this.map = null;
2145
- }
2146
- // ---------------- Public API (data) ----------------
2147
- async getGeoJSON() {
2148
- return this.store.toFeatureCollection();
2149
- }
2150
- async exportGeoJSON(t = {}) {
2151
- return mt(await this.getGeoJSON(), t);
2152
- }
2153
- async importGeoJSON(t, e = {}) {
2154
- var s;
2155
- if (!this.map || !this.drawnItems) return [];
2156
- const r = (s = e.behavior) != null ? s : "replace";
2157
- r === "replace" && await this.clearLayers();
2158
- const o = gt(t), i = this.store.add(o), n = this.createGeoJSONLayers(o);
2159
- return this.addGeoJSONLayersToDrawnItems(n), this.logger.debug("importGeoJSON", {
2160
- behavior: r,
2161
- count: o.features.length,
2162
- ids: i
2163
- }), e.fitToData && await this.fitBoundsToData(), i;
2164
- }
2165
- async loadGeoJSON(t, e = !1) {
2166
- await this.importGeoJSON(t, {
2167
- behavior: "replace",
2168
- fitToData: e
2169
- });
2170
- }
2171
- async clearLayers() {
2172
- this.drawnItems && this.drawnItems.clearLayers(), this.store.clear();
2173
- }
2174
- async addFeatures(t) {
2175
- return this.importGeoJSON(t, { behavior: "add" });
2176
- }
2177
- async updateFeature(t, e) {
2178
- if (!this.store.has(t)) {
2179
- this.logger.warn("updateFeature:missing", { id: t });
2180
- return;
2181
- }
2182
- if (this.store.update(t, e), !this.drawnItems) return;
2183
- this.drawnItems.eachLayer((o) => {
2184
- o._fid === t && this.drawnItems.removeLayer(o);
2185
- }), this.createGeoJSONLayers({
2186
- type: "FeatureCollection",
2187
- features: [{ ...e, id: t }]
2188
- }).eachLayer((o) => {
2189
- o._fid = t, this.drawnItems.addLayer(o), this.installVertexContextMenu(o);
2190
- });
2191
- }
2192
- async removeFeature(t) {
2193
- this.drawnItems && this.drawnItems.eachLayer((e) => {
2194
- e._fid === t && this.drawnItems.removeLayer(e);
2195
- }), this.store.remove(t);
2196
- }
2197
- // ---------------- Public API (map) ----------------
2198
- async fitBoundsToData(t = 0.05) {
2199
- if (!this.map) return;
2200
- const e = this.store.bounds();
2201
- if (!e) return;
2202
- const r = e, o = this.L.latLngBounds(r);
2203
- if (t > 0) {
2204
- const i = o.getSouthWest(), n = o.getNorthEast(), s = (n.lat - i.lat) * t, l = (n.lng - i.lng) * t, c = this.L.latLngBounds(
2205
- this.L.latLng(i.lat - s, i.lng - l),
2206
- this.L.latLng(n.lat + s, n.lng + l)
2207
- );
2208
- this.map.fitBounds(c);
2209
- } else
2210
- this.map.fitBounds(o);
2211
- }
2212
- async fitBounds(t, e = 0.05) {
2213
- if (!this.map) return;
2214
- const r = this.L.latLngBounds(t);
2215
- if (e > 0) {
2216
- const o = r.getSouthWest(), i = r.getNorthEast(), n = (i.lat - o.lat) * e, s = (i.lng - o.lng) * e, l = this.L.latLngBounds(
2217
- this.L.latLng(o.lat - n, o.lng - s),
2218
- this.L.latLng(i.lat + n, i.lng + s)
2219
- );
2220
- this.map.fitBounds(l);
2221
- } else
2222
- this.map.fitBounds(r);
2223
- }
2224
- async setView(t, e, r) {
2225
- this.map && this.map.setView([t, e], r != null ? r : this.map.getZoom());
2226
- }
2227
- setTileLayer(t, e) {
2228
- if (!this.map) {
2229
- this.logger.warn("setTileLayer called before map initialization", {
2230
- urlTemplate: t.urlTemplate
2231
- });
2232
- return;
2233
- }
2234
- this.logger.debug("tile-layer:switch", {
2235
- urlTemplate: t.urlTemplate,
2236
- attribution: t.attribution,
2237
- maxZoom: t.maxZoom,
2238
- subdomains: t.subdomains
2239
- }), this.tileLayer && (this.map.removeLayer(this.tileLayer), this.tileLayer = null);
2240
- const r = {
2241
- attribution: t.attribution,
2242
- minZoom: this.options.map.minZoom,
2243
- maxZoom: t.maxZoom
2244
- };
2245
- t.subdomains !== void 0 ? r.subdomains = t.subdomains : t.urlTemplate.includes("{s}") && (r.subdomains = ["a", "b", "c"]);
2246
- const o = this.L.tileLayer(
2247
- t.urlTemplate,
2248
- r
2249
- );
2250
- let i = !1;
2251
- o.on("tileerror", (n) => {
2252
- var s;
2253
- this.logger.error("tile-layer:error", { error: n }), i || (i = !0, (s = e == null ? void 0 : e.onTileError) == null || s.call(e, n));
2254
- }), o.addTo(this.map), this.tileLayer = o;
2255
- }
2256
- /**
2257
- * Merge all visible polygon features into a single polygon feature.
2258
- * This removes the original features and adds a new feature with the merged geometry.
2259
- *
2260
- * @param options Optional configuration for the merge operation
2261
- * @returns The ID of the newly created merged feature, or null if no polygons to merge
2262
- */
2263
- async mergeVisiblePolygons(t) {
2264
- if (!this.map || !this.drawnItems) return null;
2265
- const r = (await this.getGeoJSON()).features.filter((s) => {
2266
- const l = s.geometry;
2267
- return l && (Me(l) || Ce(l));
2268
- });
2269
- if (r.length <= 1) {
2270
- if (r.length === 1) {
2271
- const s = r[0].id;
2272
- return s ? String(s) : null;
2273
- }
2274
- return null;
2275
- }
2276
- const o = bt(r, t == null ? void 0 : t.properties);
2277
- if (!o) return null;
2278
- const i = [];
2279
- for (const s of r) {
2280
- const l = s.id;
2281
- l && i.push(String(l));
2282
- }
2283
- for (const s of i)
2284
- await this.removeFeature(s);
2285
- const [n] = await this.addFeatures({
2286
- type: "FeatureCollection",
2287
- features: [o]
2288
- });
2289
- return n || null;
2290
- }
2291
- setRulerUnits(t) {
2292
- if (this.measurementSystem === t) return;
2293
- const e = this.measurementSystem;
2294
- this.measurementSystem = t, this.logger.debug("ruler:units", { system: t }), this.emitToolEvent("tool:ruler:units-changed", {
2295
- previous: e,
2296
- current: t
2297
- }), this.syncMeasurementModalState(), this.rebuildRulerControl();
2298
- }
2299
- // ---------------- Internals ----------------
2300
- buildDrawOptions(t, e) {
2301
- var i;
2302
- const r = {
2303
- polygon: t.polygon ? {
2304
- allowIntersection: (i = this.options.map.polygonAllowIntersection) != null ? i : !1,
2305
- // Disallow self-intersections by default
2306
- showArea: !0,
2307
- // Display area tooltip while drawing
2308
- shapeOptions: {
2309
- color: "#3388ff"
2310
- // Default shape color
2311
- }
2312
- } : !1,
2313
- polyline: t.polyline ? {
2314
- shapeOptions: {
2315
- color: "#3388ff"
2316
- }
2317
- } : !1,
2318
- rectangle: t.rectangle ? {
2319
- shapeOptions: {
2320
- color: "#3388ff"
2321
- }
2322
- } : !1,
2323
- circle: t.circle ? {
2324
- shapeOptions: {
2325
- color: "#3388ff"
2326
- }
2327
- } : !1,
2328
- cake: t.cake ? {
2329
- shapeOptions: {
2330
- color: "#8A2BE2",
2331
- // Violet color for distinction
2332
- fillOpacity: 0.2
2333
- }
2334
- } : !1,
2335
- marker: t.marker ? this.buildMarkerDrawOptions() : !1,
2336
- move: t.move ? {
2337
- featureGroup: this.drawnItems
2338
- } : !1
2339
- };
2340
- let o = {
2341
- featureGroup: this.drawnItems
2342
- };
2343
- return t.edit ? t.delete === !1 && (o.remove = !1) : o = !1, e ? {
2344
- draw: !1,
2345
- edit: !1
2346
- } : { draw: r, edit: o };
2347
- }
2348
- buildMarkerDrawOptions() {
2349
- return this.markerIcon ? { icon: this.markerIcon } : {};
2350
- }
2351
- createMarkerIcon(t) {
2352
- return t ? this.L.icon({
2353
- iconUrl: t.iconUrl,
2354
- iconRetinaUrl: t.iconRetinaUrl,
2355
- shadowUrl: t.shadowUrl,
2356
- iconSize: t.iconSize,
2357
- iconAnchor: t.iconAnchor,
2358
- popupAnchor: t.popupAnchor
2359
- }) : null;
2360
- }
2361
- createDefaultMarkerIcon() {
2362
- var e;
2363
- const t = (e = this.L.Icon) == null ? void 0 : e.Default;
2364
- return t ? new t() : null;
2365
- }
2366
- createGeoJSONLayers(t) {
2367
- return this.L.geoJSON(t, {
2368
- pointToLayer: (e, r) => this.markerIcon ? this.L.marker(r, { icon: this.markerIcon }) : this.L.marker(r),
2369
- onEachFeature: (e, r) => {
2370
- const o = Z(e);
2371
- o && (r._fid = o);
2372
- }
2373
- });
2374
- }
2375
- addGeoJSONLayersToDrawnItems(t) {
2376
- this.drawnItems && t.eachLayer((e) => {
2377
- this.drawnItems.addLayer(e), this.installVertexContextMenu(e);
2378
- });
2379
- }
2380
- restoreVisibleLayersFromStore() {
2381
- if (!this.drawnItems)
2382
- return;
2383
- const t = this.store.toFeatureCollection();
2384
- if (t.features.length === 0)
2385
- return;
2386
- const e = this.createGeoJSONLayers(t);
2387
- this.addGeoJSONLayersToDrawnItems(e);
2388
- }
2389
- syncDrawMarkerOptions() {
2390
- var r, o, i, n;
2391
- const t = this.drawControl;
2392
- if (!t)
2393
- return;
2394
- const e = this.buildMarkerDrawOptions();
2395
- (r = t.options) != null || (t.options = {}), (i = (o = t.options).draw) != null || (o.draw = {}), t.options.draw.marker = e, (n = t.setDrawingOptions) == null || n.call(t, { marker: e });
2396
- }
2397
- reapplyMarkerIconsToExistingLayers() {
2398
- if (!this.drawnItems)
2399
- return;
2400
- const t = this.markerIcon ? null : this.createDefaultMarkerIcon();
2401
- this.drawnItems.eachLayer((e) => {
2402
- if (!(typeof (e == null ? void 0 : e.setIcon) != "function" || typeof (e == null ? void 0 : e.getLatLng) != "function")) {
2403
- if (this.markerIcon) {
2404
- e.setIcon(this.markerIcon);
2405
- return;
2406
- }
2407
- t && e.setIcon(t);
2408
- }
2409
- });
2410
- }
2411
- applyToolButtonCustomizations() {
2412
- Q(this.container, this.toolButtonConfig, {
2413
- toolbarGroups: this.toolbarGroups,
2414
- onTrigger: (t, e) => {
2415
- if (e.activate) {
2416
- this.activateTool(t, {
2417
- source: e.source,
2418
- groupId: e.groupId
2419
- });
2420
- return;
2421
- }
2422
- this.emitToolTrigger({
2423
- tool: t,
2424
- source: e.source,
2425
- groupId: e.groupId,
2426
- handled: !0
2427
- });
2428
- }
2429
- }), setTimeout(() => {
2430
- Q(this.container, this.toolButtonConfig, {
2431
- toolbarGroups: this.toolbarGroups,
2432
- onTrigger: (t, e) => {
2433
- if (e.activate) {
2434
- this.activateTool(t, {
2435
- source: e.source,
2436
- groupId: e.groupId
2437
- });
2438
- return;
2439
- }
2440
- this.emitToolTrigger({
2441
- tool: t,
2442
- source: e.source,
2443
- groupId: e.groupId,
2444
- handled: !0
2445
- });
2446
- }
2447
- });
2448
- }, 0);
2449
- }
2450
- emitToolTrigger(t) {
2451
- var e, r;
2452
- (r = (e = this.options.callbacks) == null ? void 0 : e.onToolTrigger) == null || r.call(e, {
2453
- ...t,
2454
- timestamp: Date.now()
2455
- });
2456
- }
2457
- findLeafletDrawHandler(t) {
2458
- var n, s, l, c, d, u, p, g, m, f;
2459
- const e = {
2460
- polygon: "polygon",
2461
- polyline: "polyline",
2462
- rectangle: "rectangle",
2463
- circle: "circle",
2464
- marker: "marker",
2465
- layerCake: "cake",
2466
- move: "move"
2467
- }, r = {
2468
- edit: "edit",
2469
- delete: "remove"
2470
- }, o = e[t];
2471
- if (o)
2472
- return (d = (c = (l = (s = (n = this.drawControl) == null ? void 0 : n._toolbars) == null ? void 0 : s.draw) == null ? void 0 : l._modes) == null ? void 0 : c[o]) == null ? void 0 : d.handler;
2473
- const i = r[t];
2474
- return i ? (f = (m = (g = (p = (u = this.drawControl) == null ? void 0 : u._toolbars) == null ? void 0 : p.edit) == null ? void 0 : g._modes) == null ? void 0 : m[i]) == null ? void 0 : f.handler : null;
2475
- }
2476
- disableActiveToolHandlers() {
2477
- var e;
2478
- const t = (e = this.drawControl) == null ? void 0 : e._toolbars;
2479
- t && Object.values(t).forEach((r) => {
2480
- var o;
2481
- Object.values((o = r == null ? void 0 : r._modes) != null ? o : {}).forEach((i) => {
2482
- const n = i == null ? void 0 : i.handler;
2483
- n && typeof n.disable == "function" && n.disable();
2484
- });
2485
- });
2486
- }
2487
- triggerRulerTool() {
2488
- const t = this.rulerControl;
2489
- if (typeof (t == null ? void 0 : t._toggleMeasure) == "function")
2490
- return t._toggleMeasure(), !0;
2491
- const e = this.container.querySelector(".leaflet-ruler");
2492
- return e ? (e.click(), !0) : !1;
2493
- }
2494
- applyLayerCakeToolbarIcon() {
2495
- if (!this.container) return;
2496
- const t = () => {
2497
- const e = this.container.querySelector(
2498
- "a.leaflet-draw-draw-cake"
2499
- );
2500
- if (!e) return;
2501
- e.style.setProperty("background-image", "none", "important"), e.style.setProperty("background-color", "#fff", "important"), e.style.setProperty("position", "relative", "important");
2502
- let r = e.querySelector(
2503
- ".leaflet-geokit-cake-icon"
2504
- );
2505
- r || (r = document.createElement("span"), r.className = "leaflet-geokit-cake-icon", r.setAttribute("aria-hidden", "true"), e.appendChild(r)), r.style.setProperty("position", "absolute", "important"), r.style.setProperty("display", "block", "important"), r.style.setProperty("left", "50%", "important"), r.style.setProperty("top", "50%", "important"), r.style.setProperty("width", "18px", "important"), r.style.setProperty("height", "18px", "important"), r.style.setProperty("transform", "translate(-50%, -50%)", "important"), r.style.setProperty("pointer-events", "none", "important"), r.firstElementChild || (r.innerHTML = tr);
2506
- const o = r.firstElementChild;
2507
- o && (o.style.setProperty("width", "100%", "important"), o.style.setProperty("height", "100%", "important"), o.style.setProperty("display", "block", "important"));
2508
- };
2509
- t(), setTimeout(t, 0);
2510
- }
2511
- applyMoveToolbarIcon() {
2512
- if (!this.container) return;
2513
- const t = () => {
2514
- const e = this.container.querySelector(
2515
- "a.leaflet-draw-draw-move"
2516
- );
2517
- if (!e) return;
2518
- e.style.setProperty("background-image", "none", "important"), e.style.setProperty("background-color", "#fff", "important"), e.style.setProperty("position", "relative", "important");
2519
- let r = e.querySelector(
2520
- ".leaflet-geokit-move-icon"
2521
- );
2522
- r || (r = document.createElement("span"), r.className = "leaflet-geokit-move-icon", r.setAttribute("aria-hidden", "true"), e.appendChild(r)), r.style.setProperty("position", "absolute", "important"), r.style.setProperty("display", "block", "important"), r.style.setProperty("left", "50%", "important"), r.style.setProperty("top", "50%", "important"), r.style.setProperty("width", "18px", "important"), r.style.setProperty("height", "18px", "important"), r.style.setProperty("transform", "translate(-50%, -50%)", "important"), r.style.setProperty("pointer-events", "none", "important"), r.firstElementChild || (r.innerHTML = rr);
2523
- const o = r.firstElementChild;
2524
- o && (o.style.setProperty("width", "100%", "important"), o.style.setProperty("height", "100%", "important"), o.style.setProperty("display", "block", "important"));
2525
- };
2526
- t(), setTimeout(t, 0);
2527
- }
2528
- /* c8 ignore start */
2529
- addRulerControl() {
2530
- if (!this.map) return;
2531
- this.installRulerPrecisionPatch();
2532
- const t = hr(this.measurementSystem);
2533
- this.rulerControl = this.L.control.ruler(t), this.map.addControl(this.rulerControl);
2534
- }
2535
- installRulerPrecisionPatch() {
2536
- if (xe) return;
2537
- const t = this.L.Control.Ruler;
2538
- if (!t || typeof t != "function") return;
2539
- const e = t.prototype, r = e._calculateBearingAndDistance;
2540
- if (typeof r != "function") return;
2541
- const o = this.logger;
2542
- e._calculateBearingAndDistance = function() {
2543
- var n, s, l;
2544
- r.call(this);
2545
- try {
2546
- const c = this._clickedLatLong, d = (n = this._movingLatLong) != null ? n : this._clickedLatLong;
2547
- if (!c || !d) return;
2548
- const { meters: u, bearingDegrees: p } = nr(
2549
- c.lat,
2550
- c.lng,
2551
- d.lat,
2552
- d.lng
2553
- ), g = u / 1e3, m = typeof ((l = (s = this.options) == null ? void 0 : s.lengthUnit) == null ? void 0 : l.factor) == "number" ? this.options.lengthUnit.factor : 1, f = ce(g * m);
2554
- this._result = this._result || {}, this._result.Distance = f, this._result.Bearing = p, this._result.meters = u;
2555
- } catch (c) {
2556
- o == null || o.warn("ruler:precision-patch", c);
2557
- }
2558
- }, xe = !0;
2559
- }
2560
- rebuildRulerControl() {
2561
- if (!(!this.map || !this.options.controls.ruler)) {
2562
- if (this.rulerControl) {
2563
- try {
2564
- this.map.removeControl(this.rulerControl);
2565
- } catch (t) {
2566
- this.logger.warn("ruler:remove-failed", t);
2567
- }
2568
- this.rulerControl = null;
2569
- }
2570
- this.addRulerControl();
2571
- }
2572
- }
2573
- /* c8 ignore next */
2574
- installMeasurementSettingsControl() {
2575
- if (!this.map || this.measurementControl) return;
2576
- const t = this, e = this.L.Control.extend({
2577
- options: { position: "topleft" },
2578
- onAdd() {
2579
- const r = t.L.DomUtil.create(
2580
- "div",
2581
- "leaflet-bar leaflet-ruler-settings-control"
2582
- ), o = t.L.DomUtil.create(
2583
- "button",
2584
- "leaflet-ruler-settings-button",
2585
- r
2586
- );
2587
- return o.type = "button", o.title = "Measurement settings", o.setAttribute("aria-label", "Measurement settings"), o.addEventListener("click", (i) => {
2588
- i.preventDefault(), i.stopPropagation(), t.toggleMeasurementModal(!0);
2589
- }), t.L.DomEvent.disableClickPropagation(r), t.L.DomEvent.disableScrollPropagation(r), r;
2590
- }
2591
- });
2592
- this.measurementControl = new e(), this.map.addControl(this.measurementControl);
2593
- }
2594
- /* c8 ignore next */
2595
- ensureMeasurementModal() {
2596
- if (this.measurementModalOverlay) return this.measurementModalOverlay;
2597
- if (typeof document == "undefined")
2598
- throw new Error("Measurement modal requires a browser environment");
2599
- const t = document.createElement("div");
2600
- t.className = "leaflet-ruler-modal-overlay", t.setAttribute("aria-hidden", "true");
2601
- const e = document.createElement("div");
2602
- e.className = "leaflet-ruler-modal", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.tabIndex = -1, t.addEventListener("click", (l) => {
2603
- l.target === t && this.toggleMeasurementModal(!1);
2604
- });
2605
- const r = document.createElement("h2");
2606
- r.className = "leaflet-ruler-modal-title", r.textContent = "Measurement Units", e.appendChild(r);
2607
- const o = document.createElement("p");
2608
- o.className = "leaflet-ruler-modal-description", o.textContent = "Choose how the measurement tool reports distances.", e.appendChild(o);
2609
- const i = document.createElement("div");
2610
- i.className = "leaflet-ruler-modal-options", e.appendChild(i), ["metric", "imperial"].forEach((l) => {
2611
- const c = document.createElement("label");
2612
- c.className = "leaflet-ruler-modal-option";
2613
- const d = document.createElement("input");
2614
- d.type = "radio", d.name = "leaflet-ruler-units", d.value = l, d.addEventListener("change", () => {
2615
- d.checked && this.setRulerUnits(l);
2616
- });
2617
- const u = document.createElement("span");
2618
- u.textContent = pr[l], c.appendChild(d), c.appendChild(u), i.appendChild(c), this.measurementModalRadios[l] = d;
2619
- });
2620
- const n = document.createElement("div");
2621
- n.className = "leaflet-ruler-modal-actions";
2622
- const s = document.createElement("button");
2623
- return s.type = "button", s.className = "leaflet-ruler-modal-close", s.textContent = "Close", s.addEventListener("click", () => this.toggleMeasurementModal(!1)), n.appendChild(s), e.appendChild(n), t.appendChild(e), this.container.appendChild(t), this.measurementModalOverlay = t, this.measurementModalDialog = e, this.syncMeasurementModalState(), t;
2624
- }
2625
- /* c8 ignore next */
2626
- toggleMeasurementModal(t) {
2627
- var r;
2628
- if (!t) {
2629
- this.measurementModalOverlay && (this.measurementModalOverlay.classList.remove("is-open"), this.measurementModalOverlay.setAttribute("aria-hidden", "true")), this.detachMeasurementModalKeydown();
2630
- return;
2631
- }
2632
- const e = this.ensureMeasurementModal();
2633
- e.classList.add("is-open"), e.setAttribute("aria-hidden", "false"), this.syncMeasurementModalState(), this.attachMeasurementModalKeydown(), (r = this.measurementModalDialog) == null || r.focus();
2634
- }
2635
- syncMeasurementModalState() {
2636
- for (const [t, e] of Object.entries(this.measurementModalRadios))
2637
- e && (e.checked = t === this.measurementSystem);
2638
- }
2639
- /* c8 ignore next */
2640
- removeMeasurementModal() {
2641
- this.measurementModalOverlay && this.measurementModalOverlay.remove(), this.measurementModalOverlay = null, this.measurementModalDialog = null, this.measurementModalRadios = {}, this.detachMeasurementModalKeydown();
2642
- }
2643
- /* c8 ignore next */
2644
- attachMeasurementModalKeydown() {
2645
- this.measurementModalKeydownHandler || typeof document == "undefined" || (this.measurementModalKeydownHandler = (t) => {
2646
- t.key === "Escape" && this.toggleMeasurementModal(!1);
2647
- }, document.addEventListener("keydown", this.measurementModalKeydownHandler));
2648
- }
2649
- /* c8 ignore next */
2650
- detachMeasurementModalKeydown() {
2651
- !this.measurementModalKeydownHandler || typeof document == "undefined" || (document.removeEventListener(
2652
- "keydown",
2653
- this.measurementModalKeydownHandler
2654
- ), this.measurementModalKeydownHandler = null);
2655
- }
2656
- /* c8 ignore end */
2657
- /**
2658
- * Workaround: In some environments (notably within Shadow DOM), clicking the first vertex
2659
- * to close a polygon can be unreliable due to event retargeting/hit testing.
2660
- * This patch listens for map clicks while the polygon draw handler is enabled and,
2661
- * if the click is within a small pixel radius of the first vertex, it triggers finishShape().
2662
- */
2663
- installPolygonFinishPatch() {
2664
- var n, s, l, c, d;
2665
- if (!this.map || !this.drawControl) return;
2666
- try {
2667
- (n = this.detachPolygonFinishPatch) == null || n.call(this);
2668
- } catch {
2669
- }
2670
- this.detachPolygonFinishPatch = null;
2671
- const t = this.map, e = (l = (s = this.drawControl) == null ? void 0 : s._toolbars) == null ? void 0 : l.draw;
2672
- if (!e || !!!((d = (c = e._modes) == null ? void 0 : c.polygon) != null && d.handler)) return;
2673
- const o = 10, i = (u) => {
2674
- var p, g, m, f, A, v, y, b;
2675
- try {
2676
- const w = (g = (p = e._modes) == null ? void 0 : p.polygon) == null ? void 0 : g.handler;
2677
- if (!w || !w._enabled) return;
2678
- const E = w._markers;
2679
- if (!Array.isArray(E) || E.length < 3) return;
2680
- const k = (f = (m = E[0]) == null ? void 0 : m.getLatLng) == null ? void 0 : f.call(m);
2681
- if (!k) return;
2682
- const C = t.latLngToContainerPoint(k), _ = t.latLngToContainerPoint(u.latlng);
2683
- Math.hypot(C.x - _.x, C.y - _.y) <= o && typeof w._finishShape == "function" && ((v = (A = u.originalEvent) == null ? void 0 : A.preventDefault) == null || v.call(A), (b = (y = u.originalEvent) == null ? void 0 : y.stopPropagation) == null || b.call(y), w._finishShape());
2684
- } catch (w) {
2685
- this._error("polygon-finish-patch", w);
2686
- }
2687
- };
2688
- t.on("click", i), this.detachPolygonFinishPatch = () => {
2689
- try {
2690
- t.off("click", i);
2691
- } catch {
2692
- }
2693
- };
2694
- }
2695
- patchLeafletDrawBugs() {
2696
- var t, e, r, o, i;
2697
- try {
2698
- const n = this.L, s = n.GeometryUtil;
2699
- if (!s) return;
2700
- const l = {
2701
- km: 2,
2702
- ha: 2,
2703
- m: 0,
2704
- mi: 2,
2705
- ac: 2,
2706
- yd: 0,
2707
- ft: 0,
2708
- nm: 2
2709
- }, c = (e = (t = s.formattedNumber) == null ? void 0 : t.bind(s)) != null ? e : ((d, u) => Number(d).toFixed(u));
2710
- s.readableArea = (d, u, p) => {
2711
- var f;
2712
- const g = (f = n.Util) != null && f.extend ? n.Util.extend({}, l, p || {}) : { ...l, ...p || {} };
2713
- let m;
2714
- if (u) {
2715
- let A = ["ha", "m"];
2716
- const v = typeof u;
2717
- v === "string" ? A = [u] : v !== "boolean" && (A = Array.isArray(u) ? u : A), d >= 1e6 && A.indexOf("km") !== -1 ? m = `${c(1e-6 * d, g.km)} km²` : d >= 1e4 && A.indexOf("ha") !== -1 ? m = `${c(1e-4 * d, g.ha)} ha` : m = `${c(d, g.m)} m²`;
2718
- } else
2719
- d = d / 0.836127, d >= 3097600 ? m = `${c(d / 3097600, g.mi)} mi²` : d >= 4840 ? m = `${c(d / 4840, g.ac)} acres` : m = `${c(d, g.yd)} yd²`;
2720
- return m;
2721
- };
2722
- } catch (n) {
2723
- this.logger.warn("leaflet-draw-patch:readableArea", n);
2724
- }
2725
- try {
2726
- const n = this.L, s = (r = n.Edit) == null ? void 0 : r.Circle, l = (o = n.Draw) == null ? void 0 : o.Event, c = n.GeometryUtil;
2727
- if (!((i = s == null ? void 0 : s.prototype) != null && i._resize) || !l || !c) return;
2728
- s.prototype._resize = function(u) {
2729
- var m, f, A;
2730
- const p = this._moveMarker.getLatLng(), g = c.isVersion07x() ? p.distanceTo(u) : this._map.distance(p, u);
2731
- this._shape.setRadius(g);
2732
- try {
2733
- (m = this._map) != null && m.editTooltip && ((A = (f = this._map) == null ? void 0 : f._editTooltip) != null && A.updateContent) && this._map._editTooltip.updateContent({
2734
- text: n.drawLocal.edit.handlers.edit.tooltip.subtext + "<br />" + n.drawLocal.edit.handlers.edit.tooltip.text,
2735
- subtext: n.drawLocal.draw.handlers.circle.radius + ": " + c.readableDistance(
2736
- g,
2737
- !0,
2738
- this.options.feet,
2739
- this.options.nautic
2740
- )
2741
- });
2742
- } catch {
2743
- }
2744
- this._map.fire(l.EDITRESIZE, { layer: this._shape });
2745
- };
2746
- } catch (n) {
2747
- this.logger.warn("leaflet-draw-patch:circle-resize", n);
2748
- }
2749
- }
2750
- bindDrawEvents() {
2751
- !this.map || !this.drawnItems || (this.map.on(this.L.Draw.Event.CREATED, (t) => {
2752
- var e, r, o;
2753
- try {
2754
- const { layer: i, layerType: n } = t;
2755
- if (n === F.TYPE) {
2756
- try {
2757
- (e = this.activeCakeSession) == null || e.destroy();
2758
- } catch {
2759
- }
2760
- this.activeCakeSession = new er(
2761
- this.map,
2762
- i,
2763
- (u) => {
2764
- if (!this.drawnItems) return;
2765
- const p = this.store.add(u), g = this.L.geoJSON(u);
2766
- let m = 0;
2767
- g.eachLayer((f) => {
2768
- var v, y, b;
2769
- const A = (v = p[m]) != null ? v : p[p.length - 1];
2770
- f._fid = A, this.drawnItems.addLayer(f), this.installVertexContextMenu(f), (b = (y = this.options.callbacks) == null ? void 0 : y.onCreated) == null || b.call(y, {
2771
- id: A,
2772
- layerType: "polygon",
2773
- geoJSON: f.toGeoJSON()
2774
- }), m++;
2775
- }), this.activeCakeSession = null, this.emitToolEvent("tool:layer-cake:saved", {
2776
- featureCollection: u
2777
- });
2778
- },
2779
- this.measurementSystem
2780
- ), this.emitToolEvent("tool:layer-cake:session-started", {
2781
- center: i.getLatLng(),
2782
- radius: i.getRadius()
2783
- });
2784
- return;
2785
- }
2786
- this.drawnItems.addLayer(i);
2787
- const s = i.toGeoJSON(), c = this.store.add({
2788
- type: "FeatureCollection",
2789
- features: [s]
2790
- })[0];
2791
- i._fid = c, this.installVertexContextMenu(i), (o = (r = this.options.callbacks) == null ? void 0 : r.onCreated) == null || o.call(r, { id: c, layerType: n, geoJSON: s });
2792
- const d = fr[n];
2793
- d && this.emitToolEvent(d, {
2794
- id: c,
2795
- geoJSON: s
2796
- });
2797
- } catch (i) {
2798
- this._error("onCreated handler failed", i);
2799
- }
2800
- }), this.map.on(this.L.Draw.Event.EDITED, (t) => {
2801
- var e, r;
2802
- try {
2803
- const o = [];
2804
- t.layers.eachLayer((s) => {
2805
- const l = s.toGeoJSON(), c = s._fid;
2806
- if (c)
2807
- this.store.update(c, l), o.push(c);
2808
- else {
2809
- const d = this.store.add({
2810
- type: "FeatureCollection",
2811
- features: [l]
2812
- })[0];
2813
- s._fid = d, o.push(d);
2814
- }
2815
- });
2816
- const n = this.store.toFeatureCollection();
2817
- (r = (e = this.options.callbacks) == null ? void 0 : e.onEdited) == null || r.call(e, {
2818
- ids: o,
2819
- geoJSON: n
2820
- }), this.emitToolEvent("tool:edit:applied", {
2821
- ids: o,
2822
- geoJSON: n
2823
- });
2824
- } catch (o) {
2825
- this._error("onEdited handler failed", o);
2826
- }
2827
- }), this.map.on(this.L.Draw.Event.DELETED, (t) => {
2828
- var e, r;
2829
- try {
2830
- const o = [];
2831
- t.layers.eachLayer((s) => {
2832
- const l = s._fid;
2833
- l && (o.push(l), this.store.remove(l));
2834
- });
2835
- const n = this.store.toFeatureCollection();
2836
- (r = (e = this.options.callbacks) == null ? void 0 : e.onDeleted) == null || r.call(e, {
2837
- ids: o,
2838
- geoJSON: n
2839
- }), this.emitToolEvent("tool:delete:applied", {
2840
- ids: o,
2841
- geoJSON: n
2842
- });
2843
- } catch (o) {
2844
- this._error("onDeleted handler failed", o);
2845
- }
2846
- }), this.map.on("draw:moveend", (t) => {
2847
- var e;
2848
- try {
2849
- this.emitToolEvent("tool:move:pending", {
2850
- layerId: (e = t == null ? void 0 : t.layer) == null ? void 0 : e._fid,
2851
- originalGeoJSON: t == null ? void 0 : t.originalGeoJSON,
2852
- newGeoJSON: t == null ? void 0 : t.newGeoJSON
2853
- }), this.showMoveConfirmationUI(t.layer);
2854
- } catch (r) {
2855
- this._error("draw:moveend handler failed", r);
2856
- }
2857
- }), this.map.on("draw:moveconfirmed", (t) => {
2858
- var e, r, o;
2859
- try {
2860
- this.emitToolEvent("tool:move:confirmed", {
2861
- layerId: (e = t == null ? void 0 : t.layer) == null ? void 0 : e._fid,
2862
- originalGeoJSON: t == null ? void 0 : t.originalGeoJSON,
2863
- newGeoJSON: t == null ? void 0 : t.newGeoJSON
2864
- });
2865
- const i = t.layer, n = i._fid;
2866
- if (n) {
2867
- const s = i.toGeoJSON();
2868
- this.store.update(n, s), (o = (r = this.options.callbacks) == null ? void 0 : r.onEdited) == null || o.call(r, {
2869
- ids: [n],
2870
- geoJSON: this.store.toFeatureCollection()
2871
- });
2872
- }
2873
- this.hideMoveConfirmationUI();
2874
- } catch (i) {
2875
- this._error("draw:moveconfirmed handler failed", i);
2876
- }
2877
- }));
2878
- }
2879
- _error(t, e, r) {
2880
- var i, n, s, l;
2881
- const o = {
2882
- code: (i = r == null ? void 0 : r.code) != null ? i : "controller_error",
2883
- message: t,
2884
- recoverable: (n = r == null ? void 0 : r.recoverable) != null ? n : !0,
2885
- cause: e,
2886
- timestamp: Date.now()
2887
- };
2888
- this.logger.error("error", o), (l = (s = this.options.callbacks) == null ? void 0 : s.onError) == null || l.call(s, o);
2889
- }
2890
- // -------- Vertex deletion context menu --------
2891
- installVertexEditSurfaceMenu() {
2892
- var o;
2893
- if (!this.map) return;
2894
- try {
2895
- (o = this.vertexEditSurfaceCleanup) == null || o.call(this);
2896
- } catch {
2897
- }
2898
- const t = this.map.getContainer(), e = (i) => {
2899
- this.openNearestEditableVertexMenuFromDomEvent(i);
2900
- }, r = (i) => {
2901
- (i.ctrlKey || i.metaKey) && this.openNearestEditableVertexMenuFromDomEvent(i);
2902
- };
2903
- t.addEventListener("contextmenu", e, {
2904
- capture: !0
2905
- }), t.addEventListener("click", r, { capture: !0 }), this.vertexEditSurfaceCleanup = () => {
2906
- t.removeEventListener("contextmenu", e, {
2907
- capture: !0
2908
- }), t.removeEventListener("click", r, { capture: !0 });
2909
- };
2910
- }
2911
- openNearestEditableVertexMenuFromDomEvent(t) {
2912
- try {
2913
- if (!this.map || !this.drawnItems) return;
2914
- const e = this.map.mouseEventToContainerPoint(t), r = this.map.containerPointToLatLng(e);
2915
- let o = null;
2916
- if (this.drawnItems.eachLayer((i) => {
2917
- if (o) return;
2918
- const n = i.editing;
2919
- if (!(n && typeof n.enabled == "function" && n.enabled())) return;
2920
- const l = this.findNearestVertex(i, r, 16);
2921
- l && (o = { layer: i, ...l });
2922
- }), !o) return;
2923
- t.preventDefault(), t.stopPropagation(), this.showVertexMenu(e, async () => {
2924
- await this.deleteVertex(
2925
- o.layer,
2926
- o.pathIndex,
2927
- o.vertexIndex
2928
- );
2929
- });
2930
- } catch (e) {
2931
- this._error("openNearestEditableVertexMenuFromDomEvent", e);
2932
- }
2933
- }
2934
- installVertexContextMenu(t) {
2935
- if (!t || typeof t.on != "function") return;
2936
- const e = (o) => {
2937
- var i, n, s, l;
2938
- try {
2939
- (n = (i = o == null ? void 0 : o.originalEvent) == null ? void 0 : i.preventDefault) == null || n.call(i), (l = (s = o == null ? void 0 : o.originalEvent) == null ? void 0 : s.stopPropagation) == null || l.call(s);
2940
- } catch {
2941
- }
2942
- this.openVertexMenu(t, o);
2943
- }, r = (o) => {
2944
- const i = o == null ? void 0 : o.originalEvent;
2945
- i && (i.ctrlKey || i.metaKey) && this.openVertexMenu(t, o);
2946
- };
2947
- try {
2948
- t.on("contextmenu", e), t.on("click", r);
2949
- } catch {
2950
- }
2951
- }
2952
- openVertexMenu(t, e) {
2953
- try {
2954
- if (!this.map || !(typeof t.getLatLngs == "function" && (t instanceof this.L.Polygon || t instanceof this.L.Polyline))) return;
2955
- const o = t.editing;
2956
- if (!o || typeof o.enabled != "function" || !o.enabled())
2957
- return;
2958
- const i = e == null ? void 0 : e.latlng, n = this.map.latLngToContainerPoint(i), s = this.findNearestVertex(t, i, 12);
2959
- if (!s) return;
2960
- this.showVertexMenu(n, async () => {
2961
- await this.deleteVertex(t, s.pathIndex, s.vertexIndex);
2962
- });
2963
- } catch (r) {
2964
- this._error("openVertexMenu", r);
2965
- }
2966
- }
2967
- showVertexMenu(t, e) {
2968
- var r;
2969
- try {
2970
- try {
2971
- (r = this.vertexMenuCleanup) == null || r.call(this);
2972
- } catch {
2973
- }
2974
- if (this.vertexMenuCleanup = null, !this.container) return;
2975
- const o = document.createElement("div");
2976
- o.style.position = "absolute", o.style.top = `${t.y}px`, o.style.left = `${t.x}px`, o.style.transform = "translate(-50%, -100%)", o.style.background = "#fff", o.style.border = "1px solid rgba(0,0,0,0.15)", o.style.borderRadius = "6px", o.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", o.style.padding = "6px", o.style.zIndex = "10000", o.style.fontSize = "12px", o.style.userSelect = "none";
2977
- const i = document.createElement("button");
2978
- i.textContent = "Delete vertex", i.style.padding = "6px 10px", i.style.border = "none", i.style.background = "#da1e28", i.style.color = "#fff", i.style.borderRadius = "4px", i.style.cursor = "pointer", i.addEventListener("click", (l) => {
2979
- l.stopPropagation(), l.preventDefault();
2980
- try {
2981
- e();
2982
- } finally {
2983
- n();
2984
- }
2985
- }), o.appendChild(i);
2986
- const n = () => {
2987
- try {
2988
- window.removeEventListener("pointerdown", s), this.container.removeEventListener("scroll", n, !0), o.remove();
2989
- } catch {
2990
- }
2991
- this.vertexMenuEl = null, this.vertexMenuCleanup = null;
2992
- }, s = (l) => {
2993
- !(typeof l.composedPath == "function" ? l.composedPath() : []).includes(o) && !o.contains(l.target) && n();
2994
- };
2995
- window.addEventListener("pointerdown", s, { capture: !0 }), this.container.addEventListener("scroll", n, !0), this.container.appendChild(o), this.vertexMenuEl = o, this.vertexMenuCleanup = n;
2996
- } catch (o) {
2997
- this._error("showVertexMenu", o);
2998
- }
2999
- }
3000
- findNearestVertex(t, e, r) {
3001
- if (!this.map) return null;
3002
- const o = (p) => this.map.latLngToContainerPoint(p), i = (p, g) => Math.hypot(p.x - g.x, p.y - g.y), n = o(e);
3003
- let s = 1 / 0, l = -1, c = -1;
3004
- const d = t.getLatLngs();
3005
- return (Array.isArray(d[0]) ? d : [d]).forEach((p, g) => {
3006
- p.forEach((m, f) => {
3007
- const A = o(m), v = i(A, n);
3008
- v < s && (s = v, l = g, c = f);
3009
- });
3010
- }), l === -1 || s > r ? null : { pathIndex: l, vertexIndex: c };
3011
- }
3012
- async deleteVertex(t, e, r) {
3013
- var o, i, n;
3014
- try {
3015
- if (!(typeof t.getLatLngs == "function" && (t instanceof this.L.Polygon || t instanceof this.L.Polyline))) return;
3016
- const l = t.getLatLngs(), c = Array.isArray(l[0]) ? l : [l], d = c[e];
3017
- if (!d) return;
3018
- const p = t instanceof this.L.Polygon ? 3 : 2;
3019
- if (d.length <= p) return;
3020
- if (d.splice(r, 1), c.length === 1)
3021
- t.setLatLngs(d);
3022
- else {
3023
- const m = c.map((f, A) => A === e ? d : f);
3024
- t.setLatLngs(m);
3025
- }
3026
- (o = t.redraw) == null || o.call(t);
3027
- const g = t._fid;
3028
- if (g) {
3029
- const m = t.toGeoJSON();
3030
- this.store.update(g, m), (n = (i = this.options.callbacks) == null ? void 0 : i.onEdited) == null || n.call(i, {
3031
- ids: [g],
3032
- geoJSON: this.store.toFeatureCollection()
3033
- });
3034
- }
3035
- } catch (s) {
3036
- this._error("deleteVertex", s);
3037
- }
3038
- }
3039
- // -------- Move tool Save/Cancel UI --------
3040
- showMoveConfirmationUI(t) {
3041
- var e, r;
3042
- try {
3043
- if (this.hideMoveConfirmationUI(), !this.container || !this.map) return;
3044
- const o = this.drawControl;
3045
- if (!o) return;
3046
- const i = (e = o == null ? void 0 : o._toolbars) == null ? void 0 : e.draw;
3047
- if (!i) return;
3048
- const n = i._modes || {};
3049
- let s = null;
3050
- for (const u in n) {
3051
- const p = n[u];
3052
- if (((r = p == null ? void 0 : p.handler) == null ? void 0 : r.type) === "move") {
3053
- s = p.handler;
3054
- break;
3055
- }
3056
- }
3057
- this.activeMoveHandler = s;
3058
- const l = document.createElement("div");
3059
- l.style.position = "absolute", l.style.bottom = "60px", l.style.left = "50%", l.style.transform = "translateX(-50%)", l.style.display = "flex", l.style.gap = "8px", l.style.background = "#fff", l.style.border = "2px solid #3388ff", l.style.borderRadius = "8px", l.style.padding = "12px 16px", l.style.boxShadow = "0 4px 12px rgba(0,0,0,0.2)", l.style.zIndex = "10000", l.style.fontSize = "14px", l.style.fontFamily = "system-ui, sans-serif";
3060
- const c = document.createElement("button");
3061
- c.textContent = "✓ Save", c.style.padding = "8px 16px", c.style.border = "none", c.style.background = "#28a745", c.style.color = "#fff", c.style.borderRadius = "4px", c.style.cursor = "pointer", c.style.fontWeight = "600", c.style.fontSize = "14px", c.addEventListener("click", (u) => {
3062
- u.stopPropagation(), u.preventDefault(), s != null && s.confirmMove && s.confirmMove();
3063
- });
3064
- const d = document.createElement("button");
3065
- d.textContent = "✕ Cancel", d.style.padding = "8px 16px", d.style.border = "1px solid #ccc", d.style.background = "#fff", d.style.color = "#333", d.style.borderRadius = "4px", d.style.cursor = "pointer", d.style.fontWeight = "600", d.style.fontSize = "14px", d.addEventListener("click", (u) => {
3066
- u.stopPropagation(), u.preventDefault(), this.emitToolEvent("tool:move:cancelled", {
3067
- layerId: t == null ? void 0 : t._fid
3068
- }), s != null && s.cancelMove && s.cancelMove(), this.hideMoveConfirmationUI();
3069
- }), l.appendChild(c), l.appendChild(d), this.container.appendChild(l), this.moveConfirmationUI = l, this.logger.debug("showMoveConfirmationUI", {
3070
- layerId: t._fid
3071
- });
3072
- } catch (o) {
3073
- this._error("showMoveConfirmationUI", o);
3074
- }
3075
- }
3076
- hideMoveConfirmationUI() {
3077
- try {
3078
- this.moveConfirmationUI && (this.moveConfirmationUI.remove(), this.moveConfirmationUI = null), this.activeMoveHandler = null;
3079
- } catch (t) {
3080
- this._error("hideMoveConfirmationUI", t);
3081
- }
3082
- }
3083
- }
3084
- const Oe = [25, 41], De = [12, 41], Pe = [1, -34];
3085
- function O(a, t) {
3086
- var r, o, i, n;
3087
- if (a == null)
3088
- return null;
3089
- const e = typeof a == "string" ? a.trim() : "";
3090
- if (!e)
3091
- return (r = t.reportError) == null || r.call(t, t.errorMessage, t.cause), null;
3092
- try {
3093
- return new URL(e, (o = t.baseUrl) != null ? o : document.baseURI).toString();
3094
- } catch (s) {
3095
- return (n = t.reportError) == null || n.call(t, t.errorMessage, (i = t.cause) != null ? i : s), null;
3096
- }
3097
- }
3098
- function $(a, t, e) {
3099
- var l, c;
3100
- if (a == null)
3101
- return [...t];
3102
- if (!Array.isArray(a) || a.length !== 2)
3103
- return (l = e.reportError) == null || l.call(e, e.errorMessage, e.cause), [...t];
3104
- const [r, o] = a, i = Number(r), n = Number(o);
3105
- return Number.isFinite(i) && Number.isFinite(n) && (!e.positiveOnly || i > 0 && n > 0) ? [i, n] : ((c = e.reportError) == null || c.call(e, e.errorMessage, e.cause), [...t]);
3106
- }
3107
- function ee(a, t, e) {
3108
- var l, c, d, u, p;
3109
- if (a == null)
3110
- return [...t];
3111
- const r = typeof a == "string" ? a.trim() : "";
3112
- if (!r)
3113
- return (l = e.reportError) == null || l.call(e, e.errorMessage, e.cause), [...t];
3114
- const o = r.split(",");
3115
- if (o.length !== 2)
3116
- return (c = e.reportError) == null || c.call(e, e.errorMessage, e.cause), [...t];
3117
- const i = Number((d = o[0]) == null ? void 0 : d.trim()), n = Number((u = o[1]) == null ? void 0 : u.trim());
3118
- return Number.isFinite(i) && Number.isFinite(n) && (!e.positiveOnly || i > 0 && n > 0) ? [i, n] : ((p = e.reportError) == null || p.call(e, e.errorMessage, e.cause), [...t]);
3119
- }
3120
- function mr(a, t = {}) {
3121
- var i, n;
3122
- if (!a || typeof a != "object")
3123
- return null;
3124
- const e = O(a.iconUrl, {
3125
- ...t,
3126
- errorMessage: "Invalid marker icon config: iconUrl must be a valid URL",
3127
- cause: { field: "iconUrl", value: a.iconUrl }
3128
- });
3129
- if (!e)
3130
- return null;
3131
- const r = (i = O(a.iconRetinaUrl, {
3132
- ...t,
3133
- errorMessage: "Invalid marker icon config: iconRetinaUrl must be a valid URL",
3134
- cause: { field: "iconRetinaUrl", value: a.iconRetinaUrl }
3135
- })) != null ? i : e, o = (n = O(a.shadowUrl, {
3136
- ...t,
3137
- errorMessage: "Invalid marker icon config: shadowUrl must be a valid URL",
3138
- cause: { field: "shadowUrl", value: a.shadowUrl }
3139
- })) != null ? n : void 0;
3140
- return {
3141
- iconUrl: e,
3142
- iconRetinaUrl: r,
3143
- shadowUrl: o,
3144
- iconSize: $(a.iconSize, Oe, {
3145
- ...t,
3146
- positiveOnly: !0,
3147
- errorMessage: "Invalid marker icon config: iconSize must be a [width, height] tuple of positive finite numbers",
3148
- cause: { field: "iconSize", value: a.iconSize }
3149
- }),
3150
- iconAnchor: $(
3151
- a.iconAnchor,
3152
- De,
3153
- {
3154
- ...t,
3155
- errorMessage: "Invalid marker icon config: iconAnchor must be a [x, y] tuple of finite numbers",
3156
- cause: { field: "iconAnchor", value: a.iconAnchor }
3157
- }
3158
- ),
3159
- popupAnchor: $(
3160
- a.popupAnchor,
3161
- Pe,
3162
- {
3163
- ...t,
3164
- errorMessage: "Invalid marker icon config: popupAnchor must be a [x, y] tuple of finite numbers",
3165
- cause: { field: "popupAnchor", value: a.popupAnchor }
3166
- }
3167
- )
3168
- };
3169
- }
3170
- function yr(a, t = {}) {
3171
- var i, n;
3172
- const e = O(a.iconUrl, {
3173
- ...t,
3174
- errorMessage: 'Invalid "marker-icon-url" attribute; falling back to default markers',
3175
- cause: { attribute: "marker-icon-url", value: a.iconUrl }
3176
- });
3177
- if (!e)
3178
- return null;
3179
- const r = (i = O(a.iconRetinaUrl, {
3180
- ...t,
3181
- errorMessage: 'Invalid "marker-icon-retina-url" attribute; using "marker-icon-url" instead',
3182
- cause: {
3183
- attribute: "marker-icon-retina-url",
3184
- value: a.iconRetinaUrl
3185
- }
3186
- })) != null ? i : e, o = (n = O(a.shadowUrl, {
3187
- ...t,
3188
- errorMessage: 'Invalid "marker-shadow-url" attribute; dropping the custom marker shadow',
3189
- cause: { attribute: "marker-shadow-url", value: a.shadowUrl }
3190
- })) != null ? n : void 0;
3191
- return {
3192
- iconUrl: e,
3193
- iconRetinaUrl: r,
3194
- shadowUrl: o,
3195
- iconSize: ee(
3196
- a.iconSize,
3197
- Oe,
3198
- {
3199
- ...t,
3200
- positiveOnly: !0,
3201
- errorMessage: 'Invalid "marker-icon-size" attribute; using the default marker size',
3202
- cause: {
3203
- attribute: "marker-icon-size",
3204
- value: a.iconSize
3205
- }
3206
- }
3207
- ),
3208
- iconAnchor: ee(
3209
- a.iconAnchor,
3210
- De,
3211
- {
3212
- ...t,
3213
- errorMessage: 'Invalid "marker-icon-anchor" attribute; using the default marker anchor',
3214
- cause: {
3215
- attribute: "marker-icon-anchor",
3216
- value: a.iconAnchor
3217
- }
3218
- }
3219
- ),
3220
- popupAnchor: ee(
3221
- a.popupAnchor,
3222
- Pe,
3223
- {
3224
- ...t,
3225
- errorMessage: 'Invalid "marker-popup-anchor" attribute; using the default popup anchor',
3226
- cause: {
3227
- attribute: "marker-popup-anchor",
3228
- value: a.popupAnchor
3229
- }
3230
- }
3231
- )
3232
- };
3233
- }
3234
- const I = {
3235
- osm: {
3236
- urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
3237
- attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
3238
- maxZoom: 19,
3239
- subdomains: ["a", "b", "c"]
3240
- },
3241
- here: {
3242
- styles: {
3243
- "lite.day": "lite.day",
3244
- "normal.day": "normal.day",
3245
- "satellite.day": "satellite.day"
3246
- },
3247
- defaultStyle: "lite.day",
3248
- attribution: 'Map Tiles &copy; <a href="https://www.here.com">HERE</a>',
3249
- maxZoom: 20
3250
- }
3251
- };
3252
- function ze(a) {
3253
- return typeof a == "string" ? a.trim().toLowerCase() : "";
3254
- }
3255
- function Re(a) {
3256
- if (typeof a != "string") return;
3257
- const t = a.trim();
3258
- return t.length > 0 ? t : void 0;
3259
- }
3260
- function br(a) {
3261
- const { style: t, attribution: e } = a, r = ze(a.provider), o = Re(a.apiKey);
3262
- switch (r) {
3263
- case "osm":
3264
- return {
3265
- urlTemplate: I.osm.urlTemplate,
3266
- attribution: e || I.osm.attribution,
3267
- maxZoom: I.osm.maxZoom,
3268
- subdomains: [...I.osm.subdomains]
3269
- };
3270
- case "here": {
3271
- if (!o)
3272
- throw new Error("HERE Maps requires an API key");
3273
- const i = typeof t == "string" ? t.trim() : "", n = i && i in I.here.styles ? i : I.here.defaultStyle;
3274
- return {
3275
- urlTemplate: `https://maps.hereapi.com/v3/base/mc/{z}/{x}/{y}/png8?style=${encodeURIComponent(n)}&apiKey=${encodeURIComponent(o)}`,
3276
- attribution: e || I.here.attribution,
3277
- maxZoom: I.here.maxZoom,
3278
- subdomains: void 0
3279
- };
3280
- }
3281
- default:
3282
- throw new Error(`Unknown tile provider: ${a.provider}`);
3283
- }
3284
- }
3285
- function Ar(a) {
3286
- const t = ze(a.provider), e = Re(a.apiKey);
3287
- return t ? t === "here" && !e ? { valid: !1, error: "HERE Maps requires an API key" } : { valid: !0 } : { valid: !1, error: "Provider is required" };
3288
- }
3289
- class Ue extends HTMLElement {
3290
- constructor() {
3291
- super();
3292
- // Shadow DOM and container references
3293
- h(this, "_root");
3294
- h(this, "_container");
3295
- // Logging
3296
- h(this, "_logger", J("component:leaflet-geokit", "debug"));
3297
- // Internal state mirrors for attributes/properties
3298
- h(this, "_latitude", 0);
3299
- h(this, "_longitude", 0);
3300
- h(this, "_zoom", 2);
3301
- h(this, "_minZoom");
3302
- h(this, "_maxZoom");
3303
- h(this, "_tileUrl", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");
3304
- h(this, "_tileAttribution");
3305
- h(this, "_tileProvider");
3306
- h(this, "_tileStyle");
3307
- h(this, "_apiKey");
3308
- h(this, "_activeTileProvider", "tile-url");
3309
- h(this, "_readOnly", !1);
3310
- h(this, "_logLevel", "debug");
3311
- h(this, "_devOverlay", !1);
3312
- h(this, "_polygonAllowIntersection", !1);
3313
- h(this, "_preferCanvas", !0);
3314
- // Default to Canvas for performance
3315
- // Theming
3316
- h(this, "_themeUrl");
3317
- h(this, "_themeCss", "");
3318
- h(this, "_themeLinkEl", null);
3319
- h(this, "_themeStyleEl", null);
3320
- // Controller
3321
- h(this, "_controller", null);
3322
- // External Leaflet configuration
3323
- h(this, "_useExternalLeaflet", !1);
3324
- h(this, "_skipLeafletStyles", !1);
3325
- h(this, "_leafletInstance");
3326
- h(this, "_toolHooks");
3327
- h(this, "_toolEventEmitter");
3328
- h(this, "_markerIconConfig");
3329
- h(this, "_toolButtonConfig");
3330
- h(this, "_toolbarGroups");
3331
- h(this, "_status", {
3332
- state: "uninitialized",
3333
- ready: !1,
3334
- busy: !1,
3335
- featureCount: 0,
3336
- timestamp: Date.now()
3337
- });
3338
- h(this, "_externalToolTriggerListener", (e) => {
3339
- var o, i;
3340
- const r = e.detail;
3341
- if ((r == null ? void 0 : r.action) === "deactivate" || (r == null ? void 0 : r.active) === !1) {
3342
- this.deactivateTool({
3343
- source: (o = r.source) != null ? o : "event",
3344
- groupId: r.groupId
3345
- });
3346
- return;
3347
- }
3348
- r != null && r.tool && this.activateTool(r.tool, {
3349
- source: (i = r.source) != null ? i : "event",
3350
- groupId: r.groupId
3351
- });
3352
- });
3353
- h(this, "_externalToolDeactivateListener", (e) => {
3354
- var o;
3355
- const r = e.detail;
3356
- this.deactivateTool({
3357
- source: (o = r == null ? void 0 : r.source) != null ? o : "event",
3358
- groupId: r == null ? void 0 : r.groupId
3359
- });
3360
- });
3361
- this._root = this.attachShadow({ mode: "open" }), this._root.innerHTML = `
3362
- <style>
3363
- :host {
3364
- display: block;
3365
- contain: content;
3366
- }
3367
- .map-container {
3368
- width: 100%;
3369
- height: 100%;
3370
- position: relative;
3371
- }
3372
- </style>
3373
- <div class="map-container" part="map"></div>
3374
- `;
3375
- const e = this._root.querySelector(".map-container");
3376
- if (!(e instanceof HTMLDivElement))
3377
- throw new Error("Failed to initialize map container");
3378
- this._container = e;
3379
- const r = this.getAttribute("log-level");
3380
- r && (this._logLevel = r, this._logger.setLevel(r));
3381
- }
3382
- // Build DrawControlsConfig from boolean attributes
3383
- _controlsFromAttributes() {
3384
- return {
3385
- polygon: this.hasAttribute("draw-polygon"),
3386
- polyline: this.hasAttribute("draw-polyline"),
3387
- rectangle: this.hasAttribute("draw-rectangle"),
3388
- circle: this.hasAttribute("draw-circle"),
3389
- cake: this.hasAttribute("draw-layer-cake"),
3390
- marker: this.hasAttribute("draw-marker"),
3391
- move: this.hasAttribute("draw-move"),
3392
- edit: this.hasAttribute("edit-features"),
3393
- delete: this.hasAttribute("delete-features"),
3394
- ruler: this.hasAttribute("draw-ruler")
3395
- };
3396
- }
3397
- _mapConfig() {
3398
- return {
3399
- latitude: this._latitude,
3400
- longitude: this._longitude,
3401
- zoom: this._zoom,
3402
- minZoom: this._minZoom,
3403
- maxZoom: this._maxZoom,
3404
- tileUrl: this._tileUrl,
3405
- tileAttribution: this._tileAttribution,
3406
- readOnly: this._readOnly,
3407
- fitToDataOnLoad: !1,
3408
- logLevel: this._logLevel,
3409
- devOverlay: this._devOverlay,
3410
- polygonAllowIntersection: this._polygonAllowIntersection,
3411
- preferCanvas: this._preferCanvas,
3412
- useExternalLeaflet: this._useExternalLeaflet,
3413
- skipLeafletStyles: this._skipLeafletStyles
3414
- };
3415
- }
3416
- // Lifecycle
3417
- async connectedCallback() {
3418
- var e;
3419
- this._logger.debug("connectedCallback", this._currentConfig()), this._setStatus({
3420
- state: "initializing",
3421
- ready: !1,
3422
- busy: !0,
3423
- featureCount: 0,
3424
- lastEvent: "connected",
3425
- lastError: null
3426
- }), ot({
3427
- root: this._root,
3428
- skipStyles: this._skipLeafletStyles
3429
- }), this._applyThemeStyles(), this._controller = new gr({
3430
- container: this._container,
3431
- map: this._mapConfig(),
3432
- controls: this._controlsFromAttributes(),
3433
- readOnly: this._readOnly,
3434
- logger: this._logger.child("controller"),
3435
- callbacks: {
3436
- onReady: (r) => {
3437
- this.dispatchEvent(new CustomEvent(L.Ready, { detail: r })), this._syncStatusFromController({
3438
- state: "ready",
3439
- ready: !0,
3440
- busy: !1,
3441
- lastEvent: L.Ready,
3442
- clearLastError: !0
3443
- });
3444
- },
3445
- onCreated: (r) => {
3446
- this.dispatchEvent(new CustomEvent(L.Created, { detail: r })), this._setStatus({
3447
- state: "ready",
3448
- ready: !0,
3449
- busy: !1,
3450
- featureCount: this._status.featureCount + 1,
3451
- lastEvent: L.Created,
3452
- lastError: null
3453
- });
3454
- },
3455
- onEdited: (r) => {
3456
- this.dispatchEvent(new CustomEvent(L.Edited, { detail: r })), this._setStatus({
3457
- state: "ready",
3458
- ready: !0,
3459
- busy: !1,
3460
- featureCount: r.geoJSON.features.length,
3461
- lastEvent: L.Edited,
3462
- lastError: null
3463
- });
3464
- },
3465
- onDeleted: (r) => {
3466
- this.dispatchEvent(new CustomEvent(L.Deleted, { detail: r })), this._setStatus({
3467
- state: "ready",
3468
- ready: !0,
3469
- busy: !1,
3470
- featureCount: r.geoJSON.features.length,
3471
- lastEvent: L.Deleted,
3472
- lastError: null
3473
- });
3474
- },
3475
- onError: (r) => {
3476
- this._emitError(r, {
3477
- state: r.recoverable ? this._status.ready ? "ready" : this._status.state : "error",
3478
- lastEvent: L.Error
3479
- });
3480
- },
3481
- onTileError: (r) => {
3482
- if (this._tileProvider)
3483
- return;
3484
- const o = this._describeTileLayerError(r, "tile-url");
3485
- this._handleTileProviderError(
3486
- "tile_load_failed",
3487
- o,
3488
- "tile-url"
3489
- );
3490
- },
3491
- onToolTrigger: (r) => {
3492
- this._emitToolTriggerResult(r);
3493
- },
3494
- onSaved: (r) => {
3495
- this.dispatchEvent(
3496
- new CustomEvent(L.Export, {
3497
- detail: {
3498
- geoJSON: r.geoJSON,
3499
- featureCount: r.featureCount,
3500
- adapter: "editing"
3501
- }
3502
- })
3503
- ), this._setStatus({
3504
- state: "ready",
3505
- ready: !0,
3506
- busy: !1,
3507
- featureCount: r.featureCount,
3508
- lastEvent: L.Export,
3509
- lastError: null
3510
- });
3511
- }
3512
- },
3513
- leaflet: (e = this._leafletInstance) != null ? e : void 0,
3514
- useExternalLeaflet: this._useExternalLeaflet,
3515
- toolHooks: this._toolHooks,
3516
- toolEventEmitter: this._toolEventEmitter,
3517
- markerIconConfig: this._effectiveMarkerIconConfig(),
3518
- toolButtonConfig: this._effectiveToolButtonConfig(),
3519
- toolbarGroups: this._effectiveToolbarGroups()
3520
- }), this.addEventListener(
3521
- "leaflet-geokit:trigger-tool",
3522
- this._externalToolTriggerListener
3523
- ), this.addEventListener(
3524
- "leaflet-geokit:activate-tool",
3525
- this._externalToolTriggerListener
3526
- ), this.addEventListener(
3527
- "leaflet-geokit:deactivate-tool",
3528
- this._externalToolDeactivateListener
3529
- ), await this._controller.init(), this._status.state !== "error" && this._tileProvider && this._updateTileLayer();
3530
- }
3531
- async disconnectedCallback() {
3532
- this._logger.debug("disconnectedCallback"), this._controller && (await this._controller.destroy(), this._controller = null), this.removeEventListener(
3533
- "leaflet-geokit:trigger-tool",
3534
- this._externalToolTriggerListener
3535
- ), this.removeEventListener(
3536
- "leaflet-geokit:activate-tool",
3537
- this._externalToolTriggerListener
3538
- ), this.removeEventListener(
3539
- "leaflet-geokit:deactivate-tool",
3540
- this._externalToolDeactivateListener
3541
- ), this._setStatus({
3542
- state: "uninitialized",
3543
- ready: !1,
3544
- busy: !1,
3545
- featureCount: 0,
3546
- lastEvent: "disconnected",
3547
- lastError: null
3548
- });
3549
- }
3550
- // Observed attributes and reflection
3551
- static get observedAttributes() {
3552
- return [
3553
- "latitude",
3554
- "longitude",
3555
- "zoom",
3556
- "min-zoom",
3557
- "max-zoom",
3558
- "tile-url",
3559
- "tile-attribution",
3560
- "tile-provider",
3561
- "tile-style",
3562
- "api-key",
3563
- "here-api-key",
3564
- "read-only",
3565
- "log-level",
3566
- "dev-overlay",
3567
- "prefer-canvas",
3568
- "use-external-leaflet",
3569
- "skip-leaflet-styles",
3570
- "marker-icon-url",
3571
- "marker-icon-retina-url",
3572
- "marker-shadow-url",
3573
- "marker-icon-size",
3574
- "marker-icon-anchor",
3575
- "marker-popup-anchor",
3576
- "tool-button-config",
3577
- "toolbar-groups",
3578
- "theme-url",
3579
- // draw controls
3580
- "draw-polygon",
3581
- "draw-polyline",
3582
- "draw-rectangle",
3583
- "draw-circle",
3584
- "draw-layer-cake",
3585
- "draw-marker",
3586
- "draw-move",
3587
- "draw-ruler",
3588
- "edit-features",
3589
- "delete-features",
3590
- "polygon-allow-intersection"
3591
- ];
3592
- }
3593
- attributeChangedCallback(e, r, o) {
3594
- switch (this._logger.debug("attributeChanged", { name: e, value: o }), e) {
3595
- case "latitude":
3596
- this._latitude = this._coerceNumber(o, 0);
3597
- break;
3598
- case "longitude":
3599
- this._longitude = this._coerceNumber(o, 0);
3600
- break;
3601
- case "zoom":
3602
- this._zoom = this._coerceNumber(o, 2);
3603
- break;
3604
- case "min-zoom":
3605
- this._minZoom = o != null ? this._coerceNumber(o) : void 0;
3606
- break;
3607
- case "max-zoom":
3608
- this._maxZoom = o != null ? this._coerceNumber(o) : void 0;
3609
- break;
3610
- case "tile-url":
3611
- this._tileUrl = o != null ? o : "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", this._controller && this._updateTileLayer();
3612
- break;
3613
- case "tile-attribution":
3614
- this._tileAttribution = o != null ? o : void 0, this._controller && this._updateTileLayer();
3615
- break;
3616
- case "tile-provider":
3617
- this._tileProvider = this._normalizeText(o, {
3618
- lowercase: !0
3619
- }), this._controller && this._updateTileLayer();
3620
- break;
3621
- case "tile-style":
3622
- this._tileStyle = this._normalizeText(o), this._controller && this._updateTileLayer();
3623
- break;
3624
- case "api-key":
3625
- case "here-api-key":
3626
- this._syncApiKeyFromAttributes(), this._controller && this._updateTileLayer();
3627
- break;
3628
- case "theme-url":
3629
- this._themeUrl = o != null ? o : void 0, this.isConnected && this._applyThemeStyles();
3630
- break;
3631
- case "read-only":
3632
- this._readOnly = o !== null;
3633
- break;
3634
- case "log-level":
3635
- this._logLevel = o != null ? o : this._logLevel, this._logger.setLevel(this._logLevel);
3636
- break;
3637
- case "dev-overlay":
3638
- this._devOverlay = o !== null;
3639
- break;
3640
- case "polygon-allow-intersection":
3641
- this._polygonAllowIntersection = o !== null;
3642
- break;
3643
- case "prefer-canvas":
3644
- this._preferCanvas = o !== null;
3645
- break;
3646
- case "use-external-leaflet":
3647
- this._useExternalLeaflet = o !== null;
3648
- break;
3649
- case "skip-leaflet-styles":
3650
- this._skipLeafletStyles = o !== null;
3651
- break;
3652
- }
3653
- this._controller && (e === "latitude" || e === "longitude" || e === "zoom" ? this._controller.setView(
3654
- this._latitude,
3655
- this._longitude,
3656
- this._zoom
3657
- ) : this._isMarkerIconAttribute(e) ? this._syncMarkerIconConfig() : e === "tool-button-config" ? this._syncToolButtonConfig() : e === "toolbar-groups" ? this._syncToolbarGroups() : (e === "min-zoom" || e === "max-zoom" || e === "read-only" || e === "dev-overlay" || e === "log-level" || e === "prefer-canvas" || e === "use-external-leaflet" || e === "skip-leaflet-styles" || e.startsWith("draw-") || e === "edit-features" || e === "delete-features") && this._controller.destroy().then(() => this._controller.init()));
3658
- }
3659
- _updateTileLayer() {
3660
- var r, o, i, n;
3661
- if (!this._controller)
3662
- return;
3663
- const e = this._controller;
3664
- if (typeof e.setTileLayer != "function") {
3665
- this._logger.warn("setTileLayer is not available on MapController yet");
3666
- return;
3667
- }
3668
- try {
3669
- if (this._tileProvider) {
3670
- const s = this._tileProvider, l = {
3671
- provider: s,
3672
- style: this._tileStyle,
3673
- apiKey: this._apiKey,
3674
- attribution: this._tileAttribution
3675
- }, c = Ar(l);
3676
- if (!c.valid) {
3677
- const p = (r = c.error) != null && r.toLowerCase().includes("api key") ? "missing_api_key" : "tile_load_failed";
3678
- this._handleTileProviderError(
3679
- p,
3680
- (o = c.error) != null ? o : "Invalid tile provider configuration",
3681
- s
3682
- );
3683
- return;
3684
- }
3685
- const d = br(l), u = this._activeTileProvider;
3686
- e.setTileLayer(d, {
3687
- onTileError: (p) => {
3688
- if (this._tileProvider !== s) return;
3689
- const g = this._describeTileLayerError(p, s), m = s === "here" ? this._resolveHereTileLayerErrorCode(g) : "tile_load_failed";
3690
- this._handleTileProviderError(m, g, s);
3691
- }
3692
- }), this._activeTileProvider = s, this._emitTileProviderChanged(
3693
- s,
3694
- this._tileStyle,
3695
- u
3696
- );
3697
- return;
3698
- }
3699
- e.setTileLayer(
3700
- {
3701
- urlTemplate: this._tileUrl,
3702
- attribution: (i = this._tileAttribution) != null ? i : "",
3703
- maxZoom: this._maxZoom,
3704
- subdomains: ["a", "b", "c"]
3705
- },
3706
- {
3707
- onTileError: (s) => {
3708
- const l = this._describeTileLayerError(s, "tile-url");
3709
- this._handleTileProviderError(
3710
- "tile_load_failed",
3711
- l,
3712
- "tile-url"
3713
- );
3714
- }
3715
- }
3716
- ), this._activeTileProvider = "tile-url";
3717
- } catch (s) {
3718
- const l = this._resolveTileProviderErrorCode(s);
3719
- this._logger.error("Failed to update tile layer", { error: s, code: l }), this._handleTileProviderError(
3720
- l,
3721
- s instanceof Error ? s.message : "Unknown tile layer error",
3722
- (n = this._tileProvider) != null ? n : "unknown"
3723
- );
3724
- }
3725
- }
3726
- _handleTileProviderError(e, r, o) {
3727
- this._logger.error(`Tile provider error (${e}): ${r}`);
3728
- const i = Date.now();
3729
- this.dispatchEvent(
3730
- new CustomEvent("tile-provider-error", {
3731
- bubbles: !0,
3732
- detail: {
3733
- code: e,
3734
- message: r,
3735
- provider: o,
3736
- timestamp: i
3737
- }
3738
- })
3739
- ), this._emitDiagnostic(
3740
- {
3741
- code: e,
3742
- message: r,
3743
- recoverable: !0,
3744
- severity: "warn",
3745
- timestamp: i
3746
- },
3747
- {
3748
- state: this._status.ready ? "ready" : this._status.state,
3749
- lastEvent: "tile-provider-error"
3750
- }
3751
- );
3752
- const n = this._controller;
3753
- typeof n.setTileLayer == "function" && (n.setTileLayer({
3754
- urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
3755
- attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
3756
- maxZoom: 19,
3757
- subdomains: ["a", "b", "c"]
3758
- }), this._activeTileProvider = "osm");
3759
- }
3760
- _emitTileProviderChanged(e, r, o) {
3761
- this.dispatchEvent(
3762
- new CustomEvent("tile-provider-changed", {
3763
- bubbles: !0,
3764
- detail: {
3765
- provider: e,
3766
- style: r,
3767
- previousProvider: o,
3768
- timestamp: Date.now()
3769
- }
3770
- })
3771
- );
3772
- }
3773
- _isMarkerIconAttribute(e) {
3774
- return e === "marker-icon-url" || e === "marker-icon-retina-url" || e === "marker-shadow-url" || e === "marker-icon-size" || e === "marker-icon-anchor" || e === "marker-popup-anchor";
3775
- }
3776
- _effectiveMarkerIconConfig() {
3777
- const e = (o, i) => {
3778
- this._emitError(
3779
- {
3780
- code: "invalid_marker_icon_config",
3781
- message: o,
3782
- recoverable: !0,
3783
- cause: i
3784
- },
3785
- {
3786
- state: this._status.ready ? "ready" : this._status.state
3787
- }
3788
- );
3789
- };
3790
- if (this._markerIconConfig === null)
3791
- return null;
3792
- if (this._markerIconConfig !== void 0)
3793
- return mr(this._markerIconConfig, { reportError: e });
3794
- const r = this.getAttribute("marker-icon-url");
3795
- return r == null ? null : yr(
3796
- {
3797
- iconUrl: r,
3798
- iconRetinaUrl: this.getAttribute("marker-icon-retina-url"),
3799
- shadowUrl: this.getAttribute("marker-shadow-url"),
3800
- iconSize: this.getAttribute("marker-icon-size"),
3801
- iconAnchor: this.getAttribute("marker-icon-anchor"),
3802
- popupAnchor: this.getAttribute("marker-popup-anchor")
3803
- },
3804
- { reportError: e }
3805
- );
3806
- }
3807
- _syncMarkerIconConfig() {
3808
- const e = this._controller;
3809
- typeof (e == null ? void 0 : e.setMarkerIconConfig) == "function" && e.setMarkerIconConfig(this._effectiveMarkerIconConfig());
3810
- }
3811
- _effectiveToolButtonConfig() {
3812
- if (this._toolButtonConfig !== void 0)
3813
- return this._toolButtonConfig;
3814
- const e = this.getAttribute("tool-button-config");
3815
- if (e == null || e.trim() === "")
3816
- return null;
3817
- try {
3818
- const r = JSON.parse(e);
3819
- if (!r || typeof r != "object" || Array.isArray(r))
3820
- throw new Error("tool-button-config must be a JSON object");
3821
- return r;
3822
- } catch (r) {
3823
- return this._emitError(
3824
- {
3825
- code: "invalid_tool_button_config",
3826
- message: "Failed to parse tool-button-config",
3827
- recoverable: !0,
3828
- cause: r
3829
- },
3830
- {
3831
- state: this._status.ready ? "ready" : this._status.state
3832
- }
3833
- ), null;
3834
- }
3835
- }
3836
- _syncToolButtonConfig() {
3837
- const e = this._controller;
3838
- typeof (e == null ? void 0 : e.setToolButtonConfig) == "function" && e.setToolButtonConfig(this._effectiveToolButtonConfig());
3839
- }
3840
- _effectiveToolbarGroups() {
3841
- if (this._toolbarGroups !== void 0)
3842
- return this._toolbarGroups;
3843
- const e = this.getAttribute("toolbar-groups");
3844
- if (e == null || e.trim() === "")
3845
- return null;
3846
- try {
3847
- const r = JSON.parse(e);
3848
- if (!Array.isArray(r))
3849
- throw new Error("toolbar-groups must be a JSON array");
3850
- return r;
3851
- } catch (r) {
3852
- return this._emitError(
3853
- {
3854
- code: "invalid_toolbar_groups",
3855
- message: "Failed to parse toolbar-groups",
3856
- recoverable: !0,
3857
- cause: r
3858
- },
3859
- {
3860
- state: this._status.ready ? "ready" : this._status.state
3861
- }
3862
- ), null;
3863
- }
3864
- }
3865
- _syncToolbarGroups() {
3866
- const e = this._controller;
3867
- typeof (e == null ? void 0 : e.setToolbarGroups) == "function" && e.setToolbarGroups(this._effectiveToolbarGroups());
3868
- }
3869
- // Properties (reflect attributes)
3870
- get latitude() {
3871
- return this._latitude;
3872
- }
3873
- set latitude(e) {
3874
- this._latitude = Number(e), this._reflect("latitude", String(this._latitude));
3875
- }
3876
- get longitude() {
3877
- return this._longitude;
3878
- }
3879
- set longitude(e) {
3880
- this._longitude = Number(e), this._reflect("longitude", String(this._longitude));
3881
- }
3882
- get zoom() {
3883
- return this._zoom;
3884
- }
3885
- set zoom(e) {
3886
- this._zoom = Number(e), this._reflect("zoom", String(this._zoom));
3887
- }
3888
- get minZoom() {
3889
- return this._minZoom;
3890
- }
3891
- set minZoom(e) {
3892
- this._minZoom = e, this._reflect("min-zoom", e != null ? String(e) : null);
3893
- }
3894
- get maxZoom() {
3895
- return this._maxZoom;
3896
- }
3897
- set maxZoom(e) {
3898
- this._maxZoom = e, this._reflect("max-zoom", e != null ? String(e) : null);
3899
- }
3900
- get tileUrl() {
3901
- return this._tileUrl;
3902
- }
3903
- set tileUrl(e) {
3904
- this._tileUrl = e, this._reflect("tile-url", e), this._controller && this._updateTileLayer();
3905
- }
3906
- get tileProvider() {
3907
- return this._tileProvider;
3908
- }
3909
- set tileProvider(e) {
3910
- var r;
3911
- this._tileProvider = this._normalizeText(e != null ? e : null, {
3912
- lowercase: !0
3913
- }), this._reflect("tile-provider", (r = this._tileProvider) != null ? r : null), this._controller && this._updateTileLayer();
3914
- }
3915
- get tileStyle() {
3916
- return this._tileStyle;
3917
- }
3918
- set tileStyle(e) {
3919
- var r;
3920
- this._tileStyle = this._normalizeText(e != null ? e : null), this._reflect("tile-style", (r = this._tileStyle) != null ? r : null), this._controller && this._updateTileLayer();
3921
- }
3922
- get apiKey() {
3923
- return this._apiKey;
3924
- }
3925
- set apiKey(e) {
3926
- var r;
3927
- this._apiKey = this._normalizeText(e != null ? e : null), this._reflect("api-key", (r = this._apiKey) != null ? r : null), this.hasAttribute("here-api-key") && this.removeAttribute("here-api-key"), this._controller && this._updateTileLayer();
3928
- }
3929
- get status() {
3930
- return this._cloneStatus(this._status);
3931
- }
3932
- get tileAttribution() {
3933
- return this._tileAttribution;
3934
- }
3935
- set tileAttribution(e) {
3936
- this._tileAttribution = e, this._reflect("tile-attribution", e != null ? e : null), this._controller && this._updateTileLayer();
3937
- }
3938
- get readOnly() {
3939
- return this._readOnly;
3940
- }
3941
- set readOnly(e) {
3942
- this._readOnly = !!e, this._booleanReflect("read-only", this._readOnly);
3943
- }
3944
- get logLevel() {
3945
- return this._logLevel;
3946
- }
3947
- set logLevel(e) {
3948
- this._logLevel = e, this._logger.setLevel(e), this._reflect("log-level", e);
3949
- }
3950
- get devOverlay() {
3951
- return this._devOverlay;
3952
- }
3953
- set devOverlay(e) {
3954
- this._devOverlay = !!e, this._booleanReflect("dev-overlay", this._devOverlay);
3955
- }
3956
- get preferCanvas() {
3957
- return this._preferCanvas;
3958
- }
3959
- set preferCanvas(e) {
3960
- this._preferCanvas = !!e, this._booleanReflect("prefer-canvas", this._preferCanvas);
3961
- }
3962
- get useExternalLeaflet() {
3963
- return this._useExternalLeaflet;
3964
- }
3965
- set useExternalLeaflet(e) {
3966
- this._useExternalLeaflet = !!e, this._booleanReflect("use-external-leaflet", this._useExternalLeaflet);
3967
- }
3968
- get skipLeafletStyles() {
3969
- return this._skipLeafletStyles;
3970
- }
3971
- set skipLeafletStyles(e) {
3972
- this._skipLeafletStyles = !!e, this._booleanReflect("skip-leaflet-styles", this._skipLeafletStyles);
3973
- }
3974
- get markerIconConfig() {
3975
- return this._markerIconConfig;
3976
- }
3977
- set markerIconConfig(e) {
3978
- this._markerIconConfig = e, this._syncMarkerIconConfig();
3979
- }
3980
- get toolButtonConfig() {
3981
- return this._toolButtonConfig;
3982
- }
3983
- set toolButtonConfig(e) {
3984
- this._toolButtonConfig = e, this._syncToolButtonConfig();
3985
- }
3986
- get toolbarGroups() {
3987
- return this._toolbarGroups;
3988
- }
3989
- set toolbarGroups(e) {
3990
- this._toolbarGroups = e, this._syncToolbarGroups();
3991
- }
3992
- get leafletInstance() {
3993
- return this._leafletInstance;
3994
- }
3995
- set leafletInstance(e) {
3996
- this._leafletInstance = e;
3997
- }
3998
- get toolHooks() {
3999
- return this._toolHooks;
4000
- }
4001
- set toolHooks(e) {
4002
- this._toolHooks = e;
4003
- const r = this._controller;
4004
- typeof (r == null ? void 0 : r.setToolObservers) == "function" && r.setToolObservers({
4005
- toolHooks: this._toolHooks,
4006
- toolEventEmitter: this._toolEventEmitter
4007
- });
4008
- }
4009
- get toolEventEmitter() {
4010
- return this._toolEventEmitter;
4011
- }
4012
- set toolEventEmitter(e) {
4013
- this._toolEventEmitter = e;
4014
- const r = this._controller;
4015
- typeof (r == null ? void 0 : r.setToolObservers) == "function" && r.setToolObservers({
4016
- toolHooks: this._toolHooks,
4017
- toolEventEmitter: this._toolEventEmitter
4018
- });
4019
- }
4020
- get themeCss() {
4021
- return this._themeCss;
4022
- }
4023
- set themeCss(e) {
4024
- this._themeCss = typeof e == "string" ? e : "", this.isConnected && this._applyThemeStyles();
4025
- }
4026
- // Public API methods (delegating to controller)
4027
- async getGeoJSON() {
4028
- return this._logger.debug("getGeoJSON"), this._controller ? this._controller.getGeoJSON() : { type: "FeatureCollection", features: [] };
4029
- }
4030
- async importGeoJSON(e, r = {}) {
4031
- var n, s, l, c;
4032
- const o = (n = r.behavior) != null ? n : "replace";
4033
- if (this._logger.debug("importGeoJSON", {
4034
- behavior: o,
4035
- fitToData: (s = r.fitToData) != null ? s : !1,
4036
- features: (c = (l = e == null ? void 0 : e.features) == null ? void 0 : l.length) != null ? c : 0
4037
- }), !this._controller) return [];
4038
- const i = this.status;
4039
- return this._setImportLoadingStatus(i), this._performImport(
4040
- e,
4041
- r,
4042
- i,
4043
- o === "add" ? "Failed to add GeoJSON features to the map" : "Failed to load GeoJSON into the map"
4044
- );
4045
- }
4046
- async loadGeoJSON(e) {
4047
- var r, o;
4048
- this._logger.debug("loadGeoJSON", { features: (o = (r = e == null ? void 0 : e.features) == null ? void 0 : r.length) != null ? o : 0 }), await this.importGeoJSON(e, { behavior: "replace" });
4049
- }
4050
- async clearLayers() {
4051
- this._logger.debug("clearLayers"), this._controller && (await this._controller.clearLayers(), this._setStatus({
4052
- state: "ready",
4053
- ready: !0,
4054
- busy: !1,
4055
- featureCount: 0,
4056
- lastEvent: "clearLayers",
4057
- lastError: null
4058
- }));
4059
- }
4060
- async addFeatures(e) {
4061
- var r, o;
4062
- return this._logger.debug("addFeatures", { count: (o = (r = e == null ? void 0 : e.features) == null ? void 0 : r.length) != null ? o : 0 }), this.importGeoJSON(e, { behavior: "add" });
4063
- }
4064
- async updateFeature(e, r) {
4065
- this._logger.debug("updateFeature", { id: e }), this._controller && await this._controller.updateFeature(e, r);
4066
- }
4067
- async removeFeature(e) {
4068
- this._logger.debug("removeFeature", { id: e }), this._controller && (await this._controller.removeFeature(e), await this._syncStatusFromController({
4069
- state: "ready",
4070
- ready: !0,
4071
- busy: !1,
4072
- lastEvent: "removeFeature",
4073
- clearLastError: !0
4074
- }));
4075
- }
4076
- async fitBoundsToData(e) {
4077
- this._logger.debug("fitBoundsToData", { padding: e }), this._controller && await this._controller.fitBoundsToData(
4078
- typeof e == "number" ? e : 0.05
4079
- );
4080
- }
4081
- async fitBounds(e, r) {
4082
- this._logger.debug("fitBounds", { bounds: e, padding: r }), this._controller && await this._controller.fitBounds(
4083
- e,
4084
- typeof r == "number" ? r : 0.05
4085
- );
4086
- }
4087
- async setView(e, r, o) {
4088
- this._logger.debug("setView", { lat: e, lng: r, zoom: o }), this.latitude = e, this.longitude = r, typeof o == "number" && (this.zoom = o), this._controller && await this._controller.setView(e, r, o);
4089
- }
4090
- async exportGeoJSON(e = {}) {
4091
- var n;
4092
- const r = (n = e.adapter) != null ? n : "editing";
4093
- if (this._logger.debug("exportGeoJSON", { adapter: r }), !this._controller) return { type: "FeatureCollection", features: [] };
4094
- const o = await this._exportWithController(e), i = {
4095
- geoJSON: o,
4096
- featureCount: o.features.length,
4097
- adapter: r
4098
- };
4099
- return this.dispatchEvent(new CustomEvent(L.Export, { detail: i })), o;
4100
- }
4101
- /**
4102
- * Merge all visible polygon layers into a single polygon.
4103
- * This removes the original polygon features and adds a new merged feature.
4104
- *
4105
- * @param options Optional configuration for the merge operation
4106
- * @returns Promise resolving to the ID of the newly created merged feature, or null if no polygons to merge
4107
- */
4108
- async mergePolygons(e) {
4109
- if (this._logger.debug("mergePolygons"), !this._controller) return null;
4110
- const o = (await this._controller.getGeoJSON()).features.length, i = await this._controller.mergeVisiblePolygons(e);
4111
- if (i) {
4112
- const n = await this._controller.getGeoJSON(), s = {
4113
- id: i,
4114
- mergedFeatureCount: o - n.features.length + 1,
4115
- geoJSON: n
4116
- };
4117
- this.dispatchEvent(new CustomEvent("leaflet-draw:merged", { detail: s })), this._setStatus({
4118
- state: "ready",
4119
- ready: !0,
4120
- busy: !1,
4121
- featureCount: n.features.length,
4122
- lastEvent: "leaflet-draw:merged",
4123
- lastError: null
4124
- });
4125
- }
4126
- return i;
4127
- }
4128
- async setMeasurementUnits(e) {
4129
- this._logger.debug("setMeasurementUnits", { system: e }), this._controller && this._controller.setRulerUnits(e);
4130
- }
4131
- async activateTool(e, r = {}) {
4132
- var s, l;
4133
- const o = (s = r.source) != null ? s : "api";
4134
- if (this.dispatchEvent(
4135
- new CustomEvent("leaflet-geokit:tool-trigger-requested", {
4136
- bubbles: !0,
4137
- composed: !0,
4138
- detail: {
4139
- tool: e,
4140
- source: o,
4141
- groupId: r.groupId,
4142
- handled: !1,
4143
- timestamp: Date.now()
4144
- }
4145
- })
4146
- ), !this._controller)
4147
- return this._emitToolTriggerResult({
4148
- tool: e,
4149
- source: o,
4150
- groupId: r.groupId,
4151
- handled: !1,
4152
- timestamp: Date.now(),
4153
- error: "Map controller is not initialized"
4154
- }), !1;
4155
- const i = this._controller, n = typeof i.activateTool == "function" ? i.activateTool.bind(i) : (l = i.triggerTool) == null ? void 0 : l.bind(i);
4156
- return n ? n(e, {
4157
- source: o,
4158
- groupId: r.groupId
4159
- }) : (this._emitToolTriggerResult({
4160
- tool: e,
4161
- source: o,
4162
- groupId: r.groupId,
4163
- handled: !1,
4164
- timestamp: Date.now(),
4165
- error: "Map controller cannot activate tools"
4166
- }), !1);
4167
- }
4168
- async triggerTool(e, r = {}) {
4169
- return this.activateTool(e, r);
4170
- }
4171
- async deactivateTool(e = {}) {
4172
- var n, s;
4173
- const r = (n = e.source) != null ? n : "api";
4174
- if (this.dispatchEvent(
4175
- new CustomEvent("leaflet-geokit:tool-trigger-requested", {
4176
- bubbles: !0,
4177
- composed: !0,
4178
- detail: {
4179
- tool: "select",
4180
- source: r,
4181
- groupId: e.groupId,
4182
- handled: !1,
4183
- timestamp: Date.now()
4184
- }
4185
- })
4186
- ), !this._controller)
4187
- return this._emitToolTriggerResult({
4188
- tool: "select",
4189
- source: r,
4190
- groupId: e.groupId,
4191
- handled: !1,
4192
- timestamp: Date.now(),
4193
- error: "Map controller is not initialized"
4194
- }), !1;
4195
- const o = this._controller;
4196
- if (typeof o.deactivateTool == "function")
4197
- return o.deactivateTool({
4198
- source: r,
4199
- groupId: e.groupId
4200
- });
4201
- const i = typeof o.activateTool == "function" ? o.activateTool.bind(o) : (s = o.triggerTool) == null ? void 0 : s.bind(o);
4202
- return i ? i("select", {
4203
- source: r,
4204
- groupId: e.groupId
4205
- }) : (this._emitToolTriggerResult({
4206
- tool: "select",
4207
- source: r,
4208
- groupId: e.groupId,
4209
- handled: !1,
4210
- timestamp: Date.now(),
4211
- error: "Map controller cannot deactivate tools"
4212
- }), !1);
4213
- }
4214
- async loadGeoJSONFromUrl(e, r = {}) {
4215
- var l, c, d;
4216
- const o = (l = r.behavior) != null ? l : "replace";
4217
- if (this._logger.debug("loadGeoJSONFromUrl", {
4218
- url: e,
4219
- behavior: o,
4220
- fitToData: (c = r.fitToData) != null ? c : !0
4221
- }), !this._controller) return;
4222
- const i = this.status;
4223
- this._setImportLoadingStatus(i);
4224
- let n;
4225
- try {
4226
- n = await fetch(e, { headers: { Accept: "application/json" } });
4227
- } catch (u) {
4228
- const p = new Error(`Failed to fetch GeoJSON from ${e}`);
4229
- throw this._emitError(
4230
- {
4231
- code: "data_fetch_failed",
4232
- message: p.message,
4233
- recoverable: !0,
4234
- cause: u
4235
- },
4236
- {
4237
- state: i.ready ? "ready" : i.state,
4238
- featureCount: i.featureCount
4239
- }
4240
- ), p;
4241
- }
4242
- if (!n.ok) {
4243
- const u = new Error(
4244
- `Failed to fetch GeoJSON from ${e}: ${n.status} ${n.statusText}`
4245
- );
4246
- throw this._emitError(
4247
- {
4248
- code: "data_fetch_failed",
4249
- message: u.message,
4250
- recoverable: !0,
4251
- cause: u
4252
- },
4253
- {
4254
- state: i.ready ? "ready" : i.state,
4255
- featureCount: i.featureCount
4256
- }
4257
- ), u;
4258
- }
4259
- let s;
4260
- try {
4261
- s = await n.json();
4262
- } catch (u) {
4263
- const p = new Error(`Failed to parse GeoJSON from ${e}`);
4264
- throw this._emitError(
4265
- {
4266
- code: "data_parse_failed",
4267
- message: p.message,
4268
- recoverable: !0,
4269
- cause: u
4270
- },
4271
- {
4272
- state: i.ready ? "ready" : i.state,
4273
- featureCount: i.featureCount
4274
- }
4275
- ), p;
4276
- }
4277
- await this._performImport(
4278
- s,
4279
- {
4280
- behavior: o,
4281
- fitToData: (d = r.fitToData) != null ? d : !0
4282
- },
4283
- i,
4284
- o === "add" ? `Failed to add GeoJSON from ${e}` : `Failed to load GeoJSON from ${e}`
4285
- );
4286
- }
4287
- async loadGeoJSONFromText(e, r = {}) {
4288
- var s, l, c, d;
4289
- const o = (s = r.behavior) != null ? s : "replace";
4290
- if (this._logger.debug("loadGeoJSONFromText", {
4291
- behavior: o,
4292
- fitToData: (l = r.fitToData) != null ? l : !0,
4293
- length: (c = e == null ? void 0 : e.length) != null ? c : 0
4294
- }), !this._controller) return;
4295
- const i = this.status;
4296
- this._setImportLoadingStatus(i);
4297
- let n;
4298
- try {
4299
- n = JSON.parse(e);
4300
- } catch (u) {
4301
- const p = new Error("Failed to parse GeoJSON text");
4302
- throw this._emitError(
4303
- {
4304
- code: "data_parse_failed",
4305
- message: p.message,
4306
- recoverable: !0,
4307
- cause: u
4308
- },
4309
- {
4310
- state: i.ready ? "ready" : i.state,
4311
- featureCount: i.featureCount
4312
- }
4313
- ), p;
4314
- }
4315
- await this._performImport(
4316
- n,
4317
- {
4318
- behavior: o,
4319
- fitToData: (d = r.fitToData) != null ? d : !0
4320
- },
4321
- i,
4322
- o === "add" ? "Failed to add parsed GeoJSON into the map" : "Failed to load parsed GeoJSON into the map"
4323
- );
4324
- }
4325
- _setImportLoadingStatus(e) {
4326
- this._setStatus({
4327
- state: "loading",
4328
- ready: e.ready,
4329
- busy: !0,
4330
- featureCount: e.featureCount,
4331
- lastEvent: L.Ingest,
4332
- lastError: null
4333
- });
4334
- }
4335
- async _performImport(e, r, o, i) {
4336
- var c, d;
4337
- const n = (c = r.behavior) != null ? c : "replace", s = {
4338
- fc: e,
4339
- mode: n === "add" ? "add" : "load"
4340
- };
4341
- this.dispatchEvent(new CustomEvent(L.Ingest, { detail: s }));
4342
- const l = s.fc && s.fc.type === "FeatureCollection" ? s.fc : e;
4343
- try {
4344
- const u = await this._importWithController(l, {
4345
- behavior: n,
4346
- fitToData: (d = r.fitToData) != null ? d : !1
4347
- });
4348
- return await this._syncStatusFromController({
4349
- state: "ready",
4350
- ready: !0,
4351
- busy: !1,
4352
- lastEvent: L.Ingest,
4353
- clearLastError: !0
4354
- }), u;
4355
- } catch (u) {
4356
- throw this._emitError(
4357
- {
4358
- code: n === "add" ? "data_add_failed" : "data_load_failed",
4359
- message: i,
4360
- recoverable: !0,
4361
- cause: u
4362
- },
4363
- {
4364
- state: o.ready ? "ready" : o.state,
4365
- featureCount: o.featureCount
4366
- }
4367
- ), u;
4368
- }
4369
- }
4370
- async _importWithController(e, r) {
4371
- var s, l;
4372
- if (!this._controller) return [];
4373
- const o = (s = r.behavior) != null ? s : "replace", i = (l = r.fitToData) != null ? l : !1, n = this._controller;
4374
- return typeof n.importGeoJSON == "function" ? n.importGeoJSON(e, { behavior: o, fitToData: i }) : o === "add" ? n.addFeatures(e) : (await n.loadGeoJSON(e, i), []);
4375
- }
4376
- async _exportWithController(e) {
4377
- if (!this._controller)
4378
- return { type: "FeatureCollection", features: [] };
4379
- const r = this._controller;
4380
- return typeof r.exportGeoJSON == "function" ? r.exportGeoJSON(e) : r.getGeoJSON();
4381
- }
4382
- // Helpers
4383
- _currentConfig() {
4384
- return {
4385
- latitude: this._latitude,
4386
- longitude: this._longitude,
4387
- zoom: this._zoom,
4388
- minZoom: this._minZoom,
4389
- maxZoom: this._maxZoom,
4390
- tileUrl: this._tileUrl,
4391
- tileAttribution: this._tileAttribution,
4392
- readOnly: this._readOnly,
4393
- fitToDataOnLoad: !1,
4394
- logLevel: this._logLevel,
4395
- devOverlay: this._devOverlay,
4396
- polygonAllowIntersection: this._polygonAllowIntersection,
4397
- preferCanvas: this._preferCanvas,
4398
- useExternalLeaflet: this._useExternalLeaflet,
4399
- skipLeafletStyles: this._skipLeafletStyles
4400
- };
4401
- }
4402
- _applyThemeStyles() {
4403
- var o;
4404
- const e = (o = this._themeUrl) == null ? void 0 : o.trim();
4405
- if (e) {
4406
- if (!this._themeLinkEl) {
4407
- const i = document.createElement("link");
4408
- i.setAttribute("rel", "stylesheet"), i.setAttribute("data-geokit-theme-url", "true"), this._root.appendChild(i), this._themeLinkEl = i;
4409
- }
4410
- this._themeLinkEl.getAttribute("href") !== e && this._themeLinkEl.setAttribute("href", e);
4411
- } else this._themeLinkEl && (this._themeLinkEl.remove(), this._themeLinkEl = null);
4412
- const r = this._themeCss;
4413
- if (r.trim().length > 0) {
4414
- if (!this._themeStyleEl) {
4415
- const i = document.createElement("style");
4416
- i.setAttribute("data-geokit-theme-css", "true"), this._root.appendChild(i), this._themeStyleEl = i;
4417
- }
4418
- this._themeStyleEl.textContent !== r && (this._themeStyleEl.textContent = r);
4419
- } else this._themeStyleEl && (this._themeStyleEl.remove(), this._themeStyleEl = null);
4420
- }
4421
- _emitToolTriggerResult(e) {
4422
- this.dispatchEvent(
4423
- new CustomEvent(
4424
- e.handled ? "leaflet-geokit:tool-triggered" : "leaflet-geokit:tool-trigger-failed",
4425
- {
4426
- bubbles: !0,
4427
- composed: !0,
4428
- detail: e
4429
- }
4430
- )
4431
- );
4432
- }
4433
- _syncStatusFromController(e) {
4434
- const r = this._controller;
4435
- return !r || typeof r.getGeoJSON != "function" ? (this._setStatus({
4436
- state: e.state,
4437
- ready: e.ready,
4438
- busy: e.busy,
4439
- featureCount: this._status.featureCount,
4440
- lastEvent: e.lastEvent,
4441
- lastError: e.clearLastError ? null : void 0
4442
- }), Promise.resolve()) : r.getGeoJSON().then((o) => {
4443
- this._setStatus({
4444
- state: e.state,
4445
- ready: e.ready,
4446
- busy: e.busy,
4447
- featureCount: o.features.length,
4448
- lastEvent: e.lastEvent,
4449
- lastError: e.clearLastError ? null : void 0
4450
- });
4451
- }).catch(() => {
4452
- this._setStatus({
4453
- state: e.state,
4454
- ready: e.ready,
4455
- busy: e.busy,
4456
- lastEvent: e.lastEvent,
4457
- lastError: e.clearLastError ? null : void 0
4458
- });
4459
- });
4460
- }
4461
- _emitError(e, r) {
4462
- var i;
4463
- const o = {
4464
- ...e,
4465
- timestamp: Date.now()
4466
- };
4467
- return this.dispatchEvent(
4468
- new CustomEvent(L.Error, { detail: o })
4469
- ), this._emitDiagnostic(
4470
- {
4471
- code: o.code,
4472
- message: o.message,
4473
- recoverable: o.recoverable,
4474
- severity: o.recoverable ? "warn" : "error",
4475
- cause: o.cause,
4476
- timestamp: o.timestamp
4477
- },
4478
- {
4479
- state: r.state,
4480
- featureCount: r.featureCount,
4481
- lastEvent: (i = r.lastEvent) != null ? i : L.Error
4482
- }
4483
- ), o;
4484
- }
4485
- _emitDiagnostic(e, r) {
4486
- var i, n;
4487
- const o = {
4488
- ...e,
4489
- state: r.state
4490
- };
4491
- return this.dispatchEvent(
4492
- new CustomEvent(K.Diagnostic, { detail: o })
4493
- ), this._setStatus({
4494
- state: r.state,
4495
- ready: r.state === "ready",
4496
- busy: r.state === "initializing" || r.state === "loading",
4497
- featureCount: (i = r.featureCount) != null ? i : this._status.featureCount,
4498
- lastEvent: (n = r.lastEvent) != null ? n : K.Diagnostic,
4499
- lastError: {
4500
- code: o.code,
4501
- message: o.message,
4502
- recoverable: o.recoverable,
4503
- timestamp: o.timestamp
4504
- }
4505
- }), o;
4506
- }
4507
- _setStatus(e) {
4508
- const r = {
4509
- ...this._status,
4510
- ...e,
4511
- lastError: e.lastError === null ? void 0 : e.lastError !== void 0 ? { ...e.lastError } : this._status.lastError ? { ...this._status.lastError } : void 0,
4512
- timestamp: Date.now()
4513
- };
4514
- this._status = r, this.dispatchEvent(
4515
- new CustomEvent(K.Status, {
4516
- detail: this._cloneStatus(r)
4517
- })
4518
- );
4519
- }
4520
- _cloneStatus(e) {
4521
- return {
4522
- ...e,
4523
- lastError: e.lastError ? { ...e.lastError } : void 0
4524
- };
4525
- }
4526
- _syncApiKeyFromAttributes() {
4527
- const e = this._normalizeText(this.getAttribute("api-key")), r = this._normalizeText(this.getAttribute("here-api-key"));
4528
- this._apiKey = e != null ? e : r;
4529
- }
4530
- _normalizeText(e, r) {
4531
- if (typeof e != "string") return;
4532
- const o = e.trim();
4533
- if (o)
4534
- return r != null && r.lowercase ? o.toLowerCase() : o;
4535
- }
4536
- _resolveTileProviderErrorCode(e) {
4537
- return e instanceof Error && e.message.toLowerCase().includes("unknown tile provider") ? "unknown_provider" : "tile_load_failed";
4538
- }
4539
- _resolveHereTileLayerErrorCode(e) {
4540
- const r = e.toLowerCase();
4541
- return r.includes("permission") || r.includes("forbidden") || r.includes("403") || r.includes("unauthorized") || r.includes("not authorized") || r.includes("not authorised") || r.includes("access denied") ? "permission_denied" : "invalid_api_key";
4542
- }
4543
- _describeTileLayerError(e, r) {
4544
- if (e && typeof e == "object" && "error" in e && e.error instanceof Error)
4545
- return e.error.message;
4546
- if (e instanceof Error && e.message)
4547
- return e.message;
4548
- if (e && typeof e == "object" && "message" in e && typeof e.message == "string") {
4549
- const o = e.message.trim();
4550
- if (o.length > 0)
4551
- return o;
4552
- }
4553
- return r === "here" ? `Failed to load HERE tiles; verify API key, project permissions, and allowed localhost origin/referrer.${this._tileStyle === "satellite.day" ? " If satellite.day fails, try lite.day." : ""}` : "Failed to load tile layer";
4554
- }
4555
- _reflect(e, r) {
4556
- r === null ? this.removeAttribute(e) : this.getAttribute(e) !== r && this.setAttribute(e, r);
4557
- }
4558
- _booleanReflect(e, r) {
4559
- r ? this.hasAttribute(e) || this.setAttribute(e, "") : this.hasAttribute(e) && this.removeAttribute(e);
4560
- }
4561
- _coerceNumber(e, r) {
4562
- if (e == null) return r != null ? r : NaN;
4563
- const o = Number(e);
4564
- return Number.isFinite(o) ? o : r != null ? r : NaN;
4565
- }
4566
- }
4567
- const ke = "leaflet-geokit";
4568
- customElements.get(ke) || customElements.define(ke, Ue);
4569
- const Ee = "leaflet-draw-map";
4570
- if (!customElements.get(Ee)) {
4571
- class a extends Ue {
4572
- }
4573
- customElements.define(Ee, a);
4574
- }
4575
- export {
4576
- L as DrawEvent,
4577
- K as GeoKitEvent,
4578
- Ue as LeafletDrawMapElement
4579
- };
4580
- //# sourceMappingURL=index-DCGBWrrm.js.map