@m3ui-vue/m3ui-vue 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/API.md +940 -33
  2. package/dist/{MButton-CPghlKb0.js → MButton-OQ4wIERQ.js} +2 -2
  3. package/dist/{MButton-CPghlKb0.js.map → MButton-OQ4wIERQ.js.map} +1 -1
  4. package/dist/MColorPickerModal-NtkihoK6.js +577 -0
  5. package/dist/MColorPickerModal-NtkihoK6.js.map +1 -0
  6. package/dist/{MDialog-X50At1Gk.js → MDialog-DYMnaBlt.js} +3 -3
  7. package/dist/{MDialog-X50At1Gk.js.map → MDialog-DYMnaBlt.js.map} +1 -1
  8. package/dist/{MListItem-DVi1j1QI.js → MListItem-D2cNUyzP.js} +211 -168
  9. package/dist/MListItem-D2cNUyzP.js.map +1 -0
  10. package/dist/{MLoadingIndicator-vooA3110.js → MLoadingIndicator-DWUj0BAB.js} +2 -2
  11. package/dist/{MLoadingIndicator-vooA3110.js.map → MLoadingIndicator-DWUj0BAB.js.map} +1 -1
  12. package/dist/{MMenuItem-CRNZkVVr.js → MMenuItem-BuxYoASE.js} +133 -151
  13. package/dist/MMenuItem-BuxYoASE.js.map +1 -0
  14. package/dist/{MSeekBar-BL2W5_rD.js → MSeekBar-C4cn9RIF.js} +2 -2
  15. package/dist/{MSeekBar-BL2W5_rD.js.map → MSeekBar-C4cn9RIF.js.map} +1 -1
  16. package/dist/{MSlider-B9NcKTmZ.js → MSlider-BIkA6DiE.js} +2 -2
  17. package/dist/{MSlider-B9NcKTmZ.js.map → MSlider-BIkA6DiE.js.map} +1 -1
  18. package/dist/{MSpinner-_XpTRkAg.js → MSpinner-DZkXZJpc.js} +2 -2
  19. package/dist/{MSpinner-_XpTRkAg.js.map → MSpinner-DZkXZJpc.js.map} +1 -1
  20. package/dist/{MTextField-DpcPmR5B.js → MTextField-CNH-byir.js} +2 -2
  21. package/dist/{MTextField-DpcPmR5B.js.map → MTextField-CNH-byir.js.map} +1 -1
  22. package/dist/MTooltip-CK39Zon4.js +183 -0
  23. package/dist/MTooltip-CK39Zon4.js.map +1 -0
  24. package/dist/{_useEscapeStack-C5-BYr8y.js → _popupPosition-nL8SVKPK.js} +20 -2
  25. package/dist/_popupPosition-nL8SVKPK.js.map +1 -0
  26. package/dist/api.json +1 -1
  27. package/dist/code-editor.js +1 -1
  28. package/dist/components/MAddressField.vue.d.ts +54 -0
  29. package/dist/components/MAudioPlayer.vue.d.ts +1 -1
  30. package/dist/components/MAudioRecorder.vue.d.ts +51 -0
  31. package/dist/components/MAvailabilityCalendar.vue.d.ts +1 -1
  32. package/dist/components/MCameraCapture.vue.d.ts +51 -0
  33. package/dist/components/MCollapse.vue.d.ts +32 -0
  34. package/dist/components/MCountrySelect.vue.d.ts +41 -0
  35. package/dist/components/MCronField.vue.d.ts +26 -0
  36. package/dist/components/MDashboardGrid.vue.d.ts +65 -0
  37. package/dist/components/MDiffViewer.vue.d.ts +56 -0
  38. package/dist/components/MExpansionPanel.vue.d.ts +26 -3
  39. package/dist/components/MFilterBuilder.vue.d.ts +22 -0
  40. package/dist/components/MFlex.vue.d.ts +1 -1
  41. package/dist/components/MMapCluster.vue.d.ts +80 -0
  42. package/dist/components/MMapDraw.vue.d.ts +79 -0
  43. package/dist/components/MMentionField.vue.d.ts +102 -0
  44. package/dist/components/MNotificationCenter.vue.d.ts +57 -0
  45. package/dist/components/MQRScanner.vue.d.ts +52 -0
  46. package/dist/components/MQuiz.vue.d.ts +1 -1
  47. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  48. package/dist/components/MStack.vue.d.ts +1 -1
  49. package/dist/components/MTimezoneSelect.vue.d.ts +39 -0
  50. package/dist/components/MToolbar.vue.d.ts +1 -1
  51. package/dist/components/MVideoPlayer.vue.d.ts +1 -1
  52. package/dist/components/_MFilterGroup.vue.d.ts +17 -0
  53. package/dist/composables/_caretPosition.d.ts +6 -0
  54. package/dist/composables/_useCamera.d.ts +16 -0
  55. package/dist/composables/_useFollowAnchor.d.ts +15 -0
  56. package/dist/composables/cron.d.ts +29 -0
  57. package/dist/composables/dashboardLayout.d.ts +28 -0
  58. package/dist/composables/filterBuilder.d.ts +55 -0
  59. package/dist/composables/mapAdapters.d.ts +6 -1
  60. package/dist/composables/mapSearch.d.ts +1 -0
  61. package/dist/composables/textDiff.d.ts +24 -0
  62. package/dist/composables/useLocale.d.ts +108 -0
  63. package/dist/draw.js +28 -27
  64. package/dist/draw.js.map +1 -1
  65. package/dist/flow.js +1 -1
  66. package/dist/gantt.js +1 -1
  67. package/dist/index.d.ts +25 -0
  68. package/dist/locales/index.js +749 -0
  69. package/dist/locales/index.js.map +1 -1
  70. package/dist/m3ui-vue.css +1 -1
  71. package/dist/m3ui.js +10444 -7495
  72. package/dist/m3ui.js.map +1 -1
  73. package/dist/map.d.ts +5 -0
  74. package/dist/map.js +1509 -617
  75. package/dist/map.js.map +1 -1
  76. package/dist/media.js +5 -5
  77. package/dist/pdf.js +5 -5
  78. package/dist/rich-text-editor.js +5 -5
  79. package/dist/styles.css +1 -1
  80. package/dist/{useLocale-COav9m8C.js → useLocale-DaVSTdm0.js} +108 -1
  81. package/dist/useLocale-DaVSTdm0.js.map +1 -0
  82. package/package.json +1 -1
  83. package/src/__tests__/MAddressField.test.ts +149 -0
  84. package/src/__tests__/MAudioRecorder.test.ts +125 -0
  85. package/src/__tests__/MCameraCapture.test.ts +154 -0
  86. package/src/__tests__/MCountrySelect.test.ts +67 -0
  87. package/src/__tests__/MCronField.test.ts +100 -0
  88. package/src/__tests__/MDashboardGrid.test.ts +122 -0
  89. package/src/__tests__/MDiffViewer.test.ts +68 -0
  90. package/src/__tests__/MExpansionPanel.test.ts +107 -0
  91. package/src/__tests__/MFilterBuilder.test.ts +130 -0
  92. package/src/__tests__/MMapCluster.test.ts +127 -0
  93. package/src/__tests__/MMapDraw.test.ts +188 -0
  94. package/src/__tests__/MMapLayers.test.ts +56 -0
  95. package/src/__tests__/MMentionField.test.ts +163 -0
  96. package/src/__tests__/MNotificationCenter.test.ts +94 -0
  97. package/src/__tests__/_fakeMaplibre.ts +14 -3
  98. package/src/__tests__/attrsFallthrough.test.ts +4 -0
  99. package/src/__tests__/cron.test.ts +68 -0
  100. package/src/__tests__/dashboardLayout.test.ts +45 -0
  101. package/src/__tests__/filterBuilder.test.ts +91 -0
  102. package/src/__tests__/followAnchor.test.ts +162 -0
  103. package/src/__tests__/ssr.test.ts +3 -0
  104. package/src/__tests__/textDiff.test.ts +37 -0
  105. package/src/components/MAddressField.vue +301 -0
  106. package/src/components/MAudioRecorder.vue +334 -0
  107. package/src/components/MAutocomplete.vue +3 -7
  108. package/src/components/MCameraCapture.vue +156 -0
  109. package/src/components/MCollapse.vue +91 -0
  110. package/src/components/MColorPicker.vue +4 -8
  111. package/src/components/MCountrySelect.vue +89 -0
  112. package/src/components/MCronField.vue +251 -0
  113. package/src/components/MDashboardGrid.vue +382 -0
  114. package/src/components/MDatePicker.vue +10 -7
  115. package/src/components/MDateRangePicker.vue +10 -7
  116. package/src/components/MDiffViewer.vue +234 -0
  117. package/src/components/MExpansionPanel.vue +56 -48
  118. package/src/components/MFilterBuilder.vue +47 -0
  119. package/src/components/MMapBaseLayers.vue +29 -28
  120. package/src/components/MMapCluster.vue +295 -0
  121. package/src/components/MMapDraw.vue +601 -0
  122. package/src/components/MMapMeasure.vue +1 -1
  123. package/src/components/MMapSearch.vue +1 -9
  124. package/src/components/MMentionField.vue +373 -0
  125. package/src/components/MMultiAutocomplete.vue +3 -7
  126. package/src/components/MMultiSelect.vue +3 -7
  127. package/src/components/MNotificationCenter.vue +252 -0
  128. package/src/components/MPhoneInput.vue +3 -10
  129. package/src/components/MQRScanner.vue +177 -0
  130. package/src/components/MSelect.vue +3 -7
  131. package/src/components/MTimePicker.vue +10 -7
  132. package/src/components/MTimezoneSelect.vue +116 -0
  133. package/src/components/_MFilterGroup.vue +210 -0
  134. package/src/composables/_caretPosition.ts +44 -0
  135. package/src/composables/_useCamera.ts +66 -0
  136. package/src/composables/_useFollowAnchor.ts +109 -0
  137. package/src/composables/cron.ts +179 -0
  138. package/src/composables/dashboardLayout.ts +94 -0
  139. package/src/composables/filterBuilder.ts +195 -0
  140. package/src/composables/mapAdapters.ts +29 -15
  141. package/src/composables/mapSearch.ts +10 -0
  142. package/src/composables/textDiff.ts +106 -0
  143. package/src/composables/useLocale.ts +215 -0
  144. package/src/index.ts +25 -0
  145. package/src/locales/de.ts +107 -0
  146. package/src/locales/es.ts +107 -0
  147. package/src/locales/fr.ts +107 -0
  148. package/src/locales/ja.ts +107 -0
  149. package/src/locales/ko.ts +107 -0
  150. package/src/locales/pt.ts +107 -0
  151. package/src/locales/zh.ts +107 -0
  152. package/src/map.ts +5 -0
  153. package/dist/MListItem-DVi1j1QI.js.map +0 -1
  154. package/dist/MMenuItem-CRNZkVVr.js.map +0 -1
  155. package/dist/MTooltip-BL3jPYPT.js +0 -754
  156. package/dist/MTooltip-BL3jPYPT.js.map +0 -1
  157. package/dist/_useEscapeStack-C5-BYr8y.js.map +0 -1
  158. package/dist/useLocale-COav9m8C.js.map +0 -1
package/dist/map.js CHANGED
@@ -1,62 +1,63 @@
1
1
  import { t as e } from "./MIcon-DpajuUTJ.js";
2
2
  import { i as t } from "./motion-BcejVTeX.js";
3
3
  import { d as n, f as r, l as i, t as a, u as o } from "./MIconButton-BBggVwBV.js";
4
- import { i as s } from "./useLocale-COav9m8C.js";
4
+ import { i as s } from "./useLocale-DaVSTdm0.js";
5
5
  import { o as c } from "./_storageKeys-C4W_4xK4.js";
6
6
  import { t as l } from "./useThemeTokens-DyAdPQB0.js";
7
- import { t as u } from "./MTextField-DpcPmR5B.js";
8
- import { t as d } from "./MSlider-B9NcKTmZ.js";
9
- import { t as f } from "./_useEscapeStack-C5-BYr8y.js";
10
- import { a as p, r as m, s as h, t as g } from "./MListItem-DVi1j1QI.js";
11
- import { t as _ } from "./MSpinner-_XpTRkAg.js";
12
- import { Fragment as v, Transition as y, computed as b, createBlock as x, createCommentVNode as S, createElementBlock as C, createElementVNode as w, createSlots as T, createTextVNode as E, createVNode as D, defineComponent as O, getCurrentInstance as k, inject as A, markRaw as j, mergeProps as M, normalizeClass as N, normalizeStyle as P, onBeforeUnmount as F, onMounted as ee, onUnmounted as te, openBlock as I, provide as ne, reactive as L, ref as R, renderList as z, renderSlot as B, shallowRef as V, toDisplayString as H, toValue as re, unref as U, useId as ie, useSlots as W, watch as G, withCtx as K, withModifiers as q } from "vue";
7
+ import { t as u } from "./MTextField-CNH-byir.js";
8
+ import { t as d } from "./MSlider-BIkA6DiE.js";
9
+ import { t as f } from "./MTooltip-CK39Zon4.js";
10
+ import { n as p, r as m } from "./_popupPosition-nL8SVKPK.js";
11
+ import { a as h, l as g, r as _, s as v, t as y } from "./MListItem-D2cNUyzP.js";
12
+ import { t as b } from "./MSpinner-DZkXZJpc.js";
13
+ import { Fragment as x, Teleport as S, Transition as C, computed as w, createBlock as T, createCommentVNode as E, createElementBlock as D, createElementVNode as O, createSlots as k, createTextVNode as A, createVNode as j, defineComponent as M, getCurrentInstance as N, inject as P, markRaw as ee, mergeProps as F, nextTick as I, normalizeClass as L, normalizeStyle as te, onBeforeUnmount as ne, onMounted as R, onUnmounted as re, openBlock as z, provide as B, reactive as ie, ref as V, renderList as H, renderSlot as U, shallowRef as W, toDisplayString as G, toValue as K, unref as q, useId as ae, useSlots as J, watch as Y, watchEffect as oe, withCtx as X, withModifiers as se } from "vue";
13
14
  // src/composables/useMap.ts
