{"version":3,"file":"use-favicon.cjs","names":[],"sources":["../../src/hooks/use-favicon.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\n/**\n * Swap the document favicon by updating the `<link rel=\"icon\">` href.\n * Creates the link element when it is missing. SSR-safe — no-op when\n * `document` is unavailable.\n *\n * @param href - the favicon URL to apply.\n */\nexport function useFavicon(href: string): void {\n    useEffect(() => {\n        if (typeof document === \"undefined\") return;\n        let link = document.querySelector<HTMLLinkElement>('link[rel=\"icon\"]');\n        if (!link) {\n            link = document.createElement(\"link\");\n            link.rel = \"icon\";\n            document.head.appendChild(link);\n        }\n        link.href = href;\n    }, [href]);\n}\n"],"mappings":"uBASA,SAAgB,EAAW,EAAoB,EAC3C,EAAA,EAAA,UAAA,KAAgB,CACZ,GAAI,OAAO,SAAa,IAAa,OACrC,IAAI,EAAO,SAAS,cAA+B,kBAAkB,EAChE,IACD,EAAO,SAAS,cAAc,MAAM,EACpC,EAAK,IAAM,OACX,SAAS,KAAK,YAAY,CAAI,GAElC,EAAK,KAAO,CAChB,EAAG,CAAC,CAAI,CAAC,CACb"}