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AAasB,MAAMC,QAAU,MACtC,E,iFC5DJ,IAA8BS,EAA9BC,GAA8BD,EAA9BE,EAAA,OAA8BF,EAAAG,WAAAH,EAAA,CAAAI,QAAAJ,GAsC7BxC,EAAAA,QApCc,MACXC,WAAAA,CAAYC,EAAK2C,GACb1C,KAAK2C,gBAAkB5C,EAAIG,cAAc,wBACzCF,KAAK4C,KAAOC,SAAS3C,cAAc,QACnCF,KAAK8C,gBAAkBD,SAAS3C,cAAc,sBAC9CF,KAAK+C,cAAe,EACpB,MAAMC,EAAahD,KAAKgD,WAAWrC,KAAKX,MACxCA,KAAK2C,gBAAgBM,iBAAiB,QAASD,GAC/ChD,KAAKkD,OAAS,IAAIC,EAAAA,QAAOnD,KAAK8C,iBAG9B9C,KAAKoD,SAAWV,GAAMU,SACtB,IAAIC,EAAwB,KACxBrD,KAAKoD,WACLC,EAAwBR,SAAS3C,cAC7B,+BAEJmD,EAAsBJ,iBAAiB,QAASD,GAExD,CAEAA,UAAAA,GACQhD,KAAKoD,UACLP,SAASD,KAAKU,UAAUC,OAAO,oBAE/BvD,KAAK8C,gBAAgBQ,UAAUE,SAAS,gBACxCxD,KAAK8C,gBAAgBQ,UAAUC,OAAO,eACtCvD,KAAK8C,gBAAgBQ,UAAUG,IAAI,gBACnCzD,KAAK4C,KAAKU,UAAUC,OAAO,YAE3BvD,KAAK8C,gBAAgBQ,UAAUG,IAAI,eACnCzD,KAAK8C,gBAAgBQ,UAAUC,OAAO,gBACtCvD,KAAK4C,KAAKU,UAAUG,IAAI,WAE5BzD,KAAKkD,OAAOf,cAChB,E","sources":["webpack://frontendplaceholder/./Src/Scripts/components/search.js","webpack://frontendplaceholder/./Src/Scripts/components/top-navigation-search.js"],"sourcesContent":["export default class Search {\n constructor(elm) {\n this.searchContainer = elm.querySelector('.search-result-container');\n this.resultAmountFirst = elm.querySelector('.result-amound--first');\n this.resultAmountSecond = elm.querySelector('.result-amound--second');\n\n this.resultBottom = elm.querySelector(\n '.header__search-container__bottom',\n );\n\n this.abortController = new AbortController();\n\n this.searchInput = elm.querySelector('#search');\n const searchCallback = this.loadSearchResult.bind(this);\n const abortCallback = this.abortFetch.bind(this);\n\n this.searchInput.onkeyup = function () {\n const searchInputValue = this.searchInput.value;\n if (searchInputValue.length > 2) {\n abortCallback();\n searchCallback(searchInputValue);\n }\n }.bind(this);\n }\n\n async loadSearchResult(searchString) {\n const signal = this.abortController.signal;\n const url =\n '/umbraco/api/search/content?query=' +\n searchString +\n '&culture=da&html=true';\n try {\n const response = await fetch(url, {\n signal,\n });\n const value = await response.json();\n this.searchContainer.innerHTML = value.htmlResults;\n this.resultAmountFirst.innerHTML = value.totalResults;\n this.resultAmountSecond.innerHTML = value.totalResults;\n this.resultBottom.style.display = 'flex';\n } catch (error) {\n if (typeof error !== DOMException && error.name !== 'AbortError') {\n console.error(error);\n }\n }\n }\n\n abortFetch() {\n this.abortController?.abort();\n this.fetchIsLoading = false;\n this.abortController = new AbortController();\n }\n\n clearResults() {\n console.log(this.searchInput);\n this.searchInput.value = '';\n this.searchContainer.innerHTML = '';\n this.resultAmountFirst.innerHTML = 0;\n this.resultAmountSecond.innerHTML = 0;\n this.resultBottom.style.display = 'none';\n }\n}\n","import Search from './search';\n\nexport default class TopNavigationSearch {\n constructor(elm, args) {\n this.searchToggleBtn = elm.querySelector('[data-search-toggle]');\n this.body = document.querySelector('body');\n this.headerContainer = document.querySelector('.header__container');\n this.isSearchOpen = false;\n const openSearch = this.openSearch.bind(this);\n this.searchToggleBtn.addEventListener('click', openSearch);\n this.search = new Search(this.headerContainer);\n\n // hacky mobile menu to hacky script...\n this.isMobile = args?.isMobile;\n let searchToggleBtnMobile = null;\n if (this.isMobile) {\n searchToggleBtnMobile = document.querySelector(\n '[data-search-toggle-mobile]',\n );\n searchToggleBtnMobile.addEventListener('click', openSearch);\n }\n }\n\n openSearch() {\n if (this.isMobile) {\n document.body.classList.remove('mobile-menu-open');\n }\n if (this.headerContainer.classList.contains('open-search')) {\n this.headerContainer.classList.remove('open-search');\n this.headerContainer.classList.add('close-search');\n this.body.classList.remove('blured');\n } else {\n this.headerContainer.classList.add('open-search');\n this.headerContainer.classList.remove('close-search');\n this.body.classList.add('blured');\n }\n this.search.clearResults();\n }\n}\n"],"names":["exports","constructor","elm","this","searchContainer","querySelector","resultAmountFirst","resultAmountSecond","resultBottom","abortController","AbortController","searchInput","searchCallback","loadSearchResult","bind","abortCallback","abortFetch","onkeyup","searchInputValue","value","length","searchString","signal","url","response","fetch","json","innerHTML","htmlResults","totalResults","style","display","error","DOMException","name","console","abort","fetchIsLoading","clearResults","log","obj","_search","require","__esModule","default","args","searchToggleBtn","body","document","headerContainer","isSearchOpen","openSearch","addEventListener","search","Search","isMobile","searchToggleBtnMobile","classList","remove","contains","add"],"sourceRoot":""}