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B,SAAS,GAAGN,cAAc,CAACO,YAAY,CAAC,IAAI,CAAC;YACnD,IAAKD,SAAS,KAAKjB,SAAS,CAACI,aAAa,CAAC,+BAA+B,CAAC,CAACc,YAAY,CAAC,IAAI,CAAC,EAAG;cAC/FlB,SAAS,CAACI,aAAa,CAAC,+BAA+B,CAAC,CAACI,SAAS,CAACW,GAAG,CAAC,gBAAgB,CAAC;cACxFnB,SAAS,CAACI,aAAa,CAAC,mCAAmC,CAAC,CAACI,SAAS,CAACW,GAAG,CAAC,gBAAgB,CAAC;YAC9F;UACF,CAAC,CAAC;QACJ;MACF,CAAC,CAAC;IACN,CAAC,CAAC;EACJ;AACF,CAAC,EAAE,KAAK,CAAC,C","sources":["webpack://webdevia-blocks/./includes/block-editor/blocks/accordion-block/view.js"],"sourcesContent":["/******************************************** accordion block ***************************************************/\r\n\r\ndocument.addEventListener('DOMContentLoaded', function () {\r\n const accordions = document.querySelectorAll('.wd-blocks-accordion')\r\n \r\n if ( accordions.length ) {\r\n accordions.forEach( accordion => {\r\n const options = accordion.dataset.options\r\n \r\n const title = accordion.querySelector('.wd-blocks-accordion__title')\r\n \r\n const content = accordion.querySelector('.wd-blocks-accordion__content')\r\n const icon = accordion.querySelector('.wd-blocks-accordion__title__icon')\r\n \r\n if ( !options.initiallyOpen ) {\r\n content.classList.toggle( 'accordion-hide' )\r\n icon.classList.toggle( 'accordion-hide' )\r\n }\r\n \r\n title.addEventListener(\"click\", (e) => {\r\n const currentContent = e.target.closest('.wd-blocks-accordion').querySelector('.wd-blocks-accordion__content')\r\n const currentIcon = e.target.closest('.wd-blocks-accordion').querySelector('.wd-blocks-accordion__title__icon')\r\n currentContent.classList.toggle('accordion-hide')\r\n currentIcon.classList.toggle('accordion-hide')\r\n if ( options.autoClose && !currentContent.classList.contains('accordion-hide') ) {\r\n accordions.forEach( accordion => {\r\n const currentId = currentContent.getAttribute('id')\r\n if ( currentId !== accordion.querySelector('.wd-blocks-accordion__content').getAttribute('id') ) {\r\n accordion.querySelector('.wd-blocks-accordion__content').classList.add('accordion-hide')\r\n accordion.querySelector('.wd-blocks-accordion__title__icon').classList.add('accordion-hide')\r\n }\r\n })\r\n }\r\n })\r\n })\r\n }\r\n}, false);"],"names":["document","addEventListener","accordions","querySelectorAll","length","forEach","accordion","options","dataset","title","querySelector","content","icon","initiallyOpen","classList","toggle","e","currentContent","target","closest","currentIcon","autoClose","contains","currentId","getAttribute","add"],"sourceRoot":""}