PageSourceSearch

https://lesstat.ru/assets/RegionalTab-p89ByF45.js

js lesstat.ru collected 2026-10-02 02:08:24 UTC 4,285 bytes, 1 lines download raw bytes

1import{j as t}from"./vendor-radix-j51FbGWj.js";import{r as h}from"./vendor-react-CzwWGMlW.js";import{B as R}from"./vendor-charts-CCcLMIy6.js";import{C as N}from"./ChartCard-DZ0EN5pd.js";import{H as E}from"./HeatmapChart-B2c2PB5l.js";import{c as w,w as k,b as B,E as H}from"./PriceAnalysis-BVYr9amH.js";import{C as A,f as F,g as L,b as S,a as T}from"./index-CMgi7Nl8.js";import{b as _,aX as I}from"./vendor-icons-CaDFxAI1.js";import"./tabs-CtkUE6WE.js";import"./select-DjZg9c5p.js";import"./collapsible-zOqORHrX.js";import"./vendor-utils-DYobRrOj.js";const Q=({analysisData:d,unit:i})=>{var v,f;const e=d==null?void 0:d.regionComparison,p=(d==null?void 0:d.insights)||{},x=h.useMemo(()=>{var a;const s=(a=e==null?void 0:e.datasets)==null?void 0:a[0];return!s||!e?null:{labels:e.labels,datasets:[{...s,backgroundColor:e.labels.map((r,l)=>k(w(l),.85)),borderColor:e.labels.map((r,l)=>w(l)),borderWidth:1,borderRadius:6}]}},[e]),{average:g,deviations:u}=h.useMemo(()=>{var n,c;const s=((c=(n=e==null?void 0:e.datasets)==null?void 0:n[0])==null?void 0:c.data)||[];if(s.length===0)return{average:0,deviations:[]};const r=s.reduce((o,m)=>o+(m||0),0)/s.length,l=(e.labels||[]).map((o,m)=>{const j=s[m]||0,M=r>0?Math.round((j-r)/r*100):0;return{label:o,value:j,deviation:M}});return l.sort((o,m)=>m.deviation-o.deviation),{average:Math.round(r*100)/100,deviations:l}},[e]),b=h.useMemo(()=>{const s=(e==null?void 0:e.datasets)||[];return s.length<=1?[]:s.map(a=>({label:a.label,values:a.data||[]}))},[e]),$=h.useMemo(()=>{const s=B();return{...s,plugins:{...s.plugins,legend:{display:!1},tooltip:{...s.plugins.tooltip,callbacks:{label:a=>{var r;return`${(r=a.parsed.y)==null?void 0:r.toLocaleString("ru-RU")} ${i}`}}}}}},[i]),C=h.useMemo(()=>{if(!e)return null;const s=["Регион","Значение"],a=e.labels.map((r,l)=>{var n,c,o;return[r,(o=(c=(n=e.datasets)==null?void 0:n[0])==null?void 0:c.data)==null?void 0:o[l]]});return[s,...a]},[e]);return!e||!x?t.jsx(H,{title:"Нет данных регионального анализа"}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[t.jsx("div",{className:"lg:col-span-7",children:t.jsx(N,{title:"Сравнение регионов",description:`Средняя цена по регионам, ${i}. Среднее по выборке: ${g} ${i}.`,icon:_,csvData:C,csvFilename:"market-regional.csv",srNarrative:`Среднее значение ${g} ${i}. Лидер: ${(v=u[0])==null?void 0:v.label}, аутсайдер: ${(f=u[u.length-1])==null?void 0:f.label}.`,height:"h-[280px] sm:h-[340px]",children:t.jsx(R,{data:x,options:$})})}),t.jsx("div",{className:"lg:col-span-5",children:t.jsxs(A,{className:"h-full shadow-sm border-border/60",children:[t.jsxs(F,{className:"pb-3 px-4 sm:px-6",children:[t.jsx(L,{className:"text-base sm:text-lg",children:"Отклонение от среднего"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.highestRegion&&`Лидер: ${p.highestRegion}`,p.lowestRegion&&` · Аутсайдер: ${p.lowestRegion}`]})]}),t.jsx(S,{className:"px-3 sm:px-4 pb-4",children:t.jsx("ul",{className:"max-h-[300px] overflow-y-auto space-y-1.5 pr-1",children:u.map(s=>{const a=s.deviation>0,r=s.deviation===0;return t.jsxs("li",{className:"flex items-center gap-2 group",children:[t.jsx("span",{className:"text-xs sm:text-sm flex-1 truncate text-foreground/90",children:s.label}),t.jsxs("div",{className:"relative h-2 w-20 sm:w-24 bg-muted/50 rounded-full overflow-hidden",children:[t.jsx("div",{className:`absolute top-0 h-full ${a?"bg-emerald-500 left-1/2":"bg-rose-500 right-1/2"}`,style:{width:`${Math.min(50,Math.abs(s.deviation)/2)}%`}}),t.jsx("div",{className:"absolute top-0 left-1/2 h-full w-px bg-border"})]}),t.jsxs(T,{variant:r?"outline":a?"default":"destructive",className:"text-xs min-w-[52px] justify-center",children:[a?"+":"",s.deviation,"%"]})]},s.label)})})})]})})]}),b.length>0&&t.jsx(N,{title:"Тепловая карта «продукт × регион»",description:"Цена в каждой ячейке: чем теплее цвет, тем выше значение.",icon:I,height:"h-[300px] sm:h-[360px]",children:t.jsx(E,{rows:b,columns:e.labels,unit:i})})]})};export{Q as default};

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.