PageSourceSearch

https://markethacker.ru/assets/clusters-B0I0Nnx5.js

js markethacker.ru collected 2026-10-02 02:07:18 UTC 64,444 bytes, 1 lines download raw bytes

1import{k as X,h as u,m as e,L as oe,F as Ge,G as Ke,H as Ne,T as ke,B as pe,I as Ve,w as Te,z as he,v as Qe,X as me,q as $e,A as Me,E as Ye,y as le,D as Je}from"./index-BhuuQD9y.js";import{W as Xe}from"./wallet-sO7ZU_x5.js";import{P as Ze}from"./play-D2Qj2RI3.js";import{C as et}from"./copy-B4a-LAwQ.js";import{C as ve}from"./check-DVd4CU5_.js";import{L as tt}from"./loader-circle-CVxTpzp4.js";import{C as we}from"./chevron-left-ai0KuTWj.js";const st=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],Ae=X("archive-restore",st);const at=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Ce=X("archive",at);const lt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],rt=X("circle-alert",lt);const ct=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],Se=X("radar",ct);const dt=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]],Ee=X("sticky-note",dt),H=s=>({excluded:!1,listIds:[],cpm:0,cpmAvg:0,freq:0,posAd:0,posTotal:0,posOrganic:0,posBoosted:0,posDelta:0,note:"",bestPlaceCR:"—",segments:"—",rating:0,ctr:0,cpc:0,impressionsAd:0,clicksTotal:0,clicksAd:0,clicksAdShare:0,spend:0,spendShare:0,ordersTotal:0,ordersAd:0,organicShare:0,crTotal:0,crAd:0,drrTotal:0,drrAd:0,cpoTotal:0,cpoAd:0,...s}),nt=[H({id:"c1",name:"Омега-3 1000мг",phrases:12,status:"active",listIds:["l1"],cpm:410,cpmAvg:386,freq:142450,posAd:6.4,posTotal:9.2,posOrganic:12,posBoosted:5,posDelta:3,posCheckedAt:"10 мин назад",note:"Главный кластер. Удерживать топ-5.",bestPlaceCR:"поз. 4",segments:"890–1290 ₽",rating:92,ctr:4.12,cpc:18,impressionsAd:184320,clicksTotal:11240,clicksAd:7596,clicksAdShare:67.6,spend:136728,spendShare:38.2,ordersTotal:624,ordersAd:412,organicShare:34,crTotal:.34,crAd:5.42,drrTotal:18.4,drrAd:22.1,cpoTotal:219,cpoAd:331}),H({id:"c2",name:"Рыбий жир капсулы",phrases:8,status:"active",listIds:["l1","l2"],cpm:320,cpmAvg:305,freq:88120,posAd:11,posTotal:14.6,posOrganic:18,posBoosted:9,posDelta:-2,posCheckedAt:"2 ч назад",bestPlaceCR:"поз. 7",segments:"490–890 ₽",rating:78,ctr:3.18,cpc:14,impressionsAd:96400,clicksTotal:6210,clicksAd:3066,clicksAdShare:49.4,spend:42920,spendShare:16.4,ordersTotal:312,ordersAd:182,organicShare:41.7,crTotal:.32,crAd:5.94,drrTotal:14.2,drrAd:19.8,cpoTotal:138,cpoAd:236}),H({id:"c3",name:"Витамин Д3",phrases:22,status:"paused",listIds:[],cpm:0,cpmAvg:0,freq:224800,posAd:0,posTotal:7.4,posOrganic:4,posBoosted:4,posDelta:0,posCheckedAt:"вчера",note:"Только органика — РК выключена.",bestPlaceCR:"поз. 3",segments:"390–690 ₽",rating:88,ctr:5.1,cpc:0,impressionsAd:0,clicksTotal:4820,clicksAd:0,clicksAdShare:0,spend:0,spendShare:0,ordersTotal:421,ordersAd:0,organicShare:100,crTotal:.51,crAd:0,drrTotal:0,drrAd:0,cpoTotal:0,cpoAd:0}),H({id:"c4",name:"Магний В6",phrases:5,status:"draft",listIds:[],cpm:0,cpmAvg:0,freq:31e3,posAd:0,posTotal:0,posOrganic:0,posBoosted:0,posDelta:0,bestPlaceCR:"—",segments:"—",rating:0}),H({id:"c5",name:"Коллаген морской",phrases:14,status:"active",listIds:["l2"],cpm:520,cpmAvg:498,freq:186400,posAd:5.8,posTotal:8.2,posOrganic:14,posBoosted:6,posDelta:4,posCheckedAt:"1 ч назад",bestPlaceCR:"поз. 5",segments:"1190–1890 ₽",rating:84,ctr:3.8,cpc:22,impressionsAd:248120,clicksTotal:14920,clicksAd:9426,clicksAdShare:63.2,spend:207372,spendShare:44.6,ordersTotal:512,ordersAd:384,organicShare:25,crTotal:.34,crAd:4.07,drrTotal:24.1,drrAd:28.4,cpoTotal:405,cpoAd:540}),H({id:"c6",name:"Цинк пиколинат",phrases:9,status:"active",listIds:["l1"],cpm:280,cpmAvg:271,freq:94200,posAd:14.1,posTotal:16.8,posOrganic:19,posBoosted:12,posDelta:-1,posCheckedAt:"30 мин назад",bestPlaceCR:"поз. 9",segments:"390–590 ₽",rating:71,ctr:2.84,cpc:11,impressionsAd:78200,clicksTotal:4480,clicksAd:2222,clicksAdShare:49.6,spend:24442,spendShare:9.8,ordersTotal:218,ordersAd:114,organicShare:47.7,crTotal:.49,crAd:5.13,drrTotal:11.2,drrAd:16.4,cpoTotal:112,cpoAd:214})],ot=[{id:"l1",name:"Масштабирую",color:"#15803d",bg
1:"#dcfce7"},{id:"l2",name:"Высокая маржа",color:"#1d4ed8",bg:"#dbeafe"}],se=[{color:"#15803d",bg:"#dcfce7"},{color:"#1d4ed8",bg:"#dbeafe"},{color:"#a16207",bg:"#fef3c7"},{color:"#b91c1c",bg:"#fee2e2"},{color:"#7c3aed",bg:"#ede9fe"},{color:"#be185d",bg:"#fce7f3"}],ie={active:{dot:"bg-[#22c55e]",label:"Активна"},paused:{dot:"bg-[#f59e0b]",label:"На паузе"},draft:{dot:"bg-[#9c8cbc]",label:"Черновик"}},w=(s,r=0)=>s.toLocaleString("ru-RU",{minimumFractionDigits:r,maximumFractionDigits:r}),M=s=>`${w(s,s%1===0?0:2)}%`,_=s=>`${w(s)} ₽`;function U({values:s,color:r="#8A2BE2",label:i="значение",fmtFn:k}){const n=Math.max(...s,1),[x,h]=u.useState(null),y=k??(A=>w(A)),o=A=>A===s.length-1?"сегодня":`−${s.length-1-A} д.`;return e.jsxs("div",{className:"relative inline-block",onMouseLeave:()=>h(null),children:[e.jsx("div",{className:"flex h-6 items-end gap-[2px]",children:s.map((A,a)=>e.jsx("div",{onMouseEnter:()=>h(a),className:"w-[3px] cursor-pointer rounded-sm transition-opacity",style:{height:`${A/n*100}%`,background:r,opacity:x===null?.45+a/s.length*.55:x===a?1:.25}},a))}),x!==null&&e.jsxs("div",{className:"pointer-events-none absolute -top-9 left-1/2 z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#e2d8f5] bg-white px-2 py-1 text-[10px] font-medium text-[#2a1b4a] shadow-md",children:[e.jsxs("div",{className:"text-[9px] uppercase tracking-wide text-[#9c8cbc]",children:[i," · ",o(x)]}),e.jsx("div",{className:"tabular-nums",style:{color:r},children:y(s[x])})]})]})}function j({children:s,align:r="right",pro:i=!1,className:k=""}){const n=r==="right"?"text-right":r==="center"?"text-center":"text-left";return e.jsx("th",{className:`px-2 py-2 ${n} ${k}`,children:e.jsxs("div",{className:`flex items-center gap-1 ${r==="right"?"justify-end":r==="center"?"justify-center":""}`,children:[e.jsx("span",{children:s}),i&&e.jsx("span",{title:"Доступны при подписке Джем WB",className:"inline-block h-1.5 w-1.5 rounded-full bg-[#c8ff00] ring-1 ring-[#8A2BE2] cursor-help"})]})})}function it({value:s,onChange:r}){const[i,k]=u.useState(!1),[n,x]=u.useState(String(s||"")),h=u.useRef(null);u.useEffect(()=>{i&&h.current?.focus()},[i]);const y=()=>{const o=Number(n);Number.isNaN(o)||r(o),k(!1)};return i?e.jsx("input",{ref:h,type:"number",value:n,onChange:o=>x(o.target.value),onBlur:y,onKeyDown:o=>{o.key==="Enter"&&y(),o.key==="Escape"&&(x(String(s||"")),k(!1))},className:"w-20 rounded border border-[#8A2BE2] bg-white px-1.5 py-0.5 text-right text-[11px] font-semibold text-[#2a1b4a] outline-none"}):e.jsxs("button",{onClick:()=>{x(String(s||"")),k(!0)},className:"group inline-flex items-center gap-1 rounded bg-[#fce7f3] px-1.5 py-0.5 font-semibold text-[#be185d] hover:bg-[#fbcfe8]",title:"Кликните чтобы изменить",children:[s?w(s):"—",e.jsx($e,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-70"})]})}function K({title:s,subtitle:r,right:i,defaultOpen:k=!0,accent:n="#8A2BE2",icon:x,children:h}){const[y,o]=u.useState(k);return e.jsxs("section",{className:"overflow-hidden rounded-xl border border-[#e2d8f5] bg-white shadow-sm",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-[#f0eaff] bg-[#faf8ff] px-3 py-2",children:[e.jsx("button",{onClick:()=>o(A=>!A),className:"grid h-6 w-6 place-items-center rounded text-[#9c8cbc] hover:bg-white hover:text-[#8A2BE2]",title:y?"Свернуть":"Развернуть",children:y?e.jsx(Te,{className:"h-4 w-4"}):e.jsx(he,{className:"h-4 w-4"})}),x,e.jsxs("button",{onClick:()=>o(A=>!A),className:"flex flex-1 items-center gap-2 text-left",children:[e.jsx("h3",{className:"text-xs font-bold",style:{color:n},children:s}),r&&e.jsx("span",{className:"text-[10px] text-[#9c8cbc]",children:r})]}),i&&e.jsx("div",{onClick:A=>A.stopPropagation(),children:i})]}),y&&e.jsx("div",{children:h})]})}function Ct(){const[s,r]=u.useState(nt),[i,k]=u.useState(ot),[n,x]=u.useState(new Set),[h,y]=u.useState(new Set(["c1"])),[o,A]=u.useState("all"),[a,c]=u.useState("all"),[g,b]=u.useState("active"),[C,O]=u.useState(""),[T,E]=u.useState(null),[B,P]=u.useState(""),[F,d]=u.useState(!1),[p,S]=u.useState(""),[D,q]=u.useState(0),[v,Z]=u.useState(null),[ee,ce]=u.useState([{id:"n1",text:"Удерживаем топ-5 по кластеру «Омега-3 1000мг» до Ð
1ºÐ¾Ð½Ñ†Ð° недели. Бюджет +20%.",author:"Анна",createdAt:"вчера, 18:42"},{id:"n2",text:"После повышения CPM до 410 — следить за DRR. Если выше 25% — откатить.",author:"Анна",createdAt:"сегодня, 09:15"}]),[de,te]=u.useState(""),[Q,ne]=u.useState(null),De=()=>{const t=de.trim();if(t){if(Q)ce(l=>l.map(f=>f.id===Q?{...f,text:t}:f)),ne(null);else{const l=new Date,f=`сегодня, ${String(l.getHours()).padStart(2,"0")}:${String(l.getMinutes()).padStart(2,"0")}`;ce($=>[{id:`n${Date.now()}`,text:t,author:"Вы",createdAt:f},...$])}te("")}},Oe=t=>ce(l=>l.filter(f=>f.id!==t)),Pe=t=>{ne(t.id),te(t.text)},I=u.useMemo(()=>s.filter(t=>!(g==="active"&&t.excluded||g==="excluded"&&!t.excluded||o!=="all"&&t.status!==o||a!=="all"&&!t.listIds.includes(a)||C&&!t.name.toLowerCase().includes(C.toLowerCase()))),[s,o,a,C,g]),fe=I.length>0&&I.every(t=>n.has(t.id)),_e=()=>{const t=new Set(n);fe?I.forEach(l=>t.delete(l.id)):I.forEach(l=>t.add(l.id)),x(t)},Re=t=>{const l=new Set(n);l.has(t)?l.delete(t):l.add(t),x(l)},Ie=t=>{const l=new Set(h);l.has(t)?l.delete(t):l.add(t),y(l)},Le=()=>{r(t=>t.map(l=>n.has(l.id)?T==="cpm"?{...l,cpm:Number(B)||l.cpm}:T==="status"?{...l,status:B||l.status}:T==="list"?{...l,listIds:l.listIds.includes(B)?l.listIds.filter(f=>f!==B):[...l.listIds,B]}:l:l)),E(null),P("")},ze=(t,l)=>r(f=>f.map($=>$.id===t?{...$,cpm:l}:$)),be=t=>r(l=>l.map(f=>t.includes(f.id)?{...f,excluded:!0,status:"paused"}:f)),ue=t=>r(l=>l.map(f=>t.includes(f.id)?{...f,excluded:!1}:f)),L=20,Fe=()=>{const t=[...n].slice(0,L);t.length!==0&&Z({ids:t,done:0,running:!0})};u.useEffect(()=>{if(!v||!v.running)return;if(v.done>=v.ids.length){Z(l=>l&&{...l,running:!1});return}const t=setTimeout(()=>{const l=v.ids[v.done];r(f=>f.map($=>{if($.id!==l)return $;const N=Math.max(1,($.posBoosted||8)+(Math.random()>.5?-1:1)),He=Math.max(N+1,($.posOrganic||N+6)+(Math.random()>.5?-1:1)),Ue=($.posBoosted||0)-N;return{...$,posBoosted:N,posOrganic:He,posDelta:Ue,posCheckedAt:"только что"}})),Z(f=>f&&{...f,done:f.done+1})},220);return()=>clearTimeout(t)},[v]);const ge=()=>{if(!p.trim())return;const t=se[D%se.length];k(l=>[...l,{id:`l${Date.now()}`,name:p.trim(),...t}]),S(""),q((D+1)%se.length)},qe=t=>{k(l=>l.filter(f=>f.id!==t)),r(l=>l.map(f=>({...f,listIds:f.listIds.filter($=>$!==t)}))),a===t&&c("all")},We=t=>i.find(l=>l.id===t),W=n.size,je=u.useMemo(()=>I.reduce((t,l)=>({spend:t.spend+l.spend,clicks:t.clicks+l.clicksAd,ordersAd:t.ordersAd+l.ordersAd,ordersTotal:t.ordersTotal+l.ordersTotal}),{spend:0,clicks:0,ordersAd:0,ordersTotal:0}),[I]),ye=s.filter(t=>t.excluded).length;return e.jsxs("div",{className:"min-h-screen bg-[#f6f5fb] text-[#2a1b4a]",children:[e.jsx("header",{className:"border-b border-black/5 bg-white",children:e.jsxs("div",{className:"mx-auto flex max-w-[1640px] items-center gap-4 px-6 py-3",children:[e.jsx(oe,{to:"/",className:"text-lg font-extrabold tracking-tight text-[#8A2BE2]",children:"MarketHacker"}),e.jsxs("nav",{className:"ml-4 flex items-center gap-1 text-sm",children:[e.jsx("span",{className:"rounded-md bg-[#f3eeff] px-3 py-1.5 font-semibold text-[#8A2BE2]",children:"Кластеры и РК"}),e.jsx(oe,{to:"/wb-search",className:"rounded-md px-3 py-1.5 text-[#6b5a8a] hover:bg-[#faf8ff]",children:"Расширение"}),e.jsx(oe,{to:"/seller-funnel",className:"rounded-md px-3 py-1.5 text-[#6b5a8a] hover:bg-[#faf8ff]",children:"Воронка"})]}),e.jsx("div",{className:"ml-auto flex items-center gap-2",children:e.jsxs("span",{title:"Доступны при подписке Джем WB",className:"hidden items-center gap-1 rounded-md bg-[#f3eeff] px-2 py-1 text-[10px] font-semibold text-[#8A2BE2] md:inline-flex cursor-help",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#c8ff00] ring-1 ring-[#8A2BE2]"})," Pro-метрики включены"]})})]})}),e.jsx(Ge,{}),e.jsxs("main",{className:"mx-auto max-w-[1640px] space-y-3 px-6 py-4",children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold leading-tight",children:"Кластеры · РК «Омега-3 1000мг»"}),e.jsx("p",{className:"text-xs text-[#6b5a8a]",children:"Управление группами поисковых фраз, ставками и видимостью артикулов · артикул 376772886"})]}),e.jsxs("div",{className:"flex gap-4 text-[11px] text-[#6b5a8a]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-bold text-[#2a1b4a]",children:s.filter(t=>!t.excluded).length}),"В работе"]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-bold text-[#9c8cbc]",children:ye}),"Исключено"]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-bold text-[#2a1b4a]",children:_(je.spend)}),"Расход"]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-bold text-[#22c55e]",children:w(je.ordersAd)}
1),"Заказы рек."]})]})]}),e.jsx(K,{title:"Заметки к РК",subtitle:`${ee.length} ${ee.length===1?"запись":"записей"} · общие для всей кампании`,icon:e.jsx(Ee,{className:"h-3.5 w-3.5 text-[#a16207]"}),defaultOpen:!0,accent:"#a16207",children:e.jsxs("div",{className:"space-y-2 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{value:de,onChange:t=>te(t.target.value),placeholder:Q?"Изменить заметку…":"Добавить заметку к РК: что отслеживаем, какие гипотезы, что проверить позже…",className:"h-16 flex-1 resize-none rounded-lg border border-[#e2d8f5] bg-white px-3 py-2 text-xs outline-none focus:border-[#a16207]"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("button",{onClick:De,disabled:!de.trim(),className:"rounded-lg bg-[#a16207] px-3 py-2 text-xs font-semibold text-white hover:bg-[#854d0e] disabled:cursor-not-allowed disabled:opacity-40",children:Q?"Сохранить":"Добавить"}),Q&&e.jsx("button",{onClick:()=>{ne(null),te("")},className:"rounded-lg border border-[#e2d8f5] px-3 py-1 text-[11px] text-[#6b5a8a] hover:bg-[#faf8ff]",children:"Отмена"})]})]}),ee.length===0?e.jsx("p",{className:"rounded-lg border border-dashed border-[#e2d8f5] bg-[#faf8ff] px-3 py-3 text-center text-[11px] text-[#9c8cbc]",children:"Пока нет заметок. Первая появится здесь."}):e.jsx("ul",{className:"space-y-1.5",children:ee.map(t=>e.jsxs("li",{className:"group flex items-start gap-2 rounded-lg border border-[#fde68a] bg-[#fffbeb] px-3 py-2 text-[11px] text-[#78350f]",children:[e.jsx(Ee,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[#a16207]"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"leading-snug",children:t.text}),e.jsxs("div",{className:"mt-1 text-[10px] text-[#a16207]/70",children:[t.author," · ",t.createdAt]})]}),e.jsxs("div",{className:"flex shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx("button",{onClick:()=>Pe(t),className:"rounded px-1.5 py-0.5 text-[10px] font-medium text-[#a16207] hover:bg-[#fef3c7]",children:"Изменить"}),e.jsx("button",{onClick:()=>Oe(t.id),className:"rounded px-1.5 py-0.5 text-[10px] font-medium text-[#b91c1c] hover:bg-[#fee2e2]",children:"Удалить"})]})]},t.id))})]})}),e.jsx("div",{className:"flex items-center gap-1 border-b border-[#e2d8f5] text-xs",children:[{k:"active",label:"Ключевые",n:s.filter(t=>!t.excluded).length},{k:"excluded",label:"Исключённые",n:ye}].map(t=>e.jsxs("button",{onClick:()=>{b(t.k),x(new Set)},className:`-mb-px border-b-2 px-3 py-2 font-semibold transition ${g===t.k?"border-[#8A2BE2] text-[#8A2BE2]":"border-transparent text-[#6b5a8a] hover:text-[#2a1b4a]"}`,children:[t.label," ",e.jsx("span",{className:"ml-1 rounded bg-[#f3eeff] px-1.5 py-0.5 text-[10px] text-[#8A2BE2]",children:t.n})]},t.k))}),e.jsx(K,{title:"Фильтры и поиск",subtitle:"статусы, списки, сортировка",defaultOpen:!0,icon:e.jsx(Ne,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ke,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[#9c8cbc]"}),e.jsx("input",{value:C,onChange:t=>O(t.target.value),placeholder:"Найти кластер",className:"w-56 rounded-lg border border-[#e2d8f5] bg-white py-1.5 pl-7 pr-2 text-xs outline-none focus:border-[#8A2BE2]"})]}),e.jsx(Ne,{className:"h-4 w-4 text-[#9c8cbc]"}),e.jsxs("select",{value:o,onChange:t=>A(t.target.value),className:"rounded-lg border border-[#e2d8f5] bg-white px-2 py-1.5 text-xs text-[#2a1b4a]",children:[e.jsx("option",{value:"all",children:"Все статусы"}),e.jsx("option",{value:"active",children:"Активные"}),e.jsx("option",{value:"paused",children:"На паузе"}),e.jsx("option",{value:"draft",children:"Черновики"})]}),e.jsxs("select",{value:a,onChange:t=>c(t.target.value),className:"rounded-lg border border-[#e2d8f5] bg-white px-2 py-1.5 text-xs text-[#2a1b4a]",children:[e.jsx("option",{value:"all",children:"Все списки"}),i.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1 rounded-lg border border-dashed border-[#8A2BE2]/50 px-2 py-1.5 text-xs font-medium text-[#8A2BE2] hover:bg-[#f3eeff]",children:[e.jsx(ke,{className:"h-3 w-3"})," Управлять списками"]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1 text-xs text-[#6b5a8a]",children:[e.jsxs("button",{className:"flex items-center gap-1 rounded-md px-2 py-1 hover:bg-[#faf8ff]",children:[e.jsx(pe,{className:"h-3.5 w-3.5"})," Колонки"]}),e.jsxs("button",{className:"flex items-center gap-1 rounded-md px-2 py-1 hover:bg-[#faf8ff]",children:[e.jsx(Ve,{className:"h-3.5 w-3.5"})," Сортировка"]})]})]})}),W>0&&e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-[#8A2BE2]/30 bg-gradient-to-r from-[#f3eeff] to-[#faf8ff] px-3 py-2 text-xs",children:[e.jsxs("span",{className:"rounded-md bg-[#8A2BE2] px-2 py-1 text-[11px] font-bold text-white",children:[W," выбрано"]}),g==="active"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>E("cpm"),className:"flex items-center gap-1.5 rounded-md border border-[#e2d8f5] bg-white px-2.5 py-1.5 font-medium hover:bg-[#faf8ff]",children:[e.jsx(Xe,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," Изменить CPM"]}),e.jsxs("button",{onClick:()=>E("status"),className:"flex items-center gap-1.5 rounded-md border border-[#e2d8f5] bg-white px-2.5 py-1.5 font-medium hover:bg-[#faf8ff]",children:[e.jsx(Ze,{className:"h-3.5 w-3.5 text-[#22c55e]"})," Статус"]}),e.jsxs("button",{onClick:()=>E("list"),className:"flex items-center gap-1.5 rounded-md border border-[#e2d8f5] bg-white px-2.5 py-1.5 font-medium hover:bg-[#faf8ff]",children:[e.jsx(ke,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," В список"]}),e.jsxs("button",{onClick:Fe,disabled:W>L,title:W>L?`Не более ${L} кластеров за раз`:"Проверить текущие позиции",className:"flex items-center gap-1.5 rounded-md border border-[#e2d8f5] bg-white px-2.5 py-1.5 font-medium hover:bg-[#faf8ff] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Se,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," Проверить позиции",e.jsxs("span",{className:"rounded bg-[#f3eeff] px-1 text-[10px] text-[#8A2BE2]",children:[Math.min(W,L),"/",L]})]}),e.jsxs("button",{className:"flex items-center gap-1.5 rounded-md border border-[#e2d8f5] bg-white px-2.5 py-1.5 font-medium hover:bg-[#faf8ff]",children:[e.jsx(et,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," Дублировать"]}),e.jsxs("button",{onClick:()=>{be([...n]),x(new Set)},className:"ml-auto flex items-center gap-1.5 rounded-md border border-[#fecaca] bg-white px-2.5 py-1.5 font-medium text-[#b91c1c] hover:bg-[#fee2e2]",children:[e.jsx(Ce,{className:"h-3.5 w-3.5"})," Исключить"]})]}):e.jsxs("button",{onClick:()=>{ue([...n]),x(new Set)},className:"ml-auto flex items-center gap-1.5 rounded-md border border-[#bbf7d0] bg-white px-2.5 py-1.5 font-medium text-[#15803d] hover:bg-[#dcfce7]",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"})," Вернуть в ключевые"]}),e.jsx("button",{onClick:()=>x(new Set),className:"rounded-md px-2 py-1 font-medium text-[#6b5a8a] hover:bg-white",children:"Снять выделение"})]}),e.jsx(K,{title:"Кластеры",subtitle:`${I.length} строк · ${g==="active"?"ключевые":"исключённые"}`,icon:e.jsx(Qe,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),children:e.jsx("div",{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[2800px] text-[11px]",children:[e.jsx("thead",{className:"border-b border-[#e2d8f5] bg-[#faf8ff] text-[10px] uppercase tracking-wide text-[#6b5a8a]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky left-0 z-10 w-8 bg-[#faf8ff] px-2 py-2",children:e.jsx("input",{type:"checkbox",checked:fe,onChange:_e,className:"h-3.5 w-3.5 accent-[#8A2BE2]"})}),e.jsx("th",{className:"sticky left-8 z-10 w-6 bg-[#faf8ff]"}),e.jsx("th",{className:"sticky left-[56px] z-10 min-w-[240px] bg-[#faf8ff] px-2 py-2 text-left shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:"Кластер"}),e.jsx(j,{children:"Средняя ставка"}),e.jsx(j,{children:"Ставка (CPM)"}),e.jsx(j,{pro:!0,children:"Частотность"}),e.jsx(j,{pro:!0,children:"Ср. рекл. поз."}),e.jsx(j,{pro:!0,children:"Ср. общ. поз."}),e.jsx(j,{align:"center",children:"Текущая позиция"}),e.jsx(j,{pro:!0,children:"Лучшее место по CR"}),e.jsx(j,{align:"center",pro:!0,children:"Сегменты цен"}),e.jsx(j,{children:"CTR"}),e.jsx(j,{align:"center",children:"График CTR"}),e.jsx(j,{children:"CPC"}),e.jsx(j,{pro:!0,children:"Рейтинг"}),e.jsx(j,{children:"Показы рекл."}),e.jsx(j,{align:"center",pro:!0,children:"График показов"}),e.jsx(j,{children:"Клики общие"}),e.jsx(j,{align:"center",pro:!0,children:"График кликов"}),e.jsx(j,{children:"Клики рекл."}),e.jsx(j,{align:"center",pro:!0,children:"График рекл."}),e.jsx(j,{pro:!0,children:"% рекл. кликов"}),e.jsx(j,{align:"center",pro:!0,children:"График %"}),e.jsx(j,{children:"Затраты"}),e.jsx(j,{align:"center",pro:!0,children:"График затрат"}),e.jsx(j,{pro:!0,children:"% затрат"}
1),e.jsx(j,{children:"Заказы общ."}),e.jsx(j,{children:"Заказы рек."}),e.jsx(j,{pro:!0,children:"% органики"}),e.jsx(j,{pro:!0,children:"CR общ."}),e.jsx(j,{pro:!0,children:"CR рек."}),e.jsx(j,{children:"ДРР общ."}),e.jsx(j,{children:"ДРР рек."}),e.jsx(j,{pro:!0,children:"CPO общ."}),e.jsx(j,{pro:!0,children:"CPO рек."}),e.jsx("th",{className:"sticky right-0 w-10 bg-[#faf8ff]"})]})}),e.jsx("tbody",{children:I.map(t=>{const l=n.has(t.id),f=h.has(t.id),$=t.listIds.map(We).filter(Boolean);return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:`border-b border-[#f0eaff] tabular-nums transition-colors ${l?"bg-[#f3eeff]/60":"hover:bg-[#faf8ff]"}`,children:[e.jsx("td",{className:"sticky left-0 z-10 bg-inherit px-2 py-2",children:e.jsx("input",{type:"checkbox",checked:l,onChange:()=>Re(t.id),className:"h-3.5 w-3.5 accent-[#8A2BE2]"})}),e.jsx("td",{className:"sticky left-8 z-10 bg-inherit px-1 py-2",children:e.jsx("button",{onClick:()=>Ie(t.id),className:"grid h-5 w-5 place-items-center rounded text-[#9c8cbc] hover:bg-[#f3eeff] hover:text-[#8A2BE2]",children:f?e.jsx(Te,{className:"h-3.5 w-3.5"}):e.jsx(he,{className:"h-3.5 w-3.5"})})}),e.jsx("td",{className:"sticky left-[56px] z-10 bg-inherit px-2 py-2 shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:e.jsxs("div",{className:`flex flex-wrap items-center gap-1.5 ${t.excluded?"rounded-md border-l-2 border-[#ef4444] bg-[#fef2f2] px-1.5 py-1":""}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${ie[t.status].dot}`,title:ie[t.status].label}),e.jsx("span",{className:`font-medium ${t.excluded?"text-[#b91c1c] line-through decoration-[#fca5a5]":"text-[#2a1b4a]"}`,children:t.name}),e.jsxs("span",{className:"rounded bg-[#f3eeff] px-1.5 py-0.5 text-[9px] font-semibold text-[#8A2BE2]",children:[t.phrases," фраз"]}),$.map(N=>e.jsx("span",{className:"rounded px-1.5 py-0.5 text-[9px] font-semibold",style:{background:N.bg,color:N.color},children:N.name},N.id)),t.excluded&&e.jsx("span",{className:"rounded bg-[#fee2e2] px-1.5 py-0.5 text-[9px] font-semibold text-[#b91c1c]",children:"Исключён"})]})}),e.jsx("td",{className:"px-2 py-2 text-right text-[#6b5a8a]",children:t.cpmAvg?`${w(t.cpmAvg)} ₽`:"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:e.jsx(it,{value:t.cpm,onChange:N=>ze(t.id,N)})}),e.jsx("td",{className:"px-2 py-2 text-right",children:w(t.freq)}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.posAd||"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.posTotal||"—"}),e.jsx("td",{className:"px-2 py-2 text-center",children:e.jsx(xt,{r:t})}),e.jsx("td",{className:"px-2 py-2 text-right text-[#2a1b4a]",children:t.bestPlaceCR}),e.jsx("td",{className:"px-2 py-2 text-center text-[10px] text-[#6b5a8a]",children:t.segments}),e.jsx("td",{className:"px-2 py-2 text-right",children:M(t.ctr)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[5,8,7,9,11,12,14,13,16],label:"CTR",fmtFn:N=>`${N.toFixed(1)}%`})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.cpc?_(t.cpc):"—"}),e.jsx("td",{className:"px-2 py-2 text-right font-semibold text-[#15803d]",children:t.rating||"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:w(t.impressionsAd)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[3,4,5,7,6,8,9,10,12].map(N=>N*Math.round(t.impressionsAd/60)||N),color:"#8A2BE2",label:"Показы рекл.",fmtFn:w})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:w(t.clicksTotal)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[4,6,5,8,9,8,11,10,13].map(N=>N*Math.round(t.clicksTotal/60)||N),color:"#0ea5e9",label:"Клики общие",fmtFn:w})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:w(t.clicksAd)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[2,3,4,4,6,7,6,8,9].map(N=>
1N*Math.round(t.clicksAd/40)||N),color:"#f97316",label:"Клики рекл.",fmtFn:w})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:M(t.clicksAdShare)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[5,6,6,7,8,7,9,8,10],color:"#22c55e",label:"% рекл. кликов",fmtFn:N=>`${N.toFixed(1)}%`})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:_(t.spend)}),e.jsx("td",{className:"px-2 py-2",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{values:[2,4,3,6,7,8,9,11,12].map(N=>N*Math.round(t.spend/70)||N),color:"#be185d",label:"Затраты",fmtFn:_})})}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.spendShare?M(t.spendShare):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:w(t.ordersTotal)}),e.jsx("td",{className:"px-2 py-2 text-right font-semibold text-[#2a1b4a]",children:w(t.ordersAd)}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.organicShare?M(t.organicShare):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.crTotal?M(t.crTotal):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.crAd?M(t.crAd):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.drrTotal?M(t.drrTotal):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.drrAd?M(t.drrAd):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.cpoTotal?_(t.cpoTotal):"—"}),e.jsx("td",{className:"px-2 py-2 text-right",children:t.cpoAd?_(t.cpoAd):"—"}),e.jsx("td",{className:"sticky right-0 bg-inherit px-2 py-2 text-center",children:t.excluded?e.jsx("button",{onClick:()=>ue([t.id]),title:"Вернуть в ключевые",className:"grid h-6 w-6 place-items-center rounded text-[#15803d] hover:bg-[#dcfce7]",children:e.jsx(Ae,{className:"h-3.5 w-3.5"})}):e.jsx("button",{onClick:()=>be([t.id]),title:"Исключить из кластеров",className:"grid h-6 w-6 place-items-center rounded text-[#9c8cbc] hover:bg-[#fee2e2] hover:text-[#b91c1c]",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})})})]},t.id),f&&pt(t).map(N=>e.jsx(mt,{r:t,day:N},`${t.id}-${N.label}`))]})})})]})})})}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dashed border-[#e2d8f5] bg-white px-3 py-2 text-[11px] text-[#6b5a8a]",children:[e.jsx(rt,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),"Кликните по ставке в ячейке чтобы изменить её, или выделите несколько кластеров для массовых действий. Метрики с ",e.jsx("span",{className:"mx-0.5 inline-block h-1.5 w-1.5 rounded-full bg-[#c8ff00] ring-1 ring-[#8A2BE2]"})," доступны на тарифе Pro."]}),e.jsx(gt,{})]}),T&&e.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[#2a1b4a]/40 backdrop-blur-sm",children:e.jsxs("div",{className:"w-[380px] rounded-2xl bg-white p-5 shadow-2xl",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-bold text-[#2a1b4a]",children:[T==="cpm"&&"Изменить CPM",T==="status"&&"Изменить статус",T==="list"&&"Добавить / убрать список"]}),e.jsxs("span",{className:"rounded-md bg-[#f3eeff] px-2 py-0.5 text-[10px] font-semibold text-[#8A2BE2]",children:[W," кластеров"]})]}
1),T==="cpm"&&e.jsx("input",{autoFocus:!0,type:"number",placeholder:"Новый CPM, ₽",value:B,onChange:t=>P(t.target.value),className:"w-full rounded-lg border border-[#e2d8f5] px-3 py-2.5 text-sm outline-none focus:border-[#8A2BE2]"}),T==="status"&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["active","paused","draft"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`rounded-lg border px-2 py-2 text-xs font-medium ${B===t?"border-[#8A2BE2] bg-[#f3eeff] text-[#8A2BE2]":"border-[#e2d8f5] text-[#2a1b4a]"}`,children:ie[t].label},t))}),T==="list"&&e.jsxs("div",{className:"space-y-2",children:[i.length===0&&e.jsx("p",{className:"text-xs text-[#6b5a8a]",children:"Списков пока нет. Создайте их в «Управлять списками»."}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:i.map(t=>e.jsx("button",{onClick:()=>P(t.id),className:`rounded-lg border px-2 py-2 text-xs font-medium ${B===t.id?"border-[#8A2BE2]":"border-[#e2d8f5]"}`,style:B===t.id?{background:t.bg,color:t.color}:{},children:t.name},t.id))})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{E(null),P("")},className:"rounded-lg px-3 py-2 text-xs font-medium text-[#6b5a8a] hover:bg-[#faf8ff]",children:"Отмена"}),e.jsx("button",{onClick:Le,disabled:!B,className:"rounded-lg bg-[#8A2BE2] px-4 py-2 text-xs font-semibold text-white hover:bg-[#7a22d2] disabled:bg-[#cdbbeb]",children:"Применить"})]})]})}),F&&e.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[#2a1b4a]/40 backdrop-blur-sm",onClick:()=>d(!1),children:e.jsxs("div",{className:"w-[460px] rounded-2xl bg-white p-5 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-bold text-[#2a1b4a]",children:"Списки кластеров"}),e.jsx("button",{onClick:()=>d(!1),className:"grid h-6 w-6 place-items-center rounded text-[#9c8cbc] hover:bg-[#f3eeff]",children:e.jsx(me,{className:"h-3.5 w-3.5"})})]}),e.jsx("p",{className:"mb-3 text-[11px] text-[#6b5a8a]",children:"Создавайте собственные ярлыки — например «Маржа > 30%», «Зима», «На тесте». Каждый кластер можно отметить несколькими списками."}),e.jsxs("div",{className:"mb-3 space-y-1.5",children:[i.length===0&&e.jsx("div",{className:"rounded-lg border border-dashed border-[#e2d8f5] px-3 py-4 text-center text-xs text-[#9c8cbc]",children:"Списков пока нет"}),i.map(t=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-[#e2d8f5] px-2 py-1.5",children:[e.jsx("span",{className:"rounded px-2 py-0.5 text-[10px] font-semibold",style:{background:t.bg,color:t.color},children:t.name}),e.jsxs("span",{className:"ml-auto text-[10px] text-[#9c8cbc]",children:[s.filter(l=>l.listIds.includes(t.id)).length," кластеров"]}),e.jsx("button",{onClick:()=>qe(t.id),className:"grid h-6 w-6 place-items-center rounded text-[#9c8cbc] hover:bg-[#fee2e2] hover:text-[#b91c1c]",title:"Удалить список",children:e.jsx(me,{className:"h-3.5 w-3.5"})})]},t.id))]}),e.jsxs("div",{className:"rounded-lg border border-[#e2d8f5] p-2.5",children:[e.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-[#6b5a8a]",children:"Новый список"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:p,onChange:t=>S(t.target.value),onKeyDown:t=>{t.key==="Enter"&&ge()},placeholder:"Название списка",className:"flex-1 rounded-lg border border-[#e2d8f5] px-2.5 py-1.5 text-xs outline-none focus:border-[#8A2BE2]"}),e.jsx("div",{className:"flex items-center gap-1",children:se.map((t,l)=>e.jsx("button",{onClick:()=>q(l),className:`grid h-5 w-5 place-items-center rounded-full transition ${l===D?"ring-2 ring-offset-1 ring-[#8A2BE2]":""}`,style:{background:t.bg},children:l===D&&e.jsx(ve,{className:"h-3 w-3",style:{color:t.color}})},l))}),e.jsx("button",{onClick:ge,disabled:!p.trim(),className:"rounded-lg bg-[#8A2BE2] px-3 py-1.5 text-xs font-semibold text-white hover:bg-[#7a22d2] disabled:bg-[#cdbbeb]",children:"Создать"})]})]})]})}),v&&e.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[#2a1b4a]/40 backdrop-blur-sm",children:e.jsxs("div",{className:"w-[440px] rounded-2xl bg-white p-5 shadow-2xl",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"grid h-7 w-7 place-items-center rounded-lg bg-[#f3eeff] text-[#8A2BE2]",children:e.jsx(Se,{className:"h-3.5 w-3.5"})}),e.jsx("h3",{className:"text-sm font-bold text-[#2a1b4a]",children:"Проверка позиций"})]}),e.jsxs("span",{className:"rounded-md bg-[#f3eeff] px-2 py-0.5 text-[10px] font-semibold text-[#8A2BE2]",children:["до ",L," за раз"]})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[#6b5a8a]",children:["Опрашиваем выдачу WB для ",v.ids.length," кластеров. Обновляем позиции «без буста» и «с РК»."]}),e.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] text-[#6b5a8a]",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[v.running?e.jsx(tt,{className:"h-3 w-3 animate-spin text-[#8A2BE2]"}):e.jsx(ve,{className:"h-3 w-3 text-[#22c55e]"}),v.running?"Опрос выдачи…":"Готово"]}),e.jsxs("span",{className:"font-semibold text-[#2a1b4a]",children:[v.done," / ",v.ids.length]})]}),e.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-[#f3eeff]",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#8A2BE2] to-[#c8ff00] transition-all",style:{width:`${v.done/v.ids.length*100}%`}})}),e.jsx("div",{className:"mt-4 flex justify-end gap-2",children:e.jsx("button",{onClick:()=>Z(null),disabled:v.running,className:"rounded-lg bg-[#8A2BE2] px-4 py-2 text-xs font-semibold text-white hover:bg-[#7a22d2] disabled:bg-[#cdbbeb]",children:v.running?"Подождите…":"Закрыть"})})]})})]})}function xt({r:s}){if(!s.posBoosted&&!s.posOrganic)return e.jsx("button",{className:"text-[10px] font-semibold text-[#8A2BE2] hover:underline",children:"Проверить"});const r=s.posOrganic&&s.posBoosted?s.posOrganic-s.posBoosted:0;return e.jsxs("div",{className:"inline-flex flex-col items-center gap-0.5",title:s.posCheckedAt?`Проверено: ${s.posCheckedAt}`:"",children:[e.jsxs("div",{className:"flex items-center gap-1 tabular-nums",children:[e.jsx("span",{className:"rounded bg-[#f1f5f9] px-1.5 py-0.5 text-[10px] font-semibold text-[#64748b]",title:"Без буста (no_promo)",children:s.posOrganic||"—"}),e.jsx(he,{className:"h-3 w-3 text-[#9c8cbc]"}),e.jsx("span",{className:"rounded bg-[#8A2BE2]/10 px-1.5 py-0.5 text-[11px] font-bold text-[#8A2BE2]",title:"С РК (текущая в выдаче)",children:s.posBoosted||"—"}),s.posDelta>0&&e.jsx(Me,{className:"h-3 w-3 text-[#22c55e]"}),s.posDelta<0&&e.jsx(Ye,{className:"h-3 w-3 text-[#ef4444]"})]}),r>0&&e.jsxs("span",{className:"rounded bg-[#fce7f3] px-1 text-[9px] font-semibold text-[#be185d]",children:["+",r," буст"]})]})}function pt(s){const r=[.18,.17,.15,.14,.13,.12,.11],i=new Date,k=s.id.split("").reduce((x,h)=>
1x+h.charCodeAt(0),0),n=["Сегодня","Вчера","−2 дня","−3 дня","−4 дня","−5 дней","−6 дней"];return r.map((x,h)=>{const y=new Date(i);y.setDate(i.getDate()-h);const o=((k+h*37)%9-4)/100;return{label:n[h],date:`${String(y.getDate()).padStart(2,"0")}.${String(y.getMonth()+1).padStart(2,"0")}`,f:x,j:o}})}function mt({r:s,day:r}){const{f:i,j:k}=r,n=y=>Math.round(y*i),x=y=>+(y*(1+k)).toFixed(2),h=y=>Math.round(y*(1+k));return e.jsxs("tr",{className:"border-b border-[#f0eaff] bg-[#fbf9ff] text-[10.5px] tabular-nums",children:[e.jsx("td",{className:"sticky left-0 z-10 bg-[#fbf9ff] px-2 py-1.5"}),e.jsx("td",{className:"sticky left-8 z-10 bg-[#fbf9ff] px-1 py-1.5",children:e.jsx("span",{className:"ml-2 inline-block h-3 w-[2px] rounded-full bg-[#cdbbeb]"})}),e.jsx("td",{className:"sticky left-[56px] z-10 bg-[#fbf9ff] px-2 py-1.5 shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:e.jsxs("div",{className:"flex items-center gap-2 pl-4",children:[e.jsx(le,{className:"h-3 w-3 text-[#9c8cbc]"}),e.jsx("span",{className:"font-medium text-[#2a1b4a]",children:r.label}),e.jsx("span",{className:"text-[10px] text-[#9c8cbc]",children:r.date})]})}),e.jsx("td",{className:"px-2 py-1.5 text-right text-[#6b5a8a]",children:s.cpmAvg?`${w(h(s.cpmAvg))} ₽`:"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right text-[#6b5a8a]",children:s.cpm?`${w(h(s.cpm))} ₽`:"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right text-[#6b5a8a]",children:w(n(s.freq))}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.posAd?x(s.posAd):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.posTotal?x(s.posTotal):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px]",children:s.posBoosted?e.jsxs("span",{className:"text-[#6b5a8a]",children:[h(s.posOrganic)||"—"," → ",e.jsx("span",{className:"font-semibold text-[#8A2BE2]",children:h(s.posBoosted)})]}):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right text-[#6b5a8a]",children:s.bestPlaceCR}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#9c8cbc]",children:s.segments}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.ctr?M(x(s.ctr)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.cpc?_(h(s.cpc)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right text-[#15803d]",children:s.rating?h(s.rating):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:w(n(s.impressionsAd))}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:w(n(s.clicksTotal))}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:w(n(s.clicksAd))}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.clicksAdShare?M(x(s.clicksAdShare)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:_(n(s.spend))}),e.jsx("td",{className:"px-2 py-1.5 text-center text-[10px] text-[#cdbbeb]",children:"·"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.spendShare?M(x(s.spendShare)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:w(n(s.ordersTotal))}),e.jsx("td",{className:"px-2 py-1.5 text-right font-semibold text-[#2a1b4a]",children:w(n(s.ordersAd))}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.organicShare?M(x(s.organicShare)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.crTotal?M(x(s.crTotal)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.crAd?M(x(s.crAd)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.drrTotal?M(x(s.drrTotal)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.drrAd?M(x(s.drrAd)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.cpoTotal?_(h(s.cpoTotal)):"—"}),e.jsx("td",{className:"px-2 py-1.5 text-right",children:s.cpoAd?_(h(s.cpoAd)):"—"}),e.jsx("td",{className:"sticky right-0 bg-[#fbf9ff] px-2 py-1.5"})]})}const R=[{key:"imp",label:"Показы",group:"Статистика",fmt:"int",color:"#8A2BE2"},{key:"clk",label:"Клики",group:"Статистика",fmt:"int",color:"#22c55e"},{key:"ctr",label:"CTR",group:"Статистика",fmt:"pct",color:"#0ea5e9"},{key:"cpc",label:"CPC",group:"Статистика",fmt:"rub",color:"#f59e0b"},{key:"cpm",label:"CPM",group:"Статистика",fmt:"rub",color:"#a16207"},{key:"spend",label:"Затраты",group:"Статистика",fmt:"rub",color:"#be185d"}
1,{key:"adCart",label:"Корзины",group:"Рекламная воронка",fmt:"int",color:"#f97316"},{key:"adCartPct",label:"% в корзину",group:"Рекламная воронка",fmt:"pct",color:"#f97316"},{key:"adOrd",label:"Заказы, шт.",group:"Рекламная воронка",fmt:"int",color:"#22c55e"},{key:"adOrdPct",label:"% в заказы",group:"Рекламная воронка",fmt:"pct",color:"#22c55e"},{key:"adRev",label:"Заказы, ₽",group:"Рекламная воронка",fmt:"rub",color:"#15803d"},{key:"adSalesQ",label:"Расч. продажи, шт.",group:"Рекламная воронка",fmt:"decimal",color:"#0ea5e9"},{key:"adSalesR",label:"Расч. продажи, ₽",group:"Рекламная воронка",fmt:"rub",color:"#0ea5e9"},{key:"adClkShare",label:"Кликов, %",group:"Рекламные метрики",fmt:"pct",color:"#7c3aed"},{key:"adAvgPos",label:"Ср. позиция",group:"Рекламные метрики",fmt:"decimal",color:"#7c3aed"},{key:"adCpo",label:"Стоимость заказа",group:"Рекламные метрики",fmt:"rub",color:"#be185d"},{key:"adCps",label:"Расч. стоим. продажи",group:"Рекламные метрики",fmt:"rub",color:"#be185d"},{key:"adDrr",label:"ДРР от заказов",group:"Рекламные метрики",fmt:"pct",color:"#ef4444"},{key:"adDrrS",label:"Расч. ДРР продаж",group:"Рекламные метрики",fmt:"pct",color:"#ef4444"},{key:"adDeferred",label:"Отложенные",group:"Рекламные метрики",fmt:"int",color:"#9c8cbc"},{key:"tCart",label:"Корзины",group:"Общая воронка",fmt:"int",color:"#f97316"},{key:"tCartPct",label:"% в корзину",group:"Общая воронка",fmt:"pct",color:"#f97316"},{key:"tOrd",label:"Заказы, шт.",group:"Общая воронка",fmt:"int",color:"#22c55e"},{key:"tOrdPct",label:"% в заказ",group:"Общая воронка",fmt:"pct",color:"#22c55e"},{key:"tRev",label:"Заказы, ₽",group:"Общая воронка",fmt:"rub",color:"#15803d"},{key:"tSalesQ",label:"Расч. продажи, шт.",group:"Общая воронка",fmt:"decimal",color:"#0ea5e9"},{key:"tBuyout",label:"% выкупа",group:"Общая воронка",fmt:"pct",color:"#15803d"},{key:"tSalesR",label:"Расч. продажи, ₽",group:"Общая воронка",fmt:"rub",color:"#0ea5e9"},{key:"tOpens",label:"Открытий",group:"Общая воронка",fmt:"int",color:"#8A2BE2"},{key:"tCpo",label:"Стоимость заказа",group:"Общие метрики",fmt:"rub",color:"#be185d"},{key:"tCps",label:"Расч. стоим. продажи",group:"Общие метрики",fmt:"rub",color:"#be185d"},{key:"tDrr",label:"ДРР от заказов",group:"Общие метрики",fmt:"pct",color:"#ef4444"},{key:"tDrrS",label:"Расч. ДРР продаж",group:"Общие метрики",fmt:"pct",color:"#ef4444"},{key:"sImp",label:"Показы",group:"Статистика поиска",fmt:"int",color:"#8A2BE2"},{key:"sClk",label:"Клики",group:"Статистика поиска",fmt:"int",color:"#22c55e"},{key:"sShare",label:"Доля, %",group:"Статистика поиска",fmt:"pct",color:"#7c3aed"},{key:"sCtr",label:"CTR",group:"Статистика поиска",fmt:"pct",color:"#0ea5e9"},{key:"sCpc",label:"CPC",group:"Статистика поиска",fmt:"rub",color:"#f59e0b"},{key:"sCpm",label:"CPM",group:"Статистика поиска",fmt:"rub",color:"#a16207"}],Be=["Статистика","Рекламная воронка","Рекламные метрики","Общая воронка","Общие метрики","Статистика поиска"],ae={Статистика:"#8A2BE2","Рекламная воронка":"#f97316","Рекламные метрики":"#7c3aed","Общая воронка":"#22c55e","Общие метрики":"#ef4444","Статистика поиска":"#0ea5e9"}
1,xe=[{id:"default",label:"По умолчанию",keys:["imp","clk","ctr","cpm","spend","adOrd","adRev","adDrr","tOrd","tRev","tDrr"]},{id:"ads",label:"Реклама",keys:R.filter(s=>s.group==="Статистика"||s.group==="Рекламная воронка"||s.group==="Рекламные метрики").map(s=>s.key)},{id:"funnel",label:"Воронка",keys:R.filter(s=>s.group==="Рекламная воронка"||s.group==="Общая воронка").map(s=>s.key)},{id:"search",label:"Поиск",keys:R.filter(s=>s.group==="Статистика поиска").map(s=>s.key)},{id:"all",label:`Все (${R.length})`,keys:R.map(s=>s.key)}],G=14,ht=new Date(2026,5,12),V=s=>{const r=new Date(ht);return r.setDate(r.getDate()+s),`${String(r.getDate()).padStart(2,"0")}.${String(r.getMonth()+1).padStart(2,"0")}.${r.getFullYear()}`},m=(s,r,i=0)=>Array.from({length:G}).map((k,n)=>Math.max(0,s+i*n+Math.sin(n*1.3+s)*r)),Y={imp:m(2400,800,110),clk:m(55,22,3),ctr:m(2.1,.4,.02),cpc:m(9.2,1.4,.05),cpm:m(199,6,.4),spend:m(540,180,30),adCart:m(3.6,1.8,.2),adCartPct:m(6.4,.9,.03),adOrd:m(.9,.7,.06),adOrdPct:m(1.6,.3,.02),adRev:m(1010,380,40),adSalesQ:m(.7,.4,.04),adSalesR:m(745,280,30),adClkShare:m(73,4,.1),adAvgPos:m(6.5,1.1,-.05),adCpo:m(583,40,-3),adCps:m(788,50,-2),adDrr:m(53,4,-.2),adDrrS:m(72,4,-.2),adDeferred:m(.9,.6,.04),tCart:m(5.9,2.1,.3),tCartPct:m(8,.8,.04),tOrd:m(1.8,.9,.07),tOrdPct:m(31,3,.1),tRev:m(1840,520,50),tSalesQ:m(1.4,.6,.05),tBuyout:m(74,5,.1),tSalesR:m(1370,380,40),tOpens:m(78,18,1.5),tCpo:m(291,14,-.6),tCps:m(394,18,-.7),tDrr:m(29,3,-.1),tDrrS:m(39,3,-.1),sImp:m(1180,320,50),sClk:m(22,9,1.1),sShare:m(43,3,.05),sCtr:m(1.85,.3,.01),sCpc:m(10.7,1.4,.04),sCpm:m(200,7,.3)},z=(s,r)=>isFinite(s)?r==="pct"?`${s.toFixed(2)}%`:r==="rub"?`${s.toLocaleString("ru-RU",{maximumFractionDigits:2})} ₽`:r==="decimal"?s.toFixed(2):Math.round(s).toLocaleString("ru-RU"):"—",ft=(s,r)=>{const i=Y[s];return i?r==="pct"||r==="decimal"?i.reduce((k,n)=>k+n,0)/i.length:i.reduce((k,n)=>k+n,0):0},J={price:{color:"#be185d",bg:"#fce7f3",label:"Цена"},cpm:{color:"#8A2BE2",bg:"#f3eeff",label:"Ставка"},stock:{color:"#0ea5e9",bg:"#e0f2fe",label:"Остатки"},promo:{color:"#f59e0b",bg:"#fef3c7",label:"Акция"},campaign:{color:"#22c55e",bg:"#dcfce7",label:"Кампания"}},re=[{dayIdx:1,type:"campaign",title:"Запуск РК",detail:"Старт кампании «Омега-3»"},{dayIdx:3,type:"cpm",title:"CPM 350 → 410",detail:"Повышение для топ-5 кластеров"},{dayIdx:5,type:"price",title:"Цена 1190 → 1090 ₽",detail:"Скидка на основную карточку"},{dayIdx:7,type:"promo",title:"Авто-акция WB",detail:"Распродажа здоровья"},{dayIdx:9,type:"stock",title:"Поставка +420 шт.",detail:"ФБО Подольск"},{dayIdx:11,type:"cpm",title:"CPM 410 → 380",detail:"Корректировка после теста"},{dayIdx:12,type:"price",title:"Цена 1090 → 1190 ₽",detail:"Возврат к плановой"}];function bt({keys:s}){const r=s.map(d=>R.find(p=>p.key===d)).filter(Boolean),[i,k]=u.useState(null),[n,x]=u.useState(null);if(!r.length)return e.jsx("div",{className:"grid h-[220px] place-items-center text-[11px] text-[#9c8cbc]",children:"Выберите метрику для отображения на графике"});const h=980,y=220,o=44,A=16,a=18,c=40,g=h-o-A,b=y-a-c,C=G,O=g/(C-1),T=r.map(d=>{const p=Y[d.key],S=Math.min(...p),D=Math.max(...p);return{c:d,data:p,min:S,max:D===S?S+1:D}}),E=d=>o+d*O,B=(d,p)=>a+b-(d-p.min)/(p.max-p.min)*b,P=4,F=T[0];return e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{width:"100%",viewBox:`0 0 ${h} ${y}`,className:"block",onMouseLeave:()=>k(null),children:[Array.from({length:P+1}).map((d,p)=>{const S=a+b/P*p,D=F.max-(F.max-F.min)/P*p;return e.jsxs("g",{children:[e.jsx("line",{x1:o,x2:h-A,y1:S,y2:S,stroke:"#f0eaff",strokeWidth:1}),e.jsx("text",{x:o-6,y:S+3,textAnchor:"end",fill:"#9c8cbc",fontSize:9,children:z(D,F.c.fmt)})]},p)}),Array.from({length:C}).map((d,p)=>p%2===0&&e.jsx("text",{x:E(p),y:y-c+14,textAnchor:"middle",fill:"#9c8cbc",fontSize:9,children:V(p).slice(0,5)},p)),re.map((d,p)=>{const S=J[d.type],D=E(d.dayIdx);return e.jsxs("g",{style:{cursor:"pointer"},onMouseEnter:()=>x(p),onMouseLeave:()=>x(null),children:[e.jsx("line",{x1:D,x2:D,y1:a,y2:y-c,stroke:S.color,strokeWidth:1,strokeDasharray:"3 3",opacity:.55}),e.jsx("circle",{cx:D,cy:a-2,r:5,fill:S.color,stroke:"#fff",strokeWidth:1.5})]},p)}),T.map((d,p)=>{const S=d.data.map((q,v)=>`${E(v)},${B(q,d)}`).join(" "),D=`${o},${a+b} ${S} ${o+g},${a+b}`;return e.jsxs("g",{children:[p===0&&e.jsx("polyline",{points:D,fill:d.c.color,fillOpacity:.08,stroke:"none"}),e.jsx("polyline",{points:S,fill:"none",stroke:d.c.color,strokeWidth:2}),d.data.map((q,v)=>e.jsx("circle",{cx:E(v),cy:B(q,d),r:i===v?3.5:2,fill:d.c.color},v))]},d.c.key)}),Array.from({length:C}).map((d,p)=>e.jsx("rect",{x:E(p)-O/2,y:a,width:O,height:b,fill:"transparent",onMouseEnter:()=>k(p)},p)),i!==null&&e.jsx("line",{x1:E(i),x2:E(i),y1:a,y2:y-c,stroke:"#8A2BE2",strokeWidth:1,opacity:.35})]}),i!==null&&e.jsxs("div",{className:"pointer-events-none absolute top-2 rounded-lg border border-[#e2d8f5] bg-white px-2.5 py-1.5 text-[10px] shadow-md",style:{left:`calc(${E(i)/h*100}
1% + 8px)`},children:[e.jsx("div",{className:"mb-0.5 font-semibold text-[#2a1b4a]",children:V(i)}),T.map(d=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:d.c.color}}),e.jsxs("span",{className:"text-[#6b5a8a]",children:[d.c.label,":"]}),e.jsx("span",{className:"font-semibold text-[#2a1b4a]",children:z(d.data[i],d.c.fmt)})]},d.c.key)),re.filter(d=>d.dayIdx===i).map((d,p)=>{const S=J[d.type];return e.jsxs("div",{className:"mt-1 flex items-center gap-1 border-t border-[#f0eaff] pt-1",children:[e.jsx("span",{className:"rounded px-1 text-[9px] font-semibold",style:{background:S.bg,color:S.color},children:S.label}),e.jsx("span",{className:"text-[#2a1b4a]",children:d.title})]},p)})]}),n!==null&&(()=>{const d=re[n],p=J[d.type];return e.jsxs("div",{className:"pointer-events-none absolute top-0 rounded-lg border bg-white px-2.5 py-1.5 text-[10px] shadow-md",style:{left:`calc(${E(d.dayIdx)/h*100}% + 8px)`,borderColor:p.color},children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"rounded px-1 text-[9px] font-semibold",style:{background:p.bg,color:p.color},children:p.label}),e.jsx("span",{className:"font-semibold text-[#2a1b4a]",children:V(d.dayIdx)})]}),e.jsx("div",{className:"mt-0.5 text-[#2a1b4a]",children:d.title}),d.detail&&e.jsx("div",{className:"text-[#6b5a8a]",children:d.detail})]})})()]})}function ut({data:s,color:r}){const n=Math.min(...s),x=Math.max(...s),h=x-n||1,y=120/(s.length-1),o=s.map((A,a)=>`${a*y},${32-(A-n)/h*28-2}`).join(" ");return e.jsxs("svg",{width:120,height:32,viewBox:"0 0 120 32",className:"block",children:[e.jsx("polyline",{fill:"none",stroke:r,strokeWidth:1.6,points:o}),e.jsx("polyline",{fill:r,fillOpacity:.12,stroke:"none",points:`0,32 ${o} 120,32`})]})}function gt(){const[s,r]=u.useState(new Set(xe[0].keys)),[i,k]=u.useState(!1),[n,x]=u.useState(["spend","adOrd"]),h=a=>{x(c=>c.includes(a)?c.filter(g=>g!==a):c.length>=2?[c[1],a]:[...c,a])},y=a=>{const c=xe.find(g=>g.id===a);c&&r(new Set(c.keys))},o=u.useMemo(()=>R.filter(a=>s.has(a.key)),[s]),A=u.useMemo(()=>{const a=new Map;return Be.forEach(c=>{const g=o.filter(b=>b.group===c);g.length&&a.set(c,g)}),a},[o]);return e.jsxs("section",{className:"space-y-3 pt-6",children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-[#2a1b4a]",children:"Статистика РК · по дням"}),e.jsxs("p",{className:"text-xs text-[#6b5a8a]",children:["Динамика изменений отображается в сравнении с предыдущим днём. ",o.length," из ",R.length," метрик"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-[#e2d8f5] bg-white px-2 py-1.5 text-xs",children:[e.jsx(we,{className:"h-3.5 w-3.5 text-[#9c8cbc]"}),e.jsx(le,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),e.jsxs("span",{className:"font-medium",children:[V(0)," — ",V(G-1)]}),e.jsx(we,{className:"h-3.5 w-3.5 rotate-180 text-[#9c8cbc]"})]}),e.jsxs("button",{onClick:()=>k(a=>!a),className:"flex items-center gap-1.5 rounded-lg border border-[#e2d8f5] bg-white px-3 py-2 text-xs font-medium text-[#2a1b4a] hover:bg-[#faf8ff]",children:[e.jsx(pe,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," Настройка таблицы"]}),e.jsxs("button",{className:"flex items-center gap-1.5 rounded-lg bg-[#8A2BE2] px-3 py-2 text-xs font-semibold text-white hover:bg-[#7a22d2]",children:[e.jsx(Je,{className:"h-3.5 w-3.5"})," Excel"]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-3 overflow-hidden",children:[e.jsxs(K,{title:"График показателей",subtitle:"до 2 метрик · вертикальные метки — события из календаря",icon:e.jsx(Me,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),right:e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center justify-end gap-1",children:o.slice(0,10).map(a=>{const c=n.includes(a.key);return e.jsxs("button",{onClick:()=>h(a.key),className:`rounded-md border px-2 py-0.5 text-[10px] font-medium transition ${c?"text-white":"border-[#e2d8f5] bg-white text-[#6b5a8a] hover:border-[#8A2BE2]/40"}`,style:c?{background:a.color,borderColor:a.color}:{},children:[e.jsx("span",{className:"mr-1 inline-block h-1.5 w-1.5 rounded-full align-middle",style:{background:c?"#fff":a.color}}),a.label]},a.key)})}),children:[e.jsx("div",{className:"px-2 pb-1 pt-2",children:e.jsx(bt,{keys:n})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[#f0eaff] bg-[#faf8ff] px-3 py-2 text-[10px]",children:[e.jsxs("span",{className:"flex items-center gap-1 font-semibold text-[#6b5a8a]",children:[e.jsx(le,{className:"h-3 w-3 text-[#8A2BE2]"})," События:"]}),Object.keys(J).map(a=>{const c=J[a];return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5",style:{background:c.bg,color:c.color},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:c.color}}),c.label]},a)}),e.jsxs("span",{className:"ml-auto text-[#9c8cbc]",children:[re.length," событий за период"]})]})]}),o.length>0&&e.jsx(K,{title:"Сводка показателей",subtitle:`топ-${Math.min(8,o.length)} метрик с трендом`,icon:e.jsx($e,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),children:e.jsx("div",{className:"grid gap-2 p-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:o.slice(0,8).map(a=>{const c=Y[a.key],g=c[c.length-1],b=c[c.length-2],C=g-b,O=C>=0;return e.jsxs("div",{className:"rounded-xl border border-[#e2d8f5] bg-white p-2.5",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[10px] uppercase tracking-wider text-[#6b5a8a]",children:a.label}),e.jsx("div",{className:"truncate text-[9px] text-[#9c8cbc]",children:a.group})]}),e.jsxs("span",{className:`shrink-0 rounded px-1 text-[9px] font-semibold ${O?"bg-[#dcfce7] text-[#15803d]":"bg-[#fee2e2] text-[#b91c1c]"}`,children:[O?"+":"",z(C,a.fmt)]})]}),e.jsxs("div",{className:"flex items-end justify-between gap-2",children:[e.jsx("div",{className:"text-sm font-bold tabular-nums text-[#2a1b4a]",children:z(g,a.fmt)}),e.jsx(ut,{data:c,color:a.color})]})]},a.key)})})}),e.jsx(K,{title:"Таблица по дням",subtitle:`${G} дней · ${o.length} метрик`,icon:e.jsx(le,{className:"h-3.5 w-3.5 text-[#8A2BE2]"}),children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[11px]",children:[e.jsxs("thead",{className:"text-[10px] uppercase tracking-wide text-[#6b5a8a]",children:[e.jsxs("tr",{className:"border-b border-[#e2d8f5] bg-[#faf8ff]",children:[e.jsx("th",{rowSpan:2,className:"sticky left-0 z-20 min-w-[110px] bg-[#faf8ff] px-3 py-2 text-left shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:"Дата"}),[...A.entries()].map(([a,c])=>e.jsx("th",{colSpan:c.length,className:"border-l border-[#e2d8f5] px-2 py-1.5 text-left font-semibold",style:{color:ae[a]},children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:ae[a]}}),a]})},a))]}),e.jsx("tr",{className:"border-b border-[#e2d8f5] bg-[#faf8ff]",children:o.map((a,c)=>{const g=c===0||o[c-1].group!==a.group;return e.jsx("th",{className:`whitespace-nowrap px-2 py-2 text-right font-medium ${g?"border-l border-[#e2d8f5]":""}`,children:a.label},a.key)})})]}),e.jsxs("tbody",{className:"tabular-nums",children:[e.jsxs("tr",{className:"border-b-2 border-[#e2d8f5] bg-[#f3eeff]/40 font-semibold",children:[e.jsx("td",{className:"sticky left-0 z-10 bg-[#f3eeff] px-3 py-2 text-left text-[#8A2BE2] shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:"Всего"}),o.map((a,c)=>{const g=c===0||o[c-1].group!==a.group;return e.jsx("td",{className:`px-2 py-2 text-right text-[#2a1b4a] ${g?"border-l border-[#e2d8f5]":""}`,children:z(ft(a.key,a.fmt),a.fmt)},a.key)})]}),Array.from({length:G}).map((a,c)=>{const g=G-1-c;return e.jsxs("tr",{className:"border-b border-[#f0eaff] hover:bg-[#faf8ff]",children:[e.jsx("td",{className:"sticky left-0 z-10 bg-white px-3 py-2 text-left font-medium text-[#2a1b4a] shadow-[2px_0_4px_rgba(42,27,74,0.06)]",children:V(g)}),o.map((b,C)=>{const O=C===0||o[C-1].group!==b.group,T=Y[b.key][g],E=g>0?Y[b.key][g-1]:null,B=E!==null?T-E:null,P=(B??0)>=0;return e.jsxs("td",{className:`px-2 py-2 text-right ${O?"border-l border-[#e2d8f5]":""}`,children:[e.jsx("div",{className:"text-[#2a1b4a]",children:z(T,b.fmt)}),B!==null&&Math.abs(B)>.001&&e.jsxs("div",{className:`text-[9px] font-medium ${P?"text-[#15803d]":"text-[#b91c1c]"}`,children:[P?"+":"",z(B,b.fmt)]})]},b.key)})]},g)})]})]})})})]}),i&&e.jsxs("aside",{className:"w-72 shrink-0 overflow-hidden rounded-2xl border border-[#8A2BE2]/15 bg-[#faf8ff] shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[#8A2BE2]/10 bg-white px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-[#2a1b4a]",children:[e.jsx(pe,{className:"h-3.5 w-3.5 text-[#8A2BE2]"})," Настройка таблицы"]}),e.jsx("button",{onClick:()=>k(!1),className:"rounded-md p-1 text-gray-400 hover:bg-black/5 hover:text-[#2a1b4a]",children:e.jsx(me,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"space-y-3 px-3 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-gray-500",children:"Пресет"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[xe.map(a=>e.jsx("button",{onClick:()=>y(a.id),className:"rounded-md border border-[#8A2BE2]/30 bg-white px-2 py-1 text-[11px] font-medium text-[#8A2BE2] hover:bg-[#8A2BE2] hover:text-white",children:a.label},a.id)),e.jsx("button",{onClick:()=>r(new Set),className:"rounded-md border border-black/10 bg-white px-2 py-1 text-[11px] text-gray-500 hover:text-rose-500",children:"Скрыть все"})]})]}),Be.map(a=>{const c=R.filter(b=>b.group===a),g=c.every(b=>s.has(b.key));return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide",style:{color:ae[a]},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:ae[a]}}),a]}),e.jsx("button",{onClick:()=>{const b=new Set(s);
1g?c.forEach(C=>b.delete(C.key)):c.forEach(C=>b.add(C.key)),r(b)},className:"text-[10px] text-[#8A2BE2] hover:underline",children:g?"Снять":"Выбрать все"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map(b=>{const C=s.has(b.key);return e.jsx("button",{onClick:()=>{const O=new Set(s);C?O.delete(b.key):O.add(b.key),r(O)},className:`rounded-md border px-2 py-1 text-[11px] transition ${C?"border-[#8A2BE2]/40 bg-white text-[#2a1b4a]":"border-black/10 bg-white/60 text-gray-400 hover:border-[#8A2BE2]/30 hover:text-[#2a1b4a]"}`,children:b.label},b.key)})})]},a)})]})]})]})]})}export{Ct as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.