1import{j as t}from"./vendor-query-DvnPdOMX.js";import{c as B}from"./vendor-utils-BNe0Xlio.js";import{a2 as C,aN as w,e5 as L}from"./index-1YQNuixL.js";import{P as M}from"./CrawlerShared-CCMHcXg-.js";import{R as S,d as D,X as E,Y as O,T as $,B as z,b as A}from"./vendor-charts-aEJ5Vv6F.js";import"./vendor-react-woJBpfBI.js";import"./vendor-supabase-DaZXgOw0.js";import"./vendor-icons-BLMEbmRV.js";import"./vendor-motion-ZmH_6coE.js";function F(a){const{x:r,y:n,width:x,height:i}=a;if(r==null||n==null||x==null||i==null)return null;const d=r+x/2;return t.jsx("line",{x1:d,y1:n,x2:d,y2:n+i,stroke:"var(--color-border-default)",strokeWidth:1,strokeDasharray:"3 3",style:{pointerEvents:"none"}})}function k(a,r){return r[a]??r[r.length-1]}function K(a){return!a||a.length===0?0:a.reduce((r,n)=>n.dataKey==="prev_total"?r:r+(n.value||0),0)}function R({active:a,payload:r,label:n,palette:x,labelMap:i,showPlatformLogo:d,formatTooltipLabel:l}){if(!a||!r||r.length===0)return null;const m=r.filter(e=>e.dataKey!=="prev_total"),f=r.find(e=>e.dataKey==="prev_total"),g=new Map;m.forEach((e,o)=>{g.set(e.dataKey,k(o,x))});const u=K(m);if(u<=0&&!f)return null;const j=[...m].filter(e=>(e.value||0)>0).sort((e,o)=>o.value-e.value);let p="";try{n&&(p=l?l(n):C(w(n),"MMM d, yyyy"))}catch{}const c=f?.value??null,h=f?.payload?.prev_date??null;let y="";if(h)try{y=l?l(h):C(w(h),"MMM d")}catch{}const s=c&&c>0?Math.round((u-c)/c*100):null;return t.jsxs("div",{className:"bg-white border border-default rounded shadow-[0_4px_12px_-2px_rgba(0,0,0,0.08)] min-w-[220px] overflow-hidden",children:[t.jsxs("div",{className:"px-4 py-3.5 border-b border-subtle",children:[t.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted mb-1.5",children:p}),t.jsxs("p",{className:"text-[24px] font-semibold tracking-tight tabular-nums text-primary leading-none",children:[u.toLocaleString(),t.jsx("span",{className:"text-[11px] font-normal text-secondary ml-1.5",children:"visits"})]}),c!==null&&t.jsxs("p",{className:"mt-2 text-[10px] text-muted flex items-center gap-2",children:[t.jsx("span",{"aria-hidden":!0,className:"inline-block w-3 border-t border-dashed",style:{borderColor:"var(--color-border-default)"}}),t.jsx("span",{className:"font-mono tabular-nums",children:c.toLocaleString()}),t.jsx("span",{children:y||"previous"}),s!==null&&s!==0&&t.jsxs("span",{className:B("ml-auto font-mono tabular-nums",s>0?"text-success":"text-error"),children:[s>0?"+":"",s,"%"]})]})]}),t.jsx("div",{className:"px-4 py-3 space-y-2.5",children:j.map(e=>{const o=L(e.dataKey),v=i?.[e.dataKey]??o?.name??e.dataKey,N=u>0?Math.round(e.value/u*100):0,b=d&&!i&&e.dataKey!=="Other"&&!!o?.logo;return t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:g.get(e.dataKey)||"#78716c"}}),b&&t.jsx(M,{config:o,name:e.dataKey,size:12}),t.jsx("span",{className:"text-[11px] text-secondary flex-1 truncate",children:v}),t.jsx("span",{className:"text-[11px] font-mono tabular-nums text-primary font-medium min-w-[44px] text-right",children:e.value.toLocaleString()}),t.jsxs("span",{className:"text-[10px] tabular-nums text-muted w-8 text-right",children:[N,"%"]})]},e.dataKey)})})]})}function W(a){return K(a?.payload)<=0?null:t.jsx(F,{...a})}function J({data:a,crawlers:r,formatXAxis:n,tickInterval:x,palette:i,gradientPrefix:d,useGradient:l=!0,gradientTopOpacity:m=.75,gradientBottomOpacity:f=.55,solidOpacity:g=1,labelMap:u,showCompareLine:j=!1,onSegmentClick:p,showPlatformLogo:c=!1,formatTooltipLabel:h}){if(a.length===0)return t.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-muted",children:"No data for this filter"});const y=!!p;return t.jsx(S,{width:"100%",height:"100%",minWidth:0,children:t.jsxs(D,{data:a,margin:{top:12,right:20,left:4,bottom:4},barCategoryGap:"18%",barGap:0,children:[l&&t.jsx("defs",{children:r.map((s,e)=>{const o=k(e,i);return t.jsxs("linearGradient",{id:`${d}-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:m}),t.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:f})]},e)})}
1),t.jsx(E,{dataKey:"date",tickFormatter:n,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"var(--color-tertiary)"},dy:8,interval:x,padding:{left:20,right:20}}),t.jsx(O,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"var(--color-tertiary)"},width:40,tickFormatter:s=>s>=1e3?`${(s/1e3).toFixed(0)}k`:String(s)}),t.jsx($,{content:t.jsx(R,{palette:i,labelMap:u,showPlatformLogo:c,formatTooltipLabel:h}),cursor:t.jsx(W,{})}),r.map((s,e)=>{const o=e===r.length-1,v=k(e,i);return t.jsx(z,{dataKey:s,stackId:"1",fill:l?`url(#${d}-${e})`:v,fillOpacity:l?1:g,radius:o?[2,2,0,0]:[0,0,0,0],maxBarSize:36,animationDuration:600,animationBegin:e*60,animationEasing:"ease-out",cursor:y?"pointer":"default",onClick:y?(N,b)=>{const _=a[b]?.date??"";p?.(s,_)}:void 0},s)}),j&&t.jsx(A,{type:"monotone",dataKey:"prev_total",stroke:"var(--color-border-default)",strokeWidth:1.25,strokeDasharray:"3 3",dot:!1,activeDot:!1,isAnimationActive:!1,connectNulls:!0})]})})}export{J as CrawlerStackedBarChart};
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.