{"version":3,"sources":["/Users/user/afs-redesign/frontend/source/assets/js/partner-cards-block-w-filter.js"],"names":["partnerCardsBlockWithFilterModule","classNamePrefix","status","isInitialized","scrollYBeforeDropdownOpened","setUp","blocks","document","querySelectorAll","concat","length","forEach","block","showMoreButton","querySelector","showLessButton","addEventListener","classList","add","remove","blockHeader","classes","contains","window","scrollTo","scrollY","init"],"mappings":"AAAA,YAEA,IAAIA,mCAAoCA,mCAAqC,WAC3E,GAAIC,GAAkB,+BAClBC,GACFC,eAAe,EACfC,4BAA6B,GAG3BC,EAAQ,WACV,GAAIC,GAASC,SAASC,iBAAiB,IAAIC,OAAOR,GAE9CK,GAAOI,OAAS,GAClBJ,EAAOK,QAAQ,SAAUC,GACvB,GAAIC,GAAiBD,EAAME,cAAc,IAAIL,OAAOR,EAAiB,gBACjEc,EAAiBH,EAAME,cAAc,IAAIL,OAAOR,EAAiB,eACjEY,IAAgBA,EAAeG,iBAAiB,QAAS,WAC3DJ,EAAMK,UAAUC,IAAI,qBAElBH,GAAgBA,EAAeC,iBAAiB,QAAS,WAC3DJ,EAAMK,UAAUE,OAAO,qBAEzBP,EAAMI,iBAAiB,iBAAkB,WACvC,GAAII,GAAcR,EAAME,cAAc,IAAIL,OAAOR,EAAiB,UAElE,IAAImB,EAAa,CACf,GAAIC,GAAUD,EAAYH,SAEtBI,GAAQC,SAAS,WACnBC,OAAOC,SAAS,EAAGtB,EAAOE,6BAC1BiB,EAAQF,OAAO,YAEfjB,EAAOE,4BAA8BmB,OAAOE,QAC5CJ,EAAQH,IAAI,gBAOtBK,OAAOP,iBAAiB,SAAU,WAChCV,EAAOK,QAAQ,SAAUC,GACvB,GAAIQ,GAAcR,EAAME,cAAc,IAAIL,OAAOR,EAAiB,UAE9DmB,IAAeA,EAAYH,UAAUK,SAAS,WAChDF,EAAYH,UAAUE,OAAO,eAMjCO,EAAO,WACLxB,EAAOC,gBACXE,IACAH,EAAOC,eAAgB,GAGzB,QACEuB,KAAMA,EACNxB,OAAQA,KAIZK,UAASS,iBAAiB,mBAAoBhB,kCAAkC0B","file":"partner-cards-block-w-filter.min.js","sourcesContent":["const partnerCardsBlockWithFilterModule =\n partnerCardsBlockWithFilterModule ||\n (() => {\n const classNamePrefix = \"partner-cards-block-w-filter\"\n const status = {\n isInitialized: false,\n scrollYBeforeDropdownOpened: 0,\n }\n const setUp = () => {\n const blocks = document.querySelectorAll(`.${classNamePrefix}`)\n if (blocks.length > 0) {\n blocks.forEach((block, index) => {\n const showMoreButton = block.querySelector(`.${classNamePrefix}__show-more`)\n const showLessButton = block.querySelector(`.${classNamePrefix}__show-less`)\n\n if (showMoreButton)\n showMoreButton.addEventListener(\"click\", () => {\n block.classList.add(\"show-all-filter\")\n })\n\n if (showLessButton)\n showLessButton.addEventListener(\"click\", () => {\n block.classList.remove(\"show-all-filter\")\n })\n\n block.addEventListener(\"dropdown-click\", (e) => {\n const blockHeader = block.querySelector(`.${classNamePrefix}__head`)\n if (blockHeader) {\n const classes = blockHeader.classList\n if (classes.contains(\"d-none\")) {\n window.scrollTo(0, status.scrollYBeforeDropdownOpened)\n classes.remove(\"d-none\")\n } else {\n status.scrollYBeforeDropdownOpened = window.scrollY\n classes.add(\"d-none\")\n }\n }\n })\n })\n }\n\n window.addEventListener(\"resize\", () => {\n blocks.forEach((block) => {\n const blockHeader = block.querySelector(`.${classNamePrefix}__head`)\n if (blockHeader && blockHeader.classList.contains(\"d-none\")) {\n blockHeader.classList.remove(\"d-none\")\n }\n })\n })\n }\n\n const init = () => {\n if (status.isInitialized) return\n setUp()\n status.isInitialized = true\n }\n return { init, status }\n })()\n\ndocument.addEventListener(\"DOMContentLoaded\", partnerCardsBlockWithFilterModule.init)\n"]}