digitalmarketplace-frontend
Version:
Digital Marketplace Frontend contains assets and components used in Digital Marketplace projects
5,494 lines • 206 kB
JavaScript
/*
* This variable is automatically overwritten during builds and releases.
* It doesn't need to be updated manually.
*/
/**
* Digital Marketplace Frontend release version
*
* {@link https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-govuk-frontend/releases}
*/
const version = '3.12.0';
const GOOGLE_TAG_MANAGER_ID = 'GTM-WCGFX3GW';
const googleTagManagerInit = (w, d, s, l, i) => {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
const f = d.getElementsByTagName(s)[0];
const j = d.createElement(s);
const dl = '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
};
const loadGoogleTagManager = () => googleTagManagerInit(window, document, 'script', 'dataLayer', GOOGLE_TAG_MANAGER_ID);
function assign(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
}
var defaultConverter = {
read: function read(value) {
if (value[0] === '"') {
value = value.slice(1, -1);
}
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
},
write: function write(value) {
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
}
};
function init(converter, defaultAttributes) {
function set(name, value, attributes) {
if (typeof document === 'undefined') {
return;
}
attributes = assign({}, defaultAttributes, attributes);
if (typeof attributes.expires === 'number') {
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
}
if (attributes.expires) {
attributes.expires = attributes.expires.toUTCString();
}
name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
}
return document.cookie = name + '=' + converter.write(value, name) + stringifiedAttributes;
}
function get(name) {
if (typeof document === 'undefined' || arguments.length && !name) {
return;
}
var cookies = document.cookie ? document.cookie.split('; ') : [];
var jar = {};
for (var i = 0; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var value = parts.slice(1).join('=');
try {
var found = decodeURIComponent(parts[0]);
jar[found] = converter.read(value, found);
if (name === found) {
break;
}
} catch (e) {}
}
return name ? jar[name] : jar;
}
return Object.create({
set: set,
get: get,
remove: function remove(name, attributes) {
set(name, '', assign({}, attributes, {
expires: -1
}));
},
withAttributes: function withAttributes(attributes) {
return init(this.converter, assign({}, this.attributes, attributes));
},
withConverter: function withConverter(converter) {
return init(assign({}, this.converter, converter), this.attributes);
}
}, {
attributes: {
value: Object.freeze(defaultAttributes)
},
converter: {
value: Object.freeze(converter)
}
});
}
var api = init(defaultConverter, {
path: '/'
});
var GrantType;
(function (GrantType) {
GrantType["GRANTED"] = "granted";
GrantType["NOT_GRANTED"] = "not granted";
})(GrantType || (GrantType = {}));
const getGrantedText = (state) => state ? GrantType.GRANTED : GrantType.NOT_GRANTED;
const updateDataLayer = (cookiePreferences) => {
window.dataLayer.push({
event: 'gtm_consent_update',
usage_consent: getGrantedText(cookiePreferences.usage),
glassbox_consent: getGrantedText(cookiePreferences.glassbox),
marketing_consent: GrantType.NOT_GRANTED
});
};
const cookieUpdateOptions = [
{
cookieName: 'usage',
cookiePrefixes: ['_ga', '_gi']
},
{
cookieName: 'glassbox',
cookiePrefixes: ['_cls']
}
];
const DOMAINS = [
'.marketplace.team',
'.digitalmarketplace.service.gov.uk',
'www.applytosupply.digitalmarketplace.service.gov.uk'
];
// When not in production we want to delete cookies in localhost too
const getDomains = () => {
if (window.location.hostname === 'localhost') {
return DOMAINS.concat(['localhost']);
}
return DOMAINS;
};
const getCookiePreferences = () => {
const defaultCookieSettings = '{"usage":false,"glassbox":false}';
return JSON.parse(api.get('cookie_preferences_dmp') ?? defaultCookieSettings);
};
const setCookiePreferences = (usage) => {
const cookiePreferences = getCookiePreferences();
cookiePreferences.usage = usage;
cookiePreferences.settings_viewed = true;
api.set('cookie_preferences_dmp', JSON.stringify(cookiePreferences), { expires: 365 });
updateDataLayer(cookiePreferences);
removeUnwantedCookies();
};
const removeUnwantedCookies = () => {
const cookieList = Object.keys(api.get());
const cookiesToRemove = ['digitalmarketplace_cookie_settings_viewed', 'digitalmarketplace_google_analytics_enabled', 'digitalmarketplace_cookie_options_v1', 'dm_cookies_policy'];
const cookiePreferences = getCookiePreferences();
const cookiePrefixes = [];
cookieUpdateOptions.forEach((cookieUpdateOption) => {
if (!cookiePreferences[cookieUpdateOption.cookieName])
cookiePrefixes.push(...cookieUpdateOption.cookiePrefixes);
});
for (let i = 0; i < cookieList.length; i++) {
const cookieName = cookieList[i];
if (cookiePrefixes.some((cookiePrefix) => cookieName.startsWith(cookiePrefix)))
cookiesToRemove.push(cookieName);
}
getDomains().forEach((domain) => {
cookiesToRemove.forEach((cookieName) => { api.remove(cookieName, { path: '/', domain: domain }); });
});
};
const initGoogleAnalytics = () => {
loadGoogleTagManager();
removeUnwantedCookies();
};
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _construct(t, e, r) {
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
var o = [null];
o.push.apply(o, e);
var p = new (t.bind.apply(t, o))();
return r && _setPrototypeOf(p, r.prototype), p;
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
writable: false
}), e;
}
function _createForOfIteratorHelperLoose(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (t) return (t = t.call(r)).next.bind(t);
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
t && (r = t);
var o = 0;
return function () {
return o >= r.length ? {
done: true
} : {
done: false,
value: r[o++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
function _inheritsLoose(t, o) {
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
}
function _isNativeFunction(t) {
try {
return -1 !== Function.toString.call(t).indexOf("[native code]");
} catch (n) {
return "function" == typeof t;
}
}
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function () {
return !!t;
})();
}
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r);
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (String )(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _wrapNativeSuper(t) {
var r = "function" == typeof Map ? new Map() : void 0;
return _wrapNativeSuper = function (t) {
if (null === t || !_isNativeFunction(t)) return t;
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
if (void 0 !== r) {
if (r.has(t)) return r.get(t);
r.set(t, Wrapper);
}
function Wrapper() {
return _construct(t, arguments, _getPrototypeOf(this).constructor);
}
return Wrapper.prototype = Object.create(t.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
}), _setPrototypeOf(Wrapper, t);
}, _wrapNativeSuper(t);
}
function isInitialised($root, moduleName) {
return $root instanceof HTMLElement && $root.hasAttribute("data-" + moduleName + "-init");
}
/**
* Checks if GOV.UK Frontend is supported on this page
*
* Some browsers will load and run our JavaScript but GOV.UK Frontend
* won't be supported.
*
* @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
* @returns {boolean} Whether GOV.UK Frontend is supported on this page
*/
function isSupported($scope) {
if ($scope === void 0) {
$scope = document.body;
}
if (!$scope) {
return false;
}
return $scope.classList.contains('govuk-frontend-supported');
}
function isArray(option) {
return Array.isArray(option);
}
function isObject(option) {
return !!option && typeof option === 'object' && !isArray(option);
}
function formatErrorMessage(Component, message) {
return Component.moduleName + ": " + message;
}
var GOVUKFrontendError = function (_Error) {
function GOVUKFrontendError() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Error.call.apply(_Error, [this].concat(args)) || this;
_this.name = 'GOVUKFrontendError';
return _this;
}
_inheritsLoose(GOVUKFrontendError, _Error);
return GOVUKFrontendError;
}(_wrapNativeSuper(Error));
var SupportError = function (_GOVUKFrontendError) {
/**
* Checks if GOV.UK Frontend is supported on this page
*
* @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
*/
function SupportError($scope) {
var _this2;
if ($scope === void 0) {
$scope = document.body;
}
var supportMessage = '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';
_this2 = _GOVUKFrontendError.call(this, $scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`') || this;
_this2.name = 'SupportError';
return _this2;
}
_inheritsLoose(SupportError, _GOVUKFrontendError);
return SupportError;
}(GOVUKFrontendError);
var ConfigError = function (_GOVUKFrontendError2) {
function ConfigError() {
var _this3;
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_this3 = _GOVUKFrontendError2.call.apply(_GOVUKFrontendError2, [this].concat(args)) || this;
_this3.name = 'ConfigError';
return _this3;
}
_inheritsLoose(ConfigError, _GOVUKFrontendError2);
return ConfigError;
}(GOVUKFrontendError);
var ElementError = function (_GOVUKFrontendError3) {
function ElementError(messageOrOptions) {
var _this4;
var message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
if (typeof messageOrOptions === 'object') {
var component = messageOrOptions.component,
identifier = messageOrOptions.identifier,
element = messageOrOptions.element,
expectedType = messageOrOptions.expectedType;
message = identifier;
message += element ? " is not of type " + (expectedType != null ? expectedType : 'HTMLElement') : ' not found';
message = formatErrorMessage(component, message);
}
_this4 = _GOVUKFrontendError3.call(this, message) || this;
_this4.name = 'ElementError';
return _this4;
}
_inheritsLoose(ElementError, _GOVUKFrontendError3);
return ElementError;
}(GOVUKFrontendError);
var InitError = function (_GOVUKFrontendError4) {
function InitError(componentOrMessage) {
var _this5;
var message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, "Root element (`$root`) already initialised");
_this5 = _GOVUKFrontendError4.call(this, message) || this;
_this5.name = 'InitError';
return _this5;
}
_inheritsLoose(InitError, _GOVUKFrontendError4);
return InitError;
}(GOVUKFrontendError);
var Component = function () {
function Component($root) {
this._$root = void 0;
var childConstructor = this.constructor;
if (typeof childConstructor.moduleName !== 'string') {
throw new InitError("`moduleName` not defined in component");
}
if (!($root instanceof childConstructor.elementType)) {
throw new ElementError({
element: $root,
component: childConstructor,
identifier: 'Root element (`$root`)',
expectedType: childConstructor.elementType.name
});
} else {
this._$root = $root;
}
childConstructor.checkSupport();
this.checkInitialised();
var moduleName = childConstructor.moduleName;
this.$root.setAttribute("data-" + moduleName + "-init", '');
}
var _proto = Component.prototype;
_proto.checkInitialised = function checkInitialised() {
var constructor = this.constructor;
var moduleName = constructor.moduleName;
if (moduleName && isInitialised(this.$root, moduleName)) {
throw new InitError(constructor);
}
};
Component.checkSupport = function checkSupport() {
if (!isSupported()) {
throw new SupportError();
}
};
return _createClass(Component, [{
key: "$root",
get:
/**
* Returns the root element of the component
*
* @protected
* @returns {RootElementType} - the root element of component
*/
function get() {
return this._$root;
}
}]);
}();
/**
* @typedef ChildClass
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
*/
/**
* @typedef {typeof Component & ChildClass} ChildClassConstructor
*/
Component.elementType = HTMLElement;
var configOverride = Symbol["for"]('configOverride');
var ConfigurableComponent = function (_Component) {
function ConfigurableComponent($root, config) {
var _this;
_this = _Component.call(this, $root) || this;
_this._config = void 0;
var childConstructor = _this.constructor;
if (!isObject(childConstructor.defaults)) {
throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
}
var datasetConfig = normaliseDataset(childConstructor, _this._$root.dataset);
_this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, _this[configOverride](datasetConfig), datasetConfig);
return _this;
}
_inheritsLoose(ConfigurableComponent, _Component);
var _proto = ConfigurableComponent.prototype;
_proto[configOverride] = function (param) {
return {};
}
/**
* Returns the root element of the component
*
* @protected
* @returns {ConfigurationType} - the root element of component
*/;
return _createClass(ConfigurableComponent, [{
key: "config",
get: function get() {
return this._config;
}
}]);
}(Component);
function normaliseString(value, property) {
var trimmedValue = value ? value.trim() : '';
var output;
var outputType = property == null ? void 0 : property.type;
if (!outputType) {
if (['true', 'false'].includes(trimmedValue)) {
outputType = 'boolean';
}
if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
outputType = 'number';
}
}
switch (outputType) {
case 'boolean':
output = trimmedValue === 'true';
break;
case 'number':
output = Number(trimmedValue);
break;
default:
output = value;
}
return output;
}
function normaliseDataset(Component, dataset) {
if (!isObject(Component.schema)) {
throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
}
var out = {};
var entries = Object.entries(Component.schema.properties);
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
var entry = _entries[_i];
var namespace = entry[0],
property = entry[1];
var field = namespace.toString();
if (field in dataset) {
out[field] = normaliseString(dataset[field], property);
}
if ((property == null ? void 0 : property.type) === 'object') {
out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
}
}
return out;
}
function mergeConfigs() {
var formattedConfigObject = {};
for (var _len = arguments.length, configObjects = new Array(_len), _key = 0; _key < _len; _key++) {
configObjects[_key] = arguments[_key];
}
for (var _i2 = 0, _configObjects = configObjects; _i2 < _configObjects.length; _i2++) {
var configObject = _configObjects[_i2];
for (var _i3 = 0, _Object$keys = Object.keys(configObject); _i3 < _Object$keys.length; _i3++) {
var key = _Object$keys[_i3];
var option = formattedConfigObject[key];
var override = configObject[key];
if (isObject(option) && isObject(override)) {
formattedConfigObject[key] = mergeConfigs(option, override);
} else {
formattedConfigObject[key] = override;
}
}
}
return formattedConfigObject;
}
function extractConfigByNamespace(schema, dataset, namespace) {
var _newObject;
var property = schema.properties[namespace];
if ((property == null ? void 0 : property.type) !== 'object') {
return;
}
var newObject = (_newObject = {}, _newObject[namespace] = {}, _newObject);
for (var _i5 = 0, _Object$entries2 = Object.entries(dataset); _i5 < _Object$entries2.length; _i5++) {
var _Object$entries2$_i = _Object$entries2[_i5],
key = _Object$entries2$_i[0],
value = _Object$entries2$_i[1];
var current = newObject;
var keyParts = key.split('.');
for (var _iterator2 = _createForOfIteratorHelperLoose(keyParts.entries()), _step2; !(_step2 = _iterator2()).done;) {
var _step2$value = _step2.value,
index = _step2$value[0],
name = _step2$value[1];
if (isObject(current)) {
if (index < keyParts.length - 1) {
if (!isObject(current[name])) {
current[name] = {};
}
current = current[name];
} else if (key !== namespace) {
current[name] = normaliseString(value);
}
}
}
}
return newObject[namespace];
}
var I18n = function () {
function I18n(translations, config) {
if (translations === void 0) {
translations = {};
}
if (config === void 0) {
config = {};
}
var _config$locale;
this.translations = void 0;
this.locale = void 0;
this.translations = translations;
this.locale = (_config$locale = config.locale) != null ? _config$locale : document.documentElement.lang || 'en';
}
var _proto = I18n.prototype;
_proto.t = function t(lookupKey, options) {
if (!lookupKey) {
throw new Error('i18n: lookup key missing');
}
var translation = this.translations[lookupKey];
if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
var translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
if (translationPluralForm) {
translation = translationPluralForm;
}
}
if (typeof translation === 'string') {
if (translation.match(/%{(.\S+)}/)) {
if (!options) {
throw new Error('i18n: cannot replace placeholders in string if no option data provided');
}
return this.replacePlaceholders(translation, options);
}
return translation;
}
return lookupKey;
};
_proto.replacePlaceholders = function replacePlaceholders(translationString, options) {
var formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length ? new Intl.NumberFormat(this.locale) : undefined;
return translationString.replace(/%{(.\S+)}/g, function (placeholderWithBraces, placeholderKey) {
if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {
var placeholderValue = options[placeholderKey];
if (placeholderValue === false || typeof placeholderValue !== 'number' && typeof placeholderValue !== 'string') {
return '';
}
if (typeof placeholderValue === 'number') {
return formatter ? formatter.format(placeholderValue) : "" + placeholderValue;
}
return placeholderValue;
}
throw new Error("i18n: no data found to replace " + placeholderWithBraces + " placeholder in string");
});
};
_proto.hasIntlPluralRulesSupport = function hasIntlPluralRulesSupport() {
return Boolean('PluralRules' in window.Intl && Intl.PluralRules.supportedLocalesOf(this.locale).length);
};
_proto.getPluralSuffix = function getPluralSuffix(lookupKey, count) {
count = Number(count);
if (!isFinite(count)) {
return 'other';
}
var translation = this.translations[lookupKey];
var preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
if (typeof translation === 'object') {
if (preferredForm in translation) {
return preferredForm;
} else if ('other' in translation) {
console.warn("i18n: Missing plural form \"." + preferredForm + "\" for \"" + this.locale + "\" locale. Falling back to \".other\".");
return 'other';
}
}
throw new Error("i18n: Plural form \".other\" is required for \"" + this.locale + "\" locale");
};
_proto.selectPluralFormUsingFallbackRules = function selectPluralFormUsingFallbackRules(count) {
count = Math.abs(Math.floor(count));
var ruleset = this.getPluralRulesForLocale();
if (ruleset) {
return I18n.pluralRules[ruleset](count);
}
return 'other';
};
_proto.getPluralRulesForLocale = function getPluralRulesForLocale() {
var localeShort = this.locale.split('-')[0];
for (var pluralRule in I18n.pluralRulesMap) {
var languages = I18n.pluralRulesMap[pluralRule];
if (languages.includes(this.locale) || languages.includes(localeShort)) {
return pluralRule;
}
}
};
return I18n;
}();
I18n.pluralRulesMap = {
arabic: ['ar'],
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
irish: ['ga'],
russian: ['ru', 'uk'],
scottish: ['gd'],
spanish: ['pt-PT', 'it', 'es'],
welsh: ['cy']
};
I18n.pluralRules = {
arabic: function arabic(n) {
if (n === 0) {
return 'zero';
}
if (n === 1) {
return 'one';
}
if (n === 2) {
return 'two';
}
if (n % 100 >= 3 && n % 100 <= 10) {
return 'few';
}
if (n % 100 >= 11 && n % 100 <= 99) {
return 'many';
}
return 'other';
},
chinese: function chinese() {
return 'other';
},
french: function french(n) {
return n === 0 || n === 1 ? 'one' : 'other';
},
german: function german(n) {
return n === 1 ? 'one' : 'other';
},
irish: function irish(n) {
if (n === 1) {
return 'one';
}
if (n === 2) {
return 'two';
}
if (n >= 3 && n <= 6) {
return 'few';
}
if (n >= 7 && n <= 10) {
return 'many';
}
return 'other';
},
russian: function russian(n) {
var lastTwo = n % 100;
var last = lastTwo % 10;
if (last === 1 && lastTwo !== 11) {
return 'one';
}
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
return 'few';
}
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
return 'many';
}
return 'other';
},
scottish: function scottish(n) {
if (n === 1 || n === 11) {
return 'one';
}
if (n === 2 || n === 12) {
return 'two';
}
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
return 'few';
}
return 'other';
},
spanish: function spanish(n) {
if (n === 1) {
return 'one';
}
if (n % 1000000 === 0 && n !== 0) {
return 'many';
}
return 'other';
},
welsh: function welsh(n) {
if (n === 0) {
return 'zero';
}
if (n === 1) {
return 'one';
}
if (n === 2) {
return 'two';
}
if (n === 3) {
return 'few';
}
if (n === 6) {
return 'many';
}
return 'other';
}
};
function closestAttributeValue($element, attributeName) {
var $closestElementWithAttribute = $element.closest("[" + attributeName + "]");
return $closestElementWithAttribute ? $closestElementWithAttribute.getAttribute(attributeName) : null;
}
/**
* File upload component
*
* @preserve
* @augments ConfigurableComponent<FileUploadConfig>
*/
var FileUpload = function (_ConfigurableComponen) {
/**
* @param {Element | null} $root - File input element
* @param {FileUploadConfig} [config] - File Upload config
*/
function FileUpload($root, config) {
var _this;
if (config === void 0) {
config = {};
}
_this = _ConfigurableComponen.call(this, $root, config) || this;
_this.$input = void 0;
_this.$button = void 0;
_this.$status = void 0;
_this.i18n = void 0;
_this.id = void 0;
_this.$announcements = void 0;
_this.enteredAnotherElement = void 0;
var $input = _this.$root.querySelector('input');
if ($input === null) {
throw new ElementError({
component: FileUpload,
identifier: 'File inputs (`<input type="file">`)'
});
}
if ($input.type !== 'file') {
throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
}
_this.$input = $input;
_this.$input.setAttribute('hidden', 'true');
if (!_this.$input.id) {
throw new ElementError({
component: FileUpload,
identifier: 'File input (`<input type="file">`) attribute (`id`)'
});
}
_this.id = _this.$input.id;
_this.i18n = new I18n(_this.config.i18n, {
locale: closestAttributeValue(_this.$root, 'lang')
});
var $label = _this.findLabel();
if (!$label.id) {
$label.id = _this.id + "-label";
}
_this.$input.id = _this.id + "-input";
var $button = document.createElement('button');
$button.classList.add('govuk-file-upload-button');
$button.type = 'button';
$button.id = _this.id;
$button.classList.add('govuk-file-upload-button--empty');
var ariaDescribedBy = _this.$input.getAttribute('aria-describedby');
if (ariaDescribedBy) {
$button.setAttribute('aria-describedby', ariaDescribedBy);
}
var $status = document.createElement('span');
$status.className = 'govuk-body govuk-file-upload-button__status';
$status.setAttribute('aria-live', 'polite');
$status.innerText = _this.i18n.t('noFileChosen');
$button.appendChild($status);
var commaSpan = document.createElement('span');
commaSpan.className = 'govuk-visually-hidden';
commaSpan.innerText = ', ';
commaSpan.id = _this.id + "-comma";
$button.appendChild(commaSpan);
var containerSpan = document.createElement('span');
containerSpan.className = 'govuk-file-upload-button__pseudo-button-container';
var buttonSpan = document.createElement('span');
buttonSpan.className = 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button';
buttonSpan.innerText = _this.i18n.t('chooseFilesButton');
containerSpan.appendChild(buttonSpan);
containerSpan.insertAdjacentText('beforeend', ' ');
var instructionSpan = document.createElement('span');
instructionSpan.className = 'govuk-body govuk-file-upload-button__instruction';
instructionSpan.innerText = _this.i18n.t('dropInstruction');
containerSpan.appendChild(instructionSpan);
$button.appendChild(containerSpan);
$button.setAttribute('aria-labelledby', $label.id + " " + commaSpan.id + " " + $button.id);
$button.addEventListener('click', _this.onClick.bind(_this));
$button.addEventListener('dragover', function (event) {
event.preventDefault();
});
_this.$root.insertAdjacentElement('afterbegin', $button);
_this.$input.setAttribute('tabindex', '-1');
_this.$input.setAttribute('aria-hidden', 'true');
_this.$button = $button;
_this.$status = $status;
_this.$input.addEventListener('change', _this.onChange.bind(_this));
_this.updateDisabledState();
_this.observeDisabledState();
_this.$announcements = document.createElement('span');
_this.$announcements.classList.add('govuk-file-upload-announcements');
_this.$announcements.classList.add('govuk-visually-hidden');
_this.$announcements.setAttribute('aria-live', 'assertive');
_this.$root.insertAdjacentElement('afterend', _this.$announcements);
_this.$button.addEventListener('drop', _this.onDrop.bind(_this));
document.addEventListener('dragenter', _this.updateDropzoneVisibility.bind(_this));
document.addEventListener('dragenter', function () {
_this.enteredAnotherElement = true;
});
document.addEventListener('dragleave', function () {
if (!_this.enteredAnotherElement && !_this.$button.disabled) {
_this.hideDraggingState();
_this.$announcements.innerText = _this.i18n.t('leftDropZone');
}
_this.enteredAnotherElement = false;
});
return _this;
}
_inheritsLoose(FileUpload, _ConfigurableComponen);
var _proto = FileUpload.prototype;
_proto.updateDropzoneVisibility = function updateDropzoneVisibility(event) {
if (this.$button.disabled) return;
if (event.target instanceof Node) {
if (this.$root.contains(event.target)) {
if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
this.showDraggingState();
this.$announcements.innerText = this.i18n.t('enteredDropZone');
}
}
} else {
if (this.$button.classList.contains('govuk-file-upload-button--dragging')) {
this.hideDraggingState();
this.$announcements.innerText = this.i18n.t('leftDropZone');
}
}
}
};
_proto.showDraggingState = function showDraggingState() {
this.$button.classList.add('govuk-file-upload-button--dragging');
};
_proto.hideDraggingState = function hideDraggingState() {
this.$button.classList.remove('govuk-file-upload-button--dragging');
};
_proto.onDrop = function onDrop(event) {
event.preventDefault();
if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
this.$input.files = event.dataTransfer.files;
this.$input.dispatchEvent(new CustomEvent('change'));
this.hideDraggingState();
}
};
_proto.onChange = function onChange() {
var fileCount = this.$input.files.length;
if (fileCount === 0) {
this.$status.innerText = this.i18n.t('noFileChosen');
this.$button.classList.add('govuk-file-upload-button--empty');
} else {
if (fileCount === 1) {
this.$status.innerText = this.$input.files[0].name;
} else {
this.$status.innerText = this.i18n.t('multipleFilesChosen', {
count: fileCount
});
}
this.$button.classList.remove('govuk-file-upload-button--empty');
}
};
_proto.findLabel = function findLabel() {
var $label = document.querySelector("label[for=\"" + this.$input.id + "\"]");
if (!$label) {
throw new ElementError({
component: FileUpload,
identifier: "Field label (`<label for=" + this.$input.id + ">`)"
});
}
return $label;
};
_proto.onClick = function onClick() {
this.$input.click();
};
_proto.observeDisabledState = function observeDisabledState() {
var _this2 = this;
var observer = new MutationObserver(function (mutationList) {
for (var _iterator = _createForOfIteratorHelperLoose(mutationList), _step; !(_step = _iterator()).done;) {
var mutation = _step.value;
if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {
_this2.updateDisabledState();
}
}
});
observer.observe(this.$input, {
attributes: true
});
};
_proto.updateDisabledState = function updateDisabledState() {
this.$button.disabled = this.$input.disabled;
this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
};
return FileUpload;
}(ConfigurableComponent);
FileUpload.moduleName = 'govuk-file-upload';
FileUpload.defaults = Object.freeze({
i18n: {
chooseFilesButton: 'Choose file',
dropInstruction: 'or drop file',
noFileChosen: 'No file chosen',
multipleFilesChosen: {
one: '%{count} file chosen',
other: '%{count} files chosen'
},
enteredDropZone: 'Entered drop zone',
leftDropZone: 'Left drop zone'
}
});
FileUpload.schema = Object.freeze({
properties: {
i18n: {
type: 'object'
}
}
});
function isContainingFiles(dataTransfer) {
var hasNoTypesInfo = dataTransfer.types.length === 0;
var isDraggingFiles = dataTransfer.types.some(function (type) {
return type === 'Files';
});
return hasNoTypesInfo || isDraggingFiles;
}
class ComplianceCommunicationAttachmentListRowFileInput {
$dropZone;
$input;
$label;
$hint;
$button;
$comma;
$announcements;
constructor($row, column) {
const $column = $row.find(`.govuk-grid-column-one-half:nth-of-type(${column})`);
this.$dropZone = $column.find('.govuk-drop-zone');
this.$input = $column.find('input');
this.$label = $column.find('.govuk-label');
this.$hint = $column.find('div.govuk-hint');
this.$button = $column.find('button');
this.$comma = $column.find('button > span.govuk-visually-hidden');
this.$announcements = $column.find('span.govuk-file-upload-announcements');
}
updateIndex(newIndex) {
const newName = this.$input.attr('name').replace(/\d+/, newIndex.toString());
const newId = `input-${newName}`;
if (this.$button.length) {
this.$label.attr('for', newId);
this.$label.attr('id', `${newId}-label`);
this.$hint.attr('id', `${newId}-hint`);
this.$input.attr('id', `${newId}-input`);
this.$input.attr('name', newName);
this.$input.attr('aria-describedby', `${newId}-hint`);
this.$button.attr('id', newId);
this.$button.attr('aria-describedby', `${newId}-hint`);
this.$button.attr('aria-labelledby', `${newId}-label ${newId}-comma ${newId}`);
this.$comma.attr('id', `${newId}-comma`);
}
else {
this.$label.attr('for', newId);
this.$hint.attr('id', `${newId}-hint`);
this.$input.attr('id', newId);
this.$input.attr('name', newName);
this.$input.attr('aria-describedby', `${newId}-hint`);
}
}
makeInteractable() {
if (!this.$button.length) {
return new FileUpload(this.$dropZone.get(0));
}
}
resetHtml() {
this.$label.removeAttr('id');
this.$dropZone.removeAttr('data-govuk-file-upload-init');
this.$button.remove();
const id = this.$input.attr('id');
this.$input.removeAttr('hidden');
this.$input.removeAttr('aria-hidden');
this.$input.attr('id', id.substring(0, id.length - 6));
this.$announcements.remove();
}
}
class ComplianceCommunicationAttachmentListRequiredInput {
$requiredSection;
$input;
$label;
constructor($row) {
this.$requiredSection = $row.find('.dm-compliance-communication__attachments-item-required');
this.$input = this.$requiredSection.find('.govuk-checkboxes__item > input');
this.$label = this.$requiredSection.find('.govuk-checkboxes__item > .govuk-label');
}
isChecked() {
return this.$input.is(':checked');
}
updateIndex(newIndex) {
const newName = this.$input.attr('name').replace(/\d+/, newIndex.toString());
const newId = `input-${newName}`;
this.$label.attr('for', newId);
this.$input.attr('id', newId);
this.$input.attr('name', newName);
}
checkRow() {
this.$requiredSection.toggleClass('govuk-visually-hidden', true);
this.$input.prop('checked', true);
this.$input.attr('tabindex', -1);
this.$input.attr('tabindex', -1);
}
}
class ComplianceCommunicationAttachmentListRowRemoveButton {
attachmentListRow;
$button;
$removeButtonCounter;
constructor(attachmentListRow, $row) {
this.attachmentListRow = attachmentListRow;
this.$button = $row.find('.dm-compliance-communication__attachments-item-remove');
this.$removeButtonCounter = this.$button.find('.dm-compliance-communication__attachments-item-remove-counter');
}
init() {
this.toggleVisibility(true);
this.$button.on('click', () => {
this.attachmentListRow.removeRow();
});
}
toggleVisibility(isShown) {
this.$button.toggleClass('govuk-visually-hidden', !isShown);
if (isShown) {
this.$button.removeAttr('tabindex');
}
else {
this.$button.attr('tabindex', -1);
}
}
updateIndex(newIndex) {
this.$removeButtonCounter.text(newIndex + 1);
}
}
class ComplianceCommunicationAttachmentListRow {
$row;
attachmentList;
index;
$legendCounter;
attachmentListRowFileInput;
attachmentListRowRequiredInput;
attachmentListRowRemoveButton;
constructor(attachmentList, index, $row) {
this.$row = $row;
this.attachmentList = attachmentList;
this.index = index;
this.$legendCounter = this.$row.find('.dm-compliance-communication__attachments-item-legend-counter');
this.attachmentListRowFileInput = new ComplianceCommunicationAttachmentListRowFileInput($row, 1);
this.attachmentListRowRequiredInput = new ComplianceCommunicationAttachmentListRequiredInput($row);
this.attachmentListRowRemoveButton = new ComplianceCommunicationAttachmentListRowRemoveButton(this, $row);
}
init() {
this.attachmentListRowRemoveButton.init();
this.attachmentListRowFileInput.makeInteractable();
this.attachmentListRowRequiredInput.checkRow();
}
updateIndex(newIndex) {
this.index = newIndex;
this.attachmentListRowFileInput.updateIndex(newIndex);
this.attachmentListRowRequiredInput.updateIndex(newIndex);
this.attachmentListRowRemoveButton.updateIndex(newIndex);
this.$legendCounter.text(newIndex + 1);
}
removeRow() {
this.attachmentList.removeRow(this.index);
this.deleteRow();
}
deleteRow() {
this.$row.remove();
}
toggleRemoveButtonVisibility(isShown) {
this.attachmentListRowRemoveButton.toggleVisibility(isShown);
}
isRowChecked() {
return this.attachmentListRowRequiredInput.isChecked();
}
}
class ComplianceCommunicationAttachmentListAddButton {
attachmentList;
$button;
$buttonCounter;
constructor(attachmentList, $button) {
this.attachmentList = attachmentList;
this.$button = $button;
this.$buttonCounter = $button.find('.dm-compliance-communication__attachments__js-remaining-counter');
}
init(numberOfRows) {
this.$button.on('click', () => {
this.attachmentList.addRow();
});
this.updateButtonText(this.attachmentList.maxNumberOfAttachments - numberOfRows);
}
updateButtonText(numberRemaining) {
this.$buttonCounter.text(numberRemaining);
}
toggleVisibility(isShown) {
this.$button.toggleClass('govuk-visually-hidden', !isShown);
if (isShown) {
this.$button.removeAttr('tabindex');
}
else {
this.$button.attr('tabindex', -1);
}
}
}
class ComplianceCommunicationAttachments {
static moduleName = 'dm-compliance-communication-attachments';
$attachmentList;
$attachmentListItems;
attachmentListRows;
attachmentListTemplateRow;
attachmentListAddButton;
maxNumberOfAttachments;
constructor($attachmentList) {
this.$attachmentList = $attachmentList;
this.$attachmentListItems = this.$attachmentList.find('.dm-compliance-communication__attachments-items');
this.attachmentListRows = this.$attachmentListItems.find('.dm-compliance-communication__attachments-item').get().map((row, index) => new ComplianceCommunicationAttachmentListRow(this, index, $(row)));
this.attachmentListTemplateRow = new ComplianceCommunicationAttachmentListRow(this, 99, this.$attachmentList.find('.dm-compliance-communication__attachments-item-template > .dm-compliance-communication__attachments-item'));
this.attachmentListAddButton = new ComplianceCommunicationAttachmentListAddButton(this, this.$attachmentList.find('.dm-compliance-communication__attachments-add'));
this.maxNumberOfAttachments = this.$attachmentList.data('maxNumberOfAttachments');
}
init() {
const rowsChecked = this.attachmentListRows.map((attachmentListRow) => attachmentListRow.isRowChecked());
let indexToDeleteFrom;
if (rowsChecked.every((rowChecked) => !rowChecked)) {
indexToDeleteFrom = 0;
}
else {
indexToDeleteFrom = rowsChecked.indexOf(false);
}
if (indexToDeleteFrom >= 0) {
this.attachmentListRows.slice(indexToDeleteFrom).forEach((attachmentListRow) => attachmentListRow.deleteRow());
this.attachmentListRows.splice(indexToDeleteFrom);
}
this.attachmentListAddButton.init(this.attachmentListRows.length);
this.attachmentListRows.forEach((attachmentListRow) => attachmentListRow.init());
this.attachmentListTemplateRow.attachmentListRowFileInput.resetHtml();
this.updateIfMinRows();
this.updateAttachmentButton();
}
removeRow(indexToRemove) {
this.attachmentListRows.splice(indexToRemove, 1);
this.attachmentListRows.slice(indexToRemove).forEach((attachmentListRow, index) => {
attachmentListRow.updateIndex(indexToRemove + index);
});
this.updateIfMinRows();
this.updateAttachmentButton();
if (indexToRemove > 0) {
this.focusOnRow(indexToRemove);
}
else {
this.attachmentListAddButton.$button.focus();
}
}
addRow() {
const numberOfRows = this.attachmentListRows.length;
if (numberOfRows < this.maxNumberOfAttachments) {
const $newRow = this.attachmentListTemplateRow.$row.clone();
const attachmentListRow = new ComplianceCommunicationAttachmentListRow(this, numberOfRows, $newRow);
attachmentListRow.updateIndex(numberOfRows);
this.attachmentListRows.push(attachmentListRow);
this.$attachmentListItems.append($newRow);
this.attachmentListRows[numberOfRows].init();
this.updateIfMinRows();
this.updateAttachmentButton();
this.focusOnRow(numberOfRows);
}
}
updateIfMinRows() {
if (this.attachmentListRows.length !== 0) {
this.attachmentListRows[0].toggleRemoveButtonVisibility(true);
}
}
updateAttachmentButton() {
if (this.attachmentListRows.length === this.maxNumberOfAttachments) {
this.attachmentListAddButton.toggleVisibility(false);
}
else {
this.attachmentListAddButton.toggleVisibility(true);
this.attachmentListAddButton.updateButtonText(this.maxNumberOfAttachments - this.attachmentListRows.length);
}
}
focusOnRow(targetIndexToFocus) {
const numberOfRows = this.attachmentListRows.length;
let indexToFocus = targetIndexToFocus;
if (targetIndexToFocus >= numberOfRows) {
indexToFocus = numberOfRows - 1;
}
this.attachmentListRows[indexToFocus].attachmentListRowFileInput.$button.focus();
}
}
class CookieBanner {
static moduleName = 'dm-cookie-banner';
$module;
$cookieBannerMainContent;
$cookieBannerConfirmationContent;
$cookieBannerConfirmationMessage;
$hideLink;
$acceptCookiesLink;
$rejectCookiesLink;
constructor($module) {
this.$module = $module;
this.$cookieBannerMainContent = this.$module.find('.dm-cookie-banner__button--main');
this.$cookieBannerConfirmationContent = this.$module.find('.dm-cookie-banner--selection-made');
this.$cookieBannerConfirmationMessage = this.$module.find('.dm-cookie-banner__confirmation-message');
this.$hideLink = this.$module.find('button[data-hide-cookie-banner]');
this.$acceptCookiesLink = this.$module.find('button[data-accept-cookies=true]');
this.$rejectCookiesLink = this.$module.find('button[data-accept-cookies=false]');
}
init() {
this.$hideLink.on('click', (event) => {
this.hideCookieMessage(event);
});
this.$acceptCookiesLink.on('click', () => {
this.setCookieConsent(true);
});
this.$rejectCookiesLink.on('click', () => {
this.setCookieConsent(false);
});
this.showCookieMessage();
}
setCookieConsent(analyticsConsent) {
setCookiePreferences(analyticsConsent);
this.showConfirmationMessage(analyticsConsent);
this.$cookieBannerConfirmationContent.trigger('focus');
}
showCookieMessage() {
// Show the cookie banner if policy cookie not set
const cookiePreferences = getCookiePreferences();
if (this.$module && !cookiePreferences.settings_viewed) {
this.$module.css('display', 'block');
}
}
hideCookieMessage(event) {
this.$module.css('display', 'none');
if (event.target) {
event.preventDefault();
}
}
showConfirmationMessage(analyticsConsent) {
const messagePrefix = analyticsConsent ? 'You’ve accepted analytics cookies.' : 'You told us not to use analytics cookies.';
this.$cookieBannerMainContent.attr('hidden', 'hidden');
this.$cookieBannerConfirmationMessage.prepend(messagePrefix);
this.$cookieBannerConfirmationContent.removeAttr('hidden');
}
}
class CookieSettings {
static moduleName = 'dm-cookie-settings';
$moudle;
$radioButtonAnalyticsYes;
$radioButtonAnalyticsNo;
$confirmationMessage;
$previousPageLink;
$errorSummary;
$formGroup;
$warningMessage;
$cookieBanner;
constructor($module) {
this.$moudle = $module;
this.$radioButtonAnalyticsYes = this.$moudle.find('input[name=cookies-analytics][value=On]');
this.$radioButtonAnalyticsNo = this.$moudle.find('input[name=cookies-analytics][value=Off]');
this.$confirmationMessage = $('#dm-cookie-settings-confirmation');
this.$previousPageLink = $('.dm-cookie-settings__prev-page');
this.$errorSummary = $('#dm-cookie-settings-error');
this.$formGroup = this.$moudle.find('.govuk-form-group');
this.$warningMessage = $('#dm-cookie-settings-warning');
this.$cookieBanner = $('.dm-cookie-banner');
}
init() {
this.$moudle.on('submit', (event) => {
this.submitSettingsForm(event);
});
// Ensure there aren't two forms for setting cookie preferences on the same page
this.hideCookieBanner();
this.setInitialFormValues();
}
setInitialFormValues() {
const currentCookiePreferences = getCookiePreferences();
if (!currentCookiePreferences.settings_viewed)
return;
this.hideWarningMessage();
// Populate the form with the existing choice
let $radioButton;
if (currentCookiePreferences.usage) {
$radioButton = this.$radioButtonAnalyticsYes;
}
else {
$radioButton = this.$radioButtonAnalyticsNo;
}
$radioButton.prop('checked', true);
}
submitSettingsForm(event) {
event.preventDefault();
let usage;
for (const formDataItem of this.$moudle.serializeArray()) {
if (formDataItem.name === 'cookies-analytics') {
usage = formDataItem.value === 'On';
break;
}
}
// the cookie choice must be set when form is submitted
if (usage === undefined) {
this.showError();
return;
}
// Set the analytics cookie preferences
// If 'Off' option not checked, this function will also delete any existing Google Analytics cookies
setCookiePreferences(usage);
this.hideWarningMessage();
this.hideError();
this.showConfirmationMessage();
}
showConfirmationMessage() {
const referrer = CookieSettings.getReferrerLink();
document.body.scrollTop = document.documentElement.scrollTop = 0;
if (referrer && referrer !== document.location.pathname) {
this.$previousPageLink.attr('href', referrer);
this.$previousPageLink.css('display', 'block');
}
else {
this.$previousPageLink.css('display', 'none');
}
this.$confirmationMessage.css('display', 'block');
}
showError() {
if (this.$errorSummary.length) {
this.$errorSummary.css('display', 'block');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
this.showErrorMessage();
}
showErrorMessage() {
this.$formGroup.addClass('govuk-form-group--error');
const $errorMessageSpan = $(document.createElement('p'));
$errorMessageSpan.attr('id', 'dm-cookie-settings-error-message');
$errorMessageSpan.addClass('govuk-error-message');
$errorMessageSpan.html('<span class="govuk-visually-hidden">Error:</span> Select yes to accept analytics cookies');
$errorMessageSpan.insertBefore('#cookie-settings-1, .govuk-radios--inline');
}
hideError() {
this.$errorSummary.css('display', 'none');
this.hideErrorMessage();
}
hideErrorMessage() {
const $errorMessage = this.$moudle.find('#dm-cookie-settings-error-message');
$errorMessage.css('display', 'none');
this.$formGroup.removeClass('govuk-form-group--error');
}
hideWarningMessage() {
this.$warningMessage.css('display', 'none');
}
hideCookieBanner() {
this.$cookieBanner.css('display', 'none');
}
static getReferrerLink() {
return document.referrer ? new URL(document.referrer).pathname : false;
}
}
class ListInput {
static moduleName = 'dm-list-input';
static itemContainerClass = 'dm-list-input__item-container';
static hiddenItemClass = 'dm-list-input__item--hidden';
static visibleItemClass = 'dm-list-input__item--visible';
static itemInputClass = 'dm-list-input__item-input';
static itemErrorClass = 'dm-list-input__item--error';
static itemErrorMsgClass = 'dm-list-input-error-message';
static itemCounterClass = 'dm-list-input__counter';
static inputErrorClass = 'govuk-input--error';
static removeButtonClass = 'dm-list-input__item-remove';
static hiddenRemoveButtonClass = 'dm-list-input__item-remove--hidden';
static formGroupErrorClass = 'govuk-form-group--error';
static hiddenAddButtonClass = 'dm-list-input__item-add--hidden';
static addButtonRemainingClass = 'dm-list-input__js-remaining-counter';
$module;
$allVisibleItems;
$addAnotherButton;
$allItems;
constructor($module) {
this.$module = $module;
this.$allVisibleItems = this.findVisibleItems();
this.$addAnotherButton = this.$module.find('.dm-list-input__item-add');
this.$allItems = this.$module.find('.dm-list-input__item');
}
init() {
this.hideEmptyItems();
this.updateAllCounters();
this.addRemoveClickEvent();
this.toggleAddAnotherButton();
this.addAddClickEvent();
}
findVisibleItems() {
return this.$module.find('.dm-list-input__item--visible');
}
// Hide all items that do not have a value (except for the first one, or the first two if no items have a value)
hideEmptyItems() {
let numberOfVisibleEmptyItems = 0;
let numberOfFilledInItems = 0;
this.$allItems.each((_index, item) => {
const $item = $(item);
const $input = $item.find('.' + ListInput.itemInputClass);
const $removeButton = $item.find('.' + ListInput.removeButtonClass);
if (!$input.attr('value')) {
if (numberOfVisibleEmptyItems === 0) {
$removeButton.removeClass(ListInput.hiddenRemoveButtonClass);
}
else if (numberOfVisibleEmptyItems === 1 && numberOfFilledInItems === 0) {
$removeButton.removeClass(ListInput.hiddenRemoveButtonClass);
}
else {
$item.addClass(ListInput.hiddenItemClass);
$item.removeClass(ListInput.visibleItemClass);
$removeButton.addClass(ListInput.hiddenRemoveButtonClass);
$input.attr('disabled', 'true');
}
numberOfVisibleEmptyItems += 1;
}
else {
$item.removeClass(ListInput.hiddenItemClass);
$item.addClass(ListInput.visibleItemClass);
$removeButton.removeClass(ListInput.hiddenRemoveButtonClass);
numberOfFilledInItems += 1;
}
});
this.$allVisibleItems = this.findVisibleItems();
}
// Adds an event listener to module to listen for any
// click events fired by the items "Remove" button
addRemoveClickEvent() {
this.$allItems.each((_index, item) => {
const $item = $(item);
const $input = $item.find('.' + ListInput.itemInputClass);
const $removeButton = $item.find('.' + ListInput.removeButtonClass);
$removeButton.on('click', () => {
$input.val('');
$input.removeAttr('value');
$input.attr('disabled', 'true');
$removeButton.addClass(ListInput.hiddenRemoveButtonClass);
$item.addClass(ListInput.hiddenItemClass);
$item.removeClass(ListInput.visibleItemClass);
this.$allVisibleItems = this.findVisibleItems();
if ($item.hasClass(ListInput.itemErrorClass)) {
$item.removeClass(ListInput.itemErrorClass);
const $errorFormGroup = $item.find('.' + ListInput.formGroupErrorClass);
$errorFormGroup.removeClass(ListInput.formGroupErrorClass);
$errorFormGroup.remove('.' + ListInput.itemErrorMsgClass);
const $errorInput = $errorFormGroup.find('.' + ListInput.inputErrorClass);
const inputId = $errorInput.attr('id');
const inputDescribedBy = $errorInput.attr('aria-describedby');
$errorInput.attr('aria-describedby', inputDescribedBy.replace(inputId + '-error', ''));
$errorInput.removeClass(ListInput.inputErrorClass);
}
// Hide Remove buttons if there is only one item left
if (this.$allVisibleItems.length === 1) {
const $removeButtons = this.$module.find('.' + ListInput.removeButtonClass);
$removeButtons.each((_index, button) => {
$(button).addClass(ListInput.hiddenRemoveButtonClass);
});
$(this.$allVisibleItems.get(0)).find('input').trigger('focus');
}
else {
// Set focus to the next input
const $nextVisibleItem = ListInput.getSibling('next', $item, '.' + ListInput.visibleItemClass);
if ($nextVisibleItem) {
$nextVisibleItem.find('input').trigger('focus');
}
else {
const $previousVisibleItem = ListInput.getSibling('previous', $item, '.' + ListInput.visibleItemClass);
$previousVisibleItem.find('input').trigger('focus');
}
}
this.updateAllCounters();
this.toggleAddAnotherButton();
});
});
}
// Used to update each item's label and remove button hidden text
updateCounters() {
this.$allVisibleItems.each((index, item) => {
$(item).find('.' + ListInput.itemCounterClass).each((_index, counter) => {
$(counter).text(index + 1);
});
});
}
// Used to update "Add another" buttons "Remaining" counter
// and sets focus to the new additional input
updateRemainingCounter() {
const $visibleItems = this.$allVisibleItems;
const totalItems = this.$allItems.length;
this.$module.find('.' + ListInput.addButtonRemainingClass).text(totalItems - $visibleItems.length);
}
addAddClickEvent() {
this.$addAnotherButton.on('click', () => {
const $firstHiddenItem = this.$module.find('.' + ListInput.hiddenItemClass).first();
const $firstHiddenInput = $firstHiddenItem.find('.' + ListInput.itemInputClass);
if ($firstHiddenItem.length) {
$firstHiddenInput.removeAttr('disabled');
this.$module.find('.' + ListInput.itemContainerClass).append($firstHiddenItem);
$firstHiddenItem.removeClass(ListInput.hiddenItemClass);
$firstHiddenItem.addClass(ListInput.visibleItemClass);
this.$allVisibleItems = this.findVisibleItems();
this.updateAllCounters();
$firstHiddenItem.find('.' + ListInput.removeButtonClass).removeClass(ListInput.hiddenRemoveButtonClass);
$firstHiddenInput.trigger('focus');
this.toggleAddAnotherButton();
// Show Remove buttons if there is more one item
if (this.$allVisibleItems.length > 1) {
this.$module.find('.' + ListInput.removeButtonClass).each((_index, button) => {
$(button).removeClass(ListInput.hiddenRemoveButtonClass);
});
}
}
});
}
toggleAddAnotherButton() {
const $firstHiddenItem = this.$module.find('.' + ListInput.hiddenItemClass);
if ($firstHiddenItem.length) {
this.$addAnotherButton.removeClass(ListInput.hiddenAddButtonClass);
}
else {
this.$addAnotherButton.addClass(ListInput.hiddenAddButtonClass);
}
}
updateAllCounters() {
this.updateCounters();
this.updateRemainingCounter();
}
static getSibling(direction, elem, selector) {
// Get the next sibling element
let sibling = (direction === 'next') ? elem.next() : elem.prev();
// If there's no selector, return the first sibling
if (!selector)
return sibling;
// If the sibling matches our selector, use it
// If not, jump to the next sibling and continue the loop
while (sibling.length) {
if (sibling.is(selector))
return sibling;
sibling = (direction === 'next') ? sibling.next() : sibling.prev();
}
}
}
var QuestionType;
(function (QuestionType) {
QuestionType[QuestionType["CONTROLLER"] = 0] = "CONTROLLER";
QuestionType[QuestionType["CONTROLLER_AND_TARGET"] = 1] = "CONTROLLER_AND_TARGET";
QuestionType[QuestionType["TARGET"] = 2] = "TARGET";
})(QuestionType || (QuestionType = {}));
class QuestionInput {
question;
$input;
targets;
constructor(question, $input) {
this.question = question;
this.$input = $input;
const targets = this.$input.attr('data-target');
this.targets = targets ? targets.split(' ') : [];
}
setEventListener() {
this.$input.on('click', () => {
this.question.updateTargetQuestionsVisibility();
});
}
isChecked() {
return this.$input.is(':checked');
}
}
class QuestionQuestion {
questionWatcher;
$question;
id;
questionType;
questionInputs;
possibleTargetIds;
targetOf;
constructor(questionWatcher, $question, questionType) {
this.questionWatcher = questionWatcher;
this.$question = $question;
this.id = this.$question.attr('id');
this.questionType = questionType;
if (this.questionType === QuestionType.CONTROLLER) {
this.enableControllerQuestionMethods();
}
else {
this.enableTargetQuestionMethods();
}
}
enableControllerQuestionMethods() {
this.questionInputs = this.$question.find('input').get().map((inputElement) => new QuestionInput(this, $(inputElement)));
this.possibleTargetIds = new Set(this.questionInputs.map((questionInput) => questionInput.targets).flat());
}
enableTargetQuestionMethods() {
this.targetOf = [];
}
isVisible() {
return !this.$question.hasClass('govuk-visually-hidden');
}
currentTargetIds() {
let targets;
if (this.isVisible() && this.questionInputs) {
targets = this.questionInputs.filter((questionInput) => questionInput.isChecked()).map((questionInput) => questionInput.targets).flat();
}
else {
targets = [];
}
return new Set(targets);
}
updateTargetQuestionsVisibility() {
this.questionWatcher.updateTargetQuestionsVisibility(this.possibleTargetIds);
}
appendTargetOf(questionId) {
if (this.targetOf !== undefined) {
this.targetOf.push(questionId);
}
}
toggleVisibility(isShown) {
this.$question.toggleClass('govuk-visually-hidden', !isShown);
this.$question.attr('aria-hidden', (!isShown).toString());
if (isShown) {
this.$question.removeAttr('hidden');
}
else {
this.$question.attr('hidden', '');
}
}
}
class Question {
static moduleName = 'dm-question';
questions;
constructor() {
this.questions = {};
$(`[data-module="${Question.moduleName}"]`).each((_index, question) => {
this.push(new QuestionQuestion(this, $(question), QuestionType.CONTROLLER));
});
for (const [questionId, question] of Object.entries(this.questions)) {
for (const questionTargetId of question.possibleTargetIds || []) {
if (questionTargetId in this.questions) {
if (this.questions[questionTargetId].questionType === QuestionType.CONTROLLER) {
this.questions[questionTargetId].questionType = QuestionType.CONTROLLER_AND_TARGET;
this.questions[questionTargetId].enableTargetQuestionMethods();
}
}
else {
this.push(new QuestionQuestion(this, $(`#${questionTargetId}`), QuestionType.TARGET));
}
this.questions[questionTargetId].appendTargetOf(questionId);
}
}
}
init() {
for (const question of Object.values(this.questions)) {
if (question.questionType < QuestionType.TARGET) {
for (const questionInput of question.questionInputs || []) {
questionInput.setEventListener();
}
if (question.questionType === QuestionType.CONTROLLER) {
this.updateTargetQuestionsVisibility(question.possibleTargetIds);
}
}
}
}
push(question) {
this.questions[question.id] = question;
}
updateTargetQuestionsVisibility(possibleTargetIds, isShown) {
for (const possibleTargetId of possibleTargetIds || []) {
const targetQuestion = this.questions[possibleTargetId];
let questionIsShown;
if (isShown === undefined) {
const controllerQuestions = targetQuestion.targetOf?.map((questionId) => this.questions[questionId]);
const targetsToShow = new Set(controllerQuestions?.map((controllerQuestion) => Array.from(controllerQuestion.currentTargetIds())).flat());
questionIsShown = targetsToShow.has(possibleTargetId);
}
else {
questionIsShown = isShown;
}
targetQuestion.toggleVisibility(questionIsShown);
if (targetQuestion.questionType === QuestionType.CONTROLLER_AND_TARGET) {
if (questionIsShown) {
this.updateTargetQuestionsVisibility(targetQuestion.possibleTargetIds);
}
else {
this.updateTargetQuestionsVisibility(targetQuestion.possibleTargetIds, false);
}
}
}
}
}
class QuestionCheckboxTreeSummary {
$totalSelected;
$totalSelectedText;
itemNameSingular;
itemNamePlural;
constructor($summary, itemNameSingular, itemNamePlural) {
this.$totalSelected = $summary.find('.dm-checkbox-tree__summary-total-selected');
this.$totalSelectedText = $summary.find('.dm-checkbox-tree__summary-total-selected-text');
this.itemNameSingular = itemNameSingular;
this.itemNamePlural = itemNamePlural;
}
updateSelectedCount = (numberSelected) => {
this.$totalSelected.text(numberSelected);
if (numberSelected === 1) {
this.$totalSelectedText.text(`${this.itemNameSingular} selected.`);
}
else {
this.$totalSelectedText.text(`${this.itemNamePlural} selected.`);
}
};
}
class QuestionCheckboxTreeSection {
checkboxTree;
$section;
$summaryTag;
$summaryTagCount;
tier;
checkboxTreeSections;
checkboxes;
isParent;
constructor(checkboxTree, $section, tier) {
this.checkboxTree = checkboxTree;
this.$section = $section;
this.tier = tier;
this.$summaryTag = this.$section.find('> .dm-checkbox-tree-details__summary .govuk-tag');
this.$summaryTagCount = this.$summaryTag.find('.dm-checkbox-tree-details__summary-text-count-selected');
this.checkboxTreeSections = this.$section.find('> .dm-checkbox-tree-details__text > .dm-checkbox-tree-details').get().map((element) => new QuestionCheckboxTreeSection(this.checkboxTree, $(element), tier + 1));
this.checkboxes = this.$section.find(`${this.$section.prop('tagName') === 'DETAILS' ? '> .dm-checkbox-tree-details__text > .govuk-form-group > .govuk-checkboxes > .govuk-checkboxes__item > ' : ''}.govuk-checkboxes__input`).get().map((element) => $(element));
this.isParent = this.checkboxTreeSections.length > 0;
}
init = () => {
this.openSectionIfSelected();
if (this.isParent) {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.init());
}
else {
this.checkboxes.forEach(($checkbox) => {
$checkbox.on('click', () => {
this.checkboxTree.updateTotals($checkbox.val(), $checkbox.is(':checked'));
});
});
}
};
selectedItems = () => {
return this.checkboxes.filter(($checkbox) => $checkbox.is(':checked'));
};
openSectionIfSelected = () => {
if (this.countSelected() > 0 && this.$section.attr('open') !== 'open') {
this.$section.attr('open', 'open');
}
};
countSelected = () => {
if (this.isParent) {
return this.checkboxTreeSections.reduce((total, checkboxTreeSection) => total + checkboxTreeSection.countSelected(), 0);
}
else {
return this.selectedItems().length;
}
};
slectedItemValues = () => {
if (this.isParent) {
return this.checkboxTreeSections.map((checkboxTreeSection) => checkboxTreeSection.slectedItemValues()).flat();
}
else {
return this.selectedItems().map(($checkbox) => $checkbox.val());
}
};
updateSelectedCount = () => {
const numberSelected = this.countSelected();
if (numberSelected > 0) {
this.$summaryTagCount.text(numberSelected);
this.$summaryTag.toggleClass('govuk-visually-hidden', false);
}
else {
this.$summaryTag.toggleClass('govuk-visually-hidden', true);
this.$summaryTagCount.text('');
}
if (this.isParent) {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.updateSelectedCount());
}
};
updateSectionLocks = (fromTier) => {
if (this.countSelected()) {
if (this.tier === fromTier) {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.toggleSectionLock(false));
}
else {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.updateSectionLocks(fromTier));
}
}
else {
this.toggleSectionLock(true);
}
};
toggleSectionLock = (isLocked) => {
if (this.isParent) {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.toggleSectionLock(isLocked));
}
else {
this.checkboxes.forEach((checkbox) => checkbox.prop('disabled', isLocked));
}
if (isLocked) {
this.$section.attr('disabled', 'disabled');
this.$section.removeAttr('open');
}
else {
this.$section.removeAttr('disabled');
}
};
toggleCheckbox = (value, isChecked) => {
if (this.isParent) {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.toggleCheckbox(value, isChecked));
}
else {
this.checkboxes.forEach(($checkbox) => {
if ($checkbox.val() === value) {
$checkbox.prop('checked', isChecked);
}
});
}
};
}
class QuestionCheckboxTree {
static moduleName = 'dm-question-checkbox-tree';
$checkboxTree;
checkboxTreeSummary;
checkboxTreeSections;
tierLimit;
currentCount = 0;
constructor($checkboxTree) {
this.$checkboxTree = $checkboxTree;
this.checkboxTreeSummary = new QuestionCheckboxTreeSummary(this.$checkboxTree.find('.dm-checkbox-tree__summary'), this.$checkboxTree.data('itemNameSingular'), this.$checkboxTree.data('itemNamePlural'));
this.tierLimit = this.$checkboxTree.data('tierRestriction') || 0;
const checkboxTreeSections = this.$checkboxTree.find('.dm-checkbox-tree__options > .dm-checkbox-tree-details').get().map((element) => new QuestionCheckboxTreeSection(this, $(element), 1));
if (checkboxTreeSections.length) {
this.checkboxTreeSections = checkboxTreeSections;
}
else {
this.checkboxTreeSections = [new QuestionCheckboxTreeSection(this, $('.dm-checkbox-tree__options'), 1)];
}
}
init = () => {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.init());
this.updateCheckboxTreeSummaryCount();
this.updateCheckboxTreeSectionSelectedCounts();
this.updateSectionLocks();
};
countSelected = () => {
return new Set(this.checkboxTreeSections.map((checkboxTreeSection) => checkboxTreeSection.slectedItemValues()).flat()).size;
};
updateCheckboxTreeSummaryCount = () => {
this.currentCount = this.countSelected();
this.checkboxTreeSummary.updateSelectedCount(this.currentCount);
};
updateCheckboxTreeSectionSelectedCounts = () => {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.updateSelectedCount());
};
updateSectionLocks = () => {
if (!this.tierLimit)
return;
this.checkboxTreeSections.forEach((checkboxTreeSection) => {
if (this.currentCount === 0) {
checkboxTreeSection.toggleSectionLock(false);
}
else {
checkboxTreeSection.updateSectionLocks(this.tierLimit);
}
});
};
updateTotals = (value, isChecked) => {
this.checkboxTreeSections.forEach((checkboxTreeSection) => checkboxTreeSection.toggleCheckbox(value, isChecked));
this.updateCheckboxTreeSummaryCount();
this.updateCheckboxTreeSectionSelectedCounts();
this.updateSectionLocks();
};
}
class QuestionListRowInput {
$input;
$label;
$labelCounter;
$prefixText;
constructor($row) {
this.$input = $row.find('.dm-list__item-input');
this.$label = $row.find('.govuk-label');
this.$labelCounter = this.$label.find('.dm-list__item-label-counter');
this.$prefixText = $row.find('.govuk-input__prefix');
}
getValue() {
return this.$input.val();
}
clearValue() {
this.$input.val('');
this.$input.attr('value', '');
}
updateIndex(newIndex) {
const newId = `input-${this.$input.attr('name')}-${newIndex}`;
this.$label.attr('for', newId);
this.$labelCounter.text(newIndex + 1);
this.$prefixText.text(`${newIndex + 1}.`);
this.$input.attr('id', newId);
}
}
class QuestionListRowRemoveButton {
answerListRow;
$button;
$removeButtonCounter;
constructor(answerListRow, $row) {
this.answerListRow = answerListRow;
this.$button = $row.find('.dm-list__item-remove');
this.$removeButtonCounter = this.$button.find('.dm-list__item-remove-counter');
}
init() {
this.toggleVisibility(true);
this.$button.on('click', () => {
this.answerListRow.removeRow();
});
}
toggleVisibility(isShown) {
this.$button.toggleClass('govuk-visually-hidden', !isShown);
}
updateIndex(newIndex) {
this.$removeButtonCounter.text(newIndex + 1);
}
}
class QuestionListRow {
answerList;
index;
$row;
answerListRowInput;
answerListRowRemoveButton;
constructor(answerList, index, $row) {
this.answerList = answerList;
this.index = index;
this.$row = $row;
this.answerListRowInput = new QuestionListRowInput($row);
this.answerListRowRemoveButton = new QuestionListRowRemoveButton(this, $row);
}
init() {
this.answerListRowRemoveButton.init();
}
updateIndex(newIndex) {
this.index = newIndex;
this.answerListRowInput.updateIndex(newIndex);
this.answerListRowRemoveButton.updateIndex(newIndex);
}
removeRow() {
this.answerList.removeRow(this.index);
this.deleteRow();
}
deleteRow() {
this.$row.remove();
}
toggleRemoveButtonVisibility(isShown) {
this.answerListRowRemoveButton.toggleVisibility(isShown);
}
inputValue() {
return this.answerListRowInput.getValue();
}
}
class QuestionListAddButton {
answerList;
$button;
$buttonCounter;
constructor(answerList, $button) {
this.answerList = answerList;
this.$button = $button;
this.$buttonCounter = $button.find('.dm-list__item-add-counter');
}
init(numberOfRows) {
this.$button.on('click', () => {
this.answerList.addRow();
});
this.updateButtonText(this.answerList.maxNumberOfItems - numberOfRows);
}
updateButtonText(numberRemaining) {
this.$buttonCounter.text(numberRemaining);
}
toggleVisibility(isShown) {
this.$button.toggleClass('govuk-visually-hidden', !isShown);
}
}
class QuestionList {
static moduleName = 'dm-question-list';
$answerList;
$answerListItems;
answerListRows;
answerListAddButton;
maxNumberOfItems;
numberOfItemsShownAsDefault;
constructor($answerList) {
this.$answerList = $answerList;
this.maxNumberOfItems = this.$answerList.data('maxNumberOfItems');
this.numberOfItemsShownAsDefault = this.$answerList.data('numberOfItemsShownAsDefault');
this.$answerListItems = this.$answerList.find('.dm-list__items');
this.answerListRows = this.$answerList.find('.dm-list__item').get().map((row, index) => new QuestionListRow(this, index, $(row)));
this.answerListAddButton = new QuestionListAddButton(this, this.$answerList.find('.dm-list__item-add'));
}
init() {
const rowValues = this.answerListRows.map((answerListRow) => answerListRow.inputValue());
let indexToDeleteFrom = 1;
if (rowValues.every((rowValue) => !rowValue)) {
indexToDeleteFrom = this.numberOfItemsShownAsDefault;
}
else {
rowValues.forEach((rowValue, index) => {
if (rowValue) {
indexToDeleteFrom = index + 1;
}
});
}
if (indexToDeleteFrom >= 0) {
this.answerListRows.slice(indexToDeleteFrom).forEach((answerListRow) => answerListRow.deleteRow());
this.answerListRows.splice(indexToDeleteFrom);
}
this.answerListAddButton.init(this.answerListRows.length);
this.answerListRows.forEach((answerListRow) => answerListRow.init());
this.updateIfMinRows();
this.updateAnswerButton();
}
removeRow(indexToRemove) {
this.answerListRows.splice(indexToRemove, 1);
this.answerListRows.slice(indexToRemove).forEach((answerListRow, index) => {
answerListRow.updateIndex(indexToRemove + index);
});
this.updateIfMinRows();
this.updateAnswerButton();
this.focusOnRow(indexToRemove);
}
addRow() {
const numberOfRows = this.answerListRows.length;
if (numberOfRows < this.maxNumberOfItems) {
const $newRow = this.answerListRows[0].$row.clone();
const answerListRow = new QuestionListRow(this, numberOfRows, $newRow);
answerListRow.updateIndex(numberOfRows);
answerListRow.answerListRowInput.clearValue();
this.answerListRows.push(answerListRow);
this.$answerListItems.append($newRow);
this.answerListRows[numberOfRows].init();
this.updateIfMinRows();
this.updateAnswerButton();
this.focusOnRow(numberOfRows);
}
}
updateIfMinRows() {
if (this.answerListRows.length === 1) {
this.answerListRows[0].toggleRemoveButtonVisibility(false);
}
else {
this.answerListRows[0].toggleRemoveButtonVisibility(true);
}
}
updateAnswerButton() {
if (this.answerListRows.length === this.maxNumberOfItems) {
this.answerListAddButton.toggleVisibility(false);
}
else {
this.answerListAddButton.toggleVisibility(true);
this.answerListAddButton.updateButtonText(this.maxNumberOfItems - this.answerListRows.length);
}
}
focusOnRow(targetIndexToFocus) {
const numberOfRows = this.answerListRows.length;
let indexToFocus = targetIndexToFocus;
if (targetIndexToFocus >= numberOfRows) {
indexToFocus = numberOfRows - 1;
}
this.answerListRows[indexToFocus].answerListRowInput.$input.focus();
}
}
class QuestionListMultiquestionQuestionInput {
$question;
canHideQuestion;
constructor($question) {
this.$question = $question;
this.canHideQuestion = this.$question.hasClass('js-hidden');
}
toggleVisibility(isShown) {
if (isShown) {
this.showInput();
}
else {
this.hideInput();
this.hideQuestion();
}
}
hideQuestion() {
if (this.canHideQuestion) {
this.$question.toggleClass('govuk-visually-hidden', true);
this.$question.attr('aria-hidden', 'true');
this.$question.attr('hidden', '');
}
}
}
class QuestionListMultiquestionQuestionInputWithField extends QuestionListMultiquestionQuestionInput {
$input;
constructor($question, $input) {
super($question);
this.$input = $input;
}
hasValue() {
return !!this.$input.val();
}
showInput() {
this.$input.removeAttr('tabindex');
}
hideInput() {
this.$input.val('');
this.$input.attr('value', '');
this.$input.attr('tabindex', -1);
}
focusOnInput() {
this.$input.focus();
}
}
class QuestionListMultiquestionQuestionInputWithItems extends QuestionListMultiquestionQuestionInput {
inputs;
constructor($question, inputs) {
super($question);
this.inputs = inputs;
}
hasValue() {
return this.inputs.some($input => $input.is(':checked'));
}
showInput() {
this.inputs.forEach($input => $input.removeAttr('tabindex'));
}
hideInput() {
this.inputs.forEach(($input) => {
$input.prop('checked', false);
$input.attr('tabindex', -1);
});
}
focusOnInput() {
this.inputs[0].focus();
}
}
class QuestionListMultiquestionQuestionInputFactory {
static getQuestionListMultiquestionQuestionInput($question) {
const inputs = $question.find('input').get().map((input) => $(input));
if (inputs.length == 1) {
return new QuestionListMultiquestionQuestionInputWithField($question, inputs[0]);
}
else {
return new QuestionListMultiquestionQuestionInputWithItems($question, inputs);
}
}
}
class QuestionListMultiquestionRow {
answerList;
$row;
answerListRowInputs;
constructor(answerList, $row) {
this.answerList = answerList;
this.$row = $row;
this.answerListRowInputs = $row.find('.question').get().map((question) => QuestionListMultiquestionQuestionInputFactory.getQuestionListMultiquestionQuestionInput($(question)));
}
toggleVisibility(isShown) {
this.$row.toggleClass('govuk-visually-hidden', !isShown);
this.answerListRowInputs.forEach((answerListRowInput) => answerListRowInput.toggleVisibility(isShown));
}
isRowVisible() {
return !this.$row.hasClass('govuk-visually-hidden');
}
rowHasValues() {
return this.answerListRowInputs.some((answerListRowInput) => answerListRowInput.hasValue());
}
}
class QuestionListMultiquestionButton {
answerList;
$button;
$buttonCounter;
constructor(answerList, $button, buttonType) {
this.answerList = answerList;
this.$button = $button;
this.$buttonCounter = $button.find(`.dm-list-multiquestion__item-${buttonType}-counter`);
}
updateButtonText(numberOfRows) {
this.$buttonCounter.text(numberOfRows);
}
toggleVisibility(isShown) {
this.$button.toggleClass('govuk-visually-hidden', !isShown);
if (isShown) {
this.$button.removeAttr('tabindex');
}
else {
this.$button.attr('tabindex', -1);
}
}
}
class QuestionListMultiquestionRemoveButton extends QuestionListMultiquestionButton {
constructor(answerList, $button) {
super(answerList, $button, 'remove');
}
init(numberOfRows) {
this.$button.on('click', () => {
this.answerList.hideRow();
});
this.updateButtonText(numberOfRows);
}
}
class QuestionListMultiquestionAddButton extends QuestionListMultiquestionButton {
maxNumberOfItems;
constructor(answerList, $button, maxNumberOfItems) {
super(answerList, $button, 'add');
this.maxNumberOfItems = maxNumberOfItems;
}
init(numberOfRows) {
this.$button.on('click', () => {
this.answerList.addRow();
});
this.updateButtonText(this.maxNumberOfItems - numberOfRows);
}
}
class QuestionListMultiquestionClientSide {
static moduleName = 'dm-question-list-multiquestion-client-side';
$answerList;
maxNumberOfItems;
answerListRows;
answerListAddButton;
answerListRemoveButton;
constructor($answerList) {
this.$answerList = $answerList;
this.maxNumberOfItems = this.$answerList.data('maxNumberOfItems');
this.answerListRows = this.$answerList.find('.dm-list-multiquestion__item').get().map((row) => new QuestionListMultiquestionRow(this, $(row)));
this.answerListAddButton = new QuestionListMultiquestionAddButton(this, this.$answerList.find('.dm-list-multiquestion__item-add'), this.maxNumberOfItems);
this.answerListRemoveButton = new QuestionListMultiquestionRemoveButton(this, this.$answerList.find('.dm-list-multiquestion__item-remove'));
}
init() {
const rowsVisible = this.answerListRows.map((answerListRow) => answerListRow.rowHasValues());
let indexToHideFrom = -1;
if (rowsVisible.every((rowVisible) => !rowVisible)) {
indexToHideFrom = 1;
}
else {
let previousRowVisible = true;
rowsVisible.forEach((rowVisible, index) => {
if (previousRowVisible && !rowVisible) {
indexToHideFrom = index;
}
previousRowVisible = rowVisible;
});
}
if (indexToHideFrom >= 0) {
this.answerListRows.slice(indexToHideFrom).forEach((answerListRow) => answerListRow.toggleVisibility(false));
}
const numberOfRows = this.visibleRowsCount();
this.answerListAddButton.init(numberOfRows);
this.answerListRemoveButton.init(numberOfRows);
this.updateRemoveButton(numberOfRows);
this.updateAnswerButton(numberOfRows);
}
hideRow() {
const numberOfRows = this.visibleRowsCount();
if (numberOfRows > 1) {
this.answerListRows[numberOfRows - 1].toggleVisibility(false);
this.updateRemoveButton(numberOfRows - 1);
this.updateAnswerButton(numberOfRows - 1);
this.focusOnRow(numberOfRows - 1);
}
}
addRow() {
const numberOfRows = this.visibleRowsCount();
if (numberOfRows < this.maxNumberOfItems) {
this.answerListRows[numberOfRows].toggleVisibility(true);
this.updateRemoveButton(numberOfRows + 1);
this.updateAnswerButton(numberOfRows + 1);
this.focusOnRow(numberOfRows + 1);
}
}
visibleRowsCount() {
return this.answerListRows.reduce((count, answerListRow) => count += answerListRow.isRowVisible() ? 1 : 0, 0);
}
updateRemoveButton(numberOfRows) {
if (numberOfRows === 1) {
this.answerListRemoveButton.toggleVisibility(false);
}
else {
this.answerListRemoveButton.toggleVisibility(true);
this.answerListRemoveButton.updateButtonText(numberOfRows);
}
}
updateAnswerButton(numberOfRows) {
if (numberOfRows === this.maxNumberOfItems) {
this.answerListAddButton.toggleVisibility(false);
}
else {
this.answerListAddButton.toggleVisibility(true);
this.answerListAddButton.updateButtonText(this.maxNumberOfItems - numberOfRows);
}
}
focusOnRow(numberOfRows) {
this.answerListRows[numberOfRows - 1].answerListRowInputs[0].focusOnInput();
}
}
class OptionSelect {
static moduleName = 'dm-option-select';
$optionSelect;
$options;
$optionsContainer;
$optionList;
$allCheckboxes;
checkedCheckboxes;
constructor($module) {
this.$optionSelect = $module;
this.$options = this.$optionSelect.find('input[type="checkbox"]');
this.$optionsContainer = this.$optionSelect.find('.js-options-container');
this.$optionList = this.$optionsContainer.find('.js-auto-height-inner');
this.$allCheckboxes = this.$optionsContainer.find('.govuk-checkboxes__item');
this.checkedCheckboxes = [];
}
init() {
// Attach listener to update checked count
this.$optionSelect.on('change', (event) => {
const changedEl = event.target;
if (changedEl.tagName === 'INPUT' && changedEl.getAttribute('type') === 'checkbox') {
this.updateCheckedCount();
}
});
// Replace div.container-head with a button
this.replaceHeadingSpanWithButton();
// Add js-collapsible class to parent for CSS
this.$optionSelect.addClass('js-collapsible');
// Add open/close listeners
this.$optionSelect.find('.js-container-button').on('click', (event) => {
this.toggleOptionSelect(event);
});
if (this.$optionSelect.data().closedOnLoad) {
this.close();
}
else {
this.setupHeight();
}
const checkedString = this.checkedString();
if (checkedString) {
this.attachCheckedCounter(checkedString);
}
}
getAllCheckedCheckboxes() {
this.checkedCheckboxes = [];
this.$allCheckboxes.each((_index, checkbox) => {
if ($(checkbox).find('input[type=checkbox]').is(':checked')) {
this.checkedCheckboxes.push(checkbox);
}
});
}
replaceHeadingSpanWithButton() {
/* Replace the span within the heading with a button element. This is based on feedback from Léonie Watson.
* The button has all of the accessibility hooks that are used by screen readers and etc.
* We do this in the JavaScript because if the JavaScript is not active then the button shouldn't
* be there as there is no JS to handle the click event.
*/
const $containerHead = this.$optionSelect.find('.js-container-button');
const jsContainerHeadHTML = $containerHead.html();
// Create button and replace the preexisting html with the button.
const $button = document.createElement('button');
$button.classList.add('js-container-button', 'dm-option-select__title', 'dm-option-select__button');
// Add type button to override default type submit when this component is used within a form
$button.setAttribute('type', 'button');
$button.setAttribute('aria-expanded', 'true');
$button.setAttribute('id', $containerHead.attr('id'));
$button.setAttribute('aria-controls', this.$optionsContainer.attr('id'));
$button.innerHTML = jsContainerHeadHTML;
$containerHead.after($button.outerHTML);
$containerHead.remove();
}
attachCheckedCounter(checkedString) {
this.$optionSelect.find('.js-container-button').after(`<div class="dm-option-select__selected-counter js-selected-counter">${checkedString}</div>`);
}
updateCheckedCount() {
const checkedString = this.checkedString();
const $checkedStringElement = this.$optionSelect.find('.js-selected-counter');
if (checkedString) {
if ($checkedStringElement.length) {
$checkedStringElement.text(checkedString);
}
else {
this.attachCheckedCounter(checkedString);
}
}
else {
$checkedStringElement.remove();
}
}
checkedString() {
this.getAllCheckedCheckboxes();
const count = this.checkedCheckboxes.length;
let checkedString = '';
if (count > 0) {
checkedString = count + ' selected';
}
return checkedString;
}
toggleOptionSelect(event) {
if (this.isClosed()) {
this.open();
}
else {
this.close();
}
event.preventDefault();
}
open() {
if (this.isClosed()) {
this.$optionSelect.find('.js-container-button').attr('aria-expanded', 'true');
this.$optionSelect.removeClass('js-closed');
this.$optionSelect.addClass('js-opened');
if (!this.$optionsContainer.css('height')) {
this.setupHeight();
}
}
}
close() {
this.$optionSelect.removeClass('js-opened');
this.$optionSelect.addClass('js-closed');
this.$optionSelect.find('.js-container-button').attr('aria-expanded', 'false');
}
isClosed() {
return this.$optionSelect.hasClass('js-closed');
}
setContainerHeight(height) {
this.$optionsContainer.css('height', height + 'px');
}
isCheckboxVisible($checkbox) {
const initialOptionContainerHeight = this.$optionsContainer.get(0)?.clientHeight;
const optionListOffsetTop = this.$optionList.get(0).getBoundingClientRect().top + document.body.scrollTop;
const distanceFromTopOfContainer = ($checkbox.get(0).getBoundingClientRect().top + document.body.scrollTop) - optionListOffsetTop;
return distanceFromTopOfContainer < initialOptionContainerHeight;
}
getVisibleCheckboxes() {
const visibleCheckboxes = this.$options.get().filter((checkbox) => this.isCheckboxVisible($(checkbox)));
// add an extra checkbox, if the label of the first is too long it collapses onto itself
if (visibleCheckboxes.length < this.$options.length) {
visibleCheckboxes.push(this.$options.get(visibleCheckboxes.length));
}
return visibleCheckboxes;
}
setupHeight() {
const optionsContainer = this.$optionsContainer.get(0);
const optionList = this.$optionList.get(0);
let initialOptionContainerHeight = optionsContainer.clientHeight;
let height = optionList.offsetHeight;
// check whether this is hidden by progressive disclosure,
// because height calculations won't work
if (optionsContainer.offsetParent === null) {
initialOptionContainerHeight = 200;
height = 200;
}
// Resize if the list is only slightly bigger than its container
if (height < initialOptionContainerHeight + 50) {
this.setContainerHeight(height + 1);
return;
}
// Resize to cut last item cleanly in half
const visibleCheckboxes = this.getVisibleCheckboxes();
const lastVisibleCheckbox = visibleCheckboxes[visibleCheckboxes.length - 1];
const position = (lastVisibleCheckbox?.parentNode).offsetTop; // parent element is relative
this.setContainerHeight(position + (parseFloat(window.getComputedStyle(lastVisibleCheckbox, null).height.replace('px', '')) / 1.5));
}
}
class SearchBox {
static moduleName = 'dm-search-box';
$module;
$toggleTarget;
constructor($module) {
this.$module = $module;
this.$toggleTarget = this.$module.find('.js-class-toggle');
}
init() {
if (!this.inputIsEmpty()) {
this.addFocusClass();
}
this.$toggleTarget.on('focus', this.addFocusClass.bind(this));
this.$toggleTarget.on('blur', this.removeFocusClassFromEmptyInput.bind(this));
}
inputIsEmpty() {
return this.$toggleTarget.val() === '';
}
addFocusClass() {
this.$toggleTarget.addClass('focus');
}
removeFocusClassFromEmptyInput() {
if (this.inputIsEmpty()) {
this.$toggleTarget.removeClass('focus');
}
}
}
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var accessibleAutocomplete_min = {exports: {}};
var hasRequiredAccessibleAutocomplete_min;
function requireAccessibleAutocomplete_min () {
if (hasRequiredAccessibleAutocomplete_min) return accessibleAutocomplete_min.exports;
hasRequiredAccessibleAutocomplete_min = 1;
(function (module, exports) {
!function (t, e) {
module.exports = e() ;
}(self, function () {
return function () {
var t = {
8952: function _(t, e, n) {
var r = n(4328),
o = n(36),
i = TypeError;
t.exports = function (t) {
if (r(t)) return t;
throw new i(o(t) + " is not a function");
};
},
2096: function _(t, e, n) {
var r = n(2424),
o = String,
i = TypeError;
t.exports = function (t) {
if (r(t)) return t;
throw new i("Can't set " + o(t) + " as a prototype");
};
},
4764: function _(t, e, n) {
var r = n(9764).charAt;
t.exports = function (t, e, n) {
return e + (n ? r(t, e).length : 1);
};
},
6100: function _(t, e, n) {
var r = n(7e3),
o = TypeError;
t.exports = function (t, e) {
if (r(e, t)) return t;
throw new o("Incorrect invocation");
};
},
3951: function _(t, e, n) {
var r = n(1632),
o = String,
i = TypeError;
t.exports = function (t) {
if (r(t)) return t;
throw new i(o(t) + " is not an object");
};
},
2504: function _(t, e, n) {
var r = n(4096),
o = n(2495),
i = n(3556),
u = function u(t) {
return function (e, n, u) {
var a = r(e),
c = i(a);
if (0 === c) return !t && -1;
var s,
l = o(u, c);
if (t && n != n) {
for (; c > l;) if ((s = a[l++]) != s) return true;
} else for (; c > l; l++) if ((t || l in a) && a[l] === n) return t || l || 0;
return !t && -1;
};
};
t.exports = {
includes: u(true),
indexOf: u(false)
};
},
3364: function _(t, e, n) {
var r = n(8992),
o = n(1664),
i = n(5712),
u = n(4356),
a = n(3556),
c = n(2568),
s = o([].push),
l = function l(t) {
var e = 1 === t,
n = 2 === t,
o = 3 === t,
l = 4 === t,
f = 6 === t,
p = 7 === t,
d = 5 === t || f;
return function (h, v, m, y) {
for (var g, b, x = u(h), w = i(x), O = a(w), _ = r(v, m), S = 0, C = y || c, E = e ? C(h, O) : n || p ? C(h, 0) : void 0; O > S; S++) if ((d || S in w) && (b = _(g = w[S], S, x), t)) if (e) E[S] = b;else if (b) switch (t) {
case 3:
return true;
case 5:
return g;
case 6:
return S;
case 2:
s(E, g);
} else switch (t) {
case 4:
return false;
case 7:
s(E, g);
}
return f ? -1 : o || l ? l : E;
};
};
t.exports = {
forEach: l(0),
map: l(1),
filter: l(2),
some: l(3),
every: l(4),
find: l(5),
findIndex: l(6),
filterReject: l(7)
};
},
953: function _(t, e, n) {
var r = n(9957),
o = n(9972),
i = n(8504),
u = o("species");
t.exports = function (t) {
return i >= 51 || !r(function () {
var e = [];
return (e.constructor = {})[u] = function () {
return {
foo: 1
};
}, 1 !== e[t](Boolean).foo;
});
};
},
1496: function _(t, e, n) {
var r = n(9957);
t.exports = function (t, e) {
var n = [][t];
return !!n && r(function () {
n.call(null, e || function () {
return 1;
}, 1);
});
};
},
6728: function _(t, e, n) {
var r = n(3476),
o = n(1432),
i = TypeError,
u = Object.getOwnPropertyDescriptor,
a = r && !function () {
if (void 0 !== this) return true;
try {
Object.defineProperty([], "length", {
writable: !1
}).length = 1;
} catch (t) {
return t instanceof TypeError;
}
}();
t.exports = a ? function (t, e) {
if (o(t) && !u(t, "length").writable) throw new i("Cannot set read only .length");
return t.length = e;
} : function (t, e) {
return t.length = e;
};
},
6736: function _(t, e, n) {
var r = n(1432),
o = n(6072),
i = n(1632),
u = n(9972)("species"),
a = Array;
t.exports = function (t) {
var e;
return r(t) && (e = t.constructor, (o(e) && (e === a || r(e.prototype)) || i(e) && null === (e = e[u])) && (e = void 0)), void 0 === e ? a : e;
};
},
2568: function _(t, e, n) {
var r = n(6736);
t.exports = function (t, e) {
return new (r(t))(0 === e ? 0 : e);
};
},
8696: function _(t, e, n) {
var r = n(3951),
o = n(3112);
t.exports = function (t, e, n, i) {
try {
return i ? e(r(n)[0], n[1]) : e(n);
} catch (u) {
o(t, "throw", u);
}
};
},
1888: function _(t, e, n) {
var r = n(1664),
o = r({}.toString),
i = r("".slice);
t.exports = function (t) {
return i(o(t), 8, -1);
};
},
4427: function _(t, e, n) {
var r = n(16),
o = n(4328),
i = n(1888),
u = n(9972)("toStringTag"),
a = Object,
c = "Arguments" === i(function () {
return arguments;
}());
t.exports = r ? i : function (t) {
var e, n, r;
return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (n = function (t, e) {
try {
return t[e];
} catch (n) {}
}(e = a(t), u)) ? n : c ? i(e) : "Object" === (r = i(e)) && o(e.callee) ? "Arguments" : r;
};
},
9968: function _(t, e, n) {
var r = n(5152),
o = n(9252),
i = n(9444),
u = n(8352);
t.exports = function (t, e, n) {
for (var a = o(e), c = u.f, s = i.f, l = 0; l < a.length; l++) {
var f = a[l];
r(t, f) || n && r(n, f) || c(t, f, s(e, f));
}
};
},
2272: function _(t, e, n) {
var r = n(9957);
t.exports = !r(function () {
function t() {}
return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
});
},
3336: function _(t) {
t.exports = function (t, e) {
return {
value: t,
done: e
};
};
},
3440: function _(t, e, n) {
var r = n(3476),
o = n(8352),
i = n(9728);
t.exports = r ? function (t, e, n) {
return o.f(t, e, i(1, n));
} : function (t, e, n) {
return t[e] = n, t;
};
},
9728: function _(t) {
t.exports = function (t, e) {
return {
enumerable: !(1 & t),
configurable: !(2 & t),
writable: !(4 & t),
value: e
};
};
},
92: function _(t, e, n) {
var r = n(3476),
o = n(8352),
i = n(9728);
t.exports = function (t, e, n) {
r ? o.f(t, e, i(0, n)) : t[e] = n;
};
},
2544: function _(t, e, n) {
var r = n(5312),
o = n(8352);
t.exports = function (t, e, n) {
return n.get && r(n.get, e, {
getter: true
}), n.set && r(n.set, e, {
setter: true
}), o.f(t, e, n);
};
},
6076: function _(t, e, n) {
var r = n(4328),
o = n(8352),
i = n(5312),
u = n(4636);
t.exports = function (t, e, n, a) {
a || (a = {});
var c = a.enumerable,
s = void 0 !== a.name ? a.name : e;
if (r(n) && i(n, s, a), a.global) c ? t[e] = n : u(e, n);else {
try {
a.unsafe ? t[e] && (c = !0) : delete t[e];
} catch (l) {}
c ? t[e] = n : o.f(t, e, {
value: n,
enumerable: false,
configurable: !a.nonConfigurable,
writable: !a.nonWritable
});
}
return t;
};
},
4036: function _(t, e, n) {
var r = n(6076);
t.exports = function (t, e, n) {
for (var o in e) r(t, o, e[o], n);
return t;
};
},
4636: function _(t, e, n) {
var r = n(6420),
o = Object.defineProperty;
t.exports = function (t, e) {
try {
o(r, t, {
value: e,
configurable: !0,
writable: !0
});
} catch (n) {
r[t] = e;
}
return e;
};
},
3476: function _(t, e, n) {
var r = n(9957);
t.exports = !r(function () {
return 7 !== Object.defineProperty({}, 1, {
get: function get() {
return 7;
}
})[1];
});
},
8168: function _(t, e, n) {
var r = n(6420),
o = n(1632),
i = r.document,
u = o(i) && o(i.createElement);
t.exports = function (t) {
return u ? i.createElement(t) : {};
};
},
4316: function _(t) {
var e = TypeError;
t.exports = function (t) {
if (t > 9007199254740991) throw e("Maximum allowed index exceeded");
return t;
};
},
6064: function _(t) {
t.exports = "undefined" != typeof navigator && String(navigator.userAgent) || "";
},
8504: function _(t, e, n) {
var r,
o,
i = n(6420),
u = n(6064),
a = i.process,
c = i.Deno,
s = a && a.versions || c && c.version,
l = s && s.v8;
l && (o = (r = l.split("."))[0] > 0 && r[0] < 4 ? 1 : +(r[0] + r[1])), !o && u && (!(r = u.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = u.match(/Chrome\/(\d+)/)) && (o = +r[1]), t.exports = o;
},
8256: function _(t) {
t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
},
6520: function _(t, e, n) {
var r = n(1664),
o = Error,
i = r("".replace),
u = String(new o("zxcasd").stack),
a = /\n\s*at [^:]*:[^\n]*/,
c = a.test(u);
t.exports = function (t, e) {
if (c && "string" == typeof t && !o.prepareStackTrace) for (; e--;) t = i(t, a, "");
return t;
};
},
3696: function _(t, e, n) {
var r = n(3440),
o = n(6520),
i = n(9184),
u = Error.captureStackTrace;
t.exports = function (t, e, n, a) {
i && (u ? u(t, e) : r(t, "stack", o(n, a)));
};
},
9184: function _(t, e, n) {
var r = n(9957),
o = n(9728);
t.exports = !r(function () {
var t = new Error("a");
return !("stack" in t) || (Object.defineProperty(t, "stack", o(1, 7)), 7 !== t.stack);
});
},
9160: function _(t, e, n) {
var r = n(6420),
o = n(9444).f,
i = n(3440),
u = n(6076),
a = n(4636),
c = n(9968),
s = n(6704);
t.exports = function (t, e) {
var n,
l,
f,
p,
d,
h = t.target,
v = t.global,
m = t.stat;
if (n = v ? r : m ? r[h] || a(h, {}) : r[h] && r[h].prototype) for (l in e) {
if (p = e[l], f = t.dontCallGetSet ? (d = o(n, l)) && d.value : n[l], !s(v ? l : h + (m ? "." : "#") + l, t.forced) && void 0 !== f) {
if (typeof p == typeof f) continue;
c(p, f);
}
(t.sham || f && f.sham) && i(p, "sham", true), u(n, l, p, t);
}
};
},
9957: function _(t) {
t.exports = function (t) {
try {
return !!t();
} catch (e) {
return true;
}
};
},
7176: function _(t, e, n) {
n(880);
var r = n(8448),
o = n(6076),
i = n(7680),
u = n(9957),
a = n(9972),
c = n(3440),
s = a("species"),
l = RegExp.prototype;
t.exports = function (t, e, n, f) {
var p = a(t),
d = !u(function () {
var e = {};
return e[p] = function () {
return 7;
}, 7 !== ""[t](e);
}),
h = d && !u(function () {
var e = false,
n = /a/;
return "split" === t && ((n = {}).constructor = {}, n.constructor[s] = function () {
return n;
}, n.flags = "", n[p] = /./[p]), n.exec = function () {
return e = true, null;
}, n[p](""), !e;
});
if (!d || !h || n) {
var v = /./[p],
m = e(p, ""[t], function (t, e, n, o, u) {
var a = e.exec;
return a === i || a === l.exec ? d && !u ? {
done: true,
value: r(v, e, n, o)
} : {
done: true,
value: r(t, n, e, o)
} : {
done: false
};
});
o(String.prototype, t, m[0]), o(l, p, m[1]);
}
f && c(l[p], "sham", true);
};
},
908: function _(t, e, n) {
var r = n(7332),
o = Function.prototype,
i = o.apply,
u = o.call;
t.exports = "object" == typeof Reflect && Reflect.apply || (r ? u.bind(i) : function () {
return u.apply(i, arguments);
});
},
8992: function _(t, e, n) {
var r = n(3180),
o = n(8952),
i = n(7332),
u = r(r.bind);
t.exports = function (t, e) {
return o(t), void 0 === e ? t : i ? u(t, e) : function () {
return t.apply(e, arguments);
};
};
},
7332: function _(t, e, n) {
var r = n(9957);
t.exports = !r(function () {
var t = function () {}.bind();
return "function" != typeof t || t.hasOwnProperty("prototype");
});
},
8448: function _(t, e, n) {
var r = n(7332),
o = Function.prototype.call;
t.exports = r ? o.bind(o) : function () {
return o.apply(o, arguments);
};
},
6208: function _(t, e, n) {
var r = n(3476),
o = n(5152),
i = Function.prototype,
u = r && Object.getOwnPropertyDescriptor,
a = o(i, "name"),
c = a && "something" === function () {}.name,
s = a && (!r || r && u(i, "name").configurable);
t.exports = {
EXISTS: a,
PROPER: c,
CONFIGURABLE: s
};
},
5288: function _(t, e, n) {
var r = n(1664),
o = n(8952);
t.exports = function (t, e, n) {
try {
return r(o(Object.getOwnPropertyDescriptor(t, e)[n]));
} catch (i) {}
};
},
3180: function _(t, e, n) {
var r = n(1888),
o = n(1664);
t.exports = function (t) {
if ("Function" === r(t)) return o(t);
};
},
1664: function _(t, e, n) {
var r = n(7332),
o = Function.prototype,
i = o.call,
u = r && o.bind.bind(i, i);
t.exports = r ? u : function (t) {
return function () {
return i.apply(t, arguments);
};
};
},
5232: function _(t, e, n) {
var r = n(6420),
o = n(4328);
t.exports = function (t, e) {
return arguments.length < 2 ? (n = r[t], o(n) ? n : void 0) : r[t] && r[t][e];
var n;
};
},
6752: function _(t) {
t.exports = function (t) {
return {
iterator: t,
next: t.next,
done: false
};
};
},
4504: function _(t, e, n) {
var r = n(8952),
o = n(9760);
t.exports = function (t, e) {
var n = t[e];
return o(n) ? void 0 : r(n);
};
},
6420: function _(t, e, n) {
var r = function r(t) {
return t && t.Math === Math && t;
};
t.exports = r("object" == typeof globalThis && globalThis) || r("object" == typeof window && window) || r("object" == typeof self && self) || r("object" == typeof n.g && n.g) || r("object" == typeof this && this) || function () {
return this;
}() || Function("return this")();
},
5152: function _(t, e, n) {
var r = n(1664),
o = n(4356),
i = r({}.hasOwnProperty);
t.exports = Object.hasOwn || function (t, e) {
return i(o(t), e);
};
},
2560: function _(t) {
t.exports = {};
},
4168: function _(t, e, n) {
var r = n(5232);
t.exports = r("document", "documentElement");
},
9888: function _(t, e, n) {
var r = n(3476),
o = n(9957),
i = n(8168);
t.exports = !r && !o(function () {
return 7 !== Object.defineProperty(i("div"), "a", {
get: function get() {
return 7;
}
}).a;
});
},
5712: function _(t, e, n) {
var r = n(1664),
o = n(9957),
i = n(1888),
u = Object,
a = r("".split);
t.exports = o(function () {
return !u("z").propertyIsEnumerable(0);
}) ? function (t) {
return "String" === i(t) ? a(t, "") : u(t);
} : u;
},
7512: function _(t, e, n) {
var r = n(4328),
o = n(1632),
i = n(4024);
t.exports = function (t, e, n) {
var u, a;
return i && r(u = e.constructor) && u !== n && o(a = u.prototype) && a !== n.prototype && i(t, a), t;
};
},
9112: function _(t, e, n) {
var r = n(1664),
o = n(4328),
i = n(3976),
u = r(Function.toString);
o(i.inspectSource) || (i.inspectSource = function (t) {
return u(t);
}), t.exports = i.inspectSource;
},
3480: function _(t, e, n) {
var r = n(1632),
o = n(3440);
t.exports = function (t, e) {
r(e) && "cause" in e && o(t, "cause", e.cause);
};
},
9104: function _(t, e, n) {
var r,
o,
i,
u = n(4288),
a = n(6420),
c = n(1632),
s = n(3440),
l = n(5152),
f = n(3976),
p = n(6504),
d = n(2560),
h = "Object already initialized",
v = a.TypeError,
m = a.WeakMap;
if (u || f.state) {
var y = f.state || (f.state = new m());
y.get = y.get, y.has = y.has, y.set = y.set, r = function r(t, e) {
if (y.has(t)) throw new v(h);
return e.facade = t, y.set(t, e), e;
}, o = function o(t) {
return y.get(t) || {};
}, i = function i(t) {
return y.has(t);
};
} else {
var g = p("state");
d[g] = true, r = function r(t, e) {
if (l(t, g)) throw new v(h);
return e.facade = t, s(t, g, e), e;
}, o = function o(t) {
return l(t, g) ? t[g] : {};
}, i = function i(t) {
return l(t, g);
};
}
t.exports = {
set: r,
get: o,
has: i,
enforce: function enforce(t) {
return i(t) ? o(t) : r(t, {});
},
getterFor: function getterFor(t) {
return function (e) {
var n;
if (!c(e) || (n = o(e)).type !== t) throw new v("Incompatible receiver, " + t + " required");
return n;
};
}
};
},
1432: function _(t, e, n) {
var r = n(1888);
t.exports = Array.isArray || function (t) {
return "Array" === r(t);
};
},
4328: function _(t) {
var e = "object" == typeof document && document.all;
t.exports = void 0 === e && void 0 !== e ? function (t) {
return "function" == typeof t || t === e;
} : function (t) {
return "function" == typeof t;
};
},
6072: function _(t, e, n) {
var r = n(1664),
o = n(9957),
i = n(4328),
u = n(4427),
a = n(5232),
c = n(9112),
s = function s() {},
l = a("Reflect", "construct"),
f = /^\s*(?:class|function)\b/,
p = r(f.exec),
d = !f.test(s),
h = function h(t) {
if (!i(t)) return false;
try {
return l(s, [], t), !0;
} catch (e) {
return false;
}
},
v = function v(t) {
if (!i(t)) return false;
switch (u(t)) {
case "AsyncFunction":
case "GeneratorFunction":
case "AsyncGeneratorFunction":
return false;
}
try {
return d || !!p(f, c(t));
} catch (e) {
return true;
}
};
v.sham = true, t.exports = !l || o(function () {
var t;
return h(h.call) || !h(Object) || !h(function () {
t = true;
}) || t;
}) ? v : h;
},
6704: function _(t, e, n) {
var r = n(9957),
o = n(4328),
i = /#|\.prototype\./,
u = function u(t, e) {
var n = c[a(t)];
return n === l || n !== s && (o(e) ? r(e) : !!e);
},
a = u.normalize = function (t) {
return String(t).replace(i, ".").toLowerCase();
},
c = u.data = {},
s = u.NATIVE = "N",
l = u.POLYFILL = "P";
t.exports = u;
},
9760: function _(t) {
t.exports = function (t) {
return null == t;
};
},
1632: function _(t, e, n) {
var r = n(4328);
t.exports = function (t) {
return "object" == typeof t ? null !== t : r(t);
};
},
2424: function _(t, e, n) {
var r = n(1632);
t.exports = function (t) {
return r(t) || null === t;
};
},
7048: function _(t) {
t.exports = false;
},
7728: function _(t, e, n) {
var r = n(5232),
o = n(4328),
i = n(7e3),
u = n(6536),
a = Object;
t.exports = u ? function (t) {
return "symbol" == typeof t;
} : function (t) {
var e = r("Symbol");
return o(e) && i(e.prototype, a(t));
};
},
3112: function _(t, e, n) {
var r = n(8448),
o = n(3951),
i = n(4504);
t.exports = function (t, e, n) {
var u, a;
o(t);
try {
if (!(u = i(t, "return"))) {
if ("throw" === e) throw n;
return n;
}
u = r(u, t);
} catch (c) {
a = true, u = c;
}
if ("throw" === e) throw n;
if (a) throw u;
return o(u), n;
};
},
9724: function _(t, e, n) {
var r = n(8448),
o = n(9368),
i = n(3440),
u = n(4036),
a = n(9972),
c = n(9104),
s = n(4504),
l = n(336).IteratorPrototype,
f = n(3336),
p = n(3112),
d = a("toStringTag"),
h = "IteratorHelper",
v = "WrapForValidIterator",
m = c.set,
y = function y(t) {
var e = c.getterFor(t ? v : h);
return u(o(l), {
next: function next() {
var n = e(this);
if (t) return n.nextHandler();
try {
var r = n.done ? void 0 : n.nextHandler();
return f(r, n.done);
} catch (o) {
throw n.done = true, o;
}
},
"return": function _return() {
var n = e(this),
o = n.iterator;
if (n.done = true, t) {
var i = s(o, "return");
return i ? r(i, o) : f(void 0, true);
}
if (n.inner) try {
p(n.inner.iterator, "normal");
} catch (u) {
return p(o, "throw", u);
}
return p(o, "normal"), f(void 0, true);
}
});
},
g = y(true),
b = y(false);
i(b, d, "Iterator Helper"), t.exports = function (t, e) {
var n = function n(_n, r) {
r ? (r.iterator = _n.iterator, r.next = _n.next) : r = _n, r.type = e ? v : h, r.nextHandler = t, r.counter = 0, r.done = false, m(this, r);
};
return n.prototype = e ? g : b, n;
};
},
5792: function _(t, e, n) {
var r = n(8448),
o = n(8952),
i = n(3951),
u = n(6752),
a = n(9724),
c = n(8696),
s = a(function () {
var t = this.iterator,
e = i(r(this.next, t));
if (!(this.done = !!e.done)) return c(t, this.mapper, [e.value, this.counter++], true);
});
t.exports = function (t) {
return i(this), o(t), new s(u(this), {
mapper: t
});
};
},
336: function _(t, e, n) {
var r,
o,
i,
u = n(9957),
a = n(4328),
c = n(1632),
s = n(9368),
l = n(7796),
f = n(6076),
p = n(9972),
d = n(7048),
h = p("iterator"),
v = false;
[].keys && ("next" in (i = [].keys()) ? (o = l(l(i))) !== Object.prototype && (r = o) : v = true), !c(r) || u(function () {
var t = {};
return r[h].call(t) !== t;
}) ? r = {} : d && (r = s(r)), a(r[h]) || f(r, h, function () {
return this;
}), t.exports = {
IteratorPrototype: r,
BUGGY_SAFARI_ITERATORS: v
};
},
3556: function _(t, e, n) {
var r = n(7584);
t.exports = function (t) {
return r(t.length);
};
},
5312: function _(t, e, n) {
var r = n(1664),
o = n(9957),
i = n(4328),
u = n(5152),
a = n(3476),
c = n(6208).CONFIGURABLE,
s = n(9112),
l = n(9104),
f = l.enforce,
p = l.get,
d = String,
h = Object.defineProperty,
v = r("".slice),
m = r("".replace),
y = r([].join),
g = a && !o(function () {
return 8 !== h(function () {}, "length", {
value: 8
}).length;
}),
b = String(String).split("String"),
x = t.exports = function (t, e, n) {
"Symbol(" === v(d(e), 0, 7) && (e = "[" + m(d(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), n && n.getter && (e = "get " + e), n && n.setter && (e = "set " + e), (!u(t, "name") || c && t.name !== e) && (a ? h(t, "name", {
value: e,
configurable: true
}) : t.name = e), g && n && u(n, "arity") && t.length !== n.arity && h(t, "length", {
value: n.arity
});
try {
n && u(n, "constructor") && n.constructor ? a && h(t, "prototype", {
writable: !1
}) : t.prototype && (t.prototype = void 0);
} catch (o) {}
var r = f(t);
return u(r, "source") || (r.source = y(b, "string" == typeof e ? e : "")), t;
};
Function.prototype.toString = x(function () {
return i(this) && p(this).source || s(this);
}, "toString");
},
1748: function _(t) {
var e = Math.ceil,
n = Math.floor;
t.exports = Math.trunc || function (t) {
var r = +t;
return (r > 0 ? n : e)(r);
};
},
8948: function _(t, e, n) {
var r = n(5016);
t.exports = function (t, e) {
return void 0 === t ? arguments.length < 2 ? "" : e : r(t);
};
},
9292: function _(t, e, n) {
var r = n(3476),
o = n(1664),
i = n(8448),
u = n(9957),
a = n(1531),
c = n(9392),
s = n(8912),
l = n(4356),
f = n(5712),
p = Object.assign,
d = Object.defineProperty,
h = o([].concat);
t.exports = !p || u(function () {
if (r && 1 !== p({
b: 1
}, p(d({}, "a", {
enumerable: true,
get: function get() {
d(this, "b", {
value: 3,
enumerable: false
});
}
}), {
b: 2
})).b) return true;
var t = {},
e = {},
n = Symbol("assign detection"),
o = "abcdefghijklmnopqrst";
return t[n] = 7, o.split("").forEach(function (t) {
e[t] = t;
}), 7 !== p({}, t)[n] || a(p({}, e)).join("") !== o;
}) ? function (t, e) {
for (var n = l(t), o = arguments.length, u = 1, p = c.f, d = s.f; o > u;) for (var v, m = f(arguments[u++]), y = p ? h(a(m), p(m)) : a(m), g = y.length, b = 0; g > b;) v = y[b++], r && !i(d, m, v) || (n[v] = m[v]);
return n;
} : p;
},
9368: function _(t, e, n) {
var r,
o = n(3951),
i = n(2056),
u = n(8256),
a = n(2560),
c = n(4168),
s = n(8168),
l = n(6504),
f = "prototype",
p = "script",
d = l("IE_PROTO"),
h = function h() {},
v = function v(t) {
return "<" + p + ">" + t + "</" + p + ">";
},
m = function m(t) {
t.write(v("")), t.close();
var e = t.parentWindow.Object;
return t = null, e;
},
_y = function y() {
try {
r = new ActiveXObject("htmlfile");
} catch (i) {}
var t, e, n;
_y = "undefined" != typeof document ? document.domain && r ? m(r) : (e = s("iframe"), n = "java" + p + ":", e.style.display = "none", c.appendChild(e), e.src = String(n), (t = e.contentWindow.document).open(), t.write(v("document.F=Object")), t.close(), t.F) : m(r);
for (var o = u.length; o--;) delete _y[f][u[o]];
return _y();
};
a[d] = true, t.exports = Object.create || function (t, e) {
var n;
return null !== t ? (h[f] = o(t), n = new h(), h[f] = null, n[d] = t) : n = _y(), void 0 === e ? n : i.f(n, e);
};
},
2056: function _(t, e, n) {
var r = n(3476),
o = n(1576),
i = n(8352),
u = n(3951),
a = n(4096),
c = n(1531);
e.f = r && !o ? Object.defineProperties : function (t, e) {
u(t);
for (var n, r = a(e), o = c(e), s = o.length, l = 0; s > l;) i.f(t, n = o[l++], r[n]);
return t;
};
},
8352: function _(t, e, n) {
var r = n(3476),
o = n(9888),
i = n(1576),
u = n(3951),
a = n(88),
c = TypeError,
s = Object.defineProperty,
l = Object.getOwnPropertyDescriptor,
f = "enumerable",
p = "configurable",
d = "writable";
e.f = r ? i ? function (t, e, n) {
if (u(t), e = a(e), u(n), "function" == typeof t && "prototype" === e && "value" in n && d in n && !n[d]) {
var r = l(t, e);
r && r[d] && (t[e] = n.value, n = {
configurable: p in n ? n[p] : r[p],
enumerable: f in n ? n[f] : r[f],
writable: false
});
}
return s(t, e, n);
} : s : function (t, e, n) {
if (u(t), e = a(e), u(n), o) try {
return s(t, e, n);
} catch (r) {}
if ("get" in n || "set" in n) throw new c("Accessors not supported");
return "value" in n && (t[e] = n.value), t;
};
},
9444: function _(t, e, n) {
var r = n(3476),
o = n(8448),
i = n(8912),
u = n(9728),
a = n(4096),
c = n(88),
s = n(5152),
l = n(9888),
f = Object.getOwnPropertyDescriptor;
e.f = r ? f : function (t, e) {
if (t = a(t), e = c(e), l) try {
return f(t, e);
} catch (n) {}
if (s(t, e)) return u(!o(i.f, t, e), t[e]);
};
},
5048: function _(t, e, n) {
var r = n(9008),
o = n(8256).concat("length", "prototype");
e.f = Object.getOwnPropertyNames || function (t) {
return r(t, o);
};
},
9392: function _(t, e) {
e.f = Object.getOwnPropertySymbols;
},
7796: function _(t, e, n) {
var r = n(5152),
o = n(4328),
i = n(4356),
u = n(6504),
a = n(2272),
c = u("IE_PROTO"),
s = Object,
l = s.prototype;
t.exports = a ? s.getPrototypeOf : function (t) {
var e = i(t);
if (r(e, c)) return e[c];
var n = e.constructor;
return o(n) && e instanceof n ? n.prototype : e instanceof s ? l : null;
};
},
7e3: function _(t, e, n) {
var r = n(1664);
t.exports = r({}.isPrototypeOf);
},
9008: function _(t, e, n) {
var r = n(1664),
o = n(5152),
i = n(4096),
u = n(2504).indexOf,
a = n(2560),
c = r([].push);
t.exports = function (t, e) {
var n,
r = i(t),
s = 0,
l = [];
for (n in r) !o(a, n) && o(r, n) && c(l, n);
for (; e.length > s;) o(r, n = e[s++]) && (~u(l, n) || c(l, n));
return l;
};
},
1531: function _(t, e, n) {
var r = n(9008),
o = n(8256);
t.exports = Object.keys || function (t) {
return r(t, o);
};
},
8912: function _(t, e) {
var n = {}.propertyIsEnumerable,
r = Object.getOwnPropertyDescriptor,
o = r && !n.call({
1: 2
}, 1);
e.f = o ? function (t) {
var e = r(this, t);
return !!e && e.enumerable;
} : n;
},
4024: function _(t, e, n) {
var r = n(5288),
o = n(3951),
i = n(2096);
t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
var t,
e = false,
n = {};
try {
(t = r(Object.prototype, "__proto__", "set"))(n, []), e = n instanceof Array;
} catch (u) {}
return function (n, r) {
return o(n), i(r), e ? t(n, r) : n.__proto__ = r, n;
};
}() : void 0);
},
7032: function _(t, e, n) {
var r = n(16),
o = n(4427);
t.exports = r ? {}.toString : function () {
return "[object " + o(this) + "]";
};
},
2104: function _(t, e, n) {
var r = n(8448),
o = n(4328),
i = n(1632),
u = TypeError;
t.exports = function (t, e) {
var n, a;
if ("string" === e && o(n = t.toString) && !i(a = r(n, t))) return a;
if (o(n = t.valueOf) && !i(a = r(n, t))) return a;
if ("string" !== e && o(n = t.toString) && !i(a = r(n, t))) return a;
throw new u("Can't convert object to primitive value");
};
},
9252: function _(t, e, n) {
var r = n(5232),
o = n(1664),
i = n(5048),
u = n(9392),
a = n(3951),
c = o([].concat);
t.exports = r("Reflect", "ownKeys") || function (t) {
var e = i.f(a(t)),
n = u.f;
return n ? c(e, n(t)) : e;
};
},
584: function _(t, e, n) {
var r = n(8352).f;
t.exports = function (t, e, n) {
n in t || r(t, n, {
configurable: true,
get: function get() {
return e[n];
},
set: function set(t) {
e[n] = t;
}
});
};
},
9092: function _(t, e, n) {
var r = n(8448),
o = n(3951),
i = n(4328),
u = n(1888),
a = n(7680),
c = TypeError;
t.exports = function (t, e) {
var n = t.exec;
if (i(n)) {
var s = r(n, t, e);
return null !== s && o(s), s;
}
if ("RegExp" === u(t)) return r(a, t, e);
throw new c("RegExp#exec called on incompatible receiver");
};
},
7680: function _(t, e, n) {
var r,
o,
i = n(8448),
u = n(1664),
a = n(5016),
c = n(8872),
s = n(3548),
l = n(4696),
f = n(9368),
p = n(9104).get,
d = n(8e3),
h = n(9124),
v = l("native-string-replace", String.prototype.replace),
m = RegExp.prototype.exec,
_y2 = m,
g = u("".charAt),
b = u("".indexOf),
x = u("".replace),
w = u("".slice),
O = (o = /b*/g, i(m, r = /a/, "a"), i(m, o, "a"), 0 !== r.lastIndex || 0 !== o.lastIndex),
_ = s.BROKEN_CARET,
S = void 0 !== /()??/.exec("")[1];
(O || S || _ || d || h) && (_y2 = function y(t) {
var e,
n,
r,
o,
u,
s,
l,
d = this,
h = p(d),
C = a(t),
E = h.raw;
if (E) return E.lastIndex = d.lastIndex, e = i(_y2, E, C), d.lastIndex = E.lastIndex, e;
var I = h.groups,
j = _ && d.sticky,
A = i(c, d),
P = d.source,
N = 0,
k = C;
if (j && (A = x(A, "y", ""), -1 === b(A, "g") && (A += "g"), k = w(C, d.lastIndex), d.lastIndex > 0 && (!d.multiline || d.multiline && "\n" !== g(C, d.lastIndex - 1)) && (P = "(?: " + P + ")", k = " " + k, N++), n = new RegExp("^(?:" + P + ")", A)), S && (n = new RegExp("^" + P + "$(?!\\s)", A)), O && (r = d.lastIndex), o = i(m, j ? n : d, k), j ? o ? (o.input = w(o.input, N), o[0] = w(o[0], N), o.index = d.lastIndex, d.lastIndex += o[0].length) : d.lastIndex = 0 : O && o && (d.lastIndex = d.global ? o.index + o[0].length : r), S && o && o.length > 1 && i(v, o[0], n, function () {
for (u = 1; u < arguments.length - 2; u++) void 0 === arguments[u] && (o[u] = void 0);
}), o && I) for (o.groups = s = f(null), u = 0; u < I.length; u++) s[(l = I[u])[0]] = o[l[1]];
return o;
}), t.exports = _y2;
},
8872: function _(t, e, n) {
var r = n(3951);
t.exports = function () {
var t = r(this),
e = "";
return t.hasIndices && (e += "d"), t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.dotAll && (e += "s"), t.unicode && (e += "u"), t.unicodeSets && (e += "v"), t.sticky && (e += "y"), e;
};
},
3548: function _(t, e, n) {
var r = n(9957),
o = n(6420).RegExp,
i = r(function () {
var t = o("a", "y");
return t.lastIndex = 2, null !== t.exec("abcd");
}),
u = i || r(function () {
return !o("a", "y").sticky;
}),
a = i || r(function () {
var t = o("^r", "gy");
return t.lastIndex = 2, null !== t.exec("str");
});
t.exports = {
BROKEN_CARET: a,
MISSED_STICKY: u,
UNSUPPORTED_Y: i
};
},
8e3: function _(t, e, n) {
var r = n(9957),
o = n(6420).RegExp;
t.exports = r(function () {
var t = o(".", "s");
return !(t.dotAll && t.test("\n") && "s" === t.flags);
});
},
9124: function _(t, e, n) {
var r = n(9957),
o = n(6420).RegExp;
t.exports = r(function () {
var t = o("(?<a>b)", "g");
return "b" !== t.exec("b").groups.a || "bc" !== "b".replace(t, "$<a>c");
});
},
5436: function _(t, e, n) {
var r = n(9760),
o = TypeError;
t.exports = function (t) {
if (r(t)) throw new o("Can't call method on " + t);
return t;
};
},
6504: function _(t, e, n) {
var r = n(4696),
o = n(7776),
i = r("keys");
t.exports = function (t) {
return i[t] || (i[t] = o(t));
};
},
3976: function _(t, e, n) {
var r = n(7048),
o = n(6420),
i = n(4636),
u = "__core-js_shared__",
a = t.exports = o[u] || i(u, {});
(a.versions || (a.versions = [])).push({
version: "3.36.0",
mode: r ? "pure" : "global",
copyright: "© 2014-2024 Denis Pushkarev (zloirock.ru)",
license: "https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE",
source: "https://github.com/zloirock/core-js"
});
},
4696: function _(t, e, n) {
var r = n(3976);
t.exports = function (t, e) {
return r[t] || (r[t] = e || {});
};
},
9764: function _(t, e, n) {
var r = n(1664),
o = n(6180),
i = n(5016),
u = n(5436),
a = r("".charAt),
c = r("".charCodeAt),
s = r("".slice),
l = function l(t) {
return function (e, n) {
var r,
l,
f = i(u(e)),
p = o(n),
d = f.length;
return p < 0 || p >= d ? t ? "" : void 0 : (r = c(f, p)) < 55296 || r > 56319 || p + 1 === d || (l = c(f, p + 1)) < 56320 || l > 57343 ? t ? a(f, p) : r : t ? s(f, p, p + 2) : l - 56320 + (r - 55296 << 10) + 65536;
};
};
t.exports = {
codeAt: l(false),
charAt: l(true)
};
},
772: function _(t, e, n) {
var r = n(8504),
o = n(9957),
i = n(6420).String;
t.exports = !!Object.getOwnPropertySymbols && !o(function () {
var t = Symbol("symbol detection");
return !i(t) || !(Object(t) instanceof Symbol) || !Symbol.sham && r && r < 41;
});
},
2495: function _(t, e, n) {
var r = n(6180),
o = Math.max,
i = Math.min;
t.exports = function (t, e) {
var n = r(t);
return n < 0 ? o(n + e, 0) : i(n, e);
};
},
4096: function _(t, e, n) {
var r = n(5712),
o = n(5436);
t.exports = function (t) {
return r(o(t));
};
},
6180: function _(t, e, n) {
var r = n(1748);
t.exports = function (t) {
var e = +t;
return e != e || 0 === e ? 0 : r(e);
};
},
7584: function _(t, e, n) {
var r = n(6180),
o = Math.min;
t.exports = function (t) {
var e = r(t);
return e > 0 ? o(e, 9007199254740991) : 0;
};
},
4356: function _(t, e, n) {
var r = n(5436),
o = Object;
t.exports = function (t) {
return o(r(t));
};
},
7024: function _(t, e, n) {
var r = n(8448),
o = n(1632),
i = n(7728),
u = n(4504),
a = n(2104),
c = n(9972),
s = TypeError,
l = c("toPrimitive");
t.exports = function (t, e) {
if (!o(t) || i(t)) return t;
var n,
c = u(t, l);
if (c) {
if (void 0 === e && (e = "default"), n = r(c, t, e), !o(n) || i(n)) return n;
throw new s("Can't convert object to primitive value");
}
return void 0 === e && (e = "number"), a(t, e);
};
},
88: function _(t, e, n) {
var r = n(7024),
o = n(7728);
t.exports = function (t) {
var e = r(t, "string");
return o(e) ? e : e + "";
};
},
16: function _(t, e, n) {
var r = {};
r[n(9972)("toStringTag")] = "z", t.exports = "[object z]" === String(r);
},
5016: function _(t, e, n) {
var r = n(4427),
o = String;
t.exports = function (t) {
if ("Symbol" === r(t)) throw new TypeError("Cannot convert a Symbol value to a string");
return o(t);
};
},
36: function _(t) {
var e = String;
t.exports = function (t) {
try {
return e(t);
} catch (n) {
return "Object";
}
};
},
7776: function _(t, e, n) {
var r = n(1664),
o = 0,
i = Math.random(),
u = r(1..toString);
t.exports = function (t) {
return "Symbol(" + (void 0 === t ? "" : t) + ")_" + u(++o + i, 36);
};
},
6536: function _(t, e, n) {
var r = n(772);
t.exports = r && !Symbol.sham && "symbol" == typeof Symbol.iterator;
},
1576: function _(t, e, n) {
var r = n(3476),
o = n(9957);
t.exports = r && o(function () {
return 42 !== Object.defineProperty(function () {}, "prototype", {
value: 42,
writable: false
}).prototype;
});
},
4288: function _(t, e, n) {
var r = n(6420),
o = n(4328),
i = r.WeakMap;
t.exports = o(i) && /native code/.test(String(i));
},
9972: function _(t, e, n) {
var r = n(6420),
o = n(4696),
i = n(5152),
u = n(7776),
a = n(772),
c = n(6536),
s = r.Symbol,
l = o("wks"),
f = c ? s["for"] || s : s && s.withoutSetter || u;
t.exports = function (t) {
return i(l, t) || (l[t] = a && i(s, t) ? s[t] : f("Symbol." + t)), l[t];
};
},
6488: function _(t, e, n) {
var r = n(5232),
o = n(5152),
i = n(3440),
u = n(7e3),
a = n(4024),
c = n(9968),
s = n(584),
l = n(7512),
f = n(8948),
p = n(3480),
d = n(3696),
h = n(3476),
v = n(7048);
t.exports = function (t, e, n, m) {
var y = "stackTraceLimit",
g = m ? 2 : 1,
b = t.split("."),
x = b[b.length - 1],
w = r.apply(null, b);
if (w) {
var O = w.prototype;
if (!v && o(O, "cause") && delete O.cause, !n) return w;
var _ = r("Error"),
S = e(function (t, e) {
var n = f(m ? e : t, void 0),
r = m ? new w(t) : new w();
return void 0 !== n && i(r, "message", n), d(r, S, r.stack, 2), this && u(O, this) && l(r, this, S), arguments.length > g && p(r, arguments[g]), r;
});
if (S.prototype = O, "Error" !== x ? a ? a(S, _) : c(S, _, {
name: true
}) : h && y in w && (s(S, w, y), s(S, w, "prepareStackTrace")), c(S, w), !v) try {
O.name !== x && i(O, "name", x), O.constructor = S;
} catch (C) {}
return S;
}
};
},
7476: function _(t, e, n) {
var r = n(9160),
o = n(9957),
i = n(1432),
u = n(1632),
a = n(4356),
c = n(3556),
s = n(4316),
l = n(92),
f = n(2568),
p = n(953),
d = n(9972),
h = n(8504),
v = d("isConcatSpreadable"),
m = h >= 51 || !o(function () {
var t = [];
return t[v] = false, t.concat()[0] !== t;
}),
y = function y(t) {
if (!u(t)) return false;
var e = t[v];
return void 0 !== e ? !!e : i(t);
};
r({
target: "Array",
proto: true,
arity: 1,
forced: !m || !p("concat")
}, {
concat: function concat(t) {
var e,
n,
r,
o,
i,
u = a(this),
p = f(u, 0),
d = 0;
for (e = -1, r = arguments.length; e < r; e++) if (y(i = -1 === e ? u : arguments[e])) for (o = c(i), s(d + o), n = 0; n < o; n++, d++) n in i && l(p, d, i[n]);else s(d + 1), l(p, d++, i);
return p.length = d, p;
}
});
},
6932: function _(t, e, n) {
var r = n(9160),
o = n(3364).filter;
r({
target: "Array",
proto: true,
forced: !n(953)("filter")
}, {
filter: function filter(t) {
return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
}
});
},
700: function _(t, e, n) {
var r = n(9160),
o = n(1664),
i = n(5712),
u = n(4096),
a = n(1496),
c = o([].join);
r({
target: "Array",
proto: true,
forced: i !== Object || !a("join", ",")
}, {
join: function join(t) {
return c(u(this), void 0 === t ? "," : t);
}
});
},
4456: function _(t, e, n) {
var r = n(9160),
o = n(3364).map;
r({
target: "Array",
proto: true,
forced: !n(953)("map")
}, {
map: function map(t) {
return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
}
});
},
4728: function _(t, e, n) {
var r = n(9160),
o = n(4356),
i = n(3556),
u = n(6728),
a = n(4316);
r({
target: "Array",
proto: true,
arity: 1,
forced: n(9957)(function () {
return 4294967297 !== [].push.call({
length: 4294967296
}, 1);
}) || !function () {
try {
Object.defineProperty([], "length", {
writable: !1
}).push();
} catch (t) {
return t instanceof TypeError;
}
}()
}, {
push: function push(t) {
var e = o(this),
n = i(e),
r = arguments.length;
a(n + r);
for (var c = 0; c < r; c++) e[n] = arguments[c], n++;
return u(e, n), n;
}
});
},
8752: function _(t, e, n) {
var r = n(9160),
o = n(6420),
i = n(908),
u = n(6488),
a = "WebAssembly",
c = o[a],
s = 7 !== new Error("e", {
cause: 7
}).cause,
l = function l(t, e) {
var n = {};
n[t] = u(t, e, s), r({
global: true,
constructor: true,
arity: 1,
forced: s
}, n);
},
f = function f(t, e) {
if (c && c[t]) {
var n = {};
n[t] = u(a + "." + t, e, s), r({
target: a,
stat: true,
constructor: true,
arity: 1,
forced: s
}, n);
}
};
l("Error", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("EvalError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("RangeError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("ReferenceError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("SyntaxError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("TypeError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), l("URIError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), f("CompileError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), f("LinkError", function (t) {
return function (e) {
return i(t, this, arguments);
};
}), f("RuntimeError", function (t) {
return function (e) {
return i(t, this, arguments);
};
});
},
508: function _(t, e, n) {
var r = n(3476),
o = n(6208).EXISTS,
i = n(1664),
u = n(2544),
a = Function.prototype,
c = i(a.toString),
s = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,
l = i(s.exec);
r && !o && u(a, "name", {
configurable: true,
get: function get() {
try {
return l(s, c(this))[1];
} catch (t) {
return "";
}
}
});
},
232: function _(t, e, n) {
var r = n(9160),
o = n(9292);
r({
target: "Object",
stat: true,
arity: 2,
forced: Object.assign !== o
}, {
assign: o
});
},
5443: function _(t, e, n) {
var r = n(16),
o = n(6076),
i = n(7032);
r || o(Object.prototype, "toString", i, {
unsafe: true
});
},
880: function _(t, e, n) {
var r = n(9160),
o = n(7680);
r({
target: "RegExp",
proto: true,
forced: /./.exec !== o
}, {
exec: o
});
},
9836: function _(t, e, n) {
var r = n(8448),
o = n(7176),
i = n(3951),
u = n(9760),
a = n(7584),
c = n(5016),
s = n(5436),
l = n(4504),
f = n(4764),
p = n(9092);
o("match", function (t, e, n) {
return [function (e) {
var n = s(this),
o = u(e) ? void 0 : l(e, t);
return o ? r(o, e, n) : new RegExp(e)[t](c(n));
}, function (t) {
var r = i(this),
o = c(t),
u = n(e, r, o);
if (u.done) return u.value;
if (!r.global) return p(r, o);
var s = r.unicode;
r.lastIndex = 0;
for (var l, d = [], h = 0; null !== (l = p(r, o));) {
var v = c(l[0]);
d[h] = v, "" === v && (r.lastIndex = f(o, a(r.lastIndex), s)), h++;
}
return 0 === h ? null : d;
}];
});
},
3536: function _(t, e, n) {
var r = n(9160),
o = n(6420),
i = n(6100),
u = n(3951),
a = n(4328),
c = n(7796),
s = n(2544),
l = n(92),
f = n(9957),
p = n(5152),
d = n(9972),
h = n(336).IteratorPrototype,
v = n(3476),
m = n(7048),
y = "constructor",
g = "Iterator",
b = d("toStringTag"),
x = TypeError,
w = o[g],
O = m || !a(w) || w.prototype !== h || !f(function () {
w({});
}),
_ = function _() {
if (i(this, h), c(this) === h) throw new x("Abstract class Iterator not directly constructable");
},
S = function S(t, e) {
v ? s(h, t, {
configurable: true,
get: function get() {
return e;
},
set: function set(e) {
if (u(this), this === h) throw new x("You can't redefine this property");
p(this, t) ? this[t] = e : l(this, t, e);
}
}) : h[t] = e;
};
p(h, b) || S(b, g), !O && p(h, y) && h[y] !== Object || S(y, _), _.prototype = h, r({
global: true,
constructor: true,
forced: O
}, {
Iterator: _
});
},
2144: function _(t, e, n) {
var r = n(9160),
o = n(8448),
i = n(8952),
u = n(3951),
a = n(6752),
c = n(9724),
s = n(8696),
l = n(7048),
f = c(function () {
for (var t, e, n = this.iterator, r = this.predicate, i = this.next;;) {
if (t = u(o(i, n)), this.done = !!t.done) return;
if (e = t.value, s(n, r, [e, this.counter++], true)) return e;
}
});
r({
target: "Iterator",
proto: true,
real: true,
forced: l
}, {
filter: function filter(t) {
return u(this), i(t), new f(a(this), {
predicate: t
});
}
});
},
9080: function _(t, e, n) {
var r = n(9160),
o = n(5792);
r({
target: "Iterator",
proto: true,
real: true,
forced: n(7048)
}, {
map: o
});
}
},
e = {};
function n(r) {
var o = e[r];
if (void 0 !== o) return o.exports;
var i = e[r] = {
exports: {}
};
return t[r].call(i.exports, i, i.exports, n), i.exports;
}
n.d = function (t, e) {
for (var r in e) n.o(e, r) && !n.o(t, r) && Object.defineProperty(t, r, {
enumerable: true,
get: e[r]
});
}, n.g = function () {
if ("object" == typeof globalThis) return globalThis;
try {
return this || new Function("return this")();
} catch (t) {
if ("object" == typeof window) return window;
}
}(), n.o = function (t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
};
var r = {};
return function () {
n.d(r, {
"default": function _default() {
return Q;
}
});
n(8752), n(6932), n(4456), n(508), n(232), n(5443), n(3536), n(2144), n(9080);
var t = function t() {},
e = {},
o = [],
i = [];
function u(n, r) {
var u,
a,
c,
s,
l = i;
for (s = arguments.length; s-- > 2;) o.push(arguments[s]);
for (r && null != r.children && (o.length || o.push(r.children), delete r.children); o.length;) if ((a = o.pop()) && void 0 !== a.pop) for (s = a.length; s--;) o.push(a[s]);else "boolean" == typeof a && (a = null), (c = "function" != typeof n) && (null == a ? a = "" : "number" == typeof a ? a = String(a) : "string" != typeof a && (c = false)), c && u ? l[l.length - 1] += a : l === i ? l = [a] : l.push(a), u = c;
var f = new t();
return f.nodeName = n, f.children = l, f.attributes = null == r ? void 0 : r, f.key = null == r ? void 0 : r.key, void 0 !== e.vnode && e.vnode(f), f;
}
function a(t, e) {
for (var n in e) t[n] = e[n];
return t;
}
function c(t, e) {
t && ("function" == typeof t ? t(e) : t.current = e);
}
var s = "function" == typeof Promise ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;
var l = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,
f = [];
function p(t) {
!t._dirty && (t._dirty = true) && 1 == f.push(t) && (e.debounceRendering || s)(d);
}
function d() {
for (var t; t = f.pop();) t._dirty && T(t);
}
function h(t, e, n) {
return "string" == typeof e || "number" == typeof e ? void 0 !== t.splitText : "string" == typeof e.nodeName ? !t._componentConstructor && v(t, e.nodeName) : n || t._componentConstructor === e.nodeName;
}
function v(t, e) {
return t.normalizedNodeName === e || t.nodeName.toLowerCase() === e.toLowerCase();
}
function m(t) {
var e = a({}, t.attributes);
e.children = t.children;
var n = t.nodeName.defaultProps;
if (void 0 !== n) for (var r in n) void 0 === e[r] && (e[r] = n[r]);
return e;
}
function y(t) {
var e = t.parentNode;
e && e.removeChild(t);
}
function g(t, e, n, r, o) {
if ("className" === e && (e = "class"), "key" === e) ;else if ("ref" === e) c(n, null), c(r, t);else if ("class" !== e || o) {
if ("style" === e) {
if (r && "string" != typeof r && "string" != typeof n || (t.style.cssText = r || ""), r && "object" == typeof r) {
if ("string" != typeof n) for (var i in n) i in r || (t.style[i] = "");
for (var i in r) t.style[i] = "number" == typeof r[i] && false === l.test(i) ? r[i] + "px" : r[i];
}
} else if ("dangerouslySetInnerHTML" === e) r && (t.innerHTML = r.__html || "");else if ("o" == e[0] && "n" == e[1]) {
var u = e !== (e = e.replace(/Capture$/, ""));
e = e.toLowerCase().substring(2), r ? n || t.addEventListener(e, b, u) : t.removeEventListener(e, b, u), (t._listeners || (t._listeners = {}))[e] = r;
} else if ("list" !== e && "type" !== e && !o && e in t) {
try {
t[e] = null == r ? "" : r;
} catch (s) {}
null != r && false !== r || "spellcheck" == e || t.removeAttribute(e);
} else {
var a = o && e !== (e = e.replace(/^xlink:?/, ""));
null == r || false === r ? a ? t.removeAttributeNS("http://www.w3.org/1999/xlink", e.toLowerCase()) : t.removeAttribute(e) : "function" != typeof r && (a ? t.setAttributeNS("http://www.w3.org/1999/xlink", e.toLowerCase(), r) : t.setAttribute(e, r));
}
} else t.className = r || "";
}
function b(t) {
return this._listeners[t.type](e.event && e.event(t) || t);
}
var x = [],
w = 0,
O = false,
_ = false;
function S() {
for (var t; t = x.shift();) e.afterMount && e.afterMount(t), t.componentDidMount && t.componentDidMount();
}
function C(t, e, n, r, o, i) {
w++ || (O = null != o && void 0 !== o.ownerSVGElement, _ = null != t && !("__preactattr_" in t));
var u = E(t, e, n, r, i);
return o && u.parentNode !== o && o.appendChild(u), --w || (_ = false, i || S()), u;
}
function E(t, e, n, r, o) {
var i = t,
u = O;
if (null != e && "boolean" != typeof e || (e = ""), "string" == typeof e || "number" == typeof e) return t && void 0 !== t.splitText && t.parentNode && (!t._component || o) ? t.nodeValue != e && (t.nodeValue = e) : (i = document.createTextNode(e), t && (t.parentNode && t.parentNode.replaceChild(i, t), I(t, true))), i.__preactattr_ = true, i;
var a,
c,
s = e.nodeName;
if ("function" == typeof s) return function (t, e, n, r) {
var o = t && t._component,
i = o,
u = t,
a = o && t._componentConstructor === e.nodeName,
c = a,
s = m(e);
for (; o && !c && (o = o._parentComponent);) c = o.constructor === e.nodeName;
o && c && (!r || o._component) ? (k(o, s, 3, n, r), t = o.base) : (i && !a && (R(i), t = u = null), o = P(e.nodeName, s, n), t && !o.nextBase && (o.nextBase = t, u = null), k(o, s, 1, n, r), t = o.base, u && t !== u && (u._component = null, I(u, false)));
return t;
}(t, e, n, r);
if (O = "svg" === s || "foreignObject" !== s && O, s = String(s), (!t || !v(t, s)) && (a = s, (c = O ? document.createElementNS("http://www.w3.org/2000/svg", a) : document.createElement(a)).normalizedNodeName = a, i = c, t)) {
for (; t.firstChild;) i.appendChild(t.firstChild);
t.parentNode && t.parentNode.replaceChild(i, t), I(t, true);
}
var l = i.firstChild,
f = i.__preactattr_,
p = e.children;
if (null == f) {
f = i.__preactattr_ = {};
for (var d = i.attributes, b = d.length; b--;) f[d[b].name] = d[b].value;
}
return !_ && p && 1 === p.length && "string" == typeof p[0] && null != l && void 0 !== l.splitText && null == l.nextSibling ? l.nodeValue != p[0] && (l.nodeValue = p[0]) : (p && p.length || null != l) && function (t, e, n, r, o) {
var i,
u,
a,
c,
s,
l = t.childNodes,
f = [],
p = {},
d = 0,
v = 0,
m = l.length,
g = 0,
b = e ? e.length : 0;
if (0 !== m) for (var x = 0; x < m; x++) {
var w = l[x],
O = w.__preactattr_;
null != (_ = b && O ? w._component ? w._component.__key : O.key : null) ? (d++, p[_] = w) : (O || (void 0 !== w.splitText ? !o || w.nodeValue.trim() : o)) && (f[g++] = w);
}
if (0 !== b) for (x = 0; x < b; x++) {
var _;
if (s = null, null != (_ = (c = e[x]).key)) d && void 0 !== p[_] && (s = p[_], p[_] = void 0, d--);else if (v < g) for (i = v; i < g; i++) if (void 0 !== f[i] && h(u = f[i], c, o)) {
s = u, f[i] = void 0, i === g - 1 && g--, i === v && v++;
break;
}
s = E(s, c, n, r), a = l[x], s && s !== t && s !== a && (null == a ? t.appendChild(s) : s === a.nextSibling ? y(a) : t.insertBefore(s, a));
}
if (d) for (var x in p) void 0 !== p[x] && I(p[x], false);
for (; v <= g;) void 0 !== (s = f[g--]) && I(s, false);
}(i, p, n, r, _ || null != f.dangerouslySetInnerHTML), function (t, e, n) {
var r;
for (r in n) e && null != e[r] || null == n[r] || g(t, r, n[r], n[r] = void 0, O);
for (r in e) "children" === r || "innerHTML" === r || r in n && e[r] === ("value" === r || "checked" === r ? t[r] : n[r]) || g(t, r, n[r], n[r] = e[r], O);
}(i, e.attributes, f), O = u, i;
}
function I(t, e) {
var n = t._component;
n ? R(n) : (null != t.__preactattr_ && c(t.__preactattr_.ref, null), false !== e && null != t.__preactattr_ || y(t), j(t));
}
function j(t) {
for (t = t.lastChild; t;) {
var e = t.previousSibling;
I(t, true), t = e;
}
}
var A = [];
function P(t, e, n) {
var r,
o = A.length;
for (t.prototype && t.prototype.render ? (r = new t(e, n), M.call(r, e, n)) : ((r = new M(e, n)).constructor = t, r.render = N); o--;) if (A[o].constructor === t) return r.nextBase = A[o].nextBase, A.splice(o, 1), r;
return r;
}
function N(t, e, n) {
return this.constructor(t, n);
}
function k(t, n, r, o, i) {
t._disable || (t._disable = true, t.__ref = n.ref, t.__key = n.key, delete n.ref, delete n.key, void 0 === t.constructor.getDerivedStateFromProps && (!t.base || i ? t.componentWillMount && t.componentWillMount() : t.componentWillReceiveProps && t.componentWillReceiveProps(n, o)), o && o !== t.context && (t.prevContext || (t.prevContext = t.context), t.context = o), t.prevProps || (t.prevProps = t.props), t.props = n, t._disable = false, 0 !== r && (1 !== r && false === e.syncComponentUpdates && t.base ? p(t) : T(t, 1, i)), c(t.__ref, t));
}
function T(t, n, r, o) {
if (!t._disable) {
var i,
u,
c,
s = t.props,
l = t.state,
f = t.context,
p = t.prevProps || s,
d = t.prevState || l,
h = t.prevContext || f,
v = t.base,
y = t.nextBase,
g = v || y,
b = t._component,
O = false,
_ = h;
if (t.constructor.getDerivedStateFromProps && (l = a(a({}, l), t.constructor.getDerivedStateFromProps(s, l)), t.state = l), v && (t.props = p, t.state = d, t.context = h, 2 !== n && t.shouldComponentUpdate && false === t.shouldComponentUpdate(s, l, f) ? O = true : t.componentWillUpdate && t.componentWillUpdate(s, l, f), t.props = s, t.state = l, t.context = f), t.prevProps = t.prevState = t.prevContext = t.nextBase = null, t._dirty = false, !O) {
i = t.render(s, l, f), t.getChildContext && (f = a(a({}, f), t.getChildContext())), v && t.getSnapshotBeforeUpdate && (_ = t.getSnapshotBeforeUpdate(p, d));
var E,
j,
A = i && i.nodeName;
if ("function" == typeof A) {
var N = m(i);
(u = b) && u.constructor === A && N.key == u.__key ? k(u, N, 1, f, false) : (E = u, t._component = u = P(A, N, f), u.nextBase = u.nextBase || y, u._parentComponent = t, k(u, N, 0, f, false), T(u, 1, r, true)), j = u.base;
} else c = g, (E = b) && (c = t._component = null), (g || 1 === n) && (c && (c._component = null), j = C(c, i, f, r || !v, g && g.parentNode, true));
if (g && j !== g && u !== b) {
var M = g.parentNode;
M && j !== M && (M.replaceChild(j, g), E || (g._component = null, I(g, false)));
}
if (E && R(E), t.base = j, j && !o) {
for (var L = t, D = t; D = D._parentComponent;) (L = D).base = j;
j._component = L, j._componentConstructor = L.constructor;
}
}
for (!v || r ? x.push(t) : O || (t.componentDidUpdate && t.componentDidUpdate(p, d, _), e.afterUpdate && e.afterUpdate(t)); t._renderCallbacks.length;) t._renderCallbacks.pop().call(t);
w || o || S();
}
}
function R(t) {
e.beforeUnmount && e.beforeUnmount(t);
var n = t.base;
t._disable = true, t.componentWillUnmount && t.componentWillUnmount(), t.base = null;
var r = t._component;
r ? R(r) : n && (null != n.__preactattr_ && c(n.__preactattr_.ref, null), t.nextBase = n, y(n), A.push(t), j(n)), c(t.__ref, null);
}
function M(t, e) {
this._dirty = true, this.context = e, this.props = t, this.state = this.state || {}, this._renderCallbacks = [];
}
function L(t, e, n) {
return C(n, t, {}, false, e, false);
}
a(M.prototype, {
setState: function setState(t, e) {
this.prevState || (this.prevState = this.state), this.state = a(a({}, this.state), "function" == typeof t ? t(this.state, this.props) : t), e && this._renderCallbacks.push(e), p(this);
},
forceUpdate: function forceUpdate(t) {
t && this._renderCallbacks.push(t), T(this, 2);
},
render: function render() {}
});
n(700), n(4728), n(880), n(9836), n(7476);
function D(t, e) {
return D = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, D(t, e);
}
var B = function (t) {
var e, n;
function r() {
for (var e, n = arguments.length, r = new Array(n), o = 0; o < n; o++) r[o] = arguments[o];
return (e = t.call.apply(t, [this].concat(r)) || this).state = {
bump: false,
debounced: false
}, e;
}
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, D(e, n);
var o = r.prototype;
return o.componentWillMount = function () {
var t,
e,
r,
o = this;
this.debounceStatusUpdate = (t = function t() {
if (!o.state.debounced) {
var t = !o.props.isInFocus || o.props.validChoiceMade;
o.setState(function (e) {
return {
bump: !e.bump,
debounced: true,
silenced: t
};
});
}
}, e = 1400, function () {
var o = this,
i = arguments;
clearTimeout(r), r = setTimeout(function () {
r = null, t.apply(o, i);
}, e);
});
}, o.componentWillReceiveProps = function (t) {
t.queryLength;
this.setState({
debounced: false
});
}, o.render = function () {
var t = this.props,
e = t.id,
n = t.length,
r = t.queryLength,
o = t.minQueryLength,
i = t.selectedOption,
a = t.selectedOptionIndex,
c = t.tQueryTooShort,
s = t.tNoResults,
l = t.tSelectedOption,
f = t.tResults,
p = t.className,
d = this.state,
h = d.bump,
v = d.debounced,
m = d.silenced,
y = r < o,
g = 0 === n,
b = i ? l(i, n, a) : "",
x = null;
return x = y ? c(o) : g ? s() : f(n, b), this.debounceStatusUpdate(), u("div", {
className: p,
style: {
border: "0",
clip: "rect(0 0 0 0)",
height: "1px",
marginBottom: "-1px",
marginRight: "-1px",
overflow: "hidden",
padding: "0",
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
}
}, u("div", {
id: e + "__status--A",
role: "status",
"aria-atomic": "true",
"aria-live": "polite"
}, !m && v && h ? x : ""), u("div", {
id: e + "__status--B",
role: "status",
"aria-atomic": "true",
"aria-live": "polite"
}, m || !v || h ? "" : x));
}, r;
}(M);
B.defaultProps = {
tQueryTooShort: function tQueryTooShort(t) {
return "Type in " + t + " or more characters for results";
},
tNoResults: function tNoResults() {
return "No search results";
},
tSelectedOption: function tSelectedOption(t, e, n) {
return t + " " + (n + 1) + " of " + e + " is highlighted";
},
tResults: function tResults(t, e) {
return t + " " + (1 === t ? "result" : "results") + " " + (1 === t ? "is" : "are") + " available. " + e;
}
};
var F = function F(t) {
return u("svg", {
version: "1.1",
xmlns: "http://www.w3.org/2000/svg",
className: t.className,
focusable: "false"
}, u("g", {
stroke: "none",
fill: "none",
"fill-rule": "evenodd"
}, u("polygon", {
fill: "#000000",
points: "0 0 22 0 11 17"
})));
};
function U() {
return U = Object.assign ? Object.assign.bind() : function (t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e];
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
}
return t;
}, U.apply(this, arguments);
}
function V(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function q(t, e) {
return q = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, q(t, e);
}
var W = {
13: "enter",
27: "escape",
32: "space",
38: "up",
40: "down"
};
function H() {
return "undefined" != typeof navigator && !(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g) || !navigator.userAgent.match(/AppleWebKit/g));
}
var K = function (t) {
var e, n;
function r(e) {
var n;
return (n = t.call(this, e) || this).elementReferences = {}, n.state = {
focused: null,
hovered: null,
menuOpen: false,
options: e.defaultValue ? [e.defaultValue] : [],
query: e.defaultValue,
validChoiceMade: false,
selected: null,
ariaHint: true
}, n.handleComponentBlur = n.handleComponentBlur.bind(V(n)), n.handleKeyDown = n.handleKeyDown.bind(V(n)), n.handleUpArrow = n.handleUpArrow.bind(V(n)), n.handleDownArrow = n.handleDownArrow.bind(V(n)), n.handleEnter = n.handleEnter.bind(V(n)), n.handlePrintableKey = n.handlePrintableKey.bind(V(n)), n.handleListMouseLeave = n.handleListMouseLeave.bind(V(n)), n.handleOptionBlur = n.handleOptionBlur.bind(V(n)), n.handleOptionClick = n.handleOptionClick.bind(V(n)), n.handleOptionFocus = n.handleOptionFocus.bind(V(n)), n.handleOptionMouseDown = n.handleOptionMouseDown.bind(V(n)), n.handleOptionMouseEnter = n.handleOptionMouseEnter.bind(V(n)), n.handleInputBlur = n.handleInputBlur.bind(V(n)), n.handleInputChange = n.handleInputChange.bind(V(n)), n.handleInputClick = n.handleInputClick.bind(V(n)), n.handleInputFocus = n.handleInputFocus.bind(V(n)), n.pollInputElement = n.pollInputElement.bind(V(n)), n.getDirectInputChanges = n.getDirectInputChanges.bind(V(n)), n;
}
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, q(e, n);
var o = r.prototype;
return o.isQueryAnOption = function (t, e) {
var n = this;
return -1 !== e.map(function (t) {
return n.templateInputValue(t).toLowerCase();
}).indexOf(t.toLowerCase());
}, o.componentDidMount = function () {
this.pollInputElement();
}, o.componentWillUnmount = function () {
clearTimeout(this.$pollInput);
}, o.pollInputElement = function () {
var t = this;
this.getDirectInputChanges(), this.$pollInput = setTimeout(function () {
t.pollInputElement();
}, 100);
}, o.getDirectInputChanges = function () {
var t = this.elementReferences[-1];
t && t.value !== this.state.query && this.handleInputChange({
target: {
value: t.value
}
});
}, o.componentDidUpdate = function (t, e) {
var n = this.state.focused,
r = null === n,
o = e.focused !== n;
o && !r && this.elementReferences[n].focus();
var i = -1 === n,
u = o && null === e.focused;
if (i && u) {
var a = this.elementReferences[n];
a.setSelectionRange(0, a.value.length);
}
}, o.hasAutoselect = function () {
return !H() && this.props.autoselect;
}, o.templateInputValue = function (t) {
var e = this.props.templates && this.props.templates.inputValue;
return e ? e(t) : t;
}, o.templateSuggestion = function (t) {
var e = this.props.templates && this.props.templates.suggestion;
return e ? e(t) : t;
}, o.handleComponentBlur = function (t) {
var e,
n = this.state,
r = n.options,
o = n.query,
i = n.selected;
this.props.confirmOnBlur ? (e = t.query || o, this.props.onConfirm(r[i])) : e = o, this.setState({
focused: null,
menuOpen: t.menuOpen || false,
query: e,
selected: null,
validChoiceMade: this.isQueryAnOption(e, r)
});
}, o.handleListMouseLeave = function (t) {
this.setState({
hovered: null
});
}, o.handleOptionBlur = function (t, e) {
var n = this.state,
r = n.focused,
o = n.menuOpen,
i = n.options,
u = n.selected,
a = null === t.relatedTarget,
c = t.relatedTarget === this.elementReferences[-1],
s = r !== e && -1 !== r;
if (!s && a || !(s || c)) {
var l = o && H();
this.handleComponentBlur({
menuOpen: l,
query: this.templateInputValue(i[u])
});
}
}, o.handleInputBlur = function (t) {
var e = this.state,
n = e.focused,
r = e.menuOpen,
o = e.options,
i = e.query,
u = e.selected;
if (!(-1 !== n)) {
var a = r && H(),
c = H() ? i : this.templateInputValue(o[u]);
this.handleComponentBlur({
menuOpen: a,
query: c
});
}
}, o.handleInputChange = function (t) {
var e = this,
n = this.props,
r = n.minLength,
o = n.source,
i = n.showAllValues,
u = this.hasAutoselect(),
a = t.target.value,
c = 0 === a.length,
s = this.state.query !== a,
l = a.length >= r;
this.setState({
query: a,
ariaHint: c
}), i || !c && s && l ? o(a, function (t) {
var n = t.length > 0;
e.setState({
menuOpen: n,
options: t,
selected: u && n ? 0 : -1,
validChoiceMade: false
});
}) : !c && l || this.setState({
menuOpen: false,
options: []
});
}, o.handleInputClick = function (t) {
this.handleInputChange(t);
}, o.handleInputFocus = function (t) {
var e = this.state,
n = e.query,
r = e.validChoiceMade,
o = e.options,
i = this.props.minLength,
u = !r && n.length >= i && o.length > 0;
u ? this.setState(function (t) {
var e = t.menuOpen;
return {
focused: -1,
menuOpen: u || e,
selected: -1
};
}) : this.setState({
focused: -1
});
}, o.handleOptionFocus = function (t) {
this.setState({
focused: t,
hovered: null,
selected: t
});
}, o.handleOptionMouseEnter = function (t, e) {
H() || this.setState({
hovered: e
});
}, o.handleOptionClick = function (t, e) {
var n = this.state.options[e],
r = this.templateInputValue(n);
this.props.onConfirm(n), this.setState({
focused: -1,
hovered: null,
menuOpen: false,
query: r,
selected: -1,
validChoiceMade: true
}), this.forceUpdate();
}, o.handleOptionMouseDown = function (t) {
t.preventDefault();
}, o.handleUpArrow = function (t) {
t.preventDefault();
var e = this.state,
n = e.menuOpen,
r = e.selected;
-1 !== r && n && this.handleOptionFocus(r - 1);
}, o.handleDownArrow = function (t) {
var e = this;
if (t.preventDefault(), this.props.showAllValues && false === this.state.menuOpen) t.preventDefault(), this.props.source("", function (t) {
e.setState({
menuOpen: true,
options: t,
selected: 0,
focused: 0,
hovered: null
});
});else if (true === this.state.menuOpen) {
var n = this.state,
r = n.menuOpen,
o = n.options,
i = n.selected;
i !== o.length - 1 && r && this.handleOptionFocus(i + 1);
}
}, o.handleSpace = function (t) {
var e = this;
this.props.showAllValues && false === this.state.menuOpen && "" === this.state.query && (t.preventDefault(), this.props.source("", function (t) {
e.setState({
menuOpen: true,
options: t
});
})), -1 !== this.state.focused && (t.preventDefault(), this.handleOptionClick(t, this.state.focused));
}, o.handleEnter = function (t) {
this.state.menuOpen && (t.preventDefault(), this.state.selected >= 0 && this.handleOptionClick(t, this.state.selected));
}, o.handlePrintableKey = function (t) {
var e = this.elementReferences[-1];
t.target === e || e.focus();
}, o.handleKeyDown = function (t) {
switch (W[t.keyCode]) {
case "up":
this.handleUpArrow(t);
break;
case "down":
this.handleDownArrow(t);
break;
case "space":
this.handleSpace(t);
break;
case "enter":
this.handleEnter(t);
break;
case "escape":
this.handleComponentBlur({
query: this.state.query
});
break;
default:
((e = t.keyCode) > 47 && e < 58 || 32 === e || 8 === e || e > 64 && e < 91 || e > 95 && e < 112 || e > 185 && e < 193 || e > 218 && e < 223) && this.handlePrintableKey(t);
}
var e;
}, o.render = function () {
var t,
e = this,
n = this.props,
r = n.cssNamespace,
o = n.displayMenu,
i = n.id,
a = n.minLength,
c = n.name,
s = n.placeholder,
l = n.required,
f = n.showAllValues,
p = n.tNoResults,
d = n.tStatusQueryTooShort,
h = n.tStatusNoResults,
v = n.tStatusSelectedOption,
m = n.tStatusResults,
y = n.tAssistiveHint,
g = n.dropdownArrow,
b = n.menuAttributes,
x = n.inputClasses,
w = n.hintClasses,
O = n.menuClasses,
_ = this.state,
S = _.focused,
C = _.hovered,
E = _.menuOpen,
I = _.options,
j = _.query,
A = _.selected,
P = _.ariaHint,
N = _.validChoiceMade,
k = this.hasAutoselect(),
T = -1 === S,
R = 0 === I.length,
M = 0 !== j.length,
L = j.length >= a,
D = this.props.showNoOptionsFound && T && R && M && L,
F = r + "__wrapper",
V = r + "__status",
q = r + "__dropdown-arrow-down",
W = -1 !== S && null !== S,
K = r + "__option",
z = r + "__hint",
G = this.templateInputValue(I[A]),
Q = G && 0 === G.toLowerCase().indexOf(j.toLowerCase()) && k ? j + G.substr(j.length) : "",
$ = i + "__assistiveHint",
Y = {
"aria-describedby": P ? $ : null,
"aria-expanded": E ? "true" : "false",
"aria-activedescendant": W ? i + "__option--" + S : null,
"aria-controls": i + "__listbox",
"aria-autocomplete": this.hasAutoselect() ? "both" : "list"
};
f && "string" == typeof (t = g({
className: q
})) && (t = u("div", {
className: r + "__dropdown-arrow-down-wrapper",
dangerouslySetInnerHTML: {
__html: t
}
}));
var X = r + "__input",
J = [X, this.props.showAllValues ? X + "--show-all-values" : X + "--default"];
null !== S && J.push(X + "--focused"), x && J.push(x);
var Z = r + "__menu",
tt = [Z, Z + "--" + o, Z + "--" + (E || D ? "visible" : "hidden")];
O && tt.push(O), (null != b && b["class"] || null != b && b.className) && tt.push((null == b ? void 0 : b["class"]) || (null == b ? void 0 : b.className));
var et = Object.assign({
"aria-labelledby": i
}, b, {
id: i + "__listbox",
role: "listbox",
className: tt.join(" "),
onMouseLeave: this.handleListMouseLeave
});
return delete et["class"], u("div", {
className: F,
onKeyDown: this.handleKeyDown
}, u(B, {
id: i,
length: I.length,
queryLength: j.length,
minQueryLength: a,
selectedOption: this.templateInputValue(I[A]),
selectedOptionIndex: A,
validChoiceMade: N,
isInFocus: null !== this.state.focused,
tQueryTooShort: d,
tNoResults: h,
tSelectedOption: v,
tResults: m,
className: V
}), Q && u("span", null, u("input", {
className: [z, null === w ? x : w].filter(Boolean).join(" "),
readonly: true,
tabIndex: "-1",
value: Q
})), u("input", U({}, Y, {
autoComplete: "off",
className: J.join(" "),
id: i,
onClick: this.handleInputClick,
onBlur: this.handleInputBlur
}, {
onInput: this.handleInputChange
}, {
onFocus: this.handleInputFocus,
name: c,
placeholder: s,
ref: function ref(t) {
e.elementReferences[-1] = t;
},
type: "text",
role: "combobox",
required: l,
value: j
})), t, u("ul", et, I.map(function (t, n) {
var r = (-1 === S ? A === n : S === n) && null === C ? " " + K + "--focused" : "",
o = n % 2 ? " " + K + "--odd" : "",
a = H() ? "<span id=" + i + "__option-suffix--" + n + ' style="border:0;clip:rect(0 0 0 0);height:1px;marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;whiteSpace:nowrap;width:1px"> ' + (n + 1) + " of " + I.length + "</span>" : "";
return u("li", {
"aria-selected": S === n ? "true" : "false",
className: "" + K + r + o,
dangerouslySetInnerHTML: {
__html: e.templateSuggestion(t) + a
},
id: i + "__option--" + n,
key: n,
onBlur: function onBlur(t) {
return e.handleOptionBlur(t, n);
},
onClick: function onClick(t) {
return e.handleOptionClick(t, n);
},
onMouseDown: e.handleOptionMouseDown,
onMouseEnter: function onMouseEnter(t) {
return e.handleOptionMouseEnter(t, n);
},
ref: function ref(t) {
e.elementReferences[n] = t;
},
role: "option",
tabIndex: "-1",
"aria-posinset": n + 1,
"aria-setsize": I.length
});
}), D && u("li", {
className: K + " " + K + "--no-results",
role: "option",
"aria-disabled": "true"
}, p())), u("span", {
id: $,
style: {
display: "none"
}
}, y()));
}, r;
}(M);
function z(t) {
if (!t.element) throw new Error("element is not defined");
if (!t.id) throw new Error("id is not defined");
if (!t.source) throw new Error("source is not defined");
Array.isArray(t.source) && (t.source = G(t.source)), L(u(K, t), t.element);
}
K.defaultProps = {
autoselect: false,
cssNamespace: "autocomplete",
defaultValue: "",
displayMenu: "inline",
minLength: 0,
name: "input-autocomplete",
placeholder: "",
onConfirm: function onConfirm() {},
confirmOnBlur: true,
showNoOptionsFound: true,
showAllValues: false,
required: false,
tNoResults: function tNoResults() {
return "No results found";
},
tAssistiveHint: function tAssistiveHint() {
return "When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.";
},
dropdownArrow: F,
menuAttributes: {},
inputClasses: null,
hintClasses: null,
menuClasses: null
};
var G = function G(t) {
return function (e, n) {
n(t.filter(function (t) {
return -1 !== t.toLowerCase().indexOf(e.toLowerCase());
}));
};
};
z.enhanceSelectElement = function (t) {
if (!t.selectElement) throw new Error("selectElement is not defined");
if (!t.source) {
var e = [].filter.call(t.selectElement.options, function (e) {
return e.value || t.preserveNullOptions;
});
t.source = e.map(function (t) {
return t.textContent || t.innerText;
});
}
if (t.onConfirm = t.onConfirm || function (e) {
var n = [].filter.call(t.selectElement.options, function (t) {
return (t.textContent || t.innerText) === e;
})[0];
n && (n.selected = true);
}, t.selectElement.value || void 0 === t.defaultValue) {
var n = t.selectElement.options[t.selectElement.options.selectedIndex];
t.defaultValue = n.textContent || n.innerText;
}
void 0 === t.name && (t.name = ""), void 0 === t.id && (void 0 === t.selectElement.id ? t.id = "" : t.id = t.selectElement.id), void 0 === t.autoselect && (t.autoselect = true);
var r = document.createElement("div");
t.selectElement.parentNode.insertBefore(r, t.selectElement), z(Object.assign({}, t, {
element: r
})), t.selectElement.style.display = "none", t.selectElement.id = t.selectElement.id + "-select";
};
var Q = z;
}(), r = r["default"];
}();
});
} (accessibleAutocomplete_min));
return accessibleAutocomplete_min.exports;
}
var accessibleAutocomplete_minExports = requireAccessibleAutocomplete_min();
var accessibleAutocomplete = /*@__PURE__*/getDefaultExportFromCjs(accessibleAutocomplete_minExports);
class SelectCountryFromForm {
static moduleName = 'dm-select-country-from-form';
$module;
constructor($module) {
this.$module = $module;
}
init() {
accessibleAutocomplete.enhanceSelectElement({
selectElement: this.$module.get(0)
});
}
}
const createAll = (Component) => {
$(`[data-module="${Component.moduleName}"]`).each((_index, componentElement) => {
new Component($(componentElement)).init();
});
};
const initAll = () => {
const components = [
ComplianceCommunicationAttachments,
CookieSettings,
CookieBanner,
ListInput,
OptionSelect,
QuestionCheckboxTree,
QuestionList,
QuestionListMultiquestionClientSide,
Question,
SearchBox,
SelectCountryFromForm
];
components.forEach((Component) => {
createAll(Component);
});
initGoogleAnalytics();
};
export { ComplianceCommunicationAttachments, CookieBanner, CookieSettings, ListInput, OptionSelect, Question, QuestionCheckboxTree, QuestionList, QuestionListMultiquestionClientSide, SearchBox, SelectCountryFromForm, createAll, initAll, initGoogleAnalytics, version };
//# sourceMappingURL=all.bundle.mjs.map