import React, { forwardRef } from 'react';
import Navigation from "./Navigation";

// 内库使用-start
import LocaleUtil from "./../../../../../utils/LocaleUtil";
// 内库使用-end

/* 测试使用-start
import { LocaleUtil } from 'seedsui-react'
测试使用-end */

// 当前位置
function Current(_ref, ref) {
  var map = _ref.map,
    value = _ref.value,
    readOnly = _ref.readOnly,
    onChange = _ref.onChange;
  return /*#__PURE__*/React.createElement("div", {
    className: "map-nearbyControl-item",
    onClick: function onClick(e) {
      var _map$panTo;
      map === null || map === void 0 || (_map$panTo = map.panTo) === null || _map$panTo === void 0 || _map$panTo.call(map, {
        longitude: value.longitude,
        latitude: value.latitude,
        type: value.type
      });
      if (!readOnly) {
        onChange && onChange(value);
      }
    },
    ref: ref
  }, /*#__PURE__*/React.createElement("div", {
    className: "map-nearbyControl-item-content"
  }, /*#__PURE__*/React.createElement("div", {
    className: "map-nearbyControl-item-content-title"
  }, /*#__PURE__*/React.createElement("div", {
    className: "flex-1"
  }, (value === null || value === void 0 ? void 0 : value.name) || LocaleUtil.locale('当前位置', 'SeedsUI_current_location')), /*#__PURE__*/React.createElement(Navigation, {
    map: map,
    type: value === null || value === void 0 ? void 0 : value.type,
    longitude: value === null || value === void 0 ? void 0 : value.longitude,
    latitude: value === null || value === void 0 ? void 0 : value.latitude,
    address: value === null || value === void 0 ? void 0 : value.address
  })), /*#__PURE__*/React.createElement("div", {
    className: "map-nearbyControl-item-content-description"
  }, /*#__PURE__*/React.createElement("div", {
    className: "flex-1"
  }, (value === null || value === void 0 ? void 0 : value.address) || ''))));
}
export default /*#__PURE__*/forwardRef(Current);