import { defineComponent as _, reactive as B, openBlock as d, createBlock as T, Transition as C, withCtx as w, renderSlot as v, computed as u, createElementBlock as f, normalizeClass as y, createElementVNode as g, Fragment as E, createVNode as P, withDirectives as x, vShow as H } from "vue";
import { C as h } from "../Shared/base-PQGakkrl.js";
import { _ as L } from "../Shared/_plugin-vue_export-helper-CHgC5LLL.js";
const O = /* @__PURE__ */ _({
  name: "ClTransitionSlideupdown",
  __name: "SlideUpDown",
  setup(r) {
    const t = B({
      oldPaddingTop: "",
      oldPaddingBottom: "",
      oldOverflow: ""
    }), s = (e) => {
      t.oldPaddingBottom = e.style.paddingBottom, t.oldPaddingTop = e.style.paddingTop, e.style.paddingTop = "0", e.style.paddingBottom = "0", e.style.maxHeight = "0";
    }, c = (e, l) => {
      t.oldOverflow = e.style.overflow;
      const n = e.scrollHeight;
      n > 0 ? e.style.maxHeight = n + "px" : e.style.maxHeight = "0", e.style.paddingTop = t.oldPaddingTop, e.style.paddingBottom = t.oldPaddingBottom, e.style.overflow = "hidden";
      const i = function() {
        l(), e.removeEventListener("transitionend", i, !1), e.removeEventListener("transitioncancel", i, !1);
      };
      e.addEventListener("transitionend", i, !1), e.addEventListener("transitioncancel", i, !1);
    }, p = (e) => {
      e.style.maxHeight = "", e.style.overflow = t.oldOverflow;
    }, m = (e) => {
      t.oldPaddingBottom = e.style.paddingBottom, t.oldPaddingTop = e.style.paddingTop, t.oldOverflow = e.style.overflow, e.style.maxHeight = e.scrollHeight + "px", e.style.overflow = "hidden";
    }, o = (e, l) => {
      e.scrollHeight !== 0 && (e.style.maxHeight = "0", e.style.paddingBottom = "0", e.style.paddingTop = "0");
      const n = function() {
        l(), e.removeEventListener("transitionend", n, !1), e.removeEventListener("transitioncancel", n, !1);
      };
      e.addEventListener("transitionend", n, !1), e.addEventListener("transitioncancel", n, !1);
    }, a = (e) => {
      e.style.maxHeight = "", e.style.overflow = t.oldOverflow, e.style.paddingBottom = t.oldPaddingBottom, e.style.paddingTop = t.oldPaddingTop, t.oldOverflow = t.oldPaddingBottom = t.oldPaddingTop = "";
    };
    return (e, l) => (d(), T(C, {
      name: "clSlideUpDown",
      onBeforeEnter: s,
      onEnter: c,
      onAfterEnter: p,
      onBeforeLeave: m,
      onLeave: o,
      onAfterLeave: a
    }, {
      default: w(() => [
        v(e.$slots, "default", {}, void 0, !0)
      ]),
      _: 3
    }));
  }
}), S = /* @__PURE__ */ L(O, [["__scopeId", "data-v-42c7685b"]]), k = { class: "collapse-head" }, D = { class: "collapse-title" }, N = { class: "collapse-body" }, A = /* @__PURE__ */ _({
  name: "ClCollapse",
  __name: "Index",
  props: {
    className: {
      type: String,
      default: ""
    },
    isOperate: {
      type: Boolean,
      default: !0
    }
  },
  setup(r) {
    const t = r, s = B({
      isCollapse: !1
    }), c = u(() => {
      const o = {
        "panel-collapse": !0
      };
      return h.isEmpty(t.className) || t.className.split(" ").forEach((a) => {
        h.isEmpty(a) || (o[a] = !0);
      }), o;
    }), p = u(() => ({
      "collapse-operate": !0,
      clIconFont: !0,
      "clIcon-angle-down": !0,
      "icon-rotate": !0,
      "rotate-180": s.isCollapse
    })), m = () => {
      s.isCollapse = !s.isCollapse;
    };
    return (o, a) => (d(), f("div", {
      class: y(c.value)
    }, [
      g("div", k, [
        g("div", D, [
          v(o.$slots, "title")
        ]),
        r.isOperate ? (d(), f("i", {
          key: 0,
          class: y(p.value),
          onClick: m
        }, null, 2)) : (d(), f(E, { key: 1 }, [], 64))
      ]),
      P(S, null, {
        default: w(() => [
          x(g("div", N, [
            v(o.$slots, "default")
          ], 512), [
            [H, !s.isCollapse]
          ])
        ]),
        _: 3
      })
    ], 2));
  }
});
export {
  A as default
};
//# sourceMappingURL=ClCollapse.js.map
