Files
o2o-infinith-demo/supporters/src/pages/en/stay.astro
T
Haewon KamandClaude Fable 5.1 796fa56106 feat(supporters): 주변 안내 축제를 회복 일정의 체류 기간 기준으로 먼저 보여 준다
주변 안내(/stay·/en/stay)의 축제 목록이 계절 묶음만 있고, 회복 일정 플래너에서 고른
기간과 이어지지 않았다(haewon 2026-09-16). 플래너가 체류 기간(도착일~출국 가능일)을
이 기기의 localStorage 에 남기고, 주변 안내는 그 기간과 겹치는 행사를 위로 올린다.

- Planner.astro: 결과를 그릴 때 체류 기간만 저장(시술·수술일은 저장하지 않음, 서버로도
  가지 않음). 행사 섹션에 "주변 안내에서 이 기간의 행사 전체 보기" 링크(/stay#plan:from..to)
- stay.astro·en/stay.astro: 카드에 data-start·data-end·data-km, "체류 기간" 칩(기본 숨김),
  기간 안내 문단. 스크립트가 URL 해시 또는 localStorage 에서 기간을 읽어 겹치는 카드를
  맨 앞으로 옮기고 칩을 켠다. 기간이 짧은 행사가 앞, 90일을 넘는 상시 행사는 뒤('상시 진행')
- 기간이 없거나 겹침이 없으면 화면은 이전과 같다. 저장소를 못 쓰는 브라우저는 조용히 건너뛴다
- global.css: 겹치는 카드 테두리·오른쪽 배지, 숨긴 칩
- run.mjs: planStrings.json 을 코드 갱신 목록에 넣는다. 기존 병원 폴더에 옛 문구 파일이
  남아 링크 글자가 비어 나온 것을 캡처로 발견했다

검증: 원진 빌드 게이트 통과, plan.test 14건 통과, 로컬 미리보기(Playwright)로
플래너 저장→주변 안내 정렬(20/24건, 짧은 행사 먼저)·해시 진입·기간 없음·영문·모바일 확인.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 09:47:01 +09:00

564 lines
33 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
// 외국인 환자용 주변 안내(/en/stay). /stay 의 영문 짝이다. haewon 결정(2026-09-11): 주변 안내(/en/stay)와 회복 일정 플래너(/en/plan)는 별개 페이지다.
// 1. Around the clinic : 도보·차 소요 시간으로 거른 주변 장소
// 2. Festivals : 계절로 묶은 행사
// 3. Suggested days : 시간표와 지도가 붙은 동선
// + After-treatment care(#recovery-quote): 점프 칩 아래 접이식 블록. 워커 recovery 단계가 병원 시술 페이지 원문에서 고른 문장(번역)
//
// 데이터는 한국관광공사 TourAPI 영문(EngService2)에서 scripts/fetch_medical_tourism.py 가
// 미리 수집한 src/data/medicalTourism.json 이다. 설명문은 detailCommon2 의 overview 다.
// 기준 좌표는 워커(tourism 단계)가 팩트 시트 주소로 정한다. 병원 이름·주소·도시는 factSheet, 기준점은
// medicalTourism.meta.origin 에서만 읽는다. 이 파일에 특정 병원이나 지역 이름을 적지 않는다.
// 데이터가 비어 있으면(템플릿 기본값, origin lat 0) 목록 대신 "pending" 안내를 그리고 빌드는 그대로 된다.
//
// 만들지 않는 것
// - 평점·리뷰·영업시간: TourAPI 미제공. 싣지 않는다.
// - 링크: 공식 홈페이지가 있을 때만 걸고, 없으면 검색으로 보낸다. 주소를 지어내지 않는다.
// - 식이 적합성·회복 일수: 의학 판단이라 병원 확정값만 쓴다.
// - 일정의 시각: 진료 종료 시각을 가정으로 못박아 화면에 밝힌다. 병원 일정이 아니다.
import Base from '../../layouts/Base.astro';
import { fact, site as S, SITE_NAME, clinicSchema, has } from '../../lib';
import data from '../../data/medicalTourism.json';
import recovery from '../../data/recoveryNotes.json';
const f = fact as Record<string, any>;
const Sx = S as Record<string, any>;
const clinic = f.shortNameEn || f.nameEn || f.shortName || 'the clinic';
const site = Astro.site!.toString().replace(/\/$/, '');
const T = data as any;
// 기준점. 좌표가 없으면(템플릿 기본값) 아직 수집 전이다. 지어내지 않고 확인 대기로 그린다.
const origin = (T.meta?.origin ?? {}) as { lat?: number; lng?: number; label?: string; address?: string };
const ready = Boolean(origin.lat && origin.lng);
const total: number = T.filters?.total ?? 0;
const festivals: any[] = T.festivals ?? [];
const updated: string = (T.meta?.fetchedAt || '').slice(0, 10);
// 거리의 기준 주소. 영문 주소가 있으면 그것, 없으면 수집 때 쓴 주소, 그다음 팩트 시트 국문 주소.
const originAddress = f.address?.fullEn || origin.address || f.address?.full || '';
// 도시 이름은 영문 주소의 마지막 항목("..., Gangnam-gu, Seoul" 이면 Seoul)에서 읽는다. 없으면 Korea.
const cityEn = (f.address?.fullEn || '').split(',').pop()?.trim() || 'Korea';
const festKm: number = T.meta?.festivalRadiusKm || 0;
type Place = {
id: string; title: string; address: string; image: string | null; overview: string;
homepage: string; lat: number | null; lng: number | null; distanceM: number | null;
travel: { mode: string; minutes: number; label: string } | null;
};
const GROUPS: Array<{ key: string; label: string; note: string }> = [
{ key: 'restaurant', label: 'Food', note: 'Restaurants and cafés' },
{ key: 'stay', label: 'Hotels', note: 'Places to sleep' },
{ key: 'wellness', label: 'Rest', note: 'Spas and jjimjilbang' },
{ key: 'attraction', label: 'Sights', note: 'Streets, parks, landmarks' },
{ key: 'culture', label: 'Culture', note: 'Museums, theatres, halls' },
{ key: 'shopping', label: 'Shopping', note: 'Stores and markets' },
];
const SEASONS = [
{ key: 'spring', label: 'Spring' }, { key: 'summer', label: 'Summer' },
{ key: 'autumn', label: 'Autumn' }, { key: 'winter', label: 'Winter' },
];
const MONTHS = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const nowSeason = ['winter', 'winter', 'spring', 'spring', 'spring', 'summer', 'summer', 'summer', 'autumn', 'autumn', 'autumn', 'winter'][new Date().getMonth()];
// 검색으로 보낸다. 없는 URL 을 만들지 않는다.
const searchUrl = (q: string) => `https://www.google.com/search?q=${encodeURIComponent(`${q} ${cityEn}`)}`;
// 칩은 누적 임계값으로 거른다. 카드에 이동수단과 도보 분을 실어 두면 스크립트가 판단한다.
const dt = (d: string | null) => (d && d.length === 8 ? `${MONTHS[+d.slice(4, 6)]} ${+d.slice(6, 8)}` : '');
// 사진이 없을 때 이름을 대신 넣는다. 빈 회색칸보다 낫고, 없는 사진을 지어내지도 않는다.
const shortName = (t: string) => {
const m = t.match(/\(([^)]+)\)\s*$/);
return (m ? m[1] : t).replace(/\s*\[.*\]\s*/g, '').trim();
};
const firstSentence = (s: string, n = 150) => {
if (!s) return '';
const cut = s.slice(0, n);
const stop = cut.lastIndexOf('. ');
return (stop > 60 ? cut.slice(0, stop + 1) : cut) + (s.length > n ? '…' : '');
};
/* ── 동선. 실제 데이터에서 만들고, 시각은 가정임을 화면에 밝힌다. ── */
const oLat = origin.lat ?? 0, oLng = origin.lng ?? 0;
const pick = (key: string, maxMin: number, n: number): Place[] =>
(((T.places ?? {})[key] ?? []) as Place[])
.filter((p) => p.travel && p.travel.mode === 'walk' && p.travel.minutes <= maxMin && p.lat)
.slice(0, n);
const pickAny = (key: string, n: number): Place[] => (((T.places ?? {})[key] ?? []) as Place[]).filter((p) => p.lat).slice(0, n);
const hhmm = (m: number) => `${String(Math.floor(m / 60) % 24).padStart(2, '0')}:${String(m % 60).padStart(2, '0')}`;
function buildRoute(startMin: number, stops: Array<{ p: Place | null; label: string; stay: number; note: string }>) {
let t = startMin;
const out: any[] = [];
stops.forEach((s, i) => {
const move = i === 0 ? 0 : (s.p?.travel?.minutes ?? 5);
t += move;
const from = t;
t += s.stay;
out.push({ ...s, moveMin: move, from: hhmm(from), to: hhmm(t), lat: s.p?.lat ?? oLat, lng: s.p?.lng ?? oLng });
});
return { stops: out, total: t - startMin, from: hhmm(startMin), to: hhmm(t) };
}
const clinicStop = (label: string, stay: number, note: string) => ({ p: null, label, stay, note });
const ROUTES = [
{
id: 'near', title: 'The day of a check-up', who: 'When you come back to the clinic often',
blurb: 'Everything within a short walk. You do not need a taxi.',
route: buildRoute(15 * 60, [
clinicStop(clinic, 40, 'Your appointment ends here.'),
...pick('restaurant', 10, 1).map((p) => ({ p, label: p.title, stay: 50, note: firstSentence(p.overview, 90) })),
...pick('wellness', 12, 1).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })),
]),
},
{
id: 'short', title: 'A short outing', who: 'When you can walk a little further',
blurb: 'Still close, but out of the block.',
route: buildRoute(13 * 60, [
clinicStop(clinic, 20, 'Start from the clinic.'),
...pickAny('shopping', 1).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })),
...pickAny('restaurant', 2).slice(1, 2).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })),
]),
},
{
id: 'city', title: 'When you can travel', who: 'Later in your stay',
blurb: 'Sights across the city. Expect to take a taxi or the subway.',
route: buildRoute(10 * 60, [
clinicStop(clinic, 10, 'Set off from the clinic.'),
...pickAny('attraction', 2).map((p) => ({ p, label: p.title, stay: 70, note: firstSentence(p.overview, 90) })),
...pickAny('culture', 1).map((p) => ({ p, label: p.title, stay: 70, note: firstSentence(p.overview, 90) })),
]),
},
].filter((r) => r.route.stops.length > 1);
/* OpenStreetMap 타일을 좌표로 직접 깔아 지도를 만든다. 지도 라이브러리를 부르지 않는다.
빈 회색 칸에 점만 찍으면 어디인지 알 수 없어서, 실제 거리·블록이 보이게 한다.
타일은 OSM 정책상 출처를 반드시 표기한다. */
const TILE = 256, MAPW = 680, MAPH = 340;
const lngToPx = (lng: number, z: number) => ((lng + 180) / 360) * TILE * 2 ** z;
const latToPx = (lat: number, z: number) => {
const r = (lat * Math.PI) / 180;
return ((1 - Math.log(Math.tan(r) + 1 / Math.cos(r)) / Math.PI) / 2) * TILE * 2 ** z;
};
function miniMap(stops: any[]) {
const lats = stops.map((s) => s.lat), lngs = stops.map((s) => s.lng);
const [la0, la1] = [Math.min(...lats), Math.max(...lats)];
const [ln0, ln1] = [Math.min(...lngs), Math.max(...lngs)];
// 모든 지점이 여백 안에 들어오는 가장 확대된 배율을 고른다.
let z = 17;
for (; z > 10; z--) {
const w = lngToPx(ln1, z) - lngToPx(ln0, z);
const h = latToPx(la0, z) - latToPx(la1, z);
if (w <= MAPW - 90 && h <= MAPH - 90) break;
}
const cx = (lngToPx(ln0, z) + lngToPx(ln1, z)) / 2;
const cy = (latToPx(la0, z) + latToPx(la1, z)) / 2;
const left = cx - MAPW / 2, top = cy - MAPH / 2;
const tiles: Array<{ src: string; x: number; y: number }> = [];
for (let tx = Math.floor(left / TILE); tx <= Math.floor((left + MAPW) / TILE); tx++) {
for (let ty = Math.floor(top / TILE); ty <= Math.floor((top + MAPH) / TILE); ty++) {
const n = 2 ** z;
if (tx < 0 || ty < 0 || tx >= n || ty >= n) continue;
tiles.push({ src: `https://tile.openstreetmap.org/${z}/${tx}/${ty}.png`, x: tx * TILE - left, y: ty * TILE - top });
}
}
const pins = stops.map((s, i) => ({
x: +(lngToPx(s.lng, z) - left).toFixed(1),
y: +(latToPx(s.lat, z) - top).toFixed(1),
n: i + 1, label: s.label,
}));
return { tiles, pins, z };
}
// 시술 후 관리 안내. 워커 recovery 단계(scripts/collect_recovery.mjs)가 병원 시술 페이지 원문에서 고른 문장이다.
// en 이 비어 있는 문장(번역 실패·키 없음)은 한글 원문을 그대로 보이고 (Korean) 표시를 붙인다. items 가 비어 있으면 블록을 그리지 않는다.
type RecoveryItem = { procedure: string; procedureEn?: string; area?: string; url: string; fetchedAt?: string; ko: string[]; en: string[]; ocr?: boolean };
const RN = recovery as { generatedAt?: string; items?: RecoveryItem[] };
const recoveryItems: RecoveryItem[] = (RN.items ?? []).filter((it) => it.ko?.length);
const recoveryDate = RN.generatedAt || '';
const allPlaces: Array<Place & { cat: string }> = GROUPS.flatMap((g) =>
(((T.places ?? {})[g.key] ?? []) as Place[]).map((p) => ({ ...p, cat: g.key })));
const ld = [
{ '@type': 'WebPage', '@id': `${site}/en/stay#page`, name: `Recovery schedule at ${clinic}`, url: `${site}/en/stay`, inLanguage: 'en', isPartOf: { '@id': `${site}/#website` }, about: { '@id': `${f.url}/#clinic` }, publisher: { '@type': 'Organization', name: SITE_NAME, url: site } },
clinicSchema(site),
];
---
<Base
lang="en"
title={`Around ${clinic}: food, rest, sights, festivals, day routes`}
description={`For international patients at ${clinic} in ${cityEn}: where to eat and rest, what to see, which festivals are on, and how to shape your days. Distances and walking times from the clinic. Source: Korea Tourism Organization.`}
jsonLd={ld}
>
<article class="wrap-wide stay">
<header class="article-head">
<div class="eyebrow">Nearby</div>
<h1 class="serif">Around The Clinic</h1>
<p class="lede">
<strong>Around {clinic}.</strong> {ready
? `Everything below is measured from the clinic at ${originAddress || 'its address'}.`
: 'Distances and walking times will appear once the clinic\'s location is confirmed.'}
Names, photographs and descriptions come from the Korea Tourism Organization.
For the clinic's own hours and phone, see <a href="/clinic" hreflang="ko">Clinic information<span class="lang-tag">KO</span></a>. To plan arrival and departure around your surgery date, use the <a href="/en/plan">Recovery Planner</a>.
</p>
{!ready && <p class="pending-note">This guide is pending. Food, hotels, rest, sights and festivals near the clinic will be listed once its address is confirmed.</p>}
</header>
<!-- 오늘 날씨. 빌드 시점이 아니라 브라우저에서 받는다. 정적 빌드에 넣으면 배포 시각의
날씨가 굳는다. 값을 못 받으면 이 블록은 통째로 사라진다(틀린 날씨를 보이지 않는다).
Open-Meteo 는 키가 필요 없고 CORS 를 허용한다. -->
<aside id="weather" class="wx" hidden>
<div class="wx-now">
<span class="wx-temp"><span id="wx-t">–</span><span class="wx-unit">°C</span></span>
<div>
<div class="wx-cond" id="wx-c">Loading</div>
<div class="wx-meta" id="wx-m"></div>
</div>
</div>
<p class="wx-note" id="wx-n"></p>
</aside>
<!-- 섹션이 길어 스크롤이 부담스럽다. 머리말 아래 붙여 어디서든 건너뛰게 한다. -->
<nav class="jump" aria-label="Jump to a section">
{recoveryItems.length > 0 && <a href="#recovery-quote">Care<b>{recoveryItems.length}</b></a>}
{GROUPS.filter((g) => allPlaces.some((p) => p.cat === g.key)).map((g) => (
<a href={`#g-${g.key}`}>{g.label}<b>{allPlaces.filter((p) => p.cat === g.key).length}</b></a>
))}
<a href="#festivals">Festivals<b>{festivals.length}</b></a>
<a href="#days">Days<b>{ROUTES.length}</b></a>
</nav>
<!-- ── 0. After-treatment care ── 병원 시술 페이지 원문 인용(번역). 기본은 접힘, summary 가 버튼이다(haewon 2026-09-11).
동선 카드(.route)·정차(.stop) 룩을 그대로 쓴다. id="recovery-quote" 는 발행 게이트(check.mjs)가 홈페이지 40자 일치 검사에서 이 인용 블록만 빼는 표식이다. -->
{recoveryItems.length > 0 && (
<details class="route recovery" id="recovery-quote">
<summary class="btn primary"><span class="show">Show after-treatment care · {recoveryItems.length} treatments</span><span class="hide">Hide after-treatment care</span></summary>
<div class="route-head">
<div>
<h3>After-treatment care, as published by the clinic</h3>
<p class="who">From {clinic}'s own treatment pages · {recoveryItems.length} treatments</p>
</div>
{recoveryDate && <div class="clock">Checked {recoveryDate}</div>}
</div>
<p class="blurb">These lines are quoted from {clinic}'s own treatment pages (Korean), translated for reference. They differ by treatment and by person. Confirm at your consultation.</p>
<ol class="timeline">
{recoveryItems.map((it, i) => (
<li>
<details open={i < 3}>
<summary>
<span class="stop">
<span class="n">{i + 1}</span>
<span>
<span class="stop-t">{it.area ? `${it.area} · ` : ''}{it.ko.length} {it.ko.length === 1 ? 'line' : 'lines'} · tap to open</span>
<h4>{it.procedureEn || it.procedure}</h4>
{it.procedureEn && <span class="stop-t" lang="ko">{it.procedure}</span>}
</span>
</span>
</summary>
<ul>
{it.ko.map((s, k) => it.en?.[k]
? <li>{it.en[k]}</li>
: <li lang="ko">{s} <span class="lang-tag">Korean</span></li>)}
</ul>
<p><a class="go" href={it.url} rel="noopener nofollow" hreflang="ko">Clinic page (Korean) ↗</a>{it.fetchedAt ? ` · checked ${it.fetchedAt}` : ''}</p>
</details>
</li>
))}
</ol>
</details>
)}
<!-- ── 1. 주변 ── -->
<section id="around">
<div class="sec-head">
<h2>Around the clinic</h2>
<span class="upd">{updated ? `Updated ${updated}` : 'Pending'}</span>
</div>
<p class="sub">{total > 0 ? `${total} places, sorted by how long they take to reach on foot.` : 'Listings will follow once the clinic\'s location is confirmed.'}</p>
{total > 0 && <div class="chips" id="walkchips" role="group" aria-label="Filter by travel time">
<button class="chip on" data-max="all">All <b>{T.filters.total}</b></button>
<button class="chip" data-max="5">Within 5 min walk <b>{T.filters.walk5}</b></button>
<button class="chip" data-max="15">Within 15 min walk <b>{T.filters.walk15}</b></button>
<button class="chip" data-max="walk">Walking distance <b>{T.filters.walkAll}</b></button>
<button class="chip" data-max="drive">By car <b>{T.filters.drive}</b></button>
</div>}
{GROUPS.map((g) => {
const items = allPlaces.filter((p) => p.cat === g.key);
if (!items.length) return null;
return (
<div class="grp" id={`g-${g.key}`} data-group={g.key}>
<h3>{g.label} <small>{g.note}</small></h3>
<div class="cards">
{items.map((p) => (
<article class="card" data-mode={p.travel?.mode ?? 'drive'} data-walk={p.travel?.mode === 'walk' ? p.travel.minutes : ''}>
<div class="thumb">
{p.image ? <img src={p.image} alt={`${p.title} : ${g.label.toLowerCase()} near ${clinic}`} loading="lazy" referrerpolicy="no-referrer" /> : <span class="nophoto">{shortName(p.title)}</span>}
{p.travel && <span class="badge">{p.travel.label} <em>{p.distanceM! < 1000 ? `${p.distanceM} m` : `${(p.distanceM! / 1000).toFixed(1)} km`}</em></span>}
</div>
<div class="body">
<h4>{p.title}</h4>
<p class="desc">{firstSentence(p.overview) || 'No description provided by the tourism data.'}</p>
<p class="addr">{p.address}</p>
{p.homepage
? <a class="go" href={p.homepage} rel="noopener nofollow">Official site ↗</a>
: <a class="go" href={searchUrl(p.title.replace(/\s*\(.*\)\s*$/, ''))} rel="noopener nofollow">Open in search ↗</a>}
</div>
</article>
))}
</div>
</div>
);
})}
<p class="src">Source · Korea Tourism Organization TourAPI. Walking time is estimated at 80 m per minute and is not a routed distance.</p>
</section>
<!-- ── 2. 축제 ── -->
<section id="festivals">
<div class="sec-head"><h2>Festivals and events</h2></div>
<p class="sub">{festivals.length > 0
? `${festivals.length} events${festKm ? ` within ${festKm} km` : ''}, grouped by season. Right now it is `
: 'Events will follow once the clinic\'s location is confirmed. Right now it is '}<strong>{nowSeason}</strong>.</p>
<p class="sub" data-plan-note hidden></p>
{festivals.length > 0 && <div class="chips" role="group" aria-label="Filter by season">
<button class="chip" data-season="plan" hidden>Your stay <b>0</b></button>
<button class="chip on" data-season="all">All <b>{festivals.length}</b></button>
{SEASONS.map((s) => {
const n = festivals.filter((e: any) => e.season === s.key).length;
return n ? <button class="chip" data-season={s.key}>{s.label} <b>{n}</b></button> : null;
})}
</div>}
<div class="cards fest">
{festivals.map((e: any) => (
<article class="card" data-season={e.season} data-start={e.startDate || ""} data-end={e.endDate || ""} data-km={e.distanceKm ?? ""}>
<div class="thumb">
{e.image ? <img src={e.image} alt={`${e.title} : festival near ${clinic}`} loading="lazy" referrerpolicy="no-referrer" /> : <span class="nophoto">{shortName(e.title)}</span>}
<span class="badge mono">{MONTHS[e.month] ?? ''}</span>
</div>
<div class="body">
<h4>{e.title}</h4>
<p class="when">{dt(e.startDate)} – {dt(e.endDate)} · {e.travel ? e.travel.label : `${e.distanceKm} km`}</p>
<p class="desc">{firstSentence(e.overview) || 'No description provided by the tourism data.'}</p>
<p class="addr">{e.address}</p>
<a class="go" href={searchUrl(e.title.replace(/\s*\(.*\)\s*$/, ''))} rel="noopener nofollow">Open in search ↗</a>
</div>
</article>
))}
</div>
<p class="src">Source · Korea Tourism Organization TourAPI. Dates can change at the organiser's discretion.</p>
</section>
<!-- ── 3. 동선 ── -->
<section id="days">
<div class="sec-head"><h2>Shaping your days</h2></div>
<p class="sub">
Three routes built from the places above. The clock times assume an appointment ending at the hour shown, and are an example, not your schedule.
</p>
{Sx.recoveryStagesEn
? <p><strong>What {clinic} advises.</strong> {Sx.recoveryStagesEn}</p>
: <p class="pending-note">Which of these you can do, and on which day, is a medical question. {clinic} has not yet published English guidance. Ask at your consultation.</p>}
{ROUTES.map((r) => {
const pins = miniMap(r.route.stops);
return (
<div class="route">
<div class="route-head">
<div>
<h3>{r.title}</h3>
<p class="who">{r.who}</p>
</div>
<div class="clock">{r.route.from}–{r.route.to} · {Math.floor(r.route.total / 60)}h {r.route.total % 60}m</div>
</div>
<p class="blurb">{r.blurb}</p>
<div class="map" role="img" aria-label={`Map of ${pins.pins.length} stops: ${pins.pins.map((p) => p.label).join(', ')}`}>
<div class="map-tiles">
{/* 타일은 장식이다. 지도의 뜻은 감싸는 요소의 aria-label 이 전한다.
img 대신 배경으로 두어 스크린리더가 256개 조각을 읽지 않게 한다. */}
{pins.tiles.map((t) => (
<div class="tile" style={`left:${t.x}px;top:${t.y}px;background-image:url('${t.src}')`} />
))}
</div>
<svg class="map-pins" viewBox={`0 0 ${MAPW} ${MAPH}`} aria-hidden="true">
<polyline points={pins.pins.map((p) => `${p.x},${p.y}`).join(' ')} fill="none" stroke="#0A1128" stroke-width="3" stroke-dasharray="6 5" opacity="0.65" />
{pins.pins.map((p) => (
<g><circle cx={p.x} cy={p.y} r="13" fill="#0A1128" stroke="#fff" stroke-width="2.5" /><text x={p.x} y={p.y + 4.5} text-anchor="middle" font-size="12" font-weight="700" fill="#fff">{p.n}</text></g>
))}
</svg>
<span class="map-credit">© OpenStreetMap contributors</span>
</div>
<ol class="timeline">
{r.route.stops.map((s: any, i: number) => (
<li>
{i > 0 && <div class="move">↓ {s.moveMin} min</div>}
<div class="stop">
<span class="n">{i + 1}</span>
<div>
<div class="stop-t">{s.from}–{s.to}</div>
<h4>{s.label}</h4>
<p>{s.note}</p>
</div>
</div>
</li>
))}
</ol>
</div>
);
})}
</section>
<section id="limits">
<h2>What this page does not tell you</h2>
<ul>
<li>No ratings, review counts or opening hours. The tourism data does not carry them.</li>
<li>No claim that any place suits your recovery. That is for {clinic} to say.</li>
<li>{total > 0
? `English tourism listings near the clinic are limited. Only ${T.filters.walk5} places sit within a five minute walk, and ${T.filters.drive} of ${total} need a car.`
: 'Listings near the clinic are pending until its location is confirmed.'}</li>
<li>We are not a travel agency, take no booking and no commission.</li>
</ul>
<p class="botnote">
{has(f.urlEn) && <a class="btn primary" href={f.urlEn} rel="noopener" hreflang="en">Book a consultation in English</a>}
</p>
<p class="disclosure">{f.sideEffectNoticeEn || f.sideEffectNotice}</p>
</section>
</article>
<script is:inline define:vars={{ WX_LAT: origin.lat ?? 0, WX_LNG: origin.lng ?? 0 }}>
// 이동 시간 필터. 임계값은 누적이라 "15분 이내"가 5분 이내도 포함한다.
// 걸러져 비게 된 그룹은 제목만 남지 않도록 통째로 숨긴다.
(function () {
var chips = document.querySelectorAll('#walkchips .chip');
chips.forEach(function (c) {
c.addEventListener('click', function () {
chips.forEach(function (x) { x.classList.toggle('on', x === c); });
var want = c.dataset.max;
document.querySelectorAll('#around .card').forEach(function (card) {
var mode = card.dataset.mode, w = parseInt(card.dataset.walk || '', 10);
var show = want === 'all' ? true
: want === 'walk' ? mode === 'walk'
: want === 'drive' ? mode !== 'walk'
: mode === 'walk' && w <= parseInt(want, 10);
card.hidden = !show;
});
document.querySelectorAll('#around .grp').forEach(function (g) {
g.hidden = ![].slice.call(g.querySelectorAll('.card')).some(function (x) { return !x.hidden; });
});
});
});
// 점프 칩 '시술 후 관리'는 접힌 블록으로 가므로 눌렀을 때 함께 연다.
document.querySelectorAll('a[href="#recovery-quote"]').forEach(function (a) { a.addEventListener('click', function () { var d = document.getElementById('recovery-quote'); if (d) d.open = true; }); });
// 지금 화면에 있는 섹션의 버튼을 켠다. 섹션이 많아 어디쯤인지 알기 어렵다.
var links = [].slice.call(document.querySelectorAll('.jump a'));
var targets = links.map(function (a) { return document.querySelector(a.getAttribute('href')); });
if ('IntersectionObserver' in window) {
var seen = {};
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (e) { seen[e.target.id] = e.isIntersecting ? e.intersectionRatio : 0; });
var best = null, top = 0;
targets.forEach(function (t) {
if (t && (seen[t.id] || 0) > top) { top = seen[t.id]; best = t.id; }
});
links.forEach(function (a) { a.classList.toggle('on', best !== null && a.getAttribute('href') === '#' + best); });
}, { rootMargin: '-150px 0px -55% 0px', threshold: [0, 0.15, 0.4, 0.75, 1] });
targets.forEach(function (t) { if (t) io.observe(t); });
}
// 오늘 날씨. Open-Meteo, 키 없음. 실패하면 블록을 숨긴 채 둔다.
// 문구는 이 페이지의 목록에만 연결한다. 무엇을 해도 되는지는 의학 판단이라 말하지 않는다.
(function () {
var WMO = {
0: 'Clear sky', 1: 'Mainly clear', 2: 'Partly cloudy', 3: 'Overcast',
45: 'Fog', 48: 'Rime fog', 51: 'Light drizzle', 53: 'Drizzle', 55: 'Dense drizzle',
56: 'Freezing drizzle', 57: 'Freezing drizzle', 61: 'Light rain', 63: 'Rain', 65: 'Heavy rain',
66: 'Freezing rain', 67: 'Freezing rain', 71: 'Light snow', 73: 'Snow', 75: 'Heavy snow',
77: 'Snow grains', 80: 'Light showers', 81: 'Showers', 82: 'Violent showers',
85: 'Snow showers', 86: 'Snow showers', 95: 'Thunderstorm', 96: 'Thunderstorm with hail', 99: 'Thunderstorm with hail'
};
var WET = [51,53,55,56,57,61,63,65,66,67,71,73,75,77,80,81,82,85,86,95,96,99];
var LAT = WX_LAT, LNG = WX_LNG;
if (!LAT || !LNG) return; // 기준 좌표가 없으면(확인 대기) 날씨도 띄우지 않는다
fetch('https://api.open-meteo.com/v1/forecast?latitude=' + LAT + '&longitude=' + LNG +
'&current=temperature_2m,apparent_temperature,weather_code,wind_speed_10m&timezone=auto')
.then(function (r) { if (!r.ok) throw 0; return r.json(); })
.then(function (j) {
var c = j.current; if (!c || c.temperature_2m == null) throw 0;
var code = c.weather_code;
document.getElementById('wx-t').textContent = Math.round(c.temperature_2m);
document.getElementById('wx-c').textContent = WMO[code] || 'Current conditions';
document.getElementById('wx-m').textContent =
'Feels like ' + Math.round(c.apparent_temperature) + '°C · wind ' +
Math.round(c.wind_speed_10m) + ' km/h · observed ' + String(c.time).replace('T', ' ');
document.getElementById('wx-n').textContent = WET.indexOf(code) >= 0
? 'Wet outside. The Culture and Shopping listings below are indoors.'
: (c.temperature_2m >= 30
? 'Hot today. The Culture and Shopping listings below are indoors.'
: (c.temperature_2m <= 0
? 'Below freezing. The Culture and Shopping listings below are indoors.'
: 'Dry at the moment. The walking times below are on foot from the clinic.'));
document.getElementById('weather').hidden = false;
})
.catch(function () { /* 못 받으면 숨긴 채 둔다 */ });
})();
// 회복 일정 플래너에서 고른 체류 기간과 겹치는 행사를 먼저 보여 준다.
// 기간은 플래너 링크의 URL 해시(#plan:YYYY-MM-DD..YYYY-MM-DD) 또는 이 기기의 localStorage 에서만 읽는다. 서버로 보내지 않는다.
// 기간이 없거나 겹치는 행사가 없으면 화면은 계절 묶음 그대로다.
(function () {
var sec = document.getElementById('festivals'); if (!sec) return;
var chips = Array.prototype.slice.call(sec.querySelectorAll('.chip'));
var cards = Array.prototype.slice.call(sec.querySelectorAll('.card'));
var planChip = sec.querySelector('.chip[data-season="plan"]');
var note = sec.querySelector('[data-plan-note]');
function apply(want) {
chips.forEach(function (x) { x.classList.toggle('on', x.dataset.season === want); });
cards.forEach(function (card) {
card.hidden = !(want === 'all' || (want === 'plan' ? card.dataset.inplan === '1' : card.dataset.season === want));
});
}
chips.forEach(function (c) { c.addEventListener('click', function () { apply(c.dataset.season); }); });
var ISO = /^\d{4}-\d{2}-\d{2}$/;
function readPeriod() {
var m = /plan:(\d{4}-\d{2}-\d{2})\.\.(\d{4}-\d{2}-\d{2})/.exec(location.hash);
if (m && m[1] <= m[2]) return { from: m[1], to: m[2], fromHash: true };
try {
var p = JSON.parse(localStorage.getItem('infinith.stay.period') || 'null');
if (p && ISO.test(p.from) && ISO.test(p.to) && p.from <= p.to) return { from: p.from, to: p.to, fromHash: false };
} catch (e) { /* 저장소를 못 쓰는 브라우저 */ }
return null;
}
var period = readPeriod();
if (!period || !planChip || !note) return;
var iso = function (d) { return d && d.length === 8 ? d.slice(0, 4) + '-' + d.slice(4, 6) + '-' + d.slice(6, 8) : ''; };
var hits = cards.filter(function (card) {
var s = iso(card.dataset.start), e = iso(card.dataset.end);
var ok = Boolean(s && e && s <= period.to && e >= period.from);
card.dataset.inplan = ok ? '1' : '0';
return ok;
});
var fmt = function (d) { return new Date(d + 'T00:00:00Z').toLocaleDateString('en', { month: 'short', day: 'numeric', timeZone: 'UTC' }); };
if (!hits.length) { note.textContent = 'No events overlap the stay you chose in the recovery planner (' + fmt(period.from) + ' to ' + fmt(period.to) + '). Showing all events by season.'; note.hidden = false; return; }
// 기간이 짧은 행사가 먼저다. 1년 내내 열리는 상시 행사는 체류 기간과 늘 겹치므로 뒤로 보내고 '상시'로 표시한다.
var LONG = 90;
var days = function (card) { var s = iso(card.dataset.start), e = iso(card.dataset.end); return s && e ? Math.round((Date.parse(e + 'T00:00:00Z') - Date.parse(s + 'T00:00:00Z')) / 86400000) + 1 : 9999; };
hits.sort(function (a, b) { return (days(a) > LONG) - (days(b) > LONG) || days(a) - days(b) || (+a.dataset.km || 0) - (+b.dataset.km || 0); });
var grid = sec.querySelector('.cards.fest');
hits.forEach(function (card) {
card.classList.add('in-plan');
var tag = document.createElement('span'); tag.className = 'badge plan'; tag.textContent = days(card) > LONG ? 'Year-round' : 'Your stay';
card.querySelector('.thumb').appendChild(tag);
grid.appendChild(card); // 겹치는 카드를 가까운 순으로 뒤에 다시 붙인 뒤,
});
hits.slice().reverse().forEach(function (card) { grid.insertBefore(card, grid.firstChild); }); // 그 순서 그대로 맨 앞으로 (짧은 행사 → 상시 행사 → 나머지)
planChip.querySelector('b').textContent = String(hits.length);
planChip.hidden = false;
note.textContent = 'Showing ' + hits.length + ' events that overlap the stay you chose in the recovery planner (' + fmt(period.from) + ' to ' + fmt(period.to) + '). Short-run events come first; year-round ones are listed after them.';
note.hidden = false;
apply('plan');
if (period.fromHash) sec.scrollIntoView();
})();
})();
</script>
</Base>