var _useState_HRI = React.useState;

/**
 * HealthRiskInfo — Health risk information with expandable sections
 * and quick-link navigation to FAQ and Mycology AI.
 *
 * Reusable across AnalysisPage (post-scan results) and ReportsPage (general context).
 * Self-contained — no props required.
 * Content reflects the established epidemiology of damp housing (respiratory and allergic
 * outcomes). Contested systemic-illness claims are deliberately excluded — see ADR-0007.
 * TD: source citations pending the health-epidemiology corpus work.
 */

var HEALTH_RISK_SECTIONS = [
    {
        icon: 'group',
        title: 'High-Risk Groups',
        items: [
            { label: 'Respiratory Conditions', text: 'People with asthma, allergies, COPD, emphysema, or cystic fibrosis are at higher risk of symptom exacerbation and lung infections from mould exposure.' },
            { label: 'Immunocompromised', text: 'Those with weakened immune systems face risk of severe invasive mould infections. This includes cancer patients undergoing chemotherapy, HIV/AIDS patients, organ transplant recipients, and people taking immunosuppressive medications.' },
            { label: 'Age Vulnerability', text: 'Infants, young children, and older adults are generally more sensitive to the health effects of mould exposure.' },
            { label: 'Pregnancy', text: 'Exposure to mould during pregnancy may increase the child\u2019s risk of developing asthma and other respiratory conditions.' },
            { label: 'Genetic Predisposition', text: 'Individuals with a family history of allergies (atopic individuals) are more likely to develop mould allergies and sensitivities.' },
        ],
    },
    {
        icon: 'home',
        title: 'Environmental Risks',
        items: [
            { label: 'Occupational Exposure', text: 'High-risk occupations include farming, logging, baking, carpentry, plumbing, building remediation and winemaking jobs involving regular contact with organic materials in damp conditions.' },
            { label: 'High Humidity', text: 'Indoor humidity consistently above 50% creates ideal conditions for mould growth. Use dehumidifiers and ventilation to maintain safe levels.' },
            { label: 'Water Damage', text: 'Flooding, leaky pipes, and water seepage from storms significantly increase mould prevalence. Address water intrusion within 24\u201348 hours.' },
            { label: 'Poor Ventilation', text: 'Tight building seals that trap moisture without adequate air circulation promote mould growth, particularly in bathrooms, kitchens, and basements.' },
            { label: 'Mental Health', text: 'Living in damp, mouldy housing is stressful, and the worry, disruption and cost of dealing with it can genuinely affect wellbeing. Poor housing conditions are associated with anxiety and low mood. This is a real effect of the circumstances \u2014 it is not evidence that mould acts directly on the brain.' },
        ],
    },
    {
        icon: 'medical_information',
        title: 'Common Health Effects',
        items: [
            { label: 'Allergic Reactions', text: 'Sneezing, runny or stuffy nose, coughing, itchy eyes and skin, and rashes are common allergic responses to mould spore exposure.' },
            { label: 'Respiratory Issues', text: 'Wheezing, chest tightness, shortness of breath, and asthma attacks can be triggered or worsened by mould exposure.' },
            { label: 'Skin Irritation', text: 'Direct contact with mould or prolonged exposure in damp environments can cause dermatitis, rashes, and persistent skin irritation.' },
            { label: 'Severe Infections', text: 'Immunocompromised individuals may develop invasive aspergillosis or other serious lung infections requiring urgent medical treatment.' },
            { label: 'Hypersensitivity Pneumonitis', text: 'A rare immune disorder where lungs become inflamed from breathing in large amounts of mould allergens frequently over time.' },
        ],
    },
];

var HealthRiskInfo = function () {
    var navigate = ReactRouterDOM.useNavigate();
    var expandedState = _useState_HRI({});
    var expanded = expandedState[0];
    var setExpanded = expandedState[1];
    var toggle = GroupingUtils.createAccordionToggle(setExpanded);

    return (
        <div className="space-y-4">
            {/* Header */}

            {/* Expandable sections */}
            {HEALTH_RISK_SECTIONS.map(function (section, si) {
                var sectionKey = 'sec-' + si;
                var isOpen = expanded[sectionKey] || false;
                return (
                    <div key={sectionKey} className="bio-bg bio-bg-40 rounded-xl shadow-soft border border-stone-100/50 overflow-hidden">
                        <button onClick={function () { toggle(sectionKey); }} className="w-full flex items-center gap-3 p-4 text-left btn-nature">
                            <div className="w-9 h-9 rounded-xl bg-background-light flex items-center justify-center shrink-0">
                                <span className="material-symbols-outlined text-forest text-[18px]">{section.icon}</span>
                            </div>
                            <span className="flex-1 text-sm font-extrabold text-forest">{section.title}</span>
                            <span className={'material-symbols-outlined text-sage text-lg transition-transform ' + (isOpen ? 'rotate-180' : '')}>expand_more</span>
                        </button>
                        {isOpen && (
                            <div className="px-4 pb-4 space-y-3">
                                {section.items.map(function (item, ii) {
                                    return (
                                        <div key={ii} className="flex gap-3">
                                            <span className="w-1.5 h-1.5 rounded-full bg-warning mt-2 shrink-0"></span>
                                            <div>
                                                <p className="text-xs font-bold text-forest">{item.label}</p>
                                                <p className="text-xs font-medium text-forest leading-relaxed">{item.text}</p>
                                            </div>
                                        </div>
                                    );
                                })}
                            </div>
                        )}
                    </div>
                );
            })}

            {/* Quick links */}
            <div className="flex gap-3">
                <button
                    onClick={function () { navigate('/faq'); }}
                    className="flex-1 bio-bg bio-bg-20 rounded-xl shadow-soft border border-stone-100/50 p-4 flex flex-col items-center gap-2 btn-nature group hover:bg-forest transition-all duration-300"
                >
                    <span className="material-symbols-outlined text-forest text-2xl group-hover:text-primary transition-colors">menu_book</span>
                    <span className="text-xs font-extrabold text-forest group-hover:text-white transition-colors">Mould FAQ</span>
                    <span className="text-[10px] font-bold text-muted group-hover:text-accent/60 transition-colors">Health & Safety</span>
                </button>
                {/* Was labelled "Mycology AI" but navigated to /faq — the assistant did not
                    exist yet, so both buttons here went to the same place. It exists now. */}
                <button
                    onClick={function () { navigate('/miss-mould'); }}
                    className="flex-1 bio-bg bio-bg-30 rounded-xl shadow-soft border border-stone-100/50 p-4 flex flex-col items-center gap-2 btn-nature group hover:bg-forest transition-all duration-300"
                >
                    <span className="material-symbols-outlined text-forest text-2xl group-hover:text-primary transition-colors">auto_awesome</span>
                    <span className="text-xs font-extrabold text-forest group-hover:text-white transition-colors">Miss Mould</span>
                    <span className="text-[10px] font-bold text-muted group-hover:text-accent/60 transition-colors">Ask The AI Mycologist</span>
                </button>
            </div>
        </div>
    );
};

window.HealthRiskInfo = HealthRiskInfo;
