// data.jsx — domain data + premium estimation logic. Shared to window. const INDUSTRIES = [ { id: "food", name: "음식점", icon: "food", rate: 420 }, { id: "cafe", name: "카페", icon: "cafe", rate: 320 }, { id: "store", name: "판매점·소매", icon: "store", rate: 280 }, { id: "office", name: "사무실", icon: "office", rate: 190 }, { id: "academy", name: "학원·교습소", icon: "academy", rate: 230 }, { id: "beauty", name: "미용실", icon: "beauty", rate: 260 }, { id: "mart", name: "마트·편의점", icon: "mart", rate: 300 }, { id: "etc", name: "기타 업종", icon: "dots", rate: 300 }, ]; const PYEONG_TO_M2 = 3.305785; const BASE_MONTHLY = 9000; const REGIONS = ["서울 마포구", "경기 성남시", "부산 해운대구", "인천 남동구", "대구 수성구", "서울 강서구", "광주 서구"]; const won = (n) => "₩" + Math.round(n).toLocaleString("ko-KR"); const wonPlain = (n) => Math.round(n).toLocaleString("ko-KR") + "원"; // deterministic pseudo-random from a seed string function seeded(seed) { let h = 2166136261; for (let i = 0; i < seed.length; i++) { h ^= seed.charCodeAt(i); h = Math.imul(h, 16777619); } return ((h >>> 0) % 1000) / 1000; } // limit (보장한도) tier by area function coverageLimit(m2) { if (m2 < 50) return { fire: "5천만원", liab: "1억원" }; if (m2 < 100) return { fire: "1억원", liab: "2억원" }; if (m2 < 200) return { fire: "2억원", liab: "3억원" }; return { fire: "3억원", liab: "5억원" }; } // main estimator function estimateFire(industryId, pyeong) { const ind = INDUSTRIES.find((i) => i.id === industryId) || INDUSTRIES[0]; const m2 = pyeong * PYEONG_TO_M2; let monthly = BASE_MONTHLY + m2 * ind.rate; monthly = Math.round(monthly / 100) * 100; const yearly = Math.round((monthly * 12 * 0.96) / 1000) * 1000; // 연납 할인 반영 const cov = coverageLimit(m2); // similar (anonymized) contract — 1건 const r = seeded(industryId + "-" + pyeong); const region = REGIONS[Math.floor(r * REGIONS.length)]; const simPyeong = Math.max(8, Math.round(pyeong + (r - 0.5) * 8)); const simMonthly = Math.round((monthly * (0.92 + r * 0.14)) / 100) * 100; const months = 3 + Math.floor(r * 9); // 가입 경과(개월) return { industry: ind, pyeong, m2, monthly, yearly, coverage: cov, similar: { region, industryName: ind.name, pyeong: simPyeong, monthly: simMonthly, coverage: cov, months }, }; } Object.assign(window, { INDUSTRIES, PYEONG_TO_M2, REGIONS, won, wonPlain, estimateFire });