{"version":3,"file":"BPagination-CvoSN1He.mjs","names":[],"sources":["../src/components/BPagination/BPagination.vue","../src/components/BPagination/BPagination.vue"],"sourcesContent":["<template>\n  <ul\n    class=\"pagination\"\n    :class=\"computedWrapperClasses\"\n    role=\"menubar\"\n    :aria-disabled=\"props.disabled\"\n    :aria-label=\"props.ariaLabel || undefined\"\n    @keydown=\"handleKeyNav\"\n  >\n    <li\n      v-for=\"(page, index) in pages\"\n      :key=\"`page-${page.id}`\"\n      v-bind=\"page.li\"\n      ref=\"_pageElements\"\n      :displayIndex=\"index\"\n    >\n      <span\n        v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n        v-bind=\"ellipsisProps.span\"\n      >\n        <slot name=\"ellipsis-text\">\n          {{ props.ellipsisText || '...' }}\n        </slot>\n      </span>\n      <component\n        v-bind=\"page.button\"\n        :is=\"page.button.is\"\n        v-else-if=\"'button' in page\"\n        @click=\"page.clickHandler\"\n      >\n        <slot\n          :name=\"page.text.name\"\n          :disabled=\"page.text.disabled\"\n          :page=\"page.text.page\"\n          :index=\"page.text.index\"\n          :active=\"page.text.active ?? false\"\n          :content=\"page.text.value\"\n        >\n          {{ page.text.value }}\n        </slot>\n      </component>\n    </li>\n  </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationSlots, type BPaginationProps} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n  align: 'start',\n  ariaControls: undefined,\n  ariaLabel: 'Pagination',\n  disabled: false,\n  ellipsisClass: undefined,\n  ellipsisText: '\\u2026',\n  firstClass: undefined,\n  firstNumber: false,\n  firstText: '\\u00AB',\n  noEllipsis: false,\n  noGotoEndButtons: false,\n  labelFirstPage: 'Go to first page',\n  labelLastPage: 'Go to last page',\n  labelNextPage: 'Go to next page',\n  labelPage: 'Go to page',\n  labelPrevPage: 'Go to previous page',\n  lastClass: undefined,\n  lastNumber: false,\n  lastText: '\\u00BB',\n  limit: 5,\n  nextClass: undefined,\n  nextText: '\\u203A',\n  pageClass: undefined,\n  perPage: DEFAULT_PER_PAGE,\n  pills: false,\n  prevClass: undefined,\n  prevText: '\\u2039',\n  size: undefined,\n  totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n  default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n  props.disabled ||\n  isActivePage(num) ||\n  computedModelValue.value < 1 ||\n  // Check if the number is out of bounds\n  num < 1 ||\n  num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n  page,\n  classVal,\n  disabled,\n  slotName,\n  textValue,\n  tabIndex,\n  label,\n  position,\n  isActive,\n  hidden,\n  isSmHidden,\n}: {\n  page: number\n  disabled: boolean\n  classVal: ClassValue\n  slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n  textValue?: string\n  tabIndex?: string\n  label?: string\n  position?: number\n  isActive?: boolean\n  hidden?: boolean\n  isSmHidden?: boolean\n}) => ({\n  li: {\n    'class': [\n      'page-item',\n      {\n        'active': isActive,\n        disabled,\n        'bv-d-sm-down-none': isSmHidden,\n        'flex-fill': computedFill.value,\n        'd-flex': computedFill.value && !disabled,\n      },\n      classVal,\n    ],\n    'role': 'presentation',\n    'aria-hidden': hidden,\n  },\n  button: {\n    'is': disabled ? 'span' : 'button',\n    'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n    'aria-label': label,\n    'aria-controls': props.ariaControls || undefined,\n    'aria-disabled': disabled ? true : undefined,\n    'aria-posinset': position,\n    'aria-setsize': position ? numberOfPages.value : undefined,\n    'role': 'menuitem',\n    'type': disabled ? undefined : 'button',\n    'tabindex': disabled ? undefined : tabIndex,\n  },\n  text: {\n    name: slotName,\n    active: isActive,\n    value: textValue ?? page,\n    page,\n    disabled,\n    index: page - 1,\n    content: textValue ? undefined : String(page),\n  },\n  clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n  page,\n  classVal,\n  disabled,\n  slotName,\n  textValue,\n  label,\n}: {\n  page: number\n  disabled: boolean\n  classVal: ClassValue\n  slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n  textValue?: string\n  label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n  getBaseButtonProps({\n    page,\n    disabled: props.disabled,\n    classVal: props.pageClass,\n    slotName: 'page',\n    label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n    tabIndex: getTabIndex(page) ?? undefined,\n    position: page,\n    isActive: isActivePage(page),\n    isSmHidden,\n  })\n\nconst firstButtonProps = computed(() =>\n  getButtonProps({\n    page: 1,\n    disabled: firstDisabled.value,\n    classVal: props.firstClass,\n    slotName: 'first-text',\n    textValue: props.firstText,\n    label: props.labelFirstPage,\n  })\n)\nconst prevButtonProps = computed(() =>\n  getButtonProps({\n    page: Math.max(computedModelValue.value - 1, 1),\n    disabled: prevDisabled.value,\n    classVal: props.prevClass,\n    slotName: 'prev-text',\n    textValue: props.prevText,\n    label: props.labelPrevPage,\n  })\n)\nconst nextButtonProps = computed(() =>\n  getButtonProps({\n    page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n    disabled: nextDisabled.value,\n    classVal: props.nextClass,\n    slotName: 'next-text',\n    textValue: props.nextText,\n    label: props.labelNextPage,\n  })\n)\nconst lastButtonProps = computed(() =>\n  getButtonProps({\n    page: numberOfPages.value,\n    disabled: lastDisabled.value,\n    classVal: props.lastClass,\n    slotName: 'last-text',\n    textValue: props.lastText,\n    label: props.labelLastPage,\n  })\n)\n\nconst ellipsisProps = computed(() => ({\n  li: {\n    class: [\n      'page-item',\n      'disabled',\n      'text-center',\n      'bv-d-sm-down-none',\n      computedFill.value ? 'flex-fill' : '',\n      props.ellipsisClass,\n    ],\n    role: 'separator',\n  },\n  span: {\n    class: ['page-link'],\n  },\n}))\n\nconst computedWrapperClasses = computed(() => [\n  alignment.value,\n  {\n    [`pagination-${props.size}`]: props.size !== undefined,\n    'b-pagination-pills': props.pills,\n  },\n])\n\nconst pagination = computed(() => ({\n  pageSize: perPageSanitized.value,\n  totalRows: totalRowsNumber.value,\n  numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n  if (pageNumber === computedModelValue.value) return\n  const clickEvent = new BvEvent('page-click', {\n    cancelable: true,\n    target: event.target,\n  })\n  emit('page-click', clickEvent, pageNumber)\n\n  if (clickEvent.defaultPrevented) return\n\n  modelValue.value = pageNumber\n\n  nextTick(() => {\n    if (pageNumber === 1) {\n      focusFirst()\n    } else if (pageNumber === pagination.value.numberOfPages) {\n      focusLast()\n    }\n  })\n  //    nextTick(() => {\n  //  if (isVisible(target) && un_element.contains(target)) {\n  //  attemptFocus(target)\n  //} else {\n  //this.focusCurrent()\n  //}\n  // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n  const isElement = el && el.nodeType === Node.ELEMENT_NODE\n  const hasAttr = isElement ? el.hasAttribute('disabled') : null\n  const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n  return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n  [...(pageElements.value ?? [])]\n    .sort(\n      (a, b) =>\n        Number.parseInt(a.getAttribute('displayIndex') || '0') -\n        Number.parseInt(b.getAttribute('displayIndex') || '0')\n    )\n    .map((page) => page.children[0])\n    .filter((el) => {\n      if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n        return false\n      }\n\n      const bcr = el?.getBoundingClientRect()\n\n      return !!(bcr && bcr.height > 0 && bcr.width > 0)\n    })\n    .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n  nextTick(() => {\n    const btn = getButtons().find((el) => !isDisabled(el))\n    btn?.focus()\n  })\n}\n\nconst focusPrev = () => {\n  nextTick(() => {\n    const buttons = getButtons()\n    const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n    const button = buttons[index - 1]\n    if (index > 0 && button !== undefined && !isDisabled(button)) {\n      buttons[index - 1]?.focus()\n    }\n  })\n}\n\nconst focusLast = () => {\n  nextTick(() => {\n    const btn = getButtons()\n      .reverse()\n      .find((el) => !isDisabled(el))\n    btn?.focus()\n  })\n}\n\nconst focusNext = () => {\n  nextTick(() => {\n    const buttons = getButtons()\n    const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n    const button = buttons[index + 1]\n    if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n      buttons[index + 1]?.focus()\n    }\n  })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n  const {code, shiftKey} = event\n  if (code === CODE_LEFT || code === CODE_UP) {\n    event.preventDefault()\n    if (shiftKey) {\n      focusFirst()\n    } else {\n      focusPrev()\n    }\n  } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n    event.preventDefault()\n    if (shiftKey) {\n      focusLast()\n    } else {\n      focusNext()\n    }\n  }\n}\n\nconst computedModelValue = computed(() => {\n  const page = modelValueNumber.value || 1\n  return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n  if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n    // If the page size changes, reset to page 1\n    modelValue.value = 1\n  }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n  const {value} = computedModelValue\n\n  const els = elements.value.map((p) => {\n    switch (p) {\n      case FIRST_BUTTON:\n        return {id: p, ...firstButtonProps.value}\n      case PREV_BUTTON:\n        return {id: p, ...prevButtonProps.value}\n      case NEXT_BUTTON:\n        return {id: p, ...nextButtonProps.value}\n      case LAST_BUTTON:\n        return {id: p, ...lastButtonProps.value}\n      case FIRST_ELLIPSIS:\n      case LAST_ELLIPSIS:\n        return {id: p, ...ellipsisProps.value}\n      default:\n        return {id: p, ...getPageButtonProps(p)}\n    }\n  })\n\n  if (numberOfPages.value > 3) {\n    if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n      const idx = 2 + showFirstButton.value\n      const el = els[idx]\n      if (el !== undefined) {\n        els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n      }\n    }\n\n    if (value <= halfLimit.value + firstPage.value) {\n      const idx = els.length - (3 + showLastButton.value)\n      const el = els[idx]\n      if (el !== undefined) {\n        els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n      }\n    }\n  }\n\n  return els\n})\n\nconst elements = computed(() => {\n  // The idea here is to create an array of all the buttons on the page control.\n  // This way we can keep the invariants in one place and the template code just\n  // iterates over the array.\n\n  const pages = numberOfPages.value\n  const {value} = computedModelValue\n  const limit = limitNumber.value\n  const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n  // The first case is when all of the page buttons fit on the control, this is\n  //  the simplest case and the only one that will create an array smaller than\n  //  Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n  if (pages < limit + firstPage.value + lastPage.value) {\n    return [\n      !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n      PREV_BUTTON,\n      ...Array.from({length: pages}, (_, index) => index + 1),\n      NEXT_BUTTON,\n      !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n    ].filter((x) => x !== null) as number[]\n  }\n\n  // All of the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n  //  the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n  const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n  if (!noFirstButton.value) {\n    if (!firstPage.value) {\n      buttons[0] = FIRST_BUTTON\n      buttons[1] = PREV_BUTTON\n    } else {\n      buttons[0] = PREV_BUTTON\n      buttons[1] = 1\n    }\n  } else {\n    buttons[0] = PREV_BUTTON\n  }\n\n  if (!noLastButton.value) {\n    if (!lastPage.value) {\n      buttons[buttons.length - 1] = LAST_BUTTON\n      buttons[buttons.length - 2] = NEXT_BUTTON\n    } else {\n      buttons[buttons.length - 1] = NEXT_BUTTON\n      buttons[buttons.length - 2] = pages\n    }\n  } else {\n    buttons[buttons.length - 1] = NEXT_BUTTON\n  }\n\n  // The next case is where the page buttons start at the begginning, with\n  //  no ellipsis at the beginning, but one at the end\n\n  if (value <= halfLimit.value + firstPage.value) {\n    for (let index = 1; index <= limit; index++) {\n      buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n    }\n\n    if (!noEllipsis) {\n      buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n    }\n  }\n\n  // And then we have the case where the page buttons go up to the end, with no\n  //  ellipsis at the end, but one at the beginning\n\n  if (value > pages - halfLimit.value - lastPage.value) {\n    const start = pages - (limit - 1) - lastPage.value\n    for (let index = 0; index < limit; index++) {\n      buttons[index + 2 - noFirstButton.value] = start + index\n    }\n\n    if (!noEllipsis) {\n      buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n    }\n  }\n\n  // Finally we have the case where we have ellipsis at both ends\n  if (!buttons[2]) {\n    // Is there a more elegant way to ceck that we're in the final case?\n    const start = value - Math.floor(limit / 2)\n    for (let index = 0; index < limit; index++) {\n      buttons[index + 2 - noFirstButton.value] = start + index\n    }\n\n    if (!noEllipsis) {\n      buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n      buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n    }\n  }\n\n  //Enable sanity check for debugging purposes\n  // for (let i = 0; i < buttons.length; i++) {\n  //   if (!buttons[i]) {\n  //     // eslint-disable-next-line no-console\n  //     console.log(\n  //       `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n  //     )\n  //   }\n  // }\n\n  return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n","<template>\n  <ul\n    class=\"pagination\"\n    :class=\"computedWrapperClasses\"\n    role=\"menubar\"\n    :aria-disabled=\"props.disabled\"\n    :aria-label=\"props.ariaLabel || undefined\"\n    @keydown=\"handleKeyNav\"\n  >\n    <li\n      v-for=\"(page, index) in pages\"\n      :key=\"`page-${page.id}`\"\n      v-bind=\"page.li\"\n      ref=\"_pageElements\"\n      :displayIndex=\"index\"\n    >\n      <span\n        v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n        v-bind=\"ellipsisProps.span\"\n      >\n        <slot name=\"ellipsis-text\">\n          {{ props.ellipsisText || '...' }}\n        </slot>\n      </span>\n      <component\n        v-bind=\"page.button\"\n        :is=\"page.button.is\"\n        v-else-if=\"'button' in page\"\n        @click=\"page.clickHandler\"\n      >\n        <slot\n          :name=\"page.text.name\"\n          :disabled=\"page.text.disabled\"\n          :page=\"page.text.page\"\n          :index=\"page.text.index\"\n          :active=\"page.text.active ?? false\"\n          :content=\"page.text.value\"\n        >\n          {{ page.text.value }}\n        </slot>\n      </component>\n    </li>\n  </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationSlots, type BPaginationProps} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n  align: 'start',\n  ariaControls: undefined,\n  ariaLabel: 'Pagination',\n  disabled: false,\n  ellipsisClass: undefined,\n  ellipsisText: '\\u2026',\n  firstClass: undefined,\n  firstNumber: false,\n  firstText: '\\u00AB',\n  noEllipsis: false,\n  noGotoEndButtons: false,\n  labelFirstPage: 'Go to first page',\n  labelLastPage: 'Go to last page',\n  labelNextPage: 'Go to next page',\n  labelPage: 'Go to page',\n  labelPrevPage: 'Go to previous page',\n  lastClass: undefined,\n  lastNumber: false,\n  lastText: '\\u00BB',\n  limit: 5,\n  nextClass: undefined,\n  nextText: '\\u203A',\n  pageClass: undefined,\n  perPage: DEFAULT_PER_PAGE,\n  pills: false,\n  prevClass: undefined,\n  prevText: '\\u2039',\n  size: undefined,\n  totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n  default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n  props.disabled ||\n  isActivePage(num) ||\n  computedModelValue.value < 1 ||\n  // Check if the number is out of bounds\n  num < 1 ||\n  num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n  page,\n  classVal,\n  disabled,\n  slotName,\n  textValue,\n  tabIndex,\n  label,\n  position,\n  isActive,\n  hidden,\n  isSmHidden,\n}: {\n  page: number\n  disabled: boolean\n  classVal: ClassValue\n  slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n  textValue?: string\n  tabIndex?: string\n  label?: string\n  position?: number\n  isActive?: boolean\n  hidden?: boolean\n  isSmHidden?: boolean\n}) => ({\n  li: {\n    'class': [\n      'page-item',\n      {\n        'active': isActive,\n        disabled,\n        'bv-d-sm-down-none': isSmHidden,\n        'flex-fill': computedFill.value,\n        'd-flex': computedFill.value && !disabled,\n      },\n      classVal,\n    ],\n    'role': 'presentation',\n    'aria-hidden': hidden,\n  },\n  button: {\n    'is': disabled ? 'span' : 'button',\n    'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n    'aria-label': label,\n    'aria-controls': props.ariaControls || undefined,\n    'aria-disabled': disabled ? true : undefined,\n    'aria-posinset': position,\n    'aria-setsize': position ? numberOfPages.value : undefined,\n    'role': 'menuitem',\n    'type': disabled ? undefined : 'button',\n    'tabindex': disabled ? undefined : tabIndex,\n  },\n  text: {\n    name: slotName,\n    active: isActive,\n    value: textValue ?? page,\n    page,\n    disabled,\n    index: page - 1,\n    content: textValue ? undefined : String(page),\n  },\n  clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n  page,\n  classVal,\n  disabled,\n  slotName,\n  textValue,\n  label,\n}: {\n  page: number\n  disabled: boolean\n  classVal: ClassValue\n  slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n  textValue?: string\n  label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n  getBaseButtonProps({\n    page,\n    disabled: props.disabled,\n    classVal: props.pageClass,\n    slotName: 'page',\n    label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n    tabIndex: getTabIndex(page) ?? undefined,\n    position: page,\n    isActive: isActivePage(page),\n    isSmHidden,\n  })\n\nconst firstButtonProps = computed(() =>\n  getButtonProps({\n    page: 1,\n    disabled: firstDisabled.value,\n    classVal: props.firstClass,\n    slotName: 'first-text',\n    textValue: props.firstText,\n    label: props.labelFirstPage,\n  })\n)\nconst prevButtonProps = computed(() =>\n  getButtonProps({\n    page: Math.max(computedModelValue.value - 1, 1),\n    disabled: prevDisabled.value,\n    classVal: props.prevClass,\n    slotName: 'prev-text',\n    textValue: props.prevText,\n    label: props.labelPrevPage,\n  })\n)\nconst nextButtonProps = computed(() =>\n  getButtonProps({\n    page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n    disabled: nextDisabled.value,\n    classVal: props.nextClass,\n    slotName: 'next-text',\n    textValue: props.nextText,\n    label: props.labelNextPage,\n  })\n)\nconst lastButtonProps = computed(() =>\n  getButtonProps({\n    page: numberOfPages.value,\n    disabled: lastDisabled.value,\n    classVal: props.lastClass,\n    slotName: 'last-text',\n    textValue: props.lastText,\n    label: props.labelLastPage,\n  })\n)\n\nconst ellipsisProps = computed(() => ({\n  li: {\n    class: [\n      'page-item',\n      'disabled',\n      'text-center',\n      'bv-d-sm-down-none',\n      computedFill.value ? 'flex-fill' : '',\n      props.ellipsisClass,\n    ],\n    role: 'separator',\n  },\n  span: {\n    class: ['page-link'],\n  },\n}))\n\nconst computedWrapperClasses = computed(() => [\n  alignment.value,\n  {\n    [`pagination-${props.size}`]: props.size !== undefined,\n    'b-pagination-pills': props.pills,\n  },\n])\n\nconst pagination = computed(() => ({\n  pageSize: perPageSanitized.value,\n  totalRows: totalRowsNumber.value,\n  numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n  if (pageNumber === computedModelValue.value) return\n  const clickEvent = new BvEvent('page-click', {\n    cancelable: true,\n    target: event.target,\n  })\n  emit('page-click', clickEvent, pageNumber)\n\n  if (clickEvent.defaultPrevented) return\n\n  modelValue.value = pageNumber\n\n  nextTick(() => {\n    if (pageNumber === 1) {\n      focusFirst()\n    } else if (pageNumber === pagination.value.numberOfPages) {\n      focusLast()\n    }\n  })\n  //    nextTick(() => {\n  //  if (isVisible(target) && un_element.contains(target)) {\n  //  attemptFocus(target)\n  //} else {\n  //this.focusCurrent()\n  //}\n  // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n  const isElement = el && el.nodeType === Node.ELEMENT_NODE\n  const hasAttr = isElement ? el.hasAttribute('disabled') : null\n  const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n  return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n  [...(pageElements.value ?? [])]\n    .sort(\n      (a, b) =>\n        Number.parseInt(a.getAttribute('displayIndex') || '0') -\n        Number.parseInt(b.getAttribute('displayIndex') || '0')\n    )\n    .map((page) => page.children[0])\n    .filter((el) => {\n      if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n        return false\n      }\n\n      const bcr = el?.getBoundingClientRect()\n\n      return !!(bcr && bcr.height > 0 && bcr.width > 0)\n    })\n    .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n  nextTick(() => {\n    const btn = getButtons().find((el) => !isDisabled(el))\n    btn?.focus()\n  })\n}\n\nconst focusPrev = () => {\n  nextTick(() => {\n    const buttons = getButtons()\n    const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n    const button = buttons[index - 1]\n    if (index > 0 && button !== undefined && !isDisabled(button)) {\n      buttons[index - 1]?.focus()\n    }\n  })\n}\n\nconst focusLast = () => {\n  nextTick(() => {\n    const btn = getButtons()\n      .reverse()\n      .find((el) => !isDisabled(el))\n    btn?.focus()\n  })\n}\n\nconst focusNext = () => {\n  nextTick(() => {\n    const buttons = getButtons()\n    const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n    const button = buttons[index + 1]\n    if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n      buttons[index + 1]?.focus()\n    }\n  })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n  const {code, shiftKey} = event\n  if (code === CODE_LEFT || code === CODE_UP) {\n    event.preventDefault()\n    if (shiftKey) {\n      focusFirst()\n    } else {\n      focusPrev()\n    }\n  } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n    event.preventDefault()\n    if (shiftKey) {\n      focusLast()\n    } else {\n      focusNext()\n    }\n  }\n}\n\nconst computedModelValue = computed(() => {\n  const page = modelValueNumber.value || 1\n  return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n  if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n    // If the page size changes, reset to page 1\n    modelValue.value = 1\n  }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n  const {value} = computedModelValue\n\n  const els = elements.value.map((p) => {\n    switch (p) {\n      case FIRST_BUTTON:\n        return {id: p, ...firstButtonProps.value}\n      case PREV_BUTTON:\n        return {id: p, ...prevButtonProps.value}\n      case NEXT_BUTTON:\n        return {id: p, ...nextButtonProps.value}\n      case LAST_BUTTON:\n        return {id: p, ...lastButtonProps.value}\n      case FIRST_ELLIPSIS:\n      case LAST_ELLIPSIS:\n        return {id: p, ...ellipsisProps.value}\n      default:\n        return {id: p, ...getPageButtonProps(p)}\n    }\n  })\n\n  if (numberOfPages.value > 3) {\n    if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n      const idx = 2 + showFirstButton.value\n      const el = els[idx]\n      if (el !== undefined) {\n        els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n      }\n    }\n\n    if (value <= halfLimit.value + firstPage.value) {\n      const idx = els.length - (3 + showLastButton.value)\n      const el = els[idx]\n      if (el !== undefined) {\n        els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n      }\n    }\n  }\n\n  return els\n})\n\nconst elements = computed(() => {\n  // The idea here is to create an array of all the buttons on the page control.\n  // This way we can keep the invariants in one place and the template code just\n  // iterates over the array.\n\n  const pages = numberOfPages.value\n  const {value} = computedModelValue\n  const limit = limitNumber.value\n  const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n  // The first case is when all of the page buttons fit on the control, this is\n  //  the simplest case and the only one that will create an array smaller than\n  //  Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n  if (pages < limit + firstPage.value + lastPage.value) {\n    return [\n      !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n      PREV_BUTTON,\n      ...Array.from({length: pages}, (_, index) => index + 1),\n      NEXT_BUTTON,\n      !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n    ].filter((x) => x !== null) as number[]\n  }\n\n  // All of the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n  //  the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n  const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n  if (!noFirstButton.value) {\n    if (!firstPage.value) {\n      buttons[0] = FIRST_BUTTON\n      buttons[1] = PREV_BUTTON\n    } else {\n      buttons[0] = PREV_BUTTON\n      buttons[1] = 1\n    }\n  } else {\n    buttons[0] = PREV_BUTTON\n  }\n\n  if (!noLastButton.value) {\n    if (!lastPage.value) {\n      buttons[buttons.length - 1] = LAST_BUTTON\n      buttons[buttons.length - 2] = NEXT_BUTTON\n    } else {\n      buttons[buttons.length - 1] = NEXT_BUTTON\n      buttons[buttons.length - 2] = pages\n    }\n  } else {\n    buttons[buttons.length - 1] = NEXT_BUTTON\n  }\n\n  // The next case is where the page buttons start at the begginning, with\n  //  no ellipsis at the beginning, but one at the end\n\n  if (value <= halfLimit.value + firstPage.value) {\n    for (let index = 1; index <= limit; index++) {\n      buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n    }\n\n    if (!noEllipsis) {\n      buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n    }\n  }\n\n  // And then we have the case where the page buttons go up to the end, with no\n  //  ellipsis at the end, but one at the beginning\n\n  if (value > pages - halfLimit.value - lastPage.value) {\n    const start = pages - (limit - 1) - lastPage.value\n    for (let index = 0; index < limit; index++) {\n      buttons[index + 2 - noFirstButton.value] = start + index\n    }\n\n    if (!noEllipsis) {\n      buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n    }\n  }\n\n  // Finally we have the case where we have ellipsis at both ends\n  if (!buttons[2]) {\n    // Is there a more elegant way to ceck that we're in the final case?\n    const start = value - Math.floor(limit / 2)\n    for (let index = 0; index < limit; index++) {\n      buttons[index + 2 - noFirstButton.value] = start + index\n    }\n\n    if (!noEllipsis) {\n      buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n      buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n    }\n  }\n\n  //Enable sanity check for debugging purposes\n  // for (let i = 0; i < buttons.length; i++) {\n  //   if (!buttons[i]) {\n  //     // eslint-disable-next-line no-console\n  //     console.log(\n  //       `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n  //     )\n  //   }\n  // }\n\n  return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n"],"mappings":";;;;;;;;;;;AA0kBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAlhB3B,MAAM,qBAAqB;EAE3B,MAAM,eAAe;EACrB,MAAM,cAAc;EACpB,MAAM,cAAc;EACpB,MAAM,cAAc;EACpB,MAAM,iBAAiB;EACvB,MAAM,gBAAgB;EAiCtB,MAAM,QAAQ,YA/BC,SA+BmB,cAAa;EAC/C,MAAM,OAAO;EAGb,MAAM,aAAa,SAA+D,SAAA,aAEjF;EAED,MAAM,eAAe,eAAe,gBAAe;EAEnD,MAAM,cAAc,kBAAkB,MAAM,OAAO;GAAC,WAAW;GAAM,QAAQ;GAAW,CAAA;EACxF,MAAM,gBAAgB,kB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