{"version":3,"sources":["categories.js"],"names":["Categories","[object Object]","el","this","scope","triggers","querySelectorAll","showAllTrigger","bindEvents","forEach","target","addEventListener","toggleCategory","showAll","getAttribute","removeAttribute","classList","add","remove","toggleSections","setAttribute","UnselectCategories","showAllSections","UnselectShowAllOption","length","trigger","category","document","querySelector","showSection","hideSection","section","filter","x","dataset","show"],"mappings":"AACA,MAAMA,WACJC,YAAYC,GACVC,KAAKC,MAAQF,EACbC,KAAKE,SAAWH,EAAGI,iBAAiB,0BACpCH,KAAKI,eAAiBL,EAAGI,iBAAiB,uBAC1CH,KAAKK,aAGPP,aACEE,KAAKE,SAASI,QAAQC,IACpBA,EAAOC,iBAAiB,QAAS,IAAMR,KAAKS,eAAeF,MAE7DP,KAAKI,eAAeE,QAAQP,IAC1BC,KAAKU,QAAQX,GACbA,EAAGS,iBAAiB,QAAS,IAAMR,KAAKU,QAAQX,MAIpDD,QAAQC,GACFA,EAAGY,aAAa,gBAClBZ,EAAGa,gBAAgB,eACnBb,EAAGc,UAAUC,IAAI,aACjBf,EAAGc,UAAUE,OAAO,aACpBf,KAAKgB,mBAELjB,EAAGkB,aAAa,cAAe,QAC/BlB,EAAGc,UAAUE,OAAO,aACpBhB,EAAGc,UAAUC,IAAI,aACjBd,KAAKkB,qBACLlB,KAAKmB,mBAITrB,wBACEE,KAAKI,eAAeE,QAAQP,IACtBA,EAAGY,aAAa,iBAClBZ,EAAGa,gBAAgB,eACnBb,EAAGc,UAAUC,IAAI,aACjBf,EAAGc,UAAUE,OAAO,gBAK1BjB,qBACEE,KAAKE,SAASI,QAAQP,IAChBA,EAAGY,aAAa,iBAClBZ,EAAGa,gBAAgB,eACnBb,EAAGc,UAAUC,IAAI,aACjBf,EAAGc,UAAUE,OAAO,gBAK1BjB,eAAeC,GACbC,KAAKoB,wBAEDrB,EAAGY,aAAa,gBAClBZ,EAAGa,gBAAgB,eACnBb,EAAGc,UAAUC,IAAI,aACjBf,EAAGc,UAAUE,OAAO,eAEpBhB,EAAGkB,aAAa,cAAe,QAC/BlB,EAAGc,UAAUE,OAAO,aACpBhB,EAAGc,UAAUC,IAAI,cAGnBd,KAAKgB,iBAGPlB,iBACME,KAAKC,MAAME,iBAAiB,uCAAuCkB,OAAS,EAC9ErB,KAAKE,SAASI,QAAQgB,IACpB,MAAMC,EAAWD,EAAQX,aAAa,wBAChCJ,EAASiB,SAASC,yCAAyCF,OAE7DD,EAAQX,aAAa,eACvBJ,GAAUP,KAAK0B,YAAYnB,GAE3BA,GAAUP,KAAK2B,YAAYpB,KAI/BP,KAAKI,eAAeE,QAAQP,IAC1BC,KAAKU,QAAQX,KAKnBD,YAAY8B,GACVA,EAAQf,UAAUE,OAAO,UAG3BjB,YAAY8B,GACVA,EAAQf,UAAUC,IAAI,UAGxBhB,kBACE0B,SAASrB,iBAAiB,2BAA2BG,QAAQsB,IAC7C,IAAIA,EAAQzB,iBAAiB,kBAAkB0B,OAAOC,GAAwB,SAAnBA,EAAEC,QAAQC,OAAoB,GAAOX,OAElG,EACVrB,KAAK0B,YAAYE,GAEjB5B,KAAK2B,YAAYC,MAOzBJ,SAASrB,iBAAiB,qBAAqBG,QAAQP,IACrD,IAAIF,WAAWE","sourcesContent":["//data-categories\r\nclass Categories {\r\n constructor(el) {\r\n this.scope = el;\r\n this.triggers = el.querySelectorAll(\"[data-category-target]\");\r\n this.showAllTrigger = el.querySelectorAll(\"[data-category-all]\");\r\n this.bindEvents();\r\n }\r\n\r\n bindEvents() {\r\n this.triggers.forEach(target => {\r\n target.addEventListener(\"click\", () => this.toggleCategory(target));\r\n })\r\n\r\n this.showAllTrigger.forEach(el => {\r\n this.showAll(el);\r\n el.addEventListener(\"click\", () => this.showAll(el));\r\n })\r\n }\r\n\r\n showAll(el) {\r\n if (el.getAttribute(\"data-active\")) {\r\n el.removeAttribute(\"data-active\");\r\n el.classList.add(\"button--2\");\r\n el.classList.remove(\"button--3\");\r\n this.toggleSections();\r\n } else {\r\n el.setAttribute(\"data-active\", \"true\");\r\n el.classList.remove(\"button--2\");\r\n el.classList.add(\"button--3\");\r\n this.UnselectCategories();\r\n this.showAllSections();\r\n }\r\n }\r\n\r\n UnselectShowAllOption() {\r\n this.showAllTrigger.forEach(el => {\r\n if (el.getAttribute(\"data-active\")) {\r\n el.removeAttribute(\"data-active\");\r\n el.classList.add(\"button--2\");\r\n el.classList.remove(\"button--3\");\r\n }\r\n });\r\n }\r\n\r\n UnselectCategories() {\r\n this.triggers.forEach(el => {\r\n if (el.getAttribute(\"data-active\")) {\r\n el.removeAttribute(\"data-active\");\r\n el.classList.add(\"button--2\");\r\n el.classList.remove(\"button--3\");\r\n }\r\n });\r\n }\r\n\r\n toggleCategory(el) {\r\n this.UnselectShowAllOption();\r\n\r\n if (el.getAttribute(\"data-active\")) {\r\n el.removeAttribute(\"data-active\");\r\n el.classList.add(\"button--2\");\r\n el.classList.remove(\"button--3\");\r\n } else {\r\n el.setAttribute(\"data-active\", \"true\");\r\n el.classList.remove(\"button--2\");\r\n el.classList.add(\"button--3\");\r\n }\r\n this.toggleSections();\r\n }\r\n\r\n toggleSections() {\r\n if (this.scope.querySelectorAll('[data-category-target][data-active]').length > 0) {\r\n this.triggers.forEach(trigger => {\r\n const category = trigger.getAttribute(\"data-category-target\");\r\n const target = document.querySelector(`[data-category-content=\"${category}\"]`);\r\n if (trigger.getAttribute(\"data-active\")) {\r\n target && this.showSection(target);\r\n } else {\r\n target && this.hideSection(target);\r\n }\r\n })\r\n } else {\r\n this.showAllTrigger.forEach(el => {\r\n this.showAll(el);\r\n })\r\n }\r\n }\r\n\r\n showSection(section) {\r\n section.classList.remove(\"hidden\");\r\n }\r\n\r\n hideSection(section) {\r\n section.classList.add(\"hidden\");\r\n }\r\n\r\n showAllSections() {\r\n document.querySelectorAll(\"[data-category-content]\")\r\n .forEach(section => {\r\n \r\n const count = [...section.querySelectorAll(\"[data-result]\")]\r\n .filter(x => x.dataset.show !== \"true\" === false)\r\n .length;\r\n \r\n if (count > 0)\r\n {\r\n this.showSection(section); \r\n }\r\n else\r\n {\r\n this.hideSection(section);\r\n }\r\n });\r\n }\r\n}\r\n\r\ndocument.querySelectorAll('[data-categories]').forEach(el => {\r\n new Categories(el);\r\n})"],"file":"categories-min.js"}