import * as LucideExports from 'lucide-static/dist/cjs/lucide-static';
import icons from 'lucide-static/font/info.json' with { type: 'json' };
import plugin from 'tailwindcss/plugin';
import { pascalToKebab } from './util/string.js';
import { addNameSpaceXML, encodeSVG } from './util/svg.js';
/**
 * Lucide Icons | https://lucide.dev/icons/
 * Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency and readability.
 * Colors can also be changed via symbol overrides.
 * All strokes in these icons have been converted to single vectors
 * so color overrides are respected within variants.
 *
 * Class Names:
 *
 *  btu-icon - Establishes the standard icon styles and font.
 *  btu-icon-{name-of-icon} - Sets the font glyph to the value of the icon you want.
 *  btu-icon-[xs|sm|md|lg|xl|{arbitrary value}] - Size of the icon.
 *  btu-icon-gradient-{color} - Gradient to use for the icon background (ai, primary, error, success, warning, gray, purple, rose, teal).
 *  btu-icon-via-mask-{name of icon} - SVG mask to use given a specific icon name.
 *    - exposes a custom property `--icon-svg` data URI to set the mask.
 *  btu-icon-emphasize - Tonal circle + ring behind the icon (derives from currentColor, defaults to primary).
 *  btu-icon-emphasize-pulse - Adds a one-shot ring spring animation to the emphasize circle.
 *
 * Usages:
 *
 * A heart icon:
 * >   before:btu-icon before:btu-icon-heart
 *
 * A heart icon that is 2rem in size:
 * >   before:btu-icon before:btu-icon-heart before:[--icon-size:2rem]
 * - or -
 * >   before:btu-icon before:btu-icon-heart before:btu-icon-lg
 *
 * A heart icon with a gradient background:
 * >   before:btu-icon-gradient-primary before:btu-icon-via-mask-heart
 */
