PageSourceSearch

https://markethacker.ru/assets/seller-funnel-CMhloi3J.js

js markethacker.ru collected 2026-10-02 02:07:27 UTC 46,386 bytes, 2 lines download raw bytes

1import{h as u,m as e,Z as Pe,G as Ue,y as ge,H as Ie,B as K,D as _e,v as Y,_ as je,F as Ge,K as ye,P as xe,A as Ne,E as ke,q as me,Q as We,N as he,$ as Ke,a0 as He,U as Ye,V as Ve,a1 as V,a2 as q,a3 as Q,a4 as X,a5 as pe,W as qe,a6 as Qe,a7 as F,I as Xe,w as ve,z as we,X as Ze,a8 as Je,a9 as ue}from"./index-BhuuQD9y.js";import{a as et}from"./MhShell-Cbejmf_i.js";import"./zap-Dah-fsUc.js";import"./arrow-right-DfMwkIJk.js";import"./flame-Bik0_g14.js";import"./percent-wBt4aiQW.js";import"./wrench-CeVsxVf-.js";import"./wallet-sO7ZU_x5.js";import"./check-DVd4CU5_.js";function gt(){return e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx(ot,{})]})}const R=[{key:"share",label:"Доля в выручке",group:"Финансы",fmt:s=>`${s.toFixed(0)}`},{key:"crShowOrder",label:"CR показ→заказ",group:"Воронка",fmt:s=>`${s.toFixed(2)}%`,heat:"cr"},{key:"crClickOrder",label:"CR переход→заказ",group:"Воронка",fmt:s=>`${s.toFixed(2)}%`,heat:"cr"},{key:"shows",label:"Показы",group:"Воронка",fmt:s=>s.toLocaleString("ru-RU")},{key:"clicks",label:"Перешли в карточку",group:"Воронка",fmt:s=>s.toLocaleString("ru-RU")},{key:"ctr",label:"CTR",group:"Воронка",fmt:s=>`${s.toFixed(1)}%`,heat:"ctr"},{key:"toCart",label:"Положили в корзину",group:"Воронка",fmt:s=>s.toLocaleString("ru-RU")},{key:"crCart",label:"Конверсия в корзину",group:"Воронка",fmt:s=>`${s.toFixed(1)}%`,heat:"cr"},{key:"orders",label:"Заказали товаров",group:"Заказы",fmt:s=>`${s} шт.`},{key:"crOrder",label:"Конверсия в заказ",group:"Воронка",fmt:s=>`${s.toFixed(1)}%`,heat:"cr"},{key:"revenue",label:"Заказали на сумму",group:"Финансы",fmt:s=>`${s.toLocaleString("ru-RU")} ₽`},{key:"revenueDelta",label:"Динамика суммы заказов",group:"Финансы",fmt:s=>`${s>0?"+":""}${s.toLocaleString("ru-RU")} ₽`},{key:"bought",label:"Выкупили товаров",group:"Заказы",fmt:s=>`${s} шт.`},{key:"cancelled",label:"Отменили товаров",group:"Заказы",fmt:s=>`${s} шт.`},{key:"buyoutPct",label:"Процент выкупа",group:"Заказы",fmt:s=>`${s}%`},{key:"boughtSum",label:"Выкупили на сумму",group:"Финансы",fmt:s=>`${s.toLocaleString("ru-RU")} ₽`},{key:"cancelledSum",label:"Отменили на сумму",group:"Финансы",fmt:s=>`${s.toLocaleString("ru-RU")} ₽`},{key:"avgPrice",label:"Средняя цена",group:"Финансы",fmt:s=>`${s} ₽`},{key:"stockWh",label:"Остатки на складе",group:"Склад",fmt:s=>`${s}`},{key:"stockMp",label:"Остатки МП",group:"Склад",fmt:s=>`${s}`},{key:"stockTotal",label:"Сумма остатков",group:"Склад",fmt:s=>`${s}`},{key:"avgDaily",label:"Ср. заказов в день",group:"Заказы",fmt:s=>s.toFixed(1)},{key:"localOrders",label:"Локальные заказы",group:"Заказы",fmt:s=>`${s}`},{key:"cardEff",label:"Эфф-ть карточки",group:"Прочее",fmt:s=>s.toFixed(2)}],_=Object.fromEntries(R.map(s=>[s.key,s])),tt=new Set(R.map(s=>s.key)),st=tt,be=[{id:"all",label:"Все (24)",keys:R.map(s=>s.key)},{id:"mk",label:"Маркетинг",keys:["shows","clicks","ctr","toCart","crCart","crShowOrder","crClickOrder","crOrder","cardEff"]},{id:"fin",label:"Финансы",keys:["share","revenue","revenueDelta","boughtSum","cancelledSum","avgPrice","buyoutPct"]},{id:"log",label:"Логистика",keys:["stockWh","stockMp","stockTotal","avgDaily","localOrders","orders","bought","cancelled"]},{id:"min",label:"Кратко",keys:["shows","clicks","ctr","orders","crShowOrder","revenue","buyoutPct","stockTotal"]}],Z=s=>{let l=s;return()=>(l=(l*9301+49297)%233280,l/233280)};function J(s,l=1){const c=Math.round((1500+s()*7e3)*l),m=4+s()*9,o=Math.round(c*m/100),i=4+s()*12,N=Math.round(o*i/100),j=12+s()*22,b=Math.round(N*j/100),x=700+Math.round(s()*1500),h=b*x,C=70+Math.round(s()*25),A=Math.round(b*C/100),w=b-A,L=Math.round(40+s()*300),f=Math.round(s()*80);return{share:Math.round(l*20),crShowOrder:b/Math.max(c,1)*100,crClickOrder:b/Math.max(o,1)*100,shows:c,clicks:o,ctr:m,toCart:N,crCart:i,orders:b,crOrder:j,revenue:h,revenueDelta:Math.round((s()-.4)*h*.3),bought:A,cancelled:w,buyoutPct:C,boughtSum:A*x,cancelledSum:w*x,avgPrice:x,stockWh:L,stockMp:f,stockTotal:L+f,avgDaily:b/7,localOrders:Math.round(b*(.3+s()*.4)),cardEff:.4+s()*.5}}function ee(s){if(!s.length)return J(Z(1),0);const l=x=>
1s.reduce((h,C)=>h+C[x],0),c=l("shows"),m=l("clicks"),o=l("toCart"),i=l("orders"),N=l("bought"),j=l("revenue"),b=i?Math.round(j/i):0;return{share:s.reduce((x,h)=>x+h.share,0),crShowOrder:i/Math.max(c,1)*100,crClickOrder:i/Math.max(m,1)*100,shows:c,clicks:m,ctr:m/Math.max(c,1)*100,toCart:o,crCart:o/Math.max(m,1)*100,orders:i,crOrder:i/Math.max(o,1)*100,revenue:j,revenueDelta:l("revenueDelta"),bought:N,cancelled:l("cancelled"),buyoutPct:i?Math.round(N/i*100):0,boughtSum:l("boughtSum"),cancelledSum:l("cancelledSum"),avgPrice:b,stockWh:l("stockWh"),stockMp:l("stockMp"),stockTotal:l("stockTotal"),avgDaily:s.reduce((x,h)=>x+h.avgDaily,0),localOrders:l("localOrders"),cardEff:s.reduce((x,h)=>x+h.cardEff,0)/Math.max(s.length,1)}}function at(){const s=["29.05","30.05","31.05","01.06","02.06","03.06","04.06"],l=(c,m,o,i,N,j,b,x)=>{const h=Array.from({length:j}).map((C,A)=>{const w=Z(b+A*37),L=J(w,x*(.5+w()*1.1)),f=s.map((G,$)=>({date:G,m:J(Z(b+A*91+$*13),x*.16)}));return{sku:`${2591200+b*11+A*17}`,name:`${o} · вар. ${A+1}`,brand:i,img:N,rating:4.4+Math.round(w()*6)/10,m:L,days:f}});return{glueId:c,itemId:m,name:o,brand:i,img:N,m:ee(h.map(C=>C.m)),products:h}};return[l("g1","265491017","Трусы кружевные набор","SITY_SHIK","👙",4,11,1.6),l("g2","771504400","Масло кокосовое для тела","ASTARTA","🥥",2,23,.55),l("g3","771504300","Магниевое масло для мышц","ASTARTA","🧴",3,41,.85),l("g4","992112233","Гель для душа парфюм.","LUMINEN","🧼",1,67,.4)]}function rt(s,l){if(!s)return{};const c=s==="ctr"?8:18,m=s==="ctr"?3:5;let o=(l-m)/(c-m);o=Math.max(0,Math.min(1,o));const i=0+o*130;return{background:`hsl(${i} 75% 92%)`,color:`hsl(${i} 55% 28%)`,fontWeight:600}}function Ce(s){let l=2166136261;for(let c=0;c<s.length;c++)l=Math.imul(l^s.charCodeAt(c),16777619);return Math.abs(l)}function te(s,l){const m=Ce(`${s}::${l}`)%1e3/1e3*2-1,o=m<0?-1:1,i=Math.pow(Math.abs(m),1.5)*28;return Math.round(o*i*10)/10}const nt=new Set(["cancelled","cancelledSum"]);function Se(s){return 35+Ce(`health::${s}`)%61}function Ae(s){return s>=80?{bg:"bg-emerald-50",text:"text-emerald-700",ring:"ring-emerald-200",label:"ок"}:s>=60?{bg:"bg-amber-50",text:"text-amber-700",ring:"ring-amber-200",label:"норм"}:{bg:"bg-rose-50",text:"text-rose-600",ring:"ring-rose-200",label:"риск"}}const k=["#8A2BE2","#CB11AB","#FF8A3D","#10B981","#3B82F6","#F59E0B","#EF4444","#06B6D4"];function lt(s){const l=Math.max(...s,1);return s.map(c=>c/l*100)}function ot(){const s=u.useMemo(()=>at(),[]),[l,c]=u.useState(!0),[m,o]=u.useState({g1:!0}),[i,N]=u.useState({}),[j,b]=u.useState(st),[x,h]=u.useState(!1),[C,A]=u.useState(!0),[w,L]=u.useState("multi"),[f,G]=u.useState(["shows","clicks","orders"]),[$,Me]=u.useState(!0),[Be,Le]=u.useState(!1),[W,$e]=u.useState(""),[T,ze]=u.useState(new Set),[ae,Oe]=u.useState(!1),[z,re]=u.useState(0),[O,ne]=u.useState(0),[D,le]=u.useState(0),oe=t=>ze(r=>{const n=new Set(r);return n.has(t)?n.delete(t):n.add(t),n}),Fe=t=>{const r=be.find(n=>n.id===t);r&&b(new Set(r.keys))},E=R.filter(t=>j.has(t.key)),M=u.useMemo(()=>ee(s.map(t=>t.m)),[s]),Re=u.useMemo(()=>{const t=s.flatMap(v=>v.products),r=t.map(v=>v.m.ctr).sort((v,g)=>v-g),n=r[Math.floor(r.length/2)]||0,a=t.map(v=>v.m.crOrder).sort((v,g)=>v-g),d=a[Math.floor(a.length/2)]||0;let p=0,y=0,S=0,B=0,P=0;return t.forEach(v=>{const g=v.m,de=g.avgDaily*7;if(g.stockTotal<de&&(p+=Math.max(0,de-g.stockTotal)*g.avgPrice),g.ctr<n){const H=(n-g.ctr)/100*g.shows;y+=H*(g.crCart/100)*(g.crOrder/100)*g.avgPrice}if(g.crOrder<d){const H=(d-g.crOrder)/100*g.toCart;S+=H*g.avgPrice}B+=g.cancelledSum,P+=g.boughtSum*.05}),{oos:Math.round(p),lowCtr:Math.round(y),lowCr:Math.round(S),cancel:Math.round(B),ret:Math.round(P),medCtr:n,medCr:d}},[s]),ce=u.useMemo(()=>{const t=new Set;return s.forEach(r=>{const n=[...r.products].map(d=>d.m.crOrder).sort((d,p)=>d-p),a=n[Math.floor(n.length/2)]||0;r.products.forEach(d=>{d.m.crOrder<a*.7&&t.add(d.sku)})}),t},[s]),Te=t=>t.products.reduce((r,n)=>r.m.clicks>n.m.clicks?r:n).sku,U=u.useMemo(()=>{const t=new Map;
1return s.forEach(r=>r.products.forEach(n=>n.days.forEach(a=>{t.has(a.date)||t.set(a.date,[]),t.get(a.date).push(a.m)}))),Array.from(t.entries()).map(([r,n])=>{const a=ee(n);return{date:r,...a}})},[s]),ie=u.useMemo(()=>{if(!$)return U;const t=f,r={};return t.forEach(n=>{r[n]=lt(U.map(a=>a[n]))}),U.map((n,a)=>{const d={date:n.date};return t.forEach(p=>d[p]=r[p][a]),t.forEach(p=>d[`__raw_${p}`]=n[p]),d})},[U,f,$]),I=s.filter(t=>!W||t.name.toLowerCase().includes(W.toLowerCase())||t.brand.toLowerCase().includes(W.toLowerCase())),De=()=>{const t=["Артикул","Название",...E.map(p=>p.label)],r=[];I.forEach(p=>{l?(r.push(["Вся склейка",`${p.name} · ${p.products.length} тов.`,...E.map(y=>String(p.m[y.key]))]),p.products.forEach(y=>r.push([y.sku,y.name,...E.map(S=>String(y.m[S.key]))]))):p.products.forEach(y=>r.push([y.sku,y.name,...E.map(S=>String(y.m[S.key]))]))});const n=[t,...r].map(p=>p.map(y=>`"${y}"`).join(";")).join(`
2`),a=new Blob(["\uFEFF"+n],{type:"text/csv;charset=utf-8"}),d=document.createElement("a");d.href=URL.createObjectURL(a),d.download=`funnel_${Date.now()}.csv`,d.click()};return e.jsxs("div",{className:"min-h-screen bg-[#f6f5fb] text-[#2a1b4a]",children:[e.jsxs("header",{className:"sticky top-0 z-40 border-b border-black/5 bg-white/90 backdrop-blur-xl",children:[e.jsx(Pe,{}),e.jsxs("div",{className:"mx-auto flex max-w-[1600px] items-center gap-4 px-6 py-3",children:[e.jsx("h1",{className:"text-[15px] font-semibold leading-tight",children:"Воронка продаж"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ue,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{value:W,onChange:t=>$e(t.target.value),placeholder:"Поиск по склейке, бренду…",className:"w-64 rounded-lg border border-black/10 bg-white py-2 pl-8 pr-3 text-sm outline-none focus:border-[#8A2BE2]/40"})]}),e.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-lg border border-black/10 bg-white px-3 py-2 text-xs text-[#2a1b4a]/80 hover:border-[#8A2BE2]/40",children:[e.jsx(ge,{className:"size-3.5"})," 29.05 — 04.06.2026"]}),e.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-lg border border-black/10 bg-white px-3 py-2 text-xs text-[#2a1b4a]/80 hover:border-[#8A2BE2]/40",children:[e.jsx(Ie,{className:"size-3.5"})," Фильтры ",e.jsx("span",{className:"rounded bg-[#8A2BE2]/10 px-1.5 py-px text-[10px] text-[#8A2BE2]",children:"3"})]}),e.jsxs("button",{onClick:()=>h(t=>!t),className:"inline-flex items-center gap-1.5 rounded-lg border border-black/10 bg-white px-3 py-2 text-xs text-[#2a1b4a]/80 hover:border-[#8A2BE2]/40",children:[e.jsx(K,{className:"size-3.5"})," Колонки ",E.length,"/",R.length]}),e.jsxs("button",{onClick:De,className:"inline-flex items-center gap-1.5 rounded-lg bg-[#CCFF00] px-3 py-2 text-xs font-semibold text-[#2a1b4a] ring-1 ring-[#8A2BE2]/20 hover:brightness-105",children:[e.jsx(_e,{className:"size-3.5"})," Excel"]})]})]}),e.jsxs("div",{className:"mx-auto flex max-w-[1600px] items-center gap-3 px-6 pb-3",children:[e.jsxs("div",{className:"inline-flex rounded-lg bg-[#f3f3f6] p-1 text-xs",children:[e.jsxs("button",{onClick:()=>c(!0),className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 transition ${l?"bg-[#8A2BE2] text-white shadow-sm":"text-gray-600 hover:bg-white"}`,children:[e.jsx(Y,{className:"size-3.5"})," По склейкам"]}),e.jsx("button",{onClick:()=>c(!1),className:`rounded-md px-3 py-1.5 transition ${l?"text-gray-600 hover:bg-white":"bg-[#8A2BE2] text-white shadow-sm"}`,children:"По товарам"})]}),e.jsxs("div",{className:"text-[11px] text-gray-500",children:["Склейки — по ",e.jsx("span",{className:"font-mono text-[#2a1b4a]",children:"itemID"})," WB Content API. Лидер склейки ",e.jsx(je,{className:"-mt-0.5 inline size-3 text-[#8A2BE2]"})," — макс. переходы."]})]})]}),e.jsx(Ge,{}),e.jsxs("main",{className:"mx-auto max-w-[1600px] space-y-4 px-6 py-6",children:[(()=>{const t=Re,r=t.oos+t.lowCtr+t.lowCr+t.cancel+t.ret,n=[{key:"oos",label:"Out of stock",v:t.oos,color:"bg-rose-500",action:"Создать поставку →",formula:"Для каждого товара: дней остатка = Сумма остатков ÷ Ср. заказов в день. Если < 7 дней — считаем упущенные продажи: (Ср. заказов в день × 7 − Сумма остатков) × Средняя цена. Затем суммируем по всем товарам."}
2,{key:"ctr",label:"Низкий CTR",v:t.lowCtr,color:"bg-amber-500",action:"Сменить главное фото →",formula:`Σ для товаров с CTR < медианы (${t.medCtr.toFixed(1)}%): (медCTR − CTR) × Показы × CR корзины × CR заказа × Цена`},{key:"cr",label:"Низкий CR",v:t.lowCr,color:"bg-orange-500",action:"Обновить описание / цену →",formula:`Σ для товаров с CR заказа < медианы (${t.medCr.toFixed(1)}%): (медCR − CR) × В корзине × Цена`},{key:"cancel",label:"Отмены",v:t.cancel,color:"bg-fuchsia-500",action:"Проверить остатки в РЦ →",formula:"Σ «Отменили на сумму» из таблицы — прямая сумма отменённых заказов"},{key:"ret",label:"Возвраты",v:t.ret,color:"bg-violet-500",action:"Контроль качества →",formula:"Оценка ≈ 5% от «Выкупили на сумму» (нет точных данных о возвратах в таблице)"}];return e.jsx("section",{className:"overflow-hidden rounded-2xl border border-rose-200/60 bg-gradient-to-r from-rose-50 via-white to-white shadow-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-6 px-5 py-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wide text-rose-600",children:[e.jsx(ye,{className:"size-3.5"})," Потерянная выручка · 29.05 — 04.06",e.jsxs("span",{className:"group relative inline-flex",children:[e.jsx(xe,{className:"size-3.5 cursor-help text-rose-400"}),e.jsx("span",{className:"pointer-events-none absolute left-5 top-0 z-20 hidden w-80 rounded-lg border border-black/10 bg-white p-3 text-[11px] font-normal normal-case tracking-normal text-gray-700 shadow-xl group-hover:block",children:"Считается из основной таблицы ниже: сумма пяти причин — Out of stock, низкий CTR, низкий CR, отмены и возвраты. Бенчмарк CTR/CR — медиана по портфелю товаров."})]})]}),e.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-bold tabular-nums text-rose-600",children:["−",r.toLocaleString("ru-RU")," ₽"]}),e.jsxs("span",{className:"text-[12px] text-gray-500",children:["≈ ",M.revenue?Math.round(r/M.revenue*100):0,"% от выручки · можно вернуть"]})]})]}),e.jsxs("div",{className:"flex-1 max-w-3xl",children:[e.jsx("div",{className:"flex h-2 overflow-hidden rounded-full bg-black/5",children:n.map(a=>e.jsx("div",{className:a.color,style:{flex:Math.max(a.v,1)},title:`${a.label}: ${a.v.toLocaleString("ru-RU")} ₽`},a.key))}),e.jsx("div",{className:"mt-2 grid grid-cols-5 gap-2 text-[11px]",children:n.map(a=>e.jsxs("div",{className:"group relative rounded-md border border-black/5 bg-white px-2 py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600",children:[e.jsx("span",{className:`size-2 rounded-sm ${a.color}`}),e.jsx("span",{className:"truncate",children:a.label}),e.jsx(xe,{className:"ml-auto size-3 cursor-help text-gray-400"})]}),e.jsxs("div",{className:"pointer-events-none absolute left-0 top-full z-20 mt-1 hidden w-72 rounded-lg border border-black/10 bg-white p-2.5 text-[10.5px] leading-snug text-gray-700 shadow-xl group-hover:block",children:[e.jsxs("div",{className:"mb-1 font-semibold text-[#2a1b4a]",children:[a.label," · как считаем"]}),a.formula]}),e.jsxs("div",{className:"mt-0.5 font-mono text-[12px] font-semibold tabular-nums text-[#2a1b4a]",children:["−",a.v.toLocaleString("ru-RU")," ₽"]}),e.jsx("button",{className:"mt-0.5 text-[10px] font-medium text-[#8A2BE2] hover:underline",children:a.action})]},a.key))})]})]})})})(),e.jsx("section",{className:"grid grid-cols-4 gap-3",children:[{label:"Выручка",v:M.revenue,fmt:t=>`${t.toLocaleString("ru-RU")} ₽`,d:-9.6},{label:"Заказы",v:M.orders,fmt:t=>`${t} шт`,d:-11}
2,{label:"CR показ→заказ",v:M.crShowOrder,fmt:t=>`${t.toFixed(2)}%`,d:-2.3},{label:"Выкуп",v:M.buyoutPct,fmt:t=>`${t}%`,d:1.1}].map(t=>{const r=1+z/100,n=1+O/100,a=r*n,d=Math.max(1,M.buyoutPct),p=Math.min(100,d+D),y=p/d,S=t.label==="Заказы"?t.v*a:t.label==="Выручка"?t.v*a*y:t.label==="Выкуп"?p:t.v*a,B=(S-t.v)/Math.max(t.v,1)*100,P=z||O||D;return e.jsxs("div",{className:"rounded-2xl border border-black/5 bg-white p-3 shadow-sm",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-500",children:t.label}),e.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-xl font-bold tabular-nums",children:t.fmt(t.v)}),e.jsxs("span",{className:`inline-flex items-center gap-0.5 text-[11px] font-semibold tabular-nums ${t.d>=0?"text-emerald-600":"text-rose-500"}`,children:[t.d>=0?e.jsx(Ne,{className:"size-3"}):e.jsx(ke,{className:"size-3"}),t.d>0?"+":"",t.d,"%"]})]}),e.jsx("div",{className:"mt-0.5 text-[10px] text-gray-400",children:"vs. 22.05 — 28.05.2026"}),P?e.jsxs("div",{className:"mt-2 flex items-center justify-between rounded-md border border-dashed border-[#8A2BE2]/40 bg-[#faf8ff] px-2 py-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-[#8A2BE2]",children:"«что если»"}),e.jsxs("span",{className:"text-[12px] font-bold tabular-nums text-[#8A2BE2]",children:[t.fmt(Math.round(S)),e.jsxs("span",{className:`ml-1 text-[10px] ${B>=0?"text-emerald-600":"text-rose-500"}`,children:[B>0?"+":"",B.toFixed(1),"%"]})]})]}):null]},t.label)})}),e.jsxs("section",{className:"overflow-hidden rounded-2xl border border-[#8A2BE2]/20 bg-white shadow-sm",children:[e.jsxs("button",{onClick:()=>Oe(t=>!t),className:"flex w-full items-center justify-between border-b border-black/5 bg-gradient-to-r from-[#faf8ff] to-white px-4 py-2.5 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"grid h-6 w-6 place-items-center rounded-md bg-[#8A2BE2] text-white",children:e.jsx(me,{className:"size-3.5"})}),e.jsxs("h3",{className:"text-sm font-semibold tracking-tight",children:["Симулятор «что если»",e.jsxs("span",{className:"ml-2 text-[#8A2BE2]",children:["· CTR ",z>0?"+":"",z,"% · CR ",O>0?"+":"",O,"% · Выкуп ",D>0?"+":"",D," п.п."]})]}),e.jsx("span",{className:"rounded-md bg-emerald-50 px-2 py-0.5 text-[10px] font-medium text-emerald-700",children:"live recalc"})]}),e.jsx("span",{className:"text-[11px] text-gray-500",children:ae?"Свернуть":"Развернуть"})]}),ae&&e.jsxs("div",{className:"grid grid-cols-3 gap-4 px-4 py-4",children:[[{id:"ctr",label:"CTR показ→клик",v:z,set:re,min:-50,max:100,unit:"%"},{id:"cr",label:"CR клик→заказ",v:O,set:ne,min:-50,max:100,unit:"%"},{id:"buy",label:"Процент выкупа",v:D,set:le,min:-20,max:20,unit:" п.п."}].map(t=>e.jsxs("div",{className:"rounded-xl border border-black/5 bg-[#faf8ff] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500",children:[e.jsx("span",{className:"font-semibold uppercase tracking-wide",children:t.label}),e.jsxs("span",{className:`tabular-nums font-bold ${t.v>0?"text-emerald-600":t.v<0?"text-rose-500":"text-[#2a1b4a]"}`,children:[t.v>0?"+":"",t.v,t.unit]})]}),e.jsx("input",{type:"range",min:t.min,max:t.max,step:1,value:t.v,onChange:r=>t.set(Number(r.target.value)),className:"mt-2 w-full accent-[#8A2BE2]"}),e.jsxs("div",{className:"mt-1 flex justify-between text-[9.5px] text-gray-400",children:[e.jsxs("span",{children:[t.min,t.unit]}),e.jsx("span",{children:"0"}),e.jsxs("span",{children:["+",t.max,t.unit]})]})]},t.id)),e.jsxs("div",{className:"col-span-3 flex items-center justify-between rounded-lg bg-[#CCFF00]/15 px-3 py-2 text-[11px]",children:[e.jsxs("span",{className:"text-[#2a1b4a]/80",children:["Заказы → ",e.jsx("b",{className:"font-mono",children:Math.round(M.orders*(1+z/100)*(1+O/100))})," шт · Выручка → ",e.jsxs("b",{className:"font-mono",children:[Math.round(M.revenue*(1+z/100)*(1+O/100)*(1+D/200)).toLocaleStr
2ing("ru-RU")," ₽"]})]}),e.jsxs("button",{onClick:()=>{re(0),ne(0),le(0)},className:"inline-flex items-center gap-1 rounded-md border border-black/10 bg-white px-2 py-1 text-[11px] text-gray-600 hover:border-[#8A2BE2]/40 hover:text-[#8A2BE2]",children:[e.jsx(We,{className:"size-3"})," Сбросить"]})]})]})]}),(()=>{const[t,r]=u.useState(48e5),n=30,a=19,d=Math.round(t*.58),p=d/a,y=Math.round(p*n),S=Math.round(t/n*a),B=Math.round(d/S*100),P=Math.round(y/t*100),v=y>=t;return e.jsxs("section",{className:"grid grid-cols-3 gap-3 overflow-hidden rounded-2xl border border-black/5 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"col-span-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:[e.jsx(me,{className:"size-3.5 text-[#8A2BE2]"})," План vs Факт · июнь 2026"]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-gray-500",children:"План на месяц"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:0,step:1e4,value:t,onChange:g=>r(Number(g.target.value)),className:"w-40 rounded-md border border-black/10 bg-[#faf8ff] px-2 py-1 font-mono text-lg font-bold tabular-nums text-[#2a1b4a] focus:border-[#8A2BE2]/40 focus:outline-none"}),e.jsx("span",{className:"text-lg font-bold text-[#2a1b4a]",children:"₽"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-lg border border-black/5 bg-[#faf8ff] p-2",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:["Факт · ",a," дн."]}),e.jsxs("div",{className:"mt-0.5 font-mono text-[13px] font-bold tabular-nums",children:[d.toLocaleString("ru-RU")," ₽"]}),e.jsxs("div",{className:`text-[10px] font-semibold ${B>=100?"text-emerald-600":"text-rose-500"}`,children:[B,"% от плана к дате"]})]}),e.jsxs("div",{className:`rounded-lg border p-2 ${v?"border-emerald-200 bg-emerald-50":"border-rose-200 bg-rose-50"}`,children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"Прогноз на конец"}),e.jsxs("div",{className:`mt-0.5 font-mono text-[13px] font-bold tabular-nums ${v?"text-emerald-700":"text-rose-600"}`,children:[y.toLocaleString("ru-RU")," ₽"]}),e.jsxs("div",{className:`text-[10px] font-semibold ${v?"text-emerald-600":"text-rose-500"}`,children:[v?"+":"−",Math.abs(P-100),"% к плану"]})]})]}),!v&&e.jsxs("div",{className:"rounded-md border border-dashed border-rose-300 bg-rose-50/60 px-2 py-1.5 text-[11px] text-rose-700",children:["Чтобы догнать план — нужно ≈"," ",e.jsxs("b",{className:"font-mono",children:[Math.round((t-d)/(n-a)).toLocaleString("ru-RU")," ₽/день"]})," ","(сейчас ",Math.round(p).toLocaleString("ru-RU")," ₽)."]})]}),e.jsx("div",{className:"col-span-2",children:e.jsxs("div",{className:"relative h-32 w-full overflow-hidden rounded-lg bg-gradient-to-b from-[#faf8ff] to-white ring-1 ring-black/5",children:[e.jsxs("svg",{viewBox:"0 0 600 120",preserveAspectRatio:"none",className:"absolute inset-0 h-full w-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"factFill",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#8A2BE2",stopOpacity:"0.35"}),e.jsx("stop",{offset:"100%",stopColor:"#8A2BE2",stopOpacity:"0.02"})]})}),e.jsx("line",{x1:"0",y1:"110",x2:"600",y2:"10",stroke:"#2a1b4a",strokeWidth:"1.5",strokeDasharray:"2 3",opacity:"0.45"}),e.jsx("path",{d:"M0,110 L20,108 L50,104 L80,98 L110,93 L140,90 L170,85 L200,80 L230,73 L260,68 L290,62 L320,57 L350,52 L380,48 L380,120 L0,120 Z",fill:"url(#factFill)"}),e.jsx("path",{d:"M0,110 L20,108 L50,104 L80,98 L110,93 L140,90 L170,85 L200,80 L230,73 L260,68 L290,62 L320,57 L350,52 L380,48",fill:"none",stroke:"#8A2BE2",strokeWidth:"2"}),e.jsx("path",{d:"M380,48 L420,42 L470,34 L520,26 L570,18 L600,14",fill:"none",stroke:"#8A2BE2",strokeWidth:"2",strokeDasharray:"4 4",opacity:"0.6"}),e.jsx("line",{x1:"380",y1:"0",x2:"380",y2:"120",stroke:"#CCFF00",strokeWidth:"2"})]}),e.jsxs("div",{className:"absolute right-2 top-1.5 flex items-center gap-3 text-[10px] text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"h-0.5 w-3 bg-[#8A2BE2]"})," факт"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"h-0.5 w-3 border-t border-dashed border-[#8A2BE2]"})," прогноз"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"h-0.5 w-3 border-t border-dashed border-[#2a1b4a]"})," план"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"h-3 w-0.5 bg-[#CCFF00]"})," сегодня"]})]})]})})]})})(),e.jsxs("section",{className:"overflow-hidden rounded-2xl border border-black/5 bg-white shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-black/5 bg-gradient-to-r from-[#faf8ff] to-white px-4 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"grid h-6 w-6 place-items-center rounded-md bg-[#8A2BE2] text-white",children:e.jsx(he,{className:"size-3.5"})}),e.jsxs("h3",{className:"text-sm font-semibold tracking-tight",children:["График показателей"," ",e.jsxs("span",{className:"ml-1 text-[#8A2BE2]",children:["· ",f.length," метр",f.length===1?"ика":"ик"]})]}),e.jsx("span",{className:"rounded-md bg-[#8A2BE2]/10 px-2 py-0.5 text-[10px] text-[#8A2BE2]",children:"за 7 дней"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"inline-flex rounded-md bg-[#f3f3f6] p-0.5 text-[11px]",children:[e.jsxs("button",{onClick:()=>L("multi"),className:`inline-flex items-center gap-1 rounded px-2 py-1 ${w==="multi"?"bg-[#8A2BE2] text-white":"text-gray-600"}`,children:[e.jsx(he,{className:"size-3"})," Линии"]}),e.jsxs("button",{onClick:()=>L("funnel"),className:`inline-flex items-center gap-1 rounded px-2 py-1 ${w==="funnel"?"bg-[#8A2BE2] text-white":"text-gray-600"}`,children:[e.jsx(Ke,{className:"size-3"})," Этапы"]}),e.jsxs("button",{onClick:()=>L("intersect"),className:`inline-flex items-center gap-1 rounded px-2 py-1 ${w==="intersect"?"bg-[#8A2BE2] text-white":"text-gray-600"}`,children:[e.jsx(He,{className:"size-3"})," Пересечение"]})]}),e.jsxs("button",{onClick:()=>Le(t=>!t),className:"inline-flex items-center gap-1 rounded-md bg-[#2a1b4a]/5 px-2 py-1.5 text-[11px] text-[#2a1b4a] hover:bg-[#2a1b4a]/10",children:[e.jsx(K,{className:"size-3.5"})," Настройки графика"]}),e.jsx("button",{onClick:()=>A(t=>!t),className:"inline-flex items-center gap-1 rounded-md bg-[#2a1b4a]/5 px-2 py-1.5 text-[11px] text-[#2a1b4a] hover:bg-[#2a1b4a]/10",children:C?"Свернуть":"Развернуть"})]})]}),Be&&e.jsxs("div",{className:"space-y-2 border-b border-black/5 bg-[#faf8ff] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:["Выберите метрики для графика"," ",e.jsxs("span",{className:"text-[#8A2BE2]",children:["(",f.length," / макс. 6
2)"]})]}),e.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2 text-[11px] text-gray-600",children:[e.jsx("input",{type:"checkbox",checked:$,onChange:t=>Me(t.target.checked),className:"accent-[#8A2BE2]"}),"Нормализовать к 100% (для разных единиц)"]})]}),["Воронка","Заказы","Финансы","Склад","Прочее"].map(t=>e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"w-20 shrink-0 text-[10px] font-semibold uppercase tracking-wide text-gray-500",children:t}),R.filter(r=>r.group===t).map(r=>{const n=f.includes(r.key),a=f.indexOf(r.key),d=n?k[a]:void 0;return e.jsxs("button",{onClick:()=>{n?G(f.filter(p=>p!==r.key)):f.length<6&&G([...f,r.key])},className:`inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] transition ${n?"border-transparent bg-white text-[#2a1b4a] shadow-sm":"border-black/10 bg-white/60 text-gray-500 hover:border-[#8A2BE2]/30 hover:text-[#2a1b4a]"}`,style:n?{boxShadow:`inset 0 0 0 1.5px ${d}`}:void 0,children:[n&&e.jsx("span",{className:"size-2 rounded-full",style:{background:d}}),r.label]},r.key)})]},t)),w==="intersect"&&f.length!==2&&e.jsxs("div",{className:"mt-2 rounded-md bg-amber-50 px-3 py-1.5 text-[11px] text-amber-700 ring-1 ring-amber-200",children:["Режим «Пересечение» работает с ровно 2 метриками — сейчас выбрано ",f.length,"."]})]}),C&&e.jsxs("div",{className:"px-4 py-4",children:[e.jsx("div",{className:"h-72",children:e.jsx(Ye,{width:"100%",height:"100%",children:w==="multi"?e.jsxs(Ve,{data:ie,margin:{top:10,right:20,left:0,bottom:0},children:[e.jsx("defs",{children:f.map((t,r)=>e.jsxs("linearGradient",{id:`g-${t}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:k[r],stopOpacity:.18}),e.jsx("stop",{offset:"100%",stopColor:k[r],stopOpacity:0})]},t))}),e.jsx(V,{stroke:"#00000010",vertical:!1}),e.jsx(q,{dataKey:"date",stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1}),e.jsx(Q,{stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1,unit:$?"%":""}),e.jsx(X,{content:e.jsx(Ee,{normalize:$})}),e.jsx(pe,{wrapperStyle:{fontSize:11,paddingTop:8}}),f.map((t,r)=>e.jsx(qe,{type:"monotone",dataKey:t,name:_[t].label,stroke:k[r],strokeWidth:2.2,dot:{r:3,strokeWidth:0,fill:k[r]},activeDot:{r:5}},t))]}):w==="funnel"?e.jsxs(Qe,{data:U,margin:{top:10,right:20,left:0,bottom:0},children:[e.jsx(V,{stroke:"#00000010",vertical:!1}),e.jsx(q,{dataKey:"date",stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1}),e.jsx(Q,{stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1}),e.jsx(X,{contentStyle:{background:"white",border:"1px solid #00000010",borderRadius:8,fontSize:12,boxShadow:"0 6px 24px -8px #2a1b4a30"}}),e.jsx(pe,{wrapperStyle:{fontSize:11,paddingTop:8}}),e.jsx(F,{dataKey:"shows",name:"Показы",stroke:"#8A2BE2",fill:"#8A2BE2",fillOpacity:.12}),e.jsx(F,{dataKey:"clicks",name:"Переходы",stroke:"#CB11AB",fill:"#CB11AB",fillOpacity:.18}),e.jsx(F,{dataKey:"toCart",name:"В корзину",stroke:"#FF8A3D",fill:"#FF8A3D",fillOpacity:.25}),e.jsx(F,{dataKey:"orders",name:"Заказы",stroke:"#10B981",fill:"#10B981",fillOpacity:.35})]}):e.jsx(ct,{data:ie,metrics:f.slice(0,2),normalize:$})})}),w==="intersect"&&f.length>=2&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 rounded-lg bg-[#faf8ff] px-3 py-2 text-[11px] text-[#2a1b4a]/80",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block size-3 rounded",style:{background:k[0],opacity:.4}}),_[f[0]].label]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block size-3 rounded",style:{background:k[1],opacity:.4}}),_[f[1]].label]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block size-3 rounded",style:{background:`repeating-linear-gradient(45deg, ${k[
20]}, ${k[0]} 2px, ${k[1]} 2px, ${k[1]} 4px)`}}),"Пересечение (общая зона)"]}),e.jsx("span",{className:"ml-auto text-[10px] text-gray-500",children:"Пересечение = min(А, B) после нормализации — показывает «общий потенциал» воронки."})]})]})]}),e.jsxs("div",{className:`flex gap-3 ${x?"items-start":""}`,children:[e.jsxs("section",{className:"min-w-0 flex-1 overflow-hidden rounded-2xl border border-black/5 bg-white shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[#8A2BE2]/15 bg-gradient-to-r from-[#faf8ff] to-white px-4 py-2.5 text-[#2a1b4a]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"grid h-6 w-6 place-items-center rounded-md bg-[#8A2BE2] text-white",children:e.jsx(Y,{className:"size-3.5"})}),e.jsxs("h3",{className:"text-sm font-semibold tracking-tight",children:[l?"Склейки":"Товары"," ·"," ",e.jsx("span",{className:"text-[#8A2BE2]",children:I.length})]}),e.jsx("span",{className:"rounded-md bg-[#8A2BE2]/10 px-2 py-0.5 text-[10px] text-[#8A2BE2]",children:"кэш · 2 мин назад"}),e.jsx("span",{className:"rounded-md bg-emerald-50 px-2 py-0.5 text-[10px] font-medium text-emerald-700",children:"heatmap CTR / CR"}),e.jsx("span",{className:"rounded-md bg-rose-50 px-2 py-0.5 text-[10px] font-medium text-rose-600",children:"бэйдж «узкое горло»"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-500",children:[e.jsxs("button",{onClick:()=>h(t=>!t),className:"inline-flex items-center gap-1 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:[e.jsx(K,{className:"size-3"})," Настройки таблицы"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-sm bg-[#CCFF00]"})," Лидер склейки"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-sm bg-rose-400"})," Узкое горло"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-sm bg-[#8A2BE2]"})," Склейка"]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[1200px] border-collapse text-sm",children:[e.jsx("thead",{className:"sticky top-0 z-10 bg-[#fafafb] text-[11px] uppercase tracking-wide text-gray-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky left-0 z-20 min-w-[300px] border-b border-black/5 bg-[#fafafb] px-4 py-2 text-left font-semibold",children:"Товар / Склейка"}),E.map(t=>e.jsx("th",{className:"whitespace-nowrap border-b border-black/5 px-3 py-2 text-right font-semibold",children:e.jsxs("button",{className:"ml-auto inline-flex items-center gap-1 hover:text-[#2a1b4a]",children:[t.label,e.jsx(Xe,{className:"h-3 w-3 text-gray-300"})]})},t.key))]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b border-black/5 bg-[#CCFF00]/10",children:[e.jsxs("td",{className:"sticky left-0 z-10 bg-[#f3fadd] px-4 py-2 font-semibold",children:["Итого по ",I.length," ",l?"склейкам":"товарам"]}),E.map(t=>e.jsx("td",{className:"px-3 py-2 text-right font-mono text-xs font-semibold tabular-nums",children:t.fmt(M[t.key])},t.key))]}),l?I.map(t=>{const r=m[t.glueId],n=Te(t);return e.jsxs(u.Fragment,{children:[e.jsxs("tr",{className:"border-b border-black/5 transition hover:bg-[#CCFF00]/[0.06]",children:[e.jsx("td",{className:"sticky left-0 z-10 bg-white px-4 py-2",children:e.jsxs("button",{onClick:()=>o({...m,[t.glueId]:!r}),className:"flex items-center gap-2.5 text-left",children:[r?e.jsx(ve,{className:"size-4 text-gray-400"}):e.jsx(we,{className:"size-4 text-gray-400"}),e.jsx("span",{className:"grid size-9 place-items-center rounded-md bg-[#faf8ff] text-base ring-1 ring-[#8A2BE2]/10",children:t.img}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate font-medium",children:[t.name,(()=>{const a=Se(t.glueId),d=Ae(a);return e.jsxs("span",{title:"Health Score склейки",className:`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ring-1 ${d.bg} ${d.text} ${d.ring}`,children:["♥ ",a]})})()]}),e.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 text-[11px] text-gray-500",children:[e.jsx("span",{children:t.brand}),e.jsx("span",{className:"text-gray-300",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-[#8A2BE2]/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#8A2BE2]",children:[e.jsx(Y,{className:"size-2.5"}),"склейка · ",t.products.length," тов."]}),e.jsx("span",{className:"text-gray-300",children:"·"}),e.jsxs("span",{className:"font-mono text-[10px] text-gray-400",children:["item ",t.itemId]})]})]})]})}),E.map(a=>e.jsx(se,{c:a,value:t.m[a.key],delta:te(t.glueId,a.key),size:"md"},a.key))]}),r&&[...t.products].sort((a,d)=>(T.has(d.sku)?1:0)-(T.has(a.sku)?1:0)).map(a=>e.jsx(fe,{p:a,cols:E,indent:1,bottleneck:ce.has(a.sku),leader:a.sku===n,open:i[a.sku],onToggle:()=>N({...i,[a.sku]:!i[a.sku]}),pinned:T.has(a.sku),onPin:()=>oe(a.sku)},a.sku))]},t.glueId)}):[...I.flatMap(n=>n.products)].sort((n,a)=>(T.has(a.sku)?1:0)-(T.has(n.sku)?1:0)).map(n=>e.jsx(fe,{p:n,cols:E,bottleneck:ce.has(n.sku),indent:0,open:i[n.sku],onToggle:()=>N({...i,[n.sku]:!i[n.sku]}),pinned:T.has(n.sku),onPin:()=>oe(n.sku)},n.sku))]})]})})]}),x&&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(K,{className:"size-3.5 text-[#8A2BE2]"})," Настройки таблицы"]}),e.jsx("button",{onClick:()=>h(!1),className:"rounded-md p-1 text-gray-400 hover:bg-black/5 hover:text-[#2a1b4a]","aria-label":"Закрыть",children:e.jsx(Ze,{className:"size-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:[be.map(t=>e.jsx("button",{onClick:()=>Fe(t.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:t.label},t.id)),e.jsx("button",{onClick:()=>b(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:"Скрыть все"})]})]}
2),["Воронка","Заказы","Финансы","Склад","Прочее"].map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-gray-500",children:t}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:R.filter(r=>r.group===t).map(r=>{const n=j.has(r.key);return e.jsx("button",{onClick:()=>{const a=new Set(j);n?a.delete(r.key):a.add(r.key),b(a)},className:`rounded-md border px-2 py-1 text-[11px] transition ${n?"border-[#8A2BE2]/40 bg-white text-[#2a1b4a]":"border-black/10 bg-white/60 text-gray-400 hover:border-[#8A2BE2]/30 hover:text-[#2a1b4a]"}`,children:r.label},r.key)})})]},t))]})]})]})]})]})}function fe({p:s,cols:l,indent:c,bottleneck:m,leader:o,open:i,onToggle:N,pinned:j,onPin:b}){return e.jsxs(u.Fragment,{children:[e.jsxs("tr",{className:`border-b border-black/5 transition hover:bg-[#CCFF00]/[0.06] ${o?"bg-[#CCFF00]/[0.05]":""} ${j?"bg-[#8A2BE2]/[0.04]":""}`,children:[e.jsx("td",{className:"sticky left-0 z-10 bg-white px-4 py-2",style:{paddingLeft:16+c*22},children:e.jsxs("div",{className:"flex items-center gap-2 text-left",children:[b&&e.jsx("button",{onClick:b,title:j?"Открепить":"Закрепить наверху",className:`grid size-6 place-items-center rounded-md transition ${j?"bg-[#8A2BE2] text-white":"text-gray-300 hover:bg-[#8A2BE2]/10 hover:text-[#8A2BE2]"}`,children:j?e.jsx(ue,{className:"size-3"}):e.jsx(ue,{className:"size-3"})}),e.jsxs("button",{onClick:N,className:"flex flex-1 items-center gap-2.5 text-left",children:[N?i?e.jsx(ve,{className:"size-3.5 text-gray-400"}):e.jsx(we,{className:"size-3.5 text-gray-400"}):e.jsx("span",{className:"w-3.5"}),e.jsx("span",{className:"grid size-8 place-items-center rounded-md bg-[#faf8ff] text-sm ring-1 ring-black/5",children:s.img}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-[13px] font-medium",children:[s.name,o&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-[#CCFF00] px-1.5 py-0.5 text-[10px] font-bold text-[#2a1b4a] ring-1 ring-[#8A2BE2]/20",children:[e.jsx(je,{className:"size-2.5"})," лидер"]}),m&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-rose-50 px-1.5 py-0.5 text-[10px] font-semibold text-rose-600 ring-1 ring-rose-200",children:[e.jsx(ye,{className:"size-2.5"})," узкое горло"]}),(()=>{const x=Se(s.sku),h=Ae(x);return e.jsxs("span",{title:"Health Score: контент + рейтинг + остатки + воронка",className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ring-1 ${h.bg} ${h.text} ${h.ring}`,children:["♥ ",x]})})()]}),e.jsxs("span",{className:"mt-0.5 block text-[11px] text-gray-500",children:["Артикул ",e.jsx("span",{className:"font-mono text-[#2a1b4a]/70",children:s.sku})," ·"," ",s.brand," · ★ ",s.rating]})]})]})]})}),l.map(x=>e.jsx(se,{c:x,value:s.m[x.key],delta:te(s.sku,x.key)},x.key))]}),i&&s.days.map(x=>e.jsxs("tr",{className:"border-b border-black/5 bg-[#fafafb] text-gray-600",children:[e.jsx("td",{className:"sticky left-0 z-10 bg-[#fafafb] px-4 py-1.5",style:{paddingLeft:16+(c+1)*22+60},children:e.jsxs("span",{className:"inline-flex items-center gap-2 text-[11px]",children:[e.jsx(ge,{className:"size-3 text-gray-400"}),x.date,".2026"]}
2)}),l.map(h=>e.jsx(se,{c:h,value:x.m[h.key],delta:te(`${s.sku}-${x.date}`,h.key),size:"sm",bg:"#fafafb"},h.key))]},x.date))]})}function se({c:s,value:l,delta:c,size:m="md",bg:o}){const N=nt.has(s.key)?c<0:c>0,j=Math.abs(c)<.1,b=j?"text-gray-400":N?"text-emerald-600":"text-rose-500",x=j?null:N?Ne:ke,h=m==="sm"?"px-3 py-1.5":"px-3 py-2",C=m==="sm"?"text-[11px]":"text-xs";return e.jsx("td",{className:`${h} text-right font-mono ${C} tabular-nums`,style:{...rt(s.heat,l),...o&&!s.heat?{background:o}:{}},children:e.jsxs("div",{className:"flex flex-col items-end leading-tight",children:[e.jsx("span",{children:s.fmt(l)}),!j&&e.jsxs("span",{className:`mt-0.5 inline-flex items-center gap-0.5 text-[9.5px] font-semibold ${b}`,children:[x&&e.jsx(x,{className:"size-2.5"}),c>0?"+":"",c.toFixed(1),"%"]})]})})}function Ee({active:s,payload:l,label:c,normalize:m}){return!s||!l?.length?null:e.jsxs("div",{className:"rounded-lg border border-black/10 bg-white px-3 py-2 text-xs shadow-lg",children:[e.jsx("div",{className:"mb-1 font-semibold text-[#2a1b4a]",children:c}),e.jsx("div",{className:"space-y-1",children:l.map(o=>{const i=o.payload[`__raw_${o.dataKey}`];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full",style:{background:o.color}}),e.jsx("span",{className:"text-gray-600",children:o.name}),e.jsxs("span",{className:"ml-auto font-mono font-semibold tabular-nums text-[#2a1b4a]",children:[m&&i!==void 0?i.toLocaleString("ru-RU"):Math.round(o.value),m&&e.jsxs("span",{className:"ml-1 text-gray-400",children:["(",Math.round(o.value),"%)"]})]})]},o.dataKey)})})]})}function ct({data:s,metrics:l,normalize:c}){const m=s.map(o=>{const i=o[l[0]],N=o[l[1]];return{...o,__min:Math.min(i??0,N??0)}});return e.jsxs(Je,{data:m,margin:{top:10,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"ia",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:k[0],stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:k[0],stopOpacity:.05})]}),e.jsxs("linearGradient",{id:"ib",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:k[1],stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:k[1],stopOpacity:.05})]}),e.jsxs("pattern",{id:"iHatch",patternUnits:"userSpaceOnUse",width:"6",height:"6",patternTransform:"rotate(45)",children:[e.jsx("rect",{width:"6",height:"6",fill:k[0],fillOpacity:.3}),e.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"6",stroke:k[1],strokeWidth:"2.5"})]})]}),e.jsx(V,{stroke:"#00000010",vertical:!1}),e.jsx(q,{dataKey:"date",stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1}),e.jsx(Q,{stroke:"#2a1b4a80",fontSize:11,tickLine:!1,axisLine:!1,unit:c?"%":""}),e.jsx(X,{content:e.jsx(Ee,{normalize:c})}),e.jsx(F,{type:"monotone",dataKey:l[0],name:_[l[0]].label,stroke:k[0],strokeWidth:2,fill:"url(#ia)"}),e.jsx(F,{type:"monotone",dataKey:l[1],name:_[l[1]].label,stroke:k[1],strokeWidth:2,fill:"url(#ib)"}),e.jsx(F,{type:"monotone",dataKey:"__min",name:"Пересечение",stroke:"transparent",fill:"url(#iHatch)",isAnimationActive:!1})]})}export{ot as SellerFunnelInner,gt 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.