import { emojiPattern as d } from "regex-combined-emojis";
import j from "emoji-toolkit/emoji_strategy.json";
const g = new RegExp(d, "g"), E = "8.0", f = "https://cdn.jsdelivr.net/joypixels/assets/" + E + "/png/unicode/32/";
let h = null, S = f, y = ".png", p = f, P = ".png";
const c = j, A = new RegExp("(^| |(?<=:))(:\\w+:)", "g");
function C() {
  return c;
}
function w(t, e = ".png") {
  t.endsWith("/") || (t = t + "/"), S = t, y = e;
}
function T(t, e = ".svg") {
  t.endsWith("/") || (t = t + "/"), p = t, P = e;
}
function q(t) {
  h = t;
}
function J(t) {
  U(t);
}
function U(t) {
  const e = [
    "custom",
    "date_added",
    "image"
  ], n = [
    "date_added",
    "image",
    "unicode_output",
    "shortname",
    "shortname_alternates",
    "custom",
    "name"
  ], o = (s, i, r) => {
    if (s[i] === void 0) {
      if (!e.includes(i))
        return;
      s[i] = r;
    } else
      Array.isArray(s[i]) ? s[i] = s[i].concat(r) : s[i] = r;
  };
  Object.entries(t).forEach((s) => {
    const [i, r] = s;
    if (i in c) {
      const u = c[i];
      for (const m in r) {
        const a = r[m];
        o(u, m, a);
      }
    } else
      n.every((m) => r[m] !== void 0) ? c[i] = r : console.error(
        "The following custom emoji doesn't contain the required properties:",
        r
      );
  });
}
function l(t) {
  function e(o, s) {
    if (!(!o || typeof o != "object")) {
      if ("shortname" in o && (o.shortname === t || o.shortname_alternates.includes(t)))
        return o.key = s, n = o, !0;
      Object.keys(o).some(function(i) {
        return e(o[i], i);
      });
    }
  }
  let n;
  return e(C(), null), n;
}
function _(t) {
  let e = "";
  for (const n of t) {
    const o = n.codePointAt(0).toString(16).padStart(4, "0");
    ["200d", "fe0f"].includes(o) || (e !== "" && (e = e + "-"), e = e + o);
  }
  return e;
}
function L(t) {
  const e = t.split("-");
  let n = "";
  return e.forEach((o) => {
    n = n + String.fromCodePoint(parseInt(o, 16));
  }), n;
}
function W(t) {
  if (t = t == null ? void 0 : t.trim(), t.startsWith(":") && t.endsWith(":"))
    return l(t);
  {
    const e = _(t), n = c[e];
    return n && (n.key = e), n;
  }
}
function b(t) {
  const e = (t.match(A) || []).map((n) => n.trim());
  return v(e);
}
function v(t) {
  const e = t ? t.filter((n) => l(n)) : [];
  return new Set(e);
}
function k(t) {
  const e = [...t.matchAll(g)], n = e.length ? e.map((o) => o[0]) : [];
  return new Set(n);
}
export {
  W as codeToEmojiData,
  h as customEmojiAssetUrl,
  f as defaultEmojiAssetUrl,
  P as emojiFileExtensionLarge,
  y as emojiFileExtensionSmall,
  p as emojiImageUrlLarge,
  S as emojiImageUrlSmall,
  c as emojiJson,
  g as emojiRegex,
  A as emojiShortCodeRegex,
  E as emojiVersion,
  v as filterValidShortCodes,
  k as findEmojis,
  b as findShortCodes,
  C as getEmojiData,
  J as setCustomEmojiJson,
  q as setCustomEmojiUrl,
  T as setEmojiAssetUrlLarge,
  w as setEmojiAssetUrlSmall,
  l as shortcodeToEmojiData,
  L as stringToUnicode,
  _ as unicodeToString,
  U as validateCustomEmojiJson
};
//# sourceMappingURL=index.js.map
