ts-maps-vue
Version:
Vue components for ts-maps - Interactive Vector Maps
1,381 lines • 1.24 MB
JavaScript
var Z0 = Object.defineProperty;
var o0 = (t, e, l) => e in t ? Z0(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
var Z = (t, e, l) => o0(t, typeof e != "symbol" ? e + "" : e, l);
import { defineComponent as P, ref as U, watch as R, onMounted as l0, onUnmounted as r0, createElementBlock as e0, openBlock as G, computed as N, onBeforeUnmount as h0, normalizeStyle as m0, renderSlot as j, createCommentVNode as p0, createElementVNode as H, createBlock as a0, withCtx as t0 } from "vue";
const c0 = /* @__PURE__ */ P({
__name: "GoogleMap",
props: {
apiKey: {},
center: { default: () => ({ lat: 0, lng: 0 }) },
zoom: { default: 2 },
mapId: { default: "" },
options: { default: () => ({}) },
markers: { default: () => [] }
},
emits: ["mapLoaded", "boundsChanged", "markerClicked"],
setup(t, { emit: e }) {
const l = t, a = e, n = U(null), M = U(null), i = U([]);
let s = null;
function r() {
i.value.forEach((p) => p.setMap(null)), i.value = [];
}
function h() {
M.value && (r(), l.markers.forEach((p, c) => {
const d = new window.google.maps.Marker({
...p,
map: M.value
});
d.addListener("click", () => {
a("markerClicked", d, c);
}), i.value.push(d);
}));
}
function o() {
if (!n.value)
return;
const p = {
center: l.center,
zoom: l.zoom,
mapId: l.mapId,
...l.options
};
M.value = new window.google.maps.Map(n.value, p), a("mapLoaded", M.value), M.value.addListener("bounds_changed", () => {
var c;
a("boundsChanged", ((c = M.value) == null ? void 0 : c.getBounds()) ?? null);
}), h();
}
function m() {
var p;
if ((p = window.google) != null && p.maps) {
o();
return;
}
s = document.createElement("script"), s.src = `https://maps.googleapis.com/maps/api/js?key=${l.apiKey}`, s.async = !0, s.defer = !0, s.onload = o, document.head.appendChild(s);
}
return R(() => l.center, (p) => {
M.value && p && M.value.setCenter(p);
}), R(() => l.zoom, (p) => {
M.value && p && M.value.setZoom(p);
}), R(() => l.markers, () => {
M.value && h();
}, { deep: !0 }), l0(() => {
m();
}), r0(() => {
r(), s && s.parentNode && s.parentNode.removeChild(s);
}), (p, c) => (G(), e0("div", {
ref_key: "mapContainer",
ref: n,
class: "google-map"
}, null, 512));
}
}), X = (t, e) => {
const l = t.__vccOpts || t;
for (const [a, n] of e)
l[a] = n;
return l;
}, d0 = /* @__PURE__ */ X(c0, [["__scopeId", "data-v-7f2f6c16"]]);
var x = function(e, l, a = {}) {
a.arrayMerge = a.arrayMerge || k0, a.isMergeableObject = a.isMergeableObject || $, a.cloneUnlessOtherwiseSpecified = E;
const n = Array.isArray(l), M = Array.isArray(e);
return n === M ? n ? a.arrayMerge(e, l, a) : C0(e, l, a) : E(l, a);
};
function $(t) {
return u0(t) && !f0(t);
}
function u0(t) {
return !!t && typeof t == "object";
}
function f0(t) {
const e = Object.prototype.toString.call(t);
return e === "[object RegExp]" || e === "[object Date]" || _0(t) || y0(t);
}
var S0 = typeof Symbol == "function" && Symbol.for, g0 = S0 ? Symbol.for("react.element") : 60103;
function y0(t) {
return t.$$typeof === g0;
}
function _0(t) {
return t instanceof Node;
}
function b0(t) {
return Array.isArray(t) ? [] : {};
}
function E(t, e) {
const l = (e.isMergeableObject || $)(t);
return e.clone !== !1 && l ? x(b0(t), t, e) : t;
}
function k0(t, e, l) {
return t.concat(e).map((a) => E(a, l));
}
function v0(t, e) {
if (!e.customMerge)
return x;
const l = e.customMerge(t);
return typeof l == "function" ? l : x;
}
function U0(t) {
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter((e) => Object.prototype.propertyIsEnumerable.call(t, e)) : [];
}
function q(t) {
const e = U0(t);
return [...Object.keys(t), ...e];
}
function n0(t, e) {
try {
return e in t;
} catch {
return !1;
}
}
function R0(t, e) {
return n0(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e));
}
function C0(t, e, l) {
const a = {}, n = l.isMergeableObject || $;
return n(t) && q(t).forEach((M) => {
a[M] = E(t[M], l);
}), q(e).forEach((M) => {
R0(t, M) || (n0(t, M) && n(e[M]) ? a[M] = v0(M, l)(t[M], e[M], l) : a[M] = E(e[M], l));
}), a;
}
var A0 = x;
function M0(t) {
return typeof t == "object" && typeof t.nodeType < "u" ? t : typeof t == "string" ? document.querySelector(t) : null;
}
function g(t, e, l, a = !1) {
const n = document.createElement(t);
return l && (n[a ? "innerHTML" : "textContent"] = l), e && (n.className = e), n;
}
function I(t) {
var e;
(e = t.parentNode) == null || e.removeChild(t);
}
function w0(t) {
return /\.[jpe?g|ifn]$/i.test(t);
}
function E0(t) {
return t.replace(/\w([A-Z])/g, (e) => `${e[0]}-${e[1]}`).toLowerCase();
}
function f(t, e, l = !1) {
return l ? A0(t, e) : Object.assign(t, e);
}
function L(t, e) {
return `${t.toLowerCase()}:to:${e.toLowerCase()}`;
}
class T0 {
constructor() {
Z(this, "_tooltip");
Z(this, "shape");
}
dispose() {
this._tooltip ? I(this._tooltip) : this.shape && this.shape.remove();
for (const e of Object.getOwnPropertyNames(this))
this[e] = null;
}
}
var D = T0;
class L0 extends D {
constructor(l) {
super();
Z(this, "_map");
Z(this, "_tooltip");
Z(this, "_hoveredRegion", null);
Z(this, "_hoveredMarker", null);
Z(this, "_customPositioning", !0);
return this._map = l, this._tooltip = g("div", "jvm-tooltip", ""), this._tooltip.style.display = "none", this._map.container.appendChild(this._tooltip), this;
}
getElement() {
return this._tooltip;
}
show(l) {
this._tooltip.style.display = "block", this._tooltip.innerHTML = l, this._tooltip.classList.add("active");
}
hide() {
this._tooltip.style.display = "none", this._tooltip.classList.remove("active"), this._hoveredRegion = null, this._hoveredMarker = null;
}
text(l) {
this._tooltip && (this._tooltip.innerHTML = l);
}
html(l) {
this._tooltip && (this._tooltip.innerHTML = l);
}
css(l) {
if (this._customPositioning && (l.top || l.left))
return this;
for (const a in l)
this._tooltip.style[a] = l[a];
return this;
}
setHoveredRegion(l) {
this._hoveredRegion = l;
}
getHoveredRegion() {
return this._hoveredRegion;
}
setHoveredMarker(l) {
this._hoveredMarker = l;
}
getHoveredMarker() {
return this._hoveredMarker;
}
}
var N0 = L0;
function x0() {
let t, e, l, a;
this._defaultWidth * this.scale <= this._width ? (t = (this._width - this._defaultWidth * this.scale) / (2 * this.scale), l = (this._width - this._defaultWidth * this.scale) / (2 * this.scale)) : (t = 0, l = (this._width - this._defaultWidth * this.scale) / this.scale), this._defaultHeight * this.scale <= this._height ? (e = (this._height - this._defaultHeight * this.scale) / (2 * this.scale), a = (this._height - this._defaultHeight * this.scale) / (2 * this.scale)) : (e = 0, a = (this._height - this._defaultHeight * this.scale) / this.scale), this.transY > e ? this.transY = e : this.transY < a && (this.transY = a), this.transX > t ? this.transX = t : this.transX < l && (this.transX = l), this.canvas.applyTransformParams(this.scale, this.transX, this.transY), this._markers && this._repositionMarkers(), this._lines && this._repositionLines(), this._repositionLabels();
}
function I0(t, e) {
var r;
const a = (((r = this.params.map) == null ? void 0 : r.projection) || "mercator") === "mercator" ? this.mercator.convert(t, e) : this.miller.convert(t, e);
if (a === !1)
return !1;
const n = this.getInsetForPoint(a.x, a.y);
if (!n)
return !1;
const { bbox: M } = n, i = (a.x - M[0].x) / (M[1].x - M[0].x) * n.width * this.scale, s = (a.y - M[0].y) / (M[1].y - M[0].y) * n.height * this.scale;
return {
x: i + this.transX * this.scale + n.left * this.scale,
y: s + this.transY * this.scale + n.top * this.scale
};
}
var z0 = "jvm-line";
class O0 extends D {
constructor(l, a) {
super();
Z(this, "_options");
Z(this, "_style");
this._options = l, this._style = a, this._draw();
}
setStyle(l, a) {
var n;
(n = this.shape) == null || n.setStyle(l, a);
}
getConfig() {
return this._options.config;
}
_draw() {
var s, r;
const { index: l, group: a, map: n, animate: M } = this._options, i = {
d: this._getDAttribute(),
fill: "none",
dataIndex: l
};
this.shape = n.canvas.createPath(i, this._style, a), (s = this.shape) == null || s.addClass(z0), M && ((r = this.shape) == null || r.setStyle({ animation: !0 }));
}
_getDAttribute() {
const { x1: l, y1: a, x2: n, y2: M } = this._options;
return `M${l},${a}${this._getQCommand(l, a, n, M)}${n},${M}`;
}
_getQCommand(l, a, n, M) {
if (!this._options.curvature)
return " ";
const i = this._options.curvature || 0.6, s = (l + n) / 2 + i * (M - a), r = (a + M) / 2 - i * (n - l);
return ` Q${s},${r} `;
}
}
var B0 = O0;
function P0(t) {
const e = this._markers || {}, { style: l, elements: a, ...n } = this.params.lines || {};
let M = !1, i = !1;
for (const s in t) {
const r = t[s];
for (const { config: h } of Object.values(e))
h.name === r.from && (M = this.getMarkerPosition(h)), h.name === r.to && (i = this.getMarkerPosition(h));
M !== !1 && i !== !1 && (this._lines = this._lines || {}, this._lines[L(r.from, r.to)] = new B0({
index: s,
map: this,
group: this._linesGroup,
config: r,
x1: M.x,
y1: M.y,
x2: i.x,
y2: i.y,
...n
}, f({ initial: l }, { initial: r.style || {} }, !0)));
}
}
var G0 = {
getLabelText(t, e) {
if (e) {
if (typeof e.render == "function") {
const l = [];
return this.constructor.Name === "marker" && l.push(this.getConfig()), l.push(t), e.render.apply(this, l);
}
return t;
}
},
getLabelOffsets(t, e) {
return e && typeof e.offsets == "function" ? e.offsets(t) : e && Array.isArray(e.offsets) ? e.offsets[t] || [0, 0] : [0, 0];
},
setStyle(t, e) {
this.shape.setStyle(t, e);
},
remove() {
this.shape.remove(), this.label && this.label.remove();
},
hover(t) {
this._setStatus("isHovered", t);
},
select(t) {
this._setStatus("isSelected", t);
},
_setStatus(t, e) {
this.shape[t] = e, this.shape.updateStyle(), this[t] = e, this.label && (this.label[t] = e, this.label.updateStyle());
}
}, y = G0, D0 = "marker", z = "jvm-", K0 = `${z}element ${z}marker`, Y0 = `${z}element ${z}label`;
class V0 extends D {
constructor(l, a) {
super();
Z(this, "_options");
Z(this, "_style");
Z(this, "_labelX", null);
Z(this, "_labelY", null);
Z(this, "_offsets", null);
Z(this, "_isImage");
Z(this, "label");
Z(this, "isHovered", !1);
Z(this, "isSelected", !1);
Z(this, "setStyle");
Z(this, "remove");
Z(this, "hover");
Z(this, "select");
Z(this, "_setStatus");
this._options = l, this._style = a, this._isImage = !!a.initial.image, this.setStyle = y.setStyle.bind(this), this.remove = y.remove.bind(this), this.hover = y.hover.bind(this), this.select = y.select.bind(this), this._setStatus = y._setStatus.bind(this), this._draw(), this._options.label && this._drawLabel(), this._isImage && this.updateLabelPosition();
}
static get Name() {
return D0;
}
getConfig() {
return this._options.config;
}
updateLabelPosition() {
var a, n, M, i, s;
const l = this._options.map;
this.label && this._labelX !== null && this._labelY !== null && this._offsets && this.label.set({
x: this._labelX * l.scale + this._offsets[0] + l.transX * l.scale + 5 + (this._isImage ? (((a = this.shape) == null ? void 0 : a.width) || 0) / 2 : ((s = (i = (M = (n = this.shape) == null ? void 0 : n.node) == null ? void 0 : M.r) == null ? void 0 : i.baseVal) == null ? void 0 : s.value) || 0),
y: this._labelY * l.scale + l.transY * this._options.map.scale + this._offsets[1]
});
}
_draw() {
var r;
const { index: l, map: a, group: n, cx: M, cy: i } = this._options, s = this._isImage ? "createImage" : "createCircle";
this.shape = a.canvas[s]({ dataIndex: l, cx: M, cy: i }, this._style, n), (r = this.shape) == null || r.addClass(K0);
}
_drawLabel() {
const {
index: l,
map: a,
label: n,
labelsGroup: M,
cx: i,
cy: s,
config: r,
isRecentlyCreated: h
} = this._options, o = this.getLabelText(l, n);
this._labelX = i / a.scale - a.transX, this._labelY = s / a.scale - a.transY, this._offsets = h && (r != null && r.offsets) ? r.offsets : this.getLabelOffsets(l, n), this.label = a.canvas.createText({
text: o,
dataIndex: l,
x: this._labelX,
y: this._labelY,
dy: "0.6ex"
}, a.params.markerLabelStyle, M), this.label.addClass(Y0), h && this.updateLabelPosition();
}
getLabelText(l, a) {
if (a)
return typeof a.render == "function" ? a.render(this.getConfig(), l) : l;
}
getLabelOffsets(l, a) {
return a && typeof a.offsets == "function" ? a.offsets(l) : a && Array.isArray(a.offsets) ? a.offsets[l] || [0, 0] : [0, 0];
}
}
var j0 = V0;
function H0(t = {}, e = !1) {
var l, a;
for (let n in t) {
const M = t[n], i = this.getMarkerPosition(M), s = M.coords.join(":");
if (!i)
continue;
if (e) {
if (Object.keys(this._markers || {}).filter((h) => {
var o;
return ((o = this._markers) == null ? void 0 : o[h]._uid) === s;
}).length)
continue;
n = String(Object.keys(this._markers || {}).length);
}
const r = new j0({
index: n,
map: this,
label: (l = this.params.labels) == null ? void 0 : l.markers,
labelsGroup: this._markerLabelsGroup,
cx: i.x,
cy: i.y,
group: this._markersGroup,
config: M,
isRecentlyCreated: e
}, f({ initial: {} }, f(this.params.markerStyle || {}, { ...M.style || {} }, !0)));
(a = this._markers) != null && a[n] && this.removeMarkers([n]), this._markers[n] = {
_uid: s,
config: M,
element: r
};
}
}
class X0 extends D {
constructor({ map: l, code: a, path: n, style: M, label: i, labelStyle: s, labelsGroup: r }) {
var o;
super();
Z(this, "_map");
Z(this, "labelX", 0);
Z(this, "labelY", 0);
Z(this, "label");
Z(this, "isHovered");
Z(this, "isSelected", !1);
Z(this, "shape");
Z(this, "setStyle");
Z(this, "remove");
Z(this, "hover");
Z(this, "select");
Z(this, "_setStatus");
this._map = l, this.setStyle = y.setStyle.bind(this), this.remove = y.remove.bind(this), this.hover = y.hover.bind(this), this.select = y.select.bind(this), this._setStatus = y._setStatus.bind(this), this.shape = this._createRegion(n, a, M);
const h = this.getLabelText(a, i);
if (i && h) {
const m = (o = this.shape) == null ? void 0 : o.getBBox(), p = this.getLabelOffsets(a, i);
this.labelX = ((m == null ? void 0 : m.x) ?? 0) + ((m == null ? void 0 : m.width) ?? 0) / 2 + p[0], this.labelY = ((m == null ? void 0 : m.y) ?? 0) + ((m == null ? void 0 : m.height) ?? 0) / 2 + p[1], this.label = this._map.canvas.createText({
text: h,
textAnchor: "middle",
alignmentBaseline: "central",
dataCode: a,
x: this.labelX,
y: this.labelY
}, s, r), this.label.addClass("jvm-region jvm-element");
}
}
_createRegion(l, a, n) {
const M = this._map.canvas.createPath({ d: l, dataCode: a }, n);
return M.addClass("jvm-region jvm-element"), M;
}
updateLabelPosition() {
this.label && this.label.set({
x: this.labelX * this._map.scale + this._map.transX * this._map.scale,
y: this.labelY * this._map.scale + this._map.transY * this._map.scale
});
}
getLabelText(l, a) {
if (a)
return typeof a.render == "function" ? a.render(l) : l;
}
getLabelOffsets(l, a) {
return a && typeof a.offsets == "function" ? a.offsets(l) : a && Array.isArray(a.offsets) ? a.offsets[l] || [0, 0] : [0, 0];
}
}
var $0 = X0;
function W0() {
var t;
this._regionLabelsGroup = this._regionLabelsGroup || this.canvas.createGroup("jvm-regions-labels-group");
for (const e in this._mapData.paths) {
const l = new $0({
map: this,
code: e,
path: this._mapData.paths[e].path,
style: f({ initial: {} }, this.params.regionStyle || {}),
labelStyle: this.params.regionLabelStyle,
labelsGroup: this._regionLabelsGroup,
label: (t = this.params.labels) != null && t.regions ? {} : void 0
});
this.regions[e] = {
config: this._mapData.paths[e],
element: l,
path: this._mapData.paths[e].path,
name: e
};
}
}
class F0 {
constructor(e) {
Z(this, "_options");
Z(this, "_map");
Z(this, "_series");
Z(this, "_body");
this._options = e, this._map = this._options.map, this._series = this._options.series, this._body = g("div", "jvm-legend"), this._options.cssClass && this._body.setAttribute("class", this._options.cssClass), e.vertical ? this._map.legendVertical.appendChild(this._body) : this._map.legendHorizontal.appendChild(this._body), this.render();
}
render() {
const e = this._series.scale.getTicks(), l = g("div", "jvm-legend-inner");
if (this._body.innerHTML = "", this._options.title) {
const a = g("div", "jvm-legend-title", this._options.title);
this._body.appendChild(a);
}
this._body.appendChild(l);
for (let a = 0; a < e.length; a++) {
const n = g("div", "jvm-legend-tick"), M = g("div", "jvm-legend-tick-sample");
switch (this._series.config.attribute) {
case "fill":
w0(e[a].value) ? M.style.background = `url(${e[a].value})` : M.style.background = e[a].value;
break;
case "stroke":
M.style.background = e[a].value;
break;
case "image":
M.style.background = `url(${e[a].value}) no-repeat center center`, M.style.backgroundSize = "cover";
break;
}
n.appendChild(M);
let i = e[a].label;
this._options.labelRender && (i = this._options.labelRender(i));
const s = g("div", "jvm-legend-tick-text", i);
n.appendChild(s), l.appendChild(n);
}
}
}
var J0 = F0;
class q0 {
constructor(e) {
Z(this, "_scale");
this._scale = e.scale;
}
getValue(e) {
return this._scale[String(e)];
}
getTicks() {
const e = [];
for (const l in this._scale)
e.push({
value: this._scale[l],
label: l
});
return e;
}
}
var Q0 = q0;
class ll {
constructor(e, l, a) {
Z(this, "_map");
Z(this, "_elements");
Z(this, "_values");
Z(this, "config");
Z(this, "scale");
Z(this, "legend");
this._map = a, this._elements = l, this._values = e.values || {}, this.config = e, this.config.attribute = e.attribute || "fill", e.attributes && this.setAttributes(e.attributes), typeof e.scale == "object" && (this.scale = new Q0(e.scale)), this.config.legend && (this.legend = new J0(f({ map: this._map, series: this }, this.config.legend))), this.setValues(this._values);
}
setValues(e) {
const l = {};
for (const a in e)
e[a] && (l[a] = this.scale.getValue(e[a]));
this.setAttributes(l);
}
setAttributes(e) {
for (const l in e)
this._elements[l] && this._elements[l].element.setStyle(this.config.attribute || "fill", e[l]);
}
clear() {
const e = {};
for (const l in this._values)
this._elements[l] && (e[l] = this._elements[l].element.shape.style.initial[this.config.attribute || "fill"]);
this.setAttributes(e), this._values = {};
}
}
var el = ll;
function al() {
this.series = { markers: [], regions: [] };
for (const t in this.params.series) {
const e = t;
if (this.params.series[e])
for (let l = 0; l < this.params.series[e].length; l++)
this.series[e][l] = new el(this.params.series[e][l], e === "markers" ? this._markers || {} : this.regions, this);
}
}
function tl(t, e) {
const l = B.maps[this.params.map.name].insets;
if (!(!l || l.length === 0))
for (let a = 0; a < l.length; a++) {
const n = l[a];
if (!n || !n.bbox || n.bbox.length < 2)
continue;
const [M, i] = n.bbox;
if (!(!M || !i) && t > M.x && t < i.x && e > M.y && e < i.y)
return n;
}
}
function nl({ coords: t }) {
return B.maps[this.params.map.name].projection ? this.coordsToPoint(...t) : {
x: t[0] * this.scale + this.transX * this.scale,
y: t[1] * this.scale + this.transY * this.scale
};
}
function Ml() {
const t = this.params.labels || {};
if (t.regions)
for (const e in this.regions) {
const l = this.regions[e];
!l || !l.element || !l.element.label || l.element.updateLabelPosition();
}
if (t.markers)
for (const e in this._markers) {
const l = this._markers[e];
l.element && typeof l.element.updateLabelPosition == "function" && l.element.updateLabelPosition();
}
}
function il() {
var e;
const t = ((e = this.params.lines) == null ? void 0 : e.curvature) || 0.5;
Object.values(this._lines || {}).forEach((l) => {
const a = Object.values(this._markers || {}).find(({ config: M }) => M.name === l.getConfig().from), n = Object.values(this._markers || {}).find(({ config: M }) => M.name === l.getConfig().to);
if (a && n) {
const M = this.getMarkerPosition(a.config), i = this.getMarkerPosition(n.config);
if (M && i) {
const { x: s, y: r } = M, { x: h, y: o } = i, m = (s + h) / 2, p = (r + o) / 2, c = m + t * (o - r), d = p - t * (h - s);
l.setStyle({
d: `M${s},${r} Q${c},${d} ${h},${o}`
});
}
}
});
}
function sl() {
if (this._markers)
for (const t in this._markers) {
const e = this._markers[t];
if (!e || !e.element || !e.element.shape)
continue;
const l = this.getMarkerPosition(e.config);
if (l !== !1) {
const a = Number.isNaN(l.x) ? 0 : l.x, n = Number.isNaN(l.y) ? 0 : l.y;
e.element.shape.set({
cx: a,
cy: n
});
}
}
}
function Zl() {
const t = this._baseScale;
this._width / this._height > this._defaultWidth / this._defaultHeight ? (this._baseScale = this._height / this._defaultHeight, this._baseTransX = Math.abs(this._width - this._defaultWidth * this._baseScale) / (2 * this._baseScale)) : (this._baseScale = this._width / this._defaultWidth, this._baseTransY = Math.abs(this._height - this._defaultHeight * this._baseScale) / (2 * this._baseScale)), this.scale *= this._baseScale / t, this.transX *= this._baseScale / t, this.transY *= this._baseScale / t;
}
var i0 = Zl;
function ol(t = {}) {
let e, l = [];
if (t.region ? l.push(t.region) : t.regions && (l = t.regions), l.length) {
if (l.forEach((a) => {
if (this.regions[a]) {
const n = this.regions[a].element.shape.getBBox();
n && (typeof e > "u" ? e = n : e = {
x: Math.min(e.x, n.x),
y: Math.min(e.y, n.y),
width: Math.max(e.x + e.width, n.x + n.width) - Math.min(e.x, n.x),
height: Math.max(e.y + e.height, n.y + n.height) - Math.min(e.y, n.y)
});
}
}), e)
return this._setScale(Math.min(this._width / e.width, this._height / e.height), -(e.x + e.width / 2), -(e.y + e.height / 2), !0, t.animate);
} else if (t.coords) {
const a = this.coordsToPoint(t.coords[0], t.coords[1]);
if (a) {
const n = this.transX - a.x / this.scale, M = this.transY - a.y / this.scale;
return this._setScale(t.scale ? t.scale * this._baseScale : this._baseScale, n, M, !0, t.animate);
}
}
}
var rl = {
onLoaded: "map:loaded",
onViewportChange: "viewport:changed",
onRegionClick: "region:clicked",
onMarkerClick: "marker:clicked",
onRegionSelected: "region:selected",
onMarkerSelected: "marker:selected",
onRegionTooltipShow: "region.tooltip:show",
onMarkerTooltipShow: "marker.tooltip:show",
onDestroyed: "map:destroyed"
}, S = rl;
function K(t, e, l, a, n) {
let M, i, s = 0;
const r = Math.abs(Math.round((t - this.scale) * 60 / Math.max(t, this.scale)));
let h, o, m, p, c, d, _ = this.transX, T = this.transY;
const F = this.params.zoomMax ?? 8, J = this.params.zoomMin ?? 1;
t > F * this._baseScale ? t = F * this._baseScale : t < J * this._baseScale && (t = J * this._baseScale), typeof e < "u" && typeof l < "u" && (M = t / this.scale, a ? (_ = e + this._defaultWidth * (this._width / (this._defaultWidth * t)) / 2, T = l + this._defaultHeight * (this._height / (this._defaultHeight * t)) / 2) : (_ = this.transX - (M - 1) / t * e, T = this.transY - (M - 1) / t * l)), n && r > 0 ? (h = this.scale, o = (t - h) / r, m = this.transX * this.scale, c = this.transY * this.scale, p = (_ * t - m) / r, d = (T * t - c) / r, i = setInterval(() => {
s += 1, this.scale = h + o * s, this.transX = (m + p * s) / this.scale, this.transY = (c + d * s) / this.scale, this._applyTransform(), s === r && (clearInterval(i), this._emit(S.onViewportChange, [
this.scale,
this.transX,
this.transY
]));
}, 10)) : (this.transX = _, this.transY = T, this.scale = t, this._applyTransform(), this._emit(S.onViewportChange, [
this.scale,
this.transX,
this.transY
]));
}
var v = {}, hl = 1, V = {
on(t, e, l, a = {}) {
const n = `jvm:${e}::${hl++}`;
v[n] = {
selector: t,
handler: l
}, l._uid = n, t.addEventListener(e, l, a);
},
delegate(t, e, l, a) {
e.split(" ").forEach((M) => {
V.on(t, M, (i) => {
const s = i.target;
s && s.matches && s.matches(l) && a.call(s, i);
});
});
},
off(t, e, l) {
const a = e.split(":")[1];
t.removeEventListener(a, l), delete v[l._uid];
},
flush() {
Object.keys(v).forEach((t) => {
V.off(v[t].selector, t, v[t].handler);
});
},
getEventRegistry() {
return v;
}
}, u = V;
function ml() {
let t = !1, e, l;
this.params.draggable && (u.on(this.container, "mousemove", (a) => {
if (!t)
return !1;
const n = a;
e !== void 0 && l !== void 0 && (this.transX -= (e - n.pageX) / this.scale, this.transY -= (l - n.pageY) / this.scale, this._applyTransform()), e = n.pageX, l = n.pageY;
}), u.on(this.container, "mousedown", (a) => {
t = !0;
const n = a;
return e = n.pageX, l = n.pageY, !1;
}), u.on(document.body, "mouseup", () => {
t = !1;
})), this.params.zoomOnScroll && u.on(this.container, "wheel", (a) => {
const n = a, M = ((n.deltaY || 0) >> 10 || 1) * 75, i = this.container.getBoundingClientRect(), s = n.pageX - i.left - window.scrollX, r = n.pageY - i.top - window.scrollY, h = (1 + (this.params.zoomOnScrollSpeed || 3) / 1e3) ** (-1.5 * M);
K.call(this, this.scale * h, s, r), a.preventDefault();
});
}
function pl() {
let t = 1, e = 0, l = 0, a = 0, n = 0, M = 0, i = 0, s = { top: 0, left: 0 };
const r = (h) => {
const o = h.touches;
let m = this.scale;
if (o.length === 1) {
if (n === 1) {
const p = o[0];
t === m && (this.transX -= (M - p.pageX) / m, this.transY -= (i - p.pageY) / m, this.canvas.applyTransformParams(m, this.transX, this.transY)), M = p.pageX, i = p.pageY;
}
} else if (o.length === 2)
if (n === 2)
m = Math.sqrt((o[0].pageX - o[1].pageX) ** 2 + (o[0].pageY - o[1].pageY) ** 2) / e, K.call(this, t * m, l, a, !1, !1), h.preventDefault();
else {
const p = this.container.getBoundingClientRect();
s = {
top: p.top + window.scrollY,
left: p.left + window.scrollX
}, l = o[0].pageX > o[1].pageX ? o[1].pageX + (o[0].pageX - o[1].pageX) / 2 : o[0].pageX + (o[1].pageX - o[0].pageX) / 2, a = o[0].pageY > o[1].pageY ? o[1].pageY + (o[0].pageY - o[1].pageY) / 2 : o[0].pageY + (o[1].pageY - o[0].pageY) / 2, l -= s.left, a -= s.top, t = this.scale, e = Math.sqrt((o[0].pageX - o[1].pageX) ** 2 + (o[0].pageY - o[1].pageY) ** 2);
}
n = o.length;
};
u.on(this.container, "touchstart", r), u.on(this.container, "touchmove", r);
}
function Y(t, e, l) {
var h, o, m, p, c, d, _;
const a = M0(e), n = (h = a == null ? void 0 : a.getAttribute("class")) != null && h.includes("jvm-region") ? "region" : "marker", M = n === "region", i = M ? a == null ? void 0 : a.getAttribute("data-code") : a == null ? void 0 : a.getAttribute("data-index");
if (!i)
throw new Error("Element does not have required data attribute");
let s = M ? S.onRegionSelected : S.onMarkerSelected;
l && (s = M ? S.onRegionTooltipShow : S.onMarkerTooltipShow);
const r = M ? (o = t.regions[i]) == null ? void 0 : o.element : (p = (m = t._markers) == null ? void 0 : m[i]) == null ? void 0 : p.element;
if (!r)
throw !M && !((c = t._markers) != null && c[i]) ? new Error(`Marker with index ${i} not found in map markers collection`) : M && !t.regions[i] ? new Error(`Region with code ${i} not found in map regions collection`) : new Error(`Element with code ${i} not found`);
return {
type: n,
code: i,
event: s,
element: r,
tooltipText: M ? t._mapData.paths[i].name || "" : ((_ = (d = t._markers) == null ? void 0 : d[i]) == null ? void 0 : _.config.name) || ""
};
}
function cl() {
const t = this.container;
let e, l, a = !1;
u.on(t, "mousemove", (n) => {
const M = n;
Math.abs((e || 0) - M.pageX) + Math.abs((l || 0) - M.pageY) > 2 && (a = !0);
}), u.delegate(t, "mousedown", ".jvm-element", (n) => {
const M = n;
e = M.pageX, l = M.pageY, a = !1;
}), u.delegate(t, "mouseover mouseout", ".jvm-element", (n) => {
try {
const M = Y(this, n.target, !0), { showTooltip: i } = this.params, s = this._tooltip;
n.type === "mouseover" ? (typeof M.element.hover == "function" && M.element.hover(!0), i && s && (this._emit(M.event, [M.event, s, M.code]), n.defaultPrevented || s.show(M.tooltipText))) : (typeof M.element.hover == "function" && M.element.hover(!1), i && s && s.hide());
} catch (M) {
const i = M instanceof Error ? M.message : String(M);
console.warn("Skipping mouseover/mouseout event due to error:", i), n.type === "mouseout" && this._tooltip && this._tooltip.hide();
}
}), u.delegate(t, "mouseup", ".jvm-element", (n) => {
try {
const M = Y(this, n.target, !1);
if (a)
return;
if (M.type === "region" && this.params.regionsSelectable || M.type === "marker" && this.params.markersSelectable) {
const i = M.element;
this.params[`${M.type}sSelectableOne`] && (M.type === "region" ? this.clearSelectedRegions() : this.clearSelectedMarkers()), typeof i.select == "function" && (i.isSelected ? i.select(!1) : i.select(!0), this._emit(M.event, [
M.event,
M.code,
i.isSelected,
M.type === "region" ? this.getSelectedRegions() : this.getSelectedMarkers()
]));
}
} catch (M) {
console.error("Error in mouseup handler:", M);
}
}), u.delegate(t, "click", ".jvm-element", (n) => {
try {
const { type: M, code: i } = Y(this, n.target, !1);
this._emit(M === "region" ? S.onRegionClick : S.onMarkerClick, [n, i]);
} catch (M) {
console.error("Error in click handler:", M);
}
});
}
function dl() {
const t = g("div", "jvm-zoom-btn jvm-zoomin", "+", !0), e = g("div", "jvm-zoom-btn jvm-zoomout", "−", !0);
this.container.appendChild(t), this.container.appendChild(e);
const l = (a = !0) => () => K.call(this, a ? this.scale * (this.params.zoomStep || 1.5) : this.scale / (this.params.zoomStep || 1.5), this._width / 2, this._height / 2, !1, this.params.zoomAnimate);
u.on(t, "click", l()), u.on(e, "click", l(!1));
}
function ul() {
this._width = this.container.offsetWidth, this._height = this.container.offsetHeight, i0.call(this), this.canvas.setSize(this._width, this._height), this._applyTransform();
}
var fl = {
_setupContainerEvents: ml,
_setupElementEvents: cl,
_setupZoomButtons: dl,
_setupContainerTouchEvents: pl,
_createRegions: W0,
_createLines: P0,
_createMarkers: H0,
_createSeries: al,
_applyTransform: x0,
_resize: i0,
_setScale: K,
setFocus: ol,
updateSize: ul,
coordsToPoint: I0,
getInsetForPoint: tl,
getMarkerPosition: nl,
_repositionLines: il,
_repositionMarkers: sl,
_repositionLabels: Ml
}, Sl = fl;
class gl {
constructor({ scale: e, values: l }, a) {
Z(this, "_scale");
Z(this, "_values");
Z(this, "_fromColor");
Z(this, "_toColor");
Z(this, "_map");
Z(this, "min", Number.MAX_VALUE);
Z(this, "max", 0);
this._scale = e, this._values = l, this._fromColor = this.hexToRgb(e[0]), this._toColor = this.hexToRgb(e[1]), this._map = a, this.setMinMaxValues(l), this.visualize();
}
setMinMaxValues(e) {
for (const l in e) {
const a = Number.parseFloat(String(e[l]));
a > this.max && (this.max = a), a < this.min && (this.min = a);
}
}
visualize() {
const e = {};
let l;
for (const a in this._values)
l = Number.parseFloat(String(this._values[a])), Number.isNaN(l) || (e[a] = this.getValue(l));
this.setAttributes(e);
}
setAttributes(e) {
for (const l in e)
this._map.regions[l] && this._map.regions[l].element.setStyle("fill", e[l]);
}
getValue(e) {
if (this.min === this.max)
return `#${this._toColor.join("")}`;
let l, a = "#";
for (let n = 0; n < 3; n++)
l = Math.round(this._fromColor[n] + (this._toColor[n] - this._fromColor[n]) * ((e - this.min) / (this.max - this.min))).toString(16), a += (l.length === 1 ? "0" : "") + l;
return a;
}
hexToRgb(e) {
let l = "0", a = "0", n = "0";
return e.length === 4 ? (l = `0x${e[1]}${e[1]}`, a = `0x${e[2]}${e[2]}`, n = `0x${e[3]}${e[3]}`) : e.length === 7 && (l = `0x${e[1]}${e[2]}`, a = `0x${e[3]}${e[4]}`, n = `0x${e[5]}${e[6]}`), [Number.parseInt(l, 16), Number.parseInt(a, 16), Number.parseInt(n, 16)];
}
}
var yl = gl, _l = {
map: {
name: "world",
projection: "mercator"
},
backgroundColor: "transparent",
draggable: !0,
zoomButtons: !0,
zoomOnScroll: !0,
zoomOnScrollSpeed: 3,
zoomMax: 12,
zoomMin: 1,
zoomAnimate: !0,
showTooltip: !0,
zoomStep: 1.5,
bindTouchEvents: !0,
selector: "",
lines: {
style: {
stroke: "#808080",
strokeWidth: 1,
strokeLinecap: "round"
},
elements: []
},
markersSelectable: !1,
markersSelectableOne: !1,
markerStyle: {
initial: {
r: 7,
fill: "#374151",
fillOpacity: 1,
stroke: "#FFF",
strokeWidth: 5,
strokeOpacity: 0.5
},
hover: {
fill: "#3cc0ff",
cursor: "pointer"
},
selected: {
fill: "blue"
},
selectedHover: {}
},
markerLabelStyle: {
initial: {
fontFamily: "Verdana",
fontSize: 12,
fontWeight: 500,
cursor: "default",
fill: "#374151"
},
hover: {
cursor: "pointer"
},
selected: {},
selectedHover: {}
},
regionsSelectable: !1,
regionsSelectableOne: !1,
regionStyle: {
initial: {
fill: "#dee2e8",
fillOpacity: 1,
stroke: "none",
strokeWidth: 0
},
hover: {
fillOpacity: 0.7,
cursor: "pointer"
},
selected: {
fill: "#9ca3af"
},
selectedHover: {}
},
regionLabelStyle: {
initial: {
fontFamily: "Verdana",
fontSize: "12",
fontWeight: "bold",
cursor: "default",
fill: "#35373e"
},
hover: {
cursor: "pointer"
}
}
}, bl = _l, kl = {
mill(t, e, l) {
return {
x: this.radius * (e - l) * this.radDeg,
y: -this.radius * Math.log(Math.tan((45 + 0.4 * t) * this.radDeg)) / 0.8
};
},
merc(t, e, l) {
return {
x: this.radius * (e - l) * this.radDeg,
y: -this.radius * Math.log(Math.tan(Math.PI / 4 + t * Math.PI / 360))
};
},
aea(t, e, l) {
const n = l * this.radDeg, M = 29.5 * this.radDeg, i = 45.5 * this.radDeg, s = t * this.radDeg, r = e * this.radDeg, h = (Math.sin(M) + Math.sin(i)) / 2, o = Math.cos(M) * Math.cos(M) + 2 * h * Math.sin(M), m = h * (r - n), p = Math.sqrt(o - 2 * h * Math.sin(s)) / h, c = Math.sqrt(o - 2 * h * Math.sin(0)) / h;
return {
x: p * Math.sin(m) * this.radius,
y: -(c - p * Math.cos(m)) * this.radius
};
},
lcc(t, e, l) {
const n = l * this.radDeg, M = e * this.radDeg, i = 33 * this.radDeg, s = 45 * this.radDeg, r = t * this.radDeg, h = Math.log(Math.cos(i) * (1 / Math.cos(s))) / Math.log(Math.tan(Math.PI / 4 + s / 2) * (1 / Math.tan(Math.PI / 4 + i / 2))), o = Math.cos(i) * Math.tan(Math.PI / 4 + i / 2) ** h / h, m = o * (1 / Math.tan(Math.PI / 4 + r / 2)) ** h, p = o * (1 / Math.tan(Math.PI / 4 + 0 / 2)) ** h;
return {
x: m * Math.sin(h * (M - n)) * this.radius,
y: -(p - m * Math.cos(h * (M - n))) * this.radius
};
},
degRad: 180 / Math.PI,
radDeg: Math.PI / 180,
radius: 6381372
}, Q = kl;
class vl {
constructor(e, l) {
Z(this, "node");
Z(this, "style");
this.node = this._createElement(e), this.style = { initial: {} }, l && this.set(l);
}
_createElement(e) {
return document.createElementNS("http://www.w3.org/2000/svg", e);
}
addClass(e) {
this.node.setAttribute("class", e);
}
getBBox() {
return this.node.getBBox();
}
set(e, l) {
if (typeof e == "object")
for (const a in e)
this.applyAttr(a, e[a]);
else l !== void 0 && this.applyAttr(e, l);
}
get(e) {
return this.style.initial[e];
}
applyAttr(e, l) {
this.node.setAttribute(E0(e), String(l));
}
remove() {
I(this.node);
}
}
var C = vl;
class Ul extends C {
constructor(l, a, n = { initial: {} }) {
super(l, a);
Z(this, "isHovered");
Z(this, "isSelected");
Z(this, "style");
this.isHovered = !1, this.isSelected = !1, this.style = n, this.style.current = {}, this.updateStyle();
}
hover(l) {
this.isHovered = l, this.updateStyle();
}
select(l) {
this.isSelected = l, this.updateStyle();
}
setStyle(l, a) {
typeof l == "object" ? f(this.style.current, l) : f(this.style.current, { [l]: a }), this.updateStyle();
}
updateStyle() {
const l = {};
f(l, this.style.initial), f(l, this.style.current || {}), this.isHovered && f(l, this.style.hover || {}), this.isSelected && (f(l, this.style.selected || {}), this.isHovered && f(l, this.style.selectedHover || {})), this.set(l);
}
}
var w = Ul;
class Rl extends w {
constructor(l, a) {
super("image", l, a);
Z(this, "width", 0);
Z(this, "height", 0);
Z(this, "cx", 0);
Z(this, "cy", 0);
Z(this, "offset", [0, 0]);
}
applyAttr(l, a) {
let n;
if (l === "image") {
if (typeof a == "object") {
const M = a;
n = M.url || "", this.offset = M.offset || [0, 0];
} else
n = String(a), this.offset = [0, 0];
this.node.setAttributeNS("http://www.w3.org/1999/xlink", "href", n), this.width = 23, this.height = 23, this.applyAttr("width", this.width), this.applyAttr("height", this.height), this.applyAttr("x", this.cx - this.width / 2 + this.offset[0]), this.applyAttr("y", this.cy - this.height / 2 + this.offset[1]);
} else l === "cx" ? (this.cx = Number(a), this.width && this.applyAttr("x", this.cx - this.width / 2 + this.offset[0])) : l === "cy" ? (this.cy = Number(a), this.height && this.applyAttr("y", this.cy - this.height / 2 + this.offset[1])) : super.applyAttr(l, a);
}
}
var Cl = Rl;
class Al extends w {
constructor(e, l) {
super("text", e, l);
}
applyAttr(e, l) {
e === "text" ? this.node.textContent = String(l) : e === "x" || e === "y" || e === "cx" || e === "cy" ? this.node.setAttribute(e, `${l}`) : super.applyAttr(e, l);
}
}
var wl = Al;
class El extends C {
constructor(l) {
super("svg");
Z(this, "_container");
Z(this, "_defsElement");
Z(this, "_rootElement");
this._container = l, this._defsElement = new C("defs"), this._rootElement = new C("g", { id: "jvm-regions-group" }), this.node.appendChild(this._defsElement.node), this.node.appendChild(this._rootElement.node), this._container.appendChild(this.node);
}
setSize(l, a) {
this.node.setAttribute("width", String(l)), this.node.setAttribute("height", String(a));
}
applyTransformParams(l, a, n) {
this._rootElement.node.setAttribute("transform", `scale(${l}) translate(${a}, ${n})`);
}
createPath(l, a, n) {
const M = new w("path", l, a);
return M.node.setAttribute("fill-rule", "evenodd"), this._add(M, n);
}
createCircle(l, a, n) {
const M = new w("circle", l, a);
return this._add(M, n);
}
createLine(l, a, n) {
const M = new w("line", l, a);
return this._add(M, n);
}
createText(l, a, n) {
const M = new wl(l, a);
return this._add(M, n);
}
createImage(l, a, n) {
const M = new Cl(l, a);
return this._add(M, n);
}
createGroup(l) {
const a = new C("g");
return this.node.appendChild(a.node), l && (a.node.id = l), a.canvas = this, a;
}
_add(l, a) {
return a = a || this._rootElement, a && a.node ? a.node.appendChild(l.node) : this._rootElement.node.appendChild(l.node), l;
}
}
var Tl = El, k = "jvm-", Ll = `${k}container`, Nl = `${k}markers-group`, xl = `${k}markers-labels-group`, Il = `${k}lines-group`, s0 = `${k}series-container`, zl = `${s0} ${k}series-h`, Ol = `${s0} ${k}series-v`;
const b = class b {
constructor(e = {}) {
Z(this, "params");
Z(this, "regions", {});
Z(this, "scale", 1);
Z(this, "transX", 0);
Z(this, "transY", 0);
Z(this, "container");
Z(this, "canvas");
Z(this, "dataVisualization");
Z(this, "legendHorizontal");
Z(this, "legendVertical");
Z(this, "series", { markers: [], regions: [] });
Z(this, "_mapData");
Z(this, "_markers", {});
Z(this, "_lines", {});
Z(this, "_defaultWidth");
Z(this, "_defaultHeight");
Z(this, "_height", 0);
Z(this, "_width", 0);
Z(this, "_baseScale", 1);
Z(this, "_baseTransX", 0);
Z(this, "_baseTransY", 0);
Z(this, "_tooltip");
Z(this, "_linesGroup");
Z(this, "_markersGroup");
Z(this, "_markerLabelsGroup");
Z(this, "_canvasImpl");
Z(this, "mercator", {
convert: (e, l) => {
var M;
const a = ((M = this._mapData.projection) == null ? void 0 : M.centralMeridian) || 0;
return Q.merc(e, l, a);
}
});
Z(this, "miller", {
convert: (e, l) => {
var M;
const a = ((M = this._mapData.projection) == null ? void 0 : M.centralMeridian) || 0;
return Q.mill(e, l, a);
}
});
this.params = f(b.defaults, e, !0);
const l = this.params.map, a = typeof l == "string" ? l : l.name, n = b.maps[a];
if (!n)
throw new Error(`Attempt to use map which was not loaded: ${a}`);
this._mapData = n, this._defaultWidth = this._mapData.width, this._defaultHeight = this._mapData.height, document.readyState !== "loading" ? this._init() : window.addEventListener("DOMContentLoaded", () => this._init());
}
_init() {
var a, n;
const e = this.params, l = M0(e.selector);
if (!l)
throw new Error(`Element not found: ${e.selector}`);
if (this.container = l, this.container.classList.add(Ll), this._canvasImpl = new Tl(this.container), this.canvas = this._canvasImpl, this.setBackgroundColor(e.backgroundColor || ""), this._createRegions(), this.updateSize(), (a = e.lines) != null && a.elements) {
const M = this._canvasImpl.createGroup(Il);
if (!M)
throw new TypeError("Failed to create lines group");
this._linesGroup = M;
}
if (e.markers) {
const M = this._canvasImpl.createGroup(Nl), i = this._canvasImpl.createGroup(xl);
if (!M || !i)
throw new TypeError("Failed to create markers groups");
this._markersGroup = M, this._markerLabelsGroup = i;
}
this._createMarkers(e.markers || []), this._createLines(((n = e.lines) == null ? void 0 : n.elements) || []), this._repositionLabels(), this._setupContainerEvents(), this._setupElementEvents(), e.zoomButtons && this._setupZoomButtons(), e.showTooltip && (this._tooltip = new N0(this)), e.selectedRegions && this._setSelected("regions", e.selectedRegions), e.selectedMarkers && this._setSelected("_markers", e.selectedMarkers), e.focusOn && this.setFocus(e.focusOn), e.visualizeData && (this.dataVisualization = new yl(e.visualizeData, this)), e.bindTouchEvents && "ontouchstart" in window && this._setupContainerTouchEvents(), e.series && (this.container.appendChild(this.legendHorizontal = g("div", zl)), this.container.appendChild(this.legendVertical = g("div", Ol)), this._createSeries()), this._emit(S.onLoaded, [this]);
}
setBackgroundColor(e) {
this.container.style.backgroundColor = e;
}
getSelectedRegions() {
return this._getSelected("regions");
}
clearSelectedRegions(e) {
(this._normalizeRegions(e) || this._getSelected("regions")).forEach((a) => {
this.regions[a].element.select(!1);
});
}
setSelectedRegions(e) {
this.clearSelectedRegions();
const l = this._normalizeRegions(e);
l && this._setSelected("regions", l);
}
getSelectedMarkers() {
return this._getSelected("_markers");
}
clearSelectedMarkers() {
this._clearSelected("_markers");
}
setSelectedMarkers(e) {
const l = this._normalizeRegions(e);
l && this._setSelected("_markers", l);
}
addMarkers(e) {
const l = Array.isArray(e) ? e : [e];
this._createMarkers(l, !0);
}
removeMarkers(e) {
(e || Object.keys(this._markers)).forEach((a) => {
const n = this._markers[a];
n && (typeof n.remove == "function" ? n.remove() : n.shape && (n.shape.remove(), n.label && n.label.remove()), delete this._markers[a]);
});
}
addLine(e, l, a = {}) {
console.warn("`addLine` method is deprecated, please use `addLines` instead."), this._createLines([{ from: e, to: l, style: a }]);
}
addLines(e) {
const l = this._getLinesAsUids(), a = Array.isArray(e) ? e : [e];
this._createLines(a.filter((n) => !l.includes(L(n.from, n.to))));
}
removeLines(e) {
Array.isArray(e) && typeof e[0] != "string" ? e = e.map((l) => L(l.from, l.to)) : Array.isArray(e) || (e = this._getLinesAsUids()), e.forEach((l) => {
this._lines[l].dispose(), delete this._lines[l];
});
}
removeLine(e, l) {
console.warn("`removeLine` method is deprecated, please use `removeLines` instead.");
const a = L(e, l);
Object.prototype.hasOwnProperty.call(this._lines, a) && (this._lines[a].element.remove(), delete this._lines[a]);
}
reset() {
var e, l, a, n;
for (const M in this.series || {})
for (let i = 0; i < (((l = (e = this.series) == null ? void 0 : e[M]) == null ? void 0 : l.length) || 0); i++)
(n = (a = this.series) == null ? void 0 : a[M][i]) == null || n.clear();
this.legendHorizontal && (I(this.legendHorizontal), this.legendHorizontal = void 0), this.legendVertical && (I(this.legendVertical), this.legendVertical = void 0), this.scale = this._baseScale, this.transX = this._baseTransX, this.transY = this._baseTransY, this._applyTransform(), this.clearSelectedMarkers(), this.clearSelectedRegions(), this.removeMarkers();
}
destroy(e = !0) {
var l;
u.flush(), (l = this._tooltip) == null || l.dispose(), this._emit(S.onDestroyed, []), e && Object.keys(this).forEach((a) => {
try {
delete this[a];
} catch {
}
});
}
extend(e, l) {
if (typeof this[e] == "function")
throw new TypeError(`The method [${e}] does already exist, please use another name.`);
b.prototype[e] = l;
}
getInsetForPoint(e, l) {
return !1;
}
getMarkerPosition(e) {
return { x: 0, y: 0 };
}
coordsToPoint(e, l) {
return { x: 0, y: 0 };
}
_repositionMarkers() {
}
_repositionLines() {
}
_setScale(e) {
}
_emit(e, l) {
var a;
for (const n in S)
S[n] === e && typeof this.params[n] == "function" && ((a = this.params[n]) == null || a.apply(this, l));
}
_getSelected(e) {
const l = [];
for (const a in this[e])
this[e][a].element.isSelected && l.push(a);
return l;
}
_setSelected(e, l) {
l.forEach((a) => {
this[e][a] && this[e][a].element.select(!0);
});
}
_clearSelected(e) {
this._getSelected(e).forEach((l) => {
this[e][l].element.select(!1);
});
}
_getLinesAsUids() {
return Object.keys(this._lines);
}
_normalizeRegions(e) {
if (e)
return typeof e == "string" ? [e] : e;
}
_createRegions() {
}
_createMarkers(e, l = !1) {
}
_createLines(e) {
}
_createSeries() {
}
_repositionLabels() {
}
_setupContainerEvents() {
}
_setupElementEvents() {
}
_setupZoomButtons() {
}
_setupContainerTouchEvents() {
}
_applyTransform() {
}
updateSize() {
}
setFocus(e) {
}
};
Z(b, "maps", {}), Z(b, "defaults", bl);
let O = b;
Object.assign(O.prototype, Sl);
var B = O;
class A {
constructor(e = {}) {
if (!e.selector)
throw new Error("Selector is not given.");
return new B(e);
}
static addMap(e, l) {
B.maps[e] = l;
}
}
typeof window < "u" && (window.VectorMap = A);
var Bl = { insets: [{ width: 600, top: 0, height: 650.3183105409283, bbox: [{ y: -168643134312261e-7, x: 903208.6719108557 }, { y: -5043360381389352e-9, x: 19992582811667882e-9 }], left: 0 }], paths: { "BR-AC": { path: "M30.732574,238.03114l-2.08,-0.04l0.54,-1.81l-0.21,-0.83l-0.25,-0.49l-1.25,-0.7l-0.14,-0.45l0.27,-1.15l-0.77,-1.95l-1.09,-0.64l-5.6,-1.25l-7.34,-0.19l0.27,-0.56l2.49,-2.26l0.89,-1.23l0.29,-1.2l-0.22,-1.23l-0.68,-0.91l-0.83,-0.44l-1.68,-2.95l-0.77