/* NewsPage.jsx */

var NEWS_SHEET_URL = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRNKnPtOW1dEkNW3iAvj9wD_viiXQjqeDq9WTmBF9CWiAmHv4G3A-NzNzZommtoce3n9sN8-9tYJD4O/pub?gid=0&single=true&output=csv';
var NEWS_CACHE_KEY = 'pmt-news-cache';

function toNewsImg(url) {
  if (!url) return '';
  if (url.includes('drive.google.com') || url.includes('docs.google.com')) {
    const fileMatch = url.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);
    if (fileMatch) return `https://drive.google.com/thumbnail?id=${fileMatch[1]}&sz=w800`;
    const m = url.match(/[-\w]{25,}/g);
    const id = m ? m[m.length - 1] : null;
    return id ? `https://drive.google.com/thumbnail?id=${id}&sz=w800` : url;
  }
  if (!url.startsWith('http')) return 'assets/' + url;
  return url;
}

function parseNewsCSV(text) {
  var rows = [], cur = [], field = '', inQ = false;
  for (var i = 0; i < text.length; i++) {
    var ch = text[i];
    if (ch === '"') {
      if (inQ && text[i+1] === '"') { field += '"'; i++; }
      else { inQ = !inQ; }
    } else if (ch === ',' && !inQ) {
      cur.push(field.trim()); field = '';
    } else if ((ch === '\n' || ch === '\r') && !inQ) {
      cur.push(field.trim()); field = '';
      if (cur.some(function(c){ return c; })) rows.push(cur);
      cur = [];
      if (ch === '\r' && text[i+1] === '\n') i++;
    } else { field += ch; }
  }
  if (field || cur.length) { cur.push(field.trim()); rows.push(cur); }
  if (rows.length < 2) return [];
  var headers = rows[0];
  return rows.slice(1).map(function(row) {
    var obj = {};
    headers.forEach(function(h, i) { obj[h] = row[i] || ''; });
    obj.img = toNewsImg(obj.img);
    return obj;
  }).filter(function(obj) { return obj.title && obj.title.trim(); });
}

/* ── 마크다운 → 일반 텍스트 요약 추출 ── */
function extractSummary(content, len) {
  if (!content) return '';
  return content
    .replace(/!\[.*?\]\(.*?\)/g, '')
    .replace(/\*{1,3}([^*]+)\*{1,3}/g, '$1')
    .replace(/^[-✓***]\s*/gm, '')
    .replace(/\n+/g, ' ')
    .trim()
    .slice(0, len || 100);
}

const FALLBACK_NEWS = [
  { tag:'보도자료', title:'PMT이노베이션, 일본 의료기관 3D 바디스캐너 수출 계약 체결', date:'2024.03', img:'assets/연구기관.png', content:'', link:'' },
  { tag:'블로그', title:'3D 바디스캐너로 한의원 상담이 달라진다 — 도입 전후 비교', date:'2024.02', img:'assets/한의원.png', content:'', link:'' },
  { tag:'연구', title:'ISO 20685 기반 국가 인체 표준 데이터 구축 프로젝트 참여', date:'2023.11', img:'assets/보건소.png', content:'', link:'' },
  { tag:'블로그', title:'Shape Care로 에스테틱 고객 관리가 달라진다', date:'2023.09', img:'assets/에스테틱.png', content:'', link:'' },
];

/* ── 마크다운 렌더러 ── */
function newsRenderInline(text, key) {
  const parts = text.split(/(\*\*\*[^*]+\*\*\*|\*\*[^*]+\*\*|\*\*[^*]+$|\*[^*]+\*|\*[^*]+$|https?:\/\/[^\s]+)/g);
  return (
    <React.Fragment key={key}>
      {parts.map((part, i) => {
        if (/^\*\*\*/.test(part)) return <strong key={i} style={{ fontWeight:800, color:'#111' }}>{part.replace(/^\*\*\*|\*\*\*$/g, '')}</strong>;
        if (/^\*\*/.test(part)) return <strong key={i} style={{ fontWeight:700, color:'#222' }}>{part.replace(/^\*\*|\*\*$/g, '')}</strong>;
        if (/^\*/.test(part)) return <em key={i} style={{ fontStyle:'italic' }}>{part.replace(/^\*|\*$/g, '')}</em>;
        if (/^https?:\/\//.test(part)) return <a key={i} href={part} target="_blank" rel="noopener noreferrer" style={{ color:'#C8271D', textDecoration:'underline', wordBreak:'break-all' }}>{part}</a>;
        return part;
      })}
    </React.Fragment>
  );
}

function NewsMarkdown({ text }) {
  if (!text) return null;
  const lines = text.split('\n');
  const elements = [];
  let listItems = [], checkItems = [], key = 0;
  const flushList = () => {
    if (!listItems.length) return;
    elements.push(<ul key={key++} style={{ margin:'8px 0 12px 20px', padding:0, listStyle:'disc' }}>{listItems.map((item,j)=><li key={j} style={{marginBottom:4}}>{newsRenderInline(item,j)}</li>)}</ul>);
    listItems = [];
  };
  const flushCheck = () => {
    if (!checkItems.length) return;
    elements.push(<ul key={key++} style={{ margin:'8px 0 12px 0', padding:0, listStyle:'none' }}>{checkItems.map((item,j)=>(
      <li key={j} style={{marginBottom:6,display:'flex',alignItems:'flex-start',gap:8}}><span style={{color:'#C8271D',fontWeight:700,flexShrink:0}}>✓</span><span>{newsRenderInline(item,j)}</span></li>
    ))}</ul>);
    checkItems = [];
  };
  lines.forEach((line) => {
    if (/^!\[.*?\]\(.*?\)/.test(line)) {
      flushList(); flushCheck();
      const m = line.match(/^!\[(.*?)\]\((.*?)\)/);
      if (m) { const src = toNewsImg(m[2].trim()); elements.push(<div key={key++} style={{margin:'16px 0'}}><img src={src} alt={m[1]} style={{width:'100%',borderRadius:10,display:'block',border:'1px solid #ebebeb'}}/>{m[1]&&<div style={{fontSize:13,color:'#aaa',textAlign:'center',marginTop:6}}>{m[1]}</div>}</div>); }
    } else if (/^\*{3}\s*\S/.test(line)) {
      flushList(); flushCheck();
      elements.push(<h3 key={key++} style={{fontSize:18,fontWeight:800,color:'#1a1a1a',margin:'28px 0 10px',letterSpacing:'-0.02em',borderBottom:'1.5px solid #ebebeb',paddingBottom:8}}>{line.replace(/^\*{3}\s*/,'')}</h3>);
    } else if (/^✓/.test(line)) {
      flushList(); checkItems.push(line.replace(/^✓\s*/,''));
    } else if (/^[-]\s+/.test(line)) {
      flushCheck(); listItems.push(line.replace(/^[-]\s+/,''));
    } else {
      flushList(); flushCheck();
      if (line.trim()) elements.push(<p key={key++} style={{margin:'0 0 14px'}}>{newsRenderInline(line,key)}</p>);
      else elements.push(<div key={key++} style={{height:8}}/>);
    }
  });
  flushList(); flushCheck();
  return <div style={{fontSize:17,color:'#444',lineHeight:1.95,fontWeight:400}}>{elements}</div>;
}

/* ── 상세 페이지 ── */
function NewsDetailPage({ item, onBack }) {
  return (
    <div style={{ paddingTop: NAV_HEIGHT, background:'#fff', minHeight:'100vh' }}>
      <div style={{ borderBottom:'1px solid #e8e8e8', background:'#fff', position:'sticky', top:NAV_HEIGHT, zIndex:100 }}>
        <div className="pmt-pad-lg" style={{ maxWidth:1280, margin:'0 auto', padding:'0 48px', height:52, display:'flex', alignItems:'center' }}>
          <button onClick={onBack} style={{ display:'flex', alignItems:'center', gap:8, background:'none', border:'none', cursor:'pointer', fontSize:14, fontWeight:600, color:'#555', fontFamily:'inherit', transition:'color 200ms', padding:0 }}
            onMouseEnter={e=>e.currentTarget.style.color='#C8271D'} onMouseLeave={e=>e.currentTarget.style.color='#555'}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M10 3L5 8l5 5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>
            뉴스 & 블로그 목록으로
          </button>
        </div>
      </div>
      <div className="pmt-pad-lg" style={{ maxWidth:720, margin:'0 auto', padding:'64px 48px 80px' }}>
        <div style={{ display:'flex', alignItems:'center', gap:12, marginBottom:20 }}>
          {item.tag && <span style={{ fontSize:11, fontWeight:700, letterSpacing:'0.12em', textTransform:'uppercase', color:'#C8271D' }}>{item.tag}</span>}
          {item.date && <span style={{ fontSize:13, color:'#bbb', fontWeight:500 }}>{item.date}</span>}
        </div>
        <h1 style={{ fontSize:'clamp(22px,2.4vw,36px)', fontWeight:800, color:'#1a1a1a', letterSpacing:'-0.03em', lineHeight:1.3, margin:'0 0 36px' }}>{item.title}</h1>
        {item.img && (
          <div style={{ marginBottom:40, borderRadius:14, overflow:'hidden', border:'1px solid #e8e8e8' }}>
            <img src={item.img} alt={item.title} style={{ width:'100%', display:'block', objectFit:'cover', maxHeight:420 }} />
          </div>
        )}
        <NewsMarkdown text={item.content} />
        {item.link && (
          <div style={{ marginTop:40, paddingTop:32, borderTop:'1px solid #ebebeb' }}>
            <a href={item.link} target="_blank" rel="noopener noreferrer" style={{ display:'inline-flex', alignItems:'center', gap:8, color:'#C8271D', fontSize:14, fontWeight:600, textDecoration:'none' }}>원문 보기 →</a>
          </div>
        )}
      </div>
    </div>
  );
}

/* ── 카드 컴포넌트 ── */
function NewsCard({ item, onClick, size }) {
  const [hov, setHov] = React.useState(false);
  const summary = extractSummary(item.content, 90);
  const isFeatured = size === 'featured';

  if (isFeatured) {
    return (
      <div onClick={onClick} onMouseEnter={()=>setHov(true)} onMouseLeave={()=>setHov(false)}
        className="rgrid-2" style={{ display:'grid', gridTemplateColumns:'1fr 1fr', borderRadius:20, overflow:'hidden',
          border:'1.5px solid #e8e8e8', cursor:'pointer', background:'#fff',
          boxShadow: hov ? '0 16px 48px rgba(0,0,0,0.10)' : '0 2px 12px rgba(0,0,0,0.05)',
          transform: hov ? 'translateY(-3px)' : 'none', transition:'all 280ms cubic-bezier(0.16,1,0.3,1)' }}>
        <div style={{ overflow:'hidden', minHeight:340 }}>
          <img src={item.img} alt={item.title}
            style={{ width:'100%', height:'100%', objectFit:'cover', display:'block',
              transform: hov ? 'scale(1.04)' : 'scale(1)', transition:'transform 500ms cubic-bezier(0.16,1,0.3,1)' }} />
        </div>
        <div style={{ padding:'48px 44px', display:'flex', flexDirection:'column', justifyContent:'center' }}>
          <div style={{ display:'flex', alignItems:'center', gap:10, marginBottom:20 }}>
            {item.tag && <span style={{ fontSize:11, fontWeight:700, letterSpacing:'0.12em', textTransform:'uppercase',
              color:'#fff', background:'#C8271D', borderRadius:99, padding:'4px 12px' }}>{item.tag}</span>}
            <span style={{ fontSize:13, color:'#bbb', fontWeight:500 }}>{item.date}</span>
          </div>
          <h2 style={{ fontSize:'clamp(18px,1.8vw,26px)', fontWeight:800, color:'#1a1a1a',
            letterSpacing:'-0.03em', lineHeight:1.4, margin:'0 0 16px' }}>{item.title}</h2>
          {summary && <p style={{ fontSize:15, color:'#888', lineHeight:1.75, margin:'0 0 28px', fontWeight:400 }}>{summary}…</p>}
          <span style={{ fontSize:13, fontWeight:700, color:'#C8271D' }}>읽기 →</span>
        </div>
      </div>
    );
  }

  return (
    <div onClick={onClick} onMouseEnter={()=>setHov(true)} onMouseLeave={()=>setHov(false)}
      style={{ borderRadius:16, overflow:'hidden', border:'1.5px solid #e8e8e8', cursor:'pointer', background:'#fff',
        boxShadow: hov ? '0 12px 36px rgba(0,0,0,0.10)' : '0 2px 8px rgba(0,0,0,0.04)',
        transform: hov ? 'translateY(-3px)' : 'none', transition:'all 260ms cubic-bezier(0.16,1,0.3,1)' }}>
      <div style={{ aspectRatio:'16/10', overflow:'hidden', background:'#f5f5f5' }}>
        {item.img && <img src={item.img} alt={item.title}
          style={{ width:'100%', height:'100%', objectFit:'cover', display:'block',
            transform: hov ? 'scale(1.05)' : 'scale(1)', transition:'transform 500ms cubic-bezier(0.16,1,0.3,1)' }} />}
      </div>
      <div style={{ padding:'24px 26px 28px' }}>
        <div style={{ display:'flex', alignItems:'center', gap:8, marginBottom:12 }}>
          {item.tag && <span style={{ fontSize:10, fontWeight:700, letterSpacing:'0.1em', textTransform:'uppercase',
            color:'#C8271D', background:'rgba(200,39,29,0.07)', borderRadius:99, padding:'3px 10px' }}>{item.tag}</span>}
          <span style={{ fontSize:12, color:'#ccc', fontWeight:500 }}>{item.date}</span>
        </div>
        <h3 style={{ fontSize:16, fontWeight:800, color:'#1a1a1a', letterSpacing:'-0.02em', lineHeight:1.45, margin:'0 0 10px' }}>{item.title}</h3>
        {summary && <p style={{ fontSize:13, color:'#999', lineHeight:1.7, margin:'0 0 16px', fontWeight:400,
          display:'-webkit-box', WebkitLineClamp:2, WebkitBoxOrient:'vertical', overflow:'hidden' }}>{summary}</p>}
        <span style={{ fontSize:12, fontWeight:700, color:'#C8271D' }}>읽기 →</span>
      </div>
    </div>
  );
}

/* ── 상단 히어로 슬라이더 ── */
function NewsFeaturedHero({ items, onOpen }) {
  const [current, setCurrent] = React.useState(0);
  const [fading, setFading] = React.useState(false);
  const topItems = items.slice(0, 4);

  const goTo = React.useCallback((idx) => {
    if (idx === current) return;
    setFading(true);
    setTimeout(() => { setCurrent(idx); setFading(false); }, 320);
  }, [current]);

  React.useEffect(() => {
    if (topItems.length < 2) return;
    const t = setInterval(() => goTo((current + 1) % topItems.length), 5000);
    return () => clearInterval(t);
  }, [current, topItems.length, goTo]);

  if (!topItems.length) return null;

  const featured = topItems[current];
  const sideItems = [
    topItems[(current + 1) % topItems.length],
    topItems[(current + 2) % topItems.length],
  ].filter(Boolean).slice(0, 2);

  return (
    <div style={{ background: '#0e1118', padding: '60px 0 44px' }}>
      <div className="pmt-pad-lg" style={{ maxWidth: 1280, margin: '0 auto', padding: '0 48px' }}>

        {/* 섹션 제목 */}
        <div style={{
          fontSize: 'clamp(56px, 6.5vw, 96px)', fontWeight: 900,
          color: '#252a3a', letterSpacing: '-0.04em', lineHeight: 1,
          marginBottom: 28, userSelect: 'none'
        }}>
          News & BLOG
        </div>

        <div className="rgrid-2" style={{ display: 'grid', gridTemplateColumns: '1fr 292px', gap: 10, alignItems: 'stretch' }}>

          {/* 메인 피처드 카드 */}
          <div
            onClick={() => onOpen(featured)}
            style={{
              position: 'relative', borderRadius: 18, overflow: 'hidden',
              cursor: 'pointer', minHeight: 440,
              opacity: fading ? 0 : 1, transition: 'opacity 320ms ease'
            }}
          >
            {featured.img
              ? <img src={featured.img} alt={featured.title}
                  style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
              : <div style={{ position: 'absolute', inset: 0, background: '#1a1a2e' }} />
            }
            {/* 그라데이션 오버레이 */}
            <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(135deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.42) 55%, rgba(0,0,0,0.08) 100%)' }} />
            {/* 하단 레드 라인 */}
            <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, height: 3, background: 'linear-gradient(to right, #C8271D 0%, transparent 70%)' }} />

            {/* 텍스트 */}
            <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, padding: '40px 44px 40px' }}>
              {featured.tag && (
                <span style={{
                  fontSize: 10, fontWeight: 700, letterSpacing: '0.14em',
                  textTransform: 'uppercase', color: '#fff', background: '#C8271D',
                  borderRadius: 4, padding: '4px 11px', display: 'inline-block', marginBottom: 14
                }}>{featured.tag}</span>
              )}
              <h2 style={{
                fontSize: 'clamp(20px, 2vw, 30px)', fontWeight: 800, color: '#fff',
                letterSpacing: '-0.03em', lineHeight: 1.4, margin: '0 0 14px', maxWidth: 560
              }}>{featured.title}</h2>
              {featured.content && (
                <p style={{ fontSize: 14, color: 'rgba(255,255,255,0.60)', lineHeight: 1.72, margin: '0 0 24px', maxWidth: 460 }}>
                  {extractSummary(featured.content, 80)}…
                </p>
              )}
              <span style={{
                fontSize: 12, fontWeight: 700, color: '#fff',
                display: 'inline-flex', alignItems: 'center', gap: 6,
                background: 'rgba(200,39,29,0.22)', border: '1px solid rgba(200,39,29,0.55)',
                borderRadius: 8, padding: '8px 18px', backdropFilter: 'blur(6px)'
              }}>
                자세히 보기 &nbsp;→
              </span>
            </div>
          </div>

          {/* 사이드 썸네일 */}
          <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
            {sideItems.map((item, i) => (
              <div key={i} onClick={() => onOpen(item)}
                style={{
                  flex: 1, position: 'relative', borderRadius: 14, overflow: 'hidden',
                  cursor: 'pointer', minHeight: 210,
                  transition: 'transform 220ms ease', willChange: 'transform'
                }}
                onMouseEnter={e => e.currentTarget.style.transform = 'scale(1.015)'}
                onMouseLeave={e => e.currentTarget.style.transform = 'scale(1)'}
              >
                {item.img
                  ? <img src={item.img} alt={item.title}
                      style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
                  : <div style={{ position: 'absolute', inset: 0, background: '#1a1a2e' }} />
                }
                <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.18) 60%, transparent 100%)' }} />
                <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, padding: '18px 20px' }}>
                  {item.tag && (
                    <span style={{ fontSize: 9, fontWeight: 700, color: '#C8271D', letterSpacing: '0.12em', textTransform: 'uppercase', display: 'block', marginBottom: 6 }}>
                      {item.tag}
                    </span>
                  )}
                  <p style={{
                    fontSize: 13, fontWeight: 700, color: '#fff', lineHeight: 1.45, margin: 0,
                    display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden'
                  }}>{item.title}</p>
                </div>
              </div>
            ))}
          </div>
        </div>

        {/* 네비게이션 도트 */}
        <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 22 }}>
          {topItems.map((_, i) => (
            <button key={i} onClick={() => goTo(i)}
              style={{
                width: i === current ? 28 : 8, height: 8, borderRadius: 4,
                background: i === current ? '#C8271D' : '#303030',
                border: 'none', cursor: 'pointer', padding: 0, flexShrink: 0,
                transition: 'all 300ms cubic-bezier(0.16,1,0.3,1)'
              }}
            />
          ))}
          <span style={{ marginLeft: 'auto', fontSize: 12, color: '#444', fontWeight: 700, fontVariantNumeric: 'tabular-nums' }}>
            {String(current + 1).padStart(2, '0')} / {String(topItems.length).padStart(2, '0')}
          </span>
        </div>

      </div>
    </div>
  );
}

