@m3ui-vue/m3ui-vue 1.6.0 → 1.6.1

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