(() => {
const NS = window.VakantiehuisplatformDesignSystem_2f09bb;
const { Button, Icon, Photo, FeaturePill, ReviewScoreBadge, ReviewCard, SearchBar, CalendarMonth, PriceBlock, NearbyPlace, WeatherCard, WebcamCard, NewsletterBlock, ErrorMessage, StickyBookBar } = NS;
const { VHSection: Section, VHSectionHead: SectionHead, VHContainer: Container, VHHeader, VHFooter, vhLabel, vhT: t } = window;
const I = window.VH_I18N;
const vhS = window.vhS;
const multi = house => !!(house.units && house.units.length > 1);

function Hero({ m, n, house, lang, setLang, empty, onNav, unit, setUnit }) {
  const X = I.T(lang);
  const score = <ReviewScoreBadge variant="onPhoto" count={vhS('reviewCount', 0)} score={vhS('score', undefined)} source={vhS('scoreSource', undefined)} emptyLabel={X.badge} />;
  return <div style={{ position: 'relative' }}>
    <Photo src={vhS('hero', 'img/hero.jpg')} ratio={m ? '390/440' : '1280/620'} radius="0" scrim alt={house.name + ': ' + X.heroAlt}>
      <div aria-hidden="true" style={{ position: 'absolute', inset: 0, background: 'linear-gradient(90deg, rgba(10,12,10,.62) 0%, rgba(10,12,10,.35) 45%, rgba(10,12,10,0) 75%), linear-gradient(180deg, rgba(10,12,10,.35) 0%, rgba(10,12,10,0) 22%)' }}></div>
      <VHHeader m={m} n={n} house={house} lang={lang} setLang={setLang} onNav={onNav} overlay />
      <Container m={m} style={{ position: 'absolute', left: 0, right: 0, bottom: m ? 28 : 120, display: 'flex', flexDirection: 'column', gap: m ? 12 : 16, color: '#fff' }}>
        <span style={{ ...vhLabel, color: '#fff' }}>{house.place} · {house.region} · {house.alt}</span>
        <h1 style={{ fontSize: m ? 40 : 'var(--fs-display)', lineHeight: 'var(--lh-tight)', color: '#fff' }}>{house.name}</h1>
        {!m && <p style={{ fontSize: 22, color: '#fff', maxWidth: 620 }}>{X.intro}</p>}
        <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center' }}>{score}{window.VHShareBar && <window.VHShareBar house={house} onDark />}</div>
      </Container>
    </Photo>
    <Container m={m} style={{ position: 'relative', marginTop: m ? -8 : -48, zIndex: 2 }}>
      <SearchBar layout={m ? 'stacked' : 'bar'} checkIn={X.cin} checkOut={X.cout} guests={X.guests} units={multi(house) ? house.units.map(u => I.unit(lang, u)) : undefined} unit={multi(house) ? I.unit(lang, unit) : undefined} onField={f => f === 'unit' && house.units && setUnit(house.units[(house.units.indexOf(unit) + 1) % house.units.length])} ctaLabel={t(lang, 'price')} onSubmit={() => onNav('boeken')} style={m ? { marginTop: 16 } : null} />
    </Container>
  </div>;
}
function Benefits({ m, lang }) {
  const items = vhS('benIcons', ['badge-check', 'mountain-snow', 'flame']).map((ic, i) => [ic, ...I.T(lang).ben[i]]);
  return <Container m={m} style={{ paddingTop: m ? 40 : 72 }}>
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : 'repeat(3,1fr)', gap: m ? 20 : 40 }}>
      {items.map(([ic, h, p]) => <div key={h} style={{ display: 'flex', gap: 16 }}>
        <span style={{ width: 48, height: 48, flex: 'none', display: 'grid', placeItems: 'center', borderRadius: 'var(--radius-md)', background: 'var(--accent-soft)', color: 'var(--accent-text)' }}><Icon name={ic} size={22} /></span>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}><h3 style={{ fontSize: 20 }}>{h}</h3><p style={{ fontSize: 16, color: 'var(--text-2)' }}>{p}</p></div>
      </div>)}
    </div>
  </Container>;
}
function House({ m, house, lang, few, setUnit, onNav }) {
  const n = few ? 8 : house.photos;
  const X = I.T(lang);
  const G = vhS('grid', [['woonkamer-vide', 'Woonkamer met vide en open dakconstructie, boven groot'], ['sauna', 'Eigen sauna, boven groot'], ['eettafel', 'Lange eettafel, boven groot'], ['woonkamer-beneden', 'Woonkamer beneden'], ['balkon', 'Balkon met uitzicht op het dal']]);
  const CARDS = vhS('unitCards', ['Boven groot', 'Beneden', 'Boven klein']);
  const [all, setAll] = React.useState(false);
  const PO = window.VHPhotoOverlay;
  return <Section m={m} id="huis">
    <SectionHead m={m} kicker={t(lang, 'house')} title={X.houseT} action={!m && <Button variant="secondary" icon="images" onClick={() => setAll(true)}>{t(lang, 'allPhotos')}</Button>}>
      {X.houseP}
    </SectionHead>
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr 1fr' : '2fr 1fr 1fr', gridTemplateRows: m ? 'auto' : '220px 220px', gap: m ? 8 : 12 }}>
      <Photo src={'img/' + G[0][0] + '.jpg'} alt={G[0][1]} ratio={m ? '4/3' : undefined} style={{ gridColumn: m ? '1 / -1' : undefined, gridRow: m ? undefined : '1 / 3', height: m ? undefined : '100%', aspectRatio: m ? '4/3' : 'auto' }} />
      {G.slice(1, 5).map(([f, l]) => <Photo key={f} src={'img/' + f + '.jpg'} alt={l} style={{ aspectRatio: m ? '1/1' : 'auto', height: m ? undefined : '100%' }} />)}
    </div>
    {all && PO && <PO m={m} house={house} onClose={() => setAll(false)} />}
    {m && <div style={{ marginTop: 12 }}><Button variant="secondary" full icon="images" onClick={() => setAll(true)}>{t(lang, 'allPhotos')}</Button></div>}
    <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 24 }}>
      {vhS('pillIcons', ['users', 'bed-double', 'bath', 'flame', 'heater', 'snowflake', 'car']).map((ic, i) => X.pills[i] && <FeaturePill key={ic + i} icon={ic}>{X.pills[i]}</FeaturePill>)}
    </div>
    {CARDS.length > 0 && <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : 'repeat(3,1fr)', gap: 16, marginTop: 32 }}>
      {CARDS.map(k => { const u = I.unitD(lang, k, window.VH_DATA.units[k]); const u0 = window.VH_DATA.units[k]; const go = () => { setUnit(k); onNav('appartement'); }; return <div key={k} role="link" tabIndex={0} onClick={go} onKeyDown={e => { if (e.key === 'Enter') go(); }} aria-label={I.unit(lang, k)} style={{ display: 'flex', flexDirection: 'column', gap: 8, padding: 24, paddingTop: 0, overflow: 'hidden', background: 'var(--surface-card)', border: 'var(--border-card)', borderRadius: 'var(--radius-lg)', boxShadow: 'var(--shadow-card)', cursor: 'pointer' }}><Photo src={'img/unit-' + ({ 'Boven groot': 'groot', 'Beneden': 'beneden', 'Boven klein': 'klein' })[k] + '.jpg'} alt={I.unit(lang, k)} ratio="3/2" radius="0" style={{ margin: '0 -24px 8px' }} /><span style={vhLabel}>{X.upTo(u0.max)}</span><h3 style={{ fontSize: 22 }}>{I.unit(lang, k)}</h3><p style={{ fontSize: 16, color: 'var(--text-2)' }}>{u.beds}<br />{u.bath}<br />{u.extra}</p><strong style={{ fontSize: 17 }}>{X.fromN(u0.from)}</strong><span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, marginTop: 4, color: 'var(--accent-text)', fontWeight: 700, fontSize: 16 }}>{({ nl: 'Bekijk foto’s en indeling', de: 'Fotos und Aufteilung ansehen', en: 'See photos and layout' })[lang] || 'Bekijk foto’s en indeling'}<Icon name="arrow-right" size={18} /></span></div>; })}
    </div>}
  </Section>;
}
function Availability({ m, n, house, lang, empty, onNav, unit, setUnit }) {
  const booked = empty ? Array.from({ length: 28 }, (_, i) => i + 1) : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
  const U = window.VH_DATA.units[unit] || window.VH_DATA.units[Object.keys(window.VH_DATA.units)[0]];
  const X = I.T(lang);
  return <Section m={m} alt id="beschikbaarheid">
    <SectionHead m={m} kicker={t(lang, 'avail')} title={X.week} />
    {multi(house) && <div role="radiogroup" aria-label="Appartement" style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginBottom: 24 }}>
      {house.units.map(u => <button key={u} role="radio" aria-checked={u === unit} onClick={() => setUnit(u)} style={{ minHeight: 44, padding: '0 16px', borderRadius: 'var(--radius-btn)', border: '1.5px solid ' + (u === unit ? 'var(--accent)' : 'var(--border)'), background: u === unit ? 'var(--accent)' : 'var(--surface-card)', color: u === unit ? 'var(--on-accent)' : 'var(--text-1)', fontWeight: 600, cursor: 'pointer' }}>{I.unit(lang, u)}</button>)}
    </div>}
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : n ? 'minmax(0,1fr) 340px' : 'minmax(0,1fr) minmax(0,1fr) 360px', gap: m ? 24 : 32, alignItems: 'start' }}>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
        <CalendarMonth month={X.feb} weekdays={X.wd} startOffset={0} booked={booked} range={empty ? undefined : [13, 20]} />
        {empty && <ErrorMessage variant="info" title="Februari is volgeboekt">De eerstvolgende vrije week begint op zaterdag 6 maart.</ErrorMessage>}
      </div>
      {!m && !n && <CalendarMonth month={X.mar} weekdays={X.wd} days={31} startOffset={0} booked={[1, 2, 3, 4, 5]} />}
      <PriceBlock from={U.from} note={X.note(U.max, U.top)} unit={X.night} trust={X.trust} cta={t(lang, 'book')} onCta={() => onNav('boeken')} />
    </div>
  </Section>;
}
function Reviews({ m, empty, lang }) {
  const R = window.VH_DATA.reviews;
  const X = I.T(lang);
  return <Section m={m} id="reviews">
    <SectionHead m={m} kicker={t(lang, 'reviews')} title={X.revT} />
    {!(R && R.length) ? <ErrorMessage variant="info" title={X.revNone}>{X.revNoneP}</ErrorMessage>
      : <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : 'repeat(3,1fr)', gap: 16 }}>{R.map(r => <ReviewCard key={r.name} {...r} />)}</div>}
  </Section>;
}
function Area({ m, lang, empty, onNav }) {
  const X = I.T(lang), D = I.data(lang);
  const P = window.VH_DATA.places.slice(0, 4).map((p, i) => D && D.places && D.places[i] ? { ...p, category: D.places[i][0], distance: D.places[i][1], time: D.places[i][2], tip: D.places[i][3] } : p);
  return <Section m={m} alt id="omgeving">
    <SectionHead m={m} kicker={t(lang, 'area')} title={X.areaT} action={!m && <Button variant="secondary" iconRight="arrow-right" onClick={() => onNav('omgeving')}>{t(lang, 'more')}</Button>} />
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : '1.2fr 1fr', gap: m ? 24 : 40 }}>
      <div>{P.map((p, i) => <NearbyPlace key={p.name} {...p} style={i === P.length - 1 ? { borderBottom: 0 } : null} />)}</div>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
        <window.VHLiveWeather empty={empty} lang={lang} />
        {(window.VH_SITE.webcam && window.VH_SITE.webcam.src ? <WebcamCard src={window.VH_SITE.webcam.src} href={window.VH_SITE.webcam.href || window.VH_SITE.webcam.src} title={window.VH_SITE.webcam.title || X.cam} updated={window.VH_SITE.webcam.updated || 'live'} /> : <WebcamCard empty title={X.cam} />)}
      </div>
    </div>
    <div style={{ marginTop: m ? 24 : 40 }}><window.VHAreaPhotos m={m} /></div>
    {m && <div style={{ marginTop: 20 }}><Button variant="secondary" full iconRight="arrow-right" onClick={() => onNav('omgeving')}>{t(lang, 'more')}</Button></div>}
  </Section>;
}
function Agenda({ m, lang }) {
  const D = I.data(lang);
  const E = window.VH_DATA.events.map((e, i) => D && D.events && D.events[i] ? { ...e, m: D.events[i][0], title: D.events[i][1], where: D.events[i][2] } : e);
  return <Section m={m}>
    <SectionHead m={m} kicker={lang === 'en' ? 'Events' : lang === 'de' ? 'Veranstaltungen' : 'Agenda'} title={I.T(lang).agendaT} />
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : 'repeat(3,1fr)', gap: 16 }}>
      {E.map(e => <div key={e.title} style={{ display: 'flex', gap: 16, padding: 20, background: 'var(--surface-card)', border: 'var(--border-card)', borderRadius: 'var(--radius-lg)', boxShadow: 'var(--shadow-card)' }}>
        <span style={{ width: 56, flex: 'none', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '6px 0', borderRadius: 'var(--radius-sm)', background: 'var(--accent)', color: 'var(--on-accent)' }}><strong style={{ fontFamily: 'var(--font-display)', fontSize: 24, lineHeight: 1 }}>{e.d}</strong><span style={{ fontSize: 14 }}>{e.m}</span></span>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}><strong style={{ fontSize: 17 }}>{e.title}</strong><span style={{ fontSize: 16, color: 'var(--text-2)' }}>{e.where}</span></div>
      </div>)}
    </div>
  </Section>;
}
function Owner({ m, house, lang }) {
  const D = I.data(lang), X = I.T(lang);
  const O = D ? { ...window.VH_DATA.owner, ...D.owner } : window.VH_DATA.owner;
  const S = window.VH_DATA.socials;
  const card = { display: 'flex', flexDirection: 'column', gap: 6, padding: 20, background: 'var(--surface-card)', border: 'var(--border-card)', borderRadius: 'var(--radius-lg)' };
  return <Section m={m} alt id="eigenaar">
    <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : '220px minmax(0,1fr)', gap: m ? 20 : 48, alignItems: 'start' }}>
      <Photo src={O.photo || undefined} alt={O.photo ? O.name : undefined} ratio="1/1" radius="50%" label={X.ownerPh} style={{ width: m ? 140 : 220 }} />
      <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
        <span style={vhLabel}>{X.ownerK}</span>
        <h2 style={{ fontSize: m ? 28 : 34 }}>{O.title}</h2>
        <p style={{ fontSize: 17, color: 'var(--text-2)', maxWidth: 680 }}>{O.intro}</p>
        <div style={{ display: 'grid', gridTemplateColumns: m ? '1fr' : 'repeat(2,minmax(0,1fr))', gap: 12 }}>
          {O.cv.map(([k, v]) => <div key={k} style={card}><span style={vhLabel}>{k}</span><span style={{ fontSize: 16 }}>{v}</span></div>)}
        </div>
        <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
          {S.map(x => <Button key={x.label} variant="secondary" icon={x.icon} onClick={() => { if (x.href) window.open(x.href, '_blank', 'noopener'); }}>{x.label}</Button>)}
        </div>
      </div>
    </div>
  </Section>;
}
function HomeScreen(p) {
  const { m, house } = p;
  return <div style={{ paddingBottom: 0 }}>
    <Hero {...p} />
    <Benefits m={m} lang={p.lang} />
    <House {...p} />
    <window.VHSfeer m={m} />
    <Availability {...p} />
    <window.VHPractical m={m} />
    <Reviews {...p} />
    <Area {...p} />
    <window.VHFood m={m} compact onNav={p.onNav} />
    <Agenda m={m} lang={p.lang} />
    <Owner m={m} house={house} lang={p.lang} />
    <Section m={m}><NewsletterBlock {...(I.data(p.lang) ? I.data(p.lang).news : {})} /></Section>
    <VHFooter m={m} house={house} lang={p.lang} />
    {m && <StickyBookBar position="sticky" from={house.from} unit={I.T(p.lang).nightS} cta={t(p.lang, 'price')} onCta={() => p.onNav('boeken')} />}
  </div>;
}
window.VHHome = HomeScreen;
})();
