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AAOrN,iBAAiB,QAASxB,KAAKwJ,gBACtCqF,EAAOrN,iBAAiB,UAAWxB,KAAKwJ,gBACjCqF,CACT,CAEQ,mBAAAkC,CAAoBxC,GAC1B,MAAMM,EAASpH,SAASC,cAAc,6BAUtC,OATAmH,EAAO5L,QAAQiE,OAASqH,EAAKM,OAAOI,KAAKC,aACzCL,EAAO5L,QAAQmE,QAAUmH,EAAKM,OAAOzH,QACrCyH,EAAO5L,QAAQ8D,QAAUwH,EAAKJ,SAC9BU,EAAO5L,QAAQ+D,IAAMuH,EAAKyC,yBAC1BnC,EAAOoC,KAAO,SACdpC,EAAOqC,SAAW,EAClBrC,EAAOrN,iBAAiB,QAASxB,KAAKwJ,gBACtCqF,EAAOrN,iBAAiB,QAASxB,KAAKwJ,gBACtCqF,EAAOrN,iBAAiB,UAAWxB,KAAKwJ,gBACjCqF,CACT,EAiEGnI,eAAeC,IAAI,uBACtBD,eAAeE,OAAO,qBAAsBmC","sources":["webpack://lange/./sections/yotpo-real-results/light-box/index.ts","webpack://lange/./sections/yotpo-real-results/yotpo-real-results-review/index.ts","webpack://lange/./sections/yotpo-real-results/yotpo-real-results/decode-html-entities.ts","webpack://lange/./sections/yotpo-real-results/yotpo-real-results-review-instagram/index.ts","webpack://lange/../node_modules/@integrabeauty/assert/src/index.ts","webpack://lange/./lib/decorate-error.ts","webpack://lange/./sections/yotpo-real-results/yotpo-real-results/index.ts","webpack://lange/./lib/dom-ready.ts","webpack://lange/./sections/yotpo-real-results/yotpo-real-results/yotpo-fetch-photos-by-album.ts"],"sourcesContent":["import type { CustomElement } from '@integrabeauty/custom-elements';\nimport html from './index.html';\nimport styles from './index.scss';\n\n/**\n * Render Yotpo review in a lightbox like modal with split view, photo gallery on left and review\n * content on the right\n *\n * The light box shows and hides itself off `data-modal-state`. It asks the modal manager to open or\n * close it, and the manager sets that attribute.\n */\nclass LightBox extends HTMLElement implements CustomElement {\n  public static get observedAttributes() {\n    return [\n      'data-idx',\n      'data-loading',\n      'data-media',\n      'data-modal-state',\n      'data-mode',\n      'data-show'\n    ];\n  }\n\n  declare readonly dataset: {\n    /**\n     * Click tracking label naming this light box. Empty on light boxes that have none.\n     */\n    clickTrack: string;\n\n    /**\n     * Defines index of image to be displayed from the customer review image urls list.\n     */\n    idx: string;\n\n    /**\n     * Whether the light box shows loading dots over the photo, as \"true\". Set while whoever manages\n     * the light box is fetching the next photo.\n     */\n    loading: string;\n\n    /**\n     * Comma separated list of customer review image urls.\n     */\n    media: string;\n\n    /**\n     * Whether the light box is shown, as \"open\". Anything else, or no value at all, means closed.\n     *\n     * A change only takes effect while the element is on the page. A change made while it is\n     * detached is ignored, and connecting it later does not pick it up.\n     */\n    modalState: string;\n\n    /**\n     * In the `standalone` mode the light box allows displaying a single review. If (and only if)\n     * the review has more than one picture the user can switch the currently displayed one by\n     * clicking the buttons 'next' / 'prev' or swiping. Clicking 'next' on the last picture will\n     * display the first one again.\n     *\n     * In the `managed` mode the light box emits a `LightboxNavigationEvent` every time the user\n     * wants to go back on the first picture or next on the last one. Managed mode will also display\n     * the arrows and handle navigation even if there's only a single picture for a given review.\n     * This allows switching the review in the parent element by handling `LightboxNavigationEvent`s\n     */\n    mode: 'managed' | 'standalone';\n\n    /**\n     * Acts as a change-token that opens the modal: setting this to any value different from the\n     * current one opens the modal. The specific value carries no meaning, only that it changed.\n     * Removing the attribute or setting it to an empty string does not open the modal - only a\n     * truthy value does - so clearing it cannot trigger a spurious open.\n     */\n    show: string;\n  };\n\n  private onCloseClickBound = this.onCloseClick.bind(this);\n  private onModalDismissRequestedBound = this.onModalDismissRequested.bind(this);\n  private onKeyUpBound = this.onKeyUp.bind(this);\n  private onPrevClickBound = this.onPrevClick.bind(this);\n  private onNextClickBound = this.onNextClick.bind(this);\n  private onPrevKeyUpBound = this.onPrevKeyUp.bind(this);\n  private onNextKeyUpBound = this.onNextKeyUp.bind(this);\n  private onImagePointerDownBound = this.onImagePointerDown.bind(this);\n  private onImagePointerUpBound = this.onImagePointerUp.bind(this);\n  private onImagePointerCancelBound = this.onImagePointerCancel.bind(this);\n\n  /**\n   * Where a finger first touched the photo, while a swipe on it may be under way. Absent the rest\n   * of the time.\n   */\n  private swipeStart: {\n    pointerId: number;\n    x: number;\n    y: number;\n  };\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n\n    this.addEventListener('keyup', this.onKeyUpBound);\n\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton.addEventListener('click', this.onCloseClickBound);\n\n    const prev = this.shadowRoot.querySelector<HTMLElement>('.prev');\n    prev.addEventListener('click', this.onPrevClickBound);\n    prev.addEventListener('keydown', onNavKeyDown);\n    prev.addEventListener('keyup', this.onPrevKeyUpBound);\n\n    const next = this.shadowRoot.querySelector<HTMLElement>('.next');\n    next.addEventListener('click', this.onNextClickBound);\n    next.addEventListener('keydown', onNavKeyDown);\n    next.addEventListener('keyup', this.onNextKeyUpBound);\n\n    const image = this.shadowRoot.querySelector<HTMLElement>('.image');\n    image.addEventListener('pointerdown', this.onImagePointerDownBound);\n    image.addEventListener('pointerup', this.onImagePointerUpBound);\n    image.addEventListener('pointercancel', this.onImagePointerCancelBound);\n\n    this.render();\n  }\n\n  public disconnectedCallback() {\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton?.removeEventListener('click', this.onCloseClickBound);\n\n    const prev = this.shadowRoot.querySelector<HTMLElement>('.prev');\n    prev?.removeEventListener('click', this.onPrevClickBound);\n    prev?.removeEventListener('keydown', onNavKeyDown);\n    prev?.removeEventListener('keyup', this.onPrevKeyUpBound);\n\n    const next = this.shadowRoot.querySelector<HTMLElement>('.next');\n    next?.removeEventListener('click', this.onNextClickBound);\n    next?.removeEventListener('keydown', onNavKeyDown);\n    next?.removeEventListener('keyup', this.onNextKeyUpBound);\n\n    const image = this.shadowRoot.querySelector<HTMLElement>('.image');\n    image?.removeEventListener('pointerdown', this.onImagePointerDownBound);\n    image?.removeEventListener('pointerup', this.onImagePointerUpBound);\n    image?.removeEventListener('pointercancel', this.onImagePointerCancelBound);\n    this.swipeStart = undefined;\n\n    this.removeEventListener('keyup', this.onKeyUpBound);\n\n    // show puts this one on the window and hide takes it back off, so it is still there if we get\n    // torn down while the modal is open. Nothing would remove it then, and the window would hold\n    // onto us and keep sending us dismiss requests from a page we left.\n    removeEventListener('modal-dismiss-requested', this.onModalDismissRequestedBound);\n  }\n\n  public attributeChangedCallback(name: string, oldValue: string, newValue: string) {\n    this.initializeShadowRoot();\n\n    if (this.isConnected && name === 'data-modal-state' && newValue !== oldValue) {\n      if (newValue === 'open') {\n        this.show();\n      } else if (oldValue === 'open') {\n        this.hide();\n      }\n    } else if (this.isConnected && newValue !== oldValue) {\n      this.render();\n\n      // Only a truthy value opens the modal. The change check above is also satisfied when the\n      // attribute is removed (its new value is null) or set to empty, and during upgrade if the\n      // markup ships it empty; this guard keeps those cases from spuriously opening the modal.\n      if (name === 'data-show' && newValue) {\n        this.requestOpen();\n      }\n    }\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  private getUrls() {\n    const urls = this.dataset.media\n      ?.replace(/\\s/g, '')\n      .split(',')\n      .map(path => path.replace('square.jpg', 'original.jpg'));\n    return urls || [];\n  }\n\n  private onPrevClick(_event: MouseEvent) {\n    this.goToPrevious();\n  }\n\n  private onPrevKeyUp(event: KeyboardEvent) {\n    if (['Enter', 'Space'].includes(event.code)) {\n      this.goToPrevious();\n    }\n  }\n\n  private goToPrevious() {\n    const urls = this.getUrls();\n    const index = parseInt(this.dataset.idx, 10);\n\n    if (this.dataset.mode === 'managed' && index - 1 < 0) {\n      const navEvent = new CustomEvent<LightboxNavigatedEvent['detail']>('light-box-navigated', {\n        bubbles: true,\n        composed: true,\n        detail: { action: 'prev' }\n      });\n      this.dispatchEvent(navEvent);\n      return;\n    }\n\n    if (urls.length === 0) {\n      return;\n    }\n\n    if (index <= 0) {\n      this.dataset.idx = (urls.length - 1).toString();\n    } else if (index > 0) {\n      this.dataset.idx = (index - 1).toString();\n    }\n    // render is automatically called when `idx` changes\n  }\n\n  private onNextClick(_event: MouseEvent) {\n    this.goToNext();\n  }\n\n  private onNextKeyUp(event: KeyboardEvent) {\n    if (['Enter', 'Space'].includes(event.code)) {\n      this.goToNext();\n    }\n  }\n\n  private goToNext() {\n    const urls = this.getUrls();\n    const index = parseInt(this.dataset.idx, 10);\n\n    if (this.dataset.mode === 'managed' && index + 1 >= urls.length) {\n      const navEvent = new CustomEvent<LightboxNavigatedEvent['detail']>('light-box-navigated', {\n        bubbles: true,\n        composed: true,\n        detail: { action: 'next' }\n      });\n      this.dispatchEvent(navEvent);\n      return;\n    }\n\n    if (urls.length === 0) {\n      return;\n    }\n\n    if (index + 1 >= urls.length) {\n      this.dataset.idx = '0';\n    } else {\n      this.dataset.idx = (index + 1).toString();\n    }\n    // render is automatically called when `idx` changes\n  }\n\n  /**\n   * Starts tracking a possible swipe on the photo. Only touch counts, so a mouse on desktop acts\n   * the same as before. A touch that starts on one of the arrows is left to the arrow, since\n   * counting it as a swipe too could move two steps at once.\n   */\n  private onImagePointerDown(event: PointerEvent) {\n    if (event.pointerType !== 'touch' || !event.isPrimary) {\n      return;\n    }\n\n    if (event.target !== event.currentTarget) {\n      return;\n    }\n\n    this.swipeStart = {\n      pointerId: event.pointerId,\n      x: event.clientX,\n      y: event.clientY\n    };\n  }\n\n  /**\n   * Swiping left on the photo goes to the next one and swiping right goes to the previous one, the\n   * same as the arrows. A short move counts as a tap rather than a swipe, and a move that is more\n   * up and down than sideways is left alone so the user can scroll.\n   */\n  private onImagePointerUp(event: PointerEvent) {\n    const start = this.swipeStart;\n    if (start?.pointerId !== event.pointerId) {\n      return;\n    }\n\n    this.swipeStart = undefined;\n\n    const deltaX = event.clientX - start.x;\n    const deltaY = event.clientY - start.y;\n\n    if (Math.abs(deltaX) < 50 || Math.abs(deltaX) <= Math.abs(deltaY)) {\n      return;\n    }\n\n    if (deltaX < 0) {\n      this.goToNext();\n    } else {\n      this.goToPrevious();\n    }\n  }\n\n  /**\n   * The browser cancels the touch when it takes the move over as a scroll or a zoom, so whatever\n   * swipe we were tracking is over.\n   */\n  private onImagePointerCancel(_event: PointerEvent) {\n    this.swipeStart = undefined;\n  }\n\n  private onCloseClick(_event: MouseEvent) {\n    this.requestClose();\n  }\n\n  /**\n   * Closes the lightbox when the user performs a light-dismiss gesture (a click on the backdrop or\n   * an escape key press) while it is the open modal. The modal manager broadcasts this request to\n   * every open modal; this listener is only attached while the lightbox is open.\n   */\n  private onModalDismissRequested(_event: WindowEventMap['modal-dismiss-requested']) {\n    this.requestClose();\n  }\n\n  private onKeyUp(event: KeyboardEvent) {\n    if (event.code === 'ArrowLeft') {\n      this.goToPrevious();\n    } else if (event.code === 'ArrowRight') {\n      this.goToNext();\n    }\n  }\n\n  /**\n   * Asks the modal manager to open the light box. The manager sets our data-modal-state, which\n   * shows it.\n   */\n  private requestOpen() {\n    if (this.dataset.modalState === 'open') {\n      return;\n    }\n\n    const event = new Event('modal-open-requested', { bubbles: true, composed: true });\n    this.dispatchEvent(event);\n  }\n\n  private show() {\n    const dialog = this.shadowRoot.querySelector<HTMLElement>('[role=\"dialog\"]');\n    dialog.inert = false;\n    dialog.classList.add('visible');\n\n    const closeButton = this.shadowRoot.querySelector('close-button');\n    closeButton.focus({ focusVisible: true });\n\n    addEventListener('modal-dismiss-requested', this.onModalDismissRequestedBound);\n  }\n\n  private requestClose() {\n    if (this.dataset.modalState !== 'open') {\n      return;\n    }\n\n    const event = new Event('modal-close-requested', { bubbles: true, composed: true });\n    this.dispatchEvent(event);\n  }\n\n  private hide() {\n    const dialog = this.shadowRoot.querySelector<HTMLElement>('[role=\"dialog\"]');\n    dialog.classList.remove('visible');\n    dialog.inert = true;\n\n    removeEventListener('modal-dismiss-requested', this.onModalDismissRequestedBound);\n  }\n\n  private render() {\n    const prev = this.shadowRoot.querySelector<HTMLElement>('.prev');\n    const next = this.shadowRoot.querySelector<HTMLElement>('.next');\n\n    const loadingIndicator = this.shadowRoot.querySelector('loading-indicator');\n    loadingIndicator.hidden = this.dataset.loading !== 'true';\n\n    const urls = this.getUrls();\n\n    // On every render, media may have changed. Whenever there are less than two images, we want to\n    // ensure that the carousel arrows are hidden. Whenever there are two or more images, we want to\n    // ensure that the carousel arrows are visible.\n\n    if (this.dataset.mode === 'managed' || urls.length > 1) {\n      prev.hidden = false;\n      next.hidden = false;\n    } else {\n      prev.hidden = true;\n      next.hidden = true;\n    }\n\n    // Update the background image. On every render, the urls may have changed. If there is no url\n    // or the index is invalid, remove the background image. Otherwise, render the current image.\n\n    const imageContainer = this.shadowRoot.querySelector<HTMLImageElement>('.image');\n\n    if (urls.length === 0) {\n      imageContainer.style.backgroundImage = '';\n      return;\n    }\n\n    const index = parseInt(this.dataset.idx, 10);\n    if (!Number.isInteger(index)) {\n      imageContainer.style.backgroundImage = '';\n      return;\n    }\n\n    if (index < 0 || index >= urls.length) {\n      imageContainer.style.backgroundImage = '';\n      return;\n    }\n\n    imageContainer.style.backgroundImage = `url('${urls[index]}')`;\n  }\n}\n\n/**\n * Shared keydown handler for the previous and next controls. They are role=button divs rather than\n * native buttons, so the browser does not treat enter or space as activation. We suppress the\n * default here (space would otherwise scroll) and let the keyup handlers perform the navigation.\n */\nfunction onNavKeyDown(event: KeyboardEvent) {\n  if (['Enter', 'Space'].includes(event.code)) {\n    event.preventDefault();\n  }\n}\n\n/**\n * Fired when a user clicks next / prev buttons in a lightbox\n */\ntype LightboxNavigatedEvent = CustomEvent<{\n  action: 'next' | 'prev';\n}>;\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'light-box': LightBox;\n  }\n\n  interface GlobalEventHandlersEventMap {\n    'light-box-navigated': LightboxNavigatedEvent;\n  }\n}\n\nif (!customElements.get('light-box')) {\n  customElements.define('light-box', LightBox);\n}\n","import type { CustomElement } from '@integrabeauty/custom-elements';\nimport html from './index.html';\nimport styles from './index.scss';\n\n/**\n * Renders Yotpo real results page single yotpo review\n */\nclass YotpoRealResultsReview extends HTMLElement implements CustomElement {\n  declare readonly dataset: {\n    /**\n     * Yotpo review author\n     */\n    author: string;\n\n    /**\n     * Yotpo review content\n     */\n    content: string;\n\n    /**\n     * Yotpo review customer image id\n     */\n    imageId: string;\n\n    /**\n     * Yotpo review customer image url\n     */\n    src: string;\n  };\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n\n    this.render();\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  private render() {\n    const imageElement = this.shadowRoot.querySelector<HTMLImageElement>('.image');\n    imageElement.dataset.imageId = this.dataset.imageId;\n    imageElement.src = this.dataset.src;\n    imageElement.alt = this.dataset.author;\n\n    const authorElement = this.shadowRoot.querySelector('.author');\n    authorElement.textContent = this.dataset.author;\n\n    const contentElement = this.shadowRoot.querySelector('.content');\n    contentElement.innerHTML = this.dataset.content;\n  }\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'yotpo-real-results-review': YotpoRealResultsReview;\n  }\n}\n\nif (!customElements.get('yotpo-real-results-review')) {\n  customElements.define('yotpo-real-results-review', YotpoRealResultsReview);\n}\n","/**\n * Initialized on first call to encodeEntities, then re-used\n */\nlet element: HTMLTextAreaElement;\n\n/**\n * Encodes HTML entities in a mostly safe manner but at the expense of touching the dom.\n */\nexport function decode(input: string) {\n  if (!element) {\n    element = document.createElement('textarea');\n  }\n\n  element.innerHTML = input;\n\n  const output = element.value;\n\n  // avoid leaving around stuff in dom indefinitely, even when detached\n  element.innerHTML = '';\n\n  return output;\n}\n","import type { CustomElement } from '@integrabeauty/custom-elements';\nimport html from './index.html';\nimport styles from './index.scss';\n\n/**\n * Renders Yotpo real results page single instagram review\n */\nclass YotpoRealResultsReviewInstagram extends HTMLElement implements CustomElement {\n  declare readonly dataset: {\n    /**\n     * Yotpo review author\n     */\n    author: string;\n\n    /**\n     * Yotpo review content\n     */\n    content: string;\n\n    /**\n     * Yotpo review customer image id\n     */\n    imageId: string;\n\n    /**\n     * Yotpo review customer image url\n     */\n    src: string;\n  };\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n\n    this.render();\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  private render() {\n    const authorElement = this.shadowRoot.querySelector('.author');\n    authorElement.textContent = this.dataset.author;\n\n    const contentElement = this.shadowRoot.querySelector('.content');\n    contentElement.innerHTML = this.dataset.content;\n\n    const imageElement = this.shadowRoot.querySelector<HTMLImageElement>('.image');\n    imageElement.dataset.imageId = this.dataset.imageId;\n    imageElement.src = this.dataset.src;\n    imageElement.alt = this.dataset.author;\n  }\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'yotpo-real-results-review-instagram': YotpoRealResultsReviewInstagram;\n  }\n}\n\nif (!customElements.get('yotpo-real-results-review-instagram')) {\n  customElements.define('yotpo-real-results-review-instagram', YotpoRealResultsReviewInstagram);\n}\n","/**\n * Throws an assertion error if the given condition is falsy.\n *\n * @param expression any expression, although one that evaluates to true or false is preferred by\n * convention\n * @param message optional error text\n */\nexport function assert(expression: unknown, message?: string) {\n  if (!expression) {\n    throw new AssertionError(message);\n  }\n}\n\nexport class AssertionError extends Error {\n  constructor(message = 'Assertion error') {\n    super(message);\n    this.name = this.constructor.name;\n  }\n}\n","/**\n * Copies a single piece of supplementary context onto an error before it is thrown or reported.\n *\n * Use this when decorating a value the calling code did not construct, such as a caught value or an\n * error handed in by another module. An error the caller just built with new is always writable, so\n * plain assignment is fine there. A value from elsewhere may be a foreign object this code does not\n * own. Such a value can carry a non-writable property, such as a DOMException whose code is a read-\n * only accessor, or be frozen outright, and assigning to it then throws. Attaching context must\n * never itself fail, so a rejected assignment is swallowed and the remaining context is still\n * attempted. Guarding each property in isolation means a single read-only slot, the common case,\n * costs only that one property rather than all of them.\n *\n * In practice the value that triggers this is almost always a DOMException that reached the caller\n * from a fetch the browser cut short, such as an abort when an in-flight request is interrupted.\n * The platform defines a DOMException's code, name, and message as read-only attributes, so\n * assigning a code onto one throws under the strict mode that all bundled module code runs in. It\n * surfaces from Safari far more than elsewhere for two reasons. The reported wording, attempted to\n * assign to readonly property, is JavaScriptCore's phrasing for this failure, so the same bug in\n * another engine is worded differently and groups as a separate report, which makes this one look\n * Safari specific even though the read-only rule is not. And iOS Safari abandons in-flight fetches\n * aggressively when a tab is backgrounded or a connection drops, which is when such a DOMException\n * tends to be produced and handed to code that assumed an ordinary writable error.\n *\n * A swallowed failure is logged at a level low enough that it is recorded as a breadcrumb for\n * monitoring rather than escalated into its own captured event. That keeps the lost context visible\n * alongside the eventual report without adding fresh noise of its own. The breadcrumb names the\n * property that could not be attached, the kind of value that rejected it, and why, which is enough\n * to recognize a read-only or frozen caught value after the fact.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Read-only\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n * @see https://webidl.spec.whatwg.org/#dfn-read-only\n */\nexport function decorateError(error: any, key: string, value: unknown) {\n  try {\n    error[key] = value;\n  } catch (assignmentError) {\n    let reason: string;\n    if (assignmentError instanceof Error) {\n      reason = assignmentError.message;\n    } else {\n      reason = `${assignmentError}`;\n    }\n\n    console.log('Failed to assign error property', {\n      key,\n      name: error?.name,\n      tag: Object.prototype.toString.call(error),\n      reason\n    });\n  }\n}\n","import type { CustomElement } from '@integrabeauty/custom-elements';\nimport type { GalleryAPIImage, GalleryAPIResponseBody } from '@integrabeauty/yotpo-browser-types';\nimport { ready, type ReleaseHandle } from '../../../lib/dom-ready.js';\nimport { decode } from './decode-html-entities.js';\nimport html from './index.html';\nimport styles from './index.scss';\nimport { fetchPhotosByAlbum } from './yotpo-fetch-photos-by-album.js';\n\n/**\n * Renders Yotpo real results. This is an element intended for one use in a page. It renders into a\n * shadow root that it attaches on connect.\n */\nclass YotpoRealResults extends HTMLElement implements CustomElement {\n  declare readonly dataset: {\n    /**\n     * The Yotpo API app key used to send requests to Yotpo\n     */\n    yotpoAppKey: string;\n  };\n\n  private currentPage = 0;\n  private instagramCount = 0;\n  private images: GalleryAPIImage[] = [];\n  private perPage = 48;\n  private reviewCount = 0;\n  private currentImageIdx = -1;\n\n  /**\n   * Whether a load started from the lightbox, by going past the last loaded photo, is under way.\n   */\n  private isLoadingMoreForLightbox = false;\n\n  /**\n   * Whether a load came back with nothing new, meaning every photo in the album is loaded.\n   */\n  private hasLoadedAllImages = false;\n\n  private declare releaseReady: ReleaseHandle;\n\n  private openPopupBound = this.openPopup.bind(this);\n  private onLoadBound = this.onLoad.bind(this);\n  private onLoadMoreButtonClickedBound = this.onLoadMoreButtonClicked.bind(this);\n  private onLightboxNavigatedBound = this.onLightboxNavigated.bind(this);\n  private onModalOpenedBound = this.onModalOpened.bind(this);\n  private onModalClosedBound = this.onModalClosed.bind(this);\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n\n    this.releaseReady = ready(this.onLoadBound);\n\n    this.addEventListener('light-box-navigated', this.onLightboxNavigatedBound);\n\n    // The modal manager sends both of these from the lightbox, composed and bubbling, so they reach\n    // us on the way out of the shadow root.\n    this.addEventListener('modal-opened', this.onModalOpenedBound);\n    this.addEventListener('modal-closed', this.onModalClosedBound);\n  }\n\n  public disconnectedCallback() {\n    if (this.releaseReady) {\n      this.releaseReady();\n    }\n\n    const loadMoreButton = this.shadowRoot.querySelector<HTMLElement>('.load-more');\n    loadMoreButton?.removeEventListener('click', this.onLoadMoreButtonClickedBound);\n\n    const wrapperElement = this.shadowRoot.querySelector('.ugc-gallery-container');\n    for (const reviewElement of wrapperElement?.children || []) {\n      reviewElement.removeEventListener('click', this.openPopupBound);\n    }\n\n    this.removeEventListener('light-box-navigated', this.onLightboxNavigatedBound);\n    this.removeEventListener('modal-opened', this.onModalOpenedBound);\n    this.removeEventListener('modal-closed', this.onModalClosedBound);\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  private onLoad(_event: Event) {\n    if (this.releaseReady) {\n      this.releaseReady();\n    }\n\n    const loadMoreButton = this.shadowRoot.querySelector<HTMLElement>('.load-more');\n    loadMoreButton?.addEventListener('click', this.onLoadMoreButtonClickedBound);\n\n    // We start out showing a message and a spinner, because the wait here is long enough that an\n    // empty space under the heading looks broken. The message goes away once the first page of\n    // results is in, and also if the request fails, where the empty space is all we have anyway.\n    this.getItems().then(() => {\n      this.hideLoadingMessage();\n    }).catch(error => {\n      this.hideLoadingMessage();\n      console.warn(error);\n    });\n  }\n\n  private hideLoadingMessage() {\n    this.shadowRoot.querySelector('.loading-message')?.remove();\n  }\n\n  /**\n   * Seals off the thumbnails and the load more button, so that tabbing cannot walk out of the open\n   * lightbox into them. The modal manager inerts every other .shopify-section while a modal is open\n   * and has to skip the one holding the modal, since inerting that section would inert the modal\n   * too, so containment inside this section is ours to do. The lightbox cannot do it either: it\n   * sits in this shadow root, so anything it could inert to cover its siblings would be an ancestor\n   * of the modal.\n   */\n  private onModalOpened(_event: WindowEventMap['modal-opened']) {\n    const galleryContainer = this.shadowRoot.querySelector('.ugc-gallery-container');\n    if (galleryContainer instanceof HTMLElement) {\n      galleryContainer.inert = true;\n    }\n\n    const loadMoreButton = this.shadowRoot.querySelector('.load-more');\n    if (loadMoreButton instanceof HTMLElement) {\n      loadMoreButton.inert = true;\n    }\n  }\n\n  /**\n   * Unseals the thumbnails. The modal manager restores focus to the thumbnail that opened the\n   * lightbox only after this runs, so the thumbnail is no longer inert by then.\n   */\n  private onModalClosed(_event: WindowEventMap['modal-closed']) {\n    const galleryContainer = this.shadowRoot.querySelector('.ugc-gallery-container');\n    if (galleryContainer instanceof HTMLElement) {\n      galleryContainer.inert = false;\n    }\n\n    const loadMoreButton = this.shadowRoot.querySelector('.load-more');\n    if (loadMoreButton instanceof HTMLElement) {\n      loadMoreButton.inert = false;\n    }\n  }\n\n  private onLightboxNavigated(event: WindowEventMap['light-box-navigated']) {\n    const action = event.detail.action;\n    if (!action) {\n      return;\n    }\n\n    // Going next from the last loaded photo loads the next page first, the same as the load more\n    // button, and then shows its first photo. We only loop back to the first photo once the album\n    // has nothing more to give.\n    const isOnLastImage = this.currentImageIdx + 1 >= this.images.length;\n    if (action === 'next' && isOnLastImage && !this.hasLoadedAllImages) {\n      this.loadMoreThenShowNext().catch(error => {\n        console.warn(error, 'failed to load more reviews from the lightbox');\n      });\n      return;\n    }\n\n    let idx = this.currentImageIdx;\n    if (action === 'prev') {\n      idx = idx - 1 >= 0 ? idx - 1 : this.images.length - 1;\n    } else if (action === 'next') {\n      idx = idx + 1 < this.images.length ? idx + 1 : 0;\n    }\n\n    this.currentImageIdx = idx;\n\n    this.renderPopup();\n  }\n\n  /**\n   * Loads the next page of photos and shows the first new one in the lightbox, or loops back to the\n   * first photo when there are no more. A swipe while the load is under way does nothing, so the\n   * same page is not asked for twice. The lightbox shows loading dots over the photo while it\n   * waits. When the load fails, the lightbox stays on the photo it was on, and the error shows\n   * under the gallery the same as for the load more button.\n   */\n  private async loadMoreThenShowNext() {\n    if (this.isLoadingMoreForLightbox) {\n      return;\n    }\n\n    this.isLoadingMoreForLightbox = true;\n\n    const lightbox = this.shadowRoot.querySelector('light-box');\n    lightbox.dataset.loading = 'true';\n\n    const errorContainer = this.shadowRoot.querySelector<HTMLElement>('.error');\n    errorContainer.hidden = true;\n\n    const countBefore = this.images.length;\n\n    try {\n      await this.getItems();\n    } catch (error) {\n      errorContainer.hidden = false;\n      throw error;\n    } finally {\n      this.isLoadingMoreForLightbox = false;\n      delete lightbox.dataset.loading;\n    }\n\n    if (this.hasLoadedAllImages) {\n      this.currentImageIdx = 0;\n    } else {\n      this.currentImageIdx = countBefore;\n    }\n\n    this.renderPopup();\n  }\n\n  private onLoadMoreButtonClicked(_event: MouseEvent) {\n    const errorContainer = this.shadowRoot.querySelector<HTMLElement>('.error');\n    errorContainer.hidden = true;\n    this.getItems()\n      .catch(error => {\n        errorContainer.hidden = false;\n        console.warn(error, 'failed to load more reviews on click');\n      });\n  }\n\n  private async getItems() {\n    const loaderElement = this.shadowRoot.querySelector('loading-indicator');\n    const loadButton = this.shadowRoot.querySelector<HTMLElement>('.load-more');\n\n    const wasLoadButtonHidden = loadButton.hidden;\n    loaderElement.hidden = false;\n    loadButton.hidden = true;\n\n    let responseBody: GalleryAPIResponseBody['response'];\n    try {\n      responseBody = await fetchPhotosByAlbum({\n        app_key: this.dataset.yotpoAppKey,\n        album_name: 'UGC Gallery',\n        instagram_count: this.instagramCount,\n        review_count: this.reviewCount,\n        per_page: this.perPage,\n        page: this.currentPage > 0 ? this.currentPage + 1 : NaN\n      });\n    } catch (error) {\n      // Stop the spinner and put the button back the way it was, so a failed load more can be tried\n      // again. The button starts out hidden, so it stays hidden when the first page fails.\n      loaderElement.hidden = true;\n      loadButton.hidden = wasLoadButtonHidden;\n      throw error;\n    }\n\n    this.images = this.images.concat(responseBody.images);\n\n    // Yotpo answers with an empty list once we ask for a page past the end of the album.\n    if (responseBody.images.length === 0) {\n      this.hasLoadedAllImages = true;\n    }\n\n    const instagramImages = this.images.filter(image => image.source === 'instagram');\n    const reviewImages = this.images.filter(image => image.source === 'review');\n    this.instagramCount = instagramImages.length;\n    this.reviewCount = reviewImages.length;\n\n    loaderElement.hidden = true;\n    loadButton.hidden = this.hasLoadedAllImages;\n\n    this.renderGallery();\n    this.currentPage++;\n  }\n\n  private openPopup(event: Event) {\n    if (event instanceof KeyboardEvent) {\n      if (['Enter', 'Space'].includes(event.code)) {\n        event.preventDefault();\n      } else {\n        return;\n      }\n\n      if (event.type === 'keydown') {\n        return;\n      }\n    }\n\n    const target = event.currentTarget;\n    if (!(target instanceof HTMLElement)) {\n      return;\n    }\n\n    const focusEvent = new Event('focus-stack-push-requested', {\n      bubbles: true,\n      composed: true\n    });\n    target.dispatchEvent(focusEvent);\n\n    this.currentImageIdx = this.images.findIndex(\n      image => image.image_id === target.dataset.imageId);\n\n    let lightbox = this.shadowRoot.querySelector('light-box');\n    if (!lightbox) {\n      lightbox = document.createElement('light-box');\n      lightbox.dataset.clickTrack = 'Real Results Review Modal';\n      lightbox.dataset.mode = 'managed';\n      this.shadowRoot.appendChild(lightbox);\n    }\n\n    lightbox.dataset.show = Math.random().toString();\n\n    this.renderPopup();\n  }\n\n  private renderPopup() {\n    const item = this.images[this.currentImageIdx];\n    if (!item) {\n      return;\n    }\n\n    const lightbox = this.shadowRoot.querySelector('light-box');\n    lightbox.dataset.media = item.medium_image_url;\n    lightbox.dataset.idx = '0';\n\n    const slotContent = document.createElement('div');\n    slotContent.slot = 'description';\n    slotContent.appendChild(createAvatarElement(item));\n    slotContent.appendChild(createLightboxContent(item));\n    if (item.source === 'review') {\n      slotContent.appendChild(createLightboxVoteButtons(item));\n    }\n\n    lightbox.innerHTML = '';\n    lightbox.appendChild(slotContent);\n\n    this.preloadAdjacentImages();\n  }\n\n  /**\n   * The lightbox does not ask for an image until the user clicks an arrow, so the fetch starts on\n   * the click and the user sits looking at an empty gray panel until it lands. The files are small\n   * but the trip to Yotpo's CDN is not, and it runs a few hundred milliseconds on a good connection\n   * and much longer on a phone. So we warm the two images the user can reach from here. Once an\n   * image is in the browser cache it paints in a couple of milliseconds.\n   */\n  private preloadAdjacentImages() {\n    if (this.images.length < 2) {\n      return;\n    }\n\n    const previousIndex = this.currentImageIdx - 1 >= 0 ?\n      this.currentImageIdx - 1 :\n      this.images.length - 1;\n    const nextIndex = this.currentImageIdx + 1 < this.images.length ?\n      this.currentImageIdx + 1 :\n      0;\n\n    for (const index of new Set([previousIndex, nextIndex])) {\n      const url = this.images[index]?.medium_image_url;\n      if (!url) {\n        continue;\n      }\n\n      const image = new Image();\n\n      // The image the user is looking at is probably still loading, so keep these behind it.\n      image.fetchPriority = 'low';\n\n      image.src = url;\n    }\n  }\n\n  private renderGallery() {\n    const startIndex = this.currentPage * this.perPage;\n    for (let i = startIndex; i < this.images.length; i++) {\n      this.renderGalleryItem(this.images[i]);\n    }\n  }\n\n  private renderGalleryItem(item: GalleryAPIImage) {\n    const wrapperElement = this.shadowRoot.querySelector('.ugc-gallery-container');\n    if (item.source === 'instagram') {\n      wrapperElement.appendChild(this.renderGalleryInstagram(item));\n    } else if (item.source === 'review') {\n      wrapperElement.appendChild(this.renderGalleryReview(item));\n    }\n  }\n\n  private renderGalleryInstagram(item: GalleryAPIImage) {\n    const review = document.createElement('yotpo-real-results-review-instagram');\n    review.dataset.author = item.post.username;\n    review.dataset.content = item.post.content;\n    review.dataset.imageId = item.image_id;\n    review.dataset.src = item.low_resolution_image_url;\n    review.role = 'button';\n    review.tabIndex = 0;\n    review.addEventListener('click', this.openPopupBound);\n    review.addEventListener('keyup', this.openPopupBound);\n    review.addEventListener('keydown', this.openPopupBound);\n    return review;\n  }\n\n  private renderGalleryReview(item: GalleryAPIImage) {\n    const review = document.createElement('yotpo-real-results-review');\n    review.dataset.author = item.review.user.display_name;\n    review.dataset.content = item.review.content;\n    review.dataset.imageId = item.image_id;\n    review.dataset.src = item.low_resolution_image_url;\n    review.role = 'button';\n    review.tabIndex = 0;\n    review.addEventListener('click', this.openPopupBound);\n    review.addEventListener('keyup', this.openPopupBound);\n    review.addEventListener('keydown', this.openPopupBound);\n    return review;\n  }\n}\n\nfunction createLightboxContent(item: GalleryAPIImage) {\n  // create content for slot\n  const content = document.createElement('div');\n  content.slot = 'content';\n  content.className = 'review';\n\n  // Review title and content can contain HTML tags and HTML entities. Review title and content are\n  // user-generated content and fundamentally unsafe. Therefore, we never want to set inner HTML.\n  // However, we do want reviews to render properly as many reviews use entities. So we manually\n  // decode the entities for beauty but only set text content for safety.\n\n  if (item.source === 'review') {\n    const title = document.createElement('strong');\n    title.classList.add('customer-review-title');\n    title.textContent = decode(item.review?.title);\n    content.appendChild(title);\n  }\n\n  const pElement = document.createElement('p');\n  pElement.classList.add('customer-review-text');\n  pElement.textContent = decode(item.review?.content || item.post?.content);\n  content.appendChild(pElement);\n\n  return content;\n}\n\nfunction createAvatarElement(item: GalleryAPIImage) {\n  const avatar = document.createElement('yotpo-avatar');\n  avatar.slot = 'badge';\n  avatar.dataset.date = item.source === 'review' ? item.review.created_at : item.post.created_time;\n  avatar.dataset.name = item.source === 'review' ?\n    item.review.user.display_name :\n    item.post.username;\n  avatar.dataset.score = item.source === 'review' ? item.review.score.toString() : undefined;\n  avatar.dataset.verified = item.source === 'review' ?\n    item.review.verified_buyer.toString() :\n    undefined;\n\n  if (item.source === 'instagram') {\n    avatar.classList.add('center-badge-label');\n  }\n\n  return avatar;\n}\n\n/**\n * This section does not load the actions element. It belongs to its own section, which the layout\n * loads on every page, and we count on that here.\n */\nfunction createLightboxVoteButtons(item: GalleryAPIImage) {\n  const element = document.createElement('yotpo-review-detail-actions');\n  element.dataset.reviewId = `${item.review.id}`;\n  element.dataset.votesUp = `${item.review.votes_up}`;\n  return element;\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'yotpo-real-results': YotpoRealResults;\n  }\n}\n\nif (!customElements.get('yotpo-real-results')) {\n  customElements.define('yotpo-real-results', YotpoRealResults);\n}\n","/**\n * Releases the handle returned from the ready() function.\n *\n * This is idempotent. Additional calls are pointless but harmless.\n */\nexport type ReleaseHandle = () => void;\n\n/**\n * A subset of events that pertain to document ready state.\n */\ntype LoadingEventMap = Pick<DocumentEventMap, 'DOMContentLoaded' | 'load'>;\n\n/**\n * Calls the provided callback when the document is ready. This works both when the document is\n * already ready and when it is not, so callers do not have to care. This exists because it ensures\n * that each caller consistently expresses its dependency on document readiness, and to save a bit\n * of boilerplate.\n *\n * A document is considered ready when it has been parsed. This corresponds to the ready state of\n * 'interactive'. When the document has been fully loaded, the ready state is 'complete'. The\n * callback runs either way, so callers do not have to check which one they are in.\n *\n * Ready means the html is parsed and the DOM is there to query. It does not mean the page's other\n * scripts have run. Deferred scripts and module scripts run after the ready state turns\n * 'interactive' and before DOMContentLoaded fires, so a callback here can run before them. When a\n * caller needs some other script to have run already, this is the wrong tool, and it should wait on\n * whatever that script produces instead.\n *\n * That remedy has a catch of its own when the calling bundle is loaded with async. An async bundle\n * can execute after DOMContentLoaded has already fired, so a plain listener for that event never\n * runs and the work silently never happens. Nothing here can detect that, because by the time this\n * file executes the event is long gone. Catching it needs something registered at parse time,\n * before any bundle loads.\n *\n * There is a second trap right next to that one, and it applies only when waiting for\n * DOMContentLoaded. The ready state stays 'interactive' after DOMContentLoaded has fired, all the\n * way until 'complete', so the ready state cannot tell you whether DOMContentLoaded is still coming\n * or has already gone. Waiting for load is not exposed to this, because the ready state turns\n * 'complete' and load fires in the same task, so seeing 'complete' means load has fired too.\n *\n * When the document is already ready, the callback is invoked via setTimeout. This way, if the\n * callback throws, the error surfaces to the global error handler in a way that is similar to what\n * happens when an event listener throws.\n *\n * We might one day want to move this to an NPM library.\n *\n * Beware of a quirk here. setTimeout yields, and the busier the frontend, the longer it takes to\n * fire. Page load is exactly when the frontend is busiest. The timeout is a floor and not a\n * guarantee, so there is no real bound on how long that yield lasts. What this means is that using\n * this library can introduce more delay than you might expect. Compare code that runs on async load\n * and checks ready state and invokes immediately to code that runs after setTimeout. The former\n * runs in the same tick, the latter runs in \"some later tick\". That later tick can be surprisingly\n * much later. That can cause initial paint issues.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event\n * @see https://html.spec.whatwg.org/multipage/parsing.html#the-end\n */\nexport function ready(callback: (event?: Event) => void,\n  type: keyof LoadingEventMap = 'DOMContentLoaded') {\n  if (document.readyState === 'complete' || (type === 'DOMContentLoaded' &&\n    document.readyState === 'interactive')) {\n    const timer = setTimeout(callback, 0);\n    const handle: ReleaseHandle = () => clearTimeout(timer);\n    return handle;\n  } else {\n    addEventListener(type, callback);\n    const handle: ReleaseHandle = () => removeEventListener(type, callback);\n    return handle;\n  }\n}\n","import { assert } from '@integrabeauty/assert';\nimport type { GalleryAPIResponseBody } from '@integrabeauty/yotpo-browser-types';\nimport { decorateError } from '../../../lib/decorate-error.js';\n\nexport interface Input {\n  /**\n   * @example \"UGC Gallery\"\n   */\n  album_name: string;\n\n  /**\n   * The store ID\n   */\n  app_key: string;\n\n  /**\n   * Retrieve only starred or unstarred images.\n   *\n   * Defaults to retrieving either.\n   */\n  favorite?: boolean;\n\n  instagram_count?: number;\n\n  /**\n   * The page number of a paginated response. Must be greater than zero. Default: 1\n   *\n   * This uses a 1-based offset. The first page of results is page 1, not 0.\n   *\n   * If not specified, defaults to 1.\n   */\n  page?: number;\n\n  /**\n   * The number of results to return per page. Maximum 56 per page.\n   */\n  per_page?: number;\n\n  review_count?: number;\n}\n\n/**\n * Fetches the custom album payload including album images, tags, names, and IDs of all existing\n * custom albums per account app_key.\n *\n * @see https://apidocs.yotpo.com/reference/photos-by-album\n */\nexport async function fetchPhotosByAlbum(input: Input) {\n  assert(input.album_name, 'Invalid album name');\n  assert(input.app_key, 'Invalid app key');\n\n  const url = new URL(`/apps/yotpo-ugc/v1/widget/${input.app_key}/albums/by_name`,\n    'https://langehair.com');\n  url.searchParams.append('album_name', input.album_name);\n\n  if (Number.isInteger(input.instagram_count)) {\n    url.searchParams.append('offset[instagram]', input.instagram_count.toString());\n  }\n\n  if (Number.isInteger(input.review_count)) {\n    url.searchParams.append('offset[review]', input.review_count.toString());\n  }\n\n  if (Number.isInteger(input.per_page)) {\n    url.searchParams.append('per_page', input.per_page.toString());\n  }\n\n  if (Number.isInteger(input.page)) {\n    url.searchParams.append('page', input.page.toString());\n  }\n\n  if (typeof input.favorite === 'boolean') {\n    url.searchParams.append('favorite', input.favorite.toString());\n  }\n\n  let response;\n  try {\n    response = await fetch(url);\n  } catch (error) {\n    decorateError(error, 'url', url.href);\n    throw error;\n  }\n\n  if (!response.ok) {\n    const error: any = new Error(`Status code ${response.status} fetching photos by album`);\n    error.code = response.status;\n    error.url = response.url;\n    throw error;\n  }\n\n  let responseText;\n  try {\n    responseText = await response.text();\n  } catch (error) {\n    decorateError(error, 'code', response.status);\n    decorateError(error, 'url', response.url);\n    throw error;\n  }\n\n  let body: GalleryAPIResponseBody;\n  try {\n    body = JSON.parse(responseText);\n  } catch (error) {\n    decorateError(error, 'code', response.status);\n    decorateError(error, 'url', response.url);\n    throw error;\n  }\n\n  if (body.status.code > 399) {\n    const error: any = new Error(`Nested response status code is ${body.status.code}`);\n    error.code = response.status;\n    error.url = response.url;\n    throw error;\n  }\n\n  return body.response;\n}\n"],"names":["LightBox","HTMLElement","observedAttributes","onCloseClickBound","this","onCloseClick","bind","onModalDismissRequestedBound","onModalDismissRequested","onKeyUpBound","onKeyUp","onPrevClickBound","onPrevClick","onNextClickBound","onNextClick","onPrevKeyUpBound","onPrevKeyUp","onNextKeyUpBound","onNextKeyUp","onImagePointerDownBound","onImagePointerDown","onImagePointerUpBound","onImagePointerUp","onImagePointerCancelBound","onImagePointerCancel","swipeStart","connectedCallback","initializeShadowRoot","addEventListener","shadowRoot","querySelector","prev","onNavKeyDown","next","image","render","disconnectedCallback","closeButton","removeEventListener","undefined","attributeChangedCallback","name","oldValue","newValue","isConnected","show","hide","requestOpen","attachShadow","mode","innerHTML","getUrls","_this$dataset$media","dataset","media","replace","split","map","path","_event","goToPrevious","event","includes","code","urls","index","parseInt","idx","navEvent","CustomEvent","bubbles","composed","detail","action","dispatchEvent","length","toString","goToNext","pointerType","isPrimary","target","currentTarget","pointerId","x","clientX","y","clientY","start","deltaX","deltaY","Math","abs","requestClose","modalState","Event","dialog","inert","classList","add","focus","focusVisible","remove","hidden","loading","imageContainer","style","backgroundImage","Number","isInteger","preventDefault","customElements","get","define","YotpoRealResultsReview","imageElement","imageId","src","alt","author","textContent","content","decode_html_entities_element","YotpoRealResultsReviewInstagram","decode","input","document","createElement","output","value","assert","expression","message","AssertionError","Error","constructor","super","decorateError","error","key","assignmentError","reason","console","log","tag","Object","prototype","call","YotpoRealResults","currentPage","instagramCount","images","perPage","reviewCount","currentImageIdx","isLoadingMoreForLightbox","hasLoadedAllImages","openPopupBound","openPopup","onLoadBound","onLoad","onLoadMoreButtonClickedBound","onLoadMoreButtonClicked","onLightboxNavigatedBound","onLightboxNavigated","onModalOpenedBound","onModalOpened","onModalClosedBound","onModalClosed","releaseReady","callback","type","readyState","timer","setTimeout","clearTimeout","ready","loadMoreButton","wrapperElement","reviewElement","children","getItems","then","hideLoadingMessage","catch","warn","_this$shadowRoot$quer","galleryContainer","isOnLastImage","loadMoreThenShowNext","renderPopup","lightbox","errorContainer","countBefore","loaderElement","loadButton","wasLoadButtonHidden","responseBody","async","album_name","app_key","url","URL","response","responseText","body","searchParams","append","instagram_count","review_count","per_page","page","favorite","fetch","href","ok","status","text","JSON","parse","fetchPhotosByAlbum","yotpoAppKey","NaN","concat","instagramImages","filter","source","reviewImages","renderGallery","KeyboardEvent","focusEvent","findIndex","image_id","clickTrack","appendChild","random","item","medium_image_url","slotContent","slot","avatar","date","review","created_at","post","created_time","user","display_name","username","score","verified","verified_buyer","createAvatarElement","_item$review2","_item$post","className","_item$review","title","pElement","createLightboxContent","element","reviewId","id","votesUp","votes_up","createLightboxVoteButtons","preloadAdjacentImages","previousIndex","nextIndex","Set","_this$images$index","Image","fetchPriority","i","renderGalleryItem","renderGalleryInstagram","renderGalleryReview","low_resolution_image_url","role","tabIndex"],"sourceRoot":""}