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QAAAA,SAIJ,GACER,KAAM,MACJlD,EAAAA,EAAAA,IAAG,QAlCiB,gCAkCwB2F","sources":["webpack://adjusters/./node_modules/a11y-dialog/dist/a11y-dialog.esm.js","webpack://adjusters/./src/scripts/components/modal.js","webpack://adjusters/./src/scripts/components/paginated-list.js"],"sourcesContent":["var focusableSelectors = [\n  'a[href]:not([tabindex^=\"-\"])',\n  'area[href]:not([tabindex^=\"-\"])',\n  'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n  'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n  'select:not([disabled]):not([tabindex^=\"-\"])',\n  'textarea:not([disabled]):not([tabindex^=\"-\"])',\n  'button:not([disabled]):not([tabindex^=\"-\"])',\n  'iframe:not([tabindex^=\"-\"])',\n  'audio[controls]:not([tabindex^=\"-\"])',\n  'video[controls]:not([tabindex^=\"-\"])',\n  '[contenteditable]:not([tabindex^=\"-\"])',\n  '[tabindex]:not([tabindex^=\"-\"])',\n];\n\nvar TAB_KEY = 'Tab';\nvar ESCAPE_KEY = 'Escape';\n\n/**\n * Define the constructor to instantiate a dialog\n *\n * @constructor\n * @param {Element} element\n */\nfunction A11yDialog(element) {\n  // Prebind the functions that will be bound in addEventListener and\n  // removeEventListener to avoid losing references\n  this._show = this.show.bind(this);\n  this._hide = this.hide.bind(this);\n  this._maintainFocus = this._maintainFocus.bind(this);\n  this._bindKeypress = this._bindKeypress.bind(this);\n\n  this.$el = element;\n  this.shown = false;\n  this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id;\n  this._previouslyFocused = null;\n  this._listeners = {};\n\n  // Initialise everything needed for the dialog to work properly\n  this.create();\n}\n\n/**\n * Set up everything necessary for the dialog to be functioning\n *\n * @param {(NodeList | Element | string)} targets\n * @return {this}\n */\nA11yDialog.prototype.create = function () {\n  this.$el.setAttribute('aria-hidden', true);\n  this.$el.setAttribute('aria-modal', true);\n  this.$el.setAttribute('tabindex', -1);\n\n  if (!this.$el.hasAttribute('role')) {\n    this.$el.setAttribute('role', 'dialog');\n  }\n\n  // Keep a collection of dialog openers, each of which will be bound a click\n  // event listener to open the dialog\n  this._openers = $$('[data-a11y-dialog-show=\"' + this._id + '\"]');\n  this._openers.forEach(\n    function (opener) {\n      opener.addEventListener('click', this._show);\n    }.bind(this)\n  );\n\n  // Keep a collection of dialog closers, each of which will be bound a click\n  // event listener to close the dialog\n  const $el = this.$el;\n\n  this._closers = $$('[data-a11y-dialog-hide]', this.$el)\n    // This filter is necessary in case there are nested dialogs, so that\n    // only closers from the current dialog are retrieved and effective\n    .filter(function (closer) {\n      // Testing for `[aria-modal=\"true\"]` is not enough since this attribute\n      // and the collect of closers is done at instantation time, when nested\n      // dialogs might not have yet been instantiated. Note that if the dialogs\n      // are manually instantiated, this could still fail because none of these\n      // selectors would match; this would cause closers to close all parent\n      // dialogs instead of just the current one\n      return closer.closest('[aria-modal=\"true\"], [data-a11y-dialog]') === $el\n    })\n    .concat($$('[data-a11y-dialog-hide=\"' + this._id + '\"]'));\n\n  this._closers.forEach(\n    function (closer) {\n      closer.addEventListener('click', this._hide);\n    }.bind(this)\n  );\n\n  // Execute all callbacks registered for the `create` event\n  this._fire('create');\n\n  return this\n};\n\n/**\n * Show the dialog element, disable all the targets (siblings), trap the\n * current focus within it, listen for some specific key presses and fire all\n * registered callbacks for `show` event\n *\n * @param {CustomEvent} event\n * @return {this}\n */\nA11yDialog.prototype.show = function (event) {\n  // If the dialog is already open, abort\n  if (this.shown) {\n    return this\n  }\n\n  // Keep a reference to the currently focused element to be able to restore\n  // it later\n  this._previouslyFocused = document.activeElement;\n  this.$el.removeAttribute('aria-hidden');\n  this.shown = true;\n\n  // Set the focus to the dialog element\n  moveFocusToDialog(this.$el);\n\n  // Bind a focus event listener to the body element to make sure the focus\n  // stays trapped inside the dialog while open, and start listening for some\n  // specific key presses (TAB and ESC)\n  document.body.addEventListener('focus', this._maintainFocus, true);\n  document.addEventListener('keydown', this._bindKeypress);\n\n  // Execute all callbacks registered for the `show` event\n  this._fire('show', event);\n\n  return this\n};\n\n/**\n * Hide the dialog element, enable all the targets (siblings), restore the\n * focus to the previously active element, stop listening for some specific\n * key presses and fire all registered callbacks for `hide` event\n *\n * @param {CustomEvent} event\n * @return {this}\n */\nA11yDialog.prototype.hide = function (event) {\n  // If the dialog is already closed, abort\n  if (!this.shown) {\n    return this\n  }\n\n  this.shown = false;\n  this.$el.setAttribute('aria-hidden', 'true');\n\n  // If there was a focused element before the dialog was opened (and it has a\n  // `focus` method), restore the focus back to it\n  // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108\n  if (this._previouslyFocused && this._previouslyFocused.focus) {\n    this._previouslyFocused.focus();\n  }\n\n  // Remove the focus event listener to the body element and stop listening\n  // for specific key presses\n  document.body.removeEventListener('focus', this._maintainFocus, true);\n  document.removeEventListener('keydown', this._bindKeypress);\n\n  // Execute all callbacks registered for the `hide` event\n  this._fire('hide', event);\n\n  return this\n};\n\n/**\n * Destroy the current instance (after making sure the dialog has been hidden)\n * and remove all associated listeners from dialog openers and closers\n *\n * @return {this}\n */\nA11yDialog.prototype.destroy = function () {\n  // Hide the dialog to avoid destroying an open instance\n  this.hide();\n\n  // Remove the click event listener from all dialog openers\n  this._openers.forEach(\n    function (opener) {\n      opener.removeEventListener('click', this._show);\n    }.bind(this)\n  );\n\n  // Remove the click event listener from all dialog closers\n  this._closers.forEach(\n    function (closer) {\n      closer.removeEventListener('click', this._hide);\n    }.bind(this)\n  );\n\n  // Execute all callbacks registered for the `destroy` event\n  this._fire('destroy');\n\n  // Keep an object of listener types mapped to callback functions\n  this._listeners = {};\n\n  return this\n};\n\n/**\n * Register a new callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.on = function (type, handler) {\n  if (typeof this._listeners[type] === 'undefined') {\n    this._listeners[type] = [];\n  }\n\n  this._listeners[type].push(handler);\n\n  return this\n};\n\n/**\n * Unregister an existing callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.off = function (type, handler) {\n  var index = (this._listeners[type] || []).indexOf(handler);\n\n  if (index > -1) {\n    this._listeners[type].splice(index, 1);\n  }\n\n  return this\n};\n\n/**\n * Iterate over all registered handlers for given type and call them all with\n * the dialog element as first argument, event as second argument (if any). Also\n * dispatch a custom event on the DOM element itself to make it possible to\n * react to the lifecycle of auto-instantiated dialogs.\n *\n * @access private\n * @param {string} type\n * @param {CustomEvent} event\n */\nA11yDialog.prototype._fire = function (type, event) {\n  var listeners = this._listeners[type] || [];\n  var domEvent = new CustomEvent(type, { detail: event });\n\n  this.$el.dispatchEvent(domEvent);\n\n  listeners.forEach(\n    function (listener) {\n      listener(this.$el, event);\n    }.bind(this)\n  );\n};\n\n/**\n * Private event handler used when listening to some specific key presses\n * (namely ESCAPE and TAB)\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._bindKeypress = function (event) {\n  // This is an escape hatch in case there are nested dialogs, so the keypresses\n  // are only reacted to for the most recent one\n  const focused = document.activeElement;\n  if (focused && focused.closest('[aria-modal=\"true\"]') !== this.$el) return\n\n  // If the dialog is shown and the ESCAPE key is being pressed, prevent any\n  // further effects from the ESCAPE key and hide the dialog, unless its role\n  // is 'alertdialog', which should be modal\n  if (\n    this.shown &&\n    event.key === ESCAPE_KEY &&\n    this.$el.getAttribute('role') !== 'alertdialog'\n  ) {\n    event.preventDefault();\n    this.hide(event);\n  }\n\n  // If the dialog is shown and the TAB key is being pressed, make sure the\n  // focus stays trapped within the dialog element\n  if (this.shown && event.key === TAB_KEY) {\n    trapTabKey(this.$el, event);\n  }\n};\n\n/**\n * Private event handler used when making sure the focus stays within the\n * currently open dialog\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._maintainFocus = function (event) {\n  // If the dialog is shown and the focus is not within a dialog element (either\n  // this one or another one in case of nested dialogs) or within an element\n  // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to\n  // its first focusable child.\n  // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177\n  if (\n    this.shown &&\n    !event.target.closest('[aria-modal=\"true\"]') &&\n    !event.target.closest('[data-a11y-dialog-ignore-focus-trap]')\n  ) {\n    moveFocusToDialog(this.$el);\n  }\n};\n\n/**\n * Convert a NodeList into an array\n *\n * @param {NodeList} collection\n * @return {Array<Element>}\n */\nfunction toArray(collection) {\n  return Array.prototype.slice.call(collection)\n}\n\n/**\n * Query the DOM for nodes matching the given selector, scoped to context (or\n * the whole document)\n *\n * @param {String} selector\n * @param {Element} [context = document]\n * @return {Array<Element>}\n */\nfunction $$(selector, context) {\n  return toArray((context || document).querySelectorAll(selector))\n}\n\n/**\n * Set the focus to the first element with `autofocus` with the element or the\n * element itself\n *\n * @param {Element} node\n */\nfunction moveFocusToDialog(node) {\n  var focused = node.querySelector('[autofocus]') || node;\n\n  focused.focus();\n}\n\n/**\n * Get the focusable children of the given element\n *\n * @param {Element} node\n * @return {Array<Element>}\n */\nfunction getFocusableChildren(node) {\n  return $$(focusableSelectors.join(','), node).filter(function (child) {\n    return !!(\n      child.offsetWidth ||\n      child.offsetHeight ||\n      child.getClientRects().length\n    )\n  })\n}\n\n/**\n * Trap the focus inside the given element\n *\n * @param {Element} node\n * @param {Event} event\n */\nfunction trapTabKey(node, event) {\n  var focusableChildren = getFocusableChildren(node);\n  var focusedItemIndex = focusableChildren.indexOf(document.activeElement);\n\n  // If the SHIFT key is being pressed while tabbing (moving backwards) and\n  // the currently focused item is the first one, move the focus to the last\n  // focusable item from the dialog element\n  if (event.shiftKey && focusedItemIndex === 0) {\n    focusableChildren[focusableChildren.length - 1].focus();\n    event.preventDefault();\n    // If the SHIFT key is not being pressed (moving forwards) and the currently\n    // focused item is the last one, move the focus to the first focusable item\n    // from the dialog element\n  } else if (\n    !event.shiftKey &&\n    focusedItemIndex === focusableChildren.length - 1\n  ) {\n    focusableChildren[0].focus();\n    event.preventDefault();\n  }\n}\n\nfunction instantiateDialogs() {\n  $$('[data-a11y-dialog]').forEach(function (node) {\n    new A11yDialog(node);\n  });\n}\n\nif (typeof document !== 'undefined') {\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', instantiateDialogs);\n  } else {\n    if (window.requestAnimationFrame) {\n      window.requestAnimationFrame(instantiateDialogs);\n    } else {\n      window.setTimeout(instantiateDialogs, 16);\n    }\n  }\n}\n\nexport { A11yDialog as default };\n","import '@styles/components/modal.css'\nimport ajax from '@common/ajax'\nimport { on, off } from 'delegated-events'\nimport A11yDialog from 'a11y-dialog'\n\nconst generateTemplate = (id, useDefaultClose = true, title = false) => {\n  const role = useDefaultClose ? 'dialog' : 'alertdialog'\n  const labeledBy = title ? 'aria-labelledby=\"modal-title\"' : ''\n\n  const html = `\n    <div id=\"${id}\" aria-hidden=\"true\" class=\"modal-wrapper\" ${labeledBy} role=\"${role}\">\n      <div class=\"modal-overlay\" ${useDefaultClose && 'data-a11y-dialog-hide'}></div>\n\n      ${\n        useDefaultClose === true\n        ? '<button type=\"button\" class=\"modal-close\" data-a11y-dialog-hide aria-label=\"Close dialog\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" class=\"m-auto w-3/5 h-3/5\"><path fill=\"currentColor\" d=\"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z\" /></svg></button>'\n        : ''\n      }\n\n      <div class=\"modal-container\">\n        <svg class=\"ai-loader ai-loader--centered ai-loader--light\" viewBox=\"0 0 50 50\" aria-hidden=\"true\">\n          <circle class=\"path\" cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke-width=\"5\"></circle>\n        </svg>\n      </div>\n    </div>\n  `\n\n  return html\n}\n\nconst populateModal = async (opts = {}, modalEl) => {\n  const type = opts.type\n  const title = opts.title ?? ''\n  const url = opts.url\n\n  let modalContent = ''\n\n  if (type === 'video') {\n    modalContent = `\n      <div class=\"mx-auto w-full max-w-5xl modal-content\" role=\"document\">\n        <h1 id=\"modal-title\" class=\"sr-only\">Watch ${title}</h1>\n        <div class=\"relative aspect-video modal-body\">\n            <button type=\"button\" class=\"flex absolute right-0 -top-14 ml-auto text-blue transition-colors size-11 z-1 md:-top-[22px] md:-right-[22px] hover:text-green w-10 h-10 modal-custom-close\" data-a11y-dialog-hide aria-label=\"Close dialog\">\n                <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 42 42\" class=\"w-full\">\n                    <circle cx=\"21\" cy=\"21\" r=\"21\" fill=\"currentColor\"x />\n                    <path fill=\"#fff\" d=\"M13.846 29.532a1.555 1.555 0 0 1-1.104-.373 1.555 1.555 0 0 1 0-2.192l13.2-13.199a1.555 1.555 0 0 1 2.269 2.114L14.934 29.16a1.555 1.555 0 0 1-1.088.373Z\"/>\n                    <path fill=\"#fff\" d=\"M27.031 29.533a1.555 1.555 0 0 1-1.088-.451l-13.2-13.2a1.555 1.555 0 0 1 2.193-2.191L28.213 26.89a1.555 1.555 0 0 1 0 2.27 1.555 1.555 0 0 1-1.182.373Z\"/>\n                </svg>\n            </button>\n\n            <iframe title=\"Watch ${title}\" style=\"border: none\" src=\"${url}?autoplay=1&rel=0&enablejsapi=1\" allowfullscreen class=\"absolute inset-0 w-full h-full\"></iframe>\n        </div>\n      </div>\n    `\n\n    modalEl.querySelector('.modal-container').innerHTML = modalContent\n  }\n\n  if (type === 'letter') {\n    modalContent = await ajax.get(url).text()\n\n    modalEl.querySelector('.modal-container').innerHTML = modalContent\n\n    const { default: component } = await import(\n      /* webpackChunkName: \"components-modal-slider\" */ '@scripts/components/modal-slider'\n    )\n\n    component.init(modalEl)\n  }\n\n  if (type === 'content') {\n    modalContent = await ajax.get(url).text()\n\n    modalEl.querySelector('.modal-container').innerHTML = modalContent\n  }\n\n  if (type === 'subscribe') {\n    modalContent = await ajax.get(url).text()\n\n    modalEl.querySelector('.modal-container').innerHTML = modalContent\n\n    const { default: component } = await import(\n      /* webpackChunkName: \"components-modal-subscribe\" */ '@scripts/components/modal-subscribe'\n    )\n\n    component.init(modalEl)\n  }\n\n  if (type === 'form') {\n    modalContent = await ajax.get(url).text()\n\n    modalEl.querySelector('.modal-container').innerHTML = modalContent\n    modalEl.classList.add('as-full')\n\n    const { default: component } = await import(\n      /* webpackChunkName: \"components-modal-form\" */ '@scripts/components/modal-form'\n    )\n\n    component.init(modalEl)\n  }\n}\n\nconst handleModal = (e) => {\n  e.preventDefault()\n\n  const triggerEl = e.target.closest('[data-modal]')\n\n  openModal({\n    type: triggerEl.dataset.modal,\n    title: triggerEl.dataset.modalTitle,\n    url: triggerEl.href,\n    updateUrl: triggerEl.dataset.modalUpdateUrl ?? false,\n    useDefaultClose: triggerEl.dataset.modalDisableDefaultClose === undefined,\n  })\n\n  return false\n}\n\nconst openModal = (opts = {}) => {\n  const type = opts.type\n  const title = opts.title ?? false\n  let useDefaultClose = opts.useDefaultClose ?? true\n\n  if (type === 'video') {\n    useDefaultClose = false\n  }\n\n  if (type === 'subscribe') {\n    useDefaultClose = false\n  }\n\n  if (type === \"content\") {\n    useDefaultClose = false;\n  }\n\n  const id = `modal-${Math.floor(Math.random() * Date.now())}`\n  const template = generateTemplate(id, useDefaultClose, title)\n  const node = document.createRange().createContextualFragment(template)\n\n  document.body.append(node)\n\n  const modalEl = document.getElementById(id)\n  const modal = new A11yDialog(modalEl)\n\n  const currentUrl = opts.defaultUrl ?? window.location.href\n\n  if (useDefaultClose === false) {\n    on('click', '.modal-custom-close', () => {\n      modal.hide()\n    });\n  }\n\n  modal.on('show', () => {\n    document.documentElement.classList.add('has-modal-active')\n\n    if (opts.updateUrl !== false) {\n      window.history.replaceState({}, '', opts.updateUrl)\n    }\n  })\n\n  modal.on('hide', () => {\n    document.documentElement.classList.remove('has-modal-active')\n\n    modal.destroy()\n\n    if (opts.updateUrl !== false) {\n      window.history.replaceState({}, '', currentUrl)\n    }\n\n    if (useDefaultClose === false) {\n        off(\"click\", \".modal-custom-close\", () => {\n            modal.hide()\n        });\n    }\n  })\n\n  modal.on('destroy', (el) => {\n    el.remove()\n  })\n\n  modal.show()\n\n  populateModal(\n    {\n      type: type,\n      url: opts.url ?? false,\n      updateUrl: opts.updateUrl,\n      defaultUrl: opts.defaultUrl,\n    },\n    modalEl\n  )\n}\n\nexport default {\n  init: () => {\n    const clickArgs = ['click', '[data-modal]', handleModal]\n    off(...clickArgs)\n    on(...clickArgs)\n\n    // If we have video modals, load the YouTube API\n    if (document.querySelectorAll('[data-modal=\"video\"]').length) {\n      const tag = document.createElement('script')\n      tag.src = 'https://www.youtube.com/iframe_api'\n\n      const firstScriptTag = document.getElementsByTagName('script')[0]\n\n      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)\n    }\n  },\n  openModal,\n}\n","import scrollTo from '@common/scroll-to'\nimport ajax from '@common/ajax'\nimport { on } from 'delegated-events'\nimport modal from '@scripts/components/modal'\n\nconst selectors = {\n  paginatedListControls: '[data-paginated-list-controls]',\n  paginatedListTrigger: '[data-paginated-list-trigger]',\n  paginatedListHide: 'data-paginated-list-hide',\n  paginatedList: '[data-paginated-list]',\n}\n\nconst handleTrigger = async (e) => {\n  const target = e.target\n  const controls = target.closest(selectors.paginatedListControls)\n  const list = document.querySelector(selectors.paginatedList)\n\n  e.preventDefault()\n\n  controls.classList.add('pointer-events-none', 'opacity-60')\n\n  const res = await ajax.get(target.href).json()\n\n  const updatedControls = document.createRange().createContextualFragment(res.pagination)\n  controls.replaceWith(updatedControls)\n\n  const updatedList = document.createRange().createContextualFragment(res.list)\n\n  if (target.hasAttribute(selectors.paginatedListHide)) {\n    list.replaceChildren(updatedList)\n\n    scrollTo(document.body)\n  } else {\n    list.append(updatedList)\n\n    modal.init()\n  }\n}\n\nexport default {\n  init: () => {\n    on('click', selectors.paginatedListTrigger, handleTrigger)\n  },\n}\n"],"names":["focusableSelectors","A11yDialog","element","this","_show","show","bind","_hide","hide","_maintainFocus","_bindKeypress","$el","shown","_id","getAttribute","id","_previouslyFocused","_listeners","create","$$","selector","context","collection","document","querySelectorAll","Array","prototype","slice","call","moveFocusToDialog","node","querySelector","focus","instantiateDialogs","forEach","setAttribute","hasAttribute","_openers","opener","addEventListener","_closers","filter","closer","closest","concat","_fire","event","activeElement","removeAttribute","body","removeEventListener","destroy","on","type","handler","push","off","index","indexOf","splice","listeners","domEvent","CustomEvent","detail","dispatchEvent","listener","focused","key","preventDefault","focusableChildren","join","child","offsetWidth","offsetHeight","getClientRects","length","getFocusableChildren","focusedItemIndex","shiftKey","trapTabKey","target","readyState","window","requestAnimationFrame","setTimeout","generateTemplate","useDefaultClose","title","role","labeledBy","html","populateModal","async","opts","modalEl","url","modalContent","innerHTML","ajax","text","default","component","init","classList","add","handleModal","e","triggerEl","openModal","dataset","modal","modalTitle","href","updateUrl","modalUpdateUrl","undefined","modalDisableDefaultClose","Math","floor","random","Date","now","template","createRange","createContextualFragment","append","getElementById","currentUrl","defaultUrl","location","documentElement","history","replaceState","remove","el","clickArgs","tag","createElement","src","firstScriptTag","getElementsByTagName","parentNode","insertBefore","handleTrigger","controls","list","res","json","updatedControls","pagination","replaceWith","updatedList","replaceChildren","scrollTo"],"sourceRoot":""}