react-three-map 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cjs/main.js.js +1 -1
  2. package/dist/es/main.js2.mjs +14 -15
  3. package/dist/es/main.js2.mjs.map +1 -1
  4. package/dist/es/main.js3.mjs +7 -17
  5. package/dist/es/main.js3.mjs.map +1 -1
  6. package/dist/es/main.js4.mjs +49 -7
  7. package/dist/es/main.js4.mjs.map +1 -1
  8. package/dist/es/main.js5.mjs +11 -48
  9. package/dist/es/main.js5.mjs.map +1 -1
  10. package/dist/es/main.js6.mjs +52 -12
  11. package/dist/es/main.js6.mjs.map +1 -1
  12. package/dist/es/main.js7.mjs +6 -59
  13. package/dist/es/main.js7.mjs.map +1 -1
  14. package/package.json +8 -9
  15. package/dist/es/main.js10.mjs +0 -40
  16. package/dist/es/main.js10.mjs.map +0 -1
  17. package/dist/es/main.js11.mjs +0 -13
  18. package/dist/es/main.js11.mjs.map +0 -1
  19. package/dist/es/main.js12.mjs +0 -13
  20. package/dist/es/main.js12.mjs.map +0 -1
  21. package/dist/es/main.js13.mjs +0 -31
  22. package/dist/es/main.js13.mjs.map +0 -1
  23. package/dist/es/main.js14.mjs +0 -13
  24. package/dist/es/main.js14.mjs.map +0 -1
  25. package/dist/es/main.js15.mjs +0 -15
  26. package/dist/es/main.js15.mjs.map +0 -1
  27. package/dist/es/main.js16.mjs +0 -14
  28. package/dist/es/main.js16.mjs.map +0 -1
  29. package/dist/es/main.js17.mjs +0 -56
  30. package/dist/es/main.js17.mjs.map +0 -1
  31. package/dist/es/main.js18.mjs +0 -9
  32. package/dist/es/main.js18.mjs.map +0 -1
  33. package/dist/es/main.js19.mjs +0 -320
  34. package/dist/es/main.js19.mjs.map +0 -1
  35. package/dist/es/main.js20.mjs +0 -72
  36. package/dist/es/main.js20.mjs.map +0 -1
  37. package/dist/es/main.js21.mjs +0 -6
  38. package/dist/es/main.js21.mjs.map +0 -1
  39. package/dist/es/main.js22.mjs +0 -19
  40. package/dist/es/main.js22.mjs.map +0 -1
  41. package/dist/es/main.js23.mjs +0 -14
  42. package/dist/es/main.js23.mjs.map +0 -1
  43. package/dist/es/main.js24.mjs +0 -34
  44. package/dist/es/main.js24.mjs.map +0 -1
  45. package/dist/es/main.js25.mjs +0 -15
  46. package/dist/es/main.js25.mjs.map +0 -1
  47. package/dist/es/main.js26.mjs +0 -8
  48. package/dist/es/main.js26.mjs.map +0 -1
  49. package/dist/es/main.js27.mjs +0 -41
  50. package/dist/es/main.js27.mjs.map +0 -1
  51. package/dist/es/main.js28.mjs +0 -26
  52. package/dist/es/main.js28.mjs.map +0 -1
  53. package/dist/es/main.js8.mjs +0 -58
  54. package/dist/es/main.js8.mjs.map +0 -1
  55. package/dist/es/main.js9.mjs +0 -49
  56. package/dist/es/main.js9.mjs.map +0 -1
