{"version":3,"file":"assets/js/629.ccf70f16114ba494a1b5.js","mappings":"kJAAA,MAAMA,EAAc,IAAIC,SAASC,iBAAiB,yBAC5CC,EAAS,IAAIF,SAASC,iBAAiB,yBAe7C,SAASE,IAEP,MAAMC,GAXkBC,EAWeH,GAVJI,QACjC,CAACC,EAAaC,IAASD,EAAcC,EAAKC,wBAAwBC,QAClE,GAEyBL,EAASM,OALtC,IAA0BN,EAcxB,MAAMO,EAAmBb,EAAY,GAAGc,SAAS,GAAGJ,wBAAwBC,OAE5E,IAAK,MAAMI,KAAWf,EAEpBe,EAAQC,MAAML,OAAU,GAAEN,EAAgBQ,KAE7C,CAUD,QARA,WACOb,EAAYY,QACZT,EAAOS,SAEZR,IACAa,OAAOC,iBAAiB,SAAUd,GACnC,C","sources":["webpack://ssen-distribution/./src/templates/02-components/icon-block/mando-ui.icon-block.js"],"sourcesContent":["const blockArrows = [...document.querySelectorAll('.c-icon-block__arrow')];\r\nconst images = [...document.querySelectorAll('.c-icon-block__image')];\r\n\r\n/** Gets the average height of elements passed in. This will allow us to place the arrow in the correct place\r\n *  @param {HTMLElement[]} elements - The elements to calculate average height from\r\n *  @return number\r\n * */\r\nfunction getAverageHeight(elements) {\r\n  const accumulatedHeight = elements.reduce(\r\n    (accumulator, elem) => accumulator + elem.getBoundingClientRect().height,\r\n    0,\r\n  );\r\n  return accumulatedHeight / elements.length;\r\n}\r\n\r\n/** Fires when the window is resizes */\r\nfunction onWindowResize() {\r\n  // Get the average height of the images\r\n  const averageHeight = getAverageHeight(images);\r\n\r\n  // Get the height of the first arrow. Want to use the child inside the SVG as the SVG isn't well optimised. Child is the true height\r\n  const arrowBlockHeight = blockArrows[0].children[0].getBoundingClientRect().height;\r\n\r\n  for (const element of blockArrows) {\r\n    // Set height to the sum of average height and arrow height\r\n    element.style.height = `${averageHeight + arrowBlockHeight}px`;\r\n  }\r\n}\r\n\r\nfunction init() {\r\n  if (!blockArrows.length) return;\r\n  if (!images.length) return;\r\n\r\n  onWindowResize();\r\n  window.addEventListener('resize', onWindowResize);\r\n}\r\n\r\nexport default init;\r\n"],"names":["blockArrows","document","querySelectorAll","images","onWindowResize","averageHeight","elements","reduce","accumulator","elem","getBoundingClientRect","height","length","arrowBlockHeight","children","element","style","window","addEventListener"],"sourceRoot":""}