import { defineComponent as F, ref as m, computed as s, onMounted as I, onBeforeUnmount as D, openBlock as d, createElementBlock as a, normalizeClass as z, unref as n, createElementVNode as t, withModifiers as C, toDisplayString as w, createCommentVNode as p, createVNode as E, TransitionGroup as R, withCtx as G, Fragment as O, renderList as P, withDirectives as U, createBlock as W, resolveDynamicComponent as $, vShow as j } from "vue";
import { u as q, C as J, A as K, V as Q, l as X, m as Y } from "./index-40f191fc.mjs";
import "pinia";
const Z = { class: "cds-slides-header" }, ee = ["onClick"], se = ["innerHTML"], ne = ["innerHTML"], te = { class: "cds-slides-header__body" }, oe = { class: "cds-slides-header__title" }, ie = ["textContent"], le = {
  key: 0,
  class: "cds-slides-header__sub-title"
}, ce = ["textContent"], de = ["onClick"], ae = ["innerHTML"], re = ["onClick"], ue = ["innerHTML"], _e = { class: "cds-slides-body" }, pe = /* @__PURE__ */ F({
  __name: "index",
  setup(he) {
    const o = q(), u = { iconClose: J, iconBack: K };
    m(null);
    const _ = m({ w: 0, h: 0 }), h = m(null), y = s(() => o.slides), i = s(() => o.sideCurrent), L = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.resizable;
    }), M = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.title;
    }), f = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.subTitle;
    }), k = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.size;
    }), l = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.sizes;
    }), S = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.blockClose;
    }), T = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.blockCloseMessage;
    }), v = s(() => o.sideCount), A = { small: Q, medium: X, large: Y }, g = s(() => {
      if (!l.value || !l.value.length > 1)
        return;
      const e = l.value.length, r = l.value.findIndex((c) => c === k.value);
      return r + 1 < e ? l.value[r + 1] : l.value[0];
    }), H = s(() => {
      if (!(!l.value || !l.value.length > 1))
        return A[g.value];
    });
    I(() => {
      const e = new ResizeObserver((r) => {
        r.forEach((c) => {
          const x = c.contentRect;
          _.value.w = Number(x.width.toFixed(0)), _.value.h = Number(x.height.toFixed(0)), o.setSidePanelSize(_.value);
        });
      });
      h.value && e.observe(h.value);
    }), D(() => o.closeAllSlide());
    const b = (e = !0) => {
      S.value && !confirm(T.value || "Закрыть?") || (e ? o.closeLastSlide() : o.closeAllSlide());
    }, B = () => o.changeSize(g.value), N = () => b(!0), V = () => b();
    return (e, r) => (d(), a("div", {
      ref_key: "slide",
      ref: h,
      class: z([`cds-slides-container--${n(k)}`, "cds-slides-container"])
    }, [
      t("div", Z, [
        t("a", {
          class: z([{ "cds-slides-header__side--danger": n(v) === 1 }, "cds-slides-header__side"]),
          role: "button",
          onClick: C(N, ["prevent"])
        }, [
          n(v) > 1 ? (d(), a("span", {
            key: 0,
            class: "cds-slides-header__icon",
            innerHTML: u.iconBack
          }, null, 8, se)) : (d(), a("span", {
            key: 1,
            class: "cds-slides-header__icon cds-slides-header__icon--danger",
            innerHTML: u.iconClose
          }, null, 8, ne))
        ], 10, ee),
        t("div", te, [
          t("div", oe, [
            t("div", {
              textContent: w(n(M))
            }, null, 8, ie)
          ]),
          n(f) ? (d(), a("div", le, [
            t("div", {
              textContent: w(n(f))
            }, null, 8, ce)
          ])) : p("", !0)
        ]),
        n(L) ? (d(), a("a", {
          key: 0,
          class: "cds-slides-header__side",
          onClick: C(B, ["prevent"])
        }, [
          t("span", {
            class: "cds-slides-header__icon",
            innerHTML: n(H)
          }, null, 8, ae)
        ], 8, de)) : p("", !0),
        n(v) > 1 ? (d(), a("a", {
          key: 1,
          class: "cds-slides-header__side",
          onClick: C(V, ["prevent"])
        }, [
          t("span", {
            class: "cds-slides-header__icon cds-slides-header__icon--danger",
            innerHTML: u.iconClose
          }, null, 8, ue)
        ], 8, re)) : p("", !0)
      ]),
      t("div", _e, [
        E(R, {
          mode: "in-out",
          name: "sidenav-child",
          persisted: ""
        }, {
          default: G(() => [
            (d(!0), a(O, null, P(n(y), (c) => U((d(), W($(c.component), {
              key: c.id,
              data: c.data
            }, null, 8, ["data"])), [
              [j, n(i).id === c.id]
            ])), 128))
          ]),
          _: 1
        })
      ])
    ], 2));
  }
});
export {
  pe as default
};
//# sourceMappingURL=index-f3edef64.mjs.map
