"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),n=require("react"),j=require("d3");function g(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const p=g(j);class m extends n.Component{constructor(t){super(t),this.state={},this.divRef=n.createRef(),this.createProjection=this.createProjection.bind(this)}createProjection(){const{editing:t,height:e,width:o,scale:r=200,center:s=[0,0],projectionName:a}=this.props,c=p[a]().fitSize([o,e]).scale(r).center(s).translate([o/2,e/2]);return{path:p.geoPath().projection(c),projection:c}}componentDidMount(){const{svg:t}=this.props,{path:e,projection:o}=this.createProjection();this.setState({path:e,projection:o})}componentDidUpdate(t,e,o){if(t.height!==this.props.height||t.width!==this.props.width||t.projectionName!==this.props.projectionName){const{path:r,projection:s}=this.createProjection();this.setState({path:r,projection:s})}}render(){const{editing:t,backgroundColor:e,height:o,width:r,scale:s=190,center:a=[0,0],initialPosition:c,settings:h}=this.props,d=n.Children.toArray(this.props.children);return u.jsx("div",{className:"projected",style:{margin:"auto",backgroundColor:e,height:`${o}px`,width:"100%"},children:n.Children.map(d,l=>n.cloneElement(l,{...this.state,initialPosition:c,editing:t,height:o,width:r,settings:h,projection:this.state.projection}))})}}exports.default=m;
