@graupl/core 1.0.0-beta.19 → 1.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/component/badge.css +2 -0
- package/dist/css/component/badge.css.map +1 -0
- package/dist/css/component/disclosure.css +2 -0
- package/dist/css/component/disclosure.css.map +1 -0
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +1 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/layout.css +1 -1
- package/dist/css/layout.css.map +1 -1
- package/dist/js/accordion.js +2 -2
- package/dist/js/accordion.js.map +1 -1
- package/dist/js/alert.js.map +1 -1
- package/dist/js/carousel.js +2 -2
- package/dist/js/carousel.js.map +1 -1
- package/dist/js/component/accordion.cjs.js +2 -2
- package/dist/js/component/accordion.cjs.js.map +1 -1
- package/dist/js/component/accordion.es.js +2 -2
- package/dist/js/component/accordion.es.js.map +1 -1
- package/dist/js/component/accordion.iife.js +2 -2
- package/dist/js/component/accordion.iife.js.map +1 -1
- package/dist/js/component/alert.cjs.js.map +1 -1
- package/dist/js/component/alert.es.js.map +1 -1
- package/dist/js/component/alert.iife.js +2 -2
- package/dist/js/component/alert.iife.js.map +1 -1
- package/dist/js/component/carousel.cjs.js +2 -2
- package/dist/js/component/carousel.cjs.js.map +1 -1
- package/dist/js/component/carousel.es.js +2 -2
- package/dist/js/component/carousel.es.js.map +1 -1
- package/dist/js/component/carousel.iife.js +2 -2
- package/dist/js/component/carousel.iife.js.map +1 -1
- package/dist/js/component/disclosure.cjs.js +5 -0
- package/dist/js/component/disclosure.cjs.js.map +1 -0
- package/dist/js/component/disclosure.es.js +5 -0
- package/dist/js/component/disclosure.es.js.map +1 -0
- package/dist/js/component/disclosure.iife.js +5 -0
- package/dist/js/component/disclosure.iife.js.map +1 -0
- package/dist/js/generator/accordion.cjs.js +2 -2
- package/dist/js/generator/accordion.cjs.js.map +1 -1
- package/dist/js/generator/accordion.es.js +2 -2
- package/dist/js/generator/accordion.es.js.map +1 -1
- package/dist/js/generator/accordion.iife.js +2 -2
- package/dist/js/generator/accordion.iife.js.map +1 -1
- package/dist/js/generator/alert.cjs.js.map +1 -1
- package/dist/js/generator/alert.es.js.map +1 -1
- package/dist/js/generator/alert.iife.js +2 -2
- package/dist/js/generator/alert.iife.js.map +1 -1
- package/dist/js/generator/carousel.cjs.js +2 -2
- package/dist/js/generator/carousel.cjs.js.map +1 -1
- package/dist/js/generator/carousel.es.js +2 -2
- package/dist/js/generator/carousel.es.js.map +1 -1
- package/dist/js/generator/carousel.iife.js +2 -2
- package/dist/js/generator/carousel.iife.js.map +1 -1
- package/dist/js/generator/disclosure.cjs.js +5 -0
- package/dist/js/generator/disclosure.cjs.js.map +1 -0
- package/dist/js/generator/disclosure.es.js +5 -0
- package/dist/js/generator/disclosure.es.js.map +1 -0
- package/dist/js/generator/disclosure.iife.js +5 -0
- package/dist/js/generator/disclosure.iife.js.map +1 -0
- package/dist/js/generator/navigation.cjs.js.map +1 -1
- package/dist/js/generator/navigation.es.js.map +1 -1
- package/dist/js/generator/navigation.iife.js +1 -1
- package/dist/js/generator/navigation.iife.js.map +1 -1
- package/dist/js/graupl.js +6 -4
- package/dist/js/graupl.js.map +1 -1
- package/dist/js/navigation.js.map +1 -1
- package/package.json +1 -1
- package/scss/component/badge.scss +3 -0
- package/scss/component/disclosure.scss +3 -0
- package/src/js/TransactionalValue.js +140 -0
- package/src/js/accordion/Accordion.js +4 -4
- package/src/js/carousel/Carousel.js +1 -1
- package/src/js/disclosure/Disclosure.js +1378 -0
- package/src/js/disclosure/generator.js +47 -0
- package/src/js/disclosure/index.js +5 -0
- package/src/js/main.js +2 -0
- package/src/js/validate.js +7 -7
- package/src/scss/_index.scss +8 -8
- package/src/scss/base/_index.scss +4 -4
- package/src/scss/component/_index.scss +10 -8
- package/src/scss/component/badge/_defaults.scss +47 -0
- package/src/scss/component/badge/_index.scss +201 -0
- package/src/scss/component/badge/_variables.scss +112 -0
- package/src/scss/component/disclosure/_defaults.scss +45 -0
- package/src/scss/component/disclosure/_index.scss +214 -0
- package/src/scss/component/disclosure/_variables.scss +205 -0
- package/src/scss/layout/_index.scss +3 -3
- package/src/scss/theme/_index.scss +2 -2
- package/src/scss/utilities/_index.scss +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.cjs.js","names":["isValidInstance","contructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Alert","once","generate","options","context","document","alertSelector","forEach","alertElement","alertOptions","dataset","grauplAlertOptions","JSON","parse","replace","controllerElement","querySelector","initialize"],"sources":["../../../src/js/validate.js","../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/storage.js","../../../src/js/alert/Alert.js","../../../../../node_modules/@drupal/once/src/once.js","../../../src/js/alert/generator.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific contructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(contructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Alert from \"./Alert.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n alertSelector = \".alert\"\n) => {\n once(\"graupl-alert-generator\", alertSelector, context).forEach(\n (alertElement) => {\n const alertOptions = alertElement.dataset.grauplAlertOptions\n ? JSON.parse(\n alertElement.dataset.grauplAlertOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Alert({\n alertElement,\n controllerElement:\n alertElement.querySelector(\".alert-dismisser\") || null,\n initialize: true,\n ...options,\n ...alertOptions,\n });\n }\n );\n};\n\nexport default generate;\n"],"x_google_ignoreList":[5],"mappings":"AAeA,SAAgBoG,EAAgBnG,EAAYgM,EAAU,CACpD,GAAI,CACF,GAAA,OAAWA,GAAa,SAAU,CAChC,MAAM9L,EAAAA,OAAsB8L,EAE5B,MAAM,IAAIT,UACR,qEAAqErL,CAAAA,UACvE,CACF,CAEA,UAAWgI,KAAO8D,EAChB,GAAA,EAAMA,EAAS9D,CAAAA,YAAgBlI,GAAa,CAC1C,MAAMK,EAAAA,OAAqB2L,EAAS9D,CAAAA,EACpC,MAAM,IAAIqD,UACR,GAAGrD,CAAAA,2BAA8BlI,EAAWM,IAAAA,MAAUD,CAAAA,UACxD,CACF,CAGF,MAAO,CACLkJ,OAAQ,GACRN,MAAO,IACR,CACF,OAAQA,EAAO,CACd,MAAO,CACLM,OAAQ,GACRN,MAAAA,CACD,CACH,CACF,CAiBA,SAAgB7C,EAAYd,EAAM3E,EAAQ,CACxC,GAAI,CACF,GAAA,OAAWA,GAAW,SAAU,CAC9B,MAAMC,EAAAA,OAAoBD,EAE1B,MAAM,IAAI4K,UACR,+DAA+D3K,CAAAA,UACjE,CACF,CAEA,UAAWsH,KAAOvH,EAAQ,CACxB,MAAME,EAAAA,OAAmBF,EAAOuH,CAAAA,EAEhC,GAAIrH,IAAcyE,EAChB,MAAM,IAAIiG,UAAU,GAAGrD,CAAAA,cAAiB5C,CAAAA,MAAUzE,CAAAA,UAAmB,CAEzE,CAEA,MAAO,CACL0I,OAAQ,GACRN,MAAO,IACR,CACF,OAAQA,EAAO,CACd,MAAO,CACLM,OAAQ,GACRN,MAAAA,CACD,CACH,CACF,CAaA,SAAgBnI,EAAgBH,EAAQ,CACtC,GAAI,CACF,GAAA,OAAWA,GAAW,SAAU,CAC9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,EAAgB3B,EAAS,CAAE4B,IAAKxB,CAAI,CAAA,CACnD,CACF,CAoCAsC,EAAKb,OAAS,CAACzB,EAAIQ,EAAUiC,IACpBvB,EACLnB,EAAaC,CAAAA,EACbO,EAAYC,EAAUiC,CAAAA,EACrB7C,GAAY2B,EAAgB3B,EAAS,CAAE6B,OAAQzB,CAAI,CAAA,CACtD,EAoCFsC,EAAKlB,OAAS,CAACpB,EAAIQ,EAAUiC,IAC3BvB,EAAgBnB,EAAaC,CAAAA,EAAKO,EAAYC,EAAUiC,CAAAA,CAAQ,EA6BlEH,EAAKF,KAAO,CAACpC,EAAIyC,IACflC,EAAaP,EAAuBD,EAAaC,CAAAA,EAA/B,IAAIR,CAAAA,IAAgCiD,CAAAA,EAExD,IAAA,EAAeH,EC7Yf,MAAMC,EAAWA,CACfC,EAAU,CAAE,EACZC,EAAUC,SACVC,EAAgB,WACb,CACHL,EAAK,yBAA0BK,EAAeF,CAAAA,EAASG,QACpDC,GAAiB,CAChB,MAAMC,EAAeD,EAAaE,QAAQC,mBACtCC,KAAKC,MACHL,EAAaE,QAAQC,mBAAmBG,QAAQ,KAAM,GAAA,CACxD,GAAK,CAAE,EACP,CAAE,EAEN,IAAId,EAAM,CACRQ,aAAAA,EACAO,kBACEP,EAAaQ,cAAc,kBAAA,GAAuB,KACpDC,WAAY,GACZ,GAAGd,EACH,GAAGM,CACJ,CAAA,CAEL,CAAA,CACD,EAED,IAAA,EAAeP"}
|
|
1
|
+
{"version":3,"file":"alert.cjs.js","names":["isValidInstance","constructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Alert","once","generate","options","context","document","alertSelector","forEach","alertElement","alertOptions","dataset","grauplAlertOptions","JSON","parse","replace","controllerElement","querySelector","initialize"],"sources":["../../../src/js/validate.js","../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/storage.js","../../../src/js/alert/Alert.js","../../../../../node_modules/@drupal/once/src/once.js","../../../src/js/alert/generator.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific constructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} constructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(constructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof constructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${constructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n return tabbableElements;\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(element, context = document) {\n const tabbableElements = selectAllFocusableElements(context);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Alert from \"./Alert.js\";\nimport once from \"@drupal/once\";\n\nconst generate = (\n options = {},\n context = document,\n alertSelector = \".alert\"\n) => {\n once(\"graupl-alert-generator\", alertSelector, context).forEach(\n (alertElement) => {\n const alertOptions = alertElement.dataset.grauplAlertOptions\n ? JSON.parse(\n alertElement.dataset.grauplAlertOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n new Alert({\n alertElement,\n controllerElement:\n alertElement.querySelector(\".alert-dismisser\") || null,\n initialize: true,\n ...options,\n ...alertOptions,\n });\n }\n );\n};\n\nexport default generate;\n"],"x_google_ignoreList":[5],"mappings":"AAeA,SAAgBoG,EAAgBuB,EAAasE,EAAU,CACrD,GAAI,CACF,GAAI,OAAOA,GAAa,SAAU,CAChC,MAAM9L,EAAe,OAAO8L,EAE5B,MAAM,IAAIT,UACR,qEAAqErL,CAAAA,UAAY,EAIrF,UAAWgI,KAAO8D,EAChB,GAAI,EAAEA,EAAS9D,CAAAA,YAAgBR,GAAc,CAC3C,MAAMrH,EAAc,OAAO2L,EAAS9D,CAAAA,EACpC,MAAM,IAAIqD,UACR,GAAGrD,CAAAA,2BAA8BR,EAAYpH,IAAAA,M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