{"version":3,"file":"primeflow-classic-search.js","mappings":";4HAAe,SAASA,EAAcC,EAAsBC,GAC1D,GAAKD,GAAYC,EAAjB,CAIA,IAAMC,EAAM,UACRC,GAAY,EACZC,EAAaC,OAAOC,QAExBN,EAAQO,iBAAiB,SAAS,WAChC,GAAKJ,EAaDE,OAAOC,QAAUL,EAAUO,cAC7BP,EAAUQ,UAAUC,OAAOR,GAG7BC,GAAY,MAjBZ,CACEF,EAAUQ,UAAUE,IAAIT,GACxBC,GAAY,EAEZ,IAAMS,EAAQX,EAAUY,cAAc,SAElCD,GACFA,EAAME,QAWZ,IAiBAT,OAAOE,iBAAiB,UAAU,WACxB,IAAAD,EAAYD,OAAM,SAhB5B,SAAgBU,EAAkBC,GAChC,KAAIA,EAAQD,GAKZ,OAAIA,EAAWd,EAAUO,cACvBP,EAAUQ,UAAUC,OAAOR,QAC3BC,GAAY,SAIdF,EAAUQ,UAAUE,IAAIT,GAVtBD,EAAUQ,UAAUE,IAAIT,EAW5B,CAKEe,CAAOX,EAASF,GAChBA,EAAaE,CACf,IACF","sources":["webpack://empori-primeflow-base/./src/search/classicSearch.ts"],"sourcesContent":["export default function classicSearch(trigger: HTMLElement, searchBar: HTMLElement) {\r\n if (!trigger || !searchBar) {\r\n return;\r\n }\r\n\r\n const cls = 'visible';\r\n let triggered = false;\r\n let lastScroll = window.scrollY;\r\n\r\n trigger.addEventListener('click', () => {\r\n if (!triggered) {\r\n searchBar.classList.add(cls);\r\n triggered = true;\r\n\r\n const input = searchBar.querySelector('input');\r\n\r\n if (input) {\r\n input.focus();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if (window.scrollY > searchBar.clientHeight) {\r\n searchBar.classList.remove(cls);\r\n }\r\n\r\n triggered = false;\r\n });\r\n\r\n function setCls(currentY: number, lastY: number) {\r\n if (lastY > currentY) {\r\n searchBar.classList.add(cls);\r\n return;\r\n }\r\n\r\n if (currentY > searchBar.clientHeight) {\r\n searchBar.classList.remove(cls);\r\n triggered = false;\r\n return;\r\n }\r\n\r\n searchBar.classList.add(cls);\r\n }\r\n\r\n window.addEventListener('scroll', () => {\r\n const { scrollY } = window;\r\n\r\n setCls(scrollY, lastScroll);\r\n lastScroll = scrollY;\r\n });\r\n}"],"names":["classicSearch","trigger","searchBar","cls","triggered","lastScroll","window","scrollY","addEventListener","clientHeight","classList","remove","add","input","querySelector","focus","currentY","lastY","setCls"],"sourceRoot":""}