@tracktor/map 0.3.4 → 0.4.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.
- package/dist/main.js +257 -234
- package/dist/main.umd.cjs +8 -8
- package/dist/types/MarkerProps.d.ts +2 -1
- package/dist/utils/loadMarkers.d.ts +18 -1
- package/dist/utils/mapOptions.d.ts +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4,7 +4,7 @@ import { LicenseInfo as Pr } from "@mui/x-license";
|
|
|
4
4
|
import Or, { LngLatBounds as wr, Marker as jr, Popup as Ar, Map as Lr } from "mapbox-gl";
|
|
5
5
|
import { Box as ae, Skeleton as Fr, useTheme as Dr, GlobalStyles as Nr } from "@tracktor/design-system";
|
|
6
6
|
import Ir from "react-dom";
|
|
7
|
-
const
|
|
7
|
+
const kr = 2.333, Mr = 46.8677;
|
|
8
8
|
var K = { exports: {} }, Y = {};
|
|
9
9
|
/**
|
|
10
10
|
* @license React
|
|
@@ -19,15 +19,15 @@ var Ne;
|
|
|
19
19
|
function $r() {
|
|
20
20
|
if (Ne) return Y;
|
|
21
21
|
Ne = 1;
|
|
22
|
-
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
23
|
-
function
|
|
24
|
-
var
|
|
25
|
-
v !== void 0 && (
|
|
26
|
-
for (
|
|
27
|
-
if (
|
|
28
|
-
return { $$typeof: t, type:
|
|
22
|
+
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
23
|
+
function d(p, u, v) {
|
|
24
|
+
var f, E = {}, R = null, D = null;
|
|
25
|
+
v !== void 0 && (R = "" + v), u.key !== void 0 && (R = "" + u.key), u.ref !== void 0 && (D = u.ref);
|
|
26
|
+
for (f in u) o.call(u, f) && !l.hasOwnProperty(f) && (E[f] = u[f]);
|
|
27
|
+
if (p && p.defaultProps) for (f in u = p.defaultProps, u) E[f] === void 0 && (E[f] = u[f]);
|
|
28
|
+
return { $$typeof: t, type: p, key: R, ref: D, props: E, _owner: s.current };
|
|
29
29
|
}
|
|
30
|
-
return Y.Fragment = a, Y.jsx =
|
|
30
|
+
return Y.Fragment = a, Y.jsx = d, Y.jsxs = d, Y;
|
|
31
31
|
}
|
|
32
32
|
var U = {};
|
|
33
33
|
/**
|
|
@@ -42,7 +42,7 @@ var U = {};
|
|
|
42
42
|
var Ie;
|
|
43
43
|
function Wr() {
|
|
44
44
|
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"),
|
|
45
|
+
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), d = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), G = Symbol.iterator, B = "@@iterator";
|
|
46
46
|
function H(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
@@ -50,36 +50,36 @@ function Wr() {
|
|
|
50
50
|
return typeof n == "function" ? n : null;
|
|
51
51
|
}
|
|
52
52
|
var w = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
-
function
|
|
53
|
+
function m(e) {
|
|
54
54
|
{
|
|
55
|
-
for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0),
|
|
56
|
-
i[
|
|
55
|
+
for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), c = 1; c < n; c++)
|
|
56
|
+
i[c - 1] = arguments[c];
|
|
57
57
|
S("error", e, i);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function S(e, n, i) {
|
|
61
61
|
{
|
|
62
|
-
var
|
|
62
|
+
var c = w.ReactDebugCurrentFrame, b = c.getStackAddendum();
|
|
63
63
|
b !== "" && (n += "%s", i = i.concat([b]));
|
|
64
|
-
var
|
|
64
|
+
var h = i.map(function(g) {
|
|
65
65
|
return String(g);
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
h.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, h);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
var X = !1, N = !1, qe = !1, ze = !1, Je = !1, ce;
|
|
71
71
|
ce = Symbol.for("react.module.reference");
|
|
72
72
|
function Ke(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === o || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === o || e === l || Je || e === s || e === v || e === f || ze || e === D || X || N || qe || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === E || e.$$typeof === d || e.$$typeof === p || e.$$typeof === u || // This needs to include all possible module reference object
|
|
74
74
|
// types supported by any Flight configuration anywhere since
|
|
75
75
|
// we don't know which Flight build this will end up being used
|
|
76
76
|
// with.
|
|
77
77
|
e.$$typeof === ce || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
79
|
function He(e, n, i) {
|
|
80
|
-
var
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
var c = e.displayName;
|
|
81
|
+
if (c)
|
|
82
|
+
return c;
|
|
83
83
|
var b = n.displayName || n.name || "";
|
|
84
84
|
return b !== "" ? i + "(" + b + ")" : i;
|
|
85
85
|
}
|
|
@@ -89,7 +89,7 @@ function Wr() {
|
|
|
89
89
|
function j(e) {
|
|
90
90
|
if (e == null)
|
|
91
91
|
return null;
|
|
92
|
-
if (typeof e.tag == "number" &&
|
|
92
|
+
if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
93
93
|
return e.displayName || e.name || null;
|
|
94
94
|
if (typeof e == "string")
|
|
95
95
|
return e;
|
|
@@ -98,32 +98,32 @@ function Wr() {
|
|
|
98
98
|
return "Fragment";
|
|
99
99
|
case a:
|
|
100
100
|
return "Portal";
|
|
101
|
-
case
|
|
101
|
+
case l:
|
|
102
102
|
return "Profiler";
|
|
103
103
|
case s:
|
|
104
104
|
return "StrictMode";
|
|
105
105
|
case v:
|
|
106
106
|
return "Suspense";
|
|
107
|
-
case
|
|
107
|
+
case f:
|
|
108
108
|
return "SuspenseList";
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
111
111
|
switch (e.$$typeof) {
|
|
112
|
-
case
|
|
112
|
+
case p:
|
|
113
113
|
var n = e;
|
|
114
114
|
return le(n) + ".Consumer";
|
|
115
|
-
case
|
|
115
|
+
case d:
|
|
116
116
|
var i = e;
|
|
117
117
|
return le(i._context) + ".Provider";
|
|
118
|
-
case
|
|
118
|
+
case u:
|
|
119
119
|
return He(e, e.render, "ForwardRef");
|
|
120
|
-
case
|
|
121
|
-
var
|
|
122
|
-
return
|
|
123
|
-
case
|
|
124
|
-
var b = e,
|
|
120
|
+
case E:
|
|
121
|
+
var c = e.displayName || null;
|
|
122
|
+
return c !== null ? c : j(e.type) || "Memo";
|
|
123
|
+
case R: {
|
|
124
|
+
var b = e, h = b._payload, g = b._init;
|
|
125
125
|
try {
|
|
126
|
-
return j(g(
|
|
126
|
+
return j(g(h));
|
|
127
127
|
} catch {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -190,7 +190,7 @@ function Wr() {
|
|
|
190
190
|
})
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
$ < 0 &&
|
|
193
|
+
$ < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
var Z = w.ReactCurrentDispatcher, Q;
|
|
@@ -200,8 +200,8 @@ function Wr() {
|
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
202
|
} catch (b) {
|
|
203
|
-
var
|
|
204
|
-
Q =
|
|
203
|
+
var c = b.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
+
Q = c && c[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
207
207
|
` + Q + e;
|
|
@@ -220,12 +220,12 @@ function Wr() {
|
|
|
220
220
|
if (i !== void 0)
|
|
221
221
|
return i;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var c;
|
|
224
224
|
ee = !0;
|
|
225
225
|
var b = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
227
|
-
var
|
|
228
|
-
|
|
227
|
+
var h;
|
|
228
|
+
h = Z.current, Z.current = null, Xe();
|
|
229
229
|
try {
|
|
230
230
|
if (n) {
|
|
231
231
|
var g = function() {
|
|
@@ -239,14 +239,14 @@ function Wr() {
|
|
|
239
239
|
try {
|
|
240
240
|
Reflect.construct(g, []);
|
|
241
241
|
} catch (x) {
|
|
242
|
-
|
|
242
|
+
c = x;
|
|
243
243
|
}
|
|
244
244
|
Reflect.construct(e, [], g);
|
|
245
245
|
} else {
|
|
246
246
|
try {
|
|
247
247
|
g.call();
|
|
248
248
|
} catch (x) {
|
|
249
|
-
|
|
249
|
+
c = x;
|
|
250
250
|
}
|
|
251
251
|
e.call(g.prototype);
|
|
252
252
|
}
|
|
@@ -254,33 +254,33 @@ function Wr() {
|
|
|
254
254
|
try {
|
|
255
255
|
throw Error();
|
|
256
256
|
} catch (x) {
|
|
257
|
-
|
|
257
|
+
c = x;
|
|
258
258
|
}
|
|
259
259
|
e();
|
|
260
260
|
}
|
|
261
261
|
} catch (x) {
|
|
262
|
-
if (x &&
|
|
263
|
-
for (var
|
|
264
|
-
`), T =
|
|
265
|
-
`),
|
|
266
|
-
|
|
267
|
-
for (;
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
262
|
+
if (x && c && typeof x.stack == "string") {
|
|
263
|
+
for (var y = x.stack.split(`
|
|
264
|
+
`), T = c.stack.split(`
|
|
265
|
+
`), _ = y.length - 1, C = T.length - 1; _ >= 1 && C >= 0 && y[_] !== T[C]; )
|
|
266
|
+
C--;
|
|
267
|
+
for (; _ >= 1 && C >= 0; _--, C--)
|
|
268
|
+
if (y[_] !== T[C]) {
|
|
269
|
+
if (_ !== 1 || C !== 1)
|
|
270
270
|
do
|
|
271
|
-
if (
|
|
271
|
+
if (_--, C--, C < 0 || y[_] !== T[C]) {
|
|
272
272
|
var P = `
|
|
273
|
-
` +
|
|
273
|
+
` + y[_].replace(" at new ", " at ");
|
|
274
274
|
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, P), P;
|
|
275
275
|
}
|
|
276
|
-
while (
|
|
276
|
+
while (_ >= 1 && C >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
|
-
ee = !1, Z.current =
|
|
281
|
+
ee = !1, Z.current = h, Ze(), Error.prepareStackTrace = b;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
283
|
+
var k = e ? e.displayName || e.name : "", F = k ? V(k) : "";
|
|
284
284
|
return typeof e == "function" && q.set(e, F), F;
|
|
285
285
|
}
|
|
286
286
|
function er(e, n, i) {
|
|
@@ -300,19 +300,19 @@ function Wr() {
|
|
|
300
300
|
switch (e) {
|
|
301
301
|
case v:
|
|
302
302
|
return V("Suspense");
|
|
303
|
-
case
|
|
303
|
+
case f:
|
|
304
304
|
return V("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
307
307
|
switch (e.$$typeof) {
|
|
308
|
-
case
|
|
308
|
+
case u:
|
|
309
309
|
return er(e.render);
|
|
310
|
-
case
|
|
310
|
+
case E:
|
|
311
311
|
return z(e.type, n, i);
|
|
312
|
-
case
|
|
313
|
-
var
|
|
312
|
+
case R: {
|
|
313
|
+
var c = e, b = c._payload, h = c._init;
|
|
314
314
|
try {
|
|
315
|
-
return z(
|
|
315
|
+
return z(h(b), n, i);
|
|
316
316
|
} catch {
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -327,22 +327,22 @@ function Wr() {
|
|
|
327
327
|
} else
|
|
328
328
|
me.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function tr(e, n, i,
|
|
330
|
+
function tr(e, n, i, c, b) {
|
|
331
331
|
{
|
|
332
|
-
var
|
|
332
|
+
var h = Function.call.bind(W);
|
|
333
333
|
for (var g in e)
|
|
334
|
-
if (
|
|
335
|
-
var
|
|
334
|
+
if (h(e, g)) {
|
|
335
|
+
var y = void 0;
|
|
336
336
|
try {
|
|
337
337
|
if (typeof e[g] != "function") {
|
|
338
|
-
var T = Error((
|
|
338
|
+
var T = Error((c || "React class") + ": " + i + " type `" + g + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[g] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
339
339
|
throw T.name = "Invariant Violation", T;
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
} catch (
|
|
343
|
-
|
|
341
|
+
y = e[g](n, g, c, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
|
+
} catch (_) {
|
|
343
|
+
y = _;
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
y && !(y instanceof Error) && (J(b), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", i, g, typeof y), J(null)), y instanceof Error && !(y.message in Re) && (Re[y.message] = !0, J(b), m("Failed %s type: %s", i, y.message), J(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -368,7 +368,7 @@ function Wr() {
|
|
|
368
368
|
}
|
|
369
369
|
function Ce(e) {
|
|
370
370
|
if (ir(e))
|
|
371
|
-
return
|
|
371
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", or(e)), _e(e);
|
|
372
372
|
}
|
|
373
373
|
var Te = w.ReactCurrentOwner, ar = {
|
|
374
374
|
key: !0,
|
|
@@ -398,7 +398,7 @@ function Wr() {
|
|
|
398
398
|
function lr(e, n) {
|
|
399
399
|
{
|
|
400
400
|
var i = function() {
|
|
401
|
-
xe || (xe = !0,
|
|
401
|
+
xe || (xe = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
402
402
|
};
|
|
403
403
|
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
404
404
|
get: i,
|
|
@@ -409,7 +409,7 @@ function Wr() {
|
|
|
409
409
|
function fr(e, n) {
|
|
410
410
|
{
|
|
411
411
|
var i = function() {
|
|
412
|
-
Se || (Se = !0,
|
|
412
|
+
Se || (Se = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
413
413
|
};
|
|
414
414
|
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
415
415
|
get: i,
|
|
@@ -417,8 +417,8 @@ function Wr() {
|
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
var dr = function(e, n, i,
|
|
421
|
-
var
|
|
420
|
+
var dr = function(e, n, i, c, b, h, g) {
|
|
421
|
+
var y = {
|
|
422
422
|
// This tag allows us to uniquely identify this as a React Element
|
|
423
423
|
$$typeof: t,
|
|
424
424
|
// Built-in properties that belong on the element
|
|
@@ -427,41 +427,41 @@ function Wr() {
|
|
|
427
427
|
ref: i,
|
|
428
428
|
props: g,
|
|
429
429
|
// Record the component responsible for creating this element.
|
|
430
|
-
_owner:
|
|
430
|
+
_owner: h
|
|
431
431
|
};
|
|
432
|
-
return
|
|
432
|
+
return y._store = {}, Object.defineProperty(y._store, "validated", {
|
|
433
433
|
configurable: !1,
|
|
434
434
|
enumerable: !1,
|
|
435
435
|
writable: !0,
|
|
436
436
|
value: !1
|
|
437
|
-
}), Object.defineProperty(
|
|
437
|
+
}), Object.defineProperty(y, "_self", {
|
|
438
438
|
configurable: !1,
|
|
439
439
|
enumerable: !1,
|
|
440
440
|
writable: !1,
|
|
441
|
-
value:
|
|
442
|
-
}), Object.defineProperty(
|
|
441
|
+
value: c
|
|
442
|
+
}), Object.defineProperty(y, "_source", {
|
|
443
443
|
configurable: !1,
|
|
444
444
|
enumerable: !1,
|
|
445
445
|
writable: !1,
|
|
446
446
|
value: b
|
|
447
|
-
}), Object.freeze && (Object.freeze(
|
|
447
|
+
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
448
448
|
};
|
|
449
|
-
function pr(e, n, i,
|
|
449
|
+
function pr(e, n, i, c, b) {
|
|
450
450
|
{
|
|
451
|
-
var
|
|
452
|
-
i !== void 0 && (Ce(i),
|
|
453
|
-
for (
|
|
454
|
-
W.call(n,
|
|
451
|
+
var h, g = {}, y = null, T = null;
|
|
452
|
+
i !== void 0 && (Ce(i), y = "" + i), ur(n) && (Ce(n.key), y = "" + n.key), sr(n) && (T = n.ref, cr(n, b));
|
|
453
|
+
for (h in n)
|
|
454
|
+
W.call(n, h) && !ar.hasOwnProperty(h) && (g[h] = n[h]);
|
|
455
455
|
if (e && e.defaultProps) {
|
|
456
|
-
var
|
|
457
|
-
for (
|
|
458
|
-
g[
|
|
456
|
+
var _ = e.defaultProps;
|
|
457
|
+
for (h in _)
|
|
458
|
+
g[h] === void 0 && (g[h] = _[h]);
|
|
459
459
|
}
|
|
460
|
-
if (
|
|
461
|
-
var
|
|
462
|
-
|
|
460
|
+
if (y || T) {
|
|
461
|
+
var C = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
462
|
+
y && lr(g, C), T && fr(g, C);
|
|
463
463
|
}
|
|
464
|
-
return dr(e,
|
|
464
|
+
return dr(e, y, T, b, c, Te.current, g);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
var te = w.ReactCurrentOwner, Pe = w.ReactDebugCurrentFrame;
|
|
@@ -514,8 +514,8 @@ Check the top-level render call using <` + i + ">.");
|
|
|
514
514
|
if (we[i])
|
|
515
515
|
return;
|
|
516
516
|
we[i] = !0;
|
|
517
|
-
var
|
|
518
|
-
e && e._owner && e._owner !== te.current && (
|
|
517
|
+
var c = "";
|
|
518
|
+
e && e._owner && e._owner !== te.current && (c = " It was passed a child from " + j(e._owner.type) + "."), I(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, c), I(null);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
function Ae(e, n) {
|
|
@@ -524,15 +524,15 @@ Check the top-level render call using <` + i + ">.");
|
|
|
524
524
|
return;
|
|
525
525
|
if (re(e))
|
|
526
526
|
for (var i = 0; i < e.length; i++) {
|
|
527
|
-
var
|
|
528
|
-
oe(
|
|
527
|
+
var c = e[i];
|
|
528
|
+
oe(c) && je(c, n);
|
|
529
529
|
}
|
|
530
530
|
else if (oe(e))
|
|
531
531
|
e._store && (e._store.validated = !0);
|
|
532
532
|
else if (e) {
|
|
533
533
|
var b = H(e);
|
|
534
534
|
if (typeof b == "function" && b !== e.entries)
|
|
535
|
-
for (var
|
|
535
|
+
for (var h = b.call(e), g; !(g = h.next()).done; )
|
|
536
536
|
oe(g.value) && je(g.value, n);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -545,60 +545,60 @@ Check the top-level render call using <` + i + ">.");
|
|
|
545
545
|
var i;
|
|
546
546
|
if (typeof n == "function")
|
|
547
547
|
i = n.propTypes;
|
|
548
|
-
else if (typeof n == "object" && (n.$$typeof ===
|
|
548
|
+
else if (typeof n == "object" && (n.$$typeof === u || // Note: Memo only checks outer props here.
|
|
549
549
|
// Inner props are checked in the reconciler.
|
|
550
|
-
n.$$typeof ===
|
|
550
|
+
n.$$typeof === E))
|
|
551
551
|
i = n.propTypes;
|
|
552
552
|
else
|
|
553
553
|
return;
|
|
554
554
|
if (i) {
|
|
555
|
-
var
|
|
556
|
-
tr(i, e.props, "prop",
|
|
555
|
+
var c = j(n);
|
|
556
|
+
tr(i, e.props, "prop", c, e);
|
|
557
557
|
} else if (n.PropTypes !== void 0 && !ne) {
|
|
558
558
|
ne = !0;
|
|
559
559
|
var b = j(n);
|
|
560
|
-
|
|
560
|
+
m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
|
|
561
561
|
}
|
|
562
|
-
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved &&
|
|
562
|
+
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
function br(e) {
|
|
566
566
|
{
|
|
567
567
|
for (var n = Object.keys(e.props), i = 0; i < n.length; i++) {
|
|
568
|
-
var
|
|
569
|
-
if (
|
|
570
|
-
I(e),
|
|
568
|
+
var c = n[i];
|
|
569
|
+
if (c !== "children" && c !== "key") {
|
|
570
|
+
I(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), I(null);
|
|
571
571
|
break;
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
e.ref !== null && (I(e),
|
|
574
|
+
e.ref !== null && (I(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), I(null));
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
var Le = {};
|
|
578
|
-
function Fe(e, n, i,
|
|
578
|
+
function Fe(e, n, i, c, b, h) {
|
|
579
579
|
{
|
|
580
580
|
var g = Ke(e);
|
|
581
581
|
if (!g) {
|
|
582
|
-
var
|
|
583
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
582
|
+
var y = "";
|
|
583
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
584
584
|
var T = vr();
|
|
585
|
-
T ?
|
|
586
|
-
var
|
|
587
|
-
e === null ?
|
|
585
|
+
T ? y += T : y += Oe();
|
|
586
|
+
var _;
|
|
587
|
+
e === null ? _ = "null" : re(e) ? _ = "array" : e !== void 0 && e.$$typeof === t ? (_ = "<" + (j(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : _ = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _, y);
|
|
588
588
|
}
|
|
589
|
-
var
|
|
590
|
-
if (
|
|
591
|
-
return
|
|
589
|
+
var C = pr(e, n, i, b, h);
|
|
590
|
+
if (C == null)
|
|
591
|
+
return C;
|
|
592
592
|
if (g) {
|
|
593
593
|
var P = n.children;
|
|
594
594
|
if (P !== void 0)
|
|
595
|
-
if (
|
|
595
|
+
if (c)
|
|
596
596
|
if (re(P)) {
|
|
597
|
-
for (var
|
|
598
|
-
Ae(P[
|
|
597
|
+
for (var k = 0; k < P.length; k++)
|
|
598
|
+
Ae(P[k], e);
|
|
599
599
|
Object.freeze && Object.freeze(P);
|
|
600
600
|
} else
|
|
601
|
-
|
|
601
|
+
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
602
602
|
else
|
|
603
603
|
Ae(P, e);
|
|
604
604
|
}
|
|
@@ -608,7 +608,7 @@ Check the top-level render call using <` + i + ">.");
|
|
|
608
608
|
}), ie = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
609
609
|
if (!Le[F + ie]) {
|
|
610
610
|
var _r = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
611
|
-
|
|
611
|
+
m(`A props object containing a "key" prop is being spread into JSX:
|
|
612
612
|
let props = %s;
|
|
613
613
|
<%s {...props} />
|
|
614
614
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -616,7 +616,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
616
616
|
<%s key={someKey} {...props} />`, ie, F, _r, F), Le[F + ie] = !0;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
return e === o ? br(
|
|
619
|
+
return e === o ? br(C) : gr(C), C;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
function Er(e, n, i) {
|
|
@@ -629,9 +629,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
629
629
|
U.Fragment = o, U.jsx = Rr, U.jsxs = mr;
|
|
630
630
|
}()), U;
|
|
631
631
|
}
|
|
632
|
-
var
|
|
632
|
+
var ke;
|
|
633
633
|
function Yr() {
|
|
634
|
-
return
|
|
634
|
+
return ke || (ke = 1, process.env.NODE_ENV === "production" ? K.exports = $r() : K.exports = Wr()), K.exports;
|
|
635
635
|
}
|
|
636
636
|
var O = Yr();
|
|
637
637
|
const Ur = Tr({
|
|
@@ -649,7 +649,7 @@ const Ur = Tr({
|
|
|
649
649
|
[t, a]
|
|
650
650
|
);
|
|
651
651
|
return a && (Or.accessToken = a), /* @__PURE__ */ O.jsx(Ur.Provider, { value: o, children: r });
|
|
652
|
-
}, Gr = ({ containerStyle: r, square: t, error: a, loading: o = !1, height: s = 300, width:
|
|
652
|
+
}, Gr = ({ containerStyle: r, square: t, error: a, loading: o = !1, height: s = 300, width: l = "100%" }, d) => /* @__PURE__ */ O.jsxs(ae, { sx: { position: "relative" }, height: s, children: [
|
|
653
653
|
/* @__PURE__ */ O.jsx(
|
|
654
654
|
ae,
|
|
655
655
|
{
|
|
@@ -664,8 +664,8 @@ const Ur = Tr({
|
|
|
664
664
|
zIndex: 1,
|
|
665
665
|
...r
|
|
666
666
|
},
|
|
667
|
-
ref:
|
|
668
|
-
width:
|
|
667
|
+
ref: d,
|
|
668
|
+
width: l,
|
|
669
669
|
height: s,
|
|
670
670
|
children: a && /* @__PURE__ */ O.jsx(ae, { textAlign: "center", children: a })
|
|
671
671
|
}
|
|
@@ -680,7 +680,7 @@ const Ur = Tr({
|
|
|
680
680
|
zIndex: 0,
|
|
681
681
|
...r
|
|
682
682
|
},
|
|
683
|
-
width:
|
|
683
|
+
width: l,
|
|
684
684
|
height: s,
|
|
685
685
|
variant: t ? "rectangular" : "rounded"
|
|
686
686
|
}
|
|
@@ -691,54 +691,54 @@ const Ur = Tr({
|
|
|
691
691
|
flyToDuration: a,
|
|
692
692
|
zoom: o,
|
|
693
693
|
fitBounds: s,
|
|
694
|
-
markers:
|
|
695
|
-
fitBoundDuration:
|
|
696
|
-
fitBoundsPadding:
|
|
694
|
+
markers: l,
|
|
695
|
+
fitBoundDuration: d,
|
|
696
|
+
fitBoundsPadding: p
|
|
697
697
|
}) => {
|
|
698
698
|
A(() => {
|
|
699
699
|
if (!r.current || (t || r.current.flyTo({
|
|
700
700
|
duration: a,
|
|
701
701
|
zoom: o
|
|
702
|
-
}), !s || !(
|
|
703
|
-
const
|
|
704
|
-
const
|
|
705
|
-
return Ve(
|
|
702
|
+
}), !s || !(l != null && l.length) || (l == null ? void 0 : l.length) < 2)) return;
|
|
703
|
+
const u = new wr(), v = l.filter((f) => {
|
|
704
|
+
const E = Number(f.lng), R = Number(f.lat);
|
|
705
|
+
return Ve(R, E);
|
|
706
706
|
});
|
|
707
707
|
if (!(v.length < 2)) {
|
|
708
|
-
for (let
|
|
709
|
-
const
|
|
710
|
-
|
|
708
|
+
for (let f = 0; f < v.length; f += 1) {
|
|
709
|
+
const E = Number(v[f].lng), R = Number(v[f].lat);
|
|
710
|
+
u.extend([E, R]);
|
|
711
711
|
}
|
|
712
|
-
r.current.fitBounds(
|
|
713
|
-
duration:
|
|
714
|
-
padding:
|
|
712
|
+
r.current.fitBounds(u, {
|
|
713
|
+
duration: d,
|
|
714
|
+
padding: p
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
|
-
}, [
|
|
717
|
+
}, [l, s, p, a, o, d, t, r]);
|
|
718
718
|
}, We = (r) => Array.isArray(r) ? r.length >= 2 ? [r[0], r[1]] : void 0 : r, qr = ({ map: r, center: t }) => {
|
|
719
719
|
A(() => {
|
|
720
720
|
if (!r.current || !t) return;
|
|
721
|
-
const a = Array.isArray(t) && Ve(t[1], t[0]) ? We(t) : { lat:
|
|
721
|
+
const a = Array.isArray(t) && Ve(t[1], t[0]) ? We(t) : { lat: Mr, lng: kr };
|
|
722
722
|
a && r.current.setCenter(a);
|
|
723
723
|
}, [t, r]);
|
|
724
724
|
};
|
|
725
|
-
var
|
|
725
|
+
var M = {}, Me;
|
|
726
726
|
function zr() {
|
|
727
|
-
if (
|
|
728
|
-
|
|
727
|
+
if (Me) return M;
|
|
728
|
+
Me = 1;
|
|
729
729
|
var r = Ir;
|
|
730
730
|
if (process.env.NODE_ENV === "production")
|
|
731
|
-
|
|
731
|
+
M.createRoot = r.createRoot, M.hydrateRoot = r.hydrateRoot;
|
|
732
732
|
else {
|
|
733
733
|
var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
734
|
-
|
|
734
|
+
M.createRoot = function(a, o) {
|
|
735
735
|
t.usingClientEntryPoint = !0;
|
|
736
736
|
try {
|
|
737
737
|
return r.createRoot(a, o);
|
|
738
738
|
} finally {
|
|
739
739
|
t.usingClientEntryPoint = !1;
|
|
740
740
|
}
|
|
741
|
-
},
|
|
741
|
+
}, M.hydrateRoot = function(a, o, s) {
|
|
742
742
|
t.usingClientEntryPoint = !0;
|
|
743
743
|
try {
|
|
744
744
|
return r.hydrateRoot(a, o, s);
|
|
@@ -747,7 +747,7 @@ function zr() {
|
|
|
747
747
|
}
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
return
|
|
750
|
+
return M;
|
|
751
751
|
}
|
|
752
752
|
var Ye = zr();
|
|
753
753
|
const Jr = ({ palette: r, type: t }) => {
|
|
@@ -770,29 +770,29 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
770
770
|
}
|
|
771
771
|
}, Kr = (r, t, a, o) => {
|
|
772
772
|
const s = {
|
|
773
|
-
features: a.map((
|
|
773
|
+
features: a.map((d) => ({
|
|
774
774
|
geometry: {
|
|
775
|
-
coordinates:
|
|
775
|
+
coordinates: d.geometry.coordinates,
|
|
776
776
|
type: "Point"
|
|
777
777
|
},
|
|
778
778
|
properties: {
|
|
779
|
-
id:
|
|
780
|
-
...
|
|
779
|
+
id: d.properties.id,
|
|
780
|
+
...d.properties
|
|
781
781
|
},
|
|
782
782
|
type: "Feature"
|
|
783
783
|
})),
|
|
784
784
|
type: "FeatureCollection"
|
|
785
|
-
},
|
|
786
|
-
|
|
785
|
+
}, l = r.getSource(t);
|
|
786
|
+
l ? l.setData(s) : r.addSource(t, {
|
|
787
787
|
data: s,
|
|
788
788
|
type: "geojson"
|
|
789
|
-
}), s.features.forEach((
|
|
790
|
-
const { description:
|
|
791
|
-
r.getLayer(
|
|
792
|
-
r.setPaintProperty(
|
|
789
|
+
}), s.features.forEach((d) => {
|
|
790
|
+
const { description: p, id: u } = d.properties || {}, v = Jr({ palette: o, type: p }), f = `marker-${u}`;
|
|
791
|
+
r.getLayer(f) ? Object.entries(v || {}).forEach(([E, R]) => {
|
|
792
|
+
r.setPaintProperty(f, E, R);
|
|
793
793
|
}) : r.addLayer({
|
|
794
|
-
filter: ["==", "id",
|
|
795
|
-
id:
|
|
794
|
+
filter: ["==", "id", u],
|
|
795
|
+
id: f,
|
|
796
796
|
layout: {
|
|
797
797
|
visibility: "visible"
|
|
798
798
|
},
|
|
@@ -803,12 +803,16 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
803
803
|
});
|
|
804
804
|
}, Hr = (r, t) => {
|
|
805
805
|
document.querySelectorAll(".react-custom-marker").forEach((o) => o.remove()), t.forEach((o) => {
|
|
806
|
-
const { IconComponent: s, iconProps:
|
|
807
|
-
if (s &&
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
const
|
|
811
|
-
s &&
|
|
806
|
+
const { IconComponent: s, iconProps: l, onClick: d } = o.properties || {}, { coordinates: p } = o.geometry;
|
|
807
|
+
if (s && p.length >= 2) {
|
|
808
|
+
const u = document.createElement("div");
|
|
809
|
+
u.className = "react-custom-marker", u.style.position = "absolute";
|
|
810
|
+
const v = document.createElement("div"), f = Ye.createRoot(v);
|
|
811
|
+
s && f.render(ue.createElement(s, l || {})), u.appendChild(v);
|
|
812
|
+
const E = () => {
|
|
813
|
+
d == null || d(o);
|
|
814
|
+
};
|
|
815
|
+
u.addEventListener("click", E), new jr(u).setLngLat([p[0], p[1]]).addTo(r);
|
|
812
816
|
}
|
|
813
817
|
});
|
|
814
818
|
}, Xr = (r) => ({
|
|
@@ -826,6 +830,7 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
826
830
|
iconProps: t.iconProps,
|
|
827
831
|
id: t.id || `{marker-${a}}`,
|
|
828
832
|
name: t.name,
|
|
833
|
+
onClick: t.onClick,
|
|
829
834
|
size: t.size || 1,
|
|
830
835
|
zIndex: t.zIndex || 0
|
|
831
836
|
},
|
|
@@ -834,30 +839,30 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
834
839
|
type: "FeatureCollection"
|
|
835
840
|
}), Zr = ({ map: r, setLoadingMapBox: t, palette: a, markers: o }) => {
|
|
836
841
|
if (t(!1), !r.current) return;
|
|
837
|
-
const s = Xr(o),
|
|
838
|
-
var
|
|
839
|
-
return ((
|
|
842
|
+
const s = Xr(o), l = s.features.filter((p) => {
|
|
843
|
+
var u;
|
|
844
|
+
return ((u = p.properties) == null ? void 0 : u.IconComponent) === void 0;
|
|
840
845
|
});
|
|
841
|
-
|
|
842
|
-
const
|
|
843
|
-
var
|
|
844
|
-
return (
|
|
846
|
+
l.length && Kr(r.current, "markerProps", l, a);
|
|
847
|
+
const d = s.features.filter((p) => {
|
|
848
|
+
var u;
|
|
849
|
+
return (u = p.properties) == null ? void 0 : u.IconComponent;
|
|
845
850
|
});
|
|
846
|
-
|
|
851
|
+
d.length && Hr(r.current, d);
|
|
847
852
|
}, Qr = ({ map: r, markers: t, markersAreInvalid: a, palette: o, setLoadingMapBox: s }) => {
|
|
848
853
|
A(() => {
|
|
849
854
|
if (!r.current || a) return;
|
|
850
|
-
const
|
|
855
|
+
const l = () => {
|
|
851
856
|
t && Zr({ map: r, markers: t, palette: o, setLoadingMapBox: s });
|
|
852
857
|
};
|
|
853
|
-
r.current.loaded() ?
|
|
858
|
+
r.current.loaded() ? l() : r.current.once("load", l);
|
|
854
859
|
}, [r, t, a, o, s]);
|
|
855
860
|
}, et = ({ map: r, onMapClick: t }) => {
|
|
856
861
|
A(() => {
|
|
857
862
|
if (!r.current || !t) return;
|
|
858
863
|
const a = r.current.getCanvas(), o = (s) => {
|
|
859
|
-
const
|
|
860
|
-
t(
|
|
864
|
+
const l = [s.clientX - a.getBoundingClientRect().left, s.clientY - a.getBoundingClientRect().top], d = r.current.unproject(l);
|
|
865
|
+
t(d.lng, d.lat);
|
|
861
866
|
};
|
|
862
867
|
a.addEventListener("click", o);
|
|
863
868
|
}, [r, t]);
|
|
@@ -871,18 +876,18 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
871
876
|
o.style.position = "relative", o.style.overflow = "hidden";
|
|
872
877
|
const s = document.createElement("div");
|
|
873
878
|
s.style.padding = "10px", o.style.zIndex = "1000";
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
const
|
|
879
|
+
const l = Ye.createRoot(s);
|
|
880
|
+
l.render(t);
|
|
881
|
+
const d = new Ar({
|
|
877
882
|
closeButton: !1
|
|
878
883
|
}).setLngLat(a).setDOMContent(o).addTo(r.current);
|
|
879
|
-
|
|
884
|
+
d.on("close", () => {
|
|
880
885
|
queueMicrotask(() => {
|
|
881
|
-
|
|
886
|
+
l.unmount();
|
|
882
887
|
});
|
|
883
888
|
});
|
|
884
|
-
const
|
|
885
|
-
return o.appendChild(
|
|
889
|
+
const p = rt(d);
|
|
890
|
+
return o.appendChild(p), o.appendChild(s), d;
|
|
886
891
|
}, Ue = (r) => typeof r == "object" && r !== null && "type" in r && "coordinates" in r, tt = (r) => {
|
|
887
892
|
if (typeof r != "object" || r === null || !("geometry" in r && "properties" in r))
|
|
888
893
|
return !1;
|
|
@@ -895,56 +900,74 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
895
900
|
const { properties: s } = r;
|
|
896
901
|
return typeof s != "object" || s === null ? !1 : "id" in s && s.id !== void 0;
|
|
897
902
|
}, nt = ({ map: r, point: t }) => {
|
|
898
|
-
var s,
|
|
903
|
+
var s, l, d, p, u;
|
|
899
904
|
if (!((s = r.current) != null && s.isStyleLoaded()))
|
|
900
905
|
return null;
|
|
901
|
-
const a = ((
|
|
906
|
+
const a = ((p = (d = (l = r.current) == null ? void 0 : l.getStyle()) == null ? void 0 : d.layers) == null ? void 0 : p.filter((v) => v.id.startsWith("marker-")).map((v) => v.id)) || [], o = (u = r.current) == null ? void 0 : u.queryRenderedFeatures(t, { layers: a });
|
|
902
907
|
if (o && o.length > 0) {
|
|
903
908
|
const v = o[0];
|
|
904
909
|
if (!tt(v) || !Ue(v.geometry))
|
|
905
910
|
return null;
|
|
906
|
-
const { geometry:
|
|
907
|
-
return
|
|
911
|
+
const { geometry: f } = v, E = f.coordinates.slice();
|
|
912
|
+
return E.length !== 2 || typeof E[0] != "number" || typeof E[1] != "number" ? null : v;
|
|
908
913
|
}
|
|
909
914
|
}, ot = ({ openPopup: r, map: t, markers: a }) => {
|
|
910
915
|
const o = se(null);
|
|
911
916
|
A(() => {
|
|
912
917
|
if (!t.current || !a) return;
|
|
913
|
-
const
|
|
918
|
+
const l = t.current.getCanvas();
|
|
914
919
|
if (o.current && (o.current.remove(), o.current = null), r) {
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
const
|
|
918
|
-
coordinates:
|
|
920
|
+
const p = a.find((u) => u.id === r);
|
|
921
|
+
if (p) {
|
|
922
|
+
const u = [Number(p.lng) || 0, Number(p.lat) || 0], v = $e({
|
|
923
|
+
coordinates: u,
|
|
919
924
|
map: t,
|
|
920
|
-
tooltip:
|
|
925
|
+
tooltip: p.Tooltip
|
|
921
926
|
});
|
|
922
927
|
v && (o.current = v);
|
|
923
928
|
}
|
|
924
929
|
}
|
|
925
|
-
const
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
], v = nt({ map: t, point:
|
|
930
|
+
const d = (p) => {
|
|
931
|
+
const u = [
|
|
932
|
+
p.clientX - l.getBoundingClientRect().left,
|
|
933
|
+
p.clientY - l.getBoundingClientRect().top
|
|
934
|
+
], v = nt({ map: t, point: u });
|
|
930
935
|
if (v && v.properties && v.properties.id) {
|
|
931
936
|
o.current && (o.current.remove(), o.current = null);
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
const
|
|
937
|
+
const f = a.find((E) => E.id === v.properties.id);
|
|
938
|
+
if (f) {
|
|
939
|
+
const E = [Number(f.lng) || 0, Number(f.lat) || 0];
|
|
940
|
+
if (typeof f.onClick == "function") {
|
|
941
|
+
const R = {
|
|
942
|
+
geometry: {
|
|
943
|
+
coordinates: E,
|
|
944
|
+
type: "Point"
|
|
945
|
+
},
|
|
946
|
+
properties: {
|
|
947
|
+
description: f.name,
|
|
948
|
+
id: f.id,
|
|
949
|
+
name: f.name,
|
|
950
|
+
onClick: f.onClick,
|
|
951
|
+
size: f.size || 1,
|
|
952
|
+
zIndex: f.zIndex || 1
|
|
953
|
+
},
|
|
954
|
+
type: "Feature"
|
|
955
|
+
};
|
|
956
|
+
f.onClick(R);
|
|
957
|
+
}
|
|
935
958
|
requestAnimationFrame(() => {
|
|
936
|
-
const
|
|
937
|
-
coordinates:
|
|
959
|
+
const R = $e({
|
|
960
|
+
coordinates: E,
|
|
938
961
|
map: t,
|
|
939
|
-
tooltip:
|
|
962
|
+
tooltip: f.Tooltip
|
|
940
963
|
});
|
|
941
|
-
|
|
964
|
+
R && (o.current = R);
|
|
942
965
|
});
|
|
943
966
|
}
|
|
944
967
|
}
|
|
945
968
|
};
|
|
946
|
-
return
|
|
947
|
-
|
|
969
|
+
return l.addEventListener("click", d), () => {
|
|
970
|
+
l.removeEventListener("click", d), o.current && (o.current.remove(), o.current = null);
|
|
948
971
|
};
|
|
949
972
|
}, [t, a, r]);
|
|
950
973
|
}, it = () => {
|
|
@@ -955,11 +978,11 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
955
978
|
return !1;
|
|
956
979
|
}
|
|
957
980
|
}, at = ({ mapStyle: r, mapContainer: t, zoomFlyFrom: a, markers: o, center: s }) => {
|
|
958
|
-
var
|
|
981
|
+
var d, p;
|
|
959
982
|
return {
|
|
960
983
|
center: s ? We(s) : {
|
|
961
|
-
lat: ((
|
|
962
|
-
lng: ((
|
|
984
|
+
lat: ((d = o == null ? void 0 : o[0]) == null ? void 0 : d.lat) !== void 0 ? Number(o[0].lat) : Be,
|
|
985
|
+
lng: ((p = o == null ? void 0 : o[0]) == null ? void 0 : p.lng) !== void 0 ? Number(o[0].lng) : Ge
|
|
963
986
|
},
|
|
964
987
|
container: (t == null ? void 0 : t.current) || "",
|
|
965
988
|
cooperativeGestures: !0,
|
|
@@ -973,27 +996,27 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
973
996
|
center: a,
|
|
974
997
|
openPopup: o,
|
|
975
998
|
onMapClick: s,
|
|
976
|
-
flyToDuration:
|
|
977
|
-
fitBoundDuration:
|
|
978
|
-
fitBounds:
|
|
979
|
-
disableFlyTo:
|
|
999
|
+
flyToDuration: l = 5e3,
|
|
1000
|
+
fitBoundDuration: d = 1e3,
|
|
1001
|
+
fitBounds: p = !0,
|
|
1002
|
+
disableFlyTo: u = !1,
|
|
980
1003
|
fitBoundsPadding: v = 50,
|
|
981
|
-
mapStyle:
|
|
982
|
-
zoom:
|
|
983
|
-
zoomFlyFrom:
|
|
1004
|
+
mapStyle: f = "mapbox://styles/mapbox/streets-v12?optimize=true",
|
|
1005
|
+
zoom: E = 6,
|
|
1006
|
+
zoomFlyFrom: R = 3
|
|
984
1007
|
}) => {
|
|
985
|
-
const { palette: D } = Dr(), [G, B] = De(!0), [H, w] = De(!0),
|
|
1008
|
+
const { palette: D } = Dr(), [G, B] = De(!0), [H, w] = De(!0), m = se(null), S = se(null), X = !r || r.some((N) => N.lat === void 0 || N.lng === void 0);
|
|
986
1009
|
return A(() => {
|
|
987
1010
|
if (!it()) {
|
|
988
1011
|
w(!1), B(!1);
|
|
989
1012
|
return;
|
|
990
1013
|
}
|
|
991
|
-
if (S.current || !
|
|
1014
|
+
if (S.current || !m.current || t)
|
|
992
1015
|
return;
|
|
993
|
-
|
|
994
|
-
const N = at({ center: a, mapContainer:
|
|
1016
|
+
m.current.innerHTML !== "" && (m.current.innerHTML = "");
|
|
1017
|
+
const N = at({ center: a, mapContainer: m, mapStyle: f, markers: r, zoomFlyFrom: R });
|
|
995
1018
|
S.current = new Lr(N);
|
|
996
|
-
}, [a, t,
|
|
1019
|
+
}, [a, t, f, r, R]), Qr({ map: S, markers: r, markersAreInvalid: X, palette: D, setLoadingMapBox: B }), ot({ map: S, markers: r, openPopup: o }), qr({ center: a, map: S }), et({ map: S, onMapClick: s }), Vr({ disableFlyTo: u, fitBoundDuration: d, fitBounds: p, fitBoundsPadding: v, flyToDuration: l, map: S, markers: r, zoom: E }), A(
|
|
997
1020
|
() => () => {
|
|
998
1021
|
S.current && (S.current.remove(), S.current = null);
|
|
999
1022
|
},
|
|
@@ -1001,12 +1024,12 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1001
1024
|
), {
|
|
1002
1025
|
loading: G || t,
|
|
1003
1026
|
map: S,
|
|
1004
|
-
mapContainer:
|
|
1027
|
+
mapContainer: m,
|
|
1005
1028
|
markers: r,
|
|
1006
1029
|
webGLSupported: H
|
|
1007
1030
|
};
|
|
1008
|
-
}, vt = ({ containerStyle: r, square: t, theme: a, height: o = 300, width: s = "100%", ...
|
|
1009
|
-
const { loading:
|
|
1031
|
+
}, vt = ({ containerStyle: r, square: t, theme: a, height: o = 300, width: s = "100%", ...l }) => {
|
|
1032
|
+
const { loading: d, mapContainer: p, webGLSupported: u } = st(l);
|
|
1010
1033
|
return /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
|
|
1011
1034
|
/* @__PURE__ */ O.jsx(
|
|
1012
1035
|
Nr,
|
|
@@ -1025,20 +1048,20 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1025
1048
|
/* @__PURE__ */ O.jsx(
|
|
1026
1049
|
Br,
|
|
1027
1050
|
{
|
|
1028
|
-
ref:
|
|
1029
|
-
loading:
|
|
1051
|
+
ref: p,
|
|
1052
|
+
loading: d,
|
|
1030
1053
|
height: o,
|
|
1031
1054
|
width: s,
|
|
1032
1055
|
containerStyle: r,
|
|
1033
1056
|
square: t,
|
|
1034
|
-
error: !
|
|
1057
|
+
error: !u && "WebGL is not enabled in your browser. This technology is required to display the interactive map."
|
|
1035
1058
|
}
|
|
1036
1059
|
)
|
|
1037
1060
|
] });
|
|
1038
1061
|
}, Ve = (r, t) => Number.isFinite(r) && Number.isFinite(t) && r >= -90 && r <= 90 && t >= -180 && t <= 180;
|
|
1039
1062
|
export {
|
|
1040
|
-
|
|
1041
|
-
|
|
1063
|
+
Mr as DEFAULT_CENTER_LAT,
|
|
1064
|
+
kr as DEFAULT_CENTER_LNG,
|
|
1042
1065
|
pt as MapProvider,
|
|
1043
1066
|
Ur as MapProviderContext,
|
|
1044
1067
|
vt as MarkerMap,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var le;function Xe(){if(le)return G;le=1;var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
10
|
+
*/var le;function Xe(){if(le)return G;le=1;var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(p,u,v){var f,b={},_=null,M=null;v!==void 0&&(_=""+v),u.key!==void 0&&(_=""+u.key),u.ref!==void 0&&(M=u.ref);for(f in u)o.call(u,f)&&!l.hasOwnProperty(f)&&(b[f]=u[f]);if(p&&p.defaultProps)for(f in u=p.defaultProps,u)b[f]===void 0&&(b[f]=u[f]);return{$$typeof:r,type:p,key:_,ref:M,props:b,_owner:s.current}}return G.Fragment=a,G.jsx=d,G.jsxs=d,G}var B={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-jsx-runtime.development.js
|
|
13
13
|
*
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var fe;function qe(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&function(){var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),
|
|
19
|
-
`+ne+e}}var oe=!1,q;{var xt=typeof WeakMap=="function"?WeakMap:Map;q=new xt}function Ae(e,n){if(!e||oe)return"";{var i=q.get(e);if(i!==void 0)return i}var
|
|
20
|
-
`),
|
|
21
|
-
`),
|
|
22
|
-
`+
|
|
18
|
+
*/var fe;function qe(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&function(){var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),p=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),K=Symbol.iterator,H="@@iterator";function ee(e){if(e===null||typeof e!="object")return null;var n=K&&e[K]||e[H];return typeof n=="function"?n:null}var L=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){{for(var n=arguments.length,i=new Array(n>1?n-1:0),c=1;c<n;c++)i[c-1]=arguments[c];O("error",e,i)}}function O(e,n,i){{var c=L.ReactDebugCurrentFrame,E=c.getStackAddendum();E!==""&&(n+="%s",i=i.concat([E]));var h=i.map(function(g){return String(g)});h.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,h)}}var te=!1,I=!1,bt=!1,ht=!1,Rt=!1,me;me=Symbol.for("react.module.reference");function _t(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===l||Rt||e===s||e===v||e===f||ht||e===M||te||I||bt||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===b||e.$$typeof===d||e.$$typeof===p||e.$$typeof===u||e.$$typeof===me||e.getModuleId!==void 0))}function mt(e,n,i){var c=e.displayName;if(c)return c;var E=n.displayName||n.name||"";return E!==""?i+"("+E+")":i}function Ce(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case a:return"Portal";case l:return"Profiler";case s:return"StrictMode";case v:return"Suspense";case f:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var n=e;return Ce(n)+".Consumer";case d:var i=e;return Ce(i._context)+".Provider";case u:return mt(e,e.render,"ForwardRef");case b:var c=e.displayName||null;return c!==null?c:A(e.type)||"Memo";case _:{var E=e,h=E._payload,g=E._init;try{return A(g(h))}catch{return null}}}return null}var F=Object.assign,V=0,Te,xe,Pe,Se,Oe,we,je;function Le(){}Le.__reactDisabledLog=!0;function Ct(){{if(V===0){Te=console.log,xe=console.info,Pe=console.warn,Se=console.error,Oe=console.group,we=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Le,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function Tt(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Te}),info:F({},e,{value:xe}),warn:F({},e,{value:Pe}),error:F({},e,{value:Se}),group:F({},e,{value:Oe}),groupCollapsed:F({},e,{value:we}),groupEnd:F({},e,{value:je})})}V<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=L.ReactCurrentDispatcher,ne;function X(e,n,i){{if(ne===void 0)try{throw Error()}catch(E){var c=E.stack.trim().match(/\n( *(at )?)/);ne=c&&c[1]||""}return`
|
|
19
|
+
`+ne+e}}var oe=!1,q;{var xt=typeof WeakMap=="function"?WeakMap:Map;q=new xt}function Ae(e,n){if(!e||oe)return"";{var i=q.get(e);if(i!==void 0)return i}var c;oe=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=re.current,re.current=null,Ct();try{if(n){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(S){c=S}Reflect.construct(e,[],g)}else{try{g.call()}catch(S){c=S}e.call(g.prototype)}}else{try{throw Error()}catch(S){c=S}e()}}catch(S){if(S&&c&&typeof S.stack=="string"){for(var y=S.stack.split(`
|
|
20
|
+
`),P=c.stack.split(`
|
|
21
|
+
`),C=y.length-1,T=P.length-1;C>=1&&T>=0&&y[C]!==P[T];)T--;for(;C>=1&&T>=0;C--,T--)if(y[C]!==P[T]){if(C!==1||T!==1)do if(C--,T--,T<0||y[C]!==P[T]){var w=`
|
|
22
|
+
`+y[C].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,w),w}while(C>=1&&T>=0);break}}}finally{oe=!1,re.current=h,Tt(),Error.prepareStackTrace=E}var U=e?e.displayName||e.name:"",N=U?X(U):"";return typeof e=="function"&&q.set(e,N),N}function Pt(e,n,i){return Ae(e,!1)}function St(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Z(e,n,i){if(e==null)return"";if(typeof e=="function")return Ae(e,St(e));if(typeof e=="string")return X(e);switch(e){case v:return X("Suspense");case f:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Pt(e.render);case b:return Z(e.type,n,i);case _:{var c=e,E=c._payload,h=c._init;try{return Z(h(E),n,i)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,Fe={},Ne=L.ReactDebugCurrentFrame;function Q(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);Ne.setExtraStackFrame(i)}else Ne.setExtraStackFrame(null)}function Ot(e,n,i,c,E){{var h=Function.call.bind(z);for(var g in e)if(h(e,g)){var y=void 0;try{if(typeof e[g]!="function"){var P=Error((c||"React class")+": "+i+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}y=e[g](n,g,c,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(C){y=C}y&&!(y instanceof Error)&&(Q(E),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",i,g,typeof y),Q(null)),y instanceof Error&&!(y.message in Fe)&&(Fe[y.message]=!0,Q(E),m("Failed %s type: %s",i,y.message),Q(null))}}}var wt=Array.isArray;function ie(e){return wt(e)}function jt(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,i=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function Lt(e){try{return De(e),!1}catch{return!0}}function De(e){return""+e}function ke(e){if(Lt(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jt(e)),De(e)}var Me=L.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Ie,We;function Ft(e){if(z.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function Nt(e){if(z.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function Dt(e,n){typeof e.ref=="string"&&Me.current}function kt(e,n){{var i=function(){Ie||(Ie=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function Mt(e,n){{var i=function(){We||(We=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var It=function(e,n,i,c,E,h,g){var y={$$typeof:r,type:e,key:n,ref:i,props:g,_owner:h};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function Wt(e,n,i,c,E){{var h,g={},y=null,P=null;i!==void 0&&(ke(i),y=""+i),Nt(n)&&(ke(n.key),y=""+n.key),Ft(n)&&(P=n.ref,Dt(n,E));for(h in n)z.call(n,h)&&!At.hasOwnProperty(h)&&(g[h]=n[h]);if(e&&e.defaultProps){var C=e.defaultProps;for(h in C)g[h]===void 0&&(g[h]=C[h])}if(y||P){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;y&&kt(g,T),P&&Mt(g,T)}return It(e,y,P,E,c,Me.current,g)}}var ae=L.ReactCurrentOwner,Ue=L.ReactDebugCurrentFrame;function W(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);Ue.setExtraStackFrame(i)}else Ue.setExtraStackFrame(null)}var se;se=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Ye(){{if(ae.current){var e=A(ae.current.type);if(e)return`
|
|
23
23
|
|
|
24
24
|
Check the render method of \``+e+"`."}return""}}function Ut(e){return""}var Ge={};function Yt(e){{var n=Ye();if(!n){var i=typeof e=="string"?e:e.displayName||e.name;i&&(n=`
|
|
25
25
|
|
|
26
|
-
Check the top-level render call using <`+i+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Yt(n);if(Ge[i])return;Ge[i]=!0;var
|
|
26
|
+
Check the top-level render call using <`+i+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Yt(n);if(Ge[i])return;Ge[i]=!0;var c="";e&&e._owner&&e._owner!==ae.current&&(c=" It was passed a child from "+A(e._owner.type)+"."),W(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,c),W(null)}}function Ve(e,n){{if(typeof e!="object")return;if(ie(e))for(var i=0;i<e.length;i++){var c=e[i];ue(c)&&Be(c,n)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var E=ee(e);if(typeof E=="function"&&E!==e.entries)for(var h=E.call(e),g;!(g=h.next()).done;)ue(g.value)&&Be(g.value,n)}}}function Gt(e){{var n=e.type;if(n==null||typeof n=="string")return;var i;if(typeof n=="function")i=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===b))i=n.propTypes;else return;if(i){var c=A(n);Ot(i,e.props,"prop",c,e)}else if(n.PropTypes!==void 0&&!se){se=!0;var E=A(n);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var n=Object.keys(e.props),i=0;i<n.length;i++){var c=n[i];if(c!=="children"&&c!=="key"){W(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),W(null);break}}e.ref!==null&&(W(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}var ze={};function Je(e,n,i,c,E,h){{var g=_t(e);if(!g){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Ut();P?y+=P:y+=Ye();var C;e===null?C="null":ie(e)?C="array":e!==void 0&&e.$$typeof===r?(C="<"+(A(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,y)}var T=Wt(e,n,i,E,h);if(T==null)return T;if(g){var w=n.children;if(w!==void 0)if(c)if(ie(w)){for(var U=0;U<w.length;U++)Ve(w[U],e);Object.freeze&&Object.freeze(w)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ve(w,e)}if(z.call(n,"key")){var N=A(e),S=Object.keys(n).filter(function(Xt){return Xt!=="key"}),ce=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!ze[N+ce]){var Ht=S.length>0?"{"+S.join(": ..., ")+": ...}":"{}";m(`A props object containing a "key" prop is being spread into JSX:
|
|
27
27
|
let props = %s;
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,ce,N,Ht,N),ze[N+ce]=!0}}return e===o?Bt(C):Gt(C),C}}function Vt(e,n,i){return Je(e,n,i,!0)}function zt(e,n,i){return Je(e,n,i,!1)}var Jt=zt,Kt=Vt;B.Fragment=o,B.jsx=Jt,B.jsxs=Kt}()),B}var de;function Ze(){return de||(de=1,process.env.NODE_ENV==="production"?J.exports=Xe():J.exports=qe()),J.exports}var j=Ze();const pe=R.createContext({licenceMapbox:"",licenseMuiX:""}),Qe=({children:t,licenseMuiX:r,licenceMapbox:a})=>{R.useEffect(()=>{r&&Ke.LicenseInfo.setLicenseKey(r)},[r]);const o=R.useMemo(()=>({licenceMapbox:a,licenseMuiX:r}),[r,a]);return a&&(Y.accessToken=a),j.jsx(pe.Provider,{value:o,children:t})},$e=({containerStyle:t,square:r,error:a,loading:o=!1,height:s=300,width:c="100%"},l)=>j.jsxs(D.Box,{sx:{position:"relative"},height:s,children:[j.jsx(D.Box,{sx:{alignItems:"center",borderRadius:r?0:1,display:"flex",justifyContent:"center",left:0,position:"absolute",top:0,zIndex:1,...t},ref:l,width:c,height:s,children:a&&j.jsx(D.Box,{textAlign:"center",children:a})}),o&&j.jsx(D.Skeleton,{sx:{left:0,position:"absolute",top:0,zIndex:0,...t},width:c,height:s,variant:r?"rectangular":"rounded"})]}),et=R.forwardRef($e),tt=({map:t,disableFlyTo:r,flyToDuration:a,zoom:o,fitBounds:s,markers:c,fitBoundDuration:l,fitBoundsPadding:d})=>{R.useEffect(()=>{if(!t.current||(r||t.current.flyTo({duration:a,zoom:o}),!s||!(c!=null&&c.length)||(c==null?void 0:c.length)<2))return;const f=new Y.LngLatBounds,v=c.filter(y=>{const h=Number(y.lng),T=Number(y.lat);return $(T,h)});if(!(v.length<2)){for(let y=0;y<v.length;y+=1){const h=Number(v[y].lng),T=Number(v[y].lat);f.extend([h,T])}t.current.fitBounds(f,{duration:l,padding:d})}},[c,s,d,a,o,l,r,t])},ve=t=>Array.isArray(t)?t.length>=2?[t[0],t[1]]:void 0:t,rt=({map:t,center:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=Array.isArray(r)&&$(r[1],r[0])?ve(r):{lat:46.8677,lng:2.333};a&&t.current.setCenter(a)},[r,t])};var M={},ye;function nt(){if(ye)return M;ye=1;var t=He;if(process.env.NODE_ENV==="production")M.createRoot=t.createRoot,M.hydrateRoot=t.hydrateRoot;else{var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;M.createRoot=function(a,o){r.usingClientEntryPoint=!0;try{return t.createRoot(a,o)}finally{r.usingClientEntryPoint=!1}},M.hydrateRoot=function(a,o,s){r.usingClientEntryPoint=!0;try{return t.hydrateRoot(a,o,s)}finally{r.usingClientEntryPoint=!1}}}return M}var ge=nt();const ot=({palette:t,type:r})=>{const a=t.mode==="dark"?"black":"white",o=t.secondary.main,s=t.info.main;switch(r){case"dropOff":return{"circle-color":a,"circle-radius":5,"circle-stroke-color":s,"circle-stroke-width":6};default:return{"circle-color":a,"circle-radius":7,"circle-stroke-color":o,"circle-stroke-width":8}}},it=(t,r,a,o)=>{const s={features:a.map(l=>({geometry:{coordinates:l.geometry.coordinates,type:"Point"},properties:{id:l.properties.id,...l.properties},type:"Feature"})),type:"FeatureCollection"},c=t.getSource(r);c?c.setData(s):t.addSource(r,{data:s,type:"geojson"}),s.features.forEach(l=>{const{description:d,id:f}=l.properties||{},v=ot({palette:o,type:d}),y=`marker-${f}`;t.getLayer(y)?Object.entries(v||{}).forEach(([h,T])=>{t.setPaintProperty(y,h,T)}):t.addLayer({filter:["==","id",f],id:y,layout:{visibility:"visible"},paint:v,source:r,type:"circle"})})},at=(t,r)=>{document.querySelectorAll(".react-custom-marker").forEach(o=>o.remove()),r.forEach(o=>{const{IconComponent:s,iconProps:c}=o.properties||{},{coordinates:l}=o.geometry;if(s&&l.length>=2){const d=document.createElement("div");d.className="react-custom-marker",d.style.position="absolute";const f=document.createElement("div"),v=ge.createRoot(f);s&&v.render(R.createElement(s,c||{})),d.appendChild(f),new Y.Marker(d).setLngLat([l[0],l[1]]).addTo(t)}})},st=t=>({features:(t==null?void 0:t.map((r,a)=>({geometry:{coordinates:[Number.isFinite(Number(r.lng))?Number(r.lng):Number(Re),Number.isFinite(Number(r.lat))?Number(r.lat):Number(_e)],type:"Point"},properties:{description:r.type,IconComponent:r.IconComponent,iconProps:r.iconProps,id:r.id||`{marker-${a}}`,name:r.name,size:r.size||1,zIndex:r.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:t,setLoadingMapBox:r,palette:a,markers:o})=>{if(r(!1),!t.current)return;const s=st(o),c=s.features.filter(d=>{var f;return((f=d.properties)==null?void 0:f.IconComponent)===void 0});c.length&&it(t.current,"markerProps",c,a);const l=s.features.filter(d=>{var f;return(f=d.properties)==null?void 0:f.IconComponent});l.length&&at(t.current,l)},ct=({map:t,markers:r,markersAreInvalid:a,palette:o,setLoadingMapBox:s})=>{R.useEffect(()=>{if(!t.current||a)return;const c=()=>{r&&ut({map:t,markers:r,palette:o,setLoadingMapBox:s})};t.current.loaded()?c():t.current.once("load",c)},[t,r,a,o,s])},lt=({map:t,onMapClick:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=t.current.getCanvas(),o=s=>{const c=[s.clientX-a.getBoundingClientRect().left,s.clientY-a.getBoundingClientRect().top],l=t.current.unproject(c);r(l.lng,l.lat)};a.addEventListener("click",o)},[t,r])},ft=t=>{const r=document.createElement("button");return r.innerText="×",r.style.position="absolute",r.style.top="5px",r.style.right="5px",r.style.background="transparent",r.style.border="none",r.style.fontSize="16px",r.style.padding="0",r.style.margin="10px",r.style.cursor="pointer",r.type="button",r.setAttribute("aria-label","Close popup"),r.removeAttribute("aria-hidden"),r.onclick=()=>t.remove(),r},Ee=({map:t,tooltip:r,coordinates:a})=>{if(!a||!r||!t.current||!Array.isArray(a)||a.length!==2)return null;const o=document.createElement("div");o.style.position="relative",o.style.overflow="hidden";const s=document.createElement("div");s.style.padding="10px",o.style.zIndex="1000";const c=ge.createRoot(s);c.render(r);const l=new Y.Popup({closeButton:!1}).setLngLat(a).setDOMContent(o).addTo(t.current);l.on("close",()=>{queueMicrotask(()=>{c.unmount()})});const d=ft(l);return o.appendChild(d),o.appendChild(s),l},be=t=>typeof t=="object"&&t!==null&&"type"in t&&"coordinates"in t,dt=t=>{if(typeof t!="object"||t===null||!("geometry"in t&&"properties"in t))return!1;const{geometry:a}=t;if(typeof a!="object"||a===null||!("coordinates"in a))return!1;const{coordinates:o}=a;if(!Array.isArray(o)||o.length!==2||!be(a))return!1;const{properties:s}=t;return typeof s!="object"||s===null?!1:"id"in s&&s.id!==void 0},pt=({map:t,point:r})=>{var s,c,l,d,f;if(!((s=t.current)!=null&&s.isStyleLoaded()))return null;const a=((d=(l=(c=t.current)==null?void 0:c.getStyle())==null?void 0:l.layers)==null?void 0:d.filter(v=>v.id.startsWith("marker-")).map(v=>v.id))||[],o=(f=t.current)==null?void 0:f.queryRenderedFeatures(r,{layers:a});if(o&&o.length>0){const v=o[0];if(!dt(v)||!be(v.geometry))return null;const{geometry:y}=v,h=y.coordinates.slice();return h.length!==2||typeof h[0]!="number"||typeof h[1]!="number"?null:v}},vt=({openPopup:t,map:r,markers:a})=>{const o=R.useRef(null);R.useEffect(()=>{if(!r.current||!a)return;const c=r.current.getCanvas();if(o.current&&(o.current.remove(),o.current=null),t){const d=a.find(f=>f.id===t);if(d){const f=[Number(d.lng)||0,Number(d.lat)||0],v=Ee({coordinates:f,map:r,tooltip:d.Tooltip});v&&(o.current=v)}}const l=d=>{const f=[d.clientX-c.getBoundingClientRect().left,d.clientY-c.getBoundingClientRect().top],v=pt({map:r,point:f});if(v&&v.properties&&v.properties.id){o.current&&(o.current.remove(),o.current=null);const y=a.find(h=>h.id===v.properties.id);if(y){const h=[Number(y.lng)||0,Number(y.lat)||0];requestAnimationFrame(()=>{const T=Ee({coordinates:h,map:r,tooltip:y.Tooltip});T&&(o.current=T)})}}};return c.addEventListener("click",l),()=>{c.removeEventListener("click",l),o.current&&(o.current.remove(),o.current=null)}},[r,a,t])},he=()=>{try{const t=document.createElement("canvas");return(t.getContext("webgl")||t.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}},yt=({mapStyle:t,mapContainer:r,zoomFlyFrom:a,markers:o,center:s})=>{var l,d;return{center:s?ve(s):{lat:((l=o==null?void 0:o[0])==null?void 0:l.lat)!==void 0?Number(o[0].lat):_e,lng:((d=o==null?void 0:o[0])==null?void 0:d.lng)!==void 0?Number(o[0].lng):Re},container:(r==null?void 0:r.current)||"",cooperativeGestures:!0,failIfMajorPerformanceCaveat:!1,style:t,zoom:a}},Re=2.333,_e=46.8677,gt=({markers:t,loading:r,center:a,openPopup:o,onMapClick:s,flyToDuration:c=5e3,fitBoundDuration:l=1e3,fitBounds:d=!0,disableFlyTo:f=!1,fitBoundsPadding:v=50,mapStyle:y="mapbox://styles/mapbox/streets-v12?optimize=true",zoom:h=6,zoomFlyFrom:T=3})=>{const{palette:I}=D.useTheme(),[K,H]=R.useState(!0),[ee,L]=R.useState(!0),_=R.useRef(null),O=R.useRef(null),te=!t||t.some(k=>k.lat===void 0||k.lng===void 0);return R.useEffect(()=>{if(!he()){L(!1),H(!1);return}if(O.current||!_.current||r)return;_.current.innerHTML!==""&&(_.current.innerHTML="");const k=yt({center:a,mapContainer:_,mapStyle:y,markers:t,zoomFlyFrom:T});O.current=new Y.Map(k)},[a,r,y,t,T]),ct({map:O,markers:t,markersAreInvalid:te,palette:I,setLoadingMapBox:H}),vt({map:O,markers:t,openPopup:o}),rt({center:a,map:O}),lt({map:O,onMapClick:s}),tt({disableFlyTo:f,fitBoundDuration:l,fitBounds:d,fitBoundsPadding:v,flyToDuration:c,map:O,markers:t,zoom:h}),R.useEffect(()=>()=>{O.current&&(O.current.remove(),O.current=null)},[]),{loading:K||r,map:O,mapContainer:_,markers:t,webGLSupported:ee}},Et=({containerStyle:t,square:r,theme:a,height:o=300,width:s="100%",...c})=>{const{loading:l,mapContainer:d,webGLSupported:f}=gt(c);return j.jsxs(j.Fragment,{children:[j.jsx(D.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),j.jsx(et,{ref:d,loading:l,height:o,width:s,containerStyle:t,square:r,error:!f&&"WebGL is not enabled in your browser. This technology is required to display the interactive map."})]})},$=(t,r)=>Number.isFinite(t)&&Number.isFinite(r)&&t>=-90&&t<=90&&r>=-180&&r<=180;x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=Qe,x.MapProviderContext=pe,x.MarkerMap=Et,x.isValidLatLng=$,x.isWebGLSupported=he,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
31
|
+
<%s key={someKey} {...props} />`,ce,N,Ht,N),ze[N+ce]=!0}}return e===o?Bt(T):Gt(T),T}}function Vt(e,n,i){return Je(e,n,i,!0)}function zt(e,n,i){return Je(e,n,i,!1)}var Jt=zt,Kt=Vt;B.Fragment=o,B.jsx=Jt,B.jsxs=Kt}()),B}var de;function Ze(){return de||(de=1,process.env.NODE_ENV==="production"?J.exports=Xe():J.exports=qe()),J.exports}var j=Ze();const pe=R.createContext({licenceMapbox:"",licenseMuiX:""}),Qe=({children:t,licenseMuiX:r,licenceMapbox:a})=>{R.useEffect(()=>{r&&Ke.LicenseInfo.setLicenseKey(r)},[r]);const o=R.useMemo(()=>({licenceMapbox:a,licenseMuiX:r}),[r,a]);return a&&(Y.accessToken=a),j.jsx(pe.Provider,{value:o,children:t})},$e=({containerStyle:t,square:r,error:a,loading:o=!1,height:s=300,width:l="100%"},d)=>j.jsxs(D.Box,{sx:{position:"relative"},height:s,children:[j.jsx(D.Box,{sx:{alignItems:"center",borderRadius:r?0:1,display:"flex",justifyContent:"center",left:0,position:"absolute",top:0,zIndex:1,...t},ref:d,width:l,height:s,children:a&&j.jsx(D.Box,{textAlign:"center",children:a})}),o&&j.jsx(D.Skeleton,{sx:{left:0,position:"absolute",top:0,zIndex:0,...t},width:l,height:s,variant:r?"rectangular":"rounded"})]}),et=R.forwardRef($e),tt=({map:t,disableFlyTo:r,flyToDuration:a,zoom:o,fitBounds:s,markers:l,fitBoundDuration:d,fitBoundsPadding:p})=>{R.useEffect(()=>{if(!t.current||(r||t.current.flyTo({duration:a,zoom:o}),!s||!(l!=null&&l.length)||(l==null?void 0:l.length)<2))return;const u=new Y.LngLatBounds,v=l.filter(f=>{const b=Number(f.lng),_=Number(f.lat);return $(_,b)});if(!(v.length<2)){for(let f=0;f<v.length;f+=1){const b=Number(v[f].lng),_=Number(v[f].lat);u.extend([b,_])}t.current.fitBounds(u,{duration:d,padding:p})}},[l,s,p,a,o,d,r,t])},ve=t=>Array.isArray(t)?t.length>=2?[t[0],t[1]]:void 0:t,rt=({map:t,center:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=Array.isArray(r)&&$(r[1],r[0])?ve(r):{lat:46.8677,lng:2.333};a&&t.current.setCenter(a)},[r,t])};var k={},ye;function nt(){if(ye)return k;ye=1;var t=He;if(process.env.NODE_ENV==="production")k.createRoot=t.createRoot,k.hydrateRoot=t.hydrateRoot;else{var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;k.createRoot=function(a,o){r.usingClientEntryPoint=!0;try{return t.createRoot(a,o)}finally{r.usingClientEntryPoint=!1}},k.hydrateRoot=function(a,o,s){r.usingClientEntryPoint=!0;try{return t.hydrateRoot(a,o,s)}finally{r.usingClientEntryPoint=!1}}}return k}var ge=nt();const ot=({palette:t,type:r})=>{const a=t.mode==="dark"?"black":"white",o=t.secondary.main,s=t.info.main;switch(r){case"dropOff":return{"circle-color":a,"circle-radius":5,"circle-stroke-color":s,"circle-stroke-width":6};default:return{"circle-color":a,"circle-radius":7,"circle-stroke-color":o,"circle-stroke-width":8}}},it=(t,r,a,o)=>{const s={features:a.map(d=>({geometry:{coordinates:d.geometry.coordinates,type:"Point"},properties:{id:d.properties.id,...d.properties},type:"Feature"})),type:"FeatureCollection"},l=t.getSource(r);l?l.setData(s):t.addSource(r,{data:s,type:"geojson"}),s.features.forEach(d=>{const{description:p,id:u}=d.properties||{},v=ot({palette:o,type:p}),f=`marker-${u}`;t.getLayer(f)?Object.entries(v||{}).forEach(([b,_])=>{t.setPaintProperty(f,b,_)}):t.addLayer({filter:["==","id",u],id:f,layout:{visibility:"visible"},paint:v,source:r,type:"circle"})})},at=(t,r)=>{document.querySelectorAll(".react-custom-marker").forEach(o=>o.remove()),r.forEach(o=>{const{IconComponent:s,iconProps:l,onClick:d}=o.properties||{},{coordinates:p}=o.geometry;if(s&&p.length>=2){const u=document.createElement("div");u.className="react-custom-marker",u.style.position="absolute";const v=document.createElement("div"),f=ge.createRoot(v);s&&f.render(R.createElement(s,l||{})),u.appendChild(v);const b=()=>{d==null||d(o)};u.addEventListener("click",b),new Y.Marker(u).setLngLat([p[0],p[1]]).addTo(t)}})},st=t=>({features:(t==null?void 0:t.map((r,a)=>({geometry:{coordinates:[Number.isFinite(Number(r.lng))?Number(r.lng):Number(Re),Number.isFinite(Number(r.lat))?Number(r.lat):Number(_e)],type:"Point"},properties:{description:r.type,IconComponent:r.IconComponent,iconProps:r.iconProps,id:r.id||`{marker-${a}}`,name:r.name,onClick:r.onClick,size:r.size||1,zIndex:r.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:t,setLoadingMapBox:r,palette:a,markers:o})=>{if(r(!1),!t.current)return;const s=st(o),l=s.features.filter(p=>{var u;return((u=p.properties)==null?void 0:u.IconComponent)===void 0});l.length&&it(t.current,"markerProps",l,a);const d=s.features.filter(p=>{var u;return(u=p.properties)==null?void 0:u.IconComponent});d.length&&at(t.current,d)},ct=({map:t,markers:r,markersAreInvalid:a,palette:o,setLoadingMapBox:s})=>{R.useEffect(()=>{if(!t.current||a)return;const l=()=>{r&&ut({map:t,markers:r,palette:o,setLoadingMapBox:s})};t.current.loaded()?l():t.current.once("load",l)},[t,r,a,o,s])},lt=({map:t,onMapClick:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=t.current.getCanvas(),o=s=>{const l=[s.clientX-a.getBoundingClientRect().left,s.clientY-a.getBoundingClientRect().top],d=t.current.unproject(l);r(d.lng,d.lat)};a.addEventListener("click",o)},[t,r])},ft=t=>{const r=document.createElement("button");return r.innerText="×",r.style.position="absolute",r.style.top="5px",r.style.right="5px",r.style.background="transparent",r.style.border="none",r.style.fontSize="16px",r.style.padding="0",r.style.margin="10px",r.style.cursor="pointer",r.type="button",r.setAttribute("aria-label","Close popup"),r.removeAttribute("aria-hidden"),r.onclick=()=>t.remove(),r},Ee=({map:t,tooltip:r,coordinates:a})=>{if(!a||!r||!t.current||!Array.isArray(a)||a.length!==2)return null;const o=document.createElement("div");o.style.position="relative",o.style.overflow="hidden";const s=document.createElement("div");s.style.padding="10px",o.style.zIndex="1000";const l=ge.createRoot(s);l.render(r);const d=new Y.Popup({closeButton:!1}).setLngLat(a).setDOMContent(o).addTo(t.current);d.on("close",()=>{queueMicrotask(()=>{l.unmount()})});const p=ft(d);return o.appendChild(p),o.appendChild(s),d},be=t=>typeof t=="object"&&t!==null&&"type"in t&&"coordinates"in t,dt=t=>{if(typeof t!="object"||t===null||!("geometry"in t&&"properties"in t))return!1;const{geometry:a}=t;if(typeof a!="object"||a===null||!("coordinates"in a))return!1;const{coordinates:o}=a;if(!Array.isArray(o)||o.length!==2||!be(a))return!1;const{properties:s}=t;return typeof s!="object"||s===null?!1:"id"in s&&s.id!==void 0},pt=({map:t,point:r})=>{var s,l,d,p,u;if(!((s=t.current)!=null&&s.isStyleLoaded()))return null;const a=((p=(d=(l=t.current)==null?void 0:l.getStyle())==null?void 0:d.layers)==null?void 0:p.filter(v=>v.id.startsWith("marker-")).map(v=>v.id))||[],o=(u=t.current)==null?void 0:u.queryRenderedFeatures(r,{layers:a});if(o&&o.length>0){const v=o[0];if(!dt(v)||!be(v.geometry))return null;const{geometry:f}=v,b=f.coordinates.slice();return b.length!==2||typeof b[0]!="number"||typeof b[1]!="number"?null:v}},vt=({openPopup:t,map:r,markers:a})=>{const o=R.useRef(null);R.useEffect(()=>{if(!r.current||!a)return;const l=r.current.getCanvas();if(o.current&&(o.current.remove(),o.current=null),t){const p=a.find(u=>u.id===t);if(p){const u=[Number(p.lng)||0,Number(p.lat)||0],v=Ee({coordinates:u,map:r,tooltip:p.Tooltip});v&&(o.current=v)}}const d=p=>{const u=[p.clientX-l.getBoundingClientRect().left,p.clientY-l.getBoundingClientRect().top],v=pt({map:r,point:u});if(v&&v.properties&&v.properties.id){o.current&&(o.current.remove(),o.current=null);const f=a.find(b=>b.id===v.properties.id);if(f){const b=[Number(f.lng)||0,Number(f.lat)||0];if(typeof f.onClick=="function"){const _={geometry:{coordinates:b,type:"Point"},properties:{description:f.name,id:f.id,name:f.name,onClick:f.onClick,size:f.size||1,zIndex:f.zIndex||1},type:"Feature"};f.onClick(_)}requestAnimationFrame(()=>{const _=Ee({coordinates:b,map:r,tooltip:f.Tooltip});_&&(o.current=_)})}}};return l.addEventListener("click",d),()=>{l.removeEventListener("click",d),o.current&&(o.current.remove(),o.current=null)}},[r,a,t])},he=()=>{try{const t=document.createElement("canvas");return(t.getContext("webgl")||t.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}},yt=({mapStyle:t,mapContainer:r,zoomFlyFrom:a,markers:o,center:s})=>{var d,p;return{center:s?ve(s):{lat:((d=o==null?void 0:o[0])==null?void 0:d.lat)!==void 0?Number(o[0].lat):_e,lng:((p=o==null?void 0:o[0])==null?void 0:p.lng)!==void 0?Number(o[0].lng):Re},container:(r==null?void 0:r.current)||"",cooperativeGestures:!0,failIfMajorPerformanceCaveat:!1,style:t,zoom:a}},Re=2.333,_e=46.8677,gt=({markers:t,loading:r,center:a,openPopup:o,onMapClick:s,flyToDuration:l=5e3,fitBoundDuration:d=1e3,fitBounds:p=!0,disableFlyTo:u=!1,fitBoundsPadding:v=50,mapStyle:f="mapbox://styles/mapbox/streets-v12?optimize=true",zoom:b=6,zoomFlyFrom:_=3})=>{const{palette:M}=D.useTheme(),[K,H]=R.useState(!0),[ee,L]=R.useState(!0),m=R.useRef(null),O=R.useRef(null),te=!t||t.some(I=>I.lat===void 0||I.lng===void 0);return R.useEffect(()=>{if(!he()){L(!1),H(!1);return}if(O.current||!m.current||r)return;m.current.innerHTML!==""&&(m.current.innerHTML="");const I=yt({center:a,mapContainer:m,mapStyle:f,markers:t,zoomFlyFrom:_});O.current=new Y.Map(I)},[a,r,f,t,_]),ct({map:O,markers:t,markersAreInvalid:te,palette:M,setLoadingMapBox:H}),vt({map:O,markers:t,openPopup:o}),rt({center:a,map:O}),lt({map:O,onMapClick:s}),tt({disableFlyTo:u,fitBoundDuration:d,fitBounds:p,fitBoundsPadding:v,flyToDuration:l,map:O,markers:t,zoom:b}),R.useEffect(()=>()=>{O.current&&(O.current.remove(),O.current=null)},[]),{loading:K||r,map:O,mapContainer:m,markers:t,webGLSupported:ee}},Et=({containerStyle:t,square:r,theme:a,height:o=300,width:s="100%",...l})=>{const{loading:d,mapContainer:p,webGLSupported:u}=gt(l);return j.jsxs(j.Fragment,{children:[j.jsx(D.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),j.jsx(et,{ref:p,loading:d,height:o,width:s,containerStyle:t,square:r,error:!u&&"WebGL is not enabled in your browser. This technology is required to display the interactive map."})]})},$=(t,r)=>Number.isFinite(t)&&Number.isFinite(r)&&t>=-90&&t<=90&&r>=-180&&r<=180;x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=Qe,x.MapProviderContext=pe,x.MarkerMap=Et,x.isValidLatLng=$,x.isWebGLSupported=he,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { CustomMarkerMapProps } from '../utils/loadMarkers.tsx';
|
|
2
3
|
export interface MarkerProps {
|
|
3
4
|
/**
|
|
4
5
|
* Optional unique identifier for the marker.
|
|
@@ -35,7 +36,7 @@ export interface MarkerProps {
|
|
|
35
36
|
/**
|
|
36
37
|
* Function to call when the marker is clicked.
|
|
37
38
|
*/
|
|
38
|
-
onClick?: () => void;
|
|
39
|
+
onClick?: (markerData?: CustomMarkerMapProps) => void;
|
|
39
40
|
/**
|
|
40
41
|
* Optional type/category of the marker (e.g., 'restaurant', 'user', etc.).
|
|
41
42
|
*/
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { Palette } from '@tracktor/design-system';
|
|
2
2
|
import { Map } from 'mapbox-gl';
|
|
3
|
-
import { RefObject } from 'react';
|
|
3
|
+
import { default as React, RefObject } from 'react';
|
|
4
4
|
import { MarkerProps } from '../types/MarkerProps.ts';
|
|
5
|
+
export interface CustomMarkerMapProps {
|
|
6
|
+
geometry: {
|
|
7
|
+
coordinates: number[];
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
properties: {
|
|
11
|
+
description?: string;
|
|
12
|
+
id?: string | number;
|
|
13
|
+
size: number;
|
|
14
|
+
zIndex: number;
|
|
15
|
+
name?: string;
|
|
16
|
+
IconComponent?: React.ComponentType<any>;
|
|
17
|
+
iconProps?: Record<string, any>;
|
|
18
|
+
onClick?: (markerData?: CustomMarkerMapProps) => void;
|
|
19
|
+
};
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
5
22
|
interface GenerateMarkersProps {
|
|
6
23
|
palette: Palette;
|
|
7
24
|
type?: string;
|
|
@@ -42,13 +42,13 @@ interface MapOptionsProps {
|
|
|
42
42
|
* });
|
|
43
43
|
*/
|
|
44
44
|
declare const mapOptions: ({ mapStyle, mapContainer, zoomFlyFrom, markers, center }: MapOptionsProps) => {
|
|
45
|
-
center: {
|
|
45
|
+
center: [number, number] | {
|
|
46
46
|
lng: number;
|
|
47
47
|
lat: number;
|
|
48
48
|
} | {
|
|
49
49
|
lon: number;
|
|
50
50
|
lat: number;
|
|
51
|
-
} |
|
|
51
|
+
} | undefined;
|
|
52
52
|
container: string | HTMLDivElement;
|
|
53
53
|
cooperativeGestures: boolean;
|
|
54
54
|
failIfMajorPerformanceCaveat: boolean;
|
package/package.json
CHANGED