function Materiel({go,addToCart}){
const {SectionHeader,CategoryCard,Breadcrumbs,ProductCard,Alert,Tabs,Badge} = window.IDHDesignSystem_6f4674;
const {Reveal} = window;
const {materielCategories} = window.IDH_DATA;
function Icon({name,size=22}){const pascal=name.replace(/(^\w|-\w)/g,c=>c.replace('-','').toUpperCase());const nodes=window.lucide&&window.lucide.icons[pascal];const inner=nodes?nodes.map(([tag,attrs])=>'<'+tag+' '+Object.entries(attrs).map(([k,v])=>k+'="'+v+'"').join(' ')+'/>').join(''):'';const svg='<svg xmlns="http://www.w3.org/2000/svg" width="'+size+'" height="'+size+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'+inner+'</svg>';return React.createElement('span',{style:{display:'inline-flex',width:size,height:size},dangerouslySetInnerHTML:{__html:svg}});}
const [active,setActive]=React.useState(materielCategories[0].id);
const cat = materielCategories.find(c=>c.id===active);
const [activeSub,setActiveSub]=React.useState(cat.subcategories?cat.subcategories[0].id:null);
React.useEffect(function(){
if(cat.subcategories) setActiveSub(cat.subcategories[0].id);
},[active]);
const sampleItems = {
'ordinateurs-bureau':[{brand:'HP',name:'HP ProDesk 400 G9',ref:'PD400G9',price:385000,stock:'in'},{brand:'Canon',name:'Poste bureautique standard',ref:'PC-STD-01',price:295000,stock:'low'}],
'ordinateurs-portables':[{brand:'HP',name:'HP ProBook 450 G10',ref:'PB450G10',price:520000,stock:'in'},{brand:'HP',name:'HP EliteBook 640',ref:'EB640',price:610000,stock:'in'}],
'imprimantes':[{brand:'HP',name:'HP LaserJet Pro M404dn',ref:'M404DN',price:265000,stock:'in'},{brand:'Canon',name:'Canon i-SENSYS LBP223dw',ref:'LBP223DW',price:198000,stock:'in'},{brand:'Epson',name:'Epson EcoTank L3250',ref:'L3250',price:145000,stock:'in'}],
'photocopieurs':[{brand:'Canon',name:'Canon imageRUNNER 2625',ref:'IR2625',price:1450000,stock:'low'},{brand:'HP',name:'HP LaserJet MFP M428',ref:'M428',price:520000,stock:'in'}],
'scanners':[{brand:'Epson',name:'Epson WorkForce ES-400',ref:'ES400',price:210000,stock:'in'},{brand:'Canon',name:'Canon imageFORMULA R10',ref:'R10',price:185000,stock:'in'}],
'etiqueteuses':[{brand:'Zebra',name:'Zebra ZD230 Étiqueteuse',ref:'ZD230',price:225000,stock:'in'},{brand:'Zebra',name:'Zebra DS2208 Douchette',ref:'DS2208',price:95000,stock:'in'}],
'calculatrices':[{brand:'Casio',name:'Casio DR-120R Calculatrice imprimante',ref:'DR120R',price:58000,stock:'in'},{brand:'Casio',name:'Casio SE-S400 Caisse enregistreuse',ref:'SES400',price:410000,stock:'low'}],
'onduleurs':[{brand:'HP',name:'Onduleur 1000VA',ref:'UPS-1000',price:78000,stock:'in'},{brand:'HP',name:'Onduleur 2000VA Line-interactive',ref:'UPS-2000',price:135000,stock:'in'}],
'onduleurs-apc':[],
'rallonges-apc':[],
'accessoires':[{brand:'HP',name:'Clavier + Souris sans fil HP',ref:'KM-WL-01',price:22000,stock:'in'},{brand:'HP',name:'Disque SSD 480 Go',ref:'SSD480',price:34000,stock:'in'}],
'cables-reseaux':[]
};
const items = sampleItems[cat.subcategories?activeSub:active]||[];

const categoryGrid = React.createElement('div',{style:{display:'grid',gridTemplateColumns:'repeat(5,1fr)',gap:14,marginTop:32}},
materielCategories.map(c=>React.createElement('div',{key:c.id,style:{position:'relative',opacity:c.soon?0.7:1}},
React.createElement(CategoryCard,{icon:React.createElement(Icon,{name:c.icon}),title:c.title,subtitle:c.subtitle,onClick:()=>setActive(c.id)}),
c.soon&&React.createElement('div',{style:{position:'absolute',top:10,right:10}},React.createElement(Badge,{tone:'warning'},'Produits à venir')))));

let body;
if(cat.subcategories){
body = React.createElement('div',null,
React.createElement(Tabs,{tabs:cat.subcategories.map(s=>({value:s.id,label:s.title})),active:activeSub,onChange:setActiveSub}),
React.createElement('div',{style:{marginTop:24}},
React.createElement(Alert,{tone:'warning'},'Produits à venir — les références '+(cat.subcategories.find(s=>s.id===activeSub)||{}).title+' seront ajoutées prochainement.')));
}else if(cat.soon){
body = React.createElement(Alert,{tone:'info'},'Cette catégorie sera disponible prochainement.');
}else{
body = React.createElement('div',{style:{display:'grid',gridTemplateColumns:'repeat(4,1fr)',gap:18}},
items.map(p=>React.createElement(ProductCard,{key:p.ref,image:React.createElement(window.ProductImage,{icon:cat.icon}),brand:p.brand,name:p.name,sku:p.ref,price:p.price,stock:p.stock,onAdd:()=>addToCart({...p,icon:cat.icon})})));
}

return React.createElement('div',{style:{maxWidth:1240,margin:'0 auto',padding:'32px 32px 80px'}},
React.createElement(Breadcrumbs,{items:[{href:'accueil',label:'Accueil'},{href:'materiel',label:'Matériel Informatique'}],onNavigate:go}),
React.createElement('div',{style:{marginTop:20,display:'grid',gridTemplateColumns:'1.2fr 0.8fr',gap:32,alignItems:'center'}},
React.createElement(SectionHeader,{eyebrow:'Matériel Informatique',title:'11 catégories, une seule adresse',subtitle:'Ordinateurs, impression, réseau et accessoires — vente et installation.'}),
React.createElement('div',{style:{height:180}},React.createElement(window.IllustrationMateriel,null))),
categoryGrid,
React.createElement(Reveal,{style:{marginTop:48}},
React.createElement('div',{style:{fontFamily:'var(--font-display)',fontWeight:700,fontSize:22,color:'var(--text-primary)',marginBottom:20}},cat.title),
body));
}
window.Materiel = Materiel;
