import { resolveComponent as E, openBlock as e, createElementBlock as l, normalizeClass as m, createBlock as o, withCtx as s, createVNode as k, Fragment as F, renderList as f, createTextVNode as h, toDisplayString as A, createElementVNode as r } from "vue";
import { l as z, aP as C, aG as O, aQ as U, U as y } from "./index2.js";
const B = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAATFJREFUOE+l07FHhlEUx/HPS0R7WzREQ1tzW9EQRTREtDc0RPTS9hJFFA0NEUW0NUQRRUM0tzU0RPQfRBQ53Mt9H7e3ocvjeTznnO+953d+t+Wfq/VL/QimMYw+POMOL838JmAAO5jFG57wjXEM4RwdfGRQCYjiS/RjHY/FbsvYTLE4zXyGlIBdLGCxKI6dx7DVOHpstBr/MiB6vk1J+4hnFDc9NJ4KTTJgBRsp+R3XOMNVOnaNE1odZkA+fpkYoME0hRogBG1nwHbqvZZ4glNMJiFzThegbKEJWcJD+jmB49RWCHtUE7EJiLHN4TMFLpIvukSM2EEyUK2NKFpDeOU+TaxdjjG+s5FipLU1g70UqBopQ8KqYajaCgPFuKtWLgvyZYr3F16Tqf68TD2MVw/9AP+SOREfVpq+AAAAAElFTkSuQmCC", R = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAaJJREFUOE+lk7FLW1EYxX/nJaHBbmIcujgIFQoW3NwFB8FB6FDoX+AgdLAmXUIoBF9sg4ODoHTp1EHI4CAIFhz8BzoIDoJdKkRp6dIWk9yv3GfeIzEvdfBNl3fP9+Oec88VD/yUNj/+xiYJmDcxIUfWibPA8aX5Xud39X2AJxUbaf2lJlg04yviFKMDTEs8N/icy/Pue0W/Y1AC6A43/ECnzeqPuk5j0XjRlg1eSzwyOMvlWYohCaBQslDwEvGqua4TP1wo2Ywczwio9h7dYP8q1Ir/FwEizxmO/NrB1nWo+thbexoYh0Mz7jDnM7kFFG0ZUYzExqWDA9dmL5Ol4Y+dCjFqzZq2bwFr9oGAF31C49KgIJFNA/hAr0KVIkDiP0Vpxk7H+JQJmBeUE4ljr7mh1UELgxedhDq6ZrPZgI/AY2dUr2vaHQjx7rzBxQ0s/Qr1s5tXAzFDb4hdG1u+QEP8RtcWdeUPx4gj7z+5Rr+IiySYSoO0Wyxkcmz6vdQi9UDKUaHSAoX9XJ5iapV79fFjwpi0gLaMbzgO731MQ1v3n41/BTWsEcXMQOkAAAAASUVORK5CYII=", w = {
  props: {
    blockType: {
      type: String,
      default: "button"
    }
  },
  data() {
    return {
      theme: this.$theme,
      lang: "",
      isOpen: !1,
      locales: [
        {
          key: "zh",
          name: "中文"
        },
        {
          key: "en",
          name: "English"
        }
      ]
    };
  },
  methods: {
    openChange(n) {
      this.isOpen = n;
    },
    toggleLang(n) {
      this.lang = n.key, this.$utils.ls.set("lang", n.key), window.location.reload();
    },
    toggleChange() {
      this.lang === "zh" ? (this.lang = "en", this.$utils.ls.set("lang", "en")) : (this.lang = "zh", this.$utils.ls.set("lang", "zh")), window.location.reload();
    },
    init() {
      let n = this.$utils.ls.get("lang");
      (!n || n === "undefined") && this.$utils.ls.set("lang", this.$utils.env.VITE_APP_LANG), this.langEnable = this.$utils.env.VITE_APP_LANG_ENABLE, this.langEnable ? this.lang = this.$utils.ls.get("lang") : this.lang = "zh";
    }
  },
  mounted() {
    this.init();
  }
}, N = { class: "locale-select" }, x = { class: "label" }, I = {
  key: 0,
  src: B,
  class: "icon"
}, Q = {
  key: 1,
  src: R,
  class: "icon"
};
function T(n, v, g, b, t, a) {
  const c = E("s-icon"), d = C, _ = O, p = U, u = y;
  return e(), l("div", {
    class: m(["s-toggle-language", g.blockType === "button" ? "flex-right" : ""])
  }, [
    g.blockType === "dropdown" ? (e(), o(p, {
      key: 0,
      trigger: ["click"],
      onOpenChange: a.openChange
    }, {
      overlay: s(() => [
        k(_, null, {
          default: s(() => [
            (e(!0), l(F, null, f(t.locales, (i) => (e(), o(d, {
              key: i.key,
              onClick: (D) => a.toggleLang(i)
            }, {
              default: s(() => [
                h(A(i.name), 1)
              ]),
              _: 2
            }, 1032, ["onClick"]))), 128))
          ]),
          _: 1
        })
      ]),
      default: s(() => [
        r("div", N, [
          r("div", x, A(t.lang === "zh" ? "中文" : "English"), 1),
          t.isOpen ? (e(), l("img", Q)) : (e(), l("img", I)),
          t.isOpen ? (e(), o(c, {
            key: 3,
            name: "CaretUpOutlined"
          })) : (e(), o(c, {
            key: 2,
            name: "CaretDownOutlined",
            style: { color: "#191a37", "font-size": "12px" }
          }))
        ])
      ]),
      _: 1
    }, 8, ["onOpenChange"])) : (e(), o(u, {
      key: 1,
      class: "custom-btn",
      onClick: a.toggleChange
    }, {
      default: s(() => [
        h(A(t.lang === "zh" ? "中" : "EN"), 1)
      ]),
      _: 1
    }, 8, ["onClick"]))
  ], 2);
}
const Y = /* @__PURE__ */ z(w, [["render", T], ["__scopeId", "data-v-a33e5034"]]);
export {
  Y as default
};
