{"version":3,"file":"BModal-CJ2pBX28.mjs","names":["$attrs"],"sources":["../src/composables/useModalManager.ts","../src/components/BModal/BModal.vue","../src/components/BModal/BModal.vue"],"sourcesContent":["import {getSSRHandler, tryOnScopeDispose, unrefElement} from '@vueuse/core'\nimport {\n  type ComponentInternalInstance,\n  computed,\n  getCurrentInstance,\n  inject,\n  type Ref,\n  toValue,\n  watch,\n} from 'vue'\nimport {modalManagerKey} from '../utils/keys'\nimport {getSafeDocument} from '../utils/dom'\n\nconst modalOpenClassName = 'modal-open'\n\nexport const useSharedModalStack = () => {\n  const modalManagerPlugin = inject(modalManagerKey, null)\n\n  /**\n   * Removes an item from both the stack and registry\n   */\n  const dispose = (modal: Readonly<ComponentInternalInstance>): void => {\n    modalManagerPlugin?.removeStack(modal)\n    modalManagerPlugin?.removeRegistry(modal)\n  }\n\n  const updateHTMLAttrs = getSSRHandler('updateHTMLAttrs', (selector, attribute, value) => {\n    const el =\n      typeof selector !== 'string'\n        ? unrefElement(selector)\n        : selector\n          ? getSafeDocument()?.querySelector(selector)\n          : undefined\n    if (!el) return\n\n    if (attribute === 'class') {\n      el.classList.toggle(modalOpenClassName, value === modalOpenClassName)\n    } else {\n      el.setAttribute(attribute, value)\n    }\n  })\n\n  tryOnScopeDispose(() => {\n    if (modalManagerPlugin?.countStack.value === 0) {\n      updateHTMLAttrs('body', 'class', '')\n    }\n  })\n\n  watch(\n    () => modalManagerPlugin?.countStack.value,\n    (newValue) => {\n      if (newValue === undefined) return\n      updateHTMLAttrs('body', 'class', newValue > 0 ? modalOpenClassName : '')\n    }\n  )\n\n  return {\n    ...modalManagerPlugin,\n    dispose,\n  }\n}\n\nexport const useModalManager = (modalOpen: Readonly<Ref<boolean>>, initialValue: boolean) => {\n  const {pushRegistry, pushStack, removeStack, stack, dispose, countStack} = useSharedModalStack()\n\n  const currentModal = getCurrentInstance()\n\n  if (!currentModal || currentModal.type.__name !== 'BModal') {\n    throw new Error('useModalManager must only use in BModal component')\n  }\n\n  pushRegistry?.(currentModal)\n\n  tryOnScopeDispose(() => {\n    dispose(currentModal)\n  })\n\n  const setInStack = (newValue: boolean, oldValue: boolean) => {\n    if (newValue) {\n      pushStack?.(currentModal)\n    } else if (oldValue && !newValue) {\n      removeStack?.(currentModal)\n    }\n  }\n\n  // (initialValue, initialValue) is meant to always only ever trigger the first `if (newValue) {` block. The other block is skipped _always_\n  setInStack(initialValue, initialValue)\n\n  watch(modalOpen, setInStack)\n\n  return {\n    activePosition: computed(() =>\n      stack?.value.findIndex((el) => toValue(el.exposed?.id) === toValue(currentModal.exposed?.id))\n    ),\n    activeModalCount: countStack,\n    stackWithoutSelf: computed(\n      () =>\n        stack?.value.filter(\n          (el) => toValue(el.exposed?.id) !== toValue(currentModal.exposed?.id)\n        ) ?? []\n    ),\n  }\n}\n","<template>\n  <ConditionalTeleport :to=\"props.teleportTo\" :disabled=\"props.teleportDisabled\">\n    <Transition\n      v-if=\"renderRef || contentShowing\"\n      v-bind=\"transitionProps\"\n      :appear=\"modelValue || props.visible\"\n    >\n      <div\n        v-show=\"showRef && ((backdropReady && props.backdropFirst) || !props.backdropFirst)\"\n        :id=\"computedId\"\n        ref=\"_element\"\n        class=\"modal\"\n        :class=\"[\n          props.modalClass,\n          {\n            fade: !computedNoAnimation,\n            show: isVisible,\n            ...sharedClasses,\n          },\n        ]\"\n        role=\"dialog\"\n        :aria-labelledby=\"!props.noHeader ? `${computedId}-label` : undefined\"\n        :aria-describedby=\"`${computedId}-body`\"\n        tabindex=\"-1\"\n        v-bind=\"$attrs\"\n        :style=\"computedZIndex\"\n        style=\"display: block\"\n        @mousedown.left.self=\"hide('backdrop')\"\n      >\n        <div class=\"modal-dialog\" :class=\"modalDialogClasses\">\n          <div v-if=\"contentShowing\" class=\"modal-content\" :class=\"props.contentClass\">\n            <div\n              v-if=\"!props.noHeader\"\n              class=\"modal-header\"\n              :class=\"headerClasses\"\n              v-bind=\"props.headerAttrs\"\n            >\n              <slot name=\"header\" v-bind=\"sharedSlots\">\n                <component\n                  :is=\"props.titleTag\"\n                  :id=\"`${computedId}-label`\"\n                  class=\"modal-title\"\n                  :class=\"titleClasses\"\n                >\n                  <slot name=\"title\" v-bind=\"sharedSlots\">\n                    {{ props.title }}\n                  </slot>\n                </component>\n                <template v-if=\"!props.noHeaderClose\">\n                  <BButton\n                    v-if=\"hasHeaderCloseSlot\"\n                    ref=\"_closeButton\"\n                    v-bind=\"headerCloseAttrs\"\n                    @click=\"hide('close')\"\n                  >\n                    <slot name=\"header-close\" v-bind=\"sharedSlots\" />\n                  </BButton>\n                  <BCloseButton\n                    v-else\n                    ref=\"_closeButton\"\n                    :aria-label=\"props.headerCloseLabel\"\n                    v-bind=\"headerCloseAttrs\"\n                    @click=\"hide('close')\"\n                  />\n                </template>\n              </slot>\n            </div>\n            <div\n              :id=\"`${computedId}-body`\"\n              class=\"modal-body\"\n              :class=\"bodyClasses\"\n              v-bind=\"props.bodyAttrs\"\n            >\n              <slot v-bind=\"sharedSlots\">\n                {{ props.body }}\n              </slot>\n            </div>\n            <div v-if=\"!props.noFooter\" class=\"modal-footer\" :class=\"footerClasses\">\n              <slot name=\"footer\" v-bind=\"sharedSlots\">\n                <slot name=\"cancel\" v-bind=\"sharedSlots\">\n                  <BButton\n                    v-if=\"!props.okOnly\"\n                    ref=\"_cancelButton\"\n                    :disabled=\"disableCancel\"\n                    :size=\"props.buttonSize\"\n                    :variant=\"props.cancelVariant\"\n                    :class=\"props.cancelClass\"\n                    @click=\"hide('cancel')\"\n                  >\n                    {{ props.cancelTitle }}\n                  </BButton>\n                </slot>\n                <slot name=\"ok\" v-bind=\"sharedSlots\">\n                  <BButton\n                    ref=\"_okButton\"\n                    :disabled=\"disableOk\"\n                    :size=\"props.buttonSize\"\n                    :variant=\"props.okVariant\"\n                    :class=\"props.okClass\"\n                    @click=\"hide('ok')\"\n                  >\n                    {{ props.okTitle }}\n                  </BButton>\n                </slot>\n              </slot>\n            </div>\n          </div>\n        </div>\n        <div\n          v-if=\"needsFallback\"\n          ref=\"_fallbackFocusElement\"\n          :class=\"fallbackClassSelector\"\n          tabindex=\"0\"\n          style=\"width: 0; height: 0; overflow: hidden\"\n        />\n      </div>\n    </Transition>\n    <slot v-if=\"!props.noBackdrop\" name=\"backdrop\" v-bind=\"sharedSlots\">\n      <Transition v-if=\"renderBackdropRef\" v-bind=\"backdropTransitionProps\">\n        <div\n          v-show=\"showRef || (isLeaving && props.backdropFirst && !computedNoAnimation)\"\n          class=\"modal-backdrop\"\n          :style=\"computedZIndexBackdrop\"\n          :class=\"{\n            fade: !computedNoAnimation,\n            show: backdropVisible || computedNoAnimation,\n            ...sharedClasses,\n          }\"\n          @click=\"hide('backdrop')\"\n        />\n      </Transition>\n    </slot>\n  </ConditionalTeleport>\n</template>\n\n<script setup lang=\"ts\">\nimport {onKeyStroke, unrefElement} from '@vueuse/core'\nimport {useActivatedFocusTrap} from '../../composables/useActivatedFocusTrap'\nimport {\n  computed,\n  type CSSProperties,\n  type EmitFn,\n  nextTick,\n  onMounted,\n  ref,\n  useTemplateRef,\n  watch,\n} from 'vue'\nimport type {BModalSlots, BModalSlotsData, BModalEmits, BModalProps} from '../../types'\n\nimport BButton from '../BButton/BButton.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useSafeScrollLock} from '../../composables/useSafeScrollLock'\nimport {getModalZIndex, getSafeDocument, isEmptySlot} from '../../utils/dom'\nimport {useColorVariantClasses} from '../../composables/useColorVariantClasses'\nimport {useModalManager} from '../../composables/useModalManager'\nimport {useShowHide} from '../../composables/useShowHide'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {getElement} from '../../utils/getElement'\n\ndefineOptions({\n  inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BModalProps, 'modelValue'>>(), {\n  focus: undefined,\n  backdropFirst: false,\n  body: undefined,\n  bodyBgVariant: null,\n  bodyAttrs: undefined,\n  bodyClass: null,\n  bodyScrolling: false,\n  bodyTextVariant: null,\n  bodyVariant: null,\n  busy: false,\n  buttonSize: 'md',\n  cancelClass: undefined,\n  cancelDisabled: false,\n  cancelTitle: 'Cancel',\n  cancelVariant: 'secondary',\n  centered: false,\n  contentClass: undefined,\n  dialogClass: undefined,\n  footerBgVariant: null,\n  footerBorderVariant: null,\n  footerClass: undefined,\n  footerTextVariant: null,\n  footerVariant: null,\n  fullscreen: false,\n  headerAttrs: undefined,\n  headerBgVariant: null,\n  headerBorderVariant: null,\n  headerClass: undefined,\n  headerCloseClass: undefined,\n  headerCloseLabel: 'Close',\n  headerCloseVariant: 'secondary',\n  headerTextVariant: null,\n  headerVariant: null,\n  noFooter: false,\n  noHeader: false,\n  noHeaderClose: false,\n  id: undefined,\n  initialAnimation: false,\n  lazy: false,\n  modalClass: undefined,\n  noBackdrop: false,\n  noCloseOnBackdrop: false,\n  noCloseOnEsc: false,\n  noFade: false,\n  noTrap: false,\n  okClass: undefined,\n  okDisabled: false,\n  okOnly: false,\n  okTitle: 'OK',\n  okVariant: 'primary',\n  unmountLazy: false,\n  scrollable: false,\n  size: 'md',\n  teleportDisabled: false,\n  teleportTo: 'body',\n  title: undefined,\n  titleClass: undefined,\n  titleVisuallyHidden: false,\n  titleTag: 'h5',\n  show: false,\n  transProps: undefined,\n  visible: false,\n})\nconst props = useDefaults(_props, 'BModal')\nconst emit = defineEmits<BModalEmits>()\nconst slots = defineSlots<BModalSlots>()\n\nconst computedId = useId(() => props.id, 'modal')\n// Note: passive: true will sync an internal ref... This is required for useModalManager to exit,\n// Since the modelValue that's passed from that composable is not reactive, this internal ref _is_ and thus it will trigger closing the modal\nconst modelValue = defineModel<Exclude<BModalProps['modelValue'], undefined>>({default: false})\n\nconst element = useTemplateRef<HTMLElement | null>('_element')\nconst fallbackFocusElement = useTemplateRef<HTMLElement | null>('_fallbackFocusElement')\nconst okButton = useTemplateRef<HTMLElement | null>('_okButton')\nconst cancelButton = useTemplateRef<HTMLElement | null>('_cancelButton')\nconst closeButton = useTemplateRef<HTMLElement | null>('_closeButton')\n\nconst pickFocusItem = () => {\n  if (props.focus && typeof props.focus !== 'boolean') {\n    if (props.focus === 'ok') {\n      return okButton\n    } else if (props.focus === 'close') {\n      return closeButton\n    } else if (props.focus === 'cancel') {\n      return cancelButton\n    }\n    return getElement(props.focus, element.value ?? undefined) ?? element.value\n  }\n  return element\n}\n\nlet activeElement: HTMLElement | null = null\nconst onAfterEnter = () => {\n  const doc = getSafeDocument()\n  if (props.noTrap && props.focus !== false && doc) {\n    // Hypothetically this could be an issue\n    activeElement = doc.activeElement as HTMLElement\n    if (activeElement === element.value) {\n      activeElement = null\n    }\n    const el = unrefElement(pickFocusItem())\n    if (!el) return\n    el?.focus()\n    if (\n      el.tagName &&\n      el.tagName.toLowerCase() === 'input' &&\n      typeof (el as HTMLInputElement).select === 'function'\n    ) {\n      ;(el as HTMLInputElement).select()\n    }\n  }\n}\n\nconst onAfterLeave = () => {\n  if (props.noTrap && props.focus !== false && activeElement) {\n    activeElement?.focus()\n    activeElement = null\n  }\n}\n\nconst {\n  showRef,\n  renderRef,\n  renderBackdropRef,\n  hide,\n  show,\n  toggle,\n  computedNoAnimation,\n  transitionProps,\n  backdropTransitionProps,\n  isLeaving,\n  isVisible,\n  trapActive,\n  contentShowing,\n  backdropReady,\n  backdropVisible,\n} = useShowHide(modelValue, props, emit as EmitFn, element, computedId, {\n  // addShowClass: false,\n  transitionProps: {\n    onAfterEnter,\n    onAfterLeave,\n  },\n})\n\nconst fallbackClassSelector = 'modal-fallback-focus'\nconst {needsFallback} = useActivatedFocusTrap({\n  element,\n  isActive: trapActive,\n  noTrap: () => props.noTrap,\n  fallbackFocus: {\n    ref: fallbackFocusElement,\n    classSelector: fallbackClassSelector,\n  },\n  focus: () => (props.focus === false ? false : (unrefElement(pickFocusItem()) ?? undefined)),\n  // () => (typeof focus === 'boolean' ? focus : (unrefElement(focus) ?? undefined)),\n})\n\nonKeyStroke(\n  'Escape',\n  () => {\n    hide('esc')\n  },\n  {target: element}\n)\nuseSafeScrollLock(showRef, () => props.bodyScrolling)\n\nconst hasHeaderCloseSlot = computed(() => !isEmptySlot(slots['header-close']))\n\nconst modalDialogClasses = computed(() => [\n  props.dialogClass,\n  {\n    'modal-fullscreen': props.fullscreen === true,\n    [`modal-fullscreen-${props.fullscreen}-down`]: typeof props.fullscreen === 'string',\n    [`modal-${props.size}`]: props.size !== 'md',\n    'modal-dialog-centered': props.centered,\n    'modal-dialog-scrollable': props.scrollable,\n  },\n])\n\nconst bodyColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.bodyBgVariant,\n  textVariant: props.bodyTextVariant,\n  variant: props.bodyVariant,\n}))\nconst bodyClasses = computed(() => [props.bodyClass, bodyColorClasses.value])\n\nconst headerColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.headerBgVariant,\n  textVariant: props.headerTextVariant,\n  variant: props.headerVariant,\n  borderVariant: props.headerBorderVariant,\n}))\nconst headerClasses = computed(() => [props.headerClass, headerColorClasses.value])\n\nconst headerCloseAttrs = computed(() => ({\n  variant: hasHeaderCloseSlot.value ? props.headerCloseVariant : undefined,\n  class: props.headerCloseClass,\n}))\n\nconst footerColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.footerBgVariant,\n  textVariant: props.footerTextVariant,\n  variant: props.footerVariant,\n  borderVariant: props.footerBorderVariant,\n}))\nconst footerClasses = computed(() => [props.footerClass, footerColorClasses.value])\n\nconst titleClasses = computed(() => [\n  props.titleClass,\n  {\n    ['visually-hidden']: props.titleVisuallyHidden,\n  },\n])\n\nconst disableCancel = computed(() => props.cancelDisabled || props.busy)\nconst disableOk = computed(() => props.okDisabled || props.busy)\n\nconst {activePosition, activeModalCount, stackWithoutSelf} = useModalManager(\n  showRef,\n  modelValue.value\n)\n\nconst sharedClasses = computed(() => ({\n  [`stack-position-${activePosition?.value ?? 0}`]: true,\n  [`stack-inverse-position-${(activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0)}`]: true,\n}))\n\nwatch(stackWithoutSelf, (newValue, oldValue) => {\n  if (newValue.length > oldValue.length && showRef.value === true && props.noStacking) hide()\n})\n\nconst defaultModalDialogZIndex = ref(getModalZIndex(element.value ?? getSafeDocument()?.body))\n\nonMounted(() => {\n  watch(\n    renderRef,\n    (v) => {\n      if (!v) return\n      nextTick(() => {\n        if (!element.value) return\n        defaultModalDialogZIndex.value = getModalZIndex(element.value)\n      })\n    },\n    {immediate: true}\n  )\n})\n\nconst computedZIndexNumber = computed<number>(() =>\n  // Make sure that newly opened modals have a higher z-index than currently active ones.\n  // All active modals have a z-index of ('defaultZIndex' - 'stackSize' - 'positionInStack').\n  //\n  // This means inactive modals will already be higher than active ones when opened.\n\n  showRef.value || isLeaving.value\n    ? // Just for reference there is a single frame in which the modal is not active but still has a higher z-index than the active ones due to _when_ it calculates its position. It's a small visual effect\n      defaultModalDialogZIndex.value -\n      ((activeModalCount?.value ?? 0) * 2 - (activePosition?.value ?? 0) * 2)\n    : defaultModalDialogZIndex.value\n)\nconst computedZIndex = computed<CSSProperties>(() => ({\n  'z-index': computedZIndexNumber.value,\n  '--b-position': activePosition?.value ?? 0,\n  '--b-inverse-position': (activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0),\n  '--b-count': activeModalCount?.value ?? 0,\n}))\nconst computedZIndexBackdrop = computed<CSSProperties>(() => ({\n  'z-index': computedZIndexNumber.value - 1,\n  '--b-position': activePosition?.value ?? 0,\n  '--b-inverse-position': (activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0),\n  '--b-count': activeModalCount?.value ?? 0,\n}))\n\nconst sharedSlots = computed<BModalSlotsData>(() => ({\n  id: computedId.value,\n  cancel: () => {\n    hide('cancel')\n  },\n  close: () => {\n    hide('close')\n  },\n  hide,\n  show,\n  toggle,\n  ok: () => {\n    hide('ok')\n  },\n  active: showRef.value,\n  visible: showRef.value,\n}))\n\ndefineExpose({\n  hide,\n  id: computedId,\n  show,\n  toggle,\n  visible: showRef,\n})\n</script>\n","<template>\n  <ConditionalTeleport :to=\"props.teleportTo\" :disabled=\"props.teleportDisabled\">\n    <Transition\n      v-if=\"renderRef || contentShowing\"\n      v-bind=\"transitionProps\"\n      :appear=\"modelValue || props.visible\"\n    >\n      <div\n        v-show=\"showRef && ((backdropReady && props.backdropFirst) || !props.backdropFirst)\"\n        :id=\"computedId\"\n        ref=\"_element\"\n        class=\"modal\"\n        :class=\"[\n          props.modalClass,\n          {\n            fade: !computedNoAnimation,\n            show: isVisible,\n            ...sharedClasses,\n          },\n        ]\"\n        role=\"dialog\"\n        :aria-labelledby=\"!props.noHeader ? `${computedId}-label` : undefined\"\n        :aria-describedby=\"`${computedId}-body`\"\n        tabindex=\"-1\"\n        v-bind=\"$attrs\"\n        :style=\"computedZIndex\"\n        style=\"display: block\"\n        @mousedown.left.self=\"hide('backdrop')\"\n      >\n        <div class=\"modal-dialog\" :class=\"modalDialogClasses\">\n          <div v-if=\"contentShowing\" class=\"modal-content\" :class=\"props.contentClass\">\n            <div\n              v-if=\"!props.noHeader\"\n              class=\"modal-header\"\n              :class=\"headerClasses\"\n              v-bind=\"props.headerAttrs\"\n            >\n              <slot name=\"header\" v-bind=\"sharedSlots\">\n                <component\n                  :is=\"props.titleTag\"\n                  :id=\"`${computedId}-label`\"\n                  class=\"modal-title\"\n                  :class=\"titleClasses\"\n                >\n                  <slot name=\"title\" v-bind=\"sharedSlots\">\n                    {{ props.title }}\n                  </slot>\n                </component>\n                <template v-if=\"!props.noHeaderClose\">\n                  <BButton\n                    v-if=\"hasHeaderCloseSlot\"\n                    ref=\"_closeButton\"\n                    v-bind=\"headerCloseAttrs\"\n                    @click=\"hide('close')\"\n                  >\n                    <slot name=\"header-close\" v-bind=\"sharedSlots\" />\n                  </BButton>\n                  <BCloseButton\n                    v-else\n                    ref=\"_closeButton\"\n                    :aria-label=\"props.headerCloseLabel\"\n                    v-bind=\"headerCloseAttrs\"\n                    @click=\"hide('close')\"\n                  />\n                </template>\n              </slot>\n            </div>\n            <div\n              :id=\"`${computedId}-body`\"\n              class=\"modal-body\"\n              :class=\"bodyClasses\"\n              v-bind=\"props.bodyAttrs\"\n            >\n              <slot v-bind=\"sharedSlots\">\n                {{ props.body }}\n              </slot>\n            </div>\n            <div v-if=\"!props.noFooter\" class=\"modal-footer\" :class=\"footerClasses\">\n              <slot name=\"footer\" v-bind=\"sharedSlots\">\n                <slot name=\"cancel\" v-bind=\"sharedSlots\">\n                  <BButton\n                    v-if=\"!props.okOnly\"\n                    ref=\"_cancelButton\"\n                    :disabled=\"disableCancel\"\n                    :size=\"props.buttonSize\"\n                    :variant=\"props.cancelVariant\"\n                    :class=\"props.cancelClass\"\n                    @click=\"hide('cancel')\"\n                  >\n                    {{ props.cancelTitle }}\n                  </BButton>\n                </slot>\n                <slot name=\"ok\" v-bind=\"sharedSlots\">\n                  <BButton\n                    ref=\"_okButton\"\n                    :disabled=\"disableOk\"\n                    :size=\"props.buttonSize\"\n                    :variant=\"props.okVariant\"\n                    :class=\"props.okClass\"\n                    @click=\"hide('ok')\"\n                  >\n                    {{ props.okTitle }}\n                  </BButton>\n                </slot>\n              </slot>\n            </div>\n          </div>\n        </div>\n        <div\n          v-if=\"needsFallback\"\n          ref=\"_fallbackFocusElement\"\n          :class=\"fallbackClassSelector\"\n          tabindex=\"0\"\n          style=\"width: 0; height: 0; overflow: hidden\"\n        />\n      </div>\n    </Transition>\n    <slot v-if=\"!props.noBackdrop\" name=\"backdrop\" v-bind=\"sharedSlots\">\n      <Transition v-if=\"renderBackdropRef\" v-bind=\"backdropTransitionProps\">\n        <div\n          v-show=\"showRef || (isLeaving && props.backdropFirst && !computedNoAnimation)\"\n          class=\"modal-backdrop\"\n          :style=\"computedZIndexBackdrop\"\n          :class=\"{\n            fade: !computedNoAnimation,\n            show: backdropVisible || computedNoAnimation,\n            ...sharedClasses,\n          }\"\n          @click=\"hide('backdrop')\"\n        />\n      </Transition>\n    </slot>\n  </ConditionalTeleport>\n</template>\n\n<script setup lang=\"ts\">\nimport {onKeyStroke, unrefElement} from '@vueuse/core'\nimport {useActivatedFocusTrap} from '../../composables/useActivatedFocusTrap'\nimport {\n  computed,\n  type CSSProperties,\n  type EmitFn,\n  nextTick,\n  onMounted,\n  ref,\n  useTemplateRef,\n  watch,\n} from 'vue'\nimport type {BModalSlots, BModalSlotsData, BModalEmits, BModalProps} from '../../types'\n\nimport BButton from '../BButton/BButton.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useSafeScrollLock} from '../../composables/useSafeScrollLock'\nimport {getModalZIndex, getSafeDocument, isEmptySlot} from '../../utils/dom'\nimport {useColorVariantClasses} from '../../composables/useColorVariantClasses'\nimport {useModalManager} from '../../composables/useModalManager'\nimport {useShowHide} from '../../composables/useShowHide'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {getElement} from '../../utils/getElement'\n\ndefineOptions({\n  inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BModalProps, 'modelValue'>>(), {\n  focus: undefined,\n  backdropFirst: false,\n  body: undefined,\n  bodyBgVariant: null,\n  bodyAttrs: undefined,\n  bodyClass: null,\n  bodyScrolling: false,\n  bodyTextVariant: null,\n  bodyVariant: null,\n  busy: false,\n  buttonSize: 'md',\n  cancelClass: undefined,\n  cancelDisabled: false,\n  cancelTitle: 'Cancel',\n  cancelVariant: 'secondary',\n  centered: false,\n  contentClass: undefined,\n  dialogClass: undefined,\n  footerBgVariant: null,\n  footerBorderVariant: null,\n  footerClass: undefined,\n  footerTextVariant: null,\n  footerVariant: null,\n  fullscreen: false,\n  headerAttrs: undefined,\n  headerBgVariant: null,\n  headerBorderVariant: null,\n  headerClass: undefined,\n  headerCloseClass: undefined,\n  headerCloseLabel: 'Close',\n  headerCloseVariant: 'secondary',\n  headerTextVariant: null,\n  headerVariant: null,\n  noFooter: false,\n  noHeader: false,\n  noHeaderClose: false,\n  id: undefined,\n  initialAnimation: false,\n  lazy: false,\n  modalClass: undefined,\n  noBackdrop: false,\n  noCloseOnBackdrop: false,\n  noCloseOnEsc: false,\n  noFade: false,\n  noTrap: false,\n  okClass: undefined,\n  okDisabled: false,\n  okOnly: false,\n  okTitle: 'OK',\n  okVariant: 'primary',\n  unmountLazy: false,\n  scrollable: false,\n  size: 'md',\n  teleportDisabled: false,\n  teleportTo: 'body',\n  title: undefined,\n  titleClass: undefined,\n  titleVisuallyHidden: false,\n  titleTag: 'h5',\n  show: false,\n  transProps: undefined,\n  visible: false,\n})\nconst props = useDefaults(_props, 'BModal')\nconst emit = defineEmits<BModalEmits>()\nconst slots = defineSlots<BModalSlots>()\n\nconst computedId = useId(() => props.id, 'modal')\n// Note: passive: true will sync an internal ref... This is required for useModalManager to exit,\n// Since the modelValue that's passed from that composable is not reactive, this internal ref _is_ and thus it will trigger closing the modal\nconst modelValue = defineModel<Exclude<BModalProps['modelValue'], undefined>>({default: false})\n\nconst element = useTemplateRef<HTMLElement | null>('_element')\nconst fallbackFocusElement = useTemplateRef<HTMLElement | null>('_fallbackFocusElement')\nconst okButton = useTemplateRef<HTMLElement | null>('_okButton')\nconst cancelButton = useTemplateRef<HTMLElement | null>('_cancelButton')\nconst closeButton = useTemplateRef<HTMLElement | null>('_closeButton')\n\nconst pickFocusItem = () => {\n  if (props.focus && typeof props.focus !== 'boolean') {\n    if (props.focus === 'ok') {\n      return okButton\n    } else if (props.focus === 'close') {\n      return closeButton\n    } else if (props.focus === 'cancel') {\n      return cancelButton\n    }\n    return getElement(props.focus, element.value ?? undefined) ?? element.value\n  }\n  return element\n}\n\nlet activeElement: HTMLElement | null = null\nconst onAfterEnter = () => {\n  const doc = getSafeDocument()\n  if (props.noTrap && props.focus !== false && doc) {\n    // Hypothetically this could be an issue\n    activeElement = doc.activeElement as HTMLElement\n    if (activeElement === element.value) {\n      activeElement = null\n    }\n    const el = unrefElement(pickFocusItem())\n    if (!el) return\n    el?.focus()\n    if (\n      el.tagName &&\n      el.tagName.toLowerCase() === 'input' &&\n      typeof (el as HTMLInputElement).select === 'function'\n    ) {\n      ;(el as HTMLInputElement).select()\n    }\n  }\n}\n\nconst onAfterLeave = () => {\n  if (props.noTrap && props.focus !== false && activeElement) {\n    activeElement?.focus()\n    activeElement = null\n  }\n}\n\nconst {\n  showRef,\n  renderRef,\n  renderBackdropRef,\n  hide,\n  show,\n  toggle,\n  computedNoAnimation,\n  transitionProps,\n  backdropTransitionProps,\n  isLeaving,\n  isVisible,\n  trapActive,\n  contentShowing,\n  backdropReady,\n  backdropVisible,\n} = useShowHide(modelValue, props, emit as EmitFn, element, computedId, {\n  // addShowClass: false,\n  transitionProps: {\n    onAfterEnter,\n    onAfterLeave,\n  },\n})\n\nconst fallbackClassSelector = 'modal-fallback-focus'\nconst {needsFallback} = useActivatedFocusTrap({\n  element,\n  isActive: trapActive,\n  noTrap: () => props.noTrap,\n  fallbackFocus: {\n    ref: fallbackFocusElement,\n    classSelector: fallbackClassSelector,\n  },\n  focus: () => (props.focus === false ? false : (unrefElement(pickFocusItem()) ?? undefined)),\n  // () => (typeof focus === 'boolean' ? focus : (unrefElement(focus) ?? undefined)),\n})\n\nonKeyStroke(\n  'Escape',\n  () => {\n    hide('esc')\n  },\n  {target: element}\n)\nuseSafeScrollLock(showRef, () => props.bodyScrolling)\n\nconst hasHeaderCloseSlot = computed(() => !isEmptySlot(slots['header-close']))\n\nconst modalDialogClasses = computed(() => [\n  props.dialogClass,\n  {\n    'modal-fullscreen': props.fullscreen === true,\n    [`modal-fullscreen-${props.fullscreen}-down`]: typeof props.fullscreen === 'string',\n    [`modal-${props.size}`]: props.size !== 'md',\n    'modal-dialog-centered': props.centered,\n    'modal-dialog-scrollable': props.scrollable,\n  },\n])\n\nconst bodyColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.bodyBgVariant,\n  textVariant: props.bodyTextVariant,\n  variant: props.bodyVariant,\n}))\nconst bodyClasses = computed(() => [props.bodyClass, bodyColorClasses.value])\n\nconst headerColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.headerBgVariant,\n  textVariant: props.headerTextVariant,\n  variant: props.headerVariant,\n  borderVariant: props.headerBorderVariant,\n}))\nconst headerClasses = computed(() => [props.headerClass, headerColorClasses.value])\n\nconst headerCloseAttrs = computed(() => ({\n  variant: hasHeaderCloseSlot.value ? props.headerCloseVariant : undefined,\n  class: props.headerCloseClass,\n}))\n\nconst footerColorClasses = useColorVariantClasses(() => ({\n  bgVariant: props.footerBgVariant,\n  textVariant: props.footerTextVariant,\n  variant: props.footerVariant,\n  borderVariant: props.footerBorderVariant,\n}))\nconst footerClasses = computed(() => [props.footerClass, footerColorClasses.value])\n\nconst titleClasses = computed(() => [\n  props.titleClass,\n  {\n    ['visually-hidden']: props.titleVisuallyHidden,\n  },\n])\n\nconst disableCancel = computed(() => props.cancelDisabled || props.busy)\nconst disableOk = computed(() => props.okDisabled || props.busy)\n\nconst {activePosition, activeModalCount, stackWithoutSelf} = useModalManager(\n  showRef,\n  modelValue.value\n)\n\nconst sharedClasses = computed(() => ({\n  [`stack-position-${activePosition?.value ?? 0}`]: true,\n  [`stack-inverse-position-${(activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0)}`]: true,\n}))\n\nwatch(stackWithoutSelf, (newValue, oldValue) => {\n  if (newValue.length > oldValue.length && showRef.value === true && props.noStacking) hide()\n})\n\nconst defaultModalDialogZIndex = ref(getModalZIndex(element.value ?? getSafeDocument()?.body))\n\nonMounted(() => {\n  watch(\n    renderRef,\n    (v) => {\n      if (!v) return\n      nextTick(() => {\n        if (!element.value) return\n        defaultModalDialogZIndex.value = getModalZIndex(element.value)\n      })\n    },\n    {immediate: true}\n  )\n})\n\nconst computedZIndexNumber = computed<number>(() =>\n  // Make sure that newly opened modals have a higher z-index than currently active ones.\n  // All active modals have a z-index of ('defaultZIndex' - 'stackSize' - 'positionInStack').\n  //\n  // This means inactive modals will already be higher than active ones when opened.\n\n  showRef.value || isLeaving.value\n    ? // Just for reference there is a single frame in which the modal is not active but still has a higher z-index than the active ones due to _when_ it calculates its position. It's a small visual effect\n      defaultModalDialogZIndex.value -\n      ((activeModalCount?.value ?? 0) * 2 - (activePosition?.value ?? 0) * 2)\n    : defaultModalDialogZIndex.value\n)\nconst computedZIndex = computed<CSSProperties>(() => ({\n  'z-index': computedZIndexNumber.value,\n  '--b-position': activePosition?.value ?? 0,\n  '--b-inverse-position': (activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0),\n  '--b-count': activeModalCount?.value ?? 0,\n}))\nconst computedZIndexBackdrop = computed<CSSProperties>(() => ({\n  'z-index': computedZIndexNumber.value - 1,\n  '--b-position': activePosition?.value ?? 0,\n  '--b-inverse-position': (activeModalCount?.value ?? 1) - 1 - (activePosition?.value ?? 0),\n  '--b-count': activeModalCount?.value ?? 0,\n}))\n\nconst sharedSlots = computed<BModalSlotsData>(() => ({\n  id: computedId.value,\n  cancel: () => {\n    hide('cancel')\n  },\n  close: () => {\n    hide('close')\n  },\n  hide,\n  show,\n  toggle,\n  ok: () => {\n    hide('ok')\n  },\n  active: showRef.value,\n  visible: showRef.value,\n}))\n\ndefineExpose({\n  hide,\n  id: computedId,\n  show,\n  toggle,\n  visible: showRef,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAM,qBAAqB;AAE3B,IAAa,4BAA4B;CACvC,MAAM,qBAAqB,OAAO,iBAAiB,KAAK;;;;CAKxD,MAAM,WAAW,UAAqD;AACpE,sBAAoB,YAAY,MAAM;AACtC,sBAAoB,eAAe,MAAM;;CAG3C,MAAM,kBAAkB,cAAc,oBAAoB,UAAU,WAAW,UAAU;EACvF,MAAM,KACJ,OAAO,aAAa,WAChB,aAAa,SAAS,GACtB,WACE,iBAAiB,EAAE,cAAc,SAAS,GAC1C,KAAA;AACR,MAAI,CAAC,GAAI;AAET,MAAI,cAAc,QAChB,IAAG,UAAU,OAAO,oBAAoB,UAAU,mBAAmB;MAErE,IAAG,aAAa,WAAW,MAAM;GAEnC;AAEF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