PageSourceSearch

https://d5newstv.com/assets/Dashboard-D32d_BvF.js

js d5newstv.com collected 2026-10-09 21:57:47 UTC 32,228 bytes, 1 lines download raw bytes

1import{j as t,R as S,r as x,u as R,H,I as P,q as F,x as V,L as W,J as Q,K}from"./index-B38q3oD-.js";import{u as Y}from"./usePageMeta-BeXnO4Ju.js";import{M as w}from"./MaterialIcon-DK7wVKrx.js";function J({data:e,color:r="currentColor",height:a=160}){const n=a,o={top:14,right:8,bottom:22,left:8},i=600-o.left-o.right,u=n-o.top-o.bottom,m=Math.max(1,...e.map(h=>h.value)),c=e.length,g=h=>o.left+(c<=1?i/2:h/(c-1)*i),b=h=>o.top+u-h/m*u,p=e.map((h,j)=>`${g(j)},${b(h.value)}`).join(" "),d=`${o.left},${o.top+u} ${p} ${o.left+i},${o.top+u}`,s=`grad-${r.replace(/[^a-zA-Z0-9]/g,"")}`;return t.jsxs("svg",{viewBox:`0 0 600 ${n}`,className:"w-full",preserveAspectRatio:"none",style:{height:a},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:r,stopOpacity:"0.35"}),t.jsx("stop",{offset:"100%",stopColor:r,stopOpacity:"0"})]})}),[.25,.5,.75].map(h=>t.jsx("line",{x1:o.left,x2:o.left+i,y1:o.top+u*h,y2:o.top+u*h,stroke:"currentColor",strokeOpacity:"0.08",strokeWidth:"1"},h)),t.jsx("polygon",{points:d,fill:`url(#${s})`}),t.jsx("polyline",{points:p,fill:"none",stroke:r,strokeWidth:"2.5",strokeLinejoin:"round",strokeLinecap:"round"}),e.map((h,j)=>t.jsx("circle",{cx:g(j),cy:b(h.value),r:c>20?0:3,fill:r},j)),[0,Math.floor(c/2),c-1].map(h=>t.jsx("text",{x:g(h),y:n-6,textAnchor:h===0?"start":h===c-1?"end":"middle",className:"fill-slate-400",fontSize:"10",children:e[h]?.label},h))]})}function Z({data:e,color:r="currentColor"}){const a=Math.max(1,...e.map(l=>l.value));return t.jsx("div",{className:"space-y-2.5",children:e.map(l=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-xs font-semibold text-slate-600 dark:text-slate-300 w-24 truncate shrink-0",children:l.label}),t.jsx("div",{className:"flex-1 h-2.5 bg-slate-100 dark:bg-slate-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l.value/a*100}%`,background:r}})}),t.jsx("span",{className:"text-xs font-bold tabular-nums w-8 text-right shrink-0",children:l.value})]},l.label))})}function _({data:e,size:r=150}){const a=e.reduce((m,c)=>m+c.value,0)||1,l=r/2,n=r*.18,o=l-n/2,i=2*Math.PI*o;let u=0;return t.jsxs("div",{className:"flex items-center gap-5",children:[t.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:"shrink-0 -rotate-90",children:[t.jsx("circle",{cx:l,cy:l,r:o,fill:"none",stroke:"currentColor",strokeOpacity:"0.08",strokeWidth:n}),e.map(m=>{const c=m.value/a*i,g=t.jsx("circle",{cx:l,cy:l,r:o,fill:"none",stroke:m.color,strokeWidth:n,strokeDasharray:`${c} ${i-c}`,strokeDashoffset:-u,strokeLinecap:"butt"},m.label);return u+=c,g})]}),t.jsx("div",{className:"space-y-2",children:e.map(m=>t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:m.color}}),t.jsx("span",{className:"text-slate-600 dark:text-slate-300 font-semibold",children:m.label}),t.jsxs("span",{className:"text-slate-500 dark:text-slate-400 tabular-nums",children:[m.value," (",Math.round(m.value/a*100),"%)"]})]},m.label))})]})}function X(e){const[r,a]=x.useState(!0),[l,n]=x.useState(null),[o,i]=x.useState(!1),u=()=>{a(!1),i(!0)};return x.useEffect(()=>{if(!document){const b=new Error(`[ScriptLoadingError] document not defined when attempting to load ${e}`);n(b);return}
1const m=document.querySelector(`script[src="${e}"]`);if(m?.dataset.loaded){u();return}const c=m||document.createElement("script");m||(c.src=e);const g=()=>{c.dataset.loaded="1",u()};c.addEventListener("load",g),c.addEventListener("error",b=>{console.error("Failed to load script:",e,b);const p=new Error(`[ScriptLoadingError] Failed to load script: ${e}`);n(p)}),m||document.head.append(c)},[]),{isLoading:r,error:l,isSuccess:o}}const ee=e=>e&&e.charts,U=(e,r)=>{const{controls:a,toolbarItems:l,getChartEditor:n}=e;return r&&r.charts&&r.visualization&&r.visualization.ChartWrapper&&r.visualization.Dashboard&&(!a||r.visualization.ChartWrapper)&&(!n||r.visualization.ChartEditor)&&(!l||r.visualization.drawToolbar)},te=e=>window.google;function ae(e){const{chartVersion:r="current",chartPackages:a=["corechart","controls"],chartLanguage:l="en",mapsApiKey:n}=e,[o,i]=x.useState(null),[u,m]=x.useState(null),[c,g]=x.useState(null),{isLoading:b,error:p,isSuccess:d}=X(e.chartLoaderScriptUrl||"https://www.gstatic.com/charts/loader.js");return x.useEffect(()=>{if(!d)return;const s=te();if(!ee(s)){const h=new Error("[ScriptInitializationError] Script loaded but Google not attached to window.");m(h);return}if(U(e,s)){i(s);return}s.charts.load(r,{packages:a,language:l,mapsApiKey:n}),s.charts.setOnLoadCallback(()=>{if(!U(e,s)){const h=new Error("[GoogleChartsInitializationError] Google Charts not ready after load callback.");console.error(h),g(h);return}i(s)})},[d]),{error:p||u||c,isLoading:b,google:o}}const M={legend_toggle:!1,options:{},legendToggle:!1,getChartWrapper:()=>{},spreadSheetQueryParameters:{headers:1,gid:1},rootProps:{},chartWrapperParams:{},chartLoaderScriptUrl:"https://www.gstatic.com/charts/loader.js"},re=e=>{const{isReady:r,chartControls:a,filter:l}=e;return!r||!a||!a?.length?null:S.createElement(S.Fragment,null,a.filter(n=>{let{controlProp:o,control:i}=n;return l?l({control:i,controlProp:o}):!0}).map(n=>{let{control:o}=n;return S.createElement("div",{key:o.getContainerId(),id:o.getContainerId()})}))};let G=0;const B=()=>(G+=1,`reactgooglegraph-${G}`);class q{static initializeControls=r=>{for(let a=0;a<r.length;a+=1){const{controlType:l,options:n,controlWrapperParams:o}=r[a].controlProp;o&&"state"in o&&r[a].control.setState(o.state),r[a].control.setOptions(n),r[a].control.setControlType(l)}};static listenToControlEvents=(r,a)=>{const{google:l}=a;return r.flatMap(n=>{const{control:o,controlProp:i}=n,{controlEvents:u=[]}=i;return u.map(m=>{const{callback:c,eventName:g}=m;return l.visualization.events.addListener(o,g,function(){for(var b=arguments.length,p=new Array(b),d=0;d<b;d++)p[d]=arguments[d];c({chartWrapper:null,controlWrapper:o,props:a,google:l,eventArgs:p})})})})};static createControlId=r=>{let a;return typeof r>"u"?a=`googlechart-control-${B()}`:a=r,a};static createChartControls=r=>{const{controls:a,google:l}=r;return a?a.map((n,o)=>{const{controlID:i,controlType:u,options:m,controlWrapperParams:c}=n,g=this.createControlId(i);return{controlProp:n,control:new l.visualization.ControlWrapper({containerId:g,controlType:u,options:m,...c})}}):null};static addControls=r=>{const{chartWrapper:a,chartDashboard:l}=r,n=this.createChartControls(r);return!n||!l||!a?null:(l.bind(n.map(o=>{let{control:i}=o;return i}),a),this.initializeControls(n),n)}}const se=e=>{const[r,a]=x.useState(null);return[x.useMemo(()=>!r||!e?null:e.map((n,o)=>{const i=r[o];return i?{controlProp:n,control:i}:void 0}).flatMap(n=>n?[n]:[]),[r,e]),a]},ne=(e,r)=>{x.useEffect(()=>{const a=q.listenToControlEvents(e??[],r);return()=>{a.forEach(l=>{r.google.visualization.events.removeListener(l)})}},[e,r])},oe=e=>{const[r,a]=se(e.controls);return ne(r??[],e),{addControls:n=>{const o=q.addControls(n);a(o?.map(i=>i.control)??null)},renderControl:n=>{const{chartWrapper:o,chartDashboard:i}=e;return x.createElement(re,{...e,isReady:!!(o&&i),chartControls:r,filter:n})}}},le=e=>{const r=x.useRef(null);return{chartId:(()=>{const{graphID:n,graph_id:o}=e,i=n||o;let u;return i?u=i:u=r.current||B(),r.current=u,r.current})()}},ie=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82
1E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#3B3EAC"],ce=async function(e,r){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise((l,n)=>{const o=`${a.headers?`headers=${a.headers}`:"headers=0"}`,i=`${a.query?`&tq=${encodeURIComponent(a.query)}`:""}`,u=`${a.gid?`&gid=${a.gid}`:""}`,m=`${a.sheet?`&sheet=${a.sheet}`:""}`,c=`${a.access_token?`&access_token=${a.access_token}`:""}`,g=`${o}${u}${m}${i}${c}`,b=`${r}/gviz/tq?${g}`;new e.visualization.Query(b).send(d=>{d.isError()?n(`Error in query:  ${d.getMessage()} ${d.getDetailedMessage()}`):l(d.getDataTable())})})},de="#CCCCCC";class I{static grayOutHiddenColumnsLabel=(r,a)=>{const{googleChartWrapper:l,options:n}=r;if(!l){console.error("googleChartWrapper is not defined");return}const o=l.getDataTable();if(!o)return;const i=o.getNumberOfColumns();if(a.length>0===!1)return;const m=Array.from({length:i-1}).map((c,g)=>{const b=this.getColumnId(o,g+1);return a.includes(b)?de:n&&n.colors?n.colors[g]:ie[g]});l.setOptions({...n,colors:m}),l.draw()};static listenToLegendToggle=(r,a)=>{const[l,n]=a,{google:o,googleChartWrapper:i}=r;if(!i){console.error("googleChartWrapper is not defined");return}return o.visualization.events.addListener(i,"select",()=>{const m=i.getChart().getSelection(),c=i.getDataTable();if(m.length===0||m[0].row!==null||!c)return;const g=m[0].column,b=this.getColumnId(c,g);l?.includes(b)?n(p=>[...p.filter(d=>d!==b)]):n(p=>[...p,b])})};static draw=async r=>{const{data:a,diffdata:l,rows:n,columns:o,options:i,chartType:u,formatters:m,spreadSheetUrl:c,spreadSheetQueryParameters:g,googleChartDashboard:b,googleChartWrapper:p,google:d,hiddenColumns:s,legendToggle:h,legend_toggle:j}=r;if(!p){console.error("draw was called with googleChartWrapper = null");return}let f,v=null;if(l){const A=d.visualization.arrayToDataTable(l.old),N=d.visualization.arrayToDataTable(l.new);v=d.visualization[u].prototype.computeDiff(A,N)}a?a instanceof d.visualization.DataTable?f=a:Array.isArray(a)?f=d.visualization.arrayToDataTable(a):f=new d.visualization.DataTable(a):n&&o?f=d.visualization.arrayToDataTable([o,...n]):c?f=await ce(d,c,g):f=d.visualization.arrayToDataTable([]);const C=f.getNumberOfColumns(),T=Array(C).fill(0).map((A,N)=>{const z=this.getColumnId(f,N);return s.includes(z)?{label:f.getColumnLabel(N),type:f.getColumnType(N),calc:()=>null}:N}),k=p.getChart();p.getChartType()==="Timeline"&&k&&k.clearChart(),p.setChartType(u),p.setOptions(i||{});const D=new d.visualization.DataView(f);D.setColumns(T),p.setDataTable(D),p.draw(),b&&b.draw(f),v&&(p.setDataTable(v),p.draw()),m&&(this.applyFormatters({dataTable:f,formatters:m,google:d}),p.setDataTable(f),p.draw()),(h===!0||j===!0)&&this.grayOutHiddenColumnsLabel(r,s)};static getColumnId=(r,a)=>r.getColumnId(a)||r.getColumnLabel(a);static applyFormatters=r=>{let{dataTable:a,formatters:l,google:n}=r;for(let o of l)switch(o.type){case"ArrowFormat":{new n.visualization.ArrowFormat(o.options).format(a,o.column);return}case"BarFormat":{new n.visualization.BarFormat(o.options).format(a,o.column);return}case"ColorFormat":{const i=new n.visualization.ColorFormat(o.options),{ranges:u}=o;if(u)for(let m of u)i.addRange(...m);i.format(a,o.column);return}case"DateFormat":{new n.visualization.DateFormat(o.options).format(a,o.column);return}case"NumberFormat":{new n.visualization.NumberFormat(o.options).format(a,o.column);return}case"PatternFormat":{new n.visualization.PatternFormat(o.options).format(a,o.column);return}default:{console.warn(`Unknown formatter type: ${o.type}`);return}}}}const me=e=>{const{google:r,googleChartWrapper:a,googleChartDashboard:l}=e,[n,o]=x.useState([]);x.useEffect(()=>{a&&I.draw({...e,hiddenColumns:n,googleChartWrapper:a,googleChartDashboard:l,google:r})},[n,e.data,e.rows,e.columns,e.options,e.chartLoaderScriptUrl,e.chartType,e.formatters,e.spreadSheetUrl,e.spreadSheetQueryParameters,e.legendToggle,e.legend_toggle]);const i=()=>{const{googleChartWrapper:c}=e;c&&c.draw()},u=c=>{const g=[],{legendToggle:b,legend_toggle:p}=e;if(I.draw({...e,hiddenColumns:n,googleChartWrapper:c,googleChartDashboard:l,google:r}),window.addEventListener("resize",i),p||b){const d=I.listenToLegendToggle(e,[n,o]);d&&g.push(d)}return g},m=(c,g)=>{window.removeEventListener("resize",i),g.forEach(b=>{r.visualization.events.removeListener(b)}),c.getChartType()==="Timeline"&&c.getChart()&&c.getChart().clearChart()};x.useEffect(()=>{if(!a)return;
1const c=u(a);return()=>{m(a,c)}},[a,u,m])},ue=e=>{const{chartEvents:r,google:a,googleChartWrapper:l}=e;if(r){if(!l){console.warn("listenToEvents was called before chart wrapper ready.");return}return r.map(n=>{let{eventName:o,callback:i}=n;return a.visualization.events.addListener(l,o,function(){for(var u=arguments.length,m=new Array(u),c=0;c<u;c++)m[c]=arguments[c];i({chartWrapper:l,props:e,google:a,eventArgs:m})})})}},he=e=>{x.useEffect(()=>{if(!e.googleChartWrapper)return;const r=ue(e);return()=>{r?.forEach(a=>{e.google.visualization.events.removeListener(a)})}},[e])},xe=e=>{const[r,a]=x.useState(null),[l,n]=x.useState(null),{addControls:o,renderControl:i}=oe({...e,chartDashboard:l,chartWrapper:r});he({...e,googleChartWrapper:r});const{chartId:u}=le(e),m=x.useRef(null),c=x.useRef(null);x.useEffect(()=>{const{options:f,google:v,chartType:C,chartWrapperParams:T,toolbarItems:k,getChartEditor:D,getChartWrapper:A,onLoad:N}=e,z={chartType:C,options:f,containerId:u,...T},E=new v.visualization.ChartWrapper(z);E.setOptions(f||{}),A?.(E,v);const $=new v.visualization.Dashboard(m.current);k&&v.visualization.drawToolbar(c.current,k);let L=null;D&&(L=new v.visualization.ChartEditor,D({chartEditor:L,chartWrapper:E,google:v})),o({...e,chartDashboard:$,chartWrapper:E}),a(E),n($),N?.(v,{google:v,chartWrapper:E,chartEditor:L,chartDashboard:$})},[]),me({...e,googleChartWrapper:r,googleChartDashboard:l});const g=()=>{const{width:f,height:v,options:C,style:T,className:k,rootProps:D,google:A}=e,N={height:v||C&&C.height,width:f||C&&C.width,...T};return x.createElement("div",{id:u,style:N,className:k,...D})},b=()=>e.toolbarItems?x.createElement("div",{ref:c}):null,{width:p,height:d,options:s,style:h}=e,j={height:d||s&&s.height,width:p||s&&s.width,...h};return e.render?x.createElement("div",{ref:m,style:j},x.createElement("div",{ref:c,id:"toolbar"}),e.render({renderChart:g,renderControl:i,renderToolbar:b})):x.createElement("div",{ref:m,style:j},i(f=>{let{controlProp:v}=f;return v.controlPosition!=="bottom"}),g(),i(f=>{let{controlProp:v}=f;return v.controlPosition==="bottom"}),b())},ge=x.createContext(M),pe=e=>{let{children:r,value:a}=e;return x.createElement(ge.Provider,{value:a},r)},be=e=>{const{google:r,isLoading:a,error:l}=ae(e);return a?e.loader??null:l?e.errorElement??null:r?S.createElement(xe,{google:r,...e}):null},fe=e=>{const r={...M,...e};return S.createElement(pe,{value:r},S.createElement(be,r))};var O;(function(e){e.annotation="annotation",e.annotationText="annotationText",e.certainty="certainty",e.emphasis="emphasis",e.interval="interval",e.scope="scope",e.style="style",e.tooltip="tooltip",e.domain="domain"})(O||(O={}));const ve=[7,30,90,365];function je(e){return`https://purecatamphetamine.github.io/country-flag-icons/3x2/${e.toUpperCase()}.svg`}function ye(){const{t:e}=R(),{theme:r}=H(),[a,l]=x.useState(30),[n,o]=x.useState([]),[i,u]=x.useState(0),[m,c]=x.useState(!0);x.useEffect(()=>{let d=!0;return c(!0),P.getGeo(a).then(s=>{d&&(o(s.countries||[]),u(s.total||0))}).catch(()=>{d&&(o([]),u(0))}).finally(()=>{d&&c(!1)}),()=>{d=!1}},[a]);const g=x.useMemo(()=>[[e("adminGeo.colCountry"),e("adminGeo.colViews")],...n.map(d=>[d.code,d.views])],[n,e]),b=x.useMemo(()=>({backgroundColor:"transparent",datalessRegionColor:r==="dark"?"#1e293b":"#e2e8f0",defaultColor:r==="dark"?"#334155":"#f1f5f9",colorAxis:{colors:["#93c5fd","#2B4C7E","#0f58bd","#1A365D"]},legend:"none",tooltip:{textStyle:{color:"#0f172a"}}}),[r]),p=[...n].sort((d,s)=>s.views-d.views);return t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] p-6",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[t.jsx(w,{name:"public",className:"text-primary"}),e("adminGeo.title")]}),t.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:[e("adminGeo.subtitle"),i>0&&` — ${e("adminGeo.views",{count:i,formattedCount:F(i)})}`]})]}
1),t.jsx("select",{value:a,"aria-label":e("adminGeo.period"),onChange:d=>l(Number(d.target.value)),className:"rounded-[3px] border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800 py-2 px-3 text-sm outline-none focus:border-primary",children:ve.map(d=>t.jsx("option",{value:d,children:e(`adminGeo.period${d}`)},d))})]}),m?t.jsx("div",{className:"h-[360px] rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"}):i===0?t.jsxs("div",{className:"h-[360px] rounded-[3px] bg-slate-50 dark:bg-slate-800/40 flex flex-col items-center justify-center text-center px-6",children:[t.jsx(w,{name:"travel_explore",className:"text-4xl text-slate-500 dark:text-slate-400 mb-3"}),t.jsx("p",{className:"text-sm font-semibold text-slate-600 dark:text-slate-300",children:e("adminGeo.emptyTitle")}),t.jsx("p",{className:"text-xs text-slate-600 dark:text-slate-400 mt-1 max-w-sm",children:e("adminGeo.emptyMessage")})]}):t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[t.jsx("div",{className:"xl:col-span-2 min-h-[360px]",children:t.jsx(fe,{chartType:"GeoChart",width:"100%",height:"360px",data:g,options:b,loader:t.jsx("div",{className:"h-[360px] rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"})})}),t.jsxs("div",{className:"xl:col-span-1",children:[t.jsx("h4",{className:"text-xs font-bold text-slate-500 dark:text-slate-400 uppercase tracking-widest mb-3",children:"Top pays"}),t.jsx("div",{className:"space-y-1",children:p.slice(0,10).map((d,s)=>{const h=i>0?Math.round(d.views/i*100):0;return t.jsxs("div",{className:"flex items-center gap-3 py-2",children:[t.jsx("span",{className:"text-xs font-bold text-slate-500 dark:text-slate-400 w-4 tabular-nums",children:s+1}),t.jsx("img",{src:je(d.code),alt:d.name,className:"w-6 h-4 rounded-[3px] object-cover flex-shrink-0 ring-1 ring-slate-200 dark:ring-slate-700",loading:"lazy",onError:j=>{j.currentTarget.style.visibility="hidden"}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-medium truncate",children:d.name}),t.jsx("span",{className:"text-sm font-bold tabular-nums",children:F(d.views)})]}),t.jsx("div",{className:"mt-1 h-1.5 rounded-full bg-slate-100 dark:bg-slate-800 overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-[var(--red-live)]",style:{width:`${h}%`}})})]})]},d.code)})})]})]})]})}const Ne={premium:"var(--color-primary)",free:"var(--tone-neutral)",enterprise:"var(--color-secondary)"},Ce={published:"var(--tone-success)",pending:"var(--tone-warning)",draft:"var(--tone-neutral)",rejected:"var(--tone-danger)"},we=e=>{const r=new Date(e);return`${r.getDate()}/${r.getMonth()+1}`};function y(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}K`:String(e)}const ke={totalUsers:0,premiumUsers:0,activeUsers:0,totalArticles:0,publishedArticles:0,totalViews:0,totalPodcasts:0,totalPartners:0,newContacts:0,newsletterSubscribers:0,revenueEstimate:0,recentUsers:[],popularArticles:[]};function Te(){const{t:e}=R();Y(e("adminLayout.dashboard"));const{show:r}=V(),[a,l]=x.useState(ke),[n,o]=x.useState(null),[i,u]=x.useState([]),[m,c]=x.useState([]),[g,b]=x.useState(!0),p=async()=>{b(!0);try{const[s,h,j,f]=await Promise.all([P.getStats(),P.getAnalytics(),Q.list({page:1,limit:5,status:"pending"}),K.list({page:1,limit:5,status:"pending"})]);l(s),o(h),u(j.articles),c(f.partners)}catch(s){r(s instanceof Error?s.message:e("adminDashboard.loadError"),"error")}finally{b(!1)}};x.useEffect(()=>{p()},[]);const d=[{icon:"groups",label:e("adminDashboard.cardUsers"),value:y(a.totalUsers),note:e("adminDashboard.cardUsersNote",{count:a.activeUsers}),tone:"text-sky-700 dark:text-sky-400",rule:"border-sky-500"},{icon:"workspace_premium",label:e("adminDashboard.cardPremium"),value:y(a.premiumUsers),note:e("adminDashboard.cardPremiumNote",{count:a.newsletterSubscribers}),tone:"text-secondary-dark dark:text-secondary",rule:"border-secondary-dark dark:border-secondary"},{icon:"article",label:e("adminDashboard.cardArticles"),value:y(a.publishedArticles),note:e("adminDashboard.cardArticlesNote",{count:a.totalArticles}),tone:"text-[var(--red-ink)]",rule:"border-[var(--red-live)]"},{icon:"payments",label:e("adminDashboard.cardRevenue"),value:`${y(a.revenueEstimate)} EUR`,note:e("adminDashboard.cardRevenueNote",{count:a.totalPartners}),tone:"text-emerald-700 dark:text-emerald-400",rule:"border-emerald-500"}];return t.jsxs("div",{className:"space-y-8",children:[t.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-black tracking-tight mb-1",children:e("adminDashboard.title")}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:e("adminDashboard.subtitle")})]}),t.jsxs("button",{onClick:p,className:"btn-edito px-4 py-2 btn-solid text-sm","aria-label":e("common.refresh"),children:[t.jsx(w,{name:"refresh",className:"text-lg"}),e("adminDashboard.refresh")]})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6",children:d.map(s=>t.jsxs("div",{className:`border-t-[3px] ${s.rule} pt-4`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(w,{name:s.icon,className:`text-[18px] ${s.tone}`}),t.jsx("p",{className:"text-[11px] font-black uppercase tracking-[0.14em] text-slate-600 dar
1k:text-slate-300",children:s.label})]}),t.jsx("p",{className:"text-[2rem] font-black tabular-nums leading-none mt-3 text-slate-900 dark:text-white",children:s.value}),t.jsx("p",{className:"text-[12px] text-slate-600 dark:text-slate-400 mt-1.5",children:s.note})]},s.label))}),n&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[{icon:"visibility",label:e("adminDashboard.engViews"),value:y(n.engagement.totalViews),tint:"text-sky-700 dark:text-sky-400"},{icon:"favorite",label:e("adminDashboard.engLikes"),value:y(n.engagement.totalLikes),tint:"text-rose-700 dark:text-rose-400"},{icon:"mail",label:e("adminDashboard.engNewsletter"),value:y(n.engagement.newsletterSubscribers),tint:"text-amber-700 dark:text-amber-400"},{icon:"event",label:e("adminDashboard.engEvents"),value:y(n.engagement.communityEvents),tint:"text-violet-700 dark:text-violet-400"},{icon:"how_to_reg",label:e("adminDashboard.engRsvps"),value:y(n.engagement.eventRsvps),tint:"text-emerald-700 dark:text-emerald-400"},{icon:"forum",label:e("adminDashboard.engDiscussions"),value:y(n.engagement.communityPosts),tint:"text-teal-700 dark:text-teal-400"}].map(s=>t.jsxs("div",{className:"border-t border-[var(--rule)] pt-3 pr-3",children:[t.jsx(w,{name:s.icon,className:`text-[18px] ${s.tint}`}),t.jsx("span",{className:"block text-2xl font-black tabular-nums leading-none mt-1.5 text-slate-900 dark:text-white",children:s.value}),t.jsx("p",{className:"text-[10px] text-slate-600 dark:text-slate-400 uppercase tracking-wider font-bold mt-1",children:s.label})]},s.label))}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[t.jsxs("section",{className:"xl:col-span-2 border-t-2 border-[var(--rule-strong)] pt-4 text-slate-900 dark:text-white",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.signupsTitle")}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("adminDashboard.signupsSubtitle")})]}),t.jsxs("span",{className:"text-2xl font-black text-primary tabular-nums",children:["+",n.signups.reduce((s,h)=>s+h.count,0)]})]}),t.jsx("span",{className:"block text-primary",children:t.jsx(J,{data:n.signups.map(s=>({label:we(s.day),value:s.count}))})})]}),t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] p-6",children:[t.jsx("h3",{className:"font-bold text-lg mb-1",children:e("adminDashboard.subsTitle")}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mb-4",children:e("adminDashboard.subsSubtitle")}),t.jsx(_,{data:n.subscriptions.map(s=>({label:s.type,value:s.count,color:Ne[s.type]||"var(--tone-neutral)"}))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] p-6",children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-4 gap-4",children:[t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.categoriesTitle")}),n.categories.some(s=>s.pending>0)&&t.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-[var(--red-ink)] whitespace-nowrap",children:e("adminDashboard.pendingBadge",{count:n.categories.reduce((s,h)=>s+(h.pending||0),0)})})]}),t.jsx("span",{className:"block text-primary",children:t.jsx(Z,{data:n.categories.map(s=>({label:s.name,value:s.count}))})}),n.categories.some(s=>s.pending>0)&&t.jsx("p",{className:"text-[12px] text-slate-600 dark:text-slate-400 mt-3 pt-3 border-t border-[var(--rule)]",children:e("adminDashboard.pendingHint")})]}),t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] p-6",children:[t.jsx("h3",{className:"font-bold text-lg mb-1",children:e("adminDashboard.contentStatusTitle")}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mb-4",children:e("adminDashboard.contentStatusSubtitle")}),t.jsx(_,{data:n.contentStatus.map(s=>({label:s.status,value:s.count,color:Ce[s.status]||"var(--tone-neutral)"}))})]})]})]}),t.jsx(ye,{}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6",children:[t.jsxs("section",{className:"xl:col-span-2 border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] overflow-hidden",children:[t.jsxs("div",{className:"px-6 py-5 border-b border-[var(--rule)] flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.pendingArticlesTitle")}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("adminDashboard.pendingArticlesSubtitle")})]}),t.jsx(W,{to:"/admin/editorial",className:"text-primary text-xs font-bold hover:underline",children:e("adminDashboard.seeAll")})]}),g?t.jsx("div",{className:"p-6 space-y-3",children:Array.from({length:4}).map((s,h)=>
1t.jsx("div",{className:"h-16 rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"},h))}):i.length===0?t.jsxs("div",{className:"p-10 text-center",children:[t.jsx(w,{name:"check_circle",className:"text-3xl text-emerald-700 dark:text-emerald-400 mb-2"}),t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e("adminDashboard.noPendingArticles")})]}):t.jsx("div",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:i.map(s=>t.jsxs("div",{className:"p-4 flex items-center gap-4 hover:bg-slate-50 dark:hover:bg-slate-800/40 transition-colors",children:[t.jsx("div",{className:"w-12 h-12 rounded-[3px] bg-primary/10 dark:bg-primary/20 text-primary flex items-center justify-center flex-shrink-0",children:t.jsx(w,{name:"article"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:s.title}),t.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:[s.author_name||e("adminDashboard.unknownAuthor")," - ",s.category_name||e("adminDashboard.noCategory")]})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-sm font-semibold",children:e("adminDashboard.viewsCount",{count:s.views_count})}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("adminDashboard.minRead",{count:s.read_time||1})})]})]},s.id))})]}),t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] overflow-hidden",children:[t.jsxs("div",{className:"px-6 py-5 border-b border-[var(--rule)] flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.partnersTitle")}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("adminDashboard.partnersSubtitle")})]}),t.jsx(W,{to:"/admin/partners",className:"text-primary text-xs font-bold hover:underline",children:e("adminDashboard.seeAll")})]}),g?t.jsx("div",{className:"p-6 space-y-3",children:Array.from({length:4}).map((s,h)=>t.jsx("div",{className:"h-16 rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"},h))}):m.length===0?t.jsxs("div",{className:"p-10 text-center",children:[t.jsx(w,{name:"handshake",className:"text-3xl text-emerald-700 dark:text-emerald-400 mb-2"}),t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e("adminDashboard.noPendingPartners")})]}):t.jsx("div",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:m.map(s=>t.jsxs("div",{className:"p-4 hover:bg-slate-50 dark:hover:bg-slate-800/40 transition-colors",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("p",{className:"text-sm font-semibold",children:s.name}),t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:s.partner_type})]}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1 line-clamp-2",children:s.description||e("adminDashboard.noDescription")})]},s.id))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] overflow-hidden",children:[t.jsx("div",{className:"px-6 py-5 border-b border-[var(--rule)]",children:t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.recentUsersTitle")})}),g?t.jsx("div",{className:"p-6 space-y-3",children:Array.from({length:4}).map((s,h)=>t.jsx("div",{className:"h-16 rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"},h))}):t.jsx("div",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:a.recentUsers.map(s=>t.jsxs("div",{className:"p-4 flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:s.full_name}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:s.email})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400",children:s.role}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:s.subscription_type})]})]},s.id))})]}),t.jsxs("section",{className:"border border-[var(--rule)] rounded-[3px] bg-[var(--color-paper)] dark:bg-[var(--color-bg-card)] overflow-hidden",children:[t.jsx("div",{className:"px-6 py-5 border-b border-[var(--rule)]",children:t.jsx("h3",{className:"font-bold text-lg",children:e("adminDashboard.popularArticlesTitle")})}),g?t.jsx("div",{className:"p-6 space-y-3",children:Array.from({length:4}).map((s,h)=>
1t.jsx("div",{className:"h-16 rounded-[3px] bg-slate-100 dark:bg-slate-800 animate-pulse"},h))}):t.jsx("div",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:a.popularArticles.map(s=>t.jsxs("div",{className:"p-4 flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:s.title}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:s.category_name||e("adminDashboard.noCategory")})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-sm font-semibold",children:y(s.views_count)}),t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("adminDashboard.viewsLabel")})]})]},s.id))})]})]})]})}export{Te 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.