@nationalarchives/frontend 0.44.0 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nationalarchives/all+analytics.js +1 -2
- package/nationalarchives/all+analytics.js.map +1 -1
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -2
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/analytics.js +1 -1
- package/nationalarchives/analytics.js.map +1 -1
- package/nationalarchives/components/accordion/accordion.js +1 -1
- package/nationalarchives/components/accordion/accordion.js.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/nationalarchives/components/code-block/code-block.js +1 -2
- package/nationalarchives/components/code-block/code-block.js.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
- package/nationalarchives/components/date-input/date-input.js +1 -1
- package/nationalarchives/components/date-input/date-input.js.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.js +1 -1
- package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
- package/nationalarchives/components/file-input/file-input.js +1 -1
- package/nationalarchives/components/file-input/file-input.js.map +1 -1
- package/nationalarchives/components/footer/footer.js +1 -1
- package/nationalarchives/components/footer/footer.js.map +1 -1
- package/nationalarchives/components/gallery/gallery.js +1 -1
- package/nationalarchives/components/gallery/gallery.js.map +1 -1
- package/nationalarchives/components/global-header/global-header.js +1 -1
- package/nationalarchives/components/global-header/global-header.js.map +1 -1
- package/nationalarchives/components/header/header.js +1 -1
- package/nationalarchives/components/header/header.js.map +1 -1
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +3 -3
- package/nationalarchives/components/picture/picture.js +1 -1
- package/nationalarchives/components/picture/picture.js.map +1 -1
- package/nationalarchives/components/sidebar/sidebar.js +1 -1
- package/nationalarchives/components/sidebar/sidebar.js.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.js +1 -1
- package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
- package/nationalarchives/components/tabs/tabs.js +1 -1
- package/nationalarchives/components/tabs/tabs.js.map +1 -1
- package/nationalarchives/components/text-input/text-input.js +1 -1
- package/nationalarchives/components/text-input/text-input.js.map +1 -1
- package/nationalarchives/components/textarea/textarea.js +1 -1
- package/nationalarchives/components/textarea/textarea.js.map +1 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/package.json +3 -3
- package/nationalarchives/all+analytics.js.LICENSE.txt +0 -1
- package/nationalarchives/all.js.LICENSE.txt +0 -1
- package/nationalarchives/components/code-block/code-block.js.LICENSE.txt +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/date-input/date-input.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,8jDCTDC,EAAAC,QAAOC,0BAAPF,EAAOE,wBAA4B,MAE5B,MAAMC,EAAkB,WAa5B,SARD,SAAAA,IAA2B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAEf,+FAFuBG,CAAAC,KAAAN,GAAAO,EAAAD,KAAA,SAJhB,CAAC,GAACC,EAAAD,KAAA,gBACK,CAAC,GAACC,EAAAD,KAAA,SACV,GAGNA,KAAKL,MAAQA,EACTH,OAAOC,wBAGT,OAFAO,KAAKE,IAAI,mDAEFV,OAAOC,wBAEhBD,OAAOC,wBAA0BO,IACnC,IAAC,EAAAG,IAAA,MAAAC,MAED,WACE,GAAIJ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KmI,YAAYc,gBAAgB,SAErC,GAAC,CAAA9I,IAAA,UAAAC,MAED,WACMJ,KAAKmI,aACPnI,KAAKmI,YAAYe,aAAa,SAAU,GAE5C,mFAAC,CA5H8B","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/date-input/date-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) === value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.log(\"Accepting policy:\", policy);\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.log(\"Rejecting policy:\", policy);\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.log(\"Saving policies:\", policies);\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.log(`Adding event listener for: ${event}`);\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.log(`Adding one-time event listener for: ${event}`);\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class DateInputProgressive {\n constructor($module) {\n this.$module = $module;\n this.$yearWrapper =\n $module && $module.querySelector(\".tna-date-input__item--year\");\n this.$yearInput =\n this.$yearWrapper && this.$yearWrapper.querySelector(\"input\");\n this.$monthWrapper =\n $module && $module.querySelector(\".tna-date-input__item--month\");\n this.$monthInput =\n this.$monthWrapper && this.$monthWrapper.querySelector(\"input\");\n this.$dayWrapper =\n $module && $module.querySelector(\".tna-date-input__item--day\");\n this.$dayInput =\n this.$dayWrapper && this.$dayWrapper.querySelector(\"input\");\n\n if (!this.$module) {\n return;\n }\n\n this.update();\n window.addEventListener(\"pageshow\", () => this.update());\n\n if (this.$yearInput) {\n this.$yearInput.addEventListener(\"keyup\", () => this.update());\n this.$yearInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$monthInput) {\n this.$monthInput.addEventListener(\"keyup\", () => this.update());\n this.$monthInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$dayInput) {\n this.$dayInput.addEventListener(\"keyup\", () => this.update());\n this.$dayInput.addEventListener(\"change\", () => this.update());\n }\n }\n\n update() {\n if (this.isValidYear()) {\n this.showMonth();\n if (this.isValidMonth()) {\n this.showDay();\n } else {\n this.hideDay();\n }\n } else {\n this.hideMonth();\n this.hideDay();\n }\n }\n\n isValidYear() {\n if (!this.$yearInput) {\n return true;\n }\n const yearValue = parseInt(this.$yearInput.value.trim(), 10);\n /* eslint-disable-next-line no-magic-numbers */\n return !isNaN(this.$yearInput.value) && !isNaN(yearValue) && yearValue > 0;\n }\n\n isValidMonth() {\n if (!this.$monthInput) {\n return true;\n }\n const monthRawValue = this.$monthInput.value.trim();\n const monthIntValue = parseInt(monthRawValue, 10);\n const validMonthStrings = [\n \"january\",\n \"february\",\n \"march\",\n \"april\",\n \"may\",\n \"june\",\n \"july\",\n \"august\",\n \"september\",\n \"october\",\n \"november\",\n \"december\",\n \"jan\",\n \"feb\",\n \"mar\",\n \"apr\",\n \"jun\",\n \"jul\",\n \"aug\",\n \"sep\",\n \"oct\",\n \"nov\",\n \"dec\",\n ];\n return (\n (!isNaN(this.$monthInput.value) &&\n !isNaN(monthIntValue) &&\n /* eslint-disable-next-line no-magic-numbers */\n monthIntValue > 0 &&\n /* eslint-disable-next-line no-magic-numbers */\n monthIntValue <= 12) ||\n validMonthStrings.includes(monthRawValue.toLowerCase())\n );\n }\n\n showMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n\n showDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","_window","window","TNAFrontendCookieEvents","CookieEventHandler","debug","arguments","length","undefined","_classCallCheck","this","_defineProperty","log","key","value","_console","_len","args","Array","_key","console","apply","concat","event","callback","Object","hasOwn","events","_toConsumableArray","oneTimeEvents","_this","data","forEach","eventToTrigger","call","eventIndex","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","options","document","documentElement","dataset","tnaFrontendDebug","defaultDomain","defaultPath","secure","policiesKey","defaultAge","_options$newInstance","newInstance","_options$noInit","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","parseInt","tnaCookiesDefaultAge","policiesCorrectOnInit","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","_objectSpread","usage","settings","marketing","essential","all","get","deserialised","cookie","split","trim","_parts","_slicedToArray","decodeURIComponent","JSON","parse","error","exists","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain","domain","_options$path","path","_options$secure","_options$session","session","secureString","sessionString","encodeURIComponent","trigger","set","_this2","setPolicy","accepted","allPolicies","toLowerCase","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","DateInputProgressive","$module","$yearWrapper","querySelector","$yearInput","$monthWrapper","$monthInput","$dayWrapper","$dayInput","update","addEventListener","isValidYear","showMonth","isValidMonth","showDay","hideDay","hideMonth","yearValue","isNaN","monthRawValue","monthIntValue","removeAttribute","setAttribute"],"sourceRoot":""}
|
|
1
|
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,MACA,OACA,OACA,SACA,YACA,UACA,WACA,WACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OASkBvF,SAASsF,EAAczC,cAE7C,CAEA,SAAAkC,GACM9H,KAAKuH,eACPvH,KAAKuH,cAAcgB,gBAAgB,SAEvC,CAEA,SAAAL,GACMlI,KAAKuH,eACPvH,KAAKuH,cAAciB,aAAa,SAAU,GAE9C,CAEA,OAAAR,GACMhI,KAAKyH,aACPzH,KAAKyH,YAAYc,gBAAgB,SAErC,CAEA,OAAAN,GACMjI,KAAKyH,aACPzH,KAAKyH,YAAYe,aAAa,SAAU,GAE5C","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/date-input/date-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) === value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.log(\"Accepting policy:\", policy);\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.log(\"Rejecting policy:\", policy);\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.log(\"Saving policies:\", policies);\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.log(`Adding event listener for: ${event}`);\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.log(`Adding one-time event listener for: ${event}`);\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class DateInputProgressive {\n constructor($module) {\n this.$module = $module;\n this.$yearWrapper =\n $module && $module.querySelector(\".tna-date-input__item--year\");\n this.$yearInput =\n this.$yearWrapper && this.$yearWrapper.querySelector(\"input\");\n this.$monthWrapper =\n $module && $module.querySelector(\".tna-date-input__item--month\");\n this.$monthInput =\n this.$monthWrapper && this.$monthWrapper.querySelector(\"input\");\n this.$dayWrapper =\n $module && $module.querySelector(\".tna-date-input__item--day\");\n this.$dayInput =\n this.$dayWrapper && this.$dayWrapper.querySelector(\"input\");\n\n if (!this.$module) {\n return;\n }\n\n this.update();\n window.addEventListener(\"pageshow\", () => this.update());\n\n if (this.$yearInput) {\n this.$yearInput.addEventListener(\"keyup\", () => this.update());\n this.$yearInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$monthInput) {\n this.$monthInput.addEventListener(\"keyup\", () => this.update());\n this.$monthInput.addEventListener(\"change\", () => this.update());\n }\n if (this.$dayInput) {\n this.$dayInput.addEventListener(\"keyup\", () => this.update());\n this.$dayInput.addEventListener(\"change\", () => this.update());\n }\n }\n\n update() {\n if (this.isValidYear()) {\n this.showMonth();\n if (this.isValidMonth()) {\n this.showDay();\n } else {\n this.hideDay();\n }\n } else {\n this.hideMonth();\n this.hideDay();\n }\n }\n\n isValidYear() {\n if (!this.$yearInput) {\n return true;\n }\n const yearValue = parseInt(this.$yearInput.value.trim(), 10);\n /* eslint-disable-next-line no-magic-numbers */\n return !isNaN(this.$yearInput.value) && !isNaN(yearValue) && yearValue > 0;\n }\n\n isValidMonth() {\n if (!this.$monthInput) {\n return true;\n }\n const monthRawValue = this.$monthInput.value.trim();\n const monthIntValue = parseInt(monthRawValue, 10);\n const validMonthStrings = [\n \"january\",\n \"february\",\n \"march\",\n \"april\",\n \"may\",\n \"june\",\n \"july\",\n \"august\",\n \"september\",\n \"october\",\n \"november\",\n \"december\",\n \"jan\",\n \"feb\",\n \"mar\",\n \"apr\",\n \"jun\",\n \"jul\",\n \"aug\",\n \"sep\",\n \"oct\",\n \"nov\",\n \"dec\",\n ];\n return (\n (!isNaN(this.$monthInput.value) &&\n !isNaN(monthIntValue) &&\n /* eslint-disable-next-line no-magic-numbers */\n monthIntValue > 0 &&\n /* eslint-disable-next-line no-magic-numbers */\n monthIntValue <= 12) ||\n validMonthStrings.includes(monthRawValue.toLowerCase())\n );\n }\n\n showMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideMonth() {\n if (this.$monthWrapper) {\n this.$monthWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n\n showDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.removeAttribute(\"hidden\");\n }\n }\n\n hideDay() {\n if (this.$dayWrapper) {\n this.$dayWrapper.setAttribute(\"hidden\", \"\");\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookieEvents","CookieEventHandler","events","oneTimeEvents","debug","constructor","this","log","args","console","on","event","callback","Object","hasOwn","once","trigger","data","forEach","eventToTrigger","call","eventIndex","length","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","defaultDomain","defaultPath","secure","policiesKey","defaultAge","policiesCorrectOnInit","document","documentElement","dataset","tnaFrontendDebug","options","newInstance","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","secondsInAYear","parseInt","tnaCookiesDefaultAge","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","usage","settings","marketing","essential","all","destroyInstance","deserialised","cookie","split","trim","parts","key","value","decodeURIComponent","JSON","parse","get","error","exists","hasValue","set","maxAge","sameSite","domain","path","session","secureString","sessionString","encodeURIComponent","deleteAll","delete","acceptPolicy","setPolicy","rejectPolicy","accepted","acceptAllPolicies","allPolicies","toLowerCase","rejectAllPolicies","stringify","isPolicyAccepted","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","DateInputProgressive","$module","$yearWrapper","querySelector","$yearInput","$monthWrapper","$monthInput","$dayWrapper","$dayInput","update","addEventListener","isValidYear","showMonth","isValidMonth","showDay","hideDay","hideMonth","yearValue","isNaN","monthRawValue","monthIntValue","removeAttribute","setAttribute"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={d:(t,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ErrorSummary:()=>n});class n{constructor(e){this.$module=e}init(){this.$module&&("true"===this.$module.dataset.disableAutofocus||this.setFocus(this.$module),this.$module.addEventListener("click",e=>this.handleClick(e)))}setFocus(e,t={}){const n=e.getAttribute("tabindex");function o(){t.onBlur?.call(e),n||e.removeAttribute("tabindex")}n||e.setAttribute("tabindex","-1"),e.addEventListener("focus",function(){e.addEventListener("blur",o,{once:!0})},{once:!0}),t.onBeforeFocus?.call(e),e.focus()}handleClick(e){const t=e.target;t&&this.focusTarget(t)&&e.preventDefault()}getFragmentFromUrl(e){return e.includes("#")?e.split("#").pop():null}focusTarget(e){if(!(e instanceof HTMLAnchorElement))return!1;const t=this.getFragmentFromUrl(e.href);if(!t)return!1;const n=document.getElementById(t);if(!n)return!1;const o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(e){const t=e.closest("fieldset");if(t){const n=t.getElementsByTagName("legend");if(n.length){const[t]=n;if(e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type))return t;const o=t.getBoundingClientRect().top,r=e.getBoundingClientRect();if(r.height&&window.innerHeight&&r.top+r.height-o<window.innerHeight/2)return t}}return document.querySelector(`label[for='${e.getAttribute("id")}']`)??e.closest("label")}}return t})());
|
|
2
2
|
//# sourceMappingURL=error-summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/error-summary/error-summary.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,uBCRD,IAAAC,EAAA,CCAAA,EAAA,CAAAL,EAAAM,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAR,EAAAO,IACAE,OAAAC,eAAAV,EAAAO,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCF,EAAA,CAAAQ,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAT,EAAAL,IACA,oBAAAkB,QAAAA,OAAAC,aACAV,OAAAC,eAAAV,EAAAkB,OAAAC,YAAA,CAAuDC,MAAA,WAEvDX,OAAAC,eAAAV,EAAA,cAAgDoB,OAAA,
|
|
1
|
+
{"version":3,"file":"components/error-summary/error-summary.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAA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Hb,IAIX,CAEA,WAAAN,CAAYF,GAEV,KAAMA,aAAmBS,mBACvB,OAAO,EAGT,MAAMC,EAAU5B,KAAKsB,mBAAmBJ,EAAQW,MAChD,IAAKD,EACH,OAAO,EAGT,MAAME,EAASC,SAASC,eAAeJ,GACvC,IAAKE,EACH,OAAO,EAGT,MAAMG,EAAiBjC,KAAKkC,2BAA2BJ,GACvD,QAAKG,IAOLA,EAAeE,iBACfL,EAAOb,MAAM,CAAEmB,eAAe,KAEvB,EACT,CAmBA,0BAAAF,CAA2BJ,GACzB,MAAMO,EAAYP,EAAOQ,QAAQ,YAEjC,GAAID,EAAW,CACb,MAAME,EAAWF,EAAUG,qBAAqB,UAEhD,GAAID,EAASE,OAAQ,CACnB,MAAOC,GAAoBH,EAI3B,GACET,aAAkBa,mBACD,aAAhBb,EAAOc,MAAuC,UAAhBd,EAAOc,MAEtC,OAAOF,EAST,MAAMG,EAAYH,EAAiBI,wBAAwBC,IACrDC,EAAYlB,EAAOgB,wBAIzB,GAAIE,EAAUC,QAAUC,OAAOC,aACTH,EAAUD,IAAMC,EAAUC,OAG5BJ,EAAYK,OAAOC,YAAc,EACjD,OAAOT,CAGb,CACF,CAEA,OACEX,SAASqB,cAAc,cAActB,EAAOnB,aAAa,YACzDmB,EAAOQ,QAAQ,QAEnB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/error-summary/error-summary.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class ErrorSummary {\n constructor($module) {\n this.$module = $module;\n }\n\n init() {\n if (!this.$module) {\n return;\n }\n\n const disableAutoFocus =\n this.$module.dataset.disableAutofocus === \"true\" || false;\n\n if (!disableAutoFocus) {\n this.setFocus(this.$module);\n }\n\n this.$module.addEventListener(\"click\", (event) => this.handleClick(event));\n }\n\n /* eslint-disable-next-line class-methods-use-this */\n setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute(\"tabindex\");\n\n if (!isFocusable) {\n $element.setAttribute(\"tabindex\", \"-1\");\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element);\n\n if (!isFocusable) {\n $element.removeAttribute(\"tabindex\");\n }\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener(\"blur\", onBlur, { once: true });\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener(\"focus\", onFocus, { once: true });\n\n // Focus element\n options.onBeforeFocus?.call($element);\n $element.focus();\n }\n\n handleClick(event) {\n const $target = event.target;\n if ($target && this.focusTarget($target)) {\n event.preventDefault();\n }\n }\n\n /* eslint-disable-next-line class-methods-use-this */\n getFragmentFromUrl(url) {\n if (!url.includes(\"#\")) {\n return null;\n }\n\n return url.split(\"#\").pop();\n }\n\n focusTarget($target) {\n // If the element that was clicked was not a link, return early\n if (!($target instanceof HTMLAnchorElement)) {\n return false;\n }\n\n const inputId = this.getFragmentFromUrl($target.href);\n if (!inputId) {\n return false;\n }\n\n const $input = document.getElementById(inputId);\n if (!$input) {\n return false;\n }\n\n const $legendOrLabel = this.getAssociatedLegendOrLabel($input);\n if (!$legendOrLabel) {\n return false;\n }\n\n // Scroll the legend or label into view *before* calling focus on the input\n // To avoid extra scrolling in browsers that don't support `preventScroll`\n // (which at time of writing is most of them...)\n $legendOrLabel.scrollIntoView();\n $input.focus({ preventScroll: true });\n\n return true;\n }\n\n /**\n * Get associated legend or label\n *\n * Returns the first element that exists from this list:\n *\n * - The `<legend>` associated with the closest `<fieldset>` ancestor, as long\n * as the top of it is no more than half a viewport height away from the\n * bottom of the input\n * - The first `<label>` that is associated with the input using for=\"inputId\"\n * - The closest parent `<label>`\n *\n * @private\n * @param {Element} $input - The input\n * @returns {Element | null} Associated legend or label, or null if no\n * associated legend or label can be found\n */\n /* eslint-disable-next-line class-methods-use-this */\n getAssociatedLegendOrLabel($input) {\n const $fieldset = $input.closest(\"fieldset\");\n\n if ($fieldset) {\n const $legends = $fieldset.getElementsByTagName(\"legend\");\n\n if ($legends.length) {\n const [$candidateLegend] = $legends;\n\n // If the input type is radio or checkbox, always use the legend if\n // There is one.\n if (\n $input instanceof HTMLInputElement &&\n ($input.type === \"checkbox\" || $input.type === \"radio\")\n ) {\n return $candidateLegend;\n }\n\n // For other input types, only scroll to the fieldset’s legend (instead\n // Of the label associated with the input) if the input would end up in\n // The top half of the screen.\n //\n // This should avoid situations where the input either ends up off the\n // Screen, or obscured by a software keyboard.\n const legendTop = $candidateLegend.getBoundingClientRect().top;\n const inputRect = $input.getBoundingClientRect();\n\n // If the browser doesn't support Element.getBoundingClientRect().height\n // Or window.innerHeight (like IE8), bail and just link to the label.\n if (inputRect.height && window.innerHeight) {\n const inputBottom = inputRect.top + inputRect.height;\n\n /* eslint-disable no-magic-numbers */\n if (inputBottom - legendTop < window.innerHeight / 2) {\n return $candidateLegend;\n }\n }\n }\n }\n\n return (\n document.querySelector(`label[for='${$input.getAttribute(\"id\")}']`) ??\n $input.closest(\"label\")\n );\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","ErrorSummary","constructor","$module","this","init","dataset","disableAutofocus","setFocus","addEventListener","event","handleClick","$element","options","isFocusable","getAttribute","onBlur","removeAttribute","setAttribute","once","onBeforeFocus","focus","$target","target","focusTarget","preventDefault","getFragmentFromUrl","url","includes","split","pop","HTMLAnchorElement","inputId","href","$input","document","getElementById","$legendOrLabel","getAssociatedLegendOrLabel","scrollIntoView","preventScroll","$fieldset","closest","$legends","getElementsByTagName","length","$candidateLegend","HTMLInputElement","type","legendTop","getBoundingClientRect","top","inputRect","height","window","innerHeight","querySelector"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={d:(t,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={d:(t,i)=>{for(var a in i)e.o(i,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:i[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{FileInputDroppable:()=>i});class i{constructor(e){this.$module=e,this.$body=e&&e.querySelector(".tna-form-item__body"),this.$input=this.$body&&this.$body.querySelector(".tna-file-input"),this.$module&&this.$body&&this.$input&&this.init()}init(){this.acceptMutltipleFiles=this.$input.hasAttribute("multiple"),this.$droppableArea=document.createElement("div"),this.$droppableArea.classList.add("tna-file-input__droppable","tna-file-input__droppable--empty"),this.$body.insertBefore(this.$droppableArea,this.$input),this.$droppableArea.appendChild(this.$input),this.$pseudoSelectFileText=document.createElement("span"),this.$pseudoSelectFileText.setAttribute("aria-live","polite"),this.$pseudoSelectFileText.classList.add("tna-file-input__droppable-status");let e="file";this.acceptMutltipleFiles&&(e+="s"),this.$pseudoSelectFileText.textContent=`No ${e} selected`,this.$droppableArea.appendChild(this.$pseudoSelectFileText);const t=document.createElement("div");t.classList.add("tna-button-group","tna-button-group--small","tna-!--margin-top-s","tna-file-input__droppable-buttons"),this.$droppableArea.appendChild(t);const i=document.createElement("span");i.classList.add("tna-button"),i.textContent=`Choose ${e}`,t.appendChild(i);const a=document.createElement("span");a.textContent=`or drop ${e}`,t.appendChild(a),this.$droppableAreaAriaLabel=document.createElement("span"),this.$droppableAreaAriaLabel.classList.add("tna-visually-hidden"),this.$droppableAreaAriaLabel.setAttribute("aria-live","assertive"),this.$droppableArea.appendChild(this.$droppableAreaAriaLabel),this.$input.addEventListener("dragenter",e=>this.showDropTarget(e)),this.$input.addEventListener("dragleave",()=>this.hideDropTarget()),this.$input.addEventListener("dragend",()=>this.hideDropTarget()),this.$input.addEventListener("change",()=>this.onChange()),this.$input.addEventListener("drop",()=>this.onChange())}isContainingFiles(e){const t=!e.types.length,i=e.types.some(e=>"Files"===e);return t||i}showDropTarget(e,t=!0){if(e.dataTransfer&&this.isContainingFiles(e.dataTransfer)){let i="tna-file-input__droppable--over";e.dataTransfer.items.length&&(i="tna-file-input__droppable--over-multiple"),this.$droppableArea.classList.add(i),t&&(this.$droppableAreaAriaLabel.textContent="Entered drop zone")}}hideDropTarget(e=!0){this.$droppableArea.classList.remove("tna-file-input__droppable--over","tna-file-input__droppable--over-multiple"),e&&(this.$droppableAreaAriaLabel.textContent="Left drop zone")}onChange(){const{files:e}=this.$input;if(this.acceptMutltipleFiles)if(e.length){let t="file";e.length>1&&(t+="s");const i=`${e.length} ${t} selected`;this.$pseudoSelectFileText.textContent=i}else this.$pseudoSelectFileText.textContent="No files selected";else this.$pseudoSelectFileText.textContent=e[0]?.name||"No file selected";e.length?this.$droppableArea.classList.remove("tna-file-input__droppable--empty"):this.$droppableArea.classList.add("tna-file-input__droppable--empty"),this.hideDropTarget(!1)}}return t})());
|
|
2
2
|
//# sourceMappingURL=file-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/file-input/file-input.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,uBCRD,IAAAC,EAAA,CCAAA,EAAA,CAAAL,EAAAM,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAR,EAAAO,IACAE,OAAAC,eAAAV,EAAAO,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCF,EAAA,CAAAQ,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAT,EAAAL,IACA,oBAAAkB,QAAAA,OAAAC,aACAV,OAAAC,eAAAV,EAAAkB,OAAAC,YAAA,CAAuDC,MAAA,WAEvDX,OAAAC,eAAAV,EAAA,cAAgDoB,OAAA,stBCLzC,IAAMC,EAAkB,WAW5B,SAVD,SAAAA,EAAYC,gGAASC,CAAAC,KAAAH,GACnBG,KAAKF,QAAUA,EACfE,KAAKC,MAAQH,GAAWA,EAAQI,cAAc,wBAC9CF,KAAKG,OAASH,KAAKC,OAASD,KAAKC,MAAMC,cAAc,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,yBAGxClB,KAAKe,sBAAsBG,aAEjB,QAARyB,EAAAC,EAAM,UAAE,IAAAD,OAAA,EAARA,EAAUE,OAAI,mBAEdD,EAAMZ,OACRhC,KAAKQ,eAAeG,UAAU+B,OAAO,oCAErC1C,KAAKQ,eAAeG,UAAUC,IAAI,oCAEpCZ,KAAK2B,gBAAe,EACtB,oFAAC,CA9H4B","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/file-input/file-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class FileInputDroppable {\n constructor($module) {\n this.$module = $module;\n this.$body = $module && $module.querySelector(\".tna-form-item__body\");\n this.$input = this.$body && this.$body.querySelector(\".tna-file-input\");\n\n if (!this.$module || !this.$body || !this.$input) {\n return;\n }\n\n this.init();\n }\n\n init() {\n this.acceptMutltipleFiles = this.$input.hasAttribute(\"multiple\");\n\n this.$droppableArea = document.createElement(\"div\");\n this.$droppableArea.classList.add(\n \"tna-file-input__droppable\",\n \"tna-file-input__droppable--empty\",\n );\n this.$body.insertBefore(this.$droppableArea, this.$input);\n this.$droppableArea.appendChild(this.$input);\n\n this.$pseudoSelectFileText = document.createElement(\"span\");\n this.$pseudoSelectFileText.setAttribute(\"aria-live\", \"polite\");\n this.$pseudoSelectFileText.classList.add(\n \"tna-file-input__droppable-status\",\n );\n\n let fileText = \"file\";\n if (this.acceptMutltipleFiles) {\n fileText += \"s\";\n }\n\n this.$pseudoSelectFileText.textContent = `No ${fileText} selected`;\n this.$droppableArea.appendChild(this.$pseudoSelectFileText);\n\n const $droppableButtons = document.createElement(\"div\");\n $droppableButtons.classList.add(\n \"tna-button-group\",\n \"tna-button-group--small\",\n \"tna-!--margin-top-s\",\n \"tna-file-input__droppable-buttons\",\n );\n this.$droppableArea.appendChild($droppableButtons);\n\n const $pseudoSelectFileButton = document.createElement(\"span\");\n $pseudoSelectFileButton.classList.add(\"tna-button\");\n $pseudoSelectFileButton.textContent = `Choose ${fileText}`;\n $droppableButtons.appendChild($pseudoSelectFileButton);\n\n const $pseudoDropFileButton = document.createElement(\"span\");\n $pseudoDropFileButton.textContent = `or drop ${fileText}`;\n $droppableButtons.appendChild($pseudoDropFileButton);\n\n this.$droppableAreaAriaLabel = document.createElement(\"span\");\n this.$droppableAreaAriaLabel.classList.add(\"tna-visually-hidden\");\n this.$droppableAreaAriaLabel.setAttribute(\"aria-live\", \"assertive\");\n this.$droppableArea.appendChild(this.$droppableAreaAriaLabel);\n\n this.$input.addEventListener(\"dragenter\", (event) =>\n this.showDropTarget(event),\n );\n this.$input.addEventListener(\"dragleave\", () => this.hideDropTarget());\n this.$input.addEventListener(\"dragend\", () => this.hideDropTarget());\n this.$input.addEventListener(\"change\", () => this.onChange());\n this.$input.addEventListener(\"drop\", () => this.onChange());\n }\n\n /* eslint-disable-next-line class-methods-use-this */\n isContainingFiles(dataTransfer) {\n const hasNoTypesInfo = !dataTransfer.types.length;\n const isDraggingFiles = dataTransfer.types.some((type) => type === \"Files\");\n return hasNoTypesInfo || isDraggingFiles;\n }\n\n showDropTarget(event, updateAriaLabel = true) {\n if (event.dataTransfer && this.isContainingFiles(event.dataTransfer)) {\n let classToAdd = \"tna-file-input__droppable--over\";\n if (event.dataTransfer.items.length) {\n classToAdd = \"tna-file-input__droppable--over-multiple\";\n }\n this.$droppableArea.classList.add(classToAdd);\n\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Entered drop zone\";\n }\n }\n }\n\n hideDropTarget(updateAriaLabel = true) {\n this.$droppableArea.classList.remove(\n \"tna-file-input__droppable--over\",\n \"tna-file-input__droppable--over-multiple\",\n );\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Left drop zone\";\n }\n }\n\n onChange() {\n const { files } = this.$input;\n if (this.acceptMutltipleFiles) {\n if (files.length) {\n let fileText = \"file\";\n /* eslint-disable-next-line no-magic-numbers */\n if (files.length > 1) {\n fileText += \"s\";\n }\n const textContent = `${files.length} ${fileText} selected`;\n this.$pseudoSelectFileText.textContent = textContent;\n } else {\n this.$pseudoSelectFileText.textContent = `No files selected`;\n }\n } else {\n this.$pseudoSelectFileText.textContent =\n /* eslint-disable-next-line no-magic-numbers */\n files[0]?.name || `No file selected`;\n }\n if (files.length) {\n this.$droppableArea.classList.remove(\"tna-file-input__droppable--empty\");\n } else {\n this.$droppableArea.classList.add(\"tna-file-input__droppable--empty\");\n }\n this.hideDropTarget(false);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","FileInputDroppable","$module","_classCallCheck","this","$body","querySelector","$input","init","_this","acceptMutltipleFiles","hasAttribute","$droppableArea","document","createElement","classList","add","insertBefore","appendChild","$pseudoSelectFileText","setAttribute","fileText","textContent","concat","$droppableButtons","$pseudoSelectFileButton","$pseudoDropFileButton","$droppableAreaAriaLabel","addEventListener","event","showDropTarget","hideDropTarget","onChange","dataTransfer","hasNoTypesInfo","types","length","isDraggingFiles","some","type","updateAriaLabel","arguments","undefined","isContainingFiles","classToAdd","items","remove","_files$","files","name"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"components/file-input/file-input.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,uBCRD,IAAAC,EAAA,CCAAA,EAAA,CAAAL,EAAAM,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAR,EAAAO,IACAE,OAAAC,eAAAV,EAAAO,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCF,EAAA,CAAAQ,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAT,EAAAL,IACA,oBAAAkB,QAAAA,OAAAC,aACAV,OAAAC,eAAAV,EAAAkB,OAAAC,YAAA,CAAuDC,MAAA,WAEvDX,OAAAC,eAAAV,EAAA,cAAgDoB,OAAA,oDCLzC,MAAMC,EACX,WAAAC,CAAYC,GACVC,KAAKD,QAAUA,EACfC,KAAKC,MAAQF,GAAWA,EAAQG,cAAc,wBAC9CF,KAAKG,OAASH,KAAKC,OAASD,KAAKC,MAAMC,cAAc,mBAEhDF,KAAKD,SAAYC,KAAKC,OAAUD,KAAKG,QAI1CH,KAAKI,MACP,CAEA,IAAAA,GACEJ,KAAKK,qBAAuBL,KAAKG,OAAOG,aAAa,YAErDN,KAAKO,eAAiBC,SAASC,cAAc,OAC7CT,KAAKO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UAATA,GAC1D,OAAOL,GAAkBG,CAC3B,CAEA,cAAAR,CAAeD,EAAOY,GAAkB,GACtC,GAAIZ,EAAMK,cAAgB5B,KAAK2B,kBAAkBJ,EAAMK,cAAe,CACpE,IAAIQ,EAAa,kCACbb,EAAMK,aAAaS,MAAMN,SAC3BK,EAAa,4CAEfpC,KAAKO,eAAeG,UAAUC,IAAIyB,GAE9BD,IACFnC,KAAKqB,wBAAwBJ,YAAc,oBAE/C,CACF,CAEA,cAAAQ,CAAeU,GAAkB,GAC/BnC,KAAKO,eAAeG,UAAU4B,OAC5B,kCACA,4CAEEH,IACFnC,KAAKqB,wBAAwBJ,YAAc,iBAE/C,CAEA,QAAAS,GACE,MAAMa,MAAEA,GAAUvC,KAAKG,OACvB,GAAIH,KAAKK,qBACP,GAAIkC,EAAMR,OAAQ,CAChB,IAAIf,EAAW,OAEXuB,EAAMR,OAAS,IACjBf,GAAY,KAEd,MAAMC,EAAc,GAAGsB,EAAMR,UAAUf,aACvChB,KAAKc,sBAAsBG,YAAcA,CAC3C,MACEjB,KAAKc,sBAAsBG,YAAc,yBAG3CjB,KAAKc,sBAAsBG,YAEzBsB,EAAM,IAAIC,MAAQ,mBAElBD,EAAMR,OACR/B,KAAKO,eAAeG,UAAU4B,OAAO,oCAErCtC,KAAKO,eAAeG,UAAUC,IAAI,oCAEpCX,KAAKyB,gBAAe,EACtB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/file-input/file-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class FileInputDroppable {\n constructor($module) {\n this.$module = $module;\n this.$body = $module && $module.querySelector(\".tna-form-item__body\");\n this.$input = this.$body && this.$body.querySelector(\".tna-file-input\");\n\n if (!this.$module || !this.$body || !this.$input) {\n return;\n }\n\n this.init();\n }\n\n init() {\n this.acceptMutltipleFiles = this.$input.hasAttribute(\"multiple\");\n\n this.$droppableArea = document.createElement(\"div\");\n this.$droppableArea.classList.add(\n \"tna-file-input__droppable\",\n \"tna-file-input__droppable--empty\",\n );\n this.$body.insertBefore(this.$droppableArea, this.$input);\n this.$droppableArea.appendChild(this.$input);\n\n this.$pseudoSelectFileText = document.createElement(\"span\");\n this.$pseudoSelectFileText.setAttribute(\"aria-live\", \"polite\");\n this.$pseudoSelectFileText.classList.add(\n \"tna-file-input__droppable-status\",\n );\n\n let fileText = \"file\";\n if (this.acceptMutltipleFiles) {\n fileText += \"s\";\n }\n\n this.$pseudoSelectFileText.textContent = `No ${fileText} selected`;\n this.$droppableArea.appendChild(this.$pseudoSelectFileText);\n\n const $droppableButtons = document.createElement(\"div\");\n $droppableButtons.classList.add(\n \"tna-button-group\",\n \"tna-button-group--small\",\n \"tna-!--margin-top-s\",\n \"tna-file-input__droppable-buttons\",\n );\n this.$droppableArea.appendChild($droppableButtons);\n\n const $pseudoSelectFileButton = document.createElement(\"span\");\n $pseudoSelectFileButton.classList.add(\"tna-button\");\n $pseudoSelectFileButton.textContent = `Choose ${fileText}`;\n $droppableButtons.appendChild($pseudoSelectFileButton);\n\n const $pseudoDropFileButton = document.createElement(\"span\");\n $pseudoDropFileButton.textContent = `or drop ${fileText}`;\n $droppableButtons.appendChild($pseudoDropFileButton);\n\n this.$droppableAreaAriaLabel = document.createElement(\"span\");\n this.$droppableAreaAriaLabel.classList.add(\"tna-visually-hidden\");\n this.$droppableAreaAriaLabel.setAttribute(\"aria-live\", \"assertive\");\n this.$droppableArea.appendChild(this.$droppableAreaAriaLabel);\n\n this.$input.addEventListener(\"dragenter\", (event) =>\n this.showDropTarget(event),\n );\n this.$input.addEventListener(\"dragleave\", () => this.hideDropTarget());\n this.$input.addEventListener(\"dragend\", () => this.hideDropTarget());\n this.$input.addEventListener(\"change\", () => this.onChange());\n this.$input.addEventListener(\"drop\", () => this.onChange());\n }\n\n /* eslint-disable-next-line class-methods-use-this */\n isContainingFiles(dataTransfer) {\n const hasNoTypesInfo = !dataTransfer.types.length;\n const isDraggingFiles = dataTransfer.types.some((type) => type === \"Files\");\n return hasNoTypesInfo || isDraggingFiles;\n }\n\n showDropTarget(event, updateAriaLabel = true) {\n if (event.dataTransfer && this.isContainingFiles(event.dataTransfer)) {\n let classToAdd = \"tna-file-input__droppable--over\";\n if (event.dataTransfer.items.length) {\n classToAdd = \"tna-file-input__droppable--over-multiple\";\n }\n this.$droppableArea.classList.add(classToAdd);\n\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Entered drop zone\";\n }\n }\n }\n\n hideDropTarget(updateAriaLabel = true) {\n this.$droppableArea.classList.remove(\n \"tna-file-input__droppable--over\",\n \"tna-file-input__droppable--over-multiple\",\n );\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Left drop zone\";\n }\n }\n\n onChange() {\n const { files } = this.$input;\n if (this.acceptMutltipleFiles) {\n if (files.length) {\n let fileText = \"file\";\n /* eslint-disable-next-line no-magic-numbers */\n if (files.length > 1) {\n fileText += \"s\";\n }\n const textContent = `${files.length} ${fileText} selected`;\n this.$pseudoSelectFileText.textContent = textContent;\n } else {\n this.$pseudoSelectFileText.textContent = `No files selected`;\n }\n } else {\n this.$pseudoSelectFileText.textContent =\n /* eslint-disable-next-line no-magic-numbers */\n files[0]?.name || `No file selected`;\n }\n if (files.length) {\n this.$droppableArea.classList.remove(\"tna-file-input__droppable--empty\");\n } else {\n this.$droppableArea.classList.add(\"tna-file-input__droppable--empty\");\n }\n this.hideDropTarget(false);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","FileInputDroppable","constructor","$module","this","$body","querySelector","$input","init","acceptMutltipleFiles","hasAttribute","$droppableArea","document","createElement","classList","add","insertBefore","appendChild","$pseudoSelectFileText","setAttribute","fileText","textContent","$droppableButtons","$pseudoSelectFileButton","$pseudoDropFileButton","$droppableAreaAriaLabel","addEventListener","event","showDropTarget","hideDropTarget","onChange","isContainingFiles","dataTransfer","hasNoTypesInfo","types","length","isDraggingFiles","some","type","updateAriaLabel","classToAdd","items","remove","files","name"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={533(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i;function r(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,l(o.key),o)}}function a(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}n.d(t,{A:()=>k}),(i=window).TNAFrontendCookieEvents||(i.TNAFrontendCookieEvents=null);var u,h=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"events",{}),a(this,"oneTimeEvents",{}),a(this,"debug",!1),this.debug=t,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this},t=[{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).log.apply(e,["[TNA Frontend Cookie Events]"].concat(n))}}},{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(r(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(r(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&(this.log("Triggering event: ".concat(e),n),this.events[e].forEach(function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e)){this.log("Triggering one-time event: ".concat(e),n);for(var o=this.oneTimeEvents[e].length-1;o>=0;o-=1)this.oneTimeEvents[e][o].call(this,n),this.oneTimeEvents[e].splice(o,1)}}}],t&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,g(o.key),o)}}function p(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}(u=window).TNAFrontendCookies||(u.TNAFrontendCookies=null);var b=["usage","settings","marketing","essential"],k=function(){return e=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,"defaultDomain",""),p(this,"defaultPath",""),p(this,"secure",!0),p(this,"policiesKey",""),p(this,"events",null),p(this,"defaultAge",null),p(this,"policiesCorrectOnInit",!1),p(this,"debug","true"===document.documentElement.dataset.tnaFrontendDebug);var o=n.defaultDomain,i=n.defaultPath,r=n.secure,s=n.policiesKey,c=n.defaultAge,a=n.newInstance,l=void 0!==a&&a,u=n.noInit,f=void 0!==u&&u;if(!l&&window.TNAFrontendCookies)return window.TNAFrontendCookies;this.defaultDomain=o||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=i||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=r||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=s||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",this.defaultAge=c||parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||31536e3,this.events=new h(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===b.length&&b.every(function(e){return Object.keys(t.policies).includes(e)&&"boolean"==typeof t.policies[e]}),this.policiesCorrectOnInit||f||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),l||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)},t=[{key:"init",value:function(){var e=this.policies;this.log("Existing policies on init:",e);var t=Object.fromEntries(Object.keys(e).filter(function(e){return b.includes(e)}).map(function(t){return[t,e[t]]}));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies(d(d({usage:!1,settings:!1,marketing:!1},t),{},{essential:!0}))}},{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).log.apply(e,["[TNA Frontend Cookies]"].concat(n,[this.all]))}}},{key:"destroyInstance",value:function(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter(function(e){return""!==e.trim()}).forEach(function(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,s,c=[],a=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(o=r.call(n)).done)&&(c.push(o.value),c.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{if(!a&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.trim().split("="),2),o=n[0],i=n[1];o&&(e[o]=decodeURIComponent(i||""))}),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)===t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.maxAge,i=void 0===o?this.defaultAge:o,r=n.sameSite,s=void 0===r?"Lax":r,c=n.domain,a=void 0===c?this.defaultDomain:c,l=n.path,u=void 0===l?this.defaultPath:l,h=n.secure,f=void 0===h?this.secure:h,m=n.session,y=void 0!==m&&m;if(e){var d="";f&&(d="; secure");var v="";y||(v="; max-age=".concat(i));var p="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),"; domain=").concat(a,"; samesite=").concat(s,"; path=").concat(u).concat(v).concat(d);document.cookie=p,this.log("Set cookie:",{key:e,value:t,maxAge:i,path:u,sameSite:s,domain:a,secure:f,session:y,cookie:p}),this.events.trigger("setCookie",{key:e,value:t,maxAge:i,path:u,sameSite:s,domain:a,secure:f,session:y,cookie:p})}}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.defaultDomain,o={maxAge:-1,path:t,domain:n||this.defaultDomain};this.set(e,"",o),this.log("Deleted cookie:",d({key:e,path:t,domain:n},o)),this.events.trigger("deleteCookie",d({key:e},o))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.defaultDomain;Object.keys(this.all).forEach(function(o){e.delete(o,t,n)}),this.log("Deleted all cookies",{path:t,domain:n}),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",p({},e,!0))}},{key:"rejectPolicy",value:function(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",p({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e?(this.log("Setting policy ".concat(e," to ").concat(t)),this.savePolicies(d(d({},this.policies),{},p(p({},e,t),"essential",!0))),this.events.trigger("changePolicy",p({},e,t))):this.log("Cannot change essential policy, it is always accepted.")}},{key:"acceptAllPolicies",value:function(){this.log("Accepting all policies");var e=Object.fromEntries(Object.keys(this.policies).map(function(e){return[e.toLowerCase(),!0]}));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){this.log("Rejecting all policies");var e=d(d({},Object.fromEntries(Object.keys(this.policies).map(function(e){return[e.toLowerCase(),!1]}))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.log("Saving policies:",e),this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.log("Adding event listener for: ".concat(e)),this.events.on(e,t)}},{key:"once",value:function(e,t){this.log("Adding one-time event listener for: ".concat(e)),this.events.once(e,t)}}],t&&v(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{Footer:()=>a});var i=n(533);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,c(o.key),o)}}function c(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var a=function(){return e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"theme";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$themeSelector=t&&t.querySelector(".tna-footer__theme-selector"),this.$themeSelectorNotice=t&&t.querySelector(".tna-footer__theme-selector-notice"),this.$themeSelectorEnableSettingsCookiesButton=this.$themeSelectorNotice&&this.$themeSelectorNotice.querySelector(".tna-footer__theme-selector-enable-settings-cookies"),this.$tnaTemplate=document.querySelector(".tna-template"),this.$module&&this.$themeSelector&&this.$themeSelectorNotice&&this.$themeSelectorEnableSettingsCookiesButton&&this.$tnaTemplate&&(this.themeCookieName=n,this.init())},(t=[{key:"init",value:function(){var e=this;this.currentTheme=this.$themeSelector.dataset.themeOnLoad,this.cookies=new i.A,this.$themeSelectorButtons=this.$themeSelector.querySelectorAll("button.tna-footer__theme-selector-button[value]"),Array.from(this.$themeSelectorButtons).forEach(function(t){t.addEventListener("click",function(t){var n=t.target;e.setTheme(n.value),e.selectThemeSelectorButton(n)})}),this.$themeSelectorEnableSettingsCookiesButton.addEventListener("click",function(){e.cookies.acceptPolicy("settings")}),this.showThemeSelector(),this.cookies.on("changePolicy",function(t){Object.hasOwn(t,"settings")&&(!0===t.settings?(e.cookies.set(e.themeCookieName,e.currentTheme),e.$themeSelectorNotice.setAttribute("hidden","")):(e.cookies.delete(e.themeCookieName),e.$themeSelectorNotice.removeAttribute("hidden")))})}},{key:"showThemeSelector",value:function(){var e=this;if(this.$themeSelector.removeAttribute("hidden"),this.cookies.exists(this.themeCookieName)){var t=Array.from(this.$themeSelectorButtons).find(function(t){return t.value===e.cookies.get(e.themeCookieName)});t&&this.selectThemeSelectorButton(t)}this.cookies.isPolicyAccepted("settings")||this.$themeSelectorNotice.removeAttribute("hidden")}},{key:"setTheme",value:function(e){if("light"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme","tna-template--dark-theme");else if("dark"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme"),this.$tnaTemplate.classList.add("tna-template--dark-theme");else{if("system"!==e)return;this.$tnaTemplate.classList.remove("tna-template--dark-theme"),this.$tnaTemplate.classList.add("tna-template--system-theme")}this.currentTheme=e,this.cookies.isPolicyAccepted("settings")?this.cookies.set(this.themeCookieName,this.currentTheme):this.$themeSelectorNotice.removeAttribute("hidden")}},{key:"selectThemeSelectorButton",value:function(e){Array.from(this.$themeSelectorButtons).forEach(function(t){t.value===e.value?(t.classList.remove("tna-button--plain"),t.setAttribute("aria-current",!0)):(t.classList.add("tna-button--plain"),t.removeAttribute("aria-current"))})}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return o})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,()=>(()=>{"use strict";var e={533(e,t,i){i.d(t,{A:()=>n}),window.TNAFrontendCookieEvents||=null;class s{events={};oneTimeEvents={};debug=!1;constructor(e=!1){if(this.debug=e,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}log(...e){this.debug&&console.log("[TNA Frontend Cookie Events]",...e)}on(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[...this.events[e],t]}once(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[...this.oneTimeEvents[e],t]}trigger(e,t={}){if(Object.hasOwn(this.events,e)&&(this.log(`Triggering event: ${e}`,t),this.events[e].forEach(e=>e.call(this,t))),Object.hasOwn(this.oneTimeEvents,e)){this.log(`Triggering one-time event: ${e}`,t);for(let i=this.oneTimeEvents[e].length-1;i>=0;i-=1)this.oneTimeEvents[e][i].call(this,t),this.oneTimeEvents[e].splice(i,1)}}}window.TNAFrontendCookies||=null;const o=["usage","settings","marketing","essential"];class n{defaultDomain="";defaultPath="";secure=!0;policiesKey="";events=null;defaultAge=null;policiesCorrectOnInit=!1;debug="true"===document.documentElement.dataset.tnaFrontendDebug;constructor(e={}){const{defaultDomain:t,defaultPath:i,secure:n,policiesKey:l,defaultAge:c,newInstance:r=!1,noInit:h=!1}=e;if(!r&&window.TNAFrontendCookies)return window.TNAFrontendCookies;if(this.defaultDomain=t||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=i||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=n||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=l||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",c)this.defaultAge=c;else{const e=31536e3;this.defaultAge=parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||e}this.events=new s(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===o.length&&o.every(e=>Object.keys(this.policies).includes(e)&&"boolean"==typeof this.policies[e]),this.policiesCorrectOnInit||h||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),r||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)}init(){const e=this.policies;this.log("Existing policies on init:",e);const t=Object.fromEntries(Object.keys(e).filter(e=>o.includes(e)).map(t=>[t,e[t]]));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies({usage:!1,settings:!1,marketing:!1,...t,essential:!0})}log(...e){this.debug&&console.log("[TNA Frontend Cookies]",...e,this.all)}destroyInstance(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}get all(){const e={};return document.cookie.split("; ").filter(e=>""!==e.trim()).forEach(t=>{const i=t.trim().split("="),[s,o]=i;s&&(e[s]=decodeURIComponent(o||""))}),e}get policies(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}exists(e){return Object.hasOwn(this.all,e)}hasValue(e,t){return this.get(e)===t}get(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}set(e,t,i={}){const{maxAge:s=this.defaultAge,sameSite:o="Lax",domain:n=this.defaultDomain,path:l=this.defaultPath,secure:c=this.secure,session:r=!1}=i;if(!e)return;let h="";c&&(h="; secure");let a="";r||(a=`; max-age=${s}`);const m=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; domain=${n}; samesite=${o}; path=${l}${a}${h}`;document.cookie=m,this.log("Set cookie:",{key:e,value:t,maxAge:s,path:l,sameSite:o,domain:n,secure:c,session:r,cookie:m}),this.events.trigger("setCookie",{key:e,value:t,maxAge:s,path:l,sameSite:o,domain:n,secure:c,session:r,cookie:m})}delete(e,t="/",i=this.defaultDomain){const s={maxAge:-1,path:t,domain:i||this.defaultDomain};this.set(e,"",s),this.log("Deleted cookie:",{key:e,path:t,domain:i,...s}),this.events.trigger("deleteCookie",{key:e,...s})}deleteAll(e="/",t=this.defaultDomain){Object.keys(this.all).forEach(i=>{this.delete(i,e,t)}),this.log("Deleted all cookies",{path:e,domain:t}),this.events.trigger("deleteAllCookies",{path:e,domain:t})}acceptPolicy(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",{[e]:!0})}rejectPolicy(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",{[e]:!1})}setPolicy(e,t){"essential"!==e?(this.log(`Setting policy ${e} to ${t}`),this.savePolicies({...this.policies,[e]:t,essential:!0}),this.events.trigger("changePolicy",{[e]:t})):this.log("Cannot change essential policy, it is always accepted.")}acceptAllPolicies(){this.log("Accepting all policies");const e=Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!0]));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}rejectAllPolicies(){this.log("Rejecting all policies");const e={...Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!1])),essential:!0};this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}savePolicies(e){this.log("Saving policies:",e),this.set(this.policiesKey,JSON.stringify(e))}isPolicyAccepted(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}on(e,t){this.log(`Adding event listener for: ${e}`),this.events.on(e,t)}once(e,t){this.log(`Adding one-time event listener for: ${e}`),this.events.once(e,t)}}}},t={};function i(s){var o=t[s];if(void 0!==o)return o.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};i.r(s),i.d(s,{Footer:()=>n});var o=i(533);class n{constructor(e,t="theme"){this.$module=e,this.$themeSelector=e&&e.querySelector(".tna-footer__theme-selector"),this.$themeSelectorNotice=e&&e.querySelector(".tna-footer__theme-selector-notice"),this.$themeSelectorEnableSettingsCookiesButton=this.$themeSelectorNotice&&this.$themeSelectorNotice.querySelector(".tna-footer__theme-selector-enable-settings-cookies"),this.$tnaTemplate=document.querySelector(".tna-template"),this.$module&&this.$themeSelector&&this.$themeSelectorNotice&&this.$themeSelectorEnableSettingsCookiesButton&&this.$tnaTemplate&&(this.themeCookieName=t,this.init())}init(){this.currentTheme=this.$themeSelector.dataset.themeOnLoad,this.cookies=new o.A,this.$themeSelectorButtons=this.$themeSelector.querySelectorAll("button.tna-footer__theme-selector-button[value]"),Array.from(this.$themeSelectorButtons).forEach(e=>{e.addEventListener("click",e=>{const t=e.target;this.setTheme(t.value),this.selectThemeSelectorButton(t)})}),this.$themeSelectorEnableSettingsCookiesButton.addEventListener("click",()=>{this.cookies.acceptPolicy("settings")}),this.showThemeSelector(),this.cookies.on("changePolicy",e=>{Object.hasOwn(e,"settings")&&(!0===e.settings?(this.cookies.set(this.themeCookieName,this.currentTheme),this.$themeSelectorNotice.setAttribute("hidden","")):(this.cookies.delete(this.themeCookieName),this.$themeSelectorNotice.removeAttribute("hidden")))})}showThemeSelector(){if(this.$themeSelector.removeAttribute("hidden"),this.cookies.exists(this.themeCookieName)){const e=Array.from(this.$themeSelectorButtons).find(e=>e.value===this.cookies.get(this.themeCookieName));e&&this.selectThemeSelectorButton(e)}this.cookies.isPolicyAccepted("settings")||this.$themeSelectorNotice.removeAttribute("hidden")}setTheme(e){if("light"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme","tna-template--dark-theme");else if("dark"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme"),this.$tnaTemplate.classList.add("tna-template--dark-theme");else{if("system"!==e)return;this.$tnaTemplate.classList.remove("tna-template--dark-theme"),this.$tnaTemplate.classList.add("tna-template--system-theme")}this.currentTheme=e,this.cookies.isPolicyAccepted("settings")?this.cookies.set(this.themeCookieName,this.currentTheme):this.$themeSelectorNotice.removeAttribute("hidden")}selectThemeSelectorButton(e){Array.from(this.$themeSelectorButtons).forEach(t=>{t.value===e.value?(t.classList.remove("tna-button--plain"),t.setAttribute("aria-current",!0)):(t.classList.add("tna-button--plain"),t.removeAttribute("aria-current"))})}}return s})());
|
|
2
2
|
//# sourceMappingURL=footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/footer/footer.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,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UAChCnJ,KAAKsI,QAAQpD,OAAOlF,KAAK8H,iBAAkB,CAC7C,IAAMsB,EAAsB5I,MAAMiI,KAAKzI,KAAKuI,uBAAuBc,KACjE,SAACT,GAAO,OAAKA,EAAQxI,QAAU+F,EAAKmC,QAAQ/D,IAAI4B,EAAK2B,gBAAgB,GAEnEsB,GACFpJ,KAAK+I,0BAA0BK,EAEnC,CACKpJ,KAAKsI,QAAQgB,iBAAiB,aACjCtJ,KAAKiI,qBAAqBkB,gBAAgB,SAE9C,GAAC,CAAAhJ,IAAA,WAAAC,MAED,SAASmJ,GACP,GAAc,UAAVA,EACFvJ,KAAKmI,aAAaqB,UAAUC,OAC1B,6BACA,iCAEG,GAAc,SAAVF,EACTvJ,KAAKmI,aAAaqB,UAAUC,OAAO,8BACnCzJ,KAAKmI,aAAaqB,UAAUE,IAAG,gCAC1B,IAAc,WAAVH,EAIT,OAHAvJ,KAAKmI,aAAaqB,UAAUC,OAAO,4BACnCzJ,KAAKmI,aAAaqB,UAAUE,IAAG,6BAGjC,CACA1J,KAAKoI,aAAemB,EAChBvJ,KAAKsI,QAAQgB,iBAAiB,YAChCtJ,KAAKsI,QAAQpC,IAAIlG,KAAK8H,gBAAiB9H,KAAKoI,cAE5CpI,KAAKiI,qBAAqBkB,gBAAgB,SAE9C,GAAC,CAAAhJ,IAAA,4BAAAC,MAED,SAA0BuJ,GACxBnJ,MAAMiI,KAAKzI,KAAKuI,uBAAuBjH,QAAQ,SAACsH,GAC1CA,EAAQxI,QAAUuJ,EAAgBvJ,OACpCwI,EAAQY,UAAUC,OAAO,qBACzBb,EAAQM,aAAa,gBAAgB,KAErCN,EAAQY,UAAUE,IAAI,qBACtBd,EAAQO,gBAAgB,gBAE5B,EACF,mFAAC,CAnHgB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/footer/footer.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) === value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.log(\"Accepting policy:\", policy);\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.log(\"Rejecting policy:\", policy);\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.log(\"Saving policies:\", policies);\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.log(`Adding event listener for: ${event}`);\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.log(`Adding one-time event listener for: ${event}`);\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport class Footer {\n constructor($module, themeCookieName = \"theme\") {\n this.$module = $module;\n this.$themeSelector =\n $module && $module.querySelector(\".tna-footer__theme-selector\");\n this.$themeSelectorNotice =\n $module && $module.querySelector(\".tna-footer__theme-selector-notice\");\n this.$themeSelectorEnableSettingsCookiesButton =\n this.$themeSelectorNotice &&\n this.$themeSelectorNotice.querySelector(\n \".tna-footer__theme-selector-enable-settings-cookies\",\n );\n this.$tnaTemplate = document.querySelector(\".tna-template\");\n\n if (\n !this.$module ||\n !this.$themeSelector ||\n !this.$themeSelectorNotice ||\n !this.$themeSelectorEnableSettingsCookiesButton ||\n !this.$tnaTemplate\n ) {\n return;\n }\n\n this.themeCookieName = themeCookieName;\n\n this.init();\n }\n\n init() {\n this.currentTheme = this.$themeSelector.dataset.themeOnLoad;\n\n this.cookies = new Cookies();\n\n this.$themeSelectorButtons = this.$themeSelector.querySelectorAll(\n \"button.tna-footer__theme-selector-button[value]\",\n );\n\n Array.from(this.$themeSelectorButtons).forEach(($themeSelectorButton) => {\n $themeSelectorButton.addEventListener(\"click\", (event) => {\n const $button = event.target;\n this.setTheme($button.value);\n this.selectThemeSelectorButton($button);\n });\n });\n\n this.$themeSelectorEnableSettingsCookiesButton.addEventListener(\n \"click\",\n () => {\n this.cookies.acceptPolicy(\"settings\");\n },\n );\n\n this.showThemeSelector();\n this.cookies.on(\"changePolicy\", (data) => {\n if (Object.hasOwn(data, \"settings\")) {\n if (data.settings === true) {\n this.cookies.set(this.themeCookieName, this.currentTheme);\n this.$themeSelectorNotice.setAttribute(\"hidden\", \"\");\n } else {\n this.cookies.delete(this.themeCookieName);\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n });\n }\n\n showThemeSelector() {\n this.$themeSelector.removeAttribute(\"hidden\");\n if (this.cookies.exists(this.themeCookieName)) {\n const $currentThemeButton = Array.from(this.$themeSelectorButtons).find(\n ($button) => $button.value === this.cookies.get(this.themeCookieName),\n );\n if ($currentThemeButton) {\n this.selectThemeSelectorButton($currentThemeButton);\n }\n }\n if (!this.cookies.isPolicyAccepted(\"settings\")) {\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n\n setTheme(theme) {\n if (theme === \"light\") {\n this.$tnaTemplate.classList.remove(\n \"tna-template--system-theme\",\n \"tna-template--dark-theme\",\n );\n } else if (theme === \"dark\") {\n this.$tnaTemplate.classList.remove(\"tna-template--system-theme\");\n this.$tnaTemplate.classList.add(`tna-template--dark-theme`);\n } else if (theme === \"system\") {\n this.$tnaTemplate.classList.remove(\"tna-template--dark-theme\");\n this.$tnaTemplate.classList.add(`tna-template--system-theme`);\n } else {\n return;\n }\n this.currentTheme = theme;\n if (this.cookies.isPolicyAccepted(\"settings\")) {\n this.cookies.set(this.themeCookieName, this.currentTheme);\n } else {\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n\n selectThemeSelectorButton($selectedButton) {\n Array.from(this.$themeSelectorButtons).forEach(($button) => {\n if ($button.value === $selectedButton.value) {\n $button.classList.remove(\"tna-button--plain\");\n $button.setAttribute(\"aria-current\", true);\n } else {\n $button.classList.add(\"tna-button--plain\");\n $button.removeAttribute(\"aria-current\");\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","_window","window","TNAFrontendCookieEvents","CookieEventHandler","debug","arguments","length","undefined","_classCallCheck","this","_defineProperty","log","key","value","_console","_len","args","Array","_key","console","apply","concat","event","callback","Object","hasOwn","events","_toConsumableArray","oneTimeEvents","_this","data","forEach","eventToTrigger","call","eventIndex","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","options","document","documentElement","dataset","tnaFrontendDebug","defaultDomain","defaultPath","secure","policiesKey","defaultAge","_options$newInstance","newInstance","_options$noInit","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","parseInt","tnaCookiesDefaultAge","policiesCorrectOnInit","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","_objectSpread","usage","settings","marketing","essential","all","get","deserialised","cookie","split","trim","_parts","_slicedToArray","decodeURIComponent","JSON","parse","error","exists","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain","domain","_options$path","path","_options$secure","_options$session","session","secureString","sessionString","encodeURIComponent","trigger","set","_this2","setPolicy","accepted","allPolicies","toLowerCase","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","Footer","$module","themeCookieName","$themeSelector","querySelector","$themeSelectorNotice","$themeSelectorEnableSettingsCookiesButton","$tnaTemplate","currentTheme","themeOnLoad","cookies","$themeSelectorButtons","querySelectorAll","from","$themeSelectorButton","addEventListener","$button","target","setTheme","selectThemeSelectorButton","acceptPolicy","showThemeSelector","setAttribute","removeAttribute","$currentThemeButton","find","isPolicyAccepted","theme","classList","rem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CACK5I,KAAK4H,QAAQ7B,iBAAiB,aACjC/F,KAAKuH,qBAAqBoB,gBAAgB,SAE9C,CAEA,QAAAJ,CAASO,GACP,GAAc,UAAVA,EACF9I,KAAKyH,aAAasB,UAAUC,OAC1B,6BACA,iCAEG,GAAc,SAAVF,EACT9I,KAAKyH,aAAasB,UAAUC,OAAO,8BACnChJ,KAAKyH,aAAasB,UAAUE,IAAI,gCAC3B,IAAc,WAAVH,EAIT,OAHA9I,KAAKyH,aAAasB,UAAUC,OAAO,4BACnChJ,KAAKyH,aAAasB,UAAUE,IAAI,6BAGlC,CACAjJ,KAAK0H,aAAeoB,EAChB9I,KAAK4H,QAAQ7B,iBAAiB,YAChC/F,KAAK4H,QAAQjD,IAAI3E,KAAKoH,gBAAiBpH,KAAK0H,cAE5C1H,KAAKuH,qBAAqBoB,gBAAgB,SAE9C,CAEA,yBAAAH,CAA0BU,GACxBjB,MAAMC,KAAKlI,KAAK+H,uBAAuBnH,QAASyH,IAC1CA,EAAQlE,QAAU+E,EAAgB/E,OACpCkE,EAAQU,UAAUC,OAAO,qBACzBX,EAAQK,aAAa,gBAAgB,KAErCL,EAAQU,UAAUE,IAAI,qBACtBZ,EAAQM,gBAAgB,kBAG9B","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/footer/footer.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) === value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.log(\"Accepting policy:\", policy);\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.log(\"Rejecting policy:\", policy);\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.log(\"Saving policies:\", policies);\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.log(`Adding event listener for: ${event}`);\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.log(`Adding one-time event listener for: ${event}`);\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport class Footer {\n constructor($module, themeCookieName = \"theme\") {\n this.$module = $module;\n this.$themeSelector =\n $module && $module.querySelector(\".tna-footer__theme-selector\");\n this.$themeSelectorNotice =\n $module && $module.querySelector(\".tna-footer__theme-selector-notice\");\n this.$themeSelectorEnableSettingsCookiesButton =\n this.$themeSelectorNotice &&\n this.$themeSelectorNotice.querySelector(\n \".tna-footer__theme-selector-enable-settings-cookies\",\n );\n this.$tnaTemplate = document.querySelector(\".tna-template\");\n\n if (\n !this.$module ||\n !this.$themeSelector ||\n !this.$themeSelectorNotice ||\n !this.$themeSelectorEnableSettingsCookiesButton ||\n !this.$tnaTemplate\n ) {\n return;\n }\n\n this.themeCookieName = themeCookieName;\n\n this.init();\n }\n\n init() {\n this.currentTheme = this.$themeSelector.dataset.themeOnLoad;\n\n this.cookies = new Cookies();\n\n this.$themeSelectorButtons = this.$themeSelector.querySelectorAll(\n \"button.tna-footer__theme-selector-button[value]\",\n );\n\n Array.from(this.$themeSelectorButtons).forEach(($themeSelectorButton) => {\n $themeSelectorButton.addEventListener(\"click\", (event) => {\n const $button = event.target;\n this.setTheme($button.value);\n this.selectThemeSelectorButton($button);\n });\n });\n\n this.$themeSelectorEnableSettingsCookiesButton.addEventListener(\n \"click\",\n () => {\n this.cookies.acceptPolicy(\"settings\");\n },\n );\n\n this.showThemeSelector();\n this.cookies.on(\"changePolicy\", (data) => {\n if (Object.hasOwn(data, \"settings\")) {\n if (data.settings === true) {\n this.cookies.set(this.themeCookieName, this.currentTheme);\n this.$themeSelectorNotice.setAttribute(\"hidden\", \"\");\n } else {\n this.cookies.delete(this.themeCookieName);\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n });\n }\n\n showThemeSelector() {\n this.$themeSelector.removeAttribute(\"hidden\");\n if (this.cookies.exists(this.themeCookieName)) {\n const $currentThemeButton = Array.from(this.$themeSelectorButtons).find(\n ($button) => $button.value === this.cookies.get(this.themeCookieName),\n );\n if ($currentThemeButton) {\n this.selectThemeSelectorButton($currentThemeButton);\n }\n }\n if (!this.cookies.isPolicyAccepted(\"settings\")) {\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n\n setTheme(theme) {\n if (theme === \"light\") {\n this.$tnaTemplate.classList.remove(\n \"tna-template--system-theme\",\n \"tna-template--dark-theme\",\n );\n } else if (theme === \"dark\") {\n this.$tnaTemplate.classList.remove(\"tna-template--system-theme\");\n this.$tnaTemplate.classList.add(`tna-template--dark-theme`);\n } else if (theme === \"system\") {\n this.$tnaTemplate.classList.remove(\"tna-template--dark-theme\");\n this.$tnaTemplate.classList.add(`tna-template--system-theme`);\n } else {\n return;\n }\n this.currentTheme = theme;\n if (this.cookies.isPolicyAccepted(\"settings\")) {\n this.cookies.set(this.themeCookieName, this.currentTheme);\n } else {\n this.$themeSelectorNotice.removeAttribute(\"hidden\");\n }\n }\n\n selectThemeSelectorButton($selectedButton) {\n Array.from(this.$themeSelectorButtons).forEach(($button) => {\n if ($button.value === $selectedButton.value) {\n $button.classList.remove(\"tna-button--plain\");\n $button.setAttribute(\"aria-current\", true);\n } else {\n $button.classList.add(\"tna-button--plain\");\n $button.removeAttribute(\"aria-current\");\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookieEvents","CookieEventHandler","events","oneTimeEvents","debug","constructor","this","log","args","console","on","event","callback","Object","hasOwn","once","trigger","data","forEach","eventToTrigger","call","eventIndex","length","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","defaultDomain","defaultPath","secure","policiesKey","defaultAge","policiesCorrectOnInit","document","documentElement","dataset","tnaFrontendDebug","options","newInstance","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","secondsInAYear","parseInt","tnaCookiesDefaultAge","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","usage","settings","marketing","essential","all","destroyInstance","deserialised","cookie","split","trim","parts","key","value","decodeURIComponent","JSON","parse","get","error","exists","hasValue","set","maxAge","sameSite","domain","path","session","secureString","sessionString","encodeURIComponent","deleteAll","delete","acceptPolicy","setPolicy","rejectPolicy","accepted","acceptAllPolicies","allPolicies","toLowerCase","rejectAllPolicies","stringify","isPolicyAccepted","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","Footer","$module","themeCookieName","$themeSelector","querySelector","$themeSelectorNotice","$themeSelectorEnableSettingsCookiesButton","$tnaTemplate","currentTheme","themeOnLoad","cookies","_lib_cookies_mjs__WEBPACK_IMPORTED_MODULE_0__","A","$themeSelectorButtons","querySelectorAll","Array","from","$themeSelectorButton","addEventListener","$button","target","setTheme","selectThemeSelectorButton","showThemeSelector","setAttribute","removeAttribute","$currentThemeButton","find","theme","classList","remove","add","$selectedButton"],"sourceRoot":""}
|