import '@das-fed/ui/packages/components/map/style.css';
import { ref as S, defineComponent as Ae, shallowRef as H, computed as Se, onMounted as Oe, createElementBlock as Te, openBlock as $e, normalizeStyle as je, createElementVNode as W, withDirectives as Z, createVNode as de, withKeys as Ee, unref as z, h as Qt, render as ea, isRef as ta, vShow as Ke, withCtx as aa, createTextVNode as oa, toDisplayString as ra } from "vue";
import { withInstall as Le } from "@das-fed/utils/with-install/index";
import { ElAutocomplete as Pe, ElLoadingDirective as ke } from "element-plus/es";
import "element-plus/es/components/base/style/css";
import "element-plus/es/components/loading/style/css";
import "element-plus/es/components/autocomplete/style/css";
import { t as k, setI18nRule as na } from "@das-fed/web/packages/i18n/index";
import { vDasTooltip as Re } from "@das-fed/ui/packages/components/text-tooltip/index";
import { DasMessage as N } from "@das-fed/ui/packages/components/message/index";
import { createService as it } from "@das-fed/utils/create-api-service";
import { DasButton as la } from "@das-fed/ui/packages/components/button/index";
const Q = (e) => {
  if (e)
    return typeof e == "string" && hasCssUnit(e) ? e : e + "px";
}, st = ({ MapGL: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: d, addressInfo: v }, b) => {
  const C = S();
  let x;
  const R = (O, g, p, w) => {
    C.value = p, w && (x = w);
    const $ = document.createElement("script");
    if ($.src = `${location.protocol}//webapi.amap.com/maps?v=1.4.15&key=${O}&plugin=AMap.CitySearch&callback=onLoad`, g) {
      const s = document.createElement("script");
      s.innerHTML = `window._AMapSecurityConfig = {
        securityJsCode: "${g}",
      }`, document.head.appendChild(s);
    }
    document.head.appendChild($), window.onLoad = () => {
      E();
    };
  }, E = () => {
    var O, g;
    if (e.value = AMap, console.log("AMap", e.value), typeof e.value > "u") {
      console.log("AK值无效");
      return;
    }
    try {
      const p = ((O = C.value) == null ? void 0 : O.mapOpt) ?? {};
      t.value = new AMap.Map("map", {
        zoom: 15,
        ...p
      });
    } catch {
      r.value = !1, N.error(k("thirdPartyMapErrorRetry"));
    }
    AMap.plugin(["AMap.ToolBar"], () => {
      t.value.addControl(
        // @ts-ignore
        new AMap.ToolBar({
          // 简易缩放模式，默认为 false
          liteStyle: !0
        })
      );
    }), c(), (g = C.value) != null && g.clickStream || i(), r.value = !1, x && x();
  }, i = () => {
    t.value.on("click", (O) => {
      a.value && t.value.remove(a.value), o.value = [O.lnglat.getLng(), O.lnglat.getLat()], h(o.value, !0).then(() => {
        a.value = new AMap.Marker({
          position: o.value,
          title: n.value
        }), t.value.add(a.value), t.value.setCenter(o.value), console.log("当前的地址坐标信息：", o.value, n.value);
      });
    });
  }, c = async () => {
    !n.value && !o.value.length && B(), n.value && o.value.length > 0 ? await h(o.value) : n.value ? await A(n.value) : o.value.length > 0 && await h(o.value, !0), n.value && _(n.value, (O, g) => {
      if (g && g.length) {
        const p = g.find(
          (w) => w.value === n.value || w.info.name === n.value
        );
        p ? v.value = p.info : v.value = {
          district: "",
          address: "",
          name: n.value
        };
      }
    }), a.value = new AMap.Marker({
      position: o.value,
      title: n.value
    }), t.value.add(a.value), o.value.length && t.value.setCenter(o.value);
  }, h = (O, g = !1) => {
    const p = O.join(",");
    return new Promise((w, $) => {
      AMap.service("AMap.Geocoder", () => {
        new AMap.Geocoder({
          city: "全国"
        }).getAddress(p, (f, m) => {
          var M, y;
          if (console.log(`${p}逆地址解析=======`, f, m), f === "complete" && (m != null && m.regeocode)) {
            if (g) {
              const { province: T = "", city: G = "", district: L = "", township: ne = "" } = m.regeocode.addressComponent;
              n.value = m.regeocode.formattedAddress ?? "", v.value = {
                district: T + G + L,
                address: ne,
                name: n.value.replace(T, "").replace(G, "").replace(L, "").replace(ne, "")
              };
            }
            d.value = ((y = (M = m.regeocode) == null ? void 0 : M.addressComponent) == null ? void 0 : y.adcode) ?? "", w(m.regeocode);
          } else
            N.error(k("thirdPartyMapErrorRetry")), $();
        });
      });
    });
  }, A = (O) => new Promise((g, p) => {
    AMap.service("AMap.Geocoder", () => {
      new AMap.Geocoder({
        city: "全国"
      }).getLocation(O, ($, s) => {
        var f, m;
        if (console.log(`${O}地址解析出经纬度=======`, $, s), $ === "complete" && ((f = s.geocodes) != null && f.length)) {
          const M = s.geocodes[0].location;
          o.value[0] = M.lng, o.value[1] = M.lat, d.value = ((m = s.geocodes[0]) == null ? void 0 : m.adcode) ?? "", g(s.geocodes[0].location);
        } else
          N.error(k("thirdPartyMapErrorRetry")), p();
      });
    });
  }), B = () => {
    new AMap.CitySearch().getLocalCity((g, p) => {
      if (console.log("您当前所在城市：", g, p), g === "complete" && p.info === "OK") {
        if (p && p.city && p.bounds) {
          const w = p.bounds;
          t.value.setBounds(w);
        }
      } else
        N.error(k("thirdPartyMapErrorRetry"));
    });
  }, _ = (O, g) => {
    if (u.value.activated = !0, !O) {
      l.value = [], g([]);
      return;
    }
    AMap.plugin("AMap.Autocomplete", function() {
      var p = {
        city: "全国"
      }, w = new AMap.Autocomplete(p);
      w.search(O, function($, s) {
        if (l.value = [], !s || !s.tips) return g([]);
        let f = s.tips;
        if (!f || !f.length) return g([]);
        f = f.map((m) => {
          const { district: M = "", address: y = "", name: T = "", location: G = "" } = m;
          return {
            value: M + y + T,
            point: G,
            info: {
              district: M,
              address: y,
              name: T
            }
          };
        }), l.value = f.length > 5 ? f.slice(0, 5) : f, g(l.value, f);
      });
    });
  };
  return {
    getLocationByInputSearch: _,
    handleSelectAddress: (O) => {
      n.value = O.value, v.value = O.info, A(O.value).then((g) => {
        o.value = [g.lng, g.lat], a.value && t.value.remove(a.value), a.value = new AMap.Marker({
          position: o.value,
          title: n.value
          // 鼠标移上去时显示的内容
        }), t.value.add(a.value), t.value.setCenter(o.value);
      });
    },
    getLocationParse: async () => {
      var O;
      if (!l.value.length) return N.error(k("thirdPartyMapErrorRetry"));
      if (console.log("检索列表：", l.value), n.value = l.value[0].value, !((O = l.value[0]) != null && O.point))
        return N.error(k("thirdPartyMapErrorRetry"));
      o.value = [l.value[0].point.lng, l.value[0].point.lat], v.value = l.value[0].info, await h(o.value), a.value = new AMap.Marker({
        position: o.value,
        title: n.value
        // 鼠标移上去时显示的内容
      }), t.value.add(a.value), t.value.setCenter(o.value), u.value.activated = !1;
    },
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: d.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: R
  };
}, dt = "v1", ua = it(`/api/tool/map/${dt}`), ca = it(`/api/system-config/${dt}`), ia = ua.get("/regeo"), sa = ca.get("/platform/map/list"), Ge = async (e) => {
  var n, o, d, v, b;
  const t = ["", "baidu", "gaode", "google"];
  let a = null, [r, u] = await sa().run();
  if (r)
    return [r, a];
  const l = u.filter((C) => C.enable) || [];
  if ((l == null ? void 0 : l.length) == 0) return [null, a];
  if ((l == null ? void 0 : l.length) > 1) {
    const C = l.filter((x) => t[x.serviceProvider] == e);
    a = {
      mapType: e,
      akVal: (n = C[0]) == null ? void 0 : n.akValue,
      secretK: (o = C[0]) == null ? void 0 : o.securityKey
    };
  } else (l == null ? void 0 : l.length) == 1 && (a = {
    mapType: t[(d = l[0]) == null ? void 0 : d.serviceProvider],
    akVal: (v = l[0]) == null ? void 0 : v.akValue,
    secretK: (b = l[0]) == null ? void 0 : b.securityKey
  });
  return [null, a];
}, da = { class: "search-input" }, fa = { id: "map" }, va = /* @__PURE__ */ Ae({
  __name: "gaodeMap",
  props: {
    akValue: {},
    secretKey: {},
    defaultAddress: {},
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    dev: { type: Boolean }
  },
  setup(e, { expose: t }) {
    const a = e, r = H(null), u = H(null), l = H(null), n = S(!0), o = S(null), d = S([]), v = Se(() => ({
      width: a.width ? Q(a.width) : "100%",
      height: a.height ? Q(a.height) : "100%"
    })), b = S(""), C = S([]), x = S(""), R = S(), { getLocationByInputSearch: E, handleSelectAddress: i, getLocationParse: c, getMapInfo: h, loadJavascript: A } = st(
      {
        MapGL: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: d,
        innerInput: b,
        innerPoint: C,
        adCode: x,
        addressInfo: R
      }
    ), B = async () => {
      const _ = {
        akValue: a.akValue ?? "",
        secretKey: a.secretKey ?? ""
      };
      {
        const [j, D] = await Ge("gaode");
        j && N.error(k("获取地图配置信息失败")), !j && !D && N.error(k("暂未配置地图")), D && (_.akValue || (_.akValue = D.akVal), _.secretKey || (_.secretKey = D.secretK));
      }
      return _;
    };
    return Oe(async () => {
      a.defaultLongitude && a.defaultLatitude && (C.value = [a.defaultLongitude, a.defaultLatitude]), b.value = a.defaultAddress ?? "";
      const { akValue: _, secretKey: j } = await B();
      A(_, j);
    }), t({
      /** 获取经纬度、地址、行政区划编码 */
      getMapInfo: h
    }), (_, j) => {
      const D = Pe, U = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", da, [
            Z(de(D, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": j[0] || (j[0] = (O) => b.value = O),
              "fetch-suggestions": z(E),
              placeholder: z(k)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: z(i),
              onKeyup: Ee(z(c), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [z(Re)]
            ])
          ]),
          Z(W(
            "div",
            fa,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), Be = (e, t) => {
  const a = e.__vccOpts || e;
  for (const [r, u] of t)
    a[r] = u;
  return a;
}, ga = /* @__PURE__ */ Be(va, [["__scopeId", "data-v-95b9bcca"]]), ft = ({ BMap: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: d, addressInfo: v }, b) => {
  const C = S();
  let x;
  const R = (g, p, w) => {
    C.value = p, w && (x = w);
    const $ = document.createElement("script");
    $.src = `${location.protocol}//api.map.baidu.com/getscript?type=webgl&v=3.0&ak=${g}&services=&t=20200109192240`, $.onload = () => {
      E();
    }, document.body.append($);
  }, E = () => {
    var p, w;
    e.value = window.BMapGL;
    try {
      t.value = new e.value.Map("map", ((p = C.value) == null ? void 0 : p.mapOpt) ?? {});
    } catch {
      r.value = !1, N.error(k("thirdPartyMapErrorRetry"));
    }
    const g = new e.value.NavigationControl({
      // @ts-ignore
      anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
      // @ts-ignore
      type: BMAP_NAVIGATION_CONTROL_ZOOM
    });
    t.value.addControl(g), t.value.enableScrollWheelZoom(!0), c(), (w = C.value) != null && w.clickStream || h(), r.value = !1, x && x();
  }, i = (g) => new Promise((p, w) => {
    new e.value.Geocoder().getPoint(g, (s) => {
      console.log(`${g}地址解析=======`, s), !s || JSON.stringify(s) == "{}" ? (N.error(k("thirdPartyMapErrorRetry")), w()) : (console.log("当前的地址信息：", s), o.value[0] = s.lng, o.value[1] = s.lat, p(s));
    });
  }), c = async () => {
    !n.value && !o.value.length && B(), n.value && o.value.length > 0 ? await A(o.value[0], o.value[1]) : n.value ? await i(n.value) : o.value.length > 0 && await A(o.value[0], o.value[1], !0), n.value && _(n.value, (g, p) => {
      if (p && p.length) {
        const w = p.find(
          ($) => $.value === n.value || $.info.name === n.value
        );
        w ? v.value = w.info : v.value = {
          province: "",
          city: "",
          address: "",
          name: n.value
        };
      }
    });
  }, h = () => {
    t.value.addEventListener("click", (g) => {
      a.value && t.value.clearOverlays();
      const p = g.latlng.lng, w = g.latlng.lat;
      o.value = [p, w], A(p, w, !0);
    });
  }, A = (g, p, w = !1, $ = "default") => new Promise((s, f) => {
    const m = new e.value.Geocoder(), M = new e.value.Point(g, p);
    m.getLocation(M, (y) => {
      if (console.log("逆地址解析=======", y), w) {
        n.value = y.address;
        const { province: T = "", city: G = "", district: L = "" } = y.addressComponents;
        v.value = {
          province: T,
          city: G,
          address: G + L,
          name: y.address.replace(T, "").replace(G, "").replace(L, "")
        };
      }
      y && y.address ? ($ == "default" && (o.value[0] = y.point.lng, o.value[1] = y.point.lat, console.log("当前的地址坐标信息：", y, o.value), a.value && t.value.clearOverlays(), a.value = new e.value.Marker(M, { title: n.value }), t.value.addOverlay(a.value), t.value.centerAndZoom(M, 16)), U(g, p), s(y.address)) : (N.error(k("thirdPartyMapErrorRetry")), f());
    });
  }), B = () => {
    new e.value.LocalCity().get((p) => {
      const w = p.center;
      if (console.log("您当前所在城市：", p.center), !p.center) return N.error(k("thirdPartyMapErrorRetry"));
      a.value && t.value.clearOverlays();
      const $ = new e.value.Point(w.lng, w.lat);
      t.value.centerAndZoom($, 13);
    });
  }, _ = (g, p) => {
    if (u.value.activated = !0, l.value = [], !g) {
      p([]);
      return;
    }
    new e.value.LocalSearch(t.value, {
      onSearchComplete: ($) => {
        let s = [];
        for (let f = 0; f < $.getCurrentNumPois(); f++)
          s.push($.getPoi(f));
        if (!s.length) return p([]);
        s = s.map((f) => {
          const { address: m = "", title: M = "", province: y = "", city: T = "", point: G = {} } = f;
          return {
            value: m == M ? m : m + M,
            point: G,
            info: {
              province: y,
              city: T,
              address: m,
              name: M
            }
          };
        }), l.value = s.length > 5 ? s.slice(0, 5) : s, p(l.value, s);
      }
    }).search(g);
  }, j = (g) => {
    var p, w;
    n.value = g.value, v.value = g.info, A((p = g.point) == null ? void 0 : p.lng, (w = g.point) == null ? void 0 : w.lat);
  }, D = () => {
    var g;
    if (!l.value.length) return N.error(k("thirdPartyMapErrorRetry"));
    if (console.log("检索列表：", l.value), n.value = l.value[0].value, v.value = l.value[0].info, !((g = l.value[0]) != null && g.point))
      return N.error(k("thirdPartyMapErrorRetry"));
    o.value = [l.value[0].point.lng, l.value[0].point.lat], A(o.value[0], o.value[1]), u.value.activated = !1;
  }, U = async (g, p) => {
    const [w, $] = await ia().run({ longitude: g, latitude: p });
    w || (d.value = $.areaCode);
  };
  return {
    getLocationByInputSearch: _,
    handleSelectAddress: j,
    getLocationParse: D,
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: d.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: R
  };
}, pa = { class: "search-input" }, ha = { id: "map" }, ya = /* @__PURE__ */ Ae({
  __name: "baiduMap",
  props: {
    akValue: {},
    secretKey: {},
    defaultAddress: {},
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    dev: { type: Boolean }
  },
  setup(e, { expose: t }) {
    const a = e, r = H(null), u = H(null), l = H(null), n = S(!0), o = S(null), d = S([]), v = Se(() => ({
      width: a.width ? Q(a.width) : "100%",
      height: a.height ? Q(a.height) : "100%"
    })), b = S(""), C = S([]), x = S(""), R = S(), { getLocationByInputSearch: E, handleSelectAddress: i, getLocationParse: c, getMapInfo: h, loadJavascript: A } = ft(
      {
        BMap: r,
        map: u,
        marker: l,
        mapLoading: n,
        $autocomplete: o,
        searchResultList: d,
        innerInput: b,
        innerPoint: C,
        adCode: x,
        addressInfo: R
      }
    ), B = async () => {
      if (a.akValue) return a.akValue;
      const [_, j] = await Ge("baidu");
      return _ ? (N.error(k("获取地图配置信息失败")), "") : !_ && !j ? (N.error(k("暂未配置地图")), "") : j.akVal;
    };
    return Oe(async () => {
      a.defaultLongitude && a.defaultLatitude && (C.value = [a.defaultLongitude, a.defaultLatitude]), b.value = a.defaultAddress ?? "";
      const _ = await B();
      A(_);
    }), t({
      // 获取经纬度、地址、行政区划信息
      getMapInfo: h
    }), (_, j) => {
      const D = Pe, U = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(v.value)
        },
        [
          W("div", pa, [
            Z(de(D, {
              ref_key: "$autocomplete",
              ref: o,
              modelValue: b.value,
              "onUpdate:modelValue": j[0] || (j[0] = (O) => b.value = O),
              "fetch-suggestions": z(E),
              placeholder: z(k)("请输入位置"),
              style: { width: "100%" },
              "trigger-on-focus": !1,
              onSelect: z(i),
              onKeyup: Ee(z(c), ["enter", "native"]),
              clearable: ""
            }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
              [z(Re)]
            ])
          ]),
          Z(W(
            "div",
            ha,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              U,
              n.value,
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), ma = /* @__PURE__ */ Be(ya, [["__scopeId", "data-v-5444de43"]]);
function ba() {
  this.__data__ = [], this.size = 0;
}
function ge(e, t) {
  return e === t || e !== e && t !== t;
}
function pe(e, t) {
  for (var a = e.length; a--; )
    if (ge(e[a][0], t))
      return a;
  return -1;
}
var _a = Array.prototype, wa = _a.splice;
function xa(e) {
  var t = this.__data__, a = pe(t, e);
  if (a < 0)
    return !1;
  var r = t.length - 1;
  return a == r ? t.pop() : wa.call(t, a, 1), --this.size, !0;
}
function Ma(e) {
  var t = this.__data__, a = pe(t, e);
  return a < 0 ? void 0 : t[a][1];
}
function Ca(e) {
  return pe(this.__data__, e) > -1;
}
function Aa(e, t) {
  var a = this.__data__, r = pe(a, e);
  return r < 0 ? (++this.size, a.push([e, t])) : a[r][1] = t, this;
}
function I(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
I.prototype.clear = ba;
I.prototype.delete = xa;
I.prototype.get = Ma;
I.prototype.has = Ca;
I.prototype.set = Aa;
function Sa() {
  this.__data__ = new I(), this.size = 0;
}
function Oa(e) {
  var t = this.__data__, a = t.delete(e);
  return this.size = t.size, a;
}
function Ta(e) {
  return this.__data__.get(e);
}
function $a(e) {
  return this.__data__.has(e);
}
var vt = typeof global == "object" && global && global.Object === Object && global, ja = typeof self == "object" && self && self.Object === Object && self, te = vt || ja || Function("return this")(), ee = te.Symbol, gt = Object.prototype, Ea = gt.hasOwnProperty, La = gt.toString, ue = ee ? ee.toStringTag : void 0;
function Pa(e) {
  var t = Ea.call(e, ue), a = e[ue];
  try {
    e[ue] = void 0;
    var r = !0;
  } catch {
  }
  var u = La.call(e);
  return r && (t ? e[ue] = a : delete e[ue]), u;
}
var ka = Object.prototype, Ra = ka.toString;
function Ga(e) {
  return Ra.call(e);
}
var Ba = "[object Null]", Da = "[object Undefined]", Fe = ee ? ee.toStringTag : void 0;
function se(e) {
  return e == null ? e === void 0 ? Da : Ba : Fe && Fe in Object(e) ? Pa(e) : Ga(e);
}
function Y(e) {
  var t = typeof e;
  return e != null && (t == "object" || t == "function");
}
var za = "[object AsyncFunction]", Na = "[object Function]", Ua = "[object GeneratorFunction]", Va = "[object Proxy]";
function De(e) {
  if (!Y(e))
    return !1;
  var t = se(e);
  return t == Na || t == Ua || t == za || t == Va;
}
var me = te["__core-js_shared__"], He = function() {
  var e = /[^.]+$/.exec(me && me.keys && me.keys.IE_PROTO || "");
  return e ? "Symbol(src)_1." + e : "";
}();
function Ka(e) {
  return !!He && He in e;
}
var Fa = Function.prototype, Ha = Fa.toString;
function Ia(e) {
  if (e != null) {
    try {
      return Ha.call(e);
    } catch {
    }
    try {
      return e + "";
    } catch {
    }
  }
  return "";
}
var Ja = /[\\^$.*+?()[\]{}|]/g, Za = /^\[object .+?Constructor\]$/, Wa = Function.prototype, qa = Object.prototype, Ya = Wa.toString, Xa = qa.hasOwnProperty, Qa = RegExp(
  "^" + Ya.call(Xa).replace(Ja, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function eo(e) {
  if (!Y(e) || Ka(e))
    return !1;
  var t = De(e) ? Qa : Za;
  return t.test(Ia(e));
}
function to(e, t) {
  return e == null ? void 0 : e[t];
}
function ze(e, t) {
  var a = to(e, t);
  return eo(a) ? a : void 0;
}
var pt = ze(te, "Map"), ie = ze(Object, "create");
function ao() {
  this.__data__ = ie ? ie(null) : {}, this.size = 0;
}
function oo(e) {
  var t = this.has(e) && delete this.__data__[e];
  return this.size -= t ? 1 : 0, t;
}
var ro = "__lodash_hash_undefined__", no = Object.prototype, lo = no.hasOwnProperty;
function uo(e) {
  var t = this.__data__;
  if (ie) {
    var a = t[e];
    return a === ro ? void 0 : a;
  }
  return lo.call(t, e) ? t[e] : void 0;
}
var co = Object.prototype, io = co.hasOwnProperty;
function so(e) {
  var t = this.__data__;
  return ie ? t[e] !== void 0 : io.call(t, e);
}
var fo = "__lodash_hash_undefined__";
function vo(e, t) {
  var a = this.__data__;
  return this.size += this.has(e) ? 0 : 1, a[e] = ie && t === void 0 ? fo : t, this;
}
function q(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
q.prototype.clear = ao;
q.prototype.delete = oo;
q.prototype.get = uo;
q.prototype.has = so;
q.prototype.set = vo;
function go() {
  this.size = 0, this.__data__ = {
    hash: new q(),
    map: new (pt || I)(),
    string: new q()
  };
}
function po(e) {
  var t = typeof e;
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
function he(e, t) {
  var a = e.__data__;
  return po(t) ? a[typeof t == "string" ? "string" : "hash"] : a.map;
}
function ho(e) {
  var t = he(this, e).delete(e);
  return this.size -= t ? 1 : 0, t;
}
function yo(e) {
  return he(this, e).get(e);
}
function mo(e) {
  return he(this, e).has(e);
}
function bo(e, t) {
  var a = he(this, e), r = a.size;
  return a.set(e, t), this.size += a.size == r ? 0 : 1, this;
}
function ae(e) {
  var t = -1, a = e == null ? 0 : e.length;
  for (this.clear(); ++t < a; ) {
    var r = e[t];
    this.set(r[0], r[1]);
  }
}
ae.prototype.clear = go;
ae.prototype.delete = ho;
ae.prototype.get = yo;
ae.prototype.has = mo;
ae.prototype.set = bo;
var _o = 200;
function wo(e, t) {
  var a = this.__data__;
  if (a instanceof I) {
    var r = a.__data__;
    if (!pt || r.length < _o - 1)
      return r.push([e, t]), this.size = ++a.size, this;
    a = this.__data__ = new ae(r);
  }
  return a.set(e, t), this.size = a.size, this;
}
function oe(e) {
  var t = this.__data__ = new I(e);
  this.size = t.size;
}
oe.prototype.clear = Sa;
oe.prototype.delete = Oa;
oe.prototype.get = Ta;
oe.prototype.has = $a;
oe.prototype.set = wo;
var fe = function() {
  try {
    var e = ze(Object, "defineProperty");
    return e({}, "", {}), e;
  } catch {
  }
}();
function Ne(e, t, a) {
  t == "__proto__" && fe ? fe(e, t, {
    configurable: !0,
    enumerable: !0,
    value: a,
    writable: !0
  }) : e[t] = a;
}
function _e(e, t, a) {
  (a !== void 0 && !ge(e[t], a) || a === void 0 && !(t in e)) && Ne(e, t, a);
}
function xo(e) {
  return function(t, a, r) {
    for (var u = -1, l = Object(t), n = r(t), o = n.length; o--; ) {
      var d = n[++u];
      if (a(l[d], d, l) === !1)
        break;
    }
    return t;
  };
}
var Mo = xo(), ht = typeof exports == "object" && exports && !exports.nodeType && exports, Ie = ht && typeof module == "object" && module && !module.nodeType && module, Co = Ie && Ie.exports === ht, Je = Co ? te.Buffer : void 0;
Je && Je.allocUnsafe;
function Ao(e, t) {
  return e.slice();
}
var Ze = te.Uint8Array;
function So(e) {
  var t = new e.constructor(e.byteLength);
  return new Ze(t).set(new Ze(e)), t;
}
function Oo(e, t) {
  var a = So(e.buffer);
  return new e.constructor(a, e.byteOffset, e.length);
}
function To(e, t) {
  var a = -1, r = e.length;
  for (t || (t = Array(r)); ++a < r; )
    t[a] = e[a];
  return t;
}
var We = Object.create, $o = /* @__PURE__ */ function() {
  function e() {
  }
  return function(t) {
    if (!Y(t))
      return {};
    if (We)
      return We(t);
    e.prototype = t;
    var a = new e();
    return e.prototype = void 0, a;
  };
}();
function jo(e, t) {
  return function(a) {
    return e(t(a));
  };
}
var yt = jo(Object.getPrototypeOf, Object), Eo = Object.prototype;
function mt(e) {
  var t = e && e.constructor, a = typeof t == "function" && t.prototype || Eo;
  return e === a;
}
function Lo(e) {
  return typeof e.constructor == "function" && !mt(e) ? $o(yt(e)) : {};
}
function re(e) {
  return e != null && typeof e == "object";
}
var Po = "[object Arguments]";
function qe(e) {
  return re(e) && se(e) == Po;
}
var bt = Object.prototype, ko = bt.hasOwnProperty, Ro = bt.propertyIsEnumerable, we = qe(/* @__PURE__ */ function() {
  return arguments;
}()) ? qe : function(e) {
  return re(e) && ko.call(e, "callee") && !Ro.call(e, "callee");
}, ve = Array.isArray, Go = 9007199254740991;
function _t(e) {
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Go;
}
function Ue(e) {
  return e != null && _t(e.length) && !De(e);
}
function Bo(e) {
  return re(e) && Ue(e);
}
function Do() {
  return !1;
}
var wt = typeof exports == "object" && exports && !exports.nodeType && exports, Ye = wt && typeof module == "object" && module && !module.nodeType && module, zo = Ye && Ye.exports === wt, Xe = zo ? te.Buffer : void 0, No = Xe ? Xe.isBuffer : void 0, xt = No || Do, Uo = "[object Object]", Vo = Function.prototype, Ko = Object.prototype, Mt = Vo.toString, Fo = Ko.hasOwnProperty, Ho = Mt.call(Object);
function Io(e) {
  if (!re(e) || se(e) != Uo)
    return !1;
  var t = yt(e);
  if (t === null)
    return !0;
  var a = Fo.call(t, "constructor") && t.constructor;
  return typeof a == "function" && a instanceof a && Mt.call(a) == Ho;
}
var Jo = "[object Arguments]", Zo = "[object Array]", Wo = "[object Boolean]", qo = "[object Date]", Yo = "[object Error]", Xo = "[object Function]", Qo = "[object Map]", er = "[object Number]", tr = "[object Object]", ar = "[object RegExp]", or = "[object Set]", rr = "[object String]", nr = "[object WeakMap]", lr = "[object ArrayBuffer]", ur = "[object DataView]", cr = "[object Float32Array]", ir = "[object Float64Array]", sr = "[object Int8Array]", dr = "[object Int16Array]", fr = "[object Int32Array]", vr = "[object Uint8Array]", gr = "[object Uint8ClampedArray]", pr = "[object Uint16Array]", hr = "[object Uint32Array]", P = {};
P[cr] = P[ir] = P[sr] = P[dr] = P[fr] = P[vr] = P[gr] = P[pr] = P[hr] = !0;
P[Jo] = P[Zo] = P[lr] = P[Wo] = P[ur] = P[qo] = P[Yo] = P[Xo] = P[Qo] = P[er] = P[tr] = P[ar] = P[or] = P[rr] = P[nr] = !1;
function yr(e) {
  return re(e) && _t(e.length) && !!P[se(e)];
}
function mr(e) {
  return function(t) {
    return e(t);
  };
}
var Ct = typeof exports == "object" && exports && !exports.nodeType && exports, ce = Ct && typeof module == "object" && module && !module.nodeType && module, br = ce && ce.exports === Ct, be = br && vt.process, Qe = function() {
  try {
    var e = ce && ce.require && ce.require("util").types;
    return e || be && be.binding && be.binding("util");
  } catch {
  }
}(), et = Qe && Qe.isTypedArray, At = et ? mr(et) : yr;
function xe(e, t) {
  if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
    return e[t];
}
var _r = Object.prototype, wr = _r.hasOwnProperty;
function xr(e, t, a) {
  var r = e[t];
  (!(wr.call(e, t) && ge(r, a)) || a === void 0 && !(t in e)) && Ne(e, t, a);
}
function Mr(e, t, a, r) {
  var u = !a;
  a || (a = {});
  for (var l = -1, n = t.length; ++l < n; ) {
    var o = t[l], d = void 0;
    d === void 0 && (d = e[o]), u ? Ne(a, o, d) : xr(a, o, d);
  }
  return a;
}
function Cr(e, t) {
  for (var a = -1, r = Array(e); ++a < e; )
    r[a] = t(a);
  return r;
}
var Ar = 9007199254740991, Sr = /^(?:0|[1-9]\d*)$/;
function St(e, t) {
  var a = typeof e;
  return t = t ?? Ar, !!t && (a == "number" || a != "symbol" && Sr.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function Or(e, t) {
  var a = ve(e), r = !a && we(e), u = !a && !r && xt(e), l = !a && !r && !u && At(e), n = a || r || u || l, o = n ? Cr(e.length, String) : [], d = o.length;
  for (var v in e)
    n && // Safari 9 has enumerable `arguments.length` in strict mode.
    (v == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    u && (v == "offset" || v == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    l && (v == "buffer" || v == "byteLength" || v == "byteOffset") || // Skip index properties.
    St(v, d)) || o.push(v);
  return o;
}
function Tr(e) {
  var t = [];
  if (e != null)
    for (var a in Object(e))
      t.push(a);
  return t;
}
var $r = Object.prototype, jr = $r.hasOwnProperty;
function Er(e) {
  if (!Y(e))
    return Tr(e);
  var t = mt(e), a = [];
  for (var r in e)
    r == "constructor" && (t || !jr.call(e, r)) || a.push(r);
  return a;
}
function Ot(e) {
  return Ue(e) ? Or(e) : Er(e);
}
function Lr(e) {
  return Mr(e, Ot(e));
}
function Pr(e, t, a, r, u, l, n) {
  var o = xe(e, a), d = xe(t, a), v = n.get(d);
  if (v) {
    _e(e, a, v);
    return;
  }
  var b = l ? l(o, d, a + "", e, t, n) : void 0, C = b === void 0;
  if (C) {
    var x = ve(d), R = !x && xt(d), E = !x && !R && At(d);
    b = d, x || R || E ? ve(o) ? b = o : Bo(o) ? b = To(o) : R ? (C = !1, b = Ao(d)) : E ? (C = !1, b = Oo(d)) : b = [] : Io(d) || we(d) ? (b = o, we(o) ? b = Lr(o) : (!Y(o) || De(o)) && (b = Lo(d))) : C = !1;
  }
  C && (n.set(d, b), u(b, d, r, l, n), n.delete(d)), _e(e, a, b);
}
function Tt(e, t, a, r, u) {
  e !== t && Mo(t, function(l, n) {
    if (u || (u = new oe()), Y(l))
      Pr(e, t, n, a, Tt, r, u);
    else {
      var o = r ? r(xe(e, n), l, n + "", e, t, u) : void 0;
      o === void 0 && (o = l), _e(e, n, o);
    }
  }, Ot);
}
function $t(e) {
  return e;
}
function kr(e, t, a) {
  switch (a.length) {
    case 0:
      return e.call(t);
    case 1:
      return e.call(t, a[0]);
    case 2:
      return e.call(t, a[0], a[1]);
    case 3:
      return e.call(t, a[0], a[1], a[2]);
  }
  return e.apply(t, a);
}
var tt = Math.max;
function Rr(e, t, a) {
  return t = tt(t === void 0 ? e.length - 1 : t, 0), function() {
    for (var r = arguments, u = -1, l = tt(r.length - t, 0), n = Array(l); ++u < l; )
      n[u] = r[t + u];
    u = -1;
    for (var o = Array(t + 1); ++u < t; )
      o[u] = r[u];
    return o[t] = a(n), kr(e, this, o);
  };
}
function Gr(e) {
  return function() {
    return e;
  };
}
var Br = fe ? function(e, t) {
  return fe(e, "toString", {
    configurable: !0,
    enumerable: !1,
    value: Gr(t),
    writable: !0
  });
} : $t, Dr = 800, zr = 16, Nr = Date.now;
function Ur(e) {
  var t = 0, a = 0;
  return function() {
    var r = Nr(), u = zr - (r - a);
    if (a = r, u > 0) {
      if (++t >= Dr)
        return arguments[0];
    } else
      t = 0;
    return e.apply(void 0, arguments);
  };
}
var Vr = Ur(Br);
function Kr(e, t) {
  return Vr(Rr(e, t, $t), e + "");
}
function Fr(e, t, a) {
  if (!Y(a))
    return !1;
  var r = typeof t;
  return (r == "number" ? Ue(a) && St(t, a.length) : r == "string" && t in a) ? ge(a[t], e) : !1;
}
function Hr(e) {
  return Kr(function(t, a) {
    var r = -1, u = a.length, l = u > 1 ? a[u - 1] : void 0, n = u > 2 ? a[2] : void 0;
    for (l = e.length > 3 && typeof l == "function" ? (u--, l) : void 0, n && Fr(a[0], a[1], n) && (l = u < 3 ? void 0 : l, u = 1), t = Object(t); ++r < u; ) {
      var o = a[r];
      o && e(t, o, r, l);
    }
    return t;
  });
}
var Ir = Hr(function(e, t, a, r) {
  Tt(e, t, a, r);
}), Jr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Zr(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var jt = { exports: {} };
(function(e) {
  (function(t, a) {
    e.exports ? e.exports = a() : t.coordtransform = a();
  })(Jr, function() {
    var t = 52.35987755982988, a = 3.141592653589793, r = 6378245, u = 0.006693421622965943, l = function(i, c) {
      var i = +i, c = +c, h = i - 65e-4, A = c - 6e-3, B = Math.sqrt(h * h + A * A) - 2e-5 * Math.sin(A * t), _ = Math.atan2(A, h) - 3e-6 * Math.cos(h * t), j = B * Math.cos(_), D = B * Math.sin(_);
      return [j, D];
    }, n = function(c, i) {
      var i = +i, c = +c, h = Math.sqrt(c * c + i * i) + 2e-5 * Math.sin(i * t), A = Math.atan2(i, c) + 3e-6 * Math.cos(c * t), B = h * Math.cos(A) + 65e-4, _ = h * Math.sin(A) + 6e-3;
      return [B, _];
    }, o = function(c, i) {
      var i = +i, c = +c;
      if (C(c, i))
        return [c, i];
      var h = v(c - 105, i - 35), A = b(c - 105, i - 35), B = i / 180 * a, _ = Math.sin(B);
      _ = 1 - u * _ * _;
      var j = Math.sqrt(_);
      h = h * 180 / (r * (1 - u) / (_ * j) * a), A = A * 180 / (r / j * Math.cos(B) * a);
      var D = i + h, U = c + A;
      return [U, D];
    }, d = function(c, i) {
      var i = +i, c = +c;
      if (C(c, i))
        return [c, i];
      var h = v(c - 105, i - 35), A = b(c - 105, i - 35), B = i / 180 * a, _ = Math.sin(B);
      _ = 1 - u * _ * _;
      var j = Math.sqrt(_);
      h = h * 180 / (r * (1 - u) / (_ * j) * a), A = A * 180 / (r / j * Math.cos(B) * a);
      var D = i + h, U = c + A;
      return [c * 2 - U, i * 2 - D];
    }, v = function(c, i) {
      var i = +i, c = +c, h = -100 + 2 * c + 3 * i + 0.2 * i * i + 0.1 * c * i + 0.2 * Math.sqrt(Math.abs(c));
      return h += (20 * Math.sin(6 * c * a) + 20 * Math.sin(2 * c * a)) * 2 / 3, h += (20 * Math.sin(i * a) + 40 * Math.sin(i / 3 * a)) * 2 / 3, h += (160 * Math.sin(i / 12 * a) + 320 * Math.sin(i * a / 30)) * 2 / 3, h;
    }, b = function(c, i) {
      var i = +i, c = +c, h = 300 + c + 2 * i + 0.1 * c * c + 0.1 * c * i + 0.1 * Math.sqrt(Math.abs(c));
      return h += (20 * Math.sin(6 * c * a) + 20 * Math.sin(2 * c * a)) * 2 / 3, h += (20 * Math.sin(c * a) + 40 * Math.sin(c / 3 * a)) * 2 / 3, h += (150 * Math.sin(c / 12 * a) + 300 * Math.sin(c / 30 * a)) * 2 / 3, h;
    }, C = function(c, i) {
      var i = +i, c = +c;
      return !(c > 73.66 && c < 135.05 && i > 3.86 && i < 53.55);
    };
    return {
      bd09togcj02: l,
      gcj02tobd09: n,
      wgs84togcj02: o,
      gcj02towgs84: d
    };
  });
})(jt);
var Wr = jt.exports;
const Et = /* @__PURE__ */ Zr(Wr), qr = (e, t, { type: a, MapGL: r, map: u }) => {
  const l = (n, o) => {
    const d = document.createElement("div");
    d.style.cursor = "pointer";
    const v = Qt(n, o);
    return ea(v, d), d;
  };
  e.addCustomComponent = (n) => {
    !Array.isArray(n) || (n == null ? void 0 : n.length) === 0 || n.forEach((o) => {
      const { component: d, componentProps: v, lng: b, lat: C, markerOptions: x = {} } = o, R = typeof v == "function" ? v() : v, E = typeof d == "function" ? d() : d, i = () => l(E, R);
      if (a.value === "baidu") {
        const c = Et.gcj02tobd09(b, C), h = new r.value.CustomOverlay(i, {
          point: { lng: c[0], lat: c[1] },
          ...x
        });
        u.value.addOverlay(h), h.addEventListener("click", function(A) {
          t("click-custom-component", o, A);
        });
      }
      if (a.value === "gaode") {
        const c = l(E, R), h = new r.value.Marker({ content: c, position: [b, C], ...x });
        u.value.add(h), r.value.event.addListener(h, "click", function(A) {
          t("click-custom-component", o, A);
        });
      }
    });
  };
}, Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: qr
}, Symbol.toStringTag, { value: "Module" })), Xr = (e, t, { type: a, MapGL: r, map: u, innerPoint: l, innerInput: n, adCode: o, addressInfo: d }) => {
  e.getMapInfo = () => {
    if (a.value === "baidu") {
      const v = Et.bd09togcj02(l.value[0], l.value[1]);
      return {
        longitude: v[0],
        latitude: v[1],
        address: n.value,
        adCode: o.value,
        addressInfo: d.value
      };
    }
    if (a.value === "gaode")
      return {
        longitude: l.value[0],
        latitude: l.value[1],
        address: n.value,
        adCode: o.value,
        addressInfo: d.value
      };
    if (a.value === "google")
      return {
        longitude: l.value[0],
        latitude: l.value[1],
        address: n.value,
        adCode: o.value,
        addressInfo: d.value
      };
  };
}, Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Xr
}, Symbol.toStringTag, { value: "Module" }));
function en(e, t) {
  for (var a = -1, r = e == null ? 0 : e.length, u = Array(r); ++a < r; )
    u[a] = t(e[a], a, e);
  return u;
}
var tn = "[object Symbol]";
function an(e) {
  return typeof e == "symbol" || re(e) && se(e) == tn;
}
var at = ee ? ee.prototype : void 0, ot = at ? at.toString : void 0;
function Lt(e) {
  if (typeof e == "string")
    return e;
  if (ve(e))
    return en(e, Lt) + "";
  if (an(e))
    return ot ? ot.call(e) : "";
  var t = e + "";
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
function ye(e) {
  return e == null ? "" : Lt(e);
}
function on(e, t, a) {
  var r = -1, u = e.length;
  t < 0 && (t = -t > u ? 0 : u + t), a = a > u ? u : a, a < 0 && (a += u), u = t > a ? 0 : a - t >>> 0, t >>>= 0;
  for (var l = Array(u); ++r < u; )
    l[r] = e[r + t];
  return l;
}
function rn(e, t, a) {
  var r = e.length;
  return a = a === void 0 ? r : a, !t && a >= r ? e : on(e, t, a);
}
var nn = "\\ud800-\\udfff", ln = "\\u0300-\\u036f", un = "\\ufe20-\\ufe2f", cn = "\\u20d0-\\u20ff", sn = ln + un + cn, dn = "\\ufe0e\\ufe0f", fn = "\\u200d", vn = RegExp("[" + fn + nn + sn + dn + "]");
function Pt(e) {
  return vn.test(e);
}
function gn(e) {
  return e.split("");
}
var kt = "\\ud800-\\udfff", pn = "\\u0300-\\u036f", hn = "\\ufe20-\\ufe2f", yn = "\\u20d0-\\u20ff", mn = pn + hn + yn, bn = "\\ufe0e\\ufe0f", _n = "[" + kt + "]", Me = "[" + mn + "]", Ce = "\\ud83c[\\udffb-\\udfff]", wn = "(?:" + Me + "|" + Ce + ")", Rt = "[^" + kt + "]", Gt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Bt = "[\\ud800-\\udbff][\\udc00-\\udfff]", xn = "\\u200d", Dt = wn + "?", zt = "[" + bn + "]?", Mn = "(?:" + xn + "(?:" + [Rt, Gt, Bt].join("|") + ")" + zt + Dt + ")*", Cn = zt + Dt + Mn, An = "(?:" + [Rt + Me + "?", Me, Gt, Bt, _n].join("|") + ")", Sn = RegExp(Ce + "(?=" + Ce + ")|" + An + Cn, "g");
function On(e) {
  return e.match(Sn) || [];
}
function Tn(e) {
  return Pt(e) ? On(e) : gn(e);
}
function $n(e) {
  return function(t) {
    t = ye(t);
    var a = Pt(t) ? Tn(t) : void 0, r = a ? a[0] : t.charAt(0), u = a ? rn(a, 1).join("") : t.slice(1);
    return r[e]() + u;
  };
}
var jn = $n("toUpperCase");
function En(e) {
  return jn(ye(e).toLowerCase());
}
function Ln(e, t, a, r) {
  for (var u = -1, l = e == null ? 0 : e.length; ++u < l; )
    a = t(a, e[u], u, e);
  return a;
}
function Pn(e) {
  return function(t) {
    return e == null ? void 0 : e[t];
  };
}
var kn = {
  // Latin-1 Supplement block.
  À: "A",
  Á: "A",
  Â: "A",
  Ã: "A",
  Ä: "A",
  Å: "A",
  à: "a",
  á: "a",
  â: "a",
  ã: "a",
  ä: "a",
  å: "a",
  Ç: "C",
  ç: "c",
  Ð: "D",
  ð: "d",
  È: "E",
  É: "E",
  Ê: "E",
  Ë: "E",
  è: "e",
  é: "e",
  ê: "e",
  ë: "e",
  Ì: "I",
  Í: "I",
  Î: "I",
  Ï: "I",
  ì: "i",
  í: "i",
  î: "i",
  ï: "i",
  Ñ: "N",
  ñ: "n",
  Ò: "O",
  Ó: "O",
  Ô: "O",
  Õ: "O",
  Ö: "O",
  Ø: "O",
  ò: "o",
  ó: "o",
  ô: "o",
  õ: "o",
  ö: "o",
  ø: "o",
  Ù: "U",
  Ú: "U",
  Û: "U",
  Ü: "U",
  ù: "u",
  ú: "u",
  û: "u",
  ü: "u",
  Ý: "Y",
  ý: "y",
  ÿ: "y",
  Æ: "Ae",
  æ: "ae",
  Þ: "Th",
  þ: "th",
  ß: "ss",
  // Latin Extended-A block.
  Ā: "A",
  Ă: "A",
  Ą: "A",
  ā: "a",
  ă: "a",
  ą: "a",
  Ć: "C",
  Ĉ: "C",
  Ċ: "C",
  Č: "C",
  ć: "c",
  ĉ: "c",
  ċ: "c",
  č: "c",
  Ď: "D",
  Đ: "D",
  ď: "d",
  đ: "d",
  Ē: "E",
  Ĕ: "E",
  Ė: "E",
  Ę: "E",
  Ě: "E",
  ē: "e",
  ĕ: "e",
  ė: "e",
  ę: "e",
  ě: "e",
  Ĝ: "G",
  Ğ: "G",
  Ġ: "G",
  Ģ: "G",
  ĝ: "g",
  ğ: "g",
  ġ: "g",
  ģ: "g",
  Ĥ: "H",
  Ħ: "H",
  ĥ: "h",
  ħ: "h",
  Ĩ: "I",
  Ī: "I",
  Ĭ: "I",
  Į: "I",
  İ: "I",
  ĩ: "i",
  ī: "i",
  ĭ: "i",
  į: "i",
  ı: "i",
  Ĵ: "J",
  ĵ: "j",
  Ķ: "K",
  ķ: "k",
  ĸ: "k",
  Ĺ: "L",
  Ļ: "L",
  Ľ: "L",
  Ŀ: "L",
  Ł: "L",
  ĺ: "l",
  ļ: "l",
  ľ: "l",
  ŀ: "l",
  ł: "l",
  Ń: "N",
  Ņ: "N",
  Ň: "N",
  Ŋ: "N",
  ń: "n",
  ņ: "n",
  ň: "n",
  ŋ: "n",
  Ō: "O",
  Ŏ: "O",
  Ő: "O",
  ō: "o",
  ŏ: "o",
  ő: "o",
  Ŕ: "R",
  Ŗ: "R",
  Ř: "R",
  ŕ: "r",
  ŗ: "r",
  ř: "r",
  Ś: "S",
  Ŝ: "S",
  Ş: "S",
  Š: "S",
  ś: "s",
  ŝ: "s",
  ş: "s",
  š: "s",
  Ţ: "T",
  Ť: "T",
  Ŧ: "T",
  ţ: "t",
  ť: "t",
  ŧ: "t",
  Ũ: "U",
  Ū: "U",
  Ŭ: "U",
  Ů: "U",
  Ű: "U",
  Ų: "U",
  ũ: "u",
  ū: "u",
  ŭ: "u",
  ů: "u",
  ű: "u",
  ų: "u",
  Ŵ: "W",
  ŵ: "w",
  Ŷ: "Y",
  ŷ: "y",
  Ÿ: "Y",
  Ź: "Z",
  Ż: "Z",
  Ž: "Z",
  ź: "z",
  ż: "z",
  ž: "z",
  Ĳ: "IJ",
  ĳ: "ij",
  Œ: "Oe",
  œ: "oe",
  ŉ: "'n",
  ſ: "s"
}, Rn = Pn(kn), Gn = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Bn = "\\u0300-\\u036f", Dn = "\\ufe20-\\ufe2f", zn = "\\u20d0-\\u20ff", Nn = Bn + Dn + zn, Un = "[" + Nn + "]", Vn = RegExp(Un, "g");
function Kn(e) {
  return e = ye(e), e && e.replace(Gn, Rn).replace(Vn, "");
}
var Fn = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function Hn(e) {
  return e.match(Fn) || [];
}
var In = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function Jn(e) {
  return In.test(e);
}
var Nt = "\\ud800-\\udfff", Zn = "\\u0300-\\u036f", Wn = "\\ufe20-\\ufe2f", qn = "\\u20d0-\\u20ff", Yn = Zn + Wn + qn, Ut = "\\u2700-\\u27bf", Vt = "a-z\\xdf-\\xf6\\xf8-\\xff", Xn = "\\xac\\xb1\\xd7\\xf7", Qn = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", el = "\\u2000-\\u206f", tl = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Kt = "A-Z\\xc0-\\xd6\\xd8-\\xde", al = "\\ufe0e\\ufe0f", Ft = Xn + Qn + el + tl, Ht = "['’]", rt = "[" + Ft + "]", ol = "[" + Yn + "]", It = "\\d+", rl = "[" + Ut + "]", Jt = "[" + Vt + "]", Zt = "[^" + Nt + Ft + It + Ut + Vt + Kt + "]", nl = "\\ud83c[\\udffb-\\udfff]", ll = "(?:" + ol + "|" + nl + ")", ul = "[^" + Nt + "]", Wt = "(?:\\ud83c[\\udde6-\\uddff]){2}", qt = "[\\ud800-\\udbff][\\udc00-\\udfff]", X = "[" + Kt + "]", cl = "\\u200d", nt = "(?:" + Jt + "|" + Zt + ")", il = "(?:" + X + "|" + Zt + ")", lt = "(?:" + Ht + "(?:d|ll|m|re|s|t|ve))?", ut = "(?:" + Ht + "(?:D|LL|M|RE|S|T|VE))?", Yt = ll + "?", Xt = "[" + al + "]?", sl = "(?:" + cl + "(?:" + [ul, Wt, qt].join("|") + ")" + Xt + Yt + ")*", dl = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", fl = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", vl = Xt + Yt + sl, gl = "(?:" + [rl, Wt, qt].join("|") + ")" + vl, pl = RegExp([
  X + "?" + Jt + "+" + lt + "(?=" + [rt, X, "$"].join("|") + ")",
  il + "+" + ut + "(?=" + [rt, X + nt, "$"].join("|") + ")",
  X + "?" + nt + "+" + lt,
  X + "+" + ut,
  fl,
  dl,
  It,
  gl
].join("|"), "g");
function hl(e) {
  return e.match(pl) || [];
}
function yl(e, t, a) {
  return e = ye(e), t = t, t === void 0 ? Jn(e) ? hl(e) : Hn(e) : e.match(t) || [];
}
var ml = "['’]", bl = RegExp(ml, "g");
function _l(e) {
  return function(t) {
    return Ln(yl(Kn(t).replace(bl, "")), e, "");
  };
}
var wl = _l(function(e, t, a) {
  return t = t.toLowerCase(), e + (a ? En(t) : t);
});
const ct = /* @__PURE__ */ Object.assign({ "./add-custom-dom/index.ts": Yr, "./get-map-info/index.ts": Qr }), xl = Object.keys(ct).reduce((e, t) => {
  const a = wl(t.replace("./", "").split("/")[0]);
  return e[a] = ct[t].default, e;
}, {}), Ml = (e, t, a) => {
  const r = S({});
  return { mapElement: r, addPlugins: () => {
    const n = Ir({}, (e == null ? void 0 : e.options) || {}, (o, d) => {
      if (Array.isArray(o)) return o.concat(d);
    });
    Object.values(xl).forEach((o) => o(r.value, t, a, n.plugins || {}));
  } };
}, Cl = ({ MapGL: e, map: t, marker: a, mapLoading: r, $autocomplete: u, searchResultList: l, innerInput: n, innerPoint: o, adCode: d, addressInfo: v }, b) => {
  const C = S(), x = S(), R = S();
  let E = null;
  const i = S(!1), c = S();
  let h;
  const A = async (s, f, m, M) => {
    if (c.value = m, M && (h = M), document.getElementById(s)) return B();
    const y = document.createElement("script"), T = `mapLoad${(/* @__PURE__ */ new Date()).getTime()}`, G = `https://maps.googleapis.com/maps/api/js?key=${s}&loading=async&callback=${T}`;
    y.setAttribute("id", s), y.setAttribute("src", G), document.body.appendChild(y), window[T] = () => {
      B();
    };
  }, B = async () => {
    var G, L;
    const { Map: s } = await google.maps.importLibrary("maps");
    e.value = s;
    const { Place: f, AutocompleteSessionToken: m, AutocompleteSuggestion: M } = await google.maps.importLibrary("places");
    x.value = new m(), R.value = M, C.value = f;
    const { AdvancedMarkerElement: y } = await google.maps.importLibrary("marker");
    E = y;
    const T = ((G = c.value) == null ? void 0 : G.mapOpt) ?? {};
    t.value = new s(document.getElementById("map"), {
      zoom: 11,
      mapId: "DEMO_MAP_ID",
      fullscreenControl: !1,
      // 全屏
      streetViewControl: !1,
      // 街景
      mapTypeControl: !1,
      // 左上角地图类型
      gestureHandling: "greedy",
      // 谷歌地图api缩放去掉ctrl+滚轮缩放，直接鼠标缩放
      ...T
    }), await j(), (L = c.value) != null && L.clickStream || _(), r.value = !1, i.value = !n.value && !o.value.length, h && h();
  }, _ = () => {
    var s;
    (s = t.value) == null || s.addListener("click", (f) => {
      var m, M;
      a.value && a.value.setMap(null), o.value = [(m = f == null ? void 0 : f.latLng) == null ? void 0 : m.lng(), (M = f == null ? void 0 : f.latLng) == null ? void 0 : M.lat()], D(o.value, !0).then(() => {
        var T;
        const y = {
          lng: parseFloat(o.value[0]),
          lat: parseFloat(o.value[1])
        };
        a.value = new E({
          map: t.value,
          position: y,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (T = t.value) == null || T.panTo(y), console.log("当前的地址坐标信息：", o.value, n.value);
      });
    });
  }, j = async () => {
    var s;
    if (!n.value && o.value.length, n.value && o.value.length > 0 ? await D(o.value) : n.value ? await U(n.value) : o.value.length > 0 && await D(o.value, !0), n.value && g(n.value, (f, m) => {
      if (m && m.length) {
        const M = m.find(
          (y) => y.value === n.value || y.info.name === n.value
        );
        M ? v.value = M.info : v.value = {
          district: "",
          address: "",
          name: n.value
        };
      }
    }), o.value.length) {
      const f = {
        lng: parseFloat(o.value[0]),
        lat: parseFloat(o.value[1])
      };
      a.value = new E({
        map: t.value,
        position: f,
        title: n.value
        // 鼠标移上去时显示的内容
      }), o.value.length && ((s = t.value) == null || s.setCenter(f));
    }
  }, D = (s, f = !1) => {
    const m = s.join(",");
    return new Promise((M, y) => {
      new google.maps.Geocoder().geocode({
        location: {
          lng: parseFloat(s[0]),
          lat: parseFloat(s[1])
        }
      }, (G, L) => {
        console.log(`${m}逆地址解析=======`, L, G, f), L === "OK" && (G != null && G.length) ? (f && (n.value = G[0].formatted_address ?? "", v.value = {
          district: "",
          address: "",
          name: n.value
        }), M(G[0])) : (N.error(k("thirdPartyMapErrorRetry")), y());
      });
    });
  }, U = (s) => new Promise((f, m) => {
    new google.maps.Geocoder().geocode({
      address: n.value
    }, (y, T) => {
      console.log(`${s}地址解析出经纬度=======`, T, y), T === "OK" && (y != null && y.length) ? (o.value[0] = y[0].geometry.location.lng(), o.value[1] = y[0].geometry.location.lat(), f({ lng: o.value[0], lat: o.value[1] })) : (N.error(k("thirdPartyMapErrorRetry")), m());
    });
  }), O = async () => {
    var s;
    console.log("定位到当前城市"), r.value = !0, navigator.geolocation && ((s = navigator.geolocation) == null || s.getCurrentPosition((f) => {
      var M;
      console.log("当前城市: ", f);
      const m = {
        lat: f.coords.latitude,
        lng: f.coords.longitude
      };
      (M = t.value) == null || M.panTo(m), i.value = !1, r.value = !1;
    }, (f) => {
      console.error("获取定位失败: ", f), N.error(k("获取定位失败")), r.value = !1;
    }, {
      // enableHighAccuracy: true,
      // timeout: 5000,
      // maximumAge: 0,
      // enableHighAccuracy: true
      enableHighAccuracy: !0,
      timeout: 1e4
    }));
  }, g = async (s, f) => {
    if (u.value.activated = !0, !s) {
      l.value = [], f([]);
      return;
    }
    let m = {
      input: s,
      origin: { lng: parseFloat(o.value[0]), lat: parseFloat(o.value[1]) },
      sessionToken: x.value
    };
    const { suggestions: M } = await R.value.fetchAutocompleteSuggestions(m);
    if (l.value = [], !M) return f([]);
    let y = [];
    await Promise.all(
      M.map((T) => (async () => {
        var J, le;
        let L = (T == null ? void 0 : T.placePrediction).toPlace();
        await L.fetchFields({
          fields: [
            "displayName",
            "formattedAddress",
            "location"
          ]
        });
        const ne = (J = L == null ? void 0 : L.location) == null ? void 0 : J.lng(), V = (le = L == null ? void 0 : L.location) == null ? void 0 : le.lat(), K = {
          // value: placePrediction?.text?.toString() || '',
          value: L == null ? void 0 : L.formattedAddress,
          point: { lng: ne, lat: V },
          info: {
            name: L == null ? void 0 : L.displayName
          }
        };
        y.push(K);
      })())
    ), l.value = y.length > 5 ? y.slice(0, 5) : y, f(l.value, y);
  };
  return {
    getLocationByInputSearch: g,
    handleSelectAddress: (s) => {
      n.value = s.value, v.value = s.info, U(s.value).then((f) => {
        var m;
        o.value = [f.lng, f.lat], a.value && a.value.setMap(null), a.value = new E({
          map: t.value,
          position: f,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (m = t.value) == null || m.panTo(f), i.value = !1;
      });
    },
    getLocationParse: async () => {
      var s, f;
      if (l.value.length) {
        if (console.log("检索列表：", l.value), n.value = l.value[0].value, !((s = l.value[0]) != null && s.point))
          return N.error(k("thirdPartyMapErrorRetry"));
        o.value = [l.value[0].point.lng, l.value[0].point.lat], v.value = l.value[0].info, a.value = new E({
          map: t.value,
          position: l.value[0].point,
          title: n.value
          // 鼠标移上去时显示的内容
        }), (f = t.value) == null || f.panTo(l.value[0].point), i.value = !1, u.value.activated = !1;
      }
    },
    getMapInfo: () => ({
      longitude: o.value[0],
      latitude: o.value[1],
      adCode: d.value,
      address: n.value,
      addressInfo: v.value
    }),
    loadJavascript: A,
    positionCityLocal: O,
    showGetLocationBtn: i
  };
}, Al = (e, t) => {
  const a = S("gaode"), r = S(), u = S(), l = H(null), n = H(null), o = H(null), d = S(!0), v = S(null), b = S([]), C = Se(() => ({
    width: e.width ? Q(e.width) : "100%",
    height: e.height ? Q(e.height) : "100%"
  })), x = S(""), R = S([]), E = S(""), i = S(), {
    loadJavascript: c,
    getLocationByInputSearch: h,
    handleSelectAddress: A,
    getLocationParse: B
  } = ft({
    BMap: l,
    map: n,
    marker: o,
    mapLoading: d,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: R,
    adCode: E,
    addressInfo: i
  }), {
    loadJavascript: _,
    getLocationByInputSearch: j,
    handleSelectAddress: D,
    getLocationParse: U
  } = st({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: d,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: R,
    adCode: E,
    addressInfo: i
  }), {
    loadJavascript: O,
    getLocationByInputSearch: g,
    handleSelectAddress: p,
    getLocationParse: w,
    positionCityLocal: $,
    showGetLocationBtn: s
  } = Cl({
    MapGL: l,
    map: n,
    marker: o,
    mapLoading: d,
    $autocomplete: v,
    searchResultList: b,
    innerInput: x,
    innerPoint: R,
    adCode: E,
    addressInfo: i
  }), { mapElement: f, addPlugins: m } = Ml(e, t, {
    type: a,
    MapGL: l,
    map: n,
    innerPoint: R,
    innerInput: x,
    adCode: E,
    addressInfo: i
  }), M = () => {
    a.value === "baidu" && c(r.value, { clickStream: !e.clickStream, mapOpt: e.mapOpt }, T), a.value === "gaode" && _(
      r.value,
      u.value,
      { clickStream: !e.clickStream, mapOpt: e.mapOpt },
      T
    ), a.value === "google" && O(
      r.value,
      u.value,
      { clickStream: !e.clickStream, mapOpt: e.mapOpt },
      T
    );
  }, y = async (V) => {
    const [K, J] = await Ge(V);
    if (K) {
      d.value = !1;
      return;
    }
    if (!K && !J) {
      t("no-config-map", k("暂未配置地图")), d.value = !1;
      return;
    }
    return J;
  };
  Oe(async () => {
    var V, K, J, le, Ve;
    if (e.defaultLongitude && e.defaultLatitude && (R.value = [e.defaultLongitude, e.defaultLatitude]), x.value = e.defaultAddress ?? "", e != null && e.sdkConfig && ((V = e == null ? void 0 : e.sdkConfig) != null && V.akValue))
      a.value = ((K = e.sdkConfig) == null ? void 0 : K.mapType) ?? "gaode", r.value = (J = e.sdkConfig) == null ? void 0 : J.akValue, u.value = (le = e.sdkConfig) == null ? void 0 : le.secretKey;
    else {
      const F = await y((Ve = e == null ? void 0 : e.sdkConfig) == null ? void 0 : Ve.mapType);
      F && (a.value = (F == null ? void 0 : F.mapType) ?? "gaode", r.value = F == null ? void 0 : F.akVal, u.value = F == null ? void 0 : F.secretK);
    }
    M();
  });
  const T = () => {
    f.value = n.value, m(), a.value === "baidu" && n.value.addEventListener("tilesloaded", () => {
      t("update:mapElement", f.value);
    }), a.value === "gaode" && n.value.on("complete", () => {
      t("update:mapElement", f.value);
    }), a.value === "google" && t("update:mapElement", f.value);
  };
  return {
    mapStyle: C,
    innerInput: x,
    getLocationByInputSearch: (V, K) => {
      a.value === "baidu" && h(V, K), a.value === "gaode" && j(V, K), a.value === "google" && g(V, K);
    },
    handleSelectAddress: (V) => {
      a.value === "baidu" && A(V), a.value === "gaode" && D(V), a.value === "google" && p(V);
    },
    getLocationParse: () => {
      a.value === "baidu" && B(), a.value === "gaode" && U(), a.value === "google" && w();
    },
    mapLoading: d,
    $autocomplete: v,
    googlePositionCityLocal: $,
    showGetLocationBtn: s
  };
}, Sl = { class: "search-input" }, Ol = { class: "location-icon1" }, Tl = { id: "map" }, $l = /* @__PURE__ */ Ae({
  __name: "mixMap",
  props: {
    defaultAddress: {},
    showSearch: { type: Boolean },
    clickStream: { type: Boolean },
    defaultLongitude: {},
    defaultLatitude: {},
    width: {},
    height: {},
    mapElement: {},
    sdkConfig: {},
    dev: { type: Boolean },
    mapOpt: {}
  },
  emits: ["update:mapElement", "no-config-map", "click-custom-component"],
  setup(e, { emit: t }) {
    const a = e, r = t, {
      mapStyle: u,
      innerInput: l,
      getLocationByInputSearch: n,
      handleSelectAddress: o,
      getLocationParse: d,
      mapLoading: v,
      $autocomplete: b,
      googlePositionCityLocal: C,
      showGetLocationBtn: x
    } = Al(a, r);
    return (R, E) => {
      const i = Pe, c = ke;
      return $e(), Te(
        "div",
        {
          class: "das-map",
          style: je(z(u))
        },
        [
          Z(W(
            "div",
            Sl,
            [
              Z(de(i, {
                ref_key: "$autocomplete",
                ref: b,
                modelValue: z(l),
                "onUpdate:modelValue": E[0] || (E[0] = (h) => ta(l) ? l.value = h : null),
                "fetch-suggestions": z(n),
                placeholder: z(k)("请输入位置"),
                style: { width: "100%" },
                "trigger-on-focus": !1,
                onSelect: z(o),
                onKeyup: Ee(z(d), ["enter", "native"]),
                clearable: ""
              }, null, 8, ["modelValue", "fetch-suggestions", "placeholder", "onSelect", "onKeyup"]), [
                [z(Re)]
              ])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Ke, a.showSearch]
          ]),
          Z(W(
            "div",
            Ol,
            [
              de(z(la), {
                block: "",
                size: "large",
                onClick: z(C)
              }, {
                default: aa(() => [
                  oa(
                    ra(z(k)("Please-Click-Get-Location")),
                    1
                    /* TEXT */
                  )
                ]),
                _: 1
                /* STABLE */
              }, 8, ["onClick"])
            ],
            512
            /* NEED_PATCH */
          ), [
            [Ke, z(x)]
          ]),
          Z(W(
            "div",
            Tl,
            null,
            512
            /* NEED_PATCH */
          ), [
            [
              c,
              z(v),
              void 0,
              { lock: !0 }
            ]
          ])
        ],
        4
        /* STYLE */
      );
    };
  }
}), jl = /* @__PURE__ */ Be($l, [["__scopeId", "data-v-9c0f471e"]]), El = {
  请输入位置: { "zh-CN": "请输入位置", en: "Please enter location", _appCode: "framework" },
  获取地图配置信息失败: {
    "zh-CN": "获取地图配置信息失败",
    en: "The map configuration information failed to be obtained",
    _appCode: "framework"
  },
  暂未配置地图: { "zh-CN": "暂未配置地图", en: "Map Not Configured", _appCode: "framework" },
  thirdPartyMapErrorRetry: {
    "zh-CN": "第三方地图配置参数错误或地址信息无效，请检查后再重试",
    en: "The configuration parameters of the third-party map are incorrect or the address information is invalid. please check and try again",
    _appCode: "framework"
  },
  "Please-Click-Get-Location": {
    "zh-CN": "请点击获取位置",
    en: "Please click get location",
    _appCode: "framework"
  },
  获取定位失败: {
    "zh-CN": "获取定位失败",
    en: "The location failed to be obtained",
    _appCode: "framework"
  }
};
na(El);
const Kl = Le(ga), Fl = () => S(null), Hl = Le(ma), Il = () => S(null), Jl = Le(jl), Zl = () => S(null), Wl = { title: "Map 地图" };
export {
  Hl as DasBaiduMap,
  Il as DasBaiduMapRef,
  Kl as DasGaodeMap,
  Fl as DasGaodeMapRef,
  Jl as DasMap,
  Zl as DasMapRef,
  Wl as default
};
