import { ref as Be, computed as Xo, onBeforeUnmount as Yo, resolveComponent as Zo, resolveDirective as Jo, withDirectives as Qo, createElementBlock as Pr, openBlock as Fe, createVNode as ei, createBlock as ti, Teleport as ri, createCommentVNode as ni, nextTick as oi } from "vue";
import { Z as he, $ as hr, a0 as ho, a1 as ii, a2 as se, a3 as ai, a4 as gr, a5 as ce, a6 as V, a7 as si, a8 as mr, a9 as ci, R as we, aa as ui, ab as li, ac as di, ad as fi, _ as pi, C as hi } from "./install-BuMO14Rb.js";
import { e as gi } from "./isObject-C9OMxPJa.js";
function ge(t) {
  if (typeof t != "string" || !t)
    throw new Error("expected a non-empty string, got: " + t);
}
function Ue(t) {
  if (typeof t != "number")
    throw new Error("expected a number, got: " + t);
}
const mi = 1, yi = 1, W = "emoji", Q = "keyvalue", yr = "favorites", vi = "tokens", go = "tokens", bi = "unicode", mo = "count", _i = "group", ki = "order", yo = "group-order", cr = "eTag", ke = "url", Dr = "skinTone", ee = "readonly", vr = "readwrite", vo = "skinUnicodes", Ti = "skinUnicodes", Ei = "https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json", wi = "en";
function ji(t, e) {
  const r = /* @__PURE__ */ new Set(), n = [];
  for (const i of t) {
    const o = e(i);
    r.has(o) || (r.add(o), n.push(i));
  }
  return n;
}
function Br(t) {
  return ji(t, (e) => e.unicode);
}
function Si(t) {
  function e(r, n, i) {
    const o = n ? t.createObjectStore(r, { keyPath: n }) : t.createObjectStore(r);
    if (i)
      for (const [a, [c, d]] of Object.entries(i))
        o.createIndex(a, c, { multiEntry: d });
    return o;
  }
  e(Q), e(
    W,
    /* keyPath */
    bi,
    {
      [go]: [
        vi,
        /* multiEntry */
        !0
      ],
      [yo]: [[_i, ki]],
      [vo]: [
        Ti,
        /* multiEntry */
        !0
      ]
    }
  ), e(yr, void 0, {
    [mo]: [""]
  });
}
const ur = {}, be = {}, Te = {};
function bo(t, e, r) {
  r.onerror = () => e(r.error), r.onblocked = () => e(new Error("IDB blocked")), r.onsuccess = () => t(r.result);
}
async function Ai(t) {
  const e = await new Promise((r, n) => {
    const i = indexedDB.open(t, mi);
    ur[t] = i, i.onupgradeneeded = (o) => {
      o.oldVersion < yi && Si(i.result);
    }, bo(r, n, i);
  });
  return e.onclose = () => br(t), e;
}
function Ii(t) {
  return be[t] || (be[t] = Ai(t)), be[t];
}
function D(t, e, r, n) {
  return new Promise((i, o) => {
    const a = t.transaction(e, r, { durability: "relaxed" }), c = typeof e == "string" ? a.objectStore(e) : e.map((u) => a.objectStore(u));
    let d;
    n(c, a, (u) => {
      d = u;
    }), a.oncomplete = () => i(d), a.onerror = () => o(a.error);
  });
}
function br(t) {
  const e = ur[t], r = e && e.result;
  if (r) {
    r.close();
    const n = Te[t];
    if (n)
      for (const i of n)
        i();
  }
  delete ur[t], delete be[t], delete Te[t];
}
function Ci(t) {
  return new Promise((e, r) => {
    br(t);
    const n = indexedDB.deleteDatabase(t);
    bo(e, r, n);
  });
}
function xi(t, e) {
  let r = Te[t];
  r || (r = Te[t] = []), r.push(e);
}
const Oi = /* @__PURE__ */ new Set([
  ":D",
  "XD",
  ":'D",
  "O:)",
  ":X",
  ":P",
  ";P",
  "XP",
  ":L",
  ":Z",
  ":j",
  "8D",
  "XO",
  "8)",
  ":B",
  ":O",
  ":S",
  ":'o",
  "Dx",
  "X(",
  "D:",
  ":C",
  ">0)",
  ":3",
  "</3",
  "<3",
  "\\M/",
  ":E",
  "8#"
]);
function J(t) {
  return t.split(/[\s_]+/).map((e) => !e.match(/\w/) || Oi.has(e) ? e.toLowerCase() : e.replace(/[)(:,]/g, "").replace(/’/g, "'").toLowerCase()).filter(Boolean);
}
const qi = 2;
function _o(t) {
  return t.filter(Boolean).map((e) => e.toLowerCase()).filter((e) => e.length >= qi);
}
function Ri(t) {
  return t.map(({ annotation: r, emoticon: n, group: i, order: o, shortcodes: a, skins: c, tags: d, emoji: u, version: l }) => {
    const f = [...new Set(
      _o([
        ...(a || []).map(J).flat(),
        ...(d || []).map(J).flat(),
        ...J(r),
        n
      ])
    )].sort(), p = {
      annotation: r,
      group: i,
      order: o,
      tags: d,
      tokens: f,
      unicode: u,
      version: l
    };
    if (n && (p.emoticon = n), a && (p.shortcodes = a), c) {
      p.skinTones = [], p.skinUnicodes = [], p.skinVersions = [];
      for (const { tone: m, emoji: k, version: T } of c)
        p.skinTones.push(m), p.skinUnicodes.push(k), p.skinVersions.push(T);
    }
    return p;
  });
}
function ko(t, e, r, n) {
  t[e](r).onsuccess = (i) => n && n(i.target.result);
}
function G(t, e, r) {
  ko(t, "get", e, r);
}
function To(t, e, r) {
  ko(t, "getAll", e, r);
}
function _r(t) {
  t.commit && t.commit();
}
function Li(t, e) {
  let r = t[0];
  for (let n = 1; n < t.length; n++) {
    const i = t[n];
    e(r) > e(i) && (r = i);
  }
  return r;
}
function Eo(t, e) {
  const r = Li(t, (i) => i.length), n = [];
  for (const i of r)
    t.some((o) => o.findIndex((a) => e(a) === e(i)) === -1) || n.push(i);
  return n;
}
async function Mi(t) {
  return !await kr(t, Q, ke);
}
async function Pi(t, e, r) {
  const [n, i] = await Promise.all([cr, ke].map((o) => kr(t, Q, o)));
  return n === r && i === e;
}
async function Di(t, e) {
  return D(t, W, ee, (n, i, o) => {
    let a;
    const c = () => {
      n.getAll(a && IDBKeyRange.lowerBound(a, !0), 50).onsuccess = (d) => {
        const u = d.target.result;
        for (const l of u)
          if (a = l.unicode, e(l))
            return o(l);
        if (u.length < 50)
          return o();
        c();
      };
    };
    c();
  });
}
async function wo(t, e, r, n) {
  {
    const i = Ri(e);
    await D(t, [W, Q], vr, ([o, a], c) => {
      let d, u, l = 0;
      function f() {
        ++l === 2 && p();
      }
      function p() {
        if (!(d === n && u === r)) {
          o.clear();
          for (const m of i)
            o.put(m);
          a.put(n, cr), a.put(r, ke), _r(c);
        }
      }
      G(a, cr, (m) => {
        d = m, f();
      }), G(a, ke, (m) => {
        u = m, f();
      });
    });
  }
}
async function Bi(t, e) {
  return D(t, W, ee, (r, n, i) => {
    const o = IDBKeyRange.bound([e, 0], [e + 1, 0], !1, !0);
    To(r.index(yo), o, i);
  });
}
async function jo(t, e) {
  const r = _o(J(e));
  return r.length ? D(t, W, ee, (n, i, o) => {
    const a = [], c = () => {
      a.length === r.length && d();
    }, d = () => {
      const u = Eo(a, (l) => l.unicode);
      o(u.sort((l, f) => l.order < f.order ? -1 : 1));
    };
    for (let u = 0; u < r.length; u++) {
      const l = r[u], f = u === r.length - 1 ? IDBKeyRange.bound(l, l + "", !1, !0) : IDBKeyRange.only(l);
      To(n.index(go), f, (p) => {
        a.push(p), c();
      });
    }
  }) : [];
}
async function Fi(t, e) {
  const r = await jo(t, e);
  return r.length ? r.filter((n) => (n.shortcodes || []).map((o) => o.toLowerCase()).includes(e.toLowerCase()))[0] || null : await Di(t, (i) => (i.shortcodes || []).includes(e.toLowerCase())) || null;
}
async function Ui(t, e) {
  return D(t, W, ee, (r, n, i) => G(r, e, (o) => {
    if (o)
      return i(o);
    G(r.index(vo), e, (a) => i(a || null));
  }));
}
function kr(t, e, r) {
  return D(t, e, ee, (n, i, o) => G(n, r, o));
}
function Ni(t, e, r, n) {
  return D(t, e, vr, (i, o) => {
    i.put(n, r), _r(o);
  });
}
function $i(t, e) {
  return D(t, yr, vr, (r, n) => G(r, e, (i) => {
    r.put((i || 0) + 1, e), _r(n);
  }));
}
function Ki(t, e, r) {
  return r === 0 ? [] : D(t, [yr, W], ee, ([n, i], o, a) => {
    const c = [];
    n.index(mo).openCursor(void 0, "prev").onsuccess = (d) => {
      const u = d.target.result;
      if (!u)
        return a(c);
      function l(m) {
        if (c.push(m), c.length === r)
          return a(c);
        u.continue();
      }
      const f = u.primaryKey, p = e.byName(f);
      if (p)
        return l(p);
      G(i, f, (m) => {
        if (m)
          return l(m);
        u.continue();
      });
    };
  });
}
const me = "";
function zi(t, e) {
  const r = /* @__PURE__ */ new Map();
  for (const i of t) {
    const o = e(i);
    for (const a of o) {
      let c = r;
      for (let u = 0; u < a.length; u++) {
        const l = a.charAt(u);
        let f = c.get(l);
        f || (f = /* @__PURE__ */ new Map(), c.set(l, f)), c = f;
      }
      let d = c.get(me);
      d || (d = [], c.set(me, d)), d.push(i);
    }
  }
  return (i, o) => {
    let a = r;
    for (let u = 0; u < i.length; u++) {
      const l = i.charAt(u), f = a.get(l);
      if (f)
        a = f;
      else
        return [];
    }
    if (o)
      return a.get(me) || [];
    const c = [], d = [a];
    for (; d.length; ) {
      const l = [...d.shift().entries()].sort((f, p) => f[0] < p[0] ? -1 : 1);
      for (const [f, p] of l)
        f === me ? c.push(...p) : d.push(p);
    }
    return c;
  };
}
const Gi = [
  "name",
  "url"
];
function Vi(t) {
  const e = t && Array.isArray(t), r = e && t.length && (!t[0] || Gi.some((n) => !(n in t[0])));
  if (!e || r)
    throw new Error("Custom emojis are in the wrong format");
}
function Fr(t) {
  Vi(t);
  const e = (p, m) => p.name.toLowerCase() < m.name.toLowerCase() ? -1 : 1, r = t.sort(e), i = zi(t, (p) => {
    const m = /* @__PURE__ */ new Set();
    if (p.shortcodes)
      for (const k of p.shortcodes)
        for (const T of J(k))
          m.add(T);
    return m;
  }), o = (p) => i(p, !0), a = (p) => i(p, !1), c = (p) => {
    const m = J(p), k = m.map((T, j) => (j < m.length - 1 ? o : a)(T));
    return Eo(k, (T) => T.name).sort(e);
  }, d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
  for (const p of t) {
    u.set(p.name.toLowerCase(), p);
    for (const m of p.shortcodes || [])
      d.set(m.toLowerCase(), p);
  }
  return {
    all: r,
    search: c,
    byShortcode: (p) => d.get(p.toLowerCase()),
    byName: (p) => u.get(p.toLowerCase())
  };
}
const Wi = typeof wrappedJSObject < "u";
function re(t) {
  if (!t)
    return t;
  if (Wi && (t = structuredClone(t)), delete t.tokens, t.skinTones) {
    const e = t.skinTones.length;
    t.skins = Array(e);
    for (let r = 0; r < e; r++)
      t.skins[r] = {
        tone: t.skinTones[r],
        unicode: t.skinUnicodes[r],
        version: t.skinVersions[r]
      };
    delete t.skinTones, delete t.skinUnicodes, delete t.skinVersions;
  }
  return t;
}
function So(t) {
  t || console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.");
}
const Hi = [
  "annotation",
  "emoji",
  "group",
  "order",
  "version"
];
function Xi(t) {
  if (!t || !Array.isArray(t) || !t[0] || typeof t[0] != "object" || Hi.some((e) => !(e in t[0])))
    throw new Error("Emoji data is in the wrong format");
}
function Ao(t, e) {
  if (Math.floor(t.status / 100) !== 2)
    throw new Error("Failed to fetch: " + e + ":  " + t.status);
}
async function Yi(t) {
  const e = await fetch(t, { method: "HEAD" });
  Ao(e, t);
  const r = e.headers.get("etag");
  return So(r), r;
}
async function lr(t) {
  const e = await fetch(t);
  Ao(e, t);
  const r = e.headers.get("etag");
  So(r);
  const n = await e.json();
  return Xi(n), [r, n];
}
function Zi(t) {
  for (var e = "", r = new Uint8Array(t), n = r.byteLength, i = -1; ++i < n; )
    e += String.fromCharCode(r[i]);
  return e;
}
function Ji(t) {
  for (var e = t.length, r = new ArrayBuffer(e), n = new Uint8Array(r), i = -1; ++i < e; )
    n[i] = t.charCodeAt(i);
  return r;
}
async function Io(t) {
  const e = JSON.stringify(t);
  let r = Ji(e);
  const n = await crypto.subtle.digest("SHA-1", r), i = Zi(n);
  return btoa(i);
}
async function Qi(t, e) {
  let r, n = await Yi(e);
  if (!n) {
    const i = await lr(e);
    n = i[0], r = i[1], n || (n = await Io(r));
  }
  await Pi(t, e, n) || (r || (r = (await lr(e))[1]), await wo(t, r, e, n));
}
async function ea(t, e) {
  let [r, n] = await lr(e);
  r || (r = await Io(n)), await wo(t, n, e, r);
}
async function ta(t, e) {
  try {
    await Qi(t, e);
  } catch (r) {
    if (r.name !== "InvalidStateError")
      throw r;
  }
}
class ra {
  constructor({ dataSource: e = Ei, locale: r = wi, customEmoji: n = [] } = {}) {
    this.dataSource = e, this.locale = r, this._dbName = `emoji-picker-element-${this.locale}`, this._db = void 0, this._lazyUpdate = void 0, this._custom = Fr(n), this._clear = this._clear.bind(this), this._ready = this._init();
  }
  async _init() {
    const e = this._db = await Ii(this._dbName);
    xi(this._dbName, this._clear);
    const r = this.dataSource;
    await Mi(e) ? await ea(e, r) : this._lazyUpdate = ta(e, r);
  }
  async ready() {
    const e = async () => (this._ready || (this._ready = this._init()), this._ready);
    await e(), this._db || await e();
  }
  async getEmojiByGroup(e) {
    return Ue(e), await this.ready(), Br(await Bi(this._db, e)).map(re);
  }
  async getEmojiBySearchQuery(e) {
    ge(e), await this.ready();
    const r = this._custom.search(e), n = Br(await jo(this._db, e)).map(re);
    return [
      ...r,
      ...n
    ];
  }
  async getEmojiByShortcode(e) {
    ge(e), await this.ready();
    const r = this._custom.byShortcode(e);
    return r || re(await Fi(this._db, e));
  }
  async getEmojiByUnicodeOrName(e) {
    ge(e), await this.ready();
    const r = this._custom.byName(e);
    return r || re(await Ui(this._db, e));
  }
  async getPreferredSkinTone() {
    return await this.ready(), await kr(this._db, Q, Dr) || 0;
  }
  async setPreferredSkinTone(e) {
    return Ue(e), await this.ready(), Ni(this._db, Q, Dr, e);
  }
  async incrementFavoriteEmojiCount(e) {
    return ge(e), await this.ready(), $i(this._db, e);
  }
  async getTopFavoriteEmoji(e) {
    return Ue(e), await this.ready(), (await Ki(this._db, this._custom, e)).map(re);
  }
  set customEmoji(e) {
    this._custom = Fr(e);
  }
  get customEmoji() {
    return this._custom.all;
  }
  async _shutdown() {
    await this.ready();
    try {
      await this._lazyUpdate;
    } catch {
    }
  }
  // clear references to IDB, e.g. during a close event
  _clear() {
    this._db = this._ready = this._lazyUpdate = void 0;
  }
  async close() {
    await this._shutdown(), await br(this._dbName);
  }
  async delete() {
    await this._shutdown(), await Ci(this._dbName);
  }
}
const dr = [
  [-1, "✨", "custom"],
  [0, "😀", "smileys-emotion"],
  [1, "👋", "people-body"],
  [3, "🐱", "animals-nature"],
  [4, "🍎", "food-drink"],
  [5, "🏠️", "travel-places"],
  [6, "⚽", "activities"],
  [7, "📝", "objects"],
  [8, "⛔️", "symbols"],
  [9, "🏁", "flags"]
].map(([t, e, r]) => ({ id: t, emoji: e, name: r })), Ne = dr.slice(1), na = 2, Ur = 6, Co = typeof requestIdleCallback == "function" ? requestIdleCallback : setTimeout;
function Nr(t) {
  return t.unicode.includes("‍");
}
const oa = {
  "🫪": 17,
  // distorted face
  "🫩": 16,
  // face with bags under eyes
  "🫨": 15.1,
  // shaking head, technically from v15 but see note above
  "🫠": 14,
  "🥲": 13.1,
  // smiling face with tear, technically from v13 but see note above
  "🥻": 12.1,
  // sari, technically from v12 but see note above
  "🥰": 11,
  "🤩": 5,
  "👱‍♀️": 4,
  "🤣": 3,
  "👁️‍🗨️": 2,
  "😀": 1,
  "😐️": 0.7,
  "😃": 0.6
}, ia = 1e3, aa = "🖐️", sa = 8, ca = [
  "😊",
  "😒",
  "❤️",
  "👍️",
  "😍",
  "😂",
  "😭",
  "☺️",
  "😔",
  "😩",
  "😏",
  "💕",
  "🙌",
  "😘"
], xo = '"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif', ua = (t, e) => t < e ? -1 : t > e ? 1 : 0, $r = (t, e) => {
  const r = document.createElement("canvas");
  r.width = r.height = 1;
  const n = r.getContext("2d", {
    // Improves the performance of `getImageData()`
    // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getContextAttributes#willreadfrequently
    willReadFrequently: !0
  });
  return n.textBaseline = "top", n.font = `100px ${xo}`, n.fillStyle = e, n.scale(0.01, 0.01), n.fillText(t, 0, 0), n.getImageData(0, 0, 1, 1).data;
}, la = (t, e) => {
  const r = [...t].join(","), n = [...e].join(",");
  return r === n && !r.startsWith("0,0,0,");
};
function da(t) {
  const e = $r(t, "#000"), r = $r(t, "#fff");
  return e && r && la(e, r);
}
function fa() {
  const t = Object.entries(oa);
  try {
    for (const [e, r] of t)
      if (da(e))
        return r;
  } catch {
  }
  return t[0][1];
}
let $e;
const Ke = () => ($e || ($e = new Promise((t) => Co(() => t(fa())))), $e), fr = /* @__PURE__ */ new Map(), pa = "️", ha = "\uD83C", ga = "‍", ma = 127995, ya = 57339;
function va(t, e) {
  if (e === 0)
    return t;
  const r = t.indexOf(ga);
  return r !== -1 ? t.substring(0, r) + String.fromCodePoint(ma + e - 1) + t.substring(r) : (t.endsWith(pa) && (t = t.substring(0, t.length - 1)), t + ha + String.fromCodePoint(ya + e - 1));
}
function M(t) {
  t.preventDefault(), t.stopPropagation();
}
function ze(t, e, r) {
  return e += t ? -1 : 1, e < 0 ? e = r.length - 1 : e >= r.length && (e = 0), e;
}
function Oo(t, e) {
  const r = /* @__PURE__ */ new Set(), n = [];
  for (const i of t) {
    const o = e(i);
    r.has(o) || (r.add(o), n.push(i));
  }
  return n;
}
function ba(t, e) {
  const r = (n) => {
    const i = {};
    for (const o of n)
      typeof o.tone == "number" && o.version <= e && (i[o.tone] = o.unicode);
    return i;
  };
  return t.map(({ unicode: n, skins: i, shortcodes: o, url: a, name: c, category: d, annotation: u }) => ({
    unicode: n,
    name: c,
    shortcodes: o,
    url: a,
    category: d,
    annotation: u,
    id: n || c,
    skins: i && r(i)
  }));
}
const _e = requestAnimationFrame;
let _a = typeof ResizeObserver == "function";
function ka(t, e, r) {
  let n;
  _a ? (n = new ResizeObserver(r), n.observe(t)) : _e(r), e.addEventListener("abort", () => {
    n && n.disconnect();
  });
}
function Kr(t) {
  {
    const e = document.createRange();
    return e.selectNode(t.firstChild), e.getBoundingClientRect().width;
  }
}
let Ge;
function Ta(t, e, r) {
  let n = !0;
  for (const i of t) {
    const o = r(i);
    if (!o)
      continue;
    const a = Kr(o);
    typeof Ge > "u" && (Ge = Kr(e));
    const c = a / 1.8 < Ge;
    fr.set(i.unicode, c), c || (n = !1);
  }
  return n;
}
function Ea(t) {
  return Oo(t, (e) => e);
}
function wa(t) {
  t && (t.scrollTop = 0);
}
function ae(t, e, r) {
  let n = t.get(e);
  return n || (n = r(), t.set(e, n)), n;
}
function zr(t) {
  return "" + t;
}
function ja(t) {
  const e = document.createElement("template");
  return e.innerHTML = t, e;
}
const Sa = /* @__PURE__ */ new WeakMap(), Aa = /* @__PURE__ */ new WeakMap(), Ia = /* @__PURE__ */ Symbol("un-keyed"), Ca = "replaceChildren" in Element.prototype;
function xa(t, e) {
  Ca ? t.replaceChildren(...e) : (t.innerHTML = "", t.append(...e));
}
function Oa(t, e) {
  let r = t.firstChild, n = 0;
  for (; r; ) {
    if (e[n] !== r)
      return !0;
    r = r.nextSibling, n++;
  }
  return n !== e.length;
}
function qa(t, e) {
  const { targetNode: r } = e;
  let { targetParentNode: n } = e, i = !1;
  n ? i = Oa(n, t) : (i = !0, e.targetNode = void 0, e.targetParentNode = n = r.parentNode), i && xa(n, t);
}
function Ra(t, e) {
  for (const r of e) {
    const {
      targetNode: n,
      currentExpression: i,
      binding: {
        expressionIndex: o,
        attributeName: a,
        attributeValuePre: c,
        attributeValuePost: d
      }
    } = r, u = t[o];
    if (i !== u)
      if (r.currentExpression = u, a)
        if (u === null)
          n.removeAttribute(a);
        else {
          const l = c + zr(u) + d;
          n.setAttribute(a, l);
        }
      else {
        let l;
        Array.isArray(u) ? qa(u, r) : u instanceof Element ? (l = u, n.replaceWith(l)) : n.nodeValue = zr(u), l && (r.targetNode = l);
      }
  }
}
function La(t) {
  let e = "", r = !1, n = !1, i = -1;
  const o = /* @__PURE__ */ new Map(), a = [];
  let c = 0;
  for (let u = 0, l = t.length; u < l; u++) {
    const f = t[u];
    if (e += f.slice(c), u === l - 1)
      break;
    for (let g = 0; g < f.length; g++)
      switch (f.charAt(g)) {
        case "<": {
          f.charAt(g + 1) === "/" ? a.pop() : (r = !0, a.push(++i));
          break;
        }
        case ">": {
          r = !1, n = !1;
          break;
        }
        case "=": {
          n = !0;
          break;
        }
      }
    const p = a[a.length - 1], m = ae(o, p, () => []);
    let k, T, j;
    if (n) {
      const g = /(\S+)="?([^"=]*)$/.exec(f);
      k = g[1], T = g[2];
      const b = /^([^">]*)("?)/.exec(t[u + 1]);
      j = b[1], e = e.slice(0, -1 * g[0].length), c = b[0].length;
    } else
      c = 0;
    const C = {
      attributeName: k,
      attributeValuePre: T,
      attributeValuePost: j,
      expressionIndex: u
    };
    m.push(C), !r && !n && (e += " ");
  }
  return {
    template: ja(e),
    elementsToBindings: o
  };
}
function Gr(t, e, r) {
  for (let n = 0; n < t.length; n++) {
    const i = t[n], o = i.attributeName ? e : e.firstChild, a = {
      binding: i,
      targetNode: o,
      targetParentNode: void 0,
      currentExpression: void 0
    };
    r.push(a);
  }
}
function Ma(t, e) {
  const r = [];
  let n;
  if (e.size === 1 && (n = e.get(0)))
    Gr(n, t, r);
  else {
    const i = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
    let o = t, a = -1;
    do {
      const c = e.get(++a);
      c && Gr(c, o, r);
    } while (o = i.nextNode());
  }
  return r;
}
function Pa(t) {
  const { template: e, elementsToBindings: r } = ae(Sa, t, () => La(t)), n = e.cloneNode(!0).content.firstElementChild, i = Ma(n, r);
  return function(a) {
    return Ra(a, i), n;
  };
}
function Da(t) {
  const e = ae(Aa, t, () => /* @__PURE__ */ new Map());
  let r = Ia;
  function n(o, ...a) {
    const c = ae(e, o, () => /* @__PURE__ */ new Map());
    return ae(c, r, () => Pa(o))(a);
  }
  function i(o, a, c) {
    return o.map((d, u) => {
      const l = r;
      r = c(d);
      try {
        return a(d, u);
      } finally {
        r = l;
      }
    });
  }
  return { map: i, html: n };
}
function Ba(t, e, r, n, i, o, a, c, d) {
  const { labelWithSkin: u, titleForEmoji: l, unicodeWithSkin: f } = r, { html: p, map: m } = Da(e);
  function k(g, b, S) {
    return m(g, (A, q) => p`<button role="${b ? "option" : "menuitem"}" aria-selected="${b ? q === e.activeSearchItem : null}" aria-label="${u(A, e.currentSkinTone)}" title="${l(A)}" class="${"emoji" + (b && q === e.activeSearchItem ? " active" : "") + (A.unicode ? "" : " custom-emoji")}" id="${`${S}-${A.id}`}" style="${A.unicode ? null : `--custom-emoji-background: url(${JSON.stringify(A.url)})`}">${A.unicode ? f(A, e.currentSkinTone) : ""}</button>`, (A) => `${S}-${A.id}`);
  }
  const j = p`<section data-ref="rootElement" class="picker" aria-label="${e.i18n.regionLabel}" style="${e.pickerStyle || ""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${e.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(e.searchMode && e.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${e.activeSearchItemId ? `emo-${e.activeSearchItemId}` : null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${e.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${e.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${e.skinTonePickerExpandedAfterAnimation ? "expanded" : ""}"><button id="skintone-button" class="emoji ${e.skinTonePickerExpanded ? "hide-focus" : ""}" aria-label="${e.skinToneButtonLabel}" title="${e.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${e.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${e.skinToneButtonText || ""}</button></div><span id="skintone-description" class="sr-only">${e.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${e.skinTonePickerExpanded ? "" : "hidden no-animate"}" style="transform:translateY(${e.skinTonePickerExpanded ? 0 : "calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${e.i18n.skinTonesLabel}" aria-activedescendant="skintone-${e.activeSkinTone}" aria-hidden="${!e.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${m(e.skinTones, (g, b) => p`<div id="skintone-${b}" class="emoji ${b === e.activeSkinTone ? "active" : ""}" aria-selected="${b === e.activeSkinTone}" role="option" title="${e.i18n.skinTones[b]}" aria-label="${e.i18n.skinTones[b]}">${g}</div>`, (g) => g)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${e.groups.length},1fr)" aria-label="${e.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${m(e.groups, (g) => p`<button role="tab" class="nav-button" aria-controls="tab-${g.id}" aria-label="${e.i18n.categories[g.name]}" aria-selected="${!e.searchMode && e.currentGroup.id === g.id}" title="${e.i18n.categories[g.name]}" data-group-id="${g.id}"><div class="nav-emoji emoji">${g.emoji}</div></button>`, (g) => g.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${/* istanbul ignore next */
  (e.isRtl ? -1 : 1) * e.currentGroupIndex * 100}%)"></div></div><div class="message ${e.message ? "" : "gone"}" role="alert" aria-live="polite">${e.message || ""}</div><div data-ref="tabpanelElement" class="tabpanel ${!e.databaseLoaded || e.message ? "gone" : ""}" role="${e.searchMode ? "region" : "tabpanel"}" aria-label="${e.searchMode ? e.i18n.searchResultsLabel : e.i18n.categories[e.currentGroup.name]}" id="${e.searchMode ? null : `tab-${e.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${m(e.currentEmojisWithCategories, (g, b) => p`<div><div id="menu-label-${b}" class="category ${e.currentEmojisWithCategories.length === 1 && e.currentEmojisWithCategories[0].category === "" ? "gone" : ""}" aria-hidden="true">${e.searchMode ? e.i18n.searchResultsLabel : g.category ? g.category : e.currentEmojisWithCategories.length > 1 ? e.i18n.categories.custom : e.i18n.categories[e.currentGroup.name]}</div><div class="emoji-menu ${b !== 0 && !e.searchMode && e.currentGroup.id === -1 ? "visibility-auto" : ""}" style="${`--num-rows: ${Math.ceil(g.emojis.length / e.numColumns)}`}" data-action="updateOnIntersection" role="${e.searchMode ? "listbox" : "menu"}" aria-labelledby="menu-label-${b}" id="${e.searchMode ? "search-results" : null}">${k(
    g.emojis,
    e.searchMode,
    /* prefix */
    "emo"
  )}</div></div>`, (g) => g.category)}</div></div><div class="favorites onscreen emoji-menu ${e.message ? "gone" : ""}" role="menu" aria-label="${e.i18n.favoritesLabel}" data-on-click="onEmojiClick">${k(
    e.currentFavorites,
    /* searchMode */
    !1,
    /* prefix */
    "fav"
  )}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`, C = (g, b) => {
    for (const S of t.querySelectorAll(`[${g}]`))
      b(S, S.getAttribute(g));
  };
  if (d) {
    t.appendChild(j);
    for (const g of ["click", "focusout", "input", "keydown", "keyup"])
      C(`data-on-${g}`, (b, S) => {
        b.addEventListener(g, n[S]);
      });
    C("data-ref", (g, b) => {
      o[b] = g;
    }), a.addEventListener("abort", () => {
      t.removeChild(j);
    });
  }
  C("data-action", (g, b) => {
    let S = c.get(b);
    S || c.set(b, S = /* @__PURE__ */ new WeakSet()), S.has(g) || (S.add(g), i[b](g));
  });
}
const Ee = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
function Fa(t) {
  let e = !1, r;
  const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
  let o;
  const a = () => {
    if (e)
      return;
    const u = [...i];
    i.clear();
    try {
      for (const l of u)
        l();
    } finally {
      o = !1, i.size && (o = !0, Ee(a));
    }
  }, c = new Proxy({}, {
    get(u, l) {
      if (r) {
        let f = n.get(l);
        f || (f = /* @__PURE__ */ new Set(), n.set(l, f)), f.add(r);
      }
      return u[l];
    },
    set(u, l, f) {
      if (u[l] !== f) {
        u[l] = f;
        const p = n.get(l);
        if (p) {
          for (const m of p)
            i.add(m);
          o || (o = !0, Ee(a));
        }
      }
      return !0;
    }
  }), d = (u) => {
    const l = () => {
      const f = r;
      r = l;
      try {
        return u();
      } finally {
        r = f;
      }
    };
    return l();
  };
  return t.addEventListener("abort", () => {
    e = !0;
  }), {
    state: c,
    createEffect: d
  };
}
function Ve(t, e, r) {
  if (t.length !== e.length)
    return !1;
  for (let n = 0; n < t.length; n++)
    if (!r(t[n], e[n]))
      return !1;
  return !0;
}
const Vr = /* @__PURE__ */ new WeakMap();
function Ua(t, e, r) {
  {
    const n = t.closest(".tabpanel");
    let i = Vr.get(n);
    i || (i = new IntersectionObserver(r, {
      root: n,
      // trigger if we are 1/2 scroll container height away so that the images load a bit quicker while scrolling
      rootMargin: "50% 0px 50% 0px",
      // trigger if any part of the emoji grid is intersecting
      threshold: 0
    }), Vr.set(n, i), e.addEventListener("abort", () => {
      i.disconnect();
    })), i.observe(t);
  }
}
const We = [], { assign: ye } = Object;
function Na(t, e) {
  const r = {}, n = new AbortController(), i = n.signal, { state: o, createEffect: a } = Fa(i), c = /* @__PURE__ */ new Map();
  ye(o, {
    skinToneEmoji: void 0,
    i18n: void 0,
    database: void 0,
    customEmoji: void 0,
    customCategorySorting: void 0,
    emojiVersion: void 0
  }), ye(o, e), ye(o, {
    initialLoad: !0,
    currentEmojis: [],
    currentEmojisWithCategories: [],
    rawSearchText: "",
    searchText: "",
    searchMode: !1,
    activeSearchItem: -1,
    message: void 0,
    skinTonePickerExpanded: !1,
    skinTonePickerExpandedAfterAnimation: !1,
    currentSkinTone: 0,
    activeSkinTone: 0,
    skinToneButtonText: void 0,
    pickerStyle: void 0,
    skinToneButtonLabel: "",
    skinTones: [],
    currentFavorites: [],
    defaultFavoriteEmojis: void 0,
    numColumns: sa,
    isRtl: !1,
    currentGroupIndex: 0,
    groups: Ne,
    databaseLoaded: !1,
    activeSearchItemId: void 0
  }), a(() => {
    o.currentGroup !== o.groups[o.currentGroupIndex] && (o.currentGroup = o.groups[o.currentGroupIndex]);
  });
  const d = (s) => {
    t.getElementById(s).focus();
  }, u = (s) => t.getElementById(`emo-${s.id}`), l = (s, h) => {
    r.rootElement.dispatchEvent(new CustomEvent(s, {
      detail: h,
      bubbles: !0,
      composed: !0
    }));
  }, f = (s, h) => s.id === h.id, p = (s, h) => {
    const { category: y, emojis: _ } = s, { category: I, emojis: v } = h;
    return y !== I ? !1 : Ve(_, v, f);
  }, m = (s) => {
    Ve(o.currentEmojis, s, f) || (o.currentEmojis = s);
  }, k = (s) => {
    o.searchMode !== s && (o.searchMode = s);
  }, T = (s) => {
    Ve(o.currentEmojisWithCategories, s, p) || (o.currentEmojisWithCategories = s);
  }, j = (s, h) => h && s.skins && s.skins[h] || s.unicode, b = {
    labelWithSkin: (s, h) => Ea([
      s.name || j(s, h),
      s.annotation,
      ...s.shortcodes || We
    ].filter(Boolean)).join(", "),
    titleForEmoji: (s) => s.annotation || (s.shortcodes || We).join(", "),
    unicodeWithSkin: j
  }, S = {
    onClickSkinToneButton: Re,
    onEmojiClick: Oe,
    onNavClick: ue,
    onNavKeydown: Ce,
    onSearchKeydown: Ie,
    onSkinToneOptionsClick: qe,
    onSkinToneOptionsFocusOut: Pe,
    onSkinToneOptionsKeydown: Le,
    onSkinToneOptionsKeyup: Me,
    onSearchInput: De
  }, A = {
    calculateEmojiGridStyle: K,
    updateOnIntersection: O
  };
  let q = !0;
  a(() => {
    Ba(t, o, b, S, A, r, i, c, q), q = !1;
  }), o.emojiVersion || Ke().then((s) => {
    s || (o.message = o.i18n.emojiUnsupportedMessage);
  }), a(() => {
    async function s() {
      let h = !1;
      const y = setTimeout(() => {
        h = !0, o.message = o.i18n.loadingMessage;
      }, ia);
      try {
        await o.database.ready(), o.databaseLoaded = !0;
      } catch (_) {
        console.error(_), o.message = o.i18n.networkErrorMessage;
      } finally {
        clearTimeout(y), h && (h = !1, o.message = "");
      }
    }
    o.database && s();
  }), a(() => {
    o.pickerStyle = `
      --num-groups: ${o.groups.length}; 
      --indicator-opacity: ${o.searchMode ? 0 : 1}; 
      --num-skintones: ${Ur};`;
  }), a(() => {
    o.customEmoji && o.database && B();
  }), a(() => {
    o.customEmoji && o.customEmoji.length ? o.groups !== dr && (o.groups = dr) : o.groups !== Ne && (o.currentGroupIndex && o.currentGroupIndex--, o.groups = Ne);
  }), a(() => {
    async function s() {
      o.databaseLoaded && (o.currentSkinTone = await o.database.getPreferredSkinTone());
    }
    s();
  }), a(() => {
    o.skinTones = Array(Ur).fill().map((s, h) => va(o.skinToneEmoji, h));
  }), a(() => {
    o.skinToneButtonText = o.skinTones[o.currentSkinTone];
  }), a(() => {
    o.skinToneButtonLabel = o.i18n.skinToneLabel.replace("{skinTone}", o.i18n.skinTones[o.currentSkinTone]);
  }), a(() => {
    async function s() {
      const { database: h } = o, y = (await Promise.all(ca.map((_) => h.getEmojiByUnicodeOrName(_)))).filter(Boolean);
      o.defaultFavoriteEmojis = y;
    }
    o.databaseLoaded && s();
  });
  function B() {
    const { customEmoji: s, database: h } = o, y = s || We;
    h.customEmoji !== y && (h.customEmoji = y);
  }
  a(() => {
    async function s() {
      B();
      const { database: h, defaultFavoriteEmojis: y, numColumns: _ } = o, I = await h.getTopFavoriteEmoji(_), v = await H(Oo([
        ...I,
        ...y
      ], (x) => x.unicode || x.name).slice(0, _));
      o.currentFavorites = v;
    }
    o.databaseLoaded && o.defaultFavoriteEmojis && s();
  });
  function K(s) {
    ka(s, i, () => {
      {
        const h = getComputedStyle(r.rootElement), y = parseInt(h.getPropertyValue("--num-columns"), 10), _ = h.getPropertyValue("direction") === "rtl";
        o.numColumns = y, o.isRtl = _;
      }
    });
  }
  function O(s) {
    Ua(s, i, (h) => {
      for (const { target: y, isIntersecting: _ } of h)
        y.classList.toggle("onscreen", _);
    });
  }
  a(() => {
    async function s() {
      const { searchText: h, currentGroup: y, databaseLoaded: _, customEmoji: I } = o;
      if (!_)
        o.currentEmojis = [], o.searchMode = !1;
      else if (h.length >= na) {
        const v = await Ae(h);
        o.searchText === h && (m(v), k(!0));
      } else {
        const { id: v } = y;
        if (v !== -1 || I && I.length) {
          const x = await Se(v);
          o.currentGroup.id === v && (m(x), k(!1));
        }
      }
    }
    s();
  });
  const F = () => {
    _e(() => wa(r.tabpanelElement));
  };
  a(() => {
    const { currentEmojis: s, emojiVersion: h } = o, y = s.filter((_) => _.unicode).filter((_) => Nr(_) && !fr.has(_.unicode));
    if (!h && y.length)
      m(s), _e(() => w(y));
    else {
      const _ = h ? s : s.filter(L);
      m(_), F();
    }
  });
  function w(s) {
    Ta(s, r.baselineEmoji, u) ? F() : o.currentEmojis = [...o.currentEmojis];
  }
  function L(s) {
    return !s.unicode || !Nr(s) || fr.get(s.unicode);
  }
  async function U(s) {
    const h = o.emojiVersion || await Ke();
    return s.filter(({ version: y }) => !y || y <= h);
  }
  async function H(s) {
    return ba(s, o.emojiVersion || await Ke());
  }
  async function Se(s) {
    const h = s === -1 ? o.customEmoji : await o.database.getEmojiByGroup(s);
    return H(await U(h));
  }
  async function Ae(s) {
    return H(await U(await o.database.getEmojiBySearchQuery(s)));
  }
  a(() => {
  }), a(() => {
    function s() {
      const { searchMode: y, currentEmojis: _ } = o;
      if (y)
        return [
          {
            category: "",
            emojis: _
          }
        ];
      const I = /* @__PURE__ */ new Map();
      for (const v of _) {
        const x = v.category || "";
        let E = I.get(x);
        E || (E = [], I.set(x, E)), E.push(v);
      }
      return [...I.entries()].map(([v, x]) => ({ category: v, emojis: x })).sort((v, x) => o.customCategorySorting(v.category, x.category));
    }
    const h = s();
    T(h);
  }), a(() => {
    o.activeSearchItemId = o.activeSearchItem !== -1 && o.currentEmojis[o.activeSearchItem].id;
  }), a(() => {
    const { rawSearchText: s } = o;
    Co(() => {
      o.searchText = (s || "").trim(), o.activeSearchItem = -1;
    });
  });
  function Ie(s) {
    if (!o.searchMode || !o.currentEmojis.length)
      return;
    const h = (y) => {
      M(s), o.activeSearchItem = ze(y, o.activeSearchItem, o.currentEmojis);
    };
    switch (s.key) {
      case "ArrowDown":
        return h(!1);
      case "ArrowUp":
        return h(!0);
      case "Enter":
        if (o.activeSearchItem === -1)
          o.activeSearchItem = 0;
        else
          return M(s), le(o.currentEmojis[o.activeSearchItem].id);
    }
  }
  function ue(s) {
    const { target: h } = s, y = h.closest(".nav-button");
    if (!y)
      return;
    const _ = parseInt(y.dataset.groupId, 10);
    r.searchElement.value = "", o.rawSearchText = "", o.searchText = "", o.activeSearchItem = -1, o.currentGroupIndex = o.groups.findIndex((I) => I.id === _);
  }
  function Ce(s) {
    const { target: h, key: y } = s, _ = (I) => {
      I && (M(s), I.focus());
    };
    switch (y) {
      case "ArrowLeft":
        return _(h.previousElementSibling);
      case "ArrowRight":
        return _(h.nextElementSibling);
      case "Home":
        return _(h.parentElement.firstElementChild);
      case "End":
        return _(h.parentElement.lastElementChild);
    }
  }
  async function xe(s) {
    const h = await o.database.getEmojiByUnicodeOrName(s), y = [...o.currentEmojis, ...o.currentFavorites].find((I) => I.id === s), _ = y.unicode && j(y, o.currentSkinTone);
    return await o.database.incrementFavoriteEmojiCount(s), {
      emoji: h,
      skinTone: o.currentSkinTone,
      ..._ && { unicode: _ },
      ...y.name && { name: y.name }
    };
  }
  async function le(s) {
    const h = xe(s);
    l("emoji-click-sync", h), l("emoji-click", await h);
  }
  function Oe(s) {
    const { target: h } = s;
    if (!h.classList.contains("emoji"))
      return;
    M(s);
    const y = h.id.substring(4);
    le(y);
  }
  function te(s) {
    o.currentSkinTone = s, o.skinTonePickerExpanded = !1, d("skintone-button"), l("skin-tone-change", { skinTone: s }), o.database.setPreferredSkinTone(s);
  }
  function qe(s) {
    const { target: { id: h } } = s, y = h && h.match(/^skintone-(\d)/);
    if (!y)
      return;
    M(s);
    const _ = parseInt(y[1], 10);
    te(_);
  }
  function Re(s) {
    o.skinTonePickerExpanded = !o.skinTonePickerExpanded, o.activeSkinTone = o.currentSkinTone, o.skinTonePickerExpanded && (M(s), _e(() => d("skintone-list")));
  }
  a(() => {
    o.skinTonePickerExpanded ? r.skinToneDropdown.addEventListener("transitionend", () => {
      o.skinTonePickerExpandedAfterAnimation = !0;
    }, { once: !0 }) : o.skinTonePickerExpandedAfterAnimation = !1;
  });
  function Le(s) {
    if (!o.skinTonePickerExpanded)
      return;
    const h = async (y) => {
      M(s), o.activeSkinTone = y;
    };
    switch (s.key) {
      case "ArrowUp":
        return h(ze(!0, o.activeSkinTone, o.skinTones));
      case "ArrowDown":
        return h(ze(!1, o.activeSkinTone, o.skinTones));
      case "Home":
        return h(0);
      case "End":
        return h(o.skinTones.length - 1);
      case "Enter":
        return M(s), te(o.activeSkinTone);
      case "Escape":
        return M(s), o.skinTonePickerExpanded = !1, d("skintone-button");
    }
  }
  function Me(s) {
    if (o.skinTonePickerExpanded && s.key === " ")
      return M(s), te(o.activeSkinTone);
  }
  async function Pe(s) {
    const { relatedTarget: h } = s;
    (!h || h.id !== "skintone-list") && (o.skinTonePickerExpanded = !1);
  }
  function De(s) {
    o.rawSearchText = s.target.value;
  }
  return {
    $set(s) {
      ye(o, s);
    },
    $destroy() {
      n.abort();
    }
  };
}
const $a = "https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json", Ka = "en";
var za = {
  categoriesLabel: "Categories",
  emojiUnsupportedMessage: "Your browser does not support color emoji.",
  favoritesLabel: "Favorites",
  loadingMessage: "Loading…",
  networkErrorMessage: "Could not load emoji.",
  regionLabel: "Emoji picker",
  searchDescription: "When search results are available, press up or down to select and enter to choose.",
  searchLabel: "Search",
  searchResultsLabel: "Search results",
  skinToneDescription: "When expanded, press up or down to select and enter to choose.",
  skinToneLabel: "Choose a skin tone (currently {skinTone})",
  skinTonesLabel: "Skin tones",
  skinTones: [
    "Default",
    "Light",
    "Medium-Light",
    "Medium",
    "Medium-Dark",
    "Dark"
  ],
  categories: {
    custom: "Custom",
    "smileys-emotion": "Smileys and emoticons",
    "people-body": "People and body",
    "animals-nature": "Animals and nature",
    "food-drink": "Food and drink",
    "travel-places": "Travel and places",
    activities: "Activities",
    objects: "Objects",
    symbols: "Symbols",
    flags: "Flags"
  }
}, Ga = ':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';
const qo = [
  "customEmoji",
  "customCategorySorting",
  "database",
  "dataSource",
  "i18n",
  "locale",
  "skinToneEmoji",
  "emojiVersion"
], Va = `:host{--emoji-font-family:${xo}}`;
class Tr extends HTMLElement {
  constructor(e) {
    super(), this.attachShadow({ mode: "open" });
    const r = document.createElement("style");
    r.textContent = Ga + Va, this.shadowRoot.appendChild(r), this._ctx = {
      // Set defaults
      locale: Ka,
      dataSource: $a,
      skinToneEmoji: aa,
      customCategorySorting: ua,
      customEmoji: null,
      i18n: za,
      emojiVersion: null,
      ...e
    };
    for (const n of qo)
      n !== "database" && Object.prototype.hasOwnProperty.call(this, n) && (this._ctx[n] = this[n], delete this[n]);
    this._dbFlush();
  }
  connectedCallback() {
    Wr(this), this._cmp || (this._cmp = Na(this.shadowRoot, this._ctx));
  }
  disconnectedCallback() {
    Wr(this), Ee(() => {
      if (!this.isConnected && this._cmp) {
        this._cmp.$destroy(), this._cmp = void 0;
        const { database: e } = this._ctx;
        e.close().catch((r) => console.error(r));
      }
    });
  }
  static get observedAttributes() {
    return ["locale", "data-source", "skin-tone-emoji", "emoji-version"];
  }
  attributeChangedCallback(e, r, n) {
    this._set(
      // convert from kebab-case to camelcase
      // see https://github.com/sveltejs/svelte/issues/3852#issuecomment-665037015
      e.replace(/-([a-z])/g, (i, o) => o.toUpperCase()),
      // convert string attribute to float if necessary
      e === "emoji-version" ? parseFloat(n) : n
    );
  }
  _set(e, r) {
    this._ctx[e] = r, this._cmp && this._cmp.$set({ [e]: r }), ["locale", "dataSource"].includes(e) && this._dbFlush();
  }
  _dbCreate() {
    const { locale: e, dataSource: r, database: n } = this._ctx;
    (!n || n.locale !== e || n.dataSource !== r) && this._set("database", new ra({ locale: e, dataSource: r }));
  }
  // Update the Database in one microtask if the locale/dataSource change. We do one microtask
  // so we don't create two Databases if e.g. both the locale and the dataSource change
  _dbFlush() {
    Ee(() => this._dbCreate());
  }
}
const Ro = {};
for (const t of qo)
  Ro[t] = {
    get() {
      return t === "database" && this._dbCreate(), this._ctx[t];
    },
    set(e) {
      if (t === "database")
        throw new Error("database is read-only");
      this._set(t, e);
    }
  };
Object.defineProperties(Tr.prototype, Ro);
function Wr(t) {
  t instanceof Tr || Object.setPrototypeOf(t, customElements.get(t.tagName.toLowerCase()).prototype);
}
customElements.get("emoji-picker") || customElements.define("emoji-picker", Tr);
var P = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof he == "object" && he.global === he ? he : void 0;
function Wa(t, e) {
  return typeof e > "u" ? e = { autoBom: !1 } : typeof e != "object" && (console.warn("Deprecated: Expected third argument to be a object"), e = { autoBom: !e }), e.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type) ? new Blob(["\uFEFF", t], { type: t.type }) : t;
}
function He(t, e, r) {
  var n = new XMLHttpRequest();
  n.open("GET", t), n.responseType = "blob", n.onload = function() {
    pr(n.response, e, r);
  }, n.onerror = function() {
    console.error("could not download file");
  }, n.send();
}
function Hr(t) {
  var e = new XMLHttpRequest();
  e.open("HEAD", t, !1);
  try {
    e.send();
  } catch {
  }
  return e.status >= 200 && e.status <= 299;
}
function ve(t) {
  try {
    t.dispatchEvent(new MouseEvent("click"));
  } catch {
    var e = document.createEvent("MouseEvents");
    e.initMouseEvent(
      "click",
      !0,
      !0,
      window,
      0,
      0,
      0,
      80,
      20,
      !1,
      !1,
      !1,
      !1,
      0,
      null
    ), t.dispatchEvent(e);
  }
}
var Xr = P.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), pr = P.saveAs || // probably in some web worker
(typeof window != "object" || window !== P ? function() {
} : "download" in HTMLAnchorElement.prototype && !Xr ? function(e, r, n) {
  var i = P.URL || P.webkitURL, o = document.createElement("a");
  r = r || e.name || "download", o.download = r, o.rel = "noopener", typeof e == "string" ? (o.href = e, o.origin !== location.origin ? Hr(o.href) ? He(e, r, n) : ve(o, o.target = "_blank") : ve(o)) : (o.href = i.createObjectURL(e), setTimeout(function() {
    i.revokeObjectURL(o.href);
  }, 4e4), setTimeout(function() {
    ve(o);
  }, 0));
} : "msSaveOrOpenBlob" in navigator ? function(e, r, n) {
  if (r = r || e.name || "download", typeof e == "string")
    if (Hr(e))
      He(e, r, n);
    else {
      var i = document.createElement("a");
      i.href = e, i.target = "_blank", setTimeout(function() {
        ve(i);
      });
    }
  else
    navigator.msSaveOrOpenBlob(Wa(e, n), r);
} : function(e, r, n, i) {
  if (i = i || open("", "_blank"), i && (i.document.title = i.document.body.innerText = "downloading..."), typeof e == "string") return He(e, r, n);
  var o = e.type === "application/octet-stream", a = /constructor/i.test(P.HTMLElement) || P.safari, c = /CriOS\/[\d]+/.test(navigator.userAgent);
  if ((c || o && a || Xr) && typeof FileReader < "u") {
    var d = new FileReader();
    d.onloadend = function() {
      var f = d.result;
      f = c ? f : f.replace(/^data:[^;]*;/, "data:attachment/file;"), i ? i.location.href = f : location = f, i = null;
    }, d.readAsDataURL(e);
  } else {
    var u = P.URL || P.webkitURL, l = u.createObjectURL(e);
    i ? i.location = l : location.href = l, i = null, setTimeout(function() {
      u.revokeObjectURL(l);
    }, 4e4);
  }
});
P.saveAs = pr.saveAs = pr;
var Xe, Yr;
function Ha() {
  if (Yr) return Xe;
  Yr = 1;
  var t = hr();
  function e() {
    this.__data__ = new t(), this.size = 0;
  }
  return Xe = e, Xe;
}
var Ye, Zr;
function Xa() {
  if (Zr) return Ye;
  Zr = 1;
  function t(e) {
    var r = this.__data__, n = r.delete(e);
    return this.size = r.size, n;
  }
  return Ye = t, Ye;
}
var Ze, Jr;
function Ya() {
  if (Jr) return Ze;
  Jr = 1;
  function t(e) {
    return this.__data__.get(e);
  }
  return Ze = t, Ze;
}
var Je, Qr;
function Za() {
  if (Qr) return Je;
  Qr = 1;
  function t(e) {
    return this.__data__.has(e);
  }
  return Je = t, Je;
}
var Qe, en;
function Ja() {
  if (en) return Qe;
  en = 1;
  var t = hr(), e = ho(), r = ii(), n = 200;
  function i(o, a) {
    var c = this.__data__;
    if (c instanceof t) {
      var d = c.__data__;
      if (!e || d.length < n - 1)
        return d.push([o, a]), this.size = ++c.size, this;
      c = this.__data__ = new r(d);
    }
    return c.set(o, a), this.size = c.size, this;
  }
  return Qe = i, Qe;
}
var et, tn;
function Qa() {
  if (tn) return et;
  tn = 1;
  var t = hr(), e = Ha(), r = Xa(), n = Ya(), i = Za(), o = Ja();
  function a(c) {
    var d = this.__data__ = new t(c);
    this.size = d.size;
  }
  return a.prototype.clear = e, a.prototype.delete = r, a.prototype.get = n, a.prototype.has = i, a.prototype.set = o, et = a, et;
}
var tt, rn;
function es() {
  if (rn) return tt;
  rn = 1;
  function t(e, r) {
    for (var n = -1, i = e == null ? 0 : e.length; ++n < i && r(e[n], n, e) !== !1; )
      ;
    return e;
  }
  return tt = t, tt;
}
var rt, nn;
function ts() {
  if (nn) return rt;
  nn = 1;
  var t = se(), e = (function() {
    try {
      var r = t(Object, "defineProperty");
      return r({}, "", {}), r;
    } catch {
    }
  })();
  return rt = e, rt;
}
var nt, on;
function Lo() {
  if (on) return nt;
  on = 1;
  var t = ts();
  function e(r, n, i) {
    n == "__proto__" && t ? t(r, n, {
      configurable: !0,
      enumerable: !0,
      value: i,
      writable: !0
    }) : r[n] = i;
  }
  return nt = e, nt;
}
var ot, an;
function Er() {
  if (an) return ot;
  an = 1;
  var t = Lo(), e = ai(), r = Object.prototype, n = r.hasOwnProperty;
  function i(o, a, c) {
    var d = o[a];
    (!(n.call(o, a) && e(d, c)) || c === void 0 && !(a in o)) && t(o, a, c);
  }
  return ot = i, ot;
}
var it, sn;
function je() {
  if (sn) return it;
  sn = 1;
  var t = Er(), e = Lo();
  function r(n, i, o, a) {
    var c = !o;
    o || (o = {});
    for (var d = -1, u = i.length; ++d < u; ) {
      var l = i[d], f = a ? a(o[l], n[l], l, o, n) : void 0;
      f === void 0 && (f = n[l]), c ? e(o, l, f) : t(o, l, f);
    }
    return o;
  }
  return it = r, it;
}
var at, cn;
function rs() {
  if (cn) return at;
  cn = 1;
  function t(e, r) {
    for (var n = -1, i = Array(e); ++n < e; )
      i[n] = r(n);
    return i;
  }
  return at = t, at;
}
var st, un;
function ns() {
  if (un) return st;
  un = 1;
  var t = gr(), e = ce(), r = "[object Arguments]";
  function n(i) {
    return e(i) && t(i) == r;
  }
  return st = n, st;
}
var ct, ln;
function os() {
  if (ln) return ct;
  ln = 1;
  var t = ns(), e = ce(), r = Object.prototype, n = r.hasOwnProperty, i = r.propertyIsEnumerable, o = t(/* @__PURE__ */ (function() {
    return arguments;
  })()) ? t : function(a) {
    return e(a) && n.call(a, "callee") && !i.call(a, "callee");
  };
  return ct = o, ct;
}
var ne = { exports: {} }, ut, dn;
function is() {
  if (dn) return ut;
  dn = 1;
  function t() {
    return !1;
  }
  return ut = t, ut;
}
ne.exports;
var fn;
function Mo() {
  return fn || (fn = 1, (function(t, e) {
    var r = V(), n = is(), i = e && !e.nodeType && e, o = i && !0 && t && !t.nodeType && t, a = o && o.exports === i, c = a ? r.Buffer : void 0, d = c ? c.isBuffer : void 0, u = d || n;
    t.exports = u;
  })(ne, ne.exports)), ne.exports;
}
var lt, pn;
function Po() {
  if (pn) return lt;
  pn = 1;
  var t = 9007199254740991, e = /^(?:0|[1-9]\d*)$/;
  function r(n, i) {
    var o = typeof n;
    return i = i ?? t, !!i && (o == "number" || o != "symbol" && e.test(n)) && n > -1 && n % 1 == 0 && n < i;
  }
  return lt = r, lt;
}
var dt, hn;
function Do() {
  if (hn) return dt;
  hn = 1;
  var t = 9007199254740991;
  function e(r) {
    return typeof r == "number" && r > -1 && r % 1 == 0 && r <= t;
  }
  return dt = e, dt;
}
var ft, gn;
function as() {
  if (gn) return ft;
  gn = 1;
  var t = gr(), e = Do(), r = ce(), n = "[object Arguments]", i = "[object Array]", o = "[object Boolean]", a = "[object Date]", c = "[object Error]", d = "[object Function]", u = "[object Map]", l = "[object Number]", f = "[object Object]", p = "[object RegExp]", m = "[object Set]", k = "[object String]", T = "[object WeakMap]", j = "[object ArrayBuffer]", C = "[object DataView]", g = "[object Float32Array]", b = "[object Float64Array]", S = "[object Int8Array]", A = "[object Int16Array]", q = "[object Int32Array]", B = "[object Uint8Array]", K = "[object Uint8ClampedArray]", O = "[object Uint16Array]", F = "[object Uint32Array]", w = {};
  w[g] = w[b] = w[S] = w[A] = w[q] = w[B] = w[K] = w[O] = w[F] = !0, w[n] = w[i] = w[j] = w[o] = w[C] = w[a] = w[c] = w[d] = w[u] = w[l] = w[f] = w[p] = w[m] = w[k] = w[T] = !1;
  function L(U) {
    return r(U) && e(U.length) && !!w[t(U)];
  }
  return ft = L, ft;
}
var pt, mn;
function wr() {
  if (mn) return pt;
  mn = 1;
  function t(e) {
    return function(r) {
      return e(r);
    };
  }
  return pt = t, pt;
}
var oe = { exports: {} };
oe.exports;
var yn;
function jr() {
  return yn || (yn = 1, (function(t, e) {
    var r = si(), n = e && !e.nodeType && e, i = n && !0 && t && !t.nodeType && t, o = i && i.exports === n, a = o && r.process, c = (function() {
      try {
        var d = i && i.require && i.require("util").types;
        return d || a && a.binding && a.binding("util");
      } catch {
      }
    })();
    t.exports = c;
  })(oe, oe.exports)), oe.exports;
}
var ht, vn;
function ss() {
  if (vn) return ht;
  vn = 1;
  var t = as(), e = wr(), r = jr(), n = r && r.isTypedArray, i = n ? e(n) : t;
  return ht = i, ht;
}
var gt, bn;
function Bo() {
  if (bn) return gt;
  bn = 1;
  var t = rs(), e = os(), r = mr(), n = Mo(), i = Po(), o = ss(), a = Object.prototype, c = a.hasOwnProperty;
  function d(u, l) {
    var f = r(u), p = !f && e(u), m = !f && !p && n(u), k = !f && !p && !m && o(u), T = f || p || m || k, j = T ? t(u.length, String) : [], C = j.length;
    for (var g in u)
      (l || c.call(u, g)) && !(T && // Safari 9 has enumerable `arguments.length` in strict mode.
      (g == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      m && (g == "offset" || g == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      k && (g == "buffer" || g == "byteLength" || g == "byteOffset") || // Skip index properties.
      i(g, C))) && j.push(g);
    return j;
  }
  return gt = d, gt;
}
var mt, _n;
function Sr() {
  if (_n) return mt;
  _n = 1;
  var t = Object.prototype;
  function e(r) {
    var n = r && r.constructor, i = typeof n == "function" && n.prototype || t;
    return r === i;
  }
  return mt = e, mt;
}
var yt, kn;
function Fo() {
  if (kn) return yt;
  kn = 1;
  function t(e, r) {
    return function(n) {
      return e(r(n));
    };
  }
  return yt = t, yt;
}
var vt, Tn;
function cs() {
  if (Tn) return vt;
  Tn = 1;
  var t = Fo(), e = t(Object.keys, Object);
  return vt = e, vt;
}
var bt, En;
function us() {
  if (En) return bt;
  En = 1;
  var t = Sr(), e = cs(), r = Object.prototype, n = r.hasOwnProperty;
  function i(o) {
    if (!t(o))
      return e(o);
    var a = [];
    for (var c in Object(o))
      n.call(o, c) && c != "constructor" && a.push(c);
    return a;
  }
  return bt = i, bt;
}
var _t, wn;
function Uo() {
  if (wn) return _t;
  wn = 1;
  var t = ci(), e = Do();
  function r(n) {
    return n != null && e(n.length) && !t(n);
  }
  return _t = r, _t;
}
var kt, jn;
function Ar() {
  if (jn) return kt;
  jn = 1;
  var t = Bo(), e = us(), r = Uo();
  function n(i) {
    return r(i) ? t(i) : e(i);
  }
  return kt = n, kt;
}
var Tt, Sn;
function ls() {
  if (Sn) return Tt;
  Sn = 1;
  var t = je(), e = Ar();
  function r(n, i) {
    return n && t(i, e(i), n);
  }
  return Tt = r, Tt;
}
var Et, An;
function ds() {
  if (An) return Et;
  An = 1;
  function t(e) {
    var r = [];
    if (e != null)
      for (var n in Object(e))
        r.push(n);
    return r;
  }
  return Et = t, Et;
}
var wt, In;
function fs() {
  if (In) return wt;
  In = 1;
  var t = we(), e = Sr(), r = ds(), n = Object.prototype, i = n.hasOwnProperty;
  function o(a) {
    if (!t(a))
      return r(a);
    var c = e(a), d = [];
    for (var u in a)
      u == "constructor" && (c || !i.call(a, u)) || d.push(u);
    return d;
  }
  return wt = o, wt;
}
var jt, Cn;
function Ir() {
  if (Cn) return jt;
  Cn = 1;
  var t = Bo(), e = fs(), r = Uo();
  function n(i) {
    return r(i) ? t(i, !0) : e(i);
  }
  return jt = n, jt;
}
var St, xn;
function ps() {
  if (xn) return St;
  xn = 1;
  var t = je(), e = Ir();
  function r(n, i) {
    return n && t(i, e(i), n);
  }
  return St = r, St;
}
var ie = { exports: {} };
ie.exports;
var On;
function hs() {
  return On || (On = 1, (function(t, e) {
    var r = V(), n = e && !e.nodeType && e, i = n && !0 && t && !t.nodeType && t, o = i && i.exports === n, a = o ? r.Buffer : void 0, c = a ? a.allocUnsafe : void 0;
    function d(u, l) {
      if (l)
        return u.slice();
      var f = u.length, p = c ? c(f) : new u.constructor(f);
      return u.copy(p), p;
    }
    t.exports = d;
  })(ie, ie.exports)), ie.exports;
}
var At, qn;
function gs() {
  if (qn) return At;
  qn = 1;
  function t(e, r) {
    var n = -1, i = e.length;
    for (r || (r = Array(i)); ++n < i; )
      r[n] = e[n];
    return r;
  }
  return At = t, At;
}
var It, Rn;
function ms() {
  if (Rn) return It;
  Rn = 1;
  function t(e, r) {
    for (var n = -1, i = e == null ? 0 : e.length, o = 0, a = []; ++n < i; ) {
      var c = e[n];
      r(c, n, e) && (a[o++] = c);
    }
    return a;
  }
  return It = t, It;
}
var Ct, Ln;
function No() {
  if (Ln) return Ct;
  Ln = 1;
  function t() {
    return [];
  }
  return Ct = t, Ct;
}
var xt, Mn;
function Cr() {
  if (Mn) return xt;
  Mn = 1;
  var t = ms(), e = No(), r = Object.prototype, n = r.propertyIsEnumerable, i = Object.getOwnPropertySymbols, o = i ? function(a) {
    return a == null ? [] : (a = Object(a), t(i(a), function(c) {
      return n.call(a, c);
    }));
  } : e;
  return xt = o, xt;
}
var Ot, Pn;
function ys() {
  if (Pn) return Ot;
  Pn = 1;
  var t = je(), e = Cr();
  function r(n, i) {
    return t(n, e(n), i);
  }
  return Ot = r, Ot;
}
var qt, Dn;
function $o() {
  if (Dn) return qt;
  Dn = 1;
  function t(e, r) {
    for (var n = -1, i = r.length, o = e.length; ++n < i; )
      e[o + n] = r[n];
    return e;
  }
  return qt = t, qt;
}
var Rt, Bn;
function Ko() {
  if (Bn) return Rt;
  Bn = 1;
  var t = Fo(), e = t(Object.getPrototypeOf, Object);
  return Rt = e, Rt;
}
var Lt, Fn;
function zo() {
  if (Fn) return Lt;
  Fn = 1;
  var t = $o(), e = Ko(), r = Cr(), n = No(), i = Object.getOwnPropertySymbols, o = i ? function(a) {
    for (var c = []; a; )
      t(c, r(a)), a = e(a);
    return c;
  } : n;
  return Lt = o, Lt;
}
var Mt, Un;
function vs() {
  if (Un) return Mt;
  Un = 1;
  var t = je(), e = zo();
  function r(n, i) {
    return t(n, e(n), i);
  }
  return Mt = r, Mt;
}
var Pt, Nn;
function Go() {
  if (Nn) return Pt;
  Nn = 1;
  var t = $o(), e = mr();
  function r(n, i, o) {
    var a = i(n);
    return e(n) ? a : t(a, o(n));
  }
  return Pt = r, Pt;
}
var Dt, $n;
function bs() {
  if ($n) return Dt;
  $n = 1;
  var t = Go(), e = Cr(), r = Ar();
  function n(i) {
    return t(i, r, e);
  }
  return Dt = n, Dt;
}
var Bt, Kn;
function _s() {
  if (Kn) return Bt;
  Kn = 1;
  var t = Go(), e = zo(), r = Ir();
  function n(i) {
    return t(i, r, e);
  }
  return Bt = n, Bt;
}
var Ft, zn;
function ks() {
  if (zn) return Ft;
  zn = 1;
  var t = se(), e = V(), r = t(e, "DataView");
  return Ft = r, Ft;
}
var Ut, Gn;
function Ts() {
  if (Gn) return Ut;
  Gn = 1;
  var t = se(), e = V(), r = t(e, "Promise");
  return Ut = r, Ut;
}
var Nt, Vn;
function Es() {
  if (Vn) return Nt;
  Vn = 1;
  var t = se(), e = V(), r = t(e, "Set");
  return Nt = r, Nt;
}
var $t, Wn;
function ws() {
  if (Wn) return $t;
  Wn = 1;
  var t = se(), e = V(), r = t(e, "WeakMap");
  return $t = r, $t;
}
var Kt, Hn;
function xr() {
  if (Hn) return Kt;
  Hn = 1;
  var t = ks(), e = ho(), r = Ts(), n = Es(), i = ws(), o = gr(), a = ui(), c = "[object Map]", d = "[object Object]", u = "[object Promise]", l = "[object Set]", f = "[object WeakMap]", p = "[object DataView]", m = a(t), k = a(e), T = a(r), j = a(n), C = a(i), g = o;
  return (t && g(new t(new ArrayBuffer(1))) != p || e && g(new e()) != c || r && g(r.resolve()) != u || n && g(new n()) != l || i && g(new i()) != f) && (g = function(b) {
    var S = o(b), A = S == d ? b.constructor : void 0, q = A ? a(A) : "";
    if (q)
      switch (q) {
        case m:
          return p;
        case k:
          return c;
        case T:
          return u;
        case j:
          return l;
        case C:
          return f;
      }
    return S;
  }), Kt = g, Kt;
}
var zt, Xn;
function js() {
  if (Xn) return zt;
  Xn = 1;
  var t = Object.prototype, e = t.hasOwnProperty;
  function r(n) {
    var i = n.length, o = new n.constructor(i);
    return i && typeof n[0] == "string" && e.call(n, "index") && (o.index = n.index, o.input = n.input), o;
  }
  return zt = r, zt;
}
var Gt, Yn;
function Ss() {
  if (Yn) return Gt;
  Yn = 1;
  var t = V(), e = t.Uint8Array;
  return Gt = e, Gt;
}
var Vt, Zn;
function Or() {
  if (Zn) return Vt;
  Zn = 1;
  var t = Ss();
  function e(r) {
    var n = new r.constructor(r.byteLength);
    return new t(n).set(new t(r)), n;
  }
  return Vt = e, Vt;
}
var Wt, Jn;
function As() {
  if (Jn) return Wt;
  Jn = 1;
  var t = Or();
  function e(r, n) {
    var i = n ? t(r.buffer) : r.buffer;
    return new r.constructor(i, r.byteOffset, r.byteLength);
  }
  return Wt = e, Wt;
}
var Ht, Qn;
function Is() {
  if (Qn) return Ht;
  Qn = 1;
  var t = /\w*$/;
  function e(r) {
    var n = new r.constructor(r.source, t.exec(r));
    return n.lastIndex = r.lastIndex, n;
  }
  return Ht = e, Ht;
}
var Xt, eo;
function Cs() {
  if (eo) return Xt;
  eo = 1;
  var t = li(), e = t ? t.prototype : void 0, r = e ? e.valueOf : void 0;
  function n(i) {
    return r ? Object(r.call(i)) : {};
  }
  return Xt = n, Xt;
}
var Yt, to;
function xs() {
  if (to) return Yt;
  to = 1;
  var t = Or();
  function e(r, n) {
    var i = n ? t(r.buffer) : r.buffer;
    return new r.constructor(i, r.byteOffset, r.length);
  }
  return Yt = e, Yt;
}
var Zt, ro;
function Os() {
  if (ro) return Zt;
  ro = 1;
  var t = Or(), e = As(), r = Is(), n = Cs(), i = xs(), o = "[object Boolean]", a = "[object Date]", c = "[object Map]", d = "[object Number]", u = "[object RegExp]", l = "[object Set]", f = "[object String]", p = "[object Symbol]", m = "[object ArrayBuffer]", k = "[object DataView]", T = "[object Float32Array]", j = "[object Float64Array]", C = "[object Int8Array]", g = "[object Int16Array]", b = "[object Int32Array]", S = "[object Uint8Array]", A = "[object Uint8ClampedArray]", q = "[object Uint16Array]", B = "[object Uint32Array]";
  function K(O, F, w) {
    var L = O.constructor;
    switch (F) {
      case m:
        return t(O);
      case o:
      case a:
        return new L(+O);
      case k:
        return e(O, w);
      case T:
      case j:
      case C:
      case g:
      case b:
      case S:
      case A:
      case q:
      case B:
        return i(O, w);
      case c:
        return new L();
      case d:
      case f:
        return new L(O);
      case u:
        return r(O);
      case l:
        return new L();
      case p:
        return n(O);
    }
  }
  return Zt = K, Zt;
}
var Jt, no;
function qs() {
  if (no) return Jt;
  no = 1;
  var t = we(), e = Object.create, r = /* @__PURE__ */ (function() {
    function n() {
    }
    return function(i) {
      if (!t(i))
        return {};
      if (e)
        return e(i);
      n.prototype = i;
      var o = new n();
      return n.prototype = void 0, o;
    };
  })();
  return Jt = r, Jt;
}
var Qt, oo;
function Rs() {
  if (oo) return Qt;
  oo = 1;
  var t = qs(), e = Ko(), r = Sr();
  function n(i) {
    return typeof i.constructor == "function" && !r(i) ? t(e(i)) : {};
  }
  return Qt = n, Qt;
}
var er, io;
function Ls() {
  if (io) return er;
  io = 1;
  var t = xr(), e = ce(), r = "[object Map]";
  function n(i) {
    return e(i) && t(i) == r;
  }
  return er = n, er;
}
var tr, ao;
function Ms() {
  if (ao) return tr;
  ao = 1;
  var t = Ls(), e = wr(), r = jr(), n = r && r.isMap, i = n ? e(n) : t;
  return tr = i, tr;
}
var rr, so;
function Ps() {
  if (so) return rr;
  so = 1;
  var t = xr(), e = ce(), r = "[object Set]";
  function n(i) {
    return e(i) && t(i) == r;
  }
  return rr = n, rr;
}
var nr, co;
function Ds() {
  if (co) return nr;
  co = 1;
  var t = Ps(), e = wr(), r = jr(), n = r && r.isSet, i = n ? e(n) : t;
  return nr = i, nr;
}
var or, uo;
function Bs() {
  if (uo) return or;
  uo = 1;
  var t = Qa(), e = es(), r = Er(), n = ls(), i = ps(), o = hs(), a = gs(), c = ys(), d = vs(), u = bs(), l = _s(), f = xr(), p = js(), m = Os(), k = Rs(), T = mr(), j = Mo(), C = Ms(), g = we(), b = Ds(), S = Ar(), A = Ir(), q = 1, B = 2, K = 4, O = "[object Arguments]", F = "[object Array]", w = "[object Boolean]", L = "[object Date]", U = "[object Error]", H = "[object Function]", Se = "[object GeneratorFunction]", Ae = "[object Map]", Ie = "[object Number]", ue = "[object Object]", Ce = "[object RegExp]", xe = "[object Set]", le = "[object String]", Oe = "[object Symbol]", te = "[object WeakMap]", qe = "[object ArrayBuffer]", Re = "[object DataView]", Le = "[object Float32Array]", Me = "[object Float64Array]", Pe = "[object Int8Array]", De = "[object Int16Array]", s = "[object Int32Array]", h = "[object Uint8Array]", y = "[object Uint8ClampedArray]", _ = "[object Uint16Array]", I = "[object Uint32Array]", v = {};
  v[O] = v[F] = v[qe] = v[Re] = v[w] = v[L] = v[Le] = v[Me] = v[Pe] = v[De] = v[s] = v[Ae] = v[Ie] = v[ue] = v[Ce] = v[xe] = v[le] = v[Oe] = v[h] = v[y] = v[_] = v[I] = !0, v[U] = v[H] = v[te] = !1;
  function x(E, X, Y, Vo, de, N) {
    var R, fe = X & q, pe = X & B, Wo = X & K;
    if (Y && (R = de ? Y(E, Vo, de, N) : Y(E)), R !== void 0)
      return R;
    if (!g(E))
      return E;
    var qr = T(E);
    if (qr) {
      if (R = p(E), !fe)
        return a(E, R);
    } else {
      var Z = f(E), Rr = Z == H || Z == Se;
      if (j(E))
        return o(E, fe);
      if (Z == ue || Z == O || Rr && !de) {
        if (R = pe || Rr ? {} : k(E), !fe)
          return pe ? d(E, i(R, E)) : c(E, n(R, E));
      } else {
        if (!v[Z])
          return de ? E : {};
        R = m(E, Z, fe);
      }
    }
    N || (N = new t());
    var Lr = N.get(E);
    if (Lr)
      return Lr;
    N.set(E, R), b(E) ? E.forEach(function($) {
      R.add(x($, X, Y, $, E, N));
    }) : C(E) && E.forEach(function($, z) {
      R.set(z, x($, X, Y, z, E, N));
    });
    var Ho = Wo ? pe ? l : u : pe ? A : S, Mr = qr ? void 0 : Ho(E);
    return e(Mr || E, function($, z) {
      Mr && (z = $, $ = E[z]), r(R, z, x($, X, Y, z, E, N));
    }), R;
  }
  return or = x, or;
}
var ir, lo;
function Fs() {
  if (lo) return ir;
  lo = 1;
  var t = Bs(), e = 1, r = 4;
  function n(i) {
    return t(i, e | r);
  }
  return ir = n, ir;
}
Fs();
var ar, fo;
function Us() {
  if (fo) return ar;
  fo = 1;
  var t = Er(), e = di(), r = Po(), n = we(), i = fi();
  function o(a, c, d, u) {
    if (!n(a))
      return a;
    c = e(c, a);
    for (var l = -1, f = c.length, p = f - 1, m = a; m != null && ++l < f; ) {
      var k = i(c[l]), T = d;
      if (k === "__proto__" || k === "constructor" || k === "prototype")
        return a;
      if (l != p) {
        var j = m[k];
        T = u ? u(j, k, m) : void 0, T === void 0 && (T = n(j) ? j : r(c[l + 1]) ? [] : {});
      }
      t(m, k, T), m = m[k];
    }
    return a;
  }
  return ar = o, ar;
}
var sr, po;
function Ns() {
  if (po) return sr;
  po = 1;
  var t = Us();
  function e(r, n, i) {
    return r == null ? r : t(r, n, i);
  }
  return sr = e, sr;
}
Ns();
const $s = { class: "wt-chat-emoji" }, Ks = {
  __name: "wt-chat-emoji",
  props: {
    size: {
      type: String,
      default: hi.MD
    },
    /**
     * @author HlukhovYe
     * teleport popup to specific element, pass selector
     * https://webitel.atlassian.net/browse/WTEL-8731
     */
    popupTeleportTo: {
      type: String,
      default: ""
    }
  },
  emits: [
    "insert-emoji"
  ],
  setup(t, { emit: e }) {
    const r = t, n = e, i = Be(null), o = Be(!1), a = Be(null), c = Xo(() => r.popupTeleportTo || "body"), d = async () => {
      a.value || (a.value = document.createElement("emoji-picker"), u(), a.value.addEventListener("emoji-click", l));
    }, u = () => {
      i.value && a.value && i.value.appendChild(a.value);
    }, l = (T) => {
      const { unicode: j } = T.detail;
      n("insert-emoji", j), f();
    }, f = () => {
      o.value = !1, a.value && i.value && (a.value.removeEventListener("emoji-click", l), i.value.removeChild(a.value), a.value = null);
    }, p = (T) => {
      i.value?.contains(T.target) || f();
    }, m = async () => {
      k(), o.value = !o.value, o.value ? (await oi(), await d()) : f();
    }, k = () => gi.$emit("chat-input-focus");
    return Yo(() => {
      f();
    }), (T, j) => {
      const C = Zo("wt-button"), g = Jo("clickaway");
      return Qo((Fe(), Pr("div", $s, [
        ei(C, {
          variant: o.value ? "active" : "outlined",
          size: t.size,
          color: "secondary",
          icon: "chat-emoji",
          rounded: "",
          wide: "",
          onClick: m
        }, null, 8, ["variant", "size"]),
        (Fe(), ti(ri, {
          disabled: !t.popupTeleportTo,
          to: c.value
        }, [
          o.value ? (Fe(), Pr("div", {
            key: 0,
            ref_key: "emojiPickerWrapper",
            ref: i,
            class: "wt-chat-emoji__wrapper"
          }, null, 512)) : ni("", !0)
        ], 8, ["disabled", "to"]))
      ])), [
        [g, p]
      ]);
    };
  }
}, Ws = /* @__PURE__ */ pi(Ks, [["__scopeId", "data-v-71d9b650"]]);
export {
  Ws as default
};
