{"version":3,"file":"all.bundle.mjs","sources":["../../src/govuk/common/govuk-frontend-version.mjs","../../src/govuk/common/normalise-string.mjs","../../src/govuk/common/index.mjs","../../src/govuk/common/normalise-dataset.mjs","../../src/govuk/errors/index.mjs","../../src/govuk/govuk-frontend-component.mjs","../../src/govuk/i18n.mjs","../../src/govuk/components/accordion/accordion.mjs","../../src/govuk/components/button/button.mjs","../../src/govuk/components/checkboxes/checkboxes.mjs","../../src/govuk/components/error-summary/error-summary.mjs","../../src/govuk/components/file-upload/file-upload.mjs","../../src/govuk/components/header/header.mjs","../../src/govuk/components/notification-banner/notification-banner.mjs","../../src/govuk/components/radios/radios.mjs","../../src/govuk/components/textarea/textarea.mjs","../../src/govuk/all.mjs"],"sourcesContent":["/*\n * This variable is automatically overwritten during builds and releases.\n * It doesn't need to be updated manually.\n */\n\n/**\n * GOV.UK Frontend release version\n *\n * {@link https://github.com/alphagov/govuk-frontend/releases}\n */\nexport const version = 'development'\n","/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @internal\n * @param {DOMStringMap[string]} value - The value to normalise\n * @param {SchemaProperty} [property] - Component schema property\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString(value, property) {\n  const trimmedValue = value ? value.trim() : ''\n\n  let output\n  let outputType = property?.type\n\n  // No schema type set? Determine automatically\n  if (!outputType) {\n    if (['true', 'false'].includes(trimmedValue)) {\n      outputType = 'boolean'\n    }\n\n    // Empty / whitespace-only strings are considered finite so we need to check\n    // the length of the trimmed string as well\n    if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n      outputType = 'number'\n    }\n  }\n\n  switch (outputType) {\n    case 'boolean':\n      output = trimmedValue === 'true'\n      break\n\n    case 'number':\n      output = Number(trimmedValue)\n      break\n\n    default:\n      output = value\n  }\n\n  return output\n}\n\n/**\n * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty\n */\n","import { normaliseString } from './normalise-string.mjs'\n\n/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Config merging function\n *\n * Takes any number of objects and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge\n * @returns {{ [key: string]: unknown }} A merged config object\n */\nexport function mergeConfigs(...configObjects) {\n  // Start with an empty object as our base\n  /** @type {{ [key: string]: unknown }} */\n  const formattedConfigObject = {}\n\n  // Loop through each of the passed objects\n  for (const configObject of configObjects) {\n    for (const key of Object.keys(configObject)) {\n      const option = formattedConfigObject[key]\n      const override = configObject[key]\n\n      // Push their keys one-by-one into formattedConfigObject. Any duplicate\n      // keys with object values will be merged, otherwise the new value will\n      // override the existing value.\n      if (isObject(option) && isObject(override)) {\n        // @ts-expect-error Index signature for type 'string' is missing\n        formattedConfigObject[key] = mergeConfigs(option, override)\n      } else {\n        // Apply override\n        formattedConfigObject[key] = override\n      }\n    }\n  }\n\n  return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from dataset ('data-*')\n * object, removing the namespace in the process, normalising all values\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - The object to extract key-value pairs from\n * @param {string} namespace - The namespace to filter keys with\n * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(Component, dataset, namespace) {\n  const property = Component.schema.properties[namespace]\n\n  // Only extract configs for object schema properties\n  if (property?.type !== 'object') {\n    return\n  }\n\n  // Add default empty config\n  const newObject = {\n    [namespace]: /** @type {ObjectNested} */ ({})\n  }\n\n  for (const [key, value] of Object.entries(dataset)) {\n    /** @type {ObjectNested | ObjectNested[NestedKey]} */\n    let current = newObject\n\n    // Split the key into parts, using . as our namespace separator\n    const keyParts = key.split('.')\n\n    /**\n     * Create new level per part\n     *\n     * e.g. 'i18n.textareaDescription.other' becomes\n     * `{ i18n: { textareaDescription: { other } } }`\n     */\n    for (const [index, name] of keyParts.entries()) {\n      if (typeof current === 'object') {\n        // Drop down to nested object until the last part\n        if (index < keyParts.length - 1) {\n          // New nested object (optionally) replaces existing value\n          if (!isObject(current[name])) {\n            current[name] = {}\n          }\n\n          // Drop down into new or existing nested object\n          current = current[name]\n        } else if (key !== namespace) {\n          // Normalised value (optionally) replaces existing value\n          current[name] = normaliseString(value)\n        }\n      }\n    }\n  }\n\n  return newObject[namespace]\n}\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n  if (!url.includes('#')) {\n    return undefined\n  }\n\n  return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n  const property = `--govuk-frontend-breakpoint-${name}`\n\n  // Get value from `<html>` with breakpoints on CSS :root\n  const value = window\n    .getComputedStyle(document.documentElement)\n    .getPropertyValue(property)\n\n  return {\n    property,\n    value: value || undefined\n  }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n  const isFocusable = $element.getAttribute('tabindex')\n\n  if (!isFocusable) {\n    $element.setAttribute('tabindex', '-1')\n  }\n\n  /**\n   * Handle element focus\n   */\n  function onFocus() {\n    $element.addEventListener('blur', onBlur, { once: true })\n  }\n\n  /**\n   * Handle element blur\n   */\n  function onBlur() {\n    options.onBlur?.call($element)\n\n    if (!isFocusable) {\n      $element.removeAttribute('tabindex')\n    }\n  }\n\n  // Add listener to reset element on blur, after focus\n  $element.addEventListener('focus', onFocus, { once: true })\n\n  // Focus element\n  options.onBeforeFocus?.call($element)\n  $element.focus()\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @internal\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n  if (!$scope) {\n    return false\n  }\n\n  return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Validate component config by schema\n *\n * Follows limited examples in JSON schema for wider support in future\n *\n * {@link https://ajv.js.org/json-schema.html#compound-keywords}\n * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}\n *\n * @internal\n * @param {Schema} schema - Config schema\n * @param {{ [key: string]: unknown }} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n  const validationErrors = []\n\n  // Check errors for each schema\n  for (const [name, conditions] of Object.entries(schema)) {\n    const errors = []\n\n    // Check errors for each schema condition\n    if (Array.isArray(conditions)) {\n      for (const { required, errorMessage } of conditions) {\n        if (!required.every((key) => !!config[key])) {\n          errors.push(errorMessage) // Missing config key value\n        }\n      }\n\n      // Check one condition passes or add errors\n      if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n        validationErrors.push(...errors)\n      }\n    }\n  }\n\n  return validationErrors\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n  return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an object\n */\nfunction isObject(option) {\n  return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Schema for component config\n *\n * @typedef {object} Schema\n * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties\n * @property {SchemaCondition[]} [anyOf] - List of schema conditions\n */\n\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n\n/**\n * Schema condition for component config\n *\n * @typedef {object} SchemaCondition\n * @property {string[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n\n/**\n * @internal\n * @typedef {keyof ObjectNested} NestedKey\n * @typedef {{ [key: string]: string | boolean | number | ObjectNested | undefined }} ObjectNested\n */\n","import { extractConfigByNamespace } from './index.mjs'\nimport { normaliseString } from './normalise-string.mjs'\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using {@link normaliseString},\n * optionally expanding nested `i18n.field`\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {ObjectNested} Normalised dataset\n */\nexport function normaliseDataset(Component, dataset) {\n  const out = /** @type {ReturnType<typeof normaliseDataset>} */ ({})\n\n  // Normalise top-level dataset ('data-*') values using schema types\n  for (const [field, property] of Object.entries(Component.schema.properties)) {\n    if (field in dataset) {\n      out[field] = normaliseString(dataset[field], property)\n    }\n\n    /**\n     * Extract and normalise nested object values automatically using\n     * {@link normaliseString} but only schema object types are allowed\n     */\n    if (property?.type === 'object') {\n      out[field] = extractConfigByNamespace(Component, dataset, field)\n    }\n  }\n\n  return out\n}\n\n/**\n * @internal\n * @typedef {import('./index.mjs').ObjectNested} ObjectNested\n * @typedef {import('./index.mjs').Schema} Schema\n */\n","/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n *   // Setting an explicit name is important as extending the class will not\n *   // set a new `name` on the subclass. The `name` property is important\n *   // to ensure intelligible error names even if the class name gets\n *   // mangled by a minifier\n *   name = \"MissingRootError\"\n * }\n * ```\n * @abstract\n */\nexport class GOVUKFrontendError extends Error {\n  name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n  name = 'SupportError'\n\n  /**\n   * Checks if GOV.UK Frontend is supported on this page\n   *\n   * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n   */\n  constructor($scope = document.body) {\n    const supportMessage =\n      'noModule' in HTMLScriptElement.prototype\n        ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n        : 'GOV.UK Frontend is not supported in this browser'\n\n    super(\n      $scope\n        ? supportMessage\n        : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n    )\n  }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n  name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n  name = 'ElementError'\n\n  /**\n   * @internal\n   * @overload\n   * @param {string} message - Element error message\n   */\n\n  /**\n   * @internal\n   * @overload\n   * @param {ElementErrorOptions} options - Element error options\n   */\n\n  /**\n   * @internal\n   * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n   */\n  constructor(messageOrOptions) {\n    let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n    // Build message from options\n    if (typeof messageOrOptions === 'object') {\n      const { componentName, identifier, element, expectedType } =\n        messageOrOptions\n\n      // Add prefix and identifier\n      message = `${componentName}: ${identifier}`\n\n      // Append reason\n      message += element\n        ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n        : ' not found'\n    }\n\n    super(message)\n  }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} componentName - The name of the component throwing the error\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n */\n","import { isSupported } from './common/index.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @internal\n * @abstract\n */\nexport class GOVUKFrontendComponent {\n  /**\n   * Constructs a new component, validating that GOV.UK Frontend is supported\n   *\n   * @internal\n   */\n  constructor() {\n    this.checkSupport()\n  }\n\n  /**\n   * Validates whether GOV.UK Frontend is supported\n   *\n   * @private\n   * @throws {SupportError} when GOV.UK Frontend is not supported\n   */\n  checkSupport() {\n    if (!isSupported()) {\n      throw new SupportError()\n    }\n  }\n}\n","/**\n * Internal support for selecting messages to render, with placeholder\n * interpolation and locale-aware number formatting and pluralisation\n *\n * @internal\n */\nexport class I18n {\n  translations\n  locale\n\n  /**\n   * @internal\n   * @param {{ [key: string]: string | TranslationPluralForms }} translations - Key-value pairs of the translation strings to use.\n   * @param {object} [config] - Configuration options for the function.\n   * @param {string | null} [config.locale] - An overriding locale for the PluralRules functionality.\n   */\n  constructor(translations = {}, config = {}) {\n    // Make list of translations available throughout function\n    this.translations = translations\n\n    // The locale to use for PluralRules and NumberFormat\n    this.locale = config.locale ?? (document.documentElement.lang || 'en')\n  }\n\n  /**\n   * The most used function - takes the key for a given piece of UI text and\n   * returns the appropriate string.\n   *\n   * @internal\n   * @param {string} lookupKey - The lookup key of the string to use.\n   * @param {{ [key: string]: unknown }} [options] - Any options passed with the translation string, e.g: for string interpolation.\n   * @returns {string} The appropriate translation string.\n   * @throws {Error} Lookup key required\n   * @throws {Error} Options required for `${}` placeholders\n   */\n  t(lookupKey, options) {\n    if (!lookupKey) {\n      // Print a console error if no lookup key has been provided\n      throw new Error('i18n: lookup key missing')\n    }\n\n    // Fetch the translation for that lookup key\n    let translation = this.translations[lookupKey]\n\n    // If the `count` option is set, determine which plural suffix is needed and\n    // change the lookupKey to match. We check to see if it's numeric instead of\n    // falsy, as this could legitimately be 0.\n    if (typeof options?.count === 'number' && typeof translation === 'object') {\n      const translationPluralForm =\n        translation[this.getPluralSuffix(lookupKey, options.count)]\n\n      // Update translation with plural suffix\n      if (translationPluralForm) {\n        translation = translationPluralForm\n      }\n    }\n\n    if (typeof translation === 'string') {\n      // Check for ${} placeholders in the translation string\n      if (translation.match(/%{(.\\S+)}/)) {\n        if (!options) {\n          throw new Error(\n            'i18n: cannot replace placeholders in string if no option data provided'\n          )\n        }\n\n        return this.replacePlaceholders(translation, options)\n      }\n\n      return translation\n    }\n\n    // If the key wasn't found in our translations object,\n    // return the lookup key itself as the fallback\n    return lookupKey\n  }\n\n  /**\n   * Takes a translation string with placeholders, and replaces the placeholders\n   * with the provided data\n   *\n   * @internal\n   * @param {string} translationString - The translation string\n   * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.\n   * @returns {string} The translation string to output, with $\\{\\} placeholders replaced\n   */\n  replacePlaceholders(translationString, options) {\n    const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length\n      ? new Intl.NumberFormat(this.locale)\n      : undefined\n\n    return translationString.replace(\n      /%{(.\\S+)}/g,\n\n      /**\n       * Replace translation string placeholders\n       *\n       * @internal\n       * @param {string} placeholderWithBraces - Placeholder with braces\n       * @param {string} placeholderKey - Placeholder key\n       * @returns {string} Placeholder value\n       */\n      function (placeholderWithBraces, placeholderKey) {\n        if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n          const placeholderValue = options[placeholderKey]\n\n          // If a user has passed `false` as the value for the placeholder\n          // treat it as though the value should not be displayed\n          if (\n            placeholderValue === false ||\n            (typeof placeholderValue !== 'number' &&\n              typeof placeholderValue !== 'string')\n          ) {\n            return ''\n          }\n\n          // If the placeholder's value is a number, localise the number formatting\n          if (typeof placeholderValue === 'number') {\n            return formatter\n              ? formatter.format(placeholderValue)\n              : `${placeholderValue}`\n          }\n\n          return placeholderValue\n        }\n\n        throw new Error(\n          `i18n: no data found to replace ${placeholderWithBraces} placeholder in string`\n        )\n      }\n    )\n  }\n\n  /**\n   * Check to see if the browser supports Intl.PluralRules\n   *\n   * It requires all conditions to be met in order to be supported:\n   * - The implementation of Intl supports PluralRules (NOT true in Safari 10–12)\n   * - The browser/OS has plural rules for the current locale (browser dependent)\n   *\n   * {@link https://browsersl.ist/#q=supports+es6-module+and+not+supports+intl-pluralrules}\n   *\n   * @internal\n   * @returns {boolean} Returns true if all conditions are met. Returns false otherwise.\n   */\n  hasIntlPluralRulesSupport() {\n    return Boolean(\n      'PluralRules' in window.Intl &&\n        Intl.PluralRules.supportedLocalesOf(this.locale).length\n    )\n  }\n\n  /**\n   * Get the appropriate suffix for the plural form.\n   *\n   * Uses Intl.PluralRules (or our own fallback implementation) to get the\n   * 'preferred' form to use for the given count.\n   *\n   * Checks that a translation has been provided for that plural form – if it\n   * hasn't, it'll fall back to the 'other' plural form (unless that doesn't exist\n   * either, in which case an error will be thrown)\n   *\n   * @internal\n   * @param {string} lookupKey - The lookup key of the string to use.\n   * @param {number} count - Number used to determine which pluralisation to use.\n   * @returns {PluralRule} The suffix associated with the correct pluralisation for this locale.\n   * @throws {Error} Plural form `.other` required when preferred plural form is missing\n   */\n  getPluralSuffix(lookupKey, count) {\n    // Validate that the number is actually a number.\n    //\n    // Number(count) will turn anything that can't be converted to a Number type\n    // into 'NaN'. isFinite filters out NaN, as it isn't a finite number.\n    count = Number(count)\n    if (!isFinite(count)) {\n      return 'other'\n    }\n\n    // Fetch the translation for that lookup key\n    const translation = this.translations[lookupKey]\n\n    // Check to verify that all the requirements for Intl.PluralRules are met.\n    // If so, we can use that instead of our custom implementation. Otherwise,\n    // use the hardcoded fallback.\n    const preferredForm = this.hasIntlPluralRulesSupport()\n      ? new Intl.PluralRules(this.locale).select(count)\n      : this.selectPluralFormUsingFallbackRules(count)\n\n    // Use the correct plural form if provided\n    if (typeof translation === 'object') {\n      if (preferredForm in translation) {\n        return preferredForm\n        // Fall back to `other` if the plural form is missing, but log a warning\n        // to the console\n      } else if ('other' in translation) {\n        console.warn(\n          `i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`\n        )\n\n        return 'other'\n      }\n    }\n\n    // If the required `other` plural form is missing, all we can do is error\n    throw new Error(\n      `i18n: Plural form \".other\" is required for \"${this.locale}\" locale`\n    )\n  }\n\n  /**\n   * Get the plural form using our fallback implementation\n   *\n   * This is split out into a separate function to make it easier to test the\n   * fallback behaviour in an environment where Intl.PluralRules exists.\n   *\n   * @internal\n   * @param {number} count - Number used to determine which pluralisation to use.\n   * @returns {PluralRule} The pluralisation form for count in this locale.\n   */\n  selectPluralFormUsingFallbackRules(count) {\n    // Currently our custom code can only handle positive integers, so let's\n    // make sure our number is one of those.\n    count = Math.abs(Math.floor(count))\n\n    const ruleset = this.getPluralRulesForLocale()\n\n    if (ruleset) {\n      return I18n.pluralRules[ruleset](count)\n    }\n\n    return 'other'\n  }\n\n  /**\n   * Work out which pluralisation rules to use for the current locale\n   *\n   * The locale may include a regional indicator (such as en-GB), but we don't\n   * usually care about this part, as pluralisation rules are usually the same\n   * regardless of region. There are exceptions, however, (e.g. Portuguese) so\n   * this searches by both the full and shortened locale codes, just to be sure.\n   *\n   * @internal\n   * @returns {string | undefined} The name of the pluralisation rule to use (a key for one\n   *   of the functions in this.pluralRules)\n   */\n  getPluralRulesForLocale() {\n    const localeShort = this.locale.split('-')[0]\n\n    // Look through the plural rules map to find which `pluralRule` is\n    // appropriate for our current `locale`.\n    for (const pluralRule in I18n.pluralRulesMap) {\n      const languages = I18n.pluralRulesMap[pluralRule]\n      if (languages.includes(this.locale) || languages.includes(localeShort)) {\n        return pluralRule\n      }\n    }\n  }\n\n  /**\n   * Map of plural rules to languages where those rules apply.\n   *\n   * Note: These groups are named for the most dominant or recognisable language\n   * that uses each system. The groupings do not imply that the languages are\n   * related to one another. Many languages have evolved the same systems\n   * independently of one another.\n   *\n   * Code to support more languages can be found in the i18n spike:\n   * {@link https://github.com/alphagov/govuk-frontend/blob/spike-i18n-support/src/govuk/i18n.mjs}\n   *\n   * Languages currently supported:\n   *\n   * Arabic: Arabic (ar)\n   * Chinese: Burmese (my), Chinese (zh), Indonesian (id), Japanese (ja),\n   *   Javanese (jv), Korean (ko), Malay (ms), Thai (th), Vietnamese (vi)\n   * French: Armenian (hy), Bangla (bn), French (fr), Gujarati (gu), Hindi (hi),\n   *   Persian Farsi (fa), Punjabi (pa), Zulu (zu)\n   * German: Afrikaans (af), Albanian (sq), Azerbaijani (az), Basque (eu),\n   *   Bulgarian (bg), Catalan (ca), Danish (da), Dutch (nl), English (en),\n   *   Estonian (et), Finnish (fi), Georgian (ka), German (de), Greek (el),\n   *   Hungarian (hu), Luxembourgish (lb), Norwegian (no), Somali (so),\n   *   Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Turkish (tr),\n   *   Urdu (ur)\n   * Irish: Irish Gaelic (ga)\n   * Russian: Russian (ru), Ukrainian (uk)\n   * Scottish: Scottish Gaelic (gd)\n   * Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)\n   * Welsh: Welsh (cy)\n   *\n   * @internal\n   * @type {{ [key: string]: string[] }}\n   */\n  static pluralRulesMap = {\n    arabic: ['ar'],\n    chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],\n    french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],\n    german: [\n      'af',\n      'sq',\n      'az',\n      'eu',\n      'bg',\n      'ca',\n      'da',\n      'nl',\n      'en',\n      'et',\n      'fi',\n      'ka',\n      'de',\n      'el',\n      'hu',\n      'lb',\n      'no',\n      'so',\n      'sw',\n      'sv',\n      'ta',\n      'te',\n      'tr',\n      'ur'\n    ],\n    irish: ['ga'],\n    russian: ['ru', 'uk'],\n    scottish: ['gd'],\n    spanish: ['pt-PT', 'it', 'es'],\n    welsh: ['cy']\n  }\n\n  /**\n   * Different pluralisation rule sets\n   *\n   * Returns the appropriate suffix for the plural form associated with `n`.\n   * Possible suffixes: 'zero', 'one', 'two', 'few', 'many', 'other' (the actual\n   * meaning of each differs per locale). 'other' should always exist, even in\n   * languages without plurals, such as Chinese.\n   * {@link https://cldr.unicode.org/index/cldr-spec/plural-rules}\n   *\n   * The count must be a positive integer. Negative numbers and decimals aren't accounted for\n   *\n   * @internal\n   * @type {{ [key: string]: (count: number) => PluralRule }}\n   */\n  static pluralRules = {\n    arabic(n) {\n      if (n === 0) {\n        return 'zero'\n      }\n      if (n === 1) {\n        return 'one'\n      }\n      if (n === 2) {\n        return 'two'\n      }\n      if (n % 100 >= 3 && n % 100 <= 10) {\n        return 'few'\n      }\n      if (n % 100 >= 11 && n % 100 <= 99) {\n        return 'many'\n      }\n      return 'other'\n    },\n    chinese() {\n      return 'other'\n    },\n    french(n) {\n      return n === 0 || n === 1 ? 'one' : 'other'\n    },\n    german(n) {\n      return n === 1 ? 'one' : 'other'\n    },\n    irish(n) {\n      if (n === 1) {\n        return 'one'\n      }\n      if (n === 2) {\n        return 'two'\n      }\n      if (n >= 3 && n <= 6) {\n        return 'few'\n      }\n      if (n >= 7 && n <= 10) {\n        return 'many'\n      }\n      return 'other'\n    },\n    russian(n) {\n      const lastTwo = n % 100\n      const last = lastTwo % 10\n      if (last === 1 && lastTwo !== 11) {\n        return 'one'\n      }\n      if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {\n        return 'few'\n      }\n      if (\n        last === 0 ||\n        (last >= 5 && last <= 9) ||\n        (lastTwo >= 11 && lastTwo <= 14)\n      ) {\n        return 'many'\n      }\n      // Note: The 'other' suffix is only used by decimal numbers in Russian.\n      // We don't anticipate it being used, but it's here for consistency.\n      return 'other'\n    },\n    scottish(n) {\n      if (n === 1 || n === 11) {\n        return 'one'\n      }\n      if (n === 2 || n === 12) {\n        return 'two'\n      }\n      if ((n >= 3 && n <= 10) || (n >= 13 && n <= 19)) {\n        return 'few'\n      }\n      return 'other'\n    },\n    spanish(n) {\n      if (n === 1) {\n        return 'one'\n      }\n      if (n % 1000000 === 0 && n !== 0) {\n        return 'many'\n      }\n      return 'other'\n    },\n    welsh(n) {\n      if (n === 0) {\n        return 'zero'\n      }\n      if (n === 1) {\n        return 'one'\n      }\n      if (n === 2) {\n        return 'two'\n      }\n      if (n === 3) {\n        return 'few'\n      }\n      if (n === 6) {\n        return 'many'\n      }\n      return 'other'\n    }\n  }\n}\n\n/**\n * Plural rule category mnemonic tags\n *\n * @internal\n * @typedef {'zero' | 'one' | 'two' | 'few' | 'many' | 'other'} PluralRule\n */\n\n/**\n * Translated message by plural rule they correspond to.\n *\n * Allows to group pluralised messages under a single key when passing\n * translations to a component's constructor\n *\n * @internal\n * @typedef {object} TranslationPluralForms\n * @property {string} [other] - General plural form\n * @property {string} [zero] - Plural form used with 0\n * @property {string} [one] - Plural form used with 1\n * @property {string} [two] - Plural form used with 2\n * @property {string} [few] - Plural form used for a few\n * @property {string} [many] - Plural form used for many\n */\n","import { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Accordion component\n *\n * This allows a collection of sections to be collapsed by default, showing only\n * their headers. Sections can be expanded or collapsed individually by clicking\n * their headers. A \"Show all sections\" button is also added to the top of the\n * accordion, which switches to \"Hide all sections\" when all the sections are\n * expanded.\n *\n * The state of each section is saved to the DOM via the `aria-expanded`\n * attribute, which also provides accessibility.\n *\n * @preserve\n */\nexport class Accordion extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * @private\n   * @type {AccordionConfig}\n   */\n  config\n\n  /** @private */\n  i18n\n\n  /** @private */\n  controlsClass = 'govuk-accordion__controls'\n\n  /** @private */\n  showAllClass = 'govuk-button govuk-button--texted'\n\n  /** @private */\n  showAllTextClass = ''\n\n  /** @private */\n  sectionClass = 'govuk-accordion__section'\n\n  /** @private */\n  sectionExpandedClass = 'govuk-accordion__section--expanded'\n\n  /** @private */\n  sectionButtonClass = 'govuk-accordion__section-button'\n\n  /** @private */\n  sectionHeaderClass = 'govuk-accordion__section-header'\n\n  /** @private */\n  sectionHeadingClass = 'govuk-accordion__section-heading'\n\n  /** @private */\n  sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider'\n\n  /** @private */\n  sectionHeadingTextClass = 'govuk-accordion__section-heading-text'\n\n  /** @private */\n  sectionHeadingTextFocusClass = 'govuk-accordion__section-heading-text-focus'\n\n  /** @private */\n  sectionShowHideToggleClass = 'govuk-accordion__section-toggle'\n\n  /** @private */\n  // sectionShowHideToggleFocusClass = 'govuk-accordion__section-toggle-focus'\n\n  /** @private */\n  sectionShowHideTextClass = 'material-icons'\n\n  /** @private */\n  sectionSummaryClass = 'govuk-accordion__section-summary'\n\n  /** @private */\n  // sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus'\n\n  /** @private */\n  sectionContentClass = 'govuk-accordion__section-content'\n\n  /** @private */\n  $sections\n\n  /** @private */\n  browserSupportsSessionStorage = false\n\n  /**\n   * @private\n   * @type {HTMLButtonElement | null}\n   */\n  $showAllButton = null\n\n  /**\n   * @private\n   * @type {HTMLElement | null}\n   */\n  $showAllText = null\n\n  /**\n   * @param {Element | null} $module - HTML element to use for accordion\n   * @param {AccordionConfig} [config] - Accordion config\n   */\n  constructor($module, config = {}) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Accordion',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    this.config = mergeConfigs(\n      Accordion.defaults,\n      config,\n      normaliseDataset(Accordion, $module.dataset)\n    )\n\n    this.i18n = new I18n(this.config.i18n)\n\n    const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`)\n    if (!$sections.length) {\n      throw new ElementError({\n        componentName: 'Accordion',\n        identifier: `Sections (\\`<div class=\"${this.sectionClass}\">\\`)`\n      })\n    }\n\n    this.$sections = $sections\n    this.browserSupportsSessionStorage = helper.checkForSessionStorage()\n\n    this.initControls()\n    this.initSectionHeaders()\n\n    // See if \"Show all sections\" button text should be updated\n    const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n    this.updateShowAllButton(areAllSectionsOpen)\n  }\n\n  /**\n   * Initialise controls and set attributes\n   *\n   * @private\n   */\n  initControls() {\n    // Create \"Show all\" button and set attributes\n    this.$showAllButton = document.createElement('button')\n    this.$showAllButton.setAttribute('type', 'button')\n    this.$showAllButton.setAttribute('class', this.showAllClass)\n    this.$showAllButton.setAttribute('aria-expanded', 'false')\n\n    // Create icon, add to element\n    // this.$showAllIcon = document.createElement('span')\n    // this.$showAllButton.appendChild(this.$showAllIcon)\n\n    // Create control wrapper and add controls to it\n    const $accordionControls = document.createElement('div')\n    $accordionControls.setAttribute('class', this.controlsClass)\n    $accordionControls.appendChild(this.$showAllButton)\n    this.$module.insertBefore($accordionControls, this.$module.firstChild)\n\n    // Build additional wrapper for Show all toggle text and place after icon\n    this.$showAllText = document.createElement('span')\n    if (this.showAllTextClass) {\n      this.$showAllText.classList.add(this.showAllTextClass)\n    }\n    this.$showAllButton.appendChild(this.$showAllText)\n\n    // Handle click events on the show/hide all button\n    this.$showAllButton.addEventListener('click', () =>\n      this.onShowOrHideAllToggle()\n    )\n\n    // Handle 'beforematch' events, if the user agent supports them\n    if ('onbeforematch' in document) {\n      document.addEventListener('beforematch', (event) =>\n        this.onBeforeMatch(event)\n      )\n    }\n  }\n\n  /**\n   * Initialise section headers\n   *\n   * @private\n   */\n  initSectionHeaders() {\n    this.$sections.forEach(($section, i) => {\n      const $header = $section.querySelector(`.${this.sectionHeaderClass}`)\n      if (!$header) {\n        throw new ElementError({\n          componentName: 'Accordion',\n          identifier: `Section headers (\\`<div class=\"${this.sectionHeaderClass}\">\\`)`\n        })\n      }\n\n      // Set header attributes\n      this.constructHeaderMarkup($header, i)\n      this.setExpanded(this.isExpanded($section), $section)\n\n      // Handle events\n      $header.addEventListener('click', () => this.onSectionToggle($section))\n\n      // See if there is any state stored in sessionStorage and set the sections\n      // to open or closed.\n      this.setInitialState($section)\n    })\n  }\n\n  /**\n   * Construct section header\n   *\n   * @private\n   * @param {Element} $header - Section header\n   * @param {number} index - Section index\n   */\n  constructHeaderMarkup($header, index) {\n    const $span = $header.querySelector(`.${this.sectionButtonClass}`)\n    const $heading = $header.querySelector(`.${this.sectionHeadingClass}`)\n    const $summary = $header.querySelector(`.${this.sectionSummaryClass}`)\n\n    if (!$heading) {\n      throw new ElementError({\n        componentName: 'Accordion',\n        identifier: `Section heading (\\`.${this.sectionHeadingClass}\\`)`\n      })\n    }\n\n    if (!$span) {\n      throw new ElementError({\n        componentName: 'Accordion',\n        identifier: `Section button placeholder (\\`<span class=\"${this.sectionButtonClass}\">\\`)`\n      })\n    }\n\n    // Create a button element that will replace the\n    // '.govuk-accordion__section-button' span\n    const $button = document.createElement('button')\n    $button.setAttribute('type', 'button')\n    $button.setAttribute(\n      'aria-controls',\n      `${this.$module.id}-content-${index + 1}`\n    )\n\n    // Copy all attributes from $span to $button (except `id`, which gets added\n    // to the `$headingText` element)\n    for (const attr of Array.from($span.attributes)) {\n      if (attr.nodeName !== 'id') {\n        $button.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n      }\n    }\n\n    // Create container for heading text so it can be styled\n    const $headingText = document.createElement('span')\n    $headingText.classList.add(this.sectionHeadingTextClass)\n    // Copy the span ID to the heading text to allow it to be referenced by\n    // `aria-labelledby` on the hidden content area without \"Show this section\"\n    $headingText.id = $span.id\n\n    // Create an inner heading text container to limit the width of the focus\n    // state\n    const $headingTextFocus = document.createElement('span')\n    $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass)\n    $headingText.appendChild($headingTextFocus)\n    // span could contain HTML elements\n    // (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)\n    $headingTextFocus.innerHTML = $span.innerHTML\n\n    // Create container for show / hide icons and text.\n    const $showHideToggle = document.createElement('span')\n    $showHideToggle.classList.add(this.sectionShowHideToggleClass)\n    // Tell Google not to index the 'show' text as part of the heading. Must be\n    // set on the element before it's added to the DOM.\n    // See https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr\n    $showHideToggle.setAttribute('data-nosnippet', '')\n    // Create an inner container to limit the width of the focus state\n    // const $showHideToggleFocus = document.createElement('span')\n    // $showHideToggleFocus.classList.add(this.sectionShowHideToggleFocusClass)\n    // $showHideToggle.appendChild($showHideToggleFocus)\n    // Create wrapper for the show / hide text. Append text after the show/hide icon\n    const $showHideText = document.createElement('span')\n    // const $showHideIcon = document.createElement('span')\n    // $showHideIcon.textContent = 'add'\n    // $showHideIcon.classList.add('material-icons')\n    // $showHideToggleFocus.appendChild($showHideIcon)\n    $showHideText.classList.add(this.sectionShowHideTextClass)\n    $showHideText.ariaHidden = 'true'\n    // $showHideToggleFocus.appendChild($showHideText)\n    $showHideToggle.appendChild($showHideText)\n\n    // Append elements to the button:\n    // 1. Heading text\n    // 2. Punctuation\n    // 3. (Optional: Summary line followed by punctuation)\n    // 4. Show / hide toggle\n    $button.appendChild($headingText)\n    $button.appendChild(this.getButtonPunctuationEl())\n\n    // If summary content exists add to DOM in correct order\n    if ($summary?.parentNode) {\n      // Create a new `span` element and copy the summary line content from the\n      // original `div` to the new `span`. This is because the summary line text\n      // is now inside a button element, which can only contain phrasing\n      // content.\n      const $summarySpan = document.createElement('span')\n      // Create an inner summary container to limit the width of the summary\n      // focus state\n      const $summarySpanFocus = document.createElement('span')\n      // $summarySpanFocus.classList.add(this.sectionSummaryFocusClass)\n      // $summarySpan.appendChild($summarySpanFocus)\n\n      // Get original attributes, and pass them to the replacement\n      for (const attr of Array.from($summary.attributes)) {\n        $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n      }\n\n      // Copy original contents of summary to the new summary span\n      $summarySpanFocus.innerHTML = $summary.innerHTML\n\n      // Replace the original summary `div` with the new summary `span`\n      // $summary.parentNode.replaceChild($summarySpan, $summary)\n\n      // $button.appendChild($summarySpan)\n      $button.appendChild(this.getButtonPunctuationEl())\n    }\n\n    $button.appendChild($showHideToggle)\n\n    $heading.removeChild($span)\n    $heading.appendChild($button)\n    // $headingWrapper.appendChild($summary)\n  }\n\n  /**\n   * When a section is opened by the user agent via the 'beforematch' event\n   *\n   * @private\n   * @param {Event} event - Generic event\n   */\n  onBeforeMatch(event) {\n    const $fragment = event.target\n\n    // Handle elements with `.closest()` support only\n    if (!($fragment instanceof Element)) {\n      return\n    }\n\n    // Handle when fragment is inside section\n    const $section = $fragment.closest(`.${this.sectionClass}`)\n    if ($section) {\n      this.setExpanded(true, $section)\n    }\n  }\n\n  /**\n   * When section toggled, set and store state\n   *\n   * @private\n   * @param {Element} $section - Section element\n   */\n  onSectionToggle($section) {\n    const expanded = this.isExpanded($section)\n    this.setExpanded(!expanded, $section)\n    const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n    if ($button instanceof HTMLButtonElement) {\n      $button.focus()\n    }\n\n    // Store the state in sessionStorage when a change is triggered\n    this.storeState($section)\n  }\n\n  /**\n   * When Open/Close All toggled, set and store state\n   *\n   * @private\n   */\n  onShowOrHideAllToggle() {\n    const nowExpanded = !this.checkIfAllSectionsOpen()\n\n    this.$sections.forEach(($section) => {\n      this.setExpanded(nowExpanded, $section)\n      this.storeState($section)\n    })\n\n    this.updateShowAllButton(nowExpanded)\n  }\n\n  /**\n   * Set section attributes when opened/closed\n   *\n   * @private\n   * @param {boolean} expanded - Section expanded\n   * @param {Element} $section - Section element\n   */\n  setExpanded(expanded, $section) {\n    const $showHideText = $section.querySelector(\n      `.${this.sectionShowHideTextClass}`\n    )\n    const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n    const $content = $section.querySelector(`.${this.sectionContentClass}`)\n\n    if (!$content) {\n      throw new ElementError({\n        componentName: 'Accordion',\n        identifier: `Section content (\\`<div class=\"${this.sectionContentClass}\">\\`)`\n      })\n    }\n\n    if (!$showHideText || !$button) {\n      // Return early for elements we create\n      return\n    }\n\n    $showHideText.textContent = expanded ? 'remove' : 'add'\n    $button.setAttribute('aria-expanded', `${expanded}`)\n\n    // Update aria-label combining\n    const ariaLabelParts = []\n\n    const $headingText = $section.querySelector(\n      `.${this.sectionHeadingTextClass}`\n    )\n    if ($headingText) {\n      ariaLabelParts.push(`${$headingText.textContent}`.trim())\n    }\n\n    const $summary = $section.querySelector(`.${this.sectionSummaryClass}`)\n    if ($summary) {\n      ariaLabelParts.push(`${$summary.textContent}`.trim())\n    }\n\n    const ariaLabelMessage = expanded\n      ? this.i18n.t('hideSectionAriaLabel')\n      : this.i18n.t('showSectionAriaLabel')\n    ariaLabelParts.push(ariaLabelMessage)\n\n    /*\n     * Join with a comma to add pause for assistive technology.\n     * Example: [heading]Section A ,[pause] Show this section.\n     * https://accessibility.blog.gov.uk/2017/12/18/what-working-on-gov-uk-navigation-taught-us-about-accessibility/\n     */\n    $button.setAttribute('aria-label', ariaLabelParts.join(' , '))\n\n    // Swap icon, change class\n    if (expanded) {\n      $content.removeAttribute('hidden')\n      $section.classList.add(this.sectionExpandedClass)\n    } else {\n      $content.setAttribute('hidden', 'until-found')\n      $section.classList.remove(this.sectionExpandedClass)\n    }\n\n    // See if \"Show all sections\" button text should be updated\n    const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n    this.updateShowAllButton(areAllSectionsOpen)\n  }\n\n  /**\n   * Get state of section\n   *\n   * @private\n   * @param {Element} $section - Section element\n   * @returns {boolean} True if expanded\n   */\n  isExpanded($section) {\n    return $section.classList.contains(this.sectionExpandedClass)\n  }\n\n  /**\n   * Check if all sections are open\n   *\n   * @private\n   * @returns {boolean} True if all sections are open\n   */\n  checkIfAllSectionsOpen() {\n    const sectionsCount = this.$sections.length\n    const expandedSectionCount = this.$module.querySelectorAll(\n      `.${this.sectionExpandedClass}`\n    ).length\n    return sectionsCount === expandedSectionCount\n  }\n\n  /**\n   * Update \"Show all sections\" button\n   *\n   * @private\n   * @param {boolean} expanded - Section expanded\n   */\n  updateShowAllButton(expanded) {\n    if (!this.$showAllButton || !this.$showAllText) {\n      return\n    }\n\n    this.$showAllButton.setAttribute('aria-expanded', expanded.toString())\n    this.$showAllText.textContent = expanded\n      ? this.i18n.t('hideAllSections')\n      : this.i18n.t('showAllSections')\n  }\n\n  /**\n   * Set the state of the accordions in sessionStorage\n   *\n   * @private\n   * @param {Element} $section - Section element\n   */\n  storeState($section) {\n    if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n      // We need a unique way of identifying each content in the Accordion.\n      // Since an `#id` should be unique and an `id` is required for `aria-`\n      // attributes `id` can be safely used.\n      const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n      if ($button) {\n        const contentId = $button.getAttribute('aria-controls')\n        const contentState = $button.getAttribute('aria-expanded')\n\n        // Only set the state when both `contentId` and `contentState` are taken\n        // from the DOM.\n        if (contentId && contentState) {\n          window.sessionStorage.setItem(contentId, contentState)\n        }\n      }\n    }\n  }\n\n  /**\n   * Read the state of the accordions from sessionStorage\n   *\n   * @private\n   * @param {Element} $section - Section element\n   */\n  setInitialState($section) {\n    if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n      const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n      if ($button) {\n        const contentId = $button.getAttribute('aria-controls')\n        const contentState = contentId\n          ? window.sessionStorage.getItem(contentId)\n          : null\n\n        if (contentState !== null) {\n          this.setExpanded(contentState === 'true', $section)\n        }\n      }\n    }\n  }\n\n  /**\n   * Create an element to improve semantics of the section button with\n   * punctuation\n   *\n   * Adding punctuation to the button can also improve its general semantics by\n   * dividing its contents into thematic chunks. See\n   * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442\n   *\n   * @private\n   * @returns {Element} DOM element\n   */\n  getButtonPunctuationEl() {\n    const $punctuationEl = document.createElement('span')\n    $punctuationEl.classList.add(\n      'govuk-visually-hidden',\n      this.sectionHeadingDividerClass\n    )\n    $punctuationEl.innerHTML = ', '\n    return $punctuationEl\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-accordion'\n\n  /**\n   * Accordion default config\n   *\n   * @see {@link AccordionConfig}\n   * @constant\n   * @type {AccordionConfig}\n   */\n  static defaults = Object.freeze({\n    i18n: {\n      hideAllSections: 'Zatvoriť všetko',\n      hideSectionAriaLabel: 'Zatvoriť túto sekciu',\n      showAllSections: 'Otvoriť všetko',\n      showSectionAriaLabel: 'Otvoriť túto sekciu'\n    },\n    rememberExpanded: true\n  })\n\n  /**\n   * Accordion config schema\n   *\n   * @constant\n   * @satisfies {Schema}\n   */\n  static schema = Object.freeze({\n    properties: {\n      i18n: { type: 'object' },\n      rememberExpanded: { type: 'boolean' }\n    }\n  })\n}\n\nconst helper = {\n  /**\n   * Check for `window.sessionStorage`, and that it actually works.\n   *\n   * @returns {boolean} True if session storage is available\n   */\n  checkForSessionStorage: function () {\n    const testString = 'this is the test string'\n    let result\n    try {\n      window.sessionStorage.setItem(testString, testString)\n      result =\n        window.sessionStorage.getItem(testString) === testString.toString()\n      window.sessionStorage.removeItem(testString)\n      return result\n    } catch (exception) {\n      return false\n    }\n  }\n}\n\n/**\n * Accordion config\n *\n * @see {@link Accordion.defaults}\n * @typedef {object} AccordionConfig\n * @property {AccordionTranslations} [i18n=Accordion.defaults.i18n] - Accordion translations\n * @property {boolean} [rememberExpanded] - Whether the expanded and collapsed\n *   state of each section is remembered and restored when navigating.\n */\n\n/**\n * Accordion translations\n *\n * @see {@link Accordion.defaults.i18n}\n * @typedef {object} AccordionTranslations\n *\n * Messages used by the component for the labels of its buttons. This includes\n * the visible text shown on screen, and text to help assistive technology users\n * for the buttons toggling each section.\n * @property {string} [hideAllSections] - The text content for the 'Hide all\n *   sections' button, used when at least one section is expanded.\n * @property {string} [hideSectionAriaLabel] - The text content appended to the\n *   'Hide' button's accessible name when a section is expanded.\n * @property {string} [showAllSections] - The text content for the 'Show all\n *   sections' button, used when all sections are collapsed.\n * @property {string} [showSectionAriaLabel] - The text content appended to the\n *   'Show' button's accessible name when a section is expanded.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n","import { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1\n\n/**\n * JavaScript enhancements for the Button component\n *\n * @preserve\n */\nexport class Button extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * @private\n   * @type {ButtonConfig}\n   */\n  config\n\n  /**\n   * @private\n   * @type {number | null}\n   */\n  debounceFormSubmitTimer = null\n\n  /**\n   * @param {Element | null} $module - HTML element to use for button\n   * @param {ButtonConfig} [config] - Button config\n   */\n  constructor($module, config = {}) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Button',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    this.config = mergeConfigs(\n      Button.defaults,\n      config,\n      normaliseDataset(Button, $module.dataset)\n    )\n\n    this.$module.addEventListener('keydown', (event) =>\n      this.handleKeyDown(event)\n    )\n    this.$module.addEventListener('click', (event) => this.debounce(event))\n  }\n\n  /**\n   * Trigger a click event when the space key is pressed\n   *\n   * Some screen readers tell users they can use the space bar to activate\n   * things with the 'button' role, so we need to match the functionality of\n   * native HTML buttons.\n   *\n   * See https://github.com/alphagov/govuk_elements/pull/272#issuecomment-233028270\n   *\n   * @private\n   * @param {KeyboardEvent} event - Keydown event\n   */\n  handleKeyDown(event) {\n    const $target = event.target\n\n    // Handle space bar only\n    if (event.key !== ' ') {\n      return\n    }\n\n    // Handle elements with [role=\"button\"] only\n    if (\n      $target instanceof HTMLElement &&\n      $target.getAttribute('role') === 'button'\n    ) {\n      event.preventDefault() // prevent the page from scrolling\n      $target.click()\n    }\n  }\n\n  /**\n   * Debounce double-clicks\n   *\n   * If the click quickly succeeds a previous click then nothing will happen.\n   * This stops people accidentally causing multiple form submissions by double\n   * clicking buttons.\n   *\n   * @private\n   * @param {MouseEvent} event - Mouse click event\n   * @returns {undefined | false} Returns undefined, or false when debounced\n   */\n  debounce(event) {\n    // Check the button that was clicked has preventDoubleClick enabled\n    if (!this.config.preventDoubleClick) {\n      return\n    }\n\n    // If the timer is still running, prevent the click from submitting the form\n    if (this.debounceFormSubmitTimer) {\n      event.preventDefault()\n      return false\n    }\n\n    this.debounceFormSubmitTimer = window.setTimeout(() => {\n      this.debounceFormSubmitTimer = null\n    }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000)\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-button'\n\n  /**\n   * Button default config\n   *\n   * @see {@link ButtonConfig}\n   * @constant\n   * @type {ButtonConfig}\n   */\n  static defaults = Object.freeze({\n    preventDoubleClick: false\n  })\n\n  /**\n   * Button config schema\n   *\n   * @constant\n   * @satisfies {Schema}\n   */\n  static schema = Object.freeze({\n    properties: {\n      preventDoubleClick: { type: 'boolean' }\n    }\n  })\n}\n\n/**\n * Button config\n *\n * @typedef {object} ButtonConfig\n * @property {boolean} [preventDoubleClick=false] - Prevent accidental double\n *   clicks on submit buttons from submitting forms multiple times.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n","import { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Checkboxes component\n *\n * @preserve\n */\nexport class Checkboxes extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /** @private */\n  $inputs\n\n  /**\n   * Checkboxes can be associated with a 'conditionally revealed' content block\n   * – for example, a checkbox for 'Phone' could reveal an additional form field\n   * for the user to enter their phone number.\n   *\n   * These associations are made using a `data-aria-controls` attribute, which\n   * is promoted to an aria-controls attribute during initialisation.\n   *\n   * We also need to restore the state of any conditional reveals on the page\n   * (for example if the user has navigated back), and set up event handlers to\n   * keep the reveal in sync with the checkbox state.\n   *\n   * @param {Element | null} $module - HTML element to use for checkboxes\n   */\n  constructor($module) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Checkboxes',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    const $inputs = $module.querySelectorAll('input[type=\"checkbox\"]')\n    if (!$inputs.length) {\n      throw new ElementError({\n        componentName: 'Checkboxes',\n        identifier: 'Form inputs (`<input type=\"checkbox\">`)'\n      })\n    }\n\n    this.$module = $module\n    this.$inputs = $inputs\n\n    this.$inputs.forEach(($input) => {\n      const targetId = $input.getAttribute('data-aria-controls')\n\n      // Skip radios without data-aria-controls attributes\n      if (!targetId) {\n        return\n      }\n\n      // Throw if target conditional element does not exist.\n      if (!document.getElementById(targetId)) {\n        throw new ElementError({\n          componentName: 'Checkboxes',\n          identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n        })\n      }\n\n      // Promote the data-aria-controls attribute to a aria-controls attribute\n      // so that the relationship is exposed in the AOM\n      $input.setAttribute('aria-controls', targetId)\n      $input.removeAttribute('data-aria-controls')\n    })\n\n    // When the page is restored after navigating 'back' in some browsers the\n    // state of form controls is not restored until *after* the DOMContentLoaded\n    // event is fired, so we need to sync after the pageshow event.\n    window.addEventListener('pageshow', () => this.syncAllConditionalReveals())\n\n    // Although we've set up handlers to sync state on the pageshow event, init\n    // could be called after those events have fired, for example if they are\n    // added to the page dynamically, so sync now too.\n    this.syncAllConditionalReveals()\n\n    // Handle events\n    this.$module.addEventListener('click', (event) => this.handleClick(event))\n  }\n\n  /**\n   * Sync the conditional reveal states for all checkboxes in this $module.\n   *\n   * @private\n   */\n  syncAllConditionalReveals() {\n    this.$inputs.forEach(($input) =>\n      this.syncConditionalRevealWithInputState($input)\n    )\n  }\n\n  /**\n   * Sync conditional reveal with the input state\n   *\n   * Synchronise the visibility of the conditional reveal, and its accessible\n   * state, with the input's checked state.\n   *\n   * @private\n   * @param {HTMLInputElement} $input - Checkbox input\n   */\n  syncConditionalRevealWithInputState($input) {\n    const targetId = $input.getAttribute('aria-controls')\n    if (!targetId) {\n      return\n    }\n\n    const $target = document.getElementById(targetId)\n    if (\n      $target &&\n      $target.classList.contains('govuk-checkboxes__conditional')\n    ) {\n      const inputIsChecked = $input.checked\n\n      $input.setAttribute('aria-expanded', inputIsChecked.toString())\n      $target.classList.toggle(\n        'govuk-checkboxes__conditional--hidden',\n        !inputIsChecked\n      )\n    }\n  }\n\n  /**\n   * Uncheck other checkboxes\n   *\n   * Find any other checkbox inputs with the same name value, and uncheck them.\n   * This is useful for when a “None of these\" checkbox is checked.\n   *\n   * @private\n   * @param {HTMLInputElement} $input - Checkbox input\n   */\n  unCheckAllInputsExcept($input) {\n    const allInputsWithSameName = document.querySelectorAll(\n      `input[type=\"checkbox\"][name=\"${$input.name}\"]`\n    )\n\n    allInputsWithSameName.forEach(($inputWithSameName) => {\n      const hasSameFormOwner = $input.form === $inputWithSameName.form\n      if (hasSameFormOwner && $inputWithSameName !== $input) {\n        $inputWithSameName.checked = false\n        this.syncConditionalRevealWithInputState($inputWithSameName)\n      }\n    })\n  }\n\n  /**\n   * Uncheck exclusive checkboxes\n   *\n   * Find any checkbox inputs with the same name value and the 'exclusive'\n   * behaviour, and uncheck them. This helps prevent someone checking both a\n   * regular checkbox and a \"None of these\" checkbox in the same fieldset.\n   *\n   * @private\n   * @param {HTMLInputElement} $input - Checkbox input\n   */\n  unCheckExclusiveInputs($input) {\n    const allInputsWithSameNameAndExclusiveBehaviour =\n      document.querySelectorAll(\n        `input[data-behaviour=\"exclusive\"][type=\"checkbox\"][name=\"${$input.name}\"]`\n      )\n\n    allInputsWithSameNameAndExclusiveBehaviour.forEach(($exclusiveInput) => {\n      const hasSameFormOwner = $input.form === $exclusiveInput.form\n      if (hasSameFormOwner) {\n        $exclusiveInput.checked = false\n        this.syncConditionalRevealWithInputState($exclusiveInput)\n      }\n    })\n  }\n\n  /**\n   * Click event handler\n   *\n   * Handle a click within the $module – if the click occurred on a checkbox,\n   * sync the state of any associated conditional reveal with the checkbox\n   * state.\n   *\n   * @private\n   * @param {MouseEvent} event - Click event\n   */\n  handleClick(event) {\n    const $clickedInput = event.target\n\n    // Ignore clicks on things that aren't checkbox inputs\n    if (\n      !($clickedInput instanceof HTMLInputElement) ||\n      $clickedInput.type !== 'checkbox'\n    ) {\n      return\n    }\n\n    // If the checkbox conditionally-reveals some content, sync the state\n    const hasAriaControls = $clickedInput.getAttribute('aria-controls')\n    if (hasAriaControls) {\n      this.syncConditionalRevealWithInputState($clickedInput)\n    }\n\n    // No further behaviour needed for unchecking\n    if (!$clickedInput.checked) {\n      return\n    }\n\n    // Handle 'exclusive' checkbox behaviour (ie \"None of these\")\n    const hasBehaviourExclusive =\n      $clickedInput.getAttribute('data-behaviour') === 'exclusive'\n    if (hasBehaviourExclusive) {\n      this.unCheckAllInputsExcept($clickedInput)\n    } else {\n      this.unCheckExclusiveInputs($clickedInput)\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-checkboxes'\n}\n","import {\n  getFragmentFromUrl,\n  mergeConfigs,\n  setFocus\n} from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Error summary component\n *\n * Takes focus on initialisation for accessible announcement, unless disabled in\n * configuration.\n *\n * @preserve\n */\nexport class ErrorSummary extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * @private\n   * @type {ErrorSummaryConfig}\n   */\n  config\n\n  /**\n   * @param {Element | null} $module - HTML element to use for error summary\n   * @param {ErrorSummaryConfig} [config] - Error summary config\n   */\n  constructor($module, config = {}) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Error summary',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    this.config = mergeConfigs(\n      ErrorSummary.defaults,\n      config,\n      normaliseDataset(ErrorSummary, $module.dataset)\n    )\n\n    /**\n     * Focus the error summary\n     */\n    if (!this.config.disableAutoFocus) {\n      setFocus(this.$module)\n    }\n\n    this.$module.addEventListener('click', (event) => this.handleClick(event))\n  }\n\n  /**\n   * Click event handler\n   *\n   * @private\n   * @param {MouseEvent} event - Click event\n   */\n  handleClick(event) {\n    const $target = event.target\n    if ($target && this.focusTarget($target)) {\n      event.preventDefault()\n    }\n  }\n\n  /**\n   * Focus the target element\n   *\n   * By default, the browser will scroll the target into view. Because our\n   * labels or legends appear above the input, this means the user will be\n   * presented with an input without any context, as the label or legend will be\n   * off the top of the screen.\n   *\n   * Manually handling the click event, scrolling the question into view and\n   * then focussing the element solves this.\n   *\n   * This also results in the label and/or legend being announced correctly in\n   * NVDA (as tested in 2018.3.2) - without this only the field type is\n   * announced (e.g. \"Edit, has autocomplete\").\n   *\n   * @private\n   * @param {EventTarget} $target - Event target\n   * @returns {boolean} True if the target was able to be focussed\n   */\n  focusTarget($target) {\n    // If the element that was clicked was not a link, return early\n    if (!($target instanceof HTMLAnchorElement)) {\n      return false\n    }\n\n    const inputId = getFragmentFromUrl($target.href)\n    if (!inputId) {\n      return false\n    }\n\n    const $input = document.getElementById(inputId)\n    if (!$input) {\n      return false\n    }\n\n    const $legendOrLabel = this.getAssociatedLegendOrLabel($input)\n    if (!$legendOrLabel) {\n      return false\n    }\n\n    // Scroll the legend or label into view *before* calling focus on the input\n    // to avoid extra scrolling in browsers that don't support `preventScroll`\n    // (which at time of writing is most of them...)\n    $legendOrLabel.scrollIntoView()\n    $input.focus({ preventScroll: true })\n\n    return true\n  }\n\n  /**\n   * Get associated legend or label\n   *\n   * Returns the first element that exists from this list:\n   *\n   * - The `<legend>` associated with the closest `<fieldset>` ancestor, as long\n   *   as the top of it is no more than half a viewport height away from the\n   *   bottom of the input\n   * - The first `<label>` that is associated with the input using for=\"inputId\"\n   * - The closest parent `<label>`\n   *\n   * @private\n   * @param {Element} $input - The input\n   * @returns {Element | null} Associated legend or label, or null if no\n   *   associated legend or label can be found\n   */\n  getAssociatedLegendOrLabel($input) {\n    const $fieldset = $input.closest('fieldset')\n\n    if ($fieldset) {\n      const $legends = $fieldset.getElementsByTagName('legend')\n\n      if ($legends.length) {\n        const $candidateLegend = $legends[0]\n\n        // If the input type is radio or checkbox, always use the legend if\n        // there is one.\n        if (\n          $input instanceof HTMLInputElement &&\n          ($input.type === 'checkbox' || $input.type === 'radio')\n        ) {\n          return $candidateLegend\n        }\n\n        // For other input types, only scroll to the fieldset’s legend (instead\n        // of the label associated with the input) if the input would end up in\n        // the top half of the screen.\n        //\n        // This should avoid situations where the input either ends up off the\n        // screen, or obscured by a software keyboard.\n        const legendTop = $candidateLegend.getBoundingClientRect().top\n        const inputRect = $input.getBoundingClientRect()\n\n        // If the browser doesn't support Element.getBoundingClientRect().height\n        // or window.innerHeight (like IE8), bail and just link to the label.\n        if (inputRect.height && window.innerHeight) {\n          const inputBottom = inputRect.top + inputRect.height\n\n          if (inputBottom - legendTop < window.innerHeight / 2) {\n            return $candidateLegend\n          }\n        }\n      }\n    }\n\n    return (\n      document.querySelector(`label[for='${$input.getAttribute('id')}']`) ??\n      $input.closest('label')\n    )\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-error-summary'\n\n  /**\n   * Error summary default config\n   *\n   * @see {@link ErrorSummaryConfig}\n   * @constant\n   * @type {ErrorSummaryConfig}\n   */\n  static defaults = Object.freeze({\n    disableAutoFocus: false\n  })\n\n  /**\n   * Error summary config schema\n   *\n   * @constant\n   * @satisfies {Schema}\n   */\n  static schema = Object.freeze({\n    properties: {\n      disableAutoFocus: { type: 'boolean' }\n    }\n  })\n}\n\n/**\n * Error summary config\n *\n * @typedef {object} ErrorSummaryConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the error\n *   summary will not be focussed when the page loads.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n","import { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * File upload component\n *\n * Allow user to drag and drop file to upload\n */\nexport class FileUpload extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * Container for file upload.\n   *\n   * @private\n   * @type {HTMLElement | undefined}\n   */\n  $uploadContainer\n\n  /**\n   * Hidden input for file selection.\n   *\n   * @private\n   * @type {HTMLInputElement | undefined}\n   */\n  $fileInput\n\n  /**\n   * Button to open the file selection dialog.\n   *\n   * @type {HTMLButtonElement | undefined}\n   */\n  $uploadButton\n\n  /**\n   * Creates an instance of FileUploader.\n   *\n   * @param {Element | null} $module - HTML element to be used for error summary.\n   */\n  constructor($module) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'File-upload',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    const uploadContainer = $module.querySelector('.upload-box')\n    if (uploadContainer instanceof HTMLElement) {\n      this.$uploadContainer = uploadContainer\n    }\n\n    const fileInput = $module.querySelector('input[data-file-input]')\n\n    if (fileInput instanceof HTMLInputElement) {\n      this.$fileInput = fileInput\n    }\n\n    const uploadButton = $module.querySelector('.upload-button')\n\n    if (uploadButton instanceof HTMLButtonElement) {\n      this.$uploadButton = uploadButton\n    }\n\n    // Initialize event listeners\n    this.initEventListeners()\n  }\n\n  /**\n   * Initializes event listeners for handling drag-and-drop and button file selection.\n   */\n  initEventListeners() {\n    // Clicking the button opens the file selection dialog\n    if (this.$uploadButton) {\n      this.$uploadButton.addEventListener('click', () =>\n        this.$fileInput?.click()\n      )\n    }\n\n    // Input change handles selected files\n    this.$fileInput?.addEventListener('change', () =>\n      this.handleFiles(this.$fileInput?.files)\n    )\n\n    if (this.$uploadContainer) {\n      // Drag-and-drop events\n      this.$uploadContainer.addEventListener('dragenter', (e) =>\n        this.onDragEnter(e)\n      )\n      this.$uploadContainer.addEventListener('dragover', (e) =>\n        this.onDragOver(e)\n      )\n      this.$uploadContainer.addEventListener('dragleave', (e) =>\n        this.onDragLeave(e)\n      )\n      this.$uploadContainer.addEventListener('drop', (e) => this.onDrop(e))\n    }\n  }\n\n  /**\n   * Handles the dragenter event.\n   *\n   * @param {DragEvent} event - The dragenter event.\n   */\n  onDragEnter(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.add('dragover')\n  }\n\n  /**\n   * Handles the dragover event.\n   *\n   * @param {DragEvent} event - The dragover event.\n   */\n  onDragOver(event) {\n    event.preventDefault()\n    event.stopPropagation()\n  }\n\n  /**\n   * Handles the dragleave event.\n   *\n   * @param {DragEvent} event - The dragleave event.\n   */\n  onDragLeave(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.remove('dragover')\n  }\n\n  /**\n   * Handles the drop event.\n   *\n   * @param {DragEvent} event - The drop event.\n   */\n  onDrop(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.remove('dragover')\n    const files = event.dataTransfer?.files\n    this.handleFiles(files)\n  }\n\n  /**\n   * Handles the selected or dropped files.\n   *\n   * @param {FileList | null | undefined} files - The list of files to handle.\n   */\n  handleFiles(files) {\n    if (files && files.length > 0) {\n      alert(`Selected file: ${files[0].name}`)\n      // Add your file handling logic here\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-fileUpload'\n}\n\n/**\n * File upload config\n *\n * @typedef {object} FileUploadConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the error\n *   summary will not be focussed when the page loads.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n","import { getBreakpoint } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /** @private */\n  /** @type {HTMLElement | undefined} */\n  $menuButton\n\n  /** @private */\n  /** @type {HTMLElement | undefined} */\n  $menu\n\n  /** @private */\n  /** @type {HTMLElement | undefined} */\n  $dropdownToggle\n\n  /** @private */\n  /** @type {HTMLElement | undefined} */\n  $header\n\n  /** @private */\n  /** @type {HTMLDialogElement | undefined} */\n  $profileDialog\n\n  /**\n   * Save the opened/closed state for the nav in memory so that we can\n   * accurately maintain state when the screen is changed from small to big and\n   * back to small\n   *\n   * @private\n   */\n  menuIsOpen = false\n\n  /**\n   * A global const for storing a matchMedia instance which we'll use to detect\n   * when a screen size change happens. We rely on it being null if the feature\n   * isn't available to initially apply hidden attributes\n   *\n   * @private\n   * @type {MediaQueryList | null}\n   */\n  mql = null\n\n  /**\n   * Apply a matchMedia for desktop which will trigger a state sync if the\n   * browser viewport moves between states.\n   *\n   * @param {Element | null} $module - HTML element to use for header\n   */\n  constructor($module) {\n    super()\n\n    if (!$module) {\n      throw new ElementError({\n        componentName: 'Header',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    const dropdownItems = $module.querySelectorAll('.idsk-dropdown__wrapper')\n    dropdownItems.forEach((dropdownItem) => new Dropdown(dropdownItem))\n\n    /*\n    const langDropdown = $module.querySelector('.idsk-dropdown__wrapper')\n    if (langDropdown) {\n      new Dropdown(langDropdown) // eslint-disable-line no-new\n    }\n\n    const myDropdown = $module.querySelector('.jano')\n    if (myDropdown) {\n      new Dropdown(myDropdown) // eslint-disable-line no-new\n    }\n\n    const myDropdown2 = $module.querySelector('.jano2')\n    if (myDropdown2) {\n      new Dropdown(myDropdown2) // eslint-disable-line no-new\n    }\n      */\n\n    this.$module = $module\n    const $menuButton = $module.querySelector('.govuk-js-header-toggle')\n\n    const header = document.querySelector('.govuk-header')\n    if (header instanceof HTMLElement) {\n      this.$header = header\n    }\n\n    // Headers don't necessarily have a navigation. When they don't, the menu\n    // toggle won't be rendered by our macro (or may be omitted when writing\n    // plain HTML)\n    if (!$menuButton) {\n      return this\n    }\n\n    const menuId = $menuButton.getAttribute('aria-controls')\n    if (!menuId) {\n      throw new ElementError({\n        componentName: 'Header',\n        identifier:\n          'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n      })\n    }\n\n    const websitesNavBody = $module.querySelector(\n      '.idsk-secondary-navigation__body'\n    )\n    const websitesNavBtn = $module.querySelector(\n      '.idsk-secondary-navigation__heading-button'\n    )\n\n    if (\n      websitesNavBody instanceof HTMLElement &&\n      websitesNavBtn instanceof HTMLElement\n    ) {\n      websitesNavBtn.addEventListener('click', (event) => {\n        event.preventDefault()\n        const menuIsOpen = !(websitesNavBtn.ariaExpanded === 'true')\n        const iconClassList =\n          websitesNavBtn.querySelector('.material-icons')?.classList\n        if (menuIsOpen) {\n          websitesNavBody.classList.remove('hidden')\n          iconClassList?.add('rotate180')\n          websitesNavBtn.ariaExpanded = 'true'\n        } else {\n          websitesNavBody.classList.add('hidden')\n          iconClassList?.remove('rotate180')\n          websitesNavBtn.ariaExpanded = 'false'\n        }\n      })\n    }\n\n    const menu = document.querySelector(`#${menuId}`)\n    if (menu instanceof HTMLElement) {\n      this.$menu = menu\n    }\n    if ($menuButton instanceof HTMLElement) {\n      this.$menuButton = $menuButton\n      this.$menuButton.addEventListener('click', () => {\n        this.handleMenuButtonClick()\n      })\n    }\n\n    this.setupResponsiveChecks()\n\n    // Get dropdown menu and toggle. Then function for show or hide dropdown\n    // TODO: vyhodit a nahradit ComboBoxom\n    const dropdownToggle = $module.querySelector('.dropdown-toggle')\n    if (dropdownToggle instanceof HTMLElement) {\n      this.$dropdownToggle = dropdownToggle\n      this.openCloseDropdownMenu()\n    }\n\n    const profileDialog = document.getElementById('navigationProfileDialog')\n    if (profileDialog instanceof HTMLDialogElement) {\n      this.$profileDialog = profileDialog\n    }\n    const profileButton = $module.querySelector('.govuk-header__profile_button')\n    const profileCloseButton = $module.querySelector(\n      '.govuk-header__profile_close_button'\n    )\n    if (profileDialog instanceof HTMLDialogElement && this.$profileDialog) {\n      profileButton?.addEventListener('click', () => {\n        if (profileDialog.open) {\n          this.$profileDialog?.close()\n        } else {\n          this.$profileDialog?.showModal()\n        }\n      })\n      profileCloseButton?.addEventListener('click', () => profileDialog.close())\n      profileDialog.addEventListener('click', (event) => {\n        if (event.target === this.$profileDialog) {\n          this.$profileDialog.close()\n        }\n      })\n    }\n\n    // document.getElementById(\"govuk-header__profile\")\n    /*\n    const headerProfileCard = $module.querySelector('.govuk-header__profile')\n    if (headerProfileCard instanceof HTMLElement) {\n      this.$headerProfileCard = headerProfileCard\n    }\n    const profileButton = $module.querySelector('.govuk-header__profile_button')\n    if (this.$headerProfileCard && profileButton) {\n      profileButton.addEventListener(\n        'click',\n        () => {\n          const el = document.getElementById(\"navigationProfileDialog\");\n          if (el instanceof HTMLDialogElement) {\n            if (el.open) {\n              el.close()\n            } else {\n              el.show()\n            }\n          }\n        },\n        true\n      )\n      // document.addEventListener('click', (event) => {\n      //   if (this.mql == null || !this.mql.matches) {\n      //     return\n      //   }\n      //   if (\n      //     this.$headerProfileCard &&\n      //     event.target instanceof Node &&\n      //     !this.$headerProfileCard.contains(event.target) &&\n      //     !profileButton.contains(event.target)\n      //   ) {\n      //     this.$headerProfileCard.classList.add('hidden')\n      //   }\n      // })\n    }\n      */\n  }\n\n  /**\n   * Setup viewport resize check\n   *\n   * @private\n   */\n  setupResponsiveChecks() {\n    const breakpoint = getBreakpoint('desktop')\n\n    if (!breakpoint.value) {\n      throw new ElementError({\n        componentName: 'Header',\n        identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n      })\n    }\n\n    // Media query list for GOV.UK Frontend desktop breakpoint\n    this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n    // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n    // to be able to fall back to the deprecated MediaQueryList.addListener\n    if ('addEventListener' in this.mql) {\n      this.mql.addEventListener('change', () => this.checkMode())\n    } else {\n      // @ts-expect-error Property 'addListener' does not exist\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n      this.mql.addListener(() => this.checkMode())\n    }\n\n    this.checkMode()\n  }\n\n  /**\n   * Sync menu state\n   *\n   * Uses the global variable menuIsOpen to correctly set the accessible and\n   * visual states of the menu and the menu button.\n   * Additionally will force the menu to be visible and the menu button to be\n   * hidden if the matchMedia is triggered to desktop.\n   *\n   * @private\n   */\n  checkMode() {\n    if (this.mql == null || !this.$header) {\n      return\n    }\n\n    if (this.mql.matches) {\n      // desktop mode\n      this.$menu?.removeAttribute('hidden')\n      this.$menuButton?.setAttribute('hidden', '')\n      this.$header // hide logo\n        .querySelector('.govuk-header__link--homepage')\n        ?.removeAttribute('hidden')\n      this.$header\n        .querySelector('.idsk-searchbar__wrapper')\n        ?.classList.remove('hide')\n    } else {\n      // mobile\n      if (this.$profileDialog) {\n        this.$profileDialog.close()\n      }\n      this.$menuButton?.removeAttribute('hidden')\n      this.$menuButton?.setAttribute(\n        'aria-expanded',\n        this.menuIsOpen.toString()\n      )\n\n      this.$menu?.removeAttribute('hidden')\n      if (this.$menuButton) {\n        this.$menuButton.textContent = this.menuIsOpen ? 'Zavrieť' : 'Menu'\n        this.createMaterialIcon(\n          this.menuIsOpen ? 'close' : 'menu',\n          this.$menuButton\n        )\n      }\n\n      if (this.menuIsOpen) {\n        this.$menu?.removeAttribute('hidden')\n        // this.$header.style.background = '#fafafa'\n        this.$header // show actionPanel\n          .querySelector('.govuk-header__actionPanel.mobile')\n          ?.classList.remove('mobile-hidden')\n        this.$header // hide hide logo\n          .querySelector('.govuk-header__link--homepage')\n          ?.setAttribute('hidden', '')\n        console.log(this.$header.querySelector('.idsk-searchbar__wrapper'))\n        this.$header\n          .querySelector('.idsk-searchbar__wrapper')\n          ?.classList.remove('hide')\n      } else {\n        this.$menu?.setAttribute('hidden', '')\n        // this.$header.style.background = '#fff'\n        this.$header // hide action panel\n          .querySelector('.govuk-header__actionPanel.mobile')\n          ?.classList.add('mobile-hidden')\n        this.$header // show logo\n          .querySelector('.govuk-header__link--homepage')\n          ?.removeAttribute('hidden')\n        this.$header\n          .querySelector('.idsk-searchbar__wrapper')\n          ?.classList.add('hide')\n      }\n    }\n  }\n\n  /**\n   * Handle menu button click\n   *\n   * When the menu button is clicked, change the visibility of the menu and then\n   * sync the accessibility state and menu button state\n   *\n   * @private\n   */\n  handleMenuButtonClick() {\n    this.menuIsOpen = !this.menuIsOpen\n    this.checkMode()\n  }\n\n  /**\n   * Toggle dropdown menu\n   */\n  openCloseDropdownMenu() {\n    if (!this.$dropdownToggle) {\n      return\n    }\n\n    this.$dropdownToggle.addEventListener('click', (event) => {\n      if (this.$dropdownToggle) {\n        event.preventDefault()\n        this.$dropdownToggle.classList.toggle('open')\n      }\n    })\n\n    this.clickOutsideClose(this.$dropdownToggle, 'open')\n  }\n\n  /**\n   * Create and add material icon to parent element\n   *\n   * @param {string} iconName - icon name for create\n   * @param {HTMLElement} parentElem - element to which the icon will be added\n   */\n  createMaterialIcon(iconName, parentElem) {\n    const spanIcon = document.createElement('span')\n    spanIcon.className = 'material-icons'\n    spanIcon.textContent = iconName.toString()\n    spanIcon.ariaHidden = 'true'\n    parentElem.appendChild(spanIcon)\n  }\n\n  /**\n   * Function for click outside and close some elem\n   *\n   * @param {HTMLElement} openedElem - element which need to remove open className\n   * @param {string} className - name of className to remove and close some opened element\n   */\n  clickOutsideClose(openedElem, className) {\n    document.addEventListener('click', (event) => {\n      if (event.target instanceof Node && !openedElem.contains(event.target)) {\n        openedElem.classList.remove(className.toString())\n      }\n    })\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-header'\n}\n\n/**\n * JavaScript enhancements for the Dropdown component\n *\n * @preserve\n */\nclass Dropdown {\n  /** @private */\n  $module\n\n  /** @private */\n  button\n\n  /** @private */\n  options\n\n  /** @private */\n  isOpen = false\n\n  /**\n   * @param {Element | null} $module - HTML element to use for dropdown\n   */\n  constructor($module) {\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Dropdown',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n    const buttonElement = this.$module.querySelector('.idsk-dropdown')\n    const optionsElement = this.$module.querySelector('.idsk-dropdown__options')\n    this.button = buttonElement\n    this.options = optionsElement\n\n    if (!buttonElement) {\n      throw new ElementError({\n        componentName: 'Dropdown button',\n        element: buttonElement,\n        identifier: 'Button dropdown trigger'\n      })\n    }\n\n    if (!optionsElement) {\n      throw new ElementError({\n        componentName: 'Dropdown options',\n        element: optionsElement,\n        identifier: 'Dropdown options block'\n      })\n    }\n\n    this.button?.addEventListener('click', (event) => this.handleClick(event))\n    document.addEventListener('click', (event) => {\n      if (\n        event.target instanceof Node &&\n        !this.$module.contains(event.target) &&\n        this.isOpen\n      ) {\n        this.handleClick(event)\n      }\n    })\n  }\n\n  /**\n   * Trigger a click event\n   *\n   * @param {Event} event - click event\n   * @private\n   */\n  handleClick(event) {\n    if (!this.button) {\n      return\n    }\n\n    event.preventDefault()\n\n    this.isOpen = !this.isOpen\n    const label = this.$module.dataset.pseudolabel ?? ''\n\n    if (this.isOpen) {\n      this.$module.classList.add('open')\n      this.button\n        .querySelector('svg')\n        ?.classList.add('idsk-dropdown__icon--opened')\n      this.button.ariaLabel = `Zavrieť ${label}`\n      this.options?.classList.add('idsk-dropdown--opened')\n      // this.$module.querySelector('.material-icons')?.classList.add('rotate180')\n    } else {\n      this.$module.classList.remove('open')\n      this.button\n        .querySelector('svg')\n        ?.classList.remove('idsk-dropdown__icon--opened')\n      this.button.ariaLabel = `Rozbaliť ${label}`\n      this.options?.classList.remove('idsk-dropdown--opened')\n    }\n\n    this.button.ariaExpanded = this.isOpen.toString()\n  }\n}\n","import { mergeConfigs, setFocus } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Notification Banner component\n *\n * @preserve\n */\nexport class NotificationBanner extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * @private\n   * @type {NotificationBannerConfig}\n   */\n  config\n\n  /**\n   * @param {Element | null} $module - HTML element to use for notification banner\n   * @param {NotificationBannerConfig} [config] - Notification banner config\n   */\n  constructor($module, config = {}) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Notification banner',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    this.config = mergeConfigs(\n      NotificationBanner.defaults,\n      config,\n      normaliseDataset(NotificationBanner, $module.dataset)\n    )\n\n    /**\n     * Focus the notification banner\n     *\n     * If `role=\"alert\"` is set, focus the element to help some assistive\n     * technologies prioritise announcing it.\n     *\n     * You can turn off the auto-focus functionality by setting\n     * `data-disable-auto-focus=\"true\"` in the component HTML. You might wish to\n     * do this based on user research findings, or to avoid a clash with another\n     * element which should be focused when the page loads.\n     */\n    if (\n      this.$module.getAttribute('role') === 'alert' &&\n      !this.config.disableAutoFocus\n    ) {\n      setFocus(this.$module)\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-notification-banner'\n\n  /**\n   * Notification banner default config\n   *\n   * @see {@link NotificationBannerConfig}\n   * @constant\n   * @type {NotificationBannerConfig}\n   */\n  static defaults = Object.freeze({\n    disableAutoFocus: false\n  })\n\n  /**\n   * Notification banner config schema\n   *\n   * @constant\n   * @satisfies {Schema}\n   */\n  static schema = Object.freeze({\n    properties: {\n      disableAutoFocus: { type: 'boolean' }\n    }\n  })\n}\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the\n *   notification banner will not be focussed when the page loads. This only\n *   applies if the component has a `role` of `alert` – in other cases the\n *   component will not be focused on page load, regardless of this option.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n","import { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Radios component\n *\n * @preserve\n */\nexport class Radios extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /** @private */\n  $inputs\n\n  /**\n   * Radios can be associated with a 'conditionally revealed' content block –\n   * for example, a radio for 'Phone' could reveal an additional form field for\n   * the user to enter their phone number.\n   *\n   * These associations are made using a `data-aria-controls` attribute, which\n   * is promoted to an aria-controls attribute during initialisation.\n   *\n   * We also need to restore the state of any conditional reveals on the page\n   * (for example if the user has navigated back), and set up event handlers to\n   * keep the reveal in sync with the radio state.\n   *\n   * @param {Element | null} $module - HTML element to use for radios\n   */\n  constructor($module) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Radios',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    const $inputs = $module.querySelectorAll('input[type=\"radio\"]')\n    if (!$inputs.length) {\n      throw new ElementError({\n        componentName: 'Radios',\n        identifier: 'Form inputs (`<input type=\"radio\">`)'\n      })\n    }\n\n    this.$module = $module\n    this.$inputs = $inputs\n\n    this.$inputs.forEach(($input) => {\n      const targetId = $input.getAttribute('data-aria-controls')\n\n      // Skip radios without data-aria-controls attributes\n      if (!targetId) {\n        return\n      }\n\n      // Throw if target conditional element does not exist.\n      if (!document.getElementById(targetId)) {\n        throw new ElementError({\n          componentName: 'Radios',\n          identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n        })\n      }\n\n      // Promote the data-aria-controls attribute to a aria-controls attribute\n      // so that the relationship is exposed in the AOM\n      $input.setAttribute('aria-controls', targetId)\n      $input.removeAttribute('data-aria-controls')\n    })\n\n    // When the page is restored after navigating 'back' in some browsers the\n    // state of form controls is not restored until *after* the DOMContentLoaded\n    // event is fired, so we need to sync after the pageshow event.\n    window.addEventListener('pageshow', () => this.syncAllConditionalReveals())\n\n    // Although we've set up handlers to sync state on the pageshow event, init\n    // could be called after those events have fired, for example if they are\n    // added to the page dynamically, so sync now too.\n    this.syncAllConditionalReveals()\n\n    // Handle events\n    this.$module.addEventListener('click', (event) => this.handleClick(event))\n  }\n\n  /**\n   * Sync the conditional reveal states for all radio buttons in this $module.\n   *\n   * @private\n   */\n  syncAllConditionalReveals() {\n    this.$inputs.forEach(($input) =>\n      this.syncConditionalRevealWithInputState($input)\n    )\n  }\n\n  /**\n   * Sync conditional reveal with the input state\n   *\n   * Synchronise the visibility of the conditional reveal, and its accessible\n   * state, with the input's checked state.\n   *\n   * @private\n   * @param {HTMLInputElement} $input - Radio input\n   */\n  syncConditionalRevealWithInputState($input) {\n    const targetId = $input.getAttribute('aria-controls')\n    if (!targetId) {\n      return\n    }\n\n    const $target = document.getElementById(targetId)\n    if ($target?.classList.contains('govuk-radios__conditional')) {\n      const inputIsChecked = $input.checked\n\n      $input.setAttribute('aria-expanded', inputIsChecked.toString())\n      $target.classList.toggle(\n        'govuk-radios__conditional--hidden',\n        !inputIsChecked\n      )\n    }\n  }\n\n  /**\n   * Click event handler\n   *\n   * Handle a click within the $module – if the click occurred on a radio, sync\n   * the state of the conditional reveal for all radio buttons in the same form\n   * with the same name (because checking one radio could have un-checked a\n   * radio in another $module)\n   *\n   * @private\n   * @param {MouseEvent} event - Click event\n   */\n  handleClick(event) {\n    const $clickedInput = event.target\n\n    // Ignore clicks on things that aren't radio buttons\n    if (\n      !($clickedInput instanceof HTMLInputElement) ||\n      $clickedInput.type !== 'radio'\n    ) {\n      return\n    }\n\n    // We only need to consider radios with conditional reveals, which will have\n    // aria-controls attributes.\n    const $allInputs = document.querySelectorAll(\n      'input[type=\"radio\"][aria-controls]'\n    )\n\n    const $clickedInputForm = $clickedInput.form\n    const $clickedInputName = $clickedInput.name\n\n    $allInputs.forEach(($input) => {\n      const hasSameFormOwner = $input.form === $clickedInputForm\n      const hasSameName = $input.name === $clickedInputName\n\n      if (hasSameName && hasSameFormOwner) {\n        this.syncConditionalRevealWithInputState($input)\n      }\n    })\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-radios'\n}\n","import { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Textarea component\n *\n * @preserve\n */\nexport class Textarea extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /** @private */\n  counter\n\n  /** @private */\n  textarea\n\n  /**\n   * @param {Element | null} $module - HTML element to use for textarea\n   */\n  constructor($module) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'Textarea',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    const textarea = this.$module.querySelector('textarea')\n    const counterElement = this.$module.querySelector(\n      '.idsk-textarea--counter span'\n    )\n\n    if (!textarea) {\n      throw new ElementError({\n        componentName: 'Textarea input',\n        element: textarea,\n        identifier: 'Textarea input element'\n      })\n    }\n\n    if (!counterElement) {\n      throw new ElementError({\n        componentName: 'Textarea counter',\n        element: counterElement,\n        identifier: 'Textarea length counter'\n      })\n    }\n\n    this.textarea = textarea\n    this.counter = counterElement\n\n    this.counter.textContent = this.textarea.value.length.toString()\n    this.textarea.addEventListener('input', (event) => this.handleChange(event))\n  }\n\n  /**\n   * Input event handler\n   *\n   * @private\n   * @param {Event} event - Input event\n   */\n  handleChange(event) {\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n    const el = event.target\n    if (el instanceof HTMLTextAreaElement) {\n      this.counter.textContent = el.value.length.toString()\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-textarea'\n}\n","/* eslint-disable no-new */\n\nimport { version } from './common/govuk-frontend-version.mjs'\nimport { isSupported } from './common/index.mjs'\nimport { Accordion } from './components/accordion/accordion.mjs'\nimport { Button } from './components/button/button.mjs'\nimport { Checkboxes } from './components/checkboxes/checkboxes.mjs'\nimport { ErrorSummary } from './components/error-summary/error-summary.mjs'\nimport { FileUpload } from './components/file-upload/file-upload.mjs'\nimport { Header } from './components/header/header.mjs'\nimport { NotificationBanner } from './components/notification-banner/notification-banner.mjs'\nimport { Radios } from './components/radios/radios.mjs'\nimport { Textarea } from './components/textarea/textarea.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Initialise all components\n *\n * Use the `data-module` attributes to find, instantiate and init all of the\n * components provided as part of GOV.UK Frontend.\n *\n * @param {Config & { scope?: Element }} [config] - Config for all components (with optional scope)\n */\nfunction initAll(config) {\n  config = typeof config !== 'undefined' ? config : {}\n\n  // Skip initialisation when GOV.UK Frontend is not supported\n  if (!isSupported()) {\n    console.log(new SupportError())\n    return\n  }\n\n  const components = /** @type {const} */ ([\n    [Accordion, config.accordion],\n    [Button, config.button],\n    [Checkboxes],\n    [ErrorSummary, config.errorSummary],\n    [Header],\n    [NotificationBanner, config.notificationBanner],\n    [Radios],\n    [FileUpload],\n    [Textarea]\n  ])\n\n  // Allow the user to initialise GOV.UK Frontend in only certain sections of the page\n  // Defaults to the entire document if nothing is set.\n  const $scope = config.scope ?? document\n\n  components.forEach(([Component, config]) => {\n    const $elements = $scope.querySelectorAll(\n      `[data-module=\"${Component.moduleName}\"]`\n    )\n\n    $elements.forEach(($element) => {\n      try {\n        // Only pass config to components that accept it\n        'defaults' in Component\n          ? new Component($element, config)\n          : new Component($element)\n      } catch (error) {\n        console.log(error)\n      }\n    })\n  })\n}\n\nexport {\n  initAll,\n  version,\n\n  // Components\n  Accordion,\n  Button,\n  Checkboxes,\n  ErrorSummary,\n  Header,\n  NotificationBanner,\n  Radios,\n  FileUpload,\n  Textarea\n}\n\n/**\n * Config for all components via `initAll()`\n *\n * @typedef {object} Config\n * @property {AccordionConfig} [accordion] - Accordion config\n * @property {ButtonConfig} [button] - Button config\n * @property {ErrorSummaryConfig} [errorSummary] - Error Summary config\n * @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config\n */\n\n/**\n * Config for individual components\n *\n * @typedef {import('./components/accordion/accordion.mjs').AccordionConfig} AccordionConfig\n * @typedef {import('./components/accordion/accordion.mjs').AccordionTranslations} AccordionTranslations\n * @typedef {import('./components/button/button.mjs').ButtonConfig} ButtonConfig\n * @typedef {import('./components/error-summary/error-summary.mjs').ErrorSummaryConfig} ErrorSummaryConfig\n * @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig\n */\n\n/**\n * Component config keys, e.g. `accordion` and `characterCount`\n *\n * @typedef {keyof Config} ConfigKey\n */\n"],"names":["version","normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","mergeConfigs","configObjects","formattedConfigObject","configObject","key","Object","keys","option","override","isObject","extractConfigByNamespace","Component","dataset","namespace","schema","properties","newObject","entries","current","keyParts","split","index","name","getFragmentFromUrl","url","undefined","pop","getBreakpoint","window","getComputedStyle","document","documentElement","getPropertyValue","setFocus","$element","options","_options$onBeforeFocu","isFocusable","getAttribute","setAttribute","onFocus","addEventListener","onBlur","once","_options$onBlur","call","removeAttribute","onBeforeFocus","focus","isSupported","$scope","body","classList","contains","isArray","Array","normaliseDataset","out","field","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","message","componentName","identifier","element","expectedType","GOVUKFrontendComponent","checkSupport","I18n","translations","config","_config$locale","locale","lang","t","lookupKey","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","replace","placeholderWithBraces","placeholderKey","hasOwnProperty","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","PluralRules","preferredForm","select","selectPluralFormUsingFallbackRules","console","warn","Math","abs","floor","ruleset","getPluralRulesForLocale","pluralRules","localeShort","pluralRule","pluralRulesMap","languages","arabic","chinese","french","german","irish","russian","scottish","spanish","welsh","n","lastTwo","last","Accordion","$module","i18n","controlsClass","showAllClass","showAllTextClass","sectionClass","sectionExpandedClass","sectionButtonClass","sectionHeaderClass","sectionHeadingClass","sectionHeadingDividerClass","sectionHeadingTextClass","sectionHeadingTextFocusClass","sectionShowHideToggleClass","sectionShowHideTextClass","sectionSummaryClass","sectionContentClass","$sections","browserSupportsSessionStorage","$showAllButton","$showAllText","HTMLElement","defaults","querySelectorAll","helper","checkForSessionStorage","initControls","initSectionHeaders","areAllSectionsOpen","checkIfAllSectionsOpen","updateShowAllButton","createElement","$accordionControls","appendChild","insertBefore","firstChild","add","onShowOrHideAllToggle","event","onBeforeMatch","forEach","$section","i","$header","querySelector","constructHeaderMarkup","setExpanded","isExpanded","onSectionToggle","setInitialState","$span","$heading","$summary","$button","id","attr","from","attributes","nodeName","nodeValue","$headingText","$headingTextFocus","innerHTML","$showHideToggle","$showHideText","ariaHidden","getButtonPunctuationEl","parentNode","$summarySpan","$summarySpanFocus","removeChild","$fragment","target","Element","closest","expanded","HTMLButtonElement","storeState","nowExpanded","$content","textContent","ariaLabelParts","push","ariaLabelMessage","join","remove","sectionsCount","expandedSectionCount","toString","rememberExpanded","contentId","contentState","sessionStorage","setItem","getItem","$punctuationEl","moduleName","freeze","hideAllSections","hideSectionAriaLabel","showAllSections","showSectionAriaLabel","testString","result","removeItem","exception","DEBOUNCE_TIMEOUT_IN_SECONDS","Button","debounceFormSubmitTimer","handleKeyDown","debounce","$target","preventDefault","click","preventDoubleClick","setTimeout","Checkboxes","$inputs","$input","targetId","getElementById","syncAllConditionalReveals","handleClick","syncConditionalRevealWithInputState","inputIsChecked","checked","toggle","unCheckAllInputsExcept","allInputsWithSameName","$inputWithSameName","hasSameFormOwner","form","unCheckExclusiveInputs","allInputsWithSameNameAndExclusiveBehaviour","$exclusiveInput","$clickedInput","HTMLInputElement","hasAriaControls","hasBehaviourExclusive","ErrorSummary","disableAutoFocus","focusTarget","HTMLAnchorElement","inputId","href","$legendOrLabel","getAssociatedLegendOrLabel","scrollIntoView","preventScroll","_document$querySelect","$fieldset","$legends","getElementsByTagName","$candidateLegend","legendTop","getBoundingClientRect","top","inputRect","height","innerHeight","inputBottom","FileUpload","$uploadContainer","$fileInput","$uploadButton","uploadContainer","fileInput","uploadButton","initEventListeners","_this$$fileInput2","_this$$fileInput","_this$$fileInput3","handleFiles","files","e","onDragEnter","onDragOver","onDragLeave","onDrop","_this$$uploadContaine","stopPropagation","_this$$uploadContaine2","_this$$uploadContaine3","_event$dataTransfer","dataTransfer","alert","Header","$menuButton","$menu","$dropdownToggle","$profileDialog","menuIsOpen","mql","dropdownItems","dropdownItem","Dropdown","header","menuId","websitesNavBody","websitesNavBtn","_websitesNavBtn$query","ariaExpanded","iconClassList","menu","handleMenuButtonClick","setupResponsiveChecks","dropdownToggle","openCloseDropdownMenu","profileDialog","HTMLDialogElement","profileButton","profileCloseButton","open","_this$$profileDialog","close","_this$$profileDialog2","showModal","breakpoint","matchMedia","checkMode","addListener","matches","_this$$menu","_this$$menuButton","_this$$header$querySe","_this$$header$querySe2","_this$$menuButton2","_this$$menuButton3","_this$$menu2","createMaterialIcon","_this$$menu3","_this$$header$querySe3","_this$$header$querySe4","_this$$header$querySe5","log","_this$$menu4","_this$$header$querySe6","_this$$header$querySe7","_this$$header$querySe8","clickOutsideClose","iconName","parentElem","spanIcon","className","openedElem","Node","_this$button","button","isOpen","buttonElement","optionsElement","_this$$module$dataset","label","pseudolabel","_this$button$querySel","_this$options","ariaLabel","_this$button$querySel2","_this$options2","NotificationBanner","Radios","$allInputs","$clickedInputForm","$clickedInputName","hasSameName","Textarea","counter","textarea","counterElement","handleChange","el","HTMLTextAreaElement","initAll","_config$scope","components","accordion","errorSummary","notificationBanner","scope","$elements","error"],"mappings":"AAUO,MAAMA,OAAO,GAAG;;ACMhB,SAASC,eAAeA,CAACC,KAAK,EAAEC,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