1import{u as w,r as d,p as S,j as t,d as k}from"./index-C1kzN45B.js";import{A as C}from"./AuthImage-4xos_L4C.js";import{f as W,c as F}from"./format-jI-co_ed.js";import"./react-C6Febm84.js";const P=(n,s)=>n?W(n,F(s)):"â",z=n=>n?`${n} m²`:"â",x=n=>({margin:0,paddingLeft:n?"0.8rem":"1.1rem",fontSize:n?"0.72rem":"0.8rem",lineHeight:1.4,textAlign:"left"});function I(n=640){const[s,m]=d.useState(()=>window.innerWidth<n);return d.useEffect(()=>{const i=()=>m(window.innerWidth<n);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[n]),s}function R({projectIds:n,onBack:s,onSelectProject:m}){const{t:i}=w(),[c,b]=d.useState([]),[j,v]=d.useState(!0),g=I();if(d.useEffect(()=>{!n||n.length<2||Promise.all(n.map(e=>S.getById(e))).then(b).catch(console.error).finally(()=>v(!1))},[n]),j)return t.jsx("div",{className:"loader",style:{display:"block"},children:t.jsx("div",{className:"spinner",children:t.jsx("span",{})})});if(c.length<2)return t.jsx("div",{className:"container",style:{textAlign:"center",padding:"3rem"},children:i("compareMin")||"Mindestens 2 Projekte wählen"});const l=i("compareNoData")||"â",y=[{label:i("comparePrice")||"Kaufpreis",icon:"fa-euro-sign",render:e=>P(e.price,e.country)}
1,{label:i("compareLiving")||"Wohnfläche",icon:"fa-ruler-combined",render:e=>z(e.data?.listingInfo?.livingSpace)},{label:i("compareYear")||"Baujahr",icon:"fa-calendar",render:e=>e.data?.listingInfo?.yearBuilt||l},{label:i("compareEnergy")||"Energieklasse",icon:"fa-bolt",render:e=>{const r=e.data?.listingInfo?.energyClass||e.data?.listingInfo?.energyCertificate?.class;return r?t.jsx("span",{style:{padding:"0.15rem 0.5rem",background:"rgba(239,68,68,0.1)",borderRadius:4,fontWeight:700,fontSize:"0.85rem"},children:r}):l}},{label:i("compareScorePrice")||"Preis-Score",icon:"fa-tag",render:e=>{const r=e.data?.assessment?.priceScore;return r>0?t.jsx(u,{score:r,color:"#10b981"}):l}},{label:i("compareScoreCondition")||"Substanz-Score",icon:"fa-house-crack",render:e=>{const r=e.data?.assessment?.conditionScore;return r>0?t.jsx(u,{score:r,color:"#f59e0b"}):l}},{label:i("compareScoreLocation")||"Lage-Score",icon:"fa-location-dot",render:e=>{const r=e.data?.assessment?.locationScore;return r>0?t.jsx(u,{score:r,color:"var(--accent)"}):l}},{label:i("compareRenovation")||"Sanierungskosten",icon:"fa-wrench",render:e=>{const r=e.data?.renovationScenarios?.essential?.totalEstimatedCost||0,o=e.data?.renovationScenarios?.premium?.totalEstimatedCost||e.data?.renovationScenarios?.standard?.totalEstimatedCost||0;return!r&&!o?l:t.jsxs("span",{style:{color:"#dc2626",fontWeight:600},children:["⬠",r>0&&o>0?`${(r/1e3).toFixed(0)}k â ${(o/1e3).toFixed(0)}k`:`${((r||o)/1e3).toFixed(0)}k`]})}},{label:i("comparePros")||"Vorteile",icon:"fa-thumbs-up",isList:!0,render:(e,r)=>{const o=e.data?.assessment?.pros;return!o||!o.length?l:t.jsx("ul",{style:x(r),children:o.slice(0,r?3:4).map((h,f)=>t.jsx("li",{children:h},f))})}},{label:i("compareCons")||"Nachteile",icon:"fa-thumbs-down",isList:!0,render:(e,r)=>{const o=e.data?.assessment?.cons;return!o||!o.length?l:t.jsx("ul",{style:x(r),children:o.slice(0,r?3:4).map((h,f)=>t.jsx("li",{children:h},f))})}}],a=g?{labelCol:92,projectCol:128,imgW:46,imgH:34,cellPad:"0.5rem 0.45rem",headPad:"0.6rem 0.45rem",valueFont:"0.8rem",labelFont:"0.71rem",nameFont:"0.76rem",addrFont:"0.64rem",iconW:11}:{labelCol:160,projectCol:220,imgW:80,imgH:60,cellPad:"0.6rem 0.75rem",headPad:"0.75rem",valueFont:"0.88rem",labelFont:"0.82rem",nameFont:"0.9rem",addrFont:"0.75rem",iconW:14},p={position:"sticky",left:0,background:"var(--card-bg)"};return t.jsxs("div",{className:"container",style:{paddingBottom:"3rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem",flexWrap:"wrap"},children:[t.jsxs("button",{className:"btn btn-outline btn-sm",onClick:s,style:{display:"inline-flex",alignItems:"center",gap:"0.3rem"},children:[t.jsx("i",{className:"fa-solid fa-arrow-left"})," ",i("compareBack")||"Zurück"]}),t.jsxs("h1",{style:{margin:0,fontSize:g?"1.15rem":"1.4rem"},children:[t.jsx("i",{className:"fa-solid fa-code-compare",style:{color:"var(--accent)",marginRight:"0.4rem"}}),i("compareTitle")||"Projekte vergleichen"]})]}),g&&c.length>2&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.75rem",color:"var(--text-muted)",marginBottom:"0.6rem"},children:[t.jsx("i",{className:"fa-solid fa-arrows-left-right",style:{color:"var(--accent)"}}),i("compareSwipeHint")||"Zum Vergleichen seitlich wischen"]}),t.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:t.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,minWidth:c.length*a.projectCol+a.labelCol},children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{...p,width:a.labelCol,minWidth:a.labelCol,padding:a.headPad,borderBottom:"2px solid var(--border)",zIndex:2}}),c.map(e=>t.jsxs("th",{style:{padding:a.headPad,background:"var(--card-bg)",borderBottom:"2px solid var(--border)",minWidth:a.projectCol,textAlign:"center",verticalAlign:"bottom"},children:[t.jsx("div",{style:{width:a.imgW,height:a.imgH,borderRadius:6,overflow:"hidden",margin:"0 auto 0.4rem",border:"1px solid var(--border)"},children:t.jsx(C,{src:e.images&&e.images.length>0?k(e.images[0],e.id):"https://placehold.co/160x120?text=â",alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"}})}),t.jsx("div",{style:{fontWeight:700,fontSize:a.nameFont,cursor:"pointer",color:"var(--accent)",lineHeight:1.25,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},onClick:()=>m&&m(e.id),title:e.name,children:e.name||"Projekt"}),t.jsx("div",{style:{fontSize:a.addrFont,color:"var(--text-muted)",marginTop:"0.15rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.address||""})]},e.id))]})}),t.jsx("tbody",{children:y.map((e,r)=>t.jsxs("tr",{children:[t.jsxs("td",{style:{...p,padding:a.cellPad,fontWeight:600,fontSize:a.labelFont,color:"var(--text-muted)",borderBottom:"1px solid var(--border)",zIndex:1,lineHeight:1.3},children:[t.jsx("i",{className:`fa-solid ${e.icon}`,style:{marginRight:"0.3rem",color:"var(--accent)",width:a.iconW,textAlign:"center"}}),e.label]}),c.map(o=>t.jsx("td",{style:{padding:a.cellPad,borderBottom:"1px solid var(--border)",textAlign:e.isList?"left":"center",fontSize:a.valueFont,verticalAlign:"top",wordBreak:"break-word"},children:e.render(o,g)},o.id))]},r))})]})})]})}function u({score:n,color:s}){return t.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.3rem"},children:t.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:`conic-gradient(${s} 0% ${n}%, var(--border) ${n}% 100%)`,display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:"var(--card-bg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.65rem",fontWeight:700,color:s},children:n})})})}export{R as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.