import{q as g,n as e}from"./vendor-react-Br0ZiotI.js";import{b$ as h,cc as k,bN as f,bY as l,bP as m,ck as y,P as j}from"./index-B-EDPu3R.js";import{u as p}from"./vendor-i18n-C54Hc0CQ.js";import{S as v}from"./shield-8sDW6zP8.js";import{C as N}from"./chart-no-axes-column-NppO3vuI.js";import{M as w}from"./megaphone-CEwrfYpu.js";import"./vendor-query-9i1Av1pr.js";import"./vendor-dayjs-BcsA502E.js";import"./vendor-antd-core-CbYNMZQB.js";import"./vendor-sentry-Cx26FE6p.js";/**
* @license lucide-react v1.16.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C=[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]],S=h("cookie",C),_=({checked:t,disabled:n,onChange:o,id:a,label:r})=>e.jsx("button",{type:"button",id:a,role:"switch","aria-checked":t,"aria-label":r,disabled:n,onClick:()=>o==null?void 0:o(!t),className:["relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",n?"cursor-not-allowed opacity-60":"cursor-pointer",t?"bg-primary":"bg-gray-200"].join(" "),children:e.jsx("span",{className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-200",t?"translate-x-5":"translate-x-0"].join(" ")})}),x=({icon:t,title:n,description:o,always:a,checked:r,onChange:d,id:c,expanded:s,onToggleExpand:i,details:u})=>{const{t:b}=p();return e.jsxs("div",{className:"border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-bg-subtle",children:[e.jsx(t,{className:"h-4 w-4 text-primary shrink-0"}),e.jsxs("button",{type:"button",className:"flex-1 flex items-center justify-between gap-2 text-left",onClick:i,children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-semibold text-text",children:n}),a&&e.jsx("span",{className:"ml-2 text-xs text-text-muted bg-bg px-1.5 py-0.5 rounded border border-border",children:b("consent.alwaysOn","Всегда включены")}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:o})]}),e.jsx(j,{className:["h-4 w-4 text-text-muted shrink-0 transition-transform duration-200",s?"rotate-180":""].join(" ")})]}),e.jsx(_,{id:c,label:n,checked:r,disabled:a,onChange:d})]}),s&&e.jsx("div",{className:"px-4 py-3 text-xs text-text-muted border-t border-border bg-bg",children:u})]})};function L(){const{t}=p(),[n,o]=g.useState(()=>({decision:k(),detailsOpen:!1,analytics:!0,marketing:!0,expandedSection:null}));if(n.decision!=="unknown")return null;const a=()=>{m({analytics:!0,marketing:!0}),l("cookie_consent_decision",{decision:"accepted_all"}),o(s=>({...s,decision:"accepted"}))},r=()=>{y(),l("cookie_consent_decision",{decision:"rejected"}),o(s=>({...s,decision:"rejected"}))},d=()=>{m({analytics:n.analytics,marketing:n.marketing}),l("cookie_consent_decision",{decision:"granular",analytics:n.analytics,marketing:n.marketing}),o(s=>({...s,decision:"accepted"}))},c=s=>o(i=>({...i,expandedSection:i.expandedSection===s?null:s}));return e.jsx("div",{className:"fixed z-[9999] inset-x-0 bottom-0 p-3 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:p-0",role:"dialog","aria-label":t("consent.dialogAria","Настройки cookies"),"data-testid":"cookie-consent-banner",children:e.jsxs("div",{className:"relative w-full sm:max-w-sm bg-bg rounded-2xl shadow-xl border border-border flex flex-col max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-4 pt-4 pb-2 shrink-0",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(S,{className:"h-4 w-4 text-primary"})}),e.jsx("h2",{className:"flex-1 text-sm font-semibold text-text leading-snug",children:t("consent.title","Cookies Рё аналитика")}),e.jsx("button",{type:"button",onClick:r,"data-testid":"cookie-consent-close","aria-label":t("consent.close","Закрыть"),className:"p-1 rounded-lg text-text-muted hover:text-text hover:bg-bg-subtle transition-colors",children:e.jsx(f,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 px-4 pb-1 space-y-3",children:[e.jsxs("p",{className:"text-xs text-text-muted leading-relaxed",children:[t("consent.lead","Рспользуем cookies для работы сайта Рё аналитики.")," ",e.jsx("a",{href:"/privacy",className:"text-primary underline underline-offset-2",onClick:()=>l("cookie_consent_policy_clicked"),children:t("consent.policyLink","политикой конфиденциальности")}),"."]}),n.detailsOpen&&e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsx(x,{icon:v,id:"cookie-functional",title:t("consent.categories.functional.title","Необходимые"),description:t("consent.categories.functional.desc","Обеспечивают базовую работу сайта"),always:!0,checked:!0,expanded:n.expandedSection==="functional",onToggleExpand:()=>c("functional"),details:t("consent.categories.functional.details","Сессия авторизации, выбранный язык, данные РєРѕСЂР·РёРЅС‹ калькулятора. Без этих cookies сайт РЅРµ будет работать корректно. Хранятся РЅР° время сессии или РґРѕ 1 РіРѕРґР°.")}),e.jsx(x,{icon:N,id:"cookie-analytics",title:t("consent.categories.analytics.title","Аналитика"),description:t("consent.categories.analytics.desc","Анонимная статистика для улучшения продукта"),checked:n.analytics,onChange:s=>o(i=>({...i,analytics:s})),expanded:n.expandedSection==="analytics",onToggleExpand:()=>c("analytics"),details:t("consent.categories.analytics.details","PostHog — анализ поведения пользователей: популярные маршруты, РІРѕСЂРѕРЅРєРё, ошибки. Данные анонимизированы, РЅРµ передаются третьим лицам. РЎСЂРѕРє хранения — 12 месяцев.")}),e.jsx(x,{icon:w,id:"cookie-marketing",title:t("consent.categories.marketing.title","Маркетинг"),description:t("consent.categories.marketing.desc","Ретаргетинг Рё A/B-тесты"),checked:n.marketing,onChange:s=>o(i=>({...i,marketing:s})),expanded:n.expandedSection==="marketing",onToggleExpand:()=>c("marketing"),details:t("consent.categories.marketing.details","Рспользуются для показа релевантной рекламы Рё проведения A/B-тестов интерфейса. РќРµ отправляем данные рекламным сетям без вашего СЏРІРЅРѕРіРѕ согласия.")})]})]}),e.jsxs("div",{className:"px-4 py-3 shrink-0 space-y-2",children:[e.jsx("button",{type:"button",onClick:a,"data-testid":"cookie-consent-accept-btn",className:"w-full h-9 rounded-lg bg-primary text-white font-semibold text-sm hover:bg-primary-dark transition-colors",children:t("consent.acceptAll","Принять РІСЃРµ cookies")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:r,"data-testid":"cookie-consent-reject-btn",className:"flex-1 h-9 rounded-lg border border-border text-sm font-medium text-text hover:bg-bg-subtle transition-colors",children:t("consent.rejectAll","Только необходимые")}),n.detailsOpen?e.jsx("button",{type:"button",onClick:d,"data-testid":"cookie-consent-save-btn",className:"flex-1 h-9 rounded-lg border border-primary text-primary text-sm font-medium hover:bg-primary/5 transition-colors",children:t("consent.save","Сохранить выбор")}):e.jsx("button",{type:"button",onClick:()=>o(s=>({...s,detailsOpen:!0})),"data-testid":"cookie-consent-details-btn",className:"flex-1 h-9 rounded-lg border border-border text-sm font-medium text-text-muted hover:bg-bg-subtle transition-colors",children:t("consent.settings","Настройки")})]})]})]})})}export{L as default};