const svgs = {};
for (const [key, value] of Object.entries(LucideExports)) {
    if (typeof value === 'string') {
        svgs[key] = value;
    }
}
module.exports = plugin(function ({ addBase, addComponents, matchUtilities, theme }) {
    const size = 'var(--icon-size)';
    const prefix = '.btu-icon-';
    Object.entries(svgs).forEach(([key, svg]) => {
        addComponents({
            [`${prefix}via-mask`]: {
                '--size': '1.25rem',
                mask: 'var(--mask-url, var(--icon-svg, var(--compat-icon-via-mask))) center / contain no-repeat',
                'mask-mode': 'alpha',
                'aspect-ratio': '1',
                'inline-size': 'var(--icon-size, var(--size))',
                'block-size': 'var(--icon-size, var(--size))',
                display: 'inline-block',
            },
            [`${prefix}via-mask-${pascalToKebab(key)}`]: {
                '--size': '1.25rem',
                '--icon-svg': `url("data:image/svg+xml,${encodeSVG(addNameSpaceXML(svg))}")`,
                mask: 'var(--icon-svg) center / contain no-repeat',
                'mask-mode': 'alpha',
                'aspect-ratio': '1',
                'inline-size': 'var(--icon-size, var(--size))',
                'block-size': 'var(--icon-size, var(--size))',
                display: 'inline-block',
            },
        });
    });
    addComponents({
        '.btu-icon': {
            'font-family': theme('fontFamily.lucide'),
            direction: 'ltr',
            display: 'inline-flex',
            'font-feature-settings': '"liga" 0',
            '-moz-osx-font-smoothing': 'grayscale',
            '-webkit-font-smoothing': 'antialiased',
            'font-size': size,
            'font-style': 'normal',
            'font-weight': 'normal',
            'letter-spacing': 'normal',
            'line-height': size,
            'text-transform': 'none',
            'white-space': 'nowrap',
            'word-wrap': 'normal',
            'vertical-align': 'top',
        },
    });
    addComponents(Object.entries(icons).map(value => {
        return {
            [prefix + value[0]]: {
                '--tw-content': `'${value[1].encodedCode}'`,
            },
        };
    }));
    matchUtilities({
        'btu-icon-gradient': value => ({
            'background-image': value,
            'background-repeat': 'no-repeat',
            'background-position': 'center',
            'background-size': 'var(--icon-size, 1.5rem) var(--icon-size, 1.5rem)',
            width: 'var(--icon-size, 1.5rem)',
            height: 'var(--icon-size, 1.5rem)',
            display: 'inline-block',
        }),
    }, {
        values: {
            ai: 'theme(backgroundImage.ai-gradient)',
            error: 'theme(backgroundImage.error-gradient)',
            gray: 'theme(backgroundImage.gray-gradient)',
            primary: 'theme(backgroundImage.primary-gradient)',
            purple: 'theme(backgroundImage.purple-gradient)',
            rose: 'theme(backgroundImage.rose-gradient)',
            success: 'theme(backgroundImage.success-gradient)',
            teal: 'theme(backgroundImage.teal-gradient)',
            warning: 'theme(backgroundImage.warning-gradient)',
        },
    });
    matchUtilities({
        'btu-icon': value => ({
            '--icon-size': value,
        }),
    }, { values: theme('iconSize') });
    /* ─── Emphasize: tonal circle + ring behind icon ─── */
    function oklch(l, cMul, cMin) {
        const chroma = cMin != null ? `max(calc(c * ${cMul}), ${cMin})` : `calc(c * ${cMul})`;
        return `oklch(from currentColor ${l} ${chroma} h)`;
    }
    const lightColors = {
        '--_ring-color': oklch(0.8, 0.5),
        backgroundColor: oklch(0.93, 0.22),
        borderColor: oklch(0.97, 0.1),
    };
    const darkColors = {
        '--_ring-color': oklch(0.65, 1.5, 0.08),
        backgroundColor: oklch(0.69, 1.6, 0.08),
        borderColor: oklch(0.6, 1.4, 0.06),
    };
    const highContrastColors = {
        '--_ring-color': oklch(0.75, 0.5),
        backgroundColor: oklch(0.9, 0.35),
        borderColor: oklch(0.95, 0.2),
    };
    /* Pulse ring animation keyframes (pseudo-element scale + fade) */
    addBase({
        '@keyframes btu-icon-ring-spring': {
            '0%': { transform: 'scale(1)', opacity: '0.6' },
            '35%': { transform: 'scale(var(--_ring-scale))', opacity: '0.4' },
            '100%': { transform: 'scale(var(--_ring-scale))', opacity: '0' },
        },
    });
    addComponents({
        '.btu-icon-emphasize': {
            position: 'relative',
            display: 'inline-flex',
            alignItems: 'center',
            justifyContent: 'center',
            borderRadius: '9999px',
            borderStyle: 'solid',
            color: 'oklch(var(--btu-theme-primary-600))',
            ...lightColors,
        },
        /* Per-size circle dimensions (border width scales with size per Figma spec) */
        '.btu-icon-emphasize.btu-icon-xs': {
            width: '1.5rem',
            height: '1.5rem',
            borderWidth: '2px',
            '--_ring-scale': '1.25',
        },
        '.btu-icon-emphasize.btu-icon-sm': {
            width: '2rem',
            height: '2rem',
            borderWidth: '4px',
            '--_ring-scale': '1.35',
        },
        '.btu-icon-emphasize.btu-icon-md': {
            width: '2.25rem',
            height: '2.25rem',
            borderWidth: '6px',
            '--_ring-scale': '1.4',
        },
        '.btu-icon-emphasize.btu-icon-lg': {
            width: '3rem',
            height: '3rem',
            borderWidth: '8px',
            '--_ring-scale': '1.45',
        },
        '.btu-icon-emphasize.btu-icon-xl': {
            width: '3.5rem',
            height: '3.5rem',
            borderWidth: '10px',
            '--_ring-scale': '1.5',
        },
        /* Pulse animation — pseudo-element ring that scales out and fades */
        '.btu-icon-emphasize-pulse::before': {
            content: '""',
            position: 'absolute',
            inset: '0',
            borderRadius: '9999px',
            backgroundColor: 'var(--_ring-color)',
            opacity: '0',
            animation: 'btu-icon-ring-spring 1200ms ease-out 200ms both',
            pointerEvents: 'none',
        },
        /* ─── Dark mode ─── */
        '.is-dark .btu-icon-emphasize': darkColors,
        '.is-dark .btu-icon-emphasize svg': { color: 'oklch(0.95 0 0)' },
        '@media (prefers-color-scheme: dark)': {
            ':root:not([data-theme*=\'"appearance":"light"\']):not(.is-dark) .btu-icon-emphasize': darkColors,
            ':root:not([data-theme*=\'"appearance":"light"\']):not(.is-dark) .btu-icon-emphasize svg': {
                color: 'oklch(0.95 0 0)',
            },
        },
        /* ─── High contrast ─── */
        ':root.is-moreContrast .btu-icon-emphasize': highContrastColors,
        '@media screen and (prefers-contrast: more) and (forced-colors: none)': {
            ':root:not(.is-normalContrast) .btu-icon-emphasize': highContrastColors,
        },
        /* ─── Reduced motion ─── */
        '@media (prefers-reduced-motion: reduce)': {
            '.btu-icon-emphasize-pulse::before': {
                animationDuration: '0.01ms',
                animationDelay: '0ms',
            },
        },
    });
}, {
    theme: {
        iconSize: {
            DEFAULT: '1.25rem',
            xs: '0.75rem',
            sm: '1rem',
            md: '1.25rem',
            lg: '1.5rem',
            xl: '1.75rem',
        },
    },
});
//# sourceMappingURL=tailwind-plugin-icon.js.map