@m4l/gclick 0.3.7 → 0.3.8

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 (89) hide show
  1. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts +3 -2
  2. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts.map +1 -1
  3. package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.js +16 -20
  4. package/components/index.d.ts +1 -0
  5. package/components/index.d.ts.map +1 -1
  6. package/components/maps/components/GpsMap/constants.d.ts +1 -0
  7. package/components/maps/components/GpsMap/constants.d.ts.map +1 -1
  8. package/components/maps/components/GpsMap/constants.js +16 -14
  9. package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts +2 -1
  10. package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts.map +1 -1
  11. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts +28 -0
  12. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts.map +1 -0
  13. package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.js +111 -0
  14. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts +9 -0
  15. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts.map +1 -0
  16. package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.js +183 -0
  17. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts +112 -0
  18. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts.map +1 -0
  19. package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.js +87 -0
  20. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts +10 -0
  21. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts.map +1 -0
  22. package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.js +12 -0
  23. package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts +2 -1
  24. package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts.map +1 -1
  25. package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts +6 -2
  26. package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts.map +1 -1
  27. package/components/maps/components/GpsMap/contexts/MapContext/store.js +301 -123
  28. package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts +191 -20
  29. package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts.map +1 -1
  30. package/components/maps/components/GpsMap/contexts/MapContext/types.js +8 -0
  31. package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.d.ts.map +1 -1
  32. package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.js +93 -124
  33. package/components/maps/components/GpsMap/hooks/index.d.ts +3 -0
  34. package/components/maps/components/GpsMap/hooks/index.d.ts.map +1 -1
  35. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts +12 -0
  36. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts.map +1 -0
  37. package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.js +29 -0
  38. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts +1 -4
  39. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts.map +1 -1
  40. package/components/maps/components/GpsMap/hooks/useAutoFocus/index.js +32 -59
  41. package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts +4 -13
  42. package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts.map +1 -1
  43. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts +7 -0
  44. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts.map +1 -0
  45. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.js +42 -0
  46. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts +19 -0
  47. package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts.map +1 -0
  48. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts +12 -0
  49. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts.map +1 -0
  50. package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.js +43 -0
  51. package/components/maps/components/GpsMap/index.d.ts +1 -0
  52. package/components/maps/components/GpsMap/index.d.ts.map +1 -1
  53. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts +5 -0
  54. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts.map +1 -1
  55. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.js +20 -13
  56. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +4 -3
  57. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts.map +1 -1
  58. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.js +175 -120
  59. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +6 -0
  60. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts.map +1 -1
  61. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.d.ts.map +1 -1
  62. package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.js +26 -12
  63. package/components/maps/components/GpsMap/subcomponents/LayersContainer/subcomponents/Layer/Layer.js +1 -1
  64. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts +6 -0
  65. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts.map +1 -1
  66. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.js +38 -26
  67. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useDatagridFiltered.js +26 -26
  68. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useFilterAndSort/useFilterAndSort.js +27 -27
  69. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useMaster.js +4 -4
  70. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts +1 -1
  71. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts.map +1 -1
  72. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.js +34 -28
  73. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.d.ts.map +1 -1
  74. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.js +41 -36
  75. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useTabFiltered.js +17 -17
  76. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.d.ts.map +1 -1
  77. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.js +16 -18
  78. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +3 -2
  79. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts.map +1 -1
  80. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.js +136 -92
  81. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.d.ts.map +1 -1
  82. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.js +29 -23
  83. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts +1 -1
  84. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts.map +1 -1
  85. package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.js +60 -95
  86. package/components/maps/index.d.ts +1 -0
  87. package/components/maps/index.d.ts.map +1 -1
  88. package/index.js +143 -136
  89. package/package.json +3 -4
