{"version":3,"file":"photoswipe-DEbMDbgN.js","sources":["../../../../../../.yarn/berry/cache/photoswipe-npm-5.4.4-f7a755162f-10c0.zip/node_modules/photoswipe/dist/photoswipe.esm.js"],"sourcesContent":["/*!\n  * PhotoSwipe 5.4.4 - https://photoswipe.com\n  * (c) 2024 Dmytro Semenov\n  */\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/**\r\n * @template {keyof HTMLElementTagNameMap} T\r\n * @param {string} className\r\n * @param {T} tagName\r\n * @param {Node} [appendToEl]\r\n * @returns {HTMLElementTagNameMap[T]}\r\n */\nfunction createElement(className, tagName, appendToEl) {\n  const el = document.createElement(tagName);\n\n  if (className) {\n    el.className = className;\n  }\n\n  if (appendToEl) {\n    appendToEl.appendChild(el);\n  }\n\n  return el;\n}\n/**\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {Point}\r\n */\n\nfunction equalizePoints(p1, p2) {\n  p1.x = p2.x;\n  p1.y = p2.y;\n\n  if (p2.id !== undefined) {\n    p1.id = p2.id;\n  }\n\n  return p1;\n}\n/**\r\n * @param {Point} p\r\n */\n\nfunction roundPoint(p) {\n  p.x = Math.round(p.x);\n  p.y = Math.round(p.y);\n}\n/**\r\n * Returns distance between two points.\r\n *\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {number}\r\n */\n\nfunction getDistanceBetween(p1, p2) {\n  const x = Math.abs(p1.x - p2.x);\n  const y = Math.abs(p1.y - p2.y);\n  return Math.sqrt(x * x + y * y);\n}\n/**\r\n * Whether X and Y positions of points are equal\r\n *\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {boolean}\r\n */\n\nfunction pointsEqual(p1, p2) {\n  return p1.x === p2.x && p1.y === p2.y;\n}\n/**\r\n * The float result between the min and max values.\r\n *\r\n * @param {number} val\r\n * @param {number} min\r\n * @param {number} max\r\n * @returns {number}\r\n */\n\nfunction clamp(val, min, max) {\n  return Math.min(Math.max(val, min), max);\n}\n/**\r\n * Get transform string\r\n *\r\n * @param {number} x\r\n * @param {number} [y]\r\n * @param {number} [scale]\r\n * @returns {string}\r\n */\n\nfunction toTransformString(x, y, scale) {\n  let propValue = `translate3d(${x}px,${y || 0}px,0)`;\n\n  if (scale !== undefined) {\n    propValue += ` scale3d(${scale},${scale},1)`;\n  }\n\n  return propValue;\n}\n/**\r\n * Apply transform:translate(x, y) scale(scale) to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {number} x\r\n * @param {number} [y]\r\n * @param {number} [scale]\r\n */\n\nfunction setTransform(el, x, y, scale) {\n  el.style.transform = toTransformString(x, y, scale);\n}\nconst defaultCSSEasing = 'cubic-bezier(.4,0,.22,1)';\n/**\r\n * Apply CSS transition to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {string} [prop] CSS property to animate\r\n * @param {number} [duration] in ms\r\n * @param {string} [ease] CSS easing function\r\n */\n\nfunction setTransitionStyle(el, prop, duration, ease) {\n  // inOut: 'cubic-bezier(.4, 0, .22, 1)', // for \"toggle state\" transitions\n  // out: 'cubic-bezier(0, 0, .22, 1)', // for \"show\" transitions\n  // in: 'cubic-bezier(.4, 0, 1, 1)'// for \"hide\" transitions\n  el.style.transition = prop ? `${prop} ${duration}ms ${ease || defaultCSSEasing}` : 'none';\n}\n/**\r\n * Apply width and height CSS properties to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {string | number} w\r\n * @param {string | number} h\r\n */\n\nfunction setWidthHeight(el, w, h) {\n  el.style.width = typeof w === 'number' ? `${w}px` : w;\n  el.style.height = typeof h === 'number' ? `${h}px` : h;\n}\n/**\r\n * @param {HTMLElement} el\r\n */\n\nfunction removeTransitionStyle(el) {\n  setTransitionStyle(el);\n}\n/**\r\n * @param {HTMLImageElement} img\r\n * @returns {Promise<HTMLImageElement | void>}\r\n */\n\nfunction decodeImage(img) {\n  if ('decode' in img) {\n    return img.decode().catch(() => {});\n  }\n\n  if (img.complete) {\n    return Promise.resolve(img);\n  }\n\n  return new Promise((resolve, reject) => {\n    img.onload = () => resolve(img);\n\n    img.onerror = reject;\n  });\n}\n/** @typedef {LOAD_STATE[keyof LOAD_STATE]} LoadState */\n\n/** @type {{ IDLE: 'idle'; LOADING: 'loading'; LOADED: 'loaded'; ERROR: 'error' }} */\n\nconst LOAD_STATE = {\n  IDLE: 'idle',\n  LOADING: 'loading',\n  LOADED: 'loaded',\n  ERROR: 'error'\n};\n/**\r\n * Check if click or keydown event was dispatched\r\n * with a special key or via mouse wheel.\r\n *\r\n * @param {MouseEvent | KeyboardEvent} e\r\n * @returns {boolean}\r\n */\n\nfunction specialKeyUsed(e) {\n  return 'button' in e && e.button === 1 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey;\n}\n/**\r\n * Parse `gallery` or `children` options.\r\n *\r\n * @param {import('../photoswipe.js').ElementProvider} [option]\r\n * @param {string} [legacySelector]\r\n * @param {HTMLElement | Document} [parent]\r\n * @returns HTMLElement[]\r\n */\n\nfunction getElementsFromOption(option, legacySelector, parent = document) {\n  /** @type {HTMLElement[]} */\n  let elements = [];\n\n  if (option instanceof Element) {\n    elements = [option];\n  } else if (option instanceof NodeList || Array.isArray(option)) {\n    elements = Array.from(option);\n  } else {\n    const selector = typeof option === 'string' ? option : legacySelector;\n\n    if (selector) {\n      elements = Array.from(parent.querySelectorAll(selector));\n    }\n  }\n\n  return elements;\n}\n/**\r\n * Check if browser is Safari\r\n *\r\n * @returns {boolean}\r\n */\n\nfunction isSafari() {\n  return !!(navigator.vendor && navigator.vendor.match(/apple/i));\n}\n\n// Detect passive event listener support\nlet supportsPassive = false;\n/* eslint-disable */\n\ntry {\n  /* @ts-ignore */\n  window.addEventListener('test', null, Object.defineProperty({}, 'passive', {\n    get: () => {\n      supportsPassive = true;\n    }\n  }));\n} catch (e) {}\n/* eslint-enable */\n\n/**\r\n * @typedef {Object} PoolItem\r\n * @prop {HTMLElement | Window | Document | undefined | null} target\r\n * @prop {string} type\r\n * @prop {EventListenerOrEventListenerObject} listener\r\n * @prop {boolean} [passive]\r\n */\n\n\nclass DOMEvents {\n  constructor() {\n    /**\r\n     * @type {PoolItem[]}\r\n     * @private\r\n     */\n    this._pool = [];\n  }\n  /**\r\n   * Adds event listeners\r\n   *\r\n   * @param {PoolItem['target']} target\r\n   * @param {PoolItem['type']} type Can be multiple, separated by space.\r\n   * @param {PoolItem['listener']} listener\r\n   * @param {PoolItem['passive']} [passive]\r\n   */\n\n\n  add(target, type, listener, passive) {\n    this._toggleListener(target, type, listener, passive);\n  }\n  /**\r\n   * Removes event listeners\r\n   *\r\n   * @param {PoolItem['target']} target\r\n   * @param {PoolItem['type']} type\r\n   * @param {PoolItem['listener']} listener\r\n   * @param {PoolItem['passive']} [passive]\r\n   */\n\n\n  remove(target, type, listener, passive) {\n    this._toggleListener(target, type, listener, passive, true);\n  }\n  /**\r\n   * Removes all bound events\r\n   */\n\n\n  removeAll() {\n    this._pool.forEach(poolItem => {\n      this._toggleListener(poolItem.target, poolItem.type, poolItem.listener, poolItem.passive, true, true);\n    });\n\n    this._pool = [];\n  }\n  /**\r\n   * Adds or removes event\r\n   *\r\n   * @private\r\n   * @param {PoolItem['target']} target\r\n   * @param {PoolItem['type']} type\r\n   * @param {PoolItem['listener']} listener\r\n   * @param {PoolItem['passive']} [passive]\r\n   * @param {boolean} [unbind] Whether the event should be added or removed\r\n   * @param {boolean} [skipPool] Whether events pool should be skipped\r\n   */\n\n\n  _toggleListener(target, type, listener, passive, unbind, skipPool) {\n    if (!target) {\n      return;\n    }\n\n    const methodName = unbind ? 'removeEventListener' : 'addEventListener';\n    const types = type.split(' ');\n    types.forEach(eType => {\n      if (eType) {\n        // Events pool is used to easily unbind all events when PhotoSwipe is closed,\n        // so developer doesn't need to do this manually\n        if (!skipPool) {\n          if (unbind) {\n            // Remove from the events pool\n            this._pool = this._pool.filter(poolItem => {\n              return poolItem.type !== eType || poolItem.listener !== listener || poolItem.target !== target;\n            });\n          } else {\n            // Add to the events pool\n            this._pool.push({\n              target,\n              type: eType,\n              listener,\n              passive\n            });\n          }\n        } // most PhotoSwipe events call preventDefault,\n        // and we do not need browser to scroll the page\n\n\n        const eventOptions = supportsPassive ? {\n          passive: passive || false\n        } : false;\n        target[methodName](eType, listener, eventOptions);\n      }\n    });\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\n\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\n\n/**\r\n * @param {PhotoSwipeOptions} options\r\n * @param {PhotoSwipeBase} pswp\r\n * @returns {Point}\r\n */\nfunction getViewportSize(options, pswp) {\n  if (options.getViewportSizeFn) {\n    const newViewportSize = options.getViewportSizeFn(options, pswp);\n\n    if (newViewportSize) {\n      return newViewportSize;\n    }\n  }\n\n  return {\n    x: document.documentElement.clientWidth,\n    // TODO: height on mobile is very incosistent due to toolbar\n    // find a way to improve this\n    //\n    // document.documentElement.clientHeight - doesn't seem to work well\n    y: window.innerHeight\n  };\n}\n/**\r\n * Parses padding option.\r\n * Supported formats:\r\n *\r\n * // Object\r\n * padding: {\r\n *  top: 0,\r\n *  bottom: 0,\r\n *  left: 0,\r\n *  right: 0\r\n * }\r\n *\r\n * // A function that returns the object\r\n * paddingFn: (viewportSize, itemData, index) => {\r\n *  return {\r\n *    top: 0,\r\n *    bottom: 0,\r\n *    left: 0,\r\n *    right: 0\r\n *  };\r\n * }\r\n *\r\n * // Legacy variant\r\n * paddingLeft: 0,\r\n * paddingRight: 0,\r\n * paddingTop: 0,\r\n * paddingBottom: 0,\r\n *\r\n * @param {'left' | 'top' | 'bottom' | 'right'} prop\r\n * @param {PhotoSwipeOptions} options PhotoSwipe options\r\n * @param {Point} viewportSize PhotoSwipe viewport size, for example: { x:800, y:600 }\r\n * @param {SlideData} itemData Data about the slide\r\n * @param {number} index Slide index\r\n * @returns {number}\r\n */\n\nfunction parsePaddingOption(prop, options, viewportSize, itemData, index) {\n  let paddingValue = 0;\n\n  if (options.paddingFn) {\n    paddingValue = options.paddingFn(viewportSize, itemData, index)[prop];\n  } else if (options.padding) {\n    paddingValue = options.padding[prop];\n  } else {\n    const legacyPropName = 'padding' + prop[0].toUpperCase() + prop.slice(1); // @ts-expect-error\n\n    if (options[legacyPropName]) {\n      // @ts-expect-error\n      paddingValue = options[legacyPropName];\n    }\n  }\n\n  return Number(paddingValue) || 0;\n}\n/**\r\n * @param {PhotoSwipeOptions} options\r\n * @param {Point} viewportSize\r\n * @param {SlideData} itemData\r\n * @param {number} index\r\n * @returns {Point}\r\n */\n\nfunction getPanAreaSize(options, viewportSize, itemData, index) {\n  return {\n    x: viewportSize.x - parsePaddingOption('left', options, viewportSize, itemData, index) - parsePaddingOption('right', options, viewportSize, itemData, index),\n    y: viewportSize.y - parsePaddingOption('top', options, viewportSize, itemData, index) - parsePaddingOption('bottom', options, viewportSize, itemData, index)\n  };\n}\n\n/** @typedef {import('./slide.js').default} Slide */\n\n/** @typedef {Record<Axis, number>} Point */\n\n/** @typedef {'x' | 'y'} Axis */\n\n/**\r\n * Calculates minimum, maximum and initial (center) bounds of a slide\r\n */\n\nclass PanBounds {\n  /**\r\n   * @param {Slide} slide\r\n   */\n  constructor(slide) {\n    this.slide = slide;\n    this.currZoomLevel = 1;\n    this.center =\n    /** @type {Point} */\n    {\n      x: 0,\n      y: 0\n    };\n    this.max =\n    /** @type {Point} */\n    {\n      x: 0,\n      y: 0\n    };\n    this.min =\n    /** @type {Point} */\n    {\n      x: 0,\n      y: 0\n    };\n  }\n  /**\r\n   * _getItemBounds\r\n   *\r\n   * @param {number} currZoomLevel\r\n   */\n\n\n  update(currZoomLevel) {\n    this.currZoomLevel = currZoomLevel;\n\n    if (!this.slide.width) {\n      this.reset();\n    } else {\n      this._updateAxis('x');\n\n      this._updateAxis('y');\n\n      this.slide.pswp.dispatch('calcBounds', {\n        slide: this.slide\n      });\n    }\n  }\n  /**\r\n   * _calculateItemBoundsForAxis\r\n   *\r\n   * @param {Axis} axis\r\n   */\n\n\n  _updateAxis(axis) {\n    const {\n      pswp\n    } = this.slide;\n    const elSize = this.slide[axis === 'x' ? 'width' : 'height'] * this.currZoomLevel;\n    const paddingProp = axis === 'x' ? 'left' : 'top';\n    const padding = parsePaddingOption(paddingProp, pswp.options, pswp.viewportSize, this.slide.data, this.slide.index);\n    const panAreaSize = this.slide.panAreaSize[axis]; // Default position of element.\n    // By default, it is center of viewport:\n\n    this.center[axis] = Math.round((panAreaSize - elSize) / 2) + padding; // maximum pan position\n\n    this.max[axis] = elSize > panAreaSize ? Math.round(panAreaSize - elSize) + padding : this.center[axis]; // minimum pan position\n\n    this.min[axis] = elSize > panAreaSize ? padding : this.center[axis];\n  } // _getZeroBounds\n\n\n  reset() {\n    this.center.x = 0;\n    this.center.y = 0;\n    this.max.x = 0;\n    this.max.y = 0;\n    this.min.x = 0;\n    this.min.y = 0;\n  }\n  /**\r\n   * Correct pan position if it's beyond the bounds\r\n   *\r\n   * @param {Axis} axis x or y\r\n   * @param {number} panOffset\r\n   * @returns {number}\r\n   */\n\n\n  correctPan(axis, panOffset) {\n    // checkPanBounds\n    return clamp(panOffset, this.max[axis], this.min[axis]);\n  }\n\n}\n\nconst MAX_IMAGE_WIDTH = 4000;\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\n\n/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */\n\n/**\r\n * Calculates zoom levels for specific slide.\r\n * Depends on viewport size and image size.\r\n */\n\nclass ZoomLevel {\n  /**\r\n   * @param {PhotoSwipeOptions} options PhotoSwipe options\r\n   * @param {SlideData} itemData Slide data\r\n   * @param {number} index Slide index\r\n   * @param {PhotoSwipe} [pswp] PhotoSwipe instance, can be undefined if not initialized yet\r\n   */\n  constructor(options, itemData, index, pswp) {\n    this.pswp = pswp;\n    this.options = options;\n    this.itemData = itemData;\n    this.index = index;\n    /** @type { Point | null } */\n\n    this.panAreaSize = null;\n    /** @type { Point | null } */\n\n    this.elementSize = null;\n    this.fit = 1;\n    this.fill = 1;\n    this.vFill = 1;\n    this.initial = 1;\n    this.secondary = 1;\n    this.max = 1;\n    this.min = 1;\n  }\n  /**\r\n   * Calculate initial, secondary and maximum zoom level for the specified slide.\r\n   *\r\n   * It should be called when either image or viewport size changes.\r\n   *\r\n   * @param {number} maxWidth\r\n   * @param {number} maxHeight\r\n   * @param {Point} panAreaSize\r\n   */\n\n\n  update(maxWidth, maxHeight, panAreaSize) {\n    /** @type {Point} */\n    const elementSize = {\n      x: maxWidth,\n      y: maxHeight\n    };\n    this.elementSize = elementSize;\n    this.panAreaSize = panAreaSize;\n    const hRatio = panAreaSize.x / elementSize.x;\n    const vRatio = panAreaSize.y / elementSize.y;\n    this.fit = Math.min(1, hRatio < vRatio ? hRatio : vRatio);\n    this.fill = Math.min(1, hRatio > vRatio ? hRatio : vRatio); // zoom.vFill defines zoom level of the image\n    // when it has 100% of viewport vertical space (height)\n\n    this.vFill = Math.min(1, vRatio);\n    this.initial = this._getInitial();\n    this.secondary = this._getSecondary();\n    this.max = Math.max(this.initial, this.secondary, this._getMax());\n    this.min = Math.min(this.fit, this.initial, this.secondary);\n\n    if (this.pswp) {\n      this.pswp.dispatch('zoomLevelsUpdate', {\n        zoomLevels: this,\n        slideData: this.itemData\n      });\n    }\n  }\n  /**\r\n   * Parses user-defined zoom option.\r\n   *\r\n   * @private\r\n   * @param {'initial' | 'secondary' | 'max'} optionPrefix Zoom level option prefix (initial, secondary, max)\r\n   * @returns { number | undefined }\r\n   */\n\n\n  _parseZoomLevelOption(optionPrefix) {\n    const optionName =\n    /** @type {'initialZoomLevel' | 'secondaryZoomLevel' | 'maxZoomLevel'} */\n    optionPrefix + 'ZoomLevel';\n    const optionValue = this.options[optionName];\n\n    if (!optionValue) {\n      return;\n    }\n\n    if (typeof optionValue === 'function') {\n      return optionValue(this);\n    }\n\n    if (optionValue === 'fill') {\n      return this.fill;\n    }\n\n    if (optionValue === 'fit') {\n      return this.fit;\n    }\n\n    return Number(optionValue);\n  }\n  /**\r\n   * Get zoom level to which image will be zoomed after double-tap gesture,\r\n   * or when user clicks on zoom icon,\r\n   * or mouse-click on image itself.\r\n   * If you return 1 image will be zoomed to its original size.\r\n   *\r\n   * @private\r\n   * @return {number}\r\n   */\n\n\n  _getSecondary() {\n    let currZoomLevel = this._parseZoomLevelOption('secondary');\n\n    if (currZoomLevel) {\n      return currZoomLevel;\n    } // 3x of \"fit\" state, but not larger than original\n\n\n    currZoomLevel = Math.min(1, this.fit * 3);\n\n    if (this.elementSize && currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH) {\n      currZoomLevel = MAX_IMAGE_WIDTH / this.elementSize.x;\n    }\n\n    return currZoomLevel;\n  }\n  /**\r\n   * Get initial image zoom level.\r\n   *\r\n   * @private\r\n   * @return {number}\r\n   */\n\n\n  _getInitial() {\n    return this._parseZoomLevelOption('initial') || this.fit;\n  }\n  /**\r\n   * Maximum zoom level when user zooms\r\n   * via zoom/pinch gesture,\r\n   * via cmd/ctrl-wheel or via trackpad.\r\n   *\r\n   * @private\r\n   * @return {number}\r\n   */\n\n\n  _getMax() {\n    // max zoom level is x4 from \"fit state\",\n    // used for zoom gesture and ctrl/trackpad zoom\n    return this._parseZoomLevelOption('max') || Math.max(1, this.fit * 4);\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n/**\r\n * Renders and allows to control a single slide\r\n */\n\nclass Slide {\n  /**\r\n   * @param {SlideData} data\r\n   * @param {number} index\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(data, index, pswp) {\n    this.data = data;\n    this.index = index;\n    this.pswp = pswp;\n    this.isActive = index === pswp.currIndex;\n    this.currentResolution = 0;\n    /** @type {Point} */\n\n    this.panAreaSize = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point} */\n\n    this.pan = {\n      x: 0,\n      y: 0\n    };\n    this.isFirstSlide = this.isActive && !pswp.opener.isOpen;\n    this.zoomLevels = new ZoomLevel(pswp.options, data, index, pswp);\n    this.pswp.dispatch('gettingData', {\n      slide: this,\n      data: this.data,\n      index\n    });\n    this.content = this.pswp.contentLoader.getContentBySlide(this);\n    this.container = createElement('pswp__zoom-wrap', 'div');\n    /** @type {HTMLElement | null} */\n\n    this.holderElement = null;\n    this.currZoomLevel = 1;\n    /** @type {number} */\n\n    this.width = this.content.width;\n    /** @type {number} */\n\n    this.height = this.content.height;\n    this.heavyAppended = false;\n    this.bounds = new PanBounds(this);\n    this.prevDisplayedWidth = -1;\n    this.prevDisplayedHeight = -1;\n    this.pswp.dispatch('slideInit', {\n      slide: this\n    });\n  }\n  /**\r\n   * If this slide is active/current/visible\r\n   *\r\n   * @param {boolean} isActive\r\n   */\n\n\n  setIsActive(isActive) {\n    if (isActive && !this.isActive) {\n      // slide just became active\n      this.activate();\n    } else if (!isActive && this.isActive) {\n      // slide just became non-active\n      this.deactivate();\n    }\n  }\n  /**\r\n   * Appends slide content to DOM\r\n   *\r\n   * @param {HTMLElement} holderElement\r\n   */\n\n\n  append(holderElement) {\n    this.holderElement = holderElement;\n    this.container.style.transformOrigin = '0 0'; // Slide appended to DOM\n\n    if (!this.data) {\n      return;\n    }\n\n    this.calculateSize();\n    this.load();\n    this.updateContentSize();\n    this.appendHeavy();\n    this.holderElement.appendChild(this.container);\n    this.zoomAndPanToInitial();\n    this.pswp.dispatch('firstZoomPan', {\n      slide: this\n    });\n    this.applyCurrentZoomPan();\n    this.pswp.dispatch('afterSetContent', {\n      slide: this\n    });\n\n    if (this.isActive) {\n      this.activate();\n    }\n  }\n\n  load() {\n    this.content.load(false);\n    this.pswp.dispatch('slideLoad', {\n      slide: this\n    });\n  }\n  /**\r\n   * Append \"heavy\" DOM elements\r\n   *\r\n   * This may depend on a type of slide,\r\n   * but generally these are large images.\r\n   */\n\n\n  appendHeavy() {\n    const {\n      pswp\n    } = this;\n    const appendHeavyNearby = true; // todo\n    // Avoid appending heavy elements during animations\n\n    if (this.heavyAppended || !pswp.opener.isOpen || pswp.mainScroll.isShifted() || !this.isActive && !appendHeavyNearby) {\n      return;\n    }\n\n    if (this.pswp.dispatch('appendHeavy', {\n      slide: this\n    }).defaultPrevented) {\n      return;\n    }\n\n    this.heavyAppended = true;\n    this.content.append();\n    this.pswp.dispatch('appendHeavyContent', {\n      slide: this\n    });\n  }\n  /**\r\n   * Triggered when this slide is active (selected).\r\n   *\r\n   * If it's part of opening/closing transition -\r\n   * activate() will trigger after the transition is ended.\r\n   */\n\n\n  activate() {\n    this.isActive = true;\n    this.appendHeavy();\n    this.content.activate();\n    this.pswp.dispatch('slideActivate', {\n      slide: this\n    });\n  }\n  /**\r\n   * Triggered when this slide becomes inactive.\r\n   *\r\n   * Slide can become inactive only after it was active.\r\n   */\n\n\n  deactivate() {\n    this.isActive = false;\n    this.content.deactivate();\n\n    if (this.currZoomLevel !== this.zoomLevels.initial) {\n      // allow filtering\n      this.calculateSize();\n    } // reset zoom level\n\n\n    this.currentResolution = 0;\n    this.zoomAndPanToInitial();\n    this.applyCurrentZoomPan();\n    this.updateContentSize();\n    this.pswp.dispatch('slideDeactivate', {\n      slide: this\n    });\n  }\n  /**\r\n   * The slide should destroy itself, it will never be used again.\r\n   * (unbind all events and destroy internal components)\r\n   */\n\n\n  destroy() {\n    this.content.hasSlide = false;\n    this.content.remove();\n    this.container.remove();\n    this.pswp.dispatch('slideDestroy', {\n      slide: this\n    });\n  }\n\n  resize() {\n    if (this.currZoomLevel === this.zoomLevels.initial || !this.isActive) {\n      // Keep initial zoom level if it was before the resize,\n      // as well as when this slide is not active\n      // Reset position and scale to original state\n      this.calculateSize();\n      this.currentResolution = 0;\n      this.zoomAndPanToInitial();\n      this.applyCurrentZoomPan();\n      this.updateContentSize();\n    } else {\n      // readjust pan position if it's beyond the bounds\n      this.calculateSize();\n      this.bounds.update(this.currZoomLevel);\n      this.panTo(this.pan.x, this.pan.y);\n    }\n  }\n  /**\r\n   * Apply size to current slide content,\r\n   * based on the current resolution and scale.\r\n   *\r\n   * @param {boolean} [force] if size should be updated even if dimensions weren't changed\r\n   */\n\n\n  updateContentSize(force) {\n    // Use initial zoom level\n    // if resolution is not defined (user didn't zoom yet)\n    const scaleMultiplier = this.currentResolution || this.zoomLevels.initial;\n\n    if (!scaleMultiplier) {\n      return;\n    }\n\n    const width = Math.round(this.width * scaleMultiplier) || this.pswp.viewportSize.x;\n    const height = Math.round(this.height * scaleMultiplier) || this.pswp.viewportSize.y;\n\n    if (!this.sizeChanged(width, height) && !force) {\n      return;\n    }\n\n    this.content.setDisplayedSize(width, height);\n  }\n  /**\r\n   * @param {number} width\r\n   * @param {number} height\r\n   */\n\n\n  sizeChanged(width, height) {\n    if (width !== this.prevDisplayedWidth || height !== this.prevDisplayedHeight) {\n      this.prevDisplayedWidth = width;\n      this.prevDisplayedHeight = height;\n      return true;\n    }\n\n    return false;\n  }\n  /** @returns {HTMLImageElement | HTMLDivElement | null | undefined} */\n\n\n  getPlaceholderElement() {\n    var _this$content$placeho;\n\n    return (_this$content$placeho = this.content.placeholder) === null || _this$content$placeho === void 0 ? void 0 : _this$content$placeho.element;\n  }\n  /**\r\n   * Zoom current slide image to...\r\n   *\r\n   * @param {number} destZoomLevel Destination zoom level.\r\n   * @param {Point} [centerPoint]\r\n   * Transform origin center point, or false if viewport center should be used.\r\n   * @param {number | false} [transitionDuration] Transition duration, may be set to 0.\r\n   * @param {boolean} [ignoreBounds] Minimum and maximum zoom levels will be ignored.\r\n   */\n\n\n  zoomTo(destZoomLevel, centerPoint, transitionDuration, ignoreBounds) {\n    const {\n      pswp\n    } = this;\n\n    if (!this.isZoomable() || pswp.mainScroll.isShifted()) {\n      return;\n    }\n\n    pswp.dispatch('beforeZoomTo', {\n      destZoomLevel,\n      centerPoint,\n      transitionDuration\n    }); // stop all pan and zoom transitions\n\n    pswp.animations.stopAllPan(); // if (!centerPoint) {\n    //   centerPoint = pswp.getViewportCenterPoint();\n    // }\n\n    const prevZoomLevel = this.currZoomLevel;\n\n    if (!ignoreBounds) {\n      destZoomLevel = clamp(destZoomLevel, this.zoomLevels.min, this.zoomLevels.max);\n    } // if (transitionDuration === undefined) {\n    //   transitionDuration = this.pswp.options.zoomAnimationDuration;\n    // }\n\n\n    this.setZoomLevel(destZoomLevel);\n    this.pan.x = this.calculateZoomToPanOffset('x', centerPoint, prevZoomLevel);\n    this.pan.y = this.calculateZoomToPanOffset('y', centerPoint, prevZoomLevel);\n    roundPoint(this.pan);\n\n    const finishTransition = () => {\n      this._setResolution(destZoomLevel);\n\n      this.applyCurrentZoomPan();\n    };\n\n    if (!transitionDuration) {\n      finishTransition();\n    } else {\n      pswp.animations.startTransition({\n        isPan: true,\n        name: 'zoomTo',\n        target: this.container,\n        transform: this.getCurrentTransform(),\n        onComplete: finishTransition,\n        duration: transitionDuration,\n        easing: pswp.options.easing\n      });\n    }\n  }\n  /**\r\n   * @param {Point} [centerPoint]\r\n   */\n\n\n  toggleZoom(centerPoint) {\n    this.zoomTo(this.currZoomLevel === this.zoomLevels.initial ? this.zoomLevels.secondary : this.zoomLevels.initial, centerPoint, this.pswp.options.zoomAnimationDuration);\n  }\n  /**\r\n   * Updates zoom level property and recalculates new pan bounds,\r\n   * unlike zoomTo it does not apply transform (use applyCurrentZoomPan)\r\n   *\r\n   * @param {number} currZoomLevel\r\n   */\n\n\n  setZoomLevel(currZoomLevel) {\n    this.currZoomLevel = currZoomLevel;\n    this.bounds.update(this.currZoomLevel);\n  }\n  /**\r\n   * Get pan position after zoom at a given `point`.\r\n   *\r\n   * Always call setZoomLevel(newZoomLevel) beforehand to recalculate\r\n   * pan bounds according to the new zoom level.\r\n   *\r\n   * @param {'x' | 'y'} axis\r\n   * @param {Point} [point]\r\n   * point based on which zoom is performed, usually refers to the current mouse position,\r\n   * if false - viewport center will be used.\r\n   * @param {number} [prevZoomLevel] Zoom level before new zoom was applied.\r\n   * @returns {number}\r\n   */\n\n\n  calculateZoomToPanOffset(axis, point, prevZoomLevel) {\n    const totalPanDistance = this.bounds.max[axis] - this.bounds.min[axis];\n\n    if (totalPanDistance === 0) {\n      return this.bounds.center[axis];\n    }\n\n    if (!point) {\n      point = this.pswp.getViewportCenterPoint();\n    }\n\n    if (!prevZoomLevel) {\n      prevZoomLevel = this.zoomLevels.initial;\n    }\n\n    const zoomFactor = this.currZoomLevel / prevZoomLevel;\n    return this.bounds.correctPan(axis, (this.pan[axis] - point[axis]) * zoomFactor + point[axis]);\n  }\n  /**\r\n   * Apply pan and keep it within bounds.\r\n   *\r\n   * @param {number} panX\r\n   * @param {number} panY\r\n   */\n\n\n  panTo(panX, panY) {\n    this.pan.x = this.bounds.correctPan('x', panX);\n    this.pan.y = this.bounds.correctPan('y', panY);\n    this.applyCurrentZoomPan();\n  }\n  /**\r\n   * If the slide in the current state can be panned by the user\r\n   * @returns {boolean}\r\n   */\n\n\n  isPannable() {\n    return Boolean(this.width) && this.currZoomLevel > this.zoomLevels.fit;\n  }\n  /**\r\n   * If the slide can be zoomed\r\n   * @returns {boolean}\r\n   */\n\n\n  isZoomable() {\n    return Boolean(this.width) && this.content.isZoomable();\n  }\n  /**\r\n   * Apply transform and scale based on\r\n   * the current pan position (this.pan) and zoom level (this.currZoomLevel)\r\n   */\n\n\n  applyCurrentZoomPan() {\n    this._applyZoomTransform(this.pan.x, this.pan.y, this.currZoomLevel);\n\n    if (this === this.pswp.currSlide) {\n      this.pswp.dispatch('zoomPanUpdate', {\n        slide: this\n      });\n    }\n  }\n\n  zoomAndPanToInitial() {\n    this.currZoomLevel = this.zoomLevels.initial; // pan according to the zoom level\n\n    this.bounds.update(this.currZoomLevel);\n    equalizePoints(this.pan, this.bounds.center);\n    this.pswp.dispatch('initialZoomPan', {\n      slide: this\n    });\n  }\n  /**\r\n   * Set translate and scale based on current resolution\r\n   *\r\n   * @param {number} x\r\n   * @param {number} y\r\n   * @param {number} zoom\r\n   * @private\r\n   */\n\n\n  _applyZoomTransform(x, y, zoom) {\n    zoom /= this.currentResolution || this.zoomLevels.initial;\n    setTransform(this.container, x, y, zoom);\n  }\n\n  calculateSize() {\n    const {\n      pswp\n    } = this;\n    equalizePoints(this.panAreaSize, getPanAreaSize(pswp.options, pswp.viewportSize, this.data, this.index));\n    this.zoomLevels.update(this.width, this.height, this.panAreaSize);\n    pswp.dispatch('calcSlideSize', {\n      slide: this\n    });\n  }\n  /** @returns {string} */\n\n\n  getCurrentTransform() {\n    const scale = this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);\n    return toTransformString(this.pan.x, this.pan.y, scale);\n  }\n  /**\r\n   * Set resolution and re-render the image.\r\n   *\r\n   * For example, if the real image size is 2000x1500,\r\n   * and resolution is 0.5 - it will be rendered as 1000x750.\r\n   *\r\n   * Image with zoom level 2 and resolution 0.5 is\r\n   * the same as image with zoom level 1 and resolution 1.\r\n   *\r\n   * Used to optimize animations and make\r\n   * sure that browser renders image in the highest quality.\r\n   * Also used by responsive images to load the correct one.\r\n   *\r\n   * @param {number} newResolution\r\n   */\n\n\n  _setResolution(newResolution) {\n    if (newResolution === this.currentResolution) {\n      return;\n    }\n\n    this.currentResolution = newResolution;\n    this.updateContentSize();\n    this.pswp.dispatch('resolutionChanged');\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/** @typedef {import('./gestures.js').default} Gestures */\n\nconst PAN_END_FRICTION = 0.35;\nconst VERTICAL_DRAG_FRICTION = 0.6; // 1 corresponds to the third of viewport height\n\nconst MIN_RATIO_TO_CLOSE = 0.4; // Minimum speed required to navigate\n// to next or previous slide\n\nconst MIN_NEXT_SLIDE_SPEED = 0.5;\n/**\r\n * @param {number} initialVelocity\r\n * @param {number} decelerationRate\r\n * @returns {number}\r\n */\n\nfunction project(initialVelocity, decelerationRate) {\n  return initialVelocity * decelerationRate / (1 - decelerationRate);\n}\n/**\r\n * Handles single pointer dragging\r\n */\n\n\nclass DragHandler {\n  /**\r\n   * @param {Gestures} gestures\r\n   */\n  constructor(gestures) {\n    this.gestures = gestures;\n    this.pswp = gestures.pswp;\n    /** @type {Point} */\n\n    this.startPan = {\n      x: 0,\n      y: 0\n    };\n  }\n\n  start() {\n    if (this.pswp.currSlide) {\n      equalizePoints(this.startPan, this.pswp.currSlide.pan);\n    }\n\n    this.pswp.animations.stopAll();\n  }\n\n  change() {\n    const {\n      p1,\n      prevP1,\n      dragAxis\n    } = this.gestures;\n    const {\n      currSlide\n    } = this.pswp;\n\n    if (dragAxis === 'y' && this.pswp.options.closeOnVerticalDrag && currSlide && currSlide.currZoomLevel <= currSlide.zoomLevels.fit && !this.gestures.isMultitouch) {\n      // Handle vertical drag to close\n      const panY = currSlide.pan.y + (p1.y - prevP1.y);\n\n      if (!this.pswp.dispatch('verticalDrag', {\n        panY\n      }).defaultPrevented) {\n        this._setPanWithFriction('y', panY, VERTICAL_DRAG_FRICTION);\n\n        const bgOpacity = 1 - Math.abs(this._getVerticalDragRatio(currSlide.pan.y));\n        this.pswp.applyBgOpacity(bgOpacity);\n        currSlide.applyCurrentZoomPan();\n      }\n    } else {\n      const mainScrollChanged = this._panOrMoveMainScroll('x');\n\n      if (!mainScrollChanged) {\n        this._panOrMoveMainScroll('y');\n\n        if (currSlide) {\n          roundPoint(currSlide.pan);\n          currSlide.applyCurrentZoomPan();\n        }\n      }\n    }\n  }\n\n  end() {\n    const {\n      velocity\n    } = this.gestures;\n    const {\n      mainScroll,\n      currSlide\n    } = this.pswp;\n    let indexDiff = 0;\n    this.pswp.animations.stopAll(); // Handle main scroll if it's shifted\n\n    if (mainScroll.isShifted()) {\n      // Position of the main scroll relative to the viewport\n      const mainScrollShiftDiff = mainScroll.x - mainScroll.getCurrSlideX(); // Ratio between 0 and 1:\n      // 0 - slide is not visible at all,\n      // 0.5 - half of the slide is visible\n      // 1 - slide is fully visible\n\n      const currentSlideVisibilityRatio = mainScrollShiftDiff / this.pswp.viewportSize.x; // Go next slide.\n      //\n      // - if velocity and its direction is matched,\n      //   and we see at least tiny part of the next slide\n      //\n      // - or if we see less than 50% of the current slide\n      //   and velocity is close to 0\n      //\n\n      if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {\n        // Go to next slide\n        indexDiff = 1;\n        velocity.x = Math.min(velocity.x, 0);\n      } else if (velocity.x > MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio > 0 || velocity.x > -0.1 && currentSlideVisibilityRatio > 0.5) {\n        // Go to prev slide\n        indexDiff = -1;\n        velocity.x = Math.max(velocity.x, 0);\n      }\n\n      mainScroll.moveIndexBy(indexDiff, true, velocity.x);\n    } // Restore zoom level\n\n\n    if (currSlide && currSlide.currZoomLevel > currSlide.zoomLevels.max || this.gestures.isMultitouch) {\n      this.gestures.zoomLevels.correctZoomPan(true);\n    } else {\n      // we run two animations instead of one,\n      // as each axis has own pan boundaries and thus different spring function\n      // (correctZoomPan does not have this functionality,\n      //  it animates all properties with single timing function)\n      this._finishPanGestureForAxis('x');\n\n      this._finishPanGestureForAxis('y');\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {'x' | 'y'} axis\r\n   */\n\n\n  _finishPanGestureForAxis(axis) {\n    const {\n      velocity\n    } = this.gestures;\n    const {\n      currSlide\n    } = this.pswp;\n\n    if (!currSlide) {\n      return;\n    }\n\n    const {\n      pan,\n      bounds\n    } = currSlide;\n    const panPos = pan[axis];\n    const restoreBgOpacity = this.pswp.bgOpacity < 1 && axis === 'y'; // 0.995 means - scroll view loses 0.5% of its velocity per millisecond\n    // Increasing this number will reduce travel distance\n\n    const decelerationRate = 0.995; // 0.99\n    // Pan position if there is no bounds\n\n    const projectedPosition = panPos + project(velocity[axis], decelerationRate);\n\n    if (restoreBgOpacity) {\n      const vDragRatio = this._getVerticalDragRatio(panPos);\n\n      const projectedVDragRatio = this._getVerticalDragRatio(projectedPosition); // If we are above and moving upwards,\n      // or if we are below and moving downwards\n\n\n      if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {\n        this.pswp.close();\n        return;\n      }\n    } // Pan position with corrected bounds\n\n\n    const correctedPanPosition = bounds.correctPan(axis, projectedPosition); // Exit if pan position should not be changed\n    // or if speed it too low\n\n    if (panPos === correctedPanPosition) {\n      return;\n    } // Overshoot if the final position is out of pan bounds\n\n\n    const dampingRatio = correctedPanPosition === projectedPosition ? 1 : 0.82;\n    const initialBgOpacity = this.pswp.bgOpacity;\n    const totalPanDist = correctedPanPosition - panPos;\n    this.pswp.animations.startSpring({\n      name: 'panGesture' + axis,\n      isPan: true,\n      start: panPos,\n      end: correctedPanPosition,\n      velocity: velocity[axis],\n      dampingRatio,\n      onUpdate: pos => {\n        // Animate opacity of background relative to Y pan position of an image\n        if (restoreBgOpacity && this.pswp.bgOpacity < 1) {\n          // 0 - start of animation, 1 - end of animation\n          const animationProgressRatio = 1 - (correctedPanPosition - pos) / totalPanDist; // We clamp opacity to keep it between 0 and 1.\n          // As progress ratio can be larger than 1 due to overshoot,\n          // and we do not want to bounce opacity.\n\n          this.pswp.applyBgOpacity(clamp(initialBgOpacity + (1 - initialBgOpacity) * animationProgressRatio, 0, 1));\n        }\n\n        pan[axis] = Math.floor(pos);\n        currSlide.applyCurrentZoomPan();\n      }\n    });\n  }\n  /**\r\n   * Update position of the main scroll,\r\n   * or/and update pan position of the current slide.\r\n   *\r\n   * Should return true if it changes (or can change) main scroll.\r\n   *\r\n   * @private\r\n   * @param {'x' | 'y'} axis\r\n   * @returns {boolean}\r\n   */\n\n\n  _panOrMoveMainScroll(axis) {\n    const {\n      p1,\n      dragAxis,\n      prevP1,\n      isMultitouch\n    } = this.gestures;\n    const {\n      currSlide,\n      mainScroll\n    } = this.pswp;\n    const delta = p1[axis] - prevP1[axis];\n    const newMainScrollX = mainScroll.x + delta;\n\n    if (!delta || !currSlide) {\n      return false;\n    } // Always move main scroll if image can not be panned\n\n\n    if (axis === 'x' && !currSlide.isPannable() && !isMultitouch) {\n      mainScroll.moveTo(newMainScrollX, true);\n      return true; // changed main scroll\n    }\n\n    const {\n      bounds\n    } = currSlide;\n    const newPan = currSlide.pan[axis] + delta;\n\n    if (this.pswp.options.allowPanToNext && dragAxis === 'x' && axis === 'x' && !isMultitouch) {\n      const currSlideMainScrollX = mainScroll.getCurrSlideX(); // Position of the main scroll relative to the viewport\n\n      const mainScrollShiftDiff = mainScroll.x - currSlideMainScrollX;\n      const isLeftToRight = delta > 0;\n      const isRightToLeft = !isLeftToRight;\n\n      if (newPan > bounds.min[axis] && isLeftToRight) {\n        // Panning from left to right, beyond the left edge\n        // Wether the image was at minimum pan position (or less)\n        // when this drag gesture started.\n        // Minimum pan position refers to the left edge of the image.\n        const wasAtMinPanPosition = bounds.min[axis] <= this.startPan[axis];\n\n        if (wasAtMinPanPosition) {\n          mainScroll.moveTo(newMainScrollX, true);\n          return true;\n        } else {\n          this._setPanWithFriction(axis, newPan); //currSlide.pan[axis] = newPan;\n\n        }\n      } else if (newPan < bounds.max[axis] && isRightToLeft) {\n        // Paning from right to left, beyond the right edge\n        // Maximum pan position refers to the right edge of the image.\n        const wasAtMaxPanPosition = this.startPan[axis] <= bounds.max[axis];\n\n        if (wasAtMaxPanPosition) {\n          mainScroll.moveTo(newMainScrollX, true);\n          return true;\n        } else {\n          this._setPanWithFriction(axis, newPan); //currSlide.pan[axis] = newPan;\n\n        }\n      } else {\n        // If main scroll is shifted\n        if (mainScrollShiftDiff !== 0) {\n          // If main scroll is shifted right\n          if (mainScrollShiftDiff > 0\n          /*&& isRightToLeft*/\n          ) {\n            mainScroll.moveTo(Math.max(newMainScrollX, currSlideMainScrollX), true);\n            return true;\n          } else if (mainScrollShiftDiff < 0\n          /*&& isLeftToRight*/\n          ) {\n            // Main scroll is shifted left (Position is less than 0 comparing to the viewport 0)\n            mainScroll.moveTo(Math.min(newMainScrollX, currSlideMainScrollX), true);\n            return true;\n          }\n        } else {\n          // We are within pan bounds, so just pan\n          this._setPanWithFriction(axis, newPan);\n        }\n      }\n    } else {\n      if (axis === 'y') {\n        // Do not pan vertically if main scroll is shifted o\n        if (!mainScroll.isShifted() && bounds.min.y !== bounds.max.y) {\n          this._setPanWithFriction(axis, newPan);\n        }\n      } else {\n        this._setPanWithFriction(axis, newPan);\n      }\n    }\n\n    return false;\n  } // If we move above - the ratio is negative\n  // If we move below the ratio is positive\n\n  /**\r\n   * Relation between pan Y position and third of viewport height.\r\n   *\r\n   * When we are at initial position (center bounds) - the ratio is 0,\r\n   * if position is shifted upwards - the ratio is negative,\r\n   * if position is shifted downwards - the ratio is positive.\r\n   *\r\n   * @private\r\n   * @param {number} panY The current pan Y position.\r\n   * @returns {number}\r\n   */\n\n\n  _getVerticalDragRatio(panY) {\n    var _this$pswp$currSlide$, _this$pswp$currSlide;\n\n    return (panY - ((_this$pswp$currSlide$ = (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0 ? void 0 : _this$pswp$currSlide.bounds.center.y) !== null && _this$pswp$currSlide$ !== void 0 ? _this$pswp$currSlide$ : 0)) / (this.pswp.viewportSize.y / 3);\n  }\n  /**\r\n   * Set pan position of the current slide.\r\n   * Apply friction if the position is beyond the pan bounds,\r\n   * or if custom friction is defined.\r\n   *\r\n   * @private\r\n   * @param {'x' | 'y'} axis\r\n   * @param {number} potentialPan\r\n   * @param {number} [customFriction] (0.1 - 1)\r\n   */\n\n\n  _setPanWithFriction(axis, potentialPan, customFriction) {\n    const {\n      currSlide\n    } = this.pswp;\n\n    if (!currSlide) {\n      return;\n    }\n\n    const {\n      pan,\n      bounds\n    } = currSlide;\n    const correctedPan = bounds.correctPan(axis, potentialPan); // If we are out of pan bounds\n\n    if (correctedPan !== potentialPan || customFriction) {\n      const delta = Math.round(potentialPan - pan[axis]);\n      pan[axis] += delta * (customFriction || PAN_END_FRICTION);\n    } else {\n      pan[axis] = potentialPan;\n    }\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/** @typedef {import('./gestures.js').default} Gestures */\n\nconst UPPER_ZOOM_FRICTION = 0.05;\nconst LOWER_ZOOM_FRICTION = 0.15;\n/**\r\n * Get center point between two points\r\n *\r\n * @param {Point} p\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {Point}\r\n */\n\nfunction getZoomPointsCenter(p, p1, p2) {\n  p.x = (p1.x + p2.x) / 2;\n  p.y = (p1.y + p2.y) / 2;\n  return p;\n}\n\nclass ZoomHandler {\n  /**\r\n   * @param {Gestures} gestures\r\n   */\n  constructor(gestures) {\n    this.gestures = gestures;\n    /**\r\n     * @private\r\n     * @type {Point}\r\n     */\n\n    this._startPan = {\n      x: 0,\n      y: 0\n    };\n    /**\r\n     * @private\r\n     * @type {Point}\r\n     */\n\n    this._startZoomPoint = {\n      x: 0,\n      y: 0\n    };\n    /**\r\n     * @private\r\n     * @type {Point}\r\n     */\n\n    this._zoomPoint = {\n      x: 0,\n      y: 0\n    };\n    /** @private */\n\n    this._wasOverFitZoomLevel = false;\n    /** @private */\n\n    this._startZoomLevel = 1;\n  }\n\n  start() {\n    const {\n      currSlide\n    } = this.gestures.pswp;\n\n    if (currSlide) {\n      this._startZoomLevel = currSlide.currZoomLevel;\n      equalizePoints(this._startPan, currSlide.pan);\n    }\n\n    this.gestures.pswp.animations.stopAllPan();\n    this._wasOverFitZoomLevel = false;\n  }\n\n  change() {\n    const {\n      p1,\n      startP1,\n      p2,\n      startP2,\n      pswp\n    } = this.gestures;\n    const {\n      currSlide\n    } = pswp;\n\n    if (!currSlide) {\n      return;\n    }\n\n    const minZoomLevel = currSlide.zoomLevels.min;\n    const maxZoomLevel = currSlide.zoomLevels.max;\n\n    if (!currSlide.isZoomable() || pswp.mainScroll.isShifted()) {\n      return;\n    }\n\n    getZoomPointsCenter(this._startZoomPoint, startP1, startP2);\n    getZoomPointsCenter(this._zoomPoint, p1, p2);\n\n    let currZoomLevel = 1 / getDistanceBetween(startP1, startP2) * getDistanceBetween(p1, p2) * this._startZoomLevel; // slightly over the zoom.fit\n\n\n    if (currZoomLevel > currSlide.zoomLevels.initial + currSlide.zoomLevels.initial / 15) {\n      this._wasOverFitZoomLevel = true;\n    }\n\n    if (currZoomLevel < minZoomLevel) {\n      if (pswp.options.pinchToClose && !this._wasOverFitZoomLevel && this._startZoomLevel <= currSlide.zoomLevels.initial) {\n        // fade out background if zooming out\n        const bgOpacity = 1 - (minZoomLevel - currZoomLevel) / (minZoomLevel / 1.2);\n\n        if (!pswp.dispatch('pinchClose', {\n          bgOpacity\n        }).defaultPrevented) {\n          pswp.applyBgOpacity(bgOpacity);\n        }\n      } else {\n        // Apply the friction if zoom level is below the min\n        currZoomLevel = minZoomLevel - (minZoomLevel - currZoomLevel) * LOWER_ZOOM_FRICTION;\n      }\n    } else if (currZoomLevel > maxZoomLevel) {\n      // Apply the friction if zoom level is above the max\n      currZoomLevel = maxZoomLevel + (currZoomLevel - maxZoomLevel) * UPPER_ZOOM_FRICTION;\n    }\n\n    currSlide.pan.x = this._calculatePanForZoomLevel('x', currZoomLevel);\n    currSlide.pan.y = this._calculatePanForZoomLevel('y', currZoomLevel);\n    currSlide.setZoomLevel(currZoomLevel);\n    currSlide.applyCurrentZoomPan();\n  }\n\n  end() {\n    const {\n      pswp\n    } = this.gestures;\n    const {\n      currSlide\n    } = pswp;\n\n    if ((!currSlide || currSlide.currZoomLevel < currSlide.zoomLevels.initial) && !this._wasOverFitZoomLevel && pswp.options.pinchToClose) {\n      pswp.close();\n    } else {\n      this.correctZoomPan();\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {'x' | 'y'} axis\r\n   * @param {number} currZoomLevel\r\n   * @returns {number}\r\n   */\n\n\n  _calculatePanForZoomLevel(axis, currZoomLevel) {\n    const zoomFactor = currZoomLevel / this._startZoomLevel;\n    return this._zoomPoint[axis] - (this._startZoomPoint[axis] - this._startPan[axis]) * zoomFactor;\n  }\n  /**\r\n   * Correct currZoomLevel and pan if they are\r\n   * beyond minimum or maximum values.\r\n   * With animation.\r\n   *\r\n   * @param {boolean} [ignoreGesture]\r\n   * Wether gesture coordinates should be ignored when calculating destination pan position.\r\n   */\n\n\n  correctZoomPan(ignoreGesture) {\n    const {\n      pswp\n    } = this.gestures;\n    const {\n      currSlide\n    } = pswp;\n\n    if (!(currSlide !== null && currSlide !== void 0 && currSlide.isZoomable())) {\n      return;\n    }\n\n    if (this._zoomPoint.x === 0) {\n      ignoreGesture = true;\n    }\n\n    const prevZoomLevel = currSlide.currZoomLevel;\n    /** @type {number} */\n\n    let destinationZoomLevel;\n    let currZoomLevelNeedsChange = true;\n\n    if (prevZoomLevel < currSlide.zoomLevels.initial) {\n      destinationZoomLevel = currSlide.zoomLevels.initial; // zoom to min\n    } else if (prevZoomLevel > currSlide.zoomLevels.max) {\n      destinationZoomLevel = currSlide.zoomLevels.max; // zoom to max\n    } else {\n      currZoomLevelNeedsChange = false;\n      destinationZoomLevel = prevZoomLevel;\n    }\n\n    const initialBgOpacity = pswp.bgOpacity;\n    const restoreBgOpacity = pswp.bgOpacity < 1;\n    const initialPan = equalizePoints({\n      x: 0,\n      y: 0\n    }, currSlide.pan);\n    let destinationPan = equalizePoints({\n      x: 0,\n      y: 0\n    }, initialPan);\n\n    if (ignoreGesture) {\n      this._zoomPoint.x = 0;\n      this._zoomPoint.y = 0;\n      this._startZoomPoint.x = 0;\n      this._startZoomPoint.y = 0;\n      this._startZoomLevel = prevZoomLevel;\n      equalizePoints(this._startPan, initialPan);\n    }\n\n    if (currZoomLevelNeedsChange) {\n      destinationPan = {\n        x: this._calculatePanForZoomLevel('x', destinationZoomLevel),\n        y: this._calculatePanForZoomLevel('y', destinationZoomLevel)\n      };\n    } // set zoom level, so pan bounds are updated according to it\n\n\n    currSlide.setZoomLevel(destinationZoomLevel);\n    destinationPan = {\n      x: currSlide.bounds.correctPan('x', destinationPan.x),\n      y: currSlide.bounds.correctPan('y', destinationPan.y)\n    }; // return zoom level and its bounds to initial\n\n    currSlide.setZoomLevel(prevZoomLevel);\n    const panNeedsChange = !pointsEqual(destinationPan, initialPan);\n\n    if (!panNeedsChange && !currZoomLevelNeedsChange && !restoreBgOpacity) {\n      // update resolution after gesture\n      currSlide._setResolution(destinationZoomLevel);\n\n      currSlide.applyCurrentZoomPan(); // nothing to animate\n\n      return;\n    }\n\n    pswp.animations.stopAllPan();\n    pswp.animations.startSpring({\n      isPan: true,\n      start: 0,\n      end: 1000,\n      velocity: 0,\n      dampingRatio: 1,\n      naturalFrequency: 40,\n      onUpdate: now => {\n        now /= 1000; // 0 - start, 1 - end\n\n        if (panNeedsChange || currZoomLevelNeedsChange) {\n          if (panNeedsChange) {\n            currSlide.pan.x = initialPan.x + (destinationPan.x - initialPan.x) * now;\n            currSlide.pan.y = initialPan.y + (destinationPan.y - initialPan.y) * now;\n          }\n\n          if (currZoomLevelNeedsChange) {\n            const newZoomLevel = prevZoomLevel + (destinationZoomLevel - prevZoomLevel) * now;\n            currSlide.setZoomLevel(newZoomLevel);\n          }\n\n          currSlide.applyCurrentZoomPan();\n        } // Restore background opacity\n\n\n        if (restoreBgOpacity && pswp.bgOpacity < 1) {\n          // We clamp opacity to keep it between 0 and 1.\n          // As progress ratio can be larger than 1 due to overshoot,\n          // and we do not want to bounce opacity.\n          pswp.applyBgOpacity(clamp(initialBgOpacity + (1 - initialBgOpacity) * now, 0, 1));\n        }\n      },\n      onComplete: () => {\n        // update resolution after transition ends\n        currSlide._setResolution(destinationZoomLevel);\n\n        currSlide.applyCurrentZoomPan();\n      }\n    });\n  }\n\n}\n\n/**\r\n * @template {string} T\r\n * @template {string} P\r\n * @typedef {import('../types.js').AddPostfix<T, P>} AddPostfix<T, P>\r\n */\n\n/** @typedef {import('./gestures.js').default} Gestures */\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n\n/** @typedef {'imageClick' | 'bgClick' | 'tap' | 'doubleTap'} Actions */\n\n/**\r\n * Whether the tap was performed on the main slide\r\n * (rather than controls or caption).\r\n *\r\n * @param {PointerEvent} event\r\n * @returns {boolean}\r\n */\nfunction didTapOnMainContent(event) {\n  return !!\n  /** @type {HTMLElement} */\n  event.target.closest('.pswp__container');\n}\n/**\r\n * Tap, double-tap handler.\r\n */\n\n\nclass TapHandler {\n  /**\r\n   * @param {Gestures} gestures\r\n   */\n  constructor(gestures) {\n    this.gestures = gestures;\n  }\n  /**\r\n   * @param {Point} point\r\n   * @param {PointerEvent} originalEvent\r\n   */\n\n\n  click(point, originalEvent) {\n    const targetClassList =\n    /** @type {HTMLElement} */\n    originalEvent.target.classList;\n    const isImageClick = targetClassList.contains('pswp__img');\n    const isBackgroundClick = targetClassList.contains('pswp__item') || targetClassList.contains('pswp__zoom-wrap');\n\n    if (isImageClick) {\n      this._doClickOrTapAction('imageClick', point, originalEvent);\n    } else if (isBackgroundClick) {\n      this._doClickOrTapAction('bgClick', point, originalEvent);\n    }\n  }\n  /**\r\n   * @param {Point} point\r\n   * @param {PointerEvent} originalEvent\r\n   */\n\n\n  tap(point, originalEvent) {\n    if (didTapOnMainContent(originalEvent)) {\n      this._doClickOrTapAction('tap', point, originalEvent);\n    }\n  }\n  /**\r\n   * @param {Point} point\r\n   * @param {PointerEvent} originalEvent\r\n   */\n\n\n  doubleTap(point, originalEvent) {\n    if (didTapOnMainContent(originalEvent)) {\n      this._doClickOrTapAction('doubleTap', point, originalEvent);\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {Actions} actionName\r\n   * @param {Point} point\r\n   * @param {PointerEvent} originalEvent\r\n   */\n\n\n  _doClickOrTapAction(actionName, point, originalEvent) {\n    var _this$gestures$pswp$e;\n\n    const {\n      pswp\n    } = this.gestures;\n    const {\n      currSlide\n    } = pswp;\n    const actionFullName =\n    /** @type {AddPostfix<Actions, 'Action'>} */\n    actionName + 'Action';\n    const optionValue = pswp.options[actionFullName];\n\n    if (pswp.dispatch(actionFullName, {\n      point,\n      originalEvent\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (typeof optionValue === 'function') {\n      optionValue.call(pswp, point, originalEvent);\n      return;\n    }\n\n    switch (optionValue) {\n      case 'close':\n      case 'next':\n        pswp[optionValue]();\n        break;\n\n      case 'zoom':\n        currSlide === null || currSlide === void 0 || currSlide.toggleZoom(point);\n        break;\n\n      case 'zoom-or-close':\n        // by default click zooms current image,\n        // if it can not be zoomed - gallery will be closed\n        if (currSlide !== null && currSlide !== void 0 && currSlide.isZoomable() && currSlide.zoomLevels.secondary !== currSlide.zoomLevels.initial) {\n          currSlide.toggleZoom(point);\n        } else if (pswp.options.clickToCloseNonZoomable) {\n          pswp.close();\n        }\n\n        break;\n\n      case 'toggle-controls':\n        (_this$gestures$pswp$e = this.gestures.pswp.element) === null || _this$gestures$pswp$e === void 0 || _this$gestures$pswp$e.classList.toggle('pswp--ui-visible'); // if (_controlsVisible) {\n        //   _ui.hideControls();\n        // } else {\n        //   _ui.showControls();\n        // }\n\n        break;\n    }\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('../photoswipe.js').Point} Point */\n// How far should user should drag\n// until we can determine that the gesture is swipe and its direction\n\nconst AXIS_SWIPE_HYSTERISIS = 10; //const PAN_END_FRICTION = 0.35;\n\nconst DOUBLE_TAP_DELAY = 300; // ms\n\nconst MIN_TAP_DISTANCE = 25; // px\n\n/**\r\n * Gestures class bind touch, pointer or mouse events\r\n * and emits drag to drag-handler and zoom events zoom-handler.\r\n *\r\n * Drag and zoom events are emited in requestAnimationFrame,\r\n * and only when one of pointers was actually changed.\r\n */\n\nclass Gestures {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    /** @type {'x' | 'y' | null} */\n\n    this.dragAxis = null; // point objects are defined once and reused\n    // PhotoSwipe keeps track only of two pointers, others are ignored\n\n    /** @type {Point} */\n\n    this.p1 = {\n      x: 0,\n      y: 0\n    }; // the first pressed pointer\n\n    /** @type {Point} */\n\n    this.p2 = {\n      x: 0,\n      y: 0\n    }; // the second pressed pointer\n\n    /** @type {Point} */\n\n    this.prevP1 = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point} */\n\n    this.prevP2 = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point} */\n\n    this.startP1 = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point} */\n\n    this.startP2 = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point} */\n\n    this.velocity = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point}\r\n     * @private\r\n     */\n\n    this._lastStartP1 = {\n      x: 0,\n      y: 0\n    };\n    /** @type {Point}\r\n     * @private\r\n     */\n\n    this._intervalP1 = {\n      x: 0,\n      y: 0\n    };\n    /** @private */\n\n    this._numActivePoints = 0;\n    /** @type {Point[]}\r\n     * @private\r\n     */\n\n    this._ongoingPointers = [];\n    /** @private */\n\n    this._touchEventEnabled = 'ontouchstart' in window;\n    /** @private */\n\n    this._pointerEventEnabled = !!window.PointerEvent;\n    this.supportsTouch = this._touchEventEnabled || this._pointerEventEnabled && navigator.maxTouchPoints > 1;\n    /** @private */\n\n    this._numActivePoints = 0;\n    /** @private */\n\n    this._intervalTime = 0;\n    /** @private */\n\n    this._velocityCalculated = false;\n    this.isMultitouch = false;\n    this.isDragging = false;\n    this.isZooming = false;\n    /** @type {number | null} */\n\n    this.raf = null;\n    /** @type {NodeJS.Timeout | null}\r\n     * @private\r\n     */\n\n    this._tapTimer = null;\n\n    if (!this.supportsTouch) {\n      // disable pan to next slide for non-touch devices\n      pswp.options.allowPanToNext = false;\n    }\n\n    this.drag = new DragHandler(this);\n    this.zoomLevels = new ZoomHandler(this);\n    this.tapHandler = new TapHandler(this);\n    pswp.on('bindEvents', () => {\n      pswp.events.add(pswp.scrollWrap, 'click',\n      /** @type EventListener */\n      this._onClick.bind(this));\n\n      if (this._pointerEventEnabled) {\n        this._bindEvents('pointer', 'down', 'up', 'cancel');\n      } else if (this._touchEventEnabled) {\n        this._bindEvents('touch', 'start', 'end', 'cancel'); // In previous versions we also bound mouse event here,\n        // in case device supports both touch and mouse events,\n        // but newer versions of browsers now support PointerEvent.\n        // on iOS10 if you bind touchmove/end after touchstart,\n        // and you don't preventDefault touchstart (which PhotoSwipe does),\n        // preventDefault will have no effect on touchmove and touchend.\n        // Unless you bind it previously.\n\n\n        if (pswp.scrollWrap) {\n          pswp.scrollWrap.ontouchmove = () => {};\n\n          pswp.scrollWrap.ontouchend = () => {};\n        }\n      } else {\n        this._bindEvents('mouse', 'down', 'up');\n      }\n    });\n  }\n  /**\r\n   * @private\r\n   * @param {'mouse' | 'touch' | 'pointer'} pref\r\n   * @param {'down' | 'start'} down\r\n   * @param {'up' | 'end'} up\r\n   * @param {'cancel'} [cancel]\r\n   */\n\n\n  _bindEvents(pref, down, up, cancel) {\n    const {\n      pswp\n    } = this;\n    const {\n      events\n    } = pswp;\n    const cancelEvent = cancel ? pref + cancel : '';\n    events.add(pswp.scrollWrap, pref + down,\n    /** @type EventListener */\n    this.onPointerDown.bind(this));\n    events.add(window, pref + 'move',\n    /** @type EventListener */\n    this.onPointerMove.bind(this));\n    events.add(window, pref + up,\n    /** @type EventListener */\n    this.onPointerUp.bind(this));\n\n    if (cancelEvent) {\n      events.add(pswp.scrollWrap, cancelEvent,\n      /** @type EventListener */\n      this.onPointerUp.bind(this));\n    }\n  }\n  /**\r\n   * @param {PointerEvent} e\r\n   */\n\n\n  onPointerDown(e) {\n    // We do not call preventDefault for touch events\n    // to allow browser to show native dialog on longpress\n    // (the one that allows to save image or open it in new tab).\n    //\n    // Desktop Safari allows to drag images when preventDefault isn't called on mousedown,\n    // even though preventDefault IS called on mousemove. That's why we preventDefault mousedown.\n    const isMousePointer = e.type === 'mousedown' || e.pointerType === 'mouse'; // Allow dragging only via left mouse button.\n    // http://www.quirksmode.org/js/events_properties.html\n    // https://developer.mozilla.org/en-US/docs/Web/API/event.button\n\n    if (isMousePointer && e.button > 0) {\n      return;\n    }\n\n    const {\n      pswp\n    } = this; // if PhotoSwipe is opening or closing\n\n    if (!pswp.opener.isOpen) {\n      e.preventDefault();\n      return;\n    }\n\n    if (pswp.dispatch('pointerDown', {\n      originalEvent: e\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (isMousePointer) {\n      pswp.mouseDetected(); // preventDefault mouse event to prevent\n      // browser image drag feature\n\n      this._preventPointerEventBehaviour(e, 'down');\n    }\n\n    pswp.animations.stopAll();\n\n    this._updatePoints(e, 'down');\n\n    if (this._numActivePoints === 1) {\n      this.dragAxis = null; // we need to store initial point to determine the main axis,\n      // drag is activated only after the axis is determined\n\n      equalizePoints(this.startP1, this.p1);\n    }\n\n    if (this._numActivePoints > 1) {\n      // Tap or double tap should not trigger if more than one pointer\n      this._clearTapTimer();\n\n      this.isMultitouch = true;\n    } else {\n      this.isMultitouch = false;\n    }\n  }\n  /**\r\n   * @param {PointerEvent} e\r\n   */\n\n\n  onPointerMove(e) {\n    this._preventPointerEventBehaviour(e, 'move');\n\n    if (!this._numActivePoints) {\n      return;\n    }\n\n    this._updatePoints(e, 'move');\n\n    if (this.pswp.dispatch('pointerMove', {\n      originalEvent: e\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (this._numActivePoints === 1 && !this.isDragging) {\n      if (!this.dragAxis) {\n        this._calculateDragDirection();\n      } // Drag axis was detected, emit drag.start\n\n\n      if (this.dragAxis && !this.isDragging) {\n        if (this.isZooming) {\n          this.isZooming = false;\n          this.zoomLevels.end();\n        }\n\n        this.isDragging = true;\n\n        this._clearTapTimer(); // Tap can not trigger after drag\n        // Adjust starting point\n\n\n        this._updateStartPoints();\n\n        this._intervalTime = Date.now(); //this._startTime = this._intervalTime;\n\n        this._velocityCalculated = false;\n        equalizePoints(this._intervalP1, this.p1);\n        this.velocity.x = 0;\n        this.velocity.y = 0;\n        this.drag.start();\n\n        this._rafStopLoop();\n\n        this._rafRenderLoop();\n      }\n    } else if (this._numActivePoints > 1 && !this.isZooming) {\n      this._finishDrag();\n\n      this.isZooming = true; // Adjust starting points\n\n      this._updateStartPoints();\n\n      this.zoomLevels.start();\n\n      this._rafStopLoop();\n\n      this._rafRenderLoop();\n    }\n  }\n  /**\r\n   * @private\r\n   */\n\n\n  _finishDrag() {\n    if (this.isDragging) {\n      this.isDragging = false; // Try to calculate velocity,\n      // if it wasn't calculated yet in drag.change\n\n      if (!this._velocityCalculated) {\n        this._updateVelocity(true);\n      }\n\n      this.drag.end();\n      this.dragAxis = null;\n    }\n  }\n  /**\r\n   * @param {PointerEvent} e\r\n   */\n\n\n  onPointerUp(e) {\n    if (!this._numActivePoints) {\n      return;\n    }\n\n    this._updatePoints(e, 'up');\n\n    if (this.pswp.dispatch('pointerUp', {\n      originalEvent: e\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (this._numActivePoints === 0) {\n      this._rafStopLoop();\n\n      if (this.isDragging) {\n        this._finishDrag();\n      } else if (!this.isZooming && !this.isMultitouch) {\n        //this.zoomLevels.correctZoomPan();\n        this._finishTap(e);\n      }\n    }\n\n    if (this._numActivePoints < 2 && this.isZooming) {\n      this.isZooming = false;\n      this.zoomLevels.end();\n\n      if (this._numActivePoints === 1) {\n        // Since we have 1 point left, we need to reinitiate drag\n        this.dragAxis = null;\n\n        this._updateStartPoints();\n      }\n    }\n  }\n  /**\r\n   * @private\r\n   */\n\n\n  _rafRenderLoop() {\n    if (this.isDragging || this.isZooming) {\n      this._updateVelocity();\n\n      if (this.isDragging) {\n        // make sure that pointer moved since the last update\n        if (!pointsEqual(this.p1, this.prevP1)) {\n          this.drag.change();\n        }\n      } else\n        /* if (this.isZooming) */\n        {\n          if (!pointsEqual(this.p1, this.prevP1) || !pointsEqual(this.p2, this.prevP2)) {\n            this.zoomLevels.change();\n          }\n        }\n\n      this._updatePrevPoints();\n\n      this.raf = requestAnimationFrame(this._rafRenderLoop.bind(this));\n    }\n  }\n  /**\r\n   * Update velocity at 50ms interval\r\n   *\r\n   * @private\r\n   * @param {boolean} [force]\r\n   */\n\n\n  _updateVelocity(force) {\n    const time = Date.now();\n    const duration = time - this._intervalTime;\n\n    if (duration < 50 && !force) {\n      return;\n    }\n\n    this.velocity.x = this._getVelocity('x', duration);\n    this.velocity.y = this._getVelocity('y', duration);\n    this._intervalTime = time;\n    equalizePoints(this._intervalP1, this.p1);\n    this._velocityCalculated = true;\n  }\n  /**\r\n   * @private\r\n   * @param {PointerEvent} e\r\n   */\n\n\n  _finishTap(e) {\n    const {\n      mainScroll\n    } = this.pswp; // Do not trigger tap events if main scroll is shifted\n\n    if (mainScroll.isShifted()) {\n      // restore main scroll position\n      // (usually happens if stopped in the middle of animation)\n      mainScroll.moveIndexBy(0, true);\n      return;\n    } // Do not trigger tap for touchcancel or pointercancel\n\n\n    if (e.type.indexOf('cancel') > 0) {\n      return;\n    } // Trigger click instead of tap for mouse events\n\n\n    if (e.type === 'mouseup' || e.pointerType === 'mouse') {\n      this.tapHandler.click(this.startP1, e);\n      return;\n    } // Disable delay if there is no doubleTapAction\n\n\n    const tapDelay = this.pswp.options.doubleTapAction ? DOUBLE_TAP_DELAY : 0; // If tapTimer is defined - we tapped recently,\n    // check if the current tap is close to the previous one,\n    // if yes - trigger double tap\n\n    if (this._tapTimer) {\n      this._clearTapTimer(); // Check if two taps were more or less on the same place\n\n\n      if (getDistanceBetween(this._lastStartP1, this.startP1) < MIN_TAP_DISTANCE) {\n        this.tapHandler.doubleTap(this.startP1, e);\n      }\n    } else {\n      equalizePoints(this._lastStartP1, this.startP1);\n      this._tapTimer = setTimeout(() => {\n        this.tapHandler.tap(this.startP1, e);\n\n        this._clearTapTimer();\n      }, tapDelay);\n    }\n  }\n  /**\r\n   * @private\r\n   */\n\n\n  _clearTapTimer() {\n    if (this._tapTimer) {\n      clearTimeout(this._tapTimer);\n      this._tapTimer = null;\n    }\n  }\n  /**\r\n   * Get velocity for axis\r\n   *\r\n   * @private\r\n   * @param {'x' | 'y'} axis\r\n   * @param {number} duration\r\n   * @returns {number}\r\n   */\n\n\n  _getVelocity(axis, duration) {\n    // displacement is like distance, but can be negative.\n    const displacement = this.p1[axis] - this._intervalP1[axis];\n\n    if (Math.abs(displacement) > 1 && duration > 5) {\n      return displacement / duration;\n    }\n\n    return 0;\n  }\n  /**\r\n   * @private\r\n   */\n\n\n  _rafStopLoop() {\n    if (this.raf) {\n      cancelAnimationFrame(this.raf);\n      this.raf = null;\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {PointerEvent} e\r\n   * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type\r\n   */\n\n\n  _preventPointerEventBehaviour(e, pointerType) {\n    const preventPointerEvent = this.pswp.applyFilters('preventPointerEvent', true, e, pointerType);\n\n    if (preventPointerEvent) {\n      e.preventDefault();\n    }\n  }\n  /**\r\n   * Parses and normalizes points from the touch, mouse or pointer event.\r\n   * Updates p1 and p2.\r\n   *\r\n   * @private\r\n   * @param {PointerEvent | TouchEvent} e\r\n   * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type\r\n   */\n\n\n  _updatePoints(e, pointerType) {\n    if (this._pointerEventEnabled) {\n      const pointerEvent =\n      /** @type {PointerEvent} */\n      e; // Try to find the current pointer in ongoing pointers by its ID\n\n      const pointerIndex = this._ongoingPointers.findIndex(ongoingPointer => {\n        return ongoingPointer.id === pointerEvent.pointerId;\n      });\n\n      if (pointerType === 'up' && pointerIndex > -1) {\n        // release the pointer - remove it from ongoing\n        this._ongoingPointers.splice(pointerIndex, 1);\n      } else if (pointerType === 'down' && pointerIndex === -1) {\n        // add new pointer\n        this._ongoingPointers.push(this._convertEventPosToPoint(pointerEvent, {\n          x: 0,\n          y: 0\n        }));\n      } else if (pointerIndex > -1) {\n        // update existing pointer\n        this._convertEventPosToPoint(pointerEvent, this._ongoingPointers[pointerIndex]);\n      }\n\n      this._numActivePoints = this._ongoingPointers.length; // update points that PhotoSwipe uses\n      // to calculate position and scale\n\n      if (this._numActivePoints > 0) {\n        equalizePoints(this.p1, this._ongoingPointers[0]);\n      }\n\n      if (this._numActivePoints > 1) {\n        equalizePoints(this.p2, this._ongoingPointers[1]);\n      }\n    } else {\n      const touchEvent =\n      /** @type {TouchEvent} */\n      e;\n      this._numActivePoints = 0;\n\n      if (touchEvent.type.indexOf('touch') > -1) {\n        // Touch Event\n        // https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n        if (touchEvent.touches && touchEvent.touches.length > 0) {\n          this._convertEventPosToPoint(touchEvent.touches[0], this.p1);\n\n          this._numActivePoints++;\n\n          if (touchEvent.touches.length > 1) {\n            this._convertEventPosToPoint(touchEvent.touches[1], this.p2);\n\n            this._numActivePoints++;\n          }\n        }\n      } else {\n        // Mouse Event\n        this._convertEventPosToPoint(\n        /** @type {PointerEvent} */\n        e, this.p1);\n\n        if (pointerType === 'up') {\n          // clear all points on mouseup\n          this._numActivePoints = 0;\n        } else {\n          this._numActivePoints++;\n        }\n      }\n    }\n  }\n  /** update points that were used during previous rAF tick\r\n   * @private\r\n   */\n\n\n  _updatePrevPoints() {\n    equalizePoints(this.prevP1, this.p1);\n    equalizePoints(this.prevP2, this.p2);\n  }\n  /** update points at the start of gesture\r\n   * @private\r\n   */\n\n\n  _updateStartPoints() {\n    equalizePoints(this.startP1, this.p1);\n    equalizePoints(this.startP2, this.p2);\n\n    this._updatePrevPoints();\n  }\n  /** @private */\n\n\n  _calculateDragDirection() {\n    if (this.pswp.mainScroll.isShifted()) {\n      // if main scroll position is shifted – direction is always horizontal\n      this.dragAxis = 'x';\n    } else {\n      // calculate delta of the last touchmove tick\n      const diff = Math.abs(this.p1.x - this.startP1.x) - Math.abs(this.p1.y - this.startP1.y);\n\n      if (diff !== 0) {\n        // check if pointer was shifted horizontally or vertically\n        const axisToCheck = diff > 0 ? 'x' : 'y';\n\n        if (Math.abs(this.p1[axisToCheck] - this.startP1[axisToCheck]) >= AXIS_SWIPE_HYSTERISIS) {\n          this.dragAxis = axisToCheck;\n        }\n      }\n    }\n  }\n  /**\r\n   * Converts touch, pointer or mouse event\r\n   * to PhotoSwipe point.\r\n   *\r\n   * @private\r\n   * @param {Touch | PointerEvent} e\r\n   * @param {Point} p\r\n   * @returns {Point}\r\n   */\n\n\n  _convertEventPosToPoint(e, p) {\n    p.x = e.pageX - this.pswp.offset.x;\n    p.y = e.pageY - this.pswp.offset.y;\n\n    if ('pointerId' in e) {\n      p.id = e.pointerId;\n    } else if (e.identifier !== undefined) {\n      p.id = e.identifier;\n    }\n\n    return p;\n  }\n  /**\r\n   * @private\r\n   * @param {PointerEvent} e\r\n   */\n\n\n  _onClick(e) {\n    // Do not allow click event to pass through after drag\n    if (this.pswp.mainScroll.isShifted()) {\n      e.preventDefault();\n      e.stopPropagation();\n    }\n  }\n\n}\n\n/** @typedef {import('./photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('./slide/slide.js').default} Slide */\n\n/** @typedef {{ el: HTMLDivElement; slide?: Slide }} ItemHolder */\n\nconst MAIN_SCROLL_END_FRICTION = 0.35; // const MIN_SWIPE_TRANSITION_DURATION = 250;\n// const MAX_SWIPE_TRABSITION_DURATION = 500;\n// const DEFAULT_SWIPE_TRANSITION_DURATION = 333;\n\n/**\r\n * Handles movement of the main scrolling container\r\n * (for example, it repositions when user swipes left or right).\r\n *\r\n * Also stores its state.\r\n */\n\nclass MainScroll {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    this.x = 0;\n    this.slideWidth = 0;\n    /** @private */\n\n    this._currPositionIndex = 0;\n    /** @private */\n\n    this._prevPositionIndex = 0;\n    /** @private */\n\n    this._containerShiftIndex = -1;\n    /** @type {ItemHolder[]} */\n\n    this.itemHolders = [];\n  }\n  /**\r\n   * Position the scroller and slide containers\r\n   * according to viewport size.\r\n   *\r\n   * @param {boolean} [resizeSlides] Whether slides content should resized\r\n   */\n\n\n  resize(resizeSlides) {\n    const {\n      pswp\n    } = this;\n    const newSlideWidth = Math.round(pswp.viewportSize.x + pswp.viewportSize.x * pswp.options.spacing); // Mobile browsers might trigger a resize event during a gesture.\n    // (due to toolbar appearing or hiding).\n    // Avoid re-adjusting main scroll position if width wasn't changed\n\n    const slideWidthChanged = newSlideWidth !== this.slideWidth;\n\n    if (slideWidthChanged) {\n      this.slideWidth = newSlideWidth;\n      this.moveTo(this.getCurrSlideX());\n    }\n\n    this.itemHolders.forEach((itemHolder, index) => {\n      if (slideWidthChanged) {\n        setTransform(itemHolder.el, (index + this._containerShiftIndex) * this.slideWidth);\n      }\n\n      if (resizeSlides && itemHolder.slide) {\n        itemHolder.slide.resize();\n      }\n    });\n  }\n  /**\r\n   * Reset X position of the main scroller to zero\r\n   */\n\n\n  resetPosition() {\n    // Position on the main scroller (offset)\n    // it is independent from slide index\n    this._currPositionIndex = 0;\n    this._prevPositionIndex = 0; // This will force recalculation of size on next resize()\n\n    this.slideWidth = 0; // _containerShiftIndex*viewportSize will give you amount of transform of the current slide\n\n    this._containerShiftIndex = -1;\n  }\n  /**\r\n   * Create and append array of three items\r\n   * that hold data about slides in DOM\r\n   */\n\n\n  appendHolders() {\n    this.itemHolders = []; // append our three slide holders -\n    // previous, current, and next\n\n    for (let i = 0; i < 3; i++) {\n      const el = createElement('pswp__item', 'div', this.pswp.container);\n      el.setAttribute('role', 'group');\n      el.setAttribute('aria-roledescription', 'slide');\n      el.setAttribute('aria-hidden', 'true'); // hide nearby item holders until initial zoom animation finishes (to avoid extra Paints)\n\n      el.style.display = i === 1 ? 'block' : 'none';\n      this.itemHolders.push({\n        el //index: -1\n\n      });\n    }\n  }\n  /**\r\n   * Whether the main scroll can be horizontally swiped to the next or previous slide.\r\n   * @returns {boolean}\r\n   */\n\n\n  canBeSwiped() {\n    return this.pswp.getNumItems() > 1;\n  }\n  /**\r\n   * Move main scroll by X amount of slides.\r\n   * For example:\r\n   *   `-1` will move to the previous slide,\r\n   *    `0` will reset the scroll position of the current slide,\r\n   *    `3` will move three slides forward\r\n   *\r\n   * If loop option is enabled - index will be automatically looped too,\r\n   * (for example `-1` will move to the last slide of the gallery).\r\n   *\r\n   * @param {number} diff\r\n   * @param {boolean} [animate]\r\n   * @param {number} [velocityX]\r\n   * @returns {boolean} whether index was changed or not\r\n   */\n\n\n  moveIndexBy(diff, animate, velocityX) {\n    const {\n      pswp\n    } = this;\n    let newIndex = pswp.potentialIndex + diff;\n    const numSlides = pswp.getNumItems();\n\n    if (pswp.canLoop()) {\n      newIndex = pswp.getLoopedIndex(newIndex);\n      const distance = (diff + numSlides) % numSlides;\n\n      if (distance <= numSlides / 2) {\n        // go forward\n        diff = distance;\n      } else {\n        // go backwards\n        diff = distance - numSlides;\n      }\n    } else {\n      if (newIndex < 0) {\n        newIndex = 0;\n      } else if (newIndex >= numSlides) {\n        newIndex = numSlides - 1;\n      }\n\n      diff = newIndex - pswp.potentialIndex;\n    }\n\n    pswp.potentialIndex = newIndex;\n    this._currPositionIndex -= diff;\n    pswp.animations.stopMainScroll();\n    const destinationX = this.getCurrSlideX();\n\n    if (!animate) {\n      this.moveTo(destinationX);\n      this.updateCurrItem();\n    } else {\n      pswp.animations.startSpring({\n        isMainScroll: true,\n        start: this.x,\n        end: destinationX,\n        velocity: velocityX || 0,\n        naturalFrequency: 30,\n        dampingRatio: 1,\n        //0.7,\n        onUpdate: x => {\n          this.moveTo(x);\n        },\n        onComplete: () => {\n          this.updateCurrItem();\n          pswp.appendHeavy();\n        }\n      });\n      let currDiff = pswp.potentialIndex - pswp.currIndex;\n\n      if (pswp.canLoop()) {\n        const currDistance = (currDiff + numSlides) % numSlides;\n\n        if (currDistance <= numSlides / 2) {\n          // go forward\n          currDiff = currDistance;\n        } else {\n          // go backwards\n          currDiff = currDistance - numSlides;\n        }\n      } // Force-append new slides during transition\n      // if difference between slides is more than 1\n\n\n      if (Math.abs(currDiff) > 1) {\n        this.updateCurrItem();\n      }\n    }\n\n    return Boolean(diff);\n  }\n  /**\r\n   * X position of the main scroll for the current slide\r\n   * (ignores position during dragging)\r\n   * @returns {number}\r\n   */\n\n\n  getCurrSlideX() {\n    return this.slideWidth * this._currPositionIndex;\n  }\n  /**\r\n   * Whether scroll position is shifted.\r\n   * For example, it will return true if the scroll is being dragged or animated.\r\n   * @returns {boolean}\r\n   */\n\n\n  isShifted() {\n    return this.x !== this.getCurrSlideX();\n  }\n  /**\r\n   * Update slides X positions and set their content\r\n   */\n\n\n  updateCurrItem() {\n    var _this$itemHolders$;\n\n    const {\n      pswp\n    } = this;\n    const positionDifference = this._prevPositionIndex - this._currPositionIndex;\n\n    if (!positionDifference) {\n      return;\n    }\n\n    this._prevPositionIndex = this._currPositionIndex;\n    pswp.currIndex = pswp.potentialIndex;\n    let diffAbs = Math.abs(positionDifference);\n    /** @type {ItemHolder | undefined} */\n\n    let tempHolder;\n\n    if (diffAbs >= 3) {\n      this._containerShiftIndex += positionDifference + (positionDifference > 0 ? -3 : 3);\n      diffAbs = 3; // If slides are changed by 3 screens or more - clean up previous slides\n\n      this.itemHolders.forEach(itemHolder => {\n        var _itemHolder$slide;\n\n        (_itemHolder$slide = itemHolder.slide) === null || _itemHolder$slide === void 0 || _itemHolder$slide.destroy();\n        itemHolder.slide = undefined;\n      });\n    }\n\n    for (let i = 0; i < diffAbs; i++) {\n      if (positionDifference > 0) {\n        tempHolder = this.itemHolders.shift();\n\n        if (tempHolder) {\n          this.itemHolders[2] = tempHolder; // move first to last\n\n          this._containerShiftIndex++;\n          setTransform(tempHolder.el, (this._containerShiftIndex + 2) * this.slideWidth);\n          pswp.setContent(tempHolder, pswp.currIndex - diffAbs + i + 2);\n        }\n      } else {\n        tempHolder = this.itemHolders.pop();\n\n        if (tempHolder) {\n          this.itemHolders.unshift(tempHolder); // move last to first\n\n          this._containerShiftIndex--;\n          setTransform(tempHolder.el, this._containerShiftIndex * this.slideWidth);\n          pswp.setContent(tempHolder, pswp.currIndex + diffAbs - i - 2);\n        }\n      }\n    } // Reset transfrom every 50ish navigations in one direction.\n    //\n    // Otherwise transform will keep growing indefinitely,\n    // which might cause issues as browsers have a maximum transform limit.\n    // I wasn't able to reach it, but just to be safe.\n    // This should not cause noticable lag.\n\n\n    if (Math.abs(this._containerShiftIndex) > 50 && !this.isShifted()) {\n      this.resetPosition();\n      this.resize();\n    } // Pan transition might be running (and consntantly updating pan position)\n\n\n    pswp.animations.stopAllPan();\n    this.itemHolders.forEach((itemHolder, i) => {\n      if (itemHolder.slide) {\n        // Slide in the 2nd holder is always active\n        itemHolder.slide.setIsActive(i === 1);\n      }\n    });\n    pswp.currSlide = (_this$itemHolders$ = this.itemHolders[1]) === null || _this$itemHolders$ === void 0 ? void 0 : _this$itemHolders$.slide;\n    pswp.contentLoader.updateLazy(positionDifference);\n\n    if (pswp.currSlide) {\n      pswp.currSlide.applyCurrentZoomPan();\n    }\n\n    pswp.dispatch('change');\n  }\n  /**\r\n   * Move the X position of the main scroll container\r\n   *\r\n   * @param {number} x\r\n   * @param {boolean} [dragging]\r\n   */\n\n\n  moveTo(x, dragging) {\n    if (!this.pswp.canLoop() && dragging) {\n      // Apply friction\n      let newSlideIndexOffset = (this.slideWidth * this._currPositionIndex - x) / this.slideWidth;\n      newSlideIndexOffset += this.pswp.currIndex;\n      const delta = Math.round(x - this.x);\n\n      if (newSlideIndexOffset < 0 && delta > 0 || newSlideIndexOffset >= this.pswp.getNumItems() - 1 && delta < 0) {\n        x = this.x + delta * MAIN_SCROLL_END_FRICTION;\n      }\n    }\n\n    this.x = x;\n\n    if (this.pswp.container) {\n      setTransform(this.pswp.container, x);\n    }\n\n    this.pswp.dispatch('moveMainScroll', {\n      x,\n      dragging: dragging !== null && dragging !== void 0 ? dragging : false\n    });\n  }\n\n}\n\n/** @typedef {import('./photoswipe.js').default} PhotoSwipe */\n\n/**\r\n * @template T\r\n * @typedef {import('./types.js').Methods<T>} Methods<T>\r\n */\n\nconst KeyboardKeyCodesMap = {\n  Escape: 27,\n  z: 90,\n  ArrowLeft: 37,\n  ArrowUp: 38,\n  ArrowRight: 39,\n  ArrowDown: 40,\n  Tab: 9\n};\n/**\r\n * @template {keyof KeyboardKeyCodesMap} T\r\n * @param {T} key\r\n * @param {boolean} isKeySupported\r\n * @returns {T | number | undefined}\r\n */\n\nconst getKeyboardEventKey = (key, isKeySupported) => {\n  return isKeySupported ? key : KeyboardKeyCodesMap[key];\n};\n/**\r\n * - Manages keyboard shortcuts.\r\n * - Helps trap focus within photoswipe.\r\n */\n\n\nclass Keyboard {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    /** @private */\n\n    this._wasFocused = false;\n    pswp.on('bindEvents', () => {\n      if (pswp.options.trapFocus) {\n        // Dialog was likely opened by keyboard if initial point is not defined\n        if (!pswp.options.initialPointerPos) {\n          // focus causes layout,\n          // which causes lag during the animation,\n          // that's why we delay it until the opener transition ends\n          this._focusRoot();\n        }\n\n        pswp.events.add(document, 'focusin',\n        /** @type EventListener */\n        this._onFocusIn.bind(this));\n      }\n\n      pswp.events.add(document, 'keydown',\n      /** @type EventListener */\n      this._onKeyDown.bind(this));\n    });\n    const lastActiveElement =\n    /** @type {HTMLElement} */\n    document.activeElement;\n    pswp.on('destroy', () => {\n      if (pswp.options.returnFocus && lastActiveElement && this._wasFocused) {\n        lastActiveElement.focus();\n      }\n    });\n  }\n  /** @private */\n\n\n  _focusRoot() {\n    if (!this._wasFocused && this.pswp.element) {\n      this.pswp.element.focus();\n      this._wasFocused = true;\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {KeyboardEvent} e\r\n   */\n\n\n  _onKeyDown(e) {\n    const {\n      pswp\n    } = this;\n\n    if (pswp.dispatch('keydown', {\n      originalEvent: e\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (specialKeyUsed(e)) {\n      // don't do anything if special key pressed\n      // to prevent from overriding default browser actions\n      // for example, in Chrome on Mac cmd+arrow-left returns to previous page\n      return;\n    }\n    /** @type {Methods<PhotoSwipe> | undefined} */\n\n\n    let keydownAction;\n    /** @type {'x' | 'y' | undefined} */\n\n    let axis;\n    let isForward = false;\n    const isKeySupported = ('key' in e);\n\n    switch (isKeySupported ? e.key : e.keyCode) {\n      case getKeyboardEventKey('Escape', isKeySupported):\n        if (pswp.options.escKey) {\n          keydownAction = 'close';\n        }\n\n        break;\n\n      case getKeyboardEventKey('z', isKeySupported):\n        keydownAction = 'toggleZoom';\n        break;\n\n      case getKeyboardEventKey('ArrowLeft', isKeySupported):\n        axis = 'x';\n        break;\n\n      case getKeyboardEventKey('ArrowUp', isKeySupported):\n        axis = 'y';\n        break;\n\n      case getKeyboardEventKey('ArrowRight', isKeySupported):\n        axis = 'x';\n        isForward = true;\n        break;\n\n      case getKeyboardEventKey('ArrowDown', isKeySupported):\n        isForward = true;\n        axis = 'y';\n        break;\n\n      case getKeyboardEventKey('Tab', isKeySupported):\n        this._focusRoot();\n\n        break;\n    } // if left/right/top/bottom key\n\n\n    if (axis) {\n      // prevent page scroll\n      e.preventDefault();\n      const {\n        currSlide\n      } = pswp;\n\n      if (pswp.options.arrowKeys && axis === 'x' && pswp.getNumItems() > 1) {\n        keydownAction = isForward ? 'next' : 'prev';\n      } else if (currSlide && currSlide.currZoomLevel > currSlide.zoomLevels.fit) {\n        // up/down arrow keys pan the image vertically\n        // left/right arrow keys pan horizontally.\n        // Unless there is only one image,\n        // or arrowKeys option is disabled\n        currSlide.pan[axis] += isForward ? -80 : 80;\n        currSlide.panTo(currSlide.pan.x, currSlide.pan.y);\n      }\n    }\n\n    if (keydownAction) {\n      e.preventDefault(); // @ts-ignore\n\n      pswp[keydownAction]();\n    }\n  }\n  /**\r\n   * Trap focus inside photoswipe\r\n   *\r\n   * @private\r\n   * @param {FocusEvent} e\r\n   */\n\n\n  _onFocusIn(e) {\n    const {\n      template\n    } = this.pswp;\n\n    if (template && document !== e.target && template !== e.target && !template.contains(\n    /** @type {Node} */\n    e.target)) {\n      // focus root element\n      template.focus();\n    }\n  }\n\n}\n\nconst DEFAULT_EASING = 'cubic-bezier(.4,0,.22,1)';\n/** @typedef {import('./animations.js').SharedAnimationProps} SharedAnimationProps */\n\n/** @typedef {Object} DefaultCssAnimationProps\r\n *\r\n * @prop {HTMLElement} target\r\n * @prop {number} [duration]\r\n * @prop {string} [easing]\r\n * @prop {string} [transform]\r\n * @prop {string} [opacity]\r\n * */\n\n/** @typedef {SharedAnimationProps & DefaultCssAnimationProps} CssAnimationProps */\n\n/**\r\n * Runs CSS transition.\r\n */\n\nclass CSSAnimation {\n  /**\r\n   * onComplete can be unpredictable, be careful about current state\r\n   *\r\n   * @param {CssAnimationProps} props\r\n   */\n  constructor(props) {\n    var _props$prop;\n\n    this.props = props;\n    const {\n      target,\n      onComplete,\n      transform,\n      onFinish = () => {},\n      duration = 333,\n      easing = DEFAULT_EASING\n    } = props;\n    this.onFinish = onFinish; // support only transform and opacity\n\n    const prop = transform ? 'transform' : 'opacity';\n    const propValue = (_props$prop = props[prop]) !== null && _props$prop !== void 0 ? _props$prop : '';\n    /** @private */\n\n    this._target = target;\n    /** @private */\n\n    this._onComplete = onComplete;\n    /** @private */\n\n    this._finished = false;\n    /** @private */\n\n    this._onTransitionEnd = this._onTransitionEnd.bind(this); // Using timeout hack to make sure that animation\n    // starts even if the animated property was changed recently,\n    // otherwise transitionend might not fire or transition won't start.\n    // https://drafts.csswg.org/css-transitions/#starting\n    //\n    // ¯\\_(ツ)_/¯\n\n    /** @private */\n\n    this._helperTimeout = setTimeout(() => {\n      setTransitionStyle(target, prop, duration, easing);\n      this._helperTimeout = setTimeout(() => {\n        target.addEventListener('transitionend', this._onTransitionEnd, false);\n        target.addEventListener('transitioncancel', this._onTransitionEnd, false); // Safari occasionally does not emit transitionend event\n        // if element property was modified during the transition,\n        // which may be caused by resize or third party component,\n        // using timeout as a safety fallback\n\n        this._helperTimeout = setTimeout(() => {\n          this._finalizeAnimation();\n        }, duration + 500);\n        target.style[prop] = propValue;\n      }, 30); // Do not reduce this number\n    }, 0);\n  }\n  /**\r\n   * @private\r\n   * @param {TransitionEvent} e\r\n   */\n\n\n  _onTransitionEnd(e) {\n    if (e.target === this._target) {\n      this._finalizeAnimation();\n    }\n  }\n  /**\r\n   * @private\r\n   */\n\n\n  _finalizeAnimation() {\n    if (!this._finished) {\n      this._finished = true;\n      this.onFinish();\n\n      if (this._onComplete) {\n        this._onComplete();\n      }\n    }\n  } // Destroy is called automatically onFinish\n\n\n  destroy() {\n    if (this._helperTimeout) {\n      clearTimeout(this._helperTimeout);\n    }\n\n    removeTransitionStyle(this._target);\n\n    this._target.removeEventListener('transitionend', this._onTransitionEnd, false);\n\n    this._target.removeEventListener('transitioncancel', this._onTransitionEnd, false);\n\n    if (!this._finished) {\n      this._finalizeAnimation();\n    }\n  }\n\n}\n\nconst DEFAULT_NATURAL_FREQUENCY = 12;\nconst DEFAULT_DAMPING_RATIO = 0.75;\n/**\r\n * Spring easing helper\r\n */\n\nclass SpringEaser {\n  /**\r\n   * @param {number} initialVelocity Initial velocity, px per ms.\r\n   *\r\n   * @param {number} [dampingRatio]\r\n   * Determines how bouncy animation will be.\r\n   * From 0 to 1, 0 - always overshoot, 1 - do not overshoot.\r\n   * \"overshoot\" refers to part of animation that\r\n   * goes beyond the final value.\r\n   *\r\n   * @param {number} [naturalFrequency]\r\n   * Determines how fast animation will slow down.\r\n   * The higher value - the stiffer the transition will be,\r\n   * and the faster it will slow down.\r\n   * Recommended value from 10 to 50\r\n   */\n  constructor(initialVelocity, dampingRatio, naturalFrequency) {\n    this.velocity = initialVelocity * 1000; // convert to \"pixels per second\"\n    // https://en.wikipedia.org/wiki/Damping_ratio\n\n    this._dampingRatio = dampingRatio || DEFAULT_DAMPING_RATIO; // https://en.wikipedia.org/wiki/Natural_frequency\n\n    this._naturalFrequency = naturalFrequency || DEFAULT_NATURAL_FREQUENCY;\n    this._dampedFrequency = this._naturalFrequency;\n\n    if (this._dampingRatio < 1) {\n      this._dampedFrequency *= Math.sqrt(1 - this._dampingRatio * this._dampingRatio);\n    }\n  }\n  /**\r\n   * @param {number} deltaPosition Difference between current and end position of the animation\r\n   * @param {number} deltaTime Frame duration in milliseconds\r\n   *\r\n   * @returns {number} Displacement, relative to the end position.\r\n   */\n\n\n  easeFrame(deltaPosition, deltaTime) {\n    // Inspired by Apple Webkit and Android spring function implementation\n    // https://en.wikipedia.org/wiki/Oscillation\n    // https://en.wikipedia.org/wiki/Damping_ratio\n    // we ignore mass (assume that it's 1kg)\n    let displacement = 0;\n    let coeff;\n    deltaTime /= 1000;\n    const naturalDumpingPow = Math.E ** (-this._dampingRatio * this._naturalFrequency * deltaTime);\n\n    if (this._dampingRatio === 1) {\n      coeff = this.velocity + this._naturalFrequency * deltaPosition;\n      displacement = (deltaPosition + coeff * deltaTime) * naturalDumpingPow;\n      this.velocity = displacement * -this._naturalFrequency + coeff * naturalDumpingPow;\n    } else if (this._dampingRatio < 1) {\n      coeff = 1 / this._dampedFrequency * (this._dampingRatio * this._naturalFrequency * deltaPosition + this.velocity);\n      const dumpedFCos = Math.cos(this._dampedFrequency * deltaTime);\n      const dumpedFSin = Math.sin(this._dampedFrequency * deltaTime);\n      displacement = naturalDumpingPow * (deltaPosition * dumpedFCos + coeff * dumpedFSin);\n      this.velocity = displacement * -this._naturalFrequency * this._dampingRatio + naturalDumpingPow * (-this._dampedFrequency * deltaPosition * dumpedFSin + this._dampedFrequency * coeff * dumpedFCos);\n    } // Overdamped (>1) damping ratio is not supported\n\n\n    return displacement;\n  }\n\n}\n\n/** @typedef {import('./animations.js').SharedAnimationProps} SharedAnimationProps */\n\n/**\r\n * @typedef {Object} DefaultSpringAnimationProps\r\n *\r\n * @prop {number} start\r\n * @prop {number} end\r\n * @prop {number} velocity\r\n * @prop {number} [dampingRatio]\r\n * @prop {number} [naturalFrequency]\r\n * @prop {(end: number) => void} onUpdate\r\n */\n\n/** @typedef {SharedAnimationProps & DefaultSpringAnimationProps} SpringAnimationProps */\n\nclass SpringAnimation {\n  /**\r\n   * @param {SpringAnimationProps} props\r\n   */\n  constructor(props) {\n    this.props = props;\n    this._raf = 0;\n    const {\n      start,\n      end,\n      velocity,\n      onUpdate,\n      onComplete,\n      onFinish = () => {},\n      dampingRatio,\n      naturalFrequency\n    } = props;\n    this.onFinish = onFinish;\n    const easer = new SpringEaser(velocity, dampingRatio, naturalFrequency);\n    let prevTime = Date.now();\n    let deltaPosition = start - end;\n\n    const animationLoop = () => {\n      if (this._raf) {\n        deltaPosition = easer.easeFrame(deltaPosition, Date.now() - prevTime); // Stop the animation if velocity is low and position is close to end\n\n        if (Math.abs(deltaPosition) < 1 && Math.abs(easer.velocity) < 50) {\n          // Finalize the animation\n          onUpdate(end);\n\n          if (onComplete) {\n            onComplete();\n          }\n\n          this.onFinish();\n        } else {\n          prevTime = Date.now();\n          onUpdate(deltaPosition + end);\n          this._raf = requestAnimationFrame(animationLoop);\n        }\n      }\n    };\n\n    this._raf = requestAnimationFrame(animationLoop);\n  } // Destroy is called automatically onFinish\n\n\n  destroy() {\n    if (this._raf >= 0) {\n      cancelAnimationFrame(this._raf);\n    }\n\n    this._raf = 0;\n  }\n\n}\n\n/** @typedef {import('./css-animation.js').CssAnimationProps} CssAnimationProps */\n\n/** @typedef {import('./spring-animation.js').SpringAnimationProps} SpringAnimationProps */\n\n/** @typedef {Object} SharedAnimationProps\r\n * @prop {string} [name]\r\n * @prop {boolean} [isPan]\r\n * @prop {boolean} [isMainScroll]\r\n * @prop {VoidFunction} [onComplete]\r\n * @prop {VoidFunction} [onFinish]\r\n */\n\n/** @typedef {SpringAnimation | CSSAnimation} Animation */\n\n/** @typedef {SpringAnimationProps | CssAnimationProps} AnimationProps */\n\n/**\r\n * Manages animations\r\n */\n\nclass Animations {\n  constructor() {\n    /** @type {Animation[]} */\n    this.activeAnimations = [];\n  }\n  /**\r\n   * @param {SpringAnimationProps} props\r\n   */\n\n\n  startSpring(props) {\n    this._start(props, true);\n  }\n  /**\r\n   * @param {CssAnimationProps} props\r\n   */\n\n\n  startTransition(props) {\n    this._start(props);\n  }\n  /**\r\n   * @private\r\n   * @param {AnimationProps} props\r\n   * @param {boolean} [isSpring]\r\n   * @returns {Animation}\r\n   */\n\n\n  _start(props, isSpring) {\n    const animation = isSpring ? new SpringAnimation(\n    /** @type SpringAnimationProps */\n    props) : new CSSAnimation(\n    /** @type CssAnimationProps */\n    props);\n    this.activeAnimations.push(animation);\n\n    animation.onFinish = () => this.stop(animation);\n\n    return animation;\n  }\n  /**\r\n   * @param {Animation} animation\r\n   */\n\n\n  stop(animation) {\n    animation.destroy();\n    const index = this.activeAnimations.indexOf(animation);\n\n    if (index > -1) {\n      this.activeAnimations.splice(index, 1);\n    }\n  }\n\n  stopAll() {\n    // _stopAllAnimations\n    this.activeAnimations.forEach(animation => {\n      animation.destroy();\n    });\n    this.activeAnimations = [];\n  }\n  /**\r\n   * Stop all pan or zoom transitions\r\n   */\n\n\n  stopAllPan() {\n    this.activeAnimations = this.activeAnimations.filter(animation => {\n      if (animation.props.isPan) {\n        animation.destroy();\n        return false;\n      }\n\n      return true;\n    });\n  }\n\n  stopMainScroll() {\n    this.activeAnimations = this.activeAnimations.filter(animation => {\n      if (animation.props.isMainScroll) {\n        animation.destroy();\n        return false;\n      }\n\n      return true;\n    });\n  }\n  /**\r\n   * Returns true if main scroll transition is running\r\n   */\n  // isMainScrollRunning() {\n  //   return this.activeAnimations.some((animation) => {\n  //     return animation.props.isMainScroll;\n  //   });\n  // }\n\n  /**\r\n   * Returns true if any pan or zoom transition is running\r\n   */\n\n\n  isPanRunning() {\n    return this.activeAnimations.some(animation => {\n      return animation.props.isPan;\n    });\n  }\n\n}\n\n/** @typedef {import('./photoswipe.js').default} PhotoSwipe */\n\n/**\r\n * Handles scroll wheel.\r\n * Can pan and zoom current slide image.\r\n */\nclass ScrollWheel {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    pswp.events.add(pswp.element, 'wheel',\n    /** @type EventListener */\n    this._onWheel.bind(this));\n  }\n  /**\r\n   * @private\r\n   * @param {WheelEvent} e\r\n   */\n\n\n  _onWheel(e) {\n    e.preventDefault();\n    const {\n      currSlide\n    } = this.pswp;\n    let {\n      deltaX,\n      deltaY\n    } = e;\n\n    if (!currSlide) {\n      return;\n    }\n\n    if (this.pswp.dispatch('wheel', {\n      originalEvent: e\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (e.ctrlKey || this.pswp.options.wheelToZoom) {\n      // zoom\n      if (currSlide.isZoomable()) {\n        let zoomFactor = -deltaY;\n\n        if (e.deltaMode === 1\n        /* DOM_DELTA_LINE */\n        ) {\n          zoomFactor *= 0.05;\n        } else {\n          zoomFactor *= e.deltaMode ? 1 : 0.002;\n        }\n\n        zoomFactor = 2 ** zoomFactor;\n        const destZoomLevel = currSlide.currZoomLevel * zoomFactor;\n        currSlide.zoomTo(destZoomLevel, {\n          x: e.clientX,\n          y: e.clientY\n        });\n      }\n    } else {\n      // pan\n      if (currSlide.isPannable()) {\n        if (e.deltaMode === 1\n        /* DOM_DELTA_LINE */\n        ) {\n          // 18 - average line height\n          deltaX *= 18;\n          deltaY *= 18;\n        }\n\n        currSlide.panTo(currSlide.pan.x - deltaX, currSlide.pan.y - deltaY);\n      }\n    }\n  }\n\n}\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/**\r\n * @template T\r\n * @typedef {import('../types.js').Methods<T>} Methods<T>\r\n */\n\n/**\r\n * @typedef {Object} UIElementMarkupProps\r\n * @prop {boolean} [isCustomSVG]\r\n * @prop {string} inner\r\n * @prop {string} [outlineID]\r\n * @prop {number | string} [size]\r\n */\n\n/**\r\n * @typedef {Object} UIElementData\r\n * @prop {DefaultUIElements | string} [name]\r\n * @prop {string} [className]\r\n * @prop {UIElementMarkup} [html]\r\n * @prop {boolean} [isButton]\r\n * @prop {keyof HTMLElementTagNameMap} [tagName]\r\n * @prop {string} [title]\r\n * @prop {string} [ariaLabel]\r\n * @prop {(element: HTMLElement, pswp: PhotoSwipe) => void} [onInit]\r\n * @prop {Methods<PhotoSwipe> | ((e: MouseEvent, element: HTMLElement, pswp: PhotoSwipe) => void)} [onClick]\r\n * @prop {'bar' | 'wrapper' | 'root'} [appendTo]\r\n * @prop {number} [order]\r\n */\n\n/** @typedef {'arrowPrev' | 'arrowNext' | 'close' | 'zoom' | 'counter'} DefaultUIElements */\n\n/** @typedef {string | UIElementMarkupProps} UIElementMarkup */\n\n/**\r\n * @param {UIElementMarkup} [htmlData]\r\n * @returns {string}\r\n */\n\nfunction addElementHTML(htmlData) {\n  if (typeof htmlData === 'string') {\n    // Allow developers to provide full svg,\n    // For example:\n    // <svg viewBox=\"0 0 32 32\" width=\"32\" height=\"32\" aria-hidden=\"true\" class=\"pswp__icn\">\n    //   <path d=\"...\" />\n    //   <circle ... />\n    // </svg>\n    // Can also be any HTML string.\n    return htmlData;\n  }\n\n  if (!htmlData || !htmlData.isCustomSVG) {\n    return '';\n  }\n\n  const svgData = htmlData;\n  let out = '<svg aria-hidden=\"true\" class=\"pswp__icn\" viewBox=\"0 0 %d %d\" width=\"%d\" height=\"%d\">'; // replace all %d with size\n\n  out = out.split('%d').join(\n  /** @type {string} */\n  svgData.size || 32); // Icons may contain outline/shadow,\n  // to make it we \"clone\" base icon shape and add border to it.\n  // Icon itself and border are styled via CSS.\n  //\n  // Property shadowID defines ID of element that should be cloned.\n\n  if (svgData.outlineID) {\n    out += '<use class=\"pswp__icn-shadow\" xlink:href=\"#' + svgData.outlineID + '\"/>';\n  }\n\n  out += svgData.inner;\n  out += '</svg>';\n  return out;\n}\n\nclass UIElement {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   * @param {UIElementData} data\r\n   */\n  constructor(pswp, data) {\n    var _container;\n\n    const name = data.name || data.className;\n    let elementHTML = data.html; // @ts-expect-error lookup only by `data.name` maybe?\n\n    if (pswp.options[name] === false) {\n      // exit if element is disabled from options\n      return;\n    } // Allow to override SVG icons from options\n    // @ts-expect-error lookup only by `data.name` maybe?\n\n\n    if (typeof pswp.options[name + 'SVG'] === 'string') {\n      // arrowPrevSVG\n      // arrowNextSVG\n      // closeSVG\n      // zoomSVG\n      // @ts-expect-error lookup only by `data.name` maybe?\n      elementHTML = pswp.options[name + 'SVG'];\n    }\n\n    pswp.dispatch('uiElementCreate', {\n      data\n    });\n    let className = '';\n\n    if (data.isButton) {\n      className += 'pswp__button ';\n      className += data.className || `pswp__button--${data.name}`;\n    } else {\n      className += data.className || `pswp__${data.name}`;\n    }\n\n    let tagName = data.isButton ? data.tagName || 'button' : data.tagName || 'div';\n    tagName =\n    /** @type {keyof HTMLElementTagNameMap} */\n    tagName.toLowerCase();\n    /** @type {HTMLElement} */\n\n    const element = createElement(className, tagName);\n\n    if (data.isButton) {\n      if (tagName === 'button') {\n        /** @type {HTMLButtonElement} */\n        element.type = 'button';\n      }\n\n      let {\n        title\n      } = data;\n      const {\n        ariaLabel\n      } = data; // @ts-expect-error lookup only by `data.name` maybe?\n\n      if (typeof pswp.options[name + 'Title'] === 'string') {\n        // @ts-expect-error lookup only by `data.name` maybe?\n        title = pswp.options[name + 'Title'];\n      }\n\n      if (title) {\n        element.title = title;\n      }\n\n      const ariaText = ariaLabel || title;\n\n      if (ariaText) {\n        element.setAttribute('aria-label', ariaText);\n      }\n    }\n\n    element.innerHTML = addElementHTML(elementHTML);\n\n    if (data.onInit) {\n      data.onInit(element, pswp);\n    }\n\n    if (data.onClick) {\n      element.onclick = e => {\n        if (typeof data.onClick === 'string') {\n          // @ts-ignore\n          pswp[data.onClick]();\n        } else if (typeof data.onClick === 'function') {\n          data.onClick(e, element, pswp);\n        }\n      };\n    } // Top bar is default position\n\n\n    const appendTo = data.appendTo || 'bar';\n    /** @type {HTMLElement | undefined} root element by default */\n\n    let container = pswp.element;\n\n    if (appendTo === 'bar') {\n      if (!pswp.topBar) {\n        pswp.topBar = createElement('pswp__top-bar pswp__hide-on-close', 'div', pswp.scrollWrap);\n      }\n\n      container = pswp.topBar;\n    } else {\n      // element outside of top bar gets a secondary class\n      // that makes element fade out on close\n      element.classList.add('pswp__hide-on-close');\n\n      if (appendTo === 'wrapper') {\n        container = pswp.scrollWrap;\n      }\n    }\n\n    (_container = container) === null || _container === void 0 || _container.appendChild(pswp.applyFilters('uiElement', element, data));\n  }\n\n}\n\n/*\r\n  Backward and forward arrow buttons\r\n */\n\n/** @typedef {import('./ui-element.js').UIElementData} UIElementData */\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/**\r\n *\r\n * @param {HTMLElement} element\r\n * @param {PhotoSwipe} pswp\r\n * @param {boolean} [isNextButton]\r\n */\nfunction initArrowButton(element, pswp, isNextButton) {\n  element.classList.add('pswp__button--arrow'); // TODO: this should point to a unique id for this instance\n\n  element.setAttribute('aria-controls', 'pswp__items');\n  pswp.on('change', () => {\n    if (!pswp.options.loop) {\n      if (isNextButton) {\n        /** @type {HTMLButtonElement} */\n        element.disabled = !(pswp.currIndex < pswp.getNumItems() - 1);\n      } else {\n        /** @type {HTMLButtonElement} */\n        element.disabled = !(pswp.currIndex > 0);\n      }\n    }\n  });\n}\n/** @type {UIElementData} */\n\n\nconst arrowPrev = {\n  name: 'arrowPrev',\n  className: 'pswp__button--arrow--prev',\n  title: 'Previous',\n  order: 10,\n  isButton: true,\n  appendTo: 'wrapper',\n  html: {\n    isCustomSVG: true,\n    size: 60,\n    inner: '<path d=\"M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z\" id=\"pswp__icn-arrow\"/>',\n    outlineID: 'pswp__icn-arrow'\n  },\n  onClick: 'prev',\n  onInit: initArrowButton\n};\n/** @type {UIElementData} */\n\nconst arrowNext = {\n  name: 'arrowNext',\n  className: 'pswp__button--arrow--next',\n  title: 'Next',\n  order: 11,\n  isButton: true,\n  appendTo: 'wrapper',\n  html: {\n    isCustomSVG: true,\n    size: 60,\n    inner: '<use xlink:href=\"#pswp__icn-arrow\"/>',\n    outlineID: 'pswp__icn-arrow'\n  },\n  onClick: 'next',\n  onInit: (el, pswp) => {\n    initArrowButton(el, pswp, true);\n  }\n};\n\n/** @type {import('./ui-element.js').UIElementData} UIElementData */\nconst closeButton = {\n  name: 'close',\n  title: 'Close',\n  order: 20,\n  isButton: true,\n  html: {\n    isCustomSVG: true,\n    inner: '<path d=\"M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z\" id=\"pswp__icn-close\"/>',\n    outlineID: 'pswp__icn-close'\n  },\n  onClick: 'close'\n};\n\n/** @type {import('./ui-element.js').UIElementData} UIElementData */\nconst zoomButton = {\n  name: 'zoom',\n  title: 'Zoom',\n  order: 10,\n  isButton: true,\n  html: {\n    isCustomSVG: true,\n    // eslint-disable-next-line max-len\n    inner: '<path d=\"M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z\" id=\"pswp__icn-zoom\"/>' + '<path fill=\"currentColor\" class=\"pswp__zoom-icn-bar-h\" d=\"M11 16v-2h6v2z\"/>' + '<path fill=\"currentColor\" class=\"pswp__zoom-icn-bar-v\" d=\"M13 12h2v6h-2z\"/>',\n    outlineID: 'pswp__icn-zoom'\n  },\n  onClick: 'toggleZoom'\n};\n\n/** @type {import('./ui-element.js').UIElementData} UIElementData */\nconst loadingIndicator = {\n  name: 'preloader',\n  appendTo: 'bar',\n  order: 7,\n  html: {\n    isCustomSVG: true,\n    // eslint-disable-next-line max-len\n    inner: '<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z\" id=\"pswp__icn-loading\"/>',\n    outlineID: 'pswp__icn-loading'\n  },\n  onInit: (indicatorElement, pswp) => {\n    /** @type {boolean | undefined} */\n    let isVisible;\n    /** @type {NodeJS.Timeout | null} */\n\n    let delayTimeout = null;\n    /**\r\n     * @param {string} className\r\n     * @param {boolean} add\r\n     */\n\n    const toggleIndicatorClass = (className, add) => {\n      indicatorElement.classList.toggle('pswp__preloader--' + className, add);\n    };\n    /**\r\n     * @param {boolean} visible\r\n     */\n\n\n    const setIndicatorVisibility = visible => {\n      if (isVisible !== visible) {\n        isVisible = visible;\n        toggleIndicatorClass('active', visible);\n      }\n    };\n\n    const updatePreloaderVisibility = () => {\n      var _pswp$currSlide;\n\n      if (!((_pswp$currSlide = pswp.currSlide) !== null && _pswp$currSlide !== void 0 && _pswp$currSlide.content.isLoading())) {\n        setIndicatorVisibility(false);\n\n        if (delayTimeout) {\n          clearTimeout(delayTimeout);\n          delayTimeout = null;\n        }\n\n        return;\n      }\n\n      if (!delayTimeout) {\n        // display loading indicator with delay\n        delayTimeout = setTimeout(() => {\n          var _pswp$currSlide2;\n\n          setIndicatorVisibility(Boolean((_pswp$currSlide2 = pswp.currSlide) === null || _pswp$currSlide2 === void 0 ? void 0 : _pswp$currSlide2.content.isLoading()));\n          delayTimeout = null;\n        }, pswp.options.preloaderDelay);\n      }\n    };\n\n    pswp.on('change', updatePreloaderVisibility);\n    pswp.on('loadComplete', e => {\n      if (pswp.currSlide === e.slide) {\n        updatePreloaderVisibility();\n      }\n    }); // expose the method\n\n    if (pswp.ui) {\n      pswp.ui.updatePreloaderVisibility = updatePreloaderVisibility;\n    }\n  }\n};\n\n/** @type {import('./ui-element.js').UIElementData} UIElementData */\nconst counterIndicator = {\n  name: 'counter',\n  order: 5,\n  onInit: (counterElement, pswp) => {\n    pswp.on('change', () => {\n      counterElement.innerText = pswp.currIndex + 1 + pswp.options.indexIndicatorSep + pswp.getNumItems();\n    });\n  }\n};\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('./ui-element.js').UIElementData} UIElementData */\n\n/**\r\n * Set special class on element when image is zoomed.\r\n *\r\n * By default, it is used to adjust\r\n * zoom icon and zoom cursor via CSS.\r\n *\r\n * @param {HTMLElement} el\r\n * @param {boolean} isZoomedIn\r\n */\n\nfunction setZoomedIn(el, isZoomedIn) {\n  el.classList.toggle('pswp--zoomed-in', isZoomedIn);\n}\n\nclass UI {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    this.isRegistered = false;\n    /** @type {UIElementData[]} */\n\n    this.uiElementsData = [];\n    /** @type {(UIElement | UIElementData)[]} */\n\n    this.items = [];\n    /** @type {() => void} */\n\n    this.updatePreloaderVisibility = () => {};\n    /**\r\n     * @private\r\n     * @type {number | undefined}\r\n     */\n\n\n    this._lastUpdatedZoomLevel = undefined;\n  }\n\n  init() {\n    const {\n      pswp\n    } = this;\n    this.isRegistered = false;\n    this.uiElementsData = [closeButton, arrowPrev, arrowNext, zoomButton, loadingIndicator, counterIndicator];\n    pswp.dispatch('uiRegister'); // sort by order\n\n    this.uiElementsData.sort((a, b) => {\n      // default order is 0\n      return (a.order || 0) - (b.order || 0);\n    });\n    this.items = [];\n    this.isRegistered = true;\n    this.uiElementsData.forEach(uiElementData => {\n      this.registerElement(uiElementData);\n    });\n    pswp.on('change', () => {\n      var _pswp$element;\n\n      (_pswp$element = pswp.element) === null || _pswp$element === void 0 || _pswp$element.classList.toggle('pswp--one-slide', pswp.getNumItems() === 1);\n    });\n    pswp.on('zoomPanUpdate', () => this._onZoomPanUpdate());\n  }\n  /**\r\n   * @param {UIElementData} elementData\r\n   */\n\n\n  registerElement(elementData) {\n    if (this.isRegistered) {\n      this.items.push(new UIElement(this.pswp, elementData));\n    } else {\n      this.uiElementsData.push(elementData);\n    }\n  }\n  /**\r\n   * Fired each time zoom or pan position is changed.\r\n   * Update classes that control visibility of zoom button and cursor icon.\r\n   *\r\n   * @private\r\n   */\n\n\n  _onZoomPanUpdate() {\n    const {\n      template,\n      currSlide,\n      options\n    } = this.pswp;\n\n    if (this.pswp.opener.isClosing || !template || !currSlide) {\n      return;\n    }\n\n    let {\n      currZoomLevel\n    } = currSlide; // if not open yet - check against initial zoom level\n\n    if (!this.pswp.opener.isOpen) {\n      currZoomLevel = currSlide.zoomLevels.initial;\n    }\n\n    if (currZoomLevel === this._lastUpdatedZoomLevel) {\n      return;\n    }\n\n    this._lastUpdatedZoomLevel = currZoomLevel;\n    const currZoomLevelDiff = currSlide.zoomLevels.initial - currSlide.zoomLevels.secondary; // Initial and secondary zoom levels are almost equal\n\n    if (Math.abs(currZoomLevelDiff) < 0.01 || !currSlide.isZoomable()) {\n      // disable zoom\n      setZoomedIn(template, false);\n      template.classList.remove('pswp--zoom-allowed');\n      return;\n    }\n\n    template.classList.add('pswp--zoom-allowed');\n    const potentialZoomLevel = currZoomLevel === currSlide.zoomLevels.initial ? currSlide.zoomLevels.secondary : currSlide.zoomLevels.initial;\n    setZoomedIn(template, potentialZoomLevel <= currZoomLevel);\n\n    if (options.imageClickAction === 'zoom' || options.imageClickAction === 'zoom-or-close') {\n      template.classList.add('pswp--click-to-zoom');\n    }\n  }\n\n}\n\n/** @typedef {import('./slide.js').SlideData} SlideData */\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {{ x: number; y: number; w: number; innerRect?: { w: number; h: number; x: number; y: number } }} Bounds */\n\n/**\r\n * @param {HTMLElement} el\r\n * @returns Bounds\r\n */\nfunction getBoundsByElement(el) {\n  const thumbAreaRect = el.getBoundingClientRect();\n  return {\n    x: thumbAreaRect.left,\n    y: thumbAreaRect.top,\n    w: thumbAreaRect.width\n  };\n}\n/**\r\n * @param {HTMLElement} el\r\n * @param {number} imageWidth\r\n * @param {number} imageHeight\r\n * @returns Bounds\r\n */\n\n\nfunction getCroppedBoundsByElement(el, imageWidth, imageHeight) {\n  const thumbAreaRect = el.getBoundingClientRect(); // fill image into the area\n  // (do they same as object-fit:cover does to retrieve coordinates)\n\n  const hRatio = thumbAreaRect.width / imageWidth;\n  const vRatio = thumbAreaRect.height / imageHeight;\n  const fillZoomLevel = hRatio > vRatio ? hRatio : vRatio;\n  const offsetX = (thumbAreaRect.width - imageWidth * fillZoomLevel) / 2;\n  const offsetY = (thumbAreaRect.height - imageHeight * fillZoomLevel) / 2;\n  /**\r\n   * Coordinates of the image,\r\n   * as if it was not cropped,\r\n   * height is calculated automatically\r\n   *\r\n   * @type {Bounds}\r\n   */\n\n  const bounds = {\n    x: thumbAreaRect.left + offsetX,\n    y: thumbAreaRect.top + offsetY,\n    w: imageWidth * fillZoomLevel\n  }; // Coordinates of inner crop area\n  // relative to the image\n\n  bounds.innerRect = {\n    w: thumbAreaRect.width,\n    h: thumbAreaRect.height,\n    x: offsetX,\n    y: offsetY\n  };\n  return bounds;\n}\n/**\r\n * Get dimensions of thumbnail image\r\n * (click on which opens photoswipe or closes photoswipe to)\r\n *\r\n * @param {number} index\r\n * @param {SlideData} itemData\r\n * @param {PhotoSwipe} instance PhotoSwipe instance\r\n * @returns {Bounds | undefined}\r\n */\n\n\nfunction getThumbBounds(index, itemData, instance) {\n  // legacy event, before filters were introduced\n  const event = instance.dispatch('thumbBounds', {\n    index,\n    itemData,\n    instance\n  }); // @ts-expect-error\n\n  if (event.thumbBounds) {\n    // @ts-expect-error\n    return event.thumbBounds;\n  }\n\n  const {\n    element\n  } = itemData;\n  /** @type {Bounds | undefined} */\n\n  let thumbBounds;\n  /** @type {HTMLElement | null | undefined} */\n\n  let thumbnail;\n\n  if (element && instance.options.thumbSelector !== false) {\n    const thumbSelector = instance.options.thumbSelector || 'img';\n    thumbnail = element.matches(thumbSelector) ? element :\n    /** @type {HTMLElement | null} */\n    element.querySelector(thumbSelector);\n  }\n\n  thumbnail = instance.applyFilters('thumbEl', thumbnail, itemData, index);\n\n  if (thumbnail) {\n    if (!itemData.thumbCropped) {\n      thumbBounds = getBoundsByElement(thumbnail);\n    } else {\n      thumbBounds = getCroppedBoundsByElement(thumbnail, itemData.width || itemData.w || 0, itemData.height || itemData.h || 0);\n    }\n  }\n\n  return instance.applyFilters('thumbBounds', thumbBounds, itemData, index);\n}\n\n/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\n\n/** @typedef {import('../photoswipe.js').DataSource} DataSource */\n\n/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */\n\n/** @typedef {import('../slide/content.js').default} ContentDefault */\n\n/** @typedef {import('../slide/slide.js').default} Slide */\n\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\n\n/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */\n\n/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */\n\n/**\r\n * Allow adding an arbitrary props to the Content\r\n * https://photoswipe.com/custom-content/#using-webp-image-format\r\n * @typedef {ContentDefault & Record<string, any>} Content\r\n */\n\n/** @typedef {{ x?: number; y?: number }} Point */\n\n/**\r\n * @typedef {Object} PhotoSwipeEventsMap https://photoswipe.com/events/\r\n *\r\n *\r\n * https://photoswipe.com/adding-ui-elements/\r\n *\r\n * @prop {undefined} uiRegister\r\n * @prop {{ data: UIElementData }} uiElementCreate\r\n *\r\n *\r\n * https://photoswipe.com/events/#initialization-events\r\n *\r\n * @prop {undefined} beforeOpen\r\n * @prop {undefined} firstUpdate\r\n * @prop {undefined} initialLayout\r\n * @prop {undefined} change\r\n * @prop {undefined} afterInit\r\n * @prop {undefined} bindEvents\r\n *\r\n *\r\n * https://photoswipe.com/events/#opening-or-closing-transition-events\r\n *\r\n * @prop {undefined} openingAnimationStart\r\n * @prop {undefined} openingAnimationEnd\r\n * @prop {undefined} closingAnimationStart\r\n * @prop {undefined} closingAnimationEnd\r\n *\r\n *\r\n * https://photoswipe.com/events/#closing-events\r\n *\r\n * @prop {undefined} close\r\n * @prop {undefined} destroy\r\n *\r\n *\r\n * https://photoswipe.com/events/#pointer-and-gesture-events\r\n *\r\n * @prop {{ originalEvent: PointerEvent }} pointerDown\r\n * @prop {{ originalEvent: PointerEvent }} pointerMove\r\n * @prop {{ originalEvent: PointerEvent }} pointerUp\r\n * @prop {{ bgOpacity: number }} pinchClose can be default prevented\r\n * @prop {{ panY: number }} verticalDrag can be default prevented\r\n *\r\n *\r\n * https://photoswipe.com/events/#slide-content-events\r\n *\r\n * @prop {{ content: Content }} contentInit\r\n * @prop {{ content: Content; isLazy: boolean }} contentLoad can be default prevented\r\n * @prop {{ content: Content; isLazy: boolean }} contentLoadImage can be default prevented\r\n * @prop {{ content: Content; slide: Slide; isError?: boolean }} loadComplete\r\n * @prop {{ content: Content; slide: Slide }} loadError\r\n * @prop {{ content: Content; width: number; height: number }} contentResize can be default prevented\r\n * @prop {{ content: Content; width: number; height: number; slide: Slide }} imageSizeChange\r\n * @prop {{ content: Content }} contentLazyLoad can be default prevented\r\n * @prop {{ content: Content }} contentAppend can be default prevented\r\n * @prop {{ content: Content }} contentActivate can be default prevented\r\n * @prop {{ content: Content }} contentDeactivate can be default prevented\r\n * @prop {{ content: Content }} contentRemove can be default prevented\r\n * @prop {{ content: Content }} contentDestroy can be default prevented\r\n *\r\n *\r\n * undocumented\r\n *\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} imageClickAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} bgClickAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} tapAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} doubleTapAction can be default prevented\r\n *\r\n * @prop {{ originalEvent: KeyboardEvent }} keydown can be default prevented\r\n * @prop {{ x: number; dragging: boolean }} moveMainScroll\r\n * @prop {{ slide: Slide }} firstZoomPan\r\n * @prop {{ slide: Slide | undefined, data: SlideData, index: number }} gettingData\r\n * @prop {undefined} beforeResize\r\n * @prop {undefined} resize\r\n * @prop {undefined} viewportSize\r\n * @prop {undefined} updateScrollOffset\r\n * @prop {{ slide: Slide }} slideInit\r\n * @prop {{ slide: Slide }} afterSetContent\r\n * @prop {{ slide: Slide }} slideLoad\r\n * @prop {{ slide: Slide }} appendHeavy can be default prevented\r\n * @prop {{ slide: Slide }} appendHeavyContent\r\n * @prop {{ slide: Slide }} slideActivate\r\n * @prop {{ slide: Slide }} slideDeactivate\r\n * @prop {{ slide: Slide }} slideDestroy\r\n * @prop {{ destZoomLevel: number, centerPoint: Point | undefined, transitionDuration: number | false | undefined }} beforeZoomTo\r\n * @prop {{ slide: Slide }} zoomPanUpdate\r\n * @prop {{ slide: Slide }} initialZoomPan\r\n * @prop {{ slide: Slide }} calcSlideSize\r\n * @prop {undefined} resolutionChanged\r\n * @prop {{ originalEvent: WheelEvent }} wheel can be default prevented\r\n * @prop {{ content: Content }} contentAppendImage can be default prevented\r\n * @prop {{ index: number; itemData: SlideData }} lazyLoadSlide can be default prevented\r\n * @prop {undefined} lazyLoad\r\n * @prop {{ slide: Slide }} calcBounds\r\n * @prop {{ zoomLevels: ZoomLevel, slideData: SlideData }} zoomLevelsUpdate\r\n *\r\n *\r\n * legacy\r\n *\r\n * @prop {undefined} init\r\n * @prop {undefined} initialZoomIn\r\n * @prop {undefined} initialZoomOut\r\n * @prop {undefined} initialZoomInEnd\r\n * @prop {undefined} initialZoomOutEnd\r\n * @prop {{ dataSource: DataSource | undefined, numItems: number }} numItems\r\n * @prop {{ itemData: SlideData; index: number }} itemData\r\n * @prop {{ index: number, itemData: SlideData, instance: PhotoSwipe }} thumbBounds\r\n */\n\n/**\r\n * @typedef {Object} PhotoSwipeFiltersMap https://photoswipe.com/filters/\r\n *\r\n * @prop {(numItems: number, dataSource: DataSource | undefined) => number} numItems\r\n * Modify the total amount of slides. Example on Data sources page.\r\n * https://photoswipe.com/filters/#numitems\r\n *\r\n * @prop {(itemData: SlideData, index: number) => SlideData} itemData\r\n * Modify slide item data. Example on Data sources page.\r\n * https://photoswipe.com/filters/#itemdata\r\n *\r\n * @prop {(itemData: SlideData, element: HTMLElement, linkEl: HTMLAnchorElement) => SlideData} domItemData\r\n * Modify item data when it's parsed from DOM element. Example on Data sources page.\r\n * https://photoswipe.com/filters/#domitemdata\r\n *\r\n * @prop {(clickedIndex: number, e: MouseEvent, instance: PhotoSwipeLightbox) => number} clickedIndex\r\n * Modify clicked gallery item index.\r\n * https://photoswipe.com/filters/#clickedindex\r\n *\r\n * @prop {(placeholderSrc: string | false, content: Content) => string | false} placeholderSrc\r\n * Modify placeholder image source.\r\n * https://photoswipe.com/filters/#placeholdersrc\r\n *\r\n * @prop {(isContentLoading: boolean, content: Content) => boolean} isContentLoading\r\n * Modify if the content is currently loading.\r\n * https://photoswipe.com/filters/#iscontentloading\r\n *\r\n * @prop {(isContentZoomable: boolean, content: Content) => boolean} isContentZoomable\r\n * Modify if the content can be zoomed.\r\n * https://photoswipe.com/filters/#iscontentzoomable\r\n *\r\n * @prop {(useContentPlaceholder: boolean, content: Content) => boolean} useContentPlaceholder\r\n * Modify if the placeholder should be used for the content.\r\n * https://photoswipe.com/filters/#usecontentplaceholder\r\n *\r\n * @prop {(isKeepingPlaceholder: boolean, content: Content) => boolean} isKeepingPlaceholder\r\n * Modify if the placeholder should be kept after the content is loaded.\r\n * https://photoswipe.com/filters/#iskeepingplaceholder\r\n *\r\n *\r\n * @prop {(contentErrorElement: HTMLElement, content: Content) => HTMLElement} contentErrorElement\r\n * Modify an element when the content has error state (for example, if image cannot be loaded).\r\n * https://photoswipe.com/filters/#contenterrorelement\r\n *\r\n * @prop {(element: HTMLElement, data: UIElementData) => HTMLElement} uiElement\r\n * Modify a UI element that's being created.\r\n * https://photoswipe.com/filters/#uielement\r\n *\r\n * @prop {(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement} thumbEl\r\n * Modify the thumbnail element from which opening zoom animation starts or ends.\r\n * https://photoswipe.com/filters/#thumbel\r\n *\r\n * @prop {(thumbBounds: Bounds | undefined, itemData: SlideData, index: number) => Bounds} thumbBounds\r\n * Modify the thumbnail bounds from which opening zoom animation starts or ends.\r\n * https://photoswipe.com/filters/#thumbbounds\r\n *\r\n * @prop {(srcsetSizesWidth: number, content: Content) => number} srcsetSizesWidth\r\n *\r\n * @prop {(preventPointerEvent: boolean, event: PointerEvent, pointerType: string) => boolean} preventPointerEvent\r\n *\r\n */\n\n/**\r\n * @template {keyof PhotoSwipeFiltersMap} T\r\n * @typedef {{ fn: PhotoSwipeFiltersMap[T], priority: number }} Filter\r\n */\n\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {PhotoSwipeEventsMap[T] extends undefined ? PhotoSwipeEvent<T> : PhotoSwipeEvent<T> & PhotoSwipeEventsMap[T]} AugmentedEvent\r\n */\n\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {(event: AugmentedEvent<T>) => void} EventCallback\r\n */\n\n/**\r\n * Base PhotoSwipe event object\r\n *\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n */\nclass PhotoSwipeEvent {\n  /**\r\n   * @param {T} type\r\n   * @param {PhotoSwipeEventsMap[T]} [details]\r\n   */\n  constructor(type, details) {\n    this.type = type;\n    this.defaultPrevented = false;\n\n    if (details) {\n      Object.assign(this, details);\n    }\n  }\n\n  preventDefault() {\n    this.defaultPrevented = true;\n  }\n\n}\n/**\r\n * PhotoSwipe base class that can listen and dispatch for events.\r\n * Shared by PhotoSwipe Core and PhotoSwipe Lightbox, extended by base.js\r\n */\n\n\nclass Eventable {\n  constructor() {\n    /**\r\n     * @type {{ [T in keyof PhotoSwipeEventsMap]?: ((event: AugmentedEvent<T>) => void)[] }}\r\n     */\n    this._listeners = {};\n    /**\r\n     * @type {{ [T in keyof PhotoSwipeFiltersMap]?: Filter<T>[] }}\r\n     */\n\n    this._filters = {};\n    /** @type {PhotoSwipe | undefined} */\n\n    this.pswp = undefined;\n    /** @type {PhotoSwipeOptions | undefined} */\n\n    this.options = undefined;\n  }\n  /**\r\n   * @template {keyof PhotoSwipeFiltersMap} T\r\n   * @param {T} name\r\n   * @param {PhotoSwipeFiltersMap[T]} fn\r\n   * @param {number} priority\r\n   */\n\n\n  addFilter(name, fn, priority = 100) {\n    var _this$_filters$name, _this$_filters$name2, _this$pswp;\n\n    if (!this._filters[name]) {\n      this._filters[name] = [];\n    }\n\n    (_this$_filters$name = this._filters[name]) === null || _this$_filters$name === void 0 || _this$_filters$name.push({\n      fn,\n      priority\n    });\n    (_this$_filters$name2 = this._filters[name]) === null || _this$_filters$name2 === void 0 || _this$_filters$name2.sort((f1, f2) => f1.priority - f2.priority);\n    (_this$pswp = this.pswp) === null || _this$pswp === void 0 || _this$pswp.addFilter(name, fn, priority);\n  }\n  /**\r\n   * @template {keyof PhotoSwipeFiltersMap} T\r\n   * @param {T} name\r\n   * @param {PhotoSwipeFiltersMap[T]} fn\r\n   */\n\n\n  removeFilter(name, fn) {\n    if (this._filters[name]) {\n      // @ts-expect-error\n      this._filters[name] = this._filters[name].filter(filter => filter.fn !== fn);\n    }\n\n    if (this.pswp) {\n      this.pswp.removeFilter(name, fn);\n    }\n  }\n  /**\r\n   * @template {keyof PhotoSwipeFiltersMap} T\r\n   * @param {T} name\r\n   * @param {Parameters<PhotoSwipeFiltersMap[T]>} args\r\n   * @returns {Parameters<PhotoSwipeFiltersMap[T]>[0]}\r\n   */\n\n\n  applyFilters(name, ...args) {\n    var _this$_filters$name3;\n\n    (_this$_filters$name3 = this._filters[name]) === null || _this$_filters$name3 === void 0 || _this$_filters$name3.forEach(filter => {\n      // @ts-expect-error\n      args[0] = filter.fn.apply(this, args);\n    });\n    return args[0];\n  }\n  /**\r\n   * @template {keyof PhotoSwipeEventsMap} T\r\n   * @param {T} name\r\n   * @param {EventCallback<T>} fn\r\n   */\n\n\n  on(name, fn) {\n    var _this$_listeners$name, _this$pswp2;\n\n    if (!this._listeners[name]) {\n      this._listeners[name] = [];\n    }\n\n    (_this$_listeners$name = this._listeners[name]) === null || _this$_listeners$name === void 0 || _this$_listeners$name.push(fn); // When binding events to lightbox,\n    // also bind events to PhotoSwipe Core,\n    // if it's open.\n\n    (_this$pswp2 = this.pswp) === null || _this$pswp2 === void 0 || _this$pswp2.on(name, fn);\n  }\n  /**\r\n   * @template {keyof PhotoSwipeEventsMap} T\r\n   * @param {T} name\r\n   * @param {EventCallback<T>} fn\r\n   */\n\n\n  off(name, fn) {\n    var _this$pswp3;\n\n    if (this._listeners[name]) {\n      // @ts-expect-error\n      this._listeners[name] = this._listeners[name].filter(listener => fn !== listener);\n    }\n\n    (_this$pswp3 = this.pswp) === null || _this$pswp3 === void 0 || _this$pswp3.off(name, fn);\n  }\n  /**\r\n   * @template {keyof PhotoSwipeEventsMap} T\r\n   * @param {T} name\r\n   * @param {PhotoSwipeEventsMap[T]} [details]\r\n   * @returns {AugmentedEvent<T>}\r\n   */\n\n\n  dispatch(name, details) {\n    var _this$_listeners$name2;\n\n    if (this.pswp) {\n      return this.pswp.dispatch(name, details);\n    }\n\n    const event =\n    /** @type {AugmentedEvent<T>} */\n    new PhotoSwipeEvent(name, details);\n    (_this$_listeners$name2 = this._listeners[name]) === null || _this$_listeners$name2 === void 0 || _this$_listeners$name2.forEach(listener => {\n      listener.call(this, event);\n    });\n    return event;\n  }\n\n}\n\nclass Placeholder {\n  /**\r\n   * @param {string | false} imageSrc\r\n   * @param {HTMLElement} container\r\n   */\n  constructor(imageSrc, container) {\n    // Create placeholder\n    // (stretched thumbnail or simple div behind the main image)\n\n    /** @type {HTMLImageElement | HTMLDivElement | null} */\n    this.element = createElement('pswp__img pswp__img--placeholder', imageSrc ? 'img' : 'div', container);\n\n    if (imageSrc) {\n      const imgEl =\n      /** @type {HTMLImageElement} */\n      this.element;\n      imgEl.decoding = 'async';\n      imgEl.alt = '';\n      imgEl.src = imageSrc;\n      imgEl.setAttribute('role', 'presentation');\n    }\n\n    this.element.setAttribute('aria-hidden', 'true');\n  }\n  /**\r\n   * @param {number} width\r\n   * @param {number} height\r\n   */\n\n\n  setDisplayedSize(width, height) {\n    if (!this.element) {\n      return;\n    }\n\n    if (this.element.tagName === 'IMG') {\n      // Use transform scale() to modify img placeholder size\n      // (instead of changing width/height directly).\n      // This helps with performance, specifically in iOS15 Safari.\n      setWidthHeight(this.element, 250, 'auto');\n      this.element.style.transformOrigin = '0 0';\n      this.element.style.transform = toTransformString(0, 0, width / 250);\n    } else {\n      setWidthHeight(this.element, width, height);\n    }\n  }\n\n  destroy() {\n    var _this$element;\n\n    if ((_this$element = this.element) !== null && _this$element !== void 0 && _this$element.parentNode) {\n      this.element.remove();\n    }\n\n    this.element = null;\n  }\n\n}\n\n/** @typedef {import('./slide.js').default} Slide */\n\n/** @typedef {import('./slide.js').SlideData} SlideData */\n\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\n\n/** @typedef {import('../util/util.js').LoadState} LoadState */\n\nclass Content {\n  /**\r\n   * @param {SlideData} itemData Slide data\r\n   * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance\r\n   * @param {number} index\r\n   */\n  constructor(itemData, instance, index) {\n    this.instance = instance;\n    this.data = itemData;\n    this.index = index;\n    /** @type {HTMLImageElement | HTMLDivElement | undefined} */\n\n    this.element = undefined;\n    /** @type {Placeholder | undefined} */\n\n    this.placeholder = undefined;\n    /** @type {Slide | undefined} */\n\n    this.slide = undefined;\n    this.displayedImageWidth = 0;\n    this.displayedImageHeight = 0;\n    this.width = Number(this.data.w) || Number(this.data.width) || 0;\n    this.height = Number(this.data.h) || Number(this.data.height) || 0;\n    this.isAttached = false;\n    this.hasSlide = false;\n    this.isDecoding = false;\n    /** @type {LoadState} */\n\n    this.state = LOAD_STATE.IDLE;\n\n    if (this.data.type) {\n      this.type = this.data.type;\n    } else if (this.data.src) {\n      this.type = 'image';\n    } else {\n      this.type = 'html';\n    }\n\n    this.instance.dispatch('contentInit', {\n      content: this\n    });\n  }\n\n  removePlaceholder() {\n    if (this.placeholder && !this.keepPlaceholder()) {\n      // With delay, as image might be loaded, but not rendered\n      setTimeout(() => {\n        if (this.placeholder) {\n          this.placeholder.destroy();\n          this.placeholder = undefined;\n        }\n      }, 1000);\n    }\n  }\n  /**\r\n   * Preload content\r\n   *\r\n   * @param {boolean} isLazy\r\n   * @param {boolean} [reload]\r\n   */\n\n\n  load(isLazy, reload) {\n    if (this.slide && this.usePlaceholder()) {\n      if (!this.placeholder) {\n        const placeholderSrc = this.instance.applyFilters('placeholderSrc', // use  image-based placeholder only for the first slide,\n        // as rendering (even small stretched thumbnail) is an expensive operation\n        this.data.msrc && this.slide.isFirstSlide ? this.data.msrc : false, this);\n        this.placeholder = new Placeholder(placeholderSrc, this.slide.container);\n      } else {\n        const placeholderEl = this.placeholder.element; // Add placeholder to DOM if it was already created\n\n        if (placeholderEl && !placeholderEl.parentElement) {\n          this.slide.container.prepend(placeholderEl);\n        }\n      }\n    }\n\n    if (this.element && !reload) {\n      return;\n    }\n\n    if (this.instance.dispatch('contentLoad', {\n      content: this,\n      isLazy\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (this.isImageContent()) {\n      this.element = createElement('pswp__img', 'img'); // Start loading only after width is defined, as sizes might depend on it.\n      // Due to Safari feature, we must define sizes before srcset.\n\n      if (this.displayedImageWidth) {\n        this.loadImage(isLazy);\n      }\n    } else {\n      this.element = createElement('pswp__content', 'div');\n      this.element.innerHTML = this.data.html || '';\n    }\n\n    if (reload && this.slide) {\n      this.slide.updateContentSize(true);\n    }\n  }\n  /**\r\n   * Preload image\r\n   *\r\n   * @param {boolean} isLazy\r\n   */\n\n\n  loadImage(isLazy) {\n    var _this$data$src, _this$data$alt;\n\n    if (!this.isImageContent() || !this.element || this.instance.dispatch('contentLoadImage', {\n      content: this,\n      isLazy\n    }).defaultPrevented) {\n      return;\n    }\n\n    const imageElement =\n    /** @type HTMLImageElement */\n    this.element;\n    this.updateSrcsetSizes();\n\n    if (this.data.srcset) {\n      imageElement.srcset = this.data.srcset;\n    }\n\n    imageElement.src = (_this$data$src = this.data.src) !== null && _this$data$src !== void 0 ? _this$data$src : '';\n    imageElement.alt = (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0 ? _this$data$alt : '';\n    this.state = LOAD_STATE.LOADING;\n\n    if (imageElement.complete) {\n      this.onLoaded();\n    } else {\n      imageElement.onload = () => {\n        this.onLoaded();\n      };\n\n      imageElement.onerror = () => {\n        this.onError();\n      };\n    }\n  }\n  /**\r\n   * Assign slide to content\r\n   *\r\n   * @param {Slide} slide\r\n   */\n\n\n  setSlide(slide) {\n    this.slide = slide;\n    this.hasSlide = true;\n    this.instance = slide.pswp; // todo: do we need to unset slide?\n  }\n  /**\r\n   * Content load success handler\r\n   */\n\n\n  onLoaded() {\n    this.state = LOAD_STATE.LOADED;\n\n    if (this.slide && this.element) {\n      this.instance.dispatch('loadComplete', {\n        slide: this.slide,\n        content: this\n      }); // if content is reloaded\n\n      if (this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode) {\n        this.append();\n        this.slide.updateContentSize(true);\n      }\n\n      if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) {\n        this.removePlaceholder();\n      }\n    }\n  }\n  /**\r\n   * Content load error handler\r\n   */\n\n\n  onError() {\n    this.state = LOAD_STATE.ERROR;\n\n    if (this.slide) {\n      this.displayError();\n      this.instance.dispatch('loadComplete', {\n        slide: this.slide,\n        isError: true,\n        content: this\n      });\n      this.instance.dispatch('loadError', {\n        slide: this.slide,\n        content: this\n      });\n    }\n  }\n  /**\r\n   * @returns {Boolean} If the content is currently loading\r\n   */\n\n\n  isLoading() {\n    return this.instance.applyFilters('isContentLoading', this.state === LOAD_STATE.LOADING, this);\n  }\n  /**\r\n   * @returns {Boolean} If the content is in error state\r\n   */\n\n\n  isError() {\n    return this.state === LOAD_STATE.ERROR;\n  }\n  /**\r\n   * @returns {boolean} If the content is image\r\n   */\n\n\n  isImageContent() {\n    return this.type === 'image';\n  }\n  /**\r\n   * Update content size\r\n   *\r\n   * @param {Number} width\r\n   * @param {Number} height\r\n   */\n\n\n  setDisplayedSize(width, height) {\n    if (!this.element) {\n      return;\n    }\n\n    if (this.placeholder) {\n      this.placeholder.setDisplayedSize(width, height);\n    }\n\n    if (this.instance.dispatch('contentResize', {\n      content: this,\n      width,\n      height\n    }).defaultPrevented) {\n      return;\n    }\n\n    setWidthHeight(this.element, width, height);\n\n    if (this.isImageContent() && !this.isError()) {\n      const isInitialSizeUpdate = !this.displayedImageWidth && width;\n      this.displayedImageWidth = width;\n      this.displayedImageHeight = height;\n\n      if (isInitialSizeUpdate) {\n        this.loadImage(false);\n      } else {\n        this.updateSrcsetSizes();\n      }\n\n      if (this.slide) {\n        this.instance.dispatch('imageSizeChange', {\n          slide: this.slide,\n          width,\n          height,\n          content: this\n        });\n      }\n    }\n  }\n  /**\r\n   * @returns {boolean} If the content can be zoomed\r\n   */\n\n\n  isZoomable() {\n    return this.instance.applyFilters('isContentZoomable', this.isImageContent() && this.state !== LOAD_STATE.ERROR, this);\n  }\n  /**\r\n   * Update image srcset sizes attribute based on width and height\r\n   */\n\n\n  updateSrcsetSizes() {\n    // Handle srcset sizes attribute.\n    //\n    // Never lower quality, if it was increased previously.\n    // Chrome does this automatically, Firefox and Safari do not,\n    // so we store largest used size in dataset.\n    if (!this.isImageContent() || !this.element || !this.data.srcset) {\n      return;\n    }\n\n    const image =\n    /** @type HTMLImageElement */\n    this.element;\n    const sizesWidth = this.instance.applyFilters('srcsetSizesWidth', this.displayedImageWidth, this);\n\n    if (!image.dataset.largestUsedSize || sizesWidth > parseInt(image.dataset.largestUsedSize, 10)) {\n      image.sizes = sizesWidth + 'px';\n      image.dataset.largestUsedSize = String(sizesWidth);\n    }\n  }\n  /**\r\n   * @returns {boolean} If content should use a placeholder (from msrc by default)\r\n   */\n\n\n  usePlaceholder() {\n    return this.instance.applyFilters('useContentPlaceholder', this.isImageContent(), this);\n  }\n  /**\r\n   * Preload content with lazy-loading param\r\n   */\n\n\n  lazyLoad() {\n    if (this.instance.dispatch('contentLazyLoad', {\n      content: this\n    }).defaultPrevented) {\n      return;\n    }\n\n    this.load(true);\n  }\n  /**\r\n   * @returns {boolean} If placeholder should be kept after content is loaded\r\n   */\n\n\n  keepPlaceholder() {\n    return this.instance.applyFilters('isKeepingPlaceholder', this.isLoading(), this);\n  }\n  /**\r\n   * Destroy the content\r\n   */\n\n\n  destroy() {\n    this.hasSlide = false;\n    this.slide = undefined;\n\n    if (this.instance.dispatch('contentDestroy', {\n      content: this\n    }).defaultPrevented) {\n      return;\n    }\n\n    this.remove();\n\n    if (this.placeholder) {\n      this.placeholder.destroy();\n      this.placeholder = undefined;\n    }\n\n    if (this.isImageContent() && this.element) {\n      this.element.onload = null;\n      this.element.onerror = null;\n      this.element = undefined;\n    }\n  }\n  /**\r\n   * Display error message\r\n   */\n\n\n  displayError() {\n    if (this.slide) {\n      var _this$instance$option, _this$instance$option2;\n\n      let errorMsgEl = createElement('pswp__error-msg', 'div');\n      errorMsgEl.innerText = (_this$instance$option = (_this$instance$option2 = this.instance.options) === null || _this$instance$option2 === void 0 ? void 0 : _this$instance$option2.errorMsg) !== null && _this$instance$option !== void 0 ? _this$instance$option : '';\n      errorMsgEl =\n      /** @type {HTMLDivElement} */\n      this.instance.applyFilters('contentErrorElement', errorMsgEl, this);\n      this.element = createElement('pswp__content pswp__error-msg-container', 'div');\n      this.element.appendChild(errorMsgEl);\n      this.slide.container.innerText = '';\n      this.slide.container.appendChild(this.element);\n      this.slide.updateContentSize(true);\n      this.removePlaceholder();\n    }\n  }\n  /**\r\n   * Append the content\r\n   */\n\n\n  append() {\n    if (this.isAttached || !this.element) {\n      return;\n    }\n\n    this.isAttached = true;\n\n    if (this.state === LOAD_STATE.ERROR) {\n      this.displayError();\n      return;\n    }\n\n    if (this.instance.dispatch('contentAppend', {\n      content: this\n    }).defaultPrevented) {\n      return;\n    }\n\n    const supportsDecode = ('decode' in this.element);\n\n    if (this.isImageContent()) {\n      // Use decode() on nearby slides\n      //\n      // Nearby slide images are in DOM and not hidden via display:none.\n      // However, they are placed offscreen (to the left and right side).\n      //\n      // Some browsers do not composite the image until it's actually visible,\n      // using decode() helps.\n      //\n      // You might ask \"why dont you just decode() and then append all images\",\n      // that's because I want to show image before it's fully loaded,\n      // as browser can render parts of image while it is loading.\n      // We do not do this in Safari due to partial loading bug.\n      if (supportsDecode && this.slide && (!this.slide.isActive || isSafari())) {\n        this.isDecoding = true; // purposefully using finally instead of then,\n        // as if srcset sizes changes dynamically - it may cause decode error\n\n        /** @type {HTMLImageElement} */\n\n        this.element.decode().catch(() => {}).finally(() => {\n          this.isDecoding = false;\n          this.appendImage();\n        });\n      } else {\n        this.appendImage();\n      }\n    } else if (this.slide && !this.element.parentNode) {\n      this.slide.container.appendChild(this.element);\n    }\n  }\n  /**\r\n   * Activate the slide,\r\n   * active slide is generally the current one,\r\n   * meaning the user can see it.\r\n   */\n\n\n  activate() {\n    if (this.instance.dispatch('contentActivate', {\n      content: this\n    }).defaultPrevented || !this.slide) {\n      return;\n    }\n\n    if (this.isImageContent() && this.isDecoding && !isSafari()) {\n      // add image to slide when it becomes active,\n      // even if it's not finished decoding\n      this.appendImage();\n    } else if (this.isError()) {\n      this.load(false, true); // try to reload\n    }\n\n    if (this.slide.holderElement) {\n      this.slide.holderElement.setAttribute('aria-hidden', 'false');\n    }\n  }\n  /**\r\n   * Deactivate the content\r\n   */\n\n\n  deactivate() {\n    this.instance.dispatch('contentDeactivate', {\n      content: this\n    });\n\n    if (this.slide && this.slide.holderElement) {\n      this.slide.holderElement.setAttribute('aria-hidden', 'true');\n    }\n  }\n  /**\r\n   * Remove the content from DOM\r\n   */\n\n\n  remove() {\n    this.isAttached = false;\n\n    if (this.instance.dispatch('contentRemove', {\n      content: this\n    }).defaultPrevented) {\n      return;\n    }\n\n    if (this.element && this.element.parentNode) {\n      this.element.remove();\n    }\n\n    if (this.placeholder && this.placeholder.element) {\n      this.placeholder.element.remove();\n    }\n  }\n  /**\r\n   * Append the image content to slide container\r\n   */\n\n\n  appendImage() {\n    if (!this.isAttached) {\n      return;\n    }\n\n    if (this.instance.dispatch('contentAppendImage', {\n      content: this\n    }).defaultPrevented) {\n      return;\n    } // ensure that element exists and is not already appended\n\n\n    if (this.slide && this.element && !this.element.parentNode) {\n      this.slide.container.appendChild(this.element);\n    }\n\n    if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) {\n      this.removePlaceholder();\n    }\n  }\n\n}\n\n/** @typedef {import('./content.js').default} Content */\n\n/** @typedef {import('./slide.js').default} Slide */\n\n/** @typedef {import('./slide.js').SlideData} SlideData */\n\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\n\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\n\nconst MIN_SLIDES_TO_CACHE = 5;\n/**\r\n * Lazy-load an image\r\n * This function is used both by Lightbox and PhotoSwipe core,\r\n * thus it can be called before dialog is opened.\r\n *\r\n * @param {SlideData} itemData Data about the slide\r\n * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance\r\n * @param {number} index\r\n * @returns {Content} Image that is being decoded or false.\r\n */\n\nfunction lazyLoadData(itemData, instance, index) {\n  const content = instance.createContentFromData(itemData, index);\n  /** @type {ZoomLevel | undefined} */\n\n  let zoomLevel;\n  const {\n    options\n  } = instance; // We need to know dimensions of the image to preload it,\n  // as it might use srcset, and we need to define sizes\n\n  if (options) {\n    zoomLevel = new ZoomLevel(options, itemData, -1);\n    let viewportSize;\n\n    if (instance.pswp) {\n      viewportSize = instance.pswp.viewportSize;\n    } else {\n      viewportSize = getViewportSize(options, instance);\n    }\n\n    const panAreaSize = getPanAreaSize(options, viewportSize, itemData, index);\n    zoomLevel.update(content.width, content.height, panAreaSize);\n  }\n\n  content.lazyLoad();\n\n  if (zoomLevel) {\n    content.setDisplayedSize(Math.ceil(content.width * zoomLevel.initial), Math.ceil(content.height * zoomLevel.initial));\n  }\n\n  return content;\n}\n/**\r\n * Lazy-loads specific slide.\r\n * This function is used both by Lightbox and PhotoSwipe core,\r\n * thus it can be called before dialog is opened.\r\n *\r\n * By default, it loads image based on viewport size and initial zoom level.\r\n *\r\n * @param {number} index Slide index\r\n * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox eventable instance\r\n * @returns {Content | undefined}\r\n */\n\nfunction lazyLoadSlide(index, instance) {\n  const itemData = instance.getItemData(index);\n\n  if (instance.dispatch('lazyLoadSlide', {\n    index,\n    itemData\n  }).defaultPrevented) {\n    return;\n  }\n\n  return lazyLoadData(itemData, instance, index);\n}\n\nclass ContentLoader {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp; // Total amount of cached images\n\n    this.limit = Math.max(pswp.options.preload[0] + pswp.options.preload[1] + 1, MIN_SLIDES_TO_CACHE);\n    /** @type {Content[]} */\n\n    this._cachedItems = [];\n  }\n  /**\r\n   * Lazy load nearby slides based on `preload` option.\r\n   *\r\n   * @param {number} [diff] Difference between slide indexes that was changed recently, or 0.\r\n   */\n\n\n  updateLazy(diff) {\n    const {\n      pswp\n    } = this;\n\n    if (pswp.dispatch('lazyLoad').defaultPrevented) {\n      return;\n    }\n\n    const {\n      preload\n    } = pswp.options;\n    const isForward = diff === undefined ? true : diff >= 0;\n    let i; // preload[1] - num items to preload in forward direction\n\n    for (i = 0; i <= preload[1]; i++) {\n      this.loadSlideByIndex(pswp.currIndex + (isForward ? i : -i));\n    } // preload[0] - num items to preload in backward direction\n\n\n    for (i = 1; i <= preload[0]; i++) {\n      this.loadSlideByIndex(pswp.currIndex + (isForward ? -i : i));\n    }\n  }\n  /**\r\n   * @param {number} initialIndex\r\n   */\n\n\n  loadSlideByIndex(initialIndex) {\n    const index = this.pswp.getLoopedIndex(initialIndex); // try to get cached content\n\n    let content = this.getContentByIndex(index);\n\n    if (!content) {\n      // no cached content, so try to load from scratch:\n      content = lazyLoadSlide(index, this.pswp); // if content can be loaded, add it to cache:\n\n      if (content) {\n        this.addToCache(content);\n      }\n    }\n  }\n  /**\r\n   * @param {Slide} slide\r\n   * @returns {Content}\r\n   */\n\n\n  getContentBySlide(slide) {\n    let content = this.getContentByIndex(slide.index);\n\n    if (!content) {\n      // create content if not found in cache\n      content = this.pswp.createContentFromData(slide.data, slide.index);\n      this.addToCache(content);\n    } // assign slide to content\n\n\n    content.setSlide(slide);\n    return content;\n  }\n  /**\r\n   * @param {Content} content\r\n   */\n\n\n  addToCache(content) {\n    // move to the end of array\n    this.removeByIndex(content.index);\n\n    this._cachedItems.push(content);\n\n    if (this._cachedItems.length > this.limit) {\n      // Destroy the first content that's not attached\n      const indexToRemove = this._cachedItems.findIndex(item => {\n        return !item.isAttached && !item.hasSlide;\n      });\n\n      if (indexToRemove !== -1) {\n        const removedItem = this._cachedItems.splice(indexToRemove, 1)[0];\n\n        removedItem.destroy();\n      }\n    }\n  }\n  /**\r\n   * Removes an image from cache, does not destroy() it, just removes.\r\n   *\r\n   * @param {number} index\r\n   */\n\n\n  removeByIndex(index) {\n    const indexToRemove = this._cachedItems.findIndex(item => item.index === index);\n\n    if (indexToRemove !== -1) {\n      this._cachedItems.splice(indexToRemove, 1);\n    }\n  }\n  /**\r\n   * @param {number} index\r\n   * @returns {Content | undefined}\r\n   */\n\n\n  getContentByIndex(index) {\n    return this._cachedItems.find(content => content.index === index);\n  }\n\n  destroy() {\n    this._cachedItems.forEach(content => content.destroy());\n\n    this._cachedItems = [];\n  }\n\n}\n\n/** @typedef {import(\"../photoswipe.js\").default} PhotoSwipe */\n\n/** @typedef {import(\"../slide/slide.js\").SlideData} SlideData */\n\n/**\r\n * PhotoSwipe base class that can retrieve data about every slide.\r\n * Shared by PhotoSwipe Core and PhotoSwipe Lightbox\r\n */\n\nclass PhotoSwipeBase extends Eventable {\n  /**\r\n   * Get total number of slides\r\n   *\r\n   * @returns {number}\r\n   */\n  getNumItems() {\n    var _this$options;\n\n    let numItems = 0;\n    const dataSource = (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dataSource;\n\n    if (dataSource && 'length' in dataSource) {\n      // may be an array or just object with length property\n      numItems = dataSource.length;\n    } else if (dataSource && 'gallery' in dataSource) {\n      // query DOM elements\n      if (!dataSource.items) {\n        dataSource.items = this._getGalleryDOMElements(dataSource.gallery);\n      }\n\n      if (dataSource.items) {\n        numItems = dataSource.items.length;\n      }\n    } // legacy event, before filters were introduced\n\n\n    const event = this.dispatch('numItems', {\n      dataSource,\n      numItems\n    });\n    return this.applyFilters('numItems', event.numItems, dataSource);\n  }\n  /**\r\n   * @param {SlideData} slideData\r\n   * @param {number} index\r\n   * @returns {Content}\r\n   */\n\n\n  createContentFromData(slideData, index) {\n    return new Content(slideData, this, index);\n  }\n  /**\r\n   * Get item data by index.\r\n   *\r\n   * \"item data\" should contain normalized information that PhotoSwipe needs to generate a slide.\r\n   * For example, it may contain properties like\r\n   * `src`, `srcset`, `w`, `h`, which will be used to generate a slide with image.\r\n   *\r\n   * @param {number} index\r\n   * @returns {SlideData}\r\n   */\n\n\n  getItemData(index) {\n    var _this$options2;\n\n    const dataSource = (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.dataSource;\n    /** @type {SlideData | HTMLElement} */\n\n    let dataSourceItem = {};\n\n    if (Array.isArray(dataSource)) {\n      // Datasource is an array of elements\n      dataSourceItem = dataSource[index];\n    } else if (dataSource && 'gallery' in dataSource) {\n      // dataSource has gallery property,\n      // thus it was created by Lightbox, based on\n      // gallery and children options\n      // query DOM elements\n      if (!dataSource.items) {\n        dataSource.items = this._getGalleryDOMElements(dataSource.gallery);\n      }\n\n      dataSourceItem = dataSource.items[index];\n    }\n\n    let itemData = dataSourceItem;\n\n    if (itemData instanceof Element) {\n      itemData = this._domElementToItemData(itemData);\n    } // Dispatching the itemData event,\n    // it's a legacy verion before filters were introduced\n\n\n    const event = this.dispatch('itemData', {\n      itemData: itemData || {},\n      index\n    });\n    return this.applyFilters('itemData', event.itemData, index);\n  }\n  /**\r\n   * Get array of gallery DOM elements,\r\n   * based on childSelector and gallery element.\r\n   *\r\n   * @param {HTMLElement} galleryElement\r\n   * @returns {HTMLElement[]}\r\n   */\n\n\n  _getGalleryDOMElements(galleryElement) {\n    var _this$options3, _this$options4;\n\n    if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.children || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.childSelector) {\n      return getElementsFromOption(this.options.children, this.options.childSelector, galleryElement) || [];\n    }\n\n    return [galleryElement];\n  }\n  /**\r\n   * Converts DOM element to item data object.\r\n   *\r\n   * @param {HTMLElement} element DOM element\r\n   * @returns {SlideData}\r\n   */\n\n\n  _domElementToItemData(element) {\n    /** @type {SlideData} */\n    const itemData = {\n      element\n    };\n    const linkEl =\n    /** @type {HTMLAnchorElement} */\n    element.tagName === 'A' ? element : element.querySelector('a');\n\n    if (linkEl) {\n      // src comes from data-pswp-src attribute,\n      // if it's empty link href is used\n      itemData.src = linkEl.dataset.pswpSrc || linkEl.href;\n\n      if (linkEl.dataset.pswpSrcset) {\n        itemData.srcset = linkEl.dataset.pswpSrcset;\n      }\n\n      itemData.width = linkEl.dataset.pswpWidth ? parseInt(linkEl.dataset.pswpWidth, 10) : 0;\n      itemData.height = linkEl.dataset.pswpHeight ? parseInt(linkEl.dataset.pswpHeight, 10) : 0; // support legacy w & h properties\n\n      itemData.w = itemData.width;\n      itemData.h = itemData.height;\n\n      if (linkEl.dataset.pswpType) {\n        itemData.type = linkEl.dataset.pswpType;\n      }\n\n      const thumbnailEl = element.querySelector('img');\n\n      if (thumbnailEl) {\n        var _thumbnailEl$getAttri;\n\n        // msrc is URL to placeholder image that's displayed before large image is loaded\n        // by default it's displayed only for the first slide\n        itemData.msrc = thumbnailEl.currentSrc || thumbnailEl.src;\n        itemData.alt = (_thumbnailEl$getAttri = thumbnailEl.getAttribute('alt')) !== null && _thumbnailEl$getAttri !== void 0 ? _thumbnailEl$getAttri : '';\n      }\n\n      if (linkEl.dataset.pswpCropped || linkEl.dataset.cropped) {\n        itemData.thumbCropped = true;\n      }\n    }\n\n    return this.applyFilters('domItemData', itemData, element, linkEl);\n  }\n  /**\r\n   * Lazy-load by slide data\r\n   *\r\n   * @param {SlideData} itemData Data about the slide\r\n   * @param {number} index\r\n   * @returns {Content} Image that is being decoded or false.\r\n   */\n\n\n  lazyLoadData(itemData, index) {\n    return lazyLoadData(itemData, this, index);\n  }\n\n}\n\n/** @typedef {import('./photoswipe.js').default} PhotoSwipe */\n\n/** @typedef {import('./slide/get-thumb-bounds.js').Bounds} Bounds */\n\n/** @typedef {import('./util/animations.js').AnimationProps} AnimationProps */\n// some browsers do not paint\n// elements which opacity is set to 0,\n// since we need to pre-render elements for the animation -\n// we set it to the minimum amount\n\nconst MIN_OPACITY = 0.003;\n/**\r\n * Manages opening and closing transitions of the PhotoSwipe.\r\n *\r\n * It can perform zoom, fade or no transition.\r\n */\n\nclass Opener {\n  /**\r\n   * @param {PhotoSwipe} pswp\r\n   */\n  constructor(pswp) {\n    this.pswp = pswp;\n    this.isClosed = true;\n    this.isOpen = false;\n    this.isClosing = false;\n    this.isOpening = false;\n    /**\r\n     * @private\r\n     * @type {number | false | undefined}\r\n     */\n\n    this._duration = undefined;\n    /** @private */\n\n    this._useAnimation = false;\n    /** @private */\n\n    this._croppedZoom = false;\n    /** @private */\n\n    this._animateRootOpacity = false;\n    /** @private */\n\n    this._animateBgOpacity = false;\n    /**\r\n     * @private\r\n     * @type { HTMLDivElement | HTMLImageElement | null | undefined }\r\n     */\n\n    this._placeholder = undefined;\n    /**\r\n     * @private\r\n     * @type { HTMLDivElement | undefined }\r\n     */\n\n    this._opacityElement = undefined;\n    /**\r\n     * @private\r\n     * @type { HTMLDivElement | undefined }\r\n     */\n\n    this._cropContainer1 = undefined;\n    /**\r\n     * @private\r\n     * @type { HTMLElement | null | undefined }\r\n     */\n\n    this._cropContainer2 = undefined;\n    /**\r\n     * @private\r\n     * @type {Bounds | undefined}\r\n     */\n\n    this._thumbBounds = undefined;\n    this._prepareOpen = this._prepareOpen.bind(this); // Override initial zoom and pan position\n\n    pswp.on('firstZoomPan', this._prepareOpen);\n  }\n\n  open() {\n    this._prepareOpen();\n\n    this._start();\n  }\n\n  close() {\n    if (this.isClosed || this.isClosing || this.isOpening) {\n      // if we close during opening animation\n      // for now do nothing,\n      // browsers aren't good at changing the direction of the CSS transition\n      return;\n    }\n\n    const slide = this.pswp.currSlide;\n    this.isOpen = false;\n    this.isOpening = false;\n    this.isClosing = true;\n    this._duration = this.pswp.options.hideAnimationDuration;\n\n    if (slide && slide.currZoomLevel * slide.width >= this.pswp.options.maxWidthToAnimate) {\n      this._duration = 0;\n    }\n\n    this._applyStartProps();\n\n    setTimeout(() => {\n      this._start();\n    }, this._croppedZoom ? 30 : 0);\n  }\n  /** @private */\n\n\n  _prepareOpen() {\n    this.pswp.off('firstZoomPan', this._prepareOpen);\n\n    if (!this.isOpening) {\n      const slide = this.pswp.currSlide;\n      this.isOpening = true;\n      this.isClosing = false;\n      this._duration = this.pswp.options.showAnimationDuration;\n\n      if (slide && slide.zoomLevels.initial * slide.width >= this.pswp.options.maxWidthToAnimate) {\n        this._duration = 0;\n      }\n\n      this._applyStartProps();\n    }\n  }\n  /** @private */\n\n\n  _applyStartProps() {\n    const {\n      pswp\n    } = this;\n    const slide = this.pswp.currSlide;\n    const {\n      options\n    } = pswp;\n\n    if (options.showHideAnimationType === 'fade') {\n      options.showHideOpacity = true;\n      this._thumbBounds = undefined;\n    } else if (options.showHideAnimationType === 'none') {\n      options.showHideOpacity = false;\n      this._duration = 0;\n      this._thumbBounds = undefined;\n    } else if (this.isOpening && pswp._initialThumbBounds) {\n      // Use initial bounds if defined\n      this._thumbBounds = pswp._initialThumbBounds;\n    } else {\n      this._thumbBounds = this.pswp.getThumbBounds();\n    }\n\n    this._placeholder = slide === null || slide === void 0 ? void 0 : slide.getPlaceholderElement();\n    pswp.animations.stopAll(); // Discard animations when duration is less than 50ms\n\n    this._useAnimation = Boolean(this._duration && this._duration > 50);\n    this._animateZoom = Boolean(this._thumbBounds) && (slide === null || slide === void 0 ? void 0 : slide.content.usePlaceholder()) && (!this.isClosing || !pswp.mainScroll.isShifted());\n\n    if (!this._animateZoom) {\n      this._animateRootOpacity = true;\n\n      if (this.isOpening && slide) {\n        slide.zoomAndPanToInitial();\n        slide.applyCurrentZoomPan();\n      }\n    } else {\n      var _options$showHideOpac;\n\n      this._animateRootOpacity = (_options$showHideOpac = options.showHideOpacity) !== null && _options$showHideOpac !== void 0 ? _options$showHideOpac : false;\n    }\n\n    this._animateBgOpacity = !this._animateRootOpacity && this.pswp.options.bgOpacity > MIN_OPACITY;\n    this._opacityElement = this._animateRootOpacity ? pswp.element : pswp.bg;\n\n    if (!this._useAnimation) {\n      this._duration = 0;\n      this._animateZoom = false;\n      this._animateBgOpacity = false;\n      this._animateRootOpacity = true;\n\n      if (this.isOpening) {\n        if (pswp.element) {\n          pswp.element.style.opacity = String(MIN_OPACITY);\n        }\n\n        pswp.applyBgOpacity(1);\n      }\n\n      return;\n    }\n\n    if (this._animateZoom && this._thumbBounds && this._thumbBounds.innerRect) {\n      var _this$pswp$currSlide;\n\n      // Properties are used when animation from cropped thumbnail\n      this._croppedZoom = true;\n      this._cropContainer1 = this.pswp.container;\n      this._cropContainer2 = (_this$pswp$currSlide = this.pswp.currSlide) === null || _this$pswp$currSlide === void 0 ? void 0 : _this$pswp$currSlide.holderElement;\n\n      if (pswp.container) {\n        pswp.container.style.overflow = 'hidden';\n        pswp.container.style.width = pswp.viewportSize.x + 'px';\n      }\n    } else {\n      this._croppedZoom = false;\n    }\n\n    if (this.isOpening) {\n      // Apply styles before opening transition\n      if (this._animateRootOpacity) {\n        if (pswp.element) {\n          pswp.element.style.opacity = String(MIN_OPACITY);\n        }\n\n        pswp.applyBgOpacity(1);\n      } else {\n        if (this._animateBgOpacity && pswp.bg) {\n          pswp.bg.style.opacity = String(MIN_OPACITY);\n        }\n\n        if (pswp.element) {\n          pswp.element.style.opacity = '1';\n        }\n      }\n\n      if (this._animateZoom) {\n        this._setClosedStateZoomPan();\n\n        if (this._placeholder) {\n          // tell browser that we plan to animate the placeholder\n          this._placeholder.style.willChange = 'transform'; // hide placeholder to allow hiding of\n          // elements that overlap it (such as icons over the thumbnail)\n\n          this._placeholder.style.opacity = String(MIN_OPACITY);\n        }\n      }\n    } else if (this.isClosing) {\n      // hide nearby slides to make sure that\n      // they are not painted during the transition\n      if (pswp.mainScroll.itemHolders[0]) {\n        pswp.mainScroll.itemHolders[0].el.style.display = 'none';\n      }\n\n      if (pswp.mainScroll.itemHolders[2]) {\n        pswp.mainScroll.itemHolders[2].el.style.display = 'none';\n      }\n\n      if (this._croppedZoom) {\n        if (pswp.mainScroll.x !== 0) {\n          // shift the main scroller to zero position\n          pswp.mainScroll.resetPosition();\n          pswp.mainScroll.resize();\n        }\n      }\n    }\n  }\n  /** @private */\n\n\n  _start() {\n    if (this.isOpening && this._useAnimation && this._placeholder && this._placeholder.tagName === 'IMG') {\n      // To ensure smooth animation\n      // we wait till the current slide image placeholder is decoded,\n      // but no longer than 250ms,\n      // and no shorter than 50ms\n      // (just using requestanimationframe is not enough in Firefox,\n      // for some reason)\n      new Promise(resolve => {\n        let decoded = false;\n        let isDelaying = true;\n        decodeImage(\n        /** @type {HTMLImageElement} */\n        this._placeholder).finally(() => {\n          decoded = true;\n\n          if (!isDelaying) {\n            resolve(true);\n          }\n        });\n        setTimeout(() => {\n          isDelaying = false;\n\n          if (decoded) {\n            resolve(true);\n          }\n        }, 50);\n        setTimeout(resolve, 250);\n      }).finally(() => this._initiate());\n    } else {\n      this._initiate();\n    }\n  }\n  /** @private */\n\n\n  _initiate() {\n    var _this$pswp$element, _this$pswp$element2;\n\n    (_this$pswp$element = this.pswp.element) === null || _this$pswp$element === void 0 || _this$pswp$element.style.setProperty('--pswp-transition-duration', this._duration + 'ms');\n    this.pswp.dispatch(this.isOpening ? 'openingAnimationStart' : 'closingAnimationStart'); // legacy event\n\n    this.pswp.dispatch(\n    /** @type {'initialZoomIn' | 'initialZoomOut'} */\n    'initialZoom' + (this.isOpening ? 'In' : 'Out'));\n    (_this$pswp$element2 = this.pswp.element) === null || _this$pswp$element2 === void 0 || _this$pswp$element2.classList.toggle('pswp--ui-visible', this.isOpening);\n\n    if (this.isOpening) {\n      if (this._placeholder) {\n        // unhide the placeholder\n        this._placeholder.style.opacity = '1';\n      }\n\n      this._animateToOpenState();\n    } else if (this.isClosing) {\n      this._animateToClosedState();\n    }\n\n    if (!this._useAnimation) {\n      this._onAnimationComplete();\n    }\n  }\n  /** @private */\n\n\n  _onAnimationComplete() {\n    const {\n      pswp\n    } = this;\n    this.isOpen = this.isOpening;\n    this.isClosed = this.isClosing;\n    this.isOpening = false;\n    this.isClosing = false;\n    pswp.dispatch(this.isOpen ? 'openingAnimationEnd' : 'closingAnimationEnd'); // legacy event\n\n    pswp.dispatch(\n    /** @type {'initialZoomInEnd' | 'initialZoomOutEnd'} */\n    'initialZoom' + (this.isOpen ? 'InEnd' : 'OutEnd'));\n\n    if (this.isClosed) {\n      pswp.destroy();\n    } else if (this.isOpen) {\n      var _pswp$currSlide;\n\n      if (this._animateZoom && pswp.container) {\n        pswp.container.style.overflow = 'visible';\n        pswp.container.style.width = '100%';\n      }\n\n      (_pswp$currSlide = pswp.currSlide) === null || _pswp$currSlide === void 0 || _pswp$currSlide.applyCurrentZoomPan();\n    }\n  }\n  /** @private */\n\n\n  _animateToOpenState() {\n    const {\n      pswp\n    } = this;\n\n    if (this._animateZoom) {\n      if (this._croppedZoom && this._cropContainer1 && this._cropContainer2) {\n        this._animateTo(this._cropContainer1, 'transform', 'translate3d(0,0,0)');\n\n        this._animateTo(this._cropContainer2, 'transform', 'none');\n      }\n\n      if (pswp.currSlide) {\n        pswp.currSlide.zoomAndPanToInitial();\n\n        this._animateTo(pswp.currSlide.container, 'transform', pswp.currSlide.getCurrentTransform());\n      }\n    }\n\n    if (this._animateBgOpacity && pswp.bg) {\n      this._animateTo(pswp.bg, 'opacity', String(pswp.options.bgOpacity));\n    }\n\n    if (this._animateRootOpacity && pswp.element) {\n      this._animateTo(pswp.element, 'opacity', '1');\n    }\n  }\n  /** @private */\n\n\n  _animateToClosedState() {\n    const {\n      pswp\n    } = this;\n\n    if (this._animateZoom) {\n      this._setClosedStateZoomPan(true);\n    } // do not animate opacity if it's already at 0\n\n\n    if (this._animateBgOpacity && pswp.bgOpacity > 0.01 && pswp.bg) {\n      this._animateTo(pswp.bg, 'opacity', '0');\n    }\n\n    if (this._animateRootOpacity && pswp.element) {\n      this._animateTo(pswp.element, 'opacity', '0');\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {boolean} [animate]\r\n   */\n\n\n  _setClosedStateZoomPan(animate) {\n    if (!this._thumbBounds) return;\n    const {\n      pswp\n    } = this;\n    const {\n      innerRect\n    } = this._thumbBounds;\n    const {\n      currSlide,\n      viewportSize\n    } = pswp;\n\n    if (this._croppedZoom && innerRect && this._cropContainer1 && this._cropContainer2) {\n      const containerOnePanX = -viewportSize.x + (this._thumbBounds.x - innerRect.x) + innerRect.w;\n      const containerOnePanY = -viewportSize.y + (this._thumbBounds.y - innerRect.y) + innerRect.h;\n      const containerTwoPanX = viewportSize.x - innerRect.w;\n      const containerTwoPanY = viewportSize.y - innerRect.h;\n\n      if (animate) {\n        this._animateTo(this._cropContainer1, 'transform', toTransformString(containerOnePanX, containerOnePanY));\n\n        this._animateTo(this._cropContainer2, 'transform', toTransformString(containerTwoPanX, containerTwoPanY));\n      } else {\n        setTransform(this._cropContainer1, containerOnePanX, containerOnePanY);\n        setTransform(this._cropContainer2, containerTwoPanX, containerTwoPanY);\n      }\n    }\n\n    if (currSlide) {\n      equalizePoints(currSlide.pan, innerRect || this._thumbBounds);\n      currSlide.currZoomLevel = this._thumbBounds.w / currSlide.width;\n\n      if (animate) {\n        this._animateTo(currSlide.container, 'transform', currSlide.getCurrentTransform());\n      } else {\n        currSlide.applyCurrentZoomPan();\n      }\n    }\n  }\n  /**\r\n   * @private\r\n   * @param {HTMLElement} target\r\n   * @param {'transform' | 'opacity'} prop\r\n   * @param {string} propValue\r\n   */\n\n\n  _animateTo(target, prop, propValue) {\n    if (!this._duration) {\n      target.style[prop] = propValue;\n      return;\n    }\n\n    const {\n      animations\n    } = this.pswp;\n    /** @type {AnimationProps} */\n\n    const animProps = {\n      duration: this._duration,\n      easing: this.pswp.options.easing,\n      onComplete: () => {\n        if (!animations.activeAnimations.length) {\n          this._onAnimationComplete();\n        }\n      },\n      target\n    };\n    animProps[prop] = propValue;\n    animations.startTransition(animProps);\n  }\n\n}\n\n/**\r\n * @template T\r\n * @typedef {import('./types.js').Type<T>} Type<T>\r\n */\n\n/** @typedef {import('./slide/slide.js').SlideData} SlideData */\n\n/** @typedef {import('./slide/zoom-level.js').ZoomLevelOption} ZoomLevelOption */\n\n/** @typedef {import('./ui/ui-element.js').UIElementData} UIElementData */\n\n/** @typedef {import('./main-scroll.js').ItemHolder} ItemHolder */\n\n/** @typedef {import('./core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */\n\n/** @typedef {import('./core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */\n\n/** @typedef {import('./slide/get-thumb-bounds').Bounds} Bounds */\n\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {import('./core/eventable.js').EventCallback<T>} EventCallback<T>\r\n */\n\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {import('./core/eventable.js').AugmentedEvent<T>} AugmentedEvent<T>\r\n */\n\n/** @typedef {{ x: number; y: number; id?: string | number }} Point */\n\n/** @typedef {{ top: number; bottom: number; left: number; right: number }} Padding */\n\n/** @typedef {SlideData[]} DataSourceArray */\n\n/** @typedef {{ gallery: HTMLElement; items?: HTMLElement[] }} DataSourceObject */\n\n/** @typedef {DataSourceArray | DataSourceObject} DataSource */\n\n/** @typedef {(point: Point, originalEvent: PointerEvent) => void} ActionFn */\n\n/** @typedef {'close' | 'next' | 'zoom' | 'zoom-or-close' | 'toggle-controls'} ActionType */\n\n/** @typedef {Type<PhotoSwipe> | { default: Type<PhotoSwipe> }} PhotoSwipeModule */\n\n/** @typedef {PhotoSwipeModule | Promise<PhotoSwipeModule> | (() => Promise<PhotoSwipeModule>)} PhotoSwipeModuleOption */\n\n/**\r\n * @typedef {string | NodeListOf<HTMLElement> | HTMLElement[] | HTMLElement} ElementProvider\r\n */\n\n/** @typedef {Partial<PreparedPhotoSwipeOptions>} PhotoSwipeOptions https://photoswipe.com/options/ */\n\n/**\r\n * @typedef {Object} PreparedPhotoSwipeOptions\r\n *\r\n * @prop {DataSource} [dataSource]\r\n * Pass an array of any items via dataSource option. Its length will determine amount of slides\r\n * (which may be modified further from numItems event).\r\n *\r\n * Each item should contain data that you need to generate slide\r\n * (for image slide it would be src (image URL), width (image width), height, srcset, alt).\r\n *\r\n * If these properties are not present in your initial array, you may \"pre-parse\" each item from itemData filter.\r\n *\r\n * @prop {number} bgOpacity\r\n * Background backdrop opacity, always define it via this option and not via CSS rgba color.\r\n *\r\n * @prop {number} spacing\r\n * Spacing between slides. Defined as ratio relative to the viewport width (0.1 = 10% of viewport).\r\n *\r\n * @prop {boolean} allowPanToNext\r\n * Allow swipe navigation to the next slide when the current slide is zoomed. Does not apply to mouse events.\r\n *\r\n * @prop {boolean} loop\r\n * If set to true you'll be able to swipe from the last to the first image.\r\n * Option is always false when there are less than 3 slides.\r\n *\r\n * @prop {boolean} [wheelToZoom]\r\n * By default PhotoSwipe zooms image with ctrl-wheel, if you enable this option - image will zoom just via wheel.\r\n *\r\n * @prop {boolean} pinchToClose\r\n * Pinch touch gesture to close the gallery.\r\n *\r\n * @prop {boolean} closeOnVerticalDrag\r\n * Vertical drag gesture to close the PhotoSwipe.\r\n *\r\n * @prop {Padding} [padding]\r\n * Slide area padding (in pixels).\r\n *\r\n * @prop {(viewportSize: Point, itemData: SlideData, index: number) => Padding} [paddingFn]\r\n * The option is checked frequently, so make sure it's performant. Overrides padding option if defined. For example:\r\n *\r\n * @prop {number | false} hideAnimationDuration\r\n * Transition duration in milliseconds, can be 0.\r\n *\r\n * @prop {number | false} showAnimationDuration\r\n * Transition duration in milliseconds, can be 0.\r\n *\r\n * @prop {number | false} zoomAnimationDuration\r\n * Transition duration in milliseconds, can be 0.\r\n *\r\n * @prop {string} easing\r\n * String, 'cubic-bezier(.4,0,.22,1)'. CSS easing function for open/close/zoom transitions.\r\n *\r\n * @prop {boolean} escKey\r\n * Esc key to close.\r\n *\r\n * @prop {boolean} arrowKeys\r\n * Left/right arrow keys for navigation.\r\n *\r\n * @prop {boolean} trapFocus\r\n * Trap focus within PhotoSwipe element while it's open.\r\n *\r\n * @prop {boolean} returnFocus\r\n * Restore focus the last active element after PhotoSwipe is closed.\r\n *\r\n * @prop {boolean} clickToCloseNonZoomable\r\n * If image is not zoomable (for example, smaller than viewport) it can be closed by clicking on it.\r\n *\r\n * @prop {ActionType | ActionFn | false} imageClickAction\r\n * Refer to click and tap actions page.\r\n *\r\n * @prop {ActionType | ActionFn | false} bgClickAction\r\n * Refer to click and tap actions page.\r\n *\r\n * @prop {ActionType | ActionFn | false} tapAction\r\n * Refer to click and tap actions page.\r\n *\r\n * @prop {ActionType | ActionFn | false} doubleTapAction\r\n * Refer to click and tap actions page.\r\n *\r\n * @prop {number} preloaderDelay\r\n * Delay before the loading indicator will be displayed,\r\n * if image is loaded during it - the indicator will not be displayed at all. Can be zero.\r\n *\r\n * @prop {string} indexIndicatorSep\r\n * Used for slide count indicator (\"1 of 10 \").\r\n *\r\n * @prop {(options: PhotoSwipeOptions, pswp: PhotoSwipeBase) => Point} [getViewportSizeFn]\r\n * A function that should return slide viewport width and height, in format {x: 100, y: 100}.\r\n *\r\n * @prop {string} errorMsg\r\n * Message to display when the image wasn't able to load. If you need to display HTML - use contentErrorElement filter.\r\n *\r\n * @prop {[number, number]} preload\r\n * Lazy loading of nearby slides based on direction of movement. Should be an array with two integers,\r\n * first one - number of items to preload before the current image, second one - after the current image.\r\n * Two nearby images are always loaded.\r\n *\r\n * @prop {string} [mainClass]\r\n * Class that will be added to the root element of PhotoSwipe, may contain multiple separated by space.\r\n * Example on Styling page.\r\n *\r\n * @prop {HTMLElement} [appendToEl]\r\n * Element to which PhotoSwipe dialog will be appended when it opens.\r\n *\r\n * @prop {number} maxWidthToAnimate\r\n * Maximum width of image to animate, if initial rendered image width\r\n * is larger than this value - the opening/closing transition will be automatically disabled.\r\n *\r\n * @prop {string} [closeTitle]\r\n * Translating\r\n *\r\n * @prop {string} [zoomTitle]\r\n * Translating\r\n *\r\n * @prop {string} [arrowPrevTitle]\r\n * Translating\r\n *\r\n * @prop {string} [arrowNextTitle]\r\n * Translating\r\n *\r\n * @prop {'zoom' | 'fade' | 'none'} [showHideAnimationType]\r\n * To adjust opening or closing transition type use lightbox option `showHideAnimationType` (`String`).\r\n * It supports three values - `zoom` (default), `fade` (default if there is no thumbnail) and `none`.\r\n *\r\n * Animations are automatically disabled if user `(prefers-reduced-motion: reduce)`.\r\n *\r\n * @prop {number} index\r\n * Defines start slide index.\r\n *\r\n * @prop {(e: MouseEvent) => number} [getClickedIndexFn]\r\n *\r\n * @prop {boolean} [arrowPrev]\r\n * @prop {boolean} [arrowNext]\r\n * @prop {boolean} [zoom]\r\n * @prop {boolean} [close]\r\n * @prop {boolean} [counter]\r\n *\r\n * @prop {string} [arrowPrevSVG]\r\n * @prop {string} [arrowNextSVG]\r\n * @prop {string} [zoomSVG]\r\n * @prop {string} [closeSVG]\r\n * @prop {string} [counterSVG]\r\n *\r\n * @prop {string} [arrowPrevTitle]\r\n * @prop {string} [arrowNextTitle]\r\n * @prop {string} [zoomTitle]\r\n * @prop {string} [closeTitle]\r\n * @prop {string} [counterTitle]\r\n *\r\n * @prop {ZoomLevelOption} [initialZoomLevel]\r\n * @prop {ZoomLevelOption} [secondaryZoomLevel]\r\n * @prop {ZoomLevelOption} [maxZoomLevel]\r\n *\r\n * @prop {boolean} [mouseMovePan]\r\n * @prop {Point | null} [initialPointerPos]\r\n * @prop {boolean} [showHideOpacity]\r\n *\r\n * @prop {PhotoSwipeModuleOption} [pswpModule]\r\n * @prop {() => Promise<any>} [openPromise]\r\n * @prop {boolean} [preloadFirstSlide]\r\n * @prop {ElementProvider} [gallery]\r\n * @prop {string} [gallerySelector]\r\n * @prop {ElementProvider} [children]\r\n * @prop {string} [childSelector]\r\n * @prop {string | false} [thumbSelector]\r\n */\n\n/** @type {PreparedPhotoSwipeOptions} */\n\nconst defaultOptions = {\n  allowPanToNext: true,\n  spacing: 0.1,\n  loop: true,\n  pinchToClose: true,\n  closeOnVerticalDrag: true,\n  hideAnimationDuration: 333,\n  showAnimationDuration: 333,\n  zoomAnimationDuration: 333,\n  escKey: true,\n  arrowKeys: true,\n  trapFocus: true,\n  returnFocus: true,\n  maxWidthToAnimate: 4000,\n  clickToCloseNonZoomable: true,\n  imageClickAction: 'zoom-or-close',\n  bgClickAction: 'close',\n  tapAction: 'toggle-controls',\n  doubleTapAction: 'zoom',\n  indexIndicatorSep: ' / ',\n  preloaderDelay: 2000,\n  bgOpacity: 0.8,\n  index: 0,\n  errorMsg: 'The image cannot be loaded',\n  preload: [1, 2],\n  easing: 'cubic-bezier(.4,0,.22,1)'\n};\n/**\r\n * PhotoSwipe Core\r\n */\n\nclass PhotoSwipe extends PhotoSwipeBase {\n  /**\r\n   * @param {PhotoSwipeOptions} [options]\r\n   */\n  constructor(options) {\n    super();\n    this.options = this._prepareOptions(options || {});\n    /**\r\n     * offset of viewport relative to document\r\n     *\r\n     * @type {Point}\r\n     */\n\n    this.offset = {\n      x: 0,\n      y: 0\n    };\n    /**\r\n     * @type {Point}\r\n     * @private\r\n     */\n\n    this._prevViewportSize = {\n      x: 0,\n      y: 0\n    };\n    /**\r\n     * Size of scrollable PhotoSwipe viewport\r\n     *\r\n     * @type {Point}\r\n     */\n\n    this.viewportSize = {\n      x: 0,\n      y: 0\n    };\n    /**\r\n     * background (backdrop) opacity\r\n     */\n\n    this.bgOpacity = 1;\n    this.currIndex = 0;\n    this.potentialIndex = 0;\n    this.isOpen = false;\n    this.isDestroying = false;\n    this.hasMouse = false;\n    /**\r\n     * @private\r\n     * @type {SlideData}\r\n     */\n\n    this._initialItemData = {};\n    /** @type {Bounds | undefined} */\n\n    this._initialThumbBounds = undefined;\n    /** @type {HTMLDivElement | undefined} */\n\n    this.topBar = undefined;\n    /** @type {HTMLDivElement | undefined} */\n\n    this.element = undefined;\n    /** @type {HTMLDivElement | undefined} */\n\n    this.template = undefined;\n    /** @type {HTMLDivElement | undefined} */\n\n    this.container = undefined;\n    /** @type {HTMLElement | undefined} */\n\n    this.scrollWrap = undefined;\n    /** @type {Slide | undefined} */\n\n    this.currSlide = undefined;\n    this.events = new DOMEvents();\n    this.animations = new Animations();\n    this.mainScroll = new MainScroll(this);\n    this.gestures = new Gestures(this);\n    this.opener = new Opener(this);\n    this.keyboard = new Keyboard(this);\n    this.contentLoader = new ContentLoader(this);\n  }\n  /** @returns {boolean} */\n\n\n  init() {\n    if (this.isOpen || this.isDestroying) {\n      return false;\n    }\n\n    this.isOpen = true;\n    this.dispatch('init'); // legacy\n\n    this.dispatch('beforeOpen');\n\n    this._createMainStructure(); // add classes to the root element of PhotoSwipe\n\n\n    let rootClasses = 'pswp--open';\n\n    if (this.gestures.supportsTouch) {\n      rootClasses += ' pswp--touch';\n    }\n\n    if (this.options.mainClass) {\n      rootClasses += ' ' + this.options.mainClass;\n    }\n\n    if (this.element) {\n      this.element.className += ' ' + rootClasses;\n    }\n\n    this.currIndex = this.options.index || 0;\n    this.potentialIndex = this.currIndex;\n    this.dispatch('firstUpdate'); // starting index can be modified here\n    // initialize scroll wheel handler to block the scroll\n\n    this.scrollWheel = new ScrollWheel(this); // sanitize index\n\n    if (Number.isNaN(this.currIndex) || this.currIndex < 0 || this.currIndex >= this.getNumItems()) {\n      this.currIndex = 0;\n    }\n\n    if (!this.gestures.supportsTouch) {\n      // enable mouse features if no touch support detected\n      this.mouseDetected();\n    } // causes forced synchronous layout\n\n\n    this.updateSize();\n    this.offset.y = window.pageYOffset;\n    this._initialItemData = this.getItemData(this.currIndex);\n    this.dispatch('gettingData', {\n      index: this.currIndex,\n      data: this._initialItemData,\n      slide: undefined\n    }); // *Layout* - calculate size and position of elements here\n\n    this._initialThumbBounds = this.getThumbBounds();\n    this.dispatch('initialLayout');\n    this.on('openingAnimationEnd', () => {\n      const {\n        itemHolders\n      } = this.mainScroll; // Add content to the previous and next slide\n\n      if (itemHolders[0]) {\n        itemHolders[0].el.style.display = 'block';\n        this.setContent(itemHolders[0], this.currIndex - 1);\n      }\n\n      if (itemHolders[2]) {\n        itemHolders[2].el.style.display = 'block';\n        this.setContent(itemHolders[2], this.currIndex + 1);\n      }\n\n      this.appendHeavy();\n      this.contentLoader.updateLazy();\n      this.events.add(window, 'resize', this._handlePageResize.bind(this));\n      this.events.add(window, 'scroll', this._updatePageScrollOffset.bind(this));\n      this.dispatch('bindEvents');\n    }); // set content for center slide (first time)\n\n    if (this.mainScroll.itemHolders[1]) {\n      this.setContent(this.mainScroll.itemHolders[1], this.currIndex);\n    }\n\n    this.dispatch('change');\n    this.opener.open();\n    this.dispatch('afterInit');\n    return true;\n  }\n  /**\r\n   * Get looped slide index\r\n   * (for example, -1 will return the last slide)\r\n   *\r\n   * @param {number} index\r\n   * @returns {number}\r\n   */\n\n\n  getLoopedIndex(index) {\n    const numSlides = this.getNumItems();\n\n    if (this.options.loop) {\n      if (index > numSlides - 1) {\n        index -= numSlides;\n      }\n\n      if (index < 0) {\n        index += numSlides;\n      }\n    }\n\n    return clamp(index, 0, numSlides - 1);\n  }\n\n  appendHeavy() {\n    this.mainScroll.itemHolders.forEach(itemHolder => {\n      var _itemHolder$slide;\n\n      (_itemHolder$slide = itemHolder.slide) === null || _itemHolder$slide === void 0 || _itemHolder$slide.appendHeavy();\n    });\n  }\n  /**\r\n   * Change the slide\r\n   * @param {number} index New index\r\n   */\n\n\n  goTo(index) {\n    this.mainScroll.moveIndexBy(this.getLoopedIndex(index) - this.potentialIndex);\n  }\n  /**\r\n   * Go to the next slide.\r\n   */\n\n\n  next() {\n    this.goTo(this.potentialIndex + 1);\n  }\n  /**\r\n   * Go to the previous slide.\r\n   */\n\n\n  prev() {\n    this.goTo(this.potentialIndex - 1);\n  }\n  /**\r\n   * @see slide/slide.js zoomTo\r\n   *\r\n   * @param {Parameters<Slide['zoomTo']>} args\r\n   */\n\n\n  zoomTo(...args) {\n    var _this$currSlide;\n\n    (_this$currSlide = this.currSlide) === null || _this$currSlide === void 0 || _this$currSlide.zoomTo(...args);\n  }\n  /**\r\n   * @see slide/slide.js toggleZoom\r\n   */\n\n\n  toggleZoom() {\n    var _this$currSlide2;\n\n    (_this$currSlide2 = this.currSlide) === null || _this$currSlide2 === void 0 || _this$currSlide2.toggleZoom();\n  }\n  /**\r\n   * Close the gallery.\r\n   * After closing transition ends - destroy it\r\n   */\n\n\n  close() {\n    if (!this.opener.isOpen || this.isDestroying) {\n      return;\n    }\n\n    this.isDestroying = true;\n    this.dispatch('close');\n    this.events.removeAll();\n    this.opener.close();\n  }\n  /**\r\n   * Destroys the gallery:\r\n   * - instantly closes the gallery\r\n   * - unbinds events,\r\n   * - cleans intervals and timeouts\r\n   * - removes elements from DOM\r\n   */\n\n\n  destroy() {\n    var _this$element;\n\n    if (!this.isDestroying) {\n      this.options.showHideAnimationType = 'none';\n      this.close();\n      return;\n    }\n\n    this.dispatch('destroy');\n    this._listeners = {};\n\n    if (this.scrollWrap) {\n      this.scrollWrap.ontouchmove = null;\n      this.scrollWrap.ontouchend = null;\n    }\n\n    (_this$element = this.element) === null || _this$element === void 0 || _this$element.remove();\n    this.mainScroll.itemHolders.forEach(itemHolder => {\n      var _itemHolder$slide2;\n\n      (_itemHolder$slide2 = itemHolder.slide) === null || _itemHolder$slide2 === void 0 || _itemHolder$slide2.destroy();\n    });\n    this.contentLoader.destroy();\n    this.events.removeAll();\n  }\n  /**\r\n   * Refresh/reload content of a slide by its index\r\n   *\r\n   * @param {number} slideIndex\r\n   */\n\n\n  refreshSlideContent(slideIndex) {\n    this.contentLoader.removeByIndex(slideIndex);\n    this.mainScroll.itemHolders.forEach((itemHolder, i) => {\n      var _this$currSlide$index, _this$currSlide3;\n\n      let potentialHolderIndex = ((_this$currSlide$index = (_this$currSlide3 = this.currSlide) === null || _this$currSlide3 === void 0 ? void 0 : _this$currSlide3.index) !== null && _this$currSlide$index !== void 0 ? _this$currSlide$index : 0) - 1 + i;\n\n      if (this.canLoop()) {\n        potentialHolderIndex = this.getLoopedIndex(potentialHolderIndex);\n      }\n\n      if (potentialHolderIndex === slideIndex) {\n        // set the new slide content\n        this.setContent(itemHolder, slideIndex, true); // activate the new slide if it's current\n\n        if (i === 1) {\n          var _itemHolder$slide3;\n\n          this.currSlide = itemHolder.slide;\n          (_itemHolder$slide3 = itemHolder.slide) === null || _itemHolder$slide3 === void 0 || _itemHolder$slide3.setIsActive(true);\n        }\n      }\n    });\n    this.dispatch('change');\n  }\n  /**\r\n   * Set slide content\r\n   *\r\n   * @param {ItemHolder} holder mainScroll.itemHolders array item\r\n   * @param {number} index Slide index\r\n   * @param {boolean} [force] If content should be set even if index wasn't changed\r\n   */\n\n\n  setContent(holder, index, force) {\n    if (this.canLoop()) {\n      index = this.getLoopedIndex(index);\n    }\n\n    if (holder.slide) {\n      if (holder.slide.index === index && !force) {\n        // exit if holder already contains this slide\n        // this could be common when just three slides are used\n        return;\n      } // destroy previous slide\n\n\n      holder.slide.destroy();\n      holder.slide = undefined;\n    } // exit if no loop and index is out of bounds\n\n\n    if (!this.canLoop() && (index < 0 || index >= this.getNumItems())) {\n      return;\n    }\n\n    const itemData = this.getItemData(index);\n    holder.slide = new Slide(itemData, index, this); // set current slide\n\n    if (index === this.currIndex) {\n      this.currSlide = holder.slide;\n    }\n\n    holder.slide.append(holder.el);\n  }\n  /** @returns {Point} */\n\n\n  getViewportCenterPoint() {\n    return {\n      x: this.viewportSize.x / 2,\n      y: this.viewportSize.y / 2\n    };\n  }\n  /**\r\n   * Update size of all elements.\r\n   * Executed on init and on page resize.\r\n   *\r\n   * @param {boolean} [force] Update size even if size of viewport was not changed.\r\n   */\n\n\n  updateSize(force) {\n    // let item;\n    // let itemIndex;\n    if (this.isDestroying) {\n      // exit if PhotoSwipe is closed or closing\n      // (to avoid errors, as resize event might be delayed)\n      return;\n    } //const newWidth = this.scrollWrap.clientWidth;\n    //const newHeight = this.scrollWrap.clientHeight;\n\n\n    const newViewportSize = getViewportSize(this.options, this);\n\n    if (!force && pointsEqual(newViewportSize, this._prevViewportSize)) {\n      // Exit if dimensions were not changed\n      return;\n    } //this._prevViewportSize.x = newWidth;\n    //this._prevViewportSize.y = newHeight;\n\n\n    equalizePoints(this._prevViewportSize, newViewportSize);\n    this.dispatch('beforeResize');\n    equalizePoints(this.viewportSize, this._prevViewportSize);\n\n    this._updatePageScrollOffset();\n\n    this.dispatch('viewportSize'); // Resize slides only after opener animation is finished\n    // and don't re-calculate size on inital size update\n\n    this.mainScroll.resize(this.opener.isOpen);\n\n    if (!this.hasMouse && window.matchMedia('(any-hover: hover)').matches) {\n      this.mouseDetected();\n    }\n\n    this.dispatch('resize');\n  }\n  /**\r\n   * @param {number} opacity\r\n   */\n\n\n  applyBgOpacity(opacity) {\n    this.bgOpacity = Math.max(opacity, 0);\n\n    if (this.bg) {\n      this.bg.style.opacity = String(this.bgOpacity * this.options.bgOpacity);\n    }\n  }\n  /**\r\n   * Whether mouse is detected\r\n   */\n\n\n  mouseDetected() {\n    if (!this.hasMouse) {\n      var _this$element2;\n\n      this.hasMouse = true;\n      (_this$element2 = this.element) === null || _this$element2 === void 0 || _this$element2.classList.add('pswp--has_mouse');\n    }\n  }\n  /**\r\n   * Page resize event handler\r\n   *\r\n   * @private\r\n   */\n\n\n  _handlePageResize() {\n    this.updateSize(); // In iOS webview, if element size depends on document size,\n    // it'll be measured incorrectly in resize event\n    //\n    // https://bugs.webkit.org/show_bug.cgi?id=170595\n    // https://hackernoon.com/onresize-event-broken-in-mobile-safari-d8469027bf4d\n\n    if (/iPhone|iPad|iPod/i.test(window.navigator.userAgent)) {\n      setTimeout(() => {\n        this.updateSize();\n      }, 500);\n    }\n  }\n  /**\r\n   * Page scroll offset is used\r\n   * to get correct coordinates\r\n   * relative to PhotoSwipe viewport.\r\n   *\r\n   * @private\r\n   */\n\n\n  _updatePageScrollOffset() {\n    this.setScrollOffset(0, window.pageYOffset);\n  }\n  /**\r\n   * @param {number} x\r\n   * @param {number} y\r\n   */\n\n\n  setScrollOffset(x, y) {\n    this.offset.x = x;\n    this.offset.y = y;\n    this.dispatch('updateScrollOffset');\n  }\n  /**\r\n   * Create main HTML structure of PhotoSwipe,\r\n   * and add it to DOM\r\n   *\r\n   * @private\r\n   */\n\n\n  _createMainStructure() {\n    // root DOM element of PhotoSwipe (.pswp)\n    this.element = createElement('pswp', 'div');\n    this.element.setAttribute('tabindex', '-1');\n    this.element.setAttribute('role', 'dialog'); // template is legacy prop\n\n    this.template = this.element; // Background is added as a separate element,\n    // as animating opacity is faster than animating rgba()\n\n    this.bg = createElement('pswp__bg', 'div', this.element);\n    this.scrollWrap = createElement('pswp__scroll-wrap', 'section', this.element);\n    this.container = createElement('pswp__container', 'div', this.scrollWrap); // aria pattern: carousel\n\n    this.scrollWrap.setAttribute('aria-roledescription', 'carousel');\n    this.container.setAttribute('aria-live', 'off');\n    this.container.setAttribute('id', 'pswp__items');\n    this.mainScroll.appendHolders();\n    this.ui = new UI(this);\n    this.ui.init(); // append to DOM\n\n    (this.options.appendToEl || document.body).appendChild(this.element);\n  }\n  /**\r\n   * Get position and dimensions of small thumbnail\r\n   *   {x:,y:,w:}\r\n   *\r\n   * Height is optional (calculated based on the large image)\r\n   *\r\n   * @returns {Bounds | undefined}\r\n   */\n\n\n  getThumbBounds() {\n    return getThumbBounds(this.currIndex, this.currSlide ? this.currSlide.data : this._initialItemData, this);\n  }\n  /**\r\n   * If the PhotoSwipe can have continuous loop\r\n   * @returns Boolean\r\n   */\n\n\n  canLoop() {\n    return this.options.loop && this.getNumItems() > 2;\n  }\n  /**\r\n   * @private\r\n   * @param {PhotoSwipeOptions} options\r\n   * @returns {PreparedPhotoSwipeOptions}\r\n   */\n\n\n  _prepareOptions(options) {\n    if (window.matchMedia('(prefers-reduced-motion), (update: slow)').matches) {\n      options.showHideAnimationType = 'none';\n      options.zoomAnimationDuration = 0;\n    }\n    /** @type {PreparedPhotoSwipeOptions} */\n\n\n    return { ...defaultOptions,\n      ...options\n    };\n  }\n\n}\n\nexport { PhotoSwipe as default };\n//# sourceMappingURL=photoswipe.esm.js.map\n"],"names":["createElement","className","tagName","appendToEl","el","equalizePoints","p1","p2","roundPoint","p","getDistanceBetween","x","y","pointsEqual","clamp","val","min","max","toTransformString","scale","propValue","setTransform","defaultCSSEasing","setTransitionStyle","prop","duration","ease","setWidthHeight","w","h","removeTransitionStyle","decodeImage","img","resolve","reject","LOAD_STATE","specialKeyUsed","e","getElementsFromOption","option","legacySelector","parent","elements","selector","isSafari","supportsPassive","DOMEvents","target","type","listener","passive","poolItem","unbind","skipPool","methodName","eType","eventOptions","getViewportSize","options","pswp","newViewportSize","parsePaddingOption","viewportSize","itemData","index","paddingValue","legacyPropName","getPanAreaSize","PanBounds","slide","currZoomLevel","axis","elSize","padding","panAreaSize","panOffset","MAX_IMAGE_WIDTH","ZoomLevel","maxWidth","maxHeight","elementSize","hRatio","vRatio","optionPrefix","optionName","optionValue","Slide","data","isActive","holderElement","force","scaleMultiplier","width","height","_this$content$placeho","destZoomLevel","centerPoint","transitionDuration","ignoreBounds","prevZoomLevel","finishTransition","point","zoomFactor","panX","panY","zoom","newResolution","PAN_END_FRICTION","VERTICAL_DRAG_FRICTION","MIN_RATIO_TO_CLOSE","MIN_NEXT_SLIDE_SPEED","project","initialVelocity","decelerationRate","DragHandler","gestures","prevP1","dragAxis","currSlide","bgOpacity","velocity","mainScroll","indexDiff","currentSlideVisibilityRatio","pan","bounds","panPos","restoreBgOpacity","projectedPosition","vDragRatio","projectedVDragRatio","correctedPanPosition","dampingRatio","initialBgOpacity","totalPanDist","pos","animationProgressRatio","isMultitouch","delta","newMainScrollX","newPan","currSlideMainScrollX","mainScrollShiftDiff","isLeftToRight","isRightToLeft","_this$pswp$currSlide$","_this$pswp$currSlide","potentialPan","customFriction","UPPER_ZOOM_FRICTION","LOWER_ZOOM_FRICTION","getZoomPointsCenter","ZoomHandler","startP1","startP2","minZoomLevel","maxZoomLevel","ignoreGesture","destinationZoomLevel","currZoomLevelNeedsChange","initialPan","destinationPan","panNeedsChange","now","newZoomLevel","didTapOnMainContent","event","TapHandler","originalEvent","targetClassList","isImageClick","isBackgroundClick","actionName","_this$gestures$pswp$e","actionFullName","AXIS_SWIPE_HYSTERISIS","DOUBLE_TAP_DELAY","MIN_TAP_DISTANCE","Gestures","pref","down","up","cancel","events","cancelEvent","isMousePointer","time","tapDelay","displacement","pointerType","pointerEvent","pointerIndex","ongoingPointer","touchEvent","diff","axisToCheck","MAIN_SCROLL_END_FRICTION","MainScroll","resizeSlides","newSlideWidth","slideWidthChanged","itemHolder","i","animate","velocityX","newIndex","numSlides","distance","destinationX","currDiff","currDistance","_this$itemHolders$","positionDifference","diffAbs","tempHolder","_itemHolder$slide","dragging","newSlideIndexOffset","KeyboardKeyCodesMap","getKeyboardEventKey","key","isKeySupported","Keyboard","lastActiveElement","keydownAction","isForward","template","DEFAULT_EASING","CSSAnimation","props","_props$prop","onComplete","transform","onFinish","easing","DEFAULT_NATURAL_FREQUENCY","DEFAULT_DAMPING_RATIO","SpringEaser","naturalFrequency","deltaPosition","deltaTime","coeff","naturalDumpingPow","dumpedFCos","dumpedFSin","SpringAnimation","start","end","onUpdate","easer","prevTime","animationLoop","Animations","isSpring","animation","ScrollWheel","deltaX","deltaY","addElementHTML","htmlData","svgData","out","UIElement","_container","name","elementHTML","element","title","ariaLabel","ariaText","appendTo","container","initArrowButton","isNextButton","arrowPrev","arrowNext","closeButton","zoomButton","loadingIndicator","indicatorElement","isVisible","delayTimeout","toggleIndicatorClass","add","setIndicatorVisibility","visible","updatePreloaderVisibility","_pswp$currSlide","_pswp$currSlide2","counterIndicator","counterElement","setZoomedIn","isZoomedIn","UI","a","b","uiElementData","_pswp$element","elementData","currZoomLevelDiff","potentialZoomLevel","getBoundsByElement","thumbAreaRect","getCroppedBoundsByElement","imageWidth","imageHeight","fillZoomLevel","offsetX","offsetY","getThumbBounds","instance","thumbBounds","thumbnail","thumbSelector","PhotoSwipeEvent","details","Eventable","fn","priority","_this$_filters$name","_this$_filters$name2","_this$pswp","f1","f2","filter","args","_this$_filters$name3","_this$_listeners$name","_this$pswp2","_this$pswp3","_this$_listeners$name2","Placeholder","imageSrc","imgEl","_this$element","Content","isLazy","reload","placeholderEl","placeholderSrc","_this$data$src","_this$data$alt","imageElement","isInitialSizeUpdate","image","sizesWidth","_this$instance$option","_this$instance$option2","errorMsgEl","supportsDecode","MIN_SLIDES_TO_CACHE","lazyLoadData","content","zoomLevel","lazyLoadSlide","ContentLoader","preload","initialIndex","indexToRemove","item","PhotoSwipeBase","_this$options","numItems","dataSource","slideData","_this$options2","dataSourceItem","galleryElement","_this$options3","_this$options4","linkEl","thumbnailEl","_thumbnailEl$getAttri","MIN_OPACITY","Opener","_options$showHideOpac","decoded","isDelaying","_this$pswp$element","_this$pswp$element2","innerRect","containerOnePanX","containerOnePanY","containerTwoPanX","containerTwoPanY","animations","animProps","defaultOptions","PhotoSwipe","rootClasses","itemHolders","_this$currSlide","_this$currSlide2","_itemHolder$slide2","slideIndex","_this$currSlide$index","_this$currSlide3","potentialHolderIndex","_itemHolder$slide3","holder","opacity","_this$element2"],"mappings":"AAAA;AAAA;AAAA;AAAA,IAaA,SAASA,EAAcC,EAAWC,EAASC,EAAY,CACrD,MAAMC,EAAK,SAAS,cAAcF,CAAO,EAEzC,OAAID,IACFG,EAAG,UAAYH,GAGbE,GACFA,EAAW,YAAYC,CAAE,EAGpBA,CACT,CAOA,SAASC,EAAeC,EAAIC,EAAI,CAC9B,OAAAD,EAAG,EAAIC,EAAG,EACVD,EAAG,EAAIC,EAAG,EAENA,EAAG,KAAO,SACZD,EAAG,GAAKC,EAAG,IAGND,CACT,CAKA,SAASE,EAAWC,EAAG,CACrBA,EAAE,EAAI,KAAK,MAAMA,EAAE,CAAC,EACpBA,EAAE,EAAI,KAAK,MAAMA,EAAE,CAAC,CACtB,CASA,SAASC,EAAmBJ,EAAIC,EAAI,CAClC,MAAMI,EAAI,KAAK,IAAIL,EAAG,EAAIC,EAAG,CAAC,EACxBK,EAAI,KAAK,IAAIN,EAAG,EAAIC,EAAG,CAAC,EAC9B,OAAO,KAAK,KAAKI,EAAIA,EAAIC,EAAIA,CAAC,CAChC,CASA,SAASC,EAAYP,EAAIC,EAAI,CAC3B,OAAOD,EAAG,IAAMC,EAAG,GAAKD,EAAG,IAAMC,EAAG,CACtC,CAUA,SAASO,EAAMC,EAAKC,E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