@alfadocs/ui-kit 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/address-autocomplete-CSjMrBvu.js +358 -0
- package/dist/_chunks/{alia-sidebar-DXsYPinm.js → alia-sidebar-BpX4z_af.js} +2 -2
- package/dist/_chunks/{bmi-calculator-DnEr513I.js → bmi-calculator-D4juUcyF.js} +57 -51
- package/dist/_chunks/{breadcrumb-CLlhx7qo.js → breadcrumb-OTbaY70e.js} +4 -4
- package/dist/_chunks/cycle-calculator-DsZbyzX6.js +191 -0
- package/dist/_chunks/{document-scanner-CqS_klIr.js → document-scanner-BqLsGs4Y.js} +7 -7
- package/dist/_chunks/{dropdown-menu-BC5ZdOMo.js → dropdown-menu-CUEXqKis.js} +2 -2
- package/dist/_chunks/{due-date-calculator-CUspKSTw.js → due-date-calculator-s_CBgaFs.js} +53 -40
- package/dist/_chunks/{editable-currency-cell-renderer-DgkCIIcO.js → editable-currency-cell-renderer-BhUkRiPZ.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BAk3a6er.js → freemium-paywall-BLXESpH4.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-CsQ05qDy.js → gestational-age-calculator-CWOG3bkI.js} +56 -43
- package/dist/_chunks/{header-settings-CBLwUK6t.js → header-settings-Bx0Biimh.js} +2 -2
- package/dist/_chunks/index.modern-D2LGACWg.js +1529 -0
- package/dist/_chunks/insert-result-DtQQeSSf.js +227 -0
- package/dist/_chunks/{kbd-Cglkd7CY.js → kbd-D855ZXIW.js} +2 -2
- package/dist/_chunks/map-view-Tb5VfK9Y.js +333 -0
- package/dist/_chunks/marketplace-app-shell-kVAVycz_.js +391 -0
- package/dist/_chunks/{patient-search-CBq62kmL.js → patient-search-DPe2ZYEL.js} +2 -2
- package/dist/_chunks/{patient-shell-DF81lALv.js → patient-shell-lDX3wwu6.js} +2 -2
- package/dist/_chunks/{payment-form-Dy3WIIsC.js → payment-form-BzVsG6Ks.js} +5 -5
- package/dist/_chunks/{pdf-viewer-Cy6Ul3hZ.js → pdf-viewer-B6MC6VTx.js} +139 -126
- package/dist/_chunks/{practice-results-C0d4IL5E.js → practice-results-CrLpEiiW.js} +4 -4
- package/dist/_chunks/pregnancy-weight-gain-B7kBK-ZR.js +223 -0
- package/dist/_chunks/{public-header.agent-B2dDg2_d.js → public-header.agent-BY6FH71R.js} +2 -2
- package/dist/_chunks/radio-group-CLjK-SlK.js +167 -0
- package/dist/_chunks/{rich-text-editor-DLbg2852.js → rich-text-editor-DhGIBd4a.js} +10 -10
- package/dist/_chunks/{sheet-BV-yuLE2.js → sheet-xbzu4YiY.js} +7 -7
- package/dist/_chunks/{sign-document-CpLDZ6Db.js → sign-document-QHfcNKFj.js} +5 -5
- package/dist/_chunks/{signature-capture-DoiBd6i3.js → signature-capture-CpMBhqQ9.js} +6 -6
- package/dist/_chunks/tab-bar-C4II-7ej.js +86 -0
- package/dist/_chunks/{theme-toggle-DpC28kt5.js → theme-toggle-ClATnY4Q.js} +2 -2
- package/dist/_chunks/{toast.agent-WHHfw5VX.js → toast.agent-B0MCsvdZ.js} +2 -2
- package/dist/_chunks/{unit-converter-EUwO6QYq.js → unit-converter-D1UrEUxa.js} +46 -40
- package/dist/_chunks/{workflow-map-C3gB0FvB.js → workflow-map-BFNpzTiw.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/brand/product-lockup/product-lockup.d.ts +16 -0
- package/dist/components/_shared/insert-result.d.ts +21 -4
- package/dist/components/address-autocomplete/address-autocomplete.d.ts +77 -0
- package/dist/components/address-autocomplete/index.d.ts +4 -0
- package/dist/components/address-autocomplete/index.js +6 -0
- package/dist/components/address-autocomplete/parse-address.d.ts +52 -0
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +11 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +12 -2
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +11 -1
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +12 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/kbd/index.js +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/matrix-rain/matrix-rain.d.ts +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +12 -2
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/sheet/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/components/tab-bar/index.d.ts +3 -0
- package/dist/components/tab-bar/index.js +5 -0
- package/dist/components/tab-bar/tab-bar.d.ts +61 -0
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/toast/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +11 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/i18n/config.js +39 -24
- package/dist/i18n/locales/ar.d.ts +17 -0
- package/dist/i18n/locales/ar.js +18 -1
- package/dist/i18n/locales/de.d.ts +17 -0
- package/dist/i18n/locales/de.js +18 -1
- package/dist/i18n/locales/el.d.ts +17 -0
- package/dist/i18n/locales/el.js +18 -1
- package/dist/i18n/locales/en.d.ts +17 -0
- package/dist/i18n/locales/en.js +18 -1
- package/dist/i18n/locales/es.d.ts +17 -0
- package/dist/i18n/locales/es.js +18 -1
- package/dist/i18n/locales/fr.d.ts +17 -0
- package/dist/i18n/locales/fr.js +18 -1
- package/dist/i18n/locales/hi.d.ts +17 -0
- package/dist/i18n/locales/hi.js +18 -1
- package/dist/i18n/locales/it.d.ts +17 -0
- package/dist/i18n/locales/it.js +18 -1
- package/dist/i18n/locales/ja.d.ts +17 -0
- package/dist/i18n/locales/ja.js +18 -1
- package/dist/i18n/locales/nl.d.ts +17 -0
- package/dist/i18n/locales/nl.js +18 -1
- package/dist/i18n/locales/pl.d.ts +17 -0
- package/dist/i18n/locales/pl.js +18 -1
- package/dist/i18n/locales/pt.d.ts +17 -0
- package/dist/i18n/locales/pt.js +18 -1
- package/dist/i18n/locales/ro.d.ts +17 -0
- package/dist/i18n/locales/ro.js +18 -1
- package/dist/i18n/locales/ru.d.ts +17 -0
- package/dist/i18n/locales/ru.js +18 -1
- package/dist/i18n/locales/sq.d.ts +17 -0
- package/dist/i18n/locales/sq.js +18 -1
- package/dist/i18n/locales/sv.d.ts +17 -0
- package/dist/i18n/locales/sv.js +18 -1
- package/dist/i18n/locales/tr.d.ts +17 -0
- package/dist/i18n/locales/tr.js +18 -1
- package/dist/i18n/locales/zh.d.ts +17 -0
- package/dist/i18n/locales/zh.js +18 -1
- package/dist/index.js +604 -599
- package/dist/locales/ar.json +18 -1
- package/dist/locales/de.json +18 -1
- package/dist/locales/el.json +18 -1
- package/dist/locales/en.json +18 -1
- package/dist/locales/es.json +18 -1
- package/dist/locales/fr.json +18 -1
- package/dist/locales/hi.json +18 -1
- package/dist/locales/it.json +18 -1
- package/dist/locales/ja.json +18 -1
- package/dist/locales/nl.json +18 -1
- package/dist/locales/pl.json +18 -1
- package/dist/locales/pt.json +18 -1
- package/dist/locales/ro.json +18 -1
- package/dist/locales/ru.json +18 -1
- package/dist/locales/sq.json +18 -1
- package/dist/locales/sv.json +18 -1
- package/dist/locales/tr.json +18 -1
- package/dist/locales/zh.json +18 -1
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +30 -3
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +16 -1
- package/dist/_chunks/cycle-calculator-B5Uj9QeT.js +0 -185
- package/dist/_chunks/insert-result-yJ0QavoN.js +0 -133
- package/dist/_chunks/map-view-qJLybrmN.js +0 -1850
- package/dist/_chunks/marketplace-app-shell-BlxVizU4.js +0 -296
- package/dist/_chunks/pregnancy-weight-gain-BCdi-JSv.js +0 -209
- package/dist/_chunks/radio-group-BcF92GEF.js +0 -152
|
@@ -0,0 +1,1529 @@
|
|
|
1
|
+
import * as Le from "react";
|
|
2
|
+
import M, { useMemo as w, useContext as R, useEffect as E, useLayoutEffect as V, forwardRef as B, useImperativeHandle as z, useState as I, useReducer as Se, useCallback as ue, useRef as j, Children as ge, createContext as Ue } from "react";
|
|
3
|
+
import { createPortal as oe } from "react-dom";
|
|
4
|
+
import { g as He } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
5
|
+
var re, be;
|
|
6
|
+
function Ge() {
|
|
7
|
+
return be || (be = 1, re = function e(n, t) {
|
|
8
|
+
if (n === t) return !0;
|
|
9
|
+
if (n && t && typeof n == "object" && typeof t == "object") {
|
|
10
|
+
if (n.constructor !== t.constructor) return !1;
|
|
11
|
+
var o, r, i;
|
|
12
|
+
if (Array.isArray(n)) {
|
|
13
|
+
if (o = n.length, o != t.length) return !1;
|
|
14
|
+
for (r = o; r-- !== 0; )
|
|
15
|
+
if (!e(n[r], t[r])) return !1;
|
|
16
|
+
return !0;
|
|
17
|
+
}
|
|
18
|
+
if (n.constructor === RegExp) return n.source === t.source && n.flags === t.flags;
|
|
19
|
+
if (n.valueOf !== Object.prototype.valueOf) return n.valueOf() === t.valueOf();
|
|
20
|
+
if (n.toString !== Object.prototype.toString) return n.toString() === t.toString();
|
|
21
|
+
if (i = Object.keys(n), o = i.length, o !== Object.keys(t).length) return !1;
|
|
22
|
+
for (r = o; r-- !== 0; )
|
|
23
|
+
if (!Object.prototype.hasOwnProperty.call(t, i[r])) return !1;
|
|
24
|
+
for (r = o; r-- !== 0; ) {
|
|
25
|
+
var a = i[r];
|
|
26
|
+
if (!e(n[a], t[a])) return !1;
|
|
27
|
+
}
|
|
28
|
+
return !0;
|
|
29
|
+
}
|
|
30
|
+
return n !== n && t !== t;
|
|
31
|
+
}), re;
|
|
32
|
+
}
|
|
33
|
+
var Je = Ge();
|
|
34
|
+
const W = /* @__PURE__ */ He(Je), Ve = "1.8.3";
|
|
35
|
+
function N(e, n) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
|
|
38
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
39
|
+
for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
|
|
40
|
+
n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (t[o[r]] = e[o[r]]);
|
|
41
|
+
return t;
|
|
42
|
+
}
|
|
43
|
+
function Oe(e, n, t, o) {
|
|
44
|
+
function r(i) {
|
|
45
|
+
return i instanceof t ? i : new t(function(a) {
|
|
46
|
+
a(i);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return new (t || (t = Promise))(function(i, a) {
|
|
50
|
+
function s(l) {
|
|
51
|
+
try {
|
|
52
|
+
c(o.next(l));
|
|
53
|
+
} catch (h) {
|
|
54
|
+
a(h);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function g(l) {
|
|
58
|
+
try {
|
|
59
|
+
c(o.throw(l));
|
|
60
|
+
} catch (h) {
|
|
61
|
+
a(h);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function c(l) {
|
|
65
|
+
l.done ? i(l.value) : r(l.value).then(s, g);
|
|
66
|
+
}
|
|
67
|
+
c((o = o.apply(e, [])).next());
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function $e(e, n) {
|
|
71
|
+
e.src = n;
|
|
72
|
+
}
|
|
73
|
+
const qe = (e) => {
|
|
74
|
+
var n, t, o, r = "The Google Maps JavaScript API", i = "google", a = "importLibrary", s = "__ib__", g = document, c = window, l = c[i] || (c[i] = {}), h = l.maps || (l.maps = {}), f = /* @__PURE__ */ new Set(), u = new URLSearchParams(), p = () => n || (n = new Promise(async (y, d) => {
|
|
75
|
+
var m;
|
|
76
|
+
await (t = g.createElement("script")), u.set("libraries", [...f] + "");
|
|
77
|
+
for (o in e)
|
|
78
|
+
u.set(o.replace(/[A-Z]/g, (C) => "_" + C[0].toLowerCase()), e[o]);
|
|
79
|
+
u.set("callback", i + ".maps." + s), $e(t, "https://maps.googleapis.com/maps/api/js?" + u), h[s] = y, t.onerror = () => n = d(Error(r + " could not load.")), t.nonce = ((m = g.querySelector("script[nonce]")) == null ? void 0 : m.nonce) || "", g.head.append(t);
|
|
80
|
+
}));
|
|
81
|
+
h[a] ? console.warn(r + " only loads once. Ignoring:", e) : h[a] = (y, ...d) => f.add(y) && p().then(() => h[a](y, ...d));
|
|
82
|
+
}, Ze = (e) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(e)}) will be ignored.`, We = (e) => `The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(e)}) will be ignored.`, Ke = "No options were set before calling importLibrary. Make sure to configure the loader using setOptions().", Ye = "There already is a script loading the Google Maps JavaScript API, and no google.maps.importLibrary function is defined. @googlemaps/js-api-loader will proceed to bootstrap the API with the specified options, but the existing script might cause problems using the API. Make sure to remove the script loading the API.", _e = process.env.NODE_ENV !== "production", fe = _e ? (e) => {
|
|
83
|
+
console.warn(`[@googlemaps/js-api-loader] ${e}`);
|
|
84
|
+
} : () => {
|
|
85
|
+
}, Xe = _e ? (e) => {
|
|
86
|
+
console.info(`[@googlemaps/js-api-loader] ${e}`);
|
|
87
|
+
} : () => {
|
|
88
|
+
}, Qe = process.env.NODE_ENV !== "production";
|
|
89
|
+
let ae = !1;
|
|
90
|
+
function en(e) {
|
|
91
|
+
if (ae) {
|
|
92
|
+
fe(Ze(e));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
tn(e), ae = !0;
|
|
96
|
+
}
|
|
97
|
+
async function nn(e) {
|
|
98
|
+
var n, t;
|
|
99
|
+
if (ae || fe(Ke), !((t = (n = window == null ? void 0 : window.google) == null ? void 0 : n.maps) != null && t.importLibrary))
|
|
100
|
+
throw new Error("google.maps.importLibrary is not installed.");
|
|
101
|
+
return await google.maps.importLibrary(e);
|
|
102
|
+
}
|
|
103
|
+
function tn(e) {
|
|
104
|
+
var t, o;
|
|
105
|
+
const n = !!((o = (t = window.google) == null ? void 0 : t.maps) != null && o.importLibrary);
|
|
106
|
+
n ? Xe(We(e)) : Qe && document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]') && fe(Ye), n || qe(e);
|
|
107
|
+
}
|
|
108
|
+
const x = {
|
|
109
|
+
NOT_LOADED: "NOT_LOADED",
|
|
110
|
+
LOADING: "LOADING",
|
|
111
|
+
LOADED: "LOADED",
|
|
112
|
+
FAILED: "FAILED",
|
|
113
|
+
AUTH_FAILURE: "AUTH_FAILURE"
|
|
114
|
+
}, on = "GMP_visgl_rgmlibrary_v1_default", rn = [
|
|
115
|
+
`gmp_visgl_reactgooglemaps_v${Ve}`
|
|
116
|
+
], $ = M.createContext(null);
|
|
117
|
+
let F = x.NOT_LOADED, Q;
|
|
118
|
+
const se = /* @__PURE__ */ new Set();
|
|
119
|
+
function ee(e) {
|
|
120
|
+
e !== F && (F = e, se.forEach((n) => n(F)));
|
|
121
|
+
}
|
|
122
|
+
function an() {
|
|
123
|
+
const [e, n] = I({});
|
|
124
|
+
return { mapInstances: e, addMapInstance: (i, a = "default") => {
|
|
125
|
+
n((s) => Object.assign(Object.assign({}, s), { [a]: i }));
|
|
126
|
+
}, removeMapInstance: (i = "default") => {
|
|
127
|
+
n((a) => {
|
|
128
|
+
var s = i;
|
|
129
|
+
a[s];
|
|
130
|
+
var g = N(a, [typeof s == "symbol" ? s : s + ""]);
|
|
131
|
+
return g;
|
|
132
|
+
});
|
|
133
|
+
}, clearMapInstances: () => {
|
|
134
|
+
n({});
|
|
135
|
+
} };
|
|
136
|
+
}
|
|
137
|
+
function sn() {
|
|
138
|
+
const [e, n] = I({});
|
|
139
|
+
return {
|
|
140
|
+
map3dInstances: e,
|
|
141
|
+
addMap3DInstance: (i, a = "default") => {
|
|
142
|
+
n((s) => Object.assign(Object.assign({}, s), { [a]: i }));
|
|
143
|
+
},
|
|
144
|
+
removeMap3DInstance: (i = "default") => {
|
|
145
|
+
n((a) => {
|
|
146
|
+
var s = i;
|
|
147
|
+
a[s];
|
|
148
|
+
var g = N(a, [typeof s == "symbol" ? s : s + ""]);
|
|
149
|
+
return g;
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
clearMap3DInstances: () => {
|
|
153
|
+
n({});
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function ln(e) {
|
|
158
|
+
const { onLoad: n, onError: t, apiKey: o, version: r, libraries: i = [], region: a, language: s, authReferrerPolicy: g, channel: c, solutionChannel: l, fetchAppCheckToken: h } = e, [f, u] = I(F), [p, y] = Se((C, b) => C[b.name] ? C : Object.assign(Object.assign({}, C), { [b.name]: b.value }), {}), d = w(() => {
|
|
159
|
+
const C = {
|
|
160
|
+
apiKey: o,
|
|
161
|
+
version: r,
|
|
162
|
+
libraries: i.join(","),
|
|
163
|
+
region: a,
|
|
164
|
+
language: s,
|
|
165
|
+
authReferrerPolicy: g,
|
|
166
|
+
channel: c,
|
|
167
|
+
solutionChannel: l
|
|
168
|
+
};
|
|
169
|
+
return JSON.stringify(C);
|
|
170
|
+
}, [
|
|
171
|
+
o,
|
|
172
|
+
r,
|
|
173
|
+
i,
|
|
174
|
+
a,
|
|
175
|
+
s,
|
|
176
|
+
g,
|
|
177
|
+
c,
|
|
178
|
+
l
|
|
179
|
+
]), m = ue((C) => Oe(this, void 0, void 0, function* () {
|
|
180
|
+
if (p[C])
|
|
181
|
+
return p[C];
|
|
182
|
+
const b = yield nn(C);
|
|
183
|
+
return y({ name: C, value: b }), b;
|
|
184
|
+
}), [p]);
|
|
185
|
+
return E(() => (se.add(u), u(F), () => {
|
|
186
|
+
se.delete(u);
|
|
187
|
+
}), []), E(
|
|
188
|
+
() => {
|
|
189
|
+
Oe(this, void 0, void 0, function* () {
|
|
190
|
+
var C, b;
|
|
191
|
+
try {
|
|
192
|
+
Q && Q !== d && console.warn("The Google Maps JavaScript API has already been loaded with different parameters. The new parameters will be ignored. If you need to use different parameters, please refresh the page.");
|
|
193
|
+
const P = ["core", "maps", ...i];
|
|
194
|
+
if (!((b = (C = window.google) === null || C === void 0 ? void 0 : C.maps) === null || b === void 0) && b.importLibrary) {
|
|
195
|
+
Q || ee(x.LOADED), yield Promise.all(P.map((v) => m(v))), n && n();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (F === x.LOADING || F === x.LOADED) {
|
|
199
|
+
F === x.LOADED && n && n();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
Q = d, ee(x.LOADING);
|
|
203
|
+
const A = Object.fromEntries(Object.entries({
|
|
204
|
+
key: o,
|
|
205
|
+
v: r,
|
|
206
|
+
libraries: i,
|
|
207
|
+
region: a,
|
|
208
|
+
language: s,
|
|
209
|
+
authReferrerPolicy: g
|
|
210
|
+
}).filter(([, v]) => v !== void 0));
|
|
211
|
+
c !== void 0 && c >= 0 && c <= 999 && (A.channel = String(c)), l === void 0 ? A.solutionChannel = on : l !== "" && (A.solutionChannel = l), en(A), yield Promise.all(P.map((v) => m(v))), ee(x.LOADED), n && n();
|
|
212
|
+
} catch (P) {
|
|
213
|
+
ee(x.FAILED), t ? t(P) : console.error("The Google Maps JavaScript API failed to load.", P);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
218
|
+
[d, n, t, m, i]
|
|
219
|
+
), E(() => {
|
|
220
|
+
if (f !== x.LOADED)
|
|
221
|
+
return;
|
|
222
|
+
const C = google.maps.Settings.getInstance();
|
|
223
|
+
h ? C.fetchAppCheckToken = h : C.fetchAppCheckToken && (C.fetchAppCheckToken = null);
|
|
224
|
+
}, [f, h]), {
|
|
225
|
+
status: f,
|
|
226
|
+
loadedLibraries: p,
|
|
227
|
+
importLibrary: m
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function cn(e) {
|
|
231
|
+
return w(() => e.disableUsageAttribution ? null : rn, [e.disableUsageAttribution]);
|
|
232
|
+
}
|
|
233
|
+
const _t = (e) => {
|
|
234
|
+
const { children: n } = e, t = N(e, ["children"]), { mapInstances: o, addMapInstance: r, removeMapInstance: i, clearMapInstances: a } = an(), { map3dInstances: s, addMap3DInstance: g, removeMap3DInstance: c, clearMap3DInstances: l } = sn(), { status: h, loadedLibraries: f, importLibrary: u } = ln(t), p = cn(t), y = w(() => ({
|
|
235
|
+
mapInstances: o,
|
|
236
|
+
addMapInstance: r,
|
|
237
|
+
removeMapInstance: i,
|
|
238
|
+
clearMapInstances: a,
|
|
239
|
+
map3dInstances: s,
|
|
240
|
+
addMap3DInstance: g,
|
|
241
|
+
removeMap3DInstance: c,
|
|
242
|
+
clearMap3DInstances: l,
|
|
243
|
+
status: h,
|
|
244
|
+
loadedLibraries: f,
|
|
245
|
+
importLibrary: u,
|
|
246
|
+
internalUsageAttributionIds: p
|
|
247
|
+
}), [
|
|
248
|
+
o,
|
|
249
|
+
r,
|
|
250
|
+
i,
|
|
251
|
+
a,
|
|
252
|
+
s,
|
|
253
|
+
g,
|
|
254
|
+
c,
|
|
255
|
+
l,
|
|
256
|
+
h,
|
|
257
|
+
f,
|
|
258
|
+
u,
|
|
259
|
+
p
|
|
260
|
+
]);
|
|
261
|
+
return M.createElement($.Provider, { value: y }, n);
|
|
262
|
+
};
|
|
263
|
+
function dn(e, n) {
|
|
264
|
+
for (const t of hn) {
|
|
265
|
+
const o = n[t], r = Ie[t];
|
|
266
|
+
E(() => {
|
|
267
|
+
if (!e || !o)
|
|
268
|
+
return;
|
|
269
|
+
const i = google.maps.event.addListener(e, r, (a) => {
|
|
270
|
+
o(un(r, e, a));
|
|
271
|
+
});
|
|
272
|
+
return () => i.remove();
|
|
273
|
+
}, [e, r, o]);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function un(e, n, t) {
|
|
277
|
+
var o;
|
|
278
|
+
const r = {
|
|
279
|
+
type: e,
|
|
280
|
+
map: n,
|
|
281
|
+
detail: {},
|
|
282
|
+
stoppable: !1,
|
|
283
|
+
stop: () => {
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
if (gn.includes(e)) {
|
|
287
|
+
const i = r, a = n.getCenter(), s = n.getZoom(), g = n.getHeading() || 0, c = n.getTilt() || 0, l = n.getBounds();
|
|
288
|
+
return (!a || !l || !Number.isFinite(s)) && console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), i.detail = {
|
|
289
|
+
center: (a == null ? void 0 : a.toJSON()) || { lat: 0, lng: 0 },
|
|
290
|
+
zoom: s || 0,
|
|
291
|
+
heading: g,
|
|
292
|
+
tilt: c,
|
|
293
|
+
bounds: (l == null ? void 0 : l.toJSON()) || {
|
|
294
|
+
north: 90,
|
|
295
|
+
east: 180,
|
|
296
|
+
south: -90,
|
|
297
|
+
west: -180
|
|
298
|
+
}
|
|
299
|
+
}, i;
|
|
300
|
+
} else if (fn.includes(e)) {
|
|
301
|
+
if (!t)
|
|
302
|
+
throw new Error("[createEvent] mouse events must provide a srcEvent");
|
|
303
|
+
const i = r;
|
|
304
|
+
return i.domEvent = t.domEvent, i.stoppable = !0, i.stop = () => t.stop(), i.detail = {
|
|
305
|
+
latLng: ((o = t.latLng) === null || o === void 0 ? void 0 : o.toJSON()) || null,
|
|
306
|
+
placeId: t.placeId
|
|
307
|
+
}, i;
|
|
308
|
+
}
|
|
309
|
+
return r;
|
|
310
|
+
}
|
|
311
|
+
const Ie = {
|
|
312
|
+
onBoundsChanged: "bounds_changed",
|
|
313
|
+
onCenterChanged: "center_changed",
|
|
314
|
+
onClick: "click",
|
|
315
|
+
onContextmenu: "contextmenu",
|
|
316
|
+
onDblclick: "dblclick",
|
|
317
|
+
onDrag: "drag",
|
|
318
|
+
onDragend: "dragend",
|
|
319
|
+
onDragstart: "dragstart",
|
|
320
|
+
onHeadingChanged: "heading_changed",
|
|
321
|
+
onIdle: "idle",
|
|
322
|
+
onIsFractionalZoomEnabledChanged: "isfractionalzoomenabled_changed",
|
|
323
|
+
onMapCapabilitiesChanged: "mapcapabilities_changed",
|
|
324
|
+
onMapTypeIdChanged: "maptypeid_changed",
|
|
325
|
+
onMousemove: "mousemove",
|
|
326
|
+
onMouseout: "mouseout",
|
|
327
|
+
onMouseover: "mouseover",
|
|
328
|
+
onProjectionChanged: "projection_changed",
|
|
329
|
+
onRenderingTypeChanged: "renderingtype_changed",
|
|
330
|
+
onTilesLoaded: "tilesloaded",
|
|
331
|
+
onTiltChanged: "tilt_changed",
|
|
332
|
+
onZoomChanged: "zoom_changed",
|
|
333
|
+
// note: onCameraChanged is an alias for the bounds_changed event,
|
|
334
|
+
// since that is going to be fired in every situation where the camera is
|
|
335
|
+
// updated.
|
|
336
|
+
onCameraChanged: "bounds_changed"
|
|
337
|
+
}, gn = [
|
|
338
|
+
"bounds_changed",
|
|
339
|
+
"center_changed",
|
|
340
|
+
"heading_changed",
|
|
341
|
+
"tilt_changed",
|
|
342
|
+
"zoom_changed"
|
|
343
|
+
], fn = [
|
|
344
|
+
"click",
|
|
345
|
+
"contextmenu",
|
|
346
|
+
"dblclick",
|
|
347
|
+
"mousemove",
|
|
348
|
+
"mouseout",
|
|
349
|
+
"mouseover"
|
|
350
|
+
], hn = Object.keys(Ie);
|
|
351
|
+
function K(e, n) {
|
|
352
|
+
const t = j(e);
|
|
353
|
+
return n(e, t.current) || (t.current = e), t.current;
|
|
354
|
+
}
|
|
355
|
+
function mn(e, n, t) {
|
|
356
|
+
E(e, [K(n, t)]);
|
|
357
|
+
}
|
|
358
|
+
function we(e, n) {
|
|
359
|
+
mn(e, n, W);
|
|
360
|
+
}
|
|
361
|
+
const pn = /* @__PURE__ */ new Set([
|
|
362
|
+
"backgroundColor",
|
|
363
|
+
"clickableIcons",
|
|
364
|
+
"controlSize",
|
|
365
|
+
"disableDefaultUI",
|
|
366
|
+
"disableDoubleClickZoom",
|
|
367
|
+
"draggable",
|
|
368
|
+
"draggableCursor",
|
|
369
|
+
"draggingCursor",
|
|
370
|
+
"fullscreenControl",
|
|
371
|
+
"fullscreenControlOptions",
|
|
372
|
+
"gestureHandling",
|
|
373
|
+
"headingInteractionEnabled",
|
|
374
|
+
"isFractionalZoomEnabled",
|
|
375
|
+
"keyboardShortcuts",
|
|
376
|
+
"mapTypeControl",
|
|
377
|
+
"mapTypeControlOptions",
|
|
378
|
+
"mapTypeId",
|
|
379
|
+
"maxZoom",
|
|
380
|
+
"minZoom",
|
|
381
|
+
"noClear",
|
|
382
|
+
"panControl",
|
|
383
|
+
"panControlOptions",
|
|
384
|
+
"restriction",
|
|
385
|
+
"rotateControl",
|
|
386
|
+
"rotateControlOptions",
|
|
387
|
+
"scaleControl",
|
|
388
|
+
"scaleControlOptions",
|
|
389
|
+
"scrollwheel",
|
|
390
|
+
"streetView",
|
|
391
|
+
"streetViewControl",
|
|
392
|
+
"streetViewControlOptions",
|
|
393
|
+
"styles",
|
|
394
|
+
"tiltInteractionEnabled",
|
|
395
|
+
"zoomControl",
|
|
396
|
+
"zoomControlOptions"
|
|
397
|
+
]);
|
|
398
|
+
function vn(e, n) {
|
|
399
|
+
const t = {}, o = Object.keys(n);
|
|
400
|
+
for (const r of o)
|
|
401
|
+
pn.has(r) && (t[r] = n[r]);
|
|
402
|
+
we(() => {
|
|
403
|
+
e && e.setOptions(t);
|
|
404
|
+
}, [t]);
|
|
405
|
+
}
|
|
406
|
+
function Te() {
|
|
407
|
+
var e;
|
|
408
|
+
return ((e = R($)) === null || e === void 0 ? void 0 : e.status) || x.NOT_LOADED;
|
|
409
|
+
}
|
|
410
|
+
function yn(e, n) {
|
|
411
|
+
const { viewport: t, viewState: o } = n, r = !!t;
|
|
412
|
+
return V(() => {
|
|
413
|
+
if (!e || !o)
|
|
414
|
+
return;
|
|
415
|
+
const { latitude: i, longitude: a, bearing: s, pitch: g, zoom: c } = o;
|
|
416
|
+
e.moveCamera({
|
|
417
|
+
center: { lat: i, lng: a },
|
|
418
|
+
heading: s,
|
|
419
|
+
tilt: g,
|
|
420
|
+
zoom: c + 1
|
|
421
|
+
});
|
|
422
|
+
}, [e, o]), r;
|
|
423
|
+
}
|
|
424
|
+
function Cn(e) {
|
|
425
|
+
return !e || typeof e != "object" || !("lat" in e && "lng" in e) ? !1 : Number.isFinite(e.lat) && Number.isFinite(e.lng);
|
|
426
|
+
}
|
|
427
|
+
function Ne(e, n) {
|
|
428
|
+
if (!e || !n)
|
|
429
|
+
return !1;
|
|
430
|
+
const t = te(e), o = te(n);
|
|
431
|
+
return !(t.lat !== o.lat || t.lng !== o.lng);
|
|
432
|
+
}
|
|
433
|
+
function te(e) {
|
|
434
|
+
return Cn(e) ? e : e.toJSON();
|
|
435
|
+
}
|
|
436
|
+
function Me(e) {
|
|
437
|
+
if ("north" in e && "south" in e && "east" in e && "west" in e)
|
|
438
|
+
return e;
|
|
439
|
+
const n = e.getNorthEast().toJSON(), t = e.getSouthWest().toJSON();
|
|
440
|
+
return {
|
|
441
|
+
north: n.lat,
|
|
442
|
+
east: n.lng,
|
|
443
|
+
south: t.lat,
|
|
444
|
+
west: t.lng
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function En(e, n) {
|
|
448
|
+
if (!e || !n)
|
|
449
|
+
return !1;
|
|
450
|
+
const t = Me(e), o = Me(n);
|
|
451
|
+
return t.north === o.north && t.south === o.south && t.east === o.east && t.west === o.west;
|
|
452
|
+
}
|
|
453
|
+
function xe(e, n) {
|
|
454
|
+
if (!e || !n)
|
|
455
|
+
return e === n;
|
|
456
|
+
const t = "getArray" in n ? n.getArray() : n;
|
|
457
|
+
if (e.length !== t.length)
|
|
458
|
+
return !1;
|
|
459
|
+
for (let o = 0; o < e.length; o++)
|
|
460
|
+
if (!Ne(e[o], t[o]))
|
|
461
|
+
return !1;
|
|
462
|
+
return !0;
|
|
463
|
+
}
|
|
464
|
+
function bn(e, n) {
|
|
465
|
+
if (!e || !n)
|
|
466
|
+
return e === n;
|
|
467
|
+
const t = "getArray" in n ? n.getArray().map((o) => o.getArray()) : n;
|
|
468
|
+
if (e.length !== t.length)
|
|
469
|
+
return !1;
|
|
470
|
+
for (let o = 0; o < e.length; o++)
|
|
471
|
+
if (!xe(e[o], t[o]))
|
|
472
|
+
return !1;
|
|
473
|
+
return !0;
|
|
474
|
+
}
|
|
475
|
+
function On(e, n, t) {
|
|
476
|
+
const o = t.center ? te(t.center) : null;
|
|
477
|
+
let r = null, i = null;
|
|
478
|
+
o && Number.isFinite(o.lat) && Number.isFinite(o.lng) && (r = o.lat, i = o.lng);
|
|
479
|
+
const a = Number.isFinite(t.zoom) ? t.zoom : null, s = Number.isFinite(t.heading) ? t.heading : null, g = Number.isFinite(t.tilt) ? t.tilt : null;
|
|
480
|
+
V(() => {
|
|
481
|
+
if (!e)
|
|
482
|
+
return;
|
|
483
|
+
const c = {};
|
|
484
|
+
let l = !1;
|
|
485
|
+
r !== null && i !== null && (n.current.center.lat !== r || n.current.center.lng !== i) && (c.center = { lat: r, lng: i }, l = !0), a !== null && n.current.zoom !== a && (c.zoom = a, l = !0), s !== null && n.current.heading !== s && (c.heading = s, l = !0), g !== null && n.current.tilt !== g && (c.tilt = g, l = !0), l && e.moveCamera(c);
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
const Mn = () => {
|
|
489
|
+
const e = {
|
|
490
|
+
position: "absolute",
|
|
491
|
+
top: 0,
|
|
492
|
+
left: 0,
|
|
493
|
+
bottom: 0,
|
|
494
|
+
right: 0,
|
|
495
|
+
zIndex: 999,
|
|
496
|
+
display: "flex",
|
|
497
|
+
flexFlow: "column nowrap",
|
|
498
|
+
textAlign: "center",
|
|
499
|
+
justifyContent: "center",
|
|
500
|
+
fontSize: ".8rem",
|
|
501
|
+
color: "rgba(0,0,0,0.6)",
|
|
502
|
+
background: "#dddddd",
|
|
503
|
+
padding: "1rem 1.5rem"
|
|
504
|
+
};
|
|
505
|
+
return M.createElement(
|
|
506
|
+
"div",
|
|
507
|
+
{ style: e },
|
|
508
|
+
M.createElement("h2", null, "Error: AuthFailure"),
|
|
509
|
+
M.createElement(
|
|
510
|
+
"p",
|
|
511
|
+
null,
|
|
512
|
+
"A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",
|
|
513
|
+
M.createElement("code", null, "APIProvider.apiKey"),
|
|
514
|
+
" prop is correct. Check the error-message in the console for further details."
|
|
515
|
+
)
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
function le() {
|
|
519
|
+
const [e, n] = I(null), t = ue((o) => n(o), [n]);
|
|
520
|
+
return [e, t];
|
|
521
|
+
}
|
|
522
|
+
function Re() {
|
|
523
|
+
return Te() === x.LOADED;
|
|
524
|
+
}
|
|
525
|
+
function je() {
|
|
526
|
+
const [, e] = Se((n) => n + 1, 0);
|
|
527
|
+
return e;
|
|
528
|
+
}
|
|
529
|
+
function Pn(e, n) {
|
|
530
|
+
const t = e.getCenter(), o = e.getZoom(), r = e.getHeading() || 0, i = e.getTilt() || 0, a = e.getBounds();
|
|
531
|
+
(!t || !a || !Number.isFinite(o)) && console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), Object.assign(n.current, {
|
|
532
|
+
center: (t == null ? void 0 : t.toJSON()) || { lat: 0, lng: 0 },
|
|
533
|
+
zoom: o || 0,
|
|
534
|
+
heading: r,
|
|
535
|
+
tilt: i
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function An(e) {
|
|
539
|
+
const n = je(), t = j({
|
|
540
|
+
center: { lat: 0, lng: 0 },
|
|
541
|
+
heading: 0,
|
|
542
|
+
tilt: 0,
|
|
543
|
+
zoom: 0
|
|
544
|
+
});
|
|
545
|
+
return E(() => {
|
|
546
|
+
if (!e)
|
|
547
|
+
return;
|
|
548
|
+
const o = google.maps.event.addListener(e, "bounds_changed", () => {
|
|
549
|
+
Pn(e, t), n();
|
|
550
|
+
});
|
|
551
|
+
return () => o.remove();
|
|
552
|
+
}, [e, n]), t;
|
|
553
|
+
}
|
|
554
|
+
class ne {
|
|
555
|
+
static has(n) {
|
|
556
|
+
return this.entries[n] && this.entries[n].length > 0;
|
|
557
|
+
}
|
|
558
|
+
static pop(n) {
|
|
559
|
+
return this.entries[n] && this.entries[n].pop() || null;
|
|
560
|
+
}
|
|
561
|
+
static push(n, t) {
|
|
562
|
+
this.entries[n] || (this.entries[n] = []), this.entries[n].push(t);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
ne.entries = {};
|
|
566
|
+
function kn(e, n) {
|
|
567
|
+
const t = Re(), [o, r] = I(null), [i, a] = le(), s = An(o), { id: g, defaultBounds: c, defaultCenter: l, defaultZoom: h, defaultHeading: f, defaultTilt: u, reuseMaps: p, renderingType: y, colorScheme: d } = e, m = N(e, ["id", "defaultBounds", "defaultCenter", "defaultZoom", "defaultHeading", "defaultTilt", "reuseMaps", "renderingType", "colorScheme"]), C = e.zoom !== void 0 || e.defaultZoom !== void 0, b = e.center !== void 0 || e.defaultCenter !== void 0;
|
|
568
|
+
!c && (!C || !b) && console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"), !m.center && l && (m.center = l), !m.zoom && Number.isFinite(h) && (m.zoom = h), !m.heading && Number.isFinite(f) && (m.heading = f), !m.tilt && Number.isFinite(u) && (m.tilt = u);
|
|
569
|
+
const P = m.internalUsageAttributionIds;
|
|
570
|
+
P == null ? m.internalUsageAttributionIds = n.internalUsageAttributionIds : m.internalUsageAttributionIds = [
|
|
571
|
+
...n.internalUsageAttributionIds || [],
|
|
572
|
+
...P
|
|
573
|
+
];
|
|
574
|
+
for (const v of Object.keys(m))
|
|
575
|
+
m[v] === void 0 && delete m[v];
|
|
576
|
+
const A = j(void 0);
|
|
577
|
+
return E(
|
|
578
|
+
() => {
|
|
579
|
+
if (!i || !t)
|
|
580
|
+
return;
|
|
581
|
+
const { addMapInstance: v, removeMapInstance: O } = n, { mapId: D } = e, S = `${D || "default"}:${y || "default"}:${d || "LIGHT"}`;
|
|
582
|
+
let k, T;
|
|
583
|
+
if (p && ne.has(S) ? (T = ne.pop(S), k = T.getDiv(), i.appendChild(k), T.setOptions(m), setTimeout(() => T.moveCamera({}), 0)) : (k = document.createElement("div"), k.style.height = "100%", i.appendChild(k), T = new google.maps.Map(k, Object.assign(Object.assign(Object.assign({}, m), y ? { renderingType: y } : {}), d ? { colorScheme: d } : {}))), r(T), v(T, g), c) {
|
|
584
|
+
const { padding: Y } = c, X = N(c, ["padding"]);
|
|
585
|
+
T.fitBounds(X, Y);
|
|
586
|
+
} else (!C || !b) && T.fitBounds({ east: 180, west: -180, south: -90, north: 90 });
|
|
587
|
+
if (A.current) {
|
|
588
|
+
const { mapId: Y, cameraState: X } = A.current;
|
|
589
|
+
Y !== D && T.moveCamera(X);
|
|
590
|
+
}
|
|
591
|
+
return () => {
|
|
592
|
+
A.current = {
|
|
593
|
+
mapId: D,
|
|
594
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
595
|
+
cameraState: s.current
|
|
596
|
+
}, k.remove(), p ? ne.push(S, T) : google.maps.event.clearInstanceListeners(T), r(null), O(g);
|
|
597
|
+
};
|
|
598
|
+
},
|
|
599
|
+
// some dependencies are ignored in the list below:
|
|
600
|
+
// - defaultBounds and the default* camera props will only be used once, and
|
|
601
|
+
// changes should be ignored
|
|
602
|
+
// - mapOptions has special hooks that take care of updating the options
|
|
603
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
604
|
+
[
|
|
605
|
+
i,
|
|
606
|
+
t,
|
|
607
|
+
g,
|
|
608
|
+
// these props can't be changed after initialization and require a new
|
|
609
|
+
// instance to be created
|
|
610
|
+
e.mapId,
|
|
611
|
+
e.renderingType,
|
|
612
|
+
e.colorScheme
|
|
613
|
+
]
|
|
614
|
+
), [o, a, s];
|
|
615
|
+
}
|
|
616
|
+
const Be = M.createContext(null), Dn = (e) => {
|
|
617
|
+
const { children: n, id: t, className: o, style: r } = e, i = R($), a = Te();
|
|
618
|
+
if (!i)
|
|
619
|
+
throw new Error("<Map> can only be used inside an <ApiProvider> component.");
|
|
620
|
+
const [s, g, c] = kn(e, i);
|
|
621
|
+
On(s, c, e), dn(s, e), vn(s, e);
|
|
622
|
+
const l = yn(s, e), h = !!e.controlled;
|
|
623
|
+
E(() => {
|
|
624
|
+
if (s)
|
|
625
|
+
return l && s.setOptions({ disableDefaultUI: !0 }), (l || h) && s.setOptions({
|
|
626
|
+
gestureHandling: "none",
|
|
627
|
+
keyboardShortcuts: !1
|
|
628
|
+
}), () => {
|
|
629
|
+
s.setOptions({
|
|
630
|
+
gestureHandling: e.gestureHandling,
|
|
631
|
+
keyboardShortcuts: e.keyboardShortcuts
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
}, [
|
|
635
|
+
s,
|
|
636
|
+
l,
|
|
637
|
+
h,
|
|
638
|
+
e.gestureHandling,
|
|
639
|
+
e.keyboardShortcuts
|
|
640
|
+
]);
|
|
641
|
+
const f = e.center ? te(e.center) : null;
|
|
642
|
+
let u = null, p = null;
|
|
643
|
+
f && Number.isFinite(f.lat) && Number.isFinite(f.lng) && (u = f.lat, p = f.lng);
|
|
644
|
+
const y = w(() => {
|
|
645
|
+
var C, b, P;
|
|
646
|
+
return {
|
|
647
|
+
center: { lat: u ?? 0, lng: p ?? 0 },
|
|
648
|
+
zoom: (C = e.zoom) !== null && C !== void 0 ? C : 0,
|
|
649
|
+
heading: (b = e.heading) !== null && b !== void 0 ? b : 0,
|
|
650
|
+
tilt: (P = e.tilt) !== null && P !== void 0 ? P : 0
|
|
651
|
+
};
|
|
652
|
+
}, [u, p, e.zoom, e.heading, e.tilt]);
|
|
653
|
+
V(() => {
|
|
654
|
+
if (!s || !h)
|
|
655
|
+
return;
|
|
656
|
+
s.moveCamera(y);
|
|
657
|
+
const C = s.addListener("bounds_changed", () => {
|
|
658
|
+
s.moveCamera(y);
|
|
659
|
+
});
|
|
660
|
+
return () => C.remove();
|
|
661
|
+
}, [s, h, y]);
|
|
662
|
+
const d = w(() => Object.assign({
|
|
663
|
+
width: "100%",
|
|
664
|
+
height: "100%",
|
|
665
|
+
position: "relative",
|
|
666
|
+
// when using deckgl, the map should be sent to the back
|
|
667
|
+
zIndex: l ? -1 : 0
|
|
668
|
+
}, r), [r, l]), m = w(() => ({ map: s }), [s]);
|
|
669
|
+
return a === x.AUTH_FAILURE ? M.createElement(
|
|
670
|
+
"div",
|
|
671
|
+
{ style: Object.assign({ position: "relative" }, o ? {} : d), className: o },
|
|
672
|
+
M.createElement(Mn, null)
|
|
673
|
+
) : M.createElement("div", Object.assign({ ref: g, "data-testid": "map", style: o ? void 0 : d, className: o }, t ? { id: t } : {}), s ? M.createElement(Be.Provider, { value: m }, n) : null);
|
|
674
|
+
};
|
|
675
|
+
Dn.deckGLViewProps = !0;
|
|
676
|
+
const Pe = /* @__PURE__ */ new Set();
|
|
677
|
+
function Z(...e) {
|
|
678
|
+
const n = JSON.stringify(e);
|
|
679
|
+
Pe.has(n) || (Pe.add(n), console.error(...e));
|
|
680
|
+
}
|
|
681
|
+
const q = (e = null) => {
|
|
682
|
+
const n = R($), { map: t } = R(Be) || {};
|
|
683
|
+
if (n === null)
|
|
684
|
+
return Z("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."), null;
|
|
685
|
+
const { mapInstances: o } = n;
|
|
686
|
+
return e !== null ? o[e] || null : t || o.default || null;
|
|
687
|
+
};
|
|
688
|
+
function H(e) {
|
|
689
|
+
const n = Re(), t = R($);
|
|
690
|
+
return E(() => {
|
|
691
|
+
!n || !t || t.importLibrary(e);
|
|
692
|
+
}, [n, t, e]), (t == null ? void 0 : t.loadedLibraries[e]) || null;
|
|
693
|
+
}
|
|
694
|
+
var ie;
|
|
695
|
+
const { useLayoutEffect: Ln, useRef: Sn } = Le, _n = (ie = Le.useInsertionEffect) !== null && ie !== void 0 ? ie : Ln;
|
|
696
|
+
function In() {
|
|
697
|
+
throw new Error("useEffectEvent: invalid call during rendering.");
|
|
698
|
+
}
|
|
699
|
+
function wn(e) {
|
|
700
|
+
const n = Sn(In);
|
|
701
|
+
return _n(() => {
|
|
702
|
+
n.current = e;
|
|
703
|
+
}, [e]), ((...t) => n.current(...t));
|
|
704
|
+
}
|
|
705
|
+
const Fe = wn, Tn = () => {
|
|
706
|
+
};
|
|
707
|
+
function L(e, n, t) {
|
|
708
|
+
const o = Fe(t ?? Tn), r = !!t;
|
|
709
|
+
E(() => {
|
|
710
|
+
if (!e || !n || !r)
|
|
711
|
+
return;
|
|
712
|
+
const i = google.maps.event.addListener(e, n, o);
|
|
713
|
+
return () => i.remove();
|
|
714
|
+
}, [e, n, r]);
|
|
715
|
+
}
|
|
716
|
+
function _(e, n, t) {
|
|
717
|
+
E(() => {
|
|
718
|
+
e && (e[n] = t);
|
|
719
|
+
}, [e, n, t]);
|
|
720
|
+
}
|
|
721
|
+
const Nn = () => {
|
|
722
|
+
};
|
|
723
|
+
function ce(e, n, t) {
|
|
724
|
+
const o = Fe(t ?? Nn), r = !!t;
|
|
725
|
+
E(() => {
|
|
726
|
+
if (!e || !n || !r)
|
|
727
|
+
return;
|
|
728
|
+
const i = o;
|
|
729
|
+
return e.addEventListener(n, i), () => e.removeEventListener(n, i);
|
|
730
|
+
}, [e, n, r]);
|
|
731
|
+
}
|
|
732
|
+
class xn {
|
|
733
|
+
constructor() {
|
|
734
|
+
this.renderedStyles = /* @__PURE__ */ new Set(), this.styleElement = null;
|
|
735
|
+
}
|
|
736
|
+
getStyleElement() {
|
|
737
|
+
return this.styleElement || (this.styleElement = document.createElement("style"), this.styleElement.setAttribute("data-rgm-anchor-styles", ""), document.head.appendChild(this.styleElement)), this.styleElement;
|
|
738
|
+
}
|
|
739
|
+
addAdvancedMarkerPointerEventsOverwrite() {
|
|
740
|
+
if (this.renderedStyles.has("marker-pointer-events"))
|
|
741
|
+
return;
|
|
742
|
+
const n = this.getStyleElement();
|
|
743
|
+
n.textContent += `
|
|
744
|
+
gmp-advanced-marker[data-origin='rgm'] {
|
|
745
|
+
pointer-events: none !important;
|
|
746
|
+
}
|
|
747
|
+
`, this.renderedStyles.add("marker-pointer-events");
|
|
748
|
+
}
|
|
749
|
+
cleanup() {
|
|
750
|
+
this.styleElement && (this.styleElement.remove(), this.styleElement = null, this.renderedStyles.clear());
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const Rn = new xn();
|
|
754
|
+
function jn(e, n) {
|
|
755
|
+
var t;
|
|
756
|
+
if (!(!((t = google == null ? void 0 : google.maps) === null || t === void 0) && t.version))
|
|
757
|
+
return;
|
|
758
|
+
const o = google.maps.version.split("."), r = parseInt(o[0], 10), i = parseInt(o[1], 10);
|
|
759
|
+
return r > e || r === e && i >= n;
|
|
760
|
+
}
|
|
761
|
+
const he = M.createContext(null), Bn = {
|
|
762
|
+
BOTTOM: ["50%", "100%"]
|
|
763
|
+
}, Fn = B((e, n) => {
|
|
764
|
+
const { children: t, style: o, className: r, anchorPoint: i } = e, [a, s] = Un(e), g = w(() => a ? { marker: a } : null, [a]);
|
|
765
|
+
return z(n, () => a, [a]), s ? M.createElement(he.Provider, { value: g }, oe(M.createElement(zn, { anchorPoint: i, styles: o, className: r }, t), s)) : null;
|
|
766
|
+
});
|
|
767
|
+
Fn.displayName = "AdvancedMarker";
|
|
768
|
+
function de(e) {
|
|
769
|
+
return e.nodeType === Node.ELEMENT_NODE;
|
|
770
|
+
}
|
|
771
|
+
const zn = ({ children: e, styles: n, className: t }) => M.createElement("div", { className: t, style: n }, e);
|
|
772
|
+
function Un(e) {
|
|
773
|
+
const [n, t] = I(null), [o, r] = I(null), i = q(), a = H("marker"), { children: s, onClick: g, className: c, onMouseEnter: l, onMouseLeave: h, onDrag: f, onDragStart: u, onDragEnd: p, collisionBehavior: y, clickable: d, draggable: m, position: C, title: b, zIndex: P, anchorPoint: A, anchorLeft: v, anchorTop: O } = e, D = ge.count(s);
|
|
774
|
+
return E(() => {
|
|
775
|
+
if (!i || !a)
|
|
776
|
+
return;
|
|
777
|
+
const S = new a.AdvancedMarkerElement();
|
|
778
|
+
S.map = i, t(S);
|
|
779
|
+
let k = null;
|
|
780
|
+
return D > 0 && (k = document.createElement("div"), S.content = k, r(k)), () => {
|
|
781
|
+
S.map = null, k == null || k.remove(), t(null), r(null);
|
|
782
|
+
};
|
|
783
|
+
}, [i, a, D]), E(() => {
|
|
784
|
+
!(n != null && n.content) || !de(n.content) || D > 0 || (n.content.className = c ?? "");
|
|
785
|
+
}, [n, c, D]), Hn(n, A, v, O, D > 0), _(n, "position", C), _(n, "title", b ?? ""), _(n, "zIndex", P), _(n, "collisionBehavior", y), E(() => {
|
|
786
|
+
n && (m !== void 0 ? n.gmpDraggable = m : f || u || p ? n.gmpDraggable = !0 : n.gmpDraggable = !1);
|
|
787
|
+
}, [n, m, f, p, u]), E(() => {
|
|
788
|
+
if (!n)
|
|
789
|
+
return;
|
|
790
|
+
const S = d !== void 0 ? d : !!g || !!l || !!h;
|
|
791
|
+
n.gmpClickable = S, S && (n != null && n.content) && de(n.content) && (n.content.style.pointerEvents = "all", g && (n.content.style.cursor = "pointer"));
|
|
792
|
+
}, [n, d, g, l, h]), L(n, "click", g), L(n, "drag", f), L(n, "dragstart", u), L(n, "dragend", p), ce(n == null ? void 0 : n.element, "mouseenter", l), ce(n == null ? void 0 : n.element, "mouseleave", h), [n, o];
|
|
793
|
+
}
|
|
794
|
+
function Hn(e, n, t, o, r) {
|
|
795
|
+
E(() => {
|
|
796
|
+
if (!e || !r)
|
|
797
|
+
return;
|
|
798
|
+
const i = jn(3, 62), a = e.content;
|
|
799
|
+
if (!(!a || !de(a))) {
|
|
800
|
+
if (t !== void 0 || o !== void 0) {
|
|
801
|
+
i || console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`), e.anchorLeft = t, e.anchorTop = o, n !== void 0 && console.warn("AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.");
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
if (n !== void 0) {
|
|
805
|
+
const [s, g] = n ?? Bn.BOTTOM, c = `calc(-1 * ${s})`, l = `calc(-1 * ${g})`;
|
|
806
|
+
i ? (e.anchorLeft = c, e.anchorTop = l, a.style.transform = "") : (a.style.transform = `translate(50%, 100%) translate(${c}, ${l})`, e.dataset.origin = "rgm", Rn.addAdvancedMarkerPointerEventsOverwrite());
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}, [e, n, t, o, r]);
|
|
810
|
+
}
|
|
811
|
+
function Gn(e) {
|
|
812
|
+
var n, t, o;
|
|
813
|
+
const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onRadiusChanged: l, onCenterChanged: h, center: f, defaultCenter: u, radius: p, defaultRadius: y } = e, d = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onRadiusChanged", "onCenterChanged", "center", "defaultCenter", "radius", "defaultRadius"]), [m, C] = I(null), b = q(), P = K(Object.assign(Object.assign({}, d), { clickable: (n = d.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = d.draggable) !== null && t !== void 0 ? t : !!(i || a || s || h), editable: (o = d.editable) !== null && o !== void 0 ? o : !!l }), W);
|
|
814
|
+
return E(() => {
|
|
815
|
+
if (!b) {
|
|
816
|
+
b === void 0 && console.error("<Circle> has to be inside a Map component.");
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const A = new google.maps.Circle(Object.assign(Object.assign({}, P), { center: f ?? u, radius: p ?? y }));
|
|
820
|
+
return A.setMap(b), C(A), () => {
|
|
821
|
+
A.setMap(null), C(null);
|
|
822
|
+
};
|
|
823
|
+
}, [b]), L(m, "click", r), L(m, "drag", i), L(m, "dragstart", a), L(m, "dragend", s), L(m, "mouseover", g), L(m, "mouseout", c), L(m, "radius_changed", l ? () => {
|
|
824
|
+
const A = m == null ? void 0 : m.getRadius();
|
|
825
|
+
A !== void 0 && l(A);
|
|
826
|
+
} : null), L(m, "center_changed", h ? () => {
|
|
827
|
+
h(m == null ? void 0 : m.getCenter());
|
|
828
|
+
} : null), E(() => {
|
|
829
|
+
m && m.setOptions(P);
|
|
830
|
+
}, [m, P]), E(() => {
|
|
831
|
+
!m || !f || Ne(f, m.getCenter()) || m.setCenter(f);
|
|
832
|
+
}, [m, f]), E(() => {
|
|
833
|
+
!m || p === void 0 || p !== m.getRadius() && m.setRadius(p);
|
|
834
|
+
}, [m, p]), m;
|
|
835
|
+
}
|
|
836
|
+
const Jn = B((e, n) => {
|
|
837
|
+
const t = Gn(e);
|
|
838
|
+
return z(n, () => t, [t]), M.createElement(M.Fragment, null);
|
|
839
|
+
});
|
|
840
|
+
Jn.displayName = "Circle";
|
|
841
|
+
function Vn(e, n, t) {
|
|
842
|
+
if (n != null && typeof n != "object")
|
|
843
|
+
throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
|
|
844
|
+
const o = e.style;
|
|
845
|
+
if (t == null) {
|
|
846
|
+
if (n == null)
|
|
847
|
+
return;
|
|
848
|
+
for (const r in n)
|
|
849
|
+
n.hasOwnProperty(r) && Ae(o, r, n[r]);
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
for (const r in t)
|
|
853
|
+
t.hasOwnProperty(r) && (n == null || !n.hasOwnProperty(r)) && (r.indexOf("--") === 0 ? o.setProperty(r, "") : r === "float" ? o.cssFloat = "" : o[r] = "");
|
|
854
|
+
if (n != null)
|
|
855
|
+
for (const r in n) {
|
|
856
|
+
const i = n[r];
|
|
857
|
+
n.hasOwnProperty(r) && t[r] !== i && Ae(o, r, i);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function Ae(e, n, t) {
|
|
861
|
+
const o = n.indexOf("--") === 0;
|
|
862
|
+
t == null || typeof t == "boolean" || t === "" ? o ? e.setProperty(n, "") : n === "float" ? e.cssFloat = "" : e[n] = "" : o ? e.setProperty(n, t) : typeof t == "number" && t !== 0 && !qn(n) ? e[n] = t + "px" : n === "float" ? e.cssFloat = t : e[n] = ("" + t).trim();
|
|
863
|
+
}
|
|
864
|
+
const $n = /* @__PURE__ */ new Set([
|
|
865
|
+
"animationIterationCount",
|
|
866
|
+
"aspectRatio",
|
|
867
|
+
"borderImageOutset",
|
|
868
|
+
"borderImageSlice",
|
|
869
|
+
"borderImageWidth",
|
|
870
|
+
"boxFlex",
|
|
871
|
+
"boxFlexGroup",
|
|
872
|
+
"boxOrdinalGroup",
|
|
873
|
+
"columnCount",
|
|
874
|
+
"columns",
|
|
875
|
+
"flex",
|
|
876
|
+
"flexGrow",
|
|
877
|
+
"flexPositive",
|
|
878
|
+
"flexShrink",
|
|
879
|
+
"flexNegative",
|
|
880
|
+
"flexOrder",
|
|
881
|
+
"gridArea",
|
|
882
|
+
"gridRow",
|
|
883
|
+
"gridRowEnd",
|
|
884
|
+
"gridRowSpan",
|
|
885
|
+
"gridRowStart",
|
|
886
|
+
"gridColumn",
|
|
887
|
+
"gridColumnEnd",
|
|
888
|
+
"gridColumnSpan",
|
|
889
|
+
"gridColumnStart",
|
|
890
|
+
"fontWeight",
|
|
891
|
+
"lineClamp",
|
|
892
|
+
"lineHeight",
|
|
893
|
+
"opacity",
|
|
894
|
+
"order",
|
|
895
|
+
"orphans",
|
|
896
|
+
"scale",
|
|
897
|
+
"tabSize",
|
|
898
|
+
"widows",
|
|
899
|
+
"zIndex",
|
|
900
|
+
"zoom",
|
|
901
|
+
"fillOpacity",
|
|
902
|
+
// SVG-related properties
|
|
903
|
+
"floodOpacity",
|
|
904
|
+
"stopOpacity",
|
|
905
|
+
"strokeDasharray",
|
|
906
|
+
"strokeDashoffset",
|
|
907
|
+
"strokeMiterlimit",
|
|
908
|
+
"strokeOpacity",
|
|
909
|
+
"strokeWidth"
|
|
910
|
+
]);
|
|
911
|
+
function qn(e) {
|
|
912
|
+
return $n.has(e);
|
|
913
|
+
}
|
|
914
|
+
function ke(e) {
|
|
915
|
+
const n = e.getPaths(), t = [];
|
|
916
|
+
for (let o = 0; o < n.getLength(); o++)
|
|
917
|
+
t.push(n.getAt(o).getArray());
|
|
918
|
+
return t;
|
|
919
|
+
}
|
|
920
|
+
function Zn(e) {
|
|
921
|
+
var n, t, o;
|
|
922
|
+
const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathsChanged: l, polygon: h, encodedPaths: f, paths: u, defaultPaths: p } = e, y = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathsChanged", "polygon", "encodedPaths", "paths", "defaultPaths"]), [d, m] = I(null), C = q(), b = H("geometry"), P = j(!1), A = K(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), W);
|
|
923
|
+
return E(() => {
|
|
924
|
+
if (!C) {
|
|
925
|
+
C === void 0 && console.error("<Polygon> has to be inside a Map component.");
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
let v;
|
|
929
|
+
if (h) {
|
|
930
|
+
v = h;
|
|
931
|
+
const O = u ?? p;
|
|
932
|
+
O && Array.isArray(O) && v.setPaths(O), v.setOptions(A);
|
|
933
|
+
} else {
|
|
934
|
+
const O = u ?? p, D = Object.assign({}, A);
|
|
935
|
+
O && Array.isArray(O) && (D.paths = O), v = new google.maps.Polygon(D);
|
|
936
|
+
}
|
|
937
|
+
return v.setMap(C), m(v), () => {
|
|
938
|
+
v.setMap(null), m(null);
|
|
939
|
+
};
|
|
940
|
+
}, [C, h]), L(d, "click", r), L(d, "drag", i), L(d, "dragstart", a), L(d, "mouseover", g), L(d, "mouseout", c), L(d, "dragend", (v) => {
|
|
941
|
+
s == null || s(v), l && d && !P.current && l(ke(d));
|
|
942
|
+
}), E(() => {
|
|
943
|
+
if (!d || !l)
|
|
944
|
+
return;
|
|
945
|
+
const v = [], O = d.getPaths();
|
|
946
|
+
if (typeof O.getLength != "function" || typeof O.getAt != "function")
|
|
947
|
+
return;
|
|
948
|
+
const D = () => {
|
|
949
|
+
P.current || l(ke(d));
|
|
950
|
+
}, S = (k) => {
|
|
951
|
+
v.push(google.maps.event.addListener(k, "insert_at", D)), v.push(google.maps.event.addListener(k, "remove_at", D)), v.push(google.maps.event.addListener(k, "set_at", D));
|
|
952
|
+
};
|
|
953
|
+
for (let k = 0; k < O.getLength(); k++)
|
|
954
|
+
S(O.getAt(k));
|
|
955
|
+
return v.push(google.maps.event.addListener(O, "insert_at", (k) => {
|
|
956
|
+
S(O.getAt(k)), D();
|
|
957
|
+
})), v.push(google.maps.event.addListener(O, "set_at", (k) => {
|
|
958
|
+
S(O.getAt(k)), D();
|
|
959
|
+
})), v.push(google.maps.event.addListener(O, "remove_at", D)), () => {
|
|
960
|
+
v.forEach((k) => k.remove());
|
|
961
|
+
};
|
|
962
|
+
}, [
|
|
963
|
+
d,
|
|
964
|
+
l,
|
|
965
|
+
u,
|
|
966
|
+
f,
|
|
967
|
+
A.editable,
|
|
968
|
+
A.draggable
|
|
969
|
+
]), E(() => {
|
|
970
|
+
d && d.setOptions(A);
|
|
971
|
+
}, [d, A]), E(() => {
|
|
972
|
+
if (!d || !u || !Array.isArray(u))
|
|
973
|
+
return;
|
|
974
|
+
const v = u[0], O = Array.isArray(v) ? u : [u], D = d.getPaths();
|
|
975
|
+
bn(O, D) || (P.current = !0, d.setPaths(u), P.current = !1);
|
|
976
|
+
}, [d, u]), E(() => {
|
|
977
|
+
if (!d || !f || !b)
|
|
978
|
+
return;
|
|
979
|
+
P.current = !0;
|
|
980
|
+
const v = f.map((O) => b.encoding.decodePath(O));
|
|
981
|
+
d.setPaths(v), P.current = !1;
|
|
982
|
+
}, [d, f, b]), d;
|
|
983
|
+
}
|
|
984
|
+
const Wn = B((e, n) => {
|
|
985
|
+
const t = Zn(e);
|
|
986
|
+
return z(n, () => t, [t]), M.createElement(M.Fragment, null);
|
|
987
|
+
});
|
|
988
|
+
Wn.displayName = "Polygon";
|
|
989
|
+
function Kn(e) {
|
|
990
|
+
var n, t, o;
|
|
991
|
+
const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathChanged: l, polyline: h, encodedPath: f, path: u, defaultPath: p } = e, y = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathChanged", "polyline", "encodedPath", "path", "defaultPath"]), [d, m] = I(null), C = q(), b = H("geometry"), P = j(!1), A = K(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), W);
|
|
992
|
+
return E(() => {
|
|
993
|
+
if (!C) {
|
|
994
|
+
C === void 0 && console.error("<Polyline> has to be inside a Map component.");
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
let v;
|
|
998
|
+
if (h) {
|
|
999
|
+
v = h;
|
|
1000
|
+
const O = u ?? p;
|
|
1001
|
+
O && Array.isArray(O) && v.setPath(O), v.setOptions(A);
|
|
1002
|
+
} else {
|
|
1003
|
+
const O = u ?? p, D = Object.assign({}, A);
|
|
1004
|
+
O && Array.isArray(O) && (D.path = O), v = new google.maps.Polyline(D);
|
|
1005
|
+
}
|
|
1006
|
+
return v.setMap(C), m(v), () => {
|
|
1007
|
+
v.setMap(null), m(null);
|
|
1008
|
+
};
|
|
1009
|
+
}, [C, h]), L(d, "click", r), L(d, "drag", i), L(d, "dragstart", a), L(d, "mouseover", g), L(d, "mouseout", c), L(d, "dragend", (v) => {
|
|
1010
|
+
s == null || s(v), l && d && !P.current && l(d.getPath().getArray());
|
|
1011
|
+
}), E(() => {
|
|
1012
|
+
if (!d || !l)
|
|
1013
|
+
return;
|
|
1014
|
+
const v = d.getPath();
|
|
1015
|
+
if (!v)
|
|
1016
|
+
return;
|
|
1017
|
+
const O = () => {
|
|
1018
|
+
P.current || l(v.getArray());
|
|
1019
|
+
}, D = [
|
|
1020
|
+
google.maps.event.addListener(v, "insert_at", O),
|
|
1021
|
+
google.maps.event.addListener(v, "remove_at", O),
|
|
1022
|
+
google.maps.event.addListener(v, "set_at", O)
|
|
1023
|
+
];
|
|
1024
|
+
return () => {
|
|
1025
|
+
D.forEach((S) => S.remove());
|
|
1026
|
+
};
|
|
1027
|
+
}, [
|
|
1028
|
+
d,
|
|
1029
|
+
l,
|
|
1030
|
+
u,
|
|
1031
|
+
f,
|
|
1032
|
+
A.editable,
|
|
1033
|
+
A.draggable
|
|
1034
|
+
]), E(() => {
|
|
1035
|
+
d && d.setOptions(A);
|
|
1036
|
+
}, [d, A]), E(() => {
|
|
1037
|
+
if (!d || !u)
|
|
1038
|
+
return;
|
|
1039
|
+
const v = d.getPath();
|
|
1040
|
+
xe(u, v) || (P.current = !0, d.setPath(u), P.current = !1);
|
|
1041
|
+
}, [d, u]), E(() => {
|
|
1042
|
+
if (!d || !f || !b)
|
|
1043
|
+
return;
|
|
1044
|
+
P.current = !0;
|
|
1045
|
+
const v = b.encoding.decodePath(f);
|
|
1046
|
+
d.setPath(v), P.current = !1;
|
|
1047
|
+
}, [d, f, b]), d;
|
|
1048
|
+
}
|
|
1049
|
+
const Yn = B((e, n) => {
|
|
1050
|
+
const t = Kn(e);
|
|
1051
|
+
return z(n, () => t, [t]), M.createElement(M.Fragment, null);
|
|
1052
|
+
});
|
|
1053
|
+
Yn.displayName = "Polyline";
|
|
1054
|
+
const Xn = {
|
|
1055
|
+
center: { lat: 0, lng: 0, altitude: 0 },
|
|
1056
|
+
range: 0,
|
|
1057
|
+
heading: 0,
|
|
1058
|
+
tilt: 0,
|
|
1059
|
+
roll: 0
|
|
1060
|
+
}, Qn = ["center", "range", "heading", "tilt", "roll"];
|
|
1061
|
+
function et(e, n, t) {
|
|
1062
|
+
const o = e[t];
|
|
1063
|
+
if (o != null)
|
|
1064
|
+
if (t === "center") {
|
|
1065
|
+
const r = o;
|
|
1066
|
+
n.current.center = r.toJSON ? r.toJSON() : r;
|
|
1067
|
+
} else
|
|
1068
|
+
n.current[t] = o;
|
|
1069
|
+
}
|
|
1070
|
+
function nt(e) {
|
|
1071
|
+
const n = je(), t = j(Object.assign({}, Xn));
|
|
1072
|
+
return E(() => {
|
|
1073
|
+
if (!e)
|
|
1074
|
+
return;
|
|
1075
|
+
const o = [];
|
|
1076
|
+
for (const r of Qn) {
|
|
1077
|
+
const i = `gmp-${r}change`, a = () => {
|
|
1078
|
+
et(e, t, r), n();
|
|
1079
|
+
};
|
|
1080
|
+
e.addEventListener(i, a), o.push(() => e.removeEventListener(i, a));
|
|
1081
|
+
}
|
|
1082
|
+
return () => {
|
|
1083
|
+
for (const r of o)
|
|
1084
|
+
r();
|
|
1085
|
+
};
|
|
1086
|
+
}, [e, n]), t;
|
|
1087
|
+
}
|
|
1088
|
+
function tt(e) {
|
|
1089
|
+
const n = H("maps3d"), [t, o] = I(!1), [, r] = le(), [i, a] = le(), s = nt(i);
|
|
1090
|
+
return E(() => {
|
|
1091
|
+
customElements.whenDefined("gmp-map-3d").then(() => {
|
|
1092
|
+
o(!0);
|
|
1093
|
+
});
|
|
1094
|
+
}, []), E(
|
|
1095
|
+
() => {
|
|
1096
|
+
if (!i)
|
|
1097
|
+
return;
|
|
1098
|
+
const {
|
|
1099
|
+
center: c,
|
|
1100
|
+
heading: l,
|
|
1101
|
+
tilt: h,
|
|
1102
|
+
range: f,
|
|
1103
|
+
roll: u,
|
|
1104
|
+
defaultCenter: p,
|
|
1105
|
+
defaultHeading: y,
|
|
1106
|
+
defaultTilt: d,
|
|
1107
|
+
defaultRange: m,
|
|
1108
|
+
defaultRoll: C,
|
|
1109
|
+
// Non-element props to exclude
|
|
1110
|
+
id: b,
|
|
1111
|
+
style: P,
|
|
1112
|
+
className: A,
|
|
1113
|
+
children: v,
|
|
1114
|
+
onCenterChanged: O,
|
|
1115
|
+
onHeadingChanged: D,
|
|
1116
|
+
onTiltChanged: S,
|
|
1117
|
+
onRangeChanged: k,
|
|
1118
|
+
onRollChanged: T,
|
|
1119
|
+
onCameraChanged: Y,
|
|
1120
|
+
onClick: X,
|
|
1121
|
+
onSteadyChange: Ot,
|
|
1122
|
+
onAnimationEnd: Mt,
|
|
1123
|
+
onError: Pt,
|
|
1124
|
+
mode: At,
|
|
1125
|
+
gestureHandling: kt
|
|
1126
|
+
} = e, ze = N(e, ["center", "heading", "tilt", "range", "roll", "defaultCenter", "defaultHeading", "defaultTilt", "defaultRange", "defaultRoll", "id", "style", "className", "children", "onCenterChanged", "onHeadingChanged", "onTiltChanged", "onRangeChanged", "onRollChanged", "onCameraChanged", "onClick", "onSteadyChange", "onAnimationEnd", "onError", "mode", "gestureHandling"]), pe = c ?? p, ve = l ?? y, ye = h ?? d, Ce = f ?? m, Ee = u ?? C, G = Object.assign({}, ze);
|
|
1127
|
+
pe && (G.center = pe), ve !== void 0 && (G.heading = ve), ye !== void 0 && (G.tilt = ye), Ce !== void 0 && (G.range = Ce), Ee !== void 0 && (G.roll = Ee), Object.assign(i, G);
|
|
1128
|
+
},
|
|
1129
|
+
// this effect should only run when the map3d element first becomes
|
|
1130
|
+
// available, so we skip re-running it when other props change.
|
|
1131
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1132
|
+
[i]
|
|
1133
|
+
), [i, r, a, s, !!n && t];
|
|
1134
|
+
}
|
|
1135
|
+
function ot(e) {
|
|
1136
|
+
return e ? "toJSON" in e && typeof e.toJSON == "function" ? e.toJSON() : e : null;
|
|
1137
|
+
}
|
|
1138
|
+
function rt(e, n, t) {
|
|
1139
|
+
var o, r, i, a, s, g, c;
|
|
1140
|
+
const l = ot(t.center), h = (o = l == null ? void 0 : l.lat) !== null && o !== void 0 ? o : null, f = (r = l == null ? void 0 : l.lng) !== null && r !== void 0 ? r : null, u = (i = l == null ? void 0 : l.altitude) !== null && i !== void 0 ? i : null, p = (a = t.range) !== null && a !== void 0 ? a : null, y = (s = t.heading) !== null && s !== void 0 ? s : null, d = (g = t.tilt) !== null && g !== void 0 ? g : null, m = (c = t.roll) !== null && c !== void 0 ? c : null;
|
|
1141
|
+
V(() => {
|
|
1142
|
+
var C;
|
|
1143
|
+
if (!e)
|
|
1144
|
+
return;
|
|
1145
|
+
const b = n.current;
|
|
1146
|
+
h !== null && f !== null && (b.center.lat !== h || b.center.lng !== f || u !== null && b.center.altitude !== u) && (e.center = {
|
|
1147
|
+
lat: h,
|
|
1148
|
+
lng: f,
|
|
1149
|
+
altitude: (C = u ?? b.center.altitude) !== null && C !== void 0 ? C : 0
|
|
1150
|
+
}), p !== null && b.range !== p && (e.range = p), y !== null && b.heading !== y && (e.heading = y), d !== null && b.tilt !== d && (e.tilt = d), m !== null && b.roll !== m && (e.roll = m);
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
const De = [
|
|
1154
|
+
"gmp-centerchange",
|
|
1155
|
+
"gmp-headingchange",
|
|
1156
|
+
"gmp-tiltchange",
|
|
1157
|
+
"gmp-rangechange",
|
|
1158
|
+
"gmp-rollchange"
|
|
1159
|
+
];
|
|
1160
|
+
function J(e, n) {
|
|
1161
|
+
const t = e.center;
|
|
1162
|
+
let o;
|
|
1163
|
+
return t && "toJSON" in t && typeof t.toJSON == "function" ? o = t.toJSON() : t ? o = t : o = { lat: 0, lng: 0, altitude: 0 }, {
|
|
1164
|
+
type: n,
|
|
1165
|
+
map3d: e,
|
|
1166
|
+
detail: {
|
|
1167
|
+
center: o,
|
|
1168
|
+
range: e.range || 0,
|
|
1169
|
+
heading: e.heading || 0,
|
|
1170
|
+
tilt: e.tilt || 0,
|
|
1171
|
+
roll: e.roll || 0
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function it(e, n) {
|
|
1176
|
+
const t = n;
|
|
1177
|
+
return {
|
|
1178
|
+
type: "gmp-click",
|
|
1179
|
+
map3d: e,
|
|
1180
|
+
detail: {
|
|
1181
|
+
position: n.position || null,
|
|
1182
|
+
placeId: t.placeId
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function at(e, n) {
|
|
1187
|
+
return {
|
|
1188
|
+
type: "gmp-steadychange",
|
|
1189
|
+
map3d: e,
|
|
1190
|
+
detail: {
|
|
1191
|
+
isSteady: n.isSteady
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
function st(e, n) {
|
|
1196
|
+
const { onCenterChanged: t, onHeadingChanged: o, onTiltChanged: r, onRangeChanged: i, onRollChanged: a, onCameraChanged: s, onClick: g, onSteadyChange: c, onAnimationEnd: l, onError: h } = n;
|
|
1197
|
+
U(e, "gmp-centerchange", t, J), U(e, "gmp-headingchange", o, J), U(e, "gmp-tiltchange", r, J), U(e, "gmp-rangechange", i, J), U(e, "gmp-rollchange", a, J), E(() => {
|
|
1198
|
+
if (!e || !s)
|
|
1199
|
+
return;
|
|
1200
|
+
const f = () => {
|
|
1201
|
+
s(J(e, "camerachange"));
|
|
1202
|
+
};
|
|
1203
|
+
for (const u of De)
|
|
1204
|
+
e.addEventListener(u, f);
|
|
1205
|
+
return () => {
|
|
1206
|
+
for (const u of De)
|
|
1207
|
+
e.removeEventListener(u, f);
|
|
1208
|
+
};
|
|
1209
|
+
}, [e, s]), E(() => {
|
|
1210
|
+
if (!e || !g)
|
|
1211
|
+
return;
|
|
1212
|
+
const f = (u) => {
|
|
1213
|
+
g(it(e, u));
|
|
1214
|
+
};
|
|
1215
|
+
return e.addEventListener("gmp-click", f), () => e.removeEventListener("gmp-click", f);
|
|
1216
|
+
}, [e, g]), E(() => {
|
|
1217
|
+
if (!e || !c)
|
|
1218
|
+
return;
|
|
1219
|
+
const f = (u) => {
|
|
1220
|
+
c(at(e, u));
|
|
1221
|
+
};
|
|
1222
|
+
return e.addEventListener("gmp-steadychange", f), () => e.removeEventListener("gmp-steadychange", f);
|
|
1223
|
+
}, [e, c]), U(e, "gmp-animationend", l, (f, u) => ({
|
|
1224
|
+
type: u,
|
|
1225
|
+
map3d: f
|
|
1226
|
+
})), U(e, "gmp-error", h, (f, u) => ({
|
|
1227
|
+
type: u,
|
|
1228
|
+
map3d: f
|
|
1229
|
+
}));
|
|
1230
|
+
}
|
|
1231
|
+
function U(e, n, t, o) {
|
|
1232
|
+
E(() => {
|
|
1233
|
+
if (!e || !t)
|
|
1234
|
+
return;
|
|
1235
|
+
const r = () => {
|
|
1236
|
+
t(o(e, n));
|
|
1237
|
+
};
|
|
1238
|
+
return e.addEventListener(n, r), () => e.removeEventListener(n, r);
|
|
1239
|
+
}, [e, n, t, o]);
|
|
1240
|
+
}
|
|
1241
|
+
const lt = /* @__PURE__ */ new Set([
|
|
1242
|
+
"bounds",
|
|
1243
|
+
"defaultUIHidden",
|
|
1244
|
+
"gestureHandling",
|
|
1245
|
+
"internalUsageAttributionIds",
|
|
1246
|
+
"maxAltitude",
|
|
1247
|
+
"maxHeading",
|
|
1248
|
+
"maxTilt",
|
|
1249
|
+
"minAltitude",
|
|
1250
|
+
"minHeading",
|
|
1251
|
+
"minTilt",
|
|
1252
|
+
"mode"
|
|
1253
|
+
]);
|
|
1254
|
+
function ct(e, n) {
|
|
1255
|
+
const t = w(() => {
|
|
1256
|
+
const o = {}, r = Object.keys(n);
|
|
1257
|
+
for (const i of r) {
|
|
1258
|
+
if (!lt.has(i))
|
|
1259
|
+
continue;
|
|
1260
|
+
const a = n[i];
|
|
1261
|
+
a !== void 0 && (o[i] = a);
|
|
1262
|
+
}
|
|
1263
|
+
return o;
|
|
1264
|
+
}, [n]);
|
|
1265
|
+
we(() => {
|
|
1266
|
+
e && Object.assign(e, t);
|
|
1267
|
+
}, [e, t]);
|
|
1268
|
+
}
|
|
1269
|
+
const dt = M.createContext(null), ut = {
|
|
1270
|
+
width: "100%",
|
|
1271
|
+
height: "100%",
|
|
1272
|
+
position: "relative"
|
|
1273
|
+
}, gt = B((e, n) => {
|
|
1274
|
+
const { children: t, id: o, className: r, style: i } = e, a = R($);
|
|
1275
|
+
if (!a)
|
|
1276
|
+
throw new Error("<Map3D> can only be used inside an <APIProvider> component.");
|
|
1277
|
+
const { addMap3DInstance: s, removeMap3DInstance: g } = a, [c, l, h, f, u] = tt(e);
|
|
1278
|
+
rt(c, f, e), st(c, e), ct(c, e), E(() => {
|
|
1279
|
+
if (!c)
|
|
1280
|
+
return;
|
|
1281
|
+
const d = o ?? "default";
|
|
1282
|
+
return s(c, d), () => {
|
|
1283
|
+
g(d);
|
|
1284
|
+
};
|
|
1285
|
+
}, [c, o]), z(n, () => ({
|
|
1286
|
+
map3d: c,
|
|
1287
|
+
flyCameraAround: (d) => {
|
|
1288
|
+
c == null || c.flyCameraAround(d);
|
|
1289
|
+
},
|
|
1290
|
+
flyCameraTo: (d) => {
|
|
1291
|
+
c == null || c.flyCameraTo(d);
|
|
1292
|
+
},
|
|
1293
|
+
stopCameraAnimation: () => {
|
|
1294
|
+
c == null || c.stopCameraAnimation();
|
|
1295
|
+
}
|
|
1296
|
+
}), [c]);
|
|
1297
|
+
const p = w(() => Object.assign(Object.assign({}, ut), i), [i]), y = w(() => ({ map3d: c }), [c]);
|
|
1298
|
+
return u ? M.createElement(
|
|
1299
|
+
"div",
|
|
1300
|
+
Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : p, className: r }, o ? { id: o } : {}),
|
|
1301
|
+
M.createElement("gmp-map-3d", { ref: h, style: { width: "100%", height: "100%" } }, c && M.createElement(dt.Provider, { value: y }, t))
|
|
1302
|
+
) : M.createElement("div", Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : p, className: r }, o ? { id: o } : {}));
|
|
1303
|
+
});
|
|
1304
|
+
gt.displayName = "Map3D";
|
|
1305
|
+
const me = Ue(null), ft = B(function(n, t) {
|
|
1306
|
+
const { children: o, onClick: r, position: i, altitudeMode: a, collisionBehavior: s, drawsWhenOccluded: g, extruded: c, label: l, sizePreserved: h, zIndex: f, title: u } = n, p = !!r, [y, d] = I(null), [m, C] = I(!1), b = w(() => {
|
|
1307
|
+
const v = document.createElement("div");
|
|
1308
|
+
return v.style.display = "none", document.body.appendChild(v), v;
|
|
1309
|
+
}, []);
|
|
1310
|
+
E(() => () => b.remove(), [b]);
|
|
1311
|
+
const P = ue((v) => {
|
|
1312
|
+
d(v), typeof t == "function" ? t(v) : t && (t.current = v);
|
|
1313
|
+
}, [t]);
|
|
1314
|
+
ce(y, "gmp-click", r), V(() => {
|
|
1315
|
+
if (m || !y || !b)
|
|
1316
|
+
return;
|
|
1317
|
+
for (; y.firstChild; )
|
|
1318
|
+
y.removeChild(y.firstChild);
|
|
1319
|
+
const v = Array.from(b.childNodes);
|
|
1320
|
+
for (const O of v) {
|
|
1321
|
+
if (O.nodeType !== Node.ELEMENT_NODE)
|
|
1322
|
+
continue;
|
|
1323
|
+
const D = O, S = D.tagName.toLowerCase();
|
|
1324
|
+
if (S === "img" || S === "svg") {
|
|
1325
|
+
const k = document.createElement("template");
|
|
1326
|
+
k.content.appendChild(D.cloneNode(!0)), y.appendChild(k);
|
|
1327
|
+
} else
|
|
1328
|
+
y.appendChild(D.cloneNode(!0));
|
|
1329
|
+
}
|
|
1330
|
+
}, [y, b, o, m]);
|
|
1331
|
+
const A = w(() => ({ marker: y, setContentHandledExternally: C }), [y]);
|
|
1332
|
+
return _(y, "position", i), _(y, "altitudeMode", a), _(y, "collisionBehavior", s), _(y, "drawsWhenOccluded", g), _(y, "extruded", c), _(y, "label", l), _(y, "sizePreserved", h), _(y, "zIndex", f), _(y, "title", u ?? ""), M.createElement(
|
|
1333
|
+
me.Provider,
|
|
1334
|
+
{ value: A },
|
|
1335
|
+
p ? M.createElement("gmp-marker-3d-interactive", { ref: P }) : M.createElement("gmp-marker-3d", { ref: P }),
|
|
1336
|
+
oe(o, b)
|
|
1337
|
+
);
|
|
1338
|
+
});
|
|
1339
|
+
ft.displayName = "Marker3D";
|
|
1340
|
+
const ht = B(function(n, t) {
|
|
1341
|
+
var o;
|
|
1342
|
+
const { children: r, headerContent: i, style: a, className: s, open: g = !0, position: c, anchor: l, anchorId: h, altitudeMode: f, lightDismissDisabled: u, autoPanDisabled: p, onClose: y } = n, [d, m] = I(null), C = j(null);
|
|
1343
|
+
z(t, () => d, [d]), mt(d, g, y), _(d, "open", g ?? !1), _(d, "altitudeMode", f), _(d, "lightDismissDisabled", u), _(d, "autoPanDisabled", p);
|
|
1344
|
+
const b = (o = l ?? h) !== null && o !== void 0 ? o : c;
|
|
1345
|
+
return _(d, "positionAnchor", b), V(() => {
|
|
1346
|
+
d && (Vn(d, a || null, C.current), C.current = a || null);
|
|
1347
|
+
}, [d, a]), M.createElement(
|
|
1348
|
+
"gmp-popover",
|
|
1349
|
+
{ ref: m, className: s },
|
|
1350
|
+
i && M.createElement("div", { slot: "header" }, i),
|
|
1351
|
+
r
|
|
1352
|
+
);
|
|
1353
|
+
});
|
|
1354
|
+
ht.displayName = "Popover";
|
|
1355
|
+
function mt(e, n, t) {
|
|
1356
|
+
const o = j(void 0), r = j(n);
|
|
1357
|
+
E(() => {
|
|
1358
|
+
r.current = n;
|
|
1359
|
+
}, [n]), E(() => {
|
|
1360
|
+
if (!e || !t)
|
|
1361
|
+
return;
|
|
1362
|
+
const i = new MutationObserver((a) => {
|
|
1363
|
+
for (const s of a)
|
|
1364
|
+
if (s.type === "attributes" && s.attributeName === "open") {
|
|
1365
|
+
const g = e.hasAttribute("open");
|
|
1366
|
+
o.current === !0 && !g && r.current !== !1 && t(), o.current = g;
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
return i.observe(e, {
|
|
1370
|
+
attributes: !0,
|
|
1371
|
+
attributeFilter: ["open"]
|
|
1372
|
+
}), o.current = e.hasAttribute("open"), () => {
|
|
1373
|
+
i.disconnect();
|
|
1374
|
+
};
|
|
1375
|
+
}, [e, t]);
|
|
1376
|
+
}
|
|
1377
|
+
function pt(e) {
|
|
1378
|
+
const [n, t] = I(null), o = q(), { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c } = e, l = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut"]), { position: h, draggable: f } = l;
|
|
1379
|
+
return E(() => {
|
|
1380
|
+
if (!o) {
|
|
1381
|
+
o === void 0 && console.error("<Marker> has to be inside a Map component.");
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
const u = new google.maps.Marker(l);
|
|
1385
|
+
return u.setMap(o), t(u), () => {
|
|
1386
|
+
u.setMap(null), t(null);
|
|
1387
|
+
};
|
|
1388
|
+
}, [o]), E(() => {
|
|
1389
|
+
if (!n)
|
|
1390
|
+
return;
|
|
1391
|
+
const u = n, p = google.maps.event;
|
|
1392
|
+
return r && p.addListener(u, "click", r), i && p.addListener(u, "drag", i), a && p.addListener(u, "dragstart", a), s && p.addListener(u, "dragend", s), g && p.addListener(u, "mouseover", g), c && p.addListener(u, "mouseout", c), n.setDraggable(!!f), () => {
|
|
1393
|
+
p.clearInstanceListeners(u);
|
|
1394
|
+
};
|
|
1395
|
+
}, [
|
|
1396
|
+
n,
|
|
1397
|
+
f,
|
|
1398
|
+
r,
|
|
1399
|
+
i,
|
|
1400
|
+
a,
|
|
1401
|
+
s,
|
|
1402
|
+
g,
|
|
1403
|
+
c
|
|
1404
|
+
]), E(() => {
|
|
1405
|
+
n && l && n.setOptions(l);
|
|
1406
|
+
}, [n, l]), E(() => {
|
|
1407
|
+
f || !h || !n || n.setPosition(h);
|
|
1408
|
+
}, [f, h, n]), n;
|
|
1409
|
+
}
|
|
1410
|
+
const vt = B((e, n) => {
|
|
1411
|
+
const t = pt(e);
|
|
1412
|
+
return z(n, () => t, [t]), M.createElement(M.Fragment, null);
|
|
1413
|
+
});
|
|
1414
|
+
vt.displayName = "Marker";
|
|
1415
|
+
const yt = (e) => {
|
|
1416
|
+
const n = R(he), t = R(me), o = n == null ? void 0 : n.marker, r = t == null ? void 0 : t.marker, i = t == null ? void 0 : t.setContentHandledExternally, a = w(() => document.createElement("div"), []), s = H("marker");
|
|
1417
|
+
return E(() => {
|
|
1418
|
+
if (r && i)
|
|
1419
|
+
return i(!0), () => i(!1);
|
|
1420
|
+
}, [r, i]), E(() => {
|
|
1421
|
+
if (!r || !s)
|
|
1422
|
+
return;
|
|
1423
|
+
const g = Object.assign({}, e), c = new s.PinElement(g);
|
|
1424
|
+
for (e.children && (c.glyph = a); r.firstChild; )
|
|
1425
|
+
r.removeChild(r.firstChild);
|
|
1426
|
+
return r.append(c), () => {
|
|
1427
|
+
};
|
|
1428
|
+
}, [r, s, a, e]), E(() => {
|
|
1429
|
+
var g;
|
|
1430
|
+
if (r)
|
|
1431
|
+
return;
|
|
1432
|
+
if (!o) {
|
|
1433
|
+
o === void 0 && r === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
e.glyph && e.children && Z("The <Pin> component only uses children to render the glyph if both the glyph property and children are present."), ge.count(e.children) > 1 && Z("Passing multiple children to the <Pin> component might lead to unexpected results.");
|
|
1437
|
+
const c = Object.assign({}, e), l = new google.maps.marker.PinElement(c);
|
|
1438
|
+
e.children && (l.glyph = a);
|
|
1439
|
+
const h = (g = o.content) === null || g === void 0 ? void 0 : g.firstChild;
|
|
1440
|
+
for (; h != null && h.firstChild; )
|
|
1441
|
+
h.removeChild(h.firstChild);
|
|
1442
|
+
h && h.appendChild(l.element);
|
|
1443
|
+
}, [o, a, r, e]), oe(e.children, a);
|
|
1444
|
+
}, Ct = (e) => {
|
|
1445
|
+
const { children: n } = e, t = R(he), o = R(me), r = t == null ? void 0 : t.marker, i = o == null ? void 0 : o.marker, a = o == null ? void 0 : o.setContentHandledExternally, s = w(() => document.createElement("div"), []), g = H("marker");
|
|
1446
|
+
return E(() => {
|
|
1447
|
+
if (i && a)
|
|
1448
|
+
return a(!0), () => a(!1);
|
|
1449
|
+
}, [i, a]), E(() => {
|
|
1450
|
+
if (!i || !g)
|
|
1451
|
+
return;
|
|
1452
|
+
const c = Object.assign({}, e), l = new g.PinElement(c);
|
|
1453
|
+
for (n && l.appendChild(s); i.firstChild; )
|
|
1454
|
+
i.removeChild(i.firstChild);
|
|
1455
|
+
return i.appendChild(l), () => {
|
|
1456
|
+
};
|
|
1457
|
+
}, [i, g, s, n, e]), E(() => {
|
|
1458
|
+
var c;
|
|
1459
|
+
if (i)
|
|
1460
|
+
return;
|
|
1461
|
+
if (!r || !g) {
|
|
1462
|
+
r === void 0 && i === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
(e.glyphSrc || e.glyphText) && n && Z("The <Pin> component only uses children to render the glyph if both glyphSrc/glyphText and children are present."), ge.count(n) > 1 && Z("Passing multiple children to the <Pin> component might lead to unexpected results.");
|
|
1466
|
+
const l = Object.assign({}, e), h = new g.PinElement(l);
|
|
1467
|
+
n && h.appendChild(s);
|
|
1468
|
+
const f = (c = r.content) === null || c === void 0 ? void 0 : c.firstChild;
|
|
1469
|
+
for (; f != null && f.firstChild; )
|
|
1470
|
+
f.removeChild(f.firstChild);
|
|
1471
|
+
f && f.appendChild(h);
|
|
1472
|
+
}, [
|
|
1473
|
+
r,
|
|
1474
|
+
g,
|
|
1475
|
+
s,
|
|
1476
|
+
i,
|
|
1477
|
+
n,
|
|
1478
|
+
e
|
|
1479
|
+
]), oe(n, s);
|
|
1480
|
+
}, It = (e) => {
|
|
1481
|
+
var n;
|
|
1482
|
+
const t = H("marker"), o = w(() => t ? typeof customElements < "u" && customElements.get("gmp-pin") !== void 0 : !1, [t]);
|
|
1483
|
+
if (!t)
|
|
1484
|
+
return null;
|
|
1485
|
+
if (o) {
|
|
1486
|
+
const { glyph: r, glyphSrc: i, glyphText: a } = e, s = N(e, ["glyph", "glyphSrc", "glyphText"]), g = r instanceof URL || typeof r == "string" && r.startsWith("http"), c = a ?? (typeof r == "string" && !g ? r : void 0), l = i ?? (g ? String(r) : void 0);
|
|
1487
|
+
return M.createElement(Ct, Object.assign({}, s, { glyphText: c, glyphSrc: l }));
|
|
1488
|
+
} else {
|
|
1489
|
+
const { glyph: r, glyphSrc: i, glyphText: a } = e, s = N(e, ["glyph", "glyphSrc", "glyphText"]), g = (n = r ?? i) !== null && n !== void 0 ? n : a;
|
|
1490
|
+
return M.createElement(yt, Object.assign({}, s, { glyph: g }));
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
function Et(e) {
|
|
1494
|
+
var n, t, o;
|
|
1495
|
+
const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onBoundsChanged: l, bounds: h, defaultBounds: f } = e, u = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onBoundsChanged", "bounds", "defaultBounds"]), [p, y] = I(null), d = q(), m = K(Object.assign(Object.assign({}, u), { clickable: (n = u.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = u.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = u.editable) !== null && o !== void 0 ? o : !!l }), W);
|
|
1496
|
+
return E(() => {
|
|
1497
|
+
if (!d) {
|
|
1498
|
+
d === void 0 && console.error("<Rectangle> has to be inside a Map component.");
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
const C = new google.maps.Rectangle(Object.assign(Object.assign({}, m), { bounds: h ?? f }));
|
|
1502
|
+
return C.setMap(d), y(C), () => {
|
|
1503
|
+
C.setMap(null), y(null);
|
|
1504
|
+
};
|
|
1505
|
+
}, [d]), L(p, "click", r), L(p, "drag", i), L(p, "dragstart", a), L(p, "dragend", s), L(p, "mouseover", g), L(p, "mouseout", c), L(p, "bounds_changed", l ? () => {
|
|
1506
|
+
l(p == null ? void 0 : p.getBounds());
|
|
1507
|
+
} : null), E(() => {
|
|
1508
|
+
p && p.setOptions(m);
|
|
1509
|
+
}, [p, m]), E(() => {
|
|
1510
|
+
!p || !h || En(h, p.getBounds()) || p.setBounds(h);
|
|
1511
|
+
}, [p, h]), p;
|
|
1512
|
+
}
|
|
1513
|
+
const bt = B((e, n) => {
|
|
1514
|
+
const t = Et(e);
|
|
1515
|
+
return z(n, () => t, [
|
|
1516
|
+
t
|
|
1517
|
+
]), M.createElement(M.Fragment, null);
|
|
1518
|
+
});
|
|
1519
|
+
bt.displayName = "Rectangle";
|
|
1520
|
+
export {
|
|
1521
|
+
_t as A,
|
|
1522
|
+
Dn as M,
|
|
1523
|
+
It as P,
|
|
1524
|
+
Fn as a,
|
|
1525
|
+
vt as b,
|
|
1526
|
+
q as c,
|
|
1527
|
+
H as u
|
|
1528
|
+
};
|
|
1529
|
+
//# sourceMappingURL=index.modern-D2LGACWg.js.map
|