@@ -1,185 +1,174 @@
1
- import { createStore as m } from "zustand";
2
- import { devtools as j } from "zustand/middleware";
3
- import { immer as F } from "zustand/middleware/immer";
4
- import { runToolCommand as L, unregisterToolController as O, registerToolController as g } from "./helpers/toolControllerRegistry.js";
5
- import f from "lodash-es/cloneDeep";
6
- import y from "lodash-es/merge";
7
- import { TILE_LAYER_OTHERS as w } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/others.js";
8
- import { TILE_SORCE_GOOGLE as J } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/google.js";
9
- import { TILE_LAYER_BING as E } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/bing.js";
10
- const T = (u, l) => {
11
- const { enabled: p = !1 } = l;
12
- return p && process.env.NODE_ENV === "development" ? j(u, l) : u;
13
- }, A = (u, l = !1) => {
14
- const p = {
1
+ import { createStore as J } from "zustand";
2
+ import { immer as x } from "zustand/middleware/immer";
3
+ import { INTERACTION_CHANNELS as E } from "./types.js";
4
+ import { createDevtools as P, isValidViewportBounds as V, createViewportActionResult as u, resolveMoveToBoundsOptions as Z, getAllowedViewportMap as L, runViewportActionSafely as b, isValidViewportPoint as j, resolveSmartMoveToPointOptions as R, resolveMoveToPointOptions as D, areInteractionChannelsAvailable as C, releaseOwnedInteractionChannels as S, invalidateViewportSizeIfNeeded as O, isBoundsViewportAlreadyApplied as _, isPointViewportAlreadyApplied as M } from "./helpers/helpers.js";
5
+ import { runToolCommand as w, unregisterToolController as $, registerToolController as z } from "./helpers/toolControllerRegistry.js";
6
+ import m from "lodash-es/cloneDeep";
7
+ import A from "lodash-es/merge";
8
+ import { TILE_LAYER_OTHERS as N } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/others.js";
9
+ import { TILE_SORCE_GOOGLE as q } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/google.js";
10
+ import { TILE_LAYER_BING as k } from "../../subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MapSourcesTool/sourceTypes/bing.js";
11
+ import { refreshLayerDataBounds as f } from "./helpers/layerDataBounds.js";
12
+ import { getFeatureFromLayer as F, resolveObservableFeatureSnapTarget as G, resolveObservableFeaturePick as H, resolveObservableFeatureAnchor as W, isObservableFeatureEventEnabled as Y } from "./helpers/featureObservability.js";
13
+ const ue = (g, B = !1) => {
14
+ const I = {
15
15
  currentMapSourceLayer: {
16
16
  mapSourceId: "google",
17
17
  mapSourceLayerId: "streets"
18
18
  },
19
- mapSources: [J, E, w],
19
+ mapSources: [q, k, N],
20
20
  layersIds: [],
21
21
  hashLayers: {},
22
22
  autoFocusLayers: !0,
23
23
  selectedFeature: null,
24
- ...u
24
+ interactionOwnership: {
25
+ ownersByChannel: {}
26
+ },
27
+ ...g
25
28
  };
26
- let d = null;
27
- const h = /* @__PURE__ */ new Map();
28
- return m(
29
- T(
30
- F((n, i) => ({
31
- ...p,
29
+ let h = null;
30
+ const p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
31
+ let T = 0;
32
+ return J(
33
+ P(
34
+ x((s, n) => ({
35
+ ...I,
32
36
  mapActions: {
33
37
  /**
34
38
  * TODO: Documentar
35
39
  */
36
40
  init: (e) => {
37
- n((r) => {
38
- for (let o = 0; o < e.length; o++)
39
- r.hashLayers[e[o].layerId] = f(e[o]), r.layersIds.push(e[o].layerId);
41
+ s((o) => {
42
+ for (let r = 0; r < e.length; r++)
43
+ o.hashLayers[e[r].layerId] = m(e[r]), f(o.hashLayers[e[r].layerId]), o.layersIds.push(e[r].layerId);
40
44
  });
41
45
  },
42
46
  /**
43
47
  * Actualiza el ref del mapa
44
48
  */
45
49
  setMapRef: (e) => {
46
- d = e;
50
+ h = e;
47
51
  },
48
52
  /**
49
53
  * Retorna el ref del mapa
50
54
  */
51
- getMap: () => d,
55
+ getMap: () => h,
52
56
  /**
53
57
  * Actualiza la información transversal a todas las capas.
54
58
  */
55
59
  setMapData: (e) => {
56
- n((r) => {
57
- r.hasMapData = { ...r.hasMapData, ...e };
60
+ s((o) => {
61
+ o.hasMapData = { ...o.hasMapData, ...e };
58
62
  });
59
63
  },
60
64
  /**
61
65
  * Modifica toda la capa, reemplanzando todo el geoJson
62
66
  */
63
- setDataLayer: (e, r) => {
64
- if (!i().hashLayers[e])
67
+ setDataLayer: (e, o, r) => {
68
+ if (!n().hashLayers[e])
65
69
  throw new Error(`Layer with id ${e} not found`);
66
- n((o) => {
67
- const s = o.hashLayers[e];
68
- s.geoJsonObject = r;
70
+ s((t) => {
71
+ const a = t.hashLayers[e];
72
+ a.geoJsonObject = o, a.dataBoundsOverride = r?.dataBoundsOverride, f(a);
69
73
  });
70
74
  },
71
75
  /**
72
76
  * Modifica la capa, mezclando el geoJson actual con el nuevo
73
77
  */
74
- mergeDataLayer: (e, r) => {
75
- if (!i().hashLayers[e])
78
+ mergeDataLayer: (e, o, r) => {
79
+ if (!n().hashLayers[e])
76
80
  throw new Error(`Layer with id ${e} not found`);
77
- n((o) => {
78
- const s = o.hashLayers[e];
79
- s.geoJsonObject = y(s.geoJsonObject, r);
81
+ s((t) => {
82
+ const a = t.hashLayers[e];
83
+ a.geoJsonObject = A(a.geoJsonObject, o), a.dataBoundsOverride = r?.dataBoundsOverride, f(a);
80
84
  });
81
85
  },
82
86
  /**
83
87
  * TODO: Documentar
84
88
  */
85
89
  getFeatureIds: (e) => {
86
- if (!i().hashLayers[e])
90
+ if (!n().hashLayers[e])
87
91
  throw new Error(`Layer with id ${e} not found`);
88
- const r = i().hashLayers[e]?.geoJsonObject;
89
- return r && r.object.type === "Feature" ? [r.object.id] : r && r.object.type === "FeatureCollection" ? r.object.features.map((o) => o.id) : [];
92
+ const o = n().hashLayers[e]?.geoJsonObject;
93
+ return o && o.object.type === "Feature" ? [o.object.id] : o && o.object.type === "FeatureCollection" ? o.object.features.map((r) => r.id) : [];
90
94
  },
91
95
  /**
92
96
  * TODO: Documentar
93
97
  */
94
- setFeatureData: (e, r, o, s) => {
95
- if (!i().hashLayers[e])
98
+ setFeatureData: (e, o, r, t, a, i) => {
99
+ if (!n().hashLayers[e])
96
100
  throw new Error(`Layer with id ${e} not found`);
97
- n((t) => {
98
- if (t.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
99
- const a = t.hashLayers[e].geoJsonObject?.object;
100
- let c = a.features.find((b) => b.id === r);
101
- c ? (c.geometry = f(o), c.properties = y(c.properties, s)) : (c = {
101
+ s((l) => {
102
+ if (l.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
103
+ const c = l.hashLayers[e].geoJsonObject?.object;
104
+ let d = c.features.find((y) => y.id === o);
105
+ d ? (d.geometry = m(r), d.properties = A(d.properties, t)) : (d = {
102
106
  type: "Feature",
103
- geometry: o,
104
- id: r,
105
- properties: s
106
- }, a.features.push(c));
107
- } else if (t.hashLayers[e].geoJsonObject?.object.type === "Feature") {
108
- const a = t.hashLayers[e].geoJsonObject?.object;
109
- a.id = r, a.geometry = f(o), a.properties = f(s);
107
+ geometry: r,
108
+ id: o,
109
+ properties: t
110
+ }, c.features.push(d));
111
+ } else if (l.hashLayers[e].geoJsonObject?.object.type === "Feature") {
112
+ const c = l.hashLayers[e].geoJsonObject?.object;
113
+ c.id = o, c.geometry = m(r), c.properties = m(t);
110
114
  }
115
+ l.hashLayers[e].dataBoundsOverride = i?.dataBoundsOverride, f(l.hashLayers[e]);
111
116
  });
112
117
  },
113
118
  /**
114
119
  * TODO: Documentar
115
120
  */
116
- removeFeature: (e, r) => {
117
- if (!i().hashLayers[e])
121
+ removeFeature: (e, o) => {
122
+ if (!n().hashLayers[e])
118
123
  throw new Error(`Layer with id ${e} not found`);
119
- n((o) => {
120
- if (o.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
121
- const s = o.hashLayers[e].geoJsonObject?.object, t = s.features.findIndex((a) => a.id === r);
122
- t !== -1 && s.features.splice(t, 1);
123
- } else if (o.hashLayers[e].geoJsonObject?.object.type === "Feature") {
124
- const s = o.hashLayers[e].geoJsonObject?.object;
125
- s.geometry = { type: "Point", coordinates: [0, 0] }, s.properties = { subType: "Marker" };
124
+ s((r) => {
125
+ if (r.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
126
+ const t = r.hashLayers[e].geoJsonObject?.object, a = t.features.findIndex((i) => i.id === o);
127
+ a !== -1 && t.features.splice(a, 1);
128
+ } else if (r.hashLayers[e].geoJsonObject?.object.type === "Feature") {
129
+ const t = r.hashLayers[e].geoJsonObject?.object;
130
+ t.geometry = { type: "Point", coordinates: [0, 0] }, t.properties = { subType: "Marker" };
126
131
  }
127
- o.selectedFeature?.layerId === e && o.selectedFeature.featureId === r && (o.selectedFeature = null);
132
+ r.selectedFeature?.layerId === e && r.selectedFeature.featureId === o && (r.selectedFeature = null), f(r.hashLayers[e]);
128
133
  });
129
134
  },
130
135
  /**
131
136
  * TODO: Documentar
132
137
  */
133
- setLayerRenderProp: (e, r) => {
134
- n((o) => {
135
- o.hashLayers[e].renderFeature = r;
138
+ setLayerRenderProp: (e, o) => {
139
+ s((r) => {
140
+ r.hashLayers[e].renderFeature = o;
136
141
  });
137
142
  },
138
143
  /**
139
144
  * TODO: Documentar
140
145
  */
141
146
  addLayer: (e) => {
142
- if (i().hashLayers[e.layerId])
147
+ if (n().hashLayers[e.layerId])
143
148
  throw new Error(`Layer with id ${e.layerId} already exists`);
144
- n((r) => {
145
- r.hashLayers[e.layerId] = e, r.layersIds.push(e.layerId), e.visible !== !1 && (r.hashLayers[e.layerId].visible = !0), e.autoFocus !== !1 && (r.hashLayers[e.layerId].autoFocus = !0), e.clusterAble && e.cluster !== !1 && (r.hashLayers[e.layerId].cluster = !0);
146
- });
147
- },
148
- /**
149
- * TODO: Documentar
150
- */
151
- addLayerDataToFeature: (e, r, o) => {
152
- n((s) => {
153
- if (s.hashLayers[e]) {
154
- if (s.hashLayers[e].geoJsonObject?.object.type === "FeatureCollection") {
155
- const a = (s.hashLayers[e].geoJsonObject?.object).features.find((c) => c.id === r);
156
- a && (a.layerData = y(a.layerData || {}, o));
157
- } else if (s.hashLayers[e].geoJsonObject?.object.type === "Feature") {
158
- const t = s.hashLayers[e].geoJsonObject?.object;
159
- t.layerData && (t.layerData = o);
160
- }
161
- }
149
+ s((o) => {
150
+ o.hashLayers[e.layerId] = m(e), f(o.hashLayers[e.layerId]), o.layersIds.push(e.layerId), e.visible !== !1 && (o.hashLayers[e.layerId].visible = !0), e.autoFocus !== !1 && (o.hashLayers[e.layerId].autoFocus = !0), e.clusterAble && e.cluster !== !1 && (o.hashLayers[e.layerId].cluster = !0);
162
151
  });
163
152
  },
164
153
  /**
165
154
  * TODO: Documentar
166
155
  */
167
156
  removeLayer: (e) => {
168
- i().hashLayers[e] && n((r) => {
169
- r.layersIds.splice(r.layersIds.indexOf(e), 1), delete r.hashLayers[e], r.selectedFeature?.layerId === e && (r.selectedFeature = null);
157
+ n().hashLayers[e] && s((o) => {
158
+ o.layersIds.splice(o.layersIds.indexOf(e), 1), delete o.hashLayers[e], o.selectedFeature?.layerId === e && (o.selectedFeature = null);
170
159
  });
171
160
  },
172
161
  /**
173
162
  * Stores external feature-selection intent so renderers can react declaratively.
174
163
  */
175
- selectFeature: (e, r, o) => {
176
- n((s) => {
177
- s.selectedFeature = {
164
+ selectFeature: (e, o, r) => {
165
+ s((t) => {
166
+ t.selectedFeature = {
178
167
  layerId: e,
179
- featureId: r,
180
- openPopup: o?.openPopup ?? !1,
181
- source: o?.source ?? "external",
182
- requestId: (s.selectedFeature?.requestId ?? 0) + 1
168
+ featureId: o,
169
+ openPopup: r?.openPopup ?? !1,
170
+ source: r?.source ?? "external",
171
+ requestId: (t.selectedFeature?.requestId ?? 0) + 1
183
172
  };
184
173
  });
185
174
  },
@@ -187,81 +176,270 @@ const T = (u, l) => {
187
176
  * Clears external feature-selection intent.
188
177
  */
189
178
  clearSelectedFeature: () => {
190
- n((e) => {
179
+ s((e) => {
191
180
  e.selectedFeature = null;
192
181
  });
193
182
  },
183
+ /**
184
+ * Dispatches one normalized observable-feature event to registered consumers.
185
+ */
186
+ dispatchObservableFeatureEvent: (e) => {
187
+ const o = n().hashLayers[e.layerId];
188
+ if (!Y(o, e.type))
189
+ return !1;
190
+ let r = !1;
191
+ return v.forEach(({ consumer: t, options: a }) => {
192
+ t(e), a?.captureOriginalEvent && (a.eventTypes && !a.eventTypes.includes(e.type) || (r = !0));
193
+ }), r;
194
+ },
195
+ /**
196
+ * Registers one observable-feature consumer callback.
197
+ */
198
+ subscribeObservableFeatureEvents: (e, o) => {
199
+ T += 1;
200
+ const r = `observable-feature-consumer-${T}`;
201
+ return v.set(r, {
202
+ consumer: e,
203
+ options: o
204
+ }), r;
205
+ },
206
+ /**
207
+ * Removes one observable-feature consumer callback.
208
+ */
209
+ unsubscribeObservableFeatureEvents: (e) => {
210
+ v.delete(e);
211
+ },
212
+ /**
213
+ * Resolves one normalized anchor for an observable feature.
214
+ */
215
+ resolveObservableFeatureAnchor: (e, o, r) => {
216
+ const t = n().hashLayers[e];
217
+ if (!t)
218
+ return;
219
+ const a = F(t, o);
220
+ if (a)
221
+ return W(
222
+ t,
223
+ a,
224
+ r?.purpose
225
+ );
226
+ },
227
+ /**
228
+ * Resolves one normalized pick payload from an observable feature event.
229
+ */
230
+ resolveObservableFeaturePick: (e, o) => {
231
+ const r = n().hashLayers[e.layerId];
232
+ if (!r)
233
+ return;
234
+ const t = F(r, e.featureId);
235
+ if (t)
236
+ return H(r, t, e, o?.purpose);
237
+ },
238
+ /**
239
+ * Resolves one normalized snap target for an observable feature.
240
+ */
241
+ resolveObservableFeatureSnapTarget: (e, o) => {
242
+ const r = n().hashLayers[e];
243
+ if (!r)
244
+ return;
245
+ const t = F(r, o);
246
+ if (t)
247
+ return G(r, t);
248
+ },
249
+ /**
250
+ * Atomically captures one or more interaction channels for an owner.
251
+ */
252
+ requestInteractionCapture: (e, o) => o.length === 0 ? !0 : C(n().interactionOwnership, o, e) ? (s((r) => {
253
+ o.forEach((t) => {
254
+ r.interactionOwnership.ownersByChannel[t] = e;
255
+ });
256
+ }), !0) : !1,
257
+ /**
258
+ * Releases one or more channels for the owner that currently holds them.
259
+ */
260
+ releaseInteractionCapture: (e, o = E.slice()) => {
261
+ s((r) => {
262
+ S(r.interactionOwnership, e, o);
263
+ });
264
+ },
265
+ /**
266
+ * Releases every channel currently owned by the given owner.
267
+ */
268
+ releaseAllInteractionCapture: (e) => {
269
+ s((o) => {
270
+ S(
271
+ o.interactionOwnership,
272
+ e,
273
+ E.slice()
274
+ );
275
+ });
276
+ },
277
+ /**
278
+ * Returns whether all requested channels are currently available.
279
+ */
280
+ isInteractionAvailable: (e, o) => C(n().interactionOwnership, e, o),
281
+ /**
282
+ * Returns the current owner for the requested interaction channel.
283
+ */
284
+ getInteractionOwner: (e) => n().interactionOwnership.ownersByChannel[e],
285
+ /**
286
+ * Invalidates the current viewport size through the host API.
287
+ */
288
+ invalidateViewportSize: (e = {}) => {
289
+ const { map: o, result: r } = L(
290
+ h,
291
+ n().interactionOwnership,
292
+ e.ownerId
293
+ );
294
+ return o ? b(() => (o.invalidateSize(), u("success"))) : r;
295
+ },
296
+ /**
297
+ * Moves the viewport to one serializable point.
298
+ */
299
+ moveToPoint: (e, o = {}) => {
300
+ if (!j(e))
301
+ return u("invalid-target");
302
+ const r = D(o), { map: t, result: a } = L(
303
+ h,
304
+ n().interactionOwnership,
305
+ r.ownerId
306
+ );
307
+ return t ? b(() => (O(t, r), M(
308
+ t,
309
+ e,
310
+ r.mode === "fly" ? r.zoom : void 0
311
+ ) ? u("noop") : r.mode === "fly" ? (t.flyTo([e.lat, e.lng], r.zoom ?? t.getZoom(), {
312
+ animate: r.animate,
313
+ duration: r.duration
314
+ }), u("success")) : (t.panTo([e.lat, e.lng], {
315
+ animate: r.animate,
316
+ duration: r.duration
317
+ }), u("success")))) : a;
318
+ },
319
+ /**
320
+ * Uses the shared zoom heuristic to decide between pan and fly.
321
+ */
322
+ smartMoveToPoint: (e, o = {}) => {
323
+ if (!j(e))
324
+ return u("invalid-target");
325
+ const r = R(o), { map: t, result: a } = L(
326
+ h,
327
+ n().interactionOwnership,
328
+ r.ownerId
329
+ );
330
+ return t ? b(() => {
331
+ O(t, r);
332
+ const i = r.minZoom, l = r.zoomThreshold, c = t.getZoom(), d = c >= i - l, y = d ? void 0 : Math.max(c, i);
333
+ return M(t, e, y) ? u("noop") : d ? (t.panTo([e.lat, e.lng], {
334
+ animate: r.animate,
335
+ duration: r.duration
336
+ }), u("success")) : (t.flyTo([e.lat, e.lng], y, {
337
+ animate: r.animate,
338
+ duration: r.duration
339
+ }), u("success"));
340
+ }) : a;
341
+ },
342
+ /**
343
+ * Moves the viewport to one serializable bounds object.
344
+ */
345
+ moveToBounds: (e, o = {}) => {
346
+ if (!V(e))
347
+ return u("invalid-target");
348
+ const r = Z(o), { map: t, result: a } = L(
349
+ h,
350
+ n().interactionOwnership,
351
+ r.ownerId
352
+ );
353
+ return t ? b(() => {
354
+ if (O(t, r), _(t, e))
355
+ return u("noop");
356
+ const i = [
357
+ [e.southWest.lat, e.southWest.lng],
358
+ [e.northEast.lat, e.northEast.lng]
359
+ ];
360
+ return r.mode === "fly" ? (t.flyToBounds(i, {
361
+ animate: r.animate,
362
+ duration: r.duration,
363
+ maxZoom: r.maxZoom,
364
+ padding: r.padding
365
+ }), u("success")) : (t.fitBounds(i, {
366
+ animate: r.animate,
367
+ maxZoom: r.maxZoom,
368
+ padding: r.padding
369
+ }), u("success"));
370
+ }) : a;
371
+ },
194
372
  /**
195
373
  * Registers a tool controller without forcing controller state into the
196
374
  * reactive map store.
197
375
  */
198
- registerToolController: (e, r, o = "runtime") => {
199
- g(h, e, r, o);
376
+ registerToolController: (e, o, r = "runtime") => {
377
+ z(p, e, o, r);
200
378
  },
201
379
  /**
202
380
  * Removes a previously registered tool controller.
203
381
  */
204
- unregisterToolController: (e, r = "runtime") => {
205
- O(h, e, r);
382
+ unregisterToolController: (e, o = "runtime") => {
383
+ $(p, e, o);
206
384
  },
207
385
  /**
208
386
  * Delegates an external open command to the resolved tool controller.
209
387
  */
210
388
  openTool: (e) => {
211
- L(h, e, "open");
389
+ w(p, e, "open");
212
390
  },
213
391
  /**
214
392
  * Delegates an external close command to the resolved tool controller.
215
393
  */
216
394
  closeTool: (e) => {
217
- L(h, e, "close");
395
+ w(p, e, "close");
218
396
  },
219
397
  /**
220
398
  * Delegates an external toggle command to the resolved tool controller.
221
399
  */
222
400
  toggleTool: (e) => {
223
- L(h, e, "toggle");
401
+ w(p, e, "toggle");
224
402
  },
225
403
  /**
226
404
  * TODO: Documentar
227
405
  */
228
- setCheckedLayers: (e, r, o) => {
229
- n((s) => {
230
- s.hashLayers[e] && (s.hashLayers[e][r] = o);
406
+ setCheckedLayers: (e, o, r) => {
407
+ s((t) => {
408
+ t.hashLayers[e] && (t.hashLayers[e][o] = r);
231
409
  });
232
410
  },
233
411
  /**
234
412
  * Actualizar la capa actual del mapa
235
413
  */
236
- setCurrentMapSourceLayer: (e, r) => {
237
- n((o) => {
238
- const s = o.mapSources.find((t) => t.id === e);
239
- s && s.layers.find((t) => t.id === r) && (o.currentMapSourceLayer = {
414
+ setCurrentMapSourceLayer: (e, o) => {
415
+ s((r) => {
416
+ const t = r.mapSources.find((a) => a.id === e);
417
+ t && t.layers.find((a) => a.id === o) && (r.currentMapSourceLayer = {
240
418
  mapSourceId: e,
241
- mapSourceLayerId: r
419
+ mapSourceLayerId: o
242
420
  });
243
421
  });
244
422
  },
245
423
  /**
246
424
  * TODO: Documentar
247
425
  */
248
- setMapSourceLayerRoadOptions: (e, r, o) => {
249
- n((s) => {
250
- const a = s.mapSources.find((c) => c.id === e)?.layers.find((c) => c.id === r);
251
- a && (a.roadSelectedOptions = {
252
- bicyclingLayer: a.roadSelectedOptions?.bicyclingLayer || !1,
253
- trafficLayer: a.roadSelectedOptions?.trafficLayer || !1,
254
- transitLayer: a.roadSelectedOptions?.transitLayer || !1,
255
- ...o
426
+ setMapSourceLayerRoadOptions: (e, o, r) => {
427
+ s((t) => {
428
+ const i = t.mapSources.find((l) => l.id === e)?.layers.find((l) => l.id === o);
429
+ i && (i.roadSelectedOptions = {
430
+ bicyclingLayer: i.roadSelectedOptions?.bicyclingLayer || !1,
431
+ trafficLayer: i.roadSelectedOptions?.trafficLayer || !1,
432
+ transitLayer: i.roadSelectedOptions?.transitLayer || !1,
433
+ ...r
256
434
  });
257
435
  });
258
436
  }
259
437
  }
260
438
  })),
261
- { name: `Map store: ${u.storeId}`, enabled: l }
439
+ { name: `Map store: ${g.storeId}`, enabled: B }
262
440
  )
263
441
  );
264
442
  };
265
443
  export {
266
- A as createMapStore
444
+ ue as createMapStore
267
445
  };