@@ -1,40 +0,0 @@
1
- import { createPortal as h } from "react-dom";
2
- import { memo as L, forwardRef as v, useContext as C, useMemo as f, useRef as x, useEffect as m, useImperativeHandle as N } from "react";
3
- import { applyReactStyle as M } from "./main.js23.mjs";
4
- import { MapContext as O } from "./main.js8.mjs";
5
- import { deepEqual as y } from "./main.js24.mjs";
6
- function r(t) {
7
- return new Set(t ? t.trim().split(/\s+/) : []);
8
- }
9
- function E(t, u) {
10
- const { map: d, mapLib: g } = C(O), c = f(() => document.createElement("div"), []), i = x({ props: t });
11
- i.current.props = t;
12
- const e = f(() => {
13
- const a = { ...t }, o = new g.Popup(a);
14
- return o.setLngLat([t.longitude, t.latitude]), o.once("open", (n) => {
15
- var s, l;
16
- (l = (s = i.current.props).onOpen) === null || l === void 0 || l.call(s, n);
17
- }), o;
18
- }, []);
19
- if (m(() => {
20
- const a = (o) => {
21
- var n, s;
22
- (s = (n = i.current.props).onClose) === null || s === void 0 || s.call(n, o);
23
- };
24
- return e.on("close", a), e.setDOMContent(c).addTo(d.getMap()), () => {
25
- e.off("close", a), e.isOpen() && e.remove();
26
- };
27
- }, []), m(() => {
28
- M(e.getElement(), t.style);
29
- }, [t.style]), N(u, () => e, []), e.isOpen() && ((e.getLngLat().lng !== t.longitude || e.getLngLat().lat !== t.latitude) && e.setLngLat([t.longitude, t.latitude]), t.offset && !y(e.options.offset, t.offset) && e.setOffset(t.offset), (e.options.anchor !== t.anchor || e.options.maxWidth !== t.maxWidth) && (e.options.anchor = t.anchor, e.setMaxWidth(t.maxWidth)), e.options.className !== t.className)) {
30
- const a = r(e.options.className), o = r(t.className);
31
- for (const n of a)
32
- o.has(n) || e.removeClassName(n);
33
- for (const n of o)
34
- a.has(n) || e.addClassName(n);
35
- e.options.className = t.className;
36
- }
37
- return h(t.children, c);
38
- }
39
- L(v(E));
40
- //# sourceMappingURL=main.js10.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js10.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/popup.js"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport { useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport { MapContext } from './map';\nimport { deepEqual } from '../utils/deep-equal';\n// Adapted from https://github.com/mapbox/mapbox-gl-js/blob/v1.13.0/src/ui/popup.js\nfunction getClassList(className) {\n return new Set(className ? className.trim().split(/\\s+/) : []);\n}\n/* eslint-disable complexity,max-statements */\nfunction Popup(props, ref) {\n const { map, mapLib } = useContext(MapContext);\n const container = useMemo(() => {\n return document.createElement('div');\n }, []);\n const thisRef = useRef({ props });\n thisRef.current.props = props;\n const popup = useMemo(() => {\n const options = { ...props };\n const pp = new mapLib.Popup(options);\n pp.setLngLat([props.longitude, props.latitude]);\n pp.once('open', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onOpen) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n return pp;\n }, []);\n useEffect(() => {\n const onClose = e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n };\n popup.on('close', onClose);\n popup.setDOMContent(container).addTo(map.getMap());\n return () => {\n // https://github.com/visgl/react-map-gl/issues/1825\n // onClose should not be fired if the popup is removed by unmounting\n // When using React strict mode, the component is mounted twice.\n // Firing the onClose callback here would be a false signal to remove the component.\n popup.off('close', onClose);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n }, []);\n useEffect(() => {\n applyReactStyle(popup.getElement(), props.style);\n }, [props.style]);\n useImperativeHandle(ref, () => popup, []);\n if (popup.isOpen()) {\n if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {\n popup.setLngLat([props.longitude, props.latitude]);\n }\n if (props.offset && !deepEqual(popup.options.offset, props.offset)) {\n popup.setOffset(props.offset);\n }\n if (popup.options.anchor !== props.anchor || popup.options.maxWidth !== props.maxWidth) {\n popup.options.anchor = props.anchor;\n popup.setMaxWidth(props.maxWidth);\n }\n if (popup.options.className !== props.className) {\n const prevClassList = getClassList(popup.options.className);\n const nextClassList = getClassList(props.className);\n for (const c of prevClassList) {\n if (!nextClassList.has(c)) {\n popup.removeClassName(c);\n }\n }\n for (const c of nextClassList) {\n if (!prevClassList.has(c)) {\n popup.addClassName(c);\n }\n }\n popup.options.className = props.className;\n }\n }\n return createPortal(props.children, container);\n}\nexport default memo(forwardRef(Popup));\n//# sourceMappingURL=popup.js.map"],"names":["getClassList","className","Popup","props","ref","map","mapLib","useContext","MapContext","container","useMemo","thisRef","useRef","popup","options","pp","e","_a","_b","useEffect","onClose","applyReactStyle","useImperativeHandle","deepEqual","prevClassList","nextClassList","c","createPortal","memo","forwardRef"],"mappings":";;;;;AAMA,SAASA,EAAaC,GAAW;AAC7B,SAAO,IAAI,IAAIA,IAAYA,EAAU,KAAM,EAAC,MAAM,KAAK,IAAI,CAAA,CAAE;AACjE;AAEA,SAASC,EAAMC,GAAOC,GAAK;AACvB,QAAM,EAAE,KAAAC,GAAK,QAAAC,EAAQ,IAAGC,EAAWC,CAAU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AM,QAAQ,CAAC,GAEjDA,EAAM,UAAU,CAACoB,EAAUV,EAAM,QAAQ,QAAQV,EAAM,MAAM,KAC7DU,EAAM,UAAUV,EAAM,MAAM,IAE5BU,EAAM,QAAQ,WAAWV,EAAM,UAAUU,EAAM,QAAQ,aAAaV,EAAM,cAC1EU,EAAM,QAAQ,SAASV,EAAM,QAC7BU,EAAM,YAAYV,EAAM,QAAQ,IAEhCU,EAAM,QAAQ,cAAcV,EAAM,YAAW;AAC7C,UAAMqB,IAAgBxB,EAAaa,EAAM,QAAQ,SAAS,GACpDY,IAAgBzB,EAAaG,EAAM,SAAS;AAClD,eAAWuB,KAAKF;AACZ,MAAKC,EAAc,IAAIC,CAAC,KACpBb,EAAM,gBAAgBa,CAAC;AAG/B,eAAWA,KAAKD;AACZ,MAAKD,EAAc,IAAIE,CAAC,KACpBb,EAAM,aAAaa,CAAC;AAG5B,IAAAb,EAAM,QAAQ,YAAYV,EAAM;AAAA;AAGxC,SAAOwB,EAAaxB,EAAM,UAAUM,CAAS;AACjD;AACemB,EAAKC,EAAW3B,CAAK,CAAC;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- import { memo as i, useEffect as r } from "react";
2
- import { applyReactStyle as e } from "./main.js23.mjs";
3
- import l from "./main.js25.mjs";
4
- function m(t) {
5
- const o = l(({ mapLib: n }) => new n.AttributionControl(t), {
6
- position: t.position
7
- });
8
- return r(() => {
9
- e(o._container, t.style);
10
- }, [t.style]), null;
11
- }
12
- i(m);
13
- //# sourceMappingURL=main.js11.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js11.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/attribution-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction AttributionControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.AttributionControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(AttributionControl);\n//# sourceMappingURL=attribution-control.js.map"],"names":["AttributionControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAmBC,GAAO;AAC/B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,mBAAmBH,CAAK,GAAG;AAAA,IAC1E,UAAUA,EAAM;AAAA,EACxB,CAAK;AACD,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,YAAYD,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAkB;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- import { memo as o, useEffect as l } from "react";
2
- import { applyReactStyle as r } from "./main.js23.mjs";
3
- import c from "./main.js25.mjs";
4
- function i(t) {
5
- const n = c(({ mapLib: e }) => new e.FullscreenControl({
6
- container: t.containerId && document.getElementById(t.containerId)
7
- }), { position: t.position });
8
- return l(() => {
9
- r(n._controlContainer, t.style);
10
- }, [t.style]), null;
11
- }
12
- o(i);
13
- //# sourceMappingURL=main.js12.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js12.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/fullscreen-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction FullscreenControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.FullscreenControl({\n container: props.containerId && document.getElementById(props.containerId)\n }), { position: props.position });\n useEffect(() => {\n applyReactStyle(ctrl._controlContainer, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(FullscreenControl);\n//# sourceMappingURL=fullscreen-control.js.map"],"names":["FullscreenControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAkBC,GAAO;AAC9B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAM,MAAO,IAAIA,EAAO,kBAAkB;AAAA,IACjE,WAAWH,EAAM,eAAe,SAAS,eAAeA,EAAM,WAAW;AAAA,EAC5E,CAAA,GAAG,EAAE,UAAUA,EAAM,SAAU,CAAA;AAChC,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,mBAAmBD,EAAM,KAAK;AAAA,EAC3D,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAiB;","x_google_ignoreList":[0]}
@@ -1,31 +0,0 @@
1
- import { memo as s, forwardRef as d, useRef as v, useImperativeHandle as _, useEffect as f } from "react";
2
- import { applyReactStyle as p } from "./main.js23.mjs";
3
- import m from "./main.js25.mjs";
4
- function b(e, c) {
5
- const a = v({ props: e }), l = m(({ mapLib: i }) => {
6
- const n = new i.GeolocateControl(e), u = n._setupUI;
7
- return n._setupUI = (t) => {
8
- n._container.hasChildNodes() || u(t);
9
- }, n.on("geolocate", (t) => {
10
- var r, o;
11
- (o = (r = a.current.props).onGeolocate) === null || o === void 0 || o.call(r, t);
12
- }), n.on("error", (t) => {
13
- var r, o;
14
- (o = (r = a.current.props).onError) === null || o === void 0 || o.call(r, t);
15
- }), n.on("outofmaxbounds", (t) => {
16
- var r, o;
17
- (o = (r = a.current.props).onOutOfMaxBounds) === null || o === void 0 || o.call(r, t);
18
- }), n.on("trackuserlocationstart", (t) => {
19
- var r, o;
20
- (o = (r = a.current.props).onTrackUserLocationStart) === null || o === void 0 || o.call(r, t);
21
- }), n.on("trackuserlocationend", (t) => {
22
- var r, o;
23
- (o = (r = a.current.props).onTrackUserLocationEnd) === null || o === void 0 || o.call(r, t);
24
- }), n;
25
- }, { position: e.position });
26
- return a.current.props = e, _(c, () => l, []), f(() => {
27
- p(l._container, e.style);
28
- }, [e.style]), null;
29
- }
30
- s(d(b));
31
- //# sourceMappingURL=main.js13.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js13.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/geolocate-control.js"],"sourcesContent":["import { useImperativeHandle, useRef, useEffect, forwardRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction GeolocateControl(props, ref) {\n const thisRef = useRef({ props });\n const ctrl = useControl(({ mapLib }) => {\n const gc = new mapLib.GeolocateControl(props);\n // Hack: fix GeolocateControl reuse\n // When using React strict mode, the component is mounted twice.\n // GeolocateControl's UI creation is asynchronous. Removing and adding it back causes the UI to be initialized twice.\n // @ts-expect-error private method\n const setupUI = gc._setupUI;\n // @ts-expect-error private method\n gc._setupUI = args => {\n if (!gc._container.hasChildNodes()) {\n setupUI(args);\n }\n };\n gc.on('geolocate', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onGeolocate) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('error', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('outofmaxbounds', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onOutOfMaxBounds) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('trackuserlocationstart', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onTrackUserLocationStart) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('trackuserlocationend', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onTrackUserLocationEnd) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n return gc;\n }, { position: props.position });\n thisRef.current.props = props;\n useImperativeHandle(ref, () => ctrl, []);\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(forwardRef(GeolocateControl));\n//# sourceMappingURL=geolocate-control.js.map"],"names":["GeolocateControl","props","ref","thisRef","useRef","ctrl","useControl","mapLib","gc","setupUI","args","e","_a","_b","useImperativeHandle","useEffect","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,GACMH;AAAA,EACV,GAAE,EAAE,UAAUP,EAAM,SAAU,CAAA;AAC/B,SAAAE,EAAQ,QAAQ,QAAQF,GACxBa,EAAoBZ,GAAK,MAAMG,GAAM,CAAE,CAAA,GACvCU,EAAU,MAAM;AACZ,IAAAC,EAAgBX,EAAK,YAAYJ,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACegB,EAAKC,EAAWlB,CAAgB,CAAC;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- import { memo as i, useEffect as e } from "react";
2
- import { applyReactStyle as l } from "./main.js23.mjs";
3
- import r from "./main.js25.mjs";
4
- function m(t) {
5
- const o = r(({ mapLib: n }) => new n.NavigationControl(t), {
6
- position: t.position
7
- });
8
- return e(() => {
9
- l(o._container, t.style);
10
- }, [t.style]), null;
11
- }
12
- i(m);
13
- //# sourceMappingURL=main.js14.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js14.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/navigation-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction NavigationControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.NavigationControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(NavigationControl);\n//# sourceMappingURL=navigation-control.js.map"],"names":["NavigationControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAkBC,GAAO;AAC9B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,kBAAkBH,CAAK,GAAG;AAAA,IACzE,UAAUA,EAAM;AAAA,EACxB,CAAK;AACD,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,YAAYD,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAiB;","x_google_ignoreList":[0]}
@@ -1,15 +0,0 @@
1
- import { memo as c, useRef as m, useEffect as f } from "react";
2
- import { applyReactStyle as l } from "./main.js23.mjs";
3
- import a from "./main.js25.mjs";
4
- function r(t) {
5
- const n = a(({ mapLib: u }) => new u.ScaleControl(t), {
6
- position: t.position
7
- }), i = m(t), e = i.current;
8
- i.current = t;
9
- const { style: o } = t;
10
- return t.maxWidth !== void 0 && t.maxWidth !== e.maxWidth && (n.options.maxWidth = t.maxWidth), t.unit !== void 0 && t.unit !== e.unit && n.setUnit(t.unit), f(() => {
11
- l(n._container, o);
12
- }, [o]), null;
13
- }
14
- c(r);
15
- //# sourceMappingURL=main.js15.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js15.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/scale-control.js"],"sourcesContent":["import { useEffect, useRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction ScaleControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {\n position: props.position\n });\n const propsRef = useRef(props);\n const prevProps = propsRef.current;\n propsRef.current = props;\n const { style } = props;\n if (props.maxWidth !== undefined && props.maxWidth !== prevProps.maxWidth) {\n ctrl.options.maxWidth = props.maxWidth;\n }\n if (props.unit !== undefined && props.unit !== prevProps.unit) {\n ctrl.setUnit(props.unit);\n }\n useEffect(() => {\n applyReactStyle(ctrl._container, style);\n }, [style]);\n return null;\n}\nexport default memo(ScaleControl);\n//# sourceMappingURL=scale-control.js.map"],"names":["ScaleControl","props","ctrl","useControl","mapLib","propsRef","useRef","prevProps","style","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAaC,GAAO;AACzB,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,aAAaH,CAAK,GAAG;AAAA,IACpE,UAAUA,EAAM;AAAA,EACxB,CAAK,GACKI,IAAWC,EAAOL,CAAK,GACvBM,IAAYF,EAAS;AAC3B,EAAAA,EAAS,UAAUJ;AACnB,QAAM,EAAE,OAAAO,EAAO,IAAGP;AAClB,SAAIA,EAAM,aAAa,UAAaA,EAAM,aAAaM,EAAU,aAC7DL,EAAK,QAAQ,WAAWD,EAAM,WAE9BA,EAAM,SAAS,UAAaA,EAAM,SAASM,EAAU,QACrDL,EAAK,QAAQD,EAAM,IAAI,GAE3BQ,EAAU,MAAM;AACZ,IAAAC,EAAgBR,EAAK,YAAYM,CAAK;AAAA,EAC9C,GAAO,CAACA,CAAK,CAAC,GACH;AACX;AACeG,EAAKX,CAAY;","x_google_ignoreList":[0]}
@@ -1,14 +0,0 @@
1
- import * as e from "react";
2
- import { useContext as n, useMemo as a } from "react";
3
- import { MapContext as u } from "./main.js8.mjs";
4
- const p = e.createContext(null);
5
- function c() {
6
- var o;
7
- const r = (o = n(p)) === null || o === void 0 ? void 0 : o.maps, t = n(u);
8
- return a(() => ({ ...r, current: t == null ? void 0 : t.map }), [r, t]);
9
- }
10
- export {
11
- p as MountedMapsContext,
12
- c as useMap
13
- };
14
- //# sourceMappingURL=main.js16.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js16.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/use-map.js"],"sourcesContent":["import * as React from 'react';\nimport { useState, useCallback, useMemo, useContext } from 'react';\nimport { MapContext } from './map';\nexport const MountedMapsContext = React.createContext(null);\nexport const MapProvider = props => {\n const [maps, setMaps] = useState({});\n const onMapMount = useCallback((map, id = 'default') => {\n setMaps(currMaps => {\n if (id === 'current') {\n throw new Error(\"'current' cannot be used as map id\");\n }\n if (currMaps[id]) {\n throw new Error(`Multiple maps with the same id: ${id}`);\n }\n return { ...currMaps, [id]: map };\n });\n }, []);\n const onMapUnmount = useCallback((id = 'default') => {\n setMaps(currMaps => {\n if (currMaps[id]) {\n const nextMaps = { ...currMaps };\n delete nextMaps[id];\n return nextMaps;\n }\n return currMaps;\n });\n }, []);\n return (React.createElement(MountedMapsContext.Provider, { value: {\n maps,\n onMapMount,\n onMapUnmount\n } }, props.children));\n};\nexport function useMap() {\n var _a;\n const maps = (_a = useContext(MountedMapsContext)) === null || _a === void 0 ? void 0 : _a.maps;\n const currentMap = useContext(MapContext);\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap === null || currentMap === void 0 ? void 0 : currentMap.map };\n }, [maps, currentMap]);\n return mapsWithCurrent;\n}\n//# sourceMappingURL=use-map.js.map"],"names":["MountedMapsContext","React","useMap","_a","maps","useContext","currentMap","MapContext","useMemo"],"mappings":";;;AAGY,MAACA,IAAqBC,EAAM,cAAc,IAAI;AA8BnD,SAASC,IAAS;AACrB,MAAIC;AACJ,QAAMC,KAAQD,IAAKE,EAAWL,CAAkB,OAAO,QAAQG,MAAO,SAAS,SAASA,EAAG,MACrFG,IAAaD,EAAWE,CAAU;AAIxC,SAHwBC,EAAQ,OACrB,EAAE,GAAGJ,GAAM,SAASE,KAAe,OAAgC,SAASA,EAAW,IAAG,IAClG,CAACF,GAAME,CAAU,CAAC;AAEzB;","x_google_ignoreList":[0]}
@@ -1,56 +0,0 @@
1
- import { createEvents as p } from "@react-three/fiber";
2
- const c = {
3
- onClick: ["click", !1],
4
- onContextMenu: ["contextmenu", !1],
5
- onDoubleClick: ["dblclick", !1],
6
- onWheel: ["wheel", !0],
7
- onPointerDown: ["pointerdown", !0],
8
- onPointerUp: ["pointerup", !0],
9
- onPointerLeave: ["pointerleave", !0],
10
- onPointerMove: ["pointermove", !0],
11
- onPointerCancel: ["pointercancel", !0],
12
- onLostPointerCapture: ["lostpointercapture", !0]
13
- };
14
- function u() {
15
- return (o) => {
16
- const { handlePointer: a } = p(o);
17
- return {
18
- priority: 1,
19
- enabled: !0,
20
- compute(n, e) {
21
- e.size.width = e.gl.domElement.width, e.size.height = e.gl.domElement.height, e.pointer.x = n.offsetX / (e.size.width / window.devicePixelRatio) * 2 - 1, e.pointer.y = 1 - n.offsetY / (e.size.height / window.devicePixelRatio) * 2, e.raycaster.camera = e.camera, e.raycaster.ray.origin.setScalar(0).applyMatrix4(e.camera.projectionMatrixInverse), e.raycaster.ray.direction.set(e.pointer.x, e.pointer.y, 1).applyMatrix4(e.camera.projectionMatrixInverse).sub(e.raycaster.ray.origin).normalize();
22
- },
23
- connected: void 0,
24
- handlers: Object.keys(c).reduce(
25
- (n, e) => ({ ...n, [e]: a(e) }),
26
- {}
27
- ),
28
- update: () => {
29
- var t;
30
- const { events: n, internal: e } = o.getState();
31
- (t = e.lastEvent) != null && t.current && n.handlers && n.handlers.onPointerMove(e.lastEvent.current);
32
- },
33
- connect: (n) => {
34
- var i;
35
- const { set: e, events: t } = o.getState();
36
- (i = t.disconnect) == null || i.call(t), e((r) => ({ events: { ...r.events, connected: n } })), Object.entries(t.handlers ?? []).forEach(([r, l]) => {
37
- const [s, d] = c[r];
38
- n.addEventListener(s, l, { passive: d });
39
- });
40
- },
41
- disconnect: () => {
42
- const { set: n, events: e } = o.getState();
43
- e.connected && (Object.entries(e.handlers ?? []).forEach(([t, i]) => {
44
- if (e && e.connected instanceof HTMLElement) {
45
- const [r] = c[t];
46
- e.connected.removeEventListener(r, i);
47
- }
48
- }), n((t) => ({ events: { ...t.events, connected: void 0 } })));
49
- }
50
- };
51
- };
52
- }
53
- export {
54
- u as createEvents
55
- };
56
- //# sourceMappingURL=main.js17.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js17.mjs","sources":["../../src/canvas/create-events.ts"],"sourcesContent":["import { Events, RenderProps, RootState, createEvents as createFiberEvents } from \"@react-three/fiber\";\nimport { UseBoundStore } from \"zustand\";\n\ntype DomEvent = PointerEvent | MouseEvent | WheelEvent;\n\nconst DOM_EVENTS = {\n onClick: [\"click\", false],\n onContextMenu: [\"contextmenu\", false],\n onDoubleClick: [\"dblclick\", false],\n onWheel: [\"wheel\", true],\n onPointerDown: [\"pointerdown\", true],\n onPointerUp: [\"pointerup\", true],\n onPointerLeave: [\"pointerleave\", true],\n onPointerMove: [\"pointermove\", true],\n onPointerCancel: [\"pointercancel\", true],\n onLostPointerCapture: [\"lostpointercapture\", true],\n} as const;\n\n/** ThreeLayer event manager for MapLibre and Mapbox */\nexport function createEvents() : RenderProps<HTMLCanvasElement>[\"events\"] {\n return (store: UseBoundStore<RootState>) => {\n const { handlePointer } = createFiberEvents(store);\n return {\n priority: 1,\n enabled: true,\n compute(event: DomEvent, state: RootState) {\n state.size.width = state.gl.domElement.width;\n state.size.height = state.gl.domElement.height;\n state.pointer.x = (event.offsetX / (state.size.width / window.devicePixelRatio)) * 2 - 1;\n state.pointer.y = 1 - (event.offsetY / (state.size.height / window.devicePixelRatio)) * 2;\n state.raycaster.camera = state.camera;\n state.raycaster.ray.origin.setScalar(0).applyMatrix4(state.camera.projectionMatrixInverse);\n state.raycaster.ray.direction\n .set(state.pointer.x, state.pointer.y, 1)\n .applyMatrix4(state.camera.projectionMatrixInverse)\n .sub(state.raycaster.ray.origin)\n .normalize();\n },\n connected: undefined,\n handlers: Object.keys(DOM_EVENTS).reduce(\n (acc, key) => ({ ...acc, [key]: handlePointer(key) }),\n {}\n ) as unknown as Events,\n update: () => {\n const { events, internal } = store.getState();\n if (internal.lastEvent?.current && events.handlers) {\n events.handlers.onPointerMove(internal.lastEvent.current);\n }\n },\n connect: (target: HTMLElement) => {\n const { set, events } = store.getState();\n events.disconnect?.();\n set((state) => ({ events: { ...state.events, connected: target } }));\n Object.entries(events.handlers ?? []).forEach(([name, event]) => {\n const [eventName, passive] = DOM_EVENTS[name as keyof typeof DOM_EVENTS];\n target.addEventListener(eventName, event, { passive });\n });\n },\n disconnect: () => {\n const { set, events } = store.getState();\n if (events.connected) {\n Object.entries(events.handlers ?? []).forEach(([name, event]) => {\n if (events && events.connected instanceof HTMLElement) {\n const [eventName] = DOM_EVENTS[name as keyof typeof DOM_EVENTS];\n events.connected.removeEventListener(eventName, event);\n }\n });\n set((state) => ({ events: { ...state.events, connected: undefined } }));\n }\n },\n };\n };\n}\n"],"names":["DOM_EVENTS","createEvents","store","handlePointer","createFiberEvents","event","state","acc","key","events","internal","_a","target","set","name","eventName","passive"],"mappings":";AAKA,MAAMA,IAAa;AAAA,EACjB,SAAS,CAAC,SAAS,EAAK;AAAA,EACxB,eAAe,CAAC,eAAe,EAAK;AAAA,EACpC,eAAe,CAAC,YAAY,EAAK;AAAA,EACjC,SAAS,CAAC,SAAS,EAAI;AAAA,EACvB,eAAe,CAAC,eAAe,EAAI;AAAA,EACnC,aAAa,CAAC,aAAa,EAAI;AAAA,EAC/B,gBAAgB,CAAC,gBAAgB,EAAI;AAAA,EACrC,eAAe,CAAC,eAAe,EAAI;AAAA,EACnC,iBAAiB,CAAC,iBAAiB,EAAI;AAAA,EACvC,sBAAsB,CAAC,sBAAsB,EAAI;AACnD;AAGO,SAASC,IAA0D;AACxE,SAAO,CAACC,MAAoC;AAC1C,UAAM,EAAE,eAAAC,EAAA,IAAkBC,EAAkBF,CAAK;AAC1C,WAAA;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQG,GAAiBC,GAAkB;AACzC,QAAAA,EAAM,KAAK,QAAQA,EAAM,GAAG,WAAW,OACvCA,EAAM,KAAK,SAASA,EAAM,GAAG,WAAW,QAClCA,EAAA,QAAQ,IAAKD,EAAM,WAAWC,EAAM,KAAK,QAAQ,OAAO,oBAAqB,IAAI,GACjFA,EAAA,QAAQ,IAAI,IAAKD,EAAM,WAAWC,EAAM,KAAK,SAAS,OAAO,oBAAqB,GAClFA,EAAA,UAAU,SAASA,EAAM,QACzBA,EAAA,UAAU,IAAI,OAAO,UAAU,CAAC,EAAE,aAAaA,EAAM,OAAO,uBAAuB,GACnFA,EAAA,UAAU,IAAI,UACjB,IAAIA,EAAM,QAAQ,GAAGA,EAAM,QAAQ,GAAG,CAAC,EACvC,aAAaA,EAAM,OAAO,uBAAuB,EACjD,IAAIA,EAAM,UAAU,IAAI,MAAM,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ACGQ,EAAA,CAACP,OAAW,EAAE,QAAQ,EAAE,GAAGA,EAAM,QAAQ,WAAW,OAAU,EAAA,EAAI;AAAA,MAE1E;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,9 +0,0 @@
1
- import { useRef as n, useCallback as u } from "react";
2
- const o = (r) => {
3
- const e = n(r);
4
- return e.current = r, u((...t) => e.current(...t), []);
5
- };
6
- export {
7
- o as useFunction
8
- };
9
- //# sourceMappingURL=main.js18.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js18.mjs","sources":["../../src/canvas/use-function.ts"],"sourcesContent":["import { useCallback, useRef } from 'react';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const useFunction = <T extends (...args: any[]) => any>(callback: T): T => {\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n return useCallback((...args: any[]) => {\n return callbackRef.current(...args);\n }, []) as T;\n};\n"],"names":["useFunction","callback","callbackRef","useRef","useCallback","args"],"mappings":";AAGa,MAAAA,IAAc,CAAoCC,MAAmB;AAC1E,QAAAC,IAAcC,EAAOF,CAAQ;AACnC,SAAAC,EAAY,UAAUD,GACfG,EAAY,IAAIC,MACdH,EAAY,QAAQ,GAAGG,CAAI,GACjC,CAAE,CAAA;AACP;"}
@@ -1,320 +0,0 @@
1
- import { cloneTransform as S, applyViewStateToTransform as f, transformToViewState as p } from "./main.js27.mjs";
2
- import { normalizeStyle as _ } from "./main.js28.mjs";
3
- import { deepEqual as h } from "./main.js24.mjs";
4
- const v = { version: 8, sources: {}, layers: [] }, g = {
5
- mousedown: "onMouseDown",
6
- mouseup: "onMouseUp",
7
- mouseover: "onMouseOver",
8
- mousemove: "onMouseMove",
9
- click: "onClick",
10
- dblclick: "onDblClick",
11
- mouseenter: "onMouseEnter",
12
- mouseleave: "onMouseLeave",
13
- mouseout: "onMouseOut",
14
- contextmenu: "onContextMenu",
15
- touchstart: "onTouchStart",
16
- touchend: "onTouchEnd",
17
- touchmove: "onTouchMove",
18
- touchcancel: "onTouchCancel"
19
- }, m = {
20
- movestart: "onMoveStart",
21
- move: "onMove",
22
- moveend: "onMoveEnd",
23
- dragstart: "onDragStart",
24
- drag: "onDrag",
25
- dragend: "onDragEnd",
26
- zoomstart: "onZoomStart",
27
- zoom: "onZoom",
28
- zoomend: "onZoomEnd",
29
- rotatestart: "onRotateStart",
30
- rotate: "onRotate",
31
- rotateend: "onRotateEnd",
32
- pitchstart: "onPitchStart",
33
- pitch: "onPitch",
34
- pitchend: "onPitchEnd"
35
- }, y = {
36
- wheel: "onWheel",
37
- boxzoomstart: "onBoxZoomStart",
38
- boxzoomend: "onBoxZoomEnd",
39
- boxzoomcancel: "onBoxZoomCancel",
40
- resize: "onResize",
41
- load: "onLoad",
42
- render: "onRender",
43
- idle: "onIdle",
44
- remove: "onRemove",
45
- data: "onData",
46
- styledata: "onStyleData",
47
- sourcedata: "onSourceData",
48
- error: "onError"
49
- }, E = [
50
- "minZoom",
51
- "maxZoom",
52
- "minPitch",
53
- "maxPitch",
54
- "maxBounds",
55
- "projection",
56
- "renderWorldCopies"
57
- ], T = [
58
- "scrollZoom",
59
- "boxZoom",
60
- "dragRotate",
61
- "dragPan",
62
- "keyboard",
63
- "doubleClickZoom",
64
- "touchZoomRotate",
65
- "touchPitch"
66
- ];
67
- class u {
68
- constructor(e, o, n) {
69
- this._map = null, this._internalUpdate = !1, this._inRender = !1, this._hoveredFeatures = null, this._deferredEvents = {
70
- move: !1,
71
- zoom: !1,
72
- pitch: !1,
73
- rotate: !1
74
- }, this._onEvent = (t) => {
75
- const r = this.props[y[t.type]];
76
- r ? r(t) : t.type === "error" && console.error(t.error);
77
- }, this._onPointerEvent = (t) => {
78
- (t.type === "mousemove" || t.type === "mouseout") && this._updateHover(t);
79
- const r = this.props[g[t.type]];
80
- r && (this.props.interactiveLayerIds && t.type !== "mouseover" && t.type !== "mouseout" && (t.features = this._hoveredFeatures || this._queryRenderedFeatures(t.point)), r(t), delete t.features);
81
- }, this._onCameraEvent = (t) => {
82
- if (!this._internalUpdate) {
83
- const r = this.props[m[t.type]];
84
- r && r(t);
85
- }
86
- t.type in this._deferredEvents && (this._deferredEvents[t.type] = !1);
87
- }, this._MapClass = e, this.props = o, this._initialize(n);
88
- }
89
- get map() {
90
- return this._map;
91
- }
92
- get transform() {
93
- return this._renderTransform;
94
- }
95
- setProps(e) {
96
- const o = this.props;
97
- this.props = e;
98
- const n = this._updateSettings(e, o);
99
- n && this._createShadowTransform(this._map);
100
- const t = this._updateSize(e), r = this._updateViewState(e, !0);
101
- this._updateStyle(e, o), this._updateStyleComponents(e, o), this._updateHandlers(e, o), (n || t || r && !this._map.isMoving()) && this.redraw();
102
- }
103
- static reuse(e, o) {
104
- const n = u.savedMaps.pop();
105
- if (!n)
106
- return null;
107
- const t = n.map, r = t.getContainer();
108
- for (o.className = r.className; r.childNodes.length > 0; )
109
- o.appendChild(r.childNodes[0]);
110
- t._container = o;
111
- const s = t._resizeObserver;
112
- s && (s.disconnect(), s.observe(o)), n.setProps({ ...e, styleDiffing: !1 }), t.resize();
113
- const { initialViewState: i } = e;
114
- return i && (i.bounds ? t.fitBounds(i.bounds, { ...i.fitBoundsOptions, duration: 0 }) : n._updateViewState(i, !1)), t.isStyleLoaded() ? t.fire("load") : t.once("styledata", () => t.fire("load")), t._update(), n;
115
- }
116
- /* eslint-disable complexity,max-statements */
117
- _initialize(e) {
118
- const { props: o } = this, { mapStyle: n = v } = o, t = {
119
- ...o,
120
- ...o.initialViewState,
121
- accessToken: o.mapboxAccessToken || C() || null,
122
- container: e,
123
- style: _(n)
124
- }, r = t.initialViewState || t.viewState || t;
125
- if (Object.assign(t, {
126
- center: [r.longitude || 0, r.latitude || 0],
127
- zoom: r.zoom || 0,
128
- pitch: r.pitch || 0,
129
- bearing: r.bearing || 0
130
- }), o.gl) {
131
- const a = HTMLCanvasElement.prototype.getContext;
132
- HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = a, o.gl);
133
- }
134
- const s = new this._MapClass(t);
135
- r.padding && s.setPadding(r.padding), o.cursor && (s.getCanvas().style.cursor = o.cursor), this._createShadowTransform(s);
136
- const i = s._render;
137
- s._render = (a) => {
138
- this._inRender = !0, i.call(s, a), this._inRender = !1;
139
- };
140
- const c = s._renderTaskQueue.run;
141
- s._renderTaskQueue.run = (a) => {
142
- c.call(s._renderTaskQueue, a), this._onBeforeRepaint();
143
- }, s.on("render", () => this._onAfterRepaint());
144
- const l = s.fire;
145
- s.fire = this._fireEvent.bind(this, l), s.on("resize", () => {
146
- this._renderTransform.resize(s.transform.width, s.transform.height);
147
- }), s.on("styledata", () => this._updateStyleComponents(this.props, {})), s.on("sourcedata", () => this._updateStyleComponents(this.props, {}));
148
- for (const a in g)
149
- s.on(a, this._onPointerEvent);
150
- for (const a in m)
151
- s.on(a, this._onCameraEvent);
152
- for (const a in y)
153
- s.on(a, this._onEvent);
154
- this._map = s;
155
- }
156
- /* eslint-enable complexity,max-statements */
157
- recycle() {
158
- const o = this.map.getContainer().querySelector("[mapboxgl-children]");
159
- o == null || o.remove(), u.savedMaps.push(this);
160
- }
161
- destroy() {
162
- this._map.remove();
163
- }
164
- // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next
165
- // render cycle, which is managed by Mapbox's animation loop.
166
- // This removes the synchronization issue caused by requestAnimationFrame.
167
- redraw() {
168
- const e = this._map;
169
- !this._inRender && e.style && (e._frame && (e._frame.cancel(), e._frame = null), e._render());
170
- }
171
- _createShadowTransform(e) {
172
- const o = S(e.transform);
173
- e.painter.transform = o, this._renderTransform = o;
174
- }
175
- /* Trigger map resize if size is controlled
176
- @param {object} nextProps
177
- @returns {bool} true if size has changed
178
- */
179
- _updateSize(e) {
180
- const { viewState: o } = e;
181
- if (o) {
182
- const n = this._map;
183
- if (o.width !== n.transform.width || o.height !== n.transform.height)
184
- return n.resize(), !0;
185
- }
186
- return !1;
187
- }
188
- // Adapted from map.jumpTo
189
- /* Update camera to match props
190
- @param {object} nextProps
191
- @param {bool} triggerEvents - should fire camera events
192
- @returns {bool} true if anything is changed
193
- */
194
- _updateViewState(e, o) {
195
- if (this._internalUpdate)
196
- return !1;
197
- const n = this._map, t = this._renderTransform, { zoom: r, pitch: s, bearing: i } = t, c = n.isMoving();
198
- c && (t.cameraElevationReference = "sea");
199
- const l = f(t, {
200
- ...p(n.transform),
201
- ...e
202
- });
203
- if (c && (t.cameraElevationReference = "ground"), l && o) {
204
- const a = this._deferredEvents;
205
- a.move = !0, a.zoom || (a.zoom = r !== t.zoom), a.rotate || (a.rotate = i !== t.bearing), a.pitch || (a.pitch = s !== t.pitch);
206
- }
207
- return c || f(n.transform, e), l;
208
- }
209
- /* Update camera constraints and projection settings to match props
210
- @param {object} nextProps
211
- @param {object} currProps
212
- @returns {bool} true if anything is changed
213
- */
214
- _updateSettings(e, o) {
215
- const n = this._map;
216
- let t = !1;
217
- for (const r of E)
218
- if (r in e && !h(e[r], o[r])) {
219
- t = !0;
220
- const s = n[`set${r[0].toUpperCase()}${r.slice(1)}`];
221
- s == null || s(e[r]);
222
- }
223
- return t;
224
- }
225
- /* Update map style to match props
226
- @param {object} nextProps
227
- @param {object} currProps
228
- @returns {bool} true if style is changed
229
- */
230
- _updateStyle(e, o) {
231
- if (e.cursor !== o.cursor && (this._map.getCanvas().style.cursor = e.cursor), e.mapStyle !== o.mapStyle) {
232
- const { mapStyle: n = v, styleDiffing: t = !0 } = e, r = {
233
- diff: t
234
- };
235
- return "localIdeographFontFamily" in e && (r.localIdeographFontFamily = e.localIdeographFontFamily), this._map.setStyle(_(n), r), !0;
236
- }
237
- return !1;
238
- }
239
- /* Update fog, light and terrain to match props
240
- @param {object} nextProps
241
- @param {object} currProps
242
- @returns {bool} true if anything is changed
243
- */
244
- _updateStyleComponents(e, o) {
245
- const n = this._map;
246
- let t = !1;
247
- return n.isStyleLoaded() && ("light" in e && n.setLight && !h(e.light, o.light) && (t = !0, n.setLight(e.light)), "fog" in e && n.setFog && !h(e.fog, o.fog) && (t = !0, n.setFog(e.fog)), "terrain" in e && n.setTerrain && !h(e.terrain, o.terrain) && (!e.terrain || n.getSource(e.terrain.source)) && (t = !0, n.setTerrain(e.terrain))), t;
248
- }
249
- /* Update interaction handlers to match props
250
- @param {object} nextProps
251
- @param {object} currProps
252
- @returns {bool} true if anything is changed
253
- */
254
- _updateHandlers(e, o) {
255
- var n, t;
256
- const r = this._map;
257
- let s = !1;
258
- for (const i of T) {
259
- const c = (n = e[i]) !== null && n !== void 0 ? n : !0, l = (t = o[i]) !== null && t !== void 0 ? t : !0;
260
- h(c, l) || (s = !0, c ? r[i].enable(c) : r[i].disable());
261
- }
262
- return s;
263
- }
264
- _queryRenderedFeatures(e) {
265
- const o = this._map, { interactiveLayerIds: n = [] } = this.props;
266
- try {
267
- return o.queryRenderedFeatures(e, {
268
- layers: n.filter(o.getLayer.bind(o))
269
- });
270
- } catch {
271
- return [];
272
- }
273
- }
274
- _updateHover(e) {
275
- var o;
276
- const { props: n } = this;
277
- if (n.interactiveLayerIds && (n.onMouseMove || n.onMouseEnter || n.onMouseLeave)) {
278
- const r = e.type, s = ((o = this._hoveredFeatures) === null || o === void 0 ? void 0 : o.length) > 0, i = this._queryRenderedFeatures(e.point), c = i.length > 0;
279
- !c && s && (e.type = "mouseleave", this._onPointerEvent(e)), this._hoveredFeatures = i, c && !s && (e.type = "mouseenter", this._onPointerEvent(e)), e.type = r;
280
- } else
281
- this._hoveredFeatures = null;
282
- }
283
- _fireEvent(e, o, n) {
284
- const t = this._map, r = t.transform, s = typeof o == "string" ? o : o.type;
285
- return s === "move" && this._updateViewState(this.props, !1), s in m && (typeof o == "object" && (o.viewState = p(r)), this._map.isMoving()) ? (t.transform = this._renderTransform, e.call(t, o, n), t.transform = r, t) : (e.call(t, o, n), t);
286
- }
287
- // All camera manipulations are complete, ready to repaint
288
- _onBeforeRepaint() {
289
- const e = this._map;
290
- this._internalUpdate = !0;
291
- for (const n in this._deferredEvents)
292
- this._deferredEvents[n] && e.fire(n);
293
- this._internalUpdate = !1;
294
- const o = this._map.transform;
295
- this._map.transform = this._renderTransform, this._onAfterRepaint = () => {
296
- this._map.transform = o;
297
- };
298
- }
299
- }
300
- u.savedMaps = [];
301
- function C() {
302
- let d = null;
303
- if (typeof location < "u") {
304
- const e = /access_token=([^&\/]*)/.exec(location.search);
305
- d = e && e[1];
306
- }
307
- try {
308
- d = d || process.env.MapboxAccessToken;
309
- } catch {
310
- }
311
- try {
312
- d = d || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;
313
- } catch {
314
- }
315
- return d;
316
- }
317
- export {
318
- u as default
319
- };
320
- //# sourceMappingURL=main.js19.mjs.map