@iamproperty/components 5.7.1-beta4 → 5.7.1-beta5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/assets/css/components/barchart.component.css +1 -1
  2. package/assets/css/components/barchart.component.css.map +1 -1
  3. package/assets/css/components/charts.module.css +1 -1
  4. package/assets/css/components/charts.module.css.map +1 -1
  5. package/assets/css/core.min.css +1 -1
  6. package/assets/css/core.min.css.map +1 -1
  7. package/assets/css/style.min.css +1 -1
  8. package/assets/css/style.min.css.map +1 -1
  9. package/assets/js/components/accordion/accordion.component.min.js +1 -1
  10. package/assets/js/components/actionbar/actionbar.component.min.js +1 -1
  11. package/assets/js/components/address-lookup/address-lookup.component.min.js +1 -1
  12. package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
  13. package/assets/js/components/barchart/barchart.component.js +1 -0
  14. package/assets/js/components/barchart/barchart.component.min.js +3 -3
  15. package/assets/js/components/barchart/barchart.component.min.js.map +1 -1
  16. package/assets/js/components/card/card.component.min.js +1 -1
  17. package/assets/js/components/carousel/carousel.component.min.js +1 -1
  18. package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
  19. package/assets/js/components/fileupload/fileupload.component.min.js +1 -1
  20. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  21. package/assets/js/components/header/header.component.min.js +1 -1
  22. package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
  23. package/assets/js/components/marketing/marketing.component.min.js +1 -1
  24. package/assets/js/components/multiselect/multiselect.component.min.js +1 -1
  25. package/assets/js/components/nav/nav.component.min.js +1 -1
  26. package/assets/js/components/notification/notification.component.min.js +1 -1
  27. package/assets/js/components/pagination/pagination.component.min.js +1 -1
  28. package/assets/js/components/search/search.component.min.js +1 -1
  29. package/assets/js/components/slider/slider.component.min.js +1 -1
  30. package/assets/js/components/table/table.component.min.js +1 -1
  31. package/assets/js/components/tabs/tabs.component.min.js +1 -1
  32. package/assets/js/dynamic.min.js +1 -1
  33. package/assets/js/scripts.bundle.js +1 -1
  34. package/assets/js/scripts.bundle.min.js +1 -1
  35. package/assets/sass/components/barchart.component.scss +8 -4
  36. package/assets/sass/components/charts.module.scss +15 -20
  37. package/assets/sass/elements/admin-panel.scss +1 -1
  38. package/assets/ts/components/barchart/barchart.component.ts +1 -0
  39. package/dist/components.es.js +11 -11
  40. package/dist/components.umd.js +11 -11
  41. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"barchart.component.min.js","sources":["../../modules/helpers.js","../../modules/chart.module.js","barchart.component.js"],"sourcesContent":["// @ts-nocheck\n/**\n * Global helper functions to help maintain and enhance framework elements.\n * @module Helpers\n */\n/**\n * Add global classes used by the CSS and later JavaScript.\n * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.\n */\nexport const addBodyClasses = (body) => {\n body.classList.add(\"js-enabled\");\n if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {\n body.classList.add(\"ie\");\n }\n return null;\n};\n/**\n * Add global events.\n * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.\n */\nexport const addGlobalEvents = (body) => {\n const checkElements = function (hash) {\n const label = document.querySelector(`label[for=\"${hash.replace('#', '')}\"]`);\n const summary = document.querySelector(hash + ' summary');\n const dialog = document.querySelector(`dialog${hash}`);\n const detail = document.querySelector(`detail${hash}`);\n if (label instanceof HTMLElement)\n label.click();\n else if (summary instanceof HTMLElement)\n summary.click();\n else if (dialog instanceof HTMLElement)\n dialog.showModal();\n else if (detail instanceof HTMLElement)\n detail.addAttribute('open');\n };\n if (location.hash)\n checkElements(location.hash);\n window.addEventListener('hashchange', function () { checkElements(location.hash); }, false);\n addEventListener(\"popstate\", (event) => {\n if (event && event.state && event.state.type && event.state.type == \"pagination\") {\n let form = document.querySelector(`#${event.state.form}`);\n let pageInput = document.querySelector(`#${event.state.form} [data-pagination]`);\n if (pageInput)\n pageInput.value = event.state.page;\n else\n form.innerHTML += `<input name=\"page\" type=\"hidden\" data-pagination=\"true\" value=\"${event.state.page}\" />`;\n form.dispatchEvent(new Event(\"submit\"));\n }\n });\n document.addEventListener(\"submit\", (event) => {\n if (event && event.target instanceof HTMLElement && event.target.matches('form')) {\n let form = event.target;\n // Reset password types\n Array.from(form.querySelectorAll('[data-password-type]')).forEach((input, index) => {\n input.setAttribute('type', 'password');\n });\n if (form.querySelector(':invalid') || form.querySelector('.pwd-checker[data-strength=\"1\"]') || form.querySelector('.pwd-checker[data-strength=\"2\"]')) {\n form.classList.add('was-validated');\n event.preventDefault();\n }\n if (form.querySelector('iam-multiselect[data-is-required][data-error]')) {\n form.classList.add('was-validated');\n event.preventDefault();\n }\n }\n });\n document.addEventListener(\"keydown\", (e) => {\n if (e.key === \"Escape\") {\n if (document.querySelector('.dialog--transactional[open], .dialog--acknowledgement[open]')) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n });\n Array.from(document.querySelectorAll('label progress')).forEach((progress, index) => {\n let label = progress.closest('label');\n label.setAttribute('data-percent', progress.getAttribute('value'));\n });\n return null;\n};\nexport const isNumeric = function (str) {\n if (typeof str != \"string\")\n return false; // we only process strings! \n return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...\n !isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail\n};\nexport const zeroPad = (num, places) => String(num).padStart(places, '0');\nexport const ucfirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);\nexport const ucwords = (str) => str.split(' ').map(s => ucfirst(s)).join(' ');\nexport const unsnake = (str) => str.replace(/_/g, ' ');\nexport const snake = (str) => str.replace(/ /g, '_');\nexport const safeID = function (str) {\n str = str.toLowerCase();\n str = snake(str);\n str = str.replace(/\\W/g, '');\n return str;\n};\nexport const numberOfDays = function (startDateString, endDateString) {\n let convertStart = startDateString.split('/');\n let convertEnd = endDateString.split('/');\n let dateStart = new Date(convertStart[1] + '/' + convertStart[0] + '/' + convertStart[2]);\n let dateEnd = new Date(convertEnd[1] + '/' + convertEnd[0] + '/' + convertEnd[2]);\n if (dateStart == \"Invalid Date\")\n throw \"Start date is not a valid date\";\n if (dateEnd == \"Invalid Date\")\n throw \"End date is not a valid date\";\n // To calculate the time difference of two dates\n let diffTime = dateEnd.getTime() - dateStart.getTime();\n let numberOfDays = (diffTime / (1000 * 3600 * 24) + 1);\n if (numberOfDays < 0)\n throw \"The start date should be before the end date\";\n return numberOfDays;\n};\n// Used to get values from nested json objects\nexport const resolvePath = (object, path, defaultValue) => path.split(/[\\.\\[\\]\\'\\\"]/).filter(p => p).reduce((o, p) => o ? o[p] : defaultValue, object);\nexport const isTraversable = o => Array.isArray(o) || o !== null && ['function', 'object'].includes(typeof o);\nexport const getSwipeDirection = (touchstartX, touchstartY, touchendX, touchendY) => {\n const limit = Math.tan(45 * 1.5 / 180 * Math.PI);\n let pageWidth = window.innerWidth || document.body.clientWidth;\n let treshold = Math.max(1, Math.floor(0.01 * (pageWidth)));\n let x = touchendX - touchstartX;\n let y = touchendY - touchstartY;\n let xy = Math.abs(x / y);\n let yx = Math.abs(y / x);\n if (Math.abs(x) > treshold || Math.abs(y) > treshold) {\n if (yx <= limit) {\n if (x < 0) {\n return \"left\";\n }\n else {\n return \"right\";\n }\n }\n if (xy <= limit) {\n if (y < 0) {\n return \"top\";\n }\n else {\n return \"bottom\";\n }\n }\n }\n else {\n return \"tap\";\n }\n};\n","import { numberOfDays } from './helpers.js';\n// #region Functions that setup and trigger other functions \nexport const addClasses = (chartElement) => {\n // add colour classes\n for (let i = 1; i <= 10; i++) {\n if (chartElement.hasAttribute(`data-colour-${i}`)) {\n let colour = chartElement.getAttribute(`data-colour-${i}`);\n chartElement.style.setProperty(`--chart-colour-${i}`, `var(--chart-colour-${colour})`);\n chartElement.style.setProperty(`--chart-colour-${i}-hover`, `var(--chart-colour-${colour}-hover)`);\n }\n }\n return true;\n};\nexport const setupChart = (chartElement, chartOuter, tableElement) => {\n // #region Reset the chart\n // empty divs to re-populate\n const chartKey = chartOuter.querySelector('.chart__key');\n chartKey.innerHTML = '';\n const chartGuidelines = chartOuter.querySelector('.chart__guidelines');\n chartGuidelines.innerHTML = ``;\n const chartYaxis = chartOuter.querySelector('.chart__yaxis');\n chartYaxis.innerHTML = ``;\n // Remove old input fields\n Array.from(chartOuter.querySelectorAll(':scope > input[type=\"checkbox\"],:scope > input[type=\"radio\"]')).map((element) => { element.remove(); });\n // #endregion\n let { xaxis } = getChartData(chartElement, chartOuter);\n setCellData(chartElement, chartOuter, tableElement);\n createChartKey(chartOuter, tableElement, chartKey);\n createChartGuidelines(chartElement, chartOuter, chartGuidelines);\n createChartYaxis(chartElement, chartOuter, chartYaxis);\n if (xaxis) {\n createXaxis(chartElement, chartOuter, xaxis);\n }\n return true;\n};\n// #endregion\n// #region Event handlers and observers\nexport const setEventListener = function (chartOuter) {\n let chart = chartOuter.querySelector('.chart');\n chart.addEventListener('mousemove', (event) => {\n if (event && event.target instanceof HTMLElement && event.target.closest('td:not(:first-child')) {\n let column = event.target.closest('td:not(:first-child');\n var rect = column.getBoundingClientRect();\n let x = event.clientX - rect.left;\n let y = event.clientY - rect.top;\n chart.setAttribute('style', `--cursor-x: ${x}px; --cursor-y: ${y}px;`);\n }\n });\n // Use the part for the chart items to pass through states to the pages CSS\n let labels = chartOuter.querySelectorAll('label');\n Array.from(labels).forEach((label) => {\n if (chartOuter.querySelector(`input#${label.getAttribute('for')}`).checked)\n label.setAttribute('part', 'key-checked');\n else\n label.setAttribute('part', 'key-unchecked');\n });\n chartOuter.addEventListener('change', function () {\n Array.from(labels).forEach((label) => {\n if (chartOuter.querySelector(`input#${label.getAttribute('for')}`).checked)\n label.setAttribute('part', 'key-checked');\n else\n label.setAttribute('part', 'key-unchecked');\n });\n });\n};\nexport const setEventObservers = function (chartElement, chartOuter) {\n let table = chartElement.querySelector('table');\n let shadowTable = chartOuter.querySelector('table');\n const attributesUpdated = (mutationList, observer) => {\n observer.disconnect();\n observer2.disconnect();\n for (const mutation of mutationList) {\n if (mutation.attributeName == 'class' || (mutation.type === 'attributes' && mutation.attributeName === 'data-total') || mutation.type === 'attributes') {\n shadowTable.innerHTML = table.innerHTML;\n setupChart(chartElement, chartOuter, shadowTable);\n }\n }\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n };\n const tableUpdated = (mutationList, observer) => {\n observer.disconnect();\n observer2.disconnect();\n for (const mutation of mutationList) {\n if (mutation.type == \"characterData\" || (mutation.type == \"childList\" && mutation.addedNodes.length)) {\n shadowTable.innerHTML = table.innerHTML;\n setupChart(chartElement, chartOuter, shadowTable);\n }\n }\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n };\n let observer = new MutationObserver(tableUpdated);\n let observer2 = new MutationObserver(attributesUpdated);\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n return true;\n};\n// #endregion\n// #region GET functions\nexport const getChartData = function (chartElement, chartOuter) {\n let table = chartOuter.querySelector('.chart__wrapper table');\n let min = chartElement.hasAttribute('data-min') ? chartElement.getAttribute('data-min') : 0;\n let max = chartElement.hasAttribute('data-max') ? chartElement.getAttribute('data-max') : getLargestValue(table);\n let type = chartElement.hasAttribute('data-type') ? chartElement.getAttribute('data-type') : 'column';\n let yaxis = chartElement.hasAttribute('data-yaxis') ? chartElement.getAttribute('data-yaxis').split(',') : [];\n let guidelines = chartElement.hasAttribute('data-guidelines') ? chartElement.getAttribute('data-guidelines').split(',') : [];\n let targets = chartElement.hasAttribute('data-targets') ? JSON.parse(chartElement.getAttribute('data-targets')) : null;\n let events = chartElement.hasAttribute('data-events') ? JSON.parse(chartElement.getAttribute('data-events')) : null;\n let xaxis = chartElement.hasAttribute('data-xaxis') ? chartElement.getAttribute('data-xaxis').split(',') : null;\n let increment = chartElement.hasAttribute('data-increment') ? chartElement.getAttribute('data-increment') : null;\n let start = chartElement.hasAttribute('data-start') ? chartElement.getAttribute('data-start') : 0;\n let end = chartElement.hasAttribute('data-end') ? chartElement.getAttribute('data-end') : getLargestValue(table); // TODO - get largest value from the data-xaxis\n let slope = chartElement.hasAttribute('data-slope') ? chartElement.getAttribute('data-slope') : null;\n let yInt = chartElement.hasAttribute('data-yint') ? chartElement.getAttribute('data-yint') : null;\n return { min, max, type, yaxis, targets, events, xaxis, increment, start, end, slope, yInt, guidelines };\n};\nfunction getLargestValue(table) {\n let values = Array.from(table.querySelectorAll('tbody td:not(:first-child)')).map((element) => {\n let currentValue = String(element.textContent);\n currentValue = currentValue.replace('£', '');\n currentValue = currentValue.replace('%', '');\n currentValue = currentValue.replace(',', '');\n currentValue = Number.parseFloat(currentValue);\n return currentValue;\n });\n let largetValue = Math.max(...values);\n // TO DO round to the nearest 10, 100, 1000 and so on\n return Math.ceil(largetValue);\n}\nconst getValues = function (value, min, max, start) {\n let cleanValue = String(value);\n cleanValue = cleanValue.replace('£', '');\n cleanValue = cleanValue.replace('%', '');\n cleanValue = cleanValue.replace(',', '');\n cleanValue = Number.parseFloat(cleanValue);\n let percent = ((cleanValue - min) / (max - min)) * 100;\n let axis = percent;\n let bottom = 0;\n if (start && start != 0) {\n bottom = ((start - min) / (max - min)) * 100;\n }\n // If the value is negative the position below the 0 line\n if (min < 0) {\n bottom = Math.abs(((min) / (max - min)) * 100);\n if (cleanValue < 0) {\n percent = bottom - percent;\n bottom = bottom - percent;\n axis = bottom;\n }\n else {\n percent = percent - bottom;\n axis = percent + bottom;\n }\n }\n return { percent, axis, bottom };\n};\n// #endregion\n// #region SET functions - set data attributes and classes\nexport const setCellData = function (chartElement, chartOuter, table) {\n let { min, max } = getChartData(chartElement, chartOuter);\n let increment = chartElement.getAttribute('data-increment');\n let startDay = min;\n Array.from(table.querySelectorAll('tbody tr')).forEach((tr, index) => {\n let group = tr.querySelector('td:first-child, th:first-child') ? tr.querySelector('td:first-child, th:first-child').textContent : '';\n tr.setAttribute('part', 'group');\n // Set the data numeric value if not set\n Array.from(tr.querySelectorAll('td:not([data-numeric]):not(:first-child)')).forEach((td) => {\n let value = parseFloat(td.textContent.replace('£', '').replace('%', '').replace(',', ''));\n let start = 0;\n if (increment == \"days\") {\n let dates = td.textContent.split(' - ');\n if (dates[1]) {\n value = numberOfDays(dates[0], dates[1]);\n start = numberOfDays(startDay, dates[0]) - 1;\n }\n }\n td.setAttribute('data-numeric', value);\n td.setAttribute('data-value', td.textContent);\n td.setAttribute('data-start', start);\n });\n // Set the data label value if not set\n Array.from(tr.querySelectorAll('td:not([data-label])')).forEach((td, index) => {\n if (index == 0)\n td.setAttribute('part', 'xaxis-label'); // PART\n else\n td.setAttribute('part', 'value');\n if (tr.querySelectorAll('td').length > 2)\n td.setAttribute('data-label', table.querySelectorAll('thead th')[index].textContent);\n });\n /*\n if(tr.querySelector('[data-label=\"Total\"]')){\n tr.setAttribute('data-total',tr.querySelector('[data-label=\"Total\"][data-numeric]').getAttribute('data-numeric'));\n }\n \n if(tr.querySelector('[data-label=\"Min\"]')){\n tr.setAttribute('data-min',tr.querySelector('[data-label=\"Min\"][data-numeric]').getAttribute('data-numeric'));\n }\n if(tr.querySelector('[data-label=\"Max\"]')){\n tr.setAttribute('data-max',tr.querySelector('[data-label=\"Max\"][data-numeric]').getAttribute('data-numeric'));\n }\n \n */\n let rowMin = tr.hasAttribute('data-min') ? tr.getAttribute('data-min') : min;\n let rowMax = tr.hasAttribute('data-max') ? tr.getAttribute('data-max') : max;\n if (rowMin < 0) {\n let minBottom = Math.abs(((rowMin) / (rowMax - rowMin)) * 100);\n chartElement.setAttribute('style', `--min-bottom: ${minBottom}%;`);\n }\n // Add a useful index css var for the use of animatons.\n tr.style.setProperty('--row-index', index + 1);\n // Add css vars to cells\n Array.from(tr.querySelectorAll('td[data-numeric]:not([data-label=\"Min\"]):not([data-label=\"Max\"]):not(:first-child)')).forEach((td) => {\n let display = getComputedStyle(td).display;\n if (display == 'none')\n return;\n const content = td.innerHTML;\n const value = Number.parseFloat(td.getAttribute('data-numeric'));\n const start = Number.parseFloat(td.getAttribute('data-start'));\n if (!td.querySelector('span[data-group]'))\n td.innerHTML = `<span data-group=\"${group}\" ${td.hasAttribute('data-label') ? `data-label=\"${td.getAttribute('data-label')}\"` : ''} part=\"popover\">${content}</span>`;\n if (!td.hasAttribute('style')) {\n let { percent, bottom, axis } = getValues(value, rowMin, rowMax, start);\n td.setAttribute('data-percent', percent);\n td.setAttribute(\"style\", `--bottom:${bottom}%;--percent:${percent}%;--axis:${axis}%;`);\n }\n });\n });\n};\nexport const setLongestLabel = function (chartOuter) {\n let chartWrapper = chartOuter.querySelector('.chart__wrapper');\n let chartSpacer = chartOuter.querySelector('.chart__spacer span');\n let table = chartOuter.querySelector('.chart table');\n // set the longest label attr so that the bar chart knows what margin to set on the left\n let longestLabel = '';\n Array.from(table.querySelectorAll('tbody tr td:first-child')).forEach((td) => {\n if (typeof td.textContent != \"undefined\" && td.textContent.length > longestLabel.length) {\n longestLabel = td.textContent;\n }\n });\n chartWrapper.setAttribute('data-longest-label', longestLabel);\n chartSpacer.innerHTML = longestLabel;\n};\nexport const setLongestValue = function (chartOuter) {\n let chartWrapper = chartOuter.querySelector('.chart__wrapper');\n let table = chartOuter.querySelector('.chart table');\n let longestValue = '';\n Array.from(table.querySelectorAll('tbody tr td:not(:first-child) span')).forEach((td) => {\n if (typeof td.textContent != \"undefined\" && td.textContent.length > longestValue.length)\n longestValue = td.textContent;\n });\n chartWrapper.setAttribute('data-longest-value', longestValue);\n};\n// #endregion\n// #region CREATE function\nexport const createChartKey = function (chartOuter, tableElement, chartKey) {\n const chartID = `chart-${Date.now() + (Math.floor(Math.random() * 100) + 1)}`;\n //const chartOuter = chartElement.querySelector('.chart__outer');\n let previousInput;\n let headings = Array.from(tableElement.querySelectorAll('thead th'));\n headings.forEach((arrayElement, index) => {\n if (index != 0) {\n previousInput = createChartKeyItem(chartID, index, arrayElement.textContent, chartKey, chartOuter, previousInput);\n }\n if (index == 50) {\n headings.length = index + 1;\n }\n });\n return true;\n};\nfunction createChartKeyItem(chartID, index, text, chartKey, chartOuter, previousInput) {\n let input = document.createElement('input');\n input.setAttribute('name', `${chartID}-dataset-${index}`);\n input.setAttribute('id', `${chartID}-dataset-${index}`);\n input.checked = true;\n input.setAttribute('type', `checkbox`);\n if (index == 1)\n chartOuter.prepend(input);\n else\n chartOuter.insertBefore(input, previousInput.nextSibling);\n previousInput = input;\n let label = document.createElement('label');\n label.setAttribute('class', `key btn btn-action`);\n label.setAttribute('for', `${chartID}-dataset-${index}`);\n label.setAttribute('data-label', `${text}`);\n label.setAttribute('part', `key`);\n label.innerHTML = `${text}`;\n chartKey.append(label);\n return previousInput;\n}\nexport const createChartGuidelines = function (chartElement, chartOuter, chartGuidelines) {\n let { min, max, yaxis, increment, guidelines } = getChartData(chartElement, chartOuter);\n if (!guidelines.length)\n guidelines = yaxis;\n if (increment == \"days\") {\n max = numberOfDays(min, max);\n min = 0;\n }\n chartGuidelines.innerHTML = '';\n for (var i = 0; i < guidelines.length; i++) {\n let value = parseFloat(guidelines[i].replace('£', '').replace('%', '').replace(',', ''));\n let { axis } = getValues(value, min, max);\n chartGuidelines.innerHTML += `<div class=\"guideline\" style=\"--percent:${axis}%;\">${yaxis.indexOf(guidelines[i]) != -1 ? `<span>${guidelines[i]}</span>` : ''}</div>`;\n }\n};\nexport const createChartYaxis = function (chartElement, chartOuter, chartYaxis) {\n let { min, max, yaxis, increment } = getChartData(chartElement, chartOuter);\n let startDay = min;\n if (increment == \"days\") {\n max = numberOfDays(min, max);\n min = 0;\n }\n chartYaxis.innerHTML = '';\n for (var i = 0; i < yaxis.length; i++) {\n let value = parseFloat(yaxis[i].replace('£', '').replace('%', ''));\n if (increment == \"days\") {\n value = numberOfDays(startDay, yaxis[i]);\n }\n let { axis } = getValues(value, min, max);\n chartYaxis.innerHTML += `<div class=\"axis__point\" style=\"--percent:${axis}%;\"><span>${yaxis[i]}</span></div>`;\n }\n};\nexport const createXaxis = function (chartElement, chartOuter, xaxis) {\n const chart = chartOuter.querySelector('.chart');\n let chartXaxis = chartOuter.querySelector('.chart__xaxis');\n let { increment, start, end } = getChartData(chartElement, chartOuter);\n if (!chartXaxis) {\n chartXaxis = document.createElement('div');\n chartXaxis.setAttribute('class', 'chart__xaxis');\n }\n if (increment && start && end) {\n chartXaxis.innerHTML = '';\n for (var i = 0; i < xaxis.length; i++) {\n let value = parseFloat(xaxis[i].replace('£', '').replace('%', ''));\n let position = ((value - start) / (end - start)) * 100;\n chartXaxis.innerHTML += `<div class=\"axis__point\" style=\"--percent:${position}%;\"><span>${xaxis[i]}</span></div>`;\n }\n }\n chart.prepend(chartXaxis);\n};\nexport const createTooltips = function (chartOuter) {\n const titles = chartOuter.querySelectorAll('thead th[title], tbody th[title]:first-child, tbody td[title]:first-child');\n Array.from(titles).forEach((title) => {\n let tooltipId = `tooltip-${Date.now()}-${Math.floor(Math.random() * 100)}`;\n title.innerHTML = `<button class=\"tooltip\" popovertarget=\"${tooltipId}\" part=\"tooltip\" style=\"anchor-name: --${tooltipId};\">${title.textContent}</button><span id=\"${tooltipId}\" style=\"position-anchor: --${tooltipId};\" popover part=\"tooltip__content\" class=\"tooltip__content\">${title.getAttribute('title')}</span>`;\n //title.removeAttribute('title'); // TODO add a supports query for anchor positioning\n });\n};\n// #endregion\nexport default setupChart;\n","// @ts-nocheck\nimport { addClasses, setupChart, setEventListener, setEventObservers, setLongestLabel, setLongestValue, createTooltips } from \"../../modules/chart.module.js\";\n// TODO: tooltip\n// TODO: responsive 'fit-content' classes done through JS\nclass iamBarChart extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';\n const loadCSS = `@import \"${assetLocation}/css/components/barchart.component.css\";`;\n const template = document.createElement('template');\n template.innerHTML = `\n <style>\n ${loadCSS}\n </style>\n <slot name=\"before\"></slot>\n <div class=\"chart__outer\" part=\"outer\">\n <div class=\"chart__key\" part=\"chart-key\"></div>\n <div class=\"chart__wrapper\" part=\"wrapper\">\n <div class=\"chart__yaxis\" part=\"yaxis\"></div>\n <div class=\"chart\" part=\"chart\">\n <div class=\"chart__guidelines\" part=\"guidelines\"></div>\n </div>\n </div>\n <div class=\"chart__spacer\"><span part=\"spacer\"></span</div>\n </div>\n <slot name=\"after\"></slot>`;\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n connectedCallback() {\n const chartComponent = this;\n const chartID = `chart-${Date.now() + (Math.floor(Math.random() * 100) + 1)}`;\n const orginalTable = this.querySelector('table');\n const clonedTable = orginalTable.cloneNode(true);\n const chart = this.shadowRoot.querySelector('.chart');\n const chartOuter = this.shadowRoot.querySelector('.chart__outer');\n chart.appendChild(clonedTable);\n addClasses(chartComponent);\n const barCount = chart.querySelectorAll('td:not(:first-child)').length;\n if (barCount < 10) {\n chartComponent.classList.add('chart--fit-content');\n }\n setupChart(chartComponent, chartOuter, clonedTable);\n setEventObservers(chartComponent, chartOuter);\n setEventListener(chartOuter);\n setLongestLabel(chartOuter);\n setLongestValue(chartOuter);\n createTooltips(chartOuter);\n }\n attributeChangedCallback(attrName, oldVal, newVal) {\n }\n}\nexport default iamBarChart;\n"],"names":["numberOfDays","startDateString","endDateString","convertStart","convertEnd","dateStart","dateEnd","addClasses","chartElement","i","colour","setupChart","chartOuter","tableElement","chartKey","chartGuidelines","chartYaxis","element","xaxis","getChartData","setCellData","createChartKey","createChartGuidelines","createChartYaxis","createXaxis","setEventListener","chart","event","rect","x","y","labels","label","setEventObservers","table","shadowTable","attributesUpdated","mutationList","observer","observer2","mutation","tableUpdated","min","max","getLargestValue","type","yaxis","guidelines","targets","events","increment","start","end","slope","yInt","values","currentValue","largetValue","getValues","value","cleanValue","percent","axis","bottom","startDay","tr","index","group","td","dates","rowMin","rowMax","minBottom","content","setLongestLabel","chartWrapper","chartSpacer","longestLabel","setLongestValue","longestValue","chartID","previousInput","headings","arrayElement","createChartKeyItem","text","input","chartXaxis","position","createTooltips","titles","title","tooltipId","iamBarChart","template","chartComponent","clon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,EAAkB8D,EAAgBnF,CAAU,EAC5Ca,EAAiBb,CAAU,EAC3B8D,EAAgB9D,CAAU,EAC1BkE,EAAgBlE,CAAU,EAC1B6E,EAAe7E,CAAU,CAC5B,CACD,yBAAyBqF,EAAUC,EAAQC,EAAQ,CAClD,CACL"}
1
+ {"version":3,"file":"barchart.component.min.js","sources":["../../modules/helpers.js","../../modules/chart.module.js","barchart.component.js"],"sourcesContent":["// @ts-nocheck\n/**\n * Global helper functions to help maintain and enhance framework elements.\n * @module Helpers\n */\n/**\n * Add global classes used by the CSS and later JavaScript.\n * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.\n */\nexport const addBodyClasses = (body) => {\n body.classList.add(\"js-enabled\");\n if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {\n body.classList.add(\"ie\");\n }\n return null;\n};\n/**\n * Add global events.\n * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.\n */\nexport const addGlobalEvents = (body) => {\n const checkElements = function (hash) {\n const label = document.querySelector(`label[for=\"${hash.replace('#', '')}\"]`);\n const summary = document.querySelector(hash + ' summary');\n const dialog = document.querySelector(`dialog${hash}`);\n const detail = document.querySelector(`detail${hash}`);\n if (label instanceof HTMLElement)\n label.click();\n else if (summary instanceof HTMLElement)\n summary.click();\n else if (dialog instanceof HTMLElement)\n dialog.showModal();\n else if (detail instanceof HTMLElement)\n detail.addAttribute('open');\n };\n if (location.hash)\n checkElements(location.hash);\n window.addEventListener('hashchange', function () { checkElements(location.hash); }, false);\n addEventListener(\"popstate\", (event) => {\n if (event && event.state && event.state.type && event.state.type == \"pagination\") {\n let form = document.querySelector(`#${event.state.form}`);\n let pageInput = document.querySelector(`#${event.state.form} [data-pagination]`);\n if (pageInput)\n pageInput.value = event.state.page;\n else\n form.innerHTML += `<input name=\"page\" type=\"hidden\" data-pagination=\"true\" value=\"${event.state.page}\" />`;\n form.dispatchEvent(new Event(\"submit\"));\n }\n });\n document.addEventListener(\"submit\", (event) => {\n if (event && event.target instanceof HTMLElement && event.target.matches('form')) {\n let form = event.target;\n // Reset password types\n Array.from(form.querySelectorAll('[data-password-type]')).forEach((input, index) => {\n input.setAttribute('type', 'password');\n });\n if (form.querySelector(':invalid') || form.querySelector('.pwd-checker[data-strength=\"1\"]') || form.querySelector('.pwd-checker[data-strength=\"2\"]')) {\n form.classList.add('was-validated');\n event.preventDefault();\n }\n if (form.querySelector('iam-multiselect[data-is-required][data-error]')) {\n form.classList.add('was-validated');\n event.preventDefault();\n }\n }\n });\n document.addEventListener(\"keydown\", (e) => {\n if (e.key === \"Escape\") {\n if (document.querySelector('.dialog--transactional[open], .dialog--acknowledgement[open]')) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n });\n Array.from(document.querySelectorAll('label progress')).forEach((progress, index) => {\n let label = progress.closest('label');\n label.setAttribute('data-percent', progress.getAttribute('value'));\n });\n return null;\n};\nexport const isNumeric = function (str) {\n if (typeof str != \"string\")\n return false; // we only process strings! \n return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...\n !isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail\n};\nexport const zeroPad = (num, places) => String(num).padStart(places, '0');\nexport const ucfirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);\nexport const ucwords = (str) => str.split(' ').map(s => ucfirst(s)).join(' ');\nexport const unsnake = (str) => str.replace(/_/g, ' ');\nexport const snake = (str) => str.replace(/ /g, '_');\nexport const safeID = function (str) {\n str = str.toLowerCase();\n str = snake(str);\n str = str.replace(/\\W/g, '');\n return str;\n};\nexport const numberOfDays = function (startDateString, endDateString) {\n let convertStart = startDateString.split('/');\n let convertEnd = endDateString.split('/');\n let dateStart = new Date(convertStart[1] + '/' + convertStart[0] + '/' + convertStart[2]);\n let dateEnd = new Date(convertEnd[1] + '/' + convertEnd[0] + '/' + convertEnd[2]);\n if (dateStart == \"Invalid Date\")\n throw \"Start date is not a valid date\";\n if (dateEnd == \"Invalid Date\")\n throw \"End date is not a valid date\";\n // To calculate the time difference of two dates\n let diffTime = dateEnd.getTime() - dateStart.getTime();\n let numberOfDays = (diffTime / (1000 * 3600 * 24) + 1);\n if (numberOfDays < 0)\n throw \"The start date should be before the end date\";\n return numberOfDays;\n};\n// Used to get values from nested json objects\nexport const resolvePath = (object, path, defaultValue) => path.split(/[\\.\\[\\]\\'\\\"]/).filter(p => p).reduce((o, p) => o ? o[p] : defaultValue, object);\nexport const isTraversable = o => Array.isArray(o) || o !== null && ['function', 'object'].includes(typeof o);\nexport const getSwipeDirection = (touchstartX, touchstartY, touchendX, touchendY) => {\n const limit = Math.tan(45 * 1.5 / 180 * Math.PI);\n let pageWidth = window.innerWidth || document.body.clientWidth;\n let treshold = Math.max(1, Math.floor(0.01 * (pageWidth)));\n let x = touchendX - touchstartX;\n let y = touchendY - touchstartY;\n let xy = Math.abs(x / y);\n let yx = Math.abs(y / x);\n if (Math.abs(x) > treshold || Math.abs(y) > treshold) {\n if (yx <= limit) {\n if (x < 0) {\n return \"left\";\n }\n else {\n return \"right\";\n }\n }\n if (xy <= limit) {\n if (y < 0) {\n return \"top\";\n }\n else {\n return \"bottom\";\n }\n }\n }\n else {\n return \"tap\";\n }\n};\n","import { numberOfDays } from './helpers.js';\n// #region Functions that setup and trigger other functions \nexport const addClasses = (chartElement) => {\n // add colour classes\n for (let i = 1; i <= 10; i++) {\n if (chartElement.hasAttribute(`data-colour-${i}`)) {\n let colour = chartElement.getAttribute(`data-colour-${i}`);\n chartElement.style.setProperty(`--chart-colour-${i}`, `var(--chart-colour-${colour})`);\n chartElement.style.setProperty(`--chart-colour-${i}-hover`, `var(--chart-colour-${colour}-hover)`);\n }\n }\n return true;\n};\nexport const setupChart = (chartElement, chartOuter, tableElement) => {\n // #region Reset the chart\n // empty divs to re-populate\n const chartKey = chartOuter.querySelector('.chart__key');\n chartKey.innerHTML = '';\n const chartGuidelines = chartOuter.querySelector('.chart__guidelines');\n chartGuidelines.innerHTML = ``;\n const chartYaxis = chartOuter.querySelector('.chart__yaxis');\n chartYaxis.innerHTML = ``;\n // Remove old input fields\n Array.from(chartOuter.querySelectorAll(':scope > input[type=\"checkbox\"],:scope > input[type=\"radio\"]')).map((element) => { element.remove(); });\n // #endregion\n let { xaxis } = getChartData(chartElement, chartOuter);\n setCellData(chartElement, chartOuter, tableElement);\n createChartKey(chartOuter, tableElement, chartKey);\n createChartGuidelines(chartElement, chartOuter, chartGuidelines);\n createChartYaxis(chartElement, chartOuter, chartYaxis);\n if (xaxis) {\n createXaxis(chartElement, chartOuter, xaxis);\n }\n return true;\n};\n// #endregion\n// #region Event handlers and observers\nexport const setEventListener = function (chartOuter) {\n let chart = chartOuter.querySelector('.chart');\n chart.addEventListener('mousemove', (event) => {\n if (event && event.target instanceof HTMLElement && event.target.closest('td:not(:first-child')) {\n let column = event.target.closest('td:not(:first-child');\n var rect = column.getBoundingClientRect();\n let x = event.clientX - rect.left;\n let y = event.clientY - rect.top;\n chart.setAttribute('style', `--cursor-x: ${x}px; --cursor-y: ${y}px;`);\n }\n });\n // Use the part for the chart items to pass through states to the pages CSS\n let labels = chartOuter.querySelectorAll('label');\n Array.from(labels).forEach((label) => {\n if (chartOuter.querySelector(`input#${label.getAttribute('for')}`).checked)\n label.setAttribute('part', 'key-checked');\n else\n label.setAttribute('part', 'key-unchecked');\n });\n chartOuter.addEventListener('change', function () {\n Array.from(labels).forEach((label) => {\n if (chartOuter.querySelector(`input#${label.getAttribute('for')}`).checked)\n label.setAttribute('part', 'key-checked');\n else\n label.setAttribute('part', 'key-unchecked');\n });\n });\n};\nexport const setEventObservers = function (chartElement, chartOuter) {\n let table = chartElement.querySelector('table');\n let shadowTable = chartOuter.querySelector('table');\n const attributesUpdated = (mutationList, observer) => {\n observer.disconnect();\n observer2.disconnect();\n for (const mutation of mutationList) {\n if (mutation.attributeName == 'class' || (mutation.type === 'attributes' && mutation.attributeName === 'data-total') || mutation.type === 'attributes') {\n shadowTable.innerHTML = table.innerHTML;\n setupChart(chartElement, chartOuter, shadowTable);\n }\n }\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n };\n const tableUpdated = (mutationList, observer) => {\n observer.disconnect();\n observer2.disconnect();\n for (const mutation of mutationList) {\n if (mutation.type == \"characterData\" || (mutation.type == \"childList\" && mutation.addedNodes.length)) {\n shadowTable.innerHTML = table.innerHTML;\n setupChart(chartElement, chartOuter, shadowTable);\n }\n }\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n };\n let observer = new MutationObserver(tableUpdated);\n let observer2 = new MutationObserver(attributesUpdated);\n observer.observe(table, { characterData: true, subtree: true });\n observer2.observe(chartElement, { attributes: true });\n return true;\n};\n// #endregion\n// #region GET functions\nexport const getChartData = function (chartElement, chartOuter) {\n let table = chartOuter.querySelector('.chart__wrapper table');\n let min = chartElement.hasAttribute('data-min') ? chartElement.getAttribute('data-min') : 0;\n let max = chartElement.hasAttribute('data-max') ? chartElement.getAttribute('data-max') : getLargestValue(table);\n let type = chartElement.hasAttribute('data-type') ? chartElement.getAttribute('data-type') : 'column';\n let yaxis = chartElement.hasAttribute('data-yaxis') ? chartElement.getAttribute('data-yaxis').split(',') : [];\n let guidelines = chartElement.hasAttribute('data-guidelines') ? chartElement.getAttribute('data-guidelines').split(',') : [];\n let targets = chartElement.hasAttribute('data-targets') ? JSON.parse(chartElement.getAttribute('data-targets')) : null;\n let events = chartElement.hasAttribute('data-events') ? JSON.parse(chartElement.getAttribute('data-events')) : null;\n let xaxis = chartElement.hasAttribute('data-xaxis') ? chartElement.getAttribute('data-xaxis').split(',') : null;\n let increment = chartElement.hasAttribute('data-increment') ? chartElement.getAttribute('data-increment') : null;\n let start = chartElement.hasAttribute('data-start') ? chartElement.getAttribute('data-start') : 0;\n let end = chartElement.hasAttribute('data-end') ? chartElement.getAttribute('data-end') : getLargestValue(table); // TODO - get largest value from the data-xaxis\n let slope = chartElement.hasAttribute('data-slope') ? chartElement.getAttribute('data-slope') : null;\n let yInt = chartElement.hasAttribute('data-yint') ? chartElement.getAttribute('data-yint') : null;\n return { min, max, type, yaxis, targets, events, xaxis, increment, start, end, slope, yInt, guidelines };\n};\nfunction getLargestValue(table) {\n let values = Array.from(table.querySelectorAll('tbody td:not(:first-child)')).map((element) => {\n let currentValue = String(element.textContent);\n currentValue = currentValue.replace('£', '');\n currentValue = currentValue.replace('%', '');\n currentValue = currentValue.replace(',', '');\n currentValue = Number.parseFloat(currentValue);\n return currentValue;\n });\n let largetValue = Math.max(...values);\n // TO DO round to the nearest 10, 100, 1000 and so on\n return Math.ceil(largetValue);\n}\nconst getValues = function (value, min, max, start) {\n let cleanValue = String(value);\n cleanValue = cleanValue.replace('£', '');\n cleanValue = cleanValue.replace('%', '');\n cleanValue = cleanValue.replace(',', '');\n cleanValue = Number.parseFloat(cleanValue);\n let percent = ((cleanValue - min) / (max - min)) * 100;\n let axis = percent;\n let bottom = 0;\n if (start && start != 0) {\n bottom = ((start - min) / (max - min)) * 100;\n }\n // If the value is negative the position below the 0 line\n if (min < 0) {\n bottom = Math.abs(((min) / (max - min)) * 100);\n if (cleanValue < 0) {\n percent = bottom - percent;\n bottom = bottom - percent;\n axis = bottom;\n }\n else {\n percent = percent - bottom;\n axis = percent + bottom;\n }\n }\n return { percent, axis, bottom };\n};\n// #endregion\n// #region SET functions - set data attributes and classes\nexport const setCellData = function (chartElement, chartOuter, table) {\n let { min, max } = getChartData(chartElement, chartOuter);\n let increment = chartElement.getAttribute('data-increment');\n let startDay = min;\n Array.from(table.querySelectorAll('tbody tr')).forEach((tr, index) => {\n let group = tr.querySelector('td:first-child, th:first-child') ? tr.querySelector('td:first-child, th:first-child').textContent : '';\n tr.setAttribute('part', 'group');\n // Set the data numeric value if not set\n Array.from(tr.querySelectorAll('td:not([data-numeric]):not(:first-child)')).forEach((td) => {\n let value = parseFloat(td.textContent.replace('£', '').replace('%', '').replace(',', ''));\n let start = 0;\n if (increment == \"days\") {\n let dates = td.textContent.split(' - ');\n if (dates[1]) {\n value = numberOfDays(dates[0], dates[1]);\n start = numberOfDays(startDay, dates[0]) - 1;\n }\n }\n td.setAttribute('data-numeric', value);\n td.setAttribute('data-value', td.textContent);\n td.setAttribute('data-start', start);\n });\n // Set the data label value if not set\n Array.from(tr.querySelectorAll('td:not([data-label])')).forEach((td, index) => {\n if (index == 0)\n td.setAttribute('part', 'xaxis-label'); // PART\n else\n td.setAttribute('part', 'value');\n if (tr.querySelectorAll('td').length > 2)\n td.setAttribute('data-label', table.querySelectorAll('thead th')[index].textContent);\n });\n /*\n if(tr.querySelector('[data-label=\"Total\"]')){\n tr.setAttribute('data-total',tr.querySelector('[data-label=\"Total\"][data-numeric]').getAttribute('data-numeric'));\n }\n \n if(tr.querySelector('[data-label=\"Min\"]')){\n tr.setAttribute('data-min',tr.querySelector('[data-label=\"Min\"][data-numeric]').getAttribute('data-numeric'));\n }\n if(tr.querySelector('[data-label=\"Max\"]')){\n tr.setAttribute('data-max',tr.querySelector('[data-label=\"Max\"][data-numeric]').getAttribute('data-numeric'));\n }\n \n */\n let rowMin = tr.hasAttribute('data-min') ? tr.getAttribute('data-min') : min;\n let rowMax = tr.hasAttribute('data-max') ? tr.getAttribute('data-max') : max;\n if (rowMin < 0) {\n let minBottom = Math.abs(((rowMin) / (rowMax - rowMin)) * 100);\n chartElement.setAttribute('style', `--min-bottom: ${minBottom}%;`);\n }\n // Add a useful index css var for the use of animatons.\n tr.style.setProperty('--row-index', index + 1);\n // Add css vars to cells\n Array.from(tr.querySelectorAll('td[data-numeric]:not([data-label=\"Min\"]):not([data-label=\"Max\"]):not(:first-child)')).forEach((td) => {\n let display = getComputedStyle(td).display;\n if (display == 'none')\n return;\n const content = td.innerHTML;\n const value = Number.parseFloat(td.getAttribute('data-numeric'));\n const start = Number.parseFloat(td.getAttribute('data-start'));\n if (!td.querySelector('span[data-group]'))\n td.innerHTML = `<span data-group=\"${group}\" ${td.hasAttribute('data-label') ? `data-label=\"${td.getAttribute('data-label')}\"` : ''} part=\"popover\">${content}</span>`;\n if (!td.hasAttribute('style')) {\n let { percent, bottom, axis } = getValues(value, rowMin, rowMax, start);\n td.setAttribute('data-percent', percent);\n td.setAttribute(\"style\", `--bottom:${bottom}%;--percent:${percent}%;--axis:${axis}%;`);\n }\n });\n });\n};\nexport const setLongestLabel = function (chartOuter) {\n let chartWrapper = chartOuter.querySelector('.chart__wrapper');\n let chartSpacer = chartOuter.querySelector('.chart__spacer span');\n let table = chartOuter.querySelector('.chart table');\n // set the longest label attr so that the bar chart knows what margin to set on the left\n let longestLabel = '';\n Array.from(table.querySelectorAll('tbody tr td:first-child')).forEach((td) => {\n if (typeof td.textContent != \"undefined\" && td.textContent.length > longestLabel.length) {\n longestLabel = td.textContent;\n }\n });\n chartWrapper.setAttribute('data-longest-label', longestLabel);\n chartSpacer.innerHTML = longestLabel;\n};\nexport const setLongestValue = function (chartOuter) {\n let chartWrapper = chartOuter.querySelector('.chart__wrapper');\n let table = chartOuter.querySelector('.chart table');\n let longestValue = '';\n Array.from(table.querySelectorAll('tbody tr td:not(:first-child) span')).forEach((td) => {\n if (typeof td.textContent != \"undefined\" && td.textContent.length > longestValue.length)\n longestValue = td.textContent;\n });\n chartWrapper.setAttribute('data-longest-value', longestValue);\n};\n// #endregion\n// #region CREATE function\nexport const createChartKey = function (chartOuter, tableElement, chartKey) {\n const chartID = `chart-${Date.now() + (Math.floor(Math.random() * 100) + 1)}`;\n //const chartOuter = chartElement.querySelector('.chart__outer');\n let previousInput;\n let headings = Array.from(tableElement.querySelectorAll('thead th'));\n headings.forEach((arrayElement, index) => {\n if (index != 0) {\n previousInput = createChartKeyItem(chartID, index, arrayElement.textContent, chartKey, chartOuter, previousInput);\n }\n if (index == 50) {\n headings.length = index + 1;\n }\n });\n return true;\n};\nfunction createChartKeyItem(chartID, index, text, chartKey, chartOuter, previousInput) {\n let input = document.createElement('input');\n input.setAttribute('name', `${chartID}-dataset-${index}`);\n input.setAttribute('id', `${chartID}-dataset-${index}`);\n input.checked = true;\n input.setAttribute('type', `checkbox`);\n if (index == 1)\n chartOuter.prepend(input);\n else\n chartOuter.insertBefore(input, previousInput.nextSibling);\n previousInput = input;\n let label = document.createElement('label');\n label.setAttribute('class', `key btn btn-action`);\n label.setAttribute('for', `${chartID}-dataset-${index}`);\n label.setAttribute('data-label', `${text}`);\n label.setAttribute('part', `key`);\n label.innerHTML = `${text}`;\n chartKey.append(label);\n return previousInput;\n}\nexport const createChartGuidelines = function (chartElement, chartOuter, chartGuidelines) {\n let { min, max, yaxis, increment, guidelines } = getChartData(chartElement, chartOuter);\n if (!guidelines.length)\n guidelines = yaxis;\n if (increment == \"days\") {\n max = numberOfDays(min, max);\n min = 0;\n }\n chartGuidelines.innerHTML = '';\n for (var i = 0; i < guidelines.length; i++) {\n let value = parseFloat(guidelines[i].replace('£', '').replace('%', '').replace(',', ''));\n let { axis } = getValues(value, min, max);\n chartGuidelines.innerHTML += `<div class=\"guideline\" style=\"--percent:${axis}%;\">${yaxis.indexOf(guidelines[i]) != -1 ? `<span>${guidelines[i]}</span>` : ''}</div>`;\n }\n};\nexport const createChartYaxis = function (chartElement, chartOuter, chartYaxis) {\n let { min, max, yaxis, increment } = getChartData(chartElement, chartOuter);\n let startDay = min;\n if (increment == \"days\") {\n max = numberOfDays(min, max);\n min = 0;\n }\n chartYaxis.innerHTML = '';\n for (var i = 0; i < yaxis.length; i++) {\n let value = parseFloat(yaxis[i].replace('£', '').replace('%', ''));\n if (increment == \"days\") {\n value = numberOfDays(startDay, yaxis[i]);\n }\n let { axis } = getValues(value, min, max);\n chartYaxis.innerHTML += `<div class=\"axis__point\" style=\"--percent:${axis}%;\"><span>${yaxis[i]}</span></div>`;\n }\n};\nexport const createXaxis = function (chartElement, chartOuter, xaxis) {\n const chart = chartOuter.querySelector('.chart');\n let chartXaxis = chartOuter.querySelector('.chart__xaxis');\n let { increment, start, end } = getChartData(chartElement, chartOuter);\n if (!chartXaxis) {\n chartXaxis = document.createElement('div');\n chartXaxis.setAttribute('class', 'chart__xaxis');\n }\n if (increment && start && end) {\n chartXaxis.innerHTML = '';\n for (var i = 0; i < xaxis.length; i++) {\n let value = parseFloat(xaxis[i].replace('£', '').replace('%', ''));\n let position = ((value - start) / (end - start)) * 100;\n chartXaxis.innerHTML += `<div class=\"axis__point\" style=\"--percent:${position}%;\"><span>${xaxis[i]}</span></div>`;\n }\n }\n chart.prepend(chartXaxis);\n};\nexport const createTooltips = function (chartOuter) {\n const titles = chartOuter.querySelectorAll('thead th[title], tbody th[title]:first-child, tbody td[title]:first-child');\n Array.from(titles).forEach((title) => {\n let tooltipId = `tooltip-${Date.now()}-${Math.floor(Math.random() * 100)}`;\n title.innerHTML = `<button class=\"tooltip\" popovertarget=\"${tooltipId}\" part=\"tooltip\" style=\"anchor-name: --${tooltipId};\">${title.textContent}</button><span id=\"${tooltipId}\" style=\"position-anchor: --${tooltipId};\" popover part=\"tooltip__content\" class=\"tooltip__content\">${title.getAttribute('title')}</span>`;\n //title.removeAttribute('title'); // TODO add a supports query for anchor positioning\n });\n};\n// #endregion\nexport default setupChart;\n","// @ts-nocheck\nimport { addClasses, setupChart, setEventListener, setEventObservers, setLongestLabel, setLongestValue, createTooltips } from \"../../modules/chart.module.js\";\n// TODO: tooltip\n// TODO: responsive 'fit-content' classes done through JS\nclass iamBarChart extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';\n const loadCSS = `@import \"${assetLocation}/css/components/barchart.component.css\";`;\n const template = document.createElement('template');\n template.innerHTML = `\n <style>\n ${loadCSS}\n </style>\n <slot name=\"before\"></slot>\n <div class=\"chart__outer\" part=\"outer\">\n <div class=\"chart__key\" part=\"chart-key\"></div>\n <div class=\"chart__wrapper\" part=\"wrapper\">\n <div class=\"chart__yaxis\" part=\"yaxis\"></div>\n <div class=\"chart\" part=\"chart\">\n <div class=\"chart__guidelines\" part=\"guidelines\"></div>\n </div>\n </div>\n <div class=\"chart__spacer\"><span part=\"spacer\"></span</div>\n </div>\n <slot name=\"after\"></slot>`;\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n connectedCallback() {\n const chartComponent = this;\n const chartID = `chart-${Date.now() + (Math.floor(Math.random() * 100) + 1)}`;\n const orginalTable = this.querySelector('table');\n const clonedTable = orginalTable.cloneNode(true);\n const chart = this.shadowRoot.querySelector('.chart');\n const chartOuter = this.shadowRoot.querySelector('.chart__outer');\n chart.appendChild(clonedTable);\n addClasses(chartComponent);\n const barCount = chart.querySelectorAll('td:not(:first-child)').length;\n if (barCount < 10) {\n chartComponent.classList.add('chart--fit-content');\n chartComponent.classList.add('chart--display-data');\n }\n setupChart(chartComponent, chartOuter, clonedTable);\n setEventObservers(chartComponent, chartOuter);\n setEventListener(chartOuter);\n setLongestLabel(chartOuter);\n setLongestValue(chartOuter);\n createTooltips(chartOuter);\n }\n attributeChangedCallback(attrName, oldVal, newVal) {\n }\n}\nexport default iamBarChart;\n"],"names":["numberOfDays","startDateString","endDateString","convertStart","convertEnd","dateStart","dateEnd","addClasses","chartElement","i","colour","setupChart","chartOuter","tableElement","chartKey","chartGuidelines","chartYaxis","element","xaxis","getChartData","setCellData","createChartKey","createChartGuidelines","createChartYaxis","createXaxis","setEventListener","chart","event","rect","x","y","labels","label","setEventObservers","table","shadowTable","attributesUpdated","mutationList","observer","observer2","mutation","tableUpdated","min","max","getLargestValue","type","yaxis","guidelines","targets","events","increment","start","end","slope","yInt","values","currentValue","largetValue","getValues","value","cleanValue","percent","axis","bottom","startDay","tr","index","group","td","dates","rowMin","rowMax","minBottom","content","setLongestLabel","chartWrapper","chartSpacer","longestLabel","setLongestValue","longestValue","chartID","previousInput","headings","arrayElement","createChartKeyItem","text","input","chartXaxis","position","createTooltips","titles","title","tooltipId","iamBarChart","template","chartComponent","clonedTable","attrName","oldVal","newVal"],"mappings":";;;IAiGO,MAAMA,EAAe,SAAUC,EAAiBC,EAAe,CAClE,IAAIC,EA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3B8D,EAAgB9D,CAAU,EAC1BkE,EAAgBlE,CAAU,EAC1B6E,EAAe7E,CAAU,CAC5B,CACD,yBAAyBqF,EAAUC,EAAQC,EAAQ,CAClD,CACL"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Card"});class m extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.querySelector('*:not(.badge):not(small):not(.btn) > [class*="fa-"]:not(.btn)')&&this.classList.add("card--has-icon");let e=this.classList.toString();const r=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",o=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${r}/css/core.min.css`,t=document.createElement("template");t.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */function p(l,o){var i;let t=l.querySelector(".carousel__inner"),u=l.querySelector(".carousel__controls"),n=o.querySelectorAll(":scope > .col").length;t.addEventListener("scroll",function(a){clearTimeout(i),i=setTimeout(function(){let s=t.clientWidth,e=t.scrollWidth,r=t.scrollLeft,d=Math.round(r/e*n)+1,m=o.querySelector(":scope > .col").scrollWidth,b=o.querySelector(":scope > .col:last-child").offsetLeft,f=t.scrollLeft+s+t.getBoundingClientRect().left>=b+60,h=Math.round(s/m);Math.ceil(n/h)*h-n>0&&f&&(d=Math.floor(n/h)*h+1),Array.from(l.querySelectorAll(".carousel__controls button")).forEach((_,w)=>{_.removeAttribute("aria-current")}),l.querySelector(".control-"+d).setAttribute("aria-current",!0),d==1?l.querySelector(".btn-prev").setAttribute("disabled","disabled"):l.querySelector(".btn-prev").removeAttribute("disabled"),d>n-h?l.querySelector(".btn-next").setAttribute("disabled","disabled"):l.querySelector(".btn-next").removeAttribute("disabled")},100)},!1),u.addEventListener("click",function(a){for(var s=a.target;s&&s!=this;s=s.parentNode)if(typeof s.matches=="function"&&s.matches("button")){a.preventDefault(),Array.from(u.querySelectorAll("button")).forEach((r,d)=>{r.removeAttribute("aria-current")}),s.setAttribute("aria-current",!0);const e=o.querySelector(`:scope > *:nth-child(${s.getAttribute("data-slide")})`);t.scroll({top:0,left:e.offsetLeft-t.getBoundingClientRect().left,behavior:"smooth"});break}},!1),l.addEventListener("click",function(a){let s=t.clientWidth;t.scrollWidth;let e=o.querySelector(":scope > .col").scrollWidth,r=Math.round(s/e),d=o.querySelector(":scope > .col:last-child").offsetLeft,m=t.scrollLeft+s+t.getBoundingClientRect().left>=d+60,b=Math.ceil(n/r)*r-n,f=r-b,h=m&&b>0?f*e:t.clientWidth;for(var c=a.target;c&&c!=this;c=c.parentNode)if(typeof c.matches=="function"&&c.matches(".btn-next, .btn-prev")){a.preventDefault();let _=c.classList.contains("btn-prev")?t.scrollLeft-h:t.scrollLeft+t.clientWidth;t.scroll({top:0,left:_,behavior:"smooth"});break}},!1)}window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"carousel"});class v extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const o=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",i=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${o}/css/core.min.css`,t=document.createElement("template");t.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"collapsible side menu"});class a extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const e=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",t=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${e}/css/core.min.css`,n=document.createElement("template");n.innerHTML=`
5
5
  <style class="styles">
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */function v(d,s){const n=s.querySelector(".files"),i=s.querySelector(".drop-area"),e=d.querySelector("input"),f=d.hasAttribute("data-maxsize")?d.getAttribute("data-maxsize"):0,u=s.querySelector(".invalid-feedback.size"),h=s.querySelector(".invalid-feedback.ext"),o=e.cloneNode();i.append(o);let b=function(t){if(!e.hasAttribute("accept"))return!0;const r=t.split(".").pop();return!!e.getAttribute("accept").includes(r)};if(s.addEventListener("click",t=>{t&&t.target instanceof HTMLElement&&t.target.closest(".btn-primary")&&(t.target.closest(".btn-primary"),h.classList.remove("d-block"),u.classList.remove("d-block"),(e.hasAttribute("multiple")?o:e).click())}),s.addEventListener("click",t=>{if(t&&t.target instanceof HTMLElement&&t.target.closest(".files button")){const r=new DataTransfer,{files:a}=e,m=t.target.closest(".files button");for(let p=0;p<a.length;p++){const l=a[p];l.name!=m.getAttribute("data-file")&&r.items.add(l)}e.files=r.files;const c=new Event("change");e.dispatchEvent(c)}}),o.addEventListener("change",t=>{if(e.hasAttribute("multiple")){const a=[...e.files,...o.files];let m=[];const c=new DataTransfer;for(let p=0;p<a.length;p++){const l=a[p],g=l.size/1e3;!m.includes(l.name)&&(f==0||g<f)&&b(l.name)&&c.items.add(l),b(l.name)||h.classList.add("d-block"),g>f&&u.classList.add("d-block"),m.push(l.name)}e.files=c.files}else e.files=o.files;const r=new Event("change");e.dispatchEvent(r)}),o.addEventListener("dragenter",t=>{o.classList.add("focus")}),o.addEventListener("dragleave",t=>{o.classList.remove("focus")}),o.addEventListener("drop",t=>{o.classList.remove("focus")}),e.addEventListener("change",t=>{if(e.files.length==1){let a=e.files[0];const m=a.size/1e3;if(!b(a.name)){h.classList.add("d-block");const c=new DataTransfer;e.files=c.files}if(m>f){u.classList.add("d-block");const c=new DataTransfer;e.files=c.files}}n.innerHTML="";for(const a of e.files)n.innerHTML+=`<span class="file" part="file">${a.name} <button data-file="${a.name}">Remove</button></span>`;const r=new CustomEvent("elementchange",{detail:{files:e.files}});if(d.dispatchEvent(r),e.files.length==0){const a=new CustomEvent("empty");d.dispatchEvent(a)}}),d.hasAttribute("data-filename")){let t=d.getAttribute("data-filename");t&&(n.innerHTML=`<span class="file">${t} <button data-file="${t}">Remove</button></span>`)}}window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"fileupload"});class y extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const s=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",n=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${s}/css/core.min.css`,i=document.createElement("template");i.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */function i(s,t){n(s,t)}function n(s,t){var e;t.addEventListener("keyup",a=>{clearTimeout(e),e=setTimeout(function(){o(s,t.value)},500)}),t.addEventListener("change",a=>{clearTimeout(e),o(s,t.value)})}const o=function(s,t){Array.from(s.querySelectorAll(":scope > li")).forEach((e,a)=>{let r=e.textContent.toLowerCase();e.classList.add("d-none"),r.includes(t.toLowerCase())&&e.classList.remove("d-none")}),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Filtered list",value:t})};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"filterlist"});class l extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const t=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",e=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${t}/css/core.min.css`,a=document.createElement("template");a.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"header"});class o extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const t=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",e=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${t}/css/core.min.css`,a=document.createElement("template");a.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"inline edit"});class b extends HTMLElement{constructor(){super();const t=this.attachShadow({mode:"open"}),i=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",d=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${i}/css/core.min.css`,e=document.createElement("template");e.innerHTML=`
5
5
  <style class="styles">
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Marketing"});class o extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const e=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",i=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${e}/css/core.min.css`,t=document.createElement("template");t.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"mutliselect"});class b extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const t=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",s=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${t}/css/core.min.css`,r=document.createElement("template");r.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"nav"});class v extends HTMLElement{constructor(){super();const s=this.attachShadow({mode:"open"}),n=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",o=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${n}/css/core.min.css`,i=document.createElement("template");i.innerHTML=`
5
5
  <style class="styles">
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */function r(i){if(i.hasAttribute("data-type")&&i.getAttribute("data-type")=="toast"){let t=document.querySelector(".notification__holder");t||(t=document.createElement("div"),t.classList.add("notification__holder"),t.classList.add("container"),document.querySelector("body").appendChild(t)),i.closest(".notification__holder")||t.appendChild(i)}if(i.setAttribute("role","alert"),i.addEventListener("click",function(t){event&&event.target instanceof HTMLElement&&event.target.closest("[data-dismiss-button]")&&(t.preventDefault(),a(i))},!1),i.hasAttribute("data-timeout")){let t=i.getAttribute("data-timeout");var n=new c(function(){a(i)},t);i.addEventListener("mouseenter",o=>{n.pause()}),i.addEventListener("mouseleave",o=>{n.resume()})}}function c(i,n){var t,o,e=n;this.pause=function(){window.clearTimeout(t),e-=new Date-o},this.resume=function(){o=new Date,window.clearTimeout(t),t=window.setTimeout(i,e)},this.resume()}const a=function(i){i.classList.add("d-none")};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Notification"});class d extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const n=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",t=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${n}/css/core.min.css`,o=this.querySelectorAll("a,button");Array.from(o).forEach((s,l)=>{s.setAttribute("slot","btns"),s.classList.add("link")}),(o.length||this.hasAttribute("data-dismiss"))&&this.classList.add("notification--dismissable");const e=document.createElement("template");e.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */class v extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const i=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",t=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${i}/css/core.min.css`,e=document.createElement("template");e.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */import k from"js-cookie";const q=e=>e.replace(/ /g,"_"),x=function(e){return e=e.toLowerCase(),e=q(e),e=e.replace(/\W/g,""),e},m=(e,s,a)=>s.split(/[\.\[\]\'\"]/).filter(o=>o).reduce((o,d)=>o?o[d]:a,e),S=e=>Array.isArray(e)||e!==null&&["function","object"].includes(typeof e);var L=function(e,s,a,o){function d(c){return c instanceof a?c:new a(function(n){n(c)})}return new(a||(a=Promise))(function(c,n){function v(r){try{u(o.next(r))}catch(i){n(i)}}function t(r){try{u(o.throw(r))}catch(i){n(i)}}function u(r){r.done?c(r.value):d(r.value).then(v,t)}u((o=o.apply(e,s||[])).next())})};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Search"});class C extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const s=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",a=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${s}/css/core.min.css`,o=document.createElement("template");o.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Slider"});class f extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const t=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",p=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${t}/css/core.min.css`,i=document.createElement("template");i.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */const B=function(o){return typeof o!="string"?!1:!isNaN(o)&&!isNaN(parseFloat(o))},Q=(o,e)=>String(o).padStart(e,"0"),X=o=>o.charAt(0).toUpperCase()+o.slice(1),S=(o,e,n)=>e.split(/[\.\[\]\'\"]/).filter(a=>a).reduce((a,h)=>a?a[h]:n,o);var Y=function(o,e,n,a){function h(d){return d instanceof n?d:new n(function(i){i(d)})}return new(n||(n=Promise))(function(d,i){function l(c){try{t(a.next(c))}catch(r){i(r)}}function s(c){try{t(a.throw(c))}catch(r){i(r)}}function t(c){c.done?d(c.value):h(c.value).then(l,s)}t((a=a.apply(o,e||[])).next())})};const R=o=>{const e=Array.from(o.querySelectorAll("thead th"));Array.from(o.querySelectorAll("tbody tr")).forEach((a,h)=>{const d=Array.from(a.querySelectorAll("th, td")),i=["0","low","medium","high","unknown","n/a","pending","verified","due","overdue","incomplete","complete","completed","approval required","upcoming","requires approval","to do","on track","not started","warning","error"];d.forEach((l,s)=>{const t=e[s];if(typeof t<"u"){let c=document.createElement("div");c.innerHTML=t.innerHTML;let r=c.textContent||c.innerText||"";l.setAttribute("data-label",r),t.hasAttribute("data-td-class")&&l.setAttribute("class",t.getAttribute("data-td-class")),t.hasAttribute("data-format")&&(l.setAttribute("data-format",t.getAttribute("data-format")),l.innerHTML=D(t.getAttribute("data-format"),l.textContent.trim())),i.includes(l.textContent.trim().toLowerCase())&&l.setAttribute("data-content",l.textContent.trim().toLowerCase())}})})},J=o=>{let e=0;return Array.from(o.querySelectorAll("tbody tr")).forEach((n,a)=>{let h=window.getComputedStyle(document.querySelector("html")),d=n.querySelector(":scope > *:last-child > *:first-child");if(d){d.classList.add("text-nowrap");let i=d.offsetWidth/parseFloat(h.fontSize);i+=1.7,e=e>i?e:i}}),e},G=(o,e)=>{if(e.classList.contains("table--fullwidth")&&!e.hasAttribute("data-expandable")||o.querySelectorAll("thead tr th").length<4&&!e.hasAttribute("data-expandable"))return!1;Array.from(o.querySelectorAll("thead tr")).forEach((n,a)=>{o.querySelectorAll("thead tr th.expand-button-heading").length||n.insertAdjacentHTML("afterbegin",'<th class="th--fixed expand-button-heading"></th>')}),Array.from(o.querySelectorAll("tbody tr")).forEach((n,a)=>{const h=n.getAttribute("data-view")==="full"?"aria-expanded":"";n.insertAdjacentHTML("afterbegin",`<td class="td--fixed td--expand"><button class="btn btn-compact btn-secondary" data-expand-button ${h}>Expand</button></td>`)})},V=o=>{o.addEventListener("click",e=>{if(e&&e.target instanceof HTMLElement&&e.target.closest("[data-expand-button]")){let n=e.target.closest("[data-expand-button]"),a=n.closest("tr");n.toggleAttribute("aria-expanded"),a.getAttribute("data-view")=="full"?a.setAttribute("data-view","default"):a.setAttribute("data-view","full"),n.blur()}})},N=(o,e)=>{let n=e.querySelector("input[data-search]");if(!n)return!1;const a=n.getAttribute("id"),h=n.getAttribute("data-search").split(",");let d=n.parentNode,i={};h.forEach((l,s)=>{Array.from(o.querySelectorAll('td[data-label="'+l.trim()+'"]')).forEach((t,c)=>{t.querySelector(".td__content")?i[t.querySelector(".td__content").textContent]=t.querySelector(".td__content").textContent:i[t.textContent]=t.textContent})}),n.setAttribute("list",`${a}_list`),n.setAttribute("autocomplete","off"),d.querySelector("datalist")||(d.innerHTML+=`<datalist id="${a}_list"></datalist>`),d.querySelector("datalist").innerHTML=`${Object.keys(i).map(l=>`<option value="${l}"></option>`).join("")}`},K=(o,e,n,a,h)=>{var d;let i=function(t,c=!1){if(a.hasAttribute("data-no-submit")||e.classList.contains("processing"))return!1;if(Array.from(e.querySelectorAll("iam-applied-filters")).forEach((r,p)=>{var u=new Event("tags-set");r.dispatchEvent(u)}),t.type=="submit"&&(e.classList.add("processing"),Array.from(e.querySelectorAll("[data-duplicate]")).forEach((r,p)=>{const u=r.getAttribute("data-duplicate"),b=document.getElementById(u),y=document.querySelector(`[for="${u}"] iam-card`);if(b.checked!=r.checked)if(y){let w=new Event("click");y.dispatchEvent(w)}else b.checked=r.checked}),e.classList.remove("processing")),e.hasAttribute("data-ajax")){if(!c){let r=e.querySelector("[data-pagination]");r.value=1,a.setAttribute("data-page",1)}I(o,e,n,a)}else e.hasAttribute("data-submit")?e.submit():(C(o,e,a),$(o,e));if(e.hasAttribute("data-ajax-post")){let r=new FormData(e),p=new URLSearchParams(r).toString();const u=new XMLHttpRequest;u.open("GET",`${window.location.href}?ajax=true&${p}`),u.send()}};e.querySelector("iam-actionbar[data-search]")&&e.querySelector("iam-actionbar[data-search]").addEventListener("search-submit",t=>{e.querySelector("input[data-search]")?e.querySelector("input[data-search]").value=t.detail.search:e.insertAdjacentHTML("beforeend",`<input type="hidden" name="search" data-search="${e.querySelector("iam-actionbar[data-search]").getAttribute("data-search")}" value="${t.detail.search}"/>`),clearTimeout(d),i(t)}),e.addEventListener("keyup",t=>{clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest("input[data-search]")&&(d=setTimeout(function(){i(t)},500))}),e.addEventListener("change",t=>{if(clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest("[data-sort]")&&(e.hasAttribute("data-submit")||O(o,e,h),i(t)),t&&t.target instanceof HTMLElement&&t.target.closest("input[data-search]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter][data-no-ajax]")?(C(o,e,a),$(o,e)):(t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter]")&&t.target.closest("form .dialog__wrapper > dialog")||t&&t.target instanceof HTMLElement&&t.target.closest("[data-filter]")&&!t.target.closest("form dialog"))&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-show]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.closest("[data-mimic]")&&i(t),t&&t.target instanceof HTMLElement&&t.target.hasAttribute("id")){let c=t.target.getAttribute("id");document.querySelector(`[data-duplicate="${c}"]`)&&(document.querySelector(`[data-duplicate="${c}"]`).checked=t.target.checked)}}),e.addEventListener("click",t=>{if(clearTimeout(d),t&&t.target instanceof HTMLElement&&t.target.closest('dialog button:not([type="button"])')&&t.target.closest('dialog button:not([type="button"])').closest("dialog").close(),t&&t.target instanceof HTMLElement&&t.target.closest(".dialog__close")&&(t.preventDefault(),t.stopPropagation()),t&&t.target instanceof HTMLElement&&t.target.closest("[data-clear]")){e.classList.add("processing"),Array.from(e.querySelectorAll(".applied-filters")).forEach((r,p)=>{r.innerHTML=""});let c=e.elements;for(let r=0;r<c.length;r++)switch(c[r].type.toLowerCase()?c[r].type.toLowerCase():"text"){case"text":case"password":case"textarea":c[r].value="";break;case"radio":case"checkbox":if(c[r].checked){let u=c[r],b=u.getAttribute("id"),y=document.querySelector(`[for="${b}"`);if(y.querySelector("iam-card")){let w=y.querySelector("iam-card"),L=new Event("click");w.dispatchEvent(L)}u.checked=!1}break;case"select-one":case"select-multi":c[r].selectedIndex=-1;break}e.classList.remove("processing"),e.hasAttribute("data-submit")||O(o,e,h),i(t)}}),e.addEventListener("submit",t=>{clearTimeout(d),e.hasAttribute("data-submit")||t.preventDefault(),i(t)}),e.addEventListener("force",t=>{i(t)}),e.addEventListener("paginate",t=>{i(t,!0)});let l=[],s=[];Array.from(e.querySelectorAll("[data-mimic]")).forEach((t,c)=>{let r=t.getAttribute("data-mimic");Array.from(document.querySelectorAll(`[name="${r}"]`)).forEach((p,u)=>{let b=p.closest("form");l.includes(b)||l.push(b),s.includes(r)||s.push(r)})}),l.forEach((t,c)=>{const r=function(){let p=[],u=new FormData(t);for(const[b,y]of u)document.querySelector(`[data-mimic="${b}"]`)&&!p.includes(b)?(p.push(b),document.querySelector(`[data-mimic="${b}"]`).value=y):document.querySelector(`[data-mimic="${b}"]`)&&(document.querySelector(`[data-mimic="${b}"]`).value+=","+y);for(const b of p){const y=new Event("force");e.dispatchEvent(y)}for(const b of s)if(!u.has(b)&&t.querySelector(`[name="${b}"]`)){document.querySelector(`[data-mimic="${b}"]`).value="";const y=new Event("force");e.dispatchEvent(y)}};t.addEventListener("force",p=>{r()}),t.addEventListener("change",p=>{r()})})},O=(o,e,n)=>{if(e.getAttribute("data-ajax"))return!1;let a=o.querySelector("tbody"),h=e.querySelector('input[type="radio"][data-sort]:checked');if(e.querySelector("select[data-sort]")){let r=e.querySelector("select[data-sort]");h=e.querySelector(`select[data-sort] option:nth-child(${r.selectedIndex+1})`)}let d=h.getAttribute("data-sort"),i=h.getAttribute("data-order"),l=h.getAttribute("data-format");if(!d)return a.innerHTML=n.innerHTML,R(o),!1;let s=[];["asc","desc","descending"].includes(i)||(s=i.split(","));let t=[];Array.from(a.querySelectorAll("tr")).forEach((r,p)=>{let u=r.querySelector('td[data-label="'+d+'"], th[data-label="'+d+'"]').textContent.trim();r.querySelector('[data-label="'+d+'"] .td__content')&&(u=r.querySelector('[data-label="'+d+'"] .td__content').textContent.trim()),s.length&&s.includes(u)&&(u=s.indexOf(u)),B(u)&&(u=Q(u,10)),l&&l=="date"&&(u=new Date(u));const b={index:u,row:r};t.push(b)}),t.sort((r,p)=>r.index>p.index?1:-1),(i=="descending"||i=="desc")&&(t=t.reverse());let c="";t.forEach((r,p)=>{c+=r.row.outerHTML}),a.innerHTML=c},C=(o,e,n)=>{o.classList.remove("table--filtered");let a=z(e),h=[],d=0,i=e.querySelector("[data-pagination]")?parseInt(e.querySelector("[data-pagination]").value):1,l=e.querySelector("[data-show]")?parseInt(e.querySelector("[data-show]").value):15;if(Array.from(o.querySelectorAll("tbody tr")).forEach((t,c)=>{t.classList.remove("filtered"),t.classList.remove("filtered--matched"),t.classList.remove("filtered--show"),t.removeAttribute("data-filtered-by")}),e.querySelector("input[data-search]")){let t=e.querySelector("input[data-search]");e.querySelector("input[data-search]").getAttribute("data-search").split(",").forEach((r,p)=>{h.push({column:`${r.trim()}`,value:`${t.value}`})})}Array.from(e.querySelectorAll("[data-filter-count]")).forEach((t,c)=>{t.innerHTML="",t.parentNode.classList.remove("hover")});let s=0;Object.values(a).forEach((t,c)=>{typeof t=="object"&&Object.values(t).length?s+=Object.values(t).length:s++}),s&&Array.from(e.querySelectorAll("[data-filter-count]")).forEach((t,c)=>{t.innerHTML+=`(${s})`,t.parentNode.classList.add("hover")}),o.classList.add("table--filtered");for(const[t,c]of Object.entries(a))Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).forEach((r,p)=>{let u=!1;c.forEach((b,y)=>{let w=r.querySelector(`[data-label="${t}"]`);if(b.includes("-date-from")){let f=new Date(b.replace("-date-from","")),g=new Date(w.textContent.toLowerCase());f.setHours(0,0,0,0),g.setHours(0,0,0,0),g<f?(r.classList.add("less-than-from-date"),u=!1):!r.classList.contains("less-than-from-date")&&!r.classList.contains("greater-than-to-date")&&(u=!0)}else if(b.includes("-date-to")){let f=new Date(b.replace("-date-to","")),g=new Date(w.textContent.toLowerCase());f.setHours(0,0,0,0),g.setHours(0,0,0,0),g>f?(r.classList.add("greater-than-to-date"),u=!1):!r.classList.contains("less-than-from-date")&&!r.classList.contains("greater-than-to-date")&&(u=!0)}if(b&&b=="$today")b=D("date",new Date);else if(b&&b=="$yesterday"){let f=new Date;f.setDate(f.getDate()-1),b=D("date",f)}else if(b&&(b=="$thisWeek"||b=="$lastWeek")){let f=new Date,g=new Date(f.setDate(f.getDate()-(f.getDay()-1))),m=new Date(f.setDate(f.getDate()-f.getDay()+7)),x=new Date(w.textContent.toLowerCase());if(f.setHours(0,0,0,0),g.setHours(0,0,0,0),m.setHours(0,0,0,0),x.setHours(0,0,0,0),b=="$thisWeek")u=x>=g&&x<=m;else{let A=new Date(g.setDate(g.getDate()-7)),k=new Date(m.setDate(m.getDate()-7));A.setHours(0,0,0,0),k.setHours(0,0,0,0),u=x>=A&&x<=k}}else if(b&&b=="$thisMonth"){let f=new Date,g=f.getFullYear(),m=f.getMonth();var L=new Date(g,m,1),q=new Date(g,m+1,0);let x=new Date(w.textContent.toLowerCase());L.setHours(0,0,0,0),q.setHours(0,0,0,0),x.setHours(0,0,0,0),u=x>=L&&x<=q}else if(b&&b=="$lastMonth"){let f=new Date,g=f.getFullYear(),m=f.getMonth();var E=new Date(g,m-1,1),v=new Date(g,m,0);let x=new Date(w.textContent.toLowerCase());E.setHours(0,0,0,0),v.setHours(0,0,0,0),x.setHours(0,0,0,0),u=x>=E&&x<=v}w&&w.textContent.toLowerCase().includes(b.replace("-"," ").toLowerCase())&&(u=!0)}),u||(r.classList.add("filtered"),r.setAttribute("data-filtered-by",t))});Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).forEach((t,c)=>{let r=!(h.length>0&&h[0].value.length>=3);h.forEach((p,u)=>{let b=t.querySelector(`[data-label="${p.column}"]`);b&&p.value.length>=3&&b.textContent.toLowerCase().includes(p.value.toLowerCase())&&(r=!0)}),r||t.classList.add("filtered")}),Array.from(o.querySelectorAll("tbody tr:not(.filtered")).forEach((t,c)=>{d++,t.classList.add("filtered--matched"),Math.ceil(d/l)==parseInt(i)&&t.classList.add("filtered--show")}),n&&(n.setAttribute("data-total",d),n.setAttribute("data-show",l),n.setAttribute("data-page",i))},$=(o,e,n)=>{Array.from(e.querySelectorAll("[data-query]")).forEach((h,d)=>{let i=h.getAttribute("data-query"),l=0;if(i=="total")n.hasAttribute("data-total")?l=n.getAttribute("data-total"):l=(o.classList.contains("table--filtered"),o.querySelectorAll("tbody tr").length);else if(!i.includes(" == ")&&i.includes(" & ")){let s=i.split(" & "),t="";s.forEach(c=>{t+=`:not([data-filtered-by="${c}"])`}),l=Array.from(o.querySelectorAll(`tbody tr${t}`)).length}else if(!i.includes(" == "))l=Array.from(o.querySelectorAll(`tbody tr:not([data-filtered-by="${i}"])`)).length;else if(i.includes(" && ")){let s=i.split(" && ");l=Array.from(o.querySelectorAll("tbody tr:not(.filtered)")).filter(function(t){let c=!0;for(const[r,p]of Object.entries(s)){let u=p.split(" == ");(!t.querySelector(`td[data-label="${u[0]}"]`)||t.querySelector(`td[data-label="${u[0]}"]`).textContent!=`${u[1]}`)&&(c=!1)}return c}).length}else{let s=i.split(" == ");l=Array.from(o.querySelectorAll(`tbody tr.filtered--matched td[data-label="${s[0]}"], tbody tr[data-filtered-by="${s[0]}"] td[data-label="${s[0]}"]`)).filter(function(t){return t.textContent===s[1]}).length}h.hasAttribute("data-total")?h.setAttribute("data-total",l):h.innerHTML=l})},Z=function(o,e,n,a){if(a.hasAttribute("data-no-submit"))return!1;n.addEventListener("update-page",h=>{let d=e.querySelector("[data-pagination]"),i=h.detail.page;if(d.value=i,e.dispatchEvent(new Event("paginate")),a.setAttribute("data-page",i),o.hasAttribute("data-show-history")){const l=new URL(location);l.searchParams.set("page",i),history.pushState({type:"pagination",form:e.getAttribute("id"),page:i},"",l)}if(!a.hasAttribute("data-no-scroll")){const s=o.getBoundingClientRect().top+window.pageYOffset+-250;window.scrollTo({top:s,behavior:"smooth"})}}),n.addEventListener("update-show",h=>{let d=e.querySelector("[data-show]"),i=h.detail.show;d.value=i,a.setAttribute("data-show",i),e.dispatchEvent(new Event("submit"))})},tt=(o,e)=>{if(!o)return!1;o.addEventListener("click",n=>{et(e)})},et=function(o){for(var e=[],n=o.getElementsByTagName("tr"),a=0;a<n.length;a++){for(var h=n[a].querySelectorAll("td,th"),d=[],i=0;i<h.length;i++)d.push(`"${h[i].textContent}"`);e.push(d.join(","))}e=e.join(`
5
5
  `);let l=new Blob([e],{type:"text/csv"});var s=document.createElement("a");s.download="export.csv";var t=window.URL.createObjectURL(l);s.href=t,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},P=function(o,e,n,a){if(R(o),G(o,a),$(o,e,a),a&&a.classList.contains("table--cta")){let d=function(){Array.from(o.querySelectorAll("tr")).forEach((i,l)=>{let s=i.offsetHeight;i.style.setProperty("--row-height",`${s}px`)})};const h=J(o);a.style.setProperty("--cta-width",`${h}rem`),new ResizeObserver(d).observe(o)}},z=function(o){let e=new Object;return Array.from(o.querySelectorAll("[data-filter]")).forEach((a,h)=>{if(!(a.type=="radio"&&!a.checked)&&!(a.type=="checkbox"&&!a.checked)&&a&&a.value){let d=a.getAttribute("data-filter"),i=a.value;a.hasAttribute("data-date-from")&&(i+="-date-from"),a.hasAttribute("data-date-to")&&(i+="-date-to"),e[d]||(e[d]=new Array),e[d].push(i)}}),e},I=function(o,e,n,a){return Y(this,void 0,void 0,function*(){let h=new FormData(e),d=new URLSearchParams(h).toString(),i=o.querySelectorAll("thead tr th:not(.expand-button-heading)"),l=o.querySelector("tbody"),s=e.getAttribute("data-ajax");a.classList.add("table--loading");let t=z(e);Array.from(e.querySelectorAll("[data-filter-count]")).forEach((p,u)=>{p.innerHTML="",p.parentNode.classList.remove("hover")});let c=0;Object.values(t).forEach((p,u)=>{typeof p=="object"&&Object.values(p).length?c+=Object.values(p).length:c++}),c&&Array.from(e.querySelectorAll("[data-filter-count]")).forEach((p,u)=>{p.innerHTML+=`(${c})`,p.parentNode.classList.add("hover")}),window.controller||(window.controller=[]),window.controller[s]&&window.controller[s].abort(),window.controller[s]=new AbortController;const{signal:r}=controller[s];n.setAttribute("data-loading","true"),e.classList.add("processing");try{yield fetch(s+"?"+d,{signal:r,method:"get",credentials:"same-origin",headers:new Headers({"Content-Type":"application/json",Accept:"application/json","X-Requested-With":"XMLHttpRequest"})}).then(p=>p.json()).then(p=>{let u=e.hasAttribute("data-schema")?e.getAttribute("data-schema"):"data",b=e.hasAttribute("data-schema-total")?e.getAttribute("data-schema-total"):"meta.total",y=e.hasAttribute("data-schema-page")?e.getAttribute("data-schema-page"):"meta.current_page",w=S(p,b,15),L=S(p,y,1),q=S(p,u),E=a.hasAttribute("data-empty-msg")?a.getAttribute("data-empty-msg"):"No results found";q?(l.innerHTML="",q.forEach((v,f)=>{var g=document.createElement("tr");i.forEach((m,x)=>{let A="";var k=document.createElement("td");if(k.setAttribute("data-label",m.innerText),m.getAttribute("data-output")){var H=m.getAttribute("data-output");A=H.replace(new RegExp(/{(.*?)}/,"gm"),function(M){return S(v,M.replace("{","").replace("}",""))})}if(m.hasAttribute("data-output-array")){var H=m.getAttribute("data-output");let F=S(v,H.replace("{","").replace("}",""));A="",F.forEach((j,it)=>{let W=m.getAttribute("data-output-array"),T="";if(m.hasAttribute("data-output-array-property")&&m.hasAttribute("data-output-array-transform")){const _=S(j,m.getAttribute("data-output-array-property")),U=JSON.parse(m.getAttribute("data-output-array-transform"))[_];T=W.replace(`{${m.getAttribute("data-output-array-property")}}`,U)}T=T.replace(new RegExp(/{(.*?)}/,"gm"),function(_){return S(j,_.replace("{","").replace("}",""))}),A+=T})}m.hasAttribute("data-transform")&&(A=JSON.parse(m.getAttribute("data-transform"))[A],!A&&m.hasAttribute("data-default")&&(A=m.getAttribute("data-default"))),k.innerHTML=A,g.appendChild(k)}),l.appendChild(g)}),N(o,e),a.setAttribute("data-total",parseInt(w)),a.setAttribute("data-page",parseInt(L)),P(o,e,n,a),Array.from(e.querySelectorAll("[data-ajax-query]")).forEach((v,f)=>{let g=S(p,v.getAttribute("data-ajax-query"),"");v.hasAttribute("data-total")?v.setAttribute("data-total",g):v.innerHTML=g}),parseInt(w)==0&&(l.innerHTML=`<tr><td colspan="100%"><span>${E}</span></td></tr>`),a.classList.remove("table--loading"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Ajax table loaded",url:s,formData:d})):l.innerHTML='<tr><td colspan="100%"><span>Error loading table</span></td></tr>',n.removeAttribute("data-loading"),e.classList.remove("processing")})}catch(p){console.log(p)}})},D=(o,e)=>{switch(o){case"datetime":return new Date(e).toLocaleDateString("en-gb",{weekday:"short",year:"2-digit",month:"long",day:"numeric"})+" "+new Date(e).toLocaleTimeString("en-gb",{hour:"2-digit",minute:"2-digit"});case"date":return new Date(e).toLocaleDateString("en-gb",{day:"numeric",month:"long",year:"2-digit"});case"capitalise":return e=X(e)}};class at extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const e=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",n=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${e}/css/core.min.css`,a=document.createElement("template");a.innerHTML=`
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */const g=(t,l,o,r)=>{const e=Math.tan(.375*Math.PI);let b=window.innerWidth||document.body.clientWidth,n=Math.max(1,Math.floor(.01*b)),d=o-t,c=r-l,_=Math.abs(d/c),m=Math.abs(c/d);if(Math.abs(d)>n||Math.abs(c)>n){if(m<=e)return d<0?"left":"right";if(_<=e)return c<0?"top":"bottom"}else return"tap"},y=function(t){t.querySelectorAll(":scope > details");const l=t.querySelectorAll(":scope > details, :scope > a");t.querySelectorAll(":scope > details > summary");let o=t.querySelector(":scope > .tabs__links");if(t.shadowRoot&&t.shadowRoot.querySelector(".tabs__links")&&(o=t.shadowRoot.querySelector(".tabs__links")),!o){o=document.createElement("div"),o.classList.add("tabs__links");let e=document.createElement("div");e.classList.add("tabs__links__wrapper"),e.prepend(o),t.prepend(e)}let r=0;l.forEach((e,b)=>{let n=document.createElement("button");if(e.matches("details")){let d=e.querySelector(":scope > summary"),c=d.classList.contains("disabled");d.classList.add("visually-hidden"),e.hasAttribute("id")&&n.setAttribute("data-id",`${e.getAttribute("id")}`),e.hasAttribute("open")&&n.setAttribute("aria-pressed",!0),n.innerHTML=`${d.innerText}`,n.classList.add("link"),n.setAttribute("data-index",r),e.setAttribute("tabindex","-1"),c&&n.classList.add("disabled"),r++}else e.matches("a")&&(n=e);n.classList.add("link"),o.appendChild(n)})},v=function(t){let l=t.querySelectorAll(":scope > details"),o=t.querySelectorAll(":scope > details > summary"),r=t.querySelector(":scope .tabs__links"),e=t.querySelectorAll(":scope .tabs__links > button"),b=t.querySelector(":scope .tabs__next");var n;let d=!1,c=!1;if(t.shadowRoot&&(e=t.shadowRoot.querySelectorAll(".tabs__links > button"),r=t.shadowRoot.querySelector(".tabs__links"),b=t.shadowRoot.querySelector(":scope .tabs__next")),r.addEventListener("scroll",function(i){if(c)return c=!1,!1;clearTimeout(n);let a=e[0];n=setTimeout(function(){let s=Math.abs(a.getBoundingClientRect().left);e.forEach(p=>{Math.abs(p.getBoundingClientRect().left)<s&&(s=Math.abs(p.getBoundingClientRect().left),a=p)}),d=!0,a.click(),a.focus()},100)},!1),e.forEach(i=>{i.addEventListener("click",a=>{if(a.preventDefault(),c=!0,i.classList.contains("disabled"))return!1;e.forEach(s=>{let p=s==i;s.setAttribute("aria-pressed",p)}),d||r.scroll({top:0,left:i.offsetLeft,behavior:"smooth"}),d=!1,l.forEach((s,p)=>{let u=i.getAttribute("data-index")==p;u?s.setAttribute("open",u):s.removeAttribute("open")}),i.matches(":last-child")?b.setAttribute("disabled","disabled"):b.removeAttribute("disabled"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"openTab",tabTitle:i.textContent})})}),o.forEach((i,a)=>{i.addEventListener("click",s=>{s.preventDefault(),e[a].click()})}),b.addEventListener("click",i=>{i.preventDefault();let s=r.querySelector('[aria-pressed="true"]').nextSibling;s&&s.click()}),t.classList.contains("tabs--guided")){var _=0,m=0,h=0,f=0;l.forEach(i=>{i.addEventListener("touchstart",a=>{a.stopPropagation(),_=a.changedTouches[0].screenX,m=a.changedTouches[0].screenY}),i.addEventListener("touchend",a=>{a.stopPropagation(),h=a.changedTouches[0].screenX,f=a.changedTouches[0].screenY;let s=g(_,m,h,f),p=r.querySelector('[aria-pressed="true"]');switch(s){case"left":let u=p.nextSibling;u&&u.click();break;case"right":let k=p.previousSibling;k&&k.click();break}})})}},w=function(t){if(!t.querySelector(":scope > details"))return!1;let l=t.querySelectorAll(":scope > details"),o=t.shadowRoot.querySelectorAll(".tabs__links > button");location.hash&&t.shadowRoot.querySelector(`.tabs__links [data-id="${location.hash.replace("#","")}"]`)?(t.shadowRoot.querySelector(`[data-id="${location.hash.replace("#","")}"]`).setAttribute("aria-pressed",!0),t.querySelector(`details[id="${location.hash.replace("#","")}"]`).setAttribute("open",!0)):t.querySelector("details[open]")||(l[0].setAttribute("open",!0),o[0].setAttribute("aria-pressed",!0))},x=function(t){y(t),v(t),w(t)};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"tabs"});class S extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const l=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",o=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${l}/css/core.min.css`,r=document.createElement("template");r.innerHTML=`
5
5
  <style>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * iamKey v5.7.1-beta4
2
+ * iamKey v5.7.1-beta5
3
3
  * Copyright 2022-2024 iamproperty
4
4
  */(function(p){typeof define=="function"&&define.amd?define(p):p()})(function(){"use strict";const p=e=>(e.classList.add("js-enabled"),(navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0)&&e.classList.add("ie"),null),E=e=>{const i=function(t){const a=document.querySelector(`label[for="${t.replace("#","")}"]`),o=document.querySelector(t+" summary"),r=document.querySelector(`dialog${t}`),s=document.querySelector(`detail${t}`);a instanceof HTMLElement?a.click():o instanceof HTMLElement?o.click():r instanceof HTMLElement?r.showModal():s instanceof HTMLElement&&s.addAttribute("open")};return location.hash&&i(location.hash),window.addEventListener("hashchange",function(){i(location.hash)},!1),addEventListener("popstate",t=>{if(t&&t.state&&t.state.type&&t.state.type=="pagination"){let a=document.querySelector(`#${t.state.form}`),o=document.querySelector(`#${t.state.form} [data-pagination]`);o?o.value=t.state.page:a.innerHTML+=`<input name="page" type="hidden" data-pagination="true" value="${t.state.page}" />`,a.dispatchEvent(new Event("submit"))}}),document.addEventListener("submit",t=>{if(t&&t.target instanceof HTMLElement&&t.target.matches("form")){let a=t.target;Array.from(a.querySelectorAll("[data-password-type]")).forEach((o,r)=>{o.setAttribute("type","password")}),(a.querySelector(":invalid")||a.querySelector('.pwd-checker[data-strength="1"]')||a.querySelector('.pwd-checker[data-strength="2"]'))&&(a.classList.add("was-validated"),t.preventDefault()),a.querySelector("iam-multiselect[data-is-required][data-error]")&&(a.classList.add("was-validated"),t.preventDefault())}}),document.addEventListener("keydown",t=>{t.key==="Escape"&&document.querySelector(".dialog--transactional[open], .dialog--acknowledgement[open]")&&(t.preventDefault(),t.stopPropagation())}),Array.from(document.querySelectorAll("label progress")).forEach((t,a)=>{t.closest("label").setAttribute("data-percent",t.getAttribute("value"))}),null};class q{constructor(i){document.body.classList.contains("youtubeLoaded")?i.addEventListener("click",function(t){for(var a=t.target;a&&a!=this;a=a.parentNode)if(a.matches("a")){t.preventDefault(),g(a);break}},!1):this.loadScripts(i,this.createEmbed)}loadScripts(i){return new Promise((t,a)=>{const o=new Image;o.onload=function(){var r=document.createElement("script");r.src="https://www.youtube.com/iframe_api";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(r,s),document.body.classList.add("youtubeLoaded"),t(!0),r.onload=()=>{i.addEventListener("click",function(l){console.log("click"),l&&l.target instanceof HTMLElement&&l.target.closest("a")&&(l.preventDefault(),g(l.target.closest("a")))},!1)}},o.onerror=function(){a(!1)},o.src="https://youtube.com/favicon.ico"})}}const g=function(e){typeof window.player<"u"&&typeof window.player.pauseVideo=="function"&&window.player.pauseVideo();var i=e.getAttribute("data-id"),t=e.getAttribute("id");if(typeof t>"u"||t==null){var a=String.fromCharCode(65+Math.floor(Math.random()*26));t=a+Date.now(),e.setAttribute("id",t)}function o(){window.player=new YT.Player(t,{height:"100%",width:"100%",videoId:i,playerVars:{modestbranding:1,playsinline:1,rel:0,showinfo:0},events:{onReady:r,onStateChange:l}})}o();function r(n){n.target.playVideo()}var s=!1;function l(n){if(n.data==YT.PlayerState.PLAYING&&!s){var c=document.getElementById(t);c.classList.add("player-ready"),s=!0}}},x=e=>(Array.from(e.querySelectorAll("dialog[open]")).forEach((i,t)=>{i.closest(".dialog__wrapper")||(i.removeAttribute("open"),i.showModal(),i.focus(),L(i))}),e.addEventListener("click",i=>{if(i.target.tagName=="IAM-ACTIONBAR")return!1;if(i&&i.target instanceof HTMLElement&&i.target.closest("[data-modal]")){const o=i.target.closest("[data-modal]"),r=o.hasAttribute("data-modal")?o.getAttribute("data-modal"):o.getAttribute("data-filter"),s=document.querySelector(`dialog#${r}`);L(s),s.showModal(),s.focus();let l=s.offsetWidth;s.setAttribute("style",`max-width: ${l}px;`),Array.from(s.querySelectorAll("[data-duplicate]")).forEach((n,c)=>{const d=n.getAttribute("data-duplicate"),f=document.getElementById(d);if(n.checked!=f.checked){n.checked=f.checked;let u=new Event("change");n.dispatchEvent(u)}}),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"openModal",id:r})}if(i&&i.target instanceof HTMLElement&&i.target.closest("button.dialog__close")){const o=i.target.closest("dialog[open]");i.preventDefault(),o.close(),Array.from(document.querySelectorAll(".dialog__wrapper > button")).forEach((s,l)=>{s.classList.remove("active")});let r=new CustomEvent("dialog-closed",{bubbles:!0,cancelable:!0,detail:{modalId:o.id}});i.target.dispatchEvent(r),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"closeModal",id:o.getAttribute("id")})}if(i&&i.target instanceof HTMLElement&&i.target.closest('button[formmethod="dialog"]')){const o=i.target.closest("dialog[open]");Array.from(document.querySelectorAll(".dialog__wrapper > button")).forEach((r,s)=>{r.classList.remove("active")}),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"closeModal",id:o.getAttribute("id")})}if(i&&i.target instanceof HTMLElement&&i.target.closest("dialog[open]")){let o=i.target.closest("dialog[open]");var t=window.getComputedStyle(o);if(t.display==="contents"&&(o=o.parentNode.closest("dialog[open]")),!o.classList.contains("dialog--transactional")&&!o.classList.contains("dialog--acknowledgement")){const r=o.getBoundingClientRect();(i.clientX<r.left||i.clientX>r.right||i.clientY<r.top||i.clientY>r.bottom)&&(i.target.closest("dialog *")||o.close(),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"closeModal",id:o.getAttribute("id")}))}}if(i&&i.target instanceof HTMLElement&&i.target.closest(".dialog__wrapper > button")){i.stopPropagation();let o=i.target.closest(".dialog__wrapper > button"),r=o.parentNode,s="openPopover",l=r.querySelector(":scope > dialog");if(document.querySelector("*:not([data-keep-open]) > dialog[open]")&&document.querySelector("*:not([data-keep-open]) > dialog[open]")!=l&&o.closest("dialog[open]")!=document.querySelector("*:not([data-keep-open]) > dialog[open]")&&document.querySelector("*:not([data-keep-open]) > dialog[open]").close(),Array.from(document.querySelectorAll(".dialog__wrapper > button")).forEach((f,u)=>{f.removeAttribute("aria-expanded")}),l.hasAttribute("open"))l.close(),s="closePopover",l.removeAttribute("style"),o.removeAttribute("aria-expanded");else{l.show(),o.setAttribute("aria-expanded",!0);var a=o.getBoundingClientRect();let f=a.top,u=a.left;if(o.closest("iam-table")){let m=o.closest("iam-table").parentNode.getBoundingClientRect();f-=m.top,u-=m.left}l.classList.contains("dialog--fix")&&l.setAttribute("style",`position:fixed;top: ${f}px; left: ${u}px; margin: 3rem 0 0 0;`)}let n=l.getBoundingClientRect(),c=n.bottom-window.scrollY,d=window.innerHeight-window.scrollY;if(c>d){let f=l.hasAttribute("style")?l.getAttribute("style")+" ":"";l.setAttribute("style",f+"transform: translate(0, calc(-100% - 4rem))"),n=l.getBoundingClientRect(),n.top-window.scrollY<100&&l.removeAttribute("style")}window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:s,id:o.textContent})}i&&i.target instanceof HTMLElement&&!i.target.closest("dialog[open]")&&!i.target.closest(".dialog__wrapper > button")&&(document.querySelector(".dialog__wrapper:not([data-keep-open]) > dialog[open]")&&document.querySelector(".dialog__wrapper:not([data-keep-open]) > dialog[open]").close(),Array.from(document.querySelectorAll(".dialog__wrapper:not([data-keep-open]) > button")).forEach((o,r)=>{o.removeAttribute("aria-expanded")}))}),null),L=e=>{let i=e.querySelector(".youtube-embed a");if(i&&g(i),e.classList.contains("dialog--multi")&&!e.querySelector(":scope > .steps")&&k(e),!e.querySelector(":scope .mh-lg")&&!e.classList.contains("dialog--multi")){e.innerHTML=`<div class="mh-lg">${e.innerHTML}</div>`;let t=e.querySelector(".mh-lg"),a=e.querySelector(".mh-lg :is(.h1,.h2,.h3,.h4,.h5,.h6)");if(a){let o=a.previousSibling;t.before(a),o&&a.before(o)}}e.querySelector(":scope > button:first-child")||e.insertAdjacentHTML("afterbegin",'<button class="dialog__close">Close</button>')},k=e=>{let i="",t=Array.from(e.querySelectorAll("fieldset[data-title]")),a=e.querySelector("form");t.forEach((s,l)=>{i+=`<button data-title="${s.getAttribute("data-title")}" type="button" class="${l==0?"active":""}" tabindex="-1">${s.getAttribute("data-title")}</button>`;const n=document.createElement("div");if(n.classList.add("btn--wrapper"),s.appendChild(n),l!=0&&(n.innerHTML+=`<button data-title="${t[l-1].getAttribute("data-title")}" class="btn btn-secondary mb-0" data-previous type="button">Previous</button>`),l!=t.length-1&&(n.innerHTML+=`<button data-title="${t[l+1].getAttribute("data-title")}" class="btn btn-primary mb-0" data-next type="button">Next</button>`),l==t.length-1)if(a&&a.querySelector(':scope > button[type="submit"]')){let c=a.querySelector(':scope > button[type="submit"]');c.classList.add("mb-0"),n.insertAdjacentElement("beforeend",c)}else n.innerHTML+=`<button data-title="${t[l].getAttribute("data-title")}" class="btn btn-primary mb-0" data-next type="submit">Submit</button>`}),e.insertAdjacentHTML("afterbegin",`<div class="steps bg-primary">${i}</div>`);let o=Array.from(e.querySelectorAll("fieldset.was-validated"));for(let s=0;s<o.length;s++){let l=o[s],n=l.getAttribute("data-title");if(l.querySelector(".is-invalid")){Array.from(e.querySelectorAll(`[data-title="${n}"]`)).forEach((c,d)=>{c.classList.add("active")});break}else Array.from(e.querySelectorAll(`[data-title="${n}"]`)).forEach((c,d)=>{c.classList.add("valid")})}e.addEventListener("invalid",function(){return function(s){s.preventDefault()}}(),!0);function r(s){const l=e.querySelector("fieldset.active")?e.querySelector("fieldset.active"):e.querySelector("fieldset[data-title]"),n=l.getAttribute("data-title");let c=!0;if(l.classList.add("was-validated"),Array.from(l.querySelectorAll("input")).forEach((u,m)=>{u.checkValidity()||(c=!1)}),c?Array.from(e.querySelectorAll(`[data-title="${n}"]`)).forEach((u,m)=>{u.classList.add("valid")}):Array.from(e.querySelectorAll(`[data-title="${n}"]`)).forEach((u,m)=>{u.classList.remove("valid")}),c||!s.hasAttribute("data-next")){const u=e.querySelector(`fieldset[data-title="${s.getAttribute("data-title")}"]`),m=e.querySelector(`.steps button[data-title="${s.getAttribute("data-title")}"]`);Array.from(e.querySelectorAll("button")).forEach((h,b)=>{h.classList.remove("active")}),Array.from(e.querySelectorAll("fieldset")).forEach((h,b)=>{h.classList.remove("active")}),m.classList.add("active"),u.classList.add("active")}let d=Array.from(e.querySelectorAll("fieldset")).length,f=Array.from(e.querySelectorAll("fieldset.valid")).length;e.style.setProperty("--progress",`${f/(d-1)*100}%`)}e.addEventListener("keydown",s=>{if(s&&s.target instanceof HTMLElement&&s.target.closest("button")){const l=s.target.closest("button");s.keyCode==13&&l.getAttribute("type")!="submit"&&(s.preventDefault(),r(l))}s&&s.target instanceof HTMLElement&&s.target.closest("input")&&(s.target.closest("input").classList.remove("is-invalid"),s.keyCode==13&&s.preventDefault())}),e.addEventListener("click",s=>{if(s&&s.target instanceof HTMLElement&&s.target.closest('button[type="submit"]'))s.target.closest("form").classList.add("was-validated");else if(s&&s.target instanceof HTMLElement&&s.target.closest("button[data-title]")){const l=s.target.closest("button[data-title]");r(l)}return null})};function T(){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Pageview",pageTitle:document.title}),document.addEventListener("click",e=>{const i=e.target.closest("[open] summary");if(i)window.dataLayer.push({event:"closeDetails",detailsTitle:i.textContent||""});else{const t=e.target.closest("summary"),a=e.target.closest("a"),o=e.target.closest("button");t&&window.dataLayer.push({event:"openDetails",detailsTitle:t.textContent||""}),a&&window.dataLayer.push({event:"linkClicked",linkText:a.hasAttribute("title")?a.getAttribute("title")||"":a.textContent||"",class:a.hasAttribute("class")&&a.getAttribute("class")||"",href:a.getAttribute("href")||""}),o&&window.dataLayer.push({event:"buttonClicked",buttonText:o.textContent||"",class:o.hasAttribute("class")&&o.getAttribute("class")||""})}})}function M(e){var i=new TextEncoder("utf-8").encode(e);return crypto.subtle.digest("SHA-1",i).then(function(t){for(var a=[],o=new DataView(t),r=0;r<o.byteLength;r+=4){var s=o.getUint32(r),l=s.toString(16),n="00000000",c=(n+l).slice(-n.length);a.push(c)}return a.join("")})}const $=(e,i)=>{M(e).then(function(t){const a=new XMLHttpRequest;a.addEventListener("load",function(){const o=this.responseText.split(`
5
5
  `),r=t.slice(5).toUpperCase();var s=!1;for(let n in o)if(o[n].substring(0,35)==r){s=!0;break}const l=new CustomEvent("hibpCheck",{detail:s});i.dispatchEvent(l)}),a.open("GET","https://api.pwnedpasswords.com/range/"+t.substr(0,5)),a.send()})},C=e=>{function i(){if(Array.from(document.querySelectorAll("input[maxlength],textarea[maxlength]")).forEach((t,a)=>{t.parentElement,_(t)}),Array.from(document.querySelectorAll("label input")).forEach((t,a)=>{!t.closest("label").querySelector(".optional-text")&&!t.hasAttribute("required")&&(t.parentNode.tagName.toLowerCase()=="span"?t.parentElement.insertAdjacentHTML("beforebegin",'<span class="optional-text"></span>'):t.insertAdjacentHTML("beforebegin",'<span class="optional-text"></span>'))}),document.querySelector('input[type="date"]')){let a=function(o){const r=o.getFullYear(),s=String(o.getMonth()+1).padStart(2,"0"),l=String(o.getDate()).padStart(2,"0");return`${r}-${s}-${l}`};const t=new Date;Array.from(document.querySelectorAll('input[type="date"]')).forEach((o,r)=>{let s=t;if(o.hasAttribute("data-start")&&(s.setDate(s.getDate()+parseInt(o.getAttribute("data-start"))),o.setAttribute("min",a(s))),o.hasAttribute("data-period")){let l=parseInt(o.getAttribute("data-period")),n=new Date;n.setDate(s.getDate()+l),o.setAttribute("max",a(n))}if(o.hasAttribute("data-allowed-days")){let l=JSON.parse(`[${o.getAttribute("data-allowed-days")}]`);o.addEventListener("input",function(n){var c=new Date(this.value).getUTCDay();l.includes(c)?o.setCustomValidity(""):o.setCustomValidity("That day of the week is not allowed")})}})}}document.readyState==="complete"&&i(),document.onreadystatechange=()=>{document.readyState==="complete"&&i()},e.addEventListener("input",t=>{if(t&&t.target instanceof HTMLElement&&t.target.closest("input,textarea,select")){const a=t.target.closest("input,textarea,select");a.parentElement,a.hasAttribute("type")&&a.getAttribute("type")=="color"&&(a.nextElementSibling.value=a.value),a.hasAttribute("maxlength")&&a.nextElementSibling&&a.nextElementSibling.setAttribute("data-count",a.value.length),a.hasAttribute("data-strength-checker")&&A(a)}}),e.addEventListener("change",t=>{if(t&&t.target instanceof HTMLElement&&t.target.closest("select")){const a=t.target.closest("select");if(a.hasAttribute("data-change-type")&&a.hasAttribute("data-input")){const o=document.getElementById(a.getAttribute("data-input")),r=a.value;S(o,r)}}if(t&&t.target instanceof HTMLElement&&t.target.closest('dialog [type="radio"]')){const a=t.target.closest("dialog");t.target.closest('dialog [type="radio"]'),Array.from(a.querySelectorAll('[type="radio"][autofocus]')).forEach((o,r)=>{o.removeAttribute("autofocus")}),Array.from(a.querySelectorAll('[type="radio"]:checked')).forEach((o,r)=>{o.setAttribute("autofocus",!0)})}}),e.addEventListener("click",t=>{if(t&&t.target instanceof HTMLElement&&t.target.closest("[data-change-type][data-input]:not(select)")){const a=t.target.closest("[data-change-type]"),o=document.getElementById(a.getAttribute("data-input")),r=a.getAttribute("data-change-type");if(a.setAttribute("data-change-type",o.getAttribute("type")),S(o,r),a.hasAttribute("data-alt-class")){const s=a.getAttribute("data-alt-class");a.setAttribute("data-alt-class",a.getAttribute("class")),a.setAttribute("class",s)}}})},_=e=>{let i=e.parentElement,t=e.getAttribute("maxlength");i.style.setProperty("--maxlength",t);let a=e.nextElementSibling;(!a||a&&a.classList.contains("invalid-feedback"))&&(a=document.createElement("span"),i.insertBefore(a,e.nextSibling)),a.setAttribute("data-count",e.value.length)},S=(e,i)=>{e.hasAttribute("type")&&e.getAttribute("type")=="password"&&e.setAttribute("data-password-type",!0),e.setAttribute("type",i)},A=(e,i="no")=>{const t=document.getElementById(e.getAttribute("data-strength-checker")),a=e.value,o=e.hasAttribute("minlength")?e.getAttribute("minlength"):12;let r=1,s=["Very weak","Weak","Average","Strong","Very strong"],l="";if(a.match(/(?=.*[0-9])/)&&(r+=1),a.match(/(?=.*[!,%,&,#,$,^,*,?,_,~,<,>,])/)&&(r+=1),a.match(/(?=.*[a-z])/)&&(r+=1),a.match(/(?=.*[A-Z])/)&&(r+=1),a.length<o&&(r=1,l=`(must be at least ${o} characters.)`),r>=3&&i=="no"){let n=function(c,d){c.detail?A(d,"danger"):A(d,"success"),d.removeEventListener("hibpCheck",n)};$(a,e),e.addEventListener("hibpCheck",function(c){n(c,e)})}else r>=3&&i=="danger"&&(r=3,l="(this password is very common)");t&&(r<=3?t.classList.add("invalid-feedback"):t.classList.remove("invalid-feedback"),t.setAttribute("data-strength",r),t.innerHTML=`Password strength: ${s[r-1]} ${l}`)},H=e=>{Array.from(e.querySelectorAll("details")).forEach((i,t)=>{i.addEventListener("mouseenter",function(a){window.matchMedia("(min-width: 62em)").matches&&i.setAttribute("open","true")},!1),i.addEventListener("mouseleave",function(a){window.matchMedia("(min-width: 62em)").matches&&i.removeAttribute("open")},!1)}),"IntersectionObserver"in window&&new IntersectionObserver(([t])=>t.target.classList.toggle("is-stuck",t.intersectionRatio<1),{threshold:[1]}).observe(e)};function D(e){var i;const t=e.querySelector(".testimonial__images"),a=t.querySelectorAll("img").length;if(a==1)return!1;e.classList.add("testimonial--multi");const o=function(r){const s=e.querySelector(".btn-next"),l=e.querySelector(".btn-prev");s.setAttribute("data-go",r+1),l.setAttribute("data-go",r-1),s.removeAttribute("disabled"),l.removeAttribute("disabled"),r==1?l.setAttribute("disabled",!0):r==a&&s.setAttribute("disabled",!0)};t.addEventListener("scroll",function(r){clearTimeout(i),i=setTimeout(function(){let s=t.scrollWidth,l=t.scrollHeight,n=t.scrollLeft,c=t.scrollTop,d=Math.round(n/s*a)+1;n==0&&c!=0&&(d=Math.round(c/l*a)+1),e.setAttribute("data-show",d),o(d)},300)},!1),e.addEventListener("click",function(r){for(var s=r.target;s&&s!=this;s=s.parentNode)if(s.matches("[data-go]")){let l=parseInt(s.getAttribute("data-go")),n=0,c=0,d=t.scrollWidth,f=t.scrollHeight;d>f?c=Math.floor(d*((l-1)/a)):n=Math.floor(f*((l-1)/a)),t.scroll({top:n,left:c,behavior:"smooth"});break}},!1)}function I(e,i){var t;let a=e.querySelector(".carousel__inner"),o=e.querySelector(".carousel__controls"),r=i.querySelectorAll(":scope > .col").length;a.addEventListener("scroll",function(s){clearTimeout(t),t=setTimeout(function(){let l=a.clientWidth,n=a.scrollWidth,c=a.scrollLeft,d=Math.round(c/n*r)+1,f=i.querySelector(":scope > .col").scrollWidth,u=i.querySelector(":scope > .col:last-child").offsetLeft,m=a.scrollLeft+l+a.getBoundingClientRect().left>=u+60,h=Math.round(l/f);Math.ceil(r/h)*h-r>0&&m&&(d=Math.floor(r/h)*h+1),Array.from(e.querySelectorAll(".carousel__controls button")).forEach((v,W)=>{v.removeAttribute("aria-current")}),e.querySelector(".control-"+d).setAttribute("aria-current",!0),d==1?e.querySelector(".btn-prev").setAttribute("disabled","disabled"):e.querySelector(".btn-prev").removeAttribute("disabled"),d>r-h?e.querySelector(".btn-next").setAttribute("disabled","disabled"):e.querySelector(".btn-next").removeAttribute("disabled")},100)},!1),o.addEventListener("click",function(s){for(var l=s.target;l&&l!=this;l=l.parentNode)if(typeof l.matches=="function"&&l.matches("button")){s.preventDefault(),Array.from(o.querySelectorAll("button")).forEach((c,d)=>{c.removeAttribute("aria-current")}),l.setAttribute("aria-current",!0);const n=i.querySelector(`:scope > *:nth-child(${l.getAttribute("data-slide")})`);a.scroll({top:0,left:n.offsetLeft-a.getBoundingClientRect().left,behavior:"smooth"});break}},!1),e.addEventListener("click",function(s){let l=a.clientWidth;a.scrollWidth;let n=i.querySelector(":scope > .col").scrollWidth,c=Math.round(l/n),d=i.querySelector(":scope > .col:last-child").offsetLeft,f=a.scrollLeft+l+a.getBoundingClientRect().left>=d+60,u=Math.ceil(r/c)*c-r,m=c-u,h=f&&u>0?m*n:a.clientWidth;for(var b=s.target;b&&b!=this;b=b.parentNode)if(typeof b.matches=="function"&&b.matches(".btn-next, .btn-prev")){s.preventDefault();let v=b.classList.contains("btn-prev")?a.scrollLeft-h:a.scrollLeft+a.clientWidth;a.scroll({top:0,left:v,behavior:"smooth"});break}},!1)}function B(e){e.addEventListener("change",function(i){var t=parseInt(e.querySelector("[data-min] select,[data-min] input").value),a=parseInt(e.querySelector("[data-max] select,[data-max] input").value);Array.from(e.querySelectorAll("[data-min] input")).forEach((o,r)=>{o.setAttribute("max",a)}),Array.from(e.querySelectorAll("[data-max] input")).forEach((o,r)=>{o.setAttribute("min",t)}),Array.from(e.querySelectorAll("[data-min] select option")).forEach((o,r)=>{parseInt(o.getAttribute("value"))>a?o.classList.add("d-none"):o.classList.remove("d-none")}),Array.from(e.querySelectorAll("[data-max] select option")).forEach((o,r)=>{parseInt(o.getAttribute("value"))<t?o.classList.add("d-none"):o.classList.remove("d-none")})},!1)}function N(e){e.addEventListener("change",function(i){if(e.matches("[data-value-if]")){const t=e.getAttribute("data-redirect"),a=e.getAttribute("data-value-if");e.value==a&&(document.location.href=t)}else typeof e.value<"u"&&(document.location.href=e.value)},!1)}function R(e){const t=e.querySelector(".row").cloneNode(!0),a=e.querySelector("[data-add]");e.addEventListener("click",function(o){for(var r=o.target;r&&r!=this;r=r.parentNode){if(r.matches("[data-add]")){const s=t.cloneNode(!0);e.insertBefore(s,r),a.matches("[data-maxfiles]")&&Array.from(e.querySelectorAll(":scope > .row")).length>=a.dataset.maxfiles&&a.setAttribute("disabled","disabled");break}if(r.matches("[data-delete]")){r.closest(".row").remove(),a.matches("[data-maxfiles]")&&Array.from(e.querySelectorAll(":scope > .row")).length<a.dataset.maxfiles&&a.removeAttribute("disabled");break}}},!1)}function P(e){Array.from(e.querySelectorAll("[data-input-range]")).forEach((i,t)=>{B(i)}),Array.from(e.querySelectorAll("[data-redirect]")).forEach((i,t)=>{N(i)}),Array.from(e.querySelectorAll(".multiple-file-uploads")).forEach((i,t)=>{R(i)}),e.addEventListener("change",function(i){for(var t=i.target;t&&t!=this;t=t.parentNode)if(t.matches('[type="file"][data-filesize]')&&t.files&&t.files[0]){const a=t.dataset.filesize;t.files[0].size>a&&(t.value="",alert("File too large"));break}},!1),e.addEventListener("change",function(i){Array.from(e.querySelectorAll("select[data-activeif][data-equals],input[data-activeif][data-equals]")).forEach((t,a)=>{let o=t.closest("[data-group]")?t.closest("[data-group]"):e,r=t.dataset.activeif,s=t.dataset.equals;o.querySelector(`select[data-id="${r}"],input[data-id="${r}"]`).value==s?t.removeAttribute("disabled"):(t.setAttribute("disabled","disabled"),t.value="")}),Array.from(e.querySelectorAll(".form-control__wrapper[data-displayif][data-equals]")).forEach((t,a)=>{let o=t.closest("[data-group]")?t.closest("[data-group]"):e,r=t.dataset.activeif,s=t.dataset.equals;o.querySelector(`select[data-id="${r}"],input[data-id="${r}"]`).value==s?t.classList.remove("d-none"):t.classList.add("d-none")})},!1)}function O(e){if(e.hasAttribute("data-type")&&e.getAttribute("data-type")=="toast"){let t=document.querySelector(".notification__holder");t||(t=document.createElement("div"),t.classList.add("notification__holder"),t.classList.add("container"),document.querySelector("body").appendChild(t)),e.closest(".notification__holder")||t.appendChild(e)}if(e.setAttribute("role","alert"),e.addEventListener("click",function(t){event&&event.target instanceof HTMLElement&&event.target.closest("[data-dismiss-button]")&&(t.preventDefault(),w(e))},!1),e.hasAttribute("data-timeout")){let t=e.getAttribute("data-timeout");var i=new V(function(){w(e)},t);e.addEventListener("mouseenter",a=>{i.pause()}),e.addEventListener("mouseleave",a=>{i.resume()})}}function V(e,i){var t,a,o=i;this.pause=function(){window.clearTimeout(t),o-=new Date-a},this.resume=function(){a=new Date,window.clearTimeout(t),t=window.setTimeout(e,o)},this.resume()}const w=function(e){e.classList.add("d-none")};window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"customElementRegistered",element:"Notification"});class F extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});const i=document.body.hasAttribute("data-assets-location")?document.body.getAttribute("data-assets-location"):"/assets",t=document.body.hasAttribute("data-core-css")?document.body.getAttribute("data-core-css"):`${i}/css/core.min.css`,a=`@import "${i}/css/components/notification.css";`,o=`@import "${i}/css/components/notification.global.css";`,r=this.querySelectorAll("a,button");Array.from(r).forEach((l,n)=>{l.setAttribute("slot","btns"),l.classList.add("link")}),(r.length||this.hasAttribute("data-dismiss"))&&this.classList.add("notification--dismissable");const s=document.createElement("template");s.innerHTML=`