@kong-ui-public/analytics-geo-map 1.4.6 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- import { computed as M, defineComponent as _0, createElementBlock as A, openBlock as N, createCommentVNode as a0, toDisplayString as X, Fragment as z0, renderList as T0, createElementVNode as $, normalizeStyle as C0, toRef as f0, useId as D0, ref as h0, onMounted as N0, watch as n0, createBlock as U0, renderSlot as r0, createVNode as I0, unref as D, createTextVNode as O0 } from "vue";
2
- import { Map as R0, Popup as E0 } from "maplibre-gl";
3
- import { createI18n as A0, i18nTComponent as $0 } from "@kong-ui-public/i18n";
4
- import { AnalyticsIcon as H0 } from "@kong/icons";
5
- const G0 = {
1
+ import { computed as L, defineComponent as s0, createElementBlock as T, openBlock as k, createCommentVNode as W, toDisplayString as U, Fragment as C0, renderList as D0, createElementVNode as B, normalizeStyle as N0, useCssVars as I0, toRef as p0, ref as j, useId as U0, onMounted as O0, watch as a0, createBlock as m0, renderSlot as r0, createVNode as R0, unref as I, createTextVNode as E0 } from "vue";
2
+ import { Map as A0 } from "maplibre-gl";
3
+ import { createI18n as $0, i18nTComponent as G0 } from "@kong-ui-public/i18n";
4
+ import { AnalyticsIcon as q0 } from "@kong/icons";
5
+ const H0 = {
6
6
  ms: "ms",
7
7
  bytes: "Byte{plural}",
8
8
  count: "request{plural}",
9
9
  "count/minute": "rpm",
10
10
  requests: "request{plural}"
11
- }, q0 = {
11
+ }, K0 = {
12
12
  request_count: "Request count",
13
13
  request_per_minute: "Requests per minute",
14
14
  response_latency_average: "Response latency (avg)",
@@ -33,87 +33,87 @@ const G0 = {
33
33
  request_size_p95: "Request size (p95)",
34
34
  request_size_p50: "Request size (p50)",
35
35
  request_size_sum: "Request size (sum)"
36
- }, K0 = {
36
+ }, j0 = {
37
37
  windows_zoom_help_text: "Use Ctrl + Scroll to zoom the map",
38
38
  mac_zoom_help_text: "Use ⌘ + Scroll to zoom the map",
39
39
  mobile_zoom_help_text: "Use two fingers to zoom the map"
40
- }, j0 = "No location", W0 = "No location data found.", Z0 = {
41
- metricUnits: G0,
42
- metrics: q0,
43
- cooperative_gestures: K0,
44
- no_location_data: j0,
45
- no_location_data_description: W0
40
+ }, W0 = "No location", Z0 = "No location data found.", J0 = {
41
+ metricUnits: H0,
42
+ metrics: K0,
43
+ cooperative_gestures: j0,
44
+ no_location_data: W0,
45
+ no_location_data_description: Z0
46
46
  };
47
- function J0() {
48
- const e = A0("en-us", Z0);
47
+ function X0() {
48
+ const e = $0("en-us", J0);
49
49
  return {
50
50
  i18n: e,
51
- i18nT: $0(e)
51
+ i18nT: G0(e)
52
52
  // Translation component <i18n-t>
53
53
  };
54
54
  }
55
- function F0(e) {
55
+ function w0(e) {
56
56
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
57
57
  }
58
- var w0 = { exports: {} };
58
+ var k0 = { exports: {} };
59
59
  (function(e) {
60
60
  (function() {
61
- function t(r, l) {
62
- if (l.separator === !1 || r < 1e3)
63
- return r.toString();
64
- var u = typeof l.separator == "string" ? l.separator : ",", p = [], y = Math.round(r).toString().split("");
65
- return y.reverse().forEach(function(_, w) {
61
+ function t(l, a) {
62
+ if (a.separator === !1 || l < 1e3)
63
+ return l.toString();
64
+ var u = typeof a.separator == "string" ? a.separator : ",", p = [], m = Math.round(l).toString().split("");
65
+ return m.reverse().forEach(function(_, w) {
66
66
  w && w % 3 === 0 && p.push(u), p.push(_);
67
67
  }), p.reverse().join("");
68
68
  }
69
- function i(r, l, u) {
70
- var p = r / l, y = u.round ? "round" : "floor";
71
- return u.decimal === !1 ? (r = Math[y](p), r.toString()) : (u.precision ? r = p : r = p < 10 ? Math[y](p * 10) / 10 : Math[y](p), r = r.toString(), typeof u.decimal == "string" && (r = r.replace(".", u.decimal)), r);
69
+ function i(l, a, u) {
70
+ var p = l / a, m = u.round ? "round" : "floor";
71
+ return u.decimal === !1 ? (l = Math[m](p), l.toString()) : (u.precision ? l = p : l = p < 10 ? Math[m](p * 10) / 10 : Math[m](p), l = l.toString(), typeof u.decimal == "string" && (l = l.replace(".", u.decimal)), l);
72
72
  }
73
- var a = 1e3, n = 1e4, o = 1e6, s = 1e9, c = 1e12;
74
- function f(r, l) {
73
+ var r = 1e3, n = 1e4, o = 1e6, s = 1e9, c = 1e12;
74
+ function f(l, a) {
75
75
  var u;
76
- l = l || {};
77
- var p = r < 0;
78
- p && (r = Math.abs(r)), l.precision && (r = parseFloat(r.toPrecision(l.precision)));
79
- var y = l.min10k ? n : a;
80
- return r < y || l.precision && l.precision > Math.log10(r) ? u = t(i(r, 1, l), l) : r < o ? u = i(r, a, l) + "k" : r < s ? u = i(r, o, l) + "m" : r < c ? u = t(i(r, s, l), l) + "b" : u = t(i(r, c, l), l) + "t", p && (u = "-" + u), l.capital && (u = u.toUpperCase()), l.prefix && (u = l.prefix + u), l.suffix && (u = u + l.suffix), u;
76
+ a = a || {};
77
+ var p = l < 0;
78
+ p && (l = Math.abs(l)), a.precision && (l = parseFloat(l.toPrecision(a.precision)));
79
+ var m = a.min10k ? n : r;
80
+ return l < m || a.precision && a.precision > Math.log10(l) ? u = t(i(l, 1, a), a) : l < o ? u = i(l, r, a) + "k" : l < s ? u = i(l, o, a) + "m" : l < c ? u = t(i(l, s, a), a) + "b" : u = t(i(l, c, a), a) + "t", p && (u = "-" + u), a.capital && (u = u.toUpperCase()), a.prefix && (u = a.prefix + u), a.suffix && (u = u + a.suffix), u;
81
81
  }
82
82
  f.addCommas = t, e.exports = f;
83
83
  })();
84
- })(w0);
85
- var X0 = w0.exports;
86
- const Q0 = /* @__PURE__ */ F0(X0);
87
- function Y0({
84
+ })(k0);
85
+ var Q0 = k0.exports;
86
+ const Y0 = /* @__PURE__ */ w0(Q0);
87
+ function b0({
88
88
  countryMetrics: e,
89
89
  metric: t
90
90
  }) {
91
- const i = M(() => Math.log(Math.min(...Object.values(e.value)))), a = M(() => Math.log(Math.max(...Object.values(e.value)))), n = M(() => {
91
+ const i = L(() => Math.log(Math.min(...Object.values(e.value)))), r = L(() => Math.log(Math.max(...Object.values(e.value)))), n = L(() => {
92
92
  var f;
93
93
  return !((f = t.value) != null && f.includes("latency"));
94
- }), o = M(() => {
95
- const r = (a.value - i.value) / 5, l = [
96
- i.value + 4 * r,
97
- i.value + 3 * r,
98
- i.value + 2 * r,
99
- i.value + 1 * r,
94
+ }), o = L(() => {
95
+ const l = (r.value - i.value) / 5, a = [
96
+ i.value + 4 * l,
97
+ i.value + 3 * l,
98
+ i.value + 2 * l,
99
+ i.value + 1 * l,
100
100
  i.value
101
101
  ];
102
- return l.map((u, p) => {
103
- const y = p === 0 ? a.value : l[p - 1], _ = Math.exp(u), w = Math.exp(y);
104
- let S = "";
105
- return p === 0 ? S = `> ${c(_)}` : p === l.length - 1 ? S = `< ${c(w)}` : S = `${c(_)} - ${c(w)}`, {
102
+ return a.map((u, p) => {
103
+ const m = p === 0 ? r.value : a[p - 1], _ = Math.exp(u), w = Math.exp(m);
104
+ let O = "";
105
+ return p === 0 ? O = `> ${c(_)}` : p === a.length - 1 ? O = `< ${c(w)}` : O = `${c(_)} - ${c(w)}`, {
106
106
  color: s(_),
107
- range: S
107
+ range: O
108
108
  };
109
109
  });
110
110
  }), s = (f) => {
111
- const r = Math.log(f), u = (a.value - i.value) / 5;
112
- return r >= i.value + 4 * u ? "#00819d" : r >= i.value + 3 * u ? "#00abd2" : r >= i.value + 2 * u ? "#00c8f4" : r >= i.value + 1 * u ? "#67e3ff" : "#b3f1ff";
111
+ const l = Math.log(f), u = (r.value - i.value) / 5;
112
+ return l >= i.value + 4 * u ? "#00819d" : l >= i.value + 3 * u ? "#00abd2" : l >= i.value + 2 * u ? "#00c8f4" : l >= i.value + 1 * u ? "#67e3ff" : "#b3f1ff";
113
113
  }, c = (f) => {
114
- var l;
115
- const r = Math.trunc(f);
116
- return n.value ? Q0(r, { capital: !0 }) : new Intl.NumberFormat(((l = document == null ? void 0 : document.documentElement) == null ? void 0 : l.lang) || "en-US").format(r);
114
+ var a;
115
+ const l = Math.trunc(f);
116
+ return n.value ? Y0(l, { capital: !0 }) : new Intl.NumberFormat(((a = document == null ? void 0 : document.documentElement) == null ? void 0 : a.lang) || "en-US").format(l);
117
117
  };
118
118
  return {
119
119
  getColor: s,
@@ -121,10 +121,10 @@ function Y0({
121
121
  legendData: o
122
122
  };
123
123
  }
124
- const p0 = {
125
- useI18n: J0,
126
- useMetricUtils: Y0
127
- }, b0 = "FeatureCollection", ee = [
124
+ const y0 = {
125
+ useI18n: X0,
126
+ useMetricUtils: b0
127
+ }, ee = "FeatureCollection", te = [
128
128
  {
129
129
  type: "Feature",
130
130
  properties: {
@@ -2556,11 +2556,11 @@ const p0 = {
2556
2556
  ]
2557
2557
  }
2558
2558
  }
2559
- ], te = {
2560
- type: b0,
2561
- features: ee
2559
+ ], ie = {
2560
+ type: ee,
2561
+ features: te
2562
2562
  };
2563
- var ie = re, Q, H, v, Y, e0, ne = [
2563
+ var ne = re, b, G, g, e0, i0, ae = [
2564
2564
  "Point",
2565
2565
  "MultiPoint",
2566
2566
  "LineString",
@@ -2570,105 +2570,105 @@ var ie = re, Q, H, v, Y, e0, ne = [
2570
2570
  "GeometryCollection"
2571
2571
  ];
2572
2572
  function re(e) {
2573
- Y = 2, e0 = Math.pow(10, 6), v = null, Q = [], H = [];
2574
- var t = e.readFields(ae, {});
2575
- return Q = null, t;
2573
+ e0 = 2, i0 = Math.pow(10, 6), g = null, b = [], G = [];
2574
+ var t = e.readFields(oe, {});
2575
+ return b = null, t;
2576
2576
  }
2577
- function ae(e, t, i) {
2578
- e === 1 ? Q.push(i.readString()) : e === 2 ? Y = i.readVarint() : e === 3 ? e0 = Math.pow(10, i.readVarint()) : e === 4 ? oe(i, t) : e === 5 ? k0(i, t) : e === 6 && s0(i, t);
2577
+ function oe(e, t, i) {
2578
+ e === 1 ? b.push(i.readString()) : e === 2 ? e0 = i.readVarint() : e === 3 ? i0 = Math.pow(10, i.readVarint()) : e === 4 ? se(i, t) : e === 5 ? M0(i, t) : e === 6 && l0(i, t);
2579
2579
  }
2580
- function oe(e, t) {
2581
- return t.type = "FeatureCollection", t.features = [], e.readMessage(se, t);
2580
+ function se(e, t) {
2581
+ return t.type = "FeatureCollection", t.features = [], e.readMessage(le, t);
2582
2582
  }
2583
- function k0(e, t) {
2583
+ function M0(e, t) {
2584
2584
  t.type = "Feature";
2585
- var i = e.readMessage(le, t);
2585
+ var i = e.readMessage(ue, t);
2586
2586
  return "geometry" in i || (i.geometry = null), i;
2587
2587
  }
2588
- function s0(e, t) {
2589
- return t.type = "Point", e.readMessage(ue, t);
2590
- }
2591
- function se(e, t, i) {
2592
- e === 1 ? t.features.push(k0(i, {})) : e === 13 ? H.push(l0(i)) : e === 15 && b(i, t);
2588
+ function l0(e, t) {
2589
+ return t.type = "Point", e.readMessage(ce, t);
2593
2590
  }
2594
2591
  function le(e, t, i) {
2595
- e === 1 ? t.geometry = s0(i, {}) : e === 11 ? t.id = i.readString() : e === 12 ? t.id = i.readSVarint() : e === 13 ? H.push(l0(i)) : e === 14 ? t.properties = b(i, {}) : e === 15 && b(i, t);
2592
+ e === 1 ? t.features.push(M0(i, {})) : e === 13 ? G.push(u0(i)) : e === 15 && t0(i, t);
2596
2593
  }
2597
2594
  function ue(e, t, i) {
2598
- e === 1 ? t.type = ne[i.readVarint()] : e === 2 ? v = i.readPackedVarint() : e === 3 ? ce(t, i, t.type) : e === 4 ? (t.geometries = t.geometries || [], t.geometries.push(s0(i, {}))) : e === 13 ? H.push(l0(i)) : e === 15 && b(i, t);
2595
+ e === 1 ? t.geometry = l0(i, {}) : e === 11 ? t.id = i.readString() : e === 12 ? t.id = i.readSVarint() : e === 13 ? G.push(u0(i)) : e === 14 ? t.properties = t0(i, {}) : e === 15 && t0(i, t);
2599
2596
  }
2600
2597
  function ce(e, t, i) {
2601
- i === "Point" ? e.coordinates = de(t) : i === "MultiPoint" || i === "LineString" ? e.coordinates = m0(t) : i === "MultiLineString" ? e.coordinates = y0(t) : i === "Polygon" ? e.coordinates = y0(t, !0) : i === "MultiPolygon" && (e.coordinates = fe(t));
2598
+ e === 1 ? t.type = ae[i.readVarint()] : e === 2 ? g = i.readPackedVarint() : e === 3 ? de(t, i, t.type) : e === 4 ? (t.geometries = t.geometries || [], t.geometries.push(l0(i, {}))) : e === 13 ? G.push(u0(i)) : e === 15 && t0(i, t);
2599
+ }
2600
+ function de(e, t, i) {
2601
+ i === "Point" ? e.coordinates = fe(t) : i === "MultiPoint" || i === "LineString" ? e.coordinates = x0(t) : i === "MultiLineString" ? e.coordinates = v0(t) : i === "Polygon" ? e.coordinates = v0(t, !0) : i === "MultiPolygon" && (e.coordinates = he(t));
2602
2602
  }
2603
- function l0(e) {
2603
+ function u0(e) {
2604
2604
  for (var t = e.readVarint() + e.pos, i = null; e.pos < t; ) {
2605
- var a = e.readVarint(), n = a >> 3;
2605
+ var r = e.readVarint(), n = r >> 3;
2606
2606
  n === 1 ? i = e.readString() : n === 2 ? i = e.readDouble() : n === 3 ? i = e.readVarint() : n === 4 ? i = -e.readVarint() : n === 5 ? i = e.readBoolean() : n === 6 && (i = JSON.parse(e.readString()));
2607
2607
  }
2608
2608
  return i;
2609
2609
  }
2610
- function b(e, t) {
2611
- for (var i = e.readVarint() + e.pos; e.pos < i; ) t[Q[e.readVarint()]] = H[e.readVarint()];
2612
- return H = [], t;
2610
+ function t0(e, t) {
2611
+ for (var i = e.readVarint() + e.pos; e.pos < i; ) t[b[e.readVarint()]] = G[e.readVarint()];
2612
+ return G = [], t;
2613
2613
  }
2614
- function de(e) {
2615
- for (var t = e.readVarint() + e.pos, i = []; e.pos < t; ) i.push(e.readSVarint() / e0);
2614
+ function fe(e) {
2615
+ for (var t = e.readVarint() + e.pos, i = []; e.pos < t; ) i.push(e.readSVarint() / i0);
2616
2616
  return i;
2617
2617
  }
2618
- function K(e, t, i, a) {
2618
+ function Z(e, t, i, r) {
2619
2619
  var n = 0, o = [], s, c, f = [];
2620
- for (c = 0; c < Y; c++) f[c] = 0;
2620
+ for (c = 0; c < e0; c++) f[c] = 0;
2621
2621
  for (; i ? n < i : e.pos < t; ) {
2622
- for (s = [], c = 0; c < Y; c++)
2623
- f[c] += e.readSVarint(), s[c] = f[c] / e0;
2622
+ for (s = [], c = 0; c < e0; c++)
2623
+ f[c] += e.readSVarint(), s[c] = f[c] / i0;
2624
2624
  o.push(s), n++;
2625
2625
  }
2626
- return a && o.push(o[0]), o;
2626
+ return r && o.push(o[0]), o;
2627
2627
  }
2628
- function m0(e) {
2629
- return K(e, e.readVarint() + e.pos);
2628
+ function x0(e) {
2629
+ return Z(e, e.readVarint() + e.pos);
2630
2630
  }
2631
- function y0(e, t) {
2631
+ function v0(e, t) {
2632
2632
  var i = e.readVarint() + e.pos;
2633
- if (!v) return [K(e, i, null, t)];
2634
- for (var a = [], n = 0; n < v.length; n++) a.push(K(e, i, v[n], t));
2635
- return v = null, a;
2633
+ if (!g) return [Z(e, i, null, t)];
2634
+ for (var r = [], n = 0; n < g.length; n++) r.push(Z(e, i, g[n], t));
2635
+ return g = null, r;
2636
2636
  }
2637
- function fe(e) {
2637
+ function he(e) {
2638
2638
  var t = e.readVarint() + e.pos;
2639
- if (!v) return [[K(e, t, null, !0)]];
2640
- for (var i = [], a = 1, n = 0; n < v[0]; n++) {
2641
- for (var o = [], s = 0; s < v[a]; s++) o.push(K(e, t, v[a + 1 + s], !0));
2642
- a += v[a] + 1, i.push(o);
2639
+ if (!g) return [[Z(e, t, null, !0)]];
2640
+ for (var i = [], r = 1, n = 0; n < g[0]; n++) {
2641
+ for (var o = [], s = 0; s < g[r]; s++) o.push(Z(e, t, g[r + 1 + s], !0));
2642
+ r += g[r] + 1, i.push(o);
2643
2643
  }
2644
- return v = null, i;
2644
+ return g = null, i;
2645
2645
  }
2646
- var he = ie, u0 = {};
2646
+ var pe = ne, c0 = {};
2647
2647
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
2648
- u0.read = function(e, t, i, a, n) {
2649
- var o, s, c = n * 8 - a - 1, f = (1 << c) - 1, r = f >> 1, l = -7, u = i ? n - 1 : 0, p = i ? -1 : 1, y = e[t + u];
2650
- for (u += p, o = y & (1 << -l) - 1, y >>= -l, l += c; l > 0; o = o * 256 + e[t + u], u += p, l -= 8)
2648
+ c0.read = function(e, t, i, r, n) {
2649
+ var o, s, c = n * 8 - r - 1, f = (1 << c) - 1, l = f >> 1, a = -7, u = i ? n - 1 : 0, p = i ? -1 : 1, m = e[t + u];
2650
+ for (u += p, o = m & (1 << -a) - 1, m >>= -a, a += c; a > 0; o = o * 256 + e[t + u], u += p, a -= 8)
2651
2651
  ;
2652
- for (s = o & (1 << -l) - 1, o >>= -l, l += a; l > 0; s = s * 256 + e[t + u], u += p, l -= 8)
2652
+ for (s = o & (1 << -a) - 1, o >>= -a, a += r; a > 0; s = s * 256 + e[t + u], u += p, a -= 8)
2653
2653
  ;
2654
2654
  if (o === 0)
2655
- o = 1 - r;
2655
+ o = 1 - l;
2656
2656
  else {
2657
2657
  if (o === f)
2658
- return s ? NaN : (y ? -1 : 1) * (1 / 0);
2659
- s = s + Math.pow(2, a), o = o - r;
2658
+ return s ? NaN : (m ? -1 : 1) * (1 / 0);
2659
+ s = s + Math.pow(2, r), o = o - l;
2660
2660
  }
2661
- return (y ? -1 : 1) * s * Math.pow(2, o - a);
2661
+ return (m ? -1 : 1) * s * Math.pow(2, o - r);
2662
2662
  };
2663
- u0.write = function(e, t, i, a, n, o) {
2664
- var s, c, f, r = o * 8 - n - 1, l = (1 << r) - 1, u = l >> 1, p = n === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = a ? 0 : o - 1, _ = a ? 1 : -1, w = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
2665
- for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (c = isNaN(t) ? 1 : 0, s = l) : (s = Math.floor(Math.log(t) / Math.LN2), t * (f = Math.pow(2, -s)) < 1 && (s--, f *= 2), s + u >= 1 ? t += p / f : t += p * Math.pow(2, 1 - u), t * f >= 2 && (s++, f /= 2), s + u >= l ? (c = 0, s = l) : s + u >= 1 ? (c = (t * f - 1) * Math.pow(2, n), s = s + u) : (c = t * Math.pow(2, u - 1) * Math.pow(2, n), s = 0)); n >= 8; e[i + y] = c & 255, y += _, c /= 256, n -= 8)
2663
+ c0.write = function(e, t, i, r, n, o) {
2664
+ var s, c, f, l = o * 8 - n - 1, a = (1 << l) - 1, u = a >> 1, p = n === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, m = r ? 0 : o - 1, _ = r ? 1 : -1, w = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
2665
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (c = isNaN(t) ? 1 : 0, s = a) : (s = Math.floor(Math.log(t) / Math.LN2), t * (f = Math.pow(2, -s)) < 1 && (s--, f *= 2), s + u >= 1 ? t += p / f : t += p * Math.pow(2, 1 - u), t * f >= 2 && (s++, f /= 2), s + u >= a ? (c = 0, s = a) : s + u >= 1 ? (c = (t * f - 1) * Math.pow(2, n), s = s + u) : (c = t * Math.pow(2, u - 1) * Math.pow(2, n), s = 0)); n >= 8; e[i + m] = c & 255, m += _, c /= 256, n -= 8)
2666
2666
  ;
2667
- for (s = s << n | c, r += n; r > 0; e[i + y] = s & 255, y += _, s /= 256, r -= 8)
2667
+ for (s = s << n | c, l += n; l > 0; e[i + m] = s & 255, m += _, s /= 256, l -= 8)
2668
2668
  ;
2669
- e[i + y - _] |= w * 128;
2669
+ e[i + m - _] |= w * 128;
2670
2670
  };
2671
- var pe = h, Z = u0;
2671
+ var me = h, Q = c0;
2672
2672
  function h(e) {
2673
2673
  this.buf = ArrayBuffer.isView && ArrayBuffer.isView(e) ? e : new Uint8Array(e || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
2674
2674
  }
@@ -2676,7 +2676,7 @@ h.Varint = 0;
2676
2676
  h.Fixed64 = 1;
2677
2677
  h.Bytes = 2;
2678
2678
  h.Fixed32 = 5;
2679
- var o0 = 65536 * 65536, x0 = 1 / o0, me = 12, M0 = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
2679
+ var o0 = 65536 * 65536, g0 = 1 / o0, ye = 12, L0 = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
2680
2680
  h.prototype = {
2681
2681
  destroy: function() {
2682
2682
  this.buf = null;
@@ -2684,8 +2684,8 @@ h.prototype = {
2684
2684
  // === READING =================================================================
2685
2685
  readFields: function(e, t, i) {
2686
2686
  for (i = i || this.length; this.pos < i; ) {
2687
- var a = this.readVarint(), n = a >> 3, o = this.pos;
2688
- this.type = a & 7, e(n, t, this), this.pos === o && this.skip(a);
2687
+ var r = this.readVarint(), n = r >> 3, o = this.pos;
2688
+ this.type = r & 7, e(n, t, this), this.pos === o && this.skip(r);
2689
2689
  }
2690
2690
  return t;
2691
2691
  },
@@ -2693,33 +2693,33 @@ h.prototype = {
2693
2693
  return this.readFields(e, t, this.readVarint() + this.pos);
2694
2694
  },
2695
2695
  readFixed32: function() {
2696
- var e = J(this.buf, this.pos);
2696
+ var e = Y(this.buf, this.pos);
2697
2697
  return this.pos += 4, e;
2698
2698
  },
2699
2699
  readSFixed32: function() {
2700
- var e = v0(this.buf, this.pos);
2700
+ var e = F0(this.buf, this.pos);
2701
2701
  return this.pos += 4, e;
2702
2702
  },
2703
2703
  // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
2704
2704
  readFixed64: function() {
2705
- var e = J(this.buf, this.pos) + J(this.buf, this.pos + 4) * o0;
2705
+ var e = Y(this.buf, this.pos) + Y(this.buf, this.pos + 4) * o0;
2706
2706
  return this.pos += 8, e;
2707
2707
  },
2708
2708
  readSFixed64: function() {
2709
- var e = J(this.buf, this.pos) + v0(this.buf, this.pos + 4) * o0;
2709
+ var e = Y(this.buf, this.pos) + F0(this.buf, this.pos + 4) * o0;
2710
2710
  return this.pos += 8, e;
2711
2711
  },
2712
2712
  readFloat: function() {
2713
- var e = Z.read(this.buf, this.pos, !0, 23, 4);
2713
+ var e = Q.read(this.buf, this.pos, !0, 23, 4);
2714
2714
  return this.pos += 4, e;
2715
2715
  },
2716
2716
  readDouble: function() {
2717
- var e = Z.read(this.buf, this.pos, !0, 52, 8);
2717
+ var e = Q.read(this.buf, this.pos, !0, 52, 8);
2718
2718
  return this.pos += 8, e;
2719
2719
  },
2720
2720
  readVarint: function(e) {
2721
- var t = this.buf, i, a;
2722
- return a = t[this.pos++], i = a & 127, a < 128 || (a = t[this.pos++], i |= (a & 127) << 7, a < 128) || (a = t[this.pos++], i |= (a & 127) << 14, a < 128) || (a = t[this.pos++], i |= (a & 127) << 21, a < 128) ? i : (a = t[this.pos], i |= (a & 15) << 28, ye(i, e, this));
2721
+ var t = this.buf, i, r;
2722
+ return r = t[this.pos++], i = r & 127, r < 128 || (r = t[this.pos++], i |= (r & 127) << 7, r < 128) || (r = t[this.pos++], i |= (r & 127) << 14, r < 128) || (r = t[this.pos++], i |= (r & 127) << 21, r < 128) ? i : (r = t[this.pos], i |= (r & 15) << 28, xe(i, e, this));
2723
2723
  },
2724
2724
  readVarint64: function() {
2725
2725
  return this.readVarint(!0);
@@ -2733,7 +2733,7 @@ h.prototype = {
2733
2733
  },
2734
2734
  readString: function() {
2735
2735
  var e = this.readVarint() + this.pos, t = this.pos;
2736
- return this.pos = e, e - t >= me && M0 ? ze(this.buf, t, e) : Ve(this.buf, t, e);
2736
+ return this.pos = e, e - t >= ye && L0 ? Te(this.buf, t, e) : ze(this.buf, t, e);
2737
2737
  },
2738
2738
  readBytes: function() {
2739
2739
  var e = this.readVarint() + this.pos, t = this.buf.subarray(this.pos, e);
@@ -2742,55 +2742,55 @@ h.prototype = {
2742
2742
  // verbose for performance reasons; doesn't affect gzipped size
2743
2743
  readPackedVarint: function(e, t) {
2744
2744
  if (this.type !== h.Bytes) return e.push(this.readVarint(t));
2745
- var i = k(this);
2745
+ var i = M(this);
2746
2746
  for (e = e || []; this.pos < i; ) e.push(this.readVarint(t));
2747
2747
  return e;
2748
2748
  },
2749
2749
  readPackedSVarint: function(e) {
2750
2750
  if (this.type !== h.Bytes) return e.push(this.readSVarint());
2751
- var t = k(this);
2751
+ var t = M(this);
2752
2752
  for (e = e || []; this.pos < t; ) e.push(this.readSVarint());
2753
2753
  return e;
2754
2754
  },
2755
2755
  readPackedBoolean: function(e) {
2756
2756
  if (this.type !== h.Bytes) return e.push(this.readBoolean());
2757
- var t = k(this);
2757
+ var t = M(this);
2758
2758
  for (e = e || []; this.pos < t; ) e.push(this.readBoolean());
2759
2759
  return e;
2760
2760
  },
2761
2761
  readPackedFloat: function(e) {
2762
2762
  if (this.type !== h.Bytes) return e.push(this.readFloat());
2763
- var t = k(this);
2763
+ var t = M(this);
2764
2764
  for (e = e || []; this.pos < t; ) e.push(this.readFloat());
2765
2765
  return e;
2766
2766
  },
2767
2767
  readPackedDouble: function(e) {
2768
2768
  if (this.type !== h.Bytes) return e.push(this.readDouble());
2769
- var t = k(this);
2769
+ var t = M(this);
2770
2770
  for (e = e || []; this.pos < t; ) e.push(this.readDouble());
2771
2771
  return e;
2772
2772
  },
2773
2773
  readPackedFixed32: function(e) {
2774
2774
  if (this.type !== h.Bytes) return e.push(this.readFixed32());
2775
- var t = k(this);
2775
+ var t = M(this);
2776
2776
  for (e = e || []; this.pos < t; ) e.push(this.readFixed32());
2777
2777
  return e;
2778
2778
  },
2779
2779
  readPackedSFixed32: function(e) {
2780
2780
  if (this.type !== h.Bytes) return e.push(this.readSFixed32());
2781
- var t = k(this);
2781
+ var t = M(this);
2782
2782
  for (e = e || []; this.pos < t; ) e.push(this.readSFixed32());
2783
2783
  return e;
2784
2784
  },
2785
2785
  readPackedFixed64: function(e) {
2786
2786
  if (this.type !== h.Bytes) return e.push(this.readFixed64());
2787
- var t = k(this);
2787
+ var t = M(this);
2788
2788
  for (e = e || []; this.pos < t; ) e.push(this.readFixed64());
2789
2789
  return e;
2790
2790
  },
2791
2791
  readPackedSFixed64: function(e) {
2792
2792
  if (this.type !== h.Bytes) return e.push(this.readSFixed64());
2793
- var t = k(this);
2793
+ var t = M(this);
2794
2794
  for (e = e || []; this.pos < t; ) e.push(this.readSFixed64());
2795
2795
  return e;
2796
2796
  },
@@ -2818,20 +2818,20 @@ h.prototype = {
2818
2818
  return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
2819
2819
  },
2820
2820
  writeFixed32: function(e) {
2821
- this.realloc(4), E(this.buf, e, this.pos), this.pos += 4;
2821
+ this.realloc(4), $(this.buf, e, this.pos), this.pos += 4;
2822
2822
  },
2823
2823
  writeSFixed32: function(e) {
2824
- this.realloc(4), E(this.buf, e, this.pos), this.pos += 4;
2824
+ this.realloc(4), $(this.buf, e, this.pos), this.pos += 4;
2825
2825
  },
2826
2826
  writeFixed64: function(e) {
2827
- this.realloc(8), E(this.buf, e & -1, this.pos), E(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2827
+ this.realloc(8), $(this.buf, e & -1, this.pos), $(this.buf, Math.floor(e * g0), this.pos + 4), this.pos += 8;
2828
2828
  },
2829
2829
  writeSFixed64: function(e) {
2830
- this.realloc(8), E(this.buf, e & -1, this.pos), E(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2830
+ this.realloc(8), $(this.buf, e & -1, this.pos), $(this.buf, Math.floor(e * g0), this.pos + 4), this.pos += 8;
2831
2831
  },
2832
2832
  writeVarint: function(e) {
2833
2833
  if (e = +e || 0, e > 268435455 || e < 0) {
2834
- xe(e, this);
2834
+ ve(e, this);
2835
2835
  return;
2836
2836
  }
2837
2837
  this.realloc(4), this.buf[this.pos++] = e & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = (e >>>= 7) & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = (e >>>= 7) & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = e >>> 7 & 127)));
@@ -2845,15 +2845,15 @@ h.prototype = {
2845
2845
  writeString: function(e) {
2846
2846
  e = String(e), this.realloc(e.length * 4), this.pos++;
2847
2847
  var t = this.pos;
2848
- this.pos = Te(this.buf, e, this.pos);
2848
+ this.pos = Ce(this.buf, e, this.pos);
2849
2849
  var i = this.pos - t;
2850
- i >= 128 && g0(t, i, this), this.pos = t - 1, this.writeVarint(i), this.pos += i;
2850
+ i >= 128 && _0(t, i, this), this.pos = t - 1, this.writeVarint(i), this.pos += i;
2851
2851
  },
2852
2852
  writeFloat: function(e) {
2853
- this.realloc(4), Z.write(this.buf, e, this.pos, !0, 23, 4), this.pos += 4;
2853
+ this.realloc(4), Q.write(this.buf, e, this.pos, !0, 23, 4), this.pos += 4;
2854
2854
  },
2855
2855
  writeDouble: function(e) {
2856
- this.realloc(8), Z.write(this.buf, e, this.pos, !0, 52, 8), this.pos += 8;
2856
+ this.realloc(8), Q.write(this.buf, e, this.pos, !0, 52, 8), this.pos += 8;
2857
2857
  },
2858
2858
  writeBytes: function(e) {
2859
2859
  var t = e.length;
@@ -2864,38 +2864,38 @@ h.prototype = {
2864
2864
  this.pos++;
2865
2865
  var i = this.pos;
2866
2866
  e(t, this);
2867
- var a = this.pos - i;
2868
- a >= 128 && g0(i, a, this), this.pos = i - 1, this.writeVarint(a), this.pos += a;
2867
+ var r = this.pos - i;
2868
+ r >= 128 && _0(i, r, this), this.pos = i - 1, this.writeVarint(r), this.pos += r;
2869
2869
  },
2870
2870
  writeMessage: function(e, t, i) {
2871
2871
  this.writeTag(e, h.Bytes), this.writeRawMessage(t, i);
2872
2872
  },
2873
2873
  writePackedVarint: function(e, t) {
2874
- t.length && this.writeMessage(e, _e, t);
2874
+ t.length && this.writeMessage(e, Fe, t);
2875
2875
  },
2876
2876
  writePackedSVarint: function(e, t) {
2877
- t.length && this.writeMessage(e, Fe, t);
2877
+ t.length && this.writeMessage(e, we, t);
2878
2878
  },
2879
2879
  writePackedBoolean: function(e, t) {
2880
- t.length && this.writeMessage(e, Me, t);
2880
+ t.length && this.writeMessage(e, Le, t);
2881
2881
  },
2882
2882
  writePackedFloat: function(e, t) {
2883
- t.length && this.writeMessage(e, we, t);
2883
+ t.length && this.writeMessage(e, ke, t);
2884
2884
  },
2885
2885
  writePackedDouble: function(e, t) {
2886
- t.length && this.writeMessage(e, ke, t);
2886
+ t.length && this.writeMessage(e, Me, t);
2887
2887
  },
2888
2888
  writePackedFixed32: function(e, t) {
2889
- t.length && this.writeMessage(e, Le, t);
2889
+ t.length && this.writeMessage(e, Be, t);
2890
2890
  },
2891
2891
  writePackedSFixed32: function(e, t) {
2892
- t.length && this.writeMessage(e, Be, t);
2892
+ t.length && this.writeMessage(e, Pe, t);
2893
2893
  },
2894
2894
  writePackedFixed64: function(e, t) {
2895
- t.length && this.writeMessage(e, Pe, t);
2895
+ t.length && this.writeMessage(e, Se, t);
2896
2896
  },
2897
2897
  writePackedSFixed64: function(e, t) {
2898
- t.length && this.writeMessage(e, Se, t);
2898
+ t.length && this.writeMessage(e, Ve, t);
2899
2899
  },
2900
2900
  writeBytesField: function(e, t) {
2901
2901
  this.writeTag(e, h.Bytes), this.writeBytes(t);
@@ -2931,86 +2931,86 @@ h.prototype = {
2931
2931
  this.writeVarintField(e, !!t);
2932
2932
  }
2933
2933
  };
2934
- function ye(e, t, i) {
2935
- var a = i.buf, n, o;
2936
- if (o = a[i.pos++], n = (o & 112) >> 4, o < 128 || (o = a[i.pos++], n |= (o & 127) << 3, o < 128) || (o = a[i.pos++], n |= (o & 127) << 10, o < 128) || (o = a[i.pos++], n |= (o & 127) << 17, o < 128) || (o = a[i.pos++], n |= (o & 127) << 24, o < 128) || (o = a[i.pos++], n |= (o & 1) << 31, o < 128)) return R(e, n, t);
2934
+ function xe(e, t, i) {
2935
+ var r = i.buf, n, o;
2936
+ if (o = r[i.pos++], n = (o & 112) >> 4, o < 128 || (o = r[i.pos++], n |= (o & 127) << 3, o < 128) || (o = r[i.pos++], n |= (o & 127) << 10, o < 128) || (o = r[i.pos++], n |= (o & 127) << 17, o < 128) || (o = r[i.pos++], n |= (o & 127) << 24, o < 128) || (o = r[i.pos++], n |= (o & 1) << 31, o < 128)) return A(e, n, t);
2937
2937
  throw new Error("Expected varint not more than 10 bytes");
2938
2938
  }
2939
- function k(e) {
2939
+ function M(e) {
2940
2940
  return e.type === h.Bytes ? e.readVarint() + e.pos : e.pos + 1;
2941
2941
  }
2942
- function R(e, t, i) {
2942
+ function A(e, t, i) {
2943
2943
  return i ? t * 4294967296 + (e >>> 0) : (t >>> 0) * 4294967296 + (e >>> 0);
2944
2944
  }
2945
- function xe(e, t) {
2946
- var i, a;
2947
- if (e >= 0 ? (i = e % 4294967296 | 0, a = e / 4294967296 | 0) : (i = ~(-e % 4294967296), a = ~(-e / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, a = a + 1 | 0)), e >= 18446744073709552e3 || e < -18446744073709552e3)
2945
+ function ve(e, t) {
2946
+ var i, r;
2947
+ if (e >= 0 ? (i = e % 4294967296 | 0, r = e / 4294967296 | 0) : (i = ~(-e % 4294967296), r = ~(-e / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, r = r + 1 | 0)), e >= 18446744073709552e3 || e < -18446744073709552e3)
2948
2948
  throw new Error("Given varint doesn't fit into 10 bytes");
2949
- t.realloc(10), ge(i, a, t), ve(a, t);
2949
+ t.realloc(10), ge(i, r, t), _e(r, t);
2950
2950
  }
2951
2951
  function ge(e, t, i) {
2952
2952
  i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos] = e & 127;
2953
2953
  }
2954
- function ve(e, t) {
2954
+ function _e(e, t) {
2955
2955
  var i = (e & 7) << 4;
2956
2956
  t.buf[t.pos++] |= i | ((e >>>= 3) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127)))));
2957
2957
  }
2958
- function g0(e, t, i) {
2959
- var a = t <= 16383 ? 1 : t <= 2097151 ? 2 : t <= 268435455 ? 3 : Math.floor(Math.log(t) / (Math.LN2 * 7));
2960
- i.realloc(a);
2961
- for (var n = i.pos - 1; n >= e; n--) i.buf[n + a] = i.buf[n];
2958
+ function _0(e, t, i) {
2959
+ var r = t <= 16383 ? 1 : t <= 2097151 ? 2 : t <= 268435455 ? 3 : Math.floor(Math.log(t) / (Math.LN2 * 7));
2960
+ i.realloc(r);
2961
+ for (var n = i.pos - 1; n >= e; n--) i.buf[n + r] = i.buf[n];
2962
2962
  }
2963
- function _e(e, t) {
2963
+ function Fe(e, t) {
2964
2964
  for (var i = 0; i < e.length; i++) t.writeVarint(e[i]);
2965
2965
  }
2966
- function Fe(e, t) {
2966
+ function we(e, t) {
2967
2967
  for (var i = 0; i < e.length; i++) t.writeSVarint(e[i]);
2968
2968
  }
2969
- function we(e, t) {
2969
+ function ke(e, t) {
2970
2970
  for (var i = 0; i < e.length; i++) t.writeFloat(e[i]);
2971
2971
  }
2972
- function ke(e, t) {
2972
+ function Me(e, t) {
2973
2973
  for (var i = 0; i < e.length; i++) t.writeDouble(e[i]);
2974
2974
  }
2975
- function Me(e, t) {
2975
+ function Le(e, t) {
2976
2976
  for (var i = 0; i < e.length; i++) t.writeBoolean(e[i]);
2977
2977
  }
2978
- function Le(e, t) {
2978
+ function Be(e, t) {
2979
2979
  for (var i = 0; i < e.length; i++) t.writeFixed32(e[i]);
2980
2980
  }
2981
- function Be(e, t) {
2981
+ function Pe(e, t) {
2982
2982
  for (var i = 0; i < e.length; i++) t.writeSFixed32(e[i]);
2983
2983
  }
2984
- function Pe(e, t) {
2984
+ function Se(e, t) {
2985
2985
  for (var i = 0; i < e.length; i++) t.writeFixed64(e[i]);
2986
2986
  }
2987
- function Se(e, t) {
2987
+ function Ve(e, t) {
2988
2988
  for (var i = 0; i < e.length; i++) t.writeSFixed64(e[i]);
2989
2989
  }
2990
- function J(e, t) {
2990
+ function Y(e, t) {
2991
2991
  return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + e[t + 3] * 16777216;
2992
2992
  }
2993
- function E(e, t, i) {
2993
+ function $(e, t, i) {
2994
2994
  e[i] = t, e[i + 1] = t >>> 8, e[i + 2] = t >>> 16, e[i + 3] = t >>> 24;
2995
2995
  }
2996
- function v0(e, t) {
2996
+ function F0(e, t) {
2997
2997
  return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + (e[t + 3] << 24);
2998
2998
  }
2999
- function Ve(e, t, i) {
3000
- for (var a = "", n = t; n < i; ) {
2999
+ function ze(e, t, i) {
3000
+ for (var r = "", n = t; n < i; ) {
3001
3001
  var o = e[n], s = null, c = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
3002
3002
  if (n + c > i) break;
3003
- var f, r, l;
3004
- c === 1 ? o < 128 && (s = o) : c === 2 ? (f = e[n + 1], (f & 192) === 128 && (s = (o & 31) << 6 | f & 63, s <= 127 && (s = null))) : c === 3 ? (f = e[n + 1], r = e[n + 2], (f & 192) === 128 && (r & 192) === 128 && (s = (o & 15) << 12 | (f & 63) << 6 | r & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (f = e[n + 1], r = e[n + 2], l = e[n + 3], (f & 192) === 128 && (r & 192) === 128 && (l & 192) === 128 && (s = (o & 15) << 18 | (f & 63) << 12 | (r & 63) << 6 | l & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, a += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), a += String.fromCharCode(s), n += c;
3003
+ var f, l, a;
3004
+ c === 1 ? o < 128 && (s = o) : c === 2 ? (f = e[n + 1], (f & 192) === 128 && (s = (o & 31) << 6 | f & 63, s <= 127 && (s = null))) : c === 3 ? (f = e[n + 1], l = e[n + 2], (f & 192) === 128 && (l & 192) === 128 && (s = (o & 15) << 12 | (f & 63) << 6 | l & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (f = e[n + 1], l = e[n + 2], a = e[n + 3], (f & 192) === 128 && (l & 192) === 128 && (a & 192) === 128 && (s = (o & 15) << 18 | (f & 63) << 12 | (l & 63) << 6 | a & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, r += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), r += String.fromCharCode(s), n += c;
3005
3005
  }
3006
- return a;
3007
- }
3008
- function ze(e, t, i) {
3009
- return M0.decode(e.subarray(t, i));
3006
+ return r;
3010
3007
  }
3011
3008
  function Te(e, t, i) {
3012
- for (var a = 0, n, o; a < t.length; a++) {
3013
- if (n = t.charCodeAt(a), n > 55295 && n < 57344)
3009
+ return L0.decode(e.subarray(t, i));
3010
+ }
3011
+ function Ce(e, t, i) {
3012
+ for (var r = 0, n, o; r < t.length; r++) {
3013
+ if (n = t.charCodeAt(r), n > 55295 && n < 57344)
3014
3014
  if (o)
3015
3015
  if (n < 56320) {
3016
3016
  e[i++] = 239, e[i++] = 191, e[i++] = 189, o = n;
@@ -3018,7 +3018,7 @@ function Te(e, t, i) {
3018
3018
  } else
3019
3019
  n = o - 55296 << 10 | n - 56320 | 65536, o = null;
3020
3020
  else {
3021
- n > 56319 || a + 1 === t.length ? (e[i++] = 239, e[i++] = 191, e[i++] = 189) : o = n;
3021
+ n > 56319 || r + 1 === t.length ? (e[i++] = 239, e[i++] = 191, e[i++] = 189) : o = n;
3022
3022
  continue;
3023
3023
  }
3024
3024
  else o && (e[i++] = 239, e[i++] = 191, e[i++] = 189, o = null);
@@ -3026,28 +3026,28 @@ function Te(e, t, i) {
3026
3026
  }
3027
3027
  return i;
3028
3028
  }
3029
- const Ce = /* @__PURE__ */ F0(pe), Ye = (e) => {
3030
- var a, n;
3029
+ const De = /* @__PURE__ */ w0(me), a1 = (e) => {
3030
+ var r, n;
3031
3031
  if (!e || !e.data)
3032
3032
  return {};
3033
3033
  const t = {}, i = e.data;
3034
3034
  if (i)
3035
3035
  for (const o of i) {
3036
- const s = (a = o == null ? void 0 : o.event) == null ? void 0 : a.country_code, c = (n = e.meta.metric_names) == null ? void 0 : n[0];
3036
+ const s = (r = o == null ? void 0 : o.event) == null ? void 0 : r.country_code, c = (n = e.meta.metric_names) == null ? void 0 : n[0];
3037
3037
  s && (t[s] = c ? o.event[c] : 0);
3038
3038
  }
3039
3039
  return t;
3040
3040
  };
3041
- function De(e, t = 0) {
3041
+ function Ne(e, t = 0) {
3042
3042
  let i = null;
3043
- return (...a) => {
3044
- i && clearTimeout(i), i = setTimeout(() => e(...a), t);
3043
+ return (...r) => {
3044
+ i && clearTimeout(i), i = setTimeout(() => e(...r), t);
3045
3045
  };
3046
3046
  }
3047
- const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3047
+ const Ie = "#828a9e", Ue = "32px", Oe = { class: "legend" }, Re = {
3048
3048
  key: 0,
3049
3049
  class: "legend-title"
3050
- }, Re = { class: "legend-text" }, Ee = /* @__PURE__ */ _0({
3050
+ }, Ee = { class: "legend-text" }, Ae = /* @__PURE__ */ s0({
3051
3051
  __name: "MapLegend",
3052
3052
  props: {
3053
3053
  metric: {},
@@ -3055,29 +3055,50 @@ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3055
3055
  data: {}
3056
3056
  },
3057
3057
  setup(e) {
3058
- return (t, i) => (N(), A("div", Ie, [
3059
- t.metric ? (N(), A("div", Oe, X(t.title), 1)) : a0("", !0),
3060
- (N(!0), A(z0, null, T0(t.data, (a, n) => (N(), A("div", {
3058
+ return (t, i) => (k(), T("div", Oe, [
3059
+ t.metric ? (k(), T("div", Re, U(t.title), 1)) : W("", !0),
3060
+ (k(!0), T(C0, null, D0(t.data, (r, n) => (k(), T("div", {
3061
3061
  key: n,
3062
3062
  class: "legend-item"
3063
3063
  }, [
3064
- $("span", {
3064
+ B("span", {
3065
3065
  class: "legend-color",
3066
- style: C0({ backgroundColor: a.color })
3066
+ style: N0({ backgroundColor: r.color })
3067
3067
  }, null, 4),
3068
- $("span", Re, X(a.range), 1)
3068
+ B("span", Ee, U(r.range), 1)
3069
3069
  ]))), 128))
3070
3070
  ]));
3071
3071
  }
3072
- }), L0 = (e, t) => {
3072
+ }), d0 = (e, t) => {
3073
3073
  const i = e.__vccOpts || e;
3074
- for (const [a, n] of t)
3075
- i[a] = n;
3074
+ for (const [r, n] of t)
3075
+ i[r] = n;
3076
3076
  return i;
3077
- }, Ae = /* @__PURE__ */ L0(Ee, [["__scopeId", "data-v-5f034736"]]), $e = { class: "kong-ui-public-analytics-geo-map" }, He = {
3077
+ }, $e = /* @__PURE__ */ d0(Ae, [["__scopeId", "data-v-5f034736"]]), Ge = { class: "map-tooltip" }, qe = { class: "map-tooltip-text" }, He = { key: 0 }, Ke = /* @__PURE__ */ s0({
3078
+ __name: "MapTooltip",
3079
+ props: {
3080
+ data: {},
3081
+ showValue: { type: Boolean },
3082
+ top: {},
3083
+ left: {}
3084
+ },
3085
+ setup(e) {
3086
+ return I0((t) => ({
3087
+ "55ff282a": t.left,
3088
+ "23ce2e1e": t.top,
3089
+ "011f7503": t.data.color
3090
+ })), (t, i) => (k(), T("div", Ge, [
3091
+ i[0] || (i[0] = B("div", { class: "map-tooltip-color" }, null, -1)),
3092
+ B("div", qe, [
3093
+ B("div", null, U(t.data.label), 1),
3094
+ t.showValue ? (k(), T("span", He, U(t.data.value) + " " + U(t.data.unit), 1)) : W("", !0)
3095
+ ])
3096
+ ]));
3097
+ }
3098
+ }), je = /* @__PURE__ */ d0(Ke, [["__scopeId", "data-v-5e8af715"]]), We = { class: "kong-ui-public-analytics-geo-map" }, Ze = {
3078
3099
  key: 0,
3079
3100
  class: "no-location-overlay"
3080
- }, Ge = { class: "no-location-overlay-title" }, qe = { class: "no-location-overlay-description" }, Ke = ["id"], je = /* @__PURE__ */ _0({
3101
+ }, Je = { class: "no-location-overlay-title" }, Xe = { class: "no-location-overlay-description" }, Qe = ["id"], Ye = /* @__PURE__ */ s0({
3081
3102
  __name: "AnalyticsGeoMap",
3082
3103
  props: {
3083
3104
  countryMetrics: {},
@@ -3092,10 +3113,10 @@ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3092
3113
  },
3093
3114
  emits: ["boundsChange"],
3094
3115
  setup(e, { emit: t }) {
3095
- const i = import("./countries-simple-geo-BFUDnSiE.js").then((d) => d.default), a = t, { i18n: n } = p0.useI18n(), { getColor: o, formatMetric: s, legendData: c } = p0.useMetricUtils({
3096
- countryMetrics: f0(() => e.countryMetrics),
3097
- metric: f0(() => e.metric)
3098
- }), f = D0(), r = h0(), l = h0(null), u = M(() => Object.keys(e.countryMetrics).length === 0 && !e.fitToCountry), p = M(() => ({
3116
+ const i = import("./countries-simple-geo-BFUDnSiE.js").then((d) => d.default), r = t, { i18n: n } = y0.useI18n(), { getColor: o, formatMetric: s, legendData: c } = y0.useMetricUtils({
3117
+ countryMetrics: p0(() => e.countryMetrics),
3118
+ metric: p0(() => e.metric)
3119
+ }), f = j(), l = U0(), a = j(), u = j(null), p = j({ left: "0px", top: "0px" }), m = j(!1), _ = L(() => Object.keys(e.countryMetrics).length === 0 && !e.fitToCountry), w = L(() => ({
3099
3120
  "fill-color": [
3100
3121
  "match",
3101
3122
  [
@@ -3108,60 +3129,60 @@ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3108
3129
  ],
3109
3130
  ["get", "ISO_A2"]
3110
3131
  ],
3111
- ...Object.keys(e.countryMetrics).length ? Object.entries(e.countryMetrics).flatMap(([d, m]) => [
3132
+ ...Object.keys(e.countryMetrics).length ? Object.entries(e.countryMetrics).flatMap(([d, y]) => [
3112
3133
  d,
3113
- o(m)
3134
+ o(y)
3114
3135
  ]) : ["#ccc", "#ccc"],
3115
3136
  "#ccc"
3116
3137
  // default color if no match
3117
3138
  ],
3118
3139
  "fill-opacity": 0.7
3119
- })), y = M(() => e.withLegend && Object.keys(e.countryMetrics).length > 0), _ = M(() => e.metric && n.t(`metrics.${e.metric}`) || ""), w = (d) => {
3120
- const m = d.flat(1);
3121
- return Array.isArray(m[0]) && Array.isArray(m[0][0]) ? w(m) : m;
3122
- }, S = (d) => {
3123
- var x, g, G, U, z, I, q;
3140
+ })), O = L(() => e.withLegend && Object.keys(e.countryMetrics).length > 0), B0 = L(() => e.metric && n.t(`metrics.${e.metric}`) || ""), f0 = (d) => {
3141
+ const y = d.flat(1);
3142
+ return Array.isArray(y[0]) && Array.isArray(y[0][0]) ? f0(y) : y;
3143
+ }, h0 = (d) => {
3144
+ var x, v, q, R, D, H, K;
3124
3145
  if (d === "RU") {
3125
- (x = r.value) == null || x.fitBounds([
3146
+ (x = a.value) == null || x.fitBounds([
3126
3147
  [20, 40],
3127
3148
  [180, 80]
3128
3149
  ]);
3129
3150
  return;
3130
3151
  } else if (d === "US") {
3131
- (g = r.value) == null || g.fitBounds([
3152
+ (v = a.value) == null || v.fitBounds([
3132
3153
  [-130, 20],
3133
3154
  [-60, 50]
3134
3155
  ]);
3135
3156
  return;
3136
3157
  } else if (d === "FR") {
3137
- (G = r.value) == null || G.fitBounds([
3158
+ (q = a.value) == null || q.fitBounds([
3138
3159
  [-5, 42],
3139
3160
  [9, 51]
3140
3161
  ]);
3141
3162
  return;
3142
3163
  } else if (d === "NO") {
3143
- (U = r.value) == null || U.fitBounds([
3164
+ (R = a.value) == null || R.fitBounds([
3144
3165
  [4, 57],
3145
3166
  [32, 71]
3146
3167
  ]);
3147
3168
  return;
3148
3169
  }
3149
- const m = (z = l.value) == null ? void 0 : z.features.find((F) => {
3150
- var L, B, P, T, C;
3151
- return (L = F.properties) != null && L.ISO_A2 ? ((B = F.properties) == null ? void 0 : B.ISO_A2) === d : ((P = F.properties) == null ? void 0 : P.iso_a2) === "-99" ? ((T = F.properties) == null ? void 0 : T.iso_a2_eh) === d : ((C = F.properties) == null ? void 0 : C.iso_a2) === d;
3170
+ const y = (D = u.value) == null ? void 0 : D.features.find((F) => {
3171
+ var P, S, V, N, z;
3172
+ return (P = F.properties) != null && P.ISO_A2 ? ((S = F.properties) == null ? void 0 : S.ISO_A2) === d : ((V = F.properties) == null ? void 0 : V.iso_a2) === "-99" ? ((N = F.properties) == null ? void 0 : N.iso_a2_eh) === d : ((z = F.properties) == null ? void 0 : z.iso_a2) === d;
3152
3173
  });
3153
- if (m) {
3154
- const F = (I = m.geometry) == null ? void 0 : I.coordinates;
3174
+ if (y) {
3175
+ const F = (H = y.geometry) == null ? void 0 : H.coordinates;
3155
3176
  if (!F) return;
3156
- const L = w(F), B = L.map((O) => O[1]), P = L.map((O) => O[0]), T = Math.min(...B), C = Math.max(...B), j = Math.min(...P), W = Math.max(...P);
3157
- (q = r.value) == null || q.fitBounds([
3158
- [j, T],
3159
- [W, C]
3177
+ const P = f0(F), S = P.map((E) => E[1]), V = P.map((E) => E[0]), N = Math.min(...S), z = Math.max(...S), J = Math.min(...V), X = Math.max(...V);
3178
+ (K = a.value) == null || K.fitBounds([
3179
+ [J, N],
3180
+ [X, z]
3160
3181
  ]);
3161
3182
  }
3162
- }, V = M(() => {
3183
+ }, C = L(() => {
3163
3184
  const d = {
3164
- container: f,
3185
+ container: l,
3165
3186
  style: { version: 8, sources: {}, layers: [] },
3166
3187
  attributionControl: !1,
3167
3188
  // fit bounds for whole world minus antarctica
@@ -3178,69 +3199,68 @@ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3178
3199
  }
3179
3200
  };
3180
3201
  return e.bounds && (d.bounds = e.bounds), d;
3181
- }), B0 = De(() => {
3182
- if (!r.value) return;
3183
- const d = r.value.getBounds(), m = d.getSouthWest(), x = d.getNorthEast();
3184
- a("boundsChange", [
3185
- [m.lng, m.lat],
3202
+ }), P0 = Ne(() => {
3203
+ if (!a.value) return;
3204
+ const d = a.value.getBounds(), y = d.getSouthWest(), x = d.getNorthEast();
3205
+ r("boundsChange", [
3206
+ [y.lng, y.lat],
3186
3207
  [x.lng, x.lat]
3187
3208
  ]);
3188
3209
  }, 300);
3189
- return N0(async () => {
3190
- var d, m, x;
3210
+ return O0(async () => {
3211
+ var d, y, x;
3191
3212
  try {
3192
- const g = await i, G = await fetch(g), U = new Uint8Array(await G.arrayBuffer()), z = he(new Ce(U));
3193
- l.value = z, r.value = new R0(V.value), r.value.on("load", () => {
3194
- var q, F, L, B, P, T, C;
3195
- (q = r.value) == null || q.addSource("countries", {
3213
+ const v = await i, q = await fetch(v), R = new Uint8Array(await q.arrayBuffer()), D = pe(new De(R));
3214
+ u.value = D, a.value = new A0(C.value), a.value.on("load", () => {
3215
+ var H, K, F, P, S, V, N;
3216
+ (H = a.value) == null || H.addSource("countries", {
3196
3217
  type: "geojson",
3197
- data: z
3198
- }), (F = r.value) == null || F.addLayer({
3218
+ data: D
3219
+ }), (K = a.value) == null || K.addLayer({
3199
3220
  id: "countries-layer",
3200
3221
  type: "fill",
3201
3222
  source: "countries",
3202
- paint: p.value
3203
- }), (L = r.value) == null || L.addSource("lakes", {
3223
+ paint: w.value
3224
+ }), (F = a.value) == null || F.addSource("lakes", {
3204
3225
  type: "geojson",
3205
- data: te
3206
- }), (B = r.value) == null || B.addLayer({
3226
+ data: ie
3227
+ }), (P = a.value) == null || P.addLayer({
3207
3228
  id: "lakes-layer",
3208
3229
  type: "fill",
3209
3230
  source: "lakes",
3210
3231
  paint: {
3211
3232
  "fill-color": "#FFFFFF"
3212
3233
  }
3213
- });
3214
- const I = new E0({
3215
- closeButton: !1,
3216
- closeOnClick: !1
3217
- });
3218
- (P = r.value) == null || P.on("mousemove", "countries-layer", (j) => {
3219
- var O;
3220
- const W = (O = j.features) == null ? void 0 : O[0];
3221
- if (W) {
3222
- const { iso_a2: c0, iso_a2_eh: P0, ISO_A2: S0, admin: d0 } = W.properties, V0 = S0 ?? c0 === "-99" ? P0 : c0, t0 = e.countryMetrics[V0];
3223
- if (t0 !== void 0) {
3224
- let i0;
3225
- e.showTooltipValue ? i0 = `<strong data-testid="geo-map-tooltip">${d0}</strong>: ${s(t0)} ${n.t(`metricUnits.${e.metricUnit}`, { plural: t0 > 1 ? "s" : "" })}` : i0 = `<strong data-testid="geo-map-tooltip">${d0}</strong>`, I.setLngLat(j.lngLat).setHTML(i0).addTo(r.value);
3226
- } else
3227
- I.remove();
3234
+ }), (S = a.value) == null || S.on("mousemove", "countries-layer", (z) => {
3235
+ var X;
3236
+ const J = (X = z.features) == null ? void 0 : X[0];
3237
+ if (J) {
3238
+ const { iso_a2: E, iso_a2_eh: S0, ISO_A2: V0, admin: z0 } = J.properties, T0 = V0 ?? E === "-99" ? S0 : E, n0 = e.countryMetrics[T0];
3239
+ n0 !== void 0 && (f.value = {
3240
+ label: z0,
3241
+ color: o(n0),
3242
+ value: s(n0),
3243
+ unit: e.metricUnit
3244
+ }, m.value = !0, p.value = {
3245
+ left: `${z.point.x}px`,
3246
+ top: `${z.point.y}px`
3247
+ });
3228
3248
  }
3229
- }), (T = r.value) == null || T.on("mouseleave", "countries-layer", () => {
3230
- I.remove();
3231
- }), (C = r.value) == null || C.on("move", B0), e.fitToCountry && S(e.fitToCountry);
3232
- }), (d = r.value) == null || d.dragRotate.disable(), (m = r.value) == null || m.keyboard.disable(), (x = r.value) == null || x.touchZoomRotate.disableRotation();
3233
- } catch (g) {
3234
- console.error(g);
3249
+ }), (V = a.value) == null || V.on("mouseleave", "countries-layer", () => {
3250
+ m.value = !1;
3251
+ }), (N = a.value) == null || N.on("move", P0), e.fitToCountry && h0(e.fitToCountry);
3252
+ }), (d = a.value) == null || d.dragRotate.disable(), (y = a.value) == null || y.keyboard.disable(), (x = a.value) == null || x.touchZoomRotate.disableRotation();
3253
+ } catch (v) {
3254
+ console.error(v);
3235
3255
  }
3236
- }), n0(() => e.countryMetrics, () => {
3256
+ }), a0(() => e.countryMetrics, () => {
3237
3257
  var d;
3238
- r.value && r.value.isStyleLoaded() && (r.value.getLayer("countries-layer") && r.value.removeLayer("countries-layer"), r.value.addLayer({
3258
+ a.value && a.value.isStyleLoaded() && (a.value.getLayer("countries-layer") && a.value.removeLayer("countries-layer"), a.value.addLayer({
3239
3259
  id: "countries-layer",
3240
3260
  type: "fill",
3241
3261
  source: "countries",
3242
- paint: p.value
3243
- }), r.value.removeLayer("lakes-layer"), (d = r.value) == null || d.addLayer({
3262
+ paint: w.value
3263
+ }), a.value.removeLayer("lakes-layer"), (d = a.value) == null || d.addLayer({
3244
3264
  id: "lakes-layer",
3245
3265
  type: "fill",
3246
3266
  source: "lakes",
@@ -3248,51 +3268,58 @@ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3248
3268
  "fill-color": "#FFFFFF"
3249
3269
  }
3250
3270
  }));
3251
- }), n0(() => e.fitToCountry, (d) => {
3252
- var m, x, g;
3253
- r.value && d ? S(d) : !V.value.center && !V.value.zoom ? (m = r.value) == null || m.fitBounds([
3271
+ }), a0(() => e.fitToCountry, (d) => {
3272
+ var y, x, v;
3273
+ a.value && d ? h0(d) : !C.value.center && !C.value.zoom ? (y = a.value) == null || y.fitBounds([
3254
3274
  [-180, -90],
3255
3275
  [180, 90]
3256
- ]) : (V.value.zoom && ((x = r.value) == null || x.setZoom(V.value.zoom)), V.value.center && ((g = r.value) == null || g.flyTo({ center: V.value.center })));
3257
- }), n0(() => e.bounds, (d, m) => {
3276
+ ]) : (C.value.zoom && ((x = a.value) == null || x.setZoom(C.value.zoom)), C.value.center && ((v = a.value) == null || v.flyTo({ center: C.value.center })));
3277
+ }), a0(() => e.bounds, (d, y) => {
3258
3278
  if (!d) return;
3259
- const x = d == null ? void 0 : d.flat(), g = m == null ? void 0 : m.flat();
3260
- !(x && g && x.length === g.length && x.every((U, z) => Math.round(U * 100) / 100 === Math.round(g[z] * 100) / 100)) && r.value && r.value.fitBounds(d);
3261
- }), (d, m) => (N(), A("div", $e, [
3262
- u.value ? (N(), A("div", He, [
3279
+ const x = d == null ? void 0 : d.flat(), v = y == null ? void 0 : y.flat();
3280
+ !(x && v && x.length === v.length && x.every((R, D) => Math.round(R * 100) / 100 === Math.round(v[D] * 100) / 100)) && a.value && a.value.fitBounds(d);
3281
+ }), (d, y) => (k(), T("div", We, [
3282
+ _.value ? (k(), T("div", Ze, [
3263
3283
  r0(d.$slots, "no-location-icon", {}, () => [
3264
- I0(D(H0), {
3265
- color: D(Ne),
3266
- size: D(Ue)
3284
+ R0(I(q0), {
3285
+ color: I(Ie),
3286
+ size: I(Ue)
3267
3287
  }, null, 8, ["color", "size"])
3268
3288
  ], !0),
3269
- $("div", Ge, [
3289
+ B("div", Je, [
3270
3290
  r0(d.$slots, "no-location-title", {}, () => [
3271
- O0(X(D(n).t("no_location_data")), 1)
3291
+ E0(U(I(n).t("no_location_data")), 1)
3272
3292
  ], !0)
3273
3293
  ]),
3274
- $("div", qe, [
3294
+ B("div", Xe, [
3275
3295
  r0(d.$slots, "no-location-description", {}, () => [
3276
- $("p", null, X(D(n).t("no_location_data_description")), 1)
3296
+ B("p", null, U(I(n).t("no_location_data_description")), 1)
3277
3297
  ], !0)
3278
3298
  ])
3279
- ])) : a0("", !0),
3280
- $("div", {
3281
- id: D(f),
3299
+ ])) : W("", !0),
3300
+ B("div", {
3301
+ id: I(l),
3282
3302
  class: "analytics-geo-map-container"
3283
- }, null, 8, Ke),
3284
- y.value ? (N(), U0(Ae, {
3303
+ }, null, 8, Qe),
3304
+ O.value ? (k(), m0($e, {
3285
3305
  key: 1,
3286
3306
  class: "legend-container",
3287
- data: D(c),
3307
+ data: I(c),
3288
3308
  metric: d.metric,
3289
- title: _.value
3290
- }, null, 8, ["data", "metric", "title"])) : a0("", !0)
3309
+ title: B0.value
3310
+ }, null, 8, ["data", "metric", "title"])) : W("", !0),
3311
+ m.value && f.value ? (k(), m0(je, {
3312
+ key: 2,
3313
+ data: f.value,
3314
+ left: p.value.left,
3315
+ "show-value": d.showTooltipValue,
3316
+ top: p.value.top
3317
+ }, null, 8, ["data", "left", "show-value", "top"])) : W("", !0)
3291
3318
  ]));
3292
3319
  }
3293
- }), be = /* @__PURE__ */ L0(je, [["__scopeId", "data-v-bd038b4a"]]);
3320
+ }), r1 = /* @__PURE__ */ d0(Ye, [["__scopeId", "data-v-2d66a3eb"]]);
3294
3321
  export {
3295
- be as AnalyticsGeoMap,
3296
- De as debounce,
3297
- Ye as exploreResultToCountryMetrics
3322
+ r1 as AnalyticsGeoMap,
3323
+ Ne as debounce,
3324
+ a1 as exploreResultToCountryMetrics
3298
3325
  };