hmrc-frontend 7.44.0 → 7.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["src/components/back-link-helper/back-link-helper.js","src/components/timeout-dialog/utils.js","src/components/timeout-dialog/dialog.js","src/components/timeout-dialog/validate-input.js","src/components/timeout-dialog/redirectHelper.js","src/components/timeout-dialog/timeout-dialog.js","src/components/user-research-banner/user-research-banner.js","src/utils/cookies.js","src/components/timeout-dialog/session-activity-service.js","src/components/hmrc-print-link/hmrc-print-link.js","src/all.js","src/all-govuk-and-hmrc.js"],"names":["BackLinkHelper","$module","window","document","this","prototype","init","_this","history","replaceState","location","href","addEventListener","event","preventDefault","back","warn","console","utils","generateDomElementFromString","str","abc","createElement","innerHTML","firstChild","generateDomElementFromStringAndAppendText","text","$tmp","innerText","hasClass","selector","className","querySelector","classList","contains","addClass","querySelectorAll","forEach","i","add","removeClass","remove","removeElement","$elem","parent","parentNode","removeChild","ajaxGet","url","success","xhr","XMLHttpRequest","open","onreadystatechange","readyState","status","responseText","setRequestHeader","send","dialog","displayDialog","$elementToDisplay","$dialog","$overlay","$preparedElementToDisplay","resetElementsFunctionList","closeCallbacks","appendChild","push","body","handleTouch","elements","join","close","length","shift","fn","value","getAttribute","setAttribute","removeAttribute","keepFocus","modalFocus","getElementById","target","stopPropagation","focus","elemToFocusOnReset","activeElement","removeEventListener","setupFocusHandlerAndFocusDialog","keydownListener","e","keyCode","setupKeydownHandler","touches","changedTouches","closeDialog","setAriaLabelledBy","addCloseHandler","closeHandler","ValidateInput","RedirectHelper","TimeoutDialog","$sessionActivityService","currentTimer","options","settings","cleanupFunctions","sessionActivityService","listenForSessionActivityAndResetDialogTimer","synchroniseTabs","onActivity","timeOfActivity","timestamp","cleanup","setupDialogTimer","validateInput","config","missingRequiredConfig","item","concat","replace","toLowerCase","Error","mergeOptionsWithDefaults","theOptions","localisedDefaults","clone","_objectSpread","Object","keys","key","_typeof","undefined","timeOfLastActivity","arguments","getDateNow","signoutTime","timeout","delta","secondsUntilTimeoutDialog","countdown","setTimeout","setupDialog","clearTimeout","$element","title","$countdownElement","$audibleMessage","$visualMessge","message","createTextNode","messageSuffix","$staySignedInButton","keepAliveButtonText","$wrapper","keepAliveAndClose","hideSignOutButton","$signOutButton","signOutButtonText","signOut","signOutUrl","dialogControl","getMillisecondsRemaining","getHumanText","counter","minutes","visibleMessage","properties","Math","ceil","roundSecondsUp","updateTextIfChanged","updateCountdown","audibleHumanText","humanText","messageParts","getAudibleHumanText","runUpdate","remaining","roundedRemaining","max","round","floor","keepAliveUrl","logActivity","Date","now","redirectToUrl","timeoutUrl","validate","lookupData","attributes","getNamedItem","string","minute","seconds","second","stringToValidate","parsedInt","parseInt","Number","isNaN","String","redirectHelper","UserResearchBanner","$closeLink","cookieName","cookieExpiryDays","cookieData","name","nameEQ","cookies","cookie","split","len","charAt","substring","indexOf","decodeURIComponent","getCookie","eventHandlers","noThanksClick","bind","cookieString","days","date","setTime","getTime","toGMTString","protocol","setCookie","SessionActivityService","_createClass","BrowserBroadcastChannel","_classCallCheck","activityChannel","postMessage","callback","onmessage","data","HmrcPrintLink","print","HMRCFrontend","initAll","logAndIgnoreErrors","error","$HmrcPrintLink","BroadcastChannel","$TimeoutDialog","$UserResearchBanner","$BackLink"],"mappings":"utzCAAA,SAASA,EAAeC,EAASC,EAAQC,GACvCC,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKD,SAAWA,CAClB,C,soCAEAH,EAAeK,UAAUC,KAAO,WAAgB,IAAAC,EAAAH,KAE1CA,KAAKF,OAAOM,UAEVJ,KAAKF,OAAOM,QAAQC,cAA4D,mBAArCL,KAAKF,OAAOM,QAAQC,cACjEL,KAAKF,OAAOM,QAAQC,aAAa,KAAM,KAAML,KAAKF,OAAOQ,SAASC,MAGpEP,KAAKH,QAAQW,iBAAiB,SAAS,SAACC,GACtCA,EAAMC,iBACFP,EAAK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MoO,KACjB,EAEJ,IAAC,CAlBwC,GCA3C,SAASC,EAAcjP,EAASC,GAC9BE,KAAKH,QAAUA,EACfG,KAAKF,OAASA,CAChB,CAEAgP,EAAc7O,UAAUC,KAAO,WAAgB,IAAAC,EAAAH,KAC7CA,KAAKH,QAAQW,iBAAiB,SAAS,SAACC,GACtCA,EAAMC,iBACNP,EAAKL,OAAOiP,OACd,GACF,ECsCA,IAAAC,EAAe,CACbC,QA3CF,WACE,SAASC,EAAmBhP,GAC1B,IACEA,GACF,CAAE,MAAOiP,GAEPtO,QAAQsO,MAAM,gDAAiDA,EACjE,CACF,CAEwBpP,SAASiC,iBAAiB,oCAClCC,SAAQ,SAACmN,GACvBF,GAAmB,WACjB,IAAIJ,EAAcM,EAAgBtP,QAAQI,MAC5C,GACF,IAEA,IAAMuG,EAAyB,IAAI4H,EAAuBvO,OAAOuP,kBACjE5I,EAAuB6E,cAEvB,IAAMgE,EAAiBvP,SAAS6B,cAAc,oCAC1C0N,GACFJ,GAAmB,WACjB,IAAI/I,EAAcmJ,EAAgB7I,GAAwBvG,MAC5D,IAGF,IAAMqP,EAAsBxP,SAAS6B,cAAc,6CAC/C2N,GACFL,GAAmB,WACjB,IAAIxC,EAAmB6C,GAAqBrP,MAC9C,IAGiBH,SAASiC,iBAAiB,kCAClCC,SAAQ,SAACuN,GAClBN,GAAmB,WACjB,IAAItP,EAAe4P,EAAW1P,OAAQC,UAAUG,MAClD,GACF,GACF,EAIEiG,gBACAuG,qBACA9M,mB,07BCjDFqP,GACAD,EAAaC,S","file":"../hmrc-frontend-7.46.0.min.js","sourcesContent":["function BackLinkHelper($module, window, document) {\n this.$module = $module;\n this.window = window;\n this.document = document;\n}\n\nBackLinkHelper.prototype.init = function init() {\n // do nothing if History API is absent\n if (this.window.history) {\n // prevent resubmit warning\n if (this.window.history.replaceState && typeof this.window.history.replaceState === 'function') {\n this.window.history.replaceState(null, null, this.window.location.href);\n }\n\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n if (this.window.history.back && typeof this.window.history.back === 'function') {\n this.window.history.back();\n }\n });\n }\n};\n\nexport default BackLinkHelper;\n","const { warn } = console;\n\nconst utils = {\n generateDomElementFromString(str) {\n const abc = document.createElement('div');\n abc.innerHTML = str;\n return abc.firstChild;\n },\n\n generateDomElementFromStringAndAppendText(str, text) {\n const $tmp = utils.generateDomElementFromString(str);\n $tmp.innerText = text;\n return $tmp;\n },\n\n hasClass(selector, className) {\n return document.querySelector(selector).classList.contains(className);\n },\n\n addClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.add(className); });\n },\n\n removeClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.remove(className); });\n },\n\n removeElement($elem) {\n const parent = $elem.parentNode;\n if (parent) {\n parent.removeChild($elem);\n } else {\n warn(\"couldn't find parent for elem\", $elem);\n }\n },\n\n ajaxGet(url, success) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.onreadystatechange = () => {\n if (xhr.readyState > 3 && xhr.status === 200) success(xhr.responseText);\n };\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n xhr.send();\n return xhr;\n },\n};\n\nexport default utils;\n","import utils from './utils';\n\nfunction displayDialog($elementToDisplay) {\n const $dialog = utils.generateDomElementFromString('<div id=\"hmrc-timeout-dialog\" tabindex=\"-1\" role=\"dialog\" aria-modal=\"true\" class=\"hmrc-timeout-dialog\">');\n const $overlay = utils.generateDomElementFromString('<div id=\"hmrc-timeout-overlay\" class=\"hmrc-timeout-overlay\">');\n const $preparedElementToDisplay = typeof $elementToDisplay === 'string' ? utils.generateDomElementFromString($elementToDisplay) : $elementToDisplay;\n const resetElementsFunctionList = [];\n const closeCallbacks = [];\n\n $dialog.appendChild($preparedElementToDisplay);\n\n if (!utils.hasClass('html', 'noScroll')) {\n utils.addClass('html', 'noScroll');\n resetElementsFunctionList.push(() => {\n utils.removeClass('html', 'noScroll');\n });\n }\n document.body.appendChild($dialog);\n document.body.appendChild($overlay);\n\n resetElementsFunctionList.push(() => {\n utils.removeElement($dialog);\n utils.removeElement($overlay);\n });\n\n const setupFocusHandlerAndFocusDialog = () => {\n function keepFocus(event) {\n const modalFocus = document.getElementById('hmrc-timeout-dialog');\n if (modalFocus) {\n if (event.target !== modalFocus && !modalFocus.contains(event.target)) {\n event.stopPropagation();\n modalFocus.focus();\n }\n }\n }\n\n const elemToFocusOnReset = document.activeElement;\n $dialog.focus();\n\n document.addEventListener('focus', keepFocus, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('focus', keepFocus);\n elemToFocusOnReset.focus();\n });\n };\n\n // disable the non-dialog page to prevent confusion for VoiceOver users\n const selectors = [\n '#skiplink-container',\n 'body > header',\n '#global-cookie-message',\n 'main',\n 'body > footer',\n 'body > .govuk-skip-link',\n '.cbanner-govuk-cookie-banner',\n 'body > .govuk-width-container',\n ];\n const elements = document.querySelectorAll(selectors.join(', '));\n const close = () => {\n while (resetElementsFunctionList.length > 0) {\n const fn = resetElementsFunctionList.shift();\n fn();\n }\n };\n const closeAndInform = () => {\n closeCallbacks.forEach((fn) => { fn(); });\n close();\n };\n const setupKeydownHandler = () => {\n function keydownListener(e) {\n if (e.keyCode === 27) {\n closeAndInform();\n }\n }\n\n document.addEventListener('keydown', keydownListener);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('keydown', keydownListener);\n });\n };\n const preventMobileScrollWhileAllowingPinchZoom = () => {\n const handleTouch = (e) => {\n const touches = e.touches || e.changedTouches || [];\n\n if (touches.length === 1) {\n e.preventDefault();\n }\n };\n\n document.addEventListener('touchmove', handleTouch, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('touchmove', handleTouch, true);\n });\n };\n\n elements.forEach(($elem) => {\n const value = $elem.getAttribute('aria-hidden');\n $elem.setAttribute('aria-hidden', 'true');\n resetElementsFunctionList.push(() => {\n if (value) {\n $elem.setAttribute('aria-hidden', value);\n } else {\n $elem.removeAttribute('aria-hidden');\n }\n });\n });\n\n //\n setupFocusHandlerAndFocusDialog();\n\n setupKeydownHandler();\n\n preventMobileScrollWhileAllowingPinchZoom();\n\n return {\n closeDialog() {\n close();\n },\n setAriaLabelledBy(value) {\n if (value) {\n $dialog.setAttribute('aria-labelledby', value);\n } else {\n $dialog.removeAttribute('aria-labelledby');\n }\n },\n addCloseHandler(closeHandler) {\n closeCallbacks.push(closeHandler);\n },\n };\n}\n\nexport default { displayDialog };\n","function ValidateInput() {\n}\n\nValidateInput.int = (stringToValidate) => {\n const parsedInt = parseInt(stringToValidate, 10);\n return Number.isNaN(parsedInt) ? undefined : parsedInt;\n};\n\nValidateInput.string = (stringToValidate) => (typeof stringToValidate === 'string' ? stringToValidate : undefined);\n\nValidateInput.boolean = (stringToValidate) => String(stringToValidate).toLowerCase() === 'true';\n\nexport default ValidateInput;\n","function RedirectHelper() {}\n\nRedirectHelper.redirectToUrl = (url) => {\n // This exists to make redirects more testable\n window.location.href = url;\n};\n\nexport default RedirectHelper;\n","/* oxlint-disable no-use-before-define */\nimport dialog from './dialog';\nimport ValidateInput from './validate-input';\nimport RedirectHelper from './redirectHelper';\nimport utils from './utils';\n\n// TODO: rewrite this to follow govuk-frontend prototype module pattern\n\nfunction TimeoutDialog($module, $sessionActivityService) {\n let options = {};\n let settings = {};\n const cleanupFunctions = [];\n let currentTimer;\n const sessionActivityService = $sessionActivityService;\n\n function init() {\n const validate = ValidateInput;\n\n function lookupData(key) {\n return ($module.attributes.getNamedItem(key) || {}).value;\n }\n\n const localisedDefaults = validate.string(lookupData('data-language')) === 'cy' ? {\n title: 'Rydych ar fin cael eich allgofnodi',\n message: 'Er eich diogelwch, byddwn yn eich allgofnodi cyn pen',\n keepAliveButtonText: 'Parhau i fod wedi’ch mewngofnodi',\n signOutButtonText: 'Allgofnodi',\n properties: {\n minutes: 'funud',\n minute: 'funud',\n seconds: 'eiliad',\n second: 'eiliad',\n },\n } : {\n title: 'You’re about to be signed out',\n message: 'For your security, we will sign you out in',\n keepAliveButtonText: 'Stay signed in',\n signOutButtonText: 'Sign out',\n properties: {\n minutes: 'minutes',\n minute: 'minute',\n seconds: 'seconds',\n second: 'second',\n },\n };\n\n options = {\n timeout: validate.int(lookupData('data-timeout')),\n countdown: validate.int(lookupData('data-countdown')),\n keepAliveUrl: validate.string(lookupData('data-keep-alive-url')),\n signOutUrl: validate.string(lookupData('data-sign-out-url')),\n timeoutUrl: validate.string(lookupData('data-timeout-url')),\n title: validate.string(lookupData('data-title')),\n message: validate.string(lookupData('data-message')),\n messageSuffix: validate.string(lookupData('data-message-suffix')),\n keepAliveButtonText: validate.string(\n lookupData('data-keep-alive-button-text'),\n ),\n signOutButtonText: validate.string(\n lookupData('data-sign-out-button-text'),\n ),\n synchroniseTabs: validate.boolean(\n lookupData('data-synchronise-tabs') || false,\n ),\n hideSignOutButton: validate.boolean(\n lookupData('data-hide-sign-out-button') || false,\n ),\n };\n\n // Default timeoutUrl to signOutUrl if not set\n options.timeoutUrl = options.timeoutUrl || options.signOutUrl;\n\n validateInput(options);\n settings = mergeOptionsWithDefaults(options, localisedDefaults);\n setupDialogTimer();\n listenForSessionActivityAndResetDialogTimer();\n }\n\n const broadcastSessionActivity = () => {\n sessionActivityService.logActivity();\n };\n\n const listenForSessionActivityAndResetDialogTimer = () => {\n if (settings.synchroniseTabs) {\n sessionActivityService.onActivity((event) => {\n const timeOfActivity = event.timestamp;\n cleanup();\n setupDialogTimer(timeOfActivity);\n });\n }\n };\n\n const validateInput = (config) => {\n const requiredConfig = ['timeout', 'countdown', 'keepAliveUrl', 'signOutUrl'];\n const missingRequiredConfig = [];\n\n requiredConfig.forEach((item) => {\n if (!config[item]) {\n missingRequiredConfig.push(`data-${item.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()}`);\n }\n });\n\n if (missingRequiredConfig.length > 0) {\n throw new Error(\n `Missing config item(s): [${missingRequiredConfig.join(', ')}]`,\n );\n }\n };\n\n const mergeOptionsWithDefaults = (theOptions, localisedDefaults) => {\n const clone = { ...theOptions };\n\n Object.keys(localisedDefaults).forEach((key) => {\n if (typeof clone[key] === 'object') {\n clone[key] = mergeOptionsWithDefaults(\n theOptions[key],\n localisedDefaults[key],\n );\n }\n if (clone[key] === undefined || clone[key] === '') {\n clone[key] = localisedDefaults[key];\n }\n });\n\n return clone;\n };\n\n const setupDialogTimer = (timeOfLastActivity = getDateNow()) => {\n const signoutTime = timeOfLastActivity + settings.timeout * 1000;\n\n const delta = getDateNow() - timeOfLastActivity;\n const secondsUntilTimeoutDialog = settings.timeout - settings.countdown;\n const timeout = window.setTimeout(() => {\n setupDialog(signoutTime);\n }, (secondsUntilTimeoutDialog * 1000) - delta);\n\n cleanupFunctions.push(() => {\n window.clearTimeout(timeout);\n if (currentTimer) {\n window.clearTimeout(currentTimer);\n }\n });\n };\n\n const setupDialog = (signoutTime) => {\n const $element = utils.generateDomElementFromString('<div>');\n\n if (settings.title) {\n const $tmp = utils.generateDomElementFromStringAndAppendText(\n '<h1 id=\"hmrc-timeout-heading\" class=\"govuk-heading-m push--top\">',\n settings.title,\n );\n $element.appendChild($tmp);\n }\n\n const $countdownElement = utils.generateDomElementFromString(\n '<span id=\"hmrc-timeout-countdown\" class=\"hmrc-timeout-dialog__countdown\">',\n );\n\n const $audibleMessage = utils.generateDomElementFromString('<p id=\"hmrc-timeout-message\" class=\"govuk-visually-hidden screenreader-content\" aria-live=\"assertive\">');\n const $visualMessge = utils.generateDomElementFromStringAndAppendText(\n '<p class=\"govuk-body hmrc-timeout-dialog__message\" aria-hidden=\"true\">',\n settings.message,\n );\n $visualMessge.appendChild(document.createTextNode(' '));\n $visualMessge.appendChild($countdownElement);\n if (settings.messageSuffix) {\n $visualMessge.appendChild(document.createTextNode(` ${settings.messageSuffix}`));\n }\n\n const $staySignedInButton = utils.generateDomElementFromStringAndAppendText(\n '<button id=\"hmrc-timeout-keep-signin-btn\" class=\"govuk-button\">',\n settings.keepAliveButtonText,\n );\n\n const $wrapper = document.createElement('div');\n $wrapper.classList.add('govuk-button-group');\n $wrapper.appendChild($staySignedInButton);\n\n $element.appendChild($visualMessge);\n $element.appendChild($audibleMessage);\n $staySignedInButton.addEventListener('click', keepAliveAndClose);\n $element.appendChild(document.createTextNode(' '));\n\n if (!settings.hideSignOutButton) {\n const $signOutButton = utils.generateDomElementFromStringAndAppendText(\n '<a id=\"hmrc-timeout-sign-out-link\" class=\"govuk-link hmrc-timeout-dialog__link\">',\n settings.signOutButtonText,\n );\n $signOutButton.addEventListener('click', signOut);\n $signOutButton.setAttribute('href', settings.signOutUrl);\n\n $wrapper.appendChild($signOutButton);\n }\n\n $element.appendChild($wrapper);\n\n const dialogControl = dialog.displayDialog($element);\n\n cleanupFunctions.push(() => {\n dialogControl.closeDialog();\n });\n\n dialogControl.addCloseHandler(keepAliveAndClose);\n\n dialogControl.setAriaLabelledBy('hmrc-timeout-heading hmrc-timeout-message');\n\n const getMillisecondsRemaining = () => signoutTime - getDateNow();\n const getSecondsRemaining = () => Math.round(getMillisecondsRemaining() / 1000);\n\n const getHumanText = (counter) => {\n let minutes; let\n visibleMessage;\n if (counter < 60) {\n visibleMessage = `${counter} ${settings.properties[counter !== 1 ? 'seconds' : 'second']}.`;\n } else {\n minutes = Math.ceil(counter / 60);\n visibleMessage = `${minutes} ${settings.properties[minutes === 1 ? 'minute' : 'minutes']}.`;\n }\n return visibleMessage;\n };\n\n const getAudibleHumanText = (counter) => {\n const humanText = getHumanText(roundSecondsUp(counter));\n const messageParts = [settings.message, ' ', humanText];\n if (settings.messageSuffix) {\n messageParts.push(' ');\n messageParts.push(settings.messageSuffix);\n }\n return messageParts.join('');\n };\n\n const roundSecondsUp = (counter) => {\n if (counter > 60) {\n return counter;\n } if (counter < 20) {\n return 20;\n }\n return Math.ceil(counter / 20) * 20;\n };\n\n const updateTextIfChanged = ($elem, text) => {\n if ($elem.innerText !== text) {\n // oxlint-disable-next-line no-param-reassign\n $elem.innerText = text;\n }\n };\n\n const updateCountdown = (counter) => {\n const visibleMessage = getHumanText(counter);\n const audibleHumanText = getAudibleHumanText(counter);\n\n updateTextIfChanged($countdownElement, visibleMessage);\n updateTextIfChanged($audibleMessage, audibleHumanText);\n };\n\n const getNextTimeout = () => {\n const remaining = getMillisecondsRemaining();\n const roundedRemaining = Math.floor(getMillisecondsRemaining() / 1000) * 1000;\n if (roundedRemaining <= 60000) {\n return (remaining - roundedRemaining) || 1000;\n }\n return remaining - (roundedRemaining - (roundedRemaining % 60000 || 60000));\n };\n\n const runUpdate = () => {\n const counter = Math.max(getSecondsRemaining(), 0);\n updateCountdown(counter);\n if (counter === 0) {\n timeout();\n } else {\n currentTimer = window.setTimeout(runUpdate, getNextTimeout());\n }\n };\n\n runUpdate();\n };\n\n const keepAliveAndClose = () => {\n cleanup();\n setupDialogTimer();\n utils.ajaxGet(settings.keepAliveUrl, () => {});\n broadcastSessionActivity();\n };\n\n const getDateNow = () => Date.now();\n\n const signOut = () => {\n RedirectHelper.redirectToUrl(settings.signOutUrl);\n };\n\n const timeout = () => {\n RedirectHelper.redirectToUrl(settings.timeoutUrl);\n };\n\n const cleanup = () => {\n while (cleanupFunctions.length > 0) {\n const fn = cleanupFunctions.shift();\n fn();\n }\n };\n\n return { init, cleanup };\n}\n\nTimeoutDialog.dialog = dialog;\nTimeoutDialog.redirectHelper = RedirectHelper;\nTimeoutDialog.utils = utils;\n\nexport default TimeoutDialog;\n","import { getCookie, setCookie } from '../../utils/cookies';\n\nfunction UserResearchBanner($module) {\n this.$module = $module;\n this.$closeLink = this.$module.querySelector('.hmrc-user-research-banner__close');\n this.cookieName = 'mdtpurr';\n this.cookieExpiryDays = 28;\n}\n\nUserResearchBanner.prototype.init = function init() {\n const cookieData = getCookie(this.cookieName);\n\n if (cookieData == null) {\n this.$module.classList.add('hmrc-user-research-banner--show');\n if (this.$closeLink) {\n this.$closeLink.addEventListener('click', this.eventHandlers.noThanksClick.bind(this));\n }\n }\n};\n\nUserResearchBanner.prototype.eventHandlers = {\n noThanksClick(event) {\n event.preventDefault();\n\n setCookie(this.cookieName, 'suppress_for_all_services', { days: this.cookieExpiryDays });\n this.$module.classList.remove('hmrc-user-research-banner--show');\n },\n};\n\nexport default UserResearchBanner;\n","// Based on https://github.com/alphagov/govuk_template_jinja\nexport const setCookie = (name, value, options = {}) => {\n let cookieString = `${name}=${value}; path=/`;\n if (options.days) {\n const date = new Date();\n date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));\n cookieString = `${cookieString}; expires=${date.toGMTString()}`;\n }\n if (window.location.protocol === 'https:') {\n cookieString += '; Secure';\n }\n document.cookie = cookieString;\n\n return cookieString;\n};\n\nexport const getCookie = (name) => {\n const nameEQ = `${name}=`;\n const cookies = document.cookie.split(';');\n for (let i = 0, len = cookies.length; i < len; i += 1) {\n let cookie = cookies[i];\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1, cookie.length);\n }\n if (cookie.indexOf(nameEQ) === 0) {\n return decodeURIComponent(cookie.substring(nameEQ.length));\n }\n }\n return null;\n};\n","export default class SessionActivityService {\n constructor(BrowserBroadcastChannel) {\n this.activityChannel = BrowserBroadcastChannel && new BrowserBroadcastChannel('session-activity');\n }\n\n logActivity() {\n if (this.activityChannel) {\n const event = { timestamp: Date.now() };\n this.activityChannel.postMessage(event);\n }\n }\n\n onActivity(callback) {\n if (this.activityChannel) {\n this.activityChannel.onmessage = (event) => {\n callback(event.data);\n };\n }\n }\n}\n","function HmrcPrintLink($module, window) {\n this.$module = $module;\n this.window = window;\n}\n\nHmrcPrintLink.prototype.init = function init() {\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n this.window.print();\n });\n};\n\nexport default HmrcPrintLink;\n","import BackLinkHelper from './components/back-link-helper/back-link-helper';\nimport TimeoutDialog from './components/timeout-dialog/timeout-dialog';\nimport UserResearchBanner from './components/user-research-banner/user-research-banner';\nimport SessionActivityService from './components/timeout-dialog/session-activity-service';\nimport HmrcPrintLink from './components/hmrc-print-link/hmrc-print-link';\n\nfunction initAll() {\n function logAndIgnoreErrors(init) {\n try {\n init();\n } catch (error) {\n // oxlint-disable-next-line no-console\n console.error('hmrc-frontend component initialisation failed', error);\n }\n }\n\n const $HmrcPrintLinks = document.querySelectorAll('a[data-module=\"hmrc-print-link\"]');\n $HmrcPrintLinks.forEach(($HmrcPrintLink) => {\n logAndIgnoreErrors(() => {\n new HmrcPrintLink($HmrcPrintLink, window).init();\n });\n });\n\n const sessionActivityService = new SessionActivityService(window.BroadcastChannel);\n sessionActivityService.logActivity();\n\n const $TimeoutDialog = document.querySelector('meta[name=\"hmrc-timeout-dialog\"]');\n if ($TimeoutDialog) {\n logAndIgnoreErrors(() => {\n new TimeoutDialog($TimeoutDialog, sessionActivityService).init();\n });\n }\n\n const $UserResearchBanner = document.querySelector('[data-module=\"hmrc-user-research-banner\"]');\n if ($UserResearchBanner) {\n logAndIgnoreErrors(() => {\n new UserResearchBanner($UserResearchBanner).init();\n });\n }\n\n const $BackLinks = document.querySelectorAll('[data-module=\"hmrc-back-link\"]');\n $BackLinks.forEach(($BackLink) => {\n logAndIgnoreErrors(() => {\n new BackLinkHelper($BackLink, window, document).init();\n });\n });\n}\n\nexport default {\n initAll,\n TimeoutDialog,\n UserResearchBanner,\n BackLinkHelper,\n};\n","import { initAll } from 'govuk-frontend/dist/govuk/govuk-frontend.min.js';\nimport HMRCFrontend from './all';\n\ninitAll();\nHMRCFrontend.initAll();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hmrc-frontend",
3
- "version": "7.44.0",
3
+ "version": "7.46.0",
4
4
  "description": "Design patterns for HMRC frontends",
5
5
  "scripts": {},
6
6
  "repository": {
@@ -23,6 +23,6 @@
23
23
  "homepage": "https://github.com/hmrc/hmrc-frontend#readme",
24
24
  "dependencies": {
25
25
  "accessible-autocomplete": "^3.0.2",
26
- "govuk-frontend": "^6.5.0"
26
+ "govuk-frontend": "^6.6.0"
27
27
  }
28
28
  }
@@ -1,3 +0,0 @@
1
- !function(){"use strict";function t(t){const e=`--govuk-breakpoint-${t}`;return{property:e,value:window.getComputedStyle(document.documentElement).getPropertyValue(e)||void 0}}function e(t,e={}){var n;const i=t.getAttribute("tabindex");function o(){var n;null==(n=e.onBlur)||n.call(t),i||t.removeAttribute("tabindex")}i||t.setAttribute("tabindex","-1"),t.addEventListener("focus",(function(){t.addEventListener("blur",o,{once:!0})}),{once:!0}),null==(n=e.onBeforeFocus)||n.call(t),t.focus()}function n(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function i(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function o(t){return!!t&&(t instanceof Element||t instanceof Document)}function s(t,e){return`${t.moduleName}: ${e}`}class r extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class a extends r{constructor(t=document.body){const e="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(t?e:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class c extends r{constructor(...t){super(...t),this.name="ConfigError"}}class u extends r{constructor(t){let e="string"==typeof t?t:"";if(i(t)){const{component:n,identifier:i,element:o,expectedType:r}=t;e=i,e+=o?` is not of type ${null!=r?r:"HTMLElement"}`:" not found",n&&(e=s(n,e))}super(e),this.name="ElementError"}}class l extends r{constructor(t){super("string"==typeof t?t:s(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class d{get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new l("`moduleName` not defined in component");if(!(t instanceof e.elementType))throw new u({element:t,component:e,identifier:"Root element (`$root`)",expectedType:e.elementType.name});this._$root=t,e.checkSupport(),this.checkInitialised();const n=e.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const t=this.constructor,e=t.moduleName;if(e&&function(t,e){return t instanceof HTMLElement&&t.hasAttribute(`data-${e}-init`)}(this.$root,e))throw new l(t)}static checkSupport(){if(!n())throw new a}}d.elementType=HTMLElement;const h=Symbol.for("configOverride");class p extends d{[h](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!i(n.defaults))throw new c(s(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(t,e){if(!i(t.schema))throw new c(s(t,"Config passed as parameter into constructor but no schema defined"));const n={},o=Object.entries(t.schema.properties);for(const i of o){const[o,s]=i,r=o.toString();r in e&&(n[r]=m(e[r],s)),"object"===(null==s?void 0:s.type)&&(n[r]=v(t.schema,e,o))}return n}(n,this._$root.dataset);this._config=f(n.defaults,null!=e?e:{},this[h](o),o)}}function m(t,e){const n=t?t.trim():"";let i,o=null==e?void 0:e.type;switch(o||(["true","false"].includes(n)&&(o="boolean"),n.length>0&&isFinite(Number(n))&&(o="number")),o){case"boolean":i="true"===n;break;case"number":i=Number(n);break;default:i=t}return i}function g(t){let e,n=document;if(i(t)){const i=t;(o(i.scope)||null===i.scope)&&(n=i.scope),"function"==typeof i.onError&&(e=i.onError)}return o(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}function f(...t){const e={};for(const n of t)for(const t of Object.keys(n)){const o=e[t],s=n[t];i(o)&&i(s)?e[t]=f(o,s):e[t]=s}return e}function v(t,e,n){const o=t.properties[n];if("object"!==(null==o?void 0:o.type))return;const s={[n]:{}};for(const[t,o]of Object.entries(e)){let e=s;const r=t.split(".");for(const[s,a]of r.entries())i(e)&&(s<r.length-1?(i(e[a])||(e[a]={}),e=e[a]):t!==n&&(e[a]=m(o)))}return s[n]}class b{constructor(t={},e={}){var n;this.translations=void 0,this.locale=void 0,this.translations=t,this.locale=null!=(n=e.locale)?n:document.documentElement.lang||"en"}t(t,e){if(!t)throw new Error("i18n: lookup key missing");let n=this.translations[t];if("number"==typeof(null==e?void 0:e.count)&&i(n)){const i=n[this.getPluralSuffix(t,e.count)];i&&(n=i)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}return n}return t}replacePlaceholders(t,e){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return t.replace(/%{(.\S+)}/g,(function(t,i){if(Object.prototype.hasOwnProperty.call(e,i)){const t=e[i];return!1===t||"number"!=typeof t&&"string"!=typeof t?"":"number"==typeof t?n?n.format(t):`${t}`:t}throw new Error(`i18n: no data found to replace ${t} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(t,e){if(e=Number(e),!isFinite(e))return"other";const n=this.translations[t],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):"other";if(i(n)){if(o in n)return o;if("other"in n)return console.warn(`i18n: Missing plural form ".${o}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}}class w extends p{constructor(t,e={}){super(t,e),this.i18n=void 0,this.controlsClass="govuk-accordion__controls",this.showAllClass="govuk-accordion__show-all",this.showAllTextClass="govuk-accordion__show-all-text",this.sectionClass="govuk-accordion__section",this.sectionExpandedClass="govuk-accordion__section--expanded",this.sectionButtonClass="govuk-accordion__section-button",this.sectionHeaderClass="govuk-accordion__section-header",this.sectionHeadingClass="govuk-accordion__section-heading",this.sectionHeadingDividerClass="govuk-accordion__section-heading-divider",this.sectionHeadingTextClass="govuk-accordion__section-heading-text",this.sectionHeadingTextFocusClass="govuk-accordion__section-heading-text-focus",this.sectionShowHideToggleClass="govuk-accordion__section-toggle",this.sectionShowHideToggleFocusClass="govuk-accordion__section-toggle-focus",this.sectionShowHideTextClass="govuk-accordion__section-toggle-text",this.upChevronIconClass="govuk-accordion-nav__chevron",this.downChevronIconClass="govuk-accordion-nav__chevron--down",this.sectionSummaryClass="govuk-accordion__section-summary",this.sectionSummaryFocusClass="govuk-accordion__section-summary-focus",this.sectionContentClass="govuk-accordion__section-content",this.$sections=void 0,this.$showAllButton=null,this.$showAllIcon=null,this.$showAllText=null,this.i18n=new b(this.config.i18n);const n=this.$root.querySelectorAll(`.${this.sectionClass}`);if(!n.length)throw new u({component:w,identifier:`Sections (\`<div class="${this.sectionClass}">\`)`});this.$sections=n,this.initControls(),this.initSectionHeaders(),this.updateShowAllButton(this.areAllSectionsOpen())}initControls(){this.$showAllButton=document.createElement("button"),this.$showAllButton.setAttribute("type","button"),this.$showAllButton.setAttribute("class",this.showAllClass),this.$showAllButton.setAttribute("aria-expanded","false"),this.$showAllIcon=document.createElement("span"),this.$showAllIcon.classList.add(this.upChevronIconClass),this.$showAllButton.appendChild(this.$showAllIcon);const t=document.createElement("div");t.setAttribute("class",this.controlsClass),t.appendChild(this.$showAllButton),this.$root.insertBefore(t,this.$root.firstChild),this.$showAllText=document.createElement("span"),this.$showAllText.classList.add(this.showAllTextClass),this.$showAllButton.appendChild(this.$showAllText),this.$showAllButton.addEventListener("click",(()=>this.onShowOrHideAllToggle())),"onbeforematch"in document&&document.addEventListener("beforematch",(t=>this.onBeforeMatch(t)))}initSectionHeaders(){this.$sections.forEach(((t,e)=>{const n=t.querySelector(`.${this.sectionHeaderClass}`);if(!n)throw new u({component:w,identifier:`Section headers (\`<div class="${this.sectionHeaderClass}">\`)`});this.constructHeaderMarkup(n,e),this.setExpanded(this.isExpanded(t),t),n.addEventListener("click",(()=>this.onSectionToggle(t))),this.setInitialState(t)}))}constructHeaderMarkup(t,e){const n=t.querySelector(`.${this.sectionButtonClass}`),i=t.querySelector(`.${this.sectionHeadingClass}`),o=t.querySelector(`.${this.sectionSummaryClass}`);if(!i)throw new u({component:w,identifier:`Section heading (\`.${this.sectionHeadingClass}\`)`});if(!n)throw new u({component:w,identifier:`Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`});const s=document.createElement("button");s.setAttribute("type","button"),s.setAttribute("aria-controls",`${this.$root.id}-content-${e+1}`);for(const t of Array.from(n.attributes))"id"!==t.name&&s.setAttribute(t.name,t.value);const r=document.createElement("span");r.classList.add(this.sectionHeadingTextClass),r.id=n.id;const a=document.createElement("span");a.classList.add(this.sectionHeadingTextFocusClass),r.appendChild(a),Array.from(n.childNodes).forEach((t=>a.appendChild(t)));const c=document.createElement("span");c.classList.add(this.sectionShowHideToggleClass),c.setAttribute("data-nosnippet","");const l=document.createElement("span");l.classList.add(this.sectionShowHideToggleFocusClass),c.appendChild(l);const d=document.createElement("span"),h=document.createElement("span");if(h.classList.add(this.upChevronIconClass),l.appendChild(h),d.classList.add(this.sectionShowHideTextClass),l.appendChild(d),s.appendChild(r),s.appendChild(this.getButtonPunctuationEl()),o){const t=document.createElement("span"),e=document.createElement("span");e.classList.add(this.sectionSummaryFocusClass),t.appendChild(e);for(const e of Array.from(o.attributes))t.setAttribute(e.name,e.value);Array.from(o.childNodes).forEach((t=>e.appendChild(t))),o.remove(),s.appendChild(t),s.appendChild(this.getButtonPunctuationEl())}s.appendChild(c),i.removeChild(n),i.appendChild(s)}onBeforeMatch(t){const e=t.target;if(!(e instanceof Element))return;const n=e.closest(`.${this.sectionClass}`);n&&this.setExpanded(!0,n)}onSectionToggle(t){const e=!this.isExpanded(t);this.setExpanded(e,t),this.storeState(t,e)}onShowOrHideAllToggle(){const t=!this.areAllSectionsOpen();this.$sections.forEach((e=>{this.setExpanded(t,e),this.storeState(e,t)})),this.updateShowAllButton(t)}setExpanded(t,e){const n=e.querySelector(`.${this.upChevronIconClass}`),i=e.querySelector(`.${this.sectionShowHideTextClass}`),o=e.querySelector(`.${this.sectionButtonClass}`),s=e.querySelector(`.${this.sectionContentClass}`);if(!s)throw new u({component:w,identifier:`Section content (\`<div class="${this.sectionContentClass}">\`)`});if(!n||!i||!o)return;const r=t?this.i18n.t("hideSection"):this.i18n.t("showSection");i.textContent=r,o.setAttribute("aria-expanded",`${t}`);const a=[],c=e.querySelector(`.${this.sectionHeadingTextClass}`);c&&a.push(c.textContent.trim());const l=e.querySelector(`.${this.sectionSummaryClass}`);l&&a.push(l.textContent.trim());const d=t?this.i18n.t("hideSectionAriaLabel"):this.i18n.t("showSectionAriaLabel");a.push(d),o.setAttribute("aria-label",a.join(" , ")),t?(s.removeAttribute("hidden"),e.classList.add(this.sectionExpandedClass),n.classList.remove(this.downChevronIconClass)):(s.setAttribute("hidden","until-found"),e.classList.remove(this.sectionExpandedClass),n.classList.add(this.downChevronIconClass)),this.updateShowAllButton(this.areAllSectionsOpen())}isExpanded(t){return t.classList.contains(this.sectionExpandedClass)}areAllSectionsOpen(){return Array.from(this.$sections).every((t=>this.isExpanded(t)))}updateShowAllButton(t){this.$showAllButton&&this.$showAllText&&this.$showAllIcon&&(this.$showAllButton.setAttribute("aria-expanded",t.toString()),this.$showAllText.textContent=t?this.i18n.t("hideAllSections"):this.i18n.t("showAllSections"),this.$showAllIcon.classList.toggle(this.downChevronIconClass,!t))}getIdentifier(t){const e=t.querySelector(`.${this.sectionButtonClass}`);return null==e?void 0:e.getAttribute("aria-controls")}storeState(t,e){if(!this.config.rememberExpanded)return;const n=this.getIdentifier(t);if(n)try{window.sessionStorage.setItem(n,e.toString())}catch(t){}}setInitialState(t){if(!this.config.rememberExpanded)return;const e=this.getIdentifier(t);if(e)try{const n=window.sessionStorage.getItem(e);null!==n&&this.setExpanded("true"===n,t)}catch(t){}}getButtonPunctuationEl(){const t=document.createElement("span");return t.classList.add("govuk-visually-hidden",this.sectionHeadingDividerClass),t.textContent=", ",t}}w.moduleName="govuk-accordion",w.defaults=Object.freeze({i18n:{hideAllSections:"Hide all sections",hideSection:"Hide",hideSectionAriaLabel:"Hide this section",showAllSections:"Show all sections",showSection:"Show",showSectionAriaLabel:"Show this section"},rememberExpanded:!0}),w.schema=Object.freeze({properties:{i18n:{type:"object"},rememberExpanded:{type:"boolean"}}});class y extends p{constructor(t,e={}){super(t,e),this.debounceFormSubmitTimer=null,this.$root.addEventListener("keydown",(t=>this.handleKeyDown(t))),this.$root.addEventListener("click",(t=>this.debounce(t)))}handleKeyDown(t){const e=t.target;" "===t.key&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())}debounce(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function $(t,e){const n=t.closest(`[${e}]`);return n?n.getAttribute(e):null}y.moduleName="govuk-button",y.defaults=Object.freeze({preventDoubleClick:!1}),y.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class k extends p{[h](t){let e={};return("maxwords"in t||"maxlength"in t)&&(e={maxlength:void 0,maxwords:void 0}),e}constructor(t,e={}){var n,i;super(t,e),this.$textarea=void 0,this.count=0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.i18n=void 0,this.maxLength=void 0;const o=this.$root.querySelector(".govuk-js-character-count");if(!(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement))throw new u({component:k,element:o,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const r=function(t,e){const n=[];for(const[i,o]of Object.entries(t)){const t=[];if(Array.isArray(o)){for(const{required:n,errorMessage:i}of o)n.every((t=>!!e[t]))||t.push(i);"anyOf"!==i||o.length-t.length>=1||n.push(...t)}}return n}(k.schema,this.config);if(r[0])throw new c(s(k,r[0]));this.i18n=new b(this.config.i18n,{locale:$(this.$root,"lang")}),this.maxLength=null!=(n=null!=(i=this.config.maxwords)?i:this.config.maxlength)?n:1/0,this.$textarea=o;const a=`${this.$textarea.id}-info`,l=document.getElementById(a);if(!l)throw new u({component:k,element:l,identifier:`Count message (\`id="${a}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),l.textContent.match(/^\s*$/)&&(l.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",l);const d=document.createElement("div");d.className="govuk-character-count__sr-status govuk-visually-hidden",d.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=d,l.insertAdjacentElement("afterend",d);const h=document.createElement("div");h.className=l.className,h.classList.add("govuk-character-count__status"),h.setAttribute("aria-hidden","true"),this.$visibleCountMessage=h,l.insertAdjacentElement("afterend",h),l.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>{this.$textarea.value!==this.$textarea.textContent&&(this.updateCount(),this.updateCountMessage())})),this.updateCount(),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("input",(()=>this.handleInput())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleInput(){this.updateCount(),this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval((()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}),1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const t=this.maxLength-this.count<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$errorMessage||this.$textarea.classList.toggle("govuk-textarea--error",t),this.$visibleCountMessage.classList.toggle("govuk-error-message",t),this.$visibleCountMessage.classList.toggle("govuk-hint",!t),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}updateCount(){const t=this.$textarea.value;if(this.config.maxwords){var e;const n=null!=(e=t.match(/\S+/g))?e:[];this.count=n.length}else this.count=t.length}getCountMessage(){const t=this.maxLength-this.count,e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)}formatCountMessage(t,e){if(0===t)return this.i18n.t(`${e}AtLimit`);const n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(`${e}${n}`,{count:Math.abs(t)})}isOverThreshold(){if(!this.config.threshold)return!0;const t=this.count;return this.maxLength*this.config.threshold/100<=t}}k.moduleName="govuk-character-count",k.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),k.schema=Object.freeze({properties:{i18n:{type:"object"},maxwords:{type:"number"},maxlength:{type:"number"},threshold:{type:"number"}},anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});class C extends d{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new u({component:C,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new u({component:C,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const n=document.getElementById(e);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!e)}}unCheckAllInputsExcept(t){document.querySelectorAll(`input[type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&e!==t&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}unCheckExclusiveInputs(t){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}handleClick(t){const e=t.target;e instanceof HTMLInputElement&&"checkbox"===e.type&&(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),e.checked&&("exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)))}}C.moduleName="govuk-checkboxes";class E extends p{constructor(t,n={}){super(t,n),this.config.disableAutoFocus||e(this.$root),this.$root.addEventListener("click",(t=>this.handleClick(t)))}handleClick(t){const e=t.target;e&&this.focusTarget(e)&&t.preventDefault()}focusTarget(t){if(!(t instanceof HTMLAnchorElement))return!1;const e=t.hash.replace("#","");if(!e)return!1;const n=document.getElementById(e);if(!n)return!1;const i=this.getAssociatedLegendOrLabel(n);return!!i&&(i.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(t){var e;const n=t.closest("fieldset");if(n){const e=n.getElementsByTagName("legend");if(e.length){const n=e[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return n;const i=n.getBoundingClientRect().top,o=t.getBoundingClientRect();if(o.height&&window.innerHeight&&o.top+o.height-i<window.innerHeight/2)return n}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}E.moduleName="govuk-error-summary",E.defaults=Object.freeze({disableAutoFocus:!1}),E.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class A extends p{constructor(t,e={}){super(t,e),this.i18n=void 0,this.$button=void 0,this.$skiplinkButton=null,this.$updateSpan=null,this.$indicatorContainer=null,this.$overlay=null,this.keypressCounter=0,this.lastKeyWasModified=!1,this.timeoutTime=5e3,this.keypressTimeoutId=null,this.timeoutMessageId=null;const n=this.$root.querySelector(".govuk-exit-this-page__button");if(!(n instanceof HTMLAnchorElement))throw new u({component:A,element:n,expectedType:"HTMLAnchorElement",identifier:"Button (`.govuk-exit-this-page__button`)"});this.i18n=new b(this.config.i18n),this.$button=n;const i=document.querySelector(".govuk-js-exit-this-page-skiplink");i instanceof HTMLAnchorElement&&(this.$skiplinkButton=i),this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("pageshow",this.resetPage.bind(this))}initUpdateSpan(){this.$updateSpan=document.createElement("span"),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.className="govuk-visually-hidden",this.$root.appendChild(this.$updateSpan)}initButtonClickHandler(){this.$button.addEventListener("click",this.handleClick.bind(this)),this.$skiplinkButton&&this.$skiplinkButton.addEventListener("click",this.handleClick.bind(this))}buildIndicator(){this.$indicatorContainer=document.createElement("div"),this.$indicatorContainer.className="govuk-exit-this-page__indicator",this.$indicatorContainer.setAttribute("aria-hidden","true");for(let t=0;t<3;t++){const t=document.createElement("div");t.className="govuk-exit-this-page__indicator-light",this.$indicatorContainer.appendChild(t)}this.$button.appendChild(this.$indicatorContainer)}updateIndicator(){this.$indicatorContainer&&(this.$indicatorContainer.classList.toggle("govuk-exit-this-page__indicator--visible",this.keypressCounter>0),this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light").forEach(((t,e)=>{t.classList.toggle("govuk-exit-this-page__indicator-light--on",e<this.keypressCounter)})))}exitPage(){this.$updateSpan&&(this.$updateSpan.textContent="",document.body.classList.add("govuk-exit-this-page-hide-content"),this.$overlay=document.createElement("div"),this.$overlay.className="govuk-exit-this-page-overlay",this.$overlay.setAttribute("role","alert"),document.body.appendChild(this.$overlay),this.$overlay.textContent=this.i18n.t("activated"),window.location.href=this.$button.href)}handleClick(t){t.preventDefault(),this.exitPage()}handleKeypress(t){this.$updateSpan&&("Shift"!==t.key||this.lastKeyWasModified?this.keypressTimeoutId&&this.resetKeypressTimer():(this.keypressCounter+=1,this.updateIndicator(),this.timeoutMessageId&&(window.clearTimeout(this.timeoutMessageId),this.timeoutMessageId=null),this.keypressCounter>=3?(this.keypressCounter=0,this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):1===this.keypressCounter?this.$updateSpan.textContent=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.textContent=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()),this.lastKeyWasModified=t.shiftKey)}setKeypressTimer(){this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=window.setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)}resetKeypressTimer(){if(!this.$updateSpan)return;this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null);const t=this.$updateSpan;this.keypressCounter=0,t.textContent=this.i18n.t("timedOut"),this.timeoutMessageId=window.setTimeout((()=>{t.textContent=""}),this.timeoutTime),this.updateIndicator()}resetPage(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan&&(this.$updateSpan.setAttribute("role","status"),this.$updateSpan.textContent=""),this.updateIndicator(),this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&window.clearTimeout(this.timeoutMessageId)}}A.moduleName="govuk-exit-this-page",A.defaults=Object.freeze({i18n:{activated:"Loading.",timedOut:"Exit this page expired.",pressTwoMoreTimes:"Shift, press 2 more times to exit.",pressOneMoreTime:"Shift, press 1 more time to exit."}}),A.schema=Object.freeze({properties:{i18n:{type:"object"}}});class x extends p{constructor(t,e={}){super(t,e),this.$input=void 0,this.$button=void 0,this.$status=void 0,this.$label=void 0,this.i18n=void 0,this.id=void 0,this.$announcements=void 0,this.enteredAnotherElement=void 0;const n=this.$root.querySelector('input[type="file"]');if(null===n)throw new u({component:x,identifier:'File inputs (`<input type="file">`)'});if(this.$input=n,!this.$input.id)throw new u({component:x,identifier:'File input (`<input type="file">`) attribute (`id`)'});this.id=this.$input.id,this.i18n=new b(this.config.i18n,{locale:$(this.$root,"lang")});const i=this.findLabel();i.id||(i.id=`${this.id}-label`),this.$label=i,this.$input.id=`${this.id}-input`,this.$input.setAttribute("hidden","hidden"),this.$status=this.createStatus(),this.$button=this.createButton(),this.$root.insertAdjacentElement("afterbegin",this.$button),this.$input.addEventListener("change",this.onChange.bind(this)),this.updateDisabledState(),this.observeDisabledState(),this.$announcements=document.createElement("span"),this.$announcements.classList.add("govuk-file-upload-announcements"),this.$announcements.classList.add("govuk-visually-hidden"),this.$announcements.setAttribute("aria-live","assertive"),this.$root.insertAdjacentElement("afterend",this.$announcements),this.bindDraggingEvents()}createStatus(){const t=document.createElement("span");return t.className="govuk-body govuk-file-upload-button__status",t.setAttribute("aria-live","polite"),t.innerText=this.i18n.t("noFileChosen"),t}createButton(){const t=document.createElement("button");t.classList.add("govuk-file-upload-button"),t.type="button",t.id=this.id,t.classList.add("govuk-file-upload-button--empty");const e=this.$input.getAttribute("aria-describedby");e&&t.setAttribute("aria-describedby",e),t.appendChild(this.$status);const n=document.createElement("span");n.className="govuk-visually-hidden",n.innerText=", ",n.id=`${this.id}-comma`,t.appendChild(n);const i=document.createElement("span");i.className="govuk-file-upload-button__pseudo-button-container";const o=document.createElement("span");o.className="govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button",o.innerText=this.i18n.t("chooseFilesButton"),i.appendChild(o),i.insertAdjacentText("beforeend"," ");const s=document.createElement("span");return s.className="govuk-body govuk-file-upload-button__instruction",s.innerText=this.i18n.t("dropInstruction"),i.appendChild(s),t.appendChild(i),t.setAttribute("aria-labelledby",`${this.$label.id} ${n.id} ${t.id}`),t.addEventListener("click",this.onClick.bind(this)),t.addEventListener("dragover",(t=>{t.preventDefault()})),t}bindDraggingEvents(){this.$button.addEventListener("drop",this.onDrop.bind(this)),document.addEventListener("dragenter",this.updateDropzoneVisibility.bind(this)),document.addEventListener("dragenter",(()=>{this.enteredAnotherElement=!0})),document.addEventListener("dragleave",(()=>{this.enteredAnotherElement||this.$button.disabled||(this.hideDraggingState(),this.$announcements.innerText=this.i18n.t("leftDropZone")),this.enteredAnotherElement=!1}))}updateDropzoneVisibility(t){this.$button.disabled||t.target instanceof Node&&(this.$root.contains(t.target)?t.dataTransfer&&this.canDrop(t.dataTransfer)&&(this.$button.classList.contains("govuk-file-upload-button--dragging")||(this.showDraggingState(),this.$announcements.innerText=this.i18n.t("enteredDropZone"))):this.$button.classList.contains("govuk-file-upload-button--dragging")&&(this.hideDraggingState(),this.$announcements.innerText=this.i18n.t("leftDropZone")))}showDraggingState(){this.$button.classList.add("govuk-file-upload-button--dragging")}hideDraggingState(){this.$button.classList.remove("govuk-file-upload-button--dragging")}onDrop(t){t.preventDefault(),t.dataTransfer&&this.canFillInput(t.dataTransfer)&&(this.$input.files=t.dataTransfer.files,this.$input.dispatchEvent(new CustomEvent("change")),this.hideDraggingState())}canFillInput(t){return this.matchesInputCapacity(t.files.length)}canDrop(t){return t.items.length?this.matchesInputCapacity(function(t){let e=0;for(let n=0;n<t.length;n++)"file"===t[n].kind&&e++;return e}(t.items)):!t.types.length||t.types.includes("Files")}matchesInputCapacity(t){return this.$input.multiple?t>0:1===t}onChange(){const t=this.$input.files.length;0===t?(this.$status.innerText=this.i18n.t("noFileChosen"),this.$button.classList.add("govuk-file-upload-button--empty")):(this.$status.innerText=1===t?this.$input.files[0].name:this.i18n.t("multipleFilesChosen",{count:t}),this.$button.classList.remove("govuk-file-upload-button--empty"))}findLabel(){const t=document.querySelector(`label[for="${this.$input.id}"]`);if(!t)throw new u({component:x,identifier:`Field label (\`<label for=${this.$input.id}>\`)`});return t}onClick(){this.$input.click()}observeDisabledState(){new MutationObserver((t=>{for(const e of t)"attributes"===e.type&&"disabled"===e.attributeName&&this.updateDisabledState()})).observe(this.$input,{attributes:!0})}updateDisabledState(){this.$button.disabled=this.$input.disabled,this.$root.classList.toggle("govuk-file-upload-wrapper--disabled",this.$button.disabled)}}x.moduleName="govuk-file-upload",x.defaults=Object.freeze({i18n:{chooseFilesButton:"Choose file",dropInstruction:"or drop file",noFileChosen:"No file chosen",multipleFilesChosen:{one:"%{count} file chosen",other:"%{count} files chosen"},enteredDropZone:"Entered drop zone",leftDropZone:"Left drop zone"}}),x.schema=Object.freeze({properties:{i18n:{type:"object"}}});class S extends p{constructor(t,n={}){super(t,n),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||e(this.$root)}}S.moduleName="govuk-notification-banner",S.defaults=Object.freeze({disableAutoFocus:!1}),S.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class T extends p{constructor(t,e={}){super(t,e),this.i18n=void 0,this.$input=void 0,this.$showHideButton=void 0,this.$screenReaderStatusMessage=void 0;const n=this.$root.querySelector(".govuk-js-password-input-input");if(!(n instanceof HTMLInputElement))throw new u({component:T,element:n,expectedType:"HTMLInputElement",identifier:"Form field (`.govuk-js-password-input-input`)"});if("password"!==n.type)throw new u("Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.");const i=this.$root.querySelector(".govuk-js-password-input-toggle");if(!(i instanceof HTMLButtonElement))throw new u({component:T,element:i,expectedType:"HTMLButtonElement",identifier:"Button (`.govuk-js-password-input-toggle`)"});if("button"!==i.type)throw new u("Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.");this.$input=n,this.$showHideButton=i,this.i18n=new b(this.config.i18n,{locale:$(this.$root,"lang")}),this.$showHideButton.removeAttribute("hidden");const o=document.createElement("div");o.className="govuk-password-input__sr-status govuk-visually-hidden",o.setAttribute("aria-live","polite"),this.$screenReaderStatusMessage=o,this.$input.insertAdjacentElement("afterend",o),this.$showHideButton.addEventListener("click",this.toggle.bind(this)),this.$input.form&&this.$input.form.addEventListener("submit",(()=>this.hide())),window.addEventListener("pageshow",(t=>{t.persisted&&"password"!==this.$input.type&&this.hide()})),this.hide()}toggle(t){t.preventDefault(),"password"!==this.$input.type?this.hide():this.show()}show(){this.setType("text")}hide(){this.setType("password")}setType(t){if(t===this.$input.type)return;this.$input.setAttribute("type",t);const e="password"===t,n=e?"show":"hide",i=e?"passwordHidden":"passwordShown";this.$showHideButton.innerText=this.i18n.t(`${n}Password`),this.$showHideButton.setAttribute("aria-label",this.i18n.t(`${n}PasswordAriaLabel`)),this.$screenReaderStatusMessage.innerText=this.i18n.t(`${i}Announcement`)}}T.moduleName="govuk-password-input",T.defaults=Object.freeze({i18n:{showPassword:"Show",hidePassword:"Hide",showPasswordAriaLabel:"Show password",hidePasswordAriaLabel:"Hide password",passwordShownAnnouncement:"Your password is visible",passwordHiddenAnnouncement:"Your password is hidden"}}),T.schema=Object.freeze({properties:{i18n:{type:"object"}}});class L extends d{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new u({component:L,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new u({component:L,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const n=document.getElementById(e);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!e)}}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"radio"!==e.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),i=e.form,o=e.name;n.forEach((t=>{const e=t.form===i;t.name===o&&e&&this.syncConditionalRevealWithInputState(t)}))}}L.moduleName="govuk-radios";class _ extends d{constructor(t){super(t),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const e=this.$root.querySelector(".govuk-js-service-navigation-toggle");if(!e)return this;const n=e.getAttribute("aria-controls");if(!n)throw new u({component:_,identifier:'Navigation button (`<button class="govuk-js-service-navigation-toggle">`) attribute (`aria-controls`)'});const i=document.getElementById(n);if(!i)throw new u({component:_,element:i,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=i,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}setupResponsiveChecks(){const e=t("tablet");if(!e.value)throw new u({component:_,identifier:`CSS custom property (\`${e.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${e.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),function(t,e){for(const n in e)t.setAttribute(n,e[n])}(this.$menuButton,I)):(function(t,e){for(const n of e)t.removeAttribute(n)}(this.$menuButton,Object.keys(I)),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}_.moduleName="govuk-service-navigation";const I={hidden:"","aria-hidden":"true"};class M extends d{constructor(t){var n;super(t);const i=this.$root.hash,o=null!=(n=this.$root.getAttribute("href"))?n:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const s=i.replace("#","");if(!s)throw new u(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const r=document.getElementById(s);if(!r)throw new u({component:M,element:r,identifier:`Target content (\`id="${s}"\`)`});this.$root.addEventListener("click",(()=>e(r,{onBeforeFocus(){r.classList.add("govuk-skip-link-focused-element")},onBlur(){r.classList.remove("govuk-skip-link-focused-element")}})))}}M.elementType=HTMLAnchorElement,M.moduleName="govuk-skip-link";class H extends d{constructor(t){super(t),this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null;const e=this.$root.querySelectorAll("a.govuk-tabs__tab");if(!e.length)throw new u({component:H,identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$tabs=e,this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this);const n=this.$root.querySelector(".govuk-tabs__list"),i=this.$root.querySelectorAll("li.govuk-tabs__list-item");if(!n)throw new u({component:H,identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!i.length)throw new u({component:H,identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=n,this.$tabListItems=i,this.setupResponsiveChecks()}setupResponsiveChecks(){const e=t("tablet");if(!e.value)throw new u({component:H,identifier:`CSS custom property (\`${e.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${e.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var t;null!=(t=this.mql)&&t.matches?this.setup():this.teardown()}setup(){var t;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((t=>{t.setAttribute("role","presentation")})),this.$tabs.forEach((t=>{this.setAttributes(t),t.addEventListener("click",this.boundTabClick,!0),t.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(t)}));const e=null!=(t=this.getTab(window.location.hash))?t:this.$tabs[0];this.showTab(e),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((t=>{t.removeAttribute("role")})),this.$tabs.forEach((t=>{t.removeEventListener("click",this.boundTabClick,!0),t.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(t)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const t=window.location.hash,e=this.getTab(t);if(!e)return;if(this.changingHash)return void(this.changingHash=!1);const n=this.getCurrentTab();n&&(this.hideTab(n),this.showTab(e),e.focus())}hideTab(t){this.unhighlightTab(t),this.hidePanel(t)}showTab(t){this.highlightTab(t),this.showPanel(t)}getTab(t){return this.$root.querySelector(`a.govuk-tabs__tab[href="${t}"]`)}setAttributes(t){const e=t.hash.replace("#","");if(!e)return;t.setAttribute("id",`tab_${e}`),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");const n=this.getPanel(t);n&&(n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",t.id),n.classList.add(this.jsHiddenClass))}unsetAttributes(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");const e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))}onTabClick(t){const e=this.getCurrentTab(),n=t.currentTarget;e&&n instanceof HTMLAnchorElement&&(t.preventDefault(),this.hideTab(e),this.showTab(n),this.createHistoryEntry(n))}createHistoryEntry(t){const e=this.getPanel(t);if(!e)return;const n=e.id;e.id="",this.changingHash=!0,window.location.hash=n,e.id=n}onTabKeydown(t){switch(t.key){case"ArrowLeft":case"Left":this.activatePreviousTab(),t.preventDefault();break;case"ArrowRight":case"Right":this.activateNextTab(),t.preventDefault()}}activateNextTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.nextElementSibling;if(!e)return;const n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}activatePreviousTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.previousElementSibling;if(!e)return;const n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}getPanel(t){const e=t.hash.replace("#","");return e?this.$root.querySelector(`#${e}`):null}showPanel(t){const e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)}hidePanel(t){const e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)}unhighlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))}highlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))}getCurrentTab(){return this.$root.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}function O(t,e,n){this.$module=t,this.window=e,this.document=n}function B(t,e,n){return e&&function(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,q(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function j(t,e,n){return(e=q(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function q(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}H.moduleName="govuk-tabs",O.prototype.init=function(){var t=this;this.window.history&&(this.window.history.replaceState&&"function"==typeof this.window.history.replaceState&&this.window.history.replaceState(null,null,this.window.location.href),this.$module.addEventListener("click",(function(e){e.preventDefault(),t.window.history.back&&"function"==typeof t.window.history.back&&t.window.history.back()})))};var N=console.warn,P={generateDomElementFromString:function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild},generateDomElementFromStringAndAppendText:function(t,e){var n=P.generateDomElementFromString(t);return n.innerText=e,n},hasClass:function(t,e){return document.querySelector(t).classList.contains(e)},addClass:function(t,e){document.querySelectorAll(t).forEach((function(t){t.classList.add(e)}))},removeClass:function(t,e){document.querySelectorAll(t).forEach((function(t){t.classList.remove(e)}))},removeElement:function(t){var e=t.parentNode;e?e.removeChild(t):N("couldn't find parent for elem",t)},ajaxGet:function(t,e){var n=new XMLHttpRequest;return n.open("GET",t),n.onreadystatechange=function(){n.readyState>3&&200===n.status&&e(n.responseText)},n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(),n}};var R={displayDialog:function(t){var e=P.generateDomElementFromString('<div id="hmrc-timeout-dialog" tabindex="-1" role="dialog" aria-modal="true" class="hmrc-timeout-dialog">'),n=P.generateDomElementFromString('<div id="hmrc-timeout-overlay" class="hmrc-timeout-overlay">'),i="string"==typeof t?P.generateDomElementFromString(t):t,o=[],s=[];e.appendChild(i),P.hasClass("html","noScroll")||(P.addClass("html","noScroll"),o.push((function(){P.removeClass("html","noScroll")}))),document.body.appendChild(e),document.body.appendChild(n),o.push((function(){P.removeElement(e),P.removeElement(n)}));var r,a=document.querySelectorAll(["#skiplink-container","body > header","#global-cookie-message","main","body > footer","body > .govuk-skip-link",".cbanner-govuk-cookie-banner","body > .govuk-width-container"].join(", ")),c=function(){for(;o.length>0;){o.shift()()}};return a.forEach((function(t){var e=t.getAttribute("aria-hidden");t.setAttribute("aria-hidden","true"),o.push((function(){e?t.setAttribute("aria-hidden",e):t.removeAttribute("aria-hidden")}))})),function(){function t(t){var e=document.getElementById("hmrc-timeout-dialog");e&&(t.target===e||e.contains(t.target)||(t.stopPropagation(),e.focus()))}var n=document.activeElement;e.focus(),document.addEventListener("focus",t,!0),o.push((function(){document.removeEventListener("focus",t),n.focus()}))}(),function(){function t(t){27===t.keyCode&&(s.forEach((function(t){t()})),c())}document.addEventListener("keydown",t),o.push((function(){document.removeEventListener("keydown",t)}))}(),r=function(t){1===(t.touches||t.changedTouches||[]).length&&t.preventDefault()},document.addEventListener("touchmove",r,!0),o.push((function(){document.removeEventListener("touchmove",r,!0)})),{closeDialog:function(){c()},setAriaLabelledBy:function(t){t?e.setAttribute("aria-labelledby",t):e.removeAttribute("aria-labelledby")},addCloseHandler:function(t){s.push(t)}}}};function U(){}function K(){}function z(t,e){var n,i={},o={},s=[],r=e;var a=function(){o.synchroniseTabs&&r.onActivity((function(t){var e=t.timestamp;f(),l(e)}))},c=function(t){var e=[];if(["timeout","countdown","keepAliveUrl","signOutUrl"].forEach((function(n){t[n]||e.push("data-".concat(n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()))})),e.length>0)throw new Error("Missing config item(s): [".concat(e.join(", "),"]"))},u=function(t,e){var n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?D(Object(n),!0).forEach((function(e){j(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);return Object.keys(e).forEach((function(i){"object"===F(n[i])&&(n[i]=u(t[i],e[i])),void 0!==n[i]&&""!==n[i]||(n[i]=e[i])})),n},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p(),e=t+1e3*o.timeout,i=p()-t,r=o.timeout-o.countdown,a=window.setTimeout((function(){d(e)}),1e3*r-i);s.push((function(){window.clearTimeout(a),n&&window.clearTimeout(n)}))},d=function(t){var e=P.generateDomElementFromString("<div>");if(o.title){var i=P.generateDomElementFromStringAndAppendText('<h1 id="hmrc-timeout-heading" class="govuk-heading-m push--top">',o.title);e.appendChild(i)}var r=P.generateDomElementFromString('<span id="hmrc-timeout-countdown" class="hmrc-timeout-dialog__countdown">'),a=P.generateDomElementFromString('<p id="hmrc-timeout-message" class="govuk-visually-hidden screenreader-content" aria-live="assertive">'),c=P.generateDomElementFromStringAndAppendText('<p class="govuk-body hmrc-timeout-dialog__message" aria-hidden="true">',o.message);c.appendChild(document.createTextNode(" ")),c.appendChild(r),o.messageSuffix&&c.appendChild(document.createTextNode(" ".concat(o.messageSuffix)));var u=P.generateDomElementFromStringAndAppendText('<button id="hmrc-timeout-keep-signin-btn" class="govuk-button">',o.keepAliveButtonText),l=document.createElement("div");if(l.classList.add("govuk-button-group"),l.appendChild(u),e.appendChild(c),e.appendChild(a),u.addEventListener("click",h),e.appendChild(document.createTextNode(" ")),!o.hideSignOutButton){var d=P.generateDomElementFromStringAndAppendText('<a id="hmrc-timeout-sign-out-link" class="govuk-link hmrc-timeout-dialog__link">',o.signOutButtonText);d.addEventListener("click",m),d.setAttribute("href",o.signOutUrl),l.appendChild(d)}e.appendChild(l);var f=R.displayDialog(e);s.push((function(){f.closeDialog()})),f.addCloseHandler(h),f.setAriaLabelledBy("hmrc-timeout-heading hmrc-timeout-message");var v=function(){return t-p()},b=function(t){var e,n;return t<60?n="".concat(t," ").concat(o.properties[1!==t?"seconds":"second"],"."):(e=Math.ceil(t/60),n="".concat(e," ").concat(o.properties[1===e?"minute":"minutes"],".")),n},w=function(t){return t>60?t:t<20?20:20*Math.ceil(t/20)},y=function(t,e){t.innerText!==e&&(t.innerText=e)},$=function(t){var e=b(t),n=function(t){var e=b(w(t)),n=[o.message," ",e];return o.messageSuffix&&(n.push(" "),n.push(o.messageSuffix)),n.join("")}(t);y(r,e),y(a,n)},k=function(){var t,e,i=Math.max(Math.round(v()/1e3),0);$(i),0===i?g():n=window.setTimeout(k,(t=v(),(e=1e3*Math.floor(v()/1e3))<=6e4?t-e||1e3:t-(e-(e%6e4||6e4))))};k()},h=function(){f(),l(),P.ajaxGet(o.keepAliveUrl,(function(){})),r.logActivity()},p=function(){return Date.now()},m=function(){K.redirectToUrl(o.signOutUrl)},g=function(){K.redirectToUrl(o.timeoutUrl)},f=function(){for(;s.length>0;){s.shift()()}};return{init:function(){var e=U;function n(e){return(t.attributes.getNamedItem(e)||{}).value}var s="cy"===e.string(n("data-language"))?{title:"Rydych ar fin cael eich allgofnodi",message:"Er eich diogelwch, byddwn yn eich allgofnodi cyn pen",keepAliveButtonText:"Parhau i fod wedi’ch mewngofnodi",signOutButtonText:"Allgofnodi",properties:{minutes:"funud",minute:"funud",seconds:"eiliad",second:"eiliad"}}:{title:"You’re about to be signed out",message:"For your security, we will sign you out in",keepAliveButtonText:"Stay signed in",signOutButtonText:"Sign out",properties:{minutes:"minutes",minute:"minute",seconds:"seconds",second:"second"}};(i={timeout:e.int(n("data-timeout")),countdown:e.int(n("data-countdown")),keepAliveUrl:e.string(n("data-keep-alive-url")),signOutUrl:e.string(n("data-sign-out-url")),timeoutUrl:e.string(n("data-timeout-url")),title:e.string(n("data-title")),message:e.string(n("data-message")),messageSuffix:e.string(n("data-message-suffix")),keepAliveButtonText:e.string(n("data-keep-alive-button-text")),signOutButtonText:e.string(n("data-sign-out-button-text")),synchroniseTabs:e.boolean(n("data-synchronise-tabs")||!1),hideSignOutButton:e.boolean(n("data-hide-sign-out-button")||!1)}).timeoutUrl=i.timeoutUrl||i.signOutUrl,c(i),o=u(i,s),l(),a()},cleanup:f}}U.int=function(t){var e=parseInt(t,10);return Number.isNaN(e)?void 0:e},U.string=function(t){return"string"==typeof t?t:void 0},U.boolean=function(t){return"true"===String(t).toLowerCase()},K.redirectToUrl=function(t){window.location.href=t},z.dialog=R,z.redirectHelper=K,z.utils=P;function V(t){this.$module=t,this.$closeLink=this.$module.querySelector(".hmrc-user-research-banner__close"),this.cookieName="mdtpurr",this.cookieExpiryDays=28}V.prototype.init=function(){null==function(t){for(var e="".concat(t,"="),n=document.cookie.split(";"),i=0,o=n.length;i<o;i+=1){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length))}return null}(this.cookieName)&&(this.$module.classList.add("hmrc-user-research-banner--show"),this.$closeLink&&this.$closeLink.addEventListener("click",this.eventHandlers.noThanksClick.bind(this)))},V.prototype.eventHandlers={noThanksClick:function(t){t.preventDefault(),function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="".concat(t,"=").concat(e,"; path=/");if(n.days){var o=new Date;o.setTime(o.getTime()+24*n.days*60*60*1e3),i="".concat(i,"; expires=").concat(o.toGMTString())}"https:"===window.location.protocol&&(i+="; Secure"),document.cookie=i}(this.cookieName,"suppress_for_all_services",{days:this.cookieExpiryDays}),this.$module.classList.remove("hmrc-user-research-banner--show")}};var Y=function(){return B((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.activityChannel=e&&new e("session-activity")}),[{key:"logActivity",value:function(){if(this.activityChannel){var t={timestamp:Date.now()};this.activityChannel.postMessage(t)}}},{key:"onActivity",value:function(t){this.activityChannel&&(this.activityChannel.onmessage=function(e){t(e.data)})}}])}();function W(t,e){this.$module=t,this.window=e}W.prototype.init=function(){var t=this;this.$module.addEventListener("click",(function(e){e.preventDefault(),t.window.print()}))};var G={initAll:function(){function t(t){try{t()}catch(t){console.error("hmrc-frontend component initialisation failed",t)}}document.querySelectorAll('a[data-module="hmrc-print-link"]').forEach((function(e){t((function(){new W(e,window).init()}))}));var e=new Y(window.BroadcastChannel);e.logActivity();var n=document.querySelector('meta[name="hmrc-timeout-dialog"]');n&&t((function(){new z(n,e).init()}));var i=document.querySelector('[data-module="hmrc-user-research-banner"]');i&&t((function(){new V(i).init()})),document.querySelectorAll('[data-module="hmrc-back-link"]').forEach((function(e){t((function(){new O(e,window,document).init()}))}))},TimeoutDialog:z,UserResearchBanner:V,BackLinkHelper:O};!function(t={}){const e=i(t)?t:{},o=g(t);try{if(!n())throw new a;if(null===o.scope)throw new u({element:o.scope,identifier:"GOV.UK Frontend scope element (`$scope`)"})}catch(t){return void(o.onError?o.onError(t,{config:e}):console.log(t))}[[w,e.accordion],[y,e.button],[k,e.characterCount],[C],[E,e.errorSummary],[A,e.exitThisPage],[x,e.fileUpload],[S,e.notificationBanner],[T,e.passwordInput],[L],[_],[M],[H]].forEach((([t,e])=>{!function(t,e,i){let o;const s=g(i);try{var r;if(!n())throw new a;if(null===s.scope)throw new u({element:s.scope,component:t,identifier:"Scope element (`$scope`)"});o=null==(r=s.scope)?void 0:r.querySelectorAll(`[data-module="${t.moduleName}"]`)}catch(n){return s.onError?s.onError(n,{component:t,config:e}):console.log(n),[]}Array.from(null!=o?o:[]).map((n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(i){return s.onError?s.onError(i,{element:n,component:t,config:e}):console.log(i),null}})).filter(Boolean)}(t,e,o)}))}(),G.initAll()}();
2
-
3
- //# sourceMappingURL=maps/hmrc-frontend-7.44.0.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["src/components/back-link-helper/back-link-helper.js","src/components/timeout-dialog/utils.js","src/components/timeout-dialog/dialog.js","src/components/timeout-dialog/validate-input.js","src/components/timeout-dialog/redirectHelper.js","src/components/timeout-dialog/timeout-dialog.js","src/components/user-research-banner/user-research-banner.js","src/utils/cookies.js","src/components/timeout-dialog/session-activity-service.js","src/components/hmrc-print-link/hmrc-print-link.js","src/all.js","src/all-govuk-and-hmrc.js"],"names":["BackLinkHelper","$module","window","document","this","prototype","init","_this","history","replaceState","location","href","addEventListener","event","preventDefault","back","warn","console","utils","generateDomElementFromString","str","abc","createElement","innerHTML","firstChild","generateDomElementFromStringAndAppendText","text","$tmp","innerText","hasClass","selector","className","querySelector","classList","contains","addClass","querySelectorAll","forEach","i","add","removeClass","remove","removeElement","$elem","parent","parentNode","removeChild","ajaxGet","url","success","xhr","XMLHttpRequest","open","onreadystatechange","readyState","status","responseText","setRequestHeader","send","dialog","displayDialog","$elementToDisplay","$dialog","$overlay","$preparedElementToDisplay","resetElementsFunctionList","closeCallbacks","appendChild","push","body","handleTouch","elements","join","close","length","shift","fn","value","getAttribute","setAttribute","removeAttribute","keepFocus","modalFocus","getElementById","target","stopPropagation","focus","elemToFocusOnReset","activeElement","removeEventListener","setupFocusHandlerAndFocusDialog","keydownListener","e","keyCode","setupKeydownHandler","touches","changedTouches","closeDialog","setAriaLabelledBy","addCloseHandler","closeHandler","ValidateInput","RedirectHelper","TimeoutDialog","$sessionActivityService","currentTimer","options","settings","cleanupFunctions","sessionActivityService","listenForSessionActivityAndResetDialogTimer","synchroniseTabs","onActivity","timeOfActivity","timestamp","cleanup","setupDialogTimer","validateInput","config","missingRequiredConfig","item","concat","replace","toLowerCase","Error","mergeOptionsWithDefaults","theOptions","localisedDefaults","clone","_objectSpread","Object","keys","key","_typeof","undefined","timeOfLastActivity","arguments","getDateNow","signoutTime","timeout","delta","secondsUntilTimeoutDialog","countdown","setTimeout","setupDialog","clearTimeout","$element","title","$countdownElement","$audibleMessage","$visualMessge","message","createTextNode","messageSuffix","$staySignedInButton","keepAliveButtonText","$wrapper","keepAliveAndClose","hideSignOutButton","$signOutButton","signOutButtonText","signOut","signOutUrl","dialogControl","getMillisecondsRemaining","getHumanText","counter","minutes","visibleMessage","properties","Math","ceil","roundSecondsUp","updateTextIfChanged","updateCountdown","audibleHumanText","humanText","messageParts","getAudibleHumanText","runUpdate","remaining","roundedRemaining","max","round","floor","keepAliveUrl","logActivity","Date","now","redirectToUrl","timeoutUrl","validate","lookupData","attributes","getNamedItem","string","minute","seconds","second","stringToValidate","parsedInt","parseInt","Number","isNaN","String","redirectHelper","UserResearchBanner","$closeLink","cookieName","cookieExpiryDays","name","nameEQ","cookies","cookie","split","len","charAt","substring","indexOf","decodeURIComponent","getCookie","eventHandlers","noThanksClick","bind","cookieString","days","date","setTime","getTime","toGMTString","protocol","setCookie","SessionActivityService","_createClass","BrowserBroadcastChannel","_classCallCheck","activityChannel","postMessage","callback","onmessage","data","HmrcPrintLink","print","HMRCFrontend","initAll","logAndIgnoreErrors","error","$HmrcPrintLink","BroadcastChannel","$TimeoutDialog","$UserResearchBanner","$BackLink"],"mappings":"gx0CAAA,SAASA,EAAeC,EAASC,EAAQC,GACvCC,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKD,SAAWA,CAClB,C,soCAEAH,EAAeK,UAAUC,KAAO,WAAgB,IAAAC,EAAAH,KAE1CA,KAAKF,OAAOM,UAEVJ,KAAKF,OAAOM,QAAQC,cAA4D,mBAArCL,KAAKF,OAAOM,QAAQC,cACjEL,KAAKF,OAAOM,QAAQC,aAAa,KAAM,KAAML,KAAKF,OAAOQ,SAASC,MAGpEP,KAAKH,QAAQW,iBAAiB,SAAS,SAACC,GACtCA,EAAMC,iBACFP,EAAKL,OAAOM,QAAQO,MAA4C,mBAA7BR,EAAKL,OAAOM,QAAQO,MACzDR,EAAKL,OAAOM,QAAQO,MAExB,IAEJ,ECrBA,IAAQC,EAASC,QAATD,KAEFE,EAAQ,CACZC,6BAA4B,SAACC,GAC3B,IAAMC,EAAMlB,SAASmB,cAAc,OAEnC,OADAD,EAAIE,UAAYH,EACTC,EAAIG,UACb,EAEAC,0CAAyC,SAACL,EAAKM,GAC7C,IAAMC,EAAOT,EAAMC,6BAA6BC,GAEhD,OADAO,EAAKC,UAAYF,EACVC,CACT,EAEAE,SAAQ,SAACC,EAAUC,GACjB,OAAO5B,SAAS6B,cAAcF,GAAUG,UAAUC,SAASH,EAC7D,EAEAI,SAAQ,SAACL,EAAUC,GACA5B,SAASiC,iBAAiBN,GAClCO,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yB,IAAI2H,EAAuBtO,OAAOsP,kBACjE3I,EAAuB6E,cAEvB,IAAM+D,EAAiBtP,SAAS6B,cAAc,oCAC1CyN,GACFJ,GAAmB,WACjB,IAAI9I,EAAckJ,EAAgB5I,GAAwBvG,MAC5D,IAGF,IAAMoP,EAAsBvP,SAAS6B,cAAc,6CAC/C0N,GACFL,GAAmB,WACjB,IAAIvC,EAAmB4C,GAAqBpP,MAC9C,IAGiBH,SAASiC,iBAAiB,kCAClCC,SAAQ,SAACsN,GAClBN,GAAmB,WACjB,IAAIrP,EAAe2P,EAAWzP,OAAQC,UAAUG,MAClD,GACF,GACF,EAIEiG,gBACAuG,qBACA9M,mB,07BCjDFoP,GACAD,EAAaC,S","file":"../hmrc-frontend-7.44.0.min.js","sourcesContent":["function BackLinkHelper($module, window, document) {\n this.$module = $module;\n this.window = window;\n this.document = document;\n}\n\nBackLinkHelper.prototype.init = function init() {\n // do nothing if History API is absent\n if (this.window.history) {\n // prevent resubmit warning\n if (this.window.history.replaceState && typeof this.window.history.replaceState === 'function') {\n this.window.history.replaceState(null, null, this.window.location.href);\n }\n\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n if (this.window.history.back && typeof this.window.history.back === 'function') {\n this.window.history.back();\n }\n });\n }\n};\n\nexport default BackLinkHelper;\n","const { warn } = console;\n\nconst utils = {\n generateDomElementFromString(str) {\n const abc = document.createElement('div');\n abc.innerHTML = str;\n return abc.firstChild;\n },\n\n generateDomElementFromStringAndAppendText(str, text) {\n const $tmp = utils.generateDomElementFromString(str);\n $tmp.innerText = text;\n return $tmp;\n },\n\n hasClass(selector, className) {\n return document.querySelector(selector).classList.contains(className);\n },\n\n addClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.add(className); });\n },\n\n removeClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.remove(className); });\n },\n\n removeElement($elem) {\n const parent = $elem.parentNode;\n if (parent) {\n parent.removeChild($elem);\n } else {\n warn(\"couldn't find parent for elem\", $elem);\n }\n },\n\n ajaxGet(url, success) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.onreadystatechange = () => {\n if (xhr.readyState > 3 && xhr.status === 200) success(xhr.responseText);\n };\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n xhr.send();\n return xhr;\n },\n};\n\nexport default utils;\n","import utils from './utils';\n\nfunction displayDialog($elementToDisplay) {\n const $dialog = utils.generateDomElementFromString('<div id=\"hmrc-timeout-dialog\" tabindex=\"-1\" role=\"dialog\" aria-modal=\"true\" class=\"hmrc-timeout-dialog\">');\n const $overlay = utils.generateDomElementFromString('<div id=\"hmrc-timeout-overlay\" class=\"hmrc-timeout-overlay\">');\n const $preparedElementToDisplay = typeof $elementToDisplay === 'string' ? utils.generateDomElementFromString($elementToDisplay) : $elementToDisplay;\n const resetElementsFunctionList = [];\n const closeCallbacks = [];\n\n $dialog.appendChild($preparedElementToDisplay);\n\n if (!utils.hasClass('html', 'noScroll')) {\n utils.addClass('html', 'noScroll');\n resetElementsFunctionList.push(() => {\n utils.removeClass('html', 'noScroll');\n });\n }\n document.body.appendChild($dialog);\n document.body.appendChild($overlay);\n\n resetElementsFunctionList.push(() => {\n utils.removeElement($dialog);\n utils.removeElement($overlay);\n });\n\n const setupFocusHandlerAndFocusDialog = () => {\n function keepFocus(event) {\n const modalFocus = document.getElementById('hmrc-timeout-dialog');\n if (modalFocus) {\n if (event.target !== modalFocus && !modalFocus.contains(event.target)) {\n event.stopPropagation();\n modalFocus.focus();\n }\n }\n }\n\n const elemToFocusOnReset = document.activeElement;\n $dialog.focus();\n\n document.addEventListener('focus', keepFocus, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('focus', keepFocus);\n elemToFocusOnReset.focus();\n });\n };\n\n // disable the non-dialog page to prevent confusion for VoiceOver users\n const selectors = [\n '#skiplink-container',\n 'body > header',\n '#global-cookie-message',\n 'main',\n 'body > footer',\n 'body > .govuk-skip-link',\n '.cbanner-govuk-cookie-banner',\n 'body > .govuk-width-container',\n ];\n const elements = document.querySelectorAll(selectors.join(', '));\n const close = () => {\n while (resetElementsFunctionList.length > 0) {\n const fn = resetElementsFunctionList.shift();\n fn();\n }\n };\n const closeAndInform = () => {\n closeCallbacks.forEach((fn) => { fn(); });\n close();\n };\n const setupKeydownHandler = () => {\n function keydownListener(e) {\n if (e.keyCode === 27) {\n closeAndInform();\n }\n }\n\n document.addEventListener('keydown', keydownListener);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('keydown', keydownListener);\n });\n };\n const preventMobileScrollWhileAllowingPinchZoom = () => {\n const handleTouch = (e) => {\n const touches = e.touches || e.changedTouches || [];\n\n if (touches.length === 1) {\n e.preventDefault();\n }\n };\n\n document.addEventListener('touchmove', handleTouch, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('touchmove', handleTouch, true);\n });\n };\n\n elements.forEach(($elem) => {\n const value = $elem.getAttribute('aria-hidden');\n $elem.setAttribute('aria-hidden', 'true');\n resetElementsFunctionList.push(() => {\n if (value) {\n $elem.setAttribute('aria-hidden', value);\n } else {\n $elem.removeAttribute('aria-hidden');\n }\n });\n });\n\n //\n setupFocusHandlerAndFocusDialog();\n\n setupKeydownHandler();\n\n preventMobileScrollWhileAllowingPinchZoom();\n\n return {\n closeDialog() {\n close();\n },\n setAriaLabelledBy(value) {\n if (value) {\n $dialog.setAttribute('aria-labelledby', value);\n } else {\n $dialog.removeAttribute('aria-labelledby');\n }\n },\n addCloseHandler(closeHandler) {\n closeCallbacks.push(closeHandler);\n },\n };\n}\n\nexport default { displayDialog };\n","function ValidateInput() {\n}\n\nValidateInput.int = (stringToValidate) => {\n const parsedInt = parseInt(stringToValidate, 10);\n return Number.isNaN(parsedInt) ? undefined : parsedInt;\n};\n\nValidateInput.string = (stringToValidate) => (typeof stringToValidate === 'string' ? stringToValidate : undefined);\n\nValidateInput.boolean = (stringToValidate) => String(stringToValidate).toLowerCase() === 'true';\n\nexport default ValidateInput;\n","function RedirectHelper() {}\n\nRedirectHelper.redirectToUrl = (url) => {\n // This exists to make redirects more testable\n window.location.href = url;\n};\n\nexport default RedirectHelper;\n","/* oxlint-disable no-use-before-define */\nimport dialog from './dialog';\nimport ValidateInput from './validate-input';\nimport RedirectHelper from './redirectHelper';\nimport utils from './utils';\n\n// TODO: rewrite this to follow govuk-frontend prototype module pattern\n\nfunction TimeoutDialog($module, $sessionActivityService) {\n let options = {};\n let settings = {};\n const cleanupFunctions = [];\n let currentTimer;\n const sessionActivityService = $sessionActivityService;\n\n function init() {\n const validate = ValidateInput;\n\n function lookupData(key) {\n return ($module.attributes.getNamedItem(key) || {}).value;\n }\n\n const localisedDefaults = validate.string(lookupData('data-language')) === 'cy' ? {\n title: 'Rydych ar fin cael eich allgofnodi',\n message: 'Er eich diogelwch, byddwn yn eich allgofnodi cyn pen',\n keepAliveButtonText: 'Parhau i fod wedi’ch mewngofnodi',\n signOutButtonText: 'Allgofnodi',\n properties: {\n minutes: 'funud',\n minute: 'funud',\n seconds: 'eiliad',\n second: 'eiliad',\n },\n } : {\n title: 'You’re about to be signed out',\n message: 'For your security, we will sign you out in',\n keepAliveButtonText: 'Stay signed in',\n signOutButtonText: 'Sign out',\n properties: {\n minutes: 'minutes',\n minute: 'minute',\n seconds: 'seconds',\n second: 'second',\n },\n };\n\n options = {\n timeout: validate.int(lookupData('data-timeout')),\n countdown: validate.int(lookupData('data-countdown')),\n keepAliveUrl: validate.string(lookupData('data-keep-alive-url')),\n signOutUrl: validate.string(lookupData('data-sign-out-url')),\n timeoutUrl: validate.string(lookupData('data-timeout-url')),\n title: validate.string(lookupData('data-title')),\n message: validate.string(lookupData('data-message')),\n messageSuffix: validate.string(lookupData('data-message-suffix')),\n keepAliveButtonText: validate.string(\n lookupData('data-keep-alive-button-text'),\n ),\n signOutButtonText: validate.string(\n lookupData('data-sign-out-button-text'),\n ),\n synchroniseTabs: validate.boolean(\n lookupData('data-synchronise-tabs') || false,\n ),\n hideSignOutButton: validate.boolean(\n lookupData('data-hide-sign-out-button') || false,\n ),\n };\n\n // Default timeoutUrl to signOutUrl if not set\n options.timeoutUrl = options.timeoutUrl || options.signOutUrl;\n\n validateInput(options);\n settings = mergeOptionsWithDefaults(options, localisedDefaults);\n setupDialogTimer();\n listenForSessionActivityAndResetDialogTimer();\n }\n\n const broadcastSessionActivity = () => {\n sessionActivityService.logActivity();\n };\n\n const listenForSessionActivityAndResetDialogTimer = () => {\n if (settings.synchroniseTabs) {\n sessionActivityService.onActivity((event) => {\n const timeOfActivity = event.timestamp;\n cleanup();\n setupDialogTimer(timeOfActivity);\n });\n }\n };\n\n const validateInput = (config) => {\n const requiredConfig = ['timeout', 'countdown', 'keepAliveUrl', 'signOutUrl'];\n const missingRequiredConfig = [];\n\n requiredConfig.forEach((item) => {\n if (!config[item]) {\n missingRequiredConfig.push(`data-${item.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()}`);\n }\n });\n\n if (missingRequiredConfig.length > 0) {\n throw new Error(\n `Missing config item(s): [${missingRequiredConfig.join(', ')}]`,\n );\n }\n };\n\n const mergeOptionsWithDefaults = (theOptions, localisedDefaults) => {\n const clone = { ...theOptions };\n\n Object.keys(localisedDefaults).forEach((key) => {\n if (typeof clone[key] === 'object') {\n clone[key] = mergeOptionsWithDefaults(\n theOptions[key],\n localisedDefaults[key],\n );\n }\n if (clone[key] === undefined || clone[key] === '') {\n clone[key] = localisedDefaults[key];\n }\n });\n\n return clone;\n };\n\n const setupDialogTimer = (timeOfLastActivity = getDateNow()) => {\n const signoutTime = timeOfLastActivity + settings.timeout * 1000;\n\n const delta = getDateNow() - timeOfLastActivity;\n const secondsUntilTimeoutDialog = settings.timeout - settings.countdown;\n const timeout = window.setTimeout(() => {\n setupDialog(signoutTime);\n }, (secondsUntilTimeoutDialog * 1000) - delta);\n\n cleanupFunctions.push(() => {\n window.clearTimeout(timeout);\n if (currentTimer) {\n window.clearTimeout(currentTimer);\n }\n });\n };\n\n const setupDialog = (signoutTime) => {\n const $element = utils.generateDomElementFromString('<div>');\n\n if (settings.title) {\n const $tmp = utils.generateDomElementFromStringAndAppendText(\n '<h1 id=\"hmrc-timeout-heading\" class=\"govuk-heading-m push--top\">',\n settings.title,\n );\n $element.appendChild($tmp);\n }\n\n const $countdownElement = utils.generateDomElementFromString(\n '<span id=\"hmrc-timeout-countdown\" class=\"hmrc-timeout-dialog__countdown\">',\n );\n\n const $audibleMessage = utils.generateDomElementFromString('<p id=\"hmrc-timeout-message\" class=\"govuk-visually-hidden screenreader-content\" aria-live=\"assertive\">');\n const $visualMessge = utils.generateDomElementFromStringAndAppendText(\n '<p class=\"govuk-body hmrc-timeout-dialog__message\" aria-hidden=\"true\">',\n settings.message,\n );\n $visualMessge.appendChild(document.createTextNode(' '));\n $visualMessge.appendChild($countdownElement);\n if (settings.messageSuffix) {\n $visualMessge.appendChild(document.createTextNode(` ${settings.messageSuffix}`));\n }\n\n const $staySignedInButton = utils.generateDomElementFromStringAndAppendText(\n '<button id=\"hmrc-timeout-keep-signin-btn\" class=\"govuk-button\">',\n settings.keepAliveButtonText,\n );\n\n const $wrapper = document.createElement('div');\n $wrapper.classList.add('govuk-button-group');\n $wrapper.appendChild($staySignedInButton);\n\n $element.appendChild($visualMessge);\n $element.appendChild($audibleMessage);\n $staySignedInButton.addEventListener('click', keepAliveAndClose);\n $element.appendChild(document.createTextNode(' '));\n\n if (!settings.hideSignOutButton) {\n const $signOutButton = utils.generateDomElementFromStringAndAppendText(\n '<a id=\"hmrc-timeout-sign-out-link\" class=\"govuk-link hmrc-timeout-dialog__link\">',\n settings.signOutButtonText,\n );\n $signOutButton.addEventListener('click', signOut);\n $signOutButton.setAttribute('href', settings.signOutUrl);\n\n $wrapper.appendChild($signOutButton);\n }\n\n $element.appendChild($wrapper);\n\n const dialogControl = dialog.displayDialog($element);\n\n cleanupFunctions.push(() => {\n dialogControl.closeDialog();\n });\n\n dialogControl.addCloseHandler(keepAliveAndClose);\n\n dialogControl.setAriaLabelledBy('hmrc-timeout-heading hmrc-timeout-message');\n\n const getMillisecondsRemaining = () => signoutTime - getDateNow();\n const getSecondsRemaining = () => Math.round(getMillisecondsRemaining() / 1000);\n\n const getHumanText = (counter) => {\n let minutes; let\n visibleMessage;\n if (counter < 60) {\n visibleMessage = `${counter} ${settings.properties[counter !== 1 ? 'seconds' : 'second']}.`;\n } else {\n minutes = Math.ceil(counter / 60);\n visibleMessage = `${minutes} ${settings.properties[minutes === 1 ? 'minute' : 'minutes']}.`;\n }\n return visibleMessage;\n };\n\n const getAudibleHumanText = (counter) => {\n const humanText = getHumanText(roundSecondsUp(counter));\n const messageParts = [settings.message, ' ', humanText];\n if (settings.messageSuffix) {\n messageParts.push(' ');\n messageParts.push(settings.messageSuffix);\n }\n return messageParts.join('');\n };\n\n const roundSecondsUp = (counter) => {\n if (counter > 60) {\n return counter;\n } if (counter < 20) {\n return 20;\n }\n return Math.ceil(counter / 20) * 20;\n };\n\n const updateTextIfChanged = ($elem, text) => {\n if ($elem.innerText !== text) {\n // oxlint-disable-next-line no-param-reassign\n $elem.innerText = text;\n }\n };\n\n const updateCountdown = (counter) => {\n const visibleMessage = getHumanText(counter);\n const audibleHumanText = getAudibleHumanText(counter);\n\n updateTextIfChanged($countdownElement, visibleMessage);\n updateTextIfChanged($audibleMessage, audibleHumanText);\n };\n\n const getNextTimeout = () => {\n const remaining = getMillisecondsRemaining();\n const roundedRemaining = Math.floor(getMillisecondsRemaining() / 1000) * 1000;\n if (roundedRemaining <= 60000) {\n return (remaining - roundedRemaining) || 1000;\n }\n return remaining - (roundedRemaining - (roundedRemaining % 60000 || 60000));\n };\n\n const runUpdate = () => {\n const counter = Math.max(getSecondsRemaining(), 0);\n updateCountdown(counter);\n if (counter === 0) {\n timeout();\n } else {\n currentTimer = window.setTimeout(runUpdate, getNextTimeout());\n }\n };\n\n runUpdate();\n };\n\n const keepAliveAndClose = () => {\n cleanup();\n setupDialogTimer();\n utils.ajaxGet(settings.keepAliveUrl, () => {});\n broadcastSessionActivity();\n };\n\n const getDateNow = () => Date.now();\n\n const signOut = () => {\n RedirectHelper.redirectToUrl(settings.signOutUrl);\n };\n\n const timeout = () => {\n RedirectHelper.redirectToUrl(settings.timeoutUrl);\n };\n\n const cleanup = () => {\n while (cleanupFunctions.length > 0) {\n const fn = cleanupFunctions.shift();\n fn();\n }\n };\n\n return { init, cleanup };\n}\n\nTimeoutDialog.dialog = dialog;\nTimeoutDialog.redirectHelper = RedirectHelper;\nTimeoutDialog.utils = utils;\n\nexport default TimeoutDialog;\n","import { getCookie, setCookie } from '../../utils/cookies';\n\nfunction UserResearchBanner($module) {\n this.$module = $module;\n this.$closeLink = this.$module.querySelector('.hmrc-user-research-banner__close');\n this.cookieName = 'mdtpurr';\n this.cookieExpiryDays = 28;\n}\n\nUserResearchBanner.prototype.init = function init() {\n const cookieData = getCookie(this.cookieName);\n\n if (cookieData == null) {\n this.$module.classList.add('hmrc-user-research-banner--show');\n if (this.$closeLink) {\n this.$closeLink.addEventListener('click', this.eventHandlers.noThanksClick.bind(this));\n }\n }\n};\n\nUserResearchBanner.prototype.eventHandlers = {\n noThanksClick(event) {\n event.preventDefault();\n\n setCookie(this.cookieName, 'suppress_for_all_services', { days: this.cookieExpiryDays });\n this.$module.classList.remove('hmrc-user-research-banner--show');\n },\n};\n\nexport default UserResearchBanner;\n","// Based on https://github.com/alphagov/govuk_template_jinja\nexport const setCookie = (name, value, options = {}) => {\n let cookieString = `${name}=${value}; path=/`;\n if (options.days) {\n const date = new Date();\n date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));\n cookieString = `${cookieString}; expires=${date.toGMTString()}`;\n }\n if (window.location.protocol === 'https:') {\n cookieString += '; Secure';\n }\n document.cookie = cookieString;\n\n return cookieString;\n};\n\nexport const getCookie = (name) => {\n const nameEQ = `${name}=`;\n const cookies = document.cookie.split(';');\n for (let i = 0, len = cookies.length; i < len; i += 1) {\n let cookie = cookies[i];\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1, cookie.length);\n }\n if (cookie.indexOf(nameEQ) === 0) {\n return decodeURIComponent(cookie.substring(nameEQ.length));\n }\n }\n return null;\n};\n","export default class SessionActivityService {\n constructor(BrowserBroadcastChannel) {\n this.activityChannel = BrowserBroadcastChannel && new BrowserBroadcastChannel('session-activity');\n }\n\n logActivity() {\n if (this.activityChannel) {\n const event = { timestamp: Date.now() };\n this.activityChannel.postMessage(event);\n }\n }\n\n onActivity(callback) {\n if (this.activityChannel) {\n this.activityChannel.onmessage = (event) => {\n callback(event.data);\n };\n }\n }\n}\n","function HmrcPrintLink($module, window) {\n this.$module = $module;\n this.window = window;\n}\n\nHmrcPrintLink.prototype.init = function init() {\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n this.window.print();\n });\n};\n\nexport default HmrcPrintLink;\n","import BackLinkHelper from './components/back-link-helper/back-link-helper';\nimport TimeoutDialog from './components/timeout-dialog/timeout-dialog';\nimport UserResearchBanner from './components/user-research-banner/user-research-banner';\nimport SessionActivityService from './components/timeout-dialog/session-activity-service';\nimport HmrcPrintLink from './components/hmrc-print-link/hmrc-print-link';\n\nfunction initAll() {\n function logAndIgnoreErrors(init) {\n try {\n init();\n } catch (error) {\n // oxlint-disable-next-line no-console\n console.error('hmrc-frontend component initialisation failed', error);\n }\n }\n\n const $HmrcPrintLinks = document.querySelectorAll('a[data-module=\"hmrc-print-link\"]');\n $HmrcPrintLinks.forEach(($HmrcPrintLink) => {\n logAndIgnoreErrors(() => {\n new HmrcPrintLink($HmrcPrintLink, window).init();\n });\n });\n\n const sessionActivityService = new SessionActivityService(window.BroadcastChannel);\n sessionActivityService.logActivity();\n\n const $TimeoutDialog = document.querySelector('meta[name=\"hmrc-timeout-dialog\"]');\n if ($TimeoutDialog) {\n logAndIgnoreErrors(() => {\n new TimeoutDialog($TimeoutDialog, sessionActivityService).init();\n });\n }\n\n const $UserResearchBanner = document.querySelector('[data-module=\"hmrc-user-research-banner\"]');\n if ($UserResearchBanner) {\n logAndIgnoreErrors(() => {\n new UserResearchBanner($UserResearchBanner).init();\n });\n }\n\n const $BackLinks = document.querySelectorAll('[data-module=\"hmrc-back-link\"]');\n $BackLinks.forEach(($BackLink) => {\n logAndIgnoreErrors(() => {\n new BackLinkHelper($BackLink, window, document).init();\n });\n });\n}\n\nexport default {\n initAll,\n TimeoutDialog,\n UserResearchBanner,\n BackLinkHelper,\n};\n","import { initAll } from 'govuk-frontend/dist/govuk/govuk-frontend.min.js';\nimport HMRCFrontend from './all';\n\ninitAll();\nHMRCFrontend.initAll();\n"]}