var Xt = Object.defineProperty;
var Yt = (n, e, t) => e in n ? Xt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
var He = (n, e, t) => (Yt(n, typeof e != "symbol" ? e + "" : e, t), t), ot = (n, e, t) => {
  if (!e.has(n))
    throw TypeError("Cannot " + t);
};
var me = (n, e, t) => (ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ct = (n, e, t) => {
  if (e.has(n))
    throw TypeError("Cannot add the same private member more than once");
  e instanceof WeakSet ? e.add(n) : e.set(n, t);
}, ft = (n, e, t, r) => (ot(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
function S() {
}
function xt(n, e) {
  for (const t in e)
    n[t] = e[t];
  return (
    /** @type {T & S} */
    n
  );
}
function pt(n) {
  return n();
}
function ut() {
  return /* @__PURE__ */ Object.create(null);
}
function le(n) {
  n.forEach(pt);
}
function Tt(n) {
  return typeof n == "function";
}
function ge(n, e) {
  return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
}
let Ae;
function V(n, e) {
  return n === e ? !0 : (Ae || (Ae = document.createElement("a")), Ae.href = e, n === Ae.href);
}
function $t(n) {
  return Object.keys(n).length === 0;
}
function en(n, e, t, r) {
  if (n) {
    const l = Mt(n, e, t, r);
    return n[0](l);
  }
}
function Mt(n, e, t, r) {
  return n[1] && r ? xt(t.ctx.slice(), n[1](r(e))) : t.ctx;
}
function tn(n, e, t, r) {
  if (n[2] && r) {
    const l = n[2](r(t));
    if (e.dirty === void 0)
      return l;
    if (typeof l == "object") {
      const a = [], o = Math.max(e.dirty.length, l.length);
      for (let f = 0; f < o; f += 1)
        a[f] = e.dirty[f] | l[f];
      return a;
    }
    return e.dirty | l;
  }
  return e.dirty;
}
function nn(n, e, t, r, l, a) {
  if (l) {
    const o = Mt(e, t, r, a);
    n.p(o, l);
  }
}
function rn(n) {
  if (n.ctx.length > 32) {
    const e = [], t = n.ctx.length / 32;
    for (let r = 0; r < t; r++)
      e[r] = -1;
    return e;
  }
  return -1;
}
function at(n) {
  return n ?? "";
}
function k(n, e) {
  n.appendChild(e);
}
function A(n, e, t) {
  n.insertBefore(e, t || null);
}
function z(n) {
  n.parentNode && n.parentNode.removeChild(n);
}
function R(n) {
  return document.createElement(n);
}
function ce(n) {
  return document.createElementNS("http://www.w3.org/2000/svg", n);
}
function fe(n) {
  return document.createTextNode(n);
}
function J() {
  return fe(" ");
}
function ln() {
  return fe("");
}
function D(n, e, t, r) {
  return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
}
function sn(n) {
  return function(e) {
    return e.preventDefault(), n.call(this, e);
  };
}
function s(n, e, t) {
  t == null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
}
function on(n) {
  return Array.from(n.childNodes);
}
function Ee(n, e) {
  e = "" + e, n.data !== e && (n.data = /** @type {string} */
  e);
}
function dt(n, e) {
  n.value = e ?? "";
}
function oe(n, e, t) {
  n.classList.toggle(e, !!t);
}
function cn(n, e, { bubbles: t = !1, cancelable: r = !1 } = {}) {
  return new CustomEvent(n, { detail: e, bubbles: t, cancelable: r });
}
let Re;
function Ce(n) {
  Re = n;
}
function Lt() {
  if (!Re)
    throw new Error("Function called outside component initialization");
  return Re;
}
function fn(n) {
  Lt().$$.on_destroy.push(n);
}
function un() {
  const n = Lt();
  return (e, t, { cancelable: r = !1 } = {}) => {
    const l = n.$$.callbacks[e];
    if (l) {
      const a = cn(
        /** @type {string} */
        e,
        t,
        { cancelable: r }
      );
      return l.slice().forEach((o) => {
        o.call(n, a);
      }), !a.defaultPrevented;
    }
    return !0;
  };
}
function ht(n, e) {
  const t = n.$$.callbacks[e.type];
  t && t.slice().forEach((r) => r.call(this, e));
}
const Te = [], Xe = [];
let Me = [];
const mt = [], an = /* @__PURE__ */ Promise.resolve();
let Ye = !1;
function dn() {
  Ye || (Ye = !0, an.then(Bt));
}
function xe(n) {
  Me.push(n);
}
const Je = /* @__PURE__ */ new Set();
let pe = 0;
function Bt() {
  if (pe !== 0)
    return;
  const n = Re;
  do {
    try {
      for (; pe < Te.length; ) {
        const e = Te[pe];
        pe++, Ce(e), hn(e.$$);
      }
    } catch (e) {
      throw Te.length = 0, pe = 0, e;
    }
    for (Ce(null), Te.length = 0, pe = 0; Xe.length; )
      Xe.pop()();
    for (let e = 0; e < Me.length; e += 1) {
      const t = Me[e];
      Je.has(t) || (Je.add(t), t());
    }
    Me.length = 0;
  } while (Te.length);
  for (; mt.length; )
    mt.pop()();
  Ye = !1, Je.clear(), Ce(n);
}
function hn(n) {
  if (n.fragment !== null) {
    n.update(), le(n.before_update);
    const e = n.dirty;
    n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(xe);
  }
}
function mn(n) {
  const e = [], t = [];
  Me.forEach((r) => n.indexOf(r) === -1 ? e.push(r) : t.push(r)), t.forEach((r) => r()), Me = e;
}
const Ue = /* @__PURE__ */ new Set();
let _e;
function je() {
  _e = {
    r: 0,
    c: [],
    p: _e
    // parent group
  };
}
function Ze() {
  _e.r || le(_e.c), _e = _e.p;
}
function W(n, e) {
  n && n.i && (Ue.delete(n), n.i(e));
}
function N(n, e, t, r) {
  if (n && n.o) {
    if (Ue.has(n))
      return;
    Ue.add(n), _e.c.push(() => {
      Ue.delete(n), r && (t && n.d(1), r());
    }), n.o(e);
  } else
    r && r();
}
function _t(n) {
  return (n == null ? void 0 : n.length) !== void 0 ? n : Array.from(n);
}
function _n(n, e) {
  N(n, 1, 1, () => {
    e.delete(n.key);
  });
}
function gn(n, e, t, r, l, a, o, f, h, c, m, v) {
  let g = n.length, L = a.length, I = g;
  const T = {};
  for (; I--; )
    T[n[I].key] = I;
  const M = [], U = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), O = [];
  for (I = L; I--; ) {
    const B = v(l, a, I), C = t(B);
    let _ = o.get(C);
    _ ? r && O.push(() => _.p(B, e)) : (_ = c(C, B), _.c()), U.set(C, M[I] = _), C in T && y.set(C, Math.abs(I - T[C]));
  }
  const F = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
  function b(B) {
    W(B, 1), B.m(f, m), o.set(B.key, B), m = B.first, L--;
  }
  for (; g && L; ) {
    const B = M[L - 1], C = n[g - 1], _ = B.key, w = C.key;
    B === C ? (m = B.first, g--, L--) : U.has(w) ? !o.has(_) || F.has(_) ? b(B) : d.has(w) ? g-- : y.get(_) > y.get(w) ? (d.add(_), b(B)) : (F.add(w), g--) : (h(C, o), g--);
  }
  for (; g--; ) {
    const B = n[g];
    U.has(B.key) || h(B, o);
  }
  for (; L; )
    b(M[L - 1]);
  return le(O), M;
}
function ue(n) {
  n && n.c();
}
function ne(n, e, t) {
  const { fragment: r, after_update: l } = n.$$;
  r && r.m(e, t), xe(() => {
    const a = n.$$.on_mount.map(pt).filter(Tt);
    n.$$.on_destroy ? n.$$.on_destroy.push(...a) : le(a), n.$$.on_mount = [];
  }), l.forEach(xe);
}
function re(n, e) {
  const t = n.$$;
  t.fragment !== null && (mn(t.after_update), le(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
}
function yn(n, e) {
  n.$$.dirty[0] === -1 && (Te.push(n), dn(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
}
function ye(n, e, t, r, l, a, o = null, f = [-1]) {
  const h = Re;
  Ce(n);
  const c = n.$$ = {
    fragment: null,
    ctx: [],
    // state
    props: a,
    update: S,
    not_equal: l,
    bound: ut(),
    // lifecycle
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(e.context || (h ? h.$$.context : [])),
    // everything else
    callbacks: ut(),
    dirty: f,
    skip_bound: !1,
    root: e.target || h.$$.root
  };
  o && o(c.root);
  let m = !1;
  if (c.ctx = t ? t(n, e.props || {}, (v, g, ...L) => {
    const I = L.length ? L[0] : g;
    return c.ctx && l(c.ctx[v], c.ctx[v] = I) && (!c.skip_bound && c.bound[v] && c.bound[v](I), m && yn(n, v)), g;
  }) : [], c.update(), m = !0, le(c.before_update), c.fragment = r ? r(c.ctx) : !1, e.target) {
    if (e.hydrate) {
      const v = on(e.target);
      c.fragment && c.fragment.l(v), v.forEach(z);
    } else
      c.fragment && c.fragment.c();
    e.intro && W(n.$$.fragment), ne(n, e.target, e.anchor), Bt();
  }
  Ce(h);
}
class be {
  constructor() {
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    He(this, "$$");
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    He(this, "$$set");
  }
  /** @returns {void} */
  $destroy() {
    re(this, 1), this.$destroy = S;
  }
  /**
   * @template {Extract<keyof Events, string>} K
   * @param {K} type
   * @param {((e: Events[K]) => void) | null | undefined} callback
   * @returns {() => void}
   */
  $on(e, t) {
    if (!Tt(t))
      return S;
    const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
    return r.push(t), () => {
      const l = r.indexOf(t);
      l !== -1 && r.splice(l, 1);
    };
  }
  /**
   * @param {Partial<Props>} props
   * @returns {void}
   */
  $set(e) {
    this.$$set && !$t(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
  }
}
const bn = "4";
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(bn);
function wn(n) {
  let e, t;
  return {
    c() {
      e = ce("svg"), t = ce("path"), s(t, "d", "M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"), s(e, "viewBox", "0 0 14 14"), s(e, "width", "13"), s(e, "height", "13"), s(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class Ct extends be {
  constructor(e) {
    super(), ye(this, e, null, wn, ge, {});
  }
}
function vn(n) {
  let e, t;
  return {
    c() {
      e = ce("svg"), t = ce("path"), s(t, "d", "M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"), s(e, "viewBox", "0 0 30 30"), s(e, "fill", "none"), s(e, "xmlns", "http://www.w3.org/2000/svg"), s(e, "class", "svelte-d2loi5");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class Et extends be {
  constructor(e) {
    super(), ye(this, e, null, vn, ge, {});
  }
}
function kn(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "area.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "area.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function pn(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "poi.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "poi.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Tn(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "postal_code.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "postal_code.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Mn(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "street.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "street.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Ln(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "road.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "road.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Bn(n) {
  let e, t;
  return {
    c() {
      e = R("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "housenumber.svg") || s(e, "src", t), s(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "housenumber.svg") && s(e, "src", t), l & /*placeType*/
      64 && s(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Cn(n) {
  let e, t, r, l;
  return {
    c() {
      e = R("img"), V(e.src, t = /*imageUrl*/
      n[5]) || s(e, "src", t), s(
        e,
        "alt",
        /*category*/
        n[4]
      ), s(e, "class", "svelte-ltkwvy");
    },
    m(a, o) {
      A(a, e, o), r || (l = D(
        e,
        "error",
        /*error_handler*/
        n[12]
      ), r = !0);
    },
    p(a, o) {
      o & /*imageUrl*/
      32 && !V(e.src, t = /*imageUrl*/
      a[5]) && s(e, "src", t), o & /*category*/
      16 && s(
        e,
        "alt",
        /*category*/
        a[4]
      );
    },
    d(a) {
      a && z(e), r = !1, l();
    }
  };
}
function gt(n) {
  let e, t;
  return {
    c() {
      e = R("span"), t = fe(
        /*placeType*/
        n[6]
      ), s(e, "class", "secondary svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p(r, l) {
      l & /*placeType*/
      64 && Ee(
        t,
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function En(n) {
  var B, C;
  let e, t, r, l, a, o, f, h, c = (
    /*feature*/
    n[0].place_name.replace(/,.*/, "") + ""
  ), m, v, g = (
    /*showPlaceType*/
    n[2] === "always" || /*showPlaceType*/
    n[2] && !/*feature*/
    n[0].address && /*feature*/
    ((B = n[0].properties) == null ? void 0 : B.kind) !== "road" && /*feature*/
    ((C = n[0].properties) == null ? void 0 : C.kind) !== "road_relation" && !/*feature*/
    n[0].id.startsWith("address.") && !/*feature*/
    n[0].id.startsWith("postal_code.") && (!/*feature*/
    n[0].id.startsWith("poi.") || !/*imageUrl*/
    n[5])
  ), L, I, T = (
    /*feature*/
    n[0].place_name.replace(/[^,]*,?\s*/, "") + ""
  ), M, U, y;
  function O(_, w) {
    var X, u;
    return w & /*feature*/
    1 && (t = null), w & /*feature*/
    1 && (r = null), w & /*feature*/
    1 && (l = null), /*imageUrl*/
    _[5] ? Cn : (
      /*feature*/
      _[0].address ? Bn : (
        /*feature*/
        ((X = _[0].properties) == null ? void 0 : X.kind) === "road" || /*feature*/
        ((u = _[0].properties) == null ? void 0 : u.kind) === "road_relation" ? Ln : (t == null && (t = !!/*feature*/
        _[0].id.startsWith("address.")), t ? Mn : (r == null && (r = !!/*feature*/
        _[0].id.startsWith("postal_code.")), r ? Tn : (l == null && (l = !!/*feature*/
        _[0].id.startsWith("poi.")), l ? pn : kn)))
      )
    );
  }
  let F = O(n, -1), d = F(n), b = g && gt(n);
  return {
    c() {
      e = R("li"), d.c(), a = J(), o = R("span"), f = R("span"), h = R("span"), m = fe(c), v = J(), b && b.c(), L = J(), I = R("span"), M = fe(T), s(h, "class", "primary svelte-ltkwvy"), s(f, "class", "svelte-ltkwvy"), s(I, "class", "line2 svelte-ltkwvy"), s(o, "class", "texts svelte-ltkwvy"), s(e, "tabindex", "0"), s(
        e,
        "data-selected",
        /*selected*/
        n[1]
      ), s(e, "class", "svelte-ltkwvy"), oe(
        e,
        "selected",
        /*selected*/
        n[1]
      );
    },
    m(_, w) {
      A(_, e, w), d.m(e, null), k(e, a), k(e, o), k(o, f), k(f, h), k(h, m), k(f, v), b && b.m(f, null), k(o, L), k(o, I), k(I, M), U || (y = [
        D(
          e,
          "mouseenter",
          /*mouseenter_handler*/
          n[10]
        ),
        D(
          e,
          "focus",
          /*focus_handler*/
          n[11]
        )
      ], U = !0);
    },
    p(_, [w]) {
      var X, u;
      F === (F = O(_, w)) && d ? d.p(_, w) : (d.d(1), d = F(_), d && (d.c(), d.m(e, a))), w & /*feature*/
      1 && c !== (c = /*feature*/
      _[0].place_name.replace(/,.*/, "") + "") && Ee(m, c), w & /*showPlaceType, feature, imageUrl*/
      37 && (g = /*showPlaceType*/
      _[2] === "always" || /*showPlaceType*/
      _[2] && !/*feature*/
      _[0].address && /*feature*/
      ((X = _[0].properties) == null ? void 0 : X.kind) !== "road" && /*feature*/
      ((u = _[0].properties) == null ? void 0 : u.kind) !== "road_relation" && !/*feature*/
      _[0].id.startsWith("address.") && !/*feature*/
      _[0].id.startsWith("postal_code.") && (!/*feature*/
      _[0].id.startsWith("poi.") || !/*imageUrl*/
      _[5])), g ? b ? b.p(_, w) : (b = gt(_), b.c(), b.m(f, null)) : b && (b.d(1), b = null), w & /*feature*/
      1 && T !== (T = /*feature*/
      _[0].place_name.replace(/[^,]*,?\s*/, "") + "") && Ee(M, T), w & /*selected*/
      2 && s(
        e,
        "data-selected",
        /*selected*/
        _[1]
      ), w & /*selected*/
      2 && oe(
        e,
        "selected",
        /*selected*/
        _[1]
      );
    },
    i: S,
    o: S,
    d(_) {
      _ && z(e), d.d(), b && b.d(), U = !1, le(y);
    }
  };
}
function Rn(n, e, t) {
  var U;
  let r, l, { feature: a } = e, { selected: o = !1 } = e, { showPlaceType: f } = e, { missingIconsCache: h } = e, { iconsBaseUrl: c } = e;
  const m = (U = a.properties) == null ? void 0 : U.categories;
  let v, g;
  function L(y) {
    g && h.add(g), t(9, r--, r);
  }
  function I(y) {
    ht.call(this, n, y);
  }
  function T(y) {
    ht.call(this, n, y);
  }
  const M = (y) => L(y.currentTarget);
  return n.$$set = (y) => {
    "feature" in y && t(0, a = y.feature), "selected" in y && t(1, o = y.selected), "showPlaceType" in y && t(2, f = y.showPlaceType), "missingIconsCache" in y && t(8, h = y.missingIconsCache), "iconsBaseUrl" in y && t(3, c = y.iconsBaseUrl);
  }, n.$$.update = () => {
    var y, O, F, d;
    if (n.$$.dirty & /*index, category, iconsBaseUrl, imageUrl, missingIconsCache*/
    824)
      do
        t(9, r--, r), t(4, v = m == null ? void 0 : m[r]), t(5, g = v ? c + v.replace(/ /g, "_") + ".svg" : void 0);
      while (r > -1 && (!g || h.has(g)));
    n.$$.dirty & /*feature*/
    1 && t(6, l = a.id.startsWith("poi.") ? (O = (y = a.properties) == null ? void 0 : y.categories) == null ? void 0 : O.join(", ") : ((d = (F = a.properties) == null ? void 0 : F.place_type_name) == null ? void 0 : d[0]) ?? a.place_type[0]);
  }, t(9, r = (m == null ? void 0 : m.length) ?? 0), [
    a,
    o,
    f,
    c,
    v,
    g,
    l,
    L,
    h,
    r,
    I,
    T,
    M
  ];
}
class In extends be {
  constructor(e) {
    super(), ye(this, e, Rn, En, ge, {
      feature: 0,
      selected: 1,
      showPlaceType: 2,
      missingIconsCache: 8,
      iconsBaseUrl: 3
    });
  }
}
function Sn(n) {
  let e;
  return {
    c() {
      e = R("div"), e.innerHTML = '<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>', s(e, "class", "svelte-7cmwmc");
    },
    m(t, r) {
      A(t, e, r);
    },
    p: S,
    i: S,
    o: S,
    d(t) {
      t && z(e);
    }
  };
}
class zn extends be {
  constructor(e) {
    super(), ye(this, e, null, Sn, ge, {});
  }
}
function Pn(n) {
  let e, t;
  return {
    c() {
      e = ce("svg"), t = ce("path"), s(t, "d", "M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"), s(e, "viewBox", "0 0 60.006 21.412"), s(e, "width", "14"), s(e, "height", "20"), s(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class An extends be {
  constructor(e) {
    super(), ye(this, e, null, Pn, ge, {});
  }
}
function Un(n) {
  let e, t;
  return {
    c() {
      e = ce("svg"), t = ce("path"), s(t, "d", "M13.101 14.261 8.74 9.899a4.797 4.797 0 0 1-1.425.748 5.165 5.165 0 0 1-1.603.248c-1.446 0-2.677-.5-3.693-1.503S.495 7.164.495 5.717c0-1.446.508-2.678 1.524-3.693C3.035 1.008 4.266.5 5.712.5c1.448 0 2.672.508 3.675 1.524 1.002 1.015 1.503 2.247 1.503 3.693 0 .558-.08 1.092-.239 1.603-.159.512-.411.98-.757 1.405l4.382 4.4a.74.74 0 0 1 .229.568.81.81 0 0 1-.249.568.787.787 0 0 1-.577.239.787.787 0 0 1-.578-.239ZM5.712 9.223c.97 0 1.796-.342 2.48-1.026a3.378 3.378 0 0 0 1.026-2.48c0-.982-.34-1.818-1.016-2.509-.677-.69-1.507-1.035-2.49-1.035a3.42 3.42 0 0 0-2.509 1.035 3.42 3.42 0 0 0-1.035 2.51c0 .982.345 1.812 1.035 2.488.691.678 1.527 1.017 2.51 1.017Z"), s(e, "width", "14"), s(e, "height", "14"), s(e, "viewBox", "0 0 15 15"), s(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class jn extends be {
  constructor(e) {
    super(), ye(this, e, null, Un, ge, {});
  }
}
function yt(n, e, t) {
  const r = n.slice();
  return r[76] = e[t], r[78] = t, r;
}
function bt(n) {
  let e, t;
  return e = new zn({}), {
    c() {
      ue(e.$$.fragment);
    },
    m(r, l) {
      ne(e, r, l), t = !0;
    },
    i(r) {
      t || (W(e.$$.fragment, r), t = !0);
    },
    o(r) {
      N(e.$$.fragment, r), t = !1;
    },
    d(r) {
      re(e, r);
    }
  };
}
function wt(n) {
  let e, t, r, l, a;
  return t = new An({}), {
    c() {
      e = R("button"), ue(t.$$.fragment), s(e, "type", "button"), s(
        e,
        "title",
        /*reverseButtonTitle*/
        n[9]
      ), s(e, "class", "svelte-1r7dvt7"), oe(
        e,
        "active",
        /*reverseActive*/
        n[0]
      );
    },
    m(o, f) {
      A(o, e, f), ne(t, e, null), r = !0, l || (a = D(
        e,
        "click",
        /*click_handler_2*/
        n[61]
      ), l = !0);
    },
    p(o, f) {
      (!r || f[0] & /*reverseButtonTitle*/
      512) && s(
        e,
        "title",
        /*reverseButtonTitle*/
        o[9]
      ), (!r || f[0] & /*reverseActive*/
      1) && oe(
        e,
        "active",
        /*reverseActive*/
        o[0]
      );
    },
    i(o) {
      r || (W(t.$$.fragment, o), r = !0);
    },
    o(o) {
      N(t.$$.fragment, o), r = !1;
    },
    d(o) {
      o && z(e), re(t), l = !1, a();
    }
  };
}
function Zn(n) {
  let e, t = [], r = /* @__PURE__ */ new Map(), l, a, o, f = _t(
    /*listFeatures*/
    n[13]
  );
  const h = (c) => (
    /*feature*/
    c[76].id + /*feature*/
    (c[76].address ? "," + /*feature*/
    c[76].address : "")
  );
  for (let c = 0; c < f.length; c += 1) {
    let m = yt(n, f, c), v = h(m);
    r.set(v, t[c] = vt(v, m));
  }
  return {
    c() {
      e = R("ul");
      for (let c = 0; c < t.length; c += 1)
        t[c].c();
      s(e, "class", "svelte-1r7dvt7");
    },
    m(c, m) {
      A(c, e, m);
      for (let v = 0; v < t.length; v += 1)
        t[v] && t[v].m(e, null);
      l = !0, a || (o = [
        D(
          e,
          "mouseleave",
          /*mouseleave_handler*/
          n[65]
        ),
        D(
          e,
          "blur",
          /*blur_handler_1*/
          n[66]
        )
      ], a = !0);
    },
    p(c, m) {
      m[0] & /*listFeatures, showPlaceType, selectedItemIndex, missingIconsCache, iconsBaseUrl, pick*/
      8940544 && (f = _t(
        /*listFeatures*/
        c[13]
      ), je(), t = gn(t, m, h, 1, c, f, r, e, _n, vt, null, yt), Ze());
    },
    i(c) {
      if (!l) {
        for (let m = 0; m < f.length; m += 1)
          W(t[m]);
        l = !0;
      }
    },
    o(c) {
      for (let m = 0; m < t.length; m += 1)
        N(t[m]);
      l = !1;
    },
    d(c) {
      c && z(e);
      for (let m = 0; m < t.length; m += 1)
        t[m].d();
      a = !1, le(o);
    }
  };
}
function Wn(n) {
  let e, t, r, l, a, o;
  return t = new Et({}), {
    c() {
      e = R("div"), ue(t.$$.fragment), r = J(), l = R("div"), a = fe(
        /*noResultsMessage*/
        n[7]
      ), s(l, "class", "svelte-1r7dvt7"), s(e, "class", "no-results svelte-1r7dvt7");
    },
    m(f, h) {
      A(f, e, h), ne(t, e, null), k(e, r), k(e, l), k(l, a), o = !0;
    },
    p(f, h) {
      (!o || h[0] & /*noResultsMessage*/
      128) && Ee(
        a,
        /*noResultsMessage*/
        f[7]
      );
    },
    i(f) {
      o || (W(t.$$.fragment, f), o = !0);
    },
    o(f) {
      N(t.$$.fragment, f), o = !1;
    },
    d(f) {
      f && z(e), re(t);
    }
  };
}
function On(n) {
  let e = "", t;
  return {
    c() {
      t = fe(e);
    },
    m(r, l) {
      A(r, t, l);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(t);
    }
  };
}
function Fn(n) {
  let e, t, r, l, a, o, f, h, c, m, v;
  return t = new Et({}), h = new Ct({}), {
    c() {
      e = R("div"), ue(t.$$.fragment), r = J(), l = R("div"), a = fe(
        /*errorMessage*/
        n[6]
      ), o = J(), f = R("button"), ue(h.$$.fragment), s(l, "class", "svelte-1r7dvt7"), s(f, "class", "svelte-1r7dvt7"), s(e, "class", "error svelte-1r7dvt7");
    },
    m(g, L) {
      A(g, e, L), ne(t, e, null), k(e, r), k(e, l), k(l, a), k(e, o), k(e, f), ne(h, f, null), c = !0, m || (v = D(
        f,
        "click",
        /*click_handler_3*/
        n[62]
      ), m = !0);
    },
    p(g, L) {
      (!c || L[0] & /*errorMessage*/
      64) && Ee(
        a,
        /*errorMessage*/
        g[6]
      );
    },
    i(g) {
      c || (W(t.$$.fragment, g), W(h.$$.fragment, g), c = !0);
    },
    o(g) {
      N(t.$$.fragment, g), N(h.$$.fragment, g), c = !1;
    },
    d(g) {
      g && z(e), re(t), re(h), m = !1, v();
    }
  };
}
function vt(n, e) {
  let t, r, l;
  function a() {
    return (
      /*mouseenter_handler*/
      e[63](
        /*i*/
        e[78]
      )
    );
  }
  function o() {
    return (
      /*focus_handler_1*/
      e[64](
        /*feature*/
        e[76]
      )
    );
  }
  return r = new In({
    props: {
      feature: (
        /*feature*/
        e[76]
      ),
      showPlaceType: (
        /*showPlaceType*/
        e[10]
      ),
      selected: (
        /*selectedItemIndex*/
        e[14] === /*i*/
        e[78]
      ),
      missingIconsCache: (
        /*missingIconsCache*/
        e[19]
      ),
      iconsBaseUrl: (
        /*iconsBaseUrl*/
        e[11]
      )
    }
  }), r.$on("mouseenter", a), r.$on("focus", o), {
    key: n,
    first: null,
    c() {
      t = ln(), ue(r.$$.fragment), this.first = t;
    },
    m(f, h) {
      A(f, t, h), ne(r, f, h), l = !0;
    },
    p(f, h) {
      e = f;
      const c = {};
      h[0] & /*listFeatures*/
      8192 && (c.feature = /*feature*/
      e[76]), h[0] & /*showPlaceType*/
      1024 && (c.showPlaceType = /*showPlaceType*/
      e[10]), h[0] & /*selectedItemIndex, listFeatures*/
      24576 && (c.selected = /*selectedItemIndex*/
      e[14] === /*i*/
      e[78]), h[0] & /*iconsBaseUrl*/
      2048 && (c.iconsBaseUrl = /*iconsBaseUrl*/
      e[11]), r.$set(c);
    },
    i(f) {
      l || (W(r.$$.fragment, f), l = !0);
    },
    o(f) {
      N(r.$$.fragment, f), l = !1;
    },
    d(f) {
      f && z(t), re(r, f);
    }
  };
}
function Nn(n) {
  let e, t, r, l, a, o, f, h, c, m, v, g, L, I, T, M, U, y, O, F;
  l = new jn({}), m = new Ct({});
  let d = (
    /*abortController*/
    n[18] && bt()
  ), b = (
    /*enableReverse*/
    n[5] === !0 && wt(n)
  );
  const B = (
    /*#slots*/
    n[53].default
  ), C = en(
    B,
    n,
    /*$$scope*/
    n[52],
    null
  ), _ = [Fn, On, Wn, Zn], w = [];
  function X(u, P) {
    var te, ae;
    return (
      /*error*/
      u[17] ? 0 : (
        /*focusedDelayed*/
        u[15] ? (
          /*listFeatures*/
          ((te = u[13]) == null ? void 0 : te.length) === 0 ? 2 : (
            /*focusedDelayed*/
            u[15] && /*listFeatures*/
            ((ae = u[13]) != null && ae.length) ? 3 : -1
          )
        ) : 1
      )
    );
  }
  return ~(T = X(n)) && (M = w[T] = _[T](n)), {
    c() {
      e = R("form"), t = R("div"), r = R("button"), ue(l.$$.fragment), a = J(), o = R("input"), f = J(), h = R("div"), c = R("button"), ue(m.$$.fragment), v = J(), d && d.c(), g = J(), b && b.c(), L = J(), C && C.c(), I = J(), M && M.c(), s(r, "class", "search-button svelte-1r7dvt7"), s(r, "type", "button"), s(
        o,
        "placeholder",
        /*placeholder*/
        n[8]
      ), s(
        o,
        "aria-label",
        /*placeholder*/
        n[8]
      ), s(o, "class", "svelte-1r7dvt7"), s(c, "type", "button"), s(
        c,
        "title",
        /*clearButtonTitle*/
        n[3]
      ), s(c, "class", "svelte-1r7dvt7"), s(h, "class", "clear-button-container svelte-1r7dvt7"), oe(
        h,
        "displayable",
        /*searchValue*/
        n[1] !== ""
      ), s(t, "class", "input-group svelte-1r7dvt7"), s(e, "tabindex", "0"), s(e, "class", U = at(
        /*className*/
        n[2]
      ) + " svelte-1r7dvt7"), oe(
        e,
        "can-collapse",
        /*collapsed*/
        n[4] && /*searchValue*/
        n[1] === ""
      );
    },
    m(u, P) {
      A(u, e, P), k(e, t), k(t, r), ne(l, r, null), k(t, a), k(t, o), n[55](o), dt(
        o,
        /*searchValue*/
        n[1]
      ), k(t, f), k(t, h), k(h, c), ne(m, c, null), k(h, v), d && d.m(h, null), k(t, g), b && b.m(t, null), k(t, L), C && C.m(t, null), k(e, I), ~T && w[T].m(e, null), y = !0, O || (F = [
        D(
          r,
          "click",
          /*click_handler*/
          n[54]
        ),
        D(
          o,
          "input",
          /*input_1_input_handler*/
          n[56]
        ),
        D(
          o,
          "focus",
          /*focus_handler*/
          n[57]
        ),
        D(
          o,
          "blur",
          /*blur_handler*/
          n[58]
        ),
        D(
          o,
          "keydown",
          /*handleKeyDown*/
          n[21]
        ),
        D(
          o,
          "input",
          /*input_handler*/
          n[59]
        ),
        D(
          c,
          "click",
          /*click_handler_1*/
          n[60]
        ),
        D(e, "submit", sn(
          /*handleOnSubmit*/
          n[20]
        ))
      ], O = !0);
    },
    p(u, P) {
      (!y || P[0] & /*placeholder*/
      256) && s(
        o,
        "placeholder",
        /*placeholder*/
        u[8]
      ), (!y || P[0] & /*placeholder*/
      256) && s(
        o,
        "aria-label",
        /*placeholder*/
        u[8]
      ), P[0] & /*searchValue*/
      2 && o.value !== /*searchValue*/
      u[1] && dt(
        o,
        /*searchValue*/
        u[1]
      ), (!y || P[0] & /*clearButtonTitle*/
      8) && s(
        c,
        "title",
        /*clearButtonTitle*/
        u[3]
      ), /*abortController*/
      u[18] ? d ? P[0] & /*abortController*/
      262144 && W(d, 1) : (d = bt(), d.c(), W(d, 1), d.m(h, null)) : d && (je(), N(d, 1, 1, () => {
        d = null;
      }), Ze()), (!y || P[0] & /*searchValue*/
      2) && oe(
        h,
        "displayable",
        /*searchValue*/
        u[1] !== ""
      ), /*enableReverse*/
      u[5] === !0 ? b ? (b.p(u, P), P[0] & /*enableReverse*/
      32 && W(b, 1)) : (b = wt(u), b.c(), W(b, 1), b.m(t, L)) : b && (je(), N(b, 1, 1, () => {
        b = null;
      }), Ze()), C && C.p && (!y || P[1] & /*$$scope*/
      2097152) && nn(
        C,
        B,
        u,
        /*$$scope*/
        u[52],
        y ? tn(
          B,
          /*$$scope*/
          u[52],
          P,
          null
        ) : rn(
          /*$$scope*/
          u[52]
        ),
        null
      );
      let te = T;
      T = X(u), T === te ? ~T && w[T].p(u, P) : (M && (je(), N(w[te], 1, 1, () => {
        w[te] = null;
      }), Ze()), ~T ? (M = w[T], M ? M.p(u, P) : (M = w[T] = _[T](u), M.c()), W(M, 1), M.m(e, null)) : M = null), (!y || P[0] & /*className*/
      4 && U !== (U = at(
        /*className*/
        u[2]
      ) + " svelte-1r7dvt7")) && s(e, "class", U), (!y || P[0] & /*className, collapsed, searchValue*/
      22) && oe(
        e,
        "can-collapse",
        /*collapsed*/
        u[4] && /*searchValue*/
        u[1] === ""
      );
    },
    i(u) {
      y || (W(l.$$.fragment, u), W(m.$$.fragment, u), W(d), W(b), W(C, u), W(M), y = !0);
    },
    o(u) {
      N(l.$$.fragment, u), N(m.$$.fragment, u), N(d), N(b), N(C, u), N(M), y = !1;
    },
    d(u) {
      u && z(e), re(l), n[55](null), re(m), d && d.d(), b && b.d(), C && C.d(u), ~T && w[T].d(), O = !1, le(F);
    }
  };
}
function Gn(n, e, t) {
  const r = e[1], l = e[0], a = r - l;
  return n === r && t ? n : ((n - l) % a + a) % a + l;
}
function kt(n) {
  let e = [...n];
  return e[2] < e[0] && (e[2] += 360), e;
}
function Qn(n, e, t) {
  let r, { $$slots: l = {}, $$scope: a } = e, { class: o = void 0 } = e, { apiKey: f } = e, { bbox: h = void 0 } = e, { clearButtonTitle: c = "clear" } = e, { clearOnBlur: m = !1 } = e, { collapsed: v = !1 } = e, { country: g = void 0 } = e, { debounceSearch: L = 200 } = e, { enableReverse: I = !1 } = e, { errorMessage: T = "Something went wrong…" } = e, { filter: M = () => !0 } = e, { flyTo: U = !0 } = e, { fuzzyMatch: y = !0 } = e, { language: O = void 0 } = e, { limit: F = void 0 } = e, { mapController: d = void 0 } = e, { minLength: b = 2 } = e, { noResultsMessage: B = "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!" } = e, { placeholder: C = "Search" } = e, { proximity: _ = [{ type: "server-geolocation" }] } = e, { reverseActive: w = I === "always" } = e, { reverseButtonTitle: X = "toggle reverse geocoding" } = e, { searchValue: u = "" } = e, { showFullGeometry: P = !0 } = e, { showPlaceType: te = "ifNeeded" } = e, { showResultsWhileTyping: ae = !0 } = e, { types: de = void 0 } = e, { zoom: Ie = 16 } = e, { maxZoom: Le = 18 } = e, { apiUrl: We = "https://api.maptiler.com/geocoding" } = e, { fetchParameters: Oe = {} } = e, { iconsBaseUrl: $e = "https://cdn.maptiler.com/maptiler-geocoding-control/v1.0.0-rc.4/icons/" } = e, { adjustQuery: Fe = (i) => {
  } } = e;
  function Rt() {
    Y.focus();
  }
  function It() {
    Y.blur();
  }
  function et(i, Z = !0) {
    t(1, u = i), Z ? (t(14, j = -1), nt()) : (Qe(), setTimeout(() => {
      Y.focus(), Y.select();
    }));
  }
  let we = !1, E, Q, p, tt = "", Y, j = -1, x, Se = [], he, ve, ze, Ne, Be;
  const St = /* @__PURE__ */ new Set(), ie = un();
  fn(() => {
    d && (d.setEventHandler(void 0), d.indicateReverse(!1), d.setSelectedMarker(-1), d.setMarkers(void 0, void 0));
  });
  function nt(i) {
    if (ve && (clearTimeout(ve), ve = void 0), j > -1 && E)
      t(49, p = E[j]), t(1, u = p.place_name.replace(/,.*/, "")), t(17, x = void 0), t(48, Q = void 0), t(14, j = -1);
    else if (u) {
      const Z = i || !rt();
      Ge(u, { exact: !0 }).then(() => {
        t(48, Q = E), t(49, p = void 0), Z && zt();
      }).catch(($) => t(17, x = $));
    }
  }
  function rt() {
    return /^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(u);
  }
  async function Ge(i, { byId: Z = !1, exact: $ = !1 } = {}) {
    t(17, x = void 0), he == null || he.abort();
    const se = new AbortController();
    t(18, he = se);
    try {
      const H = rt(), q = new URLSearchParams();
      if (O !== void 0 && q.set("language", Array.isArray(O) ? O.join(",") : O ?? ""), de && q.set("types", de.join(",")), h && q.set("bbox", h.map((Ve) => Ve.toFixed(6)).join(",")), g && q.set("country", Array.isArray(g) ? g.join(",") : g), !Z && !H) {
        async function Ve() {
          const ke = d == null ? void 0 : d.getCenterAndZoom();
          for (const K of _ ?? [])
            if (!(ke && (K.minZoom != null && K.minZoom > ke[0] || K.maxZoom != null && K.maxZoom < ke[0]))) {
              if (K.type === "fixed")
                return K.coordinates.join(",");
              e:
                if (K.type === "client-geolocation") {
                  if (Be && K.cachedLocationExpiry && Be.time + K.cachedLocationExpiry > Date.now()) {
                    if (!Be.coords)
                      break e;
                    return Be.coords;
                  }
                  let Ke;
                  try {
                    return Ke = await new Promise((Ht, st) => {
                      se.signal.addEventListener("abort", () => {
                        st(Error("aborted"));
                      }), navigator.geolocation.getCurrentPosition(
                        (Pe) => {
                          Ht([Pe.coords.longitude, Pe.coords.latitude].map((Jt) => Jt.toFixed(6)).join(","));
                        },
                        (Pe) => {
                          st(Pe);
                        },
                        K
                      );
                    }), Ke;
                  } catch {
                  } finally {
                    K.cachedLocationExpiry && (Be = {
                      time: Date.now(),
                      // ignore
                      coords: Ke
                    });
                  }
                  if (se.signal.aborted)
                    return;
                }
              if (K.type === "server-geolocation")
                return "ip";
              if (ke && K.type === "map-center")
                return ke[1].toFixed(6) + "," + ke[2].toFixed(6);
            }
        }
        const it = await Ve();
        it && q.set("proximity", it), ($ || !ae) && q.set("autocomplete", "false"), q.set("fuzzyMatch", String(y));
      }
      F !== void 0 && (!H || (de == null ? void 0 : de.length) === 1) && q.set("limit", String(F)), q.set("key", f), Fe(q);
      const G = We + "/" + encodeURIComponent(i) + ".json?" + q.toString();
      if (G === tt) {
        Z ? (t(13, E = void 0), t(49, p = Se[0])) : t(13, E = Se);
        return;
      }
      tt = G;
      const lt = await fetch(G, { signal: se.signal, ...Oe });
      if (!lt.ok)
        throw new Error();
      const qe = await lt.json();
      ie("response", { url: G, featureCollection: qe }), Z ? (t(13, E = void 0), t(49, p = qe.features[0]), Se = [p]) : (t(13, E = qe.features.filter(M)), Se = E, H && Y.focus());
    } catch (H) {
      if (H && typeof H == "object" && "name" in H && H.name === "AbortError")
        return;
      throw H;
    } finally {
      se === he && t(18, he = void 0);
    }
  }
  function zt() {
    var $, se, H, q;
    if (!(Q != null && Q.length) || !U)
      return;
    const i = [180, 90, -180, -90], Z = !Q.some((G) => !G.matching_text);
    for (const G of Q)
      (Z || !G.matching_text) && (i[0] = Math.min(i[0], (($ = G.bbox) == null ? void 0 : $[0]) ?? G.center[0]), i[1] = Math.min(i[1], ((se = G.bbox) == null ? void 0 : se[1]) ?? G.center[1]), i[2] = Math.max(i[2], ((H = G.bbox) == null ? void 0 : H[2]) ?? G.center[0]), i[3] = Math.max(i[3], ((q = G.bbox) == null ? void 0 : q[3]) ?? G.center[1]));
    d && Q.length > 0 && (p && i[0] === i[2] && i[1] === i[3] ? d.flyTo(p.center, Ie) : d.fitBounds(kt(i), 50, Le));
  }
  function Pt(i) {
    t(0, w = I === "always"), et(Gn(i[0], [-180, 180], !0).toFixed(6) + "," + i[1].toFixed(6));
  }
  function At(i) {
    if (!E)
      return;
    let Z = i.key === "ArrowDown" ? 1 : i.key === "ArrowUp" ? -1 : 0;
    Z ? (j === -1 && Z === -1 && t(14, j = E.length), t(14, j += Z), j >= E.length && t(14, j = -1), i.preventDefault()) : ["ArrowLeft", "ArrowRight", "Home", "End"].includes(i.key) && t(14, j = -1);
  }
  function Qe(i = !0) {
    if (t(17, x = void 0), ae) {
      if (ve && clearTimeout(ve), u.length < b)
        return;
      const Z = u;
      ve = window.setTimeout(
        () => {
          Ge(Z).catch(($) => t(17, x = $));
        },
        i ? L : 0
      );
    } else
      t(13, E = void 0), t(17, x = void 0);
  }
  function De(i) {
    t(49, p = i), t(1, u = i.place_name), t(14, j = -1);
  }
  const Ut = () => Y.focus();
  function jt(i) {
    Xe[i ? "unshift" : "push"](() => {
      Y = i, t(16, Y);
    });
  }
  function Zt() {
    u = this.value, t(1, u), t(12, we), t(26, m);
  }
  const Wt = () => t(12, we = !0), Ot = () => t(12, we = !1), Ft = () => Qe(), Nt = () => {
    t(1, u = ""), Y.focus();
  }, Gt = () => t(0, w = !w), Qt = () => t(17, x = void 0), Dt = (i) => t(14, j = i), qt = (i) => De(i), Vt = () => t(14, j = -1), Kt = () => {
  };
  return n.$$set = (i) => {
    "class" in i && t(2, o = i.class), "apiKey" in i && t(24, f = i.apiKey), "bbox" in i && t(25, h = i.bbox), "clearButtonTitle" in i && t(3, c = i.clearButtonTitle), "clearOnBlur" in i && t(26, m = i.clearOnBlur), "collapsed" in i && t(4, v = i.collapsed), "country" in i && t(27, g = i.country), "debounceSearch" in i && t(28, L = i.debounceSearch), "enableReverse" in i && t(5, I = i.enableReverse), "errorMessage" in i && t(6, T = i.errorMessage), "filter" in i && t(29, M = i.filter), "flyTo" in i && t(30, U = i.flyTo), "fuzzyMatch" in i && t(31, y = i.fuzzyMatch), "language" in i && t(32, O = i.language), "limit" in i && t(33, F = i.limit), "mapController" in i && t(34, d = i.mapController), "minLength" in i && t(35, b = i.minLength), "noResultsMessage" in i && t(7, B = i.noResultsMessage), "placeholder" in i && t(8, C = i.placeholder), "proximity" in i && t(36, _ = i.proximity), "reverseActive" in i && t(0, w = i.reverseActive), "reverseButtonTitle" in i && t(9, X = i.reverseButtonTitle), "searchValue" in i && t(1, u = i.searchValue), "showFullGeometry" in i && t(37, P = i.showFullGeometry), "showPlaceType" in i && t(10, te = i.showPlaceType), "showResultsWhileTyping" in i && t(38, ae = i.showResultsWhileTyping), "types" in i && t(39, de = i.types), "zoom" in i && t(40, Ie = i.zoom), "maxZoom" in i && t(41, Le = i.maxZoom), "apiUrl" in i && t(42, We = i.apiUrl), "fetchParameters" in i && t(43, Oe = i.fetchParameters), "iconsBaseUrl" in i && t(11, $e = i.iconsBaseUrl), "adjustQuery" in i && t(44, Fe = i.adjustQuery), "$$scope" in i && t(52, a = i.$$scope);
  }, n.$$.update = () => {
    if (n.$$.dirty[0] & /*focused, clearOnBlur*/
    67112960 && setTimeout(() => {
      t(15, ze = we), m && !we && t(1, u = "");
    }), n.$$.dirty[0] & /*searchValue, listFeatures*/
    8194 | n.$$.dirty[1] & /*minLength*/
    16 && u.length < b && (t(49, p = void 0), t(13, E = void 0), t(17, x = void 0), t(48, Q = E)), n.$$.dirty[1] & /*showFullGeometry, picked*/
    262208 && P && p && !p.address && p.geometry.type === "Point" && Ge(p.id, { byId: !0 }).catch((i) => t(17, x = i)), n.$$.dirty[0] & /*flyTo*/
    1073741824 | n.$$.dirty[1] & /*mapController, picked, prevIdToFly, maxZoom, zoom*/
    787976 && (d && p && p.id !== Ne && U && (!p.bbox || p.bbox[0] === p.bbox[2] && p.bbox[1] === p.bbox[3] ? d.flyTo(p.center, p.id.startsWith("poi.") || p.id.startsWith("address.") ? Le : Ie) : d.fitBounds(kt(p.bbox), 50, Le), t(13, E = void 0), t(48, Q = void 0), t(14, j = -1)), t(50, Ne = p == null ? void 0 : p.id)), n.$$.dirty[0] & /*listFeatures*/
    8192 | n.$$.dirty[1] & /*markedFeatures*/
    131072 && Q !== E && t(48, Q = void 0), n.$$.dirty[1] & /*mapController, markedFeatures, picked*/
    393224 && d && d.setMarkers(Q, p), n.$$.dirty[0] & /*searchValue*/
    2 && t(14, j = -1), n.$$.dirty[0] & /*reverseActive, listFeatures, focusedDelayed*/
    40961 | n.$$.dirty[1] & /*mapController*/
    8 && d && d.setEventHandler((i) => {
      switch (i.type) {
        case "mapClick":
          w && Pt(i.coordinates);
          break;
        case "markerClick":
          {
            const Z = E == null ? void 0 : E.find(($) => $.id === i.id);
            Z && De(Z);
          }
          break;
        case "markerMouseEnter":
          t(14, j = ze ? (E == null ? void 0 : E.findIndex((Z) => Z.id === i.id)) ?? -1 : -1);
          break;
        case "markerMouseLeave":
          t(14, j = -1);
          break;
      }
    }), n.$$.dirty[0] & /*selectedItemIndex*/
    16384 | n.$$.dirty[1] & /*mapController*/
    8 && (d == null || d.setSelectedMarker(j)), n.$$.dirty[0] & /*listFeatures, selectedItemIndex*/
    24576 && t(51, r = E == null ? void 0 : E[j]), n.$$.dirty[0] & /*searchValue*/
    2 | n.$$.dirty[1] & /*mapController*/
    8) {
      const i = /^(-?\d+(?:\.\d*)?),(-?\d+(?:\.\d*)?)$/.exec(u);
      d == null || d.setReverseMarker(i ? [Number(i[1]), Number(i[2])] : void 0);
    }
    n.$$.dirty[1] & /*selected*/
    1048576 && ie("select", r), n.$$.dirty[1] & /*picked*/
    262144 && ie("pick", p), n.$$.dirty[0] & /*focusedDelayed, listFeatures*/
    40960 && ie("optionsVisibilityChange", ze && !!E), n.$$.dirty[0] & /*listFeatures*/
    8192 && ie("featuresListed", E), n.$$.dirty[1] & /*markedFeatures*/
    131072 && ie("featuresMarked", Q), n.$$.dirty[0] & /*reverseActive*/
    1 && ie("reverseToggle", w), n.$$.dirty[0] & /*searchValue*/
    2 && ie("queryChange", u), n.$$.dirty[0] & /*reverseActive*/
    1 | n.$$.dirty[1] & /*mapController*/
    8 && d && d.indicateReverse(w);
  }, [
    w,
    u,
    o,
    c,
    v,
    I,
    T,
    B,
    C,
    X,
    te,
    $e,
    we,
    E,
    j,
    ze,
    Y,
    x,
    he,
    St,
    nt,
    At,
    Qe,
    De,
    f,
    h,
    m,
    g,
    L,
    M,
    U,
    y,
    O,
    F,
    d,
    b,
    _,
    P,
    ae,
    de,
    Ie,
    Le,
    We,
    Oe,
    Fe,
    Rt,
    It,
    et,
    Q,
    p,
    Ne,
    r,
    a,
    l,
    Ut,
    jt,
    Zt,
    Wt,
    Ot,
    Ft,
    Nt,
    Gt,
    Qt,
    Dt,
    qt,
    Vt,
    Kt
  ];
}
let Dn = class extends be {
  constructor(e) {
    super(), ye(
      this,
      e,
      Qn,
      Nn,
      ge,
      {
        class: 2,
        apiKey: 24,
        bbox: 25,
        clearButtonTitle: 3,
        clearOnBlur: 26,
        collapsed: 4,
        country: 27,
        debounceSearch: 28,
        enableReverse: 5,
        errorMessage: 6,
        filter: 29,
        flyTo: 30,
        fuzzyMatch: 31,
        language: 32,
        limit: 33,
        mapController: 34,
        minLength: 35,
        noResultsMessage: 7,
        placeholder: 8,
        proximity: 36,
        reverseActive: 0,
        reverseButtonTitle: 9,
        searchValue: 1,
        showFullGeometry: 37,
        showPlaceType: 10,
        showResultsWhileTyping: 38,
        types: 39,
        zoom: 40,
        maxZoom: 41,
        apiUrl: 42,
        fetchParameters: 43,
        iconsBaseUrl: 11,
        adjustQuery: 44,
        focus: 45,
        blur: 46,
        setQuery: 47
      },
      null,
      [-1, -1, -1]
    );
  }
  get focus() {
    return this.$$.ctx[45];
  }
  get blur() {
    return this.$$.ctx[46];
  }
  get setQuery() {
    return this.$$.ctx[47];
  }
};
const qn = new FinalizationRegistry((n) => {
  n.$destroy();
});
var ee;
class Hn extends EventTarget {
  constructor({ target: t, ...r }) {
    super();
    ct(this, ee, void 0);
    ft(this, ee, new Dn({
      target: t,
      props: r
    }));
    for (const l of [
      "select",
      "pick",
      "featuresListed",
      "featuresMarked",
      "response",
      "optionsVisibilityChange",
      "reverseToggle",
      "queryChange"
    ])
      me(this, ee).$on(l, (a) => this.dispatchEvent(a));
    qn.register(this, me(this, ee));
  }
  setOptions(t) {
    me(this, ee).$set(t);
  }
  setQuery(t, r = !0) {
    var l;
    (l = me(this, ee)) == null || l.setQuery(t, r);
  }
  focus() {
    var t;
    (t = me(this, ee)) == null || t.focus();
  }
  blur() {
    var t;
    (t = me(this, ee)) == null || t.blur();
  }
}
ee = new WeakMap();
export {
  Hn as GeocodingControl
};
//# sourceMappingURL=vanilla.js.map
