@defra/forms-engine-plugin 4.0.17 → 4.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.public/assets-manifest.json +6 -5
- package/.public/javascripts/application.min.js +1 -1
- package/.public/javascripts/application.min.js.map +1 -1
- package/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.public/javascripts/vendor/accessible-autocomplete.min.js +1 -1
- package/.public/javascripts/vendor/accessible-autocomplete.min.js.map +1 -1
- package/.public/stylesheets/application.min.css +3 -3
- package/.public/stylesheets/application.min.css.map +1 -1
- package/.server/client/javascripts/file-upload.js +1 -1
- package/.server/client/javascripts/file-upload.js.map +1 -1
- package/.server/config/index.d.ts +2 -1
- package/.server/server/common/helpers/logging/logger-options.d.ts +18 -17
- package/.server/server/common/helpers/logging/request-logger.d.ts +18 -17
- package/.server/server/index.js +0 -2
- package/.server/server/index.js.map +1 -1
- package/.server/server/plugins/engine/components/helpers/index.js +1 -1
- package/.server/server/plugins/engine/components/helpers/index.js.map +1 -1
- package/.server/server/plugins/engine/routes/questions.js +2 -2
- package/.server/server/plugins/engine/routes/questions.js.map +1 -1
- package/.server/server/plugins/nunjucks/types.js +0 -2
- package/.server/server/plugins/nunjucks/types.js.map +1 -1
- package/.server/server/plugins/postcode-lookup/routes/index.js +1 -1
- package/.server/server/plugins/postcode-lookup/routes/index.js.map +1 -1
- package/.server/server/services/cacheService.js.map +1 -1
- package/.server/typings/hapi/index.d.js.map +1 -1
- package/.server/typings/index.d.js.map +1 -1
- package/package.json +56 -57
- package/src/client/javascripts/file-upload.js +1 -1
- package/src/server/index.ts +0 -2
- package/src/server/plugins/engine/components/helpers/index.ts +1 -1
- package/src/server/plugins/engine/routes/questions.ts +2 -6
- package/src/server/plugins/nunjucks/types.js +0 -2
- package/src/server/plugins/postcode-lookup/routes/index.js +1 -1
- package/src/server/services/cacheService.ts +1 -1
- package/src/typings/hapi/index.d.ts +13 -8
- package/src/typings/index.d.ts +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"application.css": "stylesheets/application.min.css",
|
|
3
|
+
"application.css.map": "stylesheets/application.min.css.map",
|
|
2
4
|
"application.js": "javascripts/application.min.js",
|
|
5
|
+
"application.js.map": "javascripts/application.min.js.map",
|
|
3
6
|
"assets/fonts/bold-affa96571d-v2.woff": "assets/fonts/bold-affa96571d-v2.woff",
|
|
4
7
|
"assets/fonts/bold-b542beb274-v2.woff2": "assets/fonts/bold-b542beb274-v2.woff2",
|
|
5
8
|
"assets/fonts/light-94a07e06a1-v2.woff2": "assets/fonts/light-94a07e06a1-v2.woff2",
|
|
@@ -23,12 +26,10 @@
|
|
|
23
26
|
"assets/rebrand/images/govuk-opengraph-image.png": "assets/rebrand/images/govuk-opengraph-image.png",
|
|
24
27
|
"assets/rebrand/manifest.json": "assets/rebrand/manifest.json",
|
|
25
28
|
"javascripts/application.min.js.LICENSE.txt": "javascripts/application.min.js.LICENSE.txt",
|
|
26
|
-
"javascripts/application.min.js.map": "javascripts/application.min.js.map",
|
|
27
29
|
"javascripts/shared.min.js.LICENSE.txt": "javascripts/shared.min.js.LICENSE.txt",
|
|
28
|
-
"javascripts/shared.min.js.map": "javascripts/shared.min.js.map",
|
|
29
|
-
"javascripts/vendor/accessible-autocomplete.min.js.map": "javascripts/vendor/accessible-autocomplete.min.js.map",
|
|
30
30
|
"shared.js": "javascripts/shared.min.js",
|
|
31
|
-
"
|
|
31
|
+
"shared.js.map": "javascripts/shared.min.js.map",
|
|
32
32
|
"stylesheets/application.scss": "stylesheets/application.min.css",
|
|
33
|
-
"vendor/accessible-autocomplete.js": "javascripts/vendor/accessible-autocomplete.min.js"
|
|
33
|
+
"vendor/accessible-autocomplete.js": "javascripts/vendor/accessible-autocomplete.min.js",
|
|
34
|
+
"vendor/accessible-autocomplete.js.map": "javascripts/vendor/accessible-autocomplete.min.js.map"
|
|
34
35
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see application.min.js.LICENSE.txt */
|
|
2
|
-
var e,t,n,o={313:(e,t,n)=>{n.d(t,{Yi:()=>P});const o=300,r="aria-describedby",i="error-summary-title";function s(e,t,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(i)?n.setAttribute(r,i):n.removeAttribute(r));t&&(t.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${i}">\n There is a problem\n </h2>\n <div class="govuk-error-summary__body">\n <ul class="govuk-list govuk-error-summary__list">\n <li>\n <a href="#file-upload">${e}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(r,i));const o=n.closest(".govuk-form-group");if(o){o.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const t=n.id;let i=document.getElementById(`${t}-error`);i||(i=document.createElement("p"),i.id=`${t}-error`,i.className="govuk-error-message",i.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${e}`,o.insertBefore(i,n)),n.setAttribute(r,`error-summary-title ${t}-error`)}}function a(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function l(){var e;const t=document.querySelector('form:has(input[type="file"])'),n=t?t.querySelector('input[type="file"]'):null,i=t?t.querySelector(".upload-file-button"):null,l=null!=(e=Array.from(document.querySelectorAll("button.govuk-button")).find((e=>{var t;return"Continue"===(null==(t=e.textContent)?void 0:t.trim())})))?e:null,u=document.querySelector(".govuk-error-summary-container");if(!t||!n||!i)return;const c=t;let d=null,h=!1;const m=c.dataset.uploadId;n.addEventListener("change",(()=>{u&&(u.innerHTML=""),n.files&&n.files.length>0&&(d=n.files[0])})),i.addEventListener("click",(e=>{if(!d)return e.preventDefault(),void s("Select a file",u,n);h?e.preventDefault():(h=!0,function(e,t,n,o,i){(function(e,t,n){var o;const i=document.getElementById("uploadedFilesContainer"),s=i?i.closest("form"):null;if(!(s&&s instanceof HTMLFormElement))return;const a=s.querySelector("p.govuk-body");if(!a)return;const l=function(e,t){let n=null==e?void 0:e.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(e,t,n){var o;null!=t&&t.nextSibling&&t.parentNode===e?e.insertBefore(n,t.nextSibling):(null!=(o=null==t?void 0:t.parentNode)?o:e).appendChild(n)}(e,t,n)}catch(o){try{null==e||e.appendChild(n)}catch(r){document.body.appendChild(n)}}}return n}(s,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(r,"statusInformation");const c=function(e,t){let n=e.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const o=e.querySelector(".govuk-button-group");o?e.insertBefore(n,o):e.insertBefore(n,t.nextSibling)}return n}(s,a),d=document.querySelector(`[data-filename="${null==e?void 0:e.name}"]`);d&&d.remove();const h=function(e,t){var n,o;const r=document.createElement("div");return r.className="govuk-summary-list__row",r.setAttribute("data-filename",null!=(n=null==e?void 0:e.name)?n:""),r.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(o=null==e?void 0:e.name)?o:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${t}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,r}(e,t);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(o=null==e?void 0:e.name)?o:""} ${t}`})(i,"Uploading…",e),t.focus(),setTimeout((()=>{t.disabled=!0,n.disabled=!0,o.disabled=!0}),100)}(c,n,i,l,d),function(e,t,n,r,i,l){var u;if(!t.action||!l)return!1;e.preventDefault();const c=new FormData(t),d=!!t.dataset.proxyUrl,h=null!=(u=t.dataset.proxyUrl)?u:t.action,m={method:"POST",body:c,redirect:d?"follow":"manual"};d&&(m.mode="no-cors"),fetch(h,m).then((()=>{!function(e){let t=0;const n=setInterval((()=>{if(t++,t>=o)return clearInterval(n),void a();const r=function(e,t){const n=e.replace(/\/preview\/(draft|live)/g,"").replace(/\/{2,}/g,"/").replace(/\/$/,"").split("/").filter(Boolean);return`${n.length>2?`/${n.slice(0,n.length-2).join("/")}`:""}/upload-status/${t}`}(window.location.pathname,e);fetch(r,{headers:{Accept:"application/json"}}).then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{"ready"===e.uploadStatus&&(clearInterval(n),a())})).catch((()=>{clearInterval(n),a()}))}),1e3)}(l)})).catch((()=>(n.disabled=!1,r.disabled=!1,s("There was a problem uploading the file",i,n),null)))}(e,c,n,i,u,m))}))}function u(e){if(e.includes("#"))return e.split("#").pop()}function c(e,t={}){var n;const o=e.getAttribute("tabindex");function r(){var n;null==(n=t.onBlur)||n.call(e),o||e.removeAttribute("tabindex")}o||e.setAttribute("tabindex","-1"),e.addEventListener("focus",(function(){e.addEventListener("blur",r,{once:!0})}),{once:!0}),null==(n=t.onBeforeFocus)||n.call(e),e.focus()}function d(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function h(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function m(e,t){return`${e.moduleName}: ${t}`}class p extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class f extends p{constructor(e=document.body){const t="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(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class g extends p{constructor(...e){super(...e),this.name="ConfigError"}}class v extends p{constructor(e){let t="string"==typeof e?e:"";if("object"==typeof e){const{component:n,identifier:o,element:r,expectedType:i}=e;t=o,t+=r?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",t=m(n,t)}super(t),this.name="ElementError"}}class b extends p{constructor(e){super("string"==typeof e?e:m(e,"Root element (`$root`) already initialised")),this.name="InitError"}}function y(e,t,n){let o,r=document;var i;"object"==typeof n&&(r=null!=(i=n.scope)?i:r,o=n.onError),"function"==typeof n&&(o=n),n instanceof HTMLElement&&(r=n);const s=r.querySelectorAll(`[data-module="${e.moduleName}"]`);return d()?Array.from(s).map((n=>{try{return void 0!==t?new e(n,t):new e(n)}catch(r){return o?o(r,{element:n,component:e,config:t}):console.log(r),null}})).filter(Boolean):(o?o(new f,{component:e,config:t}):console.log(new f),[])}class w{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new b("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new v({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new b(e)}static checkSupport(){if(!d())throw new f}}w.elementType=HTMLElement;const k=Symbol.for("configOverride");class $ extends w{[k](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const n=this.constructor;if(!h(n.defaults))throw new g(m(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(e,t){if(!h(e.schema))throw new g(m(e,"Config passed as parameter into constructor but no schema defined"));const n={},o=Object.entries(e.schema.properties);for(const r of o){const[o,i]=r,s=o.toString();s in t&&(n[s]=E(t[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=C(e.schema,t,o))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=t?t:{},this[k](o),o)}}function E(e,t){const n=e?e.trim():"";let o,r=null==t?void 0:t.type;switch(r||(["true","false"].includes(n)&&(r="boolean"),n.length>0&&isFinite(Number(n))&&(r="number")),r){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function x(...e){const t={};for(const n of e)for(const e of Object.keys(n)){const o=t[e],r=n[e];h(o)&&h(r)?t[e]=x(o,r):t[e]=r}return t}function C(e,t,n){const o=e.properties[n];if("object"!==(null==o?void 0:o.type))return;const r={[n]:{}};for(const[i,s]of Object.entries(t)){let e=r;const t=i.split(".");for(const[o,r]of t.entries())h(e)&&(o<t.length-1?(h(e[r])||(e[r]={}),e=e[r]):i!==n&&(e[r]=E(s)))}return r[n]}class L extends ${constructor(e,t={}){super(e,t),this.debounceFormSubmitTimer=null,this.$root.addEventListener("keydown",(e=>this.handleKeyDown(e))),this.$root.addEventListener("click",(e=>this.debounce(e)))}handleKeyDown(e){const t=e.target;" "===e.key&&t instanceof HTMLElement&&"button"===t.getAttribute("role")&&(e.preventDefault(),t.click())}debounce(e){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function A(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}L.moduleName="govuk-button",L.defaults=Object.freeze({preventDoubleClick:!1}),L.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class S{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&"object"==typeof n){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,(function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):this.selectPluralFormUsingFallbackRules(t);if("object"==typeof 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`)}selectPluralFormUsingFallbackRules(e){e=Math.abs(Math.floor(e));const t=this.getPluralRulesForLocale();return t?S.pluralRules[t](e):"other"}getPluralRulesForLocale(){const e=this.locale.split("-")[0];for(const t in S.pluralRulesMap){const n=S.pluralRulesMap[t];if(n.includes(this.locale)||n.includes(e))return t}}}S.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},S.pluralRules={arabic:e=>0===e?"zero":1===e?"one":2===e?"two":e%100>=3&&e%100<=10?"few":e%100>=11&&e%100<=99?"many":"other",chinese:()=>"other",french:e=>0===e||1===e?"one":"other",german:e=>1===e?"one":"other",irish:e=>1===e?"one":2===e?"two":e>=3&&e<=6?"few":e>=7&&e<=10?"many":"other",russian(e){const t=e%100,n=t%10;return 1===n&&11!==t?"one":n>=2&&n<=4&&!(t>=12&&t<=14)?"few":0===n||n>=5&&n<=9||t>=11&&t<=14?"many":"other"},scottish:e=>1===e||11===e?"one":2===e||12===e?"two":e>=3&&e<=10||e>=13&&e<=19?"few":"other",spanish:e=>1===e?"one":e%1e6==0&&0!==e?"many":"other",welsh:e=>0===e?"zero":1===e?"one":2===e?"two":3===e?"few":6===e?"many":"other"};class M extends ${[k](e){let t={};return("maxwords"in e||"maxlength"in e)&&(t={maxlength:void 0,maxwords:void 0}),t}constructor(e,t={}){var n,o;super(e,t),this.$textarea=void 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 r=this.$root.querySelector(".govuk-js-character-count");if(!(r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement))throw new v({component:M,element:r,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(e,t){const n=[];for(const[o,r]of Object.entries(e)){const e=[];if(Array.isArray(r)){for(const{required:n,errorMessage:o}of r)n.every((e=>!!t[e]))||e.push(o);"anyOf"!==o||r.length-e.length>=1||n.push(...e)}}return n}(M.schema,this.config);if(i[0])throw new g(m(M,i[0]));this.i18n=new S(this.config.i18n,{locale:A(this.$root,"lang")}),this.maxLength=null!=(n=null!=(o=this.config.maxwords)?o:this.config.maxlength)?n:1/0,this.$textarea=r;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new v({component:M,element:a,identifier:`Count message (\`id="${s}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),`${a.textContent}`.match(/^\s*$/)&&(a.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",a);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,a.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=a.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,a.insertAdjacentElement("afterend",u),a.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>this.updateCountMessage())),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",(()=>this.handleKeyUp())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleKeyUp(){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 e=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$errorMessage||this.$textarea.classList.toggle("govuk-textarea--error",e),this.$visibleCountMessage.classList.toggle("govuk-error-message",e),this.$visibleCountMessage.classList.toggle("govuk-hint",!e),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(e){var t;return this.config.maxwords?(null!=(t=e.match(/\S+/g))?t:[]).length:e.length}getCountMessage(){const e=this.maxLength-this.count(this.$textarea.value),t=this.config.maxwords?"words":"characters";return this.formatCountMessage(e,t)}formatCountMessage(e,t){if(0===e)return this.i18n.t(`${t}AtLimit`);const n=e<0?"OverLimit":"UnderLimit";return this.i18n.t(`${t}${n}`,{count:Math.abs(e)})}isOverThreshold(){if(!this.config.threshold)return!0;const e=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=e}}M.moduleName="govuk-character-count",M.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:""}}}),M.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 I extends w{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new v({component:I,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=t,this.$inputs.forEach((e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new v({component:I,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(e=>this.handleClick(e)))}syncAllConditionalReveals(){this.$inputs.forEach((e=>this.syncConditionalRevealWithInputState(e)))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!t)}}unCheckAllInputsExcept(e){document.querySelectorAll(`input[type="checkbox"][name="${e.name}"]`).forEach((t=>{e.form===t.form&&t!==e&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}))}unCheckExclusiveInputs(e){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${e.name}"]`).forEach((t=>{e.form===t.form&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}))}handleClick(e){const t=e.target;t instanceof HTMLInputElement&&"checkbox"===t.type&&(t.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(t),t.checked&&("exclusive"===t.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(t):this.unCheckExclusiveInputs(t)))}}I.moduleName="govuk-checkboxes";class T extends ${constructor(e,t={}){super(e,t),this.config.disableAutoFocus||c(this.$root),this.$root.addEventListener("click",(e=>this.handleClick(e)))}handleClick(e){const t=e.target;t&&this.focusTarget(t)&&e.preventDefault()}focusTarget(e){if(!(e instanceof HTMLAnchorElement))return!1;const t=u(e.href);if(!t)return!1;const n=document.getElementById(t);if(!n)return!1;const o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(e){var t;const n=e.closest("fieldset");if(n){const t=n.getElementsByTagName("legend");if(t.length){const n=t[0];if(e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type))return n;const o=n.getBoundingClientRect().top,r=e.getBoundingClientRect();if(r.height&&window.innerHeight&&r.top+r.height-o<window.innerHeight/2)return n}}return null!=(t=document.querySelector(`label[for='${e.getAttribute("id")}']`))?t:e.closest("label")}}T.moduleName="govuk-error-summary",T.defaults=Object.freeze({disableAutoFocus:!1}),T.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class O extends w{constructor(e){super(e),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const t=this.$root.querySelector(".govuk-js-header-toggle");if(!t)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=t.getAttribute("aria-controls");if(!n)throw new v({component:O,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const o=document.getElementById(n);if(!o)throw new v({component:O,element:o,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=o,this.$menuButton=t,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}setupResponsiveChecks(){const e=function(e){const t="--govuk-breakpoint-desktop";return{property:t,value:window.getComputedStyle(document.documentElement).getPropertyValue(t)||void 0}}();if(!e.value)throw new v({component:O,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"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),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()}}O.moduleName="govuk-header";class j extends ${constructor(e,t={}){super(e,t),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||c(this.$root)}}j.moduleName="govuk-notification-banner",j.defaults=Object.freeze({disableAutoFocus:!1}),j.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class _ extends w{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new v({component:_,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=t,this.$inputs.forEach((e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new v({component:_,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(e=>this.handleClick(e)))}syncAllConditionalReveals(){this.$inputs.forEach((e=>this.syncConditionalRevealWithInputState(e)))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!t)}}handleClick(e){const t=e.target;if(!(t instanceof HTMLInputElement)||"radio"!==t.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),o=t.form,r=t.name;n.forEach((e=>{const t=e.form===o;e.name===r&&t&&this.syncConditionalRevealWithInputState(e)}))}}_.moduleName="govuk-radios";class R extends w{constructor(e){var t;super(e);const n=this.$root.hash,o=null!=(t=this.$root.getAttribute("href"))?t:"";let r;try{r=new window.URL(this.$root.href)}catch(a){throw new v(`Skip link: Target link (\`href="${o}"\`) is invalid`)}if(r.origin!==window.location.origin||r.pathname!==window.location.pathname)return;const i=u(n);if(!i)throw new v(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const s=document.getElementById(i);if(!s)throw new v({component:R,element:s,identifier:`Target content (\`id="${i}"\`)`});this.$root.addEventListener("click",(()=>c(s,{onBeforeFocus(){s.classList.add("govuk-skip-link-focused-element")},onBlur(){s.classList.remove("govuk-skip-link-focused-element")}})))}}R.elementType=HTMLAnchorElement,R.moduleName="govuk-skip-link";const q=function(){y(L),y(M),y(I),y(T),y(O),y(j),y(_),y(R)},B=function(){const e=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');e.length&&n.e(7).then(n.t.bind(n,60,19)).then((t=>{const{default:n}=t;e.forEach((e=>function(e,t){if(!e)return;const n={id:e.id,selectElement:e};t(n);const o=document.querySelector(`#${n.id}`),r=[...e.options].map((e=>e.text));null==o||o.addEventListener("blur",(()=>{o.value&&r.includes(o.value)||(e.value="")}))}(e.querySelector("select"),n.enhanceSelectElement)))})).catch(console.error)},N=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l()},F=function(){if(window.opener){const e=document.querySelector(".js-preview-banner-close");null==e||e.removeAttribute("hidden"),null==e||e.addEventListener("click",(e=>{e.preventDefault(),window.close()}))}};function P(){q(),B(),N(),F()}}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,n)=>(i.f[n](e,t),t)),[])),i.u=e=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},i.l=(e,t,o,r)=>{if(n[e])n[e].push(t);else{var s,a;if(void 0!==o)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==e){s=c;break}}s||(a=!0,(s=document.createElement("script")).type="module",s.charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.src=e),n[e]=[t];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var r=n[e];if(delete n[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((e=>e(o))),t)return t(o)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),a&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e+"../"})(),(()=>{var e={543:0,804:0};i.f.j=(t,n)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var s=i.p+i.u(t),a=new Error;i.l(s,(n=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",a.name="ChunkLoadError",a.type=r,a.request=s,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,s=n[0],a=n[1],l=n[2],u=0;if(s.some((t=>0!==e[t]))){for(o in a)i.o(a,o)&&(i.m[o]=a[o]);l&&l(i)}for(t&&t(n);u<s.length;u++)r=s[u],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(0,i(313).Yi)();
|
|
2
|
+
var e,t,n,o={313:(e,t,n)=>{n.d(t,{Yi:()=>F,IW:()=>B,AC:()=>q,u8:()=>N,DK:()=>R});const o="aria-describedby",r="error-summary-title";function i(e,t,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(r)?n.setAttribute(o,r):n.removeAttribute(o));t&&(t.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${r}">\n There is a problem\n </h2>\n <div class="govuk-error-summary__body">\n <ul class="govuk-list govuk-error-summary__list">\n <li>\n <a href="#file-upload">${e}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(o,r));const i=n.closest(".govuk-form-group");if(i){i.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const t=n.id;let r=document.getElementById(`${t}-error`);r||(r=document.createElement("p"),r.id=`${t}-error`,r.className="govuk-error-message",r.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${e}`,i.insertBefore(r,n)),n.setAttribute(o,`error-summary-title ${t}-error`)}}function s(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function a(){var e;const t=document.querySelector('form:has(input[type="file"])'),n=t?t.querySelector('input[type="file"]'):null,r=t?t.querySelector(".upload-file-button"):null,a=null!=(e=Array.from(document.querySelectorAll("button.govuk-button")).find(e=>"Continue"===e.textContent.trim()))?e:null,l=document.querySelector(".govuk-error-summary-container");if(!t||!n||!r)return;const u=t;let c=null,d=!1;const h=u.dataset.uploadId;n.addEventListener("change",()=>{l&&(l.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",e=>{if(!c)return e.preventDefault(),void i("Select a file",l,n);d?e.preventDefault():(d=!0,function(e,t,n,r,i){(function(e,t,n){var r;const i=document.getElementById("uploadedFilesContainer"),s=i?i.closest("form"):null;if(!(s&&s instanceof HTMLFormElement))return;const a=s.querySelector("p.govuk-body");if(!a)return;const l=function(e,t){let n=null==e?void 0:e.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(e,t,n){var o;null!=t&&t.nextSibling&&t.parentNode===e?e.insertBefore(n,t.nextSibling):(null!=(o=null==t?void 0:t.parentNode)?o:e).appendChild(n)}(e,t,n)}catch(o){try{null==e||e.appendChild(n)}catch(r){document.body.appendChild(n)}}}return n}(s,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(o,"statusInformation");const c=function(e,t){let n=e.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const o=e.querySelector(".govuk-button-group");o?e.insertBefore(n,o):e.insertBefore(n,t.nextSibling)}return n}(s,a),d=document.querySelector(`[data-filename="${null==e?void 0:e.name}"]`);d&&d.remove();const h=function(e,t){var n,o;const r=document.createElement("div");return r.className="govuk-summary-list__row",r.setAttribute("data-filename",null!=(n=null==e?void 0:e.name)?n:""),r.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(o=null==e?void 0:e.name)?o:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${t}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,r}(e,t);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(r=null==e?void 0:e.name)?r:""} ${t}`})(i,"Uploading…",e),t.focus(),setTimeout(()=>{t.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(u,n,r,a,c),function(e,t,n,o,r,a){var l;if(!t.action||!a)return!1;e.preventDefault();const u=new FormData(t),c=!!t.dataset.proxyUrl,d=null!=(l=t.dataset.proxyUrl)?l:t.action,h={method:"POST",body:u,redirect:c?"follow":"manual"};c&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(e){let t=0;const n=setInterval(()=>{if(t++,t>=300)return clearInterval(n),void s();const o=function(e,t){const n=e.replace(/\/preview\/(draft|live)/g,"").replace(/\/{2,}/g,"/").replace(/\/$/,"").split("/").filter(Boolean);return`${n.length>2?`/${n.slice(0,n.length-2).join("/")}`:""}/upload-status/${t}`}(window.location.pathname,e);fetch(o,{headers:{Accept:"application/json"}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{"ready"===e.uploadStatus&&(clearInterval(n),s())}).catch(()=>{clearInterval(n),s()})},1e3)}(a)}).catch(()=>(n.disabled=!1,o.disabled=!1,i("There was a problem uploading the file",r,n),null))}(e,u,n,r,l,h))})}function l(e,t={}){var n;const o=e.getAttribute("tabindex");function r(){var n;null==(n=t.onBlur)||n.call(e),o||e.removeAttribute("tabindex")}o||e.setAttribute("tabindex","-1"),e.addEventListener("focus",function(){e.addEventListener("blur",r,{once:!0})},{once:!0}),null==(n=t.onBeforeFocus)||n.call(e),e.focus()}function u(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function c(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function d(e){return!!e&&(e instanceof Element||e instanceof Document)}function h(e,t){return`${e.moduleName}: ${t}`}class m extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class p extends m{constructor(e=document.body){const t="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(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class f extends m{constructor(...e){super(...e),this.name="ConfigError"}}class g extends m{constructor(e){let t="string"==typeof e?e:"";if(c(e)){const{component:n,identifier:o,element:r,expectedType:i}=e;t=o,t+=r?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",n&&(t=h(n,t))}super(t),this.name="ElementError"}}class v extends m{constructor(e){super("string"==typeof e?e:h(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class b{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new v("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new g({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new v(e)}static checkSupport(){if(!u())throw new p}}b.elementType=HTMLElement;const y=Symbol.for("configOverride");class w extends b{[y](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const n=this.constructor;if(!c(n.defaults))throw new f(h(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(e,t){if(!c(e.schema))throw new f(h(e,"Config passed as parameter into constructor but no schema defined"));const n={},o=Object.entries(e.schema.properties);for(const r of o){const[o,i]=r,s=o.toString();s in t&&(n[s]=k(t[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=E(e.schema,t,o))}return n}(n,this._$root.dataset);this._config=$(n.defaults,null!=t?t:{},this[y](o),o)}}function k(e,t){const n=e?e.trim():"";let o,r=null==t?void 0:t.type;switch(r||(["true","false"].includes(n)&&(r="boolean"),n.length>0&&isFinite(Number(n))&&(r="number")),r){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function $(...e){const t={};for(const n of e)for(const e of Object.keys(n)){const o=t[e],r=n[e];c(o)&&c(r)?t[e]=$(o,r):t[e]=r}return t}function E(e,t,n){const o=e.properties[n];if("object"!==(null==o?void 0:o.type))return;const r={[n]:{}};for(const[i,s]of Object.entries(t)){let e=r;const t=i.split(".");for(const[o,r]of t.entries())c(e)&&(o<t.length-1?(c(e[r])||(e[r]={}),e=e[r]):i!==n&&(e[r]=k(s)))}return r[n]}function x(e,t,n){let o;const r=function(e){let t,n=document;if(c(e)){const o=e;(d(o.scope)||null===o.scope)&&(n=o.scope),"function"==typeof o.onError&&(t=o.onError)}return d(e)?n=e:null===e?n=null:"function"==typeof e&&(t=e),{scope:n,onError:t}}(n);try{var i;if(!u())throw new p;if(null===r.scope)throw new g({element:r.scope,component:e,identifier:"Scope element (`$scope`)"});o=null==(i=r.scope)?void 0:i.querySelectorAll(`[data-module="${e.moduleName}"]`)}catch(s){return r.onError?r.onError(s,{component:e,config:t}):console.log(s),[]}return Array.from(null!=o?o:[]).map(n=>{try{return void 0!==t?new e(n,t):new e(n)}catch(s){return r.onError?r.onError(s,{element:n,component:e,config:t}):console.log(s),null}}).filter(Boolean)}class C extends w{constructor(e,t={}){super(e,t),this.debounceFormSubmitTimer=null,this.$root.addEventListener("keydown",e=>this.handleKeyDown(e)),this.$root.addEventListener("click",e=>this.debounce(e))}handleKeyDown(e){const t=e.target;" "===e.key&&t instanceof HTMLElement&&"button"===t.getAttribute("role")&&(e.preventDefault(),t.click())}debounce(e){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout(()=>{this.debounceFormSubmitTimer=null},1e3))}}function A(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}C.moduleName="govuk-button",C.defaults=Object.freeze({preventDoubleClick:!1}),C.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class L{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&c(n)){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)})}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):"other";if(c(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 S extends w{[y](e){let t={};return("maxwords"in e||"maxlength"in e)&&(t={maxlength:void 0,maxwords:void 0}),t}constructor(e,t={}){var n,o;super(e,t),this.$textarea=void 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 r=this.$root.querySelector(".govuk-js-character-count");if(!(r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement))throw new g({component:S,element:r,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(e,t){const n=[];for(const[o,r]of Object.entries(e)){const e=[];if(Array.isArray(r)){for(const{required:n,errorMessage:o}of r)n.every(e=>!!t[e])||e.push(o);"anyOf"!==o||r.length-e.length>=1||n.push(...e)}}return n}(S.schema,this.config);if(i[0])throw new f(h(S,i[0]));this.i18n=new L(this.config.i18n,{locale:A(this.$root,"lang")}),this.maxLength=null!=(n=null!=(o=this.config.maxwords)?o:this.config.maxlength)?n:1/0,this.$textarea=r;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new g({component:S,element:a,identifier:`Count message (\`id="${s}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),a.textContent.match(/^\s*$/)&&(a.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",a);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,a.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=a.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,a.insertAdjacentElement("afterend",u),a.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",()=>this.updateCountMessage()),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",()=>this.handleKeyUp()),this.$textarea.addEventListener("focus",()=>this.handleFocus()),this.$textarea.addEventListener("blur",()=>this.handleBlur())}handleKeyUp(){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 e=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$errorMessage||this.$textarea.classList.toggle("govuk-textarea--error",e),this.$visibleCountMessage.classList.toggle("govuk-error-message",e),this.$visibleCountMessage.classList.toggle("govuk-hint",!e),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(e){var t;return this.config.maxwords?(null!=(t=e.match(/\S+/g))?t:[]).length:e.length}getCountMessage(){const e=this.maxLength-this.count(this.$textarea.value),t=this.config.maxwords?"words":"characters";return this.formatCountMessage(e,t)}formatCountMessage(e,t){if(0===e)return this.i18n.t(`${t}AtLimit`);const n=e<0?"OverLimit":"UnderLimit";return this.i18n.t(`${t}${n}`,{count:Math.abs(e)})}isOverThreshold(){if(!this.config.threshold)return!0;const e=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=e}}S.moduleName="govuk-character-count",S.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:""}}}),S.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 I extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new g({component:I,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=t,this.$inputs.forEach(e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new g({component:I,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",e=>this.handleClick(e))}syncAllConditionalReveals(){this.$inputs.forEach(e=>this.syncConditionalRevealWithInputState(e))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!t)}}unCheckAllInputsExcept(e){document.querySelectorAll(`input[type="checkbox"][name="${e.name}"]`).forEach(t=>{e.form===t.form&&t!==e&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))})}unCheckExclusiveInputs(e){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${e.name}"]`).forEach(t=>{e.form===t.form&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))})}handleClick(e){const t=e.target;t instanceof HTMLInputElement&&"checkbox"===t.type&&(t.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(t),t.checked&&("exclusive"===t.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(t):this.unCheckExclusiveInputs(t)))}}I.moduleName="govuk-checkboxes";class M extends w{constructor(e,t={}){super(e,t),this.config.disableAutoFocus||l(this.$root),this.$root.addEventListener("click",e=>this.handleClick(e))}handleClick(e){const t=e.target;t&&this.focusTarget(t)&&e.preventDefault()}focusTarget(e){if(!(e instanceof HTMLAnchorElement))return!1;const t=e.hash.replace("#","");if(!t)return!1;const n=document.getElementById(t);if(!n)return!1;const o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(e){var t;const n=e.closest("fieldset");if(n){const t=n.getElementsByTagName("legend");if(t.length){const n=t[0];if(e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type))return n;const o=n.getBoundingClientRect().top,r=e.getBoundingClientRect();if(r.height&&window.innerHeight&&r.top+r.height-o<window.innerHeight/2)return n}}return null!=(t=document.querySelector(`label[for='${e.getAttribute("id")}']`))?t:e.closest("label")}}M.moduleName="govuk-error-summary",M.defaults=Object.freeze({disableAutoFocus:!1}),M.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class T extends b{constructor(e){super(e),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const t=this.$root.querySelector(".govuk-js-header-toggle");if(!t)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=t.getAttribute("aria-controls");if(!n)throw new g({component:T,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const o=document.getElementById(n);if(!o)throw new g({component:T,element:o,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=o,this.$menuButton=t,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",()=>this.handleMenuButtonClick())}setupResponsiveChecks(){const e=function(){const e="--govuk-breakpoint-desktop";return{property:e,value:window.getComputedStyle(document.documentElement).getPropertyValue(e)||void 0}}();if(!e.value)throw new g({component:T,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"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),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()}}T.moduleName="govuk-header";class O extends w{constructor(e,t={}){super(e,t),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||l(this.$root)}}O.moduleName="govuk-notification-banner",O.defaults=Object.freeze({disableAutoFocus:!1}),O.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class j extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new g({component:j,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=t,this.$inputs.forEach(e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new g({component:j,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",e=>this.handleClick(e))}syncAllConditionalReveals(){this.$inputs.forEach(e=>this.syncConditionalRevealWithInputState(e))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!t)}}handleClick(e){const t=e.target;if(!(t instanceof HTMLInputElement)||"radio"!==t.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),o=t.form,r=t.name;n.forEach(e=>{const t=e.form===o;e.name===r&&t&&this.syncConditionalRevealWithInputState(e)})}}j.moduleName="govuk-radios";class _ extends b{constructor(e){var t;super(e);const n=this.$root.hash,o=null!=(t=this.$root.getAttribute("href"))?t:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const r=n.replace("#","");if(!r)throw new g(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const i=document.getElementById(r);if(!i)throw new g({component:_,element:i,identifier:`Target content (\`id="${r}"\`)`});this.$root.addEventListener("click",()=>l(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}_.elementType=HTMLAnchorElement,_.moduleName="govuk-skip-link";const q=function(){x(C),x(S),x(I),x(M),x(T),x(O),x(j),x(_)},B=function(){const e=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');e.length&&n.e(7).then(n.t.bind(n,60,19)).then(t=>{const{default:n}=t;e.forEach(e=>function(e,t){if(!e)return;const n={id:e.id,selectElement:e};t(n);const o=document.querySelector(`#${n.id}`),r=[...e.options].map(e=>e.text);null==o||o.addEventListener("blur",()=>{o.value&&r.includes(o.value)||(e.value="")})}(e.querySelector("select"),n.enhanceSelectElement))}).catch(console.error)},N=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",a):a()},R=function(){if(window.opener){const e=document.querySelector(".js-preview-banner-close");null==e||e.removeAttribute("hidden"),null==e||e.addEventListener("click",e=>{e.preventDefault(),window.close()})}};function F(){q(),B(),N(),R()}}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},i.l=(e,t,o,r)=>{if(n[e])n[e].push(t);else{var s,a;if(void 0!==o)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==e){s=c;break}}s||(a=!0,(s=document.createElement("script")).type="module",s.charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.src=e),n[e]=[t];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var r=n[e];if(delete n[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach(e=>e(o)),t)return t(o)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),a&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e+"../"})(),(()=>{var e={543:0,804:0};i.f.j=(t,n)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,r)=>o=e[t]=[n,r]);n.push(o[2]=r);var s=i.p+i.u(t),a=new Error;i.l(s,n=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",a.name="ChunkLoadError",a.type=r,a.request=s,o[1](a)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,s=n[0],a=n[1],l=n[2],u=0;if(s.some(t=>0!==e[t])){for(o in a)i.o(a,o)&&(i.m[o]=a[o]);l&&l(i)}for(t&&t(n);u<s.length;u++)r=s[u],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(0,i(313).Yi)();
|
|
3
3
|
//# sourceMappingURL=application.min.js.map
|