PageSourceSearch

https://app.mymetrics.ai/assets/index-BqLaWzan.js

js mymetrics.ai collected 2026-10-05 14:03:28 UTC 25,534 bytes, 1 lines download raw bytes

1import{a as ue,r as N,j as e,R as C}from"./router-ag37W5sd.js";import{u as xe}from"./dashboard-metrics-manager-CxPrpFIw.js";import{a as P,u as k,d8 as pe,d9 as ae,C as he,f as ge,D as M,ak as z,V as fe,a6 as be,W as F,Y as H,B as E,_ as $,o as X,m as je,p as Ne,q as ve,r as ye,s as Te,v as Ce,w as De,x as Se,H as V,z as re,S as le,bC as we,c3 as Z,da as G,db as Ae,I as Ee,i as ke,P as _e,dc as ee,T as Oe,b as Ie,d as _,be as Re}from"./index-BvKpI50G.js";import{b6 as Le,bA as Be,bG as Ue,C as ie,an as Y,D as Me,L as ze}from"./mermaid-4DMBBIKO-DQwNOGgd.js";import{a as Fe,G as ne,T as He,D as $e}from"./dashboard-wizard-container-Klp-uJzs.js";import{C as Ge}from"./construction-7gzsf-Q5.js";import{S as Pe}from"./square-pen-B19Yb0q4.js";import{L as oe,I as We}from"./linkedin-CE3sSLt_.js";import{Y as qe}from"./youtube-Chm897wG.js";import{F as Qe}from"./facebook-O7LxI23H.js";import{L as Ve}from"./layout-dashboard-DmHogG9H.js";import{P as se}from"./page-loading-DJF6u_AZ.js";import{u as Ye}from"./use-page-title-DbzgWs-W.js";import{B as Ke}from"./briefcase-Cdzwb1CG.js";import"./query-D5wQO-yD.js";import"./rocket-CffXe1VY.js";import"./integration-wizard-Dns_R_hU.js";import"./logins-Cm4DMR_1.js";import"./plug-BA3kqqW4.js";import"./use-analytics-3SdZn4k1.js";import"./tv-QiDQ3RU9.js";import"./key-Cflxyibg.js";import"./shield-BpEuCWJ4.js";import"./Trans-DBUA0Y_V.js";import"./date-range-picker-Cd4vCSRL.js";import"./calendar-vHm2O2IG.js";import"./differenceInCalendarMonths-BHOHuZlF.js";import"./under-construction-vIbwyt0N.js";import"./sheet-DrXgnZFS.js";import"./send-DHuoSN9e.js";import"./recycle-C8nedG1n.js";import"./purify.es-Bzr520pe.js";import"./use-subscription-CoK9VVGj.js";import"./chart-line-_nU7yr3K.js";import"./arrow-right-ChnID2an.js";import"./form-B2HnhBFN.js";import"./zod-B7iL7HbO.js";const Je=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V9",key:"uvy0l4"}],["path",{d:"M19 21V3",key:"11j9sm"}]],Xe=P("chart-no-axes-column-increasing",Je);const Ze=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],es=P("list",Ze);const ss=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],ts=P("music",ss);const as=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],rs=P("twitter",as),ls=({dashboardId:r,title:n,description:l,path:i,status:a="normal",createdAt:c,template:u,isTestDashboard:x,hideNotConfiguredBadge:g=!1})=>{const{t}=k(),h=Le(),v=ue(),w=pe(),D=ae()?.role?.toLowerCase()==="subuser",[S,A]=N.useState(!1),[B,I]=N.useState(!1),y=i!=="",W=()=>a==="critico"?e.jsx(Y,{className:"h-3 w-3 fill-red-500 text-red-500"}):a==="atencao"?e.jsx(Y,{className:"h-3 w-3 fill-amber-500 text-amber-500"}):e.jsx(Y,{className:"h-3 w-3 fill-green-500 text-green-500"}),q=()=>{v({to:i})},R=()=>{A(!0)},J=()=>{w.mutate(r,{onSuccess:()=>{V.success(t("DASHBOARD_RECYCLED")),A(!1)},onError:o=>{console.error("Erro ao enviar dashboard para reciclagem:",o),V.error(t("ERROR_RECYCLING_DASHBOARD"))}})},L=()=>{I(!0)},s=()=>{V.success(t("DASHBOARD_CONFIGURED")),I(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(he,{className:z("overflow-hidden flex flex-col pb-0 h-full",!y&&"border-dashed",x&&"border-orange-500/50 bg-orange-500/5"),children:[e.jsxs(ge,{className:"flex-1 flex-grow pt-3 flex flex-col",children:[e.jsx("div",{className:z(y?"mb-4":"mb-2"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[y&&W(),e.jsx("h3",{className:"text-lg font-semibold",children:n}),x&&e.jsxs(M,{variant:"outline",className:"bg-orange-500/10 text-orange-400 border-orange-500/30 text-xs flex items-center gap-1",children:[e.jsx(Be,{className:"h-3 w-3"}),"Test"]}),!y&&D&&e.jsx(M,{variant:"outline",className:"bg-slate-500/10 text-slate-400 border-slate-500/30 text-xs",children:t("NOT_AVAILABLE")}),!y&&!D&&u?.comingSoon&&e.jsx(M,{variant:"outline",className:"bg-blue-500/10 text-blue-400 border-blue-500/30 text-xs",children:t("COMING_SOON")}),!y&&!D&&!u?.comingSoon&&!g&&e.jsx(M,{variant:"outline",className:"bg-amber-500/10 text-amber-400 border-amber-500/30 text-xs",children:t("NOT_CONFIGURED")}
1)]})}),y?e.jsx(e.Fragment,{children:e.jsx("p",{className:z("text-muted-foreground line-clamp-3 text-sm mb-5"),children:l})}):e.jsxs(e.Fragment,{children:[u?.comingSoon?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"min-h-[70%] w-full flex items-center justify-center bg-muted rounded-md border border-gray-700/30",children:e.jsxs("div",{className:"text-center p-1",children:[e.jsx(Ge,{className:"h-4 w-4 text-gray-500 mx-auto mb-0"}),e.jsx("p",{className:"text-xs text-gray-400 leading-tight",children:"This dashboard is currently in development and is not available yet."})]})})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("div",{className:"min-h-[70%] w-full flex items-center justify-center bg-muted rounded-md border border-gray-700/30",children:e.jsxs("div",{className:"text-center p-1",children:[e.jsx(Ue,{className:"h-4 w-4 text-gray-500 mx-auto mb-0"}),e.jsx("p",{className:"text-xs text-gray-400 leading-tight",children:t("DASHBOARD_NEEDS_CONFIGURATION")})]})})}),e.jsx("p",{className:z("text-muted-foreground line-clamp-3 text-sm mb-1"),children:l})]}),y&&e.jsx("div",{className:"flex items-center text-xs text-muted-foreground mb-1",children:c?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),e.jsxs("span",{children:[t("CREATED_ON_DATE")," ",fe(new Date(c),"PPP",{locale:h})]})]}):e.jsx("span",{children:" "})})]}),e.jsxs(be,{className:"flex justify-between bg-muted dark:bg-[#1a1f2c] p-3 mt-auto border-t border-gray-700/30",children:[y?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(F,{children:[e.jsx(H,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"icon",className:"text-muted-foreground dark:text-gray-300 hover:text-gray-200 hover:bg-gray-800/60 cursor-pointer",children:e.jsx(Pe,{className:"h-4 w-4"})})}),e.jsx($,{children:e.jsx("p",{children:t("EDIT")})})]}),e.jsxs(F,{children:[e.jsx(H,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"icon",className:"text-red-400 hover:text-red-300 hover:bg-gray-800/60 cursor-pointer",onClick:R,disabled:w.isPending,children:e.jsx(X,{className:"h-4 w-4"})})}),e.jsx($,{children:e.jsx("p",{children:t("DELETE")})})]})]}):e.jsx("div",{}),i!==""?e.jsx(e.Fragment,{children:e.jsx(E,{variant:"outline",size:"sm",className:"bg-purple-400/10 text-purple-600 dark:bg-purple-600/10 dark:text-purple-400 border-purple-500/30 hover:bg-purple-500/20 cursor-pointer",onClick:q,children:t("DASHBOARDS_MANAGE_VIEW")})}):D?e.jsx("span",{}):u?.comingSoon?e.jsx(E,{variant:"outline",size:"sm",className:"bg-blue-400/10 text-blue-600 dark:bg-blue-600/10 dark:text-blue-400 border-blue-500/30 hover:bg-blue-500/20 cursor-pointer",onClick:L,disabled:!0,children:t("COMING_SOON")}):e.jsx(E,{variant:"outline",size:"sm",className:"bg-amber-400/10 text-amber-600 dark:bg-amber-600/10 dark:text-amber-400 border-amber-500/30 hover:bg-amber-500/20 cursor-pointer",onClick:L,children:t("CONFIGURE")})]})]}),e.jsx(je,{open:S,onOpenChange:A,children:e.jsxs(Ne,{className:"sm:max-w-[450px] max-h-[90vh] overflow-hidden p-0 gap-0 bg-background border border-red-500/20 shadow-xl",children:[e.jsx(ve,{className:"relative px-4 pt-3 pb-2 pr-12 bg-gradient-to-r from-red-500/10 via-orange-500/10 to-pink-500/10 border-b border-red-500/20",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-gradient-to-br from-red-500/20 to-orange-500/20 border border-red-500/30 shrink-0",children:e.jsx(X,{className:"h-4 w-4 text-red-400"})}),e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx(ye,{className:"text-base font-bold text-red-400 truncate",children:t("RECYCLE_DASHBOARD")}),e.jsx(Te,{className:"text-[10px] text-muted-foreground/80",children:t("RECYCLE_DASHBOARD_CONFIRMATION",{title:n})})]})]})}),e.jsxs(Ce,{className:"px-4 py-3 border-t border-border/50 bg-muted/20",children:[e.jsx(De,{className:"border-border/50 hover:bg-muted/50 cursor-pointer",children:t("CANCEL")}),e.jsx(Se,{onClick:J,className:"bg-gradient-to-r from-red-500/20 to-orange-500/20 hover:from-red-500/30 hover:to-orange-500/30 border border-red-500/30 text-red-400 hover:text-red-300 cursor-pointer",children:t("DELETE")})]})]})}),e.jsx(Fe,{open:B,onOpenChange:I,onComplete:s,initialTemplate:u})]})},is=r=>({facebook:e.jsx(Qe,{className:"h-5 w-5 text-blue-600"}),instagram:e.jsx(We,{className:"h-5 w-5 text-pink-600"}),twitter:e.jsx(rs,{className:"h-5 w-5 text-blue-400"}),youtube:e.jsx(qe,{className:"h-5 w-5 text-red-600"}),linkedin:e.jsx(oe,{className:"h-5 w-5 text-blue-700"}),tiktok:e.jsx(ts,{className:"h-5 w-5 text-pink-600"}),bar_chart:e.jsx(Xe,{className:"h-5 w-5 text-indigo-600"})})[r?.toLowerCase()],K=({group:r,dashboardId:n,title:l,description:i,path:a,createdAt:c,template:u,isTestDashboard:x,hideNotConfiguredBadge:g})=>{const t=r||{name:"",icon:""},h=is(t.icon),v=t.name&&t.name.trim()!=="",w=v?l.replace(`${t.name} - `,""):l;return e.jsxs("div",{className:"space-y-1 w-full h-full flex flex-col",children:[e.jsx("div",{className:"flex items-center justify-between",children:v?e.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[h,t.name]}):e.jsx("div",{className:"h-7"})}),e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsx(ls,{dashboardId:n||0,title:w,description:i,path:a,createdAt:c,template:u,isTestDashboard:x,hideNotConfiguredBadge:g},`dashboard-${n}`)})]})};function ns({searchQuery:r}){const{t:n}=k(),[l,i]=N.useState(!1);return N.useEffect(()=>{i(!0)},[]),e.jsxs("div",{className:"flex items-center justify-center py-16 md:py-24 w-full relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-purple-500/5 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl animate-pulse [animation-delay:1s]"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 w-96 h-96 bg-pink-500/5 rounded-full blur-3xl animate-pulse [animation-delay:2s]"})]}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center text-center px-4 max-w-2xl mx-auto",children:[e.jsx("div",{className:`relative mb-8 transition-all duration-700 ${l?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-180 opacity-0"}`,children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative",style:{animation:"float 4s ease-in-out infinite"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-500/20 via-blue-500/20 to-pink-500/20 rounded-full blur-2xl animate-pulse"}),e.jsx("div",{className:"relative bg-gradient-to-br from-purple-500/10 to-blue-500/10 rounded-3xl p-8 border border-purple-500/20 backdrop-blur-sm",children:e.jsx(Ve,{className:"w-24 h-24 text-purple-400"})})]}),[{top:"15%",left:"20%",delay:"0s"},{top:"30%",left:"70%",delay:"0.5s"},{top:"60%",left:"15%",delay:"1s"},{top:"75%",left:"75%",delay:"1.5s"},{top:"45%",left:"50%",delay:"0.3s"},{top:"25%",left:"45%",delay:"0.8s"}].map((a,c)=>
1e.jsx("div",{className:"absolute",style:{top:a.top,left:a.left,animation:"sparkle 3s ease-in-out infinite",animationDelay:a.delay},children:e.jsx(re,{className:"w-4 h-4 text-purple-400/60"})},c))]})}),e.jsx("h2",{className:`text-3xl md:text-4xl font-bold mb-4 bg-gradient-to-r from-purple-400 via-blue-400 to-pink-400 bg-clip-text text-transparent transition-all duration-500 delay-300 ${l?"opacity-100 translate-y-0":"opacity-0 translate-y-5"}`,children:n("DASHBOARDS_NO_RESULTS_TITLE")}),e.jsx("p",{className:`text-sm text-muted-foreground/70 transition-all duration-500 delay-500 ${l?"opacity-100 translate-y-0":"opacity-0 translate-y-5"}`,children:n("DASHBOARDS_NO_RESULTS_SUBTITLE")})]})]})}function te({searchQuery:r,category:n}){const{t:l}=k(),[i,a]=N.useState(!1);N.useEffect(()=>{a(!0)},[]);const c=l("SEARCH_RESULTS_MESSAGE",{query:r,category:l(n==="all"?"ALL_CATEGORIES":n?.toUpperCase()||"ALL_CATEGORIES")}),u=`"${r}"`,x=c.indexOf(u),g=x>=0?c.substring(0,x):c.replace(`"${r}"`,""),t=x>=0?c.substring(x+u.length):"";return e.jsxs("div",{className:"relative mb-4 overflow-hidden rounded-lg border border-blue-500/30 bg-gradient-to-r from-blue-500/10 via-purple-500/10 to-pink-500/10 px-3 py-2 backdrop-blur-sm shadow-lg transition-all duration-500 hover:border-blue-500/50 hover:shadow-xl hover:shadow-blue-500/20",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 left-0 w-24 h-24 bg-blue-500/5 rounded-full blur-2xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-0 right-0 w-28 h-28 bg-purple-500/5 rounded-full blur-2xl animate-pulse [animation-delay:1s]"})]}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2.5",children:[e.jsx("div",{className:`relative transition-all duration-500 ${i?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-180 opacity-0"}`,children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative",style:{animation:"float 4s ease-in-out infinite"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500/20 via-purple-500/20 to-pink-500/20 rounded-full blur-xl animate-pulse"}),e.jsx("div",{className:"relative flex items-center justify-center rounded-md bg-gradient-to-br from-blue-500/20 to-purple-500/20 p-1.5 border border-blue-500/30 backdrop-blur-sm",children:e.jsx(le,{className:"h-3.5 w-3.5 text-blue-400"})})]}),[{top:"-10%",left:"20%",delay:"0s"},{top:"60%",left:"70%",delay:"0.5s"},{top:"30%",left:"50%",delay:"1s"}].map((h,v)=>e.jsx("div",{className:"absolute",style:{top:h.top,left:h.left,animation:"sparkle 3s ease-in-out infinite",animationDelay:h.delay},children:e.jsx(re,{className:"w-3 h-3 text-blue-400/50"})},v))]})}),e.jsx("div",{className:`flex-1 transition-all duration-500 delay-200 ${i?"opacity-100 translate-x-0":"opacity-0 -translate-x-5"}`,children:e.jsxs("p",{className:"text-xs font-medium leading-tight",children:[e.jsx("span",{className:"bg-gradient-to-r from-blue-400 via-purple-400 to-pink-400 bg-clip-text text-transparent",children:g}),e.jsxs("span",{className:"font-bold bg-gradient-to-r from-blue-300 via-purple-300 to-pink-300 bg-clip-text text-transparent",children:['"',r,'"']}),e.jsx("span",{className:"bg-gradient-to-r from-blue-400 via-purple-400 to-pink-400 bg-clip-text text-transparent",children:t})]})}),e.jsx("div",{className:`hidden md:block h-full w-1 bg-gradient-to-b from-blue-500/50 via-purple-500/50 to-pink-500/50 rounded-full transition-all duration-500 delay-300 ${i?"opacity-100 scale-y-100":"opacity-0 scale-y-0"}`})]})]})}const ce=C.memo(({template:r,onExtraDashboards:n})=>{const{t:l}=k(),{data:i}=Ae(r.originalTemplate._id),a=C.useMemo(()=>[...i??[]].sort((g,t)=>{const h=new Date(g.createdAt),v=new Date(t.createdAt);return h.getTime()-v.getTime()}),[i]);C.useEffect(()=>{if(a&&a.length>1){const g=a.slice(1).map(t=>({id:t.id,title:t.title,description:t.description,createdAt:t.createdAt,category:r.originalTemplate.category,sourceTemplateId:r.originalTemplate._id,isTestDashboard:t.isTestDashboard}));n(r.originalTemplate._id,g)}else n(r.originalTemplate._id,[])},[a,n,r.originalTemplate.category,r.originalTemplate._id]);const c=a&&a.length>0?a[0]:void 0,u=c?G(c.title,l):l(r.name),x=c?G(c.description,l):l(r.description||"");return e.jsx(K,{group:r.originalTemplate.group,dashboardId:c?.id,title:u,description:x,path:c?`/dashboard/${c.id}`:"",createdAt:c?.createdAt,template:r.originalTemplate,isTestDashboard:c?.isTestDashboard??!1}
1,`template-dashboard-${c?.id??"no-dashboard"}`)});ce.displayName="TemplateWithExtras";function os({searchQuery:r,viewMode:n,category:l="all"}){const i=String(r||""),{t:a}=k(),{data:c,isLoading:u}=xe(),{data:x}=we(),g=c?.templates||[],[t,h]=C.useState([]),v=C.useMemo(()=>{const s=new Map;if(!x?.length)return s;for(const o of x){const d=o.templateId;if(!d)continue;const f=s.get(d)??[];f.push(o),s.set(d,f)}for(const[o,d]of s)s.set(o,[...d].sort((f,p)=>new Date(f.createdAt??0).getTime()-new Date(p.createdAt??0).getTime()));return s},[x]);C.useEffect(()=>{h([])},[c]);const w=C.useCallback(s=>Z(i,[s.title,s.description||""]),[i]),O=C.useCallback(s=>{const o=s.originalTemplate._id,d=v.get(o)?.[0],f=d?[G(d.title,a),G(d.description,a)]:[a(s.name),a(s.description||"")];return Z(i,f)},[i,v,a]),D=C.useMemo(()=>{if(!g)return[];const s=new Map;return g.forEach(o=>{const d=o.originalTemplate._id;s.has(d)||s.set(d,o)}),Array.from(s.values())},[g]),S=s=>g?g?.filter(d=>d.categoryId===s).filter(O).sort((d,f)=>{const p=d?.originalTemplate?.group?.uid||"",j=f?.originalTemplate?.group?.uid||"";return p.localeCompare(j)}):[],A=C.useMemo(()=>D.filter(O).sort((s,o)=>{const d=s?.originalTemplate?.index??0,f=o?.originalTemplate?.index??0,p=d-f;if(p===0){const j=s?.originalTemplate?.group?.uid||"",m=o?.originalTemplate?.group?.uid||"";return j.localeCompare(m)}return p}),[D,i]),B=s=>{let o=t;return s!=="all"&&(o=o.filter(d=>d.category&&Array.isArray(d.category)&&d.category.includes(s))),o.filter(w)},I=({dashboard:s})=>{const o=g.find(d=>d.categoryId===s.category[0]);return e.jsx("div",{className:"w-full h-full flex flex-col",children:e.jsx(K,{group:{uid:"",name:"",icon:""},dashboardId:parseInt(s.id)||0,title:a(s.title),description:a(s.description||""),path:`/dashboard/${s.id}`,createdAt:s.createdAt||"",template:o?.originalTemplate,isTestDashboard:s.isTestDashboard},`extra-dashboard-${s.id}`)})},y=C.useCallback((s,o)=>{h(d=>{const f=d.filter(b=>b.sourceTemplateId!==s),p=o.map(b=>({...b,sourceTemplateId:s})),j=new Set(f.map(b=>b.id)),m=p.filter(b=>!j.has(b.id));return[...f,...m]})},[]),W=s=>{const o=S(s),d=B(s);if(o.length===0&&d.length===0||o.length===0)return null;const f=o?.reduce((m,b)=>{const T=b?.originalTemplate?.group?.uid||"default";return m[T]||(m[T]=[]),m[T].push(b),m},{}),p=m=>f[m][0]?.originalTemplate?.layoutClass||"col-span-1 flex flex-col",j=n==="list"?"grid grid-cols-1 gap-4 items-stretch":"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 items-stretch";return e.jsx("div",{className:j,children:Object.entries(f).sort(([,m],[,b])=>{const T=m[0]?.originalTemplate?.index??0,Q=b[0]?.originalTemplate?.index??0,U=T-Q;if(U===0){const de=m[0]?.originalTemplate?.group?.uid||"",me=b[0]?.originalTemplate?.group?.uid||"";return de.localeCompare(me)}return U}).map(([m,b])=>e.jsx("div",{className:n==="list"?"w-full":`${p(m)} h-full flex flex-col`,children:b.map(T=>e.jsx(ce,{template:T,onExtraDashboards:y},T.id))},m))})},q=()=>{const s=A;if(s.length===0)return null;const o=s?.reduce((p,j)=>{const m=j?.originalTemplate?.group?.uid||"default";return p[m]||(p[m]=[]),p[m].push(j),p},{}),d=p=>o[p][0]?.originalTemplate?.layoutClass||"col-span-1 flex flex-col",f=n==="list"?"grid grid-cols-1 gap-4 items-stretch":"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 items-stretch";return e.jsx("div",{className:f,children:Object.entries(o).sort(([,p],[,j])=>{const m=p[0]?.originalTemplate?.index??0,b=j[0]?.originalTemplate?.index??0,T=m-b;if(T===0){const Q=p[0]?.originalTemplate?.group?.uid||"",U=j[0]?.originalTemplate?.group?.uid||"";return Q.localeCompare(U)}return T}).map(([p,j])=>e.jsx("div",{className:n==="list"?"w-full":`${d(p)} h-full flex flex-col`,children:j.map(m=>e.jsx(K,{group:m.originalTemplate.group,dashboardId:void 0,title:a(m.name),description:a(m.description||""),path:"",createdAt:"",template:m.originalTemplate,isTestDashboard:!1,hideNotConfiguredBadge:!0},`template-${m.originalTemplate._id}`))},p))})};if(u)return e.jsx("div",{className:"pb-6",children:e.jsx(se,{icon:"dashboard"})});const R=B(l),L=((l==="templates"?A:S(l))?.length||0)>0||R.length>0;return!L&&i.trim()?e.jsxs("div",{className:"pb-6",children:[e.jsx(te,{searchQuery:i,category:l}),e.jsx(ns,{searchQuery:i})]}):!L&&!i.trim()?e.jsx("div",{className:"pb-6",children:e.jsx(se,{icon:"dashboard"})}):e.jsxs("div",{className:"pb-6",children:[i.trim()&&e.jsx(te,{searchQuery:i,category:l}),e.jsx("h2",{className:"text-xl font-bold mb-4",children:a("DASHBOARDS_IN_FOCUS")}),e.jsx("div",{className:"overflow-x-auto pb-4",children:l==="templates"?q():W(l)}
1),R.length>0&&e.jsxs("div",{className:"mt-8",children:[e.jsx("h2",{className:"text-xl font-bold",children:a("MY_DASHBOARDS")}),e.jsx("div",{className:n==="list"?"grid grid-cols-1 gap-4 items-stretch":"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 items-stretch",children:R.map((s,o)=>e.jsx(I,{dashboard:s},`${s.id}-${o}`))})]})]})}function cs({onSearch:r,initialValue:n=""}){const[l,i]=N.useState(n||""),{t:a}=k();N.useEffect(()=>{i(n||"")},[n]);const c=u=>{const x=u.target.value||"";i(x),r(x)};return e.jsxs("div",{className:"relative w-full",children:[e.jsx(le,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{type:"text",placeholder:a("SEARCH_DASHBOARDS_PLACEHOLDER"),className:"pl-8",value:l||"",onChange:c})]})}const ds=({onSearch:r,viewMode:n,setViewMode:l,onCreateDashboard:i,searchQuery:a="",canCreateDashboard:c=!0})=>{const{t:u}=k();return e.jsxs("div",{className:"mb-6 flex flex-col gap-4 @3xl/main:flex-row @3xl/main:items-start @3xl/main:justify-between @3xl/main:gap-6",children:[e.jsxs("div",{className:"min-w-0 shrink-0 text-left",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(ke,{className:"h-6 w-6 text-insight-orange"}),e.jsx("h1",{className:"text-3xl font-bold",children:u("DASHBOARDS")})]}),e.jsx("p",{className:"text-muted-foreground",children:u("DASHBOARDS_MANAGE_DESCRIPTION")})]}),e.jsxs("div",{className:"flex w-full min-w-0 flex-wrap items-center gap-2 @3xl/main:w-auto @3xl/main:shrink @3xl/main:justify-end",children:[e.jsx("div",{className:"min-w-[180px] flex-1 @3xl/main:max-w-64",children:e.jsx(cs,{onSearch:r,initialValue:a||""})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("div",{className:"flex overflow-hidden rounded-md border",children:[e.jsxs(F,{children:[e.jsx(H,{asChild:!0,children:e.jsx(E,{variant:n==="grid"?"default":"ghost",className:"cursor-pointer rounded-none px-3 hover:bg-[var(--color-insight-orange)]",style:n==="grid"?{background:"var(--color-insight-orange)"}:void 0,onClick:()=>l("grid"),children:e.jsx(ne,{className:"h-4 w-4"})})}),e.jsx($,{children:e.jsx("p",{children:u("GRID_VIEW")})})]}),e.jsxs(F,{children:[e.jsx(H,{asChild:!0,children:e.jsx(E,{variant:n==="list"?"default":"ghost",className:"cursor-pointer rounded-none px-3 hover:bg-[var(--color-insight-orange)]",style:n==="list"?{background:"var(--color-insight-orange)"}:void 0,onClick:()=>l("list"),children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsx($,{children:e.jsx("p",{children:u("LIST_VIEW")})})]})]}),c&&e.jsxs(E,{className:"flex-shrink-0 cursor-pointer transition-all duration-200 hover:brightness-90 hover:shadow-md",style:{background:"var(--color-insight-orange)"},onClick:x=>{x.preventDefault(),i()},children:[e.jsx(_e,{className:"mr-1 h-4 w-4"}),u("NEW_DASHBOARD")]})]})]})]})};function Vs(){const r=ee.useSearch(),n=ee.useNavigate(),[l,i]=N.useState(String(r.search||"")),[a,c]=N.useState("grid"),[u,x]=N.useState(!1),[g,t]=N.useState("my_business"),{t:h}=k(),w=ae()?.role?.toLowerCase()==="subuser";N.useEffect(()=>{i(String(r.search||""))},[r.search]),N.useEffect(()=>{r.category&&t(r.category)},[r.category]),N.useEffect(()=>{l.trim()&&t("all")},[l]),Ye("DASHBOARDS");const O=S=>{i(S)},D=()=>{x(!0)};return e.jsx(Me,{children:e.jsxs("div",{className:"px-6 py-4 space-y-6",children:[e.jsx(ds,{onSearch:O,viewMode:a,setViewMode:c,onCreateDashboard:D,searchQuery:l||"",canCreateDashboard:!w}),e.jsx("div",{className:"flex  w-full overflow-x-auto",children:e.jsx(Oe,{defaultValue:"my_business",value:g,onValueChange:S=>{t(S),n({search:A=>({...A,category:S}),replace:!0})},children:e.jsxs(Ie,{className:"mb-4",children:[e.jsxs(_,{value:"my_business",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(Ke,{className:"h-4 w-4"}),e.jsx("span",{children:h("MY_BUSINESS")})]}),e.jsxs(_,{value:"social_networks",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{children:h("SOCIAL_NETWORKS")})]}),e.jsxs(_,{value:"traffic",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(He,{className:"h-4 w-4"}),e.jsx("span",{children:h("TRAFFIC")})]}),e.jsxs(_,{value:"perpetual",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:h("PERPETUAL")})]}),e.jsxs(_,{value:"sales_actions",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(ie,{className:"h-4 w-4"}),e.jsx("span",{children:h("SALES_ACTIONS")})]}),e.jsxs(_,{value:"templates",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(ze,{className:"h-4 w-4"}),e.jsx("span",{children:h("TEMPLATES")})]}),e.jsxs(_,{value:"all",className:"flex items-center gap-2 cursor-pointer ",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx("span",{children:h("ALL")})]})]})})}),e.jsx(os,{searchQuery:l||"",viewMode:a,category:g}),e.jsx($e,{showDashboardWizard:u,setShowDashboardWizard:x})]})})}export{Vs 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.