{"version":3,"sources":["jsdelivr-header.js","/npm/carousel-kit@1.1.1/src/track-carousel-state.mjs","/npm/carousel-kit@1.1.1/src/define-carousel-track.mjs","/npm/carousel-kit@1.1.1/src/carousel-track.mjs"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNO,MAAM,UAA2B,YACtC,6BAAW,GACT,MAAO,CACL,YACA,gBAEN,CAEE,MAAQ,GACR,UAAY,GACZ,uBAAwB,EAExB,WAAA,EAAa,UACX,EAAU,iBAAgB,cAC1B,EAAc,mBAAkB,sBAChC,GAAsB,GACtB,IACA,QACA,KAAK,UAAY,EACjB,KAAK,cAAgB,EACrB,KAAK,sBAAwB,CACjC,CACE,oBAAA,GACE,KAAK,YAAY,KAAK,SAAS,MACnC,CACE,EAAA,GACE,KAAK,YAAY,KAAK,SAAS,OAC/B,KAAK,SAAS,iBAAiB,KAAK,SAAS,OAAO,OAAQ,IAC1D,KAAK,YAAY,EAAM,OAAM,GAEnC,CACE,EAAA,EAAgB,KAAE,IAChB,GAAM,WACN,EAAK,aAAa,SAAU,IAC5B,EAAK,gBAAgB,mBACrB,EAAK,gBAAgB,eACrB,EAAK,MAAM,YAAY,2BAA4B,GACnD,EAAK,MAAM,YAAY,uBAAwB,EACnD,CACE,EAAA,EAAkB,KAAE,EAAI,OAAE,EAAM,KAAE,IAChC,GAAM,OAAO,YACb,EAAK,gBAAgB,UACrB,EAAK,aAAa,kBAAmB,GACrC,EAAK,gBAAgB,eACrB,EAAK,MAAM,YAAY,2BAA4B,GACnD,EAAK,MAAM,YAAY,uBAAwB,EACnD,CACE,EAAA,EAAc,KAAE,EAAI,OAAE,EAAM,KAAE,IAC5B,GAAM,OAAO,QACb,EAAK,gBAAgB,UACrB,EAAK,gBAAgB,mBACrB,EAAK,aAAa,cAAe,GACjC,EAAK,MAAM,YAAY,2BAA4B,GACnD,EAAK,MAAM,YAAY,uBAAwB,EACnD,CACE,WAAA,EAAa,YAAE,EAAW,cAAE,IAC1B,IA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Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/carousel-kit@1.1.1/src/define-carousel-track.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export class TrackCarouselState extends HTMLElement {\n  static get observedAttributes() {\n    return [\n      \"itemQuery\",\n      \"carouselQuery\",\n    ];\n  }\n\n  items = []\n  itemQuery = ''\n  accountForClonedNodes = false\n\n  constructor ({\n    itemQuery='carousel-slide',\n    carouselQuery='slotted-carousel',\n    accountForClonedNodes=false,\n  }={}) {\n    super()\n    this.itemQuery = itemQuery\n    this.carouselQuery = carouselQuery\n    this.accountForClonedNodes = accountForClonedNodes\n  }\n  reflectCarouselState () {\n    this.updateItems(this.carousel.state)\n  }\n  #init () {\n    this.updateItems(this.carousel.state)\n    this.carousel.addEventListener(this.carousel.events.slide, (event) => {\n      this.updateItems(event.detail)\n    })\n  }\n  #setActiveAttr ({ item }) {\n    item?.active?.()\n    item.setAttribute('active', '')\n    item.removeAttribute('previous-active')\n    item.removeAttribute('next-active')\n    item.style.setProperty('--previous-active-offset', 0)\n    item.style.setProperty('--next-active-offset', 0)\n  }\n  #setPreviousAttr ({ item, offset, next }) {\n    item?.exit?.('previous')\n    item.removeAttribute('active')\n    item.setAttribute('previous-active', offset)\n    item.removeAttribute('next-active')\n    item.style.setProperty('--previous-active-offset', offset)\n    item.style.setProperty('--next-active-offset', next)\n  }\n  #setNextAttr ({ item, offset, prev }) {\n    item?.exit?.('next')\n    item.removeAttribute('active')\n    item.removeAttribute('previous-active')\n    item.setAttribute('next-active', offset)\n    item.style.setProperty('--previous-active-offset', prev)\n    item.style.setProperty('--next-active-offset', offset)\n  }\n  updateItems ({ activeIndex, maxSlideIndex }) {\n    let internalActiveIndex = activeIndex\n    // we might use `minimum-slide-count` on the `CarouselTrack`\n    // to duplicate nodes, which will lead to a mismatch in\n    // this.items.length between the `CarouselTrack` & `CarouselProgress`\n    // which will also come down as an `activeSlide` value from the\n    // `SlottedCarousel` that is within the bounds of `CarouselTrack` items\n    // but outside of the bounds of `CarouselProgress` items bounds.\n    // Technically it should not be a problem to do this any items.length\n    // value, but we should only enconter it with the `CarouselProgress`,\n    // so we make that explicit.\n    if (this.accountForClonedNodes) {\n      internalActiveIndex = activeIndex % this.items.length\n    }\n    this.items.forEach((item, index, arr) => {\n      let order = index\n      if (item.hasAttribute('order')) {\n        order = parseInt(item.getAttribute('order'))\n      }\n      if (order === internalActiveIndex) {\n        this.#setActiveAttr({ item })\n      }\n      else {\n        const count = arr.length\n        const prevWrapping = count - order + internalActiveIndex\n        const prev = internalActiveIndex - order\n        const next = order - internalActiveIndex\n        const nextWrapping = count - internalActiveIndex + order\n\n        if (next > 0 && next <= prevWrapping) {\n          this.#setNextAttr({ item, offset: next, prev: prevWrapping })  \n        }\n        else if (next > 0 && prevWrapping <= next) {\n          this.#setPreviousAttr({ item, offset: prevWrapping, next })  \n        }\n        else if (prev > 0 && prev <= nextWrapping) {\n          this.#setPreviousAttr({ item, offset: prev, next: nextWrapping })  \n        }\n        else if (prev > 0 && nextWrapping <= prev) {\n          this.#setNextAttr({ item, offset: nextWrapping, prev })  \n        }\n        else {\n          console.log({ order, internalActiveIndex, count, prev, prevWrapping, next, nextWrapping })\n          throw new Error('Carousel should not reach this state')\n        }\n      }\n    })\n  }\n  connectedCallback () {\n    if (this.hasAttribute('carousel-query')) {\n      this.carouselQuery = this.getAttribute('carousel-query')\n    }\n    if (this.hasAttribute('item-query')) {\n      this.itemQuery = this.getAttribute('item-query')\n    }\n    this.carousel = this.closest(this.carouselQuery)\n    this.items = this.querySelectorAll(this.itemQuery)\n    if (this.carousel?.isReady) {\n      this.#init()\n    }\n    else {\n      this.carousel.addEventListener('ready', () => {\n        this.#init()\n      })\n    }\n  }\n  attributeChangedCallback (name, oldValue, newValue) {\n    if (name === 'carousel-query') {\n      this.carouselQuery = newValue\n      this.carousel = this.closest(this.carouselQuery)\n    }\n    if (name === 'item-query') {\n     this.itemQuery === newValue   \n     this.items = this.querySelectorAll(this.itemQuery)\n    }\n\n    if (name === 'carousel-query' || name === 'item-query') {\n      this.reflectCarouselState()\n    }\n  }\n}\n","import { CarouselTrack } from './carousel-track.mjs'\n\ncustomElements.define(\"carousel-track\", CarouselTrack)\n","import { TrackCarouselState } from './track-carousel-state.mjs'\n\nexport class CarouselTrack extends TrackCarouselState {\n  minimumSlideCount = null\n  constructor ({\n    itemQuery='carousel-slide',\n    carouselQuery='slotted-carousel',\n    minimumSlideCount\n  } = {}) {\n    super({ itemQuery, carouselQuery })\n    if (Number.isInteger(minimumSlideCount)) {\n      this.minimumSlideCount = minimumSlideCount\n    }\n  }\n  #dupeSlidesForMinimumCount () {\n    if (isNaN(this.minimumSlideCount)) return\n    this.items = this.querySelectorAll(this.itemQuery)\n    if (this.items.length >= this.minimumSlideCount) return\n    const originalSlides = Array.from(this.querySelectorAll(`${this.itemQuery}:not([clone-of-order])`))\n    originalSlides.sort((a, b) => {\n      return parseInt(a.getAttribute('order')) - parseInt(b.getAttribute('order'))\n    })\n    for (let i = 0; i < originalSlides.length; i++) {\n      const originalSlide = originalSlides[i]\n      const clonedSlide = originalSlide.cloneNode(true)\n      const order = this.items.length + i\n      clonedSlide.setAttribute('order', order)\n      clonedSlide.setAttribute('clone-of-order', originalSlide.getAttribute('order'))\n      if (clonedSlide.hasAttribute('id')) {\n        const id = clonedSlide.getAttribute('id')\n        clonedSlide.setAttribute('id', `${id}-cloned-order-${order}`)\n      }\n      this.appendChild(clonedSlide)\n    }\n    this.items = this.querySelectorAll(this.itemQuery)\n    if (this.items.length >= this.minimumSlideCount) {\n      return this.updateItems(this.carousel.state)\n    }\n    else {\n      return this.#dupeSlidesForMinimumCount()\n    }\n  }\n  connectedCallback () {\n    super.connectedCallback()\n    if (this.hasAttribute('minimum-slide-count')) {\n      this.minimumSlideCount = parseInt(this.getAttribute('minimum-slide-count'))\n    }\n    // we could have configured this.minimumSlideCount or within the\n    // constructor, so we run our check for duping slides either way\n    this.#dupeSlidesForMinimumCount()\n    \n  }\n  attributeChangedCallback (name, oldValue, newValue) {\n    if (name === 'minimum-slide-count' && oldValue !== newValue) {\n      this.minimumSlideCount = parseInt(this.getAttribute('minimum-slide-count'))\n      this.#dupeSlidesForMinimumCount()\n    }\n  }\n}\n"]}