
		import { Core as _autoloadCSSCore } from '../core/app.js';
		const fileNames = ['../assets/notice.css'].map(fileName => import.meta.resolve(fileName));
		_autoloadCSSCore.insertCSSLinkToPage(fileNames, true);
	
import { reactive as N, defineComponent as B, ref as _, computed as H, resolveComponent as z, withDirectives as D, createElementBlock as a, openBlock as l, normalizeClass as E, createElementVNode as M, createBlock as C, createCommentVNode as T, mergeProps as L, Fragment as S, renderList as x, Teleport as j, unref as O, normalizeStyle as V } from "vue";
import { C as h } from "./forms-BpbQYyEQ.es.js";
import { genIntHash as A, nl2br as F } from "../utils/string.js";
const y = 300, u = N(/* @__PURE__ */ new Map()), J = (e, i, t) => "top-notice_" + A(e + i + JSON.stringify(t)), oe = (e, i = "info", t) => {
  let d = "";
  e = String(e);
  const f = J(e, i, t);
  if (t?.title)
    d = t.title;
  else {
    const c = e.split(`
`);
    c.length && (d = String(c.shift()), e = c.join(`
`));
  }
  const o = u.get(f);
  if (o) {
    U(o);
    return;
  }
  const r = {
    id: f,
    title: d,
    text: e,
    style: i,
    buttonProps: t?.buttonProps,
    buttonsProps: t?.buttonsProps,
    metaText: t?.metaText,
    isSafeHTML: t?.isSafeHTML,
    selectToClose: t?.selectToClose,
    onClose: t?.onClose
  };
  if (u.set(r.id, r), u.size > 5) {
    const [c, g] = [...u].at(0) || [];
    g && P(g);
  }
  h.state.isMobile && $("input").one("click", () => P(r));
}, U = (e) => {
  e.hightlight = !0, setTimeout(() => e.hightlight = !1, y);
}, P = (e) => {
  e.forceClosed = !0, setTimeout(() => {
    e.onClose?.(), u.delete(e.id);
  }, y);
}, k = (e) => {
  const i = "hacking was detected";
  return e = e.replace(/<script/g, i), e = e.replace(/<img/g, i), e = e.replace(/<iframe/g, i), e = e.replace(/javascript:/g, i), e = e.replace(/<[^>]+ (@|on)\w+=[^>]+>?/g, i), e;
}, W = { class: "top-notice_itemTextWrapper" }, q = ["innerHTML"], G = ["innerHTML"], K = {
  key: 1,
  class: "top-notice_itemButtons"
}, Q = ["innerHTML"], R = ["title"], X = /* @__PURE__ */ B({
  __name: "item",
  props: {
    id: {},
    title: {},
    text: {},
    style: {},
    metaText: {},
    buttonProps: {},
    buttonsProps: {},
    isSafeHTML: { type: Boolean },
    hightlight: { type: Boolean },
    selectToClose: { type: Boolean, default: !0 },
    forceClosed: { type: Boolean }
  },
  emits: ["close"],
  setup(e, { emit: i }) {
    const t = e, d = i, f = _(!1);
    setTimeout(() => f.value = !0, 10);
    const o = _(!1), r = _("right"), c = H(() => {
      let n = t.title.replace(/ {2}/g, "&nbsp;");
      return t.isSafeHTML || (n = k(n)), n;
    }), g = H(() => {
      let n = F(t.text);
      return n = n.replace(/ {2}/g, "&nbsp;"), t.isSafeHTML || (n = k(n)), n;
    }), m = (n) => {
      o.value = !0, n && (r.value = n), setTimeout(() => d("close"), y);
    }, w = (n) => {
      if (!t.selectToClose) return;
      const { tagName: s } = n.target;
      s === "A" && m(), s === "BUTTON" && m();
    }, I = {
      mounted: (n) => {
        if (!h.state.isMobile || !h.$ || !h.$.ui.draggable) return;
        let s = "right";
        h.$(n).draggable({
          revert: !1,
          axis: "x",
          drag: (p, b) => {
            s = b.position.left > 0 ? "right" : "left";
          },
          stop: (p, b) => {
            m(s);
          }
        });
      }
    };
    return (n, s) => {
      const v = z("TopButton");
      return D((l(), a("div", {
        class: E(["top-notice_item", {
          ["top-notice_item-" + e.style]: !0,
          "top-notice_item-hightlight": e.hightlight,
          "top-notice_item-showed": f.value,
          "top-notice_item-closed": o.value || e.forceClosed,
          ["top-notice_item-closed_" + r.value]: o.value
        }]),
        onClick: w
      }, [
        M("div", W, [
          c.value ? (l(), a("div", {
            key: 0,
            class: "top-notice_itemTitle",
            innerHTML: c.value
          }, null, 8, q)) : T("", !0),
          g.value ? (l(), a("div", {
            key: 1,
            class: "top-notice_itemText",
            innerHTML: g.value
          }, null, 8, G)) : T("", !0)
        ]),
        e.buttonProps ? (l(), C(v, L({
          key: 0,
          class: "top-notice_itemButton",
          size: "s"
        }, e.buttonProps, {
          title: e.buttonProps.title,
          innerHTML: e.buttonProps.default,
          onClick: s[0] || (s[0] = (p) => m())
        }), null, 16, ["title", "innerHTML"])) : T("", !0),
        e.buttonsProps?.length ? (l(), a("div", K, [
          (l(!0), a(S, null, x(e.buttonsProps, (p) => (l(), C(v, L({
            class: "top-notice_itemButton",
            size: "s"
          }, { ref_for: !0 }, p, {
            title: p.title,
            innerHTML: p.default,
            onClick: s[1] || (s[1] = (b) => m())
          }), null, 16, ["title", "innerHTML"]))), 256))
        ])) : T("", !0),
        e.metaText ? (l(), a("div", {
          key: 2,
          class: "top-notice_itemMetaText",
          innerHTML: e.metaText
        }, null, 8, Q)) : T("", !0),
        M("div", {
          class: "top-notice_itemClose",
          "data-top-icon": "",
          title: n.$i18n.Common.Close,
          onClick: s[2] || (s[2] = () => m())
        }, null, 8, R)
      ], 2)), [
        [I]
      ]);
    };
  }
}), Y = { class: "top-notice" }, ne = /* @__PURE__ */ B({
  __name: "notice",
  setup(e) {
    const i = (t) => {
      t.onClose?.(), u.delete(t.id);
    };
    return (t, d) => (l(), C(j, { to: "body" }, [
      M("div", Y, [
        (l(!0), a(S, null, x(O(u), ([f, o]) => (l(), C(X, {
          key: o.id,
          id: o.id,
          title: o.title,
          text: o.text,
          style: V(o.style),
          buttonProps: o.buttonProps,
          buttonsProps: o.buttonsProps,
          metaText: o.metaText,
          isSafeHTML: o.isSafeHTML,
          forceClosed: o.forceClosed,
          hightlight: o.hightlight,
          onClose: (r) => i(o)
        }, null, 8, ["id", "title", "text", "style", "buttonProps", "buttonsProps", "metaText", "isSafeHTML", "forceClosed", "hightlight", "onClose"]))), 128))
      ])
    ]));
  }
});
export {
  ne as default,
  oe as show
};
//# sourceMappingURL=notice-Ckc8r96E.es.js.map
