@defra/forms-engine-plugin 4.0.42 → 4.0.44

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.
Files changed (169) hide show
  1. package/.public/javascripts/shared.min.js +1 -1
  2. package/.public/javascripts/shared.min.js.map +1 -1
  3. package/.public/stylesheets/application.min.css +1 -1
  4. package/.public/stylesheets/application.min.css.map +1 -1
  5. package/.server/client/javascripts/location-map.js +8 -4
  6. package/.server/client/javascripts/location-map.js.map +1 -1
  7. package/.server/client/stylesheets/_payment-field.scss +8 -0
  8. package/.server/client/stylesheets/application.scss +2 -0
  9. package/.server/index.js +3 -1
  10. package/.server/index.js.map +1 -1
  11. package/.server/server/constants.d.ts +1 -0
  12. package/.server/server/constants.js +1 -0
  13. package/.server/server/constants.js.map +1 -1
  14. package/.server/server/forms/payment-test.yaml +42 -0
  15. package/.server/server/forms/register-as-a-unicorn-breeder.yaml +14 -0
  16. package/.server/server/plugins/engine/components/FormComponent.d.ts +1 -0
  17. package/.server/server/plugins/engine/components/FormComponent.js +1 -0
  18. package/.server/server/plugins/engine/components/FormComponent.js.map +1 -1
  19. package/.server/server/plugins/engine/components/PaymentField.d.ts +135 -0
  20. package/.server/server/plugins/engine/components/PaymentField.js +228 -0
  21. package/.server/server/plugins/engine/components/PaymentField.js.map +1 -0
  22. package/.server/server/plugins/engine/components/PaymentField.types.d.ts +21 -0
  23. package/.server/server/plugins/engine/components/PaymentField.types.js +2 -0
  24. package/.server/server/plugins/engine/components/PaymentField.types.js.map +1 -0
  25. package/.server/server/plugins/engine/components/UkAddressField.d.ts +1 -1
  26. package/.server/server/plugins/engine/components/UkAddressField.js +3 -1
  27. package/.server/server/plugins/engine/components/UkAddressField.js.map +1 -1
  28. package/.server/server/plugins/engine/components/helpers/components.d.ts +1 -1
  29. package/.server/server/plugins/engine/components/helpers/components.js +3 -0
  30. package/.server/server/plugins/engine/components/helpers/components.js.map +1 -1
  31. package/.server/server/plugins/engine/components/index.d.ts +1 -0
  32. package/.server/server/plugins/engine/components/index.js +1 -0
  33. package/.server/server/plugins/engine/components/index.js.map +1 -1
  34. package/.server/server/plugins/engine/configureEnginePlugin.d.ts +1 -1
  35. package/.server/server/plugins/engine/configureEnginePlugin.js +4 -2
  36. package/.server/server/plugins/engine/configureEnginePlugin.js.map +1 -1
  37. package/.server/server/plugins/engine/helpers.d.ts +1 -0
  38. package/.server/server/plugins/engine/models/SummaryViewModel.d.ts +3 -0
  39. package/.server/server/plugins/engine/models/SummaryViewModel.js +7 -0
  40. package/.server/server/plugins/engine/models/SummaryViewModel.js.map +1 -1
  41. package/.server/server/plugins/engine/options.js +2 -1
  42. package/.server/server/plugins/engine/options.js.map +1 -1
  43. package/.server/server/plugins/engine/outputFormatters/human/v1.js +34 -1
  44. package/.server/server/plugins/engine/outputFormatters/human/v1.js.map +1 -1
  45. package/.server/server/plugins/engine/outputFormatters/machine/v2.d.ts +22 -0
  46. package/.server/server/plugins/engine/outputFormatters/machine/v2.js +43 -1
  47. package/.server/server/plugins/engine/outputFormatters/machine/v2.js.map +1 -1
  48. package/.server/server/plugins/engine/pageControllers/QuestionPageController.js +29 -8
  49. package/.server/server/plugins/engine/pageControllers/QuestionPageController.js.map +1 -1
  50. package/.server/server/plugins/engine/pageControllers/StartPageController.d.ts +2 -0
  51. package/.server/server/plugins/engine/pageControllers/SummaryPageController.d.ts +17 -0
  52. package/.server/server/plugins/engine/pageControllers/SummaryPageController.js +173 -51
  53. package/.server/server/plugins/engine/pageControllers/SummaryPageController.js.map +1 -1
  54. package/.server/server/plugins/engine/pageControllers/errors.d.ts +31 -0
  55. package/.server/server/plugins/engine/pageControllers/errors.js +59 -2
  56. package/.server/server/plugins/engine/pageControllers/errors.js.map +1 -1
  57. package/.server/server/plugins/engine/pageControllers/helpers/submission.d.ts +27 -0
  58. package/.server/server/plugins/engine/pageControllers/helpers/submission.js +77 -0
  59. package/.server/server/plugins/engine/pageControllers/helpers/submission.js.map +1 -0
  60. package/.server/server/plugins/engine/plugin.js +10 -5
  61. package/.server/server/plugins/engine/plugin.js.map +1 -1
  62. package/.server/server/plugins/engine/routes/index.js +8 -4
  63. package/.server/server/plugins/engine/routes/index.js.map +1 -1
  64. package/.server/server/plugins/engine/routes/payment-helper.d.ts +14 -0
  65. package/.server/server/plugins/engine/routes/payment-helper.js +41 -0
  66. package/.server/server/plugins/engine/routes/payment-helper.js.map +1 -0
  67. package/.server/server/plugins/engine/routes/payment-helper.test.js +81 -0
  68. package/.server/server/plugins/engine/routes/payment-helper.test.js.map +1 -0
  69. package/.server/server/plugins/engine/routes/payment.d.ts +8 -0
  70. package/.server/server/plugins/engine/routes/payment.js +140 -0
  71. package/.server/server/plugins/engine/routes/payment.js.map +1 -0
  72. package/.server/server/plugins/engine/routes/payment.test.js +187 -0
  73. package/.server/server/plugins/engine/routes/payment.test.js.map +1 -0
  74. package/.server/server/plugins/engine/services/localFormsService.js +6 -0
  75. package/.server/server/plugins/engine/services/localFormsService.js.map +1 -1
  76. package/.server/server/plugins/engine/types/schema.js +7 -0
  77. package/.server/server/plugins/engine/types/schema.js.map +1 -1
  78. package/.server/server/plugins/engine/types.d.ts +20 -1
  79. package/.server/server/plugins/engine/types.js +4 -0
  80. package/.server/server/plugins/engine/types.js.map +1 -1
  81. package/.server/server/plugins/engine/validationHelpers.d.ts +1 -1
  82. package/.server/server/plugins/engine/validationHelpers.js.map +1 -1
  83. package/.server/server/plugins/engine/views/components/paymentfield.html +42 -0
  84. package/.server/server/plugins/engine/views/index.html +9 -1
  85. package/.server/server/plugins/engine/views/partials/form.html +20 -5
  86. package/.server/server/plugins/engine/views/summary.html +17 -1
  87. package/.server/server/plugins/map/routes/get-os-token.d.ts +6 -0
  88. package/.server/server/plugins/map/routes/get-os-token.js +41 -0
  89. package/.server/server/plugins/map/routes/get-os-token.js.map +1 -0
  90. package/.server/server/plugins/map/routes/get-os-token.test.js +49 -0
  91. package/.server/server/plugins/map/routes/get-os-token.test.js.map +1 -0
  92. package/.server/server/plugins/map/routes/index.d.ts +1 -11
  93. package/.server/server/plugins/map/routes/index.js +60 -16
  94. package/.server/server/plugins/map/routes/index.js.map +1 -1
  95. package/.server/server/plugins/map/types.d.ts +1 -0
  96. package/.server/server/plugins/map/types.js +1 -0
  97. package/.server/server/plugins/map/types.js.map +1 -1
  98. package/.server/server/plugins/nunjucks/filters/field.d.ts +1 -1
  99. package/.server/server/plugins/payment/helper.d.ts +30 -0
  100. package/.server/server/plugins/payment/helper.js +49 -0
  101. package/.server/server/plugins/payment/helper.js.map +1 -0
  102. package/.server/server/plugins/payment/helper.test.js +37 -0
  103. package/.server/server/plugins/payment/helper.test.js.map +1 -0
  104. package/.server/server/plugins/payment/service.d.ts +40 -0
  105. package/.server/server/plugins/payment/service.js +129 -0
  106. package/.server/server/plugins/payment/service.js.map +1 -0
  107. package/.server/server/plugins/payment/service.test.js +162 -0
  108. package/.server/server/plugins/payment/service.test.js.map +1 -0
  109. package/.server/server/plugins/payment/types.d.ts +172 -0
  110. package/.server/server/plugins/payment/types.js +78 -0
  111. package/.server/server/plugins/payment/types.js.map +1 -0
  112. package/.server/server/types.d.ts +3 -0
  113. package/.server/server/types.js.map +1 -1
  114. package/.server/typings/hapi/index.d.js.map +1 -1
  115. package/README.md +12 -9
  116. package/package.json +2 -2
  117. package/src/client/javascripts/location-map.js +12 -4
  118. package/src/client/stylesheets/_payment-field.scss +8 -0
  119. package/src/client/stylesheets/application.scss +2 -0
  120. package/src/index.ts +5 -1
  121. package/src/server/constants.js +1 -0
  122. package/src/server/forms/payment-test.yaml +42 -0
  123. package/src/server/forms/register-as-a-unicorn-breeder.yaml +14 -0
  124. package/src/server/plugins/engine/components/FormComponent.ts +1 -0
  125. package/src/server/plugins/engine/components/PaymentField.test.ts +611 -0
  126. package/src/server/plugins/engine/components/PaymentField.ts +367 -0
  127. package/src/server/plugins/engine/components/PaymentField.types.ts +21 -0
  128. package/src/server/plugins/engine/components/UkAddressField.ts +2 -1
  129. package/src/server/plugins/engine/components/helpers/components.ts +5 -0
  130. package/src/server/plugins/engine/components/index.ts +1 -0
  131. package/src/server/plugins/engine/configureEnginePlugin.ts +4 -2
  132. package/src/server/plugins/engine/models/SummaryViewModel.ts +8 -0
  133. package/src/server/plugins/engine/options.js +2 -1
  134. package/src/server/plugins/engine/outputFormatters/human/v1.payment.test.ts +147 -0
  135. package/src/server/plugins/engine/outputFormatters/human/v1.test.ts +105 -103
  136. package/src/server/plugins/engine/outputFormatters/human/v1.ts +61 -2
  137. package/src/server/plugins/engine/outputFormatters/machine/v2.payment.test.ts +115 -0
  138. package/src/server/plugins/engine/outputFormatters/machine/v2.ts +60 -1
  139. package/src/server/plugins/engine/pageControllers/QuestionPageController.ts +32 -6
  140. package/src/server/plugins/engine/pageControllers/SummaryPageController.ts +247 -72
  141. package/src/server/plugins/engine/pageControllers/errors.test.ts +13 -1
  142. package/src/server/plugins/engine/pageControllers/errors.ts +79 -4
  143. package/src/server/plugins/engine/pageControllers/helpers/submission.test.ts +299 -0
  144. package/src/server/plugins/engine/pageControllers/helpers/submission.ts +110 -0
  145. package/src/server/plugins/engine/plugin.ts +17 -10
  146. package/src/server/plugins/engine/routes/index.ts +17 -16
  147. package/src/server/plugins/engine/routes/payment-helper.js +39 -0
  148. package/src/server/plugins/engine/routes/payment-helper.test.js +90 -0
  149. package/src/server/plugins/engine/routes/payment.js +151 -0
  150. package/src/server/plugins/engine/routes/payment.test.js +180 -0
  151. package/src/server/plugins/engine/services/localFormsService.js +7 -0
  152. package/src/server/plugins/engine/types/schema.ts +9 -0
  153. package/src/server/plugins/engine/types.ts +25 -1
  154. package/src/server/plugins/engine/validationHelpers.ts +1 -1
  155. package/src/server/plugins/engine/views/components/paymentfield.html +42 -0
  156. package/src/server/plugins/engine/views/index.html +9 -1
  157. package/src/server/plugins/engine/views/partials/form.html +20 -5
  158. package/src/server/plugins/engine/views/summary.html +17 -1
  159. package/src/server/plugins/map/routes/get-os-token.js +41 -0
  160. package/src/server/plugins/map/routes/get-os-token.test.js +55 -0
  161. package/src/server/plugins/map/routes/index.js +70 -24
  162. package/src/server/plugins/map/types.js +1 -0
  163. package/src/server/plugins/payment/helper.js +56 -0
  164. package/src/server/plugins/payment/helper.test.js +52 -0
  165. package/src/server/plugins/payment/service.js +171 -0
  166. package/src/server/plugins/payment/service.test.js +205 -0
  167. package/src/server/plugins/payment/types.js +77 -0
  168. package/src/server/types.ts +3 -0
  169. package/src/typings/hapi/index.d.ts +1 -0
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see shared.min.js.LICENSE.txt */
2
- var t,e,n,r={57:(t,e,n)=>{n.d(e,{Yv:()=>M});let r=" ";class o{static get separator(){return r}static set separator(t){r=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,i=null,s=null,a=null;switch(e){default:case"d":case"deg":i=t.toFixed(n),i<100&&(i="0"+i),i<10&&(i="0"+i),r=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),s=(60*t%60).toFixed(n),60==s&&(s=(0).toFixed(n),i++),i=("000"+i).slice(-3),s<10&&(s="0"+s),r=i+"°"+o.separator+s+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),s=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),s++),60==s&&(s=0,i++),i=("000"+i).slice(-3),s=("00"+s).slice(-2),a<10&&(a="0"+a),r=i+"°"+o.separator+s+"′"+o.separator+a+"″"}return r}static toLat(t,e,n){const r=o.toDms(o.wrap90(t),e,n);return null===r?"–":r.slice(1)+o.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=o.toDms(o.wrap180(t),e,n);return null===r?"–":r+o.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=o.toDms(o.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=o.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const i=o;class s{constructor(t,e,n){if(isNaN(t)||isNaN(e)||isNaN(n))throw new TypeError(`invalid vector [${t},${e},${n}]`);this.x=Number(t),this.y=Number(e),this.z=Number(n)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,n=this.z*t.x-this.x*t.z,r=this.x*t.y-this.y*t.x;return new s(e,n,r)}negate(){return new s(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,n=this.y/t,r=this.z/t;return new s(e,n,r)}angleTo(t,e=void 0){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");if(!(e instanceof s||null==e))throw new TypeError("n is not Vector3d object");const n=null==e||this.cross(t).dot(e)>=0?1:-1,r=this.cross(t).length*n,o=this.dot(t);return Math.atan2(r,o)}rotateAround(t,e){if(!(t instanceof s))throw new TypeError("axis is not Vector3d object");const n=e.toRadians(),r=this.unit(),o=t.unit(),i=Math.sin(n),a=Math.cos(n),l=1-a,u=o.x,c=o.y,d=o.z,h=[[l*u*u+a,l*u*c-i*d,l*u*d+i*c],[l*u*c+i*d,l*c*c+a,l*c*d-i*u],[l*u*d-i*c,l*c*d+i*u,l*d*d+a]],m=[h[0][0]*r.x+h[0][1]*r.y+h[0][2]*r.z,h[1][0]*r.x+h[1][1]*r.y+h[1][2]*r.z,h[2][0]*r.x+h[2][1]*r.y+h[2][2]*r.z];return new s(m[0],m[1],m[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a=s,l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},u={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(u.WGS84);class c{constructor(t,e,n=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(n)||null==n)throw new TypeError(`invalid height ‘${n}’`);this._lat=i.wrap90(Number(t)),this._lon=i.wrap180(Number(e)),this._height=Number(n)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return u}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,n,r;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([n,e,r]=o.coordinates,r=r||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(n=o.longitude),null!=o.lng&&(n=o.lng),null!=o.lon&&(n=o.lon),null!=o.height&&(r=o.height),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n))),null!=t[1]&&(r=t[1]),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,n]=t[0].split(","),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[1]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==n&&([e,n]=t,e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[2]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,n,r)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),n=this.lon.toRadians(),r=this.height,{a:o,f:i}=t,s=Math.sin(e),a=Math.cos(e),u=Math.sin(n),c=Math.cos(n),h=2*i-i*i,m=o/Math.sqrt(1-h*s*s);return new d((m+r)*a*c,(m+r)*a*u,(m*(1-h)+r)*s)}equals(t){if(!(t instanceof c))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,n=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const r=(this.height>=0?" +":" ")+this.height.toFixed(n)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==n?"":r}`):`${i.toLat(this.lat,t,e)}, ${i.toLon(this.lon,t,e)}${null==n?"":r}`}}class d extends a{constructor(t,e,n){super(t,e,n)}toLatLon(t=l.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:n,z:r}=this,{a:o,b:i,f:s}=t,a=2*s-s*s,u=a/(1-a),d=Math.sqrt(e*e+n*n),h=i*r/(o*d)*(1+u*i/Math.sqrt(d*d+r*r)),m=h/Math.sqrt(1+h*h),p=m/h,f=isNaN(p)?0:Math.atan2(r+u*i*m*m*m,d-a*o*p*p*p),g=Math.atan2(n,e),v=Math.sin(f),b=d*Math.cos(f)+r*v-o*o/(o/Math.sqrt(1-a*v*v));return new c(f.toDegrees(),g.toDegrees(),b)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const h={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},m={ED50:{ellipsoid:h.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:h.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:h.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:h.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:h.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:h.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:h.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:h.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:h.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:h.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:h.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(h).forEach(t=>Object.freeze(h[t])),Object.keys(m).forEach(t=>{Object.freeze(m[t]),Object.freeze(m[t].transform)});class p extends c{constructor(t,e,n=0,r=m.WGS84){if(!r||null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),this._datum=r}get datum(){return this._datum}static get ellipsoids(){return h}static get datums(){return m}static parse(...t){let e=m.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.parse(...t);return n._datum=e,n}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new f(t.x,t.y,t.z,this.datum)}}class f extends d{constructor(t,e,n,r=void 0){if(r&&null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),r&&(this._datum=r)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||m.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.toLatLon(e.ellipsoid);return new p(n.lat,n.lon,n.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,n=null;null!=this.datum&&this.datum!=m.WGS84||(e=this,n=t.transform),t==m.WGS84&&(e=this,n=this.datum.transform.map(t=>-t)),null==n&&(e=this.convertDatum(m.WGS84),n=t.transform);const r=e.applyTransform(n);return r.datum=t,r}applyTransform(t){const{x:e,y:n,z:r}=this,o=t[0],i=t[1],s=t[2],a=t[3]/1e6+1,l=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),c=(t[6]/3600).toRadians();return new f(o+e*a-n*c+r*u,i+e*c+n*a-r*l,s-e*u+n*l+r*a)}}const g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:p.ellipsoids.Airy1830};class v{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=p.datums.WGS84){const{easting:e,northing:n}=this,{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d;let f=i,v=0;do{f=(n-l-v)/(r*u)+f,v=o*u*((1+d+5/4*h+5/4*m)*(f-i)-(3*d+3*d*d+21/8*m)*Math.sin(f-i)*Math.cos(f+i)+(15/8*h+15/8*m)*Math.sin(2*(f-i))*Math.cos(2*(f+i))-35/24*m*Math.sin(3*(f-i))*Math.cos(3*(f+i)))}while(Math.abs(n-l-v)>=1e-5);const w=Math.cos(f),y=Math.sin(f),$=r*u/Math.sqrt(1-c*y*y),k=r*u*(1-c)/Math.pow(1-c*y*y,1.5),E=$/k-1,S=Math.tan(f),x=S*S,N=x*x,M=1/w,L=$*$*$,C=L*$*$,A=e-a,T=A*A,O=T*A,_=T*T,I=O*T;f=f-S/(2*k*$)*T+S/(24*k*L)*(5+3*x+E-9*x*E)*_-S/(720*k*C)*(61+90*x+45*N)*(_*T);const R=s+M/$*A-M/(6*L)*($/k+2*x)*O+M/(120*C)*(5+28*x+24*N)*I-M/(C*$*$*5040)*(61+662*x+1320*N+N*x*720)*(I*T);let j=new b(f.toDegrees(),R.toDegrees(),0,p.datums.OSGB36);return t!=p.datums.OSGB36&&(j=j.convertDatum(t),j=new b(j.lat,j.lon,j.height,j.datum)),j}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new v(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let n=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),r=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);n>7&&n--,r>7&&r--;const o=(n-2)%5*5+r%5,i=19-5*Math.floor(n/5)-Math.floor(r/5);let s=t.slice(2).trim().split(/\s+/);if(1==s.length&&(s=[s[0].slice(0,s[0].length/2),s[0].slice(s[0].length/2)]),s[0].length!=s[1].length)throw new Error(`invalid grid reference ‘${t}’`);s[0]=s[0].padEnd(5,"0"),s[1]=s[1].padEnd(5,"0");const a=o+s[0],l=i+s[1];return new v(a,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:n}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${n.toLocaleString("en",t)}`}const r=Math.floor(e/1e5),o=Math.floor(n/1e5);let i=19-o-(19-o)%5+Math.floor((r+10)/5),s=5*(19-o)%25+r%5;i>7&&i++,s>7&&s++;const a=String.fromCharCode(i+"A".charCodeAt(0),s+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),n=Math.floor(n%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),n=n.toString().padStart(t/2,"0"),`${a} ${e} ${n}`}}class b extends p{toOsGrid(){const t=this.datum==p.datums.OSGB36?this:this.convertDatum(p.datums.OSGB36),e=t.lat.toRadians(),n=t.lon.toRadians(),{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d,f=Math.cos(e),b=Math.sin(e),w=r*u/Math.sqrt(1-c*b*b),y=r*u*(1-c)/Math.pow(1-c*b*b,1.5),$=w/y-1,k=o*u*((1+d+5/4*h+5/4*m)*(e-i)-(3*d+3*d*d+21/8*m)*Math.sin(e-i)*Math.cos(e+i)+(15/8*h+15/8*m)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*m*Math.sin(3*(e-i))*Math.cos(3*(e+i))),E=f*f*f,S=E*f*f,x=Math.tan(e)*Math.tan(e),N=x*x,M=n-s,L=M*M,C=L*M,A=C*M,T=A*M;let O=k+l+w/2*b*f*L+w/24*b*E*(5-x+9*$)*A+w/720*b*S*(61-58*x+N)*(T*M),_=a+w*f*M+w/6*E*(w/y-x)*C+w/120*S*(5-18*x+N+14*$-58*x*$)*T;O=Number(O.toFixed(3)),_=Number(_.toFixed(3));try{return new v(_,O)}catch(I){throw new Error(`${I.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new b(e.lat,e.lon,e.height,e.datum)}}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},w.apply(null,arguments)}function y({easting:t,northing:e}){const n=new v(t,e).toLatLon();return{lat:n.latitude,long:n.longitude}}function $(t){const e=v.parse(t).toLatLon();return{lat:e.latitude,long:e.longitude}}const k={zoom:"6",center:[-2.421975,53.825564]},E=169,S="input.govuk-input",x={interactMarkerChange:"interact:markerchange"},N={VTS_OUTDOOR_URL:"/api/maps/vts/OS_VTS_3857_Outdoor.json",VTS_DARK_URL:"/api/maps/vts/OS_VTS_3857_Dark.json",VTS_BLACK_AND_WHITE_URL:"/api/maps/vts/OS_VTS_3857_Black_and_White.json"};function M(t={}){const{assetPath:e="/assets",apiPath:n="/form/api",data:r=N}=t,o=document.querySelectorAll(".app-location-field");if(o.length){const t=document.querySelector("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",function(t){return function(e){e.submitter instanceof HTMLButtonElement&&t.includes(e.submitter)||e.preventDefault()}}(e),!1)}o.forEach((t,o)=>{!function(t,e,n){var r;if(!(e instanceof HTMLDivElement))return;const o=e.querySelector(".app-location-field-inputs");if(!(o instanceof HTMLDivElement))return;const i=e.dataset.locationtype;if(!i||!["latlongfield","eastingnorthingfield","osgridreffield"].includes(i))return;const s=document.createElement("div"),a=`map_${n}`;s.setAttribute("id",a),s.setAttribute("class","map-container");const l=null!=(r=function(t){switch(t.dataset.locationtype){case"latlongfield":return function(t){const{latInput:e,longInput:n}=O(t),r=C(e.value,n.value);if(r.valid)return R([r.value.long,r.value.lat])}(t);case"eastingnorthingfield":return function(t){const{eastingInput:e,northingInput:n}=_(t),r=A(e.value,n.value);if(!r.valid)return;const o=y(r.value);return R([o.long,o.lat])}(t);case"osgridreffield":return function(t){const e=T(I(t).value);if(!e.valid)return;const n=$(e.value);return R([n.long,n.lat])}(t);default:throw new Error("Not implemented")}}(e))?r:k;o.after(s);const{map:u,interactPlugin:c}=function(t,e,n){const{assetPath:r,apiPath:o,data:i=N}=n,s="Ordnance survey logo",a=window.defra,l=a.interactPlugin({dataLayers:[],markerColor:{outdoor:"#ff0000",dark:"#00ff00"},interactionMode:"marker",multiSelect:!1});return{map:new a.InteractiveMap(t,w({},e,{mapProvider:a.maplibreProvider(),reverseGeocodeProvider:a.openNamesProvider({url:`${o}/reverse-geocode-proxy?easting={easting}&northing={northing}`}),behaviour:"inline",minZoom:6,maxZoom:18,containerHeight:"400px",enableZoomControls:!0,transformRequest:L(o),plugins:[a.mapStylesPlugin({mapStyles:[{id:"outdoor",label:"Outdoor",url:i.VTS_OUTDOOR_URL,thumbnail:`${r}/interactive-map/assets/images/outdoor-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`,backgroundColor:"#f5f5f0"},{id:"dark",label:"Dark",url:i.VTS_DARK_URL,mapColorScheme:"dark",appColorScheme:"dark",thumbnail:`${r}/interactive-map/assets/images/dark-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-white.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"black-and-white",label:"Black/White",url:i.VTS_BLACK_AND_WHITE_URL,thumbnail:`${r}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-black.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`}]}),l,a.searchPlugin({osNamesURL:`${o}/geocode-proxy?query={query}`,width:"300px",showMarker:!1}),a.scaleBarPlugin({units:"metric"})]})),interactPlugin:l}}(a,l,t);u.on("map:ready",function(t){switch(i){case"latlongfield":!function(t,e,n){const{latInput:r,longInput:o}=O(t);function i(){const t=C(r.value,o.value);if(t.valid){const r=[t.value.long,t.value.lat];j(e,n,r)}}e.on(x.interactMarkerChange,function(t){r.value=t.coords[1].toFixed(7),o.value=t.coords[0].toFixed(7)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"eastingnorthingfield":!function(t,e,n){const{eastingInput:r,northingInput:o}=_(t);function i(){const t=A(r.value,o.value);if(t.valid){const r=y(t.value),o=[r.long,r.lat];j(e,n,o)}}e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid()}({lat:t.coords[1],long:t.coords[0]});r.value=e.easting.toFixed(0),o.value=e.northing.toFixed(0)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"osgridreffield":!function(t,e,n){const r=I(t);e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid().toString()}({lat:t.coords[1],long:t.coords[0]});r.value=e}),r.addEventListener("change",function(){const t=T(r.value);if(t.valid){const r=$(t.value),o=[r.long,r.lat];j(e,n,o)}},!1)}(e,u,t.map);break;default:throw new Error("Not implemented")}u.addPanel("info",{showLabel:!0,label:"How to use the map",mobile:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},tablet:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},desktop:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},html:"If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter."}),c.enable()})}({assetPath:e,apiPath:n,data:r},t,o)})}function L(t){return function(e,n){if("Style"!==n&&e.startsWith("https://api.os.uk")&&!new URL(e).searchParams.has("key"))return{url:`${t}/map-proxy?url=${encodeURIComponent(e)}`,headers:{}};if(e.startsWith("https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main")){const n=e.substring(84);return{url:`${t}/maps/vts${n}`,headers:{}}}return{url:e,headers:{}}}}function C(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=49.85&&n<=60.859&&r>=-13.687&&r<=1.767?{valid:!0,value:{lat:n,long:r}}:{valid:!1}}function A(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=0&&n<=7e5&&r>=0&&r<=13e5?{valid:!0,value:{easting:n,northing:r}}:{valid:!1}}function T(t){if(!t)return{valid:!1};const e=/^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\s?(([0-9]{3})\s?([0-9]{3})|([0-9]{4})\s?([0-9]{4})|([0-9]{5})\s?([0-9]{5}))$/.exec(t);return null===e?{valid:!1}:{valid:!0,value:e[0]}}function O(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for lat and long");return{latInput:e[0],longInput:e[1]}}function _(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for easting and northing");return{eastingInput:e[0],northingInput:e[1]}}function I(t){const e=t.querySelector(S);if(null===e)throw new Error("Expected 1 input for osgridref");return e}function R(t){return{zoom:"16",center:t,markers:[{id:"location",coords:t}]}}function j(t,e,n){t.addMarker("location",n),e.flyTo({center:n,zoom:14,essential:!0})}}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,i),n.exports}i.m=r,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>n[t]);return s.default=()=>n,i.d(o,s),o},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce((e,n)=>(i.f[n](t,e),e),[])),i.u=t=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i.l=(t,e,r,o)=>{if(n[t])n[t].push(e);else{var s,a;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==t){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=t),n[t]=[e];var d=(e,r)=>{s.onerror=s.onload=null,clearTimeout(h);var o=n[t];if(delete n[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(t=>t(r)),e)return e(r)},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=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),(()=>{var t={804:0};i.f.j=(e,n)=>{var r=i.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=t[e]=[n,o]);n.push(r[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,r[1](a)}},"chunk-"+e,e)}};var e=(e,n)=>{var r,o,s=n[0],a=n[1],l=n[2],u=0;if(s.some(e=>0!==t[e])){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);l&&l(i)}for(e&&e(n);u<s.length;u++)o=s[u],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();const s="aria-describedby",a="error-summary-title";function l(t,e,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(a)?n.setAttribute(s,a):n.removeAttribute(s));e&&(e.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${a}">\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">${t}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(s,a));const r=n.closest(".govuk-form-group");if(r){r.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const e=n.id;let o=document.getElementById(`${e}-error`);o||(o=document.createElement("p"),o.id=`${e}-error`,o.className="govuk-error-message",o.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${t}`,r.insertBefore(o,n)),n.setAttribute(s,`error-summary-title ${e}-error`)}}function u(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function c(){var t;const e=document.querySelector('form:has(input[type="file"])'),n=e?e.querySelector('input[type="file"]'):null,r=e?e.querySelector(".upload-file-button"):null,o=null!=(t=Array.from(document.querySelectorAll("button.govuk-button")).find(t=>"Continue"===t.textContent.trim()))?t:null,i=document.querySelector(".govuk-error-summary-container");if(!e||!n||!r)return;const a=e;let c=null,d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",t=>{if(!c)return t.preventDefault(),void l("Select a file",i,n);d?t.preventDefault():(d=!0,function(t,e,n,r,o){(function(t,e,n){var r;const o=document.getElementById("uploadedFilesContainer"),i=o?o.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const a=i.querySelector("p.govuk-body");if(!a)return;const l=function(t,e){let n=null==t?void 0:t.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(t,e,n){var r;null!=e&&e.nextSibling&&e.parentNode===t?t.insertBefore(n,e.nextSibling):(null!=(r=null==e?void 0:e.parentNode)?r:t).appendChild(n)}(t,e,n)}catch(r){try{null==t||t.appendChild(n)}catch(o){document.body.appendChild(n)}}}return n}(i,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(s,"statusInformation");const c=function(t,e){let n=t.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const r=t.querySelector(".govuk-button-group");r?t.insertBefore(n,r):t.insertBefore(n,e.nextSibling)}return n}(i,a),d=document.querySelector(`[data-filename="${null==t?void 0:t.name}"]`);d&&d.remove();const h=function(t,e){var n,r;const o=document.createElement("div");return o.className="govuk-summary-list__row",o.setAttribute("data-filename",null!=(n=null==t?void 0:t.name)?n:""),o.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(r=null==t?void 0:t.name)?r:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${e}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,o}(t,e);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(r=null==t?void 0:t.name)?r:""} ${e}`})(o,"Uploading…",t),e.focus(),setTimeout(()=>{e.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(a,n,r,o,c),function(t,e,n,r,o,i){var s;if(!e.action||!i)return!1;t.preventDefault();const a=new FormData(e),c=!!e.dataset.proxyUrl,d=null!=(s=e.dataset.proxyUrl)?s:e.action,h={method:"POST",body:a,redirect:c?"follow":"manual"};c&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(t){let e=0;const n=setInterval(()=>{if(e++,e>=300)return clearInterval(n),void u();const r=function(t,e){const n=t.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/${e}`}(window.location.pathname,t);fetch(r,{headers:{Accept:"application/json"}}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{"ready"===t.uploadStatus&&(clearInterval(n),u())}).catch(()=>{clearInterval(n),u()})},1e3)}(i)}).catch(()=>(n.disabled=!1,r.disabled=!1,l("There was a problem uploading the file",o,n),null))}(t,a,n,r,i,h))})}function d(t,e={}){var n;const r=t.getAttribute("tabindex");function o(){var n;null==(n=e.onBlur)||n.call(t),r||t.removeAttribute("tabindex")}r||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 h(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function m(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function p(t){return!!t&&(t instanceof Element||t instanceof Document)}function f(t,e){return`${t.moduleName}: ${e}`}class g extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class v extends g{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 b extends g{constructor(...t){super(...t),this.name="ConfigError"}}class w extends g{constructor(t){let e="string"==typeof t?t:"";if(m(t)){const{component:n,identifier:r,element:o,expectedType:i}=t;e=r,e+=o?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",n&&(e=f(n,e))}super(e),this.name="ElementError"}}class y extends g{constructor(t){super("string"==typeof t?t:f(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class ${get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new y("`moduleName` not defined in component");if(!(t instanceof e.elementType))throw new w({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 y(t)}static checkSupport(){if(!h())throw new v}}$.elementType=HTMLElement;const k=Symbol.for("configOverride");class E extends ${[k](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!m(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const r=function(t,e){if(!m(t.schema))throw new b(f(t,"Config passed as parameter into constructor but no schema defined"));const n={},r=Object.entries(t.schema.properties);for(const o of r){const[r,i]=o,s=r.toString();s in e&&(n[s]=S(e[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=N(t.schema,e,r))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=e?e:{},this[k](r),r)}}function S(t,e){const n=t?t.trim():"";let r,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":r="true"===n;break;case"number":r=Number(n);break;default:r=t}return r}function x(...t){const e={};for(const n of t)for(const t of Object.keys(n)){const r=e[t],o=n[t];m(r)&&m(o)?e[t]=x(r,o):e[t]=o}return e}function N(t,e,n){const r=t.properties[n];if("object"!==(null==r?void 0:r.type))return;const o={[n]:{}};for(const[i,s]of Object.entries(e)){let t=o;const e=i.split(".");for(const[r,o]of e.entries())m(t)&&(r<e.length-1?(m(t[o])||(t[o]={}),t=t[o]):i!==n&&(t[o]=S(s)))}return o[n]}function M(t,e,n){let r;const o=function(t){let e,n=document;if(m(t)){const r=t;(p(r.scope)||null===r.scope)&&(n=r.scope),"function"==typeof r.onError&&(e=r.onError)}return p(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}(n);try{var i;if(!h())throw new v;if(null===o.scope)throw new w({element:o.scope,component:t,identifier:"Scope element (`$scope`)"});r=null==(i=o.scope)?void 0:i.querySelectorAll(`[data-module="${t.moduleName}"]`)}catch(s){return o.onError?o.onError(s,{component:t,config:e}):console.log(s),[]}return Array.from(null!=r?r:[]).map(n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(s){return o.onError?o.onError(s,{element:n,component:t,config:e}):console.log(s),null}}).filter(Boolean)}class L extends E{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 C(t,e){const n=t.closest(`[${e}]`);return n?n.getAttribute(e):null}L.moduleName="govuk-button",L.defaults=Object.freeze({preventDoubleClick:!1}),L.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class A{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)&&m(n)){const r=n[this.getPluralSuffix(t,e.count)];r&&(n=r)}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,r){if(Object.prototype.hasOwnProperty.call(e,r)){const t=e[r];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],r=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):"other";if(m(n)){if(r in n)return r;if("other"in n)return console.warn(`i18n: Missing plural form ".${r}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}}class T extends E{[k](t){let e={};return("maxwords"in t||"maxlength"in t)&&(e={maxlength:void 0,maxwords:void 0}),e}constructor(t,e={}){var n,r;super(t,e),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 o=this.$root.querySelector(".govuk-js-character-count");if(!(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement))throw new w({component:T,element:o,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(t,e){const n=[];for(const[r,o]of Object.entries(t)){const t=[];if(Array.isArray(o)){for(const{required:n,errorMessage:r}of o)n.every(t=>!!e[t])||t.push(r);"anyOf"!==r||o.length-t.length>=1||n.push(...t)}}return n}(T.schema,this.config);if(i[0])throw new b(f(T,i[0]));this.i18n=new A(this.config.i18n,{locale:C(this.$root,"lang")}),this.maxLength=null!=(n=null!=(r=this.config.maxwords)?r:this.config.maxlength)?n:1/0,this.$textarea=o;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new w({component:T,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 t=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",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()}count(t){var e;return this.config.maxwords?(null!=(e=t.match(/\S+/g))?e:[]).length:t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),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(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}T.moduleName="govuk-character-count",T.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:""}}}),T.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 O extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new w({component:O,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 w({component:O,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)))}}O.moduleName="govuk-checkboxes";class _ extends E{constructor(t,e={}){super(t,e),this.config.disableAutoFocus||d(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 r=this.getAssociatedLegendOrLabel(n);return!!r&&(r.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 r=n.getBoundingClientRect().top,o=t.getBoundingClientRect();if(o.height&&window.innerHeight&&o.top+o.height-r<window.innerHeight/2)return n}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}_.moduleName="govuk-error-summary",_.defaults=Object.freeze({disableAutoFocus:!1}),_.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class I extends ${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-header-toggle");if(!e)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=e.getAttribute("aria-controls");if(!n)throw new w({component:I,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const r=document.getElementById(n);if(!r)throw new w({component:I,element:r,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=r,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",()=>this.handleMenuButtonClick())}setupResponsiveChecks(){const t=function(){const t="--govuk-breakpoint-desktop";return{property:t,value:window.getComputedStyle(document.documentElement).getPropertyValue(t)||void 0}}();if(!t.value)throw new w({component:I,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.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()}}I.moduleName="govuk-header";class R extends E{constructor(t,e={}){super(t,e),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||d(this.$root)}}R.moduleName="govuk-notification-banner",R.defaults=Object.freeze({disableAutoFocus:!1}),R.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class j extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new w({component:j,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 w({component:j,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]'),r=e.form,o=e.name;n.forEach(t=>{const e=t.form===r;t.name===o&&e&&this.syncConditionalRevealWithInputState(t)})}}j.moduleName="govuk-radios";class F extends ${constructor(t){var e;super(t);const n=this.$root.hash,r=null!=(e=this.$root.getAttribute("href"))?e:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const o=n.replace("#","");if(!o)throw new w(`Skip link: Target link (\`href="${r}"\`) has no hash fragment`);const i=document.getElementById(o);if(!i)throw new w({component:F,element:i,identifier:`Target content (\`id="${o}"\`)`});this.$root.addEventListener("click",()=>d(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}F.elementType=HTMLAnchorElement,F.moduleName="govuk-skip-link";var q=i(57);const D=function(){M(L),M(T),M(O),M(_),M(I),M(R),M(j),M(F)},P=function(){const t=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');t.length&&i.e(7).then(i.t.bind(i,60,19)).then(e=>{const{default:n}=e;t.forEach(t=>function(t,e){if(!t)return;const n={id:t.id,selectElement:t};e(n);const r=document.querySelector(`#${n.id}`),o=[...t.options].map(t=>t.text);null==r||r.addEventListener("blur",()=>{r.value&&o.includes(r.value)||(t.value="")})}(t.querySelector("select"),n.enhanceSelectElement))}).catch(console.error)},B=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()},W=function(){if(window.opener){const t=document.querySelector(".js-preview-banner-close");null==t||t.removeAttribute("hidden"),null==t||t.addEventListener("click",t=>{t.preventDefault(),window.close()})}};function z(){D(),P(),B(),W()}export{z as initAll,P as initAllAutocomplete,D as initAllGovuk,B as initFileUpload,W as initPreviewCloseLink};export const initMaps=q.Yv;
2
+ var t,e,n,r={57:(t,e,n)=>{n.d(e,{Yv:()=>M});let r=" ";class o{static get separator(){return r}static set separator(t){r=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,i=null,s=null,a=null;switch(e){default:case"d":case"deg":i=t.toFixed(n),i<100&&(i="0"+i),i<10&&(i="0"+i),r=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),s=(60*t%60).toFixed(n),60==s&&(s=(0).toFixed(n),i++),i=("000"+i).slice(-3),s<10&&(s="0"+s),r=i+"°"+o.separator+s+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),s=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),s++),60==s&&(s=0,i++),i=("000"+i).slice(-3),s=("00"+s).slice(-2),a<10&&(a="0"+a),r=i+"°"+o.separator+s+"′"+o.separator+a+"″"}return r}static toLat(t,e,n){const r=o.toDms(o.wrap90(t),e,n);return null===r?"–":r.slice(1)+o.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=o.toDms(o.wrap180(t),e,n);return null===r?"–":r+o.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=o.toDms(o.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=o.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const i=o;class s{constructor(t,e,n){if(isNaN(t)||isNaN(e)||isNaN(n))throw new TypeError(`invalid vector [${t},${e},${n}]`);this.x=Number(t),this.y=Number(e),this.z=Number(n)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,n=this.z*t.x-this.x*t.z,r=this.x*t.y-this.y*t.x;return new s(e,n,r)}negate(){return new s(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,n=this.y/t,r=this.z/t;return new s(e,n,r)}angleTo(t,e=void 0){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");if(!(e instanceof s||null==e))throw new TypeError("n is not Vector3d object");const n=null==e||this.cross(t).dot(e)>=0?1:-1,r=this.cross(t).length*n,o=this.dot(t);return Math.atan2(r,o)}rotateAround(t,e){if(!(t instanceof s))throw new TypeError("axis is not Vector3d object");const n=e.toRadians(),r=this.unit(),o=t.unit(),i=Math.sin(n),a=Math.cos(n),l=1-a,u=o.x,c=o.y,d=o.z,h=[[l*u*u+a,l*u*c-i*d,l*u*d+i*c],[l*u*c+i*d,l*c*c+a,l*c*d-i*u],[l*u*d-i*c,l*c*d+i*u,l*d*d+a]],m=[h[0][0]*r.x+h[0][1]*r.y+h[0][2]*r.z,h[1][0]*r.x+h[1][1]*r.y+h[1][2]*r.z,h[2][0]*r.x+h[2][1]*r.y+h[2][2]*r.z];return new s(m[0],m[1],m[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a=s,l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},u={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(u.WGS84);class c{constructor(t,e,n=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(n)||null==n)throw new TypeError(`invalid height ‘${n}’`);this._lat=i.wrap90(Number(t)),this._lon=i.wrap180(Number(e)),this._height=Number(n)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return u}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,n,r;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([n,e,r]=o.coordinates,r=r||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(n=o.longitude),null!=o.lng&&(n=o.lng),null!=o.lon&&(n=o.lon),null!=o.height&&(r=o.height),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n))),null!=t[1]&&(r=t[1]),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,n]=t[0].split(","),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[1]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==n&&([e,n]=t,e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[2]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,n,r)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),n=this.lon.toRadians(),r=this.height,{a:o,f:i}=t,s=Math.sin(e),a=Math.cos(e),u=Math.sin(n),c=Math.cos(n),h=2*i-i*i,m=o/Math.sqrt(1-h*s*s);return new d((m+r)*a*c,(m+r)*a*u,(m*(1-h)+r)*s)}equals(t){if(!(t instanceof c))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,n=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const r=(this.height>=0?" +":" ")+this.height.toFixed(n)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==n?"":r}`):`${i.toLat(this.lat,t,e)}, ${i.toLon(this.lon,t,e)}${null==n?"":r}`}}class d extends a{constructor(t,e,n){super(t,e,n)}toLatLon(t=l.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:n,z:r}=this,{a:o,b:i,f:s}=t,a=2*s-s*s,u=a/(1-a),d=Math.sqrt(e*e+n*n),h=i*r/(o*d)*(1+u*i/Math.sqrt(d*d+r*r)),m=h/Math.sqrt(1+h*h),p=m/h,f=isNaN(p)?0:Math.atan2(r+u*i*m*m*m,d-a*o*p*p*p),g=Math.atan2(n,e),v=Math.sin(f),b=d*Math.cos(f)+r*v-o*o/(o/Math.sqrt(1-a*v*v));return new c(f.toDegrees(),g.toDegrees(),b)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const h={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},m={ED50:{ellipsoid:h.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:h.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:h.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:h.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:h.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:h.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:h.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:h.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:h.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:h.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:h.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(h).forEach(t=>Object.freeze(h[t])),Object.keys(m).forEach(t=>{Object.freeze(m[t]),Object.freeze(m[t].transform)});class p extends c{constructor(t,e,n=0,r=m.WGS84){if(!r||null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),this._datum=r}get datum(){return this._datum}static get ellipsoids(){return h}static get datums(){return m}static parse(...t){let e=m.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.parse(...t);return n._datum=e,n}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new f(t.x,t.y,t.z,this.datum)}}class f extends d{constructor(t,e,n,r=void 0){if(r&&null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),r&&(this._datum=r)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||m.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.toLatLon(e.ellipsoid);return new p(n.lat,n.lon,n.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,n=null;null!=this.datum&&this.datum!=m.WGS84||(e=this,n=t.transform),t==m.WGS84&&(e=this,n=this.datum.transform.map(t=>-t)),null==n&&(e=this.convertDatum(m.WGS84),n=t.transform);const r=e.applyTransform(n);return r.datum=t,r}applyTransform(t){const{x:e,y:n,z:r}=this,o=t[0],i=t[1],s=t[2],a=t[3]/1e6+1,l=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),c=(t[6]/3600).toRadians();return new f(o+e*a-n*c+r*u,i+e*c+n*a-r*l,s-e*u+n*l+r*a)}}const g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:p.ellipsoids.Airy1830};class v{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=p.datums.WGS84){const{easting:e,northing:n}=this,{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d;let f=i,v=0;do{f=(n-l-v)/(r*u)+f,v=o*u*((1+d+5/4*h+5/4*m)*(f-i)-(3*d+3*d*d+21/8*m)*Math.sin(f-i)*Math.cos(f+i)+(15/8*h+15/8*m)*Math.sin(2*(f-i))*Math.cos(2*(f+i))-35/24*m*Math.sin(3*(f-i))*Math.cos(3*(f+i)))}while(Math.abs(n-l-v)>=1e-5);const w=Math.cos(f),y=Math.sin(f),$=r*u/Math.sqrt(1-c*y*y),k=r*u*(1-c)/Math.pow(1-c*y*y,1.5),E=$/k-1,S=Math.tan(f),x=S*S,N=x*x,M=1/w,L=$*$*$,C=L*$*$,A=e-a,T=A*A,O=T*A,_=T*T,I=O*T;f=f-S/(2*k*$)*T+S/(24*k*L)*(5+3*x+E-9*x*E)*_-S/(720*k*C)*(61+90*x+45*N)*(_*T);const R=s+M/$*A-M/(6*L)*($/k+2*x)*O+M/(120*C)*(5+28*x+24*N)*I-M/(C*$*$*5040)*(61+662*x+1320*N+N*x*720)*(I*T);let j=new b(f.toDegrees(),R.toDegrees(),0,p.datums.OSGB36);return t!=p.datums.OSGB36&&(j=j.convertDatum(t),j=new b(j.lat,j.lon,j.height,j.datum)),j}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new v(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let n=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),r=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);n>7&&n--,r>7&&r--;const o=(n-2)%5*5+r%5,i=19-5*Math.floor(n/5)-Math.floor(r/5);let s=t.slice(2).trim().split(/\s+/);if(1==s.length&&(s=[s[0].slice(0,s[0].length/2),s[0].slice(s[0].length/2)]),s[0].length!=s[1].length)throw new Error(`invalid grid reference ‘${t}’`);s[0]=s[0].padEnd(5,"0"),s[1]=s[1].padEnd(5,"0");const a=o+s[0],l=i+s[1];return new v(a,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:n}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${n.toLocaleString("en",t)}`}const r=Math.floor(e/1e5),o=Math.floor(n/1e5);let i=19-o-(19-o)%5+Math.floor((r+10)/5),s=5*(19-o)%25+r%5;i>7&&i++,s>7&&s++;const a=String.fromCharCode(i+"A".charCodeAt(0),s+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),n=Math.floor(n%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),n=n.toString().padStart(t/2,"0"),`${a} ${e} ${n}`}}class b extends p{toOsGrid(){const t=this.datum==p.datums.OSGB36?this:this.convertDatum(p.datums.OSGB36),e=t.lat.toRadians(),n=t.lon.toRadians(),{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d,f=Math.cos(e),b=Math.sin(e),w=r*u/Math.sqrt(1-c*b*b),y=r*u*(1-c)/Math.pow(1-c*b*b,1.5),$=w/y-1,k=o*u*((1+d+5/4*h+5/4*m)*(e-i)-(3*d+3*d*d+21/8*m)*Math.sin(e-i)*Math.cos(e+i)+(15/8*h+15/8*m)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*m*Math.sin(3*(e-i))*Math.cos(3*(e+i))),E=f*f*f,S=E*f*f,x=Math.tan(e)*Math.tan(e),N=x*x,M=n-s,L=M*M,C=L*M,A=C*M,T=A*M;let O=k+l+w/2*b*f*L+w/24*b*E*(5-x+9*$)*A+w/720*b*S*(61-58*x+N)*(T*M),_=a+w*f*M+w/6*E*(w/y-x)*C+w/120*S*(5-18*x+N+14*$-58*x*$)*T;O=Number(O.toFixed(3)),_=Number(_.toFixed(3));try{return new v(_,O)}catch(I){throw new Error(`${I.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new b(e.lat,e.lon,e.height,e.datum)}}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},w.apply(null,arguments)}function y({easting:t,northing:e}){const n=new v(t,e).toLatLon();return{lat:n.latitude,long:n.longitude}}function $(t){const e=v.parse(t).toLatLon();return{lat:e.latitude,long:e.longitude}}const k={zoom:"6",center:[-2.421975,53.825564]},E=169,S="input.govuk-input",x={interactMarkerChange:"interact:markerchange"},N={VTS_OUTDOOR_URL:"/api/maps/vts/OS_VTS_3857_Outdoor.json",VTS_DARK_URL:"/api/maps/vts/OS_VTS_3857_Dark.json",VTS_BLACK_AND_WHITE_URL:"/api/maps/vts/OS_VTS_3857_Black_and_White.json"};function M(t={}){const{assetPath:e="/assets",apiPath:n="/form/api",data:r=N}=t,o=document.querySelectorAll(".app-location-field");if(o.length){const t=document.querySelector("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",function(t){return function(e){e.submitter instanceof HTMLButtonElement&&t.includes(e.submitter)||e.preventDefault()}}(e),!1)}o.forEach((t,o)=>{!function(t,e,n){var r;if(!(e instanceof HTMLDivElement))return;const o=e.querySelector(".app-location-field-inputs");if(!(o instanceof HTMLDivElement))return;const i=e.dataset.locationtype;if(!i||!["latlongfield","eastingnorthingfield","osgridreffield"].includes(i))return;const s=document.createElement("div"),a=`map_${n}`;s.setAttribute("id",a),s.setAttribute("class","map-container");const l=null!=(r=function(t){switch(t.dataset.locationtype){case"latlongfield":return function(t){const{latInput:e,longInput:n}=O(t),r=C(e.value,n.value);if(r.valid)return R([r.value.long,r.value.lat])}(t);case"eastingnorthingfield":return function(t){const{eastingInput:e,northingInput:n}=_(t),r=A(e.value,n.value);if(!r.valid)return;const o=y(r.value);return R([o.long,o.lat])}(t);case"osgridreffield":return function(t){const e=T(I(t).value);if(!e.valid)return;const n=$(e.value);return R([n.long,n.lat])}(t);default:throw new Error("Not implemented")}}(e))?r:k;o.after(s);const{map:u,interactPlugin:c}=function(t,e,n){const{assetPath:r,apiPath:o,data:i=N}=n,s="Ordnance survey logo",a=window.defra,l=a.interactPlugin({dataLayers:[],markerColor:{outdoor:"#ff0000",dark:"#00ff00"},interactionMode:"marker",multiSelect:!1});return{map:new a.InteractiveMap(t,w({},e,{mapProvider:a.maplibreProvider(),reverseGeocodeProvider:a.openNamesProvider({url:`${o}/reverse-geocode-proxy?easting={easting}&northing={northing}`}),behaviour:"inline",minZoom:6,maxZoom:18,containerHeight:"400px",enableZoomControls:!0,transformRequest:L(o),plugins:[a.mapStylesPlugin({mapStyles:[{id:"outdoor",label:"Outdoor",url:i.VTS_OUTDOOR_URL,thumbnail:`${r}/interactive-map/assets/images/outdoor-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`,backgroundColor:"#f5f5f0"},{id:"dark",label:"Dark",url:i.VTS_DARK_URL,mapColorScheme:"dark",appColorScheme:"dark",thumbnail:`${r}/interactive-map/assets/images/dark-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-white.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"black-and-white",label:"Black/White",url:i.VTS_BLACK_AND_WHITE_URL,thumbnail:`${r}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-black.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`}]}),l,a.searchPlugin({osNamesURL:`${o}/geocode-proxy?query={query}`,width:"300px",showMarker:!1}),a.scaleBarPlugin({units:"metric"})]})),interactPlugin:l}}(a,l,t);u.on("map:ready",function(t){switch(i){case"latlongfield":!function(t,e,n){const{latInput:r,longInput:o}=O(t);function i(){const t=C(r.value,o.value);if(t.valid){const r=[t.value.long,t.value.lat];j(e,n,r)}}e.on(x.interactMarkerChange,function(t){r.value=t.coords[1].toFixed(7),o.value=t.coords[0].toFixed(7)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"eastingnorthingfield":!function(t,e,n){const{eastingInput:r,northingInput:o}=_(t);function i(){const t=A(r.value,o.value);if(t.valid){const r=y(t.value),o=[r.long,r.lat];j(e,n,o)}}e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid()}({lat:t.coords[1],long:t.coords[0]});r.value=e.easting.toFixed(0),o.value=e.northing.toFixed(0)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"osgridreffield":!function(t,e,n){const r=I(t);e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid().toString()}({lat:t.coords[1],long:t.coords[0]});r.value=e}),r.addEventListener("change",function(){const t=T(r.value);if(t.valid){const r=$(t.value),o=[r.long,r.lat];j(e,n,o)}},!1)}(e,u,t.map);break;default:throw new Error("Not implemented")}u.addPanel("info",{showLabel:!0,label:"How to use the map",mobile:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},tablet:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},desktop:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},html:"If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter."}),c.enable()})}({assetPath:e,apiPath:n,data:r},t,o)})}function L(t){return function(e,n){if(e.startsWith("https://api.os.uk")){if("Tile"===n)return{url:e.replace("https://api.os.uk/maps/vector/v1/vts",`${window.location.origin}${t}`),headers:{}};if("Style"!==n)return{url:`${t}/map-proxy?url=${encodeURIComponent(e)}`,headers:{}}}if(e.startsWith("https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main")){const n=e.substring(84);return{url:`${t}/maps/vts${n}`,headers:{}}}return{url:e,headers:{}}}}function C(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=49.85&&n<=60.859&&r>=-13.687&&r<=1.767?{valid:!0,value:{lat:n,long:r}}:{valid:!1}}function A(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=0&&n<=7e5&&r>=0&&r<=13e5?{valid:!0,value:{easting:n,northing:r}}:{valid:!1}}function T(t){if(!t)return{valid:!1};const e=/^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\s?(([0-9]{3})\s?([0-9]{3})|([0-9]{4})\s?([0-9]{4})|([0-9]{5})\s?([0-9]{5}))$/.exec(t);return null===e?{valid:!1}:{valid:!0,value:e[0]}}function O(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for lat and long");return{latInput:e[0],longInput:e[1]}}function _(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for easting and northing");return{eastingInput:e[0],northingInput:e[1]}}function I(t){const e=t.querySelector(S);if(null===e)throw new Error("Expected 1 input for osgridref");return e}function R(t){return{zoom:"16",center:t,markers:[{id:"location",coords:t}]}}function j(t,e,n){t.addMarker("location",n),e.flyTo({center:n,zoom:14,essential:!0})}}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,i),n.exports}i.m=r,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>n[t]);return s.default=()=>n,i.d(o,s),o},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce((e,n)=>(i.f[n](t,e),e),[])),i.u=t=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i.l=(t,e,r,o)=>{if(n[t])n[t].push(e);else{var s,a;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==t){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=t),n[t]=[e];var d=(e,r)=>{s.onerror=s.onload=null,clearTimeout(h);var o=n[t];if(delete n[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(t=>t(r)),e)return e(r)},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=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),(()=>{var t={804:0};i.f.j=(e,n)=>{var r=i.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=t[e]=[n,o]);n.push(r[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,r[1](a)}},"chunk-"+e,e)}};var e=(e,n)=>{var r,o,s=n[0],a=n[1],l=n[2],u=0;if(s.some(e=>0!==t[e])){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);l&&l(i)}for(e&&e(n);u<s.length;u++)o=s[u],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();const s="aria-describedby",a="error-summary-title";function l(t,e,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(a)?n.setAttribute(s,a):n.removeAttribute(s));e&&(e.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${a}">\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">${t}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(s,a));const r=n.closest(".govuk-form-group");if(r){r.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const e=n.id;let o=document.getElementById(`${e}-error`);o||(o=document.createElement("p"),o.id=`${e}-error`,o.className="govuk-error-message",o.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${t}`,r.insertBefore(o,n)),n.setAttribute(s,`error-summary-title ${e}-error`)}}function u(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function c(){var t;const e=document.querySelector('form:has(input[type="file"])'),n=e?e.querySelector('input[type="file"]'):null,r=e?e.querySelector(".upload-file-button"):null,o=null!=(t=Array.from(document.querySelectorAll("button.govuk-button")).find(t=>"Continue"===t.textContent.trim()))?t:null,i=document.querySelector(".govuk-error-summary-container");if(!e||!n||!r)return;const a=e;let c=null,d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",t=>{if(!c)return t.preventDefault(),void l("Select a file",i,n);d?t.preventDefault():(d=!0,function(t,e,n,r,o){(function(t,e,n){var r;const o=document.getElementById("uploadedFilesContainer"),i=o?o.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const a=i.querySelector("p.govuk-body");if(!a)return;const l=function(t,e){let n=null==t?void 0:t.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(t,e,n){var r;null!=e&&e.nextSibling&&e.parentNode===t?t.insertBefore(n,e.nextSibling):(null!=(r=null==e?void 0:e.parentNode)?r:t).appendChild(n)}(t,e,n)}catch(r){try{null==t||t.appendChild(n)}catch(o){document.body.appendChild(n)}}}return n}(i,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(s,"statusInformation");const c=function(t,e){let n=t.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const r=t.querySelector(".govuk-button-group");r?t.insertBefore(n,r):t.insertBefore(n,e.nextSibling)}return n}(i,a),d=document.querySelector(`[data-filename="${null==t?void 0:t.name}"]`);d&&d.remove();const h=function(t,e){var n,r;const o=document.createElement("div");return o.className="govuk-summary-list__row",o.setAttribute("data-filename",null!=(n=null==t?void 0:t.name)?n:""),o.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(r=null==t?void 0:t.name)?r:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${e}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,o}(t,e);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(r=null==t?void 0:t.name)?r:""} ${e}`})(o,"Uploading…",t),e.focus(),setTimeout(()=>{e.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(a,n,r,o,c),function(t,e,n,r,o,i){var s;if(!e.action||!i)return!1;t.preventDefault();const a=new FormData(e),c=!!e.dataset.proxyUrl,d=null!=(s=e.dataset.proxyUrl)?s:e.action,h={method:"POST",body:a,redirect:c?"follow":"manual"};c&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(t){let e=0;const n=setInterval(()=>{if(e++,e>=300)return clearInterval(n),void u();const r=function(t,e){const n=t.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/${e}`}(window.location.pathname,t);fetch(r,{headers:{Accept:"application/json"}}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{"ready"===t.uploadStatus&&(clearInterval(n),u())}).catch(()=>{clearInterval(n),u()})},1e3)}(i)}).catch(()=>(n.disabled=!1,r.disabled=!1,l("There was a problem uploading the file",o,n),null))}(t,a,n,r,i,h))})}function d(t,e={}){var n;const r=t.getAttribute("tabindex");function o(){var n;null==(n=e.onBlur)||n.call(t),r||t.removeAttribute("tabindex")}r||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 h(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function m(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function p(t){return!!t&&(t instanceof Element||t instanceof Document)}function f(t,e){return`${t.moduleName}: ${e}`}class g extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class v extends g{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 b extends g{constructor(...t){super(...t),this.name="ConfigError"}}class w extends g{constructor(t){let e="string"==typeof t?t:"";if(m(t)){const{component:n,identifier:r,element:o,expectedType:i}=t;e=r,e+=o?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",n&&(e=f(n,e))}super(e),this.name="ElementError"}}class y extends g{constructor(t){super("string"==typeof t?t:f(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class ${get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new y("`moduleName` not defined in component");if(!(t instanceof e.elementType))throw new w({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 y(t)}static checkSupport(){if(!h())throw new v}}$.elementType=HTMLElement;const k=Symbol.for("configOverride");class E extends ${[k](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!m(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const r=function(t,e){if(!m(t.schema))throw new b(f(t,"Config passed as parameter into constructor but no schema defined"));const n={},r=Object.entries(t.schema.properties);for(const o of r){const[r,i]=o,s=r.toString();s in e&&(n[s]=S(e[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=N(t.schema,e,r))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=e?e:{},this[k](r),r)}}function S(t,e){const n=t?t.trim():"";let r,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":r="true"===n;break;case"number":r=Number(n);break;default:r=t}return r}function x(...t){const e={};for(const n of t)for(const t of Object.keys(n)){const r=e[t],o=n[t];m(r)&&m(o)?e[t]=x(r,o):e[t]=o}return e}function N(t,e,n){const r=t.properties[n];if("object"!==(null==r?void 0:r.type))return;const o={[n]:{}};for(const[i,s]of Object.entries(e)){let t=o;const e=i.split(".");for(const[r,o]of e.entries())m(t)&&(r<e.length-1?(m(t[o])||(t[o]={}),t=t[o]):i!==n&&(t[o]=S(s)))}return o[n]}function M(t,e,n){let r;const o=function(t){let e,n=document;if(m(t)){const r=t;(p(r.scope)||null===r.scope)&&(n=r.scope),"function"==typeof r.onError&&(e=r.onError)}return p(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}(n);try{var i;if(!h())throw new v;if(null===o.scope)throw new w({element:o.scope,component:t,identifier:"Scope element (`$scope`)"});r=null==(i=o.scope)?void 0:i.querySelectorAll(`[data-module="${t.moduleName}"]`)}catch(s){return o.onError?o.onError(s,{component:t,config:e}):console.log(s),[]}return Array.from(null!=r?r:[]).map(n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(s){return o.onError?o.onError(s,{element:n,component:t,config:e}):console.log(s),null}}).filter(Boolean)}class L extends E{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 C(t,e){const n=t.closest(`[${e}]`);return n?n.getAttribute(e):null}L.moduleName="govuk-button",L.defaults=Object.freeze({preventDoubleClick:!1}),L.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class A{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)&&m(n)){const r=n[this.getPluralSuffix(t,e.count)];r&&(n=r)}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,r){if(Object.prototype.hasOwnProperty.call(e,r)){const t=e[r];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],r=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):"other";if(m(n)){if(r in n)return r;if("other"in n)return console.warn(`i18n: Missing plural form ".${r}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}}class T extends E{[k](t){let e={};return("maxwords"in t||"maxlength"in t)&&(e={maxlength:void 0,maxwords:void 0}),e}constructor(t,e={}){var n,r;super(t,e),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 o=this.$root.querySelector(".govuk-js-character-count");if(!(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement))throw new w({component:T,element:o,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(t,e){const n=[];for(const[r,o]of Object.entries(t)){const t=[];if(Array.isArray(o)){for(const{required:n,errorMessage:r}of o)n.every(t=>!!e[t])||t.push(r);"anyOf"!==r||o.length-t.length>=1||n.push(...t)}}return n}(T.schema,this.config);if(i[0])throw new b(f(T,i[0]));this.i18n=new A(this.config.i18n,{locale:C(this.$root,"lang")}),this.maxLength=null!=(n=null!=(r=this.config.maxwords)?r:this.config.maxlength)?n:1/0,this.$textarea=o;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new w({component:T,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 t=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",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()}count(t){var e;return this.config.maxwords?(null!=(e=t.match(/\S+/g))?e:[]).length:t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),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(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}T.moduleName="govuk-character-count",T.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:""}}}),T.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 O extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new w({component:O,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 w({component:O,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)))}}O.moduleName="govuk-checkboxes";class _ extends E{constructor(t,e={}){super(t,e),this.config.disableAutoFocus||d(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 r=this.getAssociatedLegendOrLabel(n);return!!r&&(r.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 r=n.getBoundingClientRect().top,o=t.getBoundingClientRect();if(o.height&&window.innerHeight&&o.top+o.height-r<window.innerHeight/2)return n}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}_.moduleName="govuk-error-summary",_.defaults=Object.freeze({disableAutoFocus:!1}),_.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class I extends ${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-header-toggle");if(!e)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=e.getAttribute("aria-controls");if(!n)throw new w({component:I,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const r=document.getElementById(n);if(!r)throw new w({component:I,element:r,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=r,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",()=>this.handleMenuButtonClick())}setupResponsiveChecks(){const t=function(){const t="--govuk-breakpoint-desktop";return{property:t,value:window.getComputedStyle(document.documentElement).getPropertyValue(t)||void 0}}();if(!t.value)throw new w({component:I,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.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()}}I.moduleName="govuk-header";class R extends E{constructor(t,e={}){super(t,e),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||d(this.$root)}}R.moduleName="govuk-notification-banner",R.defaults=Object.freeze({disableAutoFocus:!1}),R.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class j extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new w({component:j,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 w({component:j,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]'),r=e.form,o=e.name;n.forEach(t=>{const e=t.form===r;t.name===o&&e&&this.syncConditionalRevealWithInputState(t)})}}j.moduleName="govuk-radios";class F extends ${constructor(t){var e;super(t);const n=this.$root.hash,r=null!=(e=this.$root.getAttribute("href"))?e:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const o=n.replace("#","");if(!o)throw new w(`Skip link: Target link (\`href="${r}"\`) has no hash fragment`);const i=document.getElementById(o);if(!i)throw new w({component:F,element:i,identifier:`Target content (\`id="${o}"\`)`});this.$root.addEventListener("click",()=>d(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}F.elementType=HTMLAnchorElement,F.moduleName="govuk-skip-link";var q=i(57);const D=function(){M(L),M(T),M(O),M(_),M(I),M(R),M(j),M(F)},P=function(){const t=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');t.length&&i.e(7).then(i.t.bind(i,60,19)).then(e=>{const{default:n}=e;t.forEach(t=>function(t,e){if(!t)return;const n={id:t.id,selectElement:t};e(n);const r=document.querySelector(`#${n.id}`),o=[...t.options].map(t=>t.text);null==r||r.addEventListener("blur",()=>{r.value&&o.includes(r.value)||(t.value="")})}(t.querySelector("select"),n.enhanceSelectElement))}).catch(console.error)},B=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()},W=function(){if(window.opener){const t=document.querySelector(".js-preview-banner-close");null==t||t.removeAttribute("hidden"),null==t||t.addEventListener("click",t=>{t.preventDefault(),window.close()})}};function z(){D(),P(),B(),W()}export{z as initAll,P as initAllAutocomplete,D as initAllGovuk,B as initFileUpload,W as initPreviewCloseLink};export const initMaps=q.Yv;
3
3
  //# sourceMappingURL=shared.min.js.map