@dartcom/ui-kit 10.2.28 → 10.2.32

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 (43) hide show
  1. package/README.md +8 -1
  2. package/dist/components/layers/leaflet/index.d.ts +1 -0
  3. package/dist/components/layers/leaflet/index.d.ts.map +1 -1
  4. package/dist/components/layers/leaflet/leaflet.d.ts.map +1 -1
  5. package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts +6 -0
  6. package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts.map +1 -1
  7. package/dist/components/layers/leaflet/services/index.d.ts +2 -0
  8. package/dist/components/layers/leaflet/services/index.d.ts.map +1 -0
  9. package/dist/components/layers/leaflet/services/tangram-layer.d.ts +60 -0
  10. package/dist/components/layers/leaflet/services/tangram-layer.d.ts.map +1 -0
  11. package/dist/components/layers/map-container/index.d.ts +3 -0
  12. package/dist/components/layers/map-container/index.d.ts.map +1 -0
  13. package/dist/components/layers/map-container/lib/hooks/index.d.ts +3 -0
  14. package/dist/components/layers/map-container/lib/hooks/index.d.ts.map +1 -0
  15. package/dist/components/layers/map-container/lib/hooks/useMap.d.ts +2 -0
  16. package/dist/components/layers/map-container/lib/hooks/useMap.d.ts.map +1 -0
  17. package/dist/components/layers/map-container/lib/hooks/useMapEvents.d.ts +3 -0
  18. package/dist/components/layers/map-container/lib/hooks/useMapEvents.d.ts.map +1 -0
  19. package/dist/components/layers/map-container/lib/index.d.ts +3 -0
  20. package/dist/components/layers/map-container/lib/index.d.ts.map +1 -0
  21. package/dist/components/layers/map-container/lib/types.d.ts +5 -0
  22. package/dist/components/layers/map-container/lib/types.d.ts.map +1 -0
  23. package/dist/components/layers/map-container/map-container.d.ts +9 -0
  24. package/dist/components/layers/map-container/map-container.d.ts.map +1 -0
  25. package/dist/components/layers/map-container/types.d.ts +3 -0
  26. package/dist/components/layers/map-container/types.d.ts.map +1 -0
  27. package/dist/index.cjs +1518 -21
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.css +1 -0
  30. package/dist/index.esm.css +1 -0
  31. package/dist/index.esm.js +11 -5
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/library/leaflet-arrows.d.ts +3 -0
  34. package/dist/library/leaflet-arrows.d.ts.map +1 -0
  35. package/dist/library/leaflet-textpath.d.ts +1 -0
  36. package/dist/library/leaflet-textpath.d.ts.map +1 -0
  37. package/dist/providers/map/index.d.ts +2 -0
  38. package/dist/providers/map/index.d.ts.map +1 -0
  39. package/dist/providers/map/map.d.ts +4 -0
  40. package/dist/providers/map/map.d.ts.map +1 -0
  41. package/dist/providers/providers.d.ts.map +1 -1
  42. package/dist/services/storybook/decorators.d.ts.map +1 -1
  43. package/package.json +5 -1
package/dist/index.cjs CHANGED
@@ -41,6 +41,21 @@ function _interopNamespaceDefault(e) {
41
41
  return Object.freeze(n);
42
42
  }
43
43
 
44
+ function _mergeNamespaces(n, m) {
45
+ m.forEach(function (e) {
46
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
47
+ if (k !== 'default' && !(k in n)) {
48
+ var d = Object.getOwnPropertyDescriptor(e, k);
49
+ Object.defineProperty(n, k, d.get ? d : {
50
+ enumerable: true,
51
+ get: function () { return e[k]; }
52
+ });
53
+ }
54
+ });
55
+ });
56
+ return Object.freeze(n);
57
+ }
58
+
44
59
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
45
60
 
46
61
  exports.Operations = void 0;
@@ -14633,10 +14648,11 @@ function requireLeafletSrc () {
14633
14648
  }
14634
14649
 
14635
14650
  var leafletSrcExports = requireLeafletSrc();
14651
+ var s$3 = /*@__PURE__*/getDefaultExportFromCjs(leafletSrcExports);
14636
14652
 
14637
- function r$1(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$1(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$1(e))&&(n&&(n+=" "),n+=t);return n}
14653
+ function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
14638
14654
 
14639
- let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
14655
+ let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l$1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l$1.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
14640
14656
 
