"use strict"; (function () { const ui = { version: "1.0.0", ready: true, openModal(id) { const node = document.getElementById(id); if (node) node.classList.add("active"); document.body.style.overflow = "hidden"; }, closeModal(id) { const node = document.getElementById(id); if (node) node.classList.remove("active"); document.body.style.overflow = ""; }, closeOnOverlay(event) { if (event.target.classList.contains("modal-overlay")) { event.target.classList.remove("active"); document.body.style.overflow = ""; } }, openComingSoon(section) { const title = document.getElementById("coming-soon-title"); const text = document.getElementById("coming-soon-text"); const presets = { business: { title: "Финансы бизнеса", text: "Этот раздел уже в работе. Скоро здесь появятся анализ вашего бизнеса с графиками, статистикой за 6 месяцев, выручка, прибыль, расходы по периодам и понятная сводка по бизнесу.", }, competitors: { title: "Анализ конкурентов", text: "Этот раздел сейчас создается. Скоро здесь можно будет смотреть ваших конкурентов в вашем городе, замечать изменения в цене, акциях и получать рекомендации от нас, чтобы находить новые идеи для усиления своих кампаний.", }, }; const meta = presets[section] || { title: "Раздел в разработке", text: "Извините, этот раздел сейчас создается. Мы уже готовим для него полезный сценарий, чтобы он не был просто красивой заглушкой.", }; if (title) title.textContent = meta.title; if (text) text.textContent = meta.text; this.openModal("coming-soon-modal"); }, bindComingSoonButtons() { const pairs = [ ]; pairs.forEach(([id, section]) => { const node = document.getElementById(id); if (!node || node.dataset.comingSoonBound === "1") return; node.dataset.comingSoonBound = "1"; node.addEventListener("click", () => this.openComingSoon(section)); }); }, bindModalOverlays() { document.querySelectorAll(".modal-overlay").forEach((node) => { if (node.dataset.modalBound === "1") return; node.dataset.modalBound = "1"; node.addEventListener("click", (event) => this.closeOnOverlay(event)); }); }, initSidebarNavigation() { document.querySelectorAll(".sidebar-item[data-target]").forEach((item) => { if (item.dataset.uiBound === "1") return; item.dataset.uiBound = "1"; item.addEventListener("click", () => { document.querySelectorAll(".sidebar-item[data-target]").forEach((node) => node.classList.remove("active")); item.classList.add("active"); const target = document.getElementById(item.dataset.target); if (target) target.scrollIntoView({ behavior: "smooth", block: "start" }); }); }); }, initRevealCards() { if (window.__yaCabinetObserverReady) return; window.__yaCabinetObserverReady = true; const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add("opacity-100", "translate-y-0"); entry.target.classList.remove("opacity-0", "translate-y-6"); } }); }, { threshold: 0.08 }); document.querySelectorAll(".glass-card").forEach((element) => { if (!element.dataset.revealReady) { element.dataset.revealReady = "1"; element.classList.add("opacity-0", "translate-y-6", "transition-all", "duration-700"); observer.observe(element); } }); }, init() { window.openModal = (id) => this.openModal(id); window.closeModal = (id) => this.closeModal(id); this.initSidebarNavigation(); this.initRevealCards(); this.bindModalOverlays(); this.bindComingSoonButtons(); }, }; if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", () => ui.init(), { once: true }); } else { ui.init(); } window.YAStatsCabinet = window.YAStatsCabinet || {}; window.YAStatsCabinet.ui = ui; })();