// Real product photos (photo prop) come from IDH CATALOGUE.pdf, cropped per-SKU — see readme.md.
// Items without a matching photo yet (matériel informatique) fall back to an on-brand Lucide
// icon badge, matching the rest of the system's iconography.
function ProductImage({photo,icon,size=56}){
function Icon({name,iconSize}){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="'+iconSize+'" height="'+iconSize+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">'+inner+'</svg>';return React.createElement('span',{style:{display:'inline-flex',width:iconSize,height:iconSize},dangerouslySetInnerHTML:{__html:svg}});}
if(photo){
return React.createElement('img',{src:photo,alt:'',style:{width:'100%',height:'100%',objectFit:'contain',padding:size>48?'10%':'6%',boxSizing:'border-box'}});
}
return React.createElement('div',{style:{
width:size,height:size,borderRadius:'50%',
background:'var(--surface-tint-orange)',color:'var(--color-orange-600)',
display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0
}},React.createElement(Icon,{name:icon||'package',iconSize:Math.round(size*0.5)}));
}
window.ProductImage = ProductImage;