14
- var ae;
15
- function oe(e) {
16
- ae = e;
15
+ var ce;
16
+ function le(e) {
17
+ ce = e;
17
18
  }
18
- function se() {
19
- return ae;
19
+ function ue() {
20
+ return ce;
20
21
  }
21
- var J = Symbol("m3-map");
22
- function Y(e) {
23
- let t = A(J, null);
22
+ var de = Symbol("m3-map");
23
+ function fe(e) {
24
+ let t = P(de, null);
24
25
  if (t || e === void 0) return t;
25
- let n = b(() => {
26
- let t = re(e);
26
+ let n = w(() => {
27
+ let t = K(e);
27
28
  return t ? "context" in t ? t.context : t : void 0;
28
29
  }), r = {
29
- map: b(() => n.value?.map.value),
30
- maplibre: b(() => n.value?.maplibre.value),
31
- styleVersion: b(() => n.value?.styleVersion.value ?? 0),
32
- model: b(() => n.value?.model.value),
30
+ map: w(() => n.value?.map.value),
31
+ maplibre: w(() => n.value?.maplibre.value),
32
+ styleVersion: w(() => n.value?.styleVersion.value ?? 0),
33
+ model: w(() => n.value?.model.value),
33
34
  layerState: new Proxy({
34
35
  visible: {},
35
36
  opacity: {}
36
37
  }, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
37
- activeTool: b({
38
+ activeTool: w({
38
39
  get: () => n.value?.activeTool.value ?? null,
39
40
  set: (e) => {
40
41
  n.value && (n.value.activeTool.value = e);
41
42
  }
42
43
  })
43
44
  };
44
- return ne(J, r), r;
45
+ return B(de, r), r;
45
46
  }
46
- function X(e) {
47
- let t = Y(e);
47
+ function Z(e) {
48
+ let t = fe(e);
48
49
  if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
49
50
  let n = [];
50
- k() && F(() => n.splice(0).forEach((e) => e()));
51
+ N() && ne(() => n.splice(0).forEach((e) => e()));
51
52
  function r(e) {
52
53
  let r = () => {
53
54
  if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
54
- let r = G(t.map, (n) => {
55
+ let r = Y(t.map, (n) => {
55
56
  n && t.maplibre.value && (r(), e(n, t.maplibre.value));
56
57
  });
57
58
  n.push(r);
58
- }, i = k();
59
- i && !i.isMounted ? ee(r) : r();
59
+ }, i = N();
60
+ i && !i.isMounted ? R(r) : r();
60
61
  }
61
62
  function i(e, t) {
62
63
  r((r) => {
@@ -69,9 +70,9 @@ function X(e) {
69
70
  });
70
71
  }
71
72
  return {
72
- map: b(() => t.map.value),
73
- maplibre: b(() => t.maplibre.value),
74
- styleVersion: b(() => t.styleVersion.value),
73
+ map: w(() => t.map.value),
74
+ maplibre: w(() => t.maplibre.value),
75
+ styleVersion: w(() => t.styleVersion.value),
75
76
  activeTool: t.activeTool,
76
77
  onReady: r,
77
78
  on: i,
@@ -79,10 +80,10 @@ function X(e) {
79
80
  };
80
81
  }
81
82
  // src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
82
- var ce = { class: "hidden" }, le = {
83
+ var pe = { class: "hidden" }, me = {
83
84
  key: 0,
84
85
  class: "m3-map-control-panel-in"
85
- }, ue = /* @__PURE__ */ O({
86
+ }, he = /* @__PURE__ */ M({
86
87
  inheritAttrs: !1,
87
88
  __name: "MMapControl",
88
89
  props: {
@@ -102,11 +103,11 @@ var ce = { class: "hidden" }, le = {
102
103
  },
103
104
  emits: ["update:expanded"],
104
105
  setup(e, { emit: a }) {
105
- let s = e, c = a, l = W(), u = R(), { onReady: d } = X(), f = R(s.expanded);
106
- G(() => s.expanded, (e) => {
106
+ let s = e, c = a, l = J(), u = V(), { onReady: d } = Z(), f = V(s.expanded);
107
+ Y(() => s.expanded, (e) => {
107
108
  f.value = e;
108
109
  });
109
- let p = b(() => f.value && !!l.panel);
110
+ let p = w(() => f.value && !!l.panel);
110
111
  function m(e) {
111
112
  e !== f.value && (f.value = e, c("update:expanded", e));
112
113
  }
@@ -117,14 +118,14 @@ var ce = { class: "hidden" }, le = {
117
118
  function v(e) {
118
119
  e.key === "Escape" && p.value && (g(), e.stopPropagation());
119
120
  }
120
- let y = null, x = null, S = [], T = {
121
+ let y = null, b = null, x = [], S = {
121
122
  w: 0,
122
123
  h: 0
123
- }, E = {
124
+ }, C = {
124
125
  w: 0,
125
126
  h: 0
126
- }, D = null;
127
- function O() {
127
+ }, T = null;
128
+ function E() {
128
129
  return {
129
130
  w: u.value.offsetWidth,
130
131
  h: u.value.offsetHeight
@@ -132,61 +133,61 @@ var ce = { class: "hidden" }, le = {
132
133
  }
133
134
  function k() {
134
135
  let e = u.value;
135
- if (!e || x) return;
136
- let t = O();
136
+ if (!e || b) return;
137
+ let t = E();
137
138
  y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() && A(e, y, t), y = t;
138
139
  }
139
140
  function A(e, n, a) {
140
- if (T = n, E = a, S = r(0, 1, 0, t.standard.defaultSpatial, .002), e.style.overflow = "hidden", x = i(e, S, (e) => ({
141
+ if (S = n, C = a, x = r(0, 1, 0, t.standard.defaultSpatial, .002), e.style.overflow = "hidden", b = i(e, x, (e) => ({
141
142
  width: `${n.w + (a.w - n.w) * e}px`,
142
143
  height: `${n.h + (a.h - n.h) * e}px`
143
- })), !x) return j(e);
144
- x.onfinish = () => j(e);
144
+ })), !b) return j(e);
145
+ b.onfinish = () => j(e);
145
146
  }
146
147
  function j(e) {
147
- x?.cancel(), x = null, e.style.overflow = "";
148
- let t = O();
149
- t.w !== E.w || t.h !== E.h ? (y = E, k()) : y = t;
150
- }
151
- function N() {
152
- if (!u.value || !x) return;
153
- let e = n(S, x.currentTime), t = {
154
- w: T.w + (E.w - T.w) * e,
155
- h: T.h + (E.h - T.h) * e
148
+ b?.cancel(), b = null, e.style.overflow = "";
149
+ let t = E();
150
+ t.w !== C.w || t.h !== C.h ? (y = C, k()) : y = t;
151
+ }
152
+ function M() {
153
+ if (!u.value || !b) return;
154
+ let e = n(x, b.currentTime), t = {
155
+ w: S.w + (C.w - S.w) * e,
156
+ h: S.h + (C.h - S.h) * e
156
157
  };
157
- x.onfinish = null, x.cancel(), x = null, y = t, k();
158
+ b.onfinish = null, b.cancel(), b = null, y = t, k();
158
159
  }
159
- G(p, N, { flush: "post" });
160
- let P, te = {
160
+ Y(p, M, { flush: "post" });
161
+ let N, P = {
161
162
  onAdd: () => u.value,
162
163
  onRemove: () => u.value?.remove()
163
164
  };
164
165
  return d((e) => {
165
- P = e, u.value && e.addControl(te, s.position);
166
- }), G(() => s.position, (e) => {
167
- P && u.value && (P.removeControl(te), P.addControl(te, e));
168
- }), ee(() => {
169
- document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (D = new ResizeObserver(k), D.observe(u.value));
170
- }), F(() => {
171
- document.removeEventListener("pointerdown", _, !0), D?.disconnect(), x?.cancel(), P?.hasControl(te) && P.removeControl(te);
172
- }), (t, n) => (I(), C("div", ce, [w("div", M({
166
+ N = e, u.value && e.addControl(P, s.position);
167
+ }), Y(() => s.position, (e) => {
168
+ N && u.value && (N.removeControl(P), N.addControl(P, e));
169
+ }), R(() => {
170
+ document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (T = new ResizeObserver(k), T.observe(u.value));
171
+ }), ne(() => {
172
+ document.removeEventListener("pointerdown", _, !0), T?.disconnect(), b?.cancel(), N?.hasControl(P) && N.removeControl(P);
173
+ }), (t, n) => (z(), D("div", pe, [O("div", F({
173
174
  ref_key: "el",
174
175
  ref: u,
175
176
  class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
176
- }, t.$attrs, { onKeydown: v }), [p.value ? (I(), C("div", le, [B(t.$slots, "panel", { close: g })])) : B(t.$slots, "default", {
177
+ }, t.$attrs, { onKeydown: v }), [p.value ? (z(), D("div", me, [U(t.$slots, "panel", { close: g })])) : U(t.$slots, "default", {
177
178
  expanded: f.value,
178
179
  toggle: h
179
180
  }, void 0, void 0, 1)], 16)]));
180
181
  }
181
- }), de = [
182
+ }), ge = [
182
183
  "title",
183
184
  "aria-label",
184
185
  "aria-expanded"
185
- ], fe = ["innerHTML"], pe = /* @__PURE__ */ O({
186
+ ], _e = ["innerHTML"], ve = /* @__PURE__ */ M({
186
187
  __name: "_MMapAttribution",
187
188
  props: { position: {} },
188
189
  setup(t) {
189
- let n = t, r = s(), { on: i, onReady: a } = X(), o = R([]), c = R(!0), l = R(0), u;
190
+ let n = t, r = s(), { on: i, onReady: a } = Z(), o = V([]), c = V(!0), l = V(0), u;
190
191
  function d() {
191
192
  if (!u) return;
192
193
  let e = u.getStyle?.();
@@ -205,35 +206,35 @@ var ce = { class: "hidden" }, le = {
205
206
  }), i("styledata", d), i("sourcedata", d), i("resize", d), i("dragstart", () => {
206
207
  c.value = !1;
207
208
  });
208
- let f = b(() => o.value.join(" ")), p = b(() => n.position.endsWith("right"));
209
- return (n, i) => f.value ? (I(), x(ue, {
209
+ let f = w(() => o.value.join(" ")), p = w(() => n.position.endsWith("right"));
210
+ return (n, i) => f.value ? (z(), T(he, {
210
211
  key: 0,
211
212
  position: t.position,
212
213
  group: !1,
213
- class: N(["m3-map-attrib", c.value ? "m3-map-attrib-open" : ""])
214
+ class: L(["m3-map-attrib", c.value ? "m3-map-attrib-open" : ""])
214
215
  }, {
215
- default: K(() => [w("div", {
216
- class: N(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
217
- style: P(l.value ? { maxWidth: `${l.value}px` } : void 0)
218
- }, [w("button", {
216
+ default: X(() => [O("div", {
217
+ class: L(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
218
+ style: te(l.value ? { maxWidth: `${l.value}px` } : void 0)
219
+ }, [O("button", {
219
220
  type: "button",
220
221
  class: "m3-map-attrib-button",
221
- title: U(r).mapToggleAttribution,
222
- "aria-label": U(r).mapToggleAttribution,
222
+ title: q(r).mapToggleAttribution,
223
+ "aria-label": q(r).mapToggleAttribution,
223
224
  "aria-expanded": c.value,
224
225
  onClick: i[0] ||= (e) => c.value = !c.value
225
- }, [D(e, {
226
+ }, [j(e, {
226
227
  name: "info",
227
228
  size: 20
228
- })], 8, de), c.value ? (I(), C("div", {
229
+ })], 8, ge), c.value ? (z(), D("div", {
229
230
  key: 0,
230
- class: N(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
231
+ class: L(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
231
232
  innerHTML: f.value
232
- }, null, 10, fe)) : S("", !0)], 6)]),
233
+ }, null, 10, _e)) : E("", !0)], 6)]),
233
234
  _: 1
234
- }, 8, ["position", "class"])) : S("", !0);
235
+ }, 8, ["position", "class"])) : E("", !0);
235
236
  }
236
- }), me = {
237
+ }), ye = {
237
238
  fill: ["fill-opacity"],
238
239
  line: ["line-opacity"],
239
240
  circle: ["circle-opacity", "circle-stroke-opacity"],
@@ -242,27 +243,27 @@ var ce = { class: "hidden" }, le = {
242
243
  heatmap: ["heatmap-opacity"],
243
244
  "fill-extrusion": ["fill-extrusion-opacity"]
244
245
  };
245
- function he() {
246
- return L({
246
+ function be() {
247
+ return ie({
247
248
  visible: {},
248
249
  opacity: {}
249
250
  });
250
251
  }
251
- function ge(e, t, n) {
252
+ function xe(e, t, n) {
252
253
  let r = {}, i = {};
253
254
  for (let e of n?.layers ?? []) {
254
255
  let n = t.getLayer(e.id);
255
256
  if (!n) continue;
256
257
  r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
257
- let a = me[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
258
+ let a = ye[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
258
259
  i[e.id] = typeof o == "number" ? o : 1;
259
260
  }
260
261
  e.visible = r, e.opacity = i;
261
262
  }
262
- function Z(e) {
263
- let t = Y(e);
263
+ function Q(e) {
264
+ let t = fe(e);
264
265
  if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
265
- let { map: n, model: r, layerState: i } = t, a = b(() => r.value?.layers ?? []), o = b(() => new Map(a.value.map((e) => [e.id, e])));
266
+ let { map: n, model: r, layerState: i } = t, a = w(() => r.value?.layers ?? []), o = w(() => new Map(a.value.map((e) => [e.id, e])));
266
267
  function s(e) {
267
268
  return i.visible[e] ?? !0;
268
269
  }
@@ -279,7 +280,7 @@ function Z(e) {
279
280
  }
280
281
  function d(e, t) {
281
282
  let r = n.value, a = r?.getLayer(e);
282
- if (a) for (let n of me[a.type] ?? []) r.setPaintProperty(e, n, t);
283
+ if (a) for (let n of ye[a.type] ?? []) r.setPaintProperty(e, n, t);
283
284
  i.opacity[e] = t;
284
285
  for (let n of o.value.get(e)?.children ?? []) d(n, t);
285
286
  }
@@ -293,12 +294,12 @@ function Z(e) {
293
294
  function m(e, t) {
294
295
  for (let n of f(e)) c(n.id, t);
295
296
  }
296
- let h = b(() => a.value.filter((e) => e.base)), g = b(() => h.value.find((e) => s(e.id))?.id ?? null);
297
+ let h = w(() => a.value.filter((e) => e.base)), g = w(() => h.value.find((e) => s(e.id))?.id ?? null);
297
298
  function _(e) {
298
299
  for (let t of h.value) c(t.id, t.id === e);
299
300
  }
300
301
  return {
301
- model: b(() => r.value),
302
+ model: w(() => r.value),
302
303
  layers: a,
303
304
  isVisible: s,
304
305
  setVisible: c,
@@ -314,13 +315,13 @@ function Z(e) {
314
315
  };
315
316
  }
316
317
  // src/composables/_mapStyle.ts
317
- function _e(e) {
318
+ function Se(e) {
318
319
  return {
319
320
  sources: new Set(Object.keys(e?.sources ?? {})),
320
321
  layers: new Set((e?.layers ?? []).map((e) => e.id))
321
322
  };
322
323
  }
323
- function ve(e, t, n, r = () => !0) {
324
+ function Ce(e, t, n, r = () => !0) {
324
325
  if (!e) return t;
325
326
  let i = new Set(t.layers.map((e) => e.id)), a = e.layers.filter((e) => !n.layers.has(e.id) && !i.has(e.id) && r(e)), o = { ...t.sources };
326
327
  for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
@@ -331,7 +332,7 @@ function ve(e, t, n, r = () => !0) {
331
332
  };
332
333
  }
333
334
  // src/components/MMap.vue?vue&type=script&setup=true&lang.ts
334
- var ye = 600, be = /* @__PURE__ */ O({
335
+ var $ = 600, we = /* @__PURE__ */ M({
335
336
  __name: "MMap",
336
337
  props: {
337
338
  mapStyle: {},
@@ -381,20 +382,20 @@ var ye = 600, be = /* @__PURE__ */ O({
381
382
  "update:pitch"
382
383
  ],
383
384
  setup(e, { expose: t, emit: n }) {
384
- let r = e, i = n, a = R(), o = R(), l = V(), u = V(), d = R(0), f, p = V(), m = he(), h = {
385
+ let r = e, i = n, a = V(), o = V(), l = W(), u = W(), d = V(0), f, p = W(), m = be(), h = {
385
386
  map: l,
386
387
  maplibre: u,
387
388
  styleVersion: d,
388
389
  model: p,
389
390
  layerState: m,
390
- activeTool: R(null)
391
+ activeTool: V(null)
391
392
  };
392
- ne(J, h);
393
+ B(de, h);
393
394
  function g(e) {
394
- p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, ge(m, e, p.value);
395
+ p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, xe(m, e, p.value);
395
396
  }
396
397
  let _ = s(), v = () => typeof r.persist == "string" ? r.persist : r.persist ? c("m3-map-view") : null;
397
- function b() {
398
+ function y() {
398
399
  let e = v();
399
400
  if (!e) return {};
400
401
  try {
@@ -404,7 +405,7 @@ var ye = 600, be = /* @__PURE__ */ O({
404
405
  return {};
405
406
  }
406
407
  }
407
- function T(e) {
408
+ function b(e) {
408
409
  let t = e.getCenter();
409
410
  return {
410
411
  center: [t.lng, t.lat],
@@ -413,7 +414,7 @@ var ye = 600, be = /* @__PURE__ */ O({
413
414
  pitch: e.getPitch()
414
415
  };
415
416
  }
416
- let E = {
417
+ let x = {
417
418
  navigation: {
418
419
  corner: "top-right",
419
420
  create: (e) => new e.NavigationControl()
@@ -436,19 +437,19 @@ var ye = 600, be = /* @__PURE__ */ O({
436
437
  unit: "metric"
437
438
  })
438
439
  }
439
- }, O = /* @__PURE__ */ new Map();
440
- function k(e) {
440
+ }, S = /* @__PURE__ */ new Map();
441
+ function w(e) {
441
442
  let t = l.value, n = u.value;
442
443
  if (!t || !n) return;
443
- let i = O.get(e);
444
- i && (t.removeControl(i), O.delete(e));
444
+ let i = S.get(e);
445
+ i && (t.removeControl(i), S.delete(e));
445
446
  let a = r[e];
446
447
  if (!a) return;
447
- let o = E[e].create(n);
448
- t.addControl(o, a === !0 ? E[e].corner : a), O.set(e, o);
448
+ let o = x[e].create(n);
449
+ t.addControl(o, a === !0 ? x[e].corner : a), S.set(e, o);
449
450
  }
450
- for (let e of Object.keys(E)) G(() => r[e], () => k(e));
451
- function A() {
451
+ for (let e of Object.keys(x)) Y(() => r[e], () => w(e));
452
+ function k() {
452
453
  return {
453
454
  "AttributionControl.ToggleAttribution": _.mapToggleAttribution,
454
455
  "AttributionControl.MapFeedback": _.mapFeedback,
@@ -467,76 +468,76 @@ var ye = 600, be = /* @__PURE__ */ O({
467
468
  "CooperativeGesturesHandler.MobileHelpText": _.mapTwoFingers
468
469
  };
469
470
  }
470
- let M = R(null), L, z;
471
- function re(e) {
471
+ let A = V(null), M, N;
472
+ function P(e) {
472
473
  let t = e.getAttribute("title");
473
474
  t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
474
475
  }
475
- function U(e) {
476
+ function F(e) {
476
477
  let t = e.getAttribute("data-m3-tip"), n = a.value?.getBoundingClientRect();
477
478
  if (!t || !n) return;
478
479
  let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
479
- M.value = {
480
+ A.value = {
480
481
  text: t,
481
482
  left: i,
482
483
  x: (i ? r.left - 8 : r.right + 8) - n.left,
483
484
  y: r.top + r.height / 2 - n.top
484
485
  };
485
486
  }
486
- function ie() {
487
- clearTimeout(L), M.value = null;
487
+ function I() {
488
+ clearTimeout(M), A.value = null;
488
489
  }
489
- let W = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
490
- function q(e) {
491
- let t = W(e);
492
- t && e.pointerType !== "touch" && (clearTimeout(L), L = setTimeout(() => U(t), ye));
490
+ let ie = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
491
+ function H(e) {
492
+ let t = ie(e);
493
+ t && e.pointerType !== "touch" && (clearTimeout(M), M = setTimeout(() => F(t), $));
493
494
  }
494
- function ae(e) {
495
- let t = W(e);
496
- t && !t.contains(e.relatedTarget) && ie();
495
+ function K(e) {
496
+ let t = ie(e);
497
+ t && !t.contains(e.relatedTarget) && I();
497
498
  }
498
- function oe(e) {
499
- let t = W(e);
500
- t?.matches(":focus-visible") && U(t);
499
+ function q(e) {
500
+ let t = ie(e);
501
+ t?.matches(":focus-visible") && F(t);
501
502
  }
502
- ee(() => {
503
+ R(() => {
503
504
  let e = a.value;
504
- e && (e.querySelectorAll("[title]").forEach(re), z = new MutationObserver((e) => {
505
- for (let t of e) t.type === "attributes" ? re(t.target) : t.addedNodes.forEach((e) => {
506
- e instanceof Element && (re(e), e.querySelectorAll("[title]").forEach(re));
505
+ e && (e.querySelectorAll("[title]").forEach(P), N = new MutationObserver((e) => {
506
+ for (let t of e) t.type === "attributes" ? P(t.target) : t.addedNodes.forEach((e) => {
507
+ e instanceof Element && (P(e), e.querySelectorAll("[title]").forEach(P));
507
508
  });
508
- }), z.observe(e, {
509
+ }), N.observe(e, {
509
510
  subtree: !0,
510
511
  childList: !0,
511
512
  attributes: !0,
512
513
  attributeFilter: ["title"]
513
514
  }));
514
- }), F(() => {
515
- z?.disconnect(), clearTimeout(L);
515
+ }), ne(() => {
516
+ N?.disconnect(), clearTimeout(M);
516
517
  });
517
- let Y = !1;
518
- ee(async () => {
518
+ let ae = !1;
519
+ R(async () => {
519
520
  let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
520
- if (Y || !o.value) return;
521
- let n = r.workerUrl ?? se();
521
+ if (ae || !o.value) return;
522
+ let n = r.workerUrl ?? ue();
522
523
  n && t.setWorkerUrl(n);
523
- let a = b(), s = {
524
+ let a = y(), s = {
524
525
  center: a.center ?? r.center,
525
526
  zoom: a.zoom ?? r.zoom,
526
527
  bearing: a.bearing ?? r.bearing,
527
528
  pitch: a.pitch ?? r.pitch
528
- }, c = j(new t.Map({
529
+ }, c = ee(new t.Map({
529
530
  container: o.value,
530
531
  style: r.mapStyle,
531
532
  attributionControl: !1,
532
- locale: A(),
533
+ locale: k(),
533
534
  ...Object.fromEntries(Object.entries(s).filter(([, e]) => e !== void 0)),
534
535
  ...r.options
535
536
  }));
536
537
  u.value = t, c.on("style.load", () => {
537
- f ||= _e(c.getStyle()), g(c), d.value++;
538
+ f ||= Se(c.getStyle()), g(c), d.value++;
538
539
  }), c.on("click", (e) => i("click", e)), c.on("moveend", () => {
539
- let e = T(c);
540
+ let e = b(c);
540
541
  i("update:center", e.center), i("update:zoom", e.zoom), i("update:bearing", e.bearing), i("update:pitch", e.pitch);
541
542
  let t = v();
542
543
  if (t) try {
@@ -544,87 +545,87 @@ var ye = 600, be = /* @__PURE__ */ O({
544
545
  } catch {}
545
546
  }), c.once("load", () => {
546
547
  l.value = c;
547
- for (let e of Object.keys(E)) k(e);
548
+ for (let e of Object.keys(x)) w(e);
548
549
  i("ready", c);
549
550
  });
550
- }), te(() => {
551
- Y = !0, l.value?.remove(), l.value = void 0;
551
+ }), re(() => {
552
+ ae = !0, l.value?.remove(), l.value = void 0;
552
553
  });
553
- let X = (e, t) => Math.abs(e - t) < 1e-9;
554
- return G(() => r.center?.join(","), () => {
554
+ let J = (e, t) => Math.abs(e - t) < 1e-9;
555
+ return Y(() => r.center?.join(","), () => {
555
556
  let e = l.value;
556
557
  if (!e || !r.center) return;
557
558
  let t = e.getCenter();
558
- X(t.lng, r.center[0]) && X(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
559
- }), G(() => r.zoom, (e) => {
560
- l.value && e !== void 0 && !X(l.value.getZoom(), e) && l.value.jumpTo({ zoom: e });
561
- }), G(() => r.bearing, (e) => {
562
- l.value && e !== void 0 && !X(l.value.getBearing(), e) && l.value.jumpTo({ bearing: e });
563
- }), G(() => r.pitch, (e) => {
564
- l.value && e !== void 0 && !X(l.value.getPitch(), e) && l.value.jumpTo({ pitch: e });
565
- }), G(() => r.adapter, () => {
559
+ J(t.lng, r.center[0]) && J(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
560
+ }), Y(() => r.zoom, (e) => {
561
+ l.value && e !== void 0 && !J(l.value.getZoom(), e) && l.value.jumpTo({ zoom: e });
562
+ }), Y(() => r.bearing, (e) => {
563
+ l.value && e !== void 0 && !J(l.value.getBearing(), e) && l.value.jumpTo({ bearing: e });
564
+ }), Y(() => r.pitch, (e) => {
565
+ l.value && e !== void 0 && !J(l.value.getPitch(), e) && l.value.jumpTo({ pitch: e });
566
+ }), Y(() => r.adapter, () => {
566
567
  l.value && g(l.value);
567
- }), G(() => r.mapStyle, (e) => l.value?.setStyle(e, {
568
+ }), Y(() => r.mapStyle, (e) => l.value?.setStyle(e, {
568
569
  diff: !1,
569
570
  transformStyle: (e, t) => {
570
- let n = f ?? _e(void 0);
571
- f = _e(t);
572
- let i = r.keepLayers, a = i === !1 ? t : ve(e, t, n, typeof i == "function" ? i : void 0);
571
+ let n = f ?? Se(void 0);
572
+ f = Se(t);
573
+ let i = r.keepLayers, a = i === !1 ? t : Ce(e, t, n, typeof i == "function" ? i : void 0);
573
574
  return r.transformStyle && (a = r.transformStyle(e, a)), a;
574
575
  }
575
576
  })), t({
576
577
  map: l,
577
578
  context: h
578
- }), (t, n) => (I(), C("div", {
579
+ }), (t, n) => (z(), D("div", {
579
580
  ref_key: "root",
580
581
  ref: a,
581
582
  class: "m3-map relative overflow-hidden",
582
- onPointerover: q,
583
- onPointerout: ae,
584
- onPointerdown: ie,
585
- onFocusin: oe,
586
- onFocusout: ie
583
+ onPointerover: H,
584
+ onPointerout: K,
585
+ onPointerdown: I,
586
+ onFocusin: q,
587
+ onFocusout: I
587
588
  }, [
588
- w("div", {
589
+ O("div", {
589
590
  ref_key: "container",
590
591
  ref: o,
591
592
  class: "h-full w-full"
592
593
  }, null, 512),
593
- l.value && e.attribution ? (I(), x(pe, {
594
+ l.value && e.attribution ? (z(), T(ve, {
594
595
  key: 0,
595
596
  position: e.attribution === !0 ? "bottom-right" : e.attribution
596
- }, null, 8, ["position"])) : S("", !0),
597
- l.value ? B(t.$slots, "default", {}, void 0, void 0, 1) : S("", !0),
598
- D(y, {
597
+ }, null, 8, ["position"])) : E("", !0),
598
+ l.value ? U(t.$slots, "default", {}, void 0, void 0, 1) : E("", !0),
599
+ j(C, {
599
600
  "enter-active-class": "transition-opacity duration-150",
600
601
  "enter-from-class": "opacity-0",
601
602
  "leave-active-class": "transition-opacity duration-100",
602
603
  "leave-to-class": "opacity-0"
603
604
  }, {
604
- default: K(() => [M.value ? (I(), C("div", {
605
+ default: X(() => [A.value ? (z(), D("div", {
605
606
  key: 0,
606
607
  role: "tooltip",
607
- class: N(["pointer-events-none absolute z-10 min-h-6 max-w-[200px] -translate-y-1/2 rounded bg-inverse-surface px-2 py-1 text-body-small whitespace-nowrap text-inverse-on-surface", M.value.left ? "-translate-x-full" : ""]),
608
- style: P({
609
- left: `${M.value.x}px`,
610
- top: `${M.value.y}px`
608
+ class: L(["pointer-events-none absolute z-10 min-h-6 max-w-[200px] -translate-y-1/2 rounded bg-inverse-surface px-2 py-1 text-body-small whitespace-nowrap text-inverse-on-surface", A.value.left ? "-translate-x-full" : ""]),
609
+ style: te({
610
+ left: `${A.value.x}px`,
611
+ top: `${A.value.y}px`
611
612
  })
612
- }, H(M.value.text), 7)) : S("", !0)]),
613
+ }, G(A.value.text), 7)) : E("", !0)]),
613
614
  _: 1
614
615
  })
615
616
  ], 544));
616
617
  }
617
- }), xe = 13.5, Q = xe / Math.SQRT2, Se = [0, -14], Ce = {
618
+ }), Te = 13.5, Ee = Te / Math.SQRT2, De = [0, -14], Oe = {
618
619
  center: [0, 0],
619
620
  top: [0, 0],
620
621
  "top-left": [0, 0],
621
622
  "top-right": [0, 0],
622
623
  bottom: [0, -38.1],
623
- "bottom-left": [Q, (24.6 + Q) * -1],
624
- "bottom-right": [-Q, (24.6 + Q) * -1],
625
- left: [xe, -24.6],
624
+ "bottom-left": [Ee, (24.6 + Ee) * -1],
625
+ "bottom-right": [-Ee, (24.6 + Ee) * -1],
626
+ left: [Te, -24.6],
626
627
  right: [-13.5, -24.6]
627
- }, we = { class: "hidden" }, Te = /* @__PURE__ */ O({
628
+ }, ke = { class: "hidden" }, Ae = /* @__PURE__ */ M({
628
629
  inheritAttrs: !1,
629
630
  __name: "MMapMarker",
630
631
  props: {
@@ -640,7 +641,7 @@ var ye = 600, be = /* @__PURE__ */ O({
640
641
  },
641
642
  emits: ["update:lngLat", "click"],
642
643
  setup(e, { expose: t, emit: n }) {
643
- let r = e, i = n, a = W(), o = R(), s = R(), { onReady: c } = X(), l, u = !1;
644
+ let r = e, i = n, a = J(), o = V(), s = V(), { onReady: c } = Z(), l, u = !1;
644
645
  c((e, t) => {
645
646
  u = !!a.default && !!o.value, l = new t.Marker({
646
647
  ...u ? { element: o.value } : { color: r.color ?? "currentColor" },
@@ -659,20 +660,20 @@ var ye = 600, be = /* @__PURE__ */ O({
659
660
  function d(e) {
660
661
  i("click", e);
661
662
  }
662
- return G(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), G(() => r.draggable, (e) => l?.setDraggable(e)), G(() => r.rotation, (e) => l?.setRotation(e)), G(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : Se))), F(() => {
663
+ return Y(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), Y(() => r.draggable, (e) => l?.setDraggable(e)), Y(() => r.rotation, (e) => l?.setRotation(e)), Y(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : De))), ne(() => {
663
664
  l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
664
- }), t({ marker: () => l }), (e, t) => (I(), C("div", we, [e.$slots.default ? (I(), C("div", M({
665
+ }), t({ marker: () => l }), (e, t) => (z(), D("div", ke, [e.$slots.default ? (z(), D("div", F({
665
666
  key: 0,
666
667
  ref_key: "content",
667
668
  ref: o,
668
669
  class: "m3-map-marker"
669
- }, e.$attrs), [B(e.$slots, "default")], 16)) : S("", !0), e.$slots.popup ? (I(), C("div", {
670
+ }, e.$attrs), [U(e.$slots, "default")], 16)) : E("", !0), e.$slots.popup ? (z(), D("div", {
670
671
  key: 1,
671
672
  ref_key: "popupContent",
672
673
  ref: s
673
- }, [B(e.$slots, "popup")], 512)) : S("", !0)]));
674
+ }, [U(e.$slots, "popup")], 512)) : E("", !0)]));
674
675
  }
675
- }), Ee = { class: "hidden" }, De = /* @__PURE__ */ O({
676
+ }), je = { class: "hidden" }, Me = /* @__PURE__ */ M({
676
677
  inheritAttrs: !1,
677
678
  __name: "MMapPopup",
678
679
  props: {
@@ -695,7 +696,7 @@ var ye = 600, be = /* @__PURE__ */ O({
695
696
  },
696
697
  emits: ["update:open"],
697
698
  setup(e, { expose: t, emit: n }) {
698
- let r = e, i = n, a = R(), { onReady: o } = X(), s, c, l = !1;
699
+ let r = e, i = n, a = V(), { onReady: o } = Z(), s, c, l = !1;
699
700
  function u() {
700
701
  s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
701
702
  }
@@ -711,16 +712,16 @@ var ye = 600, be = /* @__PURE__ */ O({
711
712
  }), a.value && s.setDOMContent(a.value), s.on("close", () => {
712
713
  l || i("update:open", !1);
713
714
  }), r.open && u();
714
- }), G(() => r.open, (e) => {
715
+ }), Y(() => r.open, (e) => {
715
716
  e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
716
- }), G(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), G(() => r.maxWidth, (e) => s?.setMaxWidth(e)), G(() => r.offset, (e) => s?.setOffset(e ?? 0)), F(() => {
717
+ }), Y(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), Y(() => r.maxWidth, (e) => s?.setMaxWidth(e)), Y(() => r.offset, (e) => s?.setOffset(e ?? 0)), ne(() => {
717
718
  l = !0, s?.remove();
718
- }), t({ popup: () => s }), (e, t) => (I(), C("div", Ee, [w("div", M({
719
+ }), t({ popup: () => s }), (e, t) => (z(), D("div", je, [O("div", F({
719
720
  ref_key: "content",
720
721
  ref: a
721
- }, e.$attrs), [B(e.$slots, "default")], 16)]));
722
+ }, e.$attrs), [U(e.$slots, "default")], 16)]));
722
723
  }
723
- }), Oe = /* @__PURE__ */ O({
724
+ }), Ne = /* @__PURE__ */ M({
724
725
  inheritAttrs: !1,
725
726
  __name: "MMapGeoJson",
726
727
  props: {
@@ -736,13 +737,13 @@ var ye = 600, be = /* @__PURE__ */ O({
736
737
  },
737
738
  emits: ["click"],
738
739
  setup(e, { expose: t, emit: n }) {
739
- let r = e, i = n, a = r.id ?? `m3-geojson-${ie()}`, { onReady: o, styleVersion: s } = X(), c = l(["primary", "surface"]), u = (...e) => [
740
+ let r = e, i = n, a = r.id ?? `m3-geojson-${ae()}`, { onReady: o, styleVersion: s } = Z(), c = l(["primary", "surface"]), u = (...e) => [
740
741
  "match",
741
742
  ["geometry-type"],
742
743
  e,
743
744
  !0,
744
745
  !1
745
- ], d = b(() => {
746
+ ], d = w(() => {
746
747
  let { primary: e, surface: t } = c.value;
747
748
  return [
748
749
  {
@@ -775,7 +776,7 @@ var ye = 600, be = /* @__PURE__ */ O({
775
776
  }
776
777
  }
777
778
  ];
778
- }), f = b(() => (r.layers ?? d.value).map((e, t) => ({
779
+ }), f = w(() => (r.layers ?? d.value).map((e, t) => ({
779
780
  ...e,
780
781
  id: e.id ?? `${a}-${t}`,
781
782
  source: a
@@ -796,7 +797,7 @@ var ye = 600, be = /* @__PURE__ */ O({
796
797
  for (let e of f.value) p.addLayer(e, r.before && p.getLayer(r.before) ? r.before : void 0), p.on("click", e.id, h), p.on("mouseenter", e.id, g), p.on("mouseleave", e.id, _), m.push(e.id);
797
798
  }
798
799
  }
799
- function x() {
800
+ function b() {
800
801
  p && (p.getSource(a) || (p.addSource(a, {
801
802
  type: "geojson",
802
803
  data: r.data,
@@ -804,27 +805,223 @@ var ye = 600, be = /* @__PURE__ */ O({
804
805
  }), m = []), m.length && p.getLayer(m[0]) || y());
805
806
  }
806
807
  return o((e) => {
807
- p = e, x();
808
- }), G(s, () => x()), G(() => r.data, (e) => (p?.getSource(a))?.setData(e)), G(() => JSON.stringify(f.value), () => y()), G(() => r.before, () => y()), F(() => {
808
+ p = e, b();
809
+ }), Y(s, () => b()), Y(() => r.data, (e) => (p?.getSource(a))?.setData(e)), Y(() => JSON.stringify(f.value), () => y()), Y(() => r.before, () => y()), ne(() => {
809
810
  p &&= (v(), p.getSource(a) && p.removeSource(a), void 0);
810
811
  }), t({
811
812
  sourceId: a,
812
813
  layerIds: () => [...m]
813
814
  }), (e, t) => null;
814
815
  }
815
- }), ke = { class: "flex min-w-0 flex-1 flex-col" }, Ae = ["aria-label", "aria-pressed"], je = { class: "flex min-w-0 flex-1 flex-col" }, Me = {
816
+ }), Pe = ["aria-label", "onClick"], Fe = /* @__PURE__ */ M({
817
+ inheritAttrs: !1,
818
+ __name: "MMapCluster",
819
+ props: {
820
+ data: {},
821
+ id: {},
822
+ color: { default: "primary" },
823
+ radius: { default: 50 },
824
+ maxZoom: { default: 14 },
825
+ zoomOnClick: {
826
+ type: Boolean,
827
+ default: !0
828
+ },
829
+ pointLayers: {},
830
+ before: {},
831
+ interactive: {
832
+ type: Boolean,
833
+ default: !1
834
+ },
835
+ sourceOptions: {}
836
+ },
837
+ emits: ["click", "cluster-click"],
838
+ setup(e, { expose: t, emit: n }) {
839
+ let r = e, i = n, a = r.id ?? `m3-cluster-${ae()}`, o = s(), { onReady: c, styleVersion: u } = Z(), d = l([
840
+ "primary",
841
+ "secondary",
842
+ "tertiary",
843
+ "surface"
844
+ ]), f = ["!", ["has", "point_count"]], p = w(() => {
845
+ let e = d.value[r.color];
846
+ return (r.pointLayers ?? [{
847
+ type: "circle",
848
+ filter: f,
849
+ paint: {
850
+ "circle-color": e,
851
+ "circle-radius": 6,
852
+ "circle-stroke-color": d.value.surface,
853
+ "circle-stroke-width": 2
854
+ }
855
+ }]).map((e, t) => ({
856
+ ...e,
857
+ id: e.id ?? `${a}-point-${t}`,
858
+ source: a
859
+ }));
860
+ }), m = {
861
+ primary: "bg-primary text-on-primary after:bg-on-primary",
862
+ secondary: "bg-secondary text-on-secondary after:bg-on-secondary",
863
+ tertiary: "bg-tertiary text-on-tertiary after:bg-on-tertiary"
864
+ };
865
+ function h(e) {
866
+ return e < 10 ? 32 : e < 100 ? 40 : e < 1e3 ? 48 : 56;
867
+ }
868
+ let g = w(() => {
869
+ let e = typeof document < "u" && document.documentElement.lang || void 0;
870
+ return new Intl.NumberFormat(e, {
871
+ notation: "compact",
872
+ maximumFractionDigits: 1
873
+ });
874
+ }), _, v, y = [], b = /* @__PURE__ */ new Map(), C = W([]), E = () => _?.getSource(a);
875
+ function k(e, t, n) {
876
+ return {
877
+ id: e,
878
+ count: t,
879
+ lngLat: n,
880
+ zoomIn: async () => {
881
+ let t = await E()?.getClusterExpansionZoom(e);
882
+ t !== void 0 && _ && _.easeTo({
883
+ center: n,
884
+ zoom: Math.min(t, _.getMaxZoom())
885
+ });
886
+ },
887
+ leaves: async (t = Infinity) => await E()?.getClusterLeaves(e, t, 0) ?? []
888
+ };
889
+ }
890
+ function A() {
891
+ if (j = 0, !_ || !v || !_.getSource(a)) return;
892
+ let e = /* @__PURE__ */ new Set();
893
+ for (let t of _.querySourceFeatures(a, { filter: ["has", "point_count"] })) {
894
+ let n = t.properties, r = n.cluster_id;
895
+ if (e.has(r)) continue;
896
+ e.add(r);
897
+ let [i, a] = t.geometry.coordinates, o = b.get(r);
898
+ if (o && o.count === n.point_count) {
899
+ o.marker.setLngLat([i, a]);
900
+ continue;
901
+ }
902
+ o?.marker.remove();
903
+ let s = o?.el ?? document.createElement("div");
904
+ s.className = "m3-map-cluster";
905
+ let c = new v.Marker({
906
+ element: s,
907
+ anchor: "center"
908
+ }).setLngLat([i, a]).addTo(_);
909
+ b.set(r, {
910
+ ...k(r, n.point_count, [i, a]),
911
+ el: s,
912
+ marker: c
913
+ });
914
+ }
915
+ for (let [t, n] of b) e.has(t) || (n.marker.remove(), b.delete(t));
916
+ C.value = [...b.values()];
917
+ }
918
+ let j = 0;
919
+ function M() {
920
+ j ||= requestAnimationFrame(A);
921
+ }
922
+ let N = (e) => {
923
+ e.sourceId === a && M();
924
+ }, P = (e) => i("click", e), ee = () => {
925
+ r.interactive && _ && (_.getCanvas().style.cursor = "pointer");
926
+ }, F = () => {
927
+ r.interactive && _ && (_.getCanvas().style.cursor = "");
928
+ };
929
+ function I() {
930
+ if (_) {
931
+ for (let e of y) _.off("click", e, P), _.off("mouseenter", e, ee), _.off("mouseleave", e, F), _.getLayer(e) && _.removeLayer(e);
932
+ y = [];
933
+ }
934
+ }
935
+ function R() {
936
+ if (_) {
937
+ I();
938
+ for (let e of p.value) _.addLayer(e, r.before && _.getLayer(r.before) ? r.before : void 0), _.on("click", e.id, P), _.on("mouseenter", e.id, ee), _.on("mouseleave", e.id, F), y.push(e.id);
939
+ }
940
+ }
941
+ function re() {
942
+ return {
943
+ type: "geojson",
944
+ data: r.data,
945
+ ...r.sourceOptions,
946
+ cluster: !0,
947
+ clusterRadius: r.radius,
948
+ clusterMaxZoom: r.maxZoom
949
+ };
950
+ }
951
+ function B() {
952
+ _ && (_.getSource(a) || (_.addSource(a, re()), y = []), y.length && _.getLayer(y[0]) || R(), M());
953
+ }
954
+ function ie() {
955
+ _ && (I(), _.getSource(a) && _.removeSource(a), B());
956
+ }
957
+ c((e, t) => {
958
+ _ = e, v = t, B(), _.on("sourcedata", N), _.on("move", M), _.on("moveend", M);
959
+ }), Y(u, () => B()), Y(() => r.data, (e) => {
960
+ E()?.setData(e), M();
961
+ }), Y(() => [
962
+ r.radius,
963
+ r.maxZoom,
964
+ JSON.stringify(r.sourceOptions)
965
+ ].join("|"), ie), Y(() => JSON.stringify(p.value), () => R()), Y(() => r.before, () => R());
966
+ function V(e) {
967
+ let t = {
968
+ id: e.id,
969
+ count: e.count,
970
+ lngLat: e.lngLat,
971
+ zoomIn: e.zoomIn,
972
+ leaves: e.leaves
973
+ };
974
+ i("cluster-click", t), r.zoomOnClick && e.zoomIn();
975
+ }
976
+ let K = (e) => o.mapClusterZoom.replace("{count}", String(e));
977
+ return ne(() => {
978
+ j && cancelAnimationFrame(j);
979
+ for (let e of b.values()) e.marker.remove();
980
+ b.clear(), C.value = [], _ &&= (_.off("sourcedata", N), _.off("move", M), _.off("moveend", M), I(), _.getSource(a) && _.removeSource(a), void 0);
981
+ }), t({
982
+ sourceId: a,
983
+ layerIds: () => [...y],
984
+ clusters: () => C.value.map(({ id: e, count: t, lngLat: n, zoomIn: r, leaves: i }) => ({
985
+ id: e,
986
+ count: t,
987
+ lngLat: n,
988
+ zoomIn: r,
989
+ leaves: i
990
+ }))
991
+ }), (t, n) => (z(!0), D(x, null, H(C.value, (n) => (z(), T(S, {
992
+ key: n.id,
993
+ to: n.el
994
+ }, [U(t.$slots, "cluster", {
995
+ id: n.id,
996
+ count: n.count,
997
+ label: g.value.format(n.count),
998
+ lngLat: n.lngLat,
999
+ zoomIn: n.zoomIn,
1000
+ leaves: n.leaves
1001
+ }, () => [O("button", {
1002
+ type: "button",
1003
+ class: L(["m3-map-cluster__bubble relative grid cursor-pointer place-items-center rounded-full border-2 border-surface text-label-large font-medium shadow-elevation-1 outline-none transition-[transform,box-shadow] duration-150 after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:opacity-0 after:transition-opacity hover:shadow-elevation-2 hover:after:opacity-8 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-secondary active:after:opacity-10", m[e.color]]),
1004
+ style: te({
1005
+ width: `${h(n.count)}px`,
1006
+ height: `${h(n.count)}px`
1007
+ }),
1008
+ "aria-label": K(n.count),
1009
+ onClick: se((e) => V(n), ["stop"])
1010
+ }, G(g.value.format(n.count)), 15, Pe)])], 8, ["to"]))), 128));
1011
+ }
1012
+ }), Ie = { class: "flex min-w-0 flex-1 flex-col" }, Le = ["aria-label", "aria-pressed"], Re = { class: "flex min-w-0 flex-1 flex-col" }, ze = {
816
1013
  key: 0,
817
1014
  class: "truncate text-label-small text-on-surface-variant"
818
- }, Ne = {
1015
+ }, Be = {
819
1016
  key: 0,
820
1017
  class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
821
- }, Pe = { class: "min-h-0 overflow-hidden" }, Fe = { class: "flex flex-col gap-3 px-3 pb-3" }, Ie = {
1018
+ }, Ve = { class: "min-h-0 overflow-hidden" }, He = { class: "flex flex-col gap-3 px-3 pb-3" }, Ue = {
822
1019
  key: 0,
823
1020
  class: "text-body-small text-on-surface-variant"
824
- }, Le = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, Re = ["src"], ze = {
1021
+ }, We = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, Ge = ["src"], Ke = {
825
1022
  key: 2,
826
1023
  class: "flex flex-wrap items-center gap-2"
827
- }, Be = ["href"], Ve = /* @__PURE__ */ O({
1024
+ }, qe = ["href"], Je = /* @__PURE__ */ M({
828
1025
  __name: "_MMapLayerItem",
829
1026
  props: {
830
1027
  layer: {},
@@ -832,80 +1029,80 @@ var ye = 600, be = /* @__PURE__ */ O({
832
1029
  },
833
1030
  emits: ["toggle-expanded"],
834
1031
  setup(t, { emit: n }) {
835
- let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } = Z();
836
- return (n, s) => (I(), C("div", { class: N(["flex overflow-hidden rounded-2xl bg-surface-container", U(a)(t.layer.id) ? "" : "opacity-75"]) }, [w("div", { class: N(["w-1 shrink-0 transition-colors duration-200", U(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), w("div", ke, [w("div", {
1032
+ let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } = Q();
1033
+ return (n, s) => (z(), D("div", { class: L(["flex overflow-hidden rounded-2xl bg-surface-container", q(a)(t.layer.id) ? "" : "opacity-75"]) }, [O("div", { class: L(["w-1 shrink-0 transition-colors duration-200", q(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), O("div", Ie, [O("div", {
837
1034
  class: "flex cursor-pointer items-center gap-2 px-3 py-2",
838
1035
  onClick: s[1] ||= (e) => r("toggle-expanded")
839
1036
  }, [
840
- w("button", {
1037
+ O("button", {
841
1038
  type: "button",
842
- class: N(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", U(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
843
- "aria-label": U(a)(t.layer.id) ? U(i).mapHideLayer : U(i).mapShowLayer,
844
- "aria-pressed": U(a)(t.layer.id),
845
- onClick: s[0] ||= q((e) => U(o)(t.layer.id), ["stop"])
846
- }, [D(e, {
847
- name: U(a)(t.layer.id) ? "visibility" : "visibility_off",
1039
+ class: L(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", q(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
1040
+ "aria-label": q(a)(t.layer.id) ? q(i).mapHideLayer : q(i).mapShowLayer,
1041
+ "aria-pressed": q(a)(t.layer.id),
1042
+ onClick: s[0] ||= se((e) => q(o)(t.layer.id), ["stop"])
1043
+ }, [j(e, {
1044
+ name: q(a)(t.layer.id) ? "visibility" : "visibility_off",
848
1045
  size: 18
849
- }, null, 8, ["name"])], 10, Ae),
850
- w("div", je, [w("span", { class: N(["truncate text-body-medium", U(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, H(t.layer.title), 3), t.layer.description && !t.expanded ? (I(), C("span", Me, H(t.layer.description), 1)) : S("", !0)]),
851
- U(a)(t.layer.id) && U(c)(t.layer.id) < 1 ? (I(), C("span", Ne, H(Math.round(U(c)(t.layer.id) * 100)) + "% ", 1)) : S("", !0),
852
- D(e, {
1046
+ }, null, 8, ["name"])], 10, Le),
1047
+ O("div", Re, [O("span", { class: L(["truncate text-body-medium", q(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, G(t.layer.title), 3), t.layer.description && !t.expanded ? (z(), D("span", ze, G(t.layer.description), 1)) : E("", !0)]),
1048
+ q(a)(t.layer.id) && q(c)(t.layer.id) < 1 ? (z(), D("span", Be, G(Math.round(q(c)(t.layer.id) * 100)) + "% ", 1)) : E("", !0),
1049
+ j(e, {
853
1050
  name: "expand_more",
854
1051
  size: 18,
855
- class: N(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
1052
+ class: L(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
856
1053
  }, null, 8, ["class"])
857
- ]), w("div", {
1054
+ ]), O("div", {
858
1055
  class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
859
- style: P({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
860
- }, [w("div", Pe, [w("div", Fe, [
861
- t.layer.description ? (I(), C("p", Ie, H(t.layer.description), 1)) : S("", !0),
862
- w("div", Le, [D(e, {
1056
+ style: te({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
1057
+ }, [O("div", Ve, [O("div", He, [
1058
+ t.layer.description ? (z(), D("p", Ue, G(t.layer.description), 1)) : E("", !0),
1059
+ O("div", We, [j(e, {
863
1060
  name: "opacity",
864
1061
  size: 16,
865
1062
  class: "shrink-0 text-on-surface-variant"
866
- }), D(d, {
867
- "model-value": U(c)(t.layer.id),
1063
+ }), j(d, {
1064
+ "model-value": q(c)(t.layer.id),
868
1065
  min: 0,
869
1066
  max: 1,
870
1067
  step: .01,
871
- label: U(i).mapOpacity,
1068
+ label: q(i).mapOpacity,
872
1069
  class: "flex-1",
873
- "onUpdate:modelValue": s[2] ||= (e) => U(l)(t.layer.id, Number(e))
1070
+ "onUpdate:modelValue": s[2] ||= (e) => q(l)(t.layer.id, Number(e))
874
1071
  }, null, 8, ["model-value", "label"])]),
875
- t.layer.legend ? (I(), C("img", {
1072
+ t.layer.legend ? (z(), D("img", {
876
1073
  key: 1,
877
1074
  src: t.layer.legend,
878
1075
  alt: "",
879
1076
  class: "max-w-full self-start",
880
1077
  loading: "lazy"
881
- }, null, 8, Re)) : S("", !0),
882
- t.layer.download || n.$slots.actions ? (I(), C("div", ze, [t.layer.download ? (I(), C("a", {
1078
+ }, null, 8, Ge)) : E("", !0),
1079
+ t.layer.download || n.$slots.actions ? (z(), D("div", Ke, [t.layer.download ? (z(), D("a", {
883
1080
  key: 0,
884
1081
  href: t.layer.download,
885
1082
  target: "_blank",
886
1083
  rel: "noopener",
887
1084
  download: "",
888
1085
  class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
889
- }, [D(e, {
1086
+ }, [j(e, {
890
1087
  name: "download",
891
1088
  size: 18
892
- }), E(" " + H(U(i).mapDownload), 1)], 8, Be)) : S("", !0), B(n.$slots, "actions", {
1089
+ }), A(" " + G(q(i).mapDownload), 1)], 8, qe)) : E("", !0), U(n.$slots, "actions", {
893
1090
  layer: t.layer,
894
- visible: U(a)(t.layer.id)
895
- })])) : S("", !0)
1091
+ visible: q(a)(t.layer.id)
1092
+ })])) : E("", !0)
896
1093
  ])])], 4)])], 2));
897
1094
  }
898
- }), He = { class: "flex flex-col gap-3" }, Ue = ["onClick"], We = [
1095
+ }), Ye = { class: "flex flex-col gap-3" }, Xe = ["onClick"], Ze = [
899
1096
  "aria-label",
900
1097
  "aria-pressed",
901
1098
  "onClick"
902
- ], Ge = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, Ke = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, qe = {
1099
+ ], Qe = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, $e = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, et = {
903
1100
  key: 1,
904
1101
  class: "flex flex-col gap-1.5"
905
- }, Je = {
1102
+ }, tt = {
906
1103
  key: 2,
907
1104
  class: "flex flex-col items-center gap-3 py-8"
908
- }, Ye = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, Xe = { class: "text-body-medium text-on-surface-variant" }, Ze = /* @__PURE__ */ O({
1105
+ }, nt = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, rt = { class: "text-body-medium text-on-surface-variant" }, it = /* @__PURE__ */ M({
909
1106
  __name: "MMapLayers",
910
1107
  props: {
911
1108
  search: {
@@ -919,103 +1116,98 @@ var ye = 600, be = /* @__PURE__ */ O({
919
1116
  map: {}
920
1117
  },
921
1118
  setup(t) {
922
- let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } = Z(() => n.map), d = R(""), f = (e) => !d.value || e.title.toLowerCase().includes(d.value.toLowerCase()), p = b(() => (i.value?.groups ?? []).map((e) => ({
1119
+ let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } = Q(() => n.map), d = V(""), f = (e) => !d.value || e.title.toLowerCase().includes(d.value.toLowerCase()), p = w(() => (i.value?.groups ?? []).map((e) => ({
923
1120
  ...e,
924
1121
  all: a(e.name),
925
1122
  layers: a(e.name).filter(f)
926
- })).filter((e) => e.layers.length)), m = b(() => a(null).filter(f)), h = R(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
1123
+ })).filter((e) => e.layers.length)), m = w(() => a(null).filter(f)), h = V(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
927
1124
  function _(e) {
928
1125
  let t = new Set(h.value);
929
1126
  t.delete(e) || t.add(e), h.value = t;
930
1127
  }
931
- let y = R(/* @__PURE__ */ new Set());
932
- function E(e) {
933
- let t = new Set(y.value);
934
- t.delete(e) || t.add(e), y.value = t;
1128
+ let v = V(/* @__PURE__ */ new Set());
1129
+ function y(e) {
1130
+ let t = new Set(v.value);
1131
+ t.delete(e) || t.add(e), v.value = t;
935
1132
  }
936
- let O = (e) => e.filter((e) => o(e.id)).length;
937
- return (n, i) => (I(), C("div", He, [
938
- t.search ? (I(), x(u, {
1133
+ let b = (e) => e.filter((e) => o(e.id)).length;
1134
+ return (n, i) => (z(), D("div", Ye, [
1135
+ t.search ? (z(), T(u, {
939
1136
  key: 0,
940
1137
  modelValue: d.value,
941
1138
  "onUpdate:modelValue": i[0] ||= (e) => d.value = e,
942
- label: U(r).mapSearchLayers,
1139
+ label: q(r).mapSearchLayers,
943
1140
  "leading-icon": "search",
944
1141
  variant: "outlined",
945
1142
  clearable: ""
946
- }, null, 8, ["modelValue", "label"])) : S("", !0),
947
- (I(!0), C(v, null, z(p.value, (t) => (I(), C("section", {
1143
+ }, null, 8, ["modelValue", "label"])) : E("", !0),
1144
+ (z(!0), D(x, null, H(p.value, (t) => (z(), D("section", {
948
1145
  key: t.name,
949
1146
  class: "flex flex-col"
950
- }, [w("div", {
1147
+ }, [O("div", {
951
1148
  class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
952
1149
  onClick: (e) => _(t.name)
953
1150
  }, [
954
- w("button", {
1151
+ O("button", {
955
1152
  type: "button",
956
- class: N(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", U(c)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : U(c)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
957
- "aria-label": U(c)(t.name) === "hidden" ? U(r).mapShowLayer : U(r).mapHideLayer,
958
- "aria-pressed": U(c)(t.name) !== "hidden",
959
- onClick: q((e) => U(l)(t.name, U(c)(t.name) !== "visible"), ["stop"])
960
- }, [D(e, {
961
- name: U(c)(t.name) === "hidden" ? "visibility_off" : "visibility",
1153
+ class: L(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", q(c)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : q(c)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
1154
+ "aria-label": q(c)(t.name) === "hidden" ? q(r).mapShowLayer : q(r).mapHideLayer,
1155
+ "aria-pressed": q(c)(t.name) !== "hidden",
1156
+ onClick: se((e) => q(l)(t.name, q(c)(t.name) !== "visible"), ["stop"])
1157
+ }, [j(e, {
1158
+ name: q(c)(t.name) === "hidden" ? "visibility_off" : "visibility",
962
1159
  size: 18
963
- }, null, 8, ["name"])], 10, We),
964
- w("span", Ge, H(t.title), 1),
965
- w("span", Ke, H(O(t.all)) + "/" + H(t.all.length), 1),
966
- D(e, {
1160
+ }, null, 8, ["name"])], 10, Ze),
1161
+ O("span", Qe, G(t.title), 1),
1162
+ O("span", $e, G(b(t.all)) + "/" + G(t.all.length), 1),
1163
+ j(e, {
967
1164
  name: "expand_more",
968
1165
  size: 18,
969
- class: N(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
1166
+ class: L(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
970
1167
  }, null, 8, ["class"])
971
- ], 8, Ue), w("div", {
1168
+ ], 8, Xe), O("div", {
972
1169
  class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
973
- style: P({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
974
- }, [w("div", { class: N(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(I(!0), C(v, null, z(t.layers, (e) => (I(), x(Ve, {
1170
+ style: te({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
1171
+ }, [O("div", { class: L(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(z(!0), D(x, null, H(t.layers, (e) => (z(), T(Je, {
975
1172
  key: e.id,
976
1173
  layer: e,
977
- expanded: y.value.has(e.id),
978
- onToggleExpanded: (t) => E(e.id)
979
- }, T({ _: 2 }, [n.$slots.actions ? {
1174
+ expanded: v.value.has(e.id),
1175
+ onToggleExpanded: (t) => y(e.id)
1176
+ }, k({ _: 2 }, [n.$slots.actions ? {
980
1177
  name: "actions",
981
- fn: K((e) => [B(n.$slots, "actions", M({ ref_for: !0 }, e))]),
1178
+ fn: X((e) => [U(n.$slots, "actions", F({ ref_for: !0 }, e))]),
982
1179
  key: "0"
983
1180
  } : void 0]), 1032, [
984
1181
  "layer",
985
1182
  "expanded",
986
1183
  "onToggleExpanded"
987
1184
  ]))), 128))], 2)], 4)]))), 128)),
988
- m.value.length ? (I(), C("div", qe, [(I(!0), C(v, null, z(m.value, (e) => (I(), x(Ve, {
1185
+ m.value.length ? (z(), D("div", et, [(z(!0), D(x, null, H(m.value, (e) => (z(), T(Je, {
989
1186
  key: e.id,
990
1187
  layer: e,
991
- expanded: y.value.has(e.id),
992
- onToggleExpanded: (t) => E(e.id)
993
- }, T({ _: 2 }, [n.$slots.actions ? {
1188
+ expanded: v.value.has(e.id),
1189
+ onToggleExpanded: (t) => y(e.id)
1190
+ }, k({ _: 2 }, [n.$slots.actions ? {
994
1191
  name: "actions",
995
- fn: K((e) => [B(n.$slots, "actions", M({ ref_for: !0 }, e))]),
1192
+ fn: X((e) => [U(n.$slots, "actions", F({ ref_for: !0 }, e))]),
996
1193
  key: "0"
997
1194
  } : void 0]), 1032, [
998
1195
  "layer",
999
1196
  "expanded",
1000
1197
  "onToggleExpanded"
1001
- ]))), 128))])) : S("", !0),
1002
- !p.value.length && !m.value.length ? (I(), C("div", Je, [w("div", Ye, [D(e, {
1198
+ ]))), 128))])) : E("", !0),
1199
+ !p.value.length && !m.value.length ? (z(), D("div", tt, [O("div", nt, [j(e, {
1003
1200
  name: "layers_clear",
1004
1201
  size: 28,
1005
1202
  class: "text-on-surface-variant"
1006
- })]), w("p", Xe, H(U(r).mapNoLayers), 1)])) : S("", !0)
1203
+ })]), O("p", rt, G(q(r).mapNoLayers), 1)])) : E("", !0)
1007
1204
  ]));
1008
1205
  }
1009
- }), Qe = [
1010
- "title",
1206
+ }), at = [
1011
1207
  "aria-label",
1012
1208
  "aria-checked",
1013
1209
  "onClick"
1014
- ], $e = ["src"], et = [
1015
- "title",
1016
- "aria-label",
1017
- "aria-checked"
1018
- ], tt = /* @__PURE__ */ O({
1210
+ ], ot = ["src"], st = ["aria-label", "aria-checked"], ct = /* @__PURE__ */ M({
1019
1211
  __name: "MMapBaseLayers",
1020
1212
  props: {
1021
1213
  imageBase: { default: "" },
@@ -1030,95 +1222,112 @@ var ye = 600, be = /* @__PURE__ */ O({
1030
1222
  map: {}
1031
1223
  },
1032
1224
  setup(t) {
1033
- let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = Z(() => n.map), c = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
1034
- return (n, s) => (I(), C("div", {
1035
- class: N(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
1225
+ let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = Q(() => n.map), c = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
1226
+ return (n, s) => (z(), D("div", {
1227
+ class: L(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
1036
1228
  role: "radiogroup"
1037
- }, [(I(!0), C(v, null, z(U(i), (n) => (I(), C("button", {
1229
+ }, [(z(!0), D(x, null, H(q(i), (n) => (z(), T(f, {
1038
1230
  key: n.id,
1039
- type: "button",
1040
- role: "radio",
1041
- class: N(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center overflow-hidden rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", U(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
1042
- title: n.title,
1043
- "aria-label": n.title,
1044
- "aria-checked": U(a) === n.id,
1045
- onClick: (e) => U(o)(n.id)
1046
- }, [n.base?.image ? (I(), C("img", {
1047
- key: 0,
1048
- src: c(n.base.image, t.imageBase),
1049
- alt: "",
1050
- class: "size-full object-cover"
1051
- }, null, 8, $e)) : (I(), x(e, {
1052
- key: 1,
1053
- name: "map",
1054
- size: 22,
1055
- class: "text-on-surface-variant"
1056
- }))], 10, Qe))), 128)), t.none ? (I(), C("button", {
1231
+ text: n.title,
1232
+ placement: t.vertical ? "right" : "top"
1233
+ }, {
1234
+ default: X(() => [O("button", {
1235
+ type: "button",
1236
+ role: "radio",
1237
+ class: L(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center overflow-hidden rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", q(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
1238
+ "aria-label": n.title,
1239
+ "aria-checked": q(a) === n.id,
1240
+ onClick: (e) => q(o)(n.id)
1241
+ }, [n.base?.image ? (z(), D("img", {
1242
+ key: 0,
1243
+ src: c(n.base.image, t.imageBase),
1244
+ alt: "",
1245
+ class: "size-full object-cover"
1246
+ }, null, 8, ot)) : (z(), T(e, {
1247
+ key: 1,
1248
+ name: "map",
1249
+ size: 22,
1250
+ class: "text-on-surface-variant"
1251
+ }))], 10, at)]),
1252
+ _: 2
1253
+ }, 1032, ["text", "placement"]))), 128)), t.none ? (z(), T(f, {
1057
1254
  key: 0,
1058
- type: "button",
1059
- role: "radio",
1060
- class: N(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", U(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
1061
- title: U(r).mapNoBaseLayer,
1062
- "aria-label": U(r).mapNoBaseLayer,
1063
- "aria-checked": U(a) === null,
1064
- onClick: s[0] ||= (e) => U(o)(null)
1065
- }, [D(e, {
1066
- name: "layers_clear",
1067
- size: 22,
1068
- class: "text-on-surface-variant"
1069
- })], 10, et)) : S("", !0)], 2));
1255
+ text: q(r).mapNoBaseLayer,
1256
+ placement: t.vertical ? "right" : "top"
1257
+ }, {
1258
+ default: X(() => [O("button", {
1259
+ type: "button",
1260
+ role: "radio",
1261
+ class: L(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", q(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
1262
+ "aria-label": q(r).mapNoBaseLayer,
1263
+ "aria-checked": q(a) === null,
1264
+ onClick: s[0] ||= (e) => q(o)(null)
1265
+ }, [j(e, {
1266
+ name: "layers_clear",
1267
+ size: 22,
1268
+ class: "text-on-surface-variant"
1269
+ })], 10, st)]),
1270
+ _: 1
1271
+ }, 8, ["text", "placement"])) : E("", !0)], 2));
1070
1272
  }
1071
- }), nt = { class: "flex flex-col gap-2" }, rt = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, it = { class: "text-label-large text-on-primary-container" }, at = { class: "flex flex-col px-4 py-1" }, ot = { class: "text-label-small text-on-surface-variant" }, st = { class: "text-body-medium text-on-surface" }, ct = {
1273
+ }), lt = { class: "flex flex-col gap-2" }, ut = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, dt = { class: "text-label-large text-on-primary-container" }, ft = { class: "flex flex-col px-4 py-1" }, pt = { class: "text-label-small text-on-surface-variant" }, mt = { class: "text-body-medium text-on-surface" }, ht = {
1072
1274
  key: 0,
1073
1275
  class: "break-words"
1074
- }, lt = {
1276
+ }, gt = {
1075
1277
  key: 1,
1076
1278
  class: "text-body-small italic text-on-surface-variant"
1077
- }, ut = /* @__PURE__ */ O({
1279
+ }, _t = /* @__PURE__ */ M({
1078
1280
  __name: "MMapFeatureInfo",
1079
1281
  props: { results: {} },
1080
1282
  setup(t) {
1081
1283
  let n = s();
1082
- return (r, i) => (I(), C("div", nt, [(I(!0), C(v, null, z(t.results, (t, i) => (I(), C("div", {
1284
+ return (r, i) => (z(), D("div", lt, [(z(!0), D(x, null, H(t.results, (t, i) => (z(), D("div", {
1083
1285
  key: i,
1084
1286
  class: "overflow-hidden rounded-2xl bg-surface-container"
1085
- }, [w("div", rt, [D(e, {
1287
+ }, [O("div", ut, [j(e, {
1086
1288
  name: "layers",
1087
1289
  size: 16,
1088
1290
  class: "text-on-primary-container"
1089
- }), w("span", it, H(t.layer.title), 1)]), w("dl", at, [(I(!0), C(v, null, z(t.fields, (e) => (I(), C("div", {
1291
+ }), O("span", dt, G(t.layer.title), 1)]), O("dl", ft, [(z(!0), D(x, null, H(t.fields, (e) => (z(), D("div", {
1090
1292
  key: e.key,
1091
1293
  class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
1092
- }, [w("dt", ot, H(e.label), 1), w("dd", st, [B(r.$slots, "value", {
1294
+ }, [O("dt", pt, G(e.label), 1), O("dd", mt, [U(r.$slots, "value", {
1093
1295
  field: e,
1094
1296
  result: t
1095
- }, () => [e.value ? (I(), C("span", ct, H(e.value), 1)) : (I(), C("span", lt, H(U(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
1297
+ }, () => [e.value ? (z(), D("span", ht, G(e.value), 1)) : (z(), D("span", gt, G(q(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
1096
1298
  }
1097
- }), dt = (e) => e.metadata, ft = /* @__PURE__ */ new Set([
1299
+ }), vt = (e) => e.metadata, yt = /* @__PURE__ */ new Set([
1098
1300
  "fill",
1099
1301
  "line",
1100
1302
  "circle",
1101
1303
  "symbol",
1102
1304
  "fill-extrusion",
1103
1305
  "heatmap"
1104
- ]), pt = (e) => ({
1105
- title: e.name,
1106
- groups: [],
1107
- layers: e.layers.filter((e) => e.type !== "background").map((e) => ({
1108
- id: e.id,
1109
- title: dt(e)?.title ?? e.id,
1110
- listed: !0,
1111
- children: [],
1112
- identify: ft.has(e.type) ? {
1113
- format: {},
1114
- exclude: []
1115
- } : !1,
1116
- hover: !1
1117
- }))
1118
- });
1119
- function mt(e = {}) {
1306
+ ]), bt = (e) => {
1307
+ let t = e.layers.filter((e) => e.type !== "background"), n = (e) => e?.base === !0 || typeof e?.base == "object" && e.base !== null ? e : void 0, r = (e) => Array.isArray(e?.children) ? e.children : [], i = new Set(t.flatMap((e) => n(vt(e)) ? r(vt(e)) : []));
1308
+ return {
1309
+ title: e.name,
1310
+ groups: [],
1311
+ layers: t.map((e) => {
1312
+ let t = vt(e), a = n(t);
1313
+ return {
1314
+ id: e.id,
1315
+ title: t?.title ?? e.id,
1316
+ listed: !a && !i.has(e.id) && t?.listed !== !1,
1317
+ base: a ? { image: t.base.image ?? t.image } : void 0,
1318
+ children: r(t),
1319
+ identify: yt.has(e.type) && !a && !i.has(e.id) ? {
1320
+ format: {},
1321
+ exclude: []
1322
+ } : !1,
1323
+ hover: !1
1324
+ };
1325
+ })
1326
+ };
1327
+ };
1328
+ function xt(e = {}) {
1120
1329
  let t = e.legend ?? ((e, t) => {
1121
- let n = dt(e)?.legend;
1330
+ let n = vt(e)?.legend;
1122
1331
  if (n?.show === !1) return;
1123
1332
  if (n?.wmslegend) return n.wmslegend;
1124
1333
  if (!t?.includes("/services/styles/")) return;
@@ -1134,7 +1343,7 @@ function mt(e = {}) {
1134
1343
  title: e.alias ?? e.name
1135
1344
  })),
1136
1345
  layers: e.layers.filter((e) => e.type !== "background").map((e) => {
1137
- let r = dt(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
1346
+ let r = vt(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
1138
1347
  delete i.exclude;
1139
1348
  let o = {};
1140
1349
  for (let [e, t] of Object.entries(i)) o[e] = {
@@ -1171,10 +1380,10 @@ function mt(e = {}) {
1171
1380
  };
1172
1381
  };
1173
1382
  }
1174
- function ht(e, t) {
1383
+ function St(e, t) {
1175
1384
  return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
1176
1385
  }
1177
- function gt(e, t) {
1386
+ function Ct(e, t) {
1178
1387
  if (e == null || String(e).trim() === "") return "";
1179
1388
  let n = String(e), r = typeof e == "number" ? e : Number(e);
1180
1389
  if (t?.mask && !Number.isNaN(r)) {
@@ -1187,23 +1396,23 @@ function gt(e, t) {
1187
1396
  }
1188
1397
  return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
1189
1398
  }
1190
- var _t = /* @__PURE__ */ new Set([
1399
+ var wt = /* @__PURE__ */ new Set([
1191
1400
  "coordinates",
1192
1401
  "mapCoordinates",
1193
1402
  "layerId",
1194
1403
  "__layerMetadata"
1195
1404
  ]);
1196
- function vt(e, t, n) {
1405
+ function Tt(e, t, n) {
1197
1406
  let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
1198
1407
  if (!r.size) return [];
1199
1408
  let i = [];
1200
1409
  for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
1201
1410
  let e = r.get(n.layer.id);
1202
1411
  if (!e || !e.identify) continue;
1203
- let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !_t.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
1412
+ let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !wt.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
1204
1413
  key: e,
1205
- label: ht(e, t[e]),
1206
- value: gt(n, t[e])
1414
+ label: St(e, t[e]),
1415
+ value: Ct(n, t[e])
1207
1416
  }));
1208
1417
  o.length && i.push({
1209
1418
  layer: e,
@@ -1214,7 +1423,7 @@ function vt(e, t, n) {
1214
1423
  return i;
1215
1424
  }
1216
1425
  // src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
1217
- var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1426
+ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
1218
1427
  inheritAttrs: !1,
1219
1428
  __name: "MMapIdentify",
1220
1429
  props: {
@@ -1233,16 +1442,16 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1233
1442
  },
1234
1443
  emits: ["identify"],
1235
1444
  setup(e, { expose: t, emit: n }) {
1236
- let r = e, i = n, { on: a, onReady: o, activeTool: s } = X(), { model: c } = Z(), l = V([]), u = R([0, 0]), d = R(!1);
1445
+ let r = e, i = n, { on: a, onReady: o, activeTool: s } = Z(), { model: c } = Q(), l = W([]), u = V([0, 0]), d = V(!1);
1237
1446
  a("click", (e) => {
1238
1447
  if (!r.enabled || s.value) return;
1239
1448
  let t = e.target;
1240
- l.value = vt(t, e.point, c.value), u.value = [e.lngLat.lng, e.lngLat.lat], d.value = l.value.length > 0, i("identify", l.value, u.value);
1449
+ l.value = Tt(t, e.point, c.value), u.value = [e.lngLat.lng, e.lngLat.lat], d.value = l.value.length > 0, i("identify", l.value, u.value);
1241
1450
  });
1242
1451
  function f() {
1243
1452
  d.value = !1;
1244
1453
  }
1245
- G(() => r.enabled, (e) => {
1454
+ Y(() => r.enabled, (e) => {
1246
1455
  e || f();
1247
1456
  });
1248
1457
  let p, m = [], h = () => {
@@ -1259,38 +1468,38 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1259
1468
  }
1260
1469
  return o((e) => {
1261
1470
  p = e, _();
1262
- }), G(c, _), F(() => {
1471
+ }), Y(c, _), ne(() => {
1263
1472
  m.forEach((e) => {
1264
1473
  p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
1265
1474
  });
1266
- }), t({ close: f }), (t, n) => (I(), C("div", yt, [e.marker && d.value ? (I(), x(Te, {
1475
+ }), t({ close: f }), (t, n) => (z(), D("div", Et, [e.marker && d.value ? (z(), T(Ae, {
1267
1476
  key: 0,
1268
1477
  "lng-lat": u.value
1269
- }, null, 8, ["lng-lat"])) : S("", !0), e.popup && l.value.length ? (I(), x(De, {
1478
+ }, null, 8, ["lng-lat"])) : E("", !0), e.popup && l.value.length ? (z(), T(Me, {
1270
1479
  key: 1,
1271
1480
  open: d.value,
1272
1481
  "onUpdate:open": n[0] ||= (e) => d.value = e,
1273
1482
  "lng-lat": u.value,
1274
1483
  "max-width": "360px",
1275
- offset: e.marker ? U(Ce) : void 0
1484
+ offset: e.marker ? q(Oe) : void 0
1276
1485
  }, {
1277
- default: K(() => [w("div", M({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [B(t.$slots, "default", {
1486
+ default: X(() => [O("div", F({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [U(t.$slots, "default", {
1278
1487
  results: l.value,
1279
1488
  lngLat: u.value,
1280
1489
  close: f
1281
- }, () => [D(ut, { results: l.value }, null, 8, ["results"])])], 16)]),
1490
+ }, () => [j(_t, { results: l.value }, null, 8, ["results"])])], 16)]),
1282
1491
  _: 3
1283
1492
  }, 8, [
1284
1493
  "open",
1285
1494
  "lng-lat",
1286
1495
  "offset"
1287
- ])) : S("", !0)]));
1496
+ ])) : E("", !0)]));
1288
1497
  }
1289
- }), xt = { class: "hidden" }, St = [
1498
+ }), Ot = { class: "hidden" }, kt = [
1290
1499
  "title",
1291
1500
  "aria-label",
1292
1501
  "aria-pressed"
1293
- ], Ct = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, wt = { class: "flex flex-col" }, Tt = { class: "text-label-small text-on-surface-variant" }, Et = { class: "text-body-small text-on-surface" }, Dt = /* @__PURE__ */ O({
1502
+ ], At = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, jt = { class: "flex flex-col" }, Mt = { class: "text-label-small text-on-surface-variant" }, Nt = { class: "text-body-small text-on-surface" }, Pt = /* @__PURE__ */ M({
1294
1503
  __name: "MMapHover",
1295
1504
  props: {
1296
1505
  modelValue: {
@@ -1304,7 +1513,7 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1304
1513
  },
1305
1514
  emits: ["update:modelValue"],
1306
1515
  setup(t, { emit: n }) {
1307
- let r = t, i = n, a = s(), { onReady: o } = X(), { model: c } = Z(), l = b(() => (c.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), u = V(null), d = R([0, 0]), f = R(!1), p, m = [];
1516
+ let r = t, i = n, a = s(), { onReady: o } = Z(), { model: c } = Q(), l = w(() => (c.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), u = W(null), d = V([0, 0]), f = V(!1), p, m = [];
1308
1517
  function h(e) {
1309
1518
  let t = e.features?.[0], n = l.value.find((e) => e.id === t?.layer.id);
1310
1519
  if (!t || !n || !n.hover) return;
@@ -1313,8 +1522,8 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1313
1522
  layer: n,
1314
1523
  fields: n.hover.fields.map((e) => ({
1315
1524
  key: e.key,
1316
- label: ht(e.key, e),
1317
- value: gt(r[e.key], e)
1525
+ label: St(e.key, e),
1526
+ value: Ct(r[e.key], e)
1318
1527
  })).filter((e) => e.value)
1319
1528
  }, d.value = [e.lngLat.lng, e.lngLat.lat], f.value = !0;
1320
1529
  }
@@ -1331,27 +1540,27 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1331
1540
  }
1332
1541
  o((e) => {
1333
1542
  p = e, _();
1334
- }), G([() => r.modelValue, l], _), F(() => {
1543
+ }), Y([() => r.modelValue, l], _), ne(() => {
1335
1544
  for (let e of m) p?.off("mousemove", e, h), p?.off("mouseleave", e, g);
1336
1545
  });
1337
- let y = b(() => r.control === !0 ? "top-right" : r.control || "top-right");
1338
- return (n, r) => (I(), C("div", xt, [t.control && l.value.length ? (I(), x(ue, {
1546
+ let v = w(() => r.control === !0 ? "top-right" : r.control || "top-right");
1547
+ return (n, r) => (z(), D("div", Ot, [t.control && l.value.length ? (z(), T(he, {
1339
1548
  key: 0,
1340
- position: y.value
1549
+ position: v.value
1341
1550
  }, {
1342
- default: K(() => [w("button", {
1551
+ default: X(() => [O("button", {
1343
1552
  type: "button",
1344
1553
  class: "grid place-items-center",
1345
- title: U(a).mapHoverInfo,
1346
- "aria-label": U(a).mapHoverInfo,
1554
+ title: q(a).mapHoverInfo,
1555
+ "aria-label": q(a).mapHoverInfo,
1347
1556
  "aria-pressed": t.modelValue,
1348
1557
  onClick: r[0] ||= (e) => i("update:modelValue", !t.modelValue)
1349
- }, [D(e, {
1558
+ }, [j(e, {
1350
1559
  name: "ads_click",
1351
1560
  size: 20
1352
- })], 8, St)]),
1561
+ })], 8, kt)]),
1353
1562
  _: 1
1354
- }, 8, ["position"])) : S("", !0), u.value ? (I(), x(De, {
1563
+ }, 8, ["position"])) : E("", !0), u.value ? (z(), T(Me, {
1355
1564
  key: 1,
1356
1565
  open: f.value,
1357
1566
  "onUpdate:open": r[1] ||= (e) => f.value = e,
@@ -1362,48 +1571,48 @@ var yt = { class: "hidden" }, bt = /* @__PURE__ */ O({
1362
1571
  "max-width": "280px",
1363
1572
  class: "m3-map-hover"
1364
1573
  }, {
1365
- default: K(() => [w("p", Ct, H(u.value.layer.title), 1), w("dl", wt, [(I(!0), C(v, null, z(u.value.fields, (e) => (I(), C("div", {
1574
+ default: X(() => [O("p", At, G(u.value.layer.title), 1), O("dl", jt, [(z(!0), D(x, null, H(u.value.fields, (e) => (z(), D("div", {
1366
1575
  key: e.key,
1367
1576
  class: "border-b border-outline-variant py-1 last:border-b-0"
1368
- }, [w("dt", Tt, H(e.label), 1), w("dd", Et, H(e.value), 1)]))), 128))])]),
1577
+ }, [O("dt", Mt, G(e.label), 1), O("dd", Nt, G(e.value), 1)]))), 128))])]),
1369
1578
  _: 1
1370
- }, 8, ["open", "lng-lat"])) : S("", !0)]));
1579
+ }, 8, ["open", "lng-lat"])) : E("", !0)]));
1371
1580
  }
1372
- }), Ot = 6371008.8, $ = Math.PI / 180;
1373
- function kt(e, t) {
1374
- let n = (t[1] - e[1]) * $, r = (t[0] - e[0]) * $, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * $) * Math.cos(t[1] * $) * Math.sin(r / 2) ** 2;
1375
- return 2 * Ot * Math.asin(Math.min(1, Math.sqrt(i)));
1581
+ }), Ft = 6371008.8, It = Math.PI / 180;
1582
+ function Lt(e, t) {
1583
+ let n = (t[1] - e[1]) * It, r = (t[0] - e[0]) * It, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * It) * Math.cos(t[1] * It) * Math.sin(r / 2) ** 2;
1584
+ return 2 * Ft * Math.asin(Math.min(1, Math.sqrt(i)));
1376
1585
  }
1377
- function At(e) {
1586
+ function Rt(e) {
1378
1587
  let t = 0;
1379
- for (let n = 1; n < e.length; n++) t += kt(e[n - 1], e[n]);
1588
+ for (let n = 1; n < e.length; n++) t += Lt(e[n - 1], e[n]);
1380
1589
  return t;
1381
1590
  }
1382
- function jt(e, t) {
1591
+ function zt(e, t) {
1383
1592
  let [n, r, i, a] = [
1384
- e[0] * $,
1385
- e[1] * $,
1386
- t[0] * $,
1387
- t[1] * $
1593
+ e[0] * It,
1594
+ e[1] * It,
1595
+ t[0] * It,
1596
+ t[1] * It
1388
1597
  ], o = Math.cos(a) * Math.cos(i - n), s = Math.cos(a) * Math.sin(i - n), c = Math.atan2(Math.sin(r) + Math.sin(a), Math.sqrt((Math.cos(r) + o) ** 2 + s ** 2));
1389
- return [(n + Math.atan2(s, Math.cos(r) + o)) / $, c / $];
1598
+ return [(n + Math.atan2(s, Math.cos(r) + o)) / It, c / It];
1390
1599
  }
1391
- function Mt(e) {
1392
- let t = Nt(e), n = t.length - 1;
1600
+ function Bt(e) {
1601
+ let t = Vt(e), n = t.length - 1;
1393
1602
  if (n <= 2) return 0;
1394
1603
  let r = 0;
1395
1604
  for (let e = 0; e < n; e++) {
1396
1605
  let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
1397
- r += (o[0] - i[0]) * $ * Math.sin(a[1] * $);
1606
+ r += (o[0] - i[0]) * It * Math.sin(a[1] * It);
1398
1607
  }
1399
- return Math.abs(r * Ot * Ot / 2);
1608
+ return Math.abs(r * Ft * Ft / 2);
1400
1609
  }
1401
- function Nt(e) {
1610
+ function Vt(e) {
1402
1611
  let t = e[0], n = e[e.length - 1];
1403
1612
  return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
1404
1613
  }
1405
- function Pt(e) {
1406
- let t = Nt(e), n = 0, r = 0, i = 0;
1614
+ function Ht(e) {
1615
+ let t = Vt(e), n = 0, r = 0, i = 0;
1407
1616
  for (let e = 0; e < t.length - 1; e++) {
1408
1617
  let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
1409
1618
  n += l, r += (a + s) * l, i += (o + c) * l;
@@ -1415,11 +1624,11 @@ function Pt(e) {
1415
1624
  return [r / (3 * n), i / (3 * n)];
1416
1625
  }
1417
1626
  // src/components/MMapMeasure.vue?vue&type=script&setup=true&lang.ts
1418
- var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "aria-pressed"], Rt = ["title", "disabled"], zt = [
1627
+ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "aria-pressed"], Kt = ["title", "disabled"], qt = [
1419
1628
  "aria-label",
1420
1629
  "title",
1421
1630
  "onClick"
1422
- ], Bt = /* @__PURE__ */ O({
1631
+ ], Jt = /* @__PURE__ */ M({
1423
1632
  __name: "MMapMeasure",
1424
1633
  props: {
1425
1634
  modelValue: { default: null },
@@ -1430,14 +1639,14 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1430
1639
  },
1431
1640
  emits: ["update:modelValue", "change"],
1432
1641
  setup(t, { expose: n, emit: r }) {
1433
- let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = X(), p = l(["primary", "surface"]), m = `m3-measure-${ie()}`, h = {
1434
- done: `${m}-done`,
1435
- draft: `${m}-draft`,
1436
- handles: `${m}-handles`
1437
- }, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, y = [], T = [], O = null, k = !1, A = null, j = 0, M, P = R(null), ee = R(0), te = V([]), ne = () => typeof document < "u" && document.documentElement.lang || void 0, L = (e, t) => new Intl.NumberFormat(ne(), {
1642
+ let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = Z(), f = l(["primary", "surface"]), p = `m3-measure-${ae()}`, h = {
1643
+ done: `${p}-done`,
1644
+ draft: `${p}-draft`,
1645
+ handles: `${p}-handles`
1646
+ }, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [], b = null, S = !1, C = null, k = 0, M, N = V(null), P = V(0), ee = W([]), F = () => typeof document < "u" && document.documentElement.lang || void 0, I = (e, t) => new Intl.NumberFormat(F(), {
1438
1647
  minimumFractionDigits: t,
1439
1648
  maximumFractionDigits: t
1440
- }).format(e), B = (e) => e === 0 ? "" : e < 1e3 ? `${L(Math.round(e), 0)} m` : `${L(e / 1e3, 2)} km`, re = (e) => e >= 1e6 ? `${L(e / 1e6, 2)} km²` : e >= 1e4 ? `${L(e / 1e4, 2)} ha` : `${L(Math.round(e), 0)} m²`, W = (e, t = {}) => ({
1649
+ }).format(e), te = (e) => e === 0 ? "" : e < 1e3 ? `${I(Math.round(e), 0)} m` : `${I(e / 1e3, 2)} km`, R = (e) => e >= 1e6 ? `${I(e / 1e6, 2)} km²` : e >= 1e4 ? `${I(e / 1e4, 2)} ha` : `${I(Math.round(e), 0)} m²`, re = (e, t = {}) => ({
1441
1650
  type: "Feature",
1442
1651
  geometry: {
1443
1652
  type: "Point",
@@ -1445,8 +1654,8 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1445
1654
  },
1446
1655
  properties: t
1447
1656
  });
1448
- function ae(e, t, n, r) {
1449
- let i = e.map((e) => W(e)), a = [];
1657
+ function B(e, t, n, r) {
1658
+ let i = e.map((e) => re(e)), a = [];
1450
1659
  if (e.length < 2) return {
1451
1660
  features: i,
1452
1661
  labels: a
@@ -1461,10 +1670,10 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1461
1670
  });
1462
1671
  let s = (e) => {
1463
1672
  for (let t = 0; t < e.length - 1; t++) {
1464
- let r = B(kt(e[t], e[t + 1]));
1673
+ let r = te(Lt(e[t], e[t + 1]));
1465
1674
  r && a.push({
1466
1675
  key: `${n}-s${t}`,
1467
- at: jt(e[t], e[t + 1]),
1676
+ at: zt(e[t], e[t + 1]),
1468
1677
  text: r,
1469
1678
  kind: "segment"
1470
1679
  });
@@ -1473,12 +1682,12 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1473
1682
  if (t === "distance") s(e), a.push({
1474
1683
  key: `${n}-t`,
1475
1684
  at: e[e.length - 1],
1476
- text: `${o.mapTotal}: ${B(At(e))}`,
1685
+ text: `${o.mapTotal}: ${te(Rt(e))}`,
1477
1686
  kind: "total",
1478
1687
  m: r
1479
1688
  });
1480
1689
  else if (e.length >= 3) {
1481
- let t = Nt(e);
1690
+ let t = Vt(e);
1482
1691
  i.push({
1483
1692
  type: "Feature",
1484
1693
  geometry: {
@@ -1488,15 +1697,15 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1488
1697
  properties: {}
1489
1698
  }), s(t), a.push({
1490
1699
  key: `${n}-a`,
1491
- at: Pt(t),
1492
- text: re(Mt(t)),
1700
+ at: Ht(t),
1701
+ text: R(Bt(t)),
1493
1702
  kind: "area",
1494
1703
  m: r
1495
1704
  });
1496
1705
  } else a.push({
1497
1706
  key: `${n}-t`,
1498
1707
  at: e[e.length - 1],
1499
- text: B(At(e)),
1708
+ text: te(Rt(e)),
1500
1709
  kind: "total",
1501
1710
  m: r
1502
1711
  });
@@ -1505,47 +1714,47 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1505
1714
  labels: a
1506
1715
  };
1507
1716
  }
1508
- let oe = (e) => ({
1717
+ let ie = (e) => ({
1509
1718
  type: "FeatureCollection",
1510
1719
  features: e
1511
- }), se = (e, t) => (M?.getSource(e))?.setData(oe(t));
1512
- function J() {
1720
+ }), U = (e, t) => (M?.getSource(e))?.setData(ie(t));
1721
+ function K() {
1513
1722
  if (!M) return;
1514
- let e = y.map((e, t) => ae(e.points, e.mode, `m${t}`, t)), t = P.value && T.length ? ae(O ? [...T, O] : T, P.value, "draft") : {
1723
+ let e = v.map((e, t) => B(e.points, e.mode, `m${t}`, t)), t = N.value && y.length ? B(b ? [...y, b] : y, N.value, "draft") : {
1515
1724
  features: [],
1516
1725
  labels: []
1517
1726
  };
1518
- se(h.done, e.flatMap((e) => e.features)), se(h.draft, t.features);
1727
+ U(h.done, e.flatMap((e) => e.features)), U(h.draft, t.features);
1519
1728
  let n = [];
1520
- P.value || y.forEach((e, t) => {
1521
- (e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(W(e, {
1729
+ N.value || v.forEach((e, t) => {
1730
+ (e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(re(e, {
1522
1731
  handle: "vertex",
1523
1732
  m: t,
1524
1733
  v: r
1525
1734
  })));
1526
- for (let r = 0; r < e.points.length - 1; r++) n.push(W(jt(e.points[r], e.points[r + 1]), {
1735
+ for (let r = 0; r < e.points.length - 1; r++) n.push(re(zt(e.points[r], e.points[r + 1]), {
1527
1736
  handle: "midpoint",
1528
1737
  m: t,
1529
1738
  after: r
1530
1739
  }));
1531
- }), se(h.handles, n), te.value = [...e.flatMap((e) => e.labels), ...t.labels];
1740
+ }), U(h.handles, n), ee.value = [...e.flatMap((e) => e.labels), ...t.labels];
1532
1741
  }
1533
- function Y() {
1534
- ee.value = y.length, a("change", y.map((e) => ({
1742
+ function J() {
1743
+ P.value = v.length, a("change", v.map((e) => ({
1535
1744
  mode: e.mode,
1536
1745
  points: e.points.map((e) => [...e]),
1537
1746
  closed: e.closed,
1538
- length: At(e.points),
1539
- ...e.mode === "area" || e.closed ? { area: Mt(e.points) } : {}
1747
+ length: Rt(e.points),
1748
+ ...e.mode === "area" || e.closed ? { area: Bt(e.points) } : {}
1540
1749
  })));
1541
1750
  }
1542
- let ce = (e) => [
1751
+ let oe = (e) => [
1543
1752
  "==",
1544
1753
  ["geometry-type"],
1545
1754
  e
1546
1755
  ];
1547
- function le() {
1548
- let { primary: e, surface: t } = p.value;
1756
+ function ce() {
1757
+ let { primary: e, surface: t } = f.value;
1549
1758
  return {
1550
1759
  fill: { "fill-color": e },
1551
1760
  line: { "line-color": e },
@@ -1555,20 +1764,20 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1555
1764
  }
1556
1765
  };
1557
1766
  }
1558
- function de() {
1767
+ function le() {
1559
1768
  if (!M) return;
1560
1769
  for (let e of Object.values(h)) M.getSource(e) || M.addSource(e, {
1561
1770
  type: "geojson",
1562
- data: oe([])
1771
+ data: ie([])
1563
1772
  });
1564
- let e = le(), t = (e) => {
1773
+ let e = ce(), t = (e) => {
1565
1774
  M.getLayer(e.id) || M.addLayer(e);
1566
1775
  };
1567
1776
  for (let [n, r] of [[h.done, !1], [h.draft, !0]]) t({
1568
1777
  id: `${n}-fill`,
1569
1778
  type: "fill",
1570
1779
  source: n,
1571
- filter: ce("Polygon"),
1780
+ filter: oe("Polygon"),
1572
1781
  paint: {
1573
1782
  ...e.fill,
1574
1783
  "fill-opacity": r ? .15 : .2
@@ -1591,7 +1800,7 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1591
1800
  id: `${n}-points`,
1592
1801
  type: "circle",
1593
1802
  source: n,
1594
- filter: ce("Point"),
1803
+ filter: oe("Point"),
1595
1804
  paint: {
1596
1805
  ...e.vertices,
1597
1806
  "circle-radius": 5,
@@ -1629,47 +1838,47 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1629
1838
  }
1630
1839
  });
1631
1840
  }
1632
- G(p, () => {
1841
+ Y(f, () => {
1633
1842
  if (!M) return;
1634
- let e = le(), t = (e, t) => {
1843
+ let e = ce(), t = (e, t) => {
1635
1844
  if (M.getLayer(e)) for (let [n, r] of Object.entries(t)) M.setPaintProperty(e, n, r);
1636
1845
  };
1637
1846
  for (let n of [h.done, h.draft]) t(`${n}-fill`, e.fill), t(`${n}-line`, e.line), t(`${n}-points`, e.vertices);
1638
1847
  t(_, e.vertices), t(g, e.vertices);
1639
1848
  });
1640
- let fe = (e) => [e.lngLat.lng, e.lngLat.lat];
1641
- function pe(e) {
1642
- if (T.length >= 2) {
1643
- let t = M.project(T[0]);
1849
+ let ue = (e) => [e.lngLat.lng, e.lngLat.lat];
1850
+ function de(e) {
1851
+ if (y.length >= 2) {
1852
+ let t = M.project(y[0]);
1644
1853
  if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) {
1645
- k = !0, Q();
1854
+ S = !0, Q();
1646
1855
  return;
1647
1856
  }
1648
1857
  }
1649
- T.push(fe(e)), J();
1858
+ y.push(ue(e)), K();
1650
1859
  }
1651
- function me(e) {
1652
- O = fe(e), j ||= requestAnimationFrame(() => {
1653
- j = 0, J();
1860
+ function fe(e) {
1861
+ b = ue(e), k ||= requestAnimationFrame(() => {
1862
+ k = 0, K();
1654
1863
  });
1655
1864
  }
1656
- function he(e) {
1657
- if (e.preventDefault(), T.length < 2) return;
1658
- let t = M.project(T[T.length - 1]), n = M.project(T[T.length - 2]);
1659
- Math.hypot(t.x - n.x, t.y - n.y) < 10 && T.pop(), Q();
1865
+ function pe(e) {
1866
+ if (e.preventDefault(), y.length < 2) return;
1867
+ let t = M.project(y[y.length - 1]), n = M.project(y[y.length - 2]);
1868
+ Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(), Q();
1660
1869
  }
1661
- function ge(e) {
1870
+ function me(e) {
1662
1871
  e.key === "Enter" && Q();
1663
1872
  }
1664
- f(() => !!P.value, () => Q(!0));
1665
- let Z = () => typeof navigator < "u" ? navigator.keyboard : void 0, _e = !1;
1873
+ m(() => !!N.value, () => Q(!0));
1874
+ let ge = () => typeof navigator < "u" ? navigator.keyboard : void 0, _e = !1;
1666
1875
  function ve() {
1667
- P.value && document.fullscreenElement && Z()?.lock && Z().lock(["Escape"]).then(() => {
1876
+ N.value && document.fullscreenElement && ge()?.lock && ge().lock(["Escape"]).then(() => {
1668
1877
  _e = !0;
1669
1878
  }, () => {});
1670
1879
  }
1671
1880
  function ye() {
1672
- P.value || (_e && Z()?.unlock?.(), _e = !1);
1881
+ N.value || (_e && ge()?.unlock?.(), _e = !1);
1673
1882
  }
1674
1883
  function be() {
1675
1884
  let e, t = () => {
@@ -1681,69 +1890,69 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1681
1890
  }
1682
1891
  function xe(e) {
1683
1892
  if (M) {
1684
- if (P.value === e) return Q();
1685
- P.value && Q(), P.value = e, d.value = "measure", T = [], O = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", pe), M.on("mousemove", me), M.on("dblclick", he), document.addEventListener("keydown", ge), document.addEventListener("fullscreenchange", ve), ve(), J(), i.modelValue !== e && a("update:modelValue", e);
1893
+ if (N.value === e) return Q();
1894
+ N.value && Q(), N.value = e, d.value = "measure", y = [], b = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", de), M.on("mousemove", fe), M.on("dblclick", pe), document.addEventListener("keydown", me), document.addEventListener("fullscreenchange", ve), ve(), K(), i.modelValue !== e && a("update:modelValue", e);
1686
1895
  }
1687
1896
  }
1688
1897
  function Q(e = !1) {
1689
- if (!M || !P.value) return;
1690
- cancelAnimationFrame(j), j = 0;
1691
- let t = T.length >= 3 && (k || P.value === "area");
1692
- T.length >= 2 && y.push({
1693
- mode: P.value,
1694
- points: t ? [...T, [...T[0]]] : T,
1898
+ if (!M || !N.value) return;
1899
+ cancelAnimationFrame(k), k = 0;
1900
+ let t = y.length >= 3 && (S || N.value === "area");
1901
+ y.length >= 2 && v.push({
1902
+ mode: N.value,
1903
+ points: t ? [...y, [...y[0]]] : y,
1695
1904
  closed: t
1696
- }), T = [], O = null, k = !1, P.value = null, d.value === "measure" && (d.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", pe), M.off("mousemove", me), M.off("dblclick", he), document.removeEventListener("keydown", ge), document.removeEventListener("fullscreenchange", ve), e && _e ? be() : ye(), J(), Y(), i.modelValue !== null && a("update:modelValue", null);
1905
+ }), y = [], b = null, S = !1, N.value = null, d.value === "measure" && (d.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", de), M.off("mousemove", fe), M.off("dblclick", pe), document.removeEventListener("keydown", me), document.removeEventListener("fullscreenchange", ve), e && _e ? be() : ye(), K(), J(), i.modelValue !== null && a("update:modelValue", null);
1697
1906
  }
1698
1907
  function Se(e) {
1699
- y[e] && (y.splice(e, 1), J(), Y());
1908
+ v[e] && (v.splice(e, 1), K(), J());
1700
1909
  }
1701
1910
  function Ce() {
1702
- P.value && Q(), y.length = 0, J(), Y();
1911
+ N.value && Q(), v.length = 0, K(), J();
1703
1912
  }
1704
- function we(e) {
1913
+ function $(e) {
1705
1914
  let t = e.features?.[0];
1706
- if (!t || P.value || !M) return;
1915
+ if (!t || N.value || !M) return;
1707
1916
  e.preventDefault();
1708
- let n = t.properties.m, r = y[n];
1917
+ let n = t.properties.m, r = v[n];
1709
1918
  if (!r) return;
1710
1919
  let i = t.properties.v;
1711
- t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, fe(e))), A = {
1920
+ t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, ue(e))), C = {
1712
1921
  m: n,
1713
1922
  v: i
1714
1923
  }, d.value = "measure", M.getCanvas().style.cursor = "grabbing";
1715
1924
  let a = e.type === "touchstart";
1716
- a && M.dragPan.disable(), M.on(a ? "touchmove" : "mousemove", Ee), M.once(a ? "touchend" : "mouseup", De), J();
1925
+ a && M.dragPan.disable(), M.on(a ? "touchmove" : "mousemove", we), M.once(a ? "touchend" : "mouseup", Te), K();
1717
1926
  }
1718
- function Ee(e) {
1719
- if (!A) return;
1720
- let t = y[A.m];
1927
+ function we(e) {
1928
+ if (!C) return;
1929
+ let t = v[C.m];
1721
1930
  if (!t) return;
1722
- let n = fe(e);
1723
- t.points[A.v] = n, t.closed && A.v === 0 && (t.points[t.points.length - 1] = n), J();
1931
+ let n = ue(e);
1932
+ t.points[C.v] = n, t.closed && C.v === 0 && (t.points[t.points.length - 1] = n), K();
1724
1933
  }
1725
- function De() {
1726
- M && (A = null, M.off("mousemove", Ee), M.off("touchmove", Ee), M.dragPan.enable(), M.getCanvas().style.cursor = "", Y(), setTimeout(() => {
1727
- d.value === "measure" && !P.value && (d.value = null);
1934
+ function Te() {
1935
+ M && (C = null, M.off("mousemove", we), M.off("touchmove", we), M.dragPan.enable(), M.getCanvas().style.cursor = "", J(), setTimeout(() => {
1936
+ d.value === "measure" && !N.value && (d.value = null);
1728
1937
  }));
1729
1938
  }
1730
- let Oe = () => {
1731
- M && !A && !P.value && (M.getCanvas().style.cursor = "grab");
1732
- }, ke = () => {
1733
- M && !A && !P.value && (M.getCanvas().style.cursor = "");
1939
+ let Ee = () => {
1940
+ M && !C && !N.value && (M.getCanvas().style.cursor = "grab");
1941
+ }, De = () => {
1942
+ M && !C && !N.value && (M.getCanvas().style.cursor = "");
1734
1943
  };
1735
1944
  c((e) => {
1736
- M = e, de();
1737
- for (let t of [g, _]) e.on("mousedown", t, we), e.on("touchstart", t, we), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
1945
+ M = e, le();
1946
+ for (let t of [g, _]) e.on("mousedown", t, $), e.on("touchstart", t, $), e.on("mouseenter", t, Ee), e.on("mouseleave", t, De);
1738
1947
  i.modelValue && xe(i.modelValue);
1739
- }), G(u, () => {
1740
- de(), J();
1741
- }), G(() => i.modelValue, (e) => {
1742
- e && e !== P.value ? xe(e) : !e && P.value && Q();
1743
- }), F(() => {
1948
+ }), Y(u, () => {
1949
+ le(), K();
1950
+ }), Y(() => i.modelValue, (e) => {
1951
+ e && e !== N.value ? xe(e) : !e && N.value && Q();
1952
+ }), ne(() => {
1744
1953
  if (!M) return;
1745
- P.value && Q();
1746
- for (let e of [g, _]) M.off("mousedown", e, we), M.off("touchstart", e, we), M.off("mouseenter", e, Oe), M.off("mouseleave", e, ke);
1954
+ N.value && Q();
1955
+ for (let e of [g, _]) M.off("mousedown", e, $), M.off("touchstart", e, $), M.off("mouseenter", e, Ee), M.off("mouseleave", e, De);
1747
1956
  let e = [
1748
1957
  g,
1749
1958
  _,
@@ -1756,71 +1965,71 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1756
1965
  for (let t of e) M.getLayer(t) && M.removeLayer(t);
1757
1966
  for (let e of Object.values(h)) M.getSource(e) && M.removeSource(e);
1758
1967
  });
1759
- let Ae = b(() => i.control === !0 ? "top-right" : i.control || "top-right");
1968
+ let Oe = w(() => i.control === !0 ? "top-right" : i.control || "top-right");
1760
1969
  return n({
1761
1970
  start: xe,
1762
1971
  finish: Q,
1763
1972
  clear: Ce,
1764
1973
  remove: Se
1765
- }), (n, r) => (I(), C("div", Ft, [t.control ? (I(), x(ue, {
1974
+ }), (n, r) => (z(), D("div", Ut, [t.control ? (z(), T(he, {
1766
1975
  key: 0,
1767
- position: Ae.value
1976
+ position: Oe.value
1768
1977
  }, {
1769
- default: K(() => [
1770
- w("button", {
1978
+ default: X(() => [
1979
+ O("button", {
1771
1980
  type: "button",
1772
1981
  class: "grid place-items-center",
1773
- title: U(o).mapMeasureDistance,
1774
- "aria-pressed": P.value === "distance",
1982
+ title: q(o).mapMeasureDistance,
1983
+ "aria-pressed": N.value === "distance",
1775
1984
  onClick: r[0] ||= (e) => xe("distance")
1776
- }, [D(e, {
1985
+ }, [j(e, {
1777
1986
  name: "straighten",
1778
1987
  size: 20
1779
- })], 8, It),
1780
- w("button", {
1988
+ })], 8, Wt),
1989
+ O("button", {
1781
1990
  type: "button",
1782
1991
  class: "grid place-items-center",
1783
- title: U(o).mapMeasureArea,
1784
- "aria-pressed": P.value === "area",
1992
+ title: q(o).mapMeasureArea,
1993
+ "aria-pressed": N.value === "area",
1785
1994
  onClick: r[1] ||= (e) => xe("area")
1786
- }, [D(e, {
1787
- name: "pentagon",
1995
+ }, [j(e, {
1996
+ name: "square_foot",
1788
1997
  size: 20
1789
- })], 8, Lt),
1790
- w("button", {
1998
+ })], 8, Gt),
1999
+ O("button", {
1791
2000
  type: "button",
1792
2001
  class: "grid place-items-center",
1793
- title: U(o).mapClearMeasurements,
1794
- disabled: !ee.value && !P.value,
2002
+ title: q(o).mapClearMeasurements,
2003
+ disabled: !P.value && !N.value,
1795
2004
  onClick: Ce
1796
- }, [D(e, {
2005
+ }, [j(e, {
1797
2006
  name: "delete",
1798
2007
  size: 20
1799
- })], 8, Rt)
2008
+ })], 8, Kt)
1800
2009
  ]),
1801
2010
  _: 1
1802
- }, 8, ["position"])) : S("", !0), (I(!0), C(v, null, z(te.value, (t) => (I(), x(Te, {
2011
+ }, 8, ["position"])) : E("", !0), (z(!0), D(x, null, H(ee.value, (t) => (z(), T(Ae, {
1803
2012
  key: t.key,
1804
2013
  "lng-lat": t.at,
1805
2014
  anchor: t.kind === "area" ? "center" : "top",
1806
2015
  offset: t.kind === "area" ? [0, 0] : [0, 8],
1807
2016
  class: "pointer-events-none"
1808
2017
  }, {
1809
- default: K(() => [w("span", { class: N(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [t.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", t.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [E(H(t.text) + " ", 1), t.m === void 0 ? S("", !0) : (I(), C("button", {
2018
+ default: X(() => [O("span", { class: L(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [t.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", t.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [A(G(t.text) + " ", 1), t.m === void 0 ? E("", !0) : (z(), D("button", {
1810
2019
  key: 0,
1811
2020
  type: "button",
1812
2021
  class: "pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/12 focus-visible:outline-2 focus-visible:outline-on-primary",
1813
- "aria-label": U(o).mapDeleteMeasurement,
1814
- title: U(o).mapDeleteMeasurement,
1815
- onClick: q((e) => Se(t.m), ["stop"]),
1816
- onPointerdown: r[2] ||= q(() => {}, ["stop"]),
1817
- onMousedown: r[3] ||= q(() => {}, ["stop"]),
1818
- onTouchstart: r[4] ||= q(() => {}, ["stop"]),
1819
- onDblclick: r[5] ||= q(() => {}, ["stop"])
1820
- }, [D(e, {
2022
+ "aria-label": q(o).mapDeleteMeasurement,
2023
+ title: q(o).mapDeleteMeasurement,
2024
+ onClick: se((e) => Se(t.m), ["stop"]),
2025
+ onPointerdown: r[2] ||= se(() => {}, ["stop"]),
2026
+ onMousedown: r[3] ||= se(() => {}, ["stop"]),
2027
+ onTouchstart: r[4] ||= se(() => {}, ["stop"]),
2028
+ onDblclick: r[5] ||= se(() => {}, ["stop"])
2029
+ }, [j(e, {
1821
2030
  name: "close",
1822
2031
  size: 14
1823
- })], 40, zt))], 2)]),
2032
+ })], 40, qt))], 2)]),
1824
2033
  _: 2
1825
2034
  }, 1032, [
1826
2035
  "lng-lat",
@@ -1828,15 +2037,502 @@ var Ft = { class: "hidden" }, It = ["title", "aria-pressed"], Lt = ["title", "ar
1828
2037
  "offset"
1829
2038
  ]))), 128))]));
1830
2039
  }
1831
- }), Vt = /* @__PURE__ */ new WeakMap();
1832
- function Ht(e) {
1833
- let t = Y(e);
2040
+ }), Yt = { class: "hidden" }, Xt = [
2041
+ "title",
2042
+ "aria-label",
2043
+ "aria-pressed",
2044
+ "onClick"
2045
+ ], Zt = [
2046
+ "title",
2047
+ "aria-label",
2048
+ "disabled"
2049
+ ], Qt = "draw", $t = 6, en = /* @__PURE__ */ M({
2050
+ __name: "MMapDraw",
2051
+ props: {
2052
+ modelValue: {},
2053
+ mode: { default: null },
2054
+ modes: { default: () => [
2055
+ "point",
2056
+ "line",
2057
+ "polygon"
2058
+ ] },
2059
+ control: {
2060
+ type: [Boolean, String],
2061
+ default: !0
2062
+ },
2063
+ color: { default: "primary" },
2064
+ editable: {
2065
+ type: Boolean,
2066
+ default: !0
2067
+ }
2068
+ },
2069
+ emits: [
2070
+ "update:modelValue",
2071
+ "update:mode",
2072
+ "select"
2073
+ ],
2074
+ setup(t, { expose: n, emit: r }) {
2075
+ let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = Z(), f = l([
2076
+ "primary",
2077
+ "secondary",
2078
+ "tertiary",
2079
+ "surface"
2080
+ ]), p = `m3-draw-${ae()}`, h = {
2081
+ shapes: `${p}-shapes`,
2082
+ draft: `${p}-draft`,
2083
+ handles: `${p}-handles`
2084
+ }, g = [
2085
+ `${h.shapes}-fill`,
2086
+ `${h.shapes}-line`,
2087
+ `${h.shapes}-point`
2088
+ ], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = "", S = 1, C = [], O = null, k = null, A = 0, M, N = V(null), P = V(null), ee = (e) => JSON.parse(JSON.stringify(e)), F = (e) => e === null ? void 0 : y.find((t) => t.id === e);
2089
+ function I(e) {
2090
+ y = ee(e?.features ?? []);
2091
+ for (let e of y) (e.id === void 0 || e.id === null) && (e.id = Q());
2092
+ P.value !== null && !F(P.value) && (P.value = null);
2093
+ }
2094
+ function L() {
2095
+ let e = {
2096
+ type: "FeatureCollection",
2097
+ features: ee(y)
2098
+ };
2099
+ b = JSON.stringify(e.features), a("update:modelValue", e);
2100
+ }
2101
+ function te(e) {
2102
+ let t = e.geometry;
2103
+ return t.type === "Point" ? [t.coordinates] : t.type === "LineString" ? t.coordinates : t.type === "Polygon" ? (t.coordinates[0] ?? []).slice(0, -1) : null;
2104
+ }
2105
+ function R(e, t) {
2106
+ let n = e.geometry;
2107
+ if (n.type === "Point") n.coordinates = t[0];
2108
+ else if (n.type === "LineString") n.coordinates = t;
2109
+ else if (n.type === "Polygon") {
2110
+ let e = n.coordinates;
2111
+ e[0] = [...t, [...t[0]]];
2112
+ }
2113
+ }
2114
+ let re = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1, B = (e, t = {}) => ({
2115
+ type: "Feature",
2116
+ geometry: {
2117
+ type: "Point",
2118
+ coordinates: e
2119
+ },
2120
+ properties: t
2121
+ }), ie = (e) => ({
2122
+ type: "FeatureCollection",
2123
+ features: e
2124
+ }), U = (e, t) => (M?.getSource(e))?.setData(ie(t));
2125
+ function W() {
2126
+ if (!M) return;
2127
+ U(h.shapes, y.map((e) => ({
2128
+ type: "Feature",
2129
+ geometry: e.geometry,
2130
+ properties: {
2131
+ ...e.properties,
2132
+ __draw_id: String(e.id),
2133
+ __draw_selected: e.id === P.value
2134
+ }
2135
+ })));
2136
+ let e = [];
2137
+ if (N.value && N.value !== "point" && C.length) {
2138
+ let t = O ? [...C, O] : C;
2139
+ C.forEach((t) => e.push(B(t))), t.length >= 2 && e.push({
2140
+ type: "Feature",
2141
+ geometry: {
2142
+ type: "LineString",
2143
+ coordinates: N.value === "polygon" && t.length >= 3 ? [...t, t[0]] : t
2144
+ },
2145
+ properties: {}
2146
+ }), N.value === "polygon" && t.length >= 3 && e.push({
2147
+ type: "Feature",
2148
+ geometry: {
2149
+ type: "Polygon",
2150
+ coordinates: [[...t, t[0]]]
2151
+ },
2152
+ properties: {}
2153
+ });
2154
+ }
2155
+ U(h.draft, e);
2156
+ let t = [], n = F(P.value), r = n && !N.value && i.editable ? te(n) : null;
2157
+ if (n && r && (r.forEach((e, n) => t.push(B(e, {
2158
+ handle: "vertex",
2159
+ v: n
2160
+ }))), n.geometry.type !== "Point")) {
2161
+ let e = n.geometry.type === "Polygon" ? [...r, r[0]] : r;
2162
+ for (let n = 0; n < e.length - 1; n++) t.push(B(zt(e[n], e[n + 1]), {
2163
+ handle: "midpoint",
2164
+ after: n
2165
+ }));
2166
+ }
2167
+ U(h.handles, t);
2168
+ }
2169
+ function G() {
2170
+ A ||= requestAnimationFrame(() => {
2171
+ A = 0, W();
2172
+ });
2173
+ }
2174
+ let K = (...e) => [
2175
+ "match",
2176
+ ["geometry-type"],
2177
+ e,
2178
+ !0,
2179
+ !1
2180
+ ], J = [
2181
+ "==",
2182
+ ["get", "__draw_selected"],
2183
+ !0
2184
+ ];
2185
+ function oe() {
2186
+ let e = f.value[i.color], t = f.value.surface;
2187
+ return {
2188
+ fill: {
2189
+ "fill-color": e,
2190
+ "fill-opacity": [
2191
+ "case",
2192
+ J,
2193
+ .3,
2194
+ .18
2195
+ ]
2196
+ },
2197
+ line: {
2198
+ "line-color": e,
2199
+ "line-width": [
2200
+ "case",
2201
+ J,
2202
+ 4,
2203
+ 2.5
2204
+ ]
2205
+ },
2206
+ point: {
2207
+ "circle-color": e,
2208
+ "circle-radius": [
2209
+ "case",
2210
+ J,
2211
+ 8,
2212
+ 6
2213
+ ],
2214
+ "circle-stroke-color": t,
2215
+ "circle-stroke-width": 2
2216
+ },
2217
+ draftFill: {
2218
+ "fill-color": e,
2219
+ "fill-opacity": .12
2220
+ },
2221
+ draftLine: { "line-color": e },
2222
+ handle: {
2223
+ "circle-color": t,
2224
+ "circle-stroke-color": e
2225
+ }
2226
+ };
2227
+ }
2228
+ function se() {
2229
+ if (!M) return;
2230
+ for (let e of Object.values(h)) M.getSource(e) || M.addSource(e, {
2231
+ type: "geojson",
2232
+ data: ie([])
2233
+ });
2234
+ let e = oe(), t = (e) => {
2235
+ M.getLayer(e.id) || M.addLayer(e);
2236
+ };
2237
+ t({
2238
+ id: g[0],
2239
+ type: "fill",
2240
+ source: h.shapes,
2241
+ filter: K("Polygon", "MultiPolygon"),
2242
+ paint: e.fill
2243
+ }), t({
2244
+ id: g[1],
2245
+ type: "line",
2246
+ source: h.shapes,
2247
+ filter: K("LineString", "MultiLineString", "Polygon", "MultiPolygon"),
2248
+ paint: e.line
2249
+ }), t({
2250
+ id: g[2],
2251
+ type: "circle",
2252
+ source: h.shapes,
2253
+ filter: K("Point", "MultiPoint"),
2254
+ paint: e.point
2255
+ }), t({
2256
+ id: `${h.draft}-fill`,
2257
+ type: "fill",
2258
+ source: h.draft,
2259
+ filter: K("Polygon"),
2260
+ paint: e.draftFill
2261
+ }), t({
2262
+ id: `${h.draft}-line`,
2263
+ type: "line",
2264
+ source: h.draft,
2265
+ filter: K("LineString"),
2266
+ paint: {
2267
+ ...e.draftLine,
2268
+ "line-width": 2.5,
2269
+ "line-dasharray": [2, 2]
2270
+ }
2271
+ }), t({
2272
+ id: `${h.draft}-point`,
2273
+ type: "circle",
2274
+ source: h.draft,
2275
+ filter: K("Point"),
2276
+ paint: {
2277
+ ...e.handle,
2278
+ "circle-radius": 5,
2279
+ "circle-stroke-width": 2
2280
+ }
2281
+ }), t({
2282
+ id: v,
2283
+ type: "circle",
2284
+ source: h.handles,
2285
+ filter: [
2286
+ "==",
2287
+ ["get", "handle"],
2288
+ "midpoint"
2289
+ ],
2290
+ paint: {
2291
+ ...e.handle,
2292
+ "circle-radius": 4,
2293
+ "circle-stroke-width": 1.5,
2294
+ "circle-opacity": .7
2295
+ }
2296
+ }), t({
2297
+ id: _,
2298
+ type: "circle",
2299
+ source: h.handles,
2300
+ filter: [
2301
+ "==",
2302
+ ["get", "handle"],
2303
+ "vertex"
2304
+ ],
2305
+ paint: {
2306
+ ...e.handle,
2307
+ "circle-radius": 7,
2308
+ "circle-stroke-width": 2.5
2309
+ }
2310
+ });
2311
+ }
2312
+ Y([f, () => i.color], () => {
2313
+ if (!M) return;
2314
+ let e = oe(), t = (e, t) => {
2315
+ if (M.getLayer(e)) for (let [n, r] of Object.entries(t)) M.setPaintProperty(e, n, r);
2316
+ };
2317
+ t(g[0], e.fill), t(g[1], e.line), t(g[2], e.point), t(`${h.draft}-fill`, e.draftFill), t(`${h.draft}-line`, e.draftLine), t(`${h.draft}-point`, e.handle), t(v, e.handle), t(_, e.handle);
2318
+ });
2319
+ function ce(e) {
2320
+ if (e !== null && !F(e) && (e = null), P.value === e) return;
2321
+ P.value = e, W();
2322
+ let t = F(e);
2323
+ a("select", t ? ee(t) : null);
2324
+ }
2325
+ function le(e = P.value) {
2326
+ let t = y.findIndex((t) => t.id === e);
2327
+ t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)), W(), L());
2328
+ }
2329
+ function ue() {
2330
+ N.value && $(), y.length && (y = [], P.value !== null && (P.value = null, a("select", null)), W(), L());
2331
+ }
2332
+ let de = (e) => [e.lngLat.lng, e.lngLat.lat];
2333
+ function fe(e) {
2334
+ if (N.value || !M || !i.editable || d.value && d.value !== Qt) return;
2335
+ let { x: t, y: n } = e.point, r = [[t - $t, n - $t], [t + $t, n + $t]], a = M.queryRenderedFeatures(r, { layers: g.filter((e) => M.getLayer(e)) })[0]?.properties?.__draw_id;
2336
+ if (a === void 0) return ce(null);
2337
+ let o = y.find((e) => String(e.id) === a);
2338
+ ce(o ? o.id : null);
2339
+ }
2340
+ function pe() {
2341
+ N.value || !i.editable || d.value || (d.value = Qt, setTimeout(() => {
2342
+ d.value === Qt && !N.value && !k && (d.value = null);
2343
+ }, 0));
2344
+ }
2345
+ let me = () => {
2346
+ M && !N.value && !k && i.editable && (M.getCanvas().style.cursor = "pointer");
2347
+ }, ge = () => {
2348
+ M && !N.value && !k && (M.getCanvas().style.cursor = "");
2349
+ };
2350
+ function _e(e) {
2351
+ if (N.value && M) {
2352
+ if (N.value === "point") Se({
2353
+ type: "Point",
2354
+ coordinates: de(e)
2355
+ }), $();
2356
+ else {
2357
+ if (N.value === "polygon" && C.length >= 3) {
2358
+ let t = M.project(C[0]);
2359
+ if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) return $();
2360
+ }
2361
+ C.push(de(e)), W();
2362
+ }
2363
+ }
2364
+ }
2365
+ function ve(e) {
2366
+ O = de(e), G();
2367
+ }
2368
+ function ye(e) {
2369
+ if (e.preventDefault(), !M || C.length < 2) return;
2370
+ let t = M.project(C[C.length - 1]), n = M.project(C[C.length - 2]);
2371
+ Math.hypot(t.x - n.x, t.y - n.y) < 10 && C.pop(), $();
2372
+ }
2373
+ function be() {
2374
+ let e = document.activeElement;
2375
+ return !e || e === document.body ? !0 : M?.getContainer().contains(e) ? !(e instanceof HTMLElement && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) : !1;
2376
+ }
2377
+ function xe(e) {
2378
+ be() && (N.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" && C.length && (e.preventDefault(), C.pop(), W()) : (e.key === "Delete" || e.key === "Backspace") && P.value !== null && i.editable && (e.preventDefault(), le()));
2379
+ }
2380
+ m(() => !!N.value || P.value !== null, () => N.value ? $() : ce(null));
2381
+ function Q() {
2382
+ let e = `shape-${S++}`;
2383
+ for (; y.some((t) => t.id === e);) e = `shape-${S++}`;
2384
+ return e;
2385
+ }
2386
+ function Se(e) {
2387
+ let t = {
2388
+ type: "Feature",
2389
+ id: Q(),
2390
+ geometry: e,
2391
+ properties: {}
2392
+ };
2393
+ y.push(t), P.value = i.editable ? t.id : null, L(), i.editable && a("select", ee(t));
2394
+ }
2395
+ function Ce(e) {
2396
+ if (M) {
2397
+ if (N.value === e) return $();
2398
+ N.value && $(), P.value !== null && ce(null), N.value = e, d.value = Qt, C = [], O = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", _e), M.on("mousemove", ve), M.on("dblclick", ye), W(), i.mode !== e && a("update:mode", e);
2399
+ }
2400
+ }
2401
+ function $() {
2402
+ if (!M || !N.value) return;
2403
+ cancelAnimationFrame(A), A = 0;
2404
+ let e = N.value, t = C;
2405
+ C = [], O = null, N.value = null, d.value === Qt && (d.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", _e), M.off("mousemove", ve), M.off("dblclick", ye), e === "line" && t.length >= 2 ? Se({
2406
+ type: "LineString",
2407
+ coordinates: t
2408
+ }) : e === "polygon" && t.length >= 3 && Se({
2409
+ type: "Polygon",
2410
+ coordinates: [[...t, [...t[0]]]]
2411
+ }), W(), i.mode !== null && a("update:mode", null);
2412
+ }
2413
+ function we(e) {
2414
+ let t = e.features?.[0], n = F(P.value);
2415
+ if (!t || !n || N.value || !M || !i.editable) return;
2416
+ let r = te(n);
2417
+ if (!r) return;
2418
+ e.preventDefault();
2419
+ let a = t.properties.v;
2420
+ t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0, de(e)), R(n, r)), k = {
2421
+ id: n.id,
2422
+ v: a,
2423
+ moved: t.properties.handle === "midpoint"
2424
+ }, d.value = Qt, M.getCanvas().style.cursor = "grabbing";
2425
+ let o = e.type === "touchstart";
2426
+ o && M.dragPan.disable(), M.on(o ? "touchmove" : "mousemove", Te), M.once(o ? "touchend" : "mouseup", Ee), W();
2427
+ }
2428
+ function Te(e) {
2429
+ let t = k && F(k.id), n = t && te(t);
2430
+ k && t && n && (n[k.v] = de(e), R(t, n), k.moved = !0, G());
2431
+ }
2432
+ function Ee() {
2433
+ if (!M) return;
2434
+ let e = k?.moved;
2435
+ k = null, M.off("mousemove", Te), M.off("touchmove", Te), M.dragPan.enable(), M.getCanvas().style.cursor = "", W(), e && L(), setTimeout(() => {
2436
+ d.value === Qt && !N.value && (d.value = null);
2437
+ });
2438
+ }
2439
+ function De(e) {
2440
+ let t = e.features?.[0], n = F(P.value);
2441
+ if (!t || !n || N.value || !i.editable) return;
2442
+ e.preventDefault();
2443
+ let r = te(n);
2444
+ !r || r.length <= re(n) || (r.splice(t.properties.v, 1), R(n, r), W(), L());
2445
+ }
2446
+ let Oe = () => {
2447
+ M && !k && !N.value && (M.getCanvas().style.cursor = "grab");
2448
+ }, ke = () => {
2449
+ M && !k && !N.value && (M.getCanvas().style.cursor = "");
2450
+ };
2451
+ I(i.modelValue), b = JSON.stringify(y), c((e) => {
2452
+ M = e, se(), W(), e.on("click", fe);
2453
+ for (let t of g) e.on("mousedown", t, pe), e.on("touchstart", t, pe), e.on("mouseenter", t, me), e.on("mouseleave", t, ge);
2454
+ for (let t of [_, v]) e.on("mousedown", t, we), e.on("touchstart", t, we), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
2455
+ e.on("dblclick", _, De), document.addEventListener("keydown", xe), i.mode && Ce(i.mode);
2456
+ }), Y(u, () => {
2457
+ se(), W();
2458
+ }), Y(() => i.modelValue, (e) => {
2459
+ JSON.stringify(e?.features ?? []) !== b && (I(e), b = JSON.stringify(y), W());
2460
+ }, { deep: !0 }), Y(() => i.mode, (e) => {
2461
+ e && e !== N.value ? Ce(e) : !e && N.value && $();
2462
+ }), Y(() => i.editable, (e) => {
2463
+ !e && P.value !== null && ce(null);
2464
+ }), ne(() => {
2465
+ if (document.removeEventListener("keydown", xe), !M) return;
2466
+ N.value && $(), cancelAnimationFrame(A), M.off("click", fe);
2467
+ for (let e of g) M.off("mousedown", e, pe), M.off("touchstart", e, pe), M.off("mouseenter", e, me), M.off("mouseleave", e, ge);
2468
+ for (let e of [_, v]) M.off("mousedown", e, we), M.off("touchstart", e, we), M.off("mouseenter", e, Oe), M.off("mouseleave", e, ke);
2469
+ M.off("dblclick", _, De);
2470
+ let e = [
2471
+ _,
2472
+ v,
2473
+ `${h.draft}-point`,
2474
+ `${h.draft}-line`,
2475
+ `${h.draft}-fill`,
2476
+ ...[...g].reverse()
2477
+ ];
2478
+ for (let t of e) M.getLayer(t) && M.removeLayer(t);
2479
+ for (let e of Object.values(h)) M.getSource(e) && M.removeSource(e);
2480
+ M = void 0;
2481
+ });
2482
+ let Ae = w(() => i.control === !0 ? "top-right" : i.control || "top-right"), je = {
2483
+ point: "location_on",
2484
+ line: "polyline",
2485
+ polygon: "pentagon"
2486
+ }, Me = w(() => ({
2487
+ point: o.mapDrawPoint,
2488
+ line: o.mapDrawLine,
2489
+ polygon: o.mapDrawPolygon
2490
+ }));
2491
+ return n({
2492
+ start: Ce,
2493
+ finish: $,
2494
+ select: ce,
2495
+ remove: le,
2496
+ clear: ue
2497
+ }), (n, r) => (z(), D("div", Yt, [t.control ? (z(), T(he, {
2498
+ key: 0,
2499
+ position: Ae.value
2500
+ }, {
2501
+ default: X(() => [(z(!0), D(x, null, H(t.modes, (t) => (z(), D("button", {
2502
+ key: t,
2503
+ type: "button",
2504
+ class: "grid place-items-center",
2505
+ title: Me.value[t],
2506
+ "aria-label": Me.value[t],
2507
+ "aria-pressed": N.value === t,
2508
+ onClick: (e) => Ce(t)
2509
+ }, [j(e, {
2510
+ name: je[t],
2511
+ size: 20
2512
+ }, null, 8, ["name"])], 8, Xt))), 128)), t.editable ? (z(), D("button", {
2513
+ key: 0,
2514
+ type: "button",
2515
+ class: "grid place-items-center",
2516
+ title: q(o).mapDeleteFeature,
2517
+ "aria-label": q(o).mapDeleteFeature,
2518
+ disabled: P.value === null,
2519
+ onClick: r[0] ||= (e) => le()
2520
+ }, [j(e, {
2521
+ name: "delete",
2522
+ size: 20
2523
+ })], 8, Zt)) : E("", !0)]),
2524
+ _: 1
2525
+ }, 8, ["position"])) : E("", !0)]));
2526
+ }
2527
+ }), tn = /* @__PURE__ */ new WeakMap();
2528
+ function nn(e) {
2529
+ let t = fe(e);
1834
2530
  if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
1835
2531
  function n(e, n) {
1836
2532
  let r = t.map.value;
1837
2533
  if (!r?.getLayer(e)) return;
1838
- let i = Vt.get(r);
1839
- i || Vt.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
2534
+ let i = tn.get(r);
2535
+ i || tn.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
1840
2536
  let a = i.get(e);
1841
2537
  r.setFilter(e, n ? a ? [
1842
2538
  "all",
@@ -1860,7 +2556,7 @@ function Ht(e) {
1860
2556
  };
1861
2557
  }
1862
2558
  // src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
1863
- var Ut = { class: "flex flex-wrap gap-2" }, Wt = /* @__PURE__ */ O({
2559
+ var rn = { class: "flex flex-wrap gap-2" }, an = /* @__PURE__ */ M({
1864
2560
  __name: "MMapFilter",
1865
2561
  props: {
1866
2562
  layer: {},
@@ -1872,7 +2568,7 @@ var Ut = { class: "flex flex-wrap gap-2" }, Wt = /* @__PURE__ */ O({
1872
2568
  },
1873
2569
  emits: ["update:modelValue"],
1874
2570
  setup(e, { emit: t }) {
1875
- let n = e, r = t, { onReady: i, styleVersion: a } = X(() => n.map), { setFilter: o, valuesOf: s } = Ht(() => n.map), c = R([]), l = b(() => n.values ?? c.value), u = R([]), d = b(() => n.modelValue ?? u.value);
2571
+ let n = e, r = t, { onReady: i, styleVersion: a } = Z(() => n.map), { setFilter: o, valuesOf: s } = nn(() => n.map), c = V([]), l = w(() => n.values ?? c.value), u = V([]), d = w(() => n.modelValue ?? u.value);
1876
2572
  function f() {
1877
2573
  let e = d.value;
1878
2574
  o(n.layer, e.length ? [
@@ -1881,34 +2577,34 @@ var Ut = { class: "flex flex-wrap gap-2" }, Wt = /* @__PURE__ */ O({
1881
2577
  ["literal", e]
1882
2578
  ] : null);
1883
2579
  }
1884
- function m(e) {
2580
+ function p(e) {
1885
2581
  let t = d.value.includes(e) ? d.value.filter((t) => t !== e) : [...d.value, e];
1886
2582
  u.value = t, r("update:modelValue", t);
1887
2583
  }
1888
- function h(e) {
2584
+ function m(e) {
1889
2585
  let t = () => {
1890
2586
  n.values || (c.value = s(n.layer, n.property));
1891
2587
  };
1892
2588
  t(), e.once("idle", t);
1893
2589
  }
1894
2590
  return i((e) => {
1895
- h(e), f();
1896
- }), G(d, f, { deep: !0 }), G(a, () => f()), G(() => [n.layer, n.property], ([e], [t]) => {
2591
+ m(e), f();
2592
+ }), Y(d, f, { deep: !0 }), Y(a, () => f()), Y(() => [n.layer, n.property], ([e], [t]) => {
1897
2593
  e !== t && o(t, null), f();
1898
- }), F(() => o(n.layer, null)), (t, n) => (I(), C("div", Ut, [(I(!0), C(v, null, z(l.value, (t) => (I(), x(p, {
2594
+ }), ne(() => o(n.layer, null)), (t, n) => (z(), D("div", rn, [(z(!0), D(x, null, H(l.value, (t) => (z(), T(h, {
1899
2595
  key: t,
1900
2596
  type: "filter",
1901
2597
  clickable: "",
1902
2598
  selected: d.value.includes(t),
1903
- onClick: (e) => m(t)
2599
+ onClick: (e) => p(t)
1904
2600
  }, {
1905
- default: K(() => [E(H(e.labels?.[String(t)] ?? t), 1)]),
2601
+ default: X(() => [A(G(e.labels?.[String(t)] ?? t), 1)]),
1906
2602
  _: 2
1907
2603
  }, 1032, ["selected", "onClick"]))), 128))]));
1908
2604
  }
1909
2605
  });
1910
2606
  // src/composables/mapSearch.ts
1911
- function Gt(e = {}) {
2607
+ function on(e = {}) {
1912
2608
  return async (t, n) => {
1913
2609
  let r = new URLSearchParams({
1914
2610
  format: "jsonv2",
@@ -1934,18 +2630,44 @@ function Gt(e = {}) {
1934
2630
  });
1935
2631
  };
1936
2632
  }
1937
- // src/components/MMapSearch.vue?vue&type=script&setup=true&lang.ts
1938
- var Kt = { class: "hidden" }, qt = [
2633
+ var sn = {
2634
+ city: "location_city",
2635
+ town: "location_city",
2636
+ village: "holiday_village",
2637
+ hamlet: "cottage",
2638
+ suburb: "apartment",
2639
+ neighbourhood: "maps_home_work",
2640
+ road: "road",
2641
+ residential: "home",
2642
+ house: "home",
2643
+ building: "domain",
2644
+ shop: "storefront",
2645
+ park: "park",
2646
+ water: "water",
2647
+ river: "water",
2648
+ lake: "water",
2649
+ school: "school",
2650
+ university: "school",
2651
+ hospital: "local_hospital",
2652
+ restaurant: "restaurant",
2653
+ cafe: "local_cafe",
2654
+ hotel: "hotel",
2655
+ station: "train",
2656
+ bus_stop: "directions_bus",
2657
+ administrative: "map",
2658
+ country: "public",
2659
+ state: "map"
2660
+ }, cn = (e) => e && sn[e] || "location_on", ln = { class: "hidden" }, un = [
1939
2661
  "value",
1940
2662
  "placeholder",
1941
2663
  "aria-label"
1942
- ], Jt = {
2664
+ ], dn = {
1943
2665
  key: 0,
1944
2666
  class: "border-t border-outline-variant"
1945
- }, Yt = {
2667
+ }, fn = {
1946
2668
  key: 1,
1947
2669
  class: "flex flex-col items-center gap-2 py-6"
1948
- }, Xt = { class: "text-body-small text-on-surface-variant" }, Zt = /* @__PURE__ */ O({
2670
+ }, pn = { class: "text-body-small text-on-surface-variant" }, mn = /* @__PURE__ */ M({
1949
2671
  __name: "MMapSearch",
1950
2672
  props: {
1951
2673
  provider: {},
@@ -1963,28 +2685,28 @@ var Kt = { class: "hidden" }, qt = [
1963
2685
  },
1964
2686
  emits: ["select"],
1965
2687
  setup(t, { emit: n }) {
1966
- let r = t, i = n, o = s(), { map: c } = X(), l = b(() => r.provider ?? Gt()), u = R(""), d = V([]), f = R(!1), p = R(!1), y = R(!1), T = V(null), E, O;
1967
- async function k() {
2688
+ let r = t, i = n, o = s(), { map: c } = Z(), l = w(() => r.provider ?? on()), u = V(""), d = W([]), f = V(!1), p = V(!1), m = V(!1), h = W(null), g, S;
2689
+ async function C() {
1968
2690
  let e = u.value.trim();
1969
2691
  if (!e) return;
1970
- E?.abort(), E = new AbortController();
1971
- let t = E;
1972
- f.value = !0, y.value = !0;
2692
+ g?.abort(), g = new AbortController();
2693
+ let t = g;
2694
+ f.value = !0, m.value = !0;
1973
2695
  try {
1974
2696
  d.value = await l.value(e, t.signal);
1975
2697
  } catch {
1976
2698
  if (t.signal.aborted) return;
1977
2699
  d.value = [];
1978
2700
  } finally {
1979
- E === t && (f.value = !1, p.value = !0);
2701
+ g === t && (f.value = !1, p.value = !0);
1980
2702
  }
1981
2703
  }
1982
- function A(e) {
2704
+ function k(e) {
1983
2705
  if (u.value = e, !e) return M();
1984
- r.instant && (clearTimeout(O), O = setTimeout(k, 350));
2706
+ r.instant && (clearTimeout(S), S = setTimeout(C, 350));
1985
2707
  }
1986
- function j(e) {
1987
- T.value = e, y.value = !1;
2708
+ function A(e) {
2709
+ h.value = e, m.value = !1;
1988
2710
  let t = c.value;
1989
2711
  e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
1990
2712
  padding: 48,
@@ -1995,109 +2717,279 @@ var Kt = { class: "hidden" }, qt = [
1995
2717
  }), i("select", e);
1996
2718
  }
1997
2719
  function M() {
1998
- E?.abort(), clearTimeout(O), u.value = "", d.value = [], p.value = !1, f.value = !1, y.value = !1, T.value = null;
2720
+ g?.abort(), clearTimeout(S), u.value = "", d.value = [], p.value = !1, f.value = !1, m.value = !1, h.value = null;
1999
2721
  }
2000
- F(() => {
2001
- E?.abort(), clearTimeout(O);
2002
- });
2003
- let N = {
2004
- city: "location_city",
2005
- town: "location_city",
2006
- village: "holiday_village",
2007
- hamlet: "cottage",
2008
- suburb: "apartment",
2009
- neighbourhood: "maps_home_work",
2010
- road: "road",
2011
- residential: "home",
2012
- house: "home",
2013
- building: "domain",
2014
- shop: "storefront",
2015
- park: "park",
2016
- water: "water",
2017
- river: "water",
2018
- lake: "water",
2019
- school: "school",
2020
- university: "school",
2021
- hospital: "local_hospital",
2022
- restaurant: "restaurant",
2023
- cafe: "local_cafe",
2024
- hotel: "hotel",
2025
- station: "train",
2026
- bus_stop: "directions_bus",
2027
- administrative: "map",
2028
- country: "public",
2029
- state: "map"
2030
- }, P = (e) => e && N[e] || "location_on";
2031
- return (n, r) => (I(), C("div", Kt, [D(ue, {
2722
+ return ne(() => {
2723
+ g?.abort(), clearTimeout(S);
2724
+ }), (n, r) => (z(), D("div", ln, [j(he, {
2032
2725
  position: t.position,
2033
2726
  group: !1
2034
2727
  }, {
2035
- default: K(() => [D(h, {
2728
+ default: X(() => [j(v, {
2036
2729
  variant: "elevated",
2037
2730
  class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
2038
2731
  }, {
2039
- default: K(() => [w("form", {
2732
+ default: X(() => [O("form", {
2040
2733
  class: "flex items-center gap-2 py-1 pr-1 pl-3",
2041
2734
  role: "search",
2042
- onSubmit: q(k, ["prevent"])
2735
+ onSubmit: se(C, ["prevent"])
2043
2736
  }, [
2044
- D(e, {
2737
+ j(e, {
2045
2738
  name: "search",
2046
2739
  size: 20,
2047
2740
  class: "shrink-0 text-on-surface-variant"
2048
2741
  }),
2049
- w("input", {
2742
+ O("input", {
2050
2743
  value: u.value,
2051
2744
  type: "search",
2052
2745
  enterkeyhint: "search",
2053
- placeholder: t.placeholder ?? U(o).mapSearchPlaces,
2054
- "aria-label": t.placeholder ?? U(o).mapSearchPlaces,
2746
+ placeholder: t.placeholder ?? q(o).mapSearchPlaces,
2747
+ "aria-label": t.placeholder ?? q(o).mapSearchPlaces,
2055
2748
  class: "min-w-0 flex-1 bg-transparent py-2 text-body-medium text-on-surface outline-none placeholder:text-on-surface-variant [&::-webkit-search-cancel-button]:hidden",
2056
- onInput: r[0] ||= (e) => A(e.target.value),
2057
- onFocus: r[1] ||= (e) => y.value = p.value && !T.value
2058
- }, null, 40, qt),
2059
- f.value ? (I(), x(_, {
2749
+ onInput: r[0] ||= (e) => k(e.target.value),
2750
+ onFocus: r[1] ||= (e) => m.value = p.value && !h.value
2751
+ }, null, 40, un),
2752
+ f.value ? (z(), T(b, {
2060
2753
  key: 0,
2061
2754
  size: 20,
2062
2755
  class: "mr-2 shrink-0"
2063
- })) : u.value ? (I(), x(a, {
2756
+ })) : u.value ? (z(), T(a, {
2064
2757
  key: 1,
2065
2758
  icon: "close",
2066
- label: U(o).clearSearch,
2759
+ label: q(o).clearSearch,
2067
2760
  size: "sm",
2068
2761
  onClick: M
2069
- }, null, 8, ["label"])) : S("", !0)
2070
- ], 32), y.value && p.value && !f.value ? (I(), C("div", Jt, [d.value.length ? (I(), x(m, {
2762
+ }, null, 8, ["label"])) : E("", !0)
2763
+ ], 32), m.value && p.value && !f.value ? (z(), D("div", dn, [d.value.length ? (z(), T(_, {
2071
2764
  key: 0,
2072
2765
  class: "max-h-72 overflow-y-auto"
2073
2766
  }, {
2074
- default: K(() => [(I(!0), C(v, null, z(d.value, (e, t) => (I(), x(g, {
2767
+ default: X(() => [(z(!0), D(x, null, H(d.value, (e, t) => (z(), T(y, {
2075
2768
  key: t,
2076
2769
  title: e.label,
2077
- icon: P(e.type),
2770
+ icon: q(cn)(e.type),
2078
2771
  leading: "icon",
2079
2772
  clickable: "",
2080
- onClick: (t) => j(e)
2773
+ onClick: (t) => A(e)
2081
2774
  }, null, 8, [
2082
2775
  "title",
2083
2776
  "icon",
2084
2777
  "onClick"
2085
2778
  ]))), 128))]),
2086
2779
  _: 1
2087
- })) : (I(), C("div", Yt, [D(e, {
2780
+ })) : (z(), D("div", fn, [j(e, {
2088
2781
  name: "search_off",
2089
2782
  size: 28,
2090
2783
  class: "text-on-surface-variant"
2091
- }), w("span", Xt, H(U(o).noResults), 1)]))])) : S("", !0)]),
2784
+ }), O("span", pn, G(q(o).noResults), 1)]))])) : E("", !0)]),
2092
2785
  _: 1
2093
2786
  })]),
2094
2787
  _: 1
2095
- }, 8, ["position"]), t.marker && T.value ? (I(), x(Te, {
2788
+ }, 8, ["position"]), t.marker && h.value ? (z(), T(Ae, {
2789
+ key: 0,
2790
+ "lng-lat": h.value.lngLat
2791
+ }, null, 8, ["lng-lat"])) : E("", !0)]));
2792
+ }
2793
+ }), hn = ["aria-label"], gn = {
2794
+ key: 0,
2795
+ class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
2796
+ role: "status"
2797
+ }, _n = {
2798
+ key: 1,
2799
+ class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant"
2800
+ }, vn = {
2801
+ key: 2,
2802
+ class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
2803
+ role: "status"
2804
+ }, yn = [
2805
+ "id",
2806
+ "aria-selected",
2807
+ "onMousedown",
2808
+ "onMousemove"
2809
+ ], bn = { class: "flex min-w-0 flex-col" }, xn = { class: "truncate text-body-large" }, Sn = {
2810
+ key: 0,
2811
+ class: "truncate text-body-small text-on-surface-variant"
2812
+ }, Cn = /* @__PURE__ */ M({
2813
+ inheritAttrs: !1,
2814
+ __name: "MAddressField",
2815
+ props: {
2816
+ modelValue: { default: null },
2817
+ provider: {},
2818
+ label: {},
2819
+ variant: { default: "filled" },
2820
+ leadingIcon: { default: "location_on" },
2821
+ instant: {
2822
+ type: Boolean,
2823
+ default: !1
2824
+ },
2825
+ debounce: { default: 400 },
2826
+ minLength: { default: 3 },
2827
+ hint: {},
2828
+ error: { type: Boolean },
2829
+ errorLabel: {},
2830
+ required: { type: Boolean },
2831
+ disabled: { type: Boolean }
2832
+ },
2833
+ emits: ["update:modelValue", "select"],
2834
+ setup(t, { expose: n, emit: r }) {
2835
+ let i = t, o = r, c = s(), l = ae(), d = `${l}-list`, f = (e) => `${l}-opt-${e}`, h = w(() => i.provider ?? on()), _ = V(i.modelValue?.label ?? ""), v = W([]), y = V(!1), C = V(!1), k = V(!1), M = V(!1), N = V(-1), P, ee, R = V(), re = V(), B = V(), ie = w(() => re.value?.firstElementChild?.firstElementChild ?? null), U = V({}), K = w(() => _.value.trim().length >= i.minLength), J = w(() => !i.instant && k.value && K.value && !C.value && !y.value && !i.modelValue);
2836
+ Y(() => i.modelValue, (e) => {
2837
+ e && e.label !== _.value ? _.value = e.label : !e && !k.value && (_.value = "");
2838
+ });
2839
+ async function ce() {
2840
+ let e = _.value.trim();
2841
+ if (e.length < i.minLength) return;
2842
+ P?.abort(), clearTimeout(ee), P = new AbortController();
2843
+ let t = P;
2844
+ y.value = !0, M.value = !0;
2845
+ try {
2846
+ v.value = await h.value(e, t.signal), N.value = v.value.length ? 0 : -1;
2847
+ } catch {
2848
+ if (t.signal.aborted) return;
2849
+ v.value = [];
2850
+ } finally {
2851
+ P === t && (y.value = !1, C.value = !0);
2852
+ }
2853
+ }
2854
+ function le(e) {
2855
+ _.value = String(e), C.value = !1, v.value = [], N.value = -1, i.modelValue && o("update:modelValue", null), P?.abort(), y.value = !1, clearTimeout(ee), K.value ? (M.value = !i.instant, i.instant && (ee = setTimeout(ce, i.debounce))) : M.value = !1;
2856
+ }
2857
+ function ue(e) {
2858
+ _.value = e.label, M.value = !1, v.value = [], C.value = !1, o("update:modelValue", e), o("select", e);
2859
+ }
2860
+ function de() {
2861
+ P?.abort(), clearTimeout(ee), _.value = "", v.value = [], C.value = !1, y.value = !1, M.value = !1, i.modelValue && o("update:modelValue", null), R.value?.focus();
2862
+ }
2863
+ function fe(e) {
2864
+ if (e.key === "Enter") {
2865
+ e.preventDefault();
2866
+ let t = v.value[N.value];
2867
+ M.value && t && C.value ? ue(t) : ce();
2868
+ } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
2869
+ if (!M.value || !v.value.length) return;
2870
+ e.preventDefault();
2871
+ let t = v.value.length;
2872
+ N.value = (N.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, I(() => B.value?.querySelector(`#${CSS.escape(f(N.value))}`)?.scrollIntoView({ block: "nearest" }));
2873
+ }
2874
+ }
2875
+ function Z() {
2876
+ k.value = !0, (C.value && v.value.length && !i.modelValue || J.value) && (M.value = !0);
2877
+ }
2878
+ function pe(e) {
2879
+ let t = e.relatedTarget;
2880
+ t && (re.value?.contains(t) || B.value?.contains(t)) || (k.value = !1, M.value = !1);
2881
+ }
2882
+ m(() => M.value, () => M.value = !1);
2883
+ let me = w(() => M.value && (y.value || C.value || J.value));
2884
+ function he() {
2885
+ let e = ie.value?.getBoundingClientRect(), t = B.value;
2886
+ if (!e || !t) return;
2887
+ let n = t.offsetHeight, r = p([e.bottom + 4, e.top - 4 - n], n, window.innerHeight, 8);
2888
+ U.value = {
2889
+ top: `${r}px`,
2890
+ left: `${e.left}px`,
2891
+ width: `${e.width}px`
2892
+ };
2893
+ }
2894
+ Y([
2895
+ me,
2896
+ v,
2897
+ y
2898
+ ], () => I(he)), g({
2899
+ open: () => me.value,
2900
+ anchor: ie,
2901
+ popup: B,
2902
+ place: he,
2903
+ close: () => M.value = !1
2904
+ }), oe(() => {
2905
+ let e = R.value?.inputEl;
2906
+ e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(me.value && v.value.length > 0)), e.setAttribute("aria-controls", d), e.setAttribute("enterkeyhint", "search"), me.value && N.value >= 0 && v.value.length ? e.setAttribute("aria-activedescendant", f(N.value)) : e.removeAttribute("aria-activedescendant"));
2907
+ }), ne(() => {
2908
+ P?.abort(), clearTimeout(ee);
2909
+ });
2910
+ function ge(e) {
2911
+ let t = e.indexOf(", ");
2912
+ return t < 0 ? [e, ""] : [e.slice(0, t), e.slice(t + 2)];
2913
+ }
2914
+ return n({
2915
+ search: ce,
2916
+ clear: de,
2917
+ focus: () => R.value?.focus()
2918
+ }), (n, r) => (z(), D(x, null, [O("div", F({
2919
+ ref_key: "wrapEl",
2920
+ ref: re
2921
+ }, n.$attrs, {
2922
+ onFocusin: Z,
2923
+ onFocusout: pe,
2924
+ onKeydown: fe
2925
+ }), [j(u, {
2926
+ ref_key: "field",
2927
+ ref: R,
2928
+ "model-value": _.value,
2929
+ label: t.label ?? q(c).mapAddress,
2930
+ variant: t.variant,
2931
+ "leading-icon": t.leadingIcon,
2932
+ hint: t.hint,
2933
+ error: t.error,
2934
+ "error-label": t.errorLabel,
2935
+ required: t.required,
2936
+ disabled: t.disabled,
2937
+ autocomplete: "street-address",
2938
+ "onUpdate:modelValue": le
2939
+ }, {
2940
+ trailing: X(() => [y.value ? (z(), T(b, {
2941
+ key: 0,
2942
+ size: 20,
2943
+ class: "m-2"
2944
+ })) : _.value ? (z(), T(a, {
2945
+ key: 1,
2946
+ icon: "close",
2947
+ label: q(c).clearSearch,
2948
+ size: "sm",
2949
+ disabled: t.disabled,
2950
+ onClick: de
2951
+ }, null, 8, ["label", "disabled"])) : E("", !0)]),
2952
+ _: 1
2953
+ }, 8, [
2954
+ "model-value",
2955
+ "label",
2956
+ "variant",
2957
+ "leading-icon",
2958
+ "hint",
2959
+ "error",
2960
+ "error-label",
2961
+ "required",
2962
+ "disabled"
2963
+ ])], 16), (z(), T(S, { to: "body" }, [me.value ? (z(), D("div", {
2096
2964
  key: 0,
2097
- "lng-lat": T.value.lngLat
2098
- }, null, 8, ["lng-lat"])) : S("", !0)]));
2965
+ id: d,
2966
+ ref_key: "listEl",
2967
+ ref: B,
2968
+ role: "listbox",
2969
+ "aria-label": t.label ?? q(c).mapAddress,
2970
+ class: "fixed z-500 max-h-72 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2",
2971
+ style: te(U.value)
2972
+ }, [y.value ? (z(), D("div", gn, [j(b, { size: 20 }), A(G(q(c).mapSearching), 1)])) : J.value ? (z(), D("div", _n, [j(e, {
2973
+ name: "keyboard_return",
2974
+ size: 20
2975
+ }), A(G(q(c).mapPressEnterToSearch), 1)])) : v.value.length ? (z(!0), D(x, { key: 3 }, H(v.value, (t, n) => (z(), D("div", {
2976
+ id: f(n),
2977
+ key: n,
2978
+ role: "option",
2979
+ "aria-selected": n === N.value,
2980
+ class: L(["flex cursor-pointer items-center gap-3 px-4 py-2 text-on-surface hover:bg-on-surface/8", n === N.value ? "bg-on-surface/12" : ""]),
2981
+ onMousedown: se((e) => ue(t), ["prevent"]),
2982
+ onMousemove: (e) => N.value = n
2983
+ }, [j(e, {
2984
+ name: q(cn)(t.type),
2985
+ size: 20,
2986
+ class: "shrink-0 text-on-surface-variant"
2987
+ }, null, 8, ["name"]), O("span", bn, [O("span", xn, G(ge(t.label)[0]), 1), ge(t.label)[1] ? (z(), D("span", Sn, G(ge(t.label)[1]), 1)) : E("", !0)])], 42, yn))), 128)) : (z(), D("div", vn, [j(e, {
2988
+ name: "search_off",
2989
+ size: 20
2990
+ }), A(G(q(c).mapNoPlaces), 1)]))], 12, hn)) : E("", !0)]))], 64));
2099
2991
  }
2100
2992
  });
2101
- export { be as MMap, tt as MMapBaseLayers, ue as MMapControl, ut as MMapFeatureInfo, Wt as MMapFilter, Oe as MMapGeoJson, Dt as MMapHover, bt as MMapIdentify, Ze as MMapLayers, Te as MMapMarker, Bt as MMapMeasure, De as MMapPopup, Zt as MMapSearch, ht as fieldLabel, gt as formatFieldValue, pt as genericAdapter, vt as identifyFeatures, Gt as nominatimProvider, mt as orvianAdapter, oe as setMapWorker, X as useMap, Ht as useMapFilter, Z as useMapLayers };
2993
+ export { Cn as MAddressField, we as MMap, ct as MMapBaseLayers, Fe as MMapCluster, he as MMapControl, en as MMapDraw, _t as MMapFeatureInfo, an as MMapFilter, Ne as MMapGeoJson, Pt as MMapHover, Dt as MMapIdentify, it as MMapLayers, Ae as MMapMarker, Jt as MMapMeasure, Me as MMapPopup, mn as MMapSearch, St as fieldLabel, Ct as formatFieldValue, bt as genericAdapter, Tt as identifyFeatures, on as nominatimProvider, xt as orvianAdapter, le as setMapWorker, Z as useMap, nn as useMapFilter, Q as useMapLayers };
2102
2994
 
2103
2995
  //# sourceMappingURL=map.js.map