{"version":3,"file":"useTextSpinner.cjs","sources":["../../../../src/components/logo/useTextSpinner.ts"],"sourcesContent":["import React, { useState } from \"react\";\nimport { useIntersectionObserver } from \"../../hooks/useIntersectionObserver/useIntersectionObserver.js\";\nexport function useTextSpinner<T extends HTMLElement | SVGElement>(\n    ref: React.RefObject<T>,\n) {\n    const [hasAnimated, setHasAnimated] = useState(false);\n    const [visible, setVisible] = useState(false);\n\n    const onIntersect = (entries: IntersectionObserverEntry[]) => {\n        const intersecting = entries.some((entry) => entry.isIntersecting);\n        setVisible(intersecting);\n        if (intersecting) {\n            setHasAnimated(true);\n        }\n    };\n    useIntersectionObserver(ref, onIntersect, () => setVisible(true), {\n        rootMargin: \"50% 0% 0% 0%\",\n        threshold: 0.5,\n    });\n\n    return { hasAnimated, visible };\n}\n"],"names":["ref","hasAnimated","setHasAnimated","useState","visible","setVisible","useIntersectionObserver","entries","intersecting","some","entry","isIntersecting","rootMargin","threshold"],"mappings":"6MAEO,SACHA,GAEA,MAAOC,EAAaC,GAAkBC,EAAAA,UAAS,IACxCC,EAASC,GAAcF,EAAAA,UAAS,GASvCG,OAAAA,EAAAA,wBAAwBN,EAPHO,IACjB,MAAMC,EAAeD,EAAQE,KAAMC,GAAUA,EAAMC,gBACnDN,EAAWG,GACPA,GACAN,GAAe,IAGmB,IAAMG,GAAW,GAAO,CAC9DO,WAAY,eACZC,UAAW,KAGR,CAAEZ,YAAAA,EAAaG,QAAAA,EAC1B"}