function getThumbBounds(index, itemData, instance) {
  // legacy event, before filters were introduced
  const event = instance.dispatch('thumbBounds', {
    index,
    itemData,
    instance
  }); // @ts-expect-error

  if (event.thumbBounds) {
    // @ts-expect-error
    return event.thumbBounds;
  }

  const {
    element
  } = itemData;
  /** @type {Bounds | undefined} */

  let thumbBounds;
  /** @type {HTMLElement | null | undefined} */

  let thumbnail;

  if (element && instance.options.thumbSelector !== false) {
    const thumbSelector = instance.options.thumbSelector || 'img';
    thumbnail = element.matches(thumbSelector) ? element :
    /** @type {HTMLElement | null} */
    element.querySelector(thumbSelector);
  }

  thumbnail = instance.applyFilters('thumbEl', thumbnail, itemData, index);

  if (thumbnail) {
    if (!itemData.thumbCropped) {
      thumbBounds = getBoundsByElement(thumbnail);
    } else {
      thumbBounds = getCroppedBoundsByElement(thumbnail, itemData.width || itemData.w || 0, itemData.height || itemData.h || 0);
    }
  }

  return instance.applyFilters('thumbBounds', thumbBounds, itemData, index);
}
Get dimensions of thumbnail image
(click on which opens photoswipe or closes photoswipe to)

@param {number} index
@param {SlideData} itemData
@param {PhotoSwipe} instance PhotoSwipe instance
@returns {Bounds | undefined}