import { defineComponent, useCssVars, unref, ref, toRefs, openBlock, createElementBlock, createVNode, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, isRef, toDisplayString, withCtx, createTextVNode, createCommentVNode } from "vue";
import openImg from "./images/open.mjs";
import closeImg from "./images/close.mjs";
import { NImage, NInput, NSwitch } from "naive-ui";
import "./index.vue_vue_type_style_index_0_scoped_true_lang.mjs";
import _export_sfc from "../../../../_virtual/plugin-vue_export-helper.mjs";
const _hoisted_1 = { class: "sidebar_2" };
const _hoisted_2 = ["onClick"];
const _hoisted_3 = { class: "sidebar_1" };
const _hoisted_4 = { key: 0 };
const __default__ = defineComponent({ name: "ESidebar01" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    useCssVars((_ctx) => ({
      "2ca68602": unref(height) + "px"
    }));
    let act = ref(0);
    let active = ref(-1);
    const { dataset, height } = toRefs(props.chartConfig.option);
    const railStyle = ref((focused, checked) => {
      const style = {};
      style.background = "RGBA(17, 49, 90, 1)";
      style.boxShadow = "0 0 0 2px RGBA(9, 69, 130, 1)";
      return style;
    });
    const sidebarHeight = ref(855);
    const changeSidebar = () => {
      sidebarHeight.value = sidebarHeight.value == 0 ? 855 : 0;
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(unref(NImage), {
          width: "55",
          src: sidebarHeight.value == 0 ? unref(openImg) : unref(closeImg),
          class: "openorclose",
          "preview-disabled": "",
          onClick: changeSidebar
        }, null, 8, ["src"]),
        createElementVNode("div", {
          class: "sidebar",
          style: normalizeStyle({ height: sidebarHeight.value + "px" })
        }, [
          createElementVNode("div", _hoisted_1, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataset), (item, index) => {
              return openBlock(), createElementBlock("div", {
                class: normalizeClass({ active: unref(act) == index }),
                onClick: ($event) => isRef(act) ? act.value = index : act = index
              }, toDisplayString(item.key), 11, _hoisted_2);
            }), 256))
          ]),
          createElementVNode("div", _hoisted_3, [
            createElementVNode("div", null, [
              createVNode(unref(NInput), {
                placeholder: "\u8BF7\u8F93\u5165",
                class: "input"
              }, {
                suffix: withCtx(() => []),
                _: 1
              })
            ]),
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataset)[unref(act)].children, (item, i) => {
              return openBlock(), createElementBlock("div", {
                key: i,
                class: normalizeClass(["sidebar_1_1", { active: unref(active) == i }])
              }, [
                createElementVNode("div", null, [
                  createTextVNode(toDisplayString(item.key) + " ", 1),
                  item.value ? (openBlock(), createElementBlock("span", _hoisted_4, "(" + toDisplayString(item.value) + ")", 1)) : createCommentVNode("", true)
                ]),
                createVNode(unref(NSwitch), {
                  value: item.checked,
                  "onUpdate:value": ($event) => item.checked = $event,
                  "rail-style": railStyle.value
                }, null, 8, ["value", "onUpdate:value", "rail-style"])
              ], 2);
            }), 128))
          ])
        ], 4)
      ]);
    };
  }
});
var _ESidebar01 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-06de3c2b"]]);
export { _ESidebar01 as default };
