{"version":3,"file":"./js/header/header.min.js","mappings":"yBAAA,SAASA,IACP,IAAMC,EAAYC,SAASC,cAAc,gBACnCC,EAAQH,EAAUE,cAAc,SAElCF,GAAaG,IACfH,EAAUI,UAAUC,IAAI,iBACxBL,EAAUM,MAAMC,MAAQ,QACxBP,EAAUM,MAAME,OAAS,OACzBL,EAAMG,MAAMG,QAAU,QACtBN,EAAMO,QAENP,EAAMQ,iBAAiB,QAAQ,WAC7BX,EAAUI,UAAUQ,OAAO,iBAC3BT,EAAMG,MAAMG,QAAU,MACxB,IAEJ,CAEAR,SAASU,iBAAiB,oBAAoB,WAC5C,IAAMX,EAAYC,SAASC,cAAc,gBAErCF,GACFA,EAAUW,iBAAiB,QAASZ,GAItCE,SAASU,iBAAiB,SAAS,SAACE,GAClC,IAAMC,EAASD,EAAMC,OAChBd,EAAUe,SAASD,KACtBd,EAAUI,UAAUQ,OAAO,iBAC3BZ,EAAUM,MAAMC,MAAQ,OACVP,EAAUE,cAAc,SAChCI,MAAMG,QAAU,OAE1B,GACF,IAIAR,SAASU,iBAAiB,oBAAoB,WAC5C,IAAMK,EAAqBf,SAASC,cAClC,yBAEF,GAAKc,EAAL,CAEA,IAAIC,EAAiC,KAErCD,EAAmBL,iBAAiB,SAAS,WACtCM,IAEHA,EAAkBD,EAAmBE,WAGvC,IAAMf,EAAQF,SAASkB,cAAc,SACrChB,EAAMiB,KAAO,OACbjB,EAAMkB,YAAc,eACpBlB,EAAMmB,KAAO,IACbN,EAAmBE,UAAY,GAC/BF,EAAmBO,YAAYpB,GAC/BA,EAAMO,QAGNT,SAASU,iBAAiB,QAASa,EACrC,IAEA,IAAMA,EAAyB,SAACX,GAC9B,IAAMC,EAASD,EAAMC,OAChBE,EAAmBD,SAASD,IAC3BG,IACFD,EAAmBE,UAAYD,EAC/BA,EAAkB,KAClBhB,SAASwB,oBAAoB,QAASD,GAG5C,CA/B+B,CAgCjC,G","sources":["webpack://empty-project/./src/ts/header.ts"],"sourcesContent":["function transformToInput() {\n const searchDiv = document.querySelector(\".search-home\") as HTMLElement;\n const input = searchDiv.querySelector(\"input\") as HTMLInputElement;\n\n if (searchDiv && input) {\n searchDiv.classList.add(\"input-visible\");\n searchDiv.style.width = \"310px\";\n searchDiv.style.height = \"42px\";\n input.style.display = \"block\";\n input.focus();\n\n input.addEventListener(\"blur\", () => {\n searchDiv.classList.remove(\"input-visible\");\n input.style.display = \"none\";\n });\n }\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const searchDiv = document.querySelector(\".search-home\") as HTMLElement;\n\n if (searchDiv) {\n searchDiv.addEventListener(\"click\", transformToInput);\n }\n\n // Adiciona um ouvinte de evento ao documento para detectar cliques fora do elemento .search\n document.addEventListener(\"click\", (event) => {\n const target = event.target as HTMLElement;\n if (!searchDiv.contains(target)) {\n searchDiv.classList.remove(\"input-visible\"); // Remove a classe quando o input é oculto\n searchDiv.style.width = \"32px\"; // Volta ao estado anterior\n const input = searchDiv.querySelector(\"input\") as HTMLInputElement;\n input.style.display = \"none\"; // Esconde o input novamente\n }\n });\n});\n\n// Mobile navbar\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const searchHeaderMobile = document.querySelector(\n \".search-header-mobile\"\n );\n if (!searchHeaderMobile) return;\n\n let originalContent: string | null = null; // Variável para armazenar o conteúdo original\n\n searchHeaderMobile.addEventListener(\"click\", () => {\n if (!originalContent) {\n // Armazena o conteúdo original somente se ainda não estiver armazenado\n originalContent = searchHeaderMobile.innerHTML;\n }\n \n const input = document.createElement(\"input\");\n input.type = \"text\";\n input.placeholder = \"Pesquisar...\";\n input.name = \"s\";\n searchHeaderMobile.innerHTML = \"\";\n searchHeaderMobile.appendChild(input);\n input.focus();\n\n // Adiciona um evento de clique no documento para restaurar o conteúdo original\n document.addEventListener(\"click\", restoreOriginalContent);\n });\n\n const restoreOriginalContent = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n if (!searchHeaderMobile.contains(target)) {\n if (originalContent) {\n searchHeaderMobile.innerHTML = originalContent;\n originalContent = null; // Reseta a variável para liberar a memória\n document.removeEventListener(\"click\", restoreOriginalContent); // Remove o evento de clique do documento\n }\n }\n };\n});\n"],"names":["transformToInput","searchDiv","document","querySelector","input","classList","add","style","width","height","display","focus","addEventListener","remove","event","target","contains","searchHeaderMobile","originalContent","innerHTML","createElement","type","placeholder","name","appendChild","restoreOriginalContent","removeEventListener"],"sourceRoot":""}