"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const icon = require("../../../utils/vue/icon.js");
const refs = require("../../../utils/vue/refs.js");
const index$1 = require("../../../hooks/use-draggable/index.js");
const index = require("../../../hooks/use-locale/index.js");
const index$2 = require("../../icon/index.js");
const tokens = require("../../focus-trap/src/tokens.js");
const dialogContent = require("./dialog-content.js");
const constants = require("./constants.js");
const Vue = require("vue");
const _hoisted_1 = ["aria-level"];
const _hoisted_2 = ["aria-label"];
const _hoisted_3 = ["id"];
var dialog_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElDialogContent",
  __name: "dialog-content",
  props: dialogContent.dialogContentProps,
  emits: dialogContent.dialogContentEmits,
  setup(__props, { expose: __expose }) {
    const { t } = index.useLocale();
    const { Close } = icon.CloseComponents;
    const props = __props;
    const { dialogRef, headerRef, bodyId, ns, style } = Vue.inject(constants.dialogInjectionKey);
    const { focusTrapRef } = Vue.inject(tokens.FOCUS_TRAP_INJECTION_KEY);
    const composedDialogRef = refs.composeRefs(focusTrapRef, dialogRef);
    const draggable = Vue.computed(() => !!props.draggable);
    const { resetPosition, updatePosition, isDragging } = index$1.useDraggable(dialogRef, headerRef, draggable, Vue.computed(() => !!props.overflow));
    const dialogKls = Vue.computed(() => [
      ns.b(),
      ns.is("fullscreen", props.fullscreen),
      ns.is("draggable", draggable.value),
      ns.is("dragging", isDragging.value),
      ns.is("align-center", !!props.alignCenter),
      { [ns.m("center")]: props.center }
    ]);
    __expose({
      resetPosition,
      updatePosition
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", {
        ref: Vue.unref(composedDialogRef),
        class: Vue.normalizeClass(dialogKls.value),
        style: Vue.normalizeStyle(Vue.unref(style)),
        tabindex: "-1"
      }, [
        Vue.createElementVNode("header", {
          ref_key: "headerRef",
          ref: headerRef,
          class: Vue.normalizeClass([
            Vue.unref(ns).e("header"),
            __props.headerClass,
            { "show-close": __props.showClose }
          ])
        }, [Vue.renderSlot(_ctx.$slots, "header", {}, () => [Vue.createElementVNode("span", {
          role: "heading",
          "aria-level": __props.ariaLevel,
          class: Vue.normalizeClass(Vue.unref(ns).e("title"))
        }, Vue.toDisplayString(__props.title), 11, _hoisted_1)]), __props.showClose ? (Vue.openBlock(), Vue.createElementBlock("button", {
          key: 0,
          "aria-label": Vue.unref(t)("el.dialog.close"),
          class: Vue.normalizeClass(Vue.unref(ns).e("headerbtn")),
          type: "button",
          onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
        }, [Vue.createVNode(Vue.unref(index$2.ElIcon), { class: Vue.normalizeClass(Vue.unref(ns).e("close")) }, {
          default: Vue.withCtx(() => [(Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(__props.closeIcon || Vue.unref(Close))))]),
          _: 1
        }, 8, ["class"])], 10, _hoisted_2)) : Vue.createCommentVNode("v-if", true)], 2),
        Vue.createElementVNode("div", {
          id: Vue.unref(bodyId),
          class: Vue.normalizeClass([Vue.unref(ns).e("body"), __props.bodyClass])
        }, [Vue.renderSlot(_ctx.$slots, "default")], 10, _hoisted_3),
        _ctx.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("footer", {
          key: 0,
          class: Vue.normalizeClass([Vue.unref(ns).e("footer"), __props.footerClass])
        }, [Vue.renderSlot(_ctx.$slots, "footer")], 2)) : Vue.createCommentVNode("v-if", true)
      ], 6);
    };
  }
});
exports.default = dialog_content_vue_vue_type_script_setup_true_lang_default;