14641
14657
  function _defineProperties$1(target, props) {
14642
14658
  for (var i = 0; i < props.length; i++) {
@@ -26618,6 +26634,30 @@ const DartcomInitializeProvider = ({ children, configOptions }) => {
26618
26634
  return jsxRuntime.jsx(React__namespace.Fragment, { children: children });
26619
26635
  };
26620
26636
 
26637
+ const MapProvider = ({ children }) => {
26638
+ const [isReady, setIsReady] = React__namespace.useState(false);
26639
+ const init = async () => {
26640
+ try {
26641
+ await Promise.resolve().then(function () { return tangram_min; });
26642
+ await Promise.resolve().then(function () { return leaflet_rotatedMarker; });
26643
+ await Promise.resolve().then(function () { return leaflet_polylineoffset$1; });
26644
+ await Promise.resolve().then(function () { return index$1; });
26645
+ await Promise.resolve().then(function () { return index; });
26646
+ await Promise.resolve().then(function () { return leafletArrows$1; });
26647
+ setIsReady(true);
26648
+ }
26649
+ catch {
26650
+ setIsReady(false);
26651
+ }
26652
+ };
26653
+ React__namespace.useEffect(() => {
26654
+ init();
26655
+ }, []);
26656
+ if (!isReady)
26657
+ return null;
26658
+ return jsxRuntime.jsx(React__namespace.Fragment, { children: children });
26659
+ };
26660
+
26621
26661
  const queryClient = new QueryClient();
26622
26662
  const QueryProvider = (props) => (jsxRuntime.jsx(QueryClientProvider, { ...props, client: queryClient }));
26623
26663
 
@@ -26627,7 +26667,7 @@ const DartcomThemeProvider = ({ children, themeOptions }) => {
26627
26667
  };
26628
26668
 
26629
26669
  const DartcomProviders = ({ children, configOptions, themeOptions }) => {
26630
- return (jsxRuntime.jsx(SnackbarProvider, { children: jsxRuntime.jsx(QueryProvider, { children: jsxRuntime.jsx(DartcomMobxProvider, { children: jsxRuntime.jsx(DartcomThemeProvider, { themeOptions: themeOptions, children: jsxRuntime.jsx(Provider, { children: jsxRuntime.jsx(DartcomInitializeProvider, { configOptions: configOptions, children: children }) }) }) }) }) }));
26670
+ return (jsxRuntime.jsx(SnackbarProvider, { children: jsxRuntime.jsx(QueryProvider, { children: jsxRuntime.jsx(DartcomMobxProvider, { children: jsxRuntime.jsx(DartcomThemeProvider, { themeOptions: themeOptions, children: jsxRuntime.jsx(Provider, { children: jsxRuntime.jsx(MapProvider, { children: jsxRuntime.jsx(DartcomInitializeProvider, { configOptions: configOptions, children: children }) }) }) }) }) }) }));
26631
26671
  };
26632
26672
 
26633
26673
  const useShowSnackbar = () => {
@@ -39279,7 +39319,7 @@ const tile_size = 256;
39279
39319
  const sourceUrl = {
39280
39320
  [exports.TangramSourceNames.TILE]: `${"https://dalganmap.ru/api"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39281
39321
  [exports.TangramSourceNames.NATURE_TILE]: `${"https://dalganmap.ru/api"}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,
39282
- [exports.TangramSourceNames.MSK]: `${"http://89.108.118.23:3070"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39322
+ [exports.TangramSourceNames.MSK]: `${"$VITE_API_HOST:$VITE_API_PORT"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39283
39323
  };
39284
39324
 
39285
39325
  var data = { global:{ links:{ getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",
@@ -43500,13 +43540,6 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43500
43540
  });
43501
43541
  leafletLayer.on('load', ({ sourceTarget }) => {
43502
43542
  const mapInstance = sourceTarget._map;
43503
- loggerService.log({
43504
- message: 'leafletLayer onLoad',
43505
- context: 'useGetLeafletLayer',
43506
- meta: {
43507
- sourceTarget,
43508
- },
43509
- });
43510
43543
  leafletLayer.setSelectionEvents({
43511
43544
  click: ({ feature, leaflet_event }) => {
43512
43545
  if (feature) {
@@ -43746,6 +43779,12 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43746
43779
  };
43747
43780
  };
43748
43781
 
43782
+ function extendContext(source, extra) {
43783
+ return Object.freeze({
43784
+ ...source,
43785
+ ...extra
43786
+ });
43787
+ }
43749
43788
  const LeafletContext = React.createContext(null);
43750
43789
  function useLeafletContext() {
43751
43790
  const context = React.use(LeafletContext);
@@ -43755,21 +43794,452 @@ function useLeafletContext() {
43755
43794
  return context;
43756
43795
  }
43757
43796
 
43797
+ function createContainerComponent(useElement) {
43798
+ function ContainerComponent(props, forwardedRef) {
43799
+ const { instance, context } = useElement(props).current;
43800
+ React.useImperativeHandle(forwardedRef, ()=>instance);
43801
+ const { children } = props;
43802
+ return children == null ? null : /*#__PURE__*/ React.createElement(LeafletContext, {
43803
+ value: context
43804
+ }, children);
43805
+ }
43806
+ return /*#__PURE__*/ React.forwardRef(ContainerComponent);
43807
+ }
43808
+
43809
+ function createControlHook(useElement) {
43810
+ return function useLeafletControl(props) {
43811
+ const context = useLeafletContext();
43812
+ const elementRef = useElement(props, context);
43813
+ const { instance } = elementRef.current;
43814
+ const positionRef = React.useRef(props.position);
43815
+ const { position } = props;
43816
+ React.useEffect(function addControl() {
43817
+ instance.addTo(context.map);
43818
+ return function removeControl() {
43819
+ instance.remove();
43820
+ };
43821
+ }, [
43822
+ context.map,
43823
+ instance
43824
+ ]);
43825
+ React.useEffect(function updateControl() {
43826
+ if (position != null && position !== positionRef.current) {
43827
+ instance.setPosition(position);
43828
+ positionRef.current = position;
43829
+ }
43830
+ }, [
43831
+ instance,
43832
+ position
43833
+ ]);
43834
+ return elementRef;
43835
+ };
43836
+ }
43837
+
43838
+ function createElementObject(instance, context, container) {
43839
+ return Object.freeze({
43840
+ instance,
43841
+ context,
43842
+ container
43843
+ });
43844
+ }
43845
+ function createElementHook(createElement, updateElement) {
43846
+ if (updateElement == null) {
43847
+ return function useImmutableLeafletElement(props, context) {
43848
+ const elementRef = React.useRef(undefined);
43849
+ if (!elementRef.current) elementRef.current = createElement(props, context);
43850
+ return elementRef;
43851
+ };
43852
+ }
43853
+ return function useMutableLeafletElement(props, context) {
43854
+ const elementRef = React.useRef(undefined);
43855
+ if (!elementRef.current) elementRef.current = createElement(props, context);
43856
+ const propsRef = React.useRef(props);
43857
+ const { instance } = elementRef.current;
43858
+ React.useEffect(function updateElementProps() {
43859
+ if (propsRef.current !== props) {
43860
+ updateElement(instance, props, propsRef.current);
43861
+ propsRef.current = props;
43862
+ }
43863
+ }, [
43864
+ instance,
43865
+ props,
43866
+ updateElement
43867
+ ]);
43868
+ return elementRef;
43869
+ };
43870
+ }
43871
+
43758
43872
  function useMap() {
43759
43873
  return useLeafletContext().map;
43760
43874
  }
43761
43875
 
43876
+ const useLayersControlElement = createElementHook(function createLayersControl({ children: _c, ...options }, ctx) {
43877
+ const control = new leafletSrcExports.Control.Layers(undefined, undefined, options);
43878
+ return createElementObject(control, extendContext(ctx, {
43879
+ layersControl: control
43880
+ }));
43881
+ }, function updateLayersControl(control, props, prevProps) {
43882
+ if (props.collapsed !== prevProps.collapsed) {
43883
+ if (props.collapsed === true) {
43884
+ control.collapse();
43885
+ } else {
43886
+ control.expand();
43887
+ }
43888
+ }
43889
+ });
43890
+ const useLayersControl = createControlHook(useLayersControlElement);
43891
+ // @ts-ignore
43892
+ const LayersControl = createContainerComponent(useLayersControl);
43893
+ function createControlledLayer(addLayerToControl) {
43894
+ return function ControlledLayer(props) {
43895
+ const parentContext = useLeafletContext();
43896
+ const propsRef = React.useRef(props);
43897
+ const [layer, setLayer] = React.useState(null);
43898
+ const { layersControl, map } = parentContext;
43899
+ const addLayer = React.useCallback((layerToAdd)=>{
43900
+ if (layersControl != null) {
43901
+ if (propsRef.current.checked) {
43902
+ map.addLayer(layerToAdd);
43903
+ }
43904
+ addLayerToControl(layersControl, layerToAdd, propsRef.current.name);
43905
+ setLayer(layerToAdd);
43906
+ }
43907
+ }, [
43908
+ addLayerToControl,
43909
+ layersControl,
43910
+ map
43911
+ ]);
43912
+ const removeLayer = React.useCallback((layerToRemove)=>{
43913
+ layersControl?.removeLayer(layerToRemove);
43914
+ setLayer(null);
43915
+ }, [
43916
+ layersControl
43917
+ ]);
43918
+ const context = React.useMemo(()=>{
43919
+ return extendContext(parentContext, {
43920
+ layerContainer: {
43921
+ addLayer,
43922
+ removeLayer
43923
+ }
43924
+ });
43925
+ }, [
43926
+ parentContext,
43927
+ addLayer,
43928
+ removeLayer
43929
+ ]);
43930
+ React.useEffect(()=>{
43931
+ if (layer !== null && propsRef.current !== props) {
43932
+ if (props.checked === true && (propsRef.current.checked == null || propsRef.current.checked === false)) {
43933
+ map.addLayer(layer);
43934
+ } else if (propsRef.current.checked === true && (props.checked == null || props.checked === false)) {
43935
+ map.removeLayer(layer);
43936
+ }
43937
+ propsRef.current = props;
43938
+ }
43939
+ });
43940
+ return props.children ? /*#__PURE__*/ React.createElement(LeafletContext, {
43941
+ value: context
43942
+ }, props.children) : null;
43943
+ };
43944
+ }
43945
+ LayersControl.BaseLayer = createControlledLayer(function addBaseLayer(layersControl, layer, name) {
43946
+ layersControl.addBaseLayer(layer, name);
43947
+ });
43948
+ LayersControl.Overlay = createControlledLayer(function addOverlay(layersControl, layer, name) {
43949
+ layersControl.addOverlay(layer, name);
43950
+ });
43951
+
43952
+ class TangramLayer {
43953
+ props;
43954
+ constructor(props) {
43955
+ this.props = props;
43956
+ this._initLayer();
43957
+ }
43958
+ _initLayer() {
43959
+ if (GlobalConfig.instance.isValidApiKey) {
43960
+ const layer = this._createLayer();
43961
+ if (layer) {
43962
+ const { scene } = layer;
43963
+ scene.subscribe({
43964
+ load: ({ config }) => {
43965
+ this.config = config;
43966
+ this.isReady = true;
43967
+ this._init();
43968
+ },
43969
+ });
43970
+ this.layer = layer;
43971
+ this.props.onCreate?.({ layer });
43972
+ this._addHandlers(layer);
43973
+ }
43974
+ }
43975
+ }
43976
+ _createLayer() {
43977
+ if (window.Tangram) {
43978
+ const leafletLayer = window.Tangram.leafletLayer({
43979
+ scene: data,
43980
+ });
43981
+ return leafletLayer;
43982
+ }
43983
+ }
43984
+ _addHandlers(layer) {
43985
+ layer.addEventListener('load', ({ sourceTarget }) => {
43986
+ this.props.onLoad?.({ layer });
43987
+ const mapInstance = sourceTarget._map;
43988
+ layer.setSelectionEvents({
43989
+ click: ({ feature, leaflet_event }) => {
43990
+ if (feature) {
43991
+ const { source_layer, properties } = feature;
43992
+ this.props.eventHandlers?.[source_layer]?.click?.({
43993
+ leaflet_event,
43994
+ properties,
43995
+ });
43996
+ }
43997
+ },
43998
+ hover: ({ feature, leaflet_event }) => {
43999
+ const mapContainer = mapInstance.getContainer();
44000
+ if (feature) {
44001
+ const { source_layer, properties } = feature;
44002
+ mapContainer.style.cursor = 'pointer';
44003
+ this.props.eventHandlers?.[source_layer]?.hover?.({
44004
+ leaflet_event,
44005
+ properties,
44006
+ });
44007
+ }
44008
+ else {
44009
+ mapContainer.style.cursor = 'default';
44010
+ }
44011
+ },
44012
+ });
44013
+ }, this);
44014
+ layer.addEventListener('add', () => {
44015
+ this.props.onAdd?.({ layer });
44016
+ }, this);
44017
+ layer.addEventListener('remove', () => {
44018
+ this.props.onRemove?.({ layer });
44019
+ }, this);
44020
+ }
44021
+ destroy() {
44022
+ if (this.layer) {
44023
+ this.props.onDestroy?.({
44024
+ layer: this.layer,
44025
+ });
44026
+ this.layer.clearAllEventListeners();
44027
+ this.layer.remove();
44028
+ }
44029
+ this.layer = null;
44030
+ }
44031
+ _init() {
44032
+ this.addStyle({
44033
+ name: 'zebra_crossing',
44034
+ style: {
44035
+ base: 'polygons',
44036
+ lighting: false,
44037
+ shaders: {
44038
+ attributes: {
44039
+ a_angle: {
44040
+ type: 'float',
44041
+ default: 0.0,
44042
+ },
44043
+ },
44044
+ uniforms: {
44045
+ u_stripe_width: 1,
44046
+ },
44047
+ blocks: {
44048
+ filter: `
44049
+ vec3 pos = worldPosition().xyz;
44050
+
44051
+ float ang = radians(a_angle);
44052
+
44053
+ vec2 dir = vec2(sin(ang), cos(ang));
44054
+
44055
+ float positionAlongLine = dot(pos.xy, dir);
44056
+
44057
+ float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));
44058
+
44059
+ color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);
44060
+
44061
+ color.a = 1.0;
44062
+ `,
44063
+ },
44064
+ },
44065
+ },
44066
+ });
44067
+ const layers = this.props.defaultLayers ?? [];
44068
+ layers.forEach((layer) => {
44069
+ this.addLayer(layer);
44070
+ });
44071
+ Object.values(exports.TangramSourceNames).forEach((source) => {
44072
+ this.addSource(source);
44073
+ });
44074
+ }
44075
+ _layer = null;
44076
+ get layer() {
44077
+ return this._layer;
44078
+ }
44079
+ set layer(value) {
44080
+ this._layer = value;
44081
+ }
44082
+ _config = null;
44083
+ get config() {
44084
+ return this._config;
44085
+ }
44086
+ set config(value) {
44087
+ this._config = value;
44088
+ }
44089
+ _isReady = false;
44090
+ get isReady() {
44091
+ return this._isReady;
44092
+ }
44093
+ set isReady(value) {
44094
+ this._isReady = value;
44095
+ }
44096
+ get scene() {
44097
+ if (this.layer === null)
44098
+ return null;
44099
+ const { scene } = this.layer;
44100
+ return scene;
44101
+ }
44102
+ addStyle({ name, style }) {
44103
+ if (this.config && this.scene) {
44104
+ this.config.styles[name] = structuredClone(style);
44105
+ this.scene.updateConfig({ rebuild: true });
44106
+ }
44107
+ }
44108
+ addSource(sourceName) {
44109
+ if (this.config && this.scene) {
44110
+ const url = sourceUrl[sourceName];
44111
+ this.config.sources[sourceName] = {
44112
+ tile_size,
44113
+ url,
44114
+ type: 'MVT',
44115
+ };
44116
+ this.scene.updateConfig({ rebuild: true });
44117
+ }
44118
+ }
44119
+ deleteSource(sourceName) {
44120
+ if (this.config && this.scene) {
44121
+ delete this.config.sources[sourceName];
44122
+ this.scene.updateConfig({ rebuild: true });
44123
+ }
44124
+ }
44125
+ getSource(sourceName) {
44126
+ let source = null;
44127
+ if (this.config) {
44128
+ source = structuredClone(this.config.sources[sourceName]);
44129
+ }
44130
+ return source;
44131
+ }
44132
+ updateSource(sourceName, newUrl) {
44133
+ if (this.config && this.scene) {
44134
+ this.config.sources[sourceName].url = newUrl;
44135
+ this.scene.updateConfig({ rebuild: true });
44136
+ }
44137
+ }
44138
+ reloadSource(sourceName) {
44139
+ this.deleteSource(sourceName);
44140
+ this.addSource(sourceName);
44141
+ }
44142
+ addLayer(layer) {
44143
+ if (this.config && this.scene) {
44144
+ const order = this.getLayers().length + 1;
44145
+ const validLayer = getValidLayer({
44146
+ layer,
44147
+ order,
44148
+ eventHandlers: this.props.eventHandlers,
44149
+ });
44150
+ const layerName = getLayerName(validLayer);
44151
+ const { sublayers, draw, textures } = validLayer;
44152
+ if (draw) {
44153
+ const { styles = {} } = draw;
44154
+ if (styles) {
44155
+ validLayer.draw = {
44156
+ ...structuredClone(validLayer.draw),
44157
+ ...structuredClone(styles),
44158
+ };
44159
+ }
44160
+ }
44161
+ this.config.layers[layerName] = {
44162
+ ...structuredClone(validLayer),
44163
+ ...structuredClone(sublayers),
44164
+ };
44165
+ this.config.textures = {
44166
+ ...structuredClone(this.config.textures),
44167
+ ...structuredClone(textures),
44168
+ };
44169
+ this.scene.updateConfig({ rebuild: true });
44170
+ }
44171
+ }
44172
+ deleteLayers() {
44173
+ if (this.config) {
44174
+ const { layers } = this.config;
44175
+ Object.values(layers).forEach((layer) => {
44176
+ this.deleteLayer(layer);
44177
+ });
44178
+ }
44179
+ }
44180
+ deleteLayer(layer) {
44181
+ const layerName = getLayerName(layer);
44182
+ if (this.config && this.scene) {
44183
+ delete this.config.layers[layerName];
44184
+ this.scene.updateConfig({ rebuild: true });
44185
+ }
44186
+ }
44187
+ getLayers() {
44188
+ const layers = [];
44189
+ if (this.config) {
44190
+ layers.push(...Object.keys(this.config.layers));
44191
+ }
44192
+ return layers;
44193
+ }
44194
+ getLayerVisibility(layer) {
44195
+ let layerVisibility = true;
44196
+ const layerName = getLayerName(layer);
44197
+ if (this.config) {
44198
+ const { visible = true } = this.config.layers[layerName];
44199
+ layerVisibility = visible;
44200
+ }
44201
+ return layerVisibility;
44202
+ }
44203
+ toggleLayerVisibility({ layer, visible, }) {
44204
+ const layerName = getLayerName(layer);
44205
+ if (this.config && this.scene) {
44206
+ this.config.layers[layerName].visible = visible;
44207
+ this.scene.updateConfig({ rebuild: true });
44208
+ }
44209
+ }
44210
+ }
44211
+
43762
44212
  const LeafletLayer = ({ layers }) => {
44213
+ const controlRef = React__namespace.useRef(null);
43763
44214
  const map = useMap();
43764
- const { layer } = useGetLeafletLayer({
43765
- defaultLayers: layers,
43766
- });
43767
44215
  React__namespace.useEffect(() => {
43768
- if (layer) {
43769
- map.addLayer(layer);
44216
+ const { current: layersControl } = controlRef;
44217
+ const googleSatelliteLayer = leafletSrcExports.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
44218
+ minZoom: 2,
44219
+ maxZoom: 25,
44220
+ maxNativeZoom: 19,
44221
+ subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
44222
+ });
44223
+ if (layersControl) {
44224
+ layersControl.addBaseLayer(googleSatelliteLayer, 'Google Satellite');
43770
44225
  }
43771
- }, [layer]);
43772
- return null;
44226
+ new TangramLayer({
44227
+ defaultLayers: layers,
44228
+ onCreate: ({ layer }) => {
44229
+ if (layersControl) {
44230
+ layersControl.addBaseLayer(layer, 'Dartcom');
44231
+ layer.addTo(map);
44232
+ }
44233
+ },
44234
+ onDestroy: ({ layer }) => {
44235
+ if (layersControl) {
44236
+ layersControl.removeLayer(layer);
44237
+ map.removeLayer(layer);
44238
+ }
44239
+ },
44240
+ });
44241
+ }, []);
44242
+ return jsxRuntime.jsx(LayersControl, { ref: controlRef, position: "bottomleft" });
43773
44243
  };
43774
44244
 
43775
44245
  const modalStyle = {
@@ -43874,10 +44344,10 @@ function requirePapaparse_min () {
43874
44344
  var papaparse_minExports = requirePapaparse_min();
43875
44345
  var e = /*@__PURE__*/getDefaultExportFromCjs(papaparse_minExports);
43876
44346
 
43877
- "function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
44347
+ "function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S$1(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
43878
44348
 
43879
44349
  const CSVUploader = ({ onDataParsed, onError, delimiter = ',', header = true, dynamicTyping = true, skipEmptyLines = true, worker = false, }) => {
43880
- const { readString } = S();
44350
+ const { readString } = S$1();
43881
44351
  const [loading, setLoading] = React__namespace.useState(false);
43882
44352
  const [error, setError] = React__namespace.useState(null);
43883
44353
  return (jsxRuntime.jsx(UploadButton, { accept: ".csv", loading: loading, error: error, onFilesLoad: ({ files }) => {
@@ -46329,7 +46799,7 @@ const schema = create$3().shape({
46329
46799
  password: create$6().required(),
46330
46800
  });
46331
46801
 
46332
- const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
46802
+ const r$1=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r$1(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r$1(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
46333
46803
 
46334
46804
  function o(o,n,s$1){return void 0===s$1&&(s$1={}),function(a,i,c){try{return Promise.resolve(function(t,r){try{var u=(null!=n&&n.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(o["sync"===s$1.mode?"validateSync":"validate"](a,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&o$1({},c),{values:s$1.raw?Object.assign({},a):t,errors:{}}}));}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return {values:{},errors:s((o=e,n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(o.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,s=o&&o[t.type];e[t.path]=appendErrors(t.path,n,e,t.type,s?[].concat(s,t.message):t.message);}return e},{})),c)};var o,n;}))}catch(e){return Promise.reject(e)}}}
46335
46805
 
@@ -46428,10 +46898,1036 @@ try {
46428
46898
  }
46429
46899
  } catch(e) {}
46430
46900
 
46901
+ var Tangram$1 = Tangram;
46902
+
46431
46903
  var tangram_min = /*#__PURE__*/Object.freeze({
46904
+ __proto__: null,
46905
+ default: Tangram$1
46906
+ });
46907
+
46908
+ (function() {
46909
+ // save these original methods before they are overwritten
46910
+ var proto_initIcon = L.Marker.prototype._initIcon;
46911
+ var proto_setPos = L.Marker.prototype._setPos;
46912
+
46913
+ var oldIE = (L.DomUtil.TRANSFORM === 'msTransform');
46914
+
46915
+ L.Marker.addInitHook(function () {
46916
+ var iconOptions = this.options.icon && this.options.icon.options;
46917
+ var iconAnchor = iconOptions && this.options.icon.options.iconAnchor;
46918
+ if (iconAnchor) {
46919
+ iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px');
46920
+ }
46921
+ this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ;
46922
+ this.options.rotationAngle = this.options.rotationAngle || 0;
46923
+
46924
+ // Ensure marker keeps rotated during dragging
46925
+ this.on('drag', function(e) { e.target._applyRotation(); });
46926
+ });
46927
+
46928
+ L.Marker.include({
46929
+ _initIcon: function() {
46930
+ proto_initIcon.call(this);
46931
+ },
46932
+
46933
+ _setPos: function (pos) {
46934
+ proto_setPos.call(this, pos);
46935
+ this._applyRotation();
46936
+ },
46937
+
46938
+ _applyRotation: function () {
46939
+ if(this.options.rotationAngle) {
46940
+ this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin;
46941
+
46942
+ if(oldIE) {
46943
+ // for IE 9, use the 2D rotation
46944
+ this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)';
46945
+ } else {
46946
+ // for modern browsers, prefer the 3D accelerated version
46947
+ this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)';
46948
+ }
46949
+ }
46950
+ },
46951
+
46952
+ setRotationAngle: function(angle) {
46953
+ this.options.rotationAngle = angle;
46954
+ this.update();
46955
+ return this;
46956
+ },
46957
+
46958
+ setRotationOrigin: function(origin) {
46959
+ this.options.rotationOrigin = origin;
46960
+ this.update();
46961
+ return this;
46962
+ }
46963
+ });
46964
+ })();
46965
+
46966
+ var leaflet_rotatedMarker = /*#__PURE__*/Object.freeze({
46432
46967
  __proto__: null
46433
46968
  });
46434
46969
 
46970
+ var leaflet_polylineoffset$2 = {exports: {}};
46971
+
46972
+ var hasRequiredLeaflet_polylineoffset;
46973
+
46974
+ function requireLeaflet_polylineoffset () {
46975
+ if (hasRequiredLeaflet_polylineoffset) return leaflet_polylineoffset$2.exports;
46976
+ hasRequiredLeaflet_polylineoffset = 1;
46977
+ (function (module, exports$1) {
46978
+ (function (factory, window) {
46979
+ {
46980
+ module.exports = factory(requireLeafletSrc());
46981
+ }
46982
+ if (typeof window !== 'undefined' && window.L) {
46983
+ window.L.PolylineOffset = factory(L);
46984
+ }
46985
+ }(function (L) {
46986
+
46987
+ function forEachPair(list, callback) {
46988
+ if (!list || list.length < 1) { return; }
46989
+ for (var i = 1, l = list.length; i < l; i++) {
46990
+ callback(list[i-1], list[i]);
46991
+ }
46992
+ }
46993
+
46994
+ /**
46995
+ Find the coefficients (a,b) of a line of equation y = a.x + b,
46996
+ or the constant x for vertical lines
46997
+ Return null if there's no equation possible
46998
+ */
46999
+ function lineEquation(pt1, pt2) {
47000
+ if (pt1.x === pt2.x) {
47001
+ return pt1.y === pt2.y ? null : { x: pt1.x };
47002
+ }
47003
+
47004
+ var a = (pt2.y - pt1.y) / (pt2.x - pt1.x);
47005
+ return {
47006
+ a: a,
47007
+ b: pt1.y - a * pt1.x,
47008
+ };
47009
+ }
47010
+
47011
+ /**
47012
+ Return the intersection point of two lines defined by two points each
47013
+ Return null when there's no unique intersection
47014
+ */
47015
+ function intersection(l1a, l1b, l2a, l2b) {
47016
+ var line1 = lineEquation(l1a, l1b);
47017
+ var line2 = lineEquation(l2a, l2b);
47018
+
47019
+ if (line1 === null || line2 === null) {
47020
+ return null;
47021
+ }
47022
+
47023
+ if (line1.hasOwnProperty('x')) {
47024
+ return line2.hasOwnProperty('x')
47025
+ ? null
47026
+ : {
47027
+ x: line1.x,
47028
+ y: line2.a * line1.x + line2.b,
47029
+ };
47030
+ }
47031
+ if (line2.hasOwnProperty('x')) {
47032
+ return {
47033
+ x: line2.x,
47034
+ y: line1.a * line2.x + line1.b,
47035
+ };
47036
+ }
47037
+
47038
+ if (line1.a === line2.a) {
47039
+ return null;
47040
+ }
47041
+
47042
+ var x = (line2.b - line1.b) / (line1.a - line2.a);
47043
+ return {
47044
+ x: x,
47045
+ y: line1.a * x + line1.b,
47046
+ };
47047
+ }
47048
+
47049
+ function translatePoint(pt, dist, heading) {
47050
+ return {
47051
+ x: pt.x + dist * Math.cos(heading),
47052
+ y: pt.y + dist * Math.sin(heading),
47053
+ };
47054
+ }
47055
+
47056
+ var PolylineOffset = {
47057
+ offsetPointLine: function(points, distance) {
47058
+ var offsetSegments = [];
47059
+
47060
+ forEachPair(points, L.bind(function(a, b) {
47061
+ if (a.x === b.x && a.y === b.y) { return; }
47062
+
47063
+ // angles in (-PI, PI]
47064
+ var segmentAngle = Math.atan2(a.y - b.y, a.x - b.x);
47065
+ var offsetAngle = segmentAngle - Math.PI/2;
47066
+
47067
+ offsetSegments.push({
47068
+ offsetAngle: offsetAngle,
47069
+ original: [a, b],
47070
+ offset: [
47071
+ translatePoint(a, distance, offsetAngle),
47072
+ translatePoint(b, distance, offsetAngle)
47073
+ ]
47074
+ });
47075
+ }, this));
47076
+
47077
+ return offsetSegments;
47078
+ },
47079
+
47080
+ offsetPoints: function(pts, offset) {
47081
+ var offsetSegments = this.offsetPointLine(pts, offset);
47082
+ return this.joinLineSegments(offsetSegments, offset);
47083
+ },
47084
+
47085
+ /**
47086
+ Join 2 line segments defined by 2 points each with a circular arc
47087
+ */
47088
+ joinSegments: function(s1, s2, offset) {
47089
+ // TODO: different join styles
47090
+ return this.circularArc(s1, s2, offset)
47091
+ .filter(function(x) { return x; })
47092
+ },
47093
+
47094
+ joinLineSegments: function(segments, offset) {
47095
+ var joinedPoints = [];
47096
+ var first = segments[0];
47097
+ var last = segments[segments.length - 1];
47098
+
47099
+ if (first && last) {
47100
+ joinedPoints.push(first.offset[0]);
47101
+ forEachPair(segments, L.bind(function(s1, s2) {
47102
+ joinedPoints = joinedPoints.concat(this.joinSegments(s1, s2, offset));
47103
+ }, this));
47104
+ joinedPoints.push(last.offset[1]);
47105
+ }
47106
+
47107
+ return joinedPoints;
47108
+ },
47109
+
47110
+ segmentAsVector: function(s) {
47111
+ return {
47112
+ x: s[1].x - s[0].x,
47113
+ y: s[1].y - s[0].y,
47114
+ };
47115
+ },
47116
+
47117
+ getSignedAngle: function(s1, s2) {
47118
+ const a = this.segmentAsVector(s1);
47119
+ const b = this.segmentAsVector(s2);
47120
+ return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y);
47121
+ },
47122
+
47123
+ /**
47124
+ Interpolates points between two offset segments in a circular form
47125
+ */
47126
+ circularArc: function(s1, s2, distance) {
47127
+ // if the segments are the same angle,
47128
+ // there should be a single join point
47129
+ if (s1.offsetAngle === s2.offsetAngle) {
47130
+ return [s1.offset[1]];
47131
+ }
47132
+
47133
+ const signedAngle = this.getSignedAngle(s1.offset, s2.offset);
47134
+ // for inner angles, just find the offset segments intersection
47135
+ if ((signedAngle * distance > 0) &&
47136
+ (signedAngle * this.getSignedAngle(s1.offset, [s1.offset[0], s2.offset[1]]) > 0)) {
47137
+ return [intersection(s1.offset[0], s1.offset[1], s2.offset[0], s2.offset[1])];
47138
+ }
47139
+
47140
+ // draws a circular arc with R = offset distance, C = original meeting point
47141
+ var points = [];
47142
+ var center = s1.original[1];
47143
+ // ensure angles go in the anti-clockwise direction
47144
+ var rightOffset = distance > 0;
47145
+ var startAngle = rightOffset ? s2.offsetAngle : s1.offsetAngle;
47146
+ var endAngle = rightOffset ? s1.offsetAngle : s2.offsetAngle;
47147
+ // and that the end angle is bigger than the start angle
47148
+ if (endAngle < startAngle) {
47149
+ endAngle += Math.PI * 2;
47150
+ }
47151
+ var step = Math.PI / 8;
47152
+ for (var alpha = startAngle; alpha < endAngle; alpha += step) {
47153
+ points.push(translatePoint(center, distance, alpha));
47154
+ }
47155
+ points.push(translatePoint(center, distance, endAngle));
47156
+
47157
+ return rightOffset ? points.reverse() : points;
47158
+ }
47159
+ };
47160
+
47161
+ // Modify the L.Polyline class by overwriting the projection function
47162
+ L.Polyline.include({
47163
+ _projectLatlngs: function (latlngs, result, projectedBounds) {
47164
+ var isFlat = latlngs.length > 0 && latlngs[0] instanceof L.LatLng;
47165
+
47166
+ if (isFlat) {
47167
+ var ring = latlngs.map(L.bind(function(ll) {
47168
+ var point = this._map.latLngToLayerPoint(ll);
47169
+ if (projectedBounds) {
47170
+ projectedBounds.extend(point);
47171
+ }
47172
+ return point;
47173
+ }, this));
47174
+
47175
+ // Offset management hack ---
47176
+ if (this.options.offset) {
47177
+ ring = L.PolylineOffset.offsetPoints(ring, this.options.offset);
47178
+ }
47179
+ // Offset management hack END ---
47180
+
47181
+ result.push(ring.map(function (xy) {
47182
+ return L.point(xy.x, xy.y);
47183
+ }));
47184
+ } else {
47185
+ latlngs.forEach(L.bind(function(ll) {
47186
+ this._projectLatlngs(ll, result, projectedBounds);
47187
+ }, this));
47188
+ }
47189
+ }
47190
+ });
47191
+
47192
+ L.Polyline.include({
47193
+ setOffset: function(offset) {
47194
+ this.options.offset = offset;
47195
+ this.redraw();
47196
+ return this;
47197
+ }
47198
+ });
47199
+
47200
+ return PolylineOffset;
47201
+
47202
+ }, window));
47203
+ } (leaflet_polylineoffset$2));
47204
+ return leaflet_polylineoffset$2.exports;
47205
+ }
47206
+
47207
+ var leaflet_polylineoffsetExports = requireLeaflet_polylineoffset();
47208
+ var leaflet_polylineoffset = /*@__PURE__*/getDefaultExportFromCjs(leaflet_polylineoffsetExports);
47209
+
47210
+ var leaflet_polylineoffset$1 = /*#__PURE__*/_mergeNamespaces({
47211
+ __proto__: null,
47212
+ default: leaflet_polylineoffset
47213
+ }, [leaflet_polylineoffsetExports]);
47214
+
47215
+ /**
47216
+ * L.Map.SelectArea - Area selection tool for leaflet
47217
+ *
47218
+ * @author Alexander Milevski <info@w8r.name>
47219
+ * @see https://github.com/w8r/leaflet-area-select
47220
+ * @license MIT
47221
+ * @preserve
47222
+ */
47223
+ var r = function() {
47224
+ return true;
47225
+ };
47226
+ s$3.Map.SelectArea = s$3.Map.BoxZoom.extend({
47227
+ statics: {
47228
+ /**
47229
+ * @static
47230
+ * @type {String}
47231
+ */
47232
+ SELECT_AREA_SELECTED: "selectarea:selected",
47233
+ /**
47234
+ * @static
47235
+ * @type {String}
47236
+ */
47237
+ SELECT_AREA_START: "selectarea:start",
47238
+ /**
47239
+ * @static
47240
+ * @type {String}
47241
+ */
47242
+ SELECT_AREA_TOGGLED: "selectarea:toggled"
47243
+ },
47244
+ options: {
47245
+ shiftKey: false,
47246
+ ctrlKey: true,
47247
+ validate: r,
47248
+ autoDisable: false,
47249
+ cursor: "crosshair"
47250
+ },
47251
+ /**
47252
+ * @param {L.Map} map
47253
+ * @constructor
47254
+ */
47255
+ initialize: function(t, e) {
47256
+ s$3.Util.setOptions(this, e || {}), s$3.Map.BoxZoom.prototype.initialize.call(this, t), this._validate = null, this._moved = false, this._autoDisable = !this.options.ctrlKey && this.options.autoDisable, this._lastLayerPoint = null, this._beforeCursor = null, this.setValidate(this.options.validate), this.setAutoDisable(this.options.autoDisable);
47257
+ },
47258
+ /**
47259
+ * @param {Function=} validate
47260
+ * @return {SelectArea}
47261
+ */
47262
+ setValidate: function(t) {
47263
+ var e = this;
47264
+ return typeof t != "function" && (t = r), this._validate = function(i) {
47265
+ return t.call(e, i);
47266
+ }, this;
47267
+ },
47268
+ /**
47269
+ * @param {Boolean} autoDisable
47270
+ */
47271
+ setAutoDisable: function(t) {
47272
+ this._autoDisable = !!t;
47273
+ },
47274
+ /**
47275
+ * @param {Boolean} on
47276
+ */
47277
+ setControlKey: function(t) {
47278
+ var e = this._enabled;
47279
+ e && this.disable(), this.options.ctrlKey = !!t, t && (this.options.shiftKey = false), e && this.enable();
47280
+ },
47281
+ /**
47282
+ * @param {Boolean} on
47283
+ */
47284
+ setShiftKey: function(t) {
47285
+ var e = this._enabled;
47286
+ e && this.disable(), this.options.shiftKey = !!t, t && (this.options.ctrlKey = false), e && this.enable();
47287
+ },
47288
+ /**
47289
+ * Disable dragging or zoombox
47290
+ * @param {Function=} validate
47291
+ * @param {Boolean=} autoDisable
47292
+ */
47293
+ enable: function(t, e) {
47294
+ this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.disable() : this.options.ctrlKey || this._map.dragging.disable(), s$3.Map.BoxZoom.prototype.enable.call(this), this.options.ctrlKey || this._setCursor(), t && this.setValidate(t), this.setAutoDisable(e), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
47295
+ },
47296
+ /**
47297
+ * Re-enable box zoom or dragging
47298
+ */
47299
+ disable: function() {
47300
+ s$3.Map.BoxZoom.prototype.disable.call(this), this.options.ctrlKey || this._restoreCursor(), this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.enable() : this._map.dragging.enable(), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
47301
+ },
47302
+ /**
47303
+ * Also listen to ESC to cancel interaction
47304
+ * @override
47305
+ */
47306
+ addHooks: function() {
47307
+ s$3.Map.BoxZoom.prototype.addHooks.call(this), s$3.DomEvent.on(document, "keyup", this._onKeyUp, this).on(document, "keydown", this._onKeyPress, this).on(document, "contextmenu", this._onMouseDown, this).on(window, "blur", this._onBlur, this), this._map.on("dragstart", this._onMouseDown, this);
47308
+ },
47309
+ /**
47310
+ * @override
47311
+ */
47312
+ removeHooks: function() {
47313
+ s$3.Map.BoxZoom.prototype.removeHooks.call(this), s$3.DomEvent.off(document, "keyup", this._onKeyUp, this).off(document, "keydown", this._onKeyPress, this).off(document, "contextmenu", this._onMouseDown, this).off(window, "blur", this._onBlur, this), this._map.off("dragstart", this._onMouseDown, this);
47314
+ },
47315
+ /**
47316
+ * @override
47317
+ */
47318
+ _onMouseDown: function(t) {
47319
+ if (this._moved = false, this._lastLayerPoint = null, this.options.shiftKey && !t.shiftKey || this.options.ctrlKey && !t.ctrlKey || t.which !== 1 && t.button !== 1)
47320
+ return false;
47321
+ s$3.DomEvent.stop(t);
47322
+ var e = this._map.mouseEventToLayerPoint(t);
47323
+ if (!this._validate(e)) return false;
47324
+ s$3.DomUtil.disableTextSelection(), s$3.DomUtil.disableImageDrag(), this._startLayerPoint = e, s$3.DomEvent.on(document, "mousemove", this._onMouseMove, this).on(document, "mouseup", this._onMouseUp, this).on(document, "keydown", this._onKeyDown, this);
47325
+ },
47326
+ /**
47327
+ * @override
47328
+ */
47329
+ _onMouseMove: function(t) {
47330
+ this._moved || (this._box = s$3.DomUtil.create("div", "leaflet-zoom-box", this._pane), s$3.DomUtil.setPosition(this._box, this._startLayerPoint), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_START));
47331
+ var e = this._startLayerPoint, i = this._box, o = this._map.mouseEventToLayerPoint(t), a = o.subtract(e);
47332
+ if (this._validate(o)) {
47333
+ this._lastLayerPoint = o;
47334
+ var n = new s$3.Point(
47335
+ Math.min(o.x, e.x),
47336
+ Math.min(o.y, e.y)
47337
+ );
47338
+ s$3.DomUtil.setPosition(i, n), this._moved = true, i.style.width = Math.max(0, Math.abs(a.x) - 4) + "px", i.style.height = Math.max(0, Math.abs(a.y) - 4) + "px";
47339
+ }
47340
+ },
47341
+ /**
47342
+ * General on/off toggle
47343
+ * @param {KeyboardEvent} e
47344
+ */
47345
+ _onKeyUp: function(t) {
47346
+ t.keyCode === 27 ? this._moved && this._box && this._finish() : this.options.ctrlKey && (this._restoreCursor(), this._map.dragging.enable());
47347
+ },
47348
+ /**
47349
+ * Key down listener to enable on ctrl-press
47350
+ * @param {KeyboardEvent} e
47351
+ */
47352
+ _onKeyPress: function(t) {
47353
+ this.options.ctrlKey && (t.ctrlKey || t.type === "dragstart") && this._beforeCursor === null && (this._setCursor(), this._map.dragging._draggable._onUp(t), this._map.dragging.disable());
47354
+ },
47355
+ /**
47356
+ * Window blur listener to restore state
47357
+ * @param {Event} e
47358
+ */
47359
+ _onBlur: function(t) {
47360
+ this._restoreCursor(), this._map.dragging.enable();
47361
+ },
47362
+ /**
47363
+ * Set crosshair cursor
47364
+ */
47365
+ _setCursor: function() {
47366
+ this._beforeCursor = this._container.style.cursor, this._container.style.cursor = this.options.cursor;
47367
+ },
47368
+ /**
47369
+ * Restore status quo cursor
47370
+ */
47371
+ _restoreCursor: function() {
47372
+ this._container.style.cursor = this._beforeCursor, this._beforeCursor = null;
47373
+ },
47374
+ /**
47375
+ * @override
47376
+ */
47377
+ _onMouseUp: function(t) {
47378
+ this._finish();
47379
+ var e = this._map, i = this._lastLayerPoint;
47380
+ if (!(!i || this._startLayerPoint.equals(i))) {
47381
+ s$3.DomEvent.stop(t);
47382
+ var o = e.layerPointToLatLng(this._startLayerPoint), a = e.layerPointToLatLng(i), n = new s$3.LatLngBounds(o, a);
47383
+ this._autoDisable ? this.disable() : this._restoreCursor(), this._moved = false, s$3.Util.requestAnimFrame(function() {
47384
+ e.fire(s$3.Map.SelectArea.SELECT_AREA_SELECTED, {
47385
+ bounds: n,
47386
+ start: o,
47387
+ end: a
47388
+ });
47389
+ });
47390
+ }
47391
+ }
47392
+ });
47393
+ s$3.Map.mergeOptions({
47394
+ selectArea: false
47395
+ });
47396
+ s$3.Map.addInitHook("addHandler", "selectArea", s$3.Map.SelectArea);
47397
+ const l = s$3.Map.SelectArea;
47398
+
47399
+ var index$1 = /*#__PURE__*/Object.freeze({
47400
+ __proto__: null,
47401
+ default: l
47402
+ });
47403
+
47404
+ leafletSrcExports.SVG.include({
47405
+ /**
47406
+ * Reset transform matrix
47407
+ */
47408
+ _resetTransformPath: function(t) {
47409
+ t._path.setAttributeNS(null, "transform", "");
47410
+ },
47411
+ /**
47412
+ * Applies matrix transformation to SVG
47413
+ * @param {L.Path} layer
47414
+ * @param {Array.<Number>} matrix
47415
+ */
47416
+ transformPath: function(t, i) {
47417
+ t._path.setAttributeNS(
47418
+ null,
47419
+ "transform",
47420
+ "matrix(" + i.join(" ") + ")"
47421
+ );
47422
+ }
47423
+ });
47424
+ leafletSrcExports.SVG.include(
47425
+ leafletSrcExports.Browser.vml ? {
47426
+ /**
47427
+ * Reset transform matrix
47428
+ */
47429
+ _resetTransformPath: function(t) {
47430
+ t._skew && (t._skew.on = false, t._path.removeChild(t._skew), t._skew = null);
47431
+ },
47432
+ /**
47433
+ * Applies matrix transformation to VML
47434
+ * @param {L.Path} layer
47435
+ * @param {Array.<Number>} matrix
47436
+ */
47437
+ transformPath: function(t, i) {
47438
+ let n = t._skew;
47439
+ n || (n = leafletSrcExports.SVG.create("skew"), t._path.appendChild(n), n.style.behavior = "url(#default#VML)", t._skew = n);
47440
+ const a = i[0].toFixed(8) + " " + i[1].toFixed(8) + " " + i[2].toFixed(8) + " " + i[3].toFixed(8) + " 0 0", r = Math.floor(i[4]).toFixed() + ", " + Math.floor(i[5]).toFixed(), s = this._path.style;
47441
+ let e = parseFloat(s.left), o = parseFloat(s.top), _ = parseFloat(s.width), p = parseFloat(s.height);
47442
+ isNaN(e) && (e = 0), isNaN(o) && (o = 0), (isNaN(_) || !_) && (_ = 1), (isNaN(p) || !p) && (p = 1);
47443
+ const u = (-e / _ - 0.5).toFixed(8) + " " + (-o / p - 0.5).toFixed(8);
47444
+ n.on = "f", n.matrix = a, n.origin = u, n.offset = r, n.on = true;
47445
+ }
47446
+ } : {}
47447
+ );
47448
+ function E() {
47449
+ return true;
47450
+ }
47451
+ leafletSrcExports.Canvas.include({
47452
+ /**
47453
+ * Do nothing
47454
+ * @param {L.Path} layer
47455
+ */
47456
+ _resetTransformPath: function(t) {
47457
+ this._containerCopy && (delete this._containerCopy, t._containsPoint_ && (t._containsPoint = t._containsPoint_, delete t._containsPoint_, this._requestRedraw(t)));
47458
+ },
47459
+ /**
47460
+ * Algorithm outline:
47461
+ *
47462
+ * 1. pre-transform - clear the path out of the canvas, copy canvas state
47463
+ * 2. at every frame:
47464
+ * 2.1. save
47465
+ * 2.2. redraw the canvas from saved one
47466
+ * 2.3. transform
47467
+ * 2.4. draw path
47468
+ * 2.5. restore
47469
+ * 3. Repeat
47470
+ *
47471
+ * @param {L.Path} layer
47472
+ * @param {Array.<Number>} matrix
47473
+ */
47474
+ transformPath: function(t, i) {
47475
+ let n = this._containerCopy;
47476
+ const a = this._ctx;
47477
+ let r;
47478
+ const s = leafletSrcExports.Browser.retina ? 2 : 1, e = this._bounds, o = e.getSize(), _ = e.min;
47479
+ n || (n = this._containerCopy = document.createElement("canvas"), r = n.getContext("2d"), n.width = s * o.x, n.height = s * o.y, this._removePath(t), this._redraw(), r.translate(s * e.min.x, s * e.min.y), r.drawImage(this._container, 0, 0), this._initPath(t), t._containsPoint_ = t._containsPoint, t._containsPoint = E), a.save(), a.clearRect(_.x, _.y, o.x * s, o.y * s), a.setTransform(1, 0, 0, 1, 0, 0), a.restore(), a.save(), a.drawImage(this._containerCopy, 0, 0, o.x, o.y), a.transform.apply(a, i), this._drawing = true, t._updatePath(), this._drawing = false, a.restore();
47480
+ }
47481
+ });
47482
+ /**
47483
+ * Leaflet vector features drag functionality
47484
+ * @author Alexander Milevski <info@w8r.name>
47485
+ * @preserve
47486
+ */
47487
+ leafletSrcExports.Path.include({
47488
+ /**
47489
+ * Applies matrix transformation to SVG
47490
+ * @param {Array.<Number>?} matrix
47491
+ */
47492
+ _transform: function(t) {
47493
+ return this._renderer && (t ? this._renderer.transformPath(this, t) : (this._renderer._resetTransformPath(this), this._update())), this;
47494
+ },
47495
+ /**
47496
+ * Check if the feature was dragged, that'll supress the click event
47497
+ * on mouseup. That fixes popups for example
47498
+ *
47499
+ * @param {MouseEvent} e
47500
+ */
47501
+ _onMouseClick: function(t) {
47502
+ this.dragging && this.dragging.moved() || this._map.dragging && this._map.dragging.moved() || this._fireMouseEvent(t);
47503
+ }
47504
+ });
47505
+ const S = {
47506
+ mousedown: "mouseup",
47507
+ touchstart: "touchend",
47508
+ pointerdown: "touchend",
47509
+ MSPointerDown: "touchend"
47510
+ }, M = {
47511
+ mousedown: "mousemove",
47512
+ touchstart: "touchmove",
47513
+ pointerdown: "touchmove",
47514
+ MSPointerDown: "touchmove"
47515
+ };
47516
+ function k(t, i) {
47517
+ const n = t.x - i.x, a = t.y - i.y;
47518
+ return Math.sqrt(n * n + a * a);
47519
+ }
47520
+ leafletSrcExports.Handler.PathDrag = leafletSrcExports.Handler.extend(
47521
+ /** @lends L.Path.Drag.prototype */
47522
+ {
47523
+ statics: {
47524
+ DRAGGING_CLS: "leaflet-path-draggable"
47525
+ },
47526
+ /**
47527
+ * @param {L.Path} path
47528
+ * @constructor
47529
+ */
47530
+ initialize: function(t) {
47531
+ this._path = t, this._matrix = null, this._startPoint = null, this._dragStartPoint = null, this._mapDraggingWasEnabled = false, this._path._dragMoved = false;
47532
+ },
47533
+ /**
47534
+ * Enable dragging
47535
+ */
47536
+ addHooks: function() {
47537
+ this._path.on("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className ? this._path.options.className + " " + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS : leafletSrcExports.Handler.PathDrag.DRAGGING_CLS, this._path._path && leafletSrcExports.DomUtil.addClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
47538
+ },
47539
+ /**
47540
+ * Disable dragging
47541
+ */
47542
+ removeHooks: function() {
47543
+ this._path.off("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className.replace(
47544
+ new RegExp("\\s+" + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS),
47545
+ ""
47546
+ ), this._path._path && leafletSrcExports.DomUtil.removeClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
47547
+ },
47548
+ /**
47549
+ * @return {Boolean}
47550
+ */
47551
+ moved: function() {
47552
+ return this._path._dragMoved;
47553
+ },
47554
+ /**
47555
+ * Start drag
47556
+ * @param {L.MouseEvent} evt
47557
+ */
47558
+ _onDragStart: function(t) {
47559
+ const i = t.originalEvent._simulated ? "touchstart" : t.originalEvent.type;
47560
+ this._mapDraggingWasEnabled = false, this._startPoint = t.containerPoint.clone(), this._dragStartPoint = t.containerPoint.clone(), this._matrix = [1, 0, 0, 1, 0, 0], leafletSrcExports.DomEvent.stop(t.originalEvent), leafletSrcExports.DomUtil.addClass(this._path._renderer._container, "leaflet-interactive"), leafletSrcExports.DomEvent.on(document, M[i], this._onDrag, this).on(
47561
+ document,
47562
+ S[i],
47563
+ this._onDragEnd,
47564
+ this
47565
+ ), this._path._map.dragging.enabled() && (this._path._map.dragging.disable(), this._mapDraggingWasEnabled = true), this._path._dragMoved = false, this._path._popup && this._path._popup.close(), this._replaceCoordGetters(t);
47566
+ },
47567
+ /**
47568
+ * Dragging
47569
+ * @param {L.MouseEvent} evt
47570
+ */
47571
+ _onDrag: function(t) {
47572
+ leafletSrcExports.DomEvent.stop(t);
47573
+ const i = t.touches && t.touches.length >= 1 ? t.touches[0] : t, n = this._path._map.mouseEventToContainerPoint(i);
47574
+ if (t.type === "touchmove" && !this._path._dragMoved && this._dragStartPoint.distanceTo(n) <= this._path._map.options.tapTolerance)
47575
+ return;
47576
+ const a = n.x, r = n.y, s = a - this._startPoint.x, e = r - this._startPoint.y;
47577
+ (s || e) && (this._path._dragMoved || (this._path._dragMoved = true, this._path.options.interactive = false, this._path._map.dragging._draggable._moved = true, this._path.fire("dragstart", t), this._path.bringToFront()), this._matrix[4] += s, this._matrix[5] += e, this._startPoint.x = a, this._startPoint.y = r, this._path.fire("predrag", t), this._path._transform(this._matrix), this._path.fire("drag", t));
47578
+ },
47579
+ /**
47580
+ * Dragging stopped, apply
47581
+ * @param {L.MouseEvent} evt
47582
+ */
47583
+ _onDragEnd: function(t) {
47584
+ const i = this._path._map.mouseEventToContainerPoint(t), n = this.moved();
47585
+ if (n && (this._transformPoints(this._matrix), this._path._updatePath(), this._path._project(), this._path._transform(null), leafletSrcExports.DomEvent.stop(t)), leafletSrcExports.DomEvent.off(document, "mousemove touchmove", this._onDrag, this), leafletSrcExports.DomEvent.off(document, "mouseup touchend", this._onDragEnd, this), this._restoreCoordGetters(), n) {
47586
+ this._path.fire("dragend", {
47587
+ distance: k(this._dragStartPoint, i)
47588
+ });
47589
+ const a = this._path._containsPoint;
47590
+ this._path._containsPoint = leafletSrcExports.Util.falseFn, leafletSrcExports.Util.requestAnimFrame(function() {
47591
+ this._path._dragMoved = false, this._path.options.interactive = true, this._path._containsPoint = a;
47592
+ }, this);
47593
+ }
47594
+ this._mapDraggingWasEnabled && this._path._map.dragging.enable();
47595
+ },
47596
+ /**
47597
+ * Applies transformation, does it in one sweep for performance,
47598
+ * so don't be surprised about the code repetition.
47599
+ *
47600
+ * [ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
47601
+ * [ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
47602
+ *
47603
+ * @param {Array.<Number>} matrix
47604
+ */
47605
+ _transformPoints: function(t, i) {
47606
+ const n = this._path, a = L.point(t[4], t[5]), r = n._map.options.crs, s = r.transformation, e = r.scale(n._map.getZoom()), o = r.projection, _ = s.untransform(a, e).subtract(s.untransform(leafletSrcExports.point(0, 0), e)), p = !i;
47607
+ if (n._bounds = new leafletSrcExports.LatLngBounds(), n._point)
47608
+ i = o.unproject(
47609
+ o.project(n._latlng)._add(_)
47610
+ ), p && (n._latlng = i, n._point._add(a));
47611
+ else if (n._rings || n._parts) {
47612
+ const u = n._rings || n._parts;
47613
+ let c = n._latlngs;
47614
+ i = i || c, leafletSrcExports.Util.isArray(c[0]) || (c = [c], i = [i]);
47615
+ for (let g = 0, w = u.length; g < w; g++) {
47616
+ i[g] = i[g] || [];
47617
+ for (let d = 0, v = u[g].length; d < v; d++) {
47618
+ const b = c[g][d];
47619
+ i[g][d] = o.unproject(
47620
+ o.project(b)._add(_)
47621
+ ), p && (n._bounds.extend(c[g][d]), u[g][d]._add(a));
47622
+ }
47623
+ }
47624
+ }
47625
+ return i;
47626
+ },
47627
+ /**
47628
+ * If you want to read the latlngs during the drag - your right,
47629
+ * but they have to be transformed
47630
+ */
47631
+ _replaceCoordGetters: function() {
47632
+ this._path.getLatLng ? (this._path.getLatLng_ = this._path.getLatLng, this._path.getLatLng = leafletSrcExports.Util.bind(function() {
47633
+ return this.dragging._transformPoints(this.dragging._matrix, {});
47634
+ }, this._path)) : this._path.getLatLngs && (this._path.getLatLngs_ = this._path.getLatLngs, this._path.getLatLngs = leafletSrcExports.Util.bind(function() {
47635
+ return this.dragging._transformPoints(this.dragging._matrix, []);
47636
+ }, this._path));
47637
+ },
47638
+ /**
47639
+ * Put back the getters
47640
+ */
47641
+ _restoreCoordGetters: function() {
47642
+ this._path.getLatLng_ ? (this._path.getLatLng = this._path.getLatLng_, delete this._path.getLatLng_) : this._path.getLatLngs_ && (this._path.getLatLngs = this._path.getLatLngs_, delete this._path.getLatLngs_);
47643
+ }
47644
+ }
47645
+ );
47646
+ leafletSrcExports.Handler.PathDrag.makeDraggable = function(t) {
47647
+ return t.dragging = new leafletSrcExports.Handler.PathDrag(t), t;
47648
+ };
47649
+ leafletSrcExports.Path.prototype.makeDraggable = function() {
47650
+ return leafletSrcExports.Handler.PathDrag.makeDraggable(this);
47651
+ };
47652
+ leafletSrcExports.Path.addInitHook(function() {
47653
+ this.options.draggable ? (this.options.interactive = true, this.dragging ? this.dragging.enable() : (leafletSrcExports.Handler.PathDrag.makeDraggable(this), this.dragging.enable())) : this.dragging && this.dragging.disable();
47654
+ });
47655
+ const T = leafletSrcExports.Handler.PathDrag;
47656
+
47657
+ var index = /*#__PURE__*/Object.freeze({
47658
+ __proto__: null,
47659
+ default: T
47660
+ });
47661
+
47662
+ var leafletArrows$2 = {exports: {}};
47663
+
47664
+ var hasRequiredLeafletArrows;
47665
+
47666
+ function requireLeafletArrows () {
47667
+ if (hasRequiredLeafletArrows) return leafletArrows$2.exports;
47668
+ hasRequiredLeafletArrows = 1;
47669
+ (function (module, exports$1) {
47670
+ // Leaflet Arrows by Meteotest
47671
+ // https://github.com/meteotest/leaflet-arrows
47672
+ // Module Loader Boilerplate
47673
+ (function (factory, window) {
47674
+ // define an AMD module that relies on 'leaflet'
47675
+ {
47676
+ module.exports = factory(requireLeafletSrc());
47677
+ }
47678
+ // attach your plugin to the global 'L' variable
47679
+ if (typeof window !== 'undefined' && window.L) {
47680
+ window.L.Arrow = factory(L);
47681
+ }
47682
+ })(function (L) {
47683
+ // beware! the arrow factory
47684
+ const Arrow = L.FeatureGroup.extend({
47685
+ options: {
47686
+ distanceUnit: 'km', // can be [px,km]
47687
+ stretchFactor: 1, // should the distance be stretched?
47688
+ arrowheadLength: 4, // in distance unit
47689
+ arrowheadClosingLine: false, // should a closing third line be drawn?
47690
+ arrowheadDegree: 155, // degree of arrowhead
47691
+ clickableWidth: 10, // defines the width in pixels of the "phantom" path to capture click events on a line
47692
+ //optional: popupContent: function(data) {},
47693
+ // add your own custom validator, probably not needed...
47694
+ // the validator gets the bound data object as argument
47695
+ validator: function (data) {
47696
+ return (typeof data.latlng !== 'undefined' &&
47697
+ typeof data.distance !== 'undefined' &&
47698
+ !isNaN(data.distance));
47699
+ }, // validator is a callback function that takes the data object of the current point and returns whether it is 'valid'. Invalid arrows will be drawn gray
47700
+ colorScheme: function () {
47701
+ return this.color;
47702
+ }, // add own colorscheme callback
47703
+ circleRadiusInvalidPoint: 1000, // Radius of the circle to display missing or '0'-value
47704
+ // path options
47705
+ color: '#333',
47706
+ opacity: 0.9, // stroke opacity
47707
+ fillOpacity: 0.9,
47708
+ weight: 4, // the width of the arrow
47709
+ smoothFactor: 0,
47710
+ radius: 5, // default radius, when distance is 0
47711
+ defaultPointOptions: {
47712
+ stroke: false,
47713
+ fillOpacity: 0.8,
47714
+ fillColor: '#111',
47715
+ radius: 7,
47716
+ },
47717
+ invalidPointOptions: {
47718
+ stroke: false,
47719
+ fillOpacity: 0.8,
47720
+ fillColor: 'red',
47721
+ radius: 7,
47722
+ },
47723
+ drawSourceMarker: false,
47724
+ sourceMarkerOptions: {
47725
+ stroke: false,
47726
+ fillOpacity: 1,
47727
+ fillColor: '#333',
47728
+ radius: 5,
47729
+ },
47730
+ },
47731
+ /**
47732
+ * The data opject needs at least following properties:
47733
+ * - latlng : L.LatLng
47734
+ * - degree : float
47735
+ * - distance: float
47736
+ */
47737
+ initialize: function (data, options) {
47738
+ L.Util.setOptions(this, options);
47739
+ this.setData(data);
47740
+ },
47741
+ onAdd: function (map) {
47742
+ this._map = map;
47743
+ this.redraw();
47744
+ // add a viewreset event listener for updating layer's position
47745
+ map.on('viewreset', this._reset, this);
47746
+ },
47747
+ onRemove: function () {
47748
+ // remove layer's DOM elements and listeners
47749
+ for (const i in this._layers) {
47750
+ if (this._layers.hasOwnProperty(i)) {
47751
+ this._map.removeLayer(this._layers[i]);
47752
+ }
47753
+ }
47754
+ if (typeof this._sourceMarker !== 'undefined') {
47755
+ this._map.removeLayer(this._sourceMarker);
47756
+ }
47757
+ this._map.off('viewreset', this._reset, this);
47758
+ },
47759
+ // draw
47760
+ redraw: function () {
47761
+ // only draw when on map
47762
+ if (!this._map) {
47763
+ return;
47764
+ }
47765
+ this._layers = {};
47766
+ // bind popup to the whole feature group
47767
+ if (typeof this.options.popupContent === 'function') {
47768
+ this.bindPopup(this.options.popupContent(this._data));
47769
+ }
47770
+ if (this._data.valid && typeof this.options.colorScheme === 'function') {
47771
+ this.options.color = this.options.colorScheme(this._data);
47772
+ }
47773
+ this._data.distance = parseFloat(this._data.distance);
47774
+ // if distance or degree is falsy/Zero then draw a point instead of an arrow
47775
+ if (!this._data.valid || !this._data.distance || !this._data.angle) {
47776
+ let circle;
47777
+ const pathOptions = this._data.valid
47778
+ ? this.options.defaultPointOptions
47779
+ : this.options.invalidPointOptions;
47780
+ if (this.options.distanceUnit.toLowerCase() === 'km') {
47781
+ // use a tenth of the supplied radius (usally used in the circlemarker)
47782
+ circle = L.circle(this._data.latlng, this.options.radius / 10, pathOptions);
47783
+ }
47784
+ else {
47785
+ circle = L.circleMarker(this._data.latlng, pathOptions);
47786
+ }
47787
+ this.addLayer(circle);
47788
+ }
47789
+ else {
47790
+ const theLine = [
47791
+ this._data.latlng,
47792
+ this._calculateEndPoint(this._data.latlng, this._data.distance, this._data.angle),
47793
+ ];
47794
+ const theArrow = this._calculateArrowArray(theLine[1]);
47795
+ const backgroundPathOption = L.Util.setOptions({}, this.pathOptions);
47796
+ backgroundPathOption.opacity = 0;
47797
+ backgroundPathOption.weight = this.options.clickableWidth;
47798
+ const invisibleBackgroundPolyline = new L.Polyline([theLine, theArrow], backgroundPathOption);
47799
+ const polyline = new L.Polyline([theLine, theArrow], this.options);
47800
+ this.addLayer(invisibleBackgroundPolyline);
47801
+ this.addLayer(polyline);
47802
+ // that special case, where a circle has to be drawn on the source of the arrow
47803
+ if (this.options.drawSourceMarker) {
47804
+ if (typeof this._sourceMarker === 'undefined') {
47805
+ // use the same coloar as the arrow does
47806
+ this.options.sourceMarkerOptions.fillColor = this.color;
47807
+ this._sourceMarker = L.circleMarker(this._data.latlng, this.options.sourceMarkerOptions);
47808
+ }
47809
+ else {
47810
+ // there is a chance, that the latlng values have been changed by the setData-function
47811
+ this._sourceMarker.setLatLng(this._data.latlng);
47812
+ }
47813
+ }
47814
+ }
47815
+ },
47816
+ // custom methods
47817
+ // just change the angle of the arrow
47818
+ setAngle: function (angle) {
47819
+ if (isNaN(angle)) {
47820
+ this._data.angle = 0; // undefined direction.
47821
+ }
47822
+ else {
47823
+ if (this.options.isWindDegree) {
47824
+ this._data.angle = angle - 180;
47825
+ if (this.options.distanceUnit.toLowerCase() === 'px') {
47826
+ this._data.angle -= 90;
47827
+ }
47828
+ }
47829
+ else {
47830
+ this._data.angle = angle;
47831
+ }
47832
+ }
47833
+ this.redraw();
47834
+ },
47835
+ // just change the length of the arrow
47836
+ setDistance: function (distance) {
47837
+ if (isNaN(distance)) {
47838
+ this._data.distance = 0;
47839
+ }
47840
+ else {
47841
+ this._data.distance = parseFloat(distance);
47842
+ }
47843
+ this.redraw();
47844
+ },
47845
+ // use this method to update the whole dataset that corresponds to the arrow
47846
+ setData: function (data) {
47847
+ this._data = data;
47848
+ if (this.options.validator(this._data)) {
47849
+ this._data.valid = true;
47850
+ this.setAngle(data.degree);
47851
+ }
47852
+ else {
47853
+ this._data.valid = false;
47854
+ this._data.distance = NaN;
47855
+ this._data.degree = NaN;
47856
+ }
47857
+ },
47858
+ // private methods
47859
+ // When using Screen Pixels as unit, the arrows have to be
47860
+ // recalculated after the zoom level has changed
47861
+ _reset: function () {
47862
+ if (this.options.distanceUnit.toLowerCase() === 'px') {
47863
+ this.redraw();
47864
+ }
47865
+ },
47866
+ _calculateEndPoint: function (latlng, dist, degree) {
47867
+ /*
47868
+ * http://www.codeguru.com/cpp/cpp/algorithms/article.php/c5115/Geographic-Distance-and-Azimuth-Calculations.htm
47869
+ */
47870
+ // don't use this._data here.
47871
+ // this function is also used to find the points of the arrow
47872
+ let distance = dist * this.options.stretchFactor, d2r = Math.PI / 180, // degree 2 radius
47873
+ r2d = 180 / Math.PI;
47874
+ if (this.options.distanceUnit.toLowerCase() === 'km') {
47875
+ const R = 6378.137, // earth radius in kmeters
47876
+ bearing = degree * d2r;
47877
+ distance = distance / R;
47878
+ const a = Math.acos(Math.cos(distance) * Math.cos((90 - latlng.lat) * d2r) +
47879
+ Math.sin((90 - latlng.lat) * d2r) *
47880
+ Math.sin(distance) *
47881
+ Math.cos(bearing));
47882
+ const B = Math.asin((Math.sin(distance) * Math.sin(bearing)) / Math.sin(a));
47883
+ return new L.LatLng(90 - a * r2d, B * r2d + latlng.lng);
47884
+ }
47885
+ else if (this.options.distanceUnit.toLowerCase() === 'px') {
47886
+ const sourcePoint = this._map.latLngToLayerPoint(latlng);
47887
+ const rad = degree * d2r;
47888
+ const vector = L.point(Math.cos(rad) * distance, Math.sin(rad) * distance);
47889
+ const targetPoint = sourcePoint.add(vector);
47890
+ return this._map.layerPointToLatLng(targetPoint);
47891
+ }
47892
+ else {
47893
+ throw Error('calculate end point undefined for distanceUnit: ' +
47894
+ this.options.distanceUnit);
47895
+ }
47896
+ },
47897
+ _calculateArrowArray: function (latlng) {
47898
+ // calculates the Array for the arrow
47899
+ // latlng is the position, where the arrow is added
47900
+ const degree = this._data.angle;
47901
+ if (latlng.length !== undefined) {
47902
+ latlng = new L.LatLng(latlng);
47903
+ }
47904
+ const firstEdge = this._calculateEndPoint(latlng, this.options.arrowheadLength, degree - this.options.arrowheadDegree);
47905
+ const arr = [
47906
+ firstEdge,
47907
+ latlng,
47908
+ this._calculateEndPoint(latlng, this.options.arrowheadLength, degree + this.options.arrowheadDegree),
47909
+ ];
47910
+ if (this.options.arrowheadClosingLine) {
47911
+ arr.push(firstEdge);
47912
+ }
47913
+ return arr;
47914
+ },
47915
+ });
47916
+ return Arrow;
47917
+ }, window);
47918
+
47919
+ } (leafletArrows$2));
47920
+ return leafletArrows$2.exports;
47921
+ }
47922
+
47923
+ var leafletArrowsExports = requireLeafletArrows();
47924
+ var leafletArrows = /*@__PURE__*/getDefaultExportFromCjs(leafletArrowsExports);
47925
+
47926
+ var leafletArrows$1 = /*#__PURE__*/_mergeNamespaces({
47927
+ __proto__: null,
47928
+ default: leafletArrows
47929
+ }, [leafletArrowsExports]);
47930
+
46435
47931
  exports.Accordion = Accordion;
46436
47932
  exports.AlertDialog = alertDialog;
46437
47933
  exports.AlertStore = AlertStore;
@@ -46469,6 +47965,7 @@ exports.RootStore = RootStore;
46469
47965
  exports.Select = FormSelect;
46470
47966
  exports.StoreContext = StoreContext;
46471
47967
  exports.Tabs = Tabs;
47968
+ exports.TangramLayer = TangramLayer;
46472
47969
  exports.TextField = TextField;
46473
47970
  exports.UploadButton = UploadButton;
46474
47971
  exports._testApiKeys = _testApiKeys;