"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),a=require("react"),A=require("react-redux"),s=require("../utils/parseUtils.js"),B=require("./Map.js"),O=require("./BaseLayer.js"),U=require("./DataLayer.js"),W=require("./LatLongLayer.js"),G=require("./ZoomControl.js"),H=require("./ProjectedContainer.js"),K=require("./Legends.js"),Q=require("./FlowLayer.js"),X=L=>{const{unique:c,editing:r,"data-identifier":S,"data-group":d,"data-layers":g="[]","data-height":j=400,"data-width":q=1e3,"data-back-ground-color":V="#88e8dc","data-map-position":P="{}","data-projection":C="geoMercator","data-zoom-enabled":z=!0,"data-rotation-enabled":R=!1,"data-wait-for-filters":l="false",intl:m}=L,[w,F]=a.useState(s.parse(P,r),[]),[i,p]=a.useState(s.parse(g),[]),Z=a.useRef(null),u=a.useRef(null),[b,M]=a.useState(null),[h,E]=a.useState(null),[T,v]=a.useState(null);a.useEffect(()=>{const e=s.parse(P,r);s.compareJsonProps(w,e)||F(e)},[P]),a.useEffect(()=>{const e=s.parse(g);s.compareJsonProps(i,e)||p(e)},[g]);const k=e=>{const o=i.slice(),t=o.find(f=>f.id==e);t&&(t.visible=!t.visible),p(o)},I=e=>{const o=i.slice(),t=o.find(f=>f.id==e);t&&(t.patternsVisible=t.patternsVisible==null?!1:!t.patternsVisible),p(o)},D=e=>{v(e)},J=e=>{const o=i.slice(),t=o.find(f=>f.id==e);t&&(t.colorLayerVisible=t.colorLayerVisible==null?!1:!t.colorLayerVisible),p(o)},[N,_]=a.useState(!1),x=a.useRef(0);i.length;const y=()=>{x.current+=1,x.current===i.length&&_(!0)};return n.jsx("div",{ref:Z,className:"d3map-container",children:n.jsxs(H.default,{backgroundColor:s.decode(V),height:j,width:q,projectionName:C,editing:r,initialPosition:w,children:[n.jsx(B.default,{rotationEnabled:s.parse(R,r),children:i.map((e,o)=>{if(e.type==="base")return n.jsx(O.default,{minLabelZoomVisible:e.minLabelZoomVisible,onReady:y,transform:b,intl:m,zoom:u,unique:c,...e},o);if(e.type==="data")return n.jsx(U.default,{minLabelZoomVisible:e.minLabelZoomVisible,editing:r,onLayerCreated:t=>{},onReady:y,transform:b,intl:m,group:d,zoom:u,unique:c,...e,settings:L.wordress,togglePatterns:I,initialPosition:w,waitForFilters:l=="true"||l==!0},o);if(e.type==="flow")return n.jsx(Q.default,{onReady:y,transform:b,intl:m,group:d,zoom:u,unique:c,...e,waitForFilters:l=="true"||l==!0},o);if(e.type==="dataPoints")return n.jsx(W.default,{onReady:y,onZoomToPoint:D,selectedItem:h,transform:b,intl:m,group:d,zoom:u,unique:c,...e,waitForFilters:l=="true"||l==!0},o)})}),n.jsx(K.default,{selectedItem:h,d2Click:e=>E(e),patternsData:null,layers:i,group:d,onItemClick:k,toggleColorLayer:J}),n.jsx(G.default,{readyToZoom:N,selectedPoint:T,rootationEmabled:s.parse(R,r),zoomEnabled:s.parse(z,r),onZoomed:M,width:q,height:j,ref:u,group:d,identifier:S,editing:r})]})})},Y=(L,c)=>({}),$={},ee=A.connect(Y,$)(X);exports.default=ee;
