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,EAAQrG,UJqCD,SAAsBA,EAAWlC,GAAU,GAC9CC,EAAOiC,UAAYlC,EAAUkC,EAAYT,EAAIxB,EAAOiC,UAAWA,EACnE,EItCAqG,EAAQ5F,YAAcA,EACtB,S","sources":["webpack://silverstripe-base/./themes/app/src/scripts/common/ajax.js","webpack://silverstripe-base/./node_modules/a11y-dialog/dist/a11y-dialog.esm.js","webpack://silverstripe-base/./themes/app/src/scripts/components/modal.js","webpack://silverstripe-base/./node_modules/wretch/dist/addons/queryString.js","webpack://silverstripe-base/./node_modules/wretch/dist/constants.js","webpack://silverstripe-base/./node_modules/wretch/dist/utils.js","webpack://silverstripe-base/./node_modules/wretch/dist/config.js","webpack://silverstripe-base/./node_modules/wretch/dist/resolver.js","webpack://silverstripe-base/./node_modules/wretch/dist/middleware.js","webpack://silverstripe-base/./node_modules/wretch/dist/core.js","webpack://silverstripe-base/./node_modules/wretch/dist/index.js"],"sourcesContent":["import wretch from 'wretch'\nimport QueryStringAddon from 'wretch/addons/queryString'\n\nwretch.options({\n headers: { 'X-Requested-With': 'XMLHttpRequest' },\n})\n\nexport default wretch().addon(QueryStringAddon)\n","const not = {\n inert: ':not([inert]):not([inert] *)',\n negTabIndex: ':not([tabindex^=\"-\"])',\n disabled: ':not(:disabled)',\n};\n\nvar focusableSelectors = [\n `a[href]${not.inert}${not.negTabIndex}`,\n `area[href]${not.inert}${not.negTabIndex}`,\n `input:not([type=\"hidden\"]):not([type=\"radio\"])${not.inert}${not.negTabIndex}${not.disabled}`,\n `input[type=\"radio\"]${not.inert}${not.negTabIndex}${not.disabled}`,\n `select${not.inert}${not.negTabIndex}${not.disabled}`,\n `textarea${not.inert}${not.negTabIndex}${not.disabled}`,\n `button${not.inert}${not.negTabIndex}${not.disabled}`,\n `details${not.inert} > summary:first-of-type${not.negTabIndex}`,\n // Discard until Firefox supports `:has()`\n // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12\n // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,\n `iframe${not.inert}${not.negTabIndex}`,\n `audio[controls]${not.inert}${not.negTabIndex}`,\n `video[controls]${not.inert}${not.negTabIndex}`,\n `[contenteditable]${not.inert}${not.negTabIndex}`,\n `[tabindex]${not.inert}${not.negTabIndex}`,\n];\n\n/**\n * Set the focus to the first element with `autofocus` with the element or the\n * element itself.\n */\nfunction moveFocusToDialog(el) {\n const focused = (el.querySelector('[autofocus]') || el);\n focused.focus();\n}\n/**\n * Get the first and last focusable elements in a given tree.\n */\nfunction getFocusableEdges(el) {\n // Check for a focusable element within the subtree of `el`.\n const first = findFocusableElement(el, true);\n // Only if we find the first element do we need to look for the last one. If\n // there’s no last element, we set `last` as a reference to `first` so that\n // the returned array is always of length 2.\n const last = first ? findFocusableElement(el, false) || first : null;\n return [first, last];\n}\n/**\n * Find the first focusable element inside the given node if `forward` is truthy\n * or the last focusable element otherwise.\n */\nfunction findFocusableElement(node, forward) {\n // If we’re walking forward, check if this node is focusable, and return it\n // immediately if it is.\n if (forward && isFocusable(node))\n return node;\n // We should only search the subtree of this node if it can have focusable\n // children.\n if (canHaveFocusableChildren(node)) {\n // Start walking the DOM tree, looking for focusable elements.\n // Case 1: If this node has a shadow root, search it recursively.\n if (node.shadowRoot) {\n // Descend into this subtree.\n let next = getNextChildEl(node.shadowRoot, forward);\n // Traverse siblings, searching the subtree of each one\n // for focusable elements.\n while (next) {\n const focusableEl = findFocusableElement(next, forward);\n if (focusableEl)\n return focusableEl;\n next = getNextSiblingEl(next, forward);\n }\n }\n // Case 2: If this node is a slot for a Custom Element, search its assigned\n // nodes recursively.\n else if (node.localName === 'slot') {\n const assignedElements = node.assignedElements({\n flatten: true,\n });\n if (!forward)\n assignedElements.reverse();\n for (const assignedElement of assignedElements) {\n const focusableEl = findFocusableElement(assignedElement, forward);\n if (focusableEl)\n return focusableEl;\n }\n }\n // Case 3: this is a regular Light DOM node. Search its subtree.\n else {\n // Descend into this subtree.\n let next = getNextChildEl(node, forward);\n // Traverse siblings, searching the subtree of each one\n // for focusable elements.\n while (next) {\n const focusableEl = findFocusableElement(next, forward);\n if (focusableEl)\n return focusableEl;\n next = getNextSiblingEl(next, forward);\n }\n }\n }\n // If we’re walking backward, we want to check the node’s entire subtree\n // before checking the node itself. If this node is focusable, return it.\n if (!forward && isFocusable(node))\n return node;\n return null;\n}\nfunction getNextChildEl(node, forward) {\n return forward ? node.firstElementChild : node.lastElementChild;\n}\nfunction getNextSiblingEl(el, forward) {\n return forward ? el.nextElementSibling : el.previousElementSibling;\n}\n/**\n * Determine if an element is hidden from the user.\n */\nconst isHidden = (el) => {\n // Browsers hide all non- descendants of closed
elements\n // from user interaction, but those non- elements may still match our\n // focusable-selectors and may still have dimensions, so we need a special\n // case to ignore them.\n if (el.matches('details:not([open]) *') &&\n !el.matches('details>summary:first-of-type'))\n return true;\n // If this element has no painted dimensions, it's hidden.\n return !(el.offsetWidth || el.offsetHeight || el.getClientRects().length);\n};\n/**\n * Determine if an element is focusable and has user-visible painted dimensions.\n */\nconst isFocusable = (el) => {\n // A shadow host that delegates focus will never directly receive focus,\n // even with `tabindex=0`. Consider our custom element, which\n // delegates focus to its shadow button:\n //\n // \n // #shadow-root\n // \n // \n //\n // The browser acts as as if there is only one focusable element – the shadow\n // button. Our library should behave the same way.\n if (el.shadowRoot?.delegatesFocus)\n return false;\n return el.matches(focusableSelectors.join(',')) && !isHidden(el);\n};\n/**\n * Determine if an element can have focusable children. Useful for bailing out\n * early when walking the DOM tree.\n * @example\n * This div is inert, so none of its children can be focused, even though they\n * meet our criteria for what is focusable. Once we check the div, we can skip\n * the rest of the subtree.\n * ```html\n *
\n * \n * Link\n *
\n * ```\n */\nfunction canHaveFocusableChildren(el) {\n // The browser will never send focus into a Shadow DOM if the host element\n // has a negative tabindex. This applies to both slotted Light DOM Shadow DOM\n // children\n if (el.shadowRoot && el.getAttribute('tabindex') === '-1')\n return false;\n // Elemments matching this selector are either hidden entirely from the user,\n // or are visible but unavailable for interaction. Their descentants can never\n // receive focus.\n return !el.matches(':disabled,[hidden],[inert]');\n}\n/**\n * Get the active element, accounting for Shadow DOM subtrees.\n * @author Cory LaViska\n * @see: https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/\n */\nfunction getActiveElement(root = document) {\n const activeEl = root.activeElement;\n if (!activeEl)\n return null;\n // If there’s a shadow root, recursively find the active element within it.\n // If the recursive call returns null, return the active element\n // of the top-level Document.\n if (activeEl.shadowRoot)\n return getActiveElement(activeEl.shadowRoot) || document.activeElement;\n // If not, we can just return the active element\n return activeEl;\n}\n/**\n * Trap the focus inside the given element\n */\nfunction trapTabKey(el, event) {\n const [firstFocusableChild, lastFocusableChild] = getFocusableEdges(el);\n // If there are no focusable children in the dialog, prevent the user from\n // tabbing out of it\n if (!firstFocusableChild)\n return event.preventDefault();\n const activeElement = getActiveElement();\n // If the SHIFT key is pressed while tabbing (moving backwards) and the\n // currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && activeElement === firstFocusableChild) {\n // @ts-ignore: we know that `lastFocusableChild` is not null here\n lastFocusableChild.focus();\n event.preventDefault();\n }\n // If the SHIFT key is not pressed (moving forwards) and the currently focused\n // item is the last one, move the focus to the first focusable item from the\n // dialog element\n else if (!event.shiftKey && activeElement === lastFocusableChild) {\n firstFocusableChild.focus();\n event.preventDefault();\n }\n}\n\nclass A11yDialog {\n $el;\n id;\n previouslyFocused;\n shown;\n constructor(element) {\n this.$el = element;\n this.id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id;\n this.previouslyFocused = null;\n this.shown = false;\n this.maintainFocus = this.maintainFocus.bind(this);\n this.bindKeypress = this.bindKeypress.bind(this);\n this.handleTriggerClicks = this.handleTriggerClicks.bind(this);\n this.show = this.show.bind(this);\n this.hide = this.hide.bind(this);\n this.$el.setAttribute('aria-hidden', 'true');\n this.$el.setAttribute('aria-modal', 'true');\n this.$el.setAttribute('tabindex', '-1');\n if (!this.$el.hasAttribute('role')) {\n this.$el.setAttribute('role', 'dialog');\n }\n document.addEventListener('click', this.handleTriggerClicks, true);\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 destroy() {\n // Hide the dialog to avoid destroying an open instance\n this.hide();\n // Remove the click event delegates for our openers and closers\n document.removeEventListener('click', this.handleTriggerClicks, true);\n // Clone and replace the dialog element to prevent memory leaks caused by\n // event listeners that the author might not have cleaned up.\n this.$el.replaceWith(this.$el.cloneNode(true));\n // Dispatch a `destroy` event\n this.fire('destroy');\n return this;\n }\n /**\n * Show the dialog element, trap the current focus within it, listen for some\n * specific key presses and fire all registered callbacks for `show` event\n */\n show(event) {\n // If the dialog is already open, abort\n if (this.shown)\n return this;\n // Keep a reference to the currently focused element to be able to restore\n // it later\n this.shown = true;\n this.$el.removeAttribute('aria-hidden');\n this.previouslyFocused = getActiveElement();\n // Due to a long lasting bug in Safari, clicking an interactive element\n // (like a '\n : \"\"\n }\n\n
\n \n \n \n
\n \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
\n

Watch ${title}

\n
\n \n
\n
\n `;\n\n modalEl.querySelector(\".modal-container\").innerHTML = modalContent;\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\n fire(document.documentElement, \"modal:populate\", { modalEl });\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 useCustomClose: triggerEl.dataset.modalUseCustomClose !== undefined,\n });\n\n return false;\n};\n\nconst handleModalReplace = async (e) => {\n e.preventDefault();\n\n const triggerEl = e.target.closest(\"[data-modal-replace]\");\n const url = triggerEl.href;\n\n const currentModal = document.querySelector(\".modal-wrapper\");\n\n const modalContent = await ajax.get(url).text();\n\n currentModal.querySelector(\".modal-container\").innerHTML = modalContent;\n};\n\nconst openModal = (opts = {}) => {\n const type = opts.type;\n const title = opts.title ?? false;\n let useCustomClose = opts.useCustomClose ?? 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 useCustomClose = true;\n }\n\n const id = `modal-${Math.floor(Math.random() * Date.now())}`;\n const template = generateTemplate(id, useDefaultClose, useCustomClose, 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 hideModal = () => {\n modal.hide();\n };\n\n if (useCustomClose) {\n on(\"click\", \".modal-custom-close\", hideModal);\n }\n\n const currentUrl = opts.defaultUrl ?? window.location.href;\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 (useCustomClose) {\n off(\"click\", \".modal-custom-close\", hideModal);\n }\n });\n\n modal.on(\"destroy\", (e) => {\n document.querySelector(\".modal-wrapper\").remove();\n e.target.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 const replaceClickArgs = [\"click\", \"[data-modal-replace]\", handleModalReplace];\n\n off(...clickArgs);\n on(...clickArgs);\n\n off(...replaceClickArgs);\n on(...replaceClickArgs);\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","function stringify(value) {\n return typeof value !== \"undefined\" ? value : \"\";\n}\nconst appendQueryParams = (url, qp, replace, config) => {\n let queryString;\n if (typeof qp === \"string\") {\n queryString = qp;\n }\n else {\n const usp = config.polyfill(\"URLSearchParams\", true, true);\n for (const key in qp) {\n const value = qp[key];\n if (qp[key] instanceof Array) {\n for (const val of value)\n usp.append(key, stringify(val));\n }\n else {\n usp.append(key, stringify(value));\n }\n }\n queryString = usp.toString();\n }\n const split = url.split(\"?\");\n if (!queryString)\n return replace ? split[0] : url;\n if (replace || split.length < 2)\n return split[0] + \"?\" + queryString;\n return url + \"&\" + queryString;\n};\n/**\n * Adds the ability to append query parameters from a javascript object.\n *\n * ```js\n * import QueryAddon from \"wretch/addons/queryString\"\n *\n * wretch().addon(QueryAddon)\n * ```\n */\nconst queryString = {\n wretch: {\n query(qp, replace = false) {\n return { ...this, _url: appendQueryParams(this._url, qp, replace, this._config) };\n }\n }\n};\nexport default queryString;\n//# sourceMappingURL=queryString.js.map","export const JSON_MIME = \"application/json\";\nexport const CONTENT_TYPE_HEADER = \"Content-Type\";\nexport const FETCH_ERROR = Symbol();\nexport const CATCHER_FALLBACK = Symbol();\n//# sourceMappingURL=constants.js.map","import { CONTENT_TYPE_HEADER } from \"./constants.js\";\nexport function extractContentType(headers = {}) {\n var _a;\n return (_a = Object.entries(headers).find(([k]) => k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase())) === null || _a === void 0 ? void 0 : _a[1];\n}\nexport function isLikelyJsonMime(value) {\n return /^application\\/.*json.*/.test(value);\n}\nexport const mix = function (one, two, mergeArrays = false) {\n return Object.entries(two).reduce((acc, [key, newValue]) => {\n const value = one[key];\n if (Array.isArray(value) && Array.isArray(newValue)) {\n acc[key] = mergeArrays ? [...value, ...newValue] : newValue;\n }\n else if (typeof value === \"object\" && typeof newValue === \"object\") {\n acc[key] = mix(value, newValue, mergeArrays);\n }\n else {\n acc[key] = newValue;\n }\n return acc;\n }, { ...one });\n};\n//# sourceMappingURL=utils.js.map","import { mix } from \"./utils.js\";\nconst config = {\n // Default options\n options: {},\n // Error type\n errorType: \"text\",\n // Polyfills\n polyfills: {\n // fetch: null,\n // FormData: null,\n // URLSearchParams: null,\n // performance: null,\n // PerformanceObserver: null,\n // AbortController: null\n },\n polyfill(p, doThrow = true, instance = false, ...args) {\n const res = this.polyfills[p] ||\n (typeof self !== \"undefined\" ? self[p] : null) ||\n (typeof global !== \"undefined\" ? global[p] : null);\n if (doThrow && !res)\n throw new Error(p + \" is not defined\");\n return instance && res ? new res(...args) : res;\n }\n};\n/**\n * Sets the default fetch options that will be stored internally when instantiating wretch objects.\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.options({ headers: { \"Accept\": \"application/json\" } });\n *\n * // The fetch request is sent with both headers.\n * wretch(\"...\", { headers: { \"X-Custom\": \"Header\" } }).get().res();\n * ```\n *\n * @param options Default options\n * @param replace If true, completely replaces the existing options instead of mixing in\n */\nexport function setOptions(options, replace = false) {\n config.options = replace ? options : mix(config.options, options);\n}\n/**\n * Sets the default polyfills that will be stored internally when instantiating wretch objects.\n * Useful for browserless environments like `node.js`.\n *\n * Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.polyfills({\n * fetch: require(\"node-fetch\"),\n * FormData: require(\"form-data\"),\n * URLSearchParams: require(\"url\").URLSearchParams,\n * });\n *\n * // Uses the above polyfills.\n * wretch(\"...\").get().res();\n * ```\n *\n * @param polyfills An object containing the polyfills\n * @param replace If true, replaces the current polyfills instead of mixing in\n */\nexport function setPolyfills(polyfills, replace = false) {\n config.polyfills = replace ? polyfills : mix(config.polyfills, polyfills);\n}\n/**\n * Sets the default method (text, json, …) used to parse the data contained in the response body in case of an HTTP error.\n * As with other static methods, it will affect wretch instances created after calling this function.\n *\n * _Note: if the response Content-Type header is set to \"application/json\", the body will be parsed as json regardless of the errorType._\n *\n * ```js\n * import wretch from \"wretch\"\n *\n * wretch.errorType(\"json\")\n *\n * wretch(\"http://server/which/returns/an/error/with/a/json/body\")\n * .get()\n * .res()\n * .catch(error => {\n * // error[errorType] (here, json) contains the parsed body\n * console.log(error.json)\n * })\n * ```\n *\n * If null, defaults to \"text\".\n */\nexport function setErrorType(errorType) {\n config.errorType = errorType;\n}\nexport default config;\n//# sourceMappingURL=config.js.map","import { middlewareHelper } from \"./middleware.js\";\nimport { mix } from \"./utils.js\";\nimport { FETCH_ERROR, CATCHER_FALLBACK } from \"./constants.js\";\n/**\n * This class inheriting from Error is thrown when the fetch response is not \"ok\".\n * It extends Error and adds status, text and body fields.\n */\nexport class WretchError extends Error {\n}\nexport const resolver = (wretch) => {\n const sharedState = Object.create(null);\n wretch = wretch._addons.reduce((w, addon) => addon.beforeRequest &&\n addon.beforeRequest(w, wretch._options, sharedState)\n || w, wretch);\n const { _url: url, _options: opts, _config: config, _catchers: _catchers, _resolvers: resolvers, _middlewares: middlewares, _addons: addons } = wretch;\n const catchers = new Map(_catchers);\n const finalOptions = mix(config.options, opts);\n // The generated fetch request\n let finalUrl = url;\n const _fetchReq = middlewareHelper(middlewares)((url, options) => {\n finalUrl = url;\n return config.polyfill(\"fetch\")(url, options);\n })(url, finalOptions);\n // Throws on an http error\n const referenceError = new Error();\n const throwingPromise = _fetchReq\n .catch(error => {\n throw { [FETCH_ERROR]: error };\n })\n .then(response => {\n if (!response.ok) {\n const err = new WretchError();\n // Enhance the error object\n err[\"cause\"] = referenceError;\n err.stack = err.stack + \"\\nCAUSE: \" + referenceError.stack;\n err.response = response;\n err.url = finalUrl;\n if (response.type === \"opaque\") {\n throw err;\n }\n return response.text().then((body) => {\n var _a;\n err.message = body;\n if (config.errorType === \"json\" || ((_a = response.headers.get(\"Content-Type\")) === null || _a === void 0 ? void 0 : _a.split(\";\")[0]) === \"application/json\") {\n try {\n err.json = JSON.parse(body);\n }\n catch (e) { /* ignore */ }\n }\n err.text = body;\n err[\"status\"] = response.status;\n throw err;\n });\n }\n return response;\n });\n // Wraps the Promise in order to dispatch the error to a matching catcher\n const catchersWrapper = (promise) => {\n return promise.catch(err => {\n const fetchErrorFlag = err.hasOwnProperty(FETCH_ERROR);\n const error = fetchErrorFlag ? err[FETCH_ERROR] : err;\n const catcher = ((error === null || error === void 0 ? void 0 : error.status) && catchers.get(error.status)) ||\n catchers.get(error === null || error === void 0 ? void 0 : error.name) || (fetchErrorFlag && catchers.has(FETCH_ERROR) && catchers.get(FETCH_ERROR));\n if (catcher)\n return catcher(error, wretch);\n const catcherFallback = catchers.get(CATCHER_FALLBACK);\n if (catcherFallback)\n return catcherFallback(error, wretch);\n throw error;\n });\n };\n const bodyParser = funName => cb => funName ?\n // If a callback is provided, then callback with the body result otherwise return the parsed body itself.\n catchersWrapper(throwingPromise.then(_ => _ && _[funName]()).then(_ => cb ? cb(_) : _)) :\n // No body parsing method - return the response\n catchersWrapper(throwingPromise.then(_ => cb ? cb(_) : _));\n const responseChain = {\n _wretchReq: wretch,\n _fetchReq,\n _sharedState: sharedState,\n res: bodyParser(null),\n json: bodyParser(\"json\"),\n blob: bodyParser(\"blob\"),\n formData: bodyParser(\"formData\"),\n arrayBuffer: bodyParser(\"arrayBuffer\"),\n text: bodyParser(\"text\"),\n error(errorId, cb) {\n catchers.set(errorId, cb);\n return this;\n },\n badRequest(cb) { return this.error(400, cb); },\n unauthorized(cb) { return this.error(401, cb); },\n forbidden(cb) { return this.error(403, cb); },\n notFound(cb) { return this.error(404, cb); },\n timeout(cb) { return this.error(408, cb); },\n internalError(cb) { return this.error(500, cb); },\n fetchError(cb) { return this.error(FETCH_ERROR, cb); },\n };\n const enhancedResponseChain = addons.reduce((chain, addon) => ({\n ...chain,\n ...(typeof addon.resolver === \"function\" ? addon.resolver(chain) : addon.resolver)\n }), responseChain);\n return resolvers.reduce((chain, r) => r(chain, wretch), enhancedResponseChain);\n};\n//# sourceMappingURL=resolver.js.map","/**\n * @private @internal\n */\nexport const middlewareHelper = (middlewares) => (fetchFunction) => {\n return middlewares.reduceRight((acc, curr) => curr(acc), fetchFunction) || fetchFunction;\n};\n//# sourceMappingURL=middleware.js.map","import { mix, extractContentType, isLikelyJsonMime } from \"./utils.js\";\nimport { JSON_MIME, CONTENT_TYPE_HEADER, CATCHER_FALLBACK } from \"./constants.js\";\nimport { resolver } from \"./resolver.js\";\nimport config from \"./config.js\";\nexport const core = {\n _url: \"\",\n _options: {},\n _config: config,\n _catchers: new Map(),\n _resolvers: [],\n _deferred: [],\n _middlewares: [],\n _addons: [],\n addon(addon) {\n return { ...this, _addons: [...this._addons, addon], ...addon.wretch };\n },\n errorType(errorType) {\n return {\n ...this,\n _config: {\n ...this._config,\n errorType\n }\n };\n },\n polyfills(polyfills, replace = false) {\n return {\n ...this,\n _config: {\n ...this._config,\n polyfills: replace ? polyfills : mix(this._config.polyfills, polyfills)\n }\n };\n },\n url(_url, replace = false) {\n if (replace)\n return { ...this, _url };\n const split = this._url.split(\"?\");\n return {\n ...this,\n _url: split.length > 1 ?\n split[0] + _url + \"?\" + split[1] :\n this._url + _url\n };\n },\n options(options, replace = false) {\n return { ...this, _options: replace ? options : mix(this._options, options) };\n },\n headers(headerValues) {\n const headers = !headerValues ? {} :\n Array.isArray(headerValues) ? Object.fromEntries(headerValues) :\n \"entries\" in headerValues ? Object.fromEntries(headerValues.entries()) :\n headerValues;\n return { ...this, _options: mix(this._options, { headers }) };\n },\n accept(headerValue) {\n return this.headers({ Accept: headerValue });\n },\n content(headerValue) {\n return this.headers({ [CONTENT_TYPE_HEADER]: headerValue });\n },\n auth(headerValue) {\n return this.headers({ Authorization: headerValue });\n },\n catcher(errorId, catcher) {\n const newMap = new Map(this._catchers);\n newMap.set(errorId, catcher);\n return { ...this, _catchers: newMap };\n },\n catcherFallback(catcher) {\n return this.catcher(CATCHER_FALLBACK, catcher);\n },\n resolve(resolver, clear = false) {\n return { ...this, _resolvers: clear ? [resolver] : [...this._resolvers, resolver] };\n },\n defer(callback, clear = false) {\n return {\n ...this,\n _deferred: clear ? [callback] : [...this._deferred, callback]\n };\n },\n middlewares(middlewares, clear = false) {\n return {\n ...this,\n _middlewares: clear ? middlewares : [...this._middlewares, ...middlewares]\n };\n },\n fetch(method = this._options.method, url = \"\", body = null) {\n let base = this.url(url).options({ method });\n // \"Jsonify\" the body if it is an object and if it is likely that the content type targets json.\n const contentType = extractContentType(base._options.headers);\n const jsonify = typeof body === \"object\" && (!base._options.headers || !contentType || isLikelyJsonMime(contentType));\n base =\n !body ? base :\n jsonify ? base.json(body, contentType) :\n base.body(body);\n return resolver(base\n ._deferred\n .reduce((acc, curr) => curr(acc, acc._url, acc._options), base));\n },\n get(url = \"\") {\n return this.fetch(\"GET\", url);\n },\n delete(url = \"\") {\n return this.fetch(\"DELETE\", url);\n },\n put(body, url = \"\") {\n return this.fetch(\"PUT\", url, body);\n },\n post(body, url = \"\") {\n return this.fetch(\"POST\", url, body);\n },\n patch(body, url = \"\") {\n return this.fetch(\"PATCH\", url, body);\n },\n head(url = \"\") {\n return this.fetch(\"HEAD\", url);\n },\n opts(url = \"\") {\n return this.fetch(\"OPTIONS\", url);\n },\n body(contents) {\n return { ...this, _options: { ...this._options, body: contents } };\n },\n json(jsObject, contentType) {\n const currentContentType = extractContentType(this._options.headers);\n return this.content(contentType ||\n isLikelyJsonMime(currentContentType) && currentContentType ||\n JSON_MIME).body(JSON.stringify(jsObject));\n }\n};\n//# sourceMappingURL=core.js.map","import { setOptions, setErrorType, setPolyfills } from \"./config.js\";\nimport { core } from \"./core.js\";\nimport { WretchError } from \"./resolver.js\";\n/**\n * Creates a new wretch instance with a base url and base\n * [fetch options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch).\n *\n * ```ts\n * import wretch from \"wretch\"\n *\n * // Reusable instance\n * const w = wretch(\"https://domain.com\", { mode: \"cors\" })\n * ```\n *\n * @param _url The base url\n * @param _options The base fetch options\n * @returns A fresh wretch instance\n */\nfunction factory(_url = \"\", _options = {}) {\n return { ...core, _url, _options };\n}\nfactory[\"default\"] = factory;\n/** {@inheritDoc setOptions} */\nfactory.options = setOptions;\n/** {@inheritDoc setErrorType} */\nfactory.errorType = setErrorType;\n/** {@inheritDoc setPolyfills} */\nfactory.polyfills = setPolyfills;\nfactory.WretchError = WretchError;\nexport default factory;\n//# sourceMappingURL=index.js.map"],"names":["wretch","options","headers","addon","QueryStringAddon","not","focusableSelectors","moveFocusToDialog","el","querySelector","focus","findFocusableElement","node","forward","isFocusable","shadowRoot","getAttribute","matches","next","getNextChildEl","focusableEl","getNextSiblingEl","localName","assignedElements","flatten","reverse","assignedElement","firstElementChild","lastElementChild","nextElementSibling","previousElementSibling","delegatesFocus","join","offsetWidth","offsetHeight","getClientRects","length","isHidden","getActiveElement","root","document","activeEl","activeElement","A11yDialog","$el","id","previouslyFocused","shown","constructor","element","this","maintainFocus","bind","bindKeypress","handleTriggerClicks","show","hide","setAttribute","hasAttribute","addEventListener","destroy","removeEventListener","replaceWith","cloneNode","fire","event","removeAttribute","tagName","target","type","body","on","handler","off","dispatchEvent","CustomEvent","detail","cancelable","closest","hasOpenPopover","key","preventDefault","firstFocusableChild","lastFocusableChild","first","getFocusableEdges","shiftKey","trapTabKey","instantiateDialogs","querySelectorAll","readyState","handleModal","e","triggerEl","openModal","dataset","modal","title","modalTitle","url","href","updateUrl","modalUpdateUrl","useDefaultClose","undefined","modalDisableDefaultClose","useCustomClose","modalUseCustomClose","handleModalReplace","async","currentModal","modalContent","ajax","get","text","innerHTML","opts","Math","floor","random","Date","now","template","generateTemplate","createRange","createContextualFragment","append","modalEl","getElementById","hideModal","currentUrl","defaultUrl","window","location","documentElement","classList","add","history","replaceState","remove","populateModal","init","clickArgs","replaceClickArgs","tag","createElement","src","firstScriptTag","getElementsByTagName","parentNode","insertBefore","stringify","value","appendQueryParams","qp","replace","config","queryString","usp","polyfill","Array","val","toString","split","query","_url","_config","CONTENT_TYPE_HEADER","FETCH_ERROR","Symbol","CATCHER_FALLBACK","extractContentType","_a","Object","entries","find","k","toLowerCase","isLikelyJsonMime","test","mix","one","two","mergeArrays","reduce","acc","newValue","isArray","errorType","polyfills","p","doThrow","instance","args","res","self","global","Error","WretchError","resolver","sharedState","create","_addons","w","beforeRequest","_options","_catchers","_resolvers","resolvers","_middlewares","middlewares","addons","catchers","Map","finalOptions","finalUrl","_fetchReq","fetchFunction","reduceRight","curr","middlewareHelper","referenceError","throwingPromise","catch","error","then","response","ok","err","stack","message","json","JSON","parse","status","bodyParser","funName","cb","_","fetchErrorFlag","hasOwnProperty","catcher","name","has","catcherFallback","responseChain","_wretchReq","_sharedState","blob","formData","arrayBuffer","errorId","set","badRequest","unauthorized","forbidden","notFound","timeout","internalError","fetchError","enhancedResponseChain","chain","r","core","_deferred","headerValues","fromEntries","accept","headerValue","Accept","content","auth","Authorization","newMap","resolve","clear","defer","callback","fetch","method","base","contentType","jsonify","put","post","patch","head","contents","jsObject","currentContentType","factory"],"sourceRoot":""}