"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){"function"==typeof define&&define.amd?define(t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=t():e.Accordion=t()}(window,function(){return function(r,o){var i=[];o=function(){var e={expand:function(e,t){t.style.maxHeight="".concat(t.scrollHeight,"px")},collapse:function(e,t){t.style.maxHeight=0},transitionEnd:function(e){"max-height"===e.propertyName&&(e.currentTarget.classList.contains("accordion--expanded")||e.currentTarget.setAttribute("hidden","hidden"))},resizeEvent:function(e,t){for(var n=t.length;n--;)o.expand(null,t[n])},init:!0,buttonSelector:"button.accordion--button",accordionExpandedClass:"accordion--expanded"},t=Object.keys(e);o=o||{};for(var n=t.length;n--;)o[t[n]]=o[t[n]]||e[t[n]];return o}();function a(e){e.preventDefault();var t=e.currentTarget;t.setAttribute("aria-expanded","true"===t.getAttribute("aria-expanded")?"false":"true"),d(t)}function c(t){var e=t.keyCode||t.which,n=function(){for(var e=u.length;e--;)if(u[e]===t.currentTarget)return e}();switch(e){case 40:t.preventDefault(),n===u.length-1&&(n=-1),u[n+1].focus();break;case 38:t.preventDefault(),0===n&&(n=u.length),u[n-1].focus();break;case 36:t.preventDefault(),u[0].focus();break;case 35:t.preventDefault(),u[u.length-1].focus()}}function n(e){e.setAttribute("aria-expanded","true"),d(e)}function e(){!function(){for(var e=u.length;e--;)d(u[e],!0)}(),function(){for(var e=function(e){o.resizeEvent(e,i)},t=u.length;t--;){var n=u[t];n.addEventListener("click",a),n.addEventListener("keydown",c),r.querySelector("#".concat(n.getAttribute("aria-controls"))).addEventListener("transitionend",o.transitionEnd),o.resizeEvent&&window.addEventListener("resize",e)}window.addEventListener("hashchange",s)}(),s()}var u=r.querySelectorAll(o.buttonSelector),d=function(e,t){var n=r.querySelector("#".concat(e.getAttribute("aria-controls")));n&&("true"===e.getAttribute("aria-expanded")?(n.classList.add(o.accordionExpandedClass),n.setAttribute("aria-hidden","false"),n.removeAttribute("hidden"),i.push(n),o.expand(e,n)):(n.classList.remove(o.accordionExpandedClass),n.setAttribute("aria-hidden","true"),t&&n.setAttribute("hidden","hidden"),i.filter(function(e){return e!==n}),o.collapse(e,n)))},s=function(){var e=window.location.hash.replace("#","");if(e)try{var t=r.querySelector("[aria-controls=".concat(e,"]"));t&&(n(t),t.focus())}catch(e){}};return!1!==o.init&&e(),{init:e,closeAll:function(){for(var e=u.length;e--;)(t=u[e]).setAttribute("aria-expanded","false"),d(t);var t},openAll:function(){for(var e=u.length;e--;)n(u[e])}}}});