import { cn } from "./index3.js";
import { motion } from "./index359.js";
import { useReducedMotion } from "./index361.js";
import { cva } from "class-variance-authority";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/organisms/ai/AITextShimmer/AITextShimmer.tsx
var textShimmerVariants = cva("inline-block", {
	variants: { size: {
		xs: "text-xs",
		sm: "text-sm",
		md: "text-base",
		lg: "text-lg",
		xl: "text-xl"
	} },
	defaultVariants: { size: "md" }
});
var shimmerPresets = {
	brand: "color-mix(in srgb, var(--brand-500) 60%, transparent)",
	silver: "color-mix(in srgb, var(--muted-foreground) 50%, transparent)"
};
var AITextShimmer = React.forwardRef(({ children, size, duration = 2, variant = "brand", shimmerColor, baseColor = "var(--quaternary-foreground)", isActive = true, className }, ref) => {
	const prefersReducedMotion = useReducedMotion();
	const resolvedShimmerColor = shimmerColor ?? shimmerPresets[variant];
	if (!isActive || prefersReducedMotion) return /* @__PURE__ */ jsx("span", {
		ref,
		"data-slot": "ai-text-shimmer",
		className: cn(textShimmerVariants({ size }), className),
		style: { color: baseColor },
		children
	});
	return /* @__PURE__ */ jsx(motion.span, {
		ref,
		"data-slot": "ai-text-shimmer",
		"aria-busy": "true",
		className: cn(textShimmerVariants({ size }), "bg-clip-text text-transparent bg-[length:200%_100%] will-change-[background-position]", className),
		style: { backgroundImage: `linear-gradient(
          90deg,
          ${baseColor} 0%,
          ${baseColor} 25%,
          ${resolvedShimmerColor} 50%,
          ${baseColor} 75%,
          ${baseColor} 100%
        )` },
		animate: { backgroundPosition: ["200% 0", "-200% 0"] },
		transition: {
			duration,
			repeat: Number.POSITIVE_INFINITY,
			ease: "linear"
		},
		children
	});
});
AITextShimmer.displayName = "AITextShimmer";
var dotSizes = {
	sm: "size-1",
	md: "size-1.5",
	lg: "size-2"
};
var dotGaps = {
	sm: "gap-0.5",
	md: "gap-1",
	lg: "gap-1.5"
};
var AILoadingDots = React.forwardRef(({ size = "md", color = "bg-muted", className }, ref) => {
	const prefersReducedMotion = useReducedMotion();
	return /* @__PURE__ */ jsx("span", {
		ref,
		"data-slot": "ai-loading-dots",
		role: "status",
		"aria-label": "Loading",
		className: cn("inline-flex items-center", dotGaps[size], className),
		children: [
			0,
			1,
			2
		].map((i) => /* @__PURE__ */ jsx(motion.span, {
			className: cn("rounded-full will-change-transform", dotSizes[size], color),
			animate: prefersReducedMotion ? {
				y: 0,
				opacity: .75
			} : {
				y: [
					0,
					-2,
					0
				],
				opacity: [
					.4,
					1,
					.4
				]
			},
			transition: prefersReducedMotion ? void 0 : {
				duration: 1,
				repeat: Number.POSITIVE_INFINITY,
				ease: [
					.4,
					0,
					.2,
					1
				],
				delay: i * .15
			},
			"aria-hidden": "true"
		}, i))
	});
});
AILoadingDots.displayName = "AILoadingDots";
var AITypingText = React.forwardRef(({ texts, typingSpeed = 50, pauseDuration = 1500, className }, ref) => {
	const [currentTextIndex, setCurrentTextIndex] = React.useState(0);
	const [displayedText, setDisplayedText] = React.useState("");
	const [isDeleting, setIsDeleting] = React.useState(false);
	const pauseTimerRef = React.useRef(void 0);
	React.useEffect(() => {
		const currentFullText = texts[currentTextIndex];
		const timer = setTimeout(() => {
			if (!isDeleting) if (displayedText.length < currentFullText.length) setDisplayedText(currentFullText.slice(0, displayedText.length + 1));
			else pauseTimerRef.current = setTimeout(() => setIsDeleting(true), pauseDuration);
			else if (displayedText.length > 0) setDisplayedText(currentFullText.slice(0, displayedText.length - 1));
			else {
				setIsDeleting(false);
				setCurrentTextIndex((prev) => (prev + 1) % texts.length);
			}
		}, isDeleting ? typingSpeed / 2 : typingSpeed);
		return () => {
			clearTimeout(timer);
			clearTimeout(pauseTimerRef.current);
		};
	}, [
		displayedText,
		isDeleting,
		currentTextIndex,
		texts,
		typingSpeed,
		pauseDuration
	]);
	return /* @__PURE__ */ jsxs("span", {
		ref,
		"data-slot": "ai-typing-text",
		role: "status",
		"aria-label": texts[currentTextIndex],
		className: cn("inline-flex items-center", className),
		children: [displayedText, /* @__PURE__ */ jsx(motion.span, {
			className: "inline-block w-0.5 h-[1em] bg-muted-foreground ms-0.5 motion-reduce:animate-none motion-reduce:opacity-100",
			animate: { opacity: [
				1,
				.15,
				1
			] },
			transition: {
				duration: 1,
				repeat: Number.POSITIVE_INFINITY,
				ease: "easeInOut"
			},
			"aria-hidden": "true"
		})]
	});
});
AITypingText.displayName = "AITypingText";
var AIPulseText = React.forwardRef(({ children, isActive = true, className }, ref) => {
	const prefersReducedMotion = useReducedMotion();
	if (!isActive || prefersReducedMotion) return /* @__PURE__ */ jsx("span", {
		ref,
		"data-slot": "ai-pulse-text",
		role: "status",
		"aria-label": children,
		className,
		children
	});
	return /* @__PURE__ */ jsx(motion.span, {
		ref,
		"data-slot": "ai-pulse-text",
		role: "status",
		"aria-label": children,
		className,
		animate: { opacity: [
			.4,
			1,
			.7,
			1,
			.4
		] },
		transition: {
			duration: 2.5,
			repeat: Number.POSITIVE_INFINITY,
			times: [
				0,
				.3,
				.5,
				.7,
				1
			],
			ease: "easeInOut"
		},
		children
	});
});
AIPulseText.displayName = "AIPulseText";
//#endregion
export { AILoadingDots, AIPulseText, AITextShimmer, AITypingText, shimmerPresets, textShimmerVariants };

//# sourceMappingURL=index443.js.map