<template>
  <sar-dialog
    :root-style="innerProps.rootStyle"
    :root-class="innerProps.rootClass"
    v-model:visible="innerProps.visible"
    :title="innerProps.title"
    :message="innerProps.message"
    :headed="innerProps.headed"
    :button-type="innerProps.buttonType"
    :show-cancel="innerProps.showCancel"
    :cancel-text="innerProps.cancelText"
    :show-confirm="innerProps.showConfirm"
    :confirm-text="innerProps.confirmText"
    :overlay-closable="innerProps.overlayClosable"
    :before-close="innerProps.beforeClose"
  />
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { onMounted, onUnmounted, ref } from "vue";
import SarDialog from "../dialog/dialog.vue";
import { dialogAgentProps, mapIdImperative } from "./common";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "dialog-agent",
  props: dialogAgentProps,
  setup(__props, { expose: __expose }) {
    __expose();
    const props = __props;
    const innerProps = ref({ ...props });
    const imperative = {
      show(newProps) {
        innerProps.value = {
          ...props,
          ...newProps,
          visible: true
        };
      },
      hide() {
        innerProps.value = {
          ...innerProps.value,
          visible: false
        };
      }
    };
    onMounted(() => {
      if (innerProps.value.id) {
        mapIdImperative[innerProps.value.id] = imperative;
      }
    });
    onUnmounted(() => {
      if (innerProps.value.id) {
        delete mapIdImperative[innerProps.value.id];
      }
    });
    const __returned__ = { props, innerProps, imperative, SarDialog };
    return __returned__;
  }
});
</script>