/* ── 목록 페이지 ── */
function NewsPage({ navigate }) {
  const [detail, setDetail] = React.useState(null);
  const [activeTag, setActiveTag] = React.useState('전체');
  const [items, setItems] = React.useState(() => {
    try {
      const cached = localStorage.getItem(NEWS_CACHE_KEY);
      return cached ? JSON.parse(cached) : FALLBACK_NEWS;
    } catch(e) { return FALLBACK_NEWS; }
  });

  React.useEffect(() => {
    localStorage.removeItem(NEWS_CACHE_KEY);
    fetch(NEWS_SHEET_URL)
      .then(r => r.text())
      .then(text => {
        try {
          const parsed = parseNewsCSV(text);
          if (parsed.length > 0) {
            setItems(parsed);
            localStorage.setItem(NEWS_CACHE_KEY, JSON.stringify(parsed));
          }
        } catch(e) { console.error('뉴스 파싱 오류:', e); }
      })
      .catch(e => console.error('뉴스 시트 로드 오류:', e));
  }, []);

  const openDetail = (item) => {
    if (item.content && item.content.trim()) { setDetail(item); window.scrollTo({top:0,behavior:'instant'}); }
    else if (item.link) { window.open(item.link, '_blank'); }
  };

  if (detail) return <NewsDetailPage item={detail} onBack={() => { setDetail(null); window.scrollTo({top:0,behavior:'instant'}); }} />;

  const tags = ['전체', ...Array.from(new Set(items.map(n => n.tag).filter(Boolean)))];
  const filtered = activeTag === '전체' ? items : items.filter(n => n.tag === activeTag);
  const featured = filtered[0];
  const rest = filtered.slice(1);

  return (
    <div style={{ paddingTop: NAV_HEIGHT, background:'#fff', minHeight:'100vh' }}>

      {/* 상단 히어로 슬라이더 */}
      <NewsFeaturedHero items={items} onOpen={openDetail} />

      {/* 카테고리 필터 헤더 */}
      <div style={{ background:'#fff' }}>
        <div style={{ maxWidth:1280, margin:'0 auto', padding:'28px 48px 0' }}>

          {/* 카테고리 필터 */}
          <div style={{ display:'flex', gap:8, flexWrap:'wrap', paddingBottom:0 }}>
            {tags.map(tag => (
              <button key={tag} onClick={() => setActiveTag(tag)}
                style={{ border:'none', borderRadius:99, padding:'8px 20px', fontSize:13, fontWeight:700,
                  cursor:'pointer', fontFamily:'inherit', transition:'all 180ms',
                  background: activeTag===tag ? '#C8271D' : '#f0f0f0',
                  color: activeTag===tag ? '#fff' : '#666' }}>
                {tag}
              </button>
            ))}
          </div>
        </div>
      </div>

      <div className="pmt-pad-lg" style={{ maxWidth:1280, margin:'0 auto', padding:'48px 48px 80px', background:'#fff' }}>

        {/* 피처드 카드 */}
        {featured && (
          <div style={{ marginBottom:32 }}>
            <NewsCard item={featured} onClick={() => openDetail(featured)} size="featured" />
          </div>
        )}

        {/* 2열 그리드 */}
        {rest.length > 0 && (
          <div className="rgrid-2" style={{ display:'grid', gridTemplateColumns:'repeat(2,1fr)', gap:24 }}>
            {rest.map((n, i) => (
              <NewsCard key={i} item={n} onClick={() => openDetail(n)} size="normal" />
            ))}
          </div>
        )}

        {filtered.length === 0 && (
          <div style={{ textAlign:'center', padding:'80px 0', color:'#bbb', fontSize:15 }}>
            아직 등록된 글이 없습니다.
          </div>
        )}
      </div>

    </div>
  );
}

Object.assign(window, { NewsPage });
