1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177,42077,86352],{297:(e,t,r)=>{"use strict";r.d(t,{I:()=>m,M5:()=>f,SQ:()=>x,_2:()=>g,hO:()=>b,lp:()=>v,lv:()=>h,mB:()=>j,nV:()=>p,rI:()=>c,ty:()=>u});var a=r(99769),s=r(25677),n=r(7867),i=r(6197),l=r(75057),o=r(4207),d=r(60515);let c=n.bL,u=n.l9,m=n.YJ;n.ZL;let h=n.Pb;n.z6;let p=s.forwardRef((e,t)=>{let{className:r,inset:s,children:l,...o}=e;return(0,a.jsxs)(n.ZP,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",r),...o,children:[l,(0,a.jsx)(i.A,{className:"ml-auto h-4 w-4"})]})});p.displayName=n.ZP.displayName;let f=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.G5,{ref:t,className:(0,d.cn)("z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...s})});f.displayName=n.G5.displayName;let x=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...i}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:t,sideOffset:s,className:(0,d.cn)("z-50 flex min-w-32 flex-col gap-0.5 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i})})});x.displayName=n.UC.displayName;let g=s.forwardRef((e,t)=>{let{className:r,inset:s,...i}=e;return(0,a.jsx)(n.q7,{ref:t,className:(0,d.cn)("relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",s&&"pl-8",r),...i})});g.displayName=n.q7.displayName;let b=s.forwardRef((e,t)=>{let{className:r,children:s,checked:i,...o}=e;return(0,a.jsxs)(n.H_,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",r),checked:i,...o,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})}),s]})});b.displayName=n.H_.displayName,s.forwardRef((e,t)=>{let{className:r,children:s,...i}=e;return(0,a.jsxs)(n.hN,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",r),...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(o.A,{className:"h-2 w-2 fill-current"})})}),s]})}).displayName=n.hN.displayName;let v=s.forwardRef((e,t)=>{let{className:r,inset:s,...i}=e;return(0,a.jsx)(n.JU,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",r),...i})});v.displayName=n.JU.displayName;let j=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.wv,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-border",r),...s})});j.displayName=n.wv.displayName},3142:(e,t,r)=>{"use strict";r.d(t,{J:()=>d});var a=r(99769),s=r(25677),n=r(27751),i=r(59615),l=r(60515);let o=(0,i.F)("text-base leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.b,{ref:t,className:(0,l.cn)(o(),r),...s})});d.displayName=n.b.displayName},6706:(e,t,r)=>{"use strict";r.d(t,{ThemeProvider:()=>n});var a=r(99769),s=r(35414);function n(e){let{children:t}=e;return(0,a.jsx)(s.N,{attribute:"class",defaultTheme:"light",enableSystem:!0,disableTransitionOnChange:!0,children:t})}},6842:()=>{},6881:(e,t,r)=>{"use strict";r.d(t,{AuthenticatedLayout:()=>t2});var a=r(99769),s=r(25677),n=r(2471),i=r(52554),l=r(46577),o=r(92098),d=r(32974);function c(){let{user:e,isLoading:t}=(0,d.J)(),r=(0,l.useAtomValue)(i.Me);return(0,s.useEffect)(()=>
1{if(t)return;let a=(0,o.x)();if(!a)return;if(!e)return void a.then(e=>e.reset()).catch(()=>void 0);let s=null==r?void 0:r._id,n=null==r?void 0:r.name;a.then(t=>{t.identify(e._id,{email:e.email,name:"".concat(e.profile.first_name," ").concat(e.profile.last_name).trim()}),s&&t.group("team",s,{name:n})}).catch(e=>{console.error("PostHog identify/group failed:",e)})},[e,t,r]),null}var u=r(47120);let m=(0,r(76084).s)(()=>Promise.all([r.e(21433),r.e(25569),r.e(16735),r.e(44225),r.e(32096),r.e(62800),r.e(83290),r.e(9004),r.e(79483),r.e(95256)]).then(r.bind(r,95256)).then(e=>e.GiaChatWindow));function h(){let{open:e}=(0,l.useAtomValue)(i.fC);return e?(0,a.jsx)(m,{}):null}var p=r(18610),f=r(72898),x=r.n(f),g=r(87941),b=r(80707),v=r(63761),j=r(63675),y=r(12416),N=r(60515),w=r(79256),_=r(96628),k=r(71648),E=r(11088),C=r(36739),S=r(95255),A=r(63247),R=r(84030),I=r(85819),F=r(89495),M=r(83768),P=r(35414),T=r(30316),O=r(67564),L=r(7220);function H(){let{openDelay:e=0,closeDelay:t=150}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[r,a]=s.useState(!1),n=s.useRef(null),i=s.useRef(null),l=s.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]),o=s.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),d=s.useCallback(()=>{if(o(),e<=0)return void a(!0);n.current||(n.current=setTimeout(()=>{n.current=null,a(!0)},e))},[o,e]),c=s.useCallback(()=>{l(),o(),i.current=setTimeout(()=>a(!1),t)},[l,o,t]),u=s.useCallback(()=>{l(),o(),a(!1)},[l,o]);return s.useEffect(()=>()=>{l(),o()},[l,o]),{open:r,setOpen:a,openNow:d,scheduleClose:c,cancelClose:o,close:u}}var D=r(297),K=r(79190);function U(){let{isMobile:e}=(0,u.cL)(),{user:t}=(0,d.J)(),[r]=(0,l.useAtom)(i.Me),{openModal:n}=(0,p.hS)(),o=(0,y.c)("navigation.userMenu"),c=(0,L.V)(),m=(0,L.n)(),{theme:h,setTheme:f}=(0,P.D)(),[b,v]=(0,s.useState)(!1),{open:j,setOpen:N,openNow:w,scheduleClose:_,cancelClose:U}=H();return((0,s.useEffect)(()=>{v(!0)},[]),t)?(0,a.jsx)(u.wZ,{className:"w-auto",children:(0,a.jsx)(u.FX,{children:(0,a.jsxs)(D.rI,{open:j,onOpenChange:N,modal:!1,children:[(0,a.jsx)("div",{onMouseEnter:w,onMouseLeave:_,children:(0,a.jsx)(D.ty,{asChild:!0,children:(0,a.jsxs)(u.Uj,{className:"!p-0 group-data-[collapsible=icon]:!p-0 flex flex-col items-center justify-center gap-1 h-auto",children:[(0,a.jsx)(K.GvUserAvatar,{user:t,CDN:O.Rc,className:"h-6 w-6 md:h-8 md:w-8"}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground md:hidden",children:o("profileLabel")})]})})}),(0,a.jsxs)(D.SQ,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg bg-sidebar border-sidebar-border text-sidebar-foreground/70 [&_[role=menuitem]]:text-sidebar-foreground/70 [&_[role=menuitem]]:hover:bg-sidebar-accent [&_[role=menuitem]]:hover:text-sidebar-foreground [&_[role=menuitem]]:focus:bg-sidebar-accent [&_[role=menuitem]]:focus:text-sidebar-foreground [&_[role=separator]]:bg-sidebar-border",side:e?"top":"right",align:"end",sideOffset:4,onMouseEnter:U,onMouseLeave:_,children:[(0,a.jsx)(D.lp,{className:"p-0 font-normal",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[(0,a.jsx)(K.GvUserAvatar,{user:t,CDN:O.Rc,className:"h-8 w-8"}),(0,a.jsxs)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[(0,a.jsx)("span",{className:"truncate font-medium",children:t.profile.first_name+" "+t.profile.last_name}),(0,a.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:t.email})]})]})}),(0,a.jsx)(D.mB,{}),(0,a.jsxs)(D.I,{children:[(0,a.jsx)(D._2,{className:"p-0",children:(0,a.jsxs)(x(),{className:"w-full flex items-center px-2 py-1.5",href:"/user/account",children:[(0,a.jsx)(F.K,{className:"size-4 mr-2"}),o("profile")]})}),(0,a.jsx)(D._2,{className:"p-0",children:(0,a.jsxs)(x(),{className:"w-full flex items-center px-2 py-1.5",href:"/user/notifications",children:[(0,a.jsx)(g.I,{className:"size-4 mr-2"}),o("notifications")]})})]}),(0,a.jsx)(D.mB,{}),(0,a.jsxs)(D.I,{children:[(0,a.jsxs)(D._2,{onClick:()=>n(p.ew.HELP),children:[(0,a.jsx)(A.v,{className:"size-4 mr-2"}),o("helpCenter")]}),(0,a.jsxs)(D._2,{onClick:()=>n(p.ew.WHATS_NEW),children:[(0,a.jsx)(E.p,{className:"size-4 mr-2"}),o("whatsNew")]}),(0,a.jsx)(D._2,{className:"p-0",children:(0,a.jsxs)(x(),{className:"w-full flex items-center px-2 py-1.5",href:"".concat("https://tally.so/r/wkGNXe","?fname=").concat(t.profile.first_name,"&lname=").concat(t.profile.last_name,"&email=").concat(t.email,"&team=").concat(null==r?void 0:r.name),target:"_blank",children:[(0,a.jsx)(k.l,{className:"size-4 mr-2"}),o("feedback")]})}),(0,a.jsx)(D._2,{className:"p-0",children:(0,a.jsxs)(x(),{className:"w-full flex items-center px-2 py-1.5",href:"".concat("https://docs.google.com/forms/d/e/1FAIpQLSf2qNcD4W9O6NrCFwuKcV8VznOlFRPCqjBk1MImUSYaYi6Klg/viewform"),target:"_blank",children:[(0,a.jsx)(C.Q,{className:"size-4 mr-2"}),o("referWin")]})})]}),b&&(0,a.jsxs)(D._2,{onClick:()=>f("dark"===h?"light":"dark"),children:["dark"===h?(0,a.jsx)(I.b,{className:"size-4 mr-2"}):(0,a.jsx)(S.A,{className:"size-4 mr-2"}),o("dark"===h?"toggleLightMode":"toggleDarkMode")]}),(0,a.jsx)(D.mB,{}),(0,a.jsxs)(D.lv,{children:[(0,a.jsxs)(D.nV,{className:"focus:bg-sidebar-accent focus:text-sidebar-foreground data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-foreground",children:[(0,a.jsx)(M.A,{className:"size-4 mr-2"}),o("language")]}),(0,a.jsx)(D.M5,{onMouseEnter:U,onMouseLeave:_,className:"bg-sidebar border-sidebar-border text-sidebar-foreground
1/70 [&_[role=menuitem]]:text-sidebar-foreground/70 [&_[role=menuitem]]:hover:bg-sidebar-accent [&_[role=menuitem]]:hover:text-sidebar-foreground [&_[role=menuitem]]:focus:bg-sidebar-accent [&_[role=menuitem]]:focus:text-sidebar-foreground",children:T.Y.map(e=>(0,a.jsxs)(D._2,{onClick:()=>c(e.code),className:m===e.code?"bg-sidebar-accent !text-sidebar-foreground":"",children:[(0,a.jsx)("span",{className:"mr-2",children:e.flag}),e.name]},e.code))})]}),(0,a.jsx)(D.mB,{}),(0,a.jsx)(D._2,{className:"p-0",children:(0,a.jsxs)(x(),{className:"w-full flex items-center px-2 py-1.5",href:"/logout",children:[(0,a.jsx)(R.M,{className:"size-4 mr-2"}),o("logout")]})})]})]})})}):null}function z(){let{toggleSidebar:e}=(0,u.cL)(),t=(0,y.c)("navigation.mobile"),r=(0,n.useRouter)(),[s]=(0,l.useAtom)(i.Me),{projects:o}=(0,w.sw)({teamId:null==s?void 0:s._id,limit:1,enabled:!!(null==s?void 0:s._id)});return(0,a.jsxs)("div",{className:"dark bg-sidebar text-sidebar-foreground border-t border-sidebar-border fixed bottom-0 left-0 right-0 z-50 h-[70px] flex items-center justify-around px-4 py-2 gap-4 md:hidden",children:[(0,a.jsxs)(x(),{href:"/dashboard",className:(0,N.cn)((0,_.r)({variant:"ghost"}),"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent text-sm font-normal flex-col h-auto p-0 gap-1"),children:[(0,a.jsx)(b.t,{className:"w-6 h-6"}),(0,a.jsx)("span",{children:t("dashboard")})]}),(0,a.jsxs)(_.$,{variant:"ghost",className:"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent text-sm font-normal flex-col h-auto p-0 !gap-1",onClick:()=>{o.length>0?r.push("/projects/".concat(o[0]._id)):r.push("/dashboard")},children:[(0,a.jsx)(j.B,{className:"w-6 h-6"}),(0,a.jsx)("span",{children:t("projects")})]}),(0,a.jsxs)(x(),{href:"/activities",className:(0,N.cn)((0,_.r)({variant:"ghost"}),"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent text-sm font-normal flex-col h-auto p-0 gap-1"),children:[(0,a.jsx)(g.I,{className:"w-6 h-6"}),(0,a.jsx)("span",{children:t("notifications")})]}),(0,a.jsx)(U,{}),(0,a.jsxs)(_.$,{variant:"ghost",className:"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent text-sm font-normal flex-col h-auto p-0 !gap-1",onClick:e,children:[(0,a.jsx)(v.V,{className:"w-6 h-6"}),(0,a.jsx)("span",{children:"Menu"})]})]})}var G=r(92934),B=r(96015),W=r(58266),J=r(56201),V=r(93085),q=r(85454),Z=r(32651),Q=r(20702),X=r(6686),Y=r(32413),$=r(62141),ee=r(16973),et=r(55514),er=r(97021),ea=r(22896),es=r(7305),en=r(76673),ei=r(78423),el=r(97661),eo=r(15196);let ed=[{nameKey:"projects.analytics.navigation.analytics",href:"/analytics",icon:r(30823).N}];function ec(){let e=(0,n.usePathname)(),t=(0,y.c)();return(0,a.jsx)("div",{className:"flex flex-col gap-4 py-2",children:(0,a.jsxs)(u.Cn,{className:"gap-1 p-0 px-2",children:[(0,a.jsx)("div",{className:"px-3 py-1",children:(0,a.jsx)("span",{className:"text-sidebar-foreground/40 text-[10px] font-semibold tracking-wider uppercase",children:t("projects.analytics.navigation.group")})}),(0,a.jsx)(u.wZ,{children:ed.map(r=>(0,a.jsx)(u.FX,{className:e===r.href?"bg-dark-gray":"",children:(0,a.jsx)(u.Uj,{asChild:!0,className:"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-dark-gray cursor-pointer px-3 py-2",children:(0,a.jsxs)(x(),{href:r.href,children:[(0,a.jsx)(r.icon,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm",children:t(r.nameKey)})]})})},r.href))})]})})}var eu=r(59326),em=r(98219),eh=r(63427),ep=r(31018),ef=r(77111),ex=r(3069),eg=r(19036),eb=r(31250);function ev(){var e;let t=(0,y.c)("ai"),r=(0,n.usePathname)(),i=(0,n.useSearchParams)().get("chatId"),{toast:l}=(0,eh.dj)(),o=null!=(e=null==r?void 0:r.split("/")[2])?e:"",[d,c]=(0,s.useState)([]),[m,h]=(0,s.useState)(!0),[p,f]=(0,s.useState)(""),[g,b]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(!o)return;let e=!1;return h(!0),(0,eb.ll)(o).then(t=>{e||c(t)}).catch(t=>{e||(console.error("Failed to load chat history:",t),c([]))}).finally(()=>{e||h(!1)}),()=>{e=!0}},[o]);let v=p?d.filter(e=>e.title.toLowerCase().includes(p.toLowerCase())):d,j=async()=>
1{g&&(b(null),c(e=>e.filter(e=>e._id!==g)),await (0,eb.F9)(g)?l({title:t("chatHistory.deleted.title"),description:t("chatHistory.deleted.description")}):(l({title:t("chatHistory.deleteFailed.title"),description:t("chatHistory.deleteFailed.description"),variant:"destructive"}),(0,eb.ll)(o).then(c).catch(e=>console.error("Failed to reload chat history:",e))))};return(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsx)("div",{className:"px-2 pb-2 pt-1",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(ef.A,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-sidebar-foreground/40"}),(0,a.jsx)("input",{type:"text",placeholder:t("chatHistory.searchPlaceholder"),value:p,onChange:e=>f(e.target.value),className:"h-8 w-full rounded-md bg-dark-gray pl-9 pr-3 text-sm text-sidebar-foreground outline-none placeholder:text-sidebar-foreground/40"})]})}),(0,a.jsx)(u.Cn,{className:"scrollbar-thin min-h-0 flex-1 gap-1 overflow-y-scroll overflow-x-hidden p-0 px-2 [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-sidebar-border",children:m?(0,a.jsx)(u.wZ,{children:[1,2,3,4].map(e=>(0,a.jsx)(u.FX,{className:"flex items-center rounded-md",children:(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 px-3 py-2",children:[(0,a.jsx)("div",{className:"h-3.5 w-3/4 animate-pulse rounded-sm bg-dark-gray"}),(0,a.jsx)("div",{className:"h-2.5 w-1/3 animate-pulse rounded-sm bg-dark-gray"})]})},e))}):0===v.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,a.jsx)(ex.A,{className:"mb-3 size-8 text-sidebar-foreground/30"}),(0,a.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:p?t("chatHistory.noResults"):t("chatHistory.empty.title")})]}):(0,a.jsx)(u.wZ,{children:v.map(e=>(0,a.jsxs)(u.FX,{className:(0,N.cn)("group/chat flex items-center rounded-md hover:bg-dark-gray",i===e._id&&"bg-dark-gray"),children:[(0,a.jsxs)(x(),{href:"/chat/".concat(o,"?chatId=").concat(e._id),className:"flex min-w-0 flex-1 flex-col gap-0.5 px-3 py-2 text-sidebar-foreground/70 hover:text-sidebar-foreground",children:[(0,a.jsx)("span",{className:"truncate text-sm leading-snug",children:e.title}),(0,a.jsx)("span",{className:"text-[11px] text-sidebar-foreground/40",children:(0,ep.A)(new Date(e.updatedAt),{addSuffix:!0})})]}),(0,a.jsxs)(D.rI,{children:[(0,a.jsx)(D.ty,{asChild:!0,children:(0,a.jsx)(_.$,{type:"button",variant:"ghost",size:"icon",className:"mx-1 size-7 shrink-0 text-sidebar-foreground/50 opacity-0 transition-opacity hover:bg-white/10 hover:text-sidebar-foreground group-hover/chat:opacity-100",children:(0,a.jsx)(eu.H,{className:"size-5",weight:"bold"})})}),(0,a.jsx)(D.SQ,{side:"right",align:"start",className:"w-40",children:(0,a.jsxs)(D._2,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:()=>b(e._id),children:[(0,a.jsx)(eg.A,{className:"mr-2 size-4"}),t("chatHistory.deleteChat")]})})]})]},e._id))})}),(0,a.jsx)(em.Lt,{open:!!g,onOpenChange:e=>{e||b(null)},children:(0,a.jsxs)(em.EO,{children:[(0,a.jsxs)(em.wd,{children:[(0,a.jsx)(em.r7,{children:t("chatHistory.confirmDelete.title")}),(0,a.jsx)(em.$v,{children:t("chatHistory.confirmDelete.description")})]}),(0,a.jsxs)(em.ck,{children:[(0,a.jsx)(em.Zr,{children:t("chatHistory.confirmDelete.cancel")}),(0,a.jsx)(em.Rx,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:j,children:t("chatHistory.confirmDelete.delete")})]})]})})]})}var ej=r(99671),ey=r(15975),eN=r(23402),ew=r(51130);function e_(){var e,t,r,o;let d=(0,y.c)("aiCompare.history"),c=(0,n.usePathname)(),m=null!=(r=null==c||null==(e=c.match(/^\/_teams\/([^/]+)/))?void 0:e[1])?r:"",[h]=(0,l.useAtom)(i.Me),p=m||(null==h?void 0:h._id)||"",f=null!=(o=null==c||null==(t=c.match(/^\/_teams\/[^/]+\/ai-compare\/([^/]+)/))?void 0:t[1])?o:null,[g,b]=(0,s.useState)([]),[v,j]=(0,s.useState)(!0),w=(0,s.useRef)(!1),[_,k]=(0,s.use
1State)(""),[E,C]=(0,s.useState)(0),[S,A]=(0,s.useState)(!1),[R,I]=(0,s.useState)(0),F=(0,ew._l)(g),M=R>5,P=R>0&&!M;(0,s.useEffect)(()=>{if(M||!F&&!P)return;let e=setInterval(()=>C(e=>e+1),5e3);return()=>clearInterval(e)},[F,P,M]),(0,s.useEffect)(()=>{w.current=!1,A(!1),I(0)},[p]),(0,s.useEffect)(()=>{if(!p)return;let e=!1;return w.current||j(!0),(0,eN.n)("/api/revision-comparisons?teamId=".concat(encodeURIComponent(p)),{cache:"no-store"}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))).then(t=>{e||(b(e=>{var r;return(0,ew.D4)(e,null!=(r=t.comparisons)?r:[])}),A(!1),I(0))}).catch(t=>{e||(console.error("Failed to load comparison history:",t),A(!0),I(e=>e+1))}).finally(()=>{e||(w.current=!0,j(!1))}),()=>{e=!0}},[p,f,E]);let T=(0,ew.rs)(g,_);return(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsx)("div",{className:"px-2 pb-2 pt-1",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(ef.A,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-sidebar-foreground/40"}),(0,a.jsx)("input",{type:"text",placeholder:d("searchPlaceholder"),value:_,onChange:e=>k(e.target.value),className:"h-8 w-full rounded-sm bg-dark-gray pl-9 pr-3 text-sm text-sidebar-foreground outline-none placeholder:text-sidebar-foreground/40"})]})}),(0,a.jsx)(u.Cn,{className:"scrollbar-thin min-h-0 flex-1 gap-1 overflow-y-scroll overflow-x-hidden p-0 px-2 [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-sidebar-border",children:v?(0,a.jsx)(u.wZ,{children:[1,2,3,4].map(e=>(0,a.jsx)(u.FX,{className:"flex items-center rounded-sm",children:(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 px-3 py-2",children:[(0,a.jsx)("div",{className:"h-3.5 w-3/4 animate-pulse rounded-sm bg-dark-gray"}),(0,a.jsx)("div",{className:"h-2.5 w-1/3 animate-pulse rounded-sm bg-dark-gray"})]})},e))}):0===T.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,a.jsx)(ej.A,{className:"mb-3 size-8 text-sidebar-foreground/30"}),0===g.length&&S?(0,a.jsx)("button",{type:"button",onClick:()=>C(e=>e+1),className:"text-xs text-underline-red hover:underline",children:d("failed")}):(0,a.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:_?d("noResults"):d("empty")})]}):(0,a.jsxs)(u.wZ,{children:[S&&(0,a.jsx)(u.FX,{className:"px-1 pb-1",children:(0,a.jsx)("button",{type:"button",onClick:()=>C(e=>e+1),className:"flex items-center gap-1 px-2 py-1 text-[11px] text-underline-red hover:underline",children:d("failed")})}),T.map(e=>{var t;let r=(0,ew.lH)(e.status),s=null!=(t=e.created)?t:e.updatedAt;return(0,a.jsx)(u.FX,{className:(0,N.cn)("flex items-center rounded-sm hover:bg-dark-gray",f===e._id&&"bg-dark-gray"),children:(0,a.jsxs)(x(),{href:(0,ew.BO)(p,e._id),className:"flex min-w-0 flex-1 flex-col gap-0.5 px-3 py-2 text-sidebar-foreground/70 hover:text-sidebar-foreground",children:[(0,a.jsx)("span",{className:"truncate text-sm leading-snug",children:(0,ew.wq)(e)}),(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-[11px] text-sidebar-foreground/40",children:[s?(0,ep.A)(new Date(s),{addSuffix:!0}):null,"failed"===r&&(0,a.jsx)("span",{className:"text-underline-red",children:d("failed")}),"running"===r&&(0,a.jsxs)("span",{className:"flex items-center gap-1 text-mustard-yellow",children:[(0,a.jsx)(ey.A,{className:"size-3 animate-spin"}),null!=(0,ew.v)(e)?"".concat((0,ew.v)(e),"%"):d("running")]})]})]})},e._id)})]})})]})}var ek=r(73743),eE=r(60580),eC=r(4096),eS=r(19141),eA=r(78020),eR=r(50608),eI=r(64447),eF=r(54695),eM=r(10533),eP=r(37907),eT=r(26364);function eO(){return(0,a.jsxs)("div",{className:"flex items-start gap-4 px-2 py-2",children:[(0,a.jsx)(eM.E,{className:"mt-2 h-9 w-9 shrink-0 rounded-full bg-sidebar-accent"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-2 py-0.5",children:[(0,a.jsx)(eM.E,{className:"h-3.5 w-full rounded-sm bg-sidebar-accent"}),(0,a.jsx)(eM.E,{className:"h-3.5 w-3/5 rounded-sm bg-sidebar-accent"}),(0,a.jsx)(eM.E,{className:"h-3 w-24 rounded-sm bg-sidebar-accent"})]})]})}let eL=[{labelKey:"sidebar.notifications.filterAll",value:"ALL"},{labelKey:"sidebar.notifications.filterNewComment",value:"NEW_COMMENT"},{labelKey:"sidebar.notifications.filterMention",value:"MENTIONED"},{labelKey:"sidebar.notifications.filterReaction",value:"NEW_COMMENT_REACTION"},{labelKey:"projects.filters.needsChanges",value:"REVISION_NEEDS_CHANGES"},{labelKey:"projects.filters.approved",value:"REVISION_APPROVED"},{labelKey:"projects.filters.finalized",value:"DESIGN_FINALIZED"},{labelKey:"sidebar.notifications.filterNewProof",value:"NEW_DESIGN"},{labelKey:"sidebar.notifications.filterProductHub",value:"PRODUCT_HUB"}];function eH(e){let t={ALL:e.length,NEW_COMMENT:0,MENTIONED:0,NEW_COMMENT_REACTION:0,REVISION_NEEDS_CHANGES:0,REVISION_APPROVED:0,DESIGN_FINALIZED:0,NEW_DESIGN:0,PRODUCT_HUB:0};
1return e.forEach(e=>{var r;(null==(r=e.type)?void 0:r.startsWith("PRODUCT_HUB_"))?t.PRODUCT_HUB++:"NEW_COMMENT"===e.type||"UPDATED_COMMENT"===e.type?t.NEW_COMMENT++:"MENTIONED"===e.type||"NEW_NOTE_MENTIONED"===e.type?t.MENTIONED++:"NEW_COMMENT_REACTION"===e.type||"NEW_NOTE_COMMENT_REACTION"===e.type?t.NEW_COMMENT_REACTION++:"REVISION_NEEDS_CHANGES"===e.type?t.REVISION_NEEDS_CHANGES++:"REVISION_APPROVED"===e.type?t.REVISION_APPROVED++:"DESIGN_FINALIZED"===e.type?t.DESIGN_FINALIZED++:"NEW_DESIGN"===e.type&&t.NEW_DESIGN++}),t}function eD(e){let{children:t}=e,{count:r,mutate:n}=(0,en.l)(),{user:o}=(0,d.J)(),c=(0,l.useAtomValue)(i.Me),u=(0,y.c)(),m=(0,y.c)("common.activityVerbs"),h=s.useCallback((e,t,r)=>(0,eR.jT)(c,e,t,r),[c]),{open:p,setOpen:f,openNow:g,scheduleClose:b,cancelClose:v,close:j}=H({openDelay:500}),[w,_]=s.useState("ALL"),[k,E]=s.useState([]),[C,S]=s.useState([]),[A,R]=s.useState({}),[I,F]=s.useState(!1),[M,P]=s.useState(0),[T,L]=s.useState(!0),[D,K]=s.useState(-1),[U,z]=s.useState(!1),B=s.useRef(null),W=s.useRef(null),J=s.useRef(null),V=s.useCallback(async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];F(!0);try{let a=await (0,eT.H)({skip:20*t,limit:20,..."ALL"!==e&&{filterBy:e}});a.length>0?(E(e=>r?[...e,...a]:a),0===t&&("ALL"!==e&&0===C.length?(0,eT.H)({skip:0,limit:20}).then(e=>{S(e),R(eH(e))}):"ALL"===e&&(S(a),R(eH(a)))),L(a.length>=20)):(r||E([]),L(!1))}catch(e){console.error("Failed to load activities:",e)}finally{F(!1)}},[C.length]);s.useEffect(()=>{p&&(_("ALL"),P(0),L(!0),K(-1),V("ALL",0),r>0&&(0,ek.V)().then(()=>n()).catch(e=>console.error("Failed to clear notifications:",e)))},[p]);let q=async e=>{e!==w&&(_(e),P(0),L(!0),E([]),K(-1),await V(e,0))},Z=async e=>{let t=e.target;if(t.scrollHeight-t.scrollTop-t.clientHeight<100&&!I&&T){let e=M+1;P(e),await V(w,e,!0)}};return s.useEffect(()=>{if(!p||!W.current)return;let e=e=>{var t;let r=e.target;if((null==(t=W.current)?void 0:t.contains(r))||r===document.body){if("Escape"===e.key)return void f(!1);if(0!==k.length){if("ArrowDown"===e.key)e.preventDefault(),K(e=>e<k.length-1?e+1:e);else if("ArrowUp"===e.key)e.preventDefault(),K(e=>e>0?e-1:-1);else if("Enter"===e.key&&D>=0){e.preventDefault();let t=document.querySelector('[data-activity-index="'.concat(D,'"] a'));null==t||t.click()}}}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[p,k,D,f]),s.useEffect(()=>{let e=J.current;if(!e)return;let t=()=>{z(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return t(),e.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[p,A]),(0,a.jsxs)(eI.AM,{open:p,onOpenChange:f,children:[(0,a.jsx)(eI.dT,{asChild:!0,children:(0,a.jsx)("div",{onMouseEnter:g,onMouseLeave:b,onFocus:g,onBlur:b,onClick:j,children:t})}),(0,a.jsxs)(eI.hl,{ref:W,side:"right",align:"end",sideOffset:12,onMouseEnter:v,onMouseLeave:b,className:"w-[380px] overflow-hidden p-0 rounded-sm shadow-xl border border-sidebar-border bg-sidebar text-sidebar-foreground/70",children:[(0,a.jsxs)("div",{className:"flex h-11 items-center justify-between border-b border-sidebar-border px-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:u("navigation.mobile.notifications")}),(0,a.jsx)(x(),{href:"/activities",onClick:()=>f(!1),className:"text-xs text-blue-400 hover:text-blue-300 font-medium",children:u("projects.reviewStatusPopover.viewAll")})]}),(0,a.jsx)("div",{className:"px-3 py-3",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{ref:J,className:"flex gap-1 overflow-x-auto rounded-md bg-black/20 p-1 [&::-webkit-scrollbar]:h-0",children:eL.map(e=>{let t=A[e.value]||0,r=w===e.value;return(0,a.jsxs)("button",{onClick:()=>q(e.value),className:(0,N.cn)("flex shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium outline-hidden transition-all focus-visible:ring-2 focus-visible:ring-blue-500",r?"bg-sidebar-accent text-white shadow-xs":"text-sidebar-foreground
1/70 hover:text-sidebar-foreground"),children:[u(e.labelKey),t>0&&!r&&(0,a.jsx)("span",{className:"text-[10px] text-sidebar-foreground/50",children:t>99?"99+":t})]},e.value)})}),U&&(0,a.jsx)("div",{className:"pointer-events-none absolute right-0 top-0 bottom-0 w-20 rounded-r-md bg-gradient-to-l from-sidebar via-sidebar/80 to-transparent"})]})}),(0,a.jsx)(eF.F,{className:"h-[460px] [&_[data-radix-scroll-area-scrollbar]]:bg-transparent [&_[data-radix-scroll-area-scrollbar]]:w-1.5 [&_[data-radix-scroll-area-thumb]]:!bg-sidebar-border [&_[data-radix-scroll-area-thumb]]:!rounded-full",onScrollCapture:Z,ref:B,children:(0,a.jsxs)("div",{className:"px-2 min-h-[460px]",children:[I&&0===k.length&&(0,a.jsx)("div",{className:"min-h-[460px] space-y-0",children:Array.from({length:6},(e,t)=>(0,a.jsx)(eO,{},t))}),k.length>0&&o&&(0,a.jsxs)("div",{className:"min-h-[460px]",children:[(()=>{let e=function(e){let t={today:[],yesterday:[],thisWeek:[],older:[]};return e.forEach(e=>{let r=(0,eE.A)(e.created);(0,eC.A)(r)?t.today.push(e):(0,eS.A)(r)?t.yesterday.push(e):(0,eA.A)(r)?t.thisWeek.push(e):t.older.push(e)}),t}(k),t=[{key:"today",labelKey:"sidebar.notifications.today",items:e.today},{key:"yesterday",labelKey:"sidebar.notifications.yesterday",items:e.yesterday},{key:"thisWeek",labelKey:"sidebar.notifications.thisWeek",items:e.thisWeek},{key:"older",labelKey:"sidebar.notifications.older",items:e.older}],r=[];return t.forEach(e=>{e.items.forEach(t=>{r.push({activity:t,sectionKey:e.key,sectionLabelKey:e.labelKey})})}),t.map(e=>0===e.items.length?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("div",{className:"px-2 py-2.5 text-xs text-muted-foreground uppercase tracking-wide",children:u(e.labelKey)}),e.items.map(e=>{let t=r.findIndex(t=>t.activity._id===e._id),s=D===t;return(0,a.jsx)("div",{"data-activity-index":t,role:"option","aria-selected":s,className:(0,N.cn)("transition-colors rounded-sm",s&&"bg-sidebar"),children:(0,a.jsx)(eP.O1,{translate:(e,t)=>
1m(e,t),activity:e,user:o,cdnDomain:O.Rc,sidebar:!0,resolveHref:h,className:(0,N.cn)("bg-transparent px-2 py-2 max-w-full rounded-sm hover:bg-sidebar-accent mb-0 [&_span.text-foreground]:text-white [&_span.text-muted-foreground]:text-sidebar-foreground/70 [&_span.text-xs]:text-sidebar-foreground/70 [&_p]:text-sidebar-foreground/70",s&&"bg-sidebar")})},e._id)})]},e.key))})(),I&&(0,a.jsx)("div",{className:"space-y-0",children:Array.from({length:3},(e,t)=>(0,a.jsx)(eO,{},"more-".concat(t)))}),!T&&(0,a.jsx)("p",{className:"text-center text-xs text-sidebar-foreground/70 py-3",children:u("sidebar.notifications.noMore")})]}),!I&&0===k.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-6 min-h-[460px]",children:[(0,a.jsx)("div",{className:"relative h-28 w-28 mb-3",children:(0,a.jsx)(G.default,{src:"/icons/notifications_vector.svg",alt:u("navigation.mobile.notifications"),fill:!0,style:{objectFit:"contain"}})}),(0,a.jsx)("p",{className:"text-sm text-sidebar-foreground/70 text-center",children:u("sidebar.notifications.noneYet")})]})]})})]})]})}var eK=r(71790),eU=r(26279),ez=r(79721);function eG(e){let t=(0,y.c)("playbooks");return[{key:"playbooks",name:t("tabs.playbooks"),href:"/_teams/".concat(e,"/playbooks"),icon:eU.F},{key:"knowledge-base",name:t("knowledgeBase.heading"),href:"/_teams/".concat(e,"/playbooks/knowledge-base"),icon:eK.G},{key:"ai-scans",name:t("layout.tabs.aiScans"),href:"/_teams/".concat(e,"/playbooks/ai-scans"),icon:ez.g}]}function eB(e,t){return"knowledge-base"===e?!!(null==t?void 0:t.includes("/playbooks/knowledge-base")):"ai-scans"===e?!!(null==t?void 0:t.includes("/playbooks/ai-scans")):!!((null==t?void 0:t.includes("/playbooks"))&&!t.includes("/knowledge-base")&&!t.includes("/ai-scans"))}function eW(){let{teamId:e}=(0,n.useParams)(),t=(0,n.usePathname)(),r=(0,y.c)("playbooks"),s=eG(e);return(0,a.jsx)("div",{className:"flex flex-col gap-4 py-2",children:(0,a.jsxs)(u.Cn,{className:"gap-1 p-0 px-2",children:[(0,a.jsx)("div",{className:"px-3 py-1",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/40",children:r("pageTitle")})}),(0,a.jsx)(u.wZ,{children:s.map(e=>(0,a.jsx)(u.FX,{className:eB(e.key,t)?"bg-dark-gray":"",children:(0,a.jsx)(u.Uj,{asChild:!0,className:"cursor-pointer px-3 py-2 text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground",children:(0,a.jsxs)(x(),{href:e.href,children:[(0,a.jsx)(e.icon,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm",children:e.name})]})})},e.href))})]})})}function eJ(e){var t;let{title:r,groups:n,emptyMessage:i,onOpenChange:l,children:o}=e,{open:d,setOpen:c,openNow:u,scheduleClose:m,cancelClose:h,close:p}=H({openDelay:500});s.useEffect(()=>{null==l||l(d)},[d,l]);let f=n.filter(e=>e.items.length>0||e.isLoading),g=0===f.length,b=57+24*(null!=(t=f[0])&&!!t.label);return(0,a.jsxs)(eI.AM,{open:d,onOpenChange:c,children:[(0,a.jsx)(eI.dT,{asChild:!0,children:(0,a.jsx)("div",{onMouseEnter:u,onMouseLeave:m,onFocus:u,onBlur:m,onClick:p,children:o})}),(0,a.jsxs)(eI.hl,{side:"right",align:"start",sideOffset:12,alignOffset:-(b+2),collisionPadding:16,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onMouseEnter:h,onMouseLeave:m,onFocus:h,onBlur:m,className:"w-64 rounded-sm border border-sidebar-border bg-sidebar p-0 text-sidebar-foreground/70 shadow-xl",children:[(0,a.jsx)("div",{className:"flex h-11 items-center border-b border-sidebar-border px-4",children:(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:r})}),(0,a.jsxs)("div",{className:"flex max-h-[min(28rem,calc(100vh-8rem))] flex-col gap-4 overflow-y-auto py-3",children:[g&&i&&(0,a.jsx)("p",{className:"px-4 py-2 text-sm text-sidebar-foreground/40",children:i}),f.map(e=>{var t;return(0,a.jsxs)("div",{className:"flex flex-col gap-1 px-2",children:[e.label&&(0,a.jsx)("div",{className:"flex h-5 items-center px-2",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/40",children:e.label})}),(0,a.jsx)("ul",{className:"flex flex-col gap-1",children:0===e.items.length&&e.isLoading?Array.from({length:null!=(t=e.skeletonCount)?t:3},(e,t)=>(0,a.jsx)("li",{className:"flex h-9 items-center px-2","aria-hidden":!0,
1children:(0,a.jsx)(eM.E,{className:"h-4 w-full rounded-sm bg-dark-gray"})},t)):e.items.map(e=>{let t=()=>{var t;null==(t=e.onSelect)||t.call(e),c(!1)},r=(0,N.cn)("flex h-9 w-full items-center gap-2 rounded-sm px-2 text-left text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground",e.isActive&&"bg-dark-gray"),s=(0,a.jsxs)(a.Fragment,{children:[e.icon&&(0,a.jsx)(e.icon,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"truncate text-sm",children:e.name}),e.trailing&&(0,a.jsx)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:e.trailing})]});return(0,a.jsx)("li",{children:e.href?(0,a.jsx)(x(),{href:e.href,onClick:t,className:r,children:s}):(0,a.jsx)("button",{type:"button",onClick:t,className:(0,N.cn)(r,"cursor-pointer"),children:s})},e.id)})})]},e.id)})]})]})]})}function eV(e){let{children:t}=e,r=(0,l.useAtomValue)(i.Me),s=(0,n.usePathname)(),o=(0,y.c)("navigation.sidebar"),d=eG(null==r?void 0:r._id);return(0,a.jsx)(eJ,{title:o("primary.playbooks"),groups:[{id:"playbooks",items:d.map(e=>({id:e.key,name:e.name,href:e.href,icon:e.icon,isActive:eB(e.key,s)}))}],children:t})}var eq=r(93162),eZ=r(48238),eQ=r(98096),eX=r(57669),eY=r(99823),e$=r(48307),e0=r(72404),e1=r(52806),e2=r(42077),e5=r(14458);function e4(){var e;let t=(0,y.c)("productHub.nav"),{teamId:r}=(0,n.useParams)(),i=(0,n.usePathname)(),l=(0,n.useSearchParams)(),{brands:o}=(0,e2.Ek)(r),d=null!=(e=null==l?void 0:l.get("brand"))?e:null,[c,m]=(0,s.useState)(!1),{effective:h}=(0,e1.vL)(r),p=(null==h?void 0:h.enabled)!==!1,{waitingOnMe:f}=(0,e1.K$)(p?r:void 0),g=(0,n.useRouter)(),v="/_teams/".concat(r,"/product-hub"),N=[{name:t("dashboard"),href:"".concat(v,"/dashboard"),icon:b.t},{name:t("catalog"),href:v,icon:eQ.x},...p?[{name:t("changeRequests"),href:"".concat(v,"/change-requests"),icon:eq.Y,matchChildRoutes:!0,count:f.length}]:[],{name:t("import"),href:"".concat(v,"/import"),icon:e$.C,badge:t("comingSoon")}],w=[{name:t("productFamilies"),href:"".concat(v,"/product-families"),icon:j.B,matchChildRoutes:!0},{name:t("fields"),href:"".concat(v,"/fields"),icon:eX.R},{name:t("workflow"),href:"".concat(v,"/workflow"),icon:eY.M},{name:t("access"),href:"".concat(v,"/access"),icon:e0.n}],_=[{label:t("workspace"),items:N},{label:t("settings"),items:w}],k=e=>e.href===v?i===v:!!(i===e.href||e.matchChildRoutes&&(null==i?void 0:i.startsWith(e.href)));return(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[_.map(e=>(0,a.jsxs)(u.Cn,{className:"gap-1 p-0 px-2",children:[(0,a.jsx)("div",{className:"px-3 py-1",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/40",children:e.label})}),(0,a.jsx)(u.wZ,{children:e.items.map(e=>(0,a.jsxs)(u.FX,{className:"rounded-md ".concat(k(e)?"bg-dark-gray":""),children:[(0,a.jsx)(u.Uj,{asChild:!0,className:"px-3 py-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-dark-gray",children:(0,a.jsxs)(x(),{href:e.badge?"#":e.href,"aria-disabled":!!e.badge,tabIndex:e.badge?-1:void 0,className:e.badge?"pointer-events-none opacity-50":"",children:[(0,a.jsx)(e.icon,{className:"w-4 h-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm",children:e.name}),e.badge&&(0,a.jsx)("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded-full bg-sidebar-foreground/10 text-sidebar-foreground/40",children:e.badge}),!e.badge&&!!e.count&&(0,a.jsx)("span",{className:"ml-auto text-[10px] font-semibold tabular-nums px-1.5 py-0.5 rounded-full bg-marker-blue text-white",children:e.count})]})}),e.href===v&&(0,a.jsxs)("div",{className:"mt-0.5 ml-4 flex flex-col gap-0.5 border-l border-sidebar-foreground/10 pl-3",children:[(0,a.jsxs)(x(),{href:v,className:"flex items-center gap-2 rounded-md px-2 py-1 text-sm text-sidebar-foreground/60 hover:bg-dark-gray hover:text-sidebar-foreground ".concat(i!==v||d?"":"bg-dark-gray text-sidebar-foreground"),children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-sidebar-foreground/30"}),(0,a.jsx)("span",{className:"truncate",children:t("allBrands")})]}),o.map(e=>(0,a.jsxs)(x(),{href:"".concat(v,"?brand=").concat(encodeURIComponent(e._id)),className:"flex items-center gap-2 rounded-md px-2 py-1 text-sm text-sidebar-foreground
1/60 hover:bg-dark-gray hover:text-sidebar-foreground ".concat(d===e._id?"bg-dark-gray text-sidebar-foreground":""),children:[(0,a.jsx)("span",{className:"bg-marker-blue h-1.5 w-1.5 shrink-0 rounded-full"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]},e._id)),(0,a.jsxs)("button",{type:"button",onClick:()=>m(!0),className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-sidebar-foreground/40 hover:bg-dark-gray hover:text-sidebar-foreground",children:[(0,a.jsx)(eZ.F,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:t("addBrand")})]})]})]},e.href))})]},e.label)),(0,a.jsx)(e5.b,{teamId:r,open:c,onOpenChange:m,onCreated:e=>g.push("".concat(v,"?brand=").concat(encodeURIComponent(e)))})]})}var e7=r(7189);let e6=(0,e7.createServerReference)("7f5ea68cfbce710479a8f70b6367dedb1b503f41c4",e7.callServer,void 0,e7.findSourceMapURL,"setProjectGroupAction"),e3=(0,e7.createServerReference)("7ffecc1f5c64b349b71049ecf888d2a6910280221e",e7.callServer,void 0,e7.findSourceMapURL,"deleteProjectGroupAction");var e9=r(86352),e8=r(40775),te=r(27130),tt=r(18114),tr=r(50138),ta=r(24427);let ts=(e,t,r)=>["group-projects",null!=e?e:null,t,r];var tn=r(4841);let ti=(e,t)=>["project-groups",null!=e?e:null,!!t];var tl=r(21832);let to=(0,e7.createServerReference)("7fd40a973c98be3dd2508b2df19ba5a724fa76056b",e7.callServer,void 0,e7.findSourceMapURL,"updateProjectGroupAction"),td=(0,e7.createServerReference)("7fc2dff025aceeeb3f380e278728e6f99cd9d5c996",e7.callServer,void 0,e7.findSourceMapURL,"createProjectGroupAction");var tc=r(82780),tu=r(3142),tm=r(47291);let th="Folder",tp="#0D6ABE",tf=["Folder","Briefcase","Building","Users","Rocket","Target","Flag","Star","Bookmark","Tag","Palette","Camera","Image","Package","ShoppingCart","Globe","Lightbulb","Calendar","Compass","Heart","Gift","Book","Shield","Crown"];function tx(e){let{open:t,onOpenChange:r,teamId:n,group:i,onSaved:l,onCreated:o}=e,d=(0,y.c)("projectGroups"),{toast:c}=(0,eh.dj)(),u=!!(null==i?void 0:i._id),[m,h]=s.useState(""),[p,f]=s.useState(th),[x,g]=s.useState(tp),[b,v]=s.useState(!1),j=s.useRef(!1);s.useEffect(()=>{var e,r,a;t&&(h(null!=(e=null==i?void 0:i.name)?e:""),f(null!=(r=null==i?void 0:i.icon)?r:th),g(null!=(a=null==i?void 0:i.color)?a:tp))},[t,i]);let N=async()=>{if(j.current)return;let e=m.trim();if(!e)return void c({title:d("nameRequired"),variant:"destructive"});j.current=!0,v(!0);try{let t=u&&i?await to({teamId:n,groupId:i._id,name:e,icon:p,color:x}):await td({teamId:n,name:e,icon:p,color:x});if(null==t?void 0:t.isError)return void c({title:d("saveError"),variant:"destructive"});c({title:u?d("updateSuccess"):d("createSuccess")});let a=null==t?void 0:t.body;!u&&a&&(null==o||o(a)),l(),r(!1)}catch(e){console.error("Failed to save group:",e),c({title:d("saveError"),variant:"destructive"})}finally{j.current=!1,v(!1)}},w=(0,tm.Rg)(p);return(0,a.jsx)(tc.lG,{open:t,onOpenChange:r,children:(0,a.jsxs)(tc.Cf,{className:"sm:max-w-md",children:[(0,a.jsx)(tc.c7,{children:(0,a.jsx)(tc.L3,{children:u?d("editTitle"):d("createTitle")})}),(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(tu.J,{htmlFor:"group-name",children:d("nameLabel")}),(0,a.jsx)(tl.p,{id:"group-name",value:m,maxLength:100,placeholder:d("namePlaceholder"),onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),N())}})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(tu.J,{children:d("colorLabel")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:tm.JJ.map(e=>(0,a.jsx)(_.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 rounded border-2 p-0 hover:bg-transparent ".concat(x===e?"border-marker-blue ring-2 ring-marker-blue":"border-border"),style:{backgroundColor:e},onClick:()=>g(e),"aria-label":d("selectColorAriaLabel",{color:e})},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(tu.J,{children:d("iconLabel")}),(0,a.jsxs)(eI.AM,{children:[(0,a.jsx)(eI.Wv,{asChild:!0,children:(0,a.jsxs)(_.$,{type:"button",variant:"outline-solid",className:"w-full justify-start gap-2","aria-label":d("selectIconAriaLabel"),children:[(0,a.jsx)(w,{className:"h-4 w-4",style:{color:x}}),(0,a.jsx)("span",{children:p})]})}),(0,a.jsx)(eI.hl,{className:"w-64 p-2",children:(0,a.jsx)("div",{className:"grid max-h-48 grid-cols-6 gap-1 overflow-y-auto",onWheel:e=>e.stopPropagation(),children:tf.map(e=>{let t=(0,tm.Rg)(e);return(0,a.jsx)(_.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 rounded border p-0 hover:bg-accent ".concat(p===e?"border-marker-blue bg-marker-blue/10":"border-border"),onClick:()=>f(e),"aria-label":d("selectSpecificIconAriaLabel",{iconName:e}),children:(0,a.jsx)(t,{className:"h-4 w-4",style:{color:x}})},e)})})})]})]})]}),(0,a.jsxs)(tc.Es,{children:[(0,a.jsx)(_.$,{type:"button",variant:"ghost",onClick:()=>r(!1),disabled:b,children:d("cancel")}),(0,a.jsx)(_.$,{type:"button",variant:"primary",onClick:N,disabled:b,children:u?d("save"):d("create")})]})]})})}var tg=r(82449),tb=r(47872),tv=r(91047);function tj(e){let{group:t,count:r,countIsTrustworthy:s,notificationsCount:n,isCollapsed:i,canManage:l,canDelete:o,canCreateGroup:d,onToggleCollapse:c,onEditGroup:m,onDeleteGroup:h,onCreateGroup:p,children:f}=e,x=(0,y.c)("projectGroups"),g=(0,tm.Rg)(t.icon),{setNodeRef:b,
1isOver:v}=(0,e8.zM)({id:"group:".concat(t._id),data:{groupId:t._id}}),j=l||o||d,N=e=>(0,a.jsxs)(e,{className:"gap-2",onSelect:()=>p(),children:[(0,a.jsx)(eZ.F,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{children:x("newGroup")})]}),w=(0,a.jsxs)("div",{className:"flex items-center gap-1 rounded-md bg-[color-mix(in_srgb,var(--gc)_24%,#121212)] pr-1 hover:bg-[color-mix(in_srgb,var(--gc)_32%,#121212)]",children:[(0,a.jsx)(tb.R6,{asChild:!0,children:(0,a.jsxs)("button",{type:"button","aria-label":t.name,className:"flex min-w-0 flex-1 items-center gap-2 rounded-sm px-2 py-2 text-sm text-sidebar-foreground/70 hover:text-sidebar-foreground",children:[(0,a.jsx)(tg.K,{className:"h-3 w-3 shrink-0 transition-transform ".concat(i?"":"rotate-90")}),(0,a.jsx)(g,{className:"h-4 w-4 shrink-0",style:{color:t.color}}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",children:t.name}),i&&n>0&&(0,a.jsx)("span",{className:"shrink-0 rounded-full bg-muted-foreground px-1.5 py-0.5 text-center text-xs text-background",children:n}),s&&(0,a.jsx)("span",{className:"shrink-0 text-xs text-sidebar-foreground/50",children:r})]})}),j&&(0,a.jsxs)(D.rI,{children:[(0,a.jsx)(D.ty,{asChild:!0,children:(0,a.jsx)("button",{type:"button","aria-label":x("groupActions",{name:t.name}),className:"rounded-sm p-1 text-sidebar-foreground/50 hover:text-sidebar-foreground",children:(0,a.jsx)(eu.H,{className:"h-4 w-4"})})}),(0,a.jsxs)(D.SQ,{align:"end",className:"w-44 rounded-md",children:[l&&(0,a.jsx)(D._2,{onSelect:()=>m(t),children:x("editGroup")}),o&&(0,a.jsx)(D._2,{className:"text-underline-red focus:text-underline-red",onSelect:()=>h(t),children:x("deleteGroup")}),d&&(0,a.jsxs)(a.Fragment,{children:[(l||o)&&(0,a.jsx)(D.mB,{}),N(D._2)]})]})]})]});return(0,a.jsx)(u.FX,{className:"block",children:(0,a.jsx)("div",{ref:b,style:{"--gc":t.color},className:"my-0.5 rounded-lg p-0.5 ".concat(v?"bg-marker-blue/10 ring-1 ring-inset ring-marker-blue":"bg-[color-mix(in_srgb,var(--gc)_12%,#121212)]"),children:(0,a.jsxs)(tb.Nt,{open:!i,onOpenChange:()=>c(t._id),children:[j?(0,a.jsxs)(tv.tz,{children:[(0,a.jsx)(tv.Rc,{asChild:!0,children:w}),(0,a.jsxs)(tv.Ip,{className:"w-44",children:[l&&(0,a.jsx)(tv.kt,{onSelect:()=>m(t),children:x("editGroup")}),o&&(0,a.jsx)(tv.kt,{className:"text-underline-red focus:text-underline-red",onSelect:()=>h(t),children:x("deleteGroup")}),d&&(0,a.jsxs)(a.Fragment,{children:[(l||o)&&(0,a.jsx)(tv.K5,{}),N(tv.kt)]})]})]}):w,(0,a.jsx)(tb.Ke,{children:(0,a.jsx)(u.q9,{className:"mx-0 border-none p-0 px-0.5 pb-0.5 pt-1",children:0===r&&s?(0,a.jsx)(u.FX,{className:"px-2 py-2 text-xs italic text-sidebar-foreground/40",children:x("dropHere")}):f})})]})})})}var ty=r(68536),tN=r(22730),tw=r(60505),t_=r(24641);function tk(e){let{project:t,isActive:r,isLocked:s,isFavourited:n,isNotificationsSnoozed:i,notificationsCount:l,groups:o,canCreateGroup:c,currentProjectHasOthersSection:m,inGroup:h,groupsEnabled:f,canManageProject:g,canManageMembers:b,team:v,onOpen:j,onMoveToGroup:N,onCreateGroup:w}=e,_=(0,y.c)("projectGroups"),k=(0,y.c)("projects"),{openModal:E}=(0,p.hS)(),{user:C}=(0,d.J)(),S=1===t.status,A=!!t.team,R=!s&&r,{setNodeRef:I,listeners:F,isDragging:
1M}=(0,e8.PM)({id:t._id,data:{type:"project",project:t},disabled:!A}),P=g||b,T=(0,a.jsxs)(u.Uj,{onClick:()=>j(t),className:"cursor-pointer rounded-sm text-sidebar-foreground/70 hover:text-sidebar-foreground ".concat(R?"":h?"hover:bg-[color-mix(in_srgb,var(--gc)_18%,#121212)]":"hover:bg-dark-gray"),tooltip:{children:t.name,hidden:!1},children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.name}),(0,a.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[n&&(0,a.jsx)(t_.F,{className:"h-3! w-3! text-post-it-yellow",weight:"fill"}),s&&(0,a.jsx)(tN.W,{className:"h-3! w-3!"}),i&&(0,a.jsx)(ty.l,{className:"h-3! w-3!"}),l>0&&(0,a.jsx)("span",{className:"rounded-full bg-muted-foreground px-1.5 py-0.5 text-center text-xs text-background",children:l})]})]});return(0,a.jsxs)(u.FX,{className:"rounded-sm ".concat(R?h?"bg-[color-mix(in_srgb,var(--gc)_34%,#121212)]":"bg-dark-gray":""),children:[(0,a.jsx)("div",{ref:I,style:{opacity:M?.4:void 0},...F,children:P?(0,a.jsxs)(tv.tz,{children:[(0,a.jsx)(tv.Rc,{asChild:!0,children:T}),(0,a.jsxs)(tv.Ip,{className:"w-56",children:[A&&g&&f&&(0,a.jsxs)(tv.Fj,{children:[(0,a.jsx)(tv.Pd,{children:_("moveToGroup")}),(0,a.jsxs)(tv.es,{className:"max-h-72 w-52 overflow-y-auto",children:[0===o.length?(0,a.jsx)(tv.kt,{disabled:!0,children:_("noGroupsYet")}):o.map(e=>{let r=(0,tm.Rg)(e.icon);return(0,a.jsxs)(tv.kt,{disabled:t.group===e._id,onSelect:()=>N(t,e._id),className:"gap-2",children:[(0,a.jsx)(r,{className:"h-4 w-4 shrink-0",style:{color:e.color}}),(0,a.jsx)("span",{className:"truncate",children:e.name})]},e._id)}),t.group&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tv.K5,{}),(0,a.jsx)(tv.kt,{onSelect:()=>N(t,null),children:_("removeFromGroup")})]}),c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tv.K5,{}),(0,a.jsxs)(tv.kt,{className:"gap-2",onSelect:()=>w(t),children:[(0,a.jsx)(eZ.F,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{children:_("newGroup")})]})]})]})]}),g&&(0,a.jsx)(tv.kt,{onSelect:()=>E(p.ew.PROJECT_SETTINGS,{project:t,user:C,team:v}),children:_("rename")}),b&&(0,a.jsx)(tv.kt,{onSelect:()=>E(p.ew.INVITE_REVIEWERS,{project:t,team:v}),children:_("share")}),g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tv.K5,{}),S?(0,a.jsx)(tv.kt,{onSelect:()=>E(p.ew.RESTORE_PROJECT,{project:t}),children:_("restore")}):(0,a.jsx)(tv.kt,{onSelect:()=>E(p.ew.ARCHIVE_PROJECT,{project:t}),children:_("archive")}),(0,a.jsx)(tv.kt,{className:"text-underline-red focus:text-underline-red",onSelect:()=>E(p.ew.DELETE_PROJECT,{project:t}),children:_("delete")})]})]})]}):T}),r&&t.sections&&t.sections.length>0&&(0,a.jsxs)(u.q9,{className:"mx-0 mb-0.5 mt-0 border-none p-0 pl-4",children:[t.sections.map(e=>{var r;return(0,a.jsx)(u.Fg,{children:(0,a.jsx)(u.Cp,{asChild:!0,className:"cursor-pointer rounded-sm text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground",children:(0,a.jsxs)(x(),{className:"flex w-full items-center gap-2",href:"/projects/".concat(t._id,"?sectionId=").concat(e._id?e._id:"NO_SECTION"),children:[(0,a.jsx)("span",{className:"flex w-4 shrink-0 items-center justify-center",children:(null==(r=e.private_section)?void 0:r.status)?(0,a.jsx)(tN.W,{style:{color:e.color||"var(--color-mid-gray)"},className:"h-3 w-3"}):(0,a.jsx)("span",{style:{backgroundColor:e.color||"var(--color-mid-gray)"},className:"h-2.5 w-2.5 rounded-full"})}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.pinned&&(0,a.jsx)(tw.U,{className:"ml-auto h-3! w-3! shrink-0 text-post-it-yellow",weight:"fill"})]})})},e._id)}),m?(0,a.jsx)(u.Fg,{children:(0,a.jsx)(u.Cp,{asChild:!0,className:"cursor-pointer rounded-sm text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground",children:(0,a.jsxs)(x(),{className:"flex w-full items-center gap-2",href:"/projects/".concat(t._id,"?sectionId=NO_SECTION"),children:[(0,a.jsx)("span",{className:"flex w-4 shrink-0 items-center justify-center",children:(0,a.jsx)("span",{style:{backgroundColor:"var(--color-mid-gray)"},className:"h-2.5 w-2.5 rounded-full"})}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:k("sections.others")})]})})}):null]})]})}function tE(e){let{children:t}=e,{setNodeRef:r,isOver:s}=(0,e8.zM)({id:"no-group",data:{groupId:null}});return(0,a.jsx)("div",{ref:r,role:"presentation",className:"rounded-sm ".concat(s?"ring-1 ring-inset ring-marker-blue/60":""),children:t})}function tC(e){let{label:t}=e,{setNodeRef:r,isOver:s}=(0,e8.zM)({id:"ungroup",data:{groupId:null}});return(0,a.jsx)("div",{ref:r,role:"presentation",className:"mt-1 flex min-h-9 items-center justify-center rounded-sm border border-dashed px-2 py-2 text-center text-xs transition-colors ".concat(s?"border-marker-blue bg-marker-blue/10 text-marker-blue":"border-sidebar-border text-sidebar-foreground
1/50"),children:t})}function tS(){var e,t,r;let{projectId:o}=(0,n.useParams)(),c=(0,n.useRouter)(),{openModal:m}=(0,p.hS)(),{toast:h}=(0,eh.dj)(),{toggleSidebar:f,isMobile:x}=(0,u.cL)(),{user:g}=(0,d.J)(),{teams:b}=(0,es.S)(),[v]=(0,l.useAtom)(i.Me),[j]=(0,l.useAtom)(i.AZ),[N,_]=(0,l.useAtom)(i.EE),k=(0,y.c)("projects"),E=(0,y.c)("projectGroups"),C=[{value:"All projects",label:k("filters.all")},{value:"My projects",label:k("filters.my")},{value:"Favourites",label:k("filters.favorites")},{value:"Archived",label:k("filters.archived")}],[S,A]=s.useState(""),[R,I]=s.useState("My projects"),[F,M]=s.useState(!1),[P,T]=s.useState(null),[O,L]=s.useState(null),[H,K]=s.useState(null),[U,z]=s.useState({}),G=e=>{var t;return Object.prototype.hasOwnProperty.call(U,e._id)?U[e._id]:null!=(t=e.group)?t:null},{projects:J,isLoading:V,hasMore:q,loadMore:Z,isLoadingMore:Q,notifications:X,error:Y}=(0,w.sw)({teamId:null==v?void 0:v._id,page:0,limit:40,query:S,showAll:"All projects"===R||"Archived"===R,favourites:"Favourites"===R,archived:"Archived"===R}),$=!!(v&&(0,B.Fv)(v,"feature_project-groups_enabled",!0)),{groups:ee,invalidate:et}=function(e,t){var r;let a=(0,tr.jE)(),s=(0,tn.I)({queryKey:ti(e,t),queryFn:async()=>{if(!e)return[];try{var r;let a=await (0,eN.n)("/api/projects/teams/".concat(e,"/groups").concat(t?"?showAll=true":""),{method:"GET"});if(!a.ok)throw Error("Failed to load project groups",{cause:a});let s=await a.json();return null!=(r=null==s?void 0:s.data)?r:[]}catch(e){throw console.error("Failed to load project groups:",e),e}},enabled:!!e,staleTime:0,refetchOnWindowFocus:!1});return{groups:null!=(r=s.data)?r:[],isLoading:s.isLoading&&!!e,error:s.error,invalidate:()=>a.invalidateQueries({queryKey:["project-groups",null!=e?e:null]})}}($?null==v?void 0:v._id:void 0,"All projects"===R);s.useEffect(()=>{(0,tt.GF)()},[R]);let er=s.useRef(null),ea=s.useRef();s.useEffect(()=>{let e=er.current;if(!e)return;let t=()=>{ea.current&&clearTimeout(ea.current),ea.current=setTimeout(()=>{let{scrollTop:t,scrollHeight:r,clientHeight:a}=e;(t+a)/r>=.8&&q&&!Q&&Z()},100)};return e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t),ea.current&&clearTimeout(ea.current)}},[q,Q]);let en=s.useCallback(e=>{A(e.target.value)},[]),[ei,el]=s.useState(null),eo=(0,e8.FR)((0,e8.MS)(e8.AN,{activationConstraint:{distance:6}})),ed=e=>{let t=(0,e9.BO)(e,v,b);(0,e9._Q)(e,t)?m(p.ew.PROJECT_LOCK,{project:e,team:t}):(x&&f(),c.push("/projects/".concat(e._id)))},ec=async(e,t)=>{let r=G(e);if(r===t)return;let a=()=>z(t=>{var a;let s={...t};return r===(null!=(a=e.group)?a:null)?delete s[e._id]:s[e._id]=r,s});z(r=>({...r,[e._id]:t}));try{let r=await e6({projectId:e._id,groupId:t});if(null==r?void 0:r.isError){a(),h({title:E("moveError"),variant:"destructive"});return}h({title:E("moveSuccess")}),await Promise.all([(0,tt.GF)(),et(),eR()])}catch(e){console.error("Failed to move project to group:",e),a(),h({title:E("moveError"),variant:"destructive"})}},eu=async()=>{if(O&&(null==v?void 0:v._id))try{let e=await e3({teamId:v._id,groupId:O._id});(null==e?void 0:e.isError)?h({title:E("deleteError"),variant:"destructive"}):(h({title:E("deleteSuccess")}),await Promise.all([et(),(0,tt.GF)(),eR()]))}catch(e){console.error("Failed to delete group:",e),h({title:E("deleteError"),variant:"destructive"})}finally{L(null)}},ep=!!v&&!!g&&!!(0,W.TY)(v,g),ef=!!v&&!!g&&!!(0,W._5)(v,g),ex=e=>ef,eg=s.useMemo(()=>{var e;return!!(null==v?void 0:v._id)&&!!$&&(null==(e=(0,W.rr)(v))?void 0:e.status)===0},[v,$]),eb=e=>{T(null),K(null!=e?e:null),M(!0)},ev=S.trim().toLowerCase().length>0,ej=!!(null==v?void 0:v._id)&&$,ey=g&&null!=(t=N[g._id])?t:[],ew=e=>!ev&&ey.includes(e),e_=!ev&&"Archived"!==R&&"Favourites"!==R,ek=s.useMemo(()=>new Set(ee.map(e=>e._id)),[ee]),{pagedByGroup:eE,noGroupProjects:eC}=s.useMemo(()=>{let e={},t=[];return J.forEach(r=>{let a=G(r);a&&ek.has(a)?(e[a]||(e[a]=[]),e[a].push(r)):t.push(r)}),{pagedByGroup:e,noGroupProjects:t}},[J,ek,U]),eS=s.useMemo(()=>ej&&e_?ee.filter(e=>{var t,r;return!ew(e._id)&&"number"==typeof e.project_count&&e.project_count>(null!=(r=null==(t=eE[e._id])?void 0:t.length)?r:0)}).map(e=>
1e._id):[],[ee,eE,ej,e_,ey,ev]),{projectsByGroup:eA,invalidate:eR}=function(e,t,r){let a=(0,tr.jE)(),s=(0,ta.E)({queries:t.map(t=>({queryKey:ts(e,t,r),queryFn:async()=>{try{var a,s;let n=new URLSearchParams({page:"0",limit:String(200),showAll:String(r),favourites:"false",archived:"false",view:"sidebar",group:t}),i=await (0,eN.n)("/api/projects/teams/".concat(e,"?").concat(n.toString()),{method:"GET"});if(!i.ok)throw Error("Failed to load group projects",{cause:i});let l=await i.json();return null!=(s=null==l||null==(a=l.data)?void 0:a.data)?s:[]}catch(e){throw console.error("Failed to load group projects:",e),e}},enabled:!!e,staleTime:3e4,refetchOnWindowFocus:!1}))}),n={};return t.forEach((e,t)=>{var r;let a=null==(r=s[t])?void 0:r.data;a&&(n[e]=a)}),{projectsByGroup:n,isLoadingGroup:e=>{var r;let a=t.indexOf(e);return a>=0&&!!(null==(r=s[a])?void 0:r.isLoading)},invalidate:()=>a.invalidateQueries({queryKey:["group-projects",null!=e?e:null]})}}(ej?null==v?void 0:v._id:void 0,eS,"All projects"===R),eI=s.useMemo(()=>{let e={...eE};return Object.entries(eA).forEach(t=>{var r;let[a,s]=t,n=new Set,i=[];s.forEach(e=>{G(e)===a&&(n.add(e._id),i.push(e))}),(null!=(r=eE[a])?r:[]).forEach(e=>{n.has(e._id)||(n.add(e._id),i.push(e))}),e[a]=i}),e},[eE,eA,U]);s.useEffect(()=>{z(e=>{if(0===Object.keys(e).length)return e;let t=!1,r={...e};return J.forEach(e=>{var a;Object.prototype.hasOwnProperty.call(r,e._id)&&(null!=(a=e.group)?a:null)===r[e._id]&&(delete r[e._id],t=!0)}),t?r:e})},[J]);let eF=s.useMemo(()=>{let e={};return Object.entries(eI).forEach(t=>{let[r,a]=t;e[r]=a.reduce((e,t)=>e+(X[t._id]||0),0)}),e},[eI,X]),eP=s.useMemo(()=>ev?ee.filter(e=>{var t,r;return(null!=(r=null==(t=eI[e._id])?void 0:t.length)?r:0)>0}):ee,[ee,ev,eI]),eT=e=>{var t,r;let a=null!=(r=null==(t=eI[e._id])?void 0:t.length)?r:0;if(e_&&"number"==typeof e.project_count)return{count:e.project_count,trustworthy:!0};let s=void 0!==eA[e._id];return{count:a,trustworthy:!q||s}},eO=e=>{g&&!ev&&_(t=>{var r;let a=null!=(r=t[g._id])?r:[],s=a.includes(e)?a.filter(t=>t!==e):[...a,e];return{...t,[g._id]:s}})},eL=(e,t)=>{let r=e._id===o,s=(0,e9._Q)(e,(0,e9.BO)(e,v,b)),n=(0,e9.hJ)(e._id,g),i=(0,e9.eC)({projectId:e._id,user:g}),l=X[e._id]||0,d=(0,e9.BO)(e,v,b),c=!!g&&((0,e9.PV)(e,g)||(0,e9.W6)({project:e,team:d,user:g,permission:e9.oC.MANAGE_PROJECT})),u=!!g&&((0,e9.PV)(e,g)||(0,e9.W6)({project:e,team:d,user:g,permission:e9.oC.MANAGE_MEMBERS}));return(0,a.jsx)(tk,{project:e,isActive:r,isLocked:s,isFavourited:n,isNotificationsSnoozed:i,notificationsCount:l,groups:ee,canCreateGroup:eg,currentProjectHasOthersSection:j,inGroup:t,groupsEnabled:$,canManageProject:c,canManageMembers:u,team:d,onOpen:ed,onMoveToGroup:ec,onCreateGroup:eb},e._id)},eH=!Y&&0===J.length&&(!ej||0===eP.length);return(0,a.jsxs)(u.Cn,{className:"gap-2 pr-0",children:[(0,a.jsx)(u.wZ,{className:"pr-2",children:(0,a.jsxs)(D.rI,{children:[(0,a.jsxs)(D.ty,{className:"flex w-full items-center justify-between rounded-md border border-sidebar-border bg-transparent px-3 py-2 text-sm text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground",children:[(0,a.jsx)("span",{children:null!=(r=null==(e=C.find(e=>e.value===R))?void 0:e.label)?r:R}),(0,a.jsx)(te.a,{className:"h-4 w-4"})]}),(0,a.jsx)(D.SQ,{className:"w-60 border-sidebar-border bg-charcoal text-sidebar-foreground/70",children:C.map(e=>(0,a.jsx)(D._2,{onClick:()=>I(e.value),className:"cursor-pointer text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground focus:bg-dark-gray focus:text-sidebar-foreground focus:outline-none focus-visible:ring-0",children:e.label},e.value))})]})}),(0,a.jsx)(u.wZ,{className:"pr-2",children:(0,a.jsx)(tl.p,{type:"search",placeholder:k("search.placeholder"),className:"h-8 border-sidebar-border bg-transparent text-sidebar-foreground/70 focus-visible:ring-sidebar-ring focus-visible:ring-offset-sidebar",value:S,onChange:en})}),(0,a.jsxs)(e8.Mp,{sensors:eo,collisionDetection:e8.TT,onDragStart:e=>{var t;let r=null==(t=e.active.data.current)?void 0:t.project;el(null!=r?r:null)},onDragEnd:e=>{var t;let r;el(null);let{active:a,over:s}=e;if(!s)return;let n=null==(t=a.data.current)?void 0:t.project;if(!n)return;let i=String(s.id);if("no-group"===i||"ungroup"===i)r=null;else{if(!i.startsWith("group:"))return;r=i.slice(6)}G(n)!==r&&ec(n,r)},children:[(0,a.jsxs)(u.wZ,{ref:er,className:"max-h-[calc(100vh-200px)] ".concat(V?"overflow-hidden":"overflow-y-scroll"," scrollbar-thin overflow-x-hidden [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-sidebar-border"),children:[V?(0,a.jsx)("div",{className:"flex flex-col gap-2 pr-2",children:Array.from({length:40},(e,t)=>(0,a.jsx)(u.FX,{children:(0,a.jsx)(eM.E,{className:"h-6 w-full rounded-sm bg-dark-gray"})},t))}):Y?(0,a.jsx)(u.FX,{className:"p-8 text-center text-sm text-sidebar-foreground
1/70",children:k("emptyState.loadFailed")}):eH?(0,a.jsx)(u.FX,{className:"p-8 text-center text-sm text-sidebar-foreground/70",children:k("emptyState.noProjects")}):(0,a.jsxs)(a.Fragment,{children:[ej&&eP.map(e=>{var t,r;let{count:s,trustworthy:n}=eT(e);return(0,a.jsx)(tj,{group:e,count:s,countIsTrustworthy:n,notificationsCount:null!=(t=eF[e._id])?t:0,isCollapsed:ew(e._id),canManage:ex(e),canDelete:ep,canCreateGroup:eg,onToggleCollapse:eO,onEditGroup:e=>{T(e),K(null),M(!0)},onDeleteGroup:e=>L(e),onCreateGroup:()=>eb(),children:(null!=(r=eI[e._id])?r:[]).map(e=>eL(e,!0))},e._id)}),(0,a.jsx)(tE,{children:eC.map(e=>eL(e,!1))}),ei&&null!==G(ei)&&(0,a.jsx)(tC,{label:E("dropToUngroup")})]}),Q&&Array.from({length:10},(e,t)=>(0,a.jsx)(u.FX,{children:(0,a.jsx)(eM.E,{className:"h-6 w-full rounded-sm bg-dark-gray"})},t))]}),(0,a.jsx)(e8.Hd,{dropAnimation:null,children:ei?(0,a.jsx)("div",{className:"rounded-sm bg-charcoal px-2 py-1.5 text-sm text-sidebar-foreground shadow-lg ring-1 ring-sidebar-border",children:ei.name}):null})]}),(null==v?void 0:v._id)&&$&&(0,a.jsx)(tx,{open:F,onOpenChange:e=>{M(e),e||K(null)},teamId:v._id,group:P,onSaved:()=>{et(),eR()},onCreated:e=>{H&&(ec(H,e._id),K(null))}}),(0,a.jsx)(em.Lt,{open:!!O,onOpenChange:e=>{e||L(null)},children:(0,a.jsxs)(em.EO,{children:[(0,a.jsxs)(em.wd,{children:[(0,a.jsx)(em.r7,{children:E("deleteGroupTitle")}),(0,a.jsx)(em.$v,{children:E("deleteGroupDescription")})]}),(0,a.jsxs)(em.ck,{children:[(0,a.jsx)(em.Zr,{children:E("cancel")}),(0,a.jsx)(em.Rx,{onClick:eu,children:E("delete")})]})]})})]})}function tA(e){let{children:t}=e,r=(0,l.useAtomValue)(i.Me),{teams:o}=(0,es.S)(),{user:c}=(0,d.J)(),{openModal:u}=(0,p.hS)(),{projectId:m}=(0,n.useParams)(),h=(0,y.c)("navigation.sidebar.projectsPopover"),f=(0,y.c)("navigation.sidebar"),x=(0,y.c)("projects"),[g,b]=s.useState(!1),v=s.useCallback(e=>{e&&b(!0)},[]),{projects:j,isLoading:N}=(0,w.sw)({teamId:null==r?void 0:r._id,limit:10,showAll:!1,favourites:!1,archived:!1,enabled:g}),[_,k]=s.useState(!1);s.useEffect(()=>{g&&!N&&k(!0)},[g,N]);let E=j.slice(0,10).map(e=>{let t=(0,e9.BO)(e,r,o),s=(0,e9._Q)(e,t);return{id:e._id,name:e.name,href:s?void 0:"/projects/".concat(e._id),onSelect:s?()=>u(p.ew.PROJECT_LOCK,{project:e,team:t}):void 0,isActive:!s&&e._id===m,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,e9.hJ)(e._id,c)&&(0,a.jsx)(t_.F,{className:"h-3! w-3! text-post-it-yellow",weight:"fill"}),s&&(0,a.jsx)(tN.W,{className:"h-3! w-3!"})]})}});return(0,a.jsx)(eJ,{title:f("primary.projects"),onOpenChange:v,emptyMessage:x("emptyState.noProjects"),groups:[{id:"recent",label:h("recent"),items:E,isLoading:g&&(N||!_),skeletonCount:10}],children:t})}var tR=r(58281),tI=r(83596),tF=r(19712),tM=r(48487),tP=r(5913),tT=r(12698),tO=r(92583),tL=r(56533),tH=r(63215),tD=r(77129),tK=r(38146);function tU(e,t){return!!(t===e.href||e.matchChildRoutes&&(null==t?void 0:t.startsWith(e.href)))}function tz(e){let{teams:t}=(0,es.S)(),r=null==t?void 0:t.find(t=>t._id===e),a=!!r&&(0,B.xy)(r);return[{labelKey:"teams.navigation.groupWorkspace",items:[{nameKey:"teams.navigation.members",href:"/teams/".concat(e,"/members"),icon:ea.z},{nameKey:"teams.navigation.subscription",href:"/teams/".concat(e,"/subscription"),icon:tF.y}]},{labelKey:"teams.navigation.groupBranding",items:[{nameKey:"teams.navigation.logoBranding",href:"/teams/".concat(e,"/account"),icon:tL.e},{nameKey:"teams.navigation.watermark",href:"/teams/".concat(e,"/watermark"),icon:tM.e}]},{labelKey:"teams.navigation.groupWorkflows",items:[{nameKey:"teams.navigation.globalSettings",href:"/teams/".concat(e,"/projects"),icon:Q._},{nameKey:"teams.checklist.title",href:"/teams/".concat(e,"/checklist"),icon:tI.k},{nameKey:"teams.navigation.customFields",href:"/teams/".concat(e,"/custom-fields"),icon:tD.S},{nameKey:"teams.navigation.bulkOperations",href:"/teams/".concat(e,"/projects/bulk-archive"),icon:j.B}]},{labelKey:"teams.navigation.integrations",items:[{nameKey:"teams.navigation.allIntegrations",href:"/teams/".concat(e,"/integrations"),icon:tH.F,matchChildRoutes:!0},{nameKey:"teams.navigation.apiKeys",href:"/teams/".concat(e,"/authentication"),icon:tT.U}]},{labelKey:"teams.navigation.groupSecurity",items:[{nameKey:"teams.navigation.securitySso",href:"/teams/".concat(e,"/security-sso"),icon:tO.c},{nameKey:"teams.auditLogs.title",href:"/teams/".concat(e,"/audit-logs"),icon:tP.C5},...a?[{nameKey:"teams.recycleBin.title",href:"/teams/".concat(e,"/recycle-bin"),icon:tK.l}]:[]]}]}function tG(){let{teamId:e}=(0,n.useParams)(),t=(0,n.usePathname)(),r=(0,y.c)(),s=tz(e);return(0,a.jsx)("div",{className:"flex flex-col gap-4 py-2",children:s.map(e=>(0,a.jsxs)(u.Cn,{className:"gap-1 p-0 px-2",children:[(0,a.jsx)("div",{className:"px-3 py-1",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground
1/40",children:r(e.labelKey)})}),(0,a.jsx)(u.wZ,{children:e.items.map(e=>(0,a.jsx)(u.FX,{className:tU(e,t)?"bg-dark-gray":"",children:(0,a.jsx)(u.Uj,{asChild:!0,className:"px-3 py-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-dark-gray",children:(0,a.jsxs)(x(),{href:e.href,className:e.badge?"pointer-events-none opacity-50":"",children:[(0,a.jsx)(e.icon,{className:"w-4 h-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm",children:r(e.nameKey)}),e.badge&&(0,a.jsx)("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded-full bg-sidebar-foreground/10 text-sidebar-foreground/40",children:e.badge}),e.isNew&&(0,a.jsx)(tR.t,{className:"ml-auto"})]})})},e.href))})]},e.labelKey))})}function tB(e){let{children:t}=e,r=(0,l.useAtomValue)(i.Me),s=(0,n.usePathname)(),o=(0,y.c)(),d=(0,y.c)("navigation.sidebar"),c=tz(null==r?void 0:r._id);return(0,a.jsx)(eJ,{title:d("primary.settings"),groups:c.map(e=>({id:e.labelKey,label:o(e.labelKey),items:e.items.map(e=>({id:e.href,name:o(e.nameKey),href:e.href,icon:e.icon,isActive:tU(e,s),trailing:e.isNew?(0,a.jsx)(tR.t,{}):void 0}))})),children:t})}var tW=r(19089);function tJ(){let{isMobile:e}=(0,u.cL)(),{user:t}=(0,d.J)(),{teams:r}=(0,es.S)(),[s,n]=(0,l.useAtom)(i.Me),o=(0,y.c)("navigation.teamSwitcher");return(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:0===r.length?(0,a.jsxs)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 px-3 py-2 cursor-default",children:[null==t?void 0:t.profile.first_name," ",null==t?void 0:t.profile.last_name]}):(0,a.jsxs)(D.rI,{children:[(0,a.jsx)(D.ty,{asChild:!0,children:(0,a.jsxs)(u.Uj,{size:"lg",className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 cursor-pointer px-3 py-2",children:[(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:s?s.name:o("allTeams")})}),(0,a.jsx)(tW.Z,{className:"ml-auto"})]})}),(0,a.jsxs)(D.SQ,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 bg-charcoal border-sidebar-border text-sidebar-foreground/70",align:"start",side:e?"bottom":"right",sideOffset:4,children:[(0,a.jsxs)(D._2,{onClick:()=>n(null),className:"gap-2 p-2 text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground focus:bg-dark-gray focus:text-sidebar-foreground",children:[(0,a.jsx)(G.default,{src:"/marketing/gv_icon_white.png",width:32,height:32,alt:"GoVisually",className:"w-8 h-8"}),o("allTeams")]}),r.map(e=>(0,a.jsxs)(D._2,{onClick:()=>n(e),className:"gap-2 p-2 text-sidebar-foreground/70 hover:bg-dark-gray hover:text-sidebar-foreground focus:bg-dark-gray focus:text-sidebar-foreground",children:[(0,a.jsx)(K.GvTeamAvatar,{team:e,CDN:O.Rc,className:"w-8 h-8"}),e.name]},e._id))]})]})})})}function tV(){let e=(0,n.usePathname)(),t=(0,y.c)(),r=[{labelKey:"user.navigation.account",items:[{nameKey:"user.navigation.myProfile",href:"/user/account",icon:F.K},{nameKey:"user.navigation.subscription",href:"/user/subscription",icon:tF.y},{nameKey:"user.navigation.notifications",href:"/user/notifications",icon:g.I}]}],s=t=>e===t.href;return(0,a.jsx)("div",{className:"flex flex-col gap-4 py-2",children:r.map(e=>(0,a.jsxs)(u.Cn,{className:"gap-1 p-0 px-2",children:[(0,a.jsx)("div",{className:"px-3 py-1",children:(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/40",children:t(e.labelKey)})}),(0,a.jsx)(u.wZ,{children:e.items.map(e=>(0,a.jsx)(u.FX,{className:s(e)?"bg-dark-gray":"",children:(0,a.jsx)(u.Uj,{asChild:!0,className:"px-3 py-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-dark-gray",children:(0,a.jsxs)(x(),{href:e.href,children:[(0,a.jsx)(e.icon,{className:"w-4 h-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm",children:t(e.nameKey)})]})})},e.href))})]},e.labelKey))})}function tq(e){var t,r,o,c,m;let{...h}=e,{toggleSidebar:f,isMobile:C,openMobile:S}=(0,u.cL)(),[R]=(0,l.useAtom)(i.Me),{teams:I,isLoading:F}=(0,es.S)(),{user:M}=(0,d.J)(),[P,T]=(0,l.useAtom)(i.Me),{teams:L}=(0,es.S)(),H=null==P?void 0:P._id,D=s.useMemo(()=>H?L.find(e=>e._id===H):void 0,[L,H]);s.useEffect(()=>{(null==D?void 0:D._id)&&T(e=>{if(!e||e._id!==D._id)return e;let t={...e,...D};return JSON.stringify(t)===JSON.stringify(e)?e:t})},[D,T]);let z=null!=(r=I.find(e=>e._id===(null==R?void 0:R._id)))?r:R,{openModal:ed}=(0,p.hS)(),{count:eu}=(0,en.l)(),{unreadCount:em}=(0,ei.k)({seed:!0}
1),eh=(0,y.c)("navigation.sidebar"),ep=/Mac/i.test(window.navigator.userAgent),ef=(0,n.useRouter)(),ex=(0,n.usePathname)(),eg=(null==ex?void 0:ex.startsWith("/teams/"))&&!/^\/teams\/[^/]+\/library/.test(ex),eb=null==ex?void 0:ex.startsWith("/user"),ej=null==ex?void 0:ex.startsWith("/chat/"),ey=null==ex||null==(t=ex.match(/^\/_teams\/([^/]+)\/product-hub/))?void 0:t[1],eN=ey?null!=(o=I.find(e=>e._id===ey))?o:(null==R?void 0:R._id)===ey?R:null:null,ew=!!(ey&&(eN?(0,B.dC)(eN):F)),ek=!!(null==ex?void 0:ex.match(/^\/_teams\/[^/]+\/playbooks/)),eE=null==ex?void 0:ex.startsWith("/analytics"),eC=!!(null==ex?void 0:ex.match(/^\/_teams\/[^/]+\/ai-compare/)),{projects:eS,isLoading:eA,error:eR}=(0,w.sw)({teamId:null==R?void 0:R._id,limit:1}),eI=!!(R&&M&&(0,W.TY)(R,M)&&(0,B.rK)(R.subscription)),eF={primary:[[{icon:b.t,title:eh("primary.dashboard"),url:"/dashboard",show:!0},{icon:q._,title:eh("primary.analytics"),url:"/analytics",show:!1},{icon:j.B,title:eh("primary.projects"),onClick:()=>{eS.length>0?ef.push("/projects/".concat(eS[0]._id)):ef.push("/dashboard")},show:!0,id:"projects"},{icon:J.Q,title:eh("primary.birdsEye"),url:"/_teams/".concat(null==R?void 0:R._id,"/overview"),show:R&&M&&(0,W.TY)(R,M)}],[{icon:er.R,title:eh("primary.playbooks"),url:"/_teams/".concat(null==R?void 0:R._id,"/playbooks"),show:R&&M&&((0,W.TY)(R,M)||(0,W._5)(R,M)),id:"playbooks"},{icon:ee.l,title:eh("primary.productHub"),url:"/_teams/".concat(null==R?void 0:R._id,"/product-hub"),show:R&&M&&((0,W.TY)(R,M)||(0,W._5)(R,M))},{icon:et.s,title:eh("primary.printProofChecker"),url:"/_teams/".concat(null==R?void 0:R._id,"/proof-checker"),show:R&&M&&((0,W.TY)(R,M)||(0,W._5)(R,M))},{icon:X.o,title:eh("primary.aiCompare"),url:"/_teams/".concat(null==R?void 0:R._id,"/ai-compare"),show:R&&M&&((0,W.TY)(R,M)||(0,W._5)(R,M))&&(0,B.d4)(z)},{icon:k.l,title:eh("primary.giaAssistant"),url:"/chat/".concat(null==R?void 0:R._id),show:!!(R&&M&&((0,W.TY)(R,M)||(0,W._5)(R,M)))}],[{icon:Q._,title:eh("primary.settings"),url:"/teams/".concat(null==R?void 0:R._id,"/account"),show:R&&M&&(0,W.TY)(R,M),id:"settings"},{icon:ea.z,title:eh("primary.members"),url:"/teams/".concat(null==R?void 0:R._id,"/members"),show:R&&M&&(0,W.TY)(R,M)},{icon:Z._,title:eh("primary.library"),url:"/teams/".concat(null==R?void 0:R._id,"/library"),show:R&&M&&(0,W.TY)(R,M)&&(0,B.et)(R)}]],secondary:[{icon:E.p,title:eh("secondary.whatsNew"),onClick:()=>ed(p.ew.WHATS_NEW),show:!0,badge:em},{icon:$.e,title:eh(ep?"secondary.quickSearchMac":"secondary.quickSearchOther"),onClick:()=>ed(p.ew.QUICK_SEARCH,{team:R}),show:!0},{icon:Y.X,title:eh("secondary.academy"),url:"/learning-path",show:!0},{icon:A.v,title:eh("secondary.help"),onClick:()=>ed(p.ew.HELP),show:R&&!(0,B.rK)(R.subscription)},{icon:V.V,title:eh("secondary.bookADemo"),onClick:()=>window.open(O.E$,"_blank","noopener,noreferrer"),show:eI}]};return(0,a.jsxs)(u.Bx,{collapsible:C?"none":"icon",className:"w-auto md:w-(--sidebar-width) overflow-hidden *:data-[sidebar=sidebar]:flex-row z-50",...h,children:[(0,a.jsxs)(u.Bx,{hidden:C,collapsible:"none",className:"w-[calc(var(--sidebar-width-icon))]! bg-sidebar border-r border-sidebar-border [&_[data-slot=sidebar-inner]]:bg-transparent",children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{onClick:()=>f(),className:"cursor-pointer",children:R?(0,a.jsx)(K.GvTeamAvatar,{team:z,CDN:O.Rc,className:"w-8 h-8"}):(0,a.jsx)(G.default,{src:"/marketing/gv_icon_white.png",width:32,height:32,alt:eh("govisuallyLogoAlt"),className:"w-8 h-8"})})})}),(0,a.jsxs)(u.Yv,{className:"justify-between",children:[(0,a.jsx)(u.Cn,{children:(0,a.jsx)(u.rQ,{className:"px-1.5 md:px-0",children:(0,a.jsx)(u.wZ,{children:eF.primary.map(e=>e.filter(e=>e.show)).filter(e=>e.length>0).map((e,t)=>(0,a.jsxs)(s.Fragment,{children:[t>0&&(0,a.jsx)(u.GX,{className:"mx-1 my-1"}),e.map((e,t)=>{let r="settings"===e.id||"playbooks"===e.id||"projects"===e.id,s=(0,a.jsx)(u.Uj,{tooltip:r?void 0:{children:e.title,hidden:!1},asChild:!!e.url,onClick:e.onClick,"aria-label":r?e.title:void 0,className:"px-2.5 md:px-2 cursor-pointer text-sidebar-foreground
1/70 hover:text-sidebar-foreground hover:bg-sidebar-accent justify-center",children:e.url?(0,a.jsx)(x(),{href:e.url,children:(0,a.jsx)(e.icon,{className:"size-4"})}):(0,a.jsx)(e.icon,{className:"size-4"})});return(0,a.jsx)(u.FX,{className:"hover:bg-sidebar-accent rounded-md",children:"settings"===e.id?(0,a.jsx)(tB,{children:s}):"playbooks"===e.id?(0,a.jsx)(eV,{children:s}):"projects"===e.id?(0,a.jsx)(tA,{children:s}):s},t)})]},t))})})}),(0,a.jsx)(u.Cn,{children:(0,a.jsx)(u.rQ,{className:"px-1.5 md:px-0",children:(0,a.jsxs)(u.wZ,{children:[eF.secondary.filter(e=>e.show).map((e,t)=>(0,a.jsxs)(u.FX,{className:"hover:bg-sidebar-accent rounded-md relative",children:[(0,a.jsx)(u.Uj,{tooltip:{children:e.title,hidden:!1},asChild:!0,onClick:e.onClick,className:"px-2.5 md:px-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground justify-center hover:bg-sidebar-accent",children:e.url?(0,a.jsx)(x(),{href:e.url,children:(0,a.jsx)(e.icon,{className:"size-4"})}):(0,a.jsx)(e.icon,{className:"size-4"})}),e.badge&&e.badge>0?(0,a.jsx)(el.E,{variant:"danger",className:"absolute -top-1.5 left-1/2 -translate-x-1/2 min-w-[18px] h-[16px] py-0 px-1 rounded-full text-[9px] flex items-center justify-center pointer-events-none",children:e.badge>99?"99+":e.badge}):null]},t)),(0,a.jsxs)(u.FX,{className:"hover:bg-sidebar-accent rounded-md relative",children:[(0,a.jsx)(eD,{children:(0,a.jsx)(u.Uj,{asChild:!0,"aria-label":eh("notifications"),className:"px-2.5 md:px-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground justify-center hover:bg-sidebar-accent",children:(0,a.jsx)(x(),{href:"/activities",children:(0,a.jsx)(g.I,{className:"size-4",weight:"regular"})})})}),eu>0&&(0,a.jsx)(el.E,{variant:"danger",className:"absolute -top-1.5 left-1/2 -translate-x-1/2 min-w-[18px] h-[16px] py-0 px-1 rounded-full text-[9px] flex items-center justify-center pointer-events-none",children:eu>99?"99+":eu})]})]})})})]}),(0,a.jsxs)(u.CG,{children:[(0,a.jsx)(U,{}),(0,a.jsx)(u.FX,{className:"hover:bg-sidebar-accent rounded-md",children:(0,a.jsx)(u.Uj,{className:"px-2.5 md:px-2 cursor-pointer text-sidebar-foreground/70 hover:text-sidebar-foreground",onClick:()=>f(),tooltip:{children:eh("toggleSidebar"),hidden:!1},children:(0,a.jsx)(v.V,{})})})]})]}),(0,a.jsxs)(u.Bx,{collapsible:"none",className:(0,N.cn)("bg-charcoal w-auto min-w-0 flex-1 [&_[data-slot=sidebar-inner]]:bg-transparent shadow-[inset_-8px_0_8px_-8px_rgba(0,0,0,0.15)]",C?"fixed top-0 bottom-[70px] left-0 w-full h-auto ".concat(S?"translate-x-full":"translate-x-0"):null),children:[eb?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:(null==M?void 0:M.profile)&&"".concat(null!=(c=M.profile.first_name)?c:""," ").concat(null!=(m=M.profile.last_name)?m:"").trim()||eh("myAccount")})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-y-auto",children:(0,a.jsx)(tV,{})})]}):eg?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:(null==z?void 0:z.name)||eh("settings")})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-y-auto",children:(0,a.jsx)(tG,{})})]}):eC?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:(null==z?void 0:z.name)||eh("aiCompareHistory")})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-hidden",children:(0,a.jsx)(e_,{})}),(0,a.jsx)(u.CG,{className:"px-2 pb-3",children:(0,a.jsx)(_.$,{variant:"primary",disabled:!(null==R?void 0:R._id),onClick:()=>{(null==R?void 0:R._id)&&ef.push("/_teams/".concat(R._id,"/ai-compare"))},children:eh("newComparison")})})]}):ej?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground
1/70 h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:eh("giaChatHistory")})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-hidden",children:(0,a.jsx)(ev,{})}),(0,a.jsx)(u.CG,{className:"px-2 pb-3",children:(0,a.jsx)(_.$,{variant:"primary",disabled:!(null==R?void 0:R._id),onClick:()=>{(null==R?void 0:R._id)&&ef.push("/chat/".concat(R._id))},children:eh("newChat")})})]}):ew?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 rounded-md h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:eh("primary.productHub")})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-y-auto",children:(0,a.jsx)(e4,{})})]}):ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(u.wZ,{children:(0,a.jsx)(u.FX,{children:(0,a.jsx)(u.Uj,{className:"bg-dark-gray hover:bg-dark-gray/80 text-sidebar-foreground/70 h-8 px-3 py-2 cursor-default",children:(0,a.jsx)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:(0,a.jsx)("span",{className:"truncate font-medium",children:(null==z?void 0:z.name)||"AI Playbooks"})})})})})}),(0,a.jsx)(u.Yv,{className:"overflow-y-auto",children:(0,a.jsx)(eW,{})})]}):eE?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(tJ,{})}),(0,a.jsx)(u.Yv,{className:"overflow-y-auto",children:(0,a.jsx)(ec,{})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Gh,{children:(0,a.jsx)(tJ,{})}),(0,a.jsx)(u.Yv,{className:"overflow-hidden",children:(0,a.jsx)(tS,{})}),(0,a.jsx)(u.CG,{children:!eA&&(eS.length>0||eR?(0,a.jsx)(_.$,{variant:"primary",onClick:()=>ed(p.ew.NEW_PROJECT),children:eh("createNewProject")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eo.CreateProjectButton,{}),(0,a.jsx)(eo.CreateDemoProjectButton,{})]}))})]}),(0,a.jsx)(u.jM,{})]})]})}let tZ=(0,e7.createServerReference)("7f7af35322f88c38fe4e454d54da58b5a18e669f0c",e7.callServer,void 0,e7.findSourceMapURL,"loadTeamAction");var tQ=r(836),tX=r(56302);function tY(){let e=(0,n.useRouter)(),{openModal:t}=(0,p.hS)(),{user:r}=(0,d.J)(),o=(0,y.c)(),[c]=(0,l.useAtom)(i.Me),[u,m]=s.useState(!1),{offer:h,isLoading:f}=(0,tX.k)(null==c?void 0:c._id),x=async()=>{let e=await tZ({teamId:null==c?void 0:c._id});e.isError||m((0,B.rK)(e.body.subscription))};if(s.useEffect(()=>{c&&x()},[c]),!c||!r||!u||f)return null;let g=(0,W.m6)({team:c,user:r}),b=(0,B.ss)(c.subscription),v=b<=0,j=b<=2&&b>0,N=v||j?"#FC4E46":"#0D6ABE",w=null==h?void 0:h.durationInMonths,k=!!h&&!v&&"number"==typeof w,E=k?o("trial.offer.short",{months:w}):null,C=v?{title:o("trial.ended.title"),description:o("trial.ended.description")}:1===b?{title:o("trial.lastDay.title"),description:null!=E?E:o("trial.lastDay.description")}:j?{title:o("trial.urgent.title",{daysLeft:b}),description:null!=E?E:o("trial.urgent.description")}:b<=7?{title:o("trial.warning.title",{daysLeft:b}),description:null!=E?E:o("trial.warning.description")}:{title:o("trial.default.title",{daysLeft:b}),description:null!=E?E:o("trial.default.description")};return(0,a.jsx)("div",{className:"relative text-white",style:{backgroundColor:N},children:(0,a.jsx)("div",{className:"container mx-auto px-4 py-2",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{className:"flex flex-1 items-center gap-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"hidden sm:flex items-center justify-center w-8 h-8 rounded-full ".concat(v||j?"bg-white/30":"bg-white/20"),children:v||j?(0,a.jsx)(tQ.A,{className:"w-5 h-5"}):(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,a.jsxs)("div",{className:"text-sm sm:text-base",children:[(0,a.jsx)("span",{className:"font-semibold",children:C.title}),k&&(0,a.jsx)(el.E,{className:"ml-2 mr-1 border-transparent bg-white align-middle font-bold",style:{color:N},children:o("trial.offer.pill",{percent:h.percentOff})}),(0,a.jsx)("span",{className:"ml-2 hidden sm:inline",children:C.description})," ",(0,a.jsx)(_.$,{variant:"link",onClick:()=>
1t(p.ew.TRIAL_UPGRADE,{user:r,team:c}),className:"text-white hover:text-white underline font-normal p-0 h-auto",children:o("trial.learnMore")})]})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[!v&&(0,a.jsx)(_.$,{size:"sm",variant:"ghost",onClick:()=>window.open(O.E$,"_blank","noopener,noreferrer"),className:"text-white hover:text-white hover:bg-white/20",children:o("projects.bookDemo")}),(0,a.jsx)(_.$,{size:"sm",onClick:()=>{g?e.push("/teams/".concat(c._id,"/subscription/start")):t(p.ew.TRIAL_UPGRADE,{user:r,team:c})},className:"bg-white hover:bg-white/90",style:{color:N},children:o(k?"trial.claimOffer":"trial.upgradeNow")})]})]})})})}var t$=r(91033);let t0=["/login","/register","/logout","/auth","/modal/login","/modal/register","/export",/^\/proof\//,/^\/_teams\/[^/]+\/playbooks\/analyse/,/^\/teams\/[^/]+\/onboarding/],t1=[/^\/teams\/[^/]+\/subscription\/start/,/^\/teams\/[^/]+\/onboarding/];function t2(e){let{children:t}=e,r=(0,n.usePathname)(),[i,l]=s.useState(()=>t0.some(e=>"string"==typeof e?null==r?void 0:r.startsWith(e):e.test(r||""))),[o,d]=s.useState(!1),[m,p]=s.useState(!0);return s.useEffect(()=>{let e=t0.some(e=>"string"==typeof e?null==r?void 0:r.startsWith(e):e.test(r||"")),t=(null==r?void 0:r.includes("/playbooks/analyse/"))&&(null==r?void 0:r.endsWith("/ai-analysis"));l(e||t),d(t1.some(e=>"string"==typeof e?null==r?void 0:r.startsWith(e):e.test(r||"")))},[r]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{}),!1,(0,a.jsx)(h,{}),i?(0,a.jsx)("div",{className:"h-screen",children:t}):(0,a.jsxs)(u.GB,{style:{"--sidebar-width":"300px"},open:m,onOpenChange:p,children:[(0,a.jsxs)("div",{className:"flex h-screen w-screen pb-[70px] md:pb-0",children:[(0,a.jsx)(tq,{}),(0,a.jsxs)(u.sF,{className:"overflow-x-hidden",children:[!o&&(0,a.jsx)(tY,{}),t,(0,a.jsx)(t$.d,{})]})]}),(0,a.jsx)(z,{})]})]})}},7220:(e,t,r)=>{"use strict";r.d(t,{V:()=>n,n:()=>i});var a=r(2471),s=r(27975);function n(){(0,a.useRouter)();let e=(0,s.Ym)();return t=>{t!==e&&(document.cookie="NEXT_LOCALE=".concat(t,";path=/;max-age=31536000;SameSite=Lax"),window.location.reload())}}function i(){return(0,s.Ym)()}},14448:(e,t,r)=>{"use strict";r.d(t,{Hh:()=>s,JJ:()=>l,yo:()=>i,zj:()=>n}),r(18029);let a="wfkef3s2",s=()=>{!function(){var e=window,t=e.Intercom;if("function"==typeof t)t("reattach_activator"),t("update",e.intercomSettings);else{var r=document,s=function(){s.c(arguments)};s.q=[],s.c=function(e){s.q.push(e)},e.Intercom=s;var n=function(){var e=r.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.intercom.io/widget/"+a;var t=r.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?n():e.attachEvent?e.attachEvent("onload",n):e.addEventListener("load",n,!1)}}()},n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};window&&window.Intercom&&window.Intercom("boot",{app_id:a,...e})},i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};window&&window.Intercom&&window.Intercom("update",e)},l=e=>{window&&window.Intercom&&window.Intercom("showNewMessage",e)}},14458:(e,t,r)=>{"use strict";r.d(t,{b:()=>m});var a=r(99769),s=r(25677),n=r(12416),i=r(42077),l=r(96628),o=r(82780),d=r(21832),c=r(3142),u=r(63427);function m(e){let{teamId:t,open:r,onOpenChange:m,onCreated:h}=e,p=(0,n.c)("productHub.brands"),{toast:f}=(0,u.dj)(),x=(0,i.dU)(t),[g,b]=(0,s.useState)(""),[v,j]=(0,s.useState)("");(0,s.useEffect)(()=>{r&&(b(""),j(""))},[r]);let y=()=>{let e=g.trim();e&&x.mutate({name:e,code:v.trim()||null},{onSuccess:e=>{m(!1),null==h||h(e._id),f({title:p("created")})},onError:e=>{console.error("[ProductHub] could not create the brand:",e),f({title:e instanceof Error?e.message:p("createFailed"),variant:"destructive"})}})};return(0,a.jsx)(o.lG,{open:r,onOpenChange:m,children:(0,a.jsxs)(o.Cf,{className:"max-w-[28rem]",children:[(0,a.jsxs)(o.c7,{children:[(0,a.jsx)(o.L3,{children:p("create.title")}),(0,a.jsx)(o.rr,{children:p("create.body")})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(c.J,{htmlFor:"new-brand-name",children:p("name")}
1),(0,a.jsx)(d.p,{id:"new-brand-name",value:g,autoFocus:!0,disabled:x.isPending,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y()}})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(c.J,{htmlFor:"new-brand-code",children:p("codeOptional")}),(0,a.jsx)(d.p,{id:"new-brand-code",value:v,disabled:x.isPending,placeholder:p("codePlaceholder"),onChange:e=>j(e.target.value)})]})]}),(0,a.jsxs)(o.Es,{children:[(0,a.jsx)(l.$,{variant:"outline-solid",disabled:x.isPending,onClick:()=>m(!1),children:p("cancel")}),(0,a.jsx)(l.$,{variant:"primary",disabled:x.isPending||!g.trim(),onClick:y,children:p("create.confirm")})]})]})})}},14792:(e,t,r)=>{"use strict";r.d(t,{A:()=>I});var a=r(99769),s=r(2024),n=r(836),i=r(74847),l=r(67030),o=r(6518),d=r(75057),c=r(54245),u=r(69356),m=r(6197),h=r(19259),p=r(66660),f=r(87381),x=r(49012),g=r(72599),b=r(83768),v=r(95072),j=r(15975),y=r(14852),N=r(46045),w=r(37731),_=r(64905),k=r(77111),E=r(57266),C=r(20771),S=r(13049),A=r(20886);let R={AlertCircle:s.A,AlertTriangle:n.A,ArrowDown:i.A,ArrowLeft:l.A,ArrowUp:o.A,Check:d.A,CheckCircle:c.A,ChevronLeft:u.A,ChevronRight:m.A,ChevronsLeft:h.A,ChevronsRight:p.A,ChevronsUpDown:f.A,ExternalLink:x.A,FileText:g.A,Globe:b.A,Loader:v.A,Loader2:j.A,Mail:y.A,Play:N.A,Plus:w.A,Printer:_.A,Search:k.A,SlidersHorizontal:E.A,Trash:C.A,X:S.A,XCircle:A.A,ArrowDownIcon:i.A,ArrowUpIcon:o.A,CheckIcon:d.A,ChevronLeftIcon:u.A,ChevronRightIcon:m.A};R.AI=e=>{let{size:t=20,...r}=e;return(0,a.jsx)("svg",{stroke:"#777D83",fill:"#777D83",strokeWidth:"0",viewBox:"0 0 24 24",height:t,width:t,xmlns:"http://www.w3.org/2000/svg",...r,children:(0,a.jsx)("path",{d:"M17.0007 1.20825 18.3195 3.68108 20.7923 4.99992 18.3195 6.31876 17.0007 8.79159 15.6818 6.31876 13.209 4.99992 15.6818 3.68108 17.0007 1.20825ZM10.6673 9.33325 15.6673 11.9999 10.6673 14.6666 8.00065 19.6666 5.33398 14.6666.333984 11.9999 5.33398 9.33325 8.00065 4.33325 10.6673 9.33325ZM11.4173 11.9999 9.18905 10.8115 8.00065 8.58325 6.81224 10.8115 4.58398 11.9999 6.81224 13.1883 8.00065 15.4166 9.18905 13.1883 11.4173 11.9999ZM19.6673 16.3333 18.0007 13.2083 16.334 16.3333 13.209 17.9999 16.334 19.6666 18.0007 22.7916 19.6673 19.6666 22.7923 17.9999 19.6673 16.3333Z"})})};let I=R},15196:(e,t,r)=>{"use strict";r.d(t,{CreateDemoProjectButton:()=>y,CreateProjectButton:()=>j});var a=r(99769),s=r(25677),n=r(12416),i=r(96628),l=r(2471),o=r(7189);let d=(0,o.createServerReference)("7fa89fc308c8048184adc57aa2237a30d5c63f6a7c",o.callServer,void 0,o.findSourceMapURL,"createSampleProject");var c=r(52554),u=r(46577),m=r(79256),h=r(7305),p=r(82780),f=r(63427),x=r(14792),g=r(18119);let b=e=>{let{open:t,setOpen:r}=e,o=(0,l.useRouter)(),{toast:b}=(0,f.dj)(),v=(0,n.c)("projects"),j=(0,n.c)("common"),[y]=(0,u.useAtom)(c.Me),{mutate:N}=(0,m.sw)({teamId:null==y?void 0:y._id}),{teams:w}=(0,h.S)(),[_,k]=(0,s.useState)(!1),E=async()=>{k(!0);try{var e;let t=await d({teamId:y?y._id:null==(e=w[0])?void 0:e._id});if(t.isError)return void b({variant:"destructive",title:v("demo.toast.errorTitle"),description:v("demo.toast.errorDescription")});N(),o.push("/projects/".concat(t.body._id))}catch(e){b({variant:"destructive",title:v("demo.toast.errorTitle"),description:v("demo.toast.errorDescription")}),console.error(e),k(!1)}finally{k(!1)}};return(0,a.jsx)(p.lG,{open:t,onOpenChange:r,children:(0,a.jsxs)(p.Cf,{children:[(0,a.jsxs)(p.c7,{children:[(0,a.jsx)(p.L3,{children:v("demo.title")}),(0,a.jsx)(p.rr,{className:""})]}),(0,a.jsx)("div",{className:"flex flex-col items-center justify-center gap-4 my-4",children:(0,a.jsxs)("div",{className:"flex flex-col items-left gap-2",children:[(0,a.jsx)(g.E,{variant:"muted",className:"whitespace-normal",children:v("demo.description")}),(0,a.jsx)(g.E,{variant:"muted",className:"whitespace-normal",children:v("demo.note")})]})}),(0,a.jsx)(p.Es,{children:(0,a.jsxs)(i.$,{variant:"primary",size:"block",onClick:()=>E(),disabled:_,children:[_&&(0,a.jsx)(x.A.Loader2,{className:"h-4 w-4 animate-spin"}),j("buttons.create")]})})]})})};var v=r(18610);let j=()=>{let{openModal:e}=(0,v.hS)(),t=(0,n.c)("project.buttons");return(0,a.jsx)(i.$,{variant:"outline-solid",onClick:()=>e(v.ew.NEW_PROJECT),className:"text-midnight border-white bg-white hover:bg-white/90",children:t("createFirstProject")})},y=()=>
1{let[e,t]=(0,s.useState)(!1),r=(0,n.c)("project.buttons");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.$,{variant:"primary",onClick:()=>t(!0),children:r("exploreDemoProject")}),(0,a.jsx)(b,{open:e,setOpen:t})]})}},18119:(e,t,r)=>{"use strict";r.d(t,{E:()=>o});var a=r(99769),s=r(25677),n=r(59615),i=r(60515);let l=(0,n.F)("leading-[150%] mb-3xs",{variants:{variant:{emphasize:"font-medium",muted:"text-muted-foreground"},size:{default:"text-base",large:"text-xl",small:"text-sm"}},defaultVariants:{size:"default"}}),o=s.forwardRef((e,t)=>{let{className:r,variant:s,size:n,...o}=e;return(0,a.jsx)("p",{className:(0,i.cn)(l({variant:s,size:n,className:r})),ref:t,...o})});o.displayName="Text"},18610:(e,t,r)=>{"use strict";r.d(t,{ew:()=>s.e,hS:()=>a.h}),r(26244),r(82778);var a=r(22234),s=r(68431);r(47603),r(46411)},21832:(e,t,r)=>{"use strict";r.d(t,{p:()=>i});var a=r(99769),s=r(25677),n=r(60515);let i=s.forwardRef((e,t)=>{let{className:r,type:s,...i}=e;return(0,a.jsx)("input",{type:s,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...i})});i.displayName="Input"},22234:(e,t,r)=>{"use strict";r.d(t,{h:()=>n});var a=r(46577),s=r(47603);function n(){let[,e]=(0,a.useAtom)(s.E);return{openModal:(t,r)=>{e({isOpen:!0,type:t,data:r})},closeModal:()=>{e({isOpen:!1,type:null,data:null})}}}},26244:(e,t,r)=>{"use strict";r.d(t,{ModalProvider:()=>i});var a=r(99769),s=r(46411),n=r(82778);function i(e){let{children:t}=e;return(0,a.jsxs)(a.Fragment,{children:[t,(0,a.jsx)(n.ModalRenderer,{}),(0,a.jsx)(s.ModalKeyboardShortcutHandler,{})]})}},26364:(e,t,r)=>{"use strict";r.d(t,{H:()=>s});var a=r(7189);let s=(0,a.createServerReference)("7f93fad8f2e09c091f687d373bbe7fb32268ea8d64",a.callServer,void 0,a.findSourceMapURL,"loadMoreActivities")},30316:(e,t,r)=>{"use strict";r.d(t,{Y:()=>u});var a=r(76472),s=r(22636);let n="true"===r(18029).env.NEXT_PUBLIC_ENABLE_TEST_LOCALE,i=(0,s.A)({locales:["en","es","fr","pt","ko","th",...n?["en-XA"]:[]],defaultLocale:"en",localePrefix:"never"}),{Link:l,redirect:o,usePathname:d,useRouter:c}=(0,a.A)(i),u=[{code:"en",name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},{code:"es",name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},{code:"fr",name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},{code:"pt",name:"Portugu\xeas",flag:"\uD83C\uDDE7\uD83C\uDDF7"},{code:"ko",name:"íêµì´",flag:"\uD83C\uDDF0\uD83C\uDDF7"},{code:"th",name:"à¹à¸à¸¢",flag:"\uD83C\uDDF9\uD83C\uDDED"},...n?[{code:"en-XA",name:"Test (i18n)",flag:"\uD83E\uDDEA"}]:[]]},31250:(e,t,r)=>{"use strict";r.d(t,{F9:()=>i,YS:()=>n,ll:()=>s});var a=r(23402);async function s(e){try{var t;let r=await (0,a.n)("/api/gia-chats?teamId=".concat(encodeURIComponent(e)));if(!r.ok)return[];return null!=(t=(await r.json()).data)?t:[]}catch(e){return console.error("Failed to list GIA chats:",e),[]}}async function n(e){try{var t;let r=await (0,a.n)("/api/gia-chats/".concat(encodeURIComponent(e)));if(!r.ok)return null;return null!=(t=(await r.json()).data)?t:null}catch(e){return console.error("Failed to load GIA chat:",e),null}}async function i(e){try{return(await (0,a.n)("/api/gia-chats/".concat(encodeURIComponent(e)),{method:"DELETE"})).ok}catch(e){return console.error("Failed to delete GIA chat:",e),!1}}},32974:(e,t,r)=>{"use strict";r.d(t,{J:()=>d});var a=r(95373),s=r(50138),n=r(4841),i=r(23402);class l extends Error{constructor(e,t){super(t),this.name="ProfileFetchError",this.status=e}}async function o(){let e=await (0,i.n)("/api/users",{method:"GET"});if(401===e.status)throw window.location.href="/logout",new l(401,"SESSION_EXPIRED");if(!e.ok){let t=new l(e.status,"Failed to fetch user profile (".concat(e.status,")"));throw console.error("[fetchUser] Error fetching user:",{error:t}),t}let t=await e.json();if(!(null==t?void 0:t.data))throw Error("User profile response contained no user");return t.data}function d(){let e=(0,s.jE)(),{data:t,error:r,isLoading:i}=(0,n.I)({queryKey:a.lH.user,queryFn:o,staleTime:1e6,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>{let r=t instanceof l?t.status:void 0;return(void 0===r||!(r<500))&&e<2}});return{user:t,isLoading:i,error:r,mutate:()=>{e.invalidateQueries({queryKey:a.lH.user})}}}},38962:(e,t,r)=>{"use strict";r.d(t,{s:()=>l});var a=r(95373),s=r(4841),n=r(23402);async function i(){try{var e;let t=await (0,n.n)("/api/whats-new",{method:"GET"});if(!t.ok)throw Error("Failed to fetch release notes");let r=await t.json();if(r.isError||r.error)throw Error(r.error||"Failed to fetch release notes",{cause:r});return null!=(e=r.notes)?e:[]}catch(e){throw console.error("[fetchReleaseNotes] Error fetching release notes:",{error:e,...e instanceof Error&&e.cause?{responseError:e.cause}:{}}),e}}function l(){let{data:e,isLoading:t,isError:r,refetch:n}=(0,s.I)({queryKey:a.lH.releaseNotes,queryFn:i,staleTime:36e5,gcTime:72e5});return{notes:null!=e?e:[],isLoading:t,isError:r,refetch:()=>{n()}}}},42077:(e,t,r)=>{"use strict";r.d(t,{Bj:()=>y,Bq:()=>O,Ek:()=>f,F:()=>k,GB:()=>T,OX:()=>S,Pg:()=>j,SA:()=>P,U4:()=>F,Wf:()=>N,dU:()=>
1g,dl:()=>v,f2:()=>R,nY:()=>E,oU:()=>b,r0:()=>x,tN:()=>_,w7:()=>I,z5:()=>A,zJ:()=>M});var a=r(95373),s=r(4841),n=r(50138),i=r(85289),l=r(12416),o=r(23402),d=r(97489),c=r(53741);let u=e=>"/api/teams/".concat(encodeURIComponent(e),"/product-hub"),m=(e,t)=>"".concat(u(e),"/products/").concat(encodeURIComponent(t),"/axes");function h(e,t,r){e.invalidateQueries({queryKey:a.lH.productHub(t),predicate:e=>(0,d.j)(e.queryKey,r)})}async function p(e,t){if(!e.ok){let r=await e.json().catch(()=>null);throw(0,c.Yz)(r,t)}let r=await e.json();return null==r?void 0:r.data}function f(e){let{data:t,error:r,isLoading:n}=(0,s.I)({queryKey:e?a.lH.productHubBrands(e):["team",void 0,"product-hub-brands"],queryFn:async()=>{var t;let r=await (0,o.n)("".concat(u(e),"/brands"));if(!r.ok)throw Error("Failed to fetch brands");return null!=(t=(await r.json()).data)?t:[]},enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1});return{brands:null!=t?t:[],isLoading:n,error:r}}function x(e){let{brands:t,isLoading:r}=f(e),a=new Map(t.map(e=>[e._id,e.name]));return{brands:t,isLoading:r,nameOf:e=>{var t;return e&&null!=(t=a.get(e))?t:null}}}function g(e){let t=(0,l.c)("productHub.brands"),r=(0,n.jE)();return(0,i.n)({mutationFn:async r=>p(await (0,o.n)("".concat(u(e),"/brands"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),t("createFailed")),onSuccess:()=>{e&&r.invalidateQueries({queryKey:a.lH.productHubBrands(e)})}})}function b(e){let t=(0,l.c)("productHub.brands"),r=(0,n.jE)();return(0,i.n)({mutationFn:async r=>{let{brandId:a,updates:s}=r;return p(await (0,o.n)("".concat(u(e),"/brands/").concat(encodeURIComponent(a)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),t("updateFailed"))},onSuccess:()=>{e&&(r.invalidateQueries({queryKey:a.lH.productHubBrands(e)}),r.invalidateQueries({queryKey:a.lH.productHub(e)}))}})}function v(e){let t=(0,l.c)("productHub.brands"),r=(0,n.jE)();return(0,i.n)({mutationFn:async r=>p(await (0,o.n)("".concat(u(e),"/brands/").concat(encodeURIComponent(r)),{method:"DELETE"}),t("archiveFailed")),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:a.lH.productHubBrands(e)}),r.invalidateQueries({queryKey:a.lH.productHub(e)}))}})}function j(e){let t=(0,l.c)("productHub.newProduct"),r=(0,n.jE)();return(0,i.n)({mutationFn:async r=>p(await (0,o.n)("".concat(u(e),"/products"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),t("createFailed")),onSuccess:()=>{e&&r.invalidateQueries({queryKey:a.lH.productHub(e)})}})}function y(e,t){let r=(0,n.jE)(),{data:i,error:l,isLoading:d}=(0,s.I)({queryKey:e&&t?a.lH.productHubProduct(e,t):["team",void 0,"product-hub","product",void 0],queryFn:async()=>{let r=await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"?options=none"));if(!r.ok)throw Error("Failed to fetch the product");return(await r.json()).data},enabled:!!e&&!!t,staleTime:1e4,refetchOnWindowFocus:!1,refetchOnMount:!0});return{product:i,isLoading:d,error:l,mutate:()=>{e&&t&&r.invalidateQueries({queryKey:a.lH.productHubProduct(e,t)})}}}function N(e,t,r){let s=(0,n.jE)();return(0,i.n)({retry:!1,mutationFn:async a=>{if(!e||!t)throw Error(r);return p(await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),r)},onSuccess:()=>{e&&s.invalidateQueries({queryKey:a.lH.productHub(e)})}})}let w=(e,t)=>[...a.lH.productHubProduct(e,t),"options"];function _(e,t,r){var a,n,i;let{data:l,error:d,isLoading:c}=(0,s.I)({queryKey:e&&t?w(e,t):["team",void 0,"product-hub","product",void 0,"options"],queryFn:async()=>{var r,a,s,n;let i=await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/options"));if(!i.ok)throw Error("Failed to fetch the options");let l=await i.json();return{axes:null!=(s=null==(r=l.data)?void 0:r.axes)?s:[],axisValues:null!=(n=null==(a=l.data)?void 0:a.axisValues)?n:[]}},enabled:!!e&&!!t&&(null==(a=null==r?void 0:r.enabled)||a),staleTime:1e4,refetchOnWindowFocus:!1,refetchOnMount:!0});return{axes:null!=(n=null==l?void 0:l.axes)?n:[],axisValues:null!=(i=null==l?void 0:l.axisValues)?i:[],isLoading:c,error:d}}function k(e,t,r){var n,i,l;let{data:d,error:c,isLoading:m}=(0,s.I)({queryKey:e&&t?[...a.lH.productHubProduct(e,t),"skus"]:["team",void 0,"product-hub","product",void 0,"skus"],queryFn:async()=>{var r,a,s;let n=await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/skus?includeArchived=true"));if(!n.ok)throw Error("Failed to fetch the packs");let i=await n.json();return{skus:null!=(s=null==(r=i.data)?void 0:r.skus)?s:[],truncated:!!(null==(a=i.data)?void 0:a.truncated)}},enabled:!!e&&!!t&&(null==(n=null==r?void 0:r.enabled)||n),staleTime:1e4,refetchOnWindowFocus:!1,refetchOnMount:!0});return{skus:null!=(i=null==d?void 0:d.skus)?i:[],truncated:null!=(l=null==d?void 0:d.truncated)&&l,isLoading:m,error:c}}function E(e,t){let r=(0,l.c)("productHub.product"),s=(0,n.jE)();return(0,i.n)({mutationFn:async t=>{let{skuId:a,inRange:s}=t;return p(await (0,o.n)("".concat(u(e),"/skus/").concat(encodeURIComponent(a)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({inRange:s})}),r("skus.rangeFailed"))},onSuccess:(r,n)=>{if(!e)return;t&&s.refetchQueries({queryKey:[...a.lH.productHubProduct(e,t),"skus"]});let i=a.lH.productHubSku(e,n.skuId);s.invalidateQueries({queryKey:i}),h(s,e,[...t?[a.lH.productHubProduct(e,t)]:[],i])}})}function C(e,t,r,s){let l=(0,n.jE)();return(0,i.n)({mutationFn:async e=>p(await r(e),s),onSuccess:r=>{e&&(t&&(null==r?void 0:r.product)&&(l.setQueryData(a.lH.productHubProduct(e,t),r.product),l.refetchQueries({queryKey:[...a.lH.productHubProduct(e,t),"skus"]}
1),l.invalidateQueries({queryKey:w(e,t)})),h(l,e,t&&(null==r?void 0:r.product)?[a.lH.productHubProduct(e,t)]:[]))}})}function S(e,t){return C(e,t,r=>(0,o.n)(m(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),(0,l.c)("productHub.axes")("addFailed"))}function A(e,t){return C(e,t,r=>(0,o.n)("".concat(m(e,t),"/").concat(encodeURIComponent(r)),{method:"DELETE"}),(0,l.c)("productHub.axes")("removeFailed"))}function R(e,t){return C(e,t,r=>{let{axisName:a,value:s}=r;return(0,o.n)("".concat(m(e,t),"/").concat(encodeURIComponent(a),"/values"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s})})},(0,l.c)("productHub.axes")("addValueFailed"))}function I(e,t){return C(e,t,r=>{let{axisName:a,from:s,to:n}=r;return(0,o.n)("".concat(m(e,t),"/").concat(encodeURIComponent(a),"/values/").concat(encodeURIComponent(s)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n})})},(0,l.c)("productHub.axes")("renameValueFailed"))}function F(e,t){return C(e,t,r=>{let{axisName:a,value:s}=r;return(0,o.n)("".concat(m(e,t),"/").concat(encodeURIComponent(a),"/values/").concat(encodeURIComponent(s)),{method:"DELETE"})},(0,l.c)("productHub.axes")("removeValueFailed"))}function M(e,t){let r=(0,l.c)("productHub.slices"),s=(0,n.jE)();return(0,i.n)({mutationFn:async a=>p(await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/axis-values/entries"),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),r("removeFailed")),onSuccess:()=>{e&&s.invalidateQueries({queryKey:a.lH.productHub(e)})}})}function P(e,t){let r=(0,l.c)("productHub.productSpec"),s=(0,n.jE)();return(0,i.n)({mutationFn:async a=>p(await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/entries"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),r("saveFailed")),onSuccess:(t,r)=>{!r.dryRun&&e&&s.invalidateQueries({queryKey:a.lH.productHub(e)})}})}function T(e,t){let r=(0,l.c)("productHub.productSpec"),s=(0,n.jE)();return(0,i.n)({mutationFn:async a=>p(await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/entries"),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),r("removeFailed")),onSuccess:()=>{e&&s.invalidateQueries({queryKey:a.lH.productHub(e)})}})}function O(e,t){let r=(0,l.c)("productHub.productSpec"),s=(0,n.jE)();return(0,i.n)({mutationFn:async a=>p(await (0,o.n)("".concat(u(e),"/products/").concat(encodeURIComponent(t),"/fields"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),r("fieldChangeFailed")),onSuccess:r=>{e&&t&&((null==r?void 0:r.product)&&s.setQueryData(a.lH.productHubProduct(e,t),r.product),s.refetchQueries({queryKey:[...a.lH.productHubProduct(e,t),"skus"]}),h(s,e,(null==r?void 0:r.product)?[a.lH.productHubProduct(e,t)]:[]))}})}},43102:(e,t,r)=>{"use strict";r.d(t,{StateProvider:()=>i});var a=r(99769);r(25677);var s=r(46577);function n(){return null}function i(e){let{children:t}=e;return(0,a.jsxs)(s.Provider,{children:[(0,a.jsx)(n,{}),t]})}},46411:(e,t,r)=>{"use strict";r.d(t,{ModalKeyboardShortcutHandler:()=>i});var a=r(25677),s=r(68431),n=r(22234);function i(){let{openModal:e}=(0,n.h)();return(0,a.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&"k"===t.key&&(t.preventDefault(),e(s.e.QUICK_SEARCH))};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e]),null}},47872:(e,t,r)=>{"use strict";r.d(t,{Ke:()=>i,Nt:()=>s,R6:()=>n});var a=r(14147);let s=a.bL,n=a.R6,i=a.Ke},48539:(e,t,r)=>{"use strict";r.d(t,{BK:()=>o,eu:()=>l,q5:()=>d});var a=r(99769),s=r(25677),n=r(69121),i=r(60515);let l=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.bL,{ref:t,className:(0,i.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",r),...s})});l.displayName=n.bL.displayName;let o=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n._V,{ref:t,className:(0,i.cn)("aspect-square h-full w-full object-cover",r),...s})});o.displayName=n._V.displayName;let d=s.forwardRef((e,t)=>
1{let{className:r,...s}=e;return(0,a.jsx)(n.H4,{ref:t,className:(0,i.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",r),...s})});d.displayName=n.H4.displayName},50310:()=>{},51130:(e,t,r)=>{"use strict";function a(e,t){if(!e)return"â";if("upload"===e.kind)return e.name||(null==t?void 0:t.upload)||"Uploaded file";if("revision"===e.kind){let r=e.proofName||(null==t?void 0:t.proof)||"Proof";return null!=e.version?"".concat(r," v").concat(e.version):r}return"â"}function s(e,t){var r,s;let n=null==(r=e.sides)?void 0:r.previous,i=null==(s=e.sides)?void 0:s.current;return(null==n?void 0:n.kind)==="revision"&&(null==i?void 0:i.kind)==="revision"&&n.proofName&&n.proofName===i.proofName&&null!=n.version&&null!=i.version?"".concat(n.proofName," \xb7 v").concat(n.version," vs v").concat(i.version):"".concat(a(n,t)," vs ").concat(a(i,t))}function n(e,t){let r=t.trim().toLowerCase();return r?e.filter(e=>s(e).toLowerCase().includes(r)):e}function i(e,t){return"/_teams/".concat(e,"/ai-compare/").concat(t)}function l(e){var t,r;return[e._id,e.status,null!=(t=e.progress)?t:"",null!=(r=e.updatedAt)?r:"",e.sides?s(e):""].join("|")}function o(e,t){let r=new Map(e.map(e=>[e._id,e])),a=e.length!==t.length,s=t.map((t,s)=>{let n=r.get(t._id);if(n&&l(n)===l(t)){var i;return(null==(i=e[s])?void 0:i._id)!==t._id&&(a=!0),n}return a=!0,t});return a?s:e}function d(e){return e.some(e=>"running"===u(e.status))}function c(e){if("running"!==u(e.status))return null;let t=e.progress;return"number"!=typeof t||Number.isNaN(t)||t<=0?null:Math.min(100,Math.round(t))}function u(e){return"failed"===e||"error"===e?"failed":"done"===e?null:"running"}r.d(t,{BO:()=>i,D4:()=>o,Wk:()=>a,_l:()=>d,lH:()=>u,rs:()=>n,v:()=>c,wq:()=>s})},54695:(e,t,r)=>{"use strict";r.d(t,{$:()=>o,F:()=>l});var a=r(99769),s=r(25677),n=r(90005),i=r(60515);let l=s.forwardRef((e,t)=>{let{className:r,children:s,...l}=e;return(0,a.jsxs)(n.bL,{ref:t,className:(0,i.cn)("relative overflow-hidden",r),...l,children:[(0,a.jsx)(n.LM,{className:"h-full w-full rounded-[inherit]",children:s}),(0,a.jsx)(o,{}),(0,a.jsx)(n.OK,{})]})});l.displayName=n.bL.displayName;let o=s.forwardRef((e,t)=>{let{className:r,orientation:s="vertical",...l}=e;return(0,a.jsx)(n.VM,{ref:t,orientation:s,className:(0,i.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-px","horizontal"===s&&"h-2.5 border-t border-t-transparent p-px",r),...l,children:(0,a.jsx)(n.lr,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=n.VM.displayName},56302:(e,t,r)=>{"use strict";r.d(t,{k:()=>i});var a=r(7189);let s=(0,a.createServerReference)("7fc545aad6ebc4b2de3594b5bfba162a3481de6367",a.callServer,void 0,a.findSourceMapURL,"getTrialOfferAction");var n=r(4841);function i(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{data:r,isLoading:a}=(0,n.I)({queryKey:["subscription","trial-offer",e],queryFn:()=>{if(!e)throw Error("Team ID is required");return s(e)},enabled:!!e&&t,staleTime:3e5,refetchOnWindowFocus:!1,retry:1});return{offer:r,isLoading:a}}},56792:(e,t,r)=>{"use strict";r.d(t,{PRBanner:()=>n});var a=r(99769),s=r(25677);function n(e){let{branch:t}=e,[r,n]=(0,s.useState)(!1);return r?null:(0,a.jsx)("div",{className:"fixed bottom-3 right-3 z-50 pointer-events-none",children:(0,a.jsx)("span",{onClick:()=>n(!0),className:"text-xs text-white/60 bg-black/30 backdrop-blur-sm rounded px-2 py-1 font-mono select-none pointer-events-auto cursor-pointer hover:opacity-60 transition-opacity",children:t})})}},61689:(e,t,r)=>{"use strict";r.d(t,{CG:()=>u,Fm:()=>g,Qs:()=>v,cj:()=>c,h:()=>x,kN:()=>m,qp:()=>b});var a=r(99769),s=r(25677),n=r(50802),i=r(59615),l=r(13049),o=r(60515),d=r(82780);let c=n.bL,u=n.l9,m=n.bm,h=e=>{let{...t}=e;return(0,a.jsx)(n.ZL,{...t})};h.displayName=n.ZL.displayName;let p=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.hJ,{className:(0,o.cn)("fixed inset-0 z-50 bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...s,ref:t})});p.displayName=n.hJ.displayName;let f=(0,i.F)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),x=s.forwardRef((e,t)=>
1{let{side:r="right",className:s,children:i,onInteractOutside:c,onEscapeKeyDown:u,...m}=e;return(0,a.jsxs)(h,{children:[(0,a.jsx)(p,{}),(0,a.jsxs)(n.UC,{ref:t,className:(0,o.cn)(f({side:r}),s),...m,onInteractOutside:(0,d.P3)(c),onEscapeKeyDown:(0,d.P3)(u),children:[i,(0,a.jsxs)(n.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});x.displayName=n.UC.displayName;let g=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};g.displayName="SheetHeader";let b=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.hE,{ref:t,className:(0,o.cn)("text-lg font-semibold text-foreground",r),...s})});b.displayName=n.hE.displayName;let v=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.VY,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",r),...s})});v.displayName=n.VY.displayName},64447:(e,t,r)=>{"use strict";r.d(t,{AM:()=>l,Wv:()=>o,dT:()=>d,hl:()=>c});var a=r(99769),s=r(25677),n=r(59462),i=r(60515);let l=n.bL,o=n.l9,d=n.Mz,c=s.forwardRef((e,t)=>{let{className:r,align:s="center",sideOffset:l=4,...o}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:t,align:s,sideOffset:l,className:(0,i.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",r),...o})})});c.displayName=n.UC.displayName},64449:(e,t,r)=>{"use strict";r.d(t,{Qg:()=>h,Sb:()=>f,US:()=>c,aD:()=>x,eC:()=>p,tE:()=>d,y8:()=>m});var a=r(99769),s=r(25677),n=r(89804),i=r(59615),l=r(13049),o=r(60515);let d=n.Kq,c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.LM,{ref:t,className:(0,o.cn)("fixed z-100 flex max-h-screen w-full flex-col-reverse p-4 bottom-16 sm:bottom-0 sm:right-0 sm:top-auto md:max-w-[420px]",r),...s})});c.displayName=n.LM.displayName;let u=(0,i.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=s.forwardRef((e,t)=>{let{className:r,variant:s,...i}=e;return(0,a.jsx)(n.bL,{ref:t,className:(0,o.cn)(u({variant:s}),r),...i})});m.displayName=n.bL.displayName;let h=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.rc,{ref:t,className:(0,o.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:group-[.destructive]:ring-destructive",r),...s})});h.displayName=n.rc.displayName;let p=s.forwardRef((e,t)=>
1{let{className:r,...s}=e;return(0,a.jsx)(n.bm,{ref:t,className:(0,o.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",r),"toast-close":"",...s,children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})});p.displayName=n.bm.displayName;let f=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.hE,{ref:t,className:(0,o.cn)("text-sm font-semibold",r),...s})});f.displayName=n.hE.displayName;let x=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.VY,{ref:t,className:(0,o.cn)("text-sm opacity-90",r),...s})});x.displayName=n.VY.displayName},73743:(e,t,r)=>{"use strict";r.d(t,{V:()=>s});var a=r(7189);let s=(0,a.createServerReference)("7f71ff4648926943f0752ae97de603442d6db99a57",a.callServer,void 0,a.findSourceMapURL,"clearAllNavbarNotificationsAction")},76673:(e,t,r)=>{"use strict";r.d(t,{l:()=>o});var a=r(95373),s=r(50138),n=r(4841),i=r(23402);async function l(){try{let e=await (0,i.n)("/api/notifications/count",{method:"GET"});if(!e.ok)throw Error("Failed to fetch notification count");let t=await e.json();if(t.isError||t.error){let e=t.error||"Failed to fetch notification count";throw Error(e,{cause:t})}return t.count}catch(e){throw console.error("[fetchNotificationsCount] Error fetching notification count:",{error:e,...e instanceof Error&&e.cause?{responseError:e.cause}:{}}),e}}function o(){let e=(0,s.jE)(),{data:t,error:r,isLoading:i}=(0,n.I)({queryKey:a.lH.notificationsCount,queryFn:l,staleTime:5e3,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchInterval:3e4});return{count:null!=t?t:0,isLoading:i,error:r,mutate:()=>{e.invalidateQueries({queryKey:a.lH.notificationsCount})}}}},78423:(e,t,r)=>{"use strict";r.d(t,{s:()=>c,k:()=>u});var a=r(25677),s=r(95373),n=r(50138),i=r(38962),l=r(32974),o=r(7189);let d=(0,o.createServerReference)("7f5f8c7b26a26623039838a9f0b717912058f2a8a3",o.callServer,void 0,o.findSourceMapURL,"markWhatsNewSeen");function c(e,t){if(0===e.length||!t)return new Set;let r=e.findIndex(e=>e.id===t),a=-1===r?e.length:r;return new Set(e.slice(0,a).map(e=>e.id))}function u(e){var t,r,o,u,m,h;let p=null!=(u=null==e?void 0:e.seed)&&u,{notes:f}=(0,i.s)(),{user:x,isLoading:g}=(0,l.J)(),b=(0,n.jE)(),v=a.useRef(!1),j=null!=(m=null==x||null==(r=x.metadata)||null==(t=r.whats_new)?void 0:t.last_seen_release_id)?m:null,y=null!=(h=null==(o=f[0])?void 0:o.id)?h:null,N=a.useMemo(()=>c(f,j).size,[f,j]),w=a.useCallback(async e=>{if(!(null==x?void 0:x._id))return;b.setQueryData(s.lH.user,t=>t?{...t,metadata:{...t.metadata,whats_new:{last_seen_release_id:e}}}:t);let t=await d(e);(null==t?void 0:t.isError)&&console.error("[useWhatsNewUnread] Failed to persist last seen release")},[null==x?void 0:x._id,b]);a.useEffect(()=>{p&&!v.current&&(null==x?void 0:x._id)&&y&&(j||(v.current=!0,w(y)))},[p,null==x?void 0:x._id,y,j,w]);let _=a.useCallback(()=>{y&&j!==y&&w(y)},[y,j,w]);return{unreadCount:N,lastSeenId:j,isUserLoading:g,markAllSeen:_}}},80253:(e,t,r)=>{Promise.resolve().then(r.bind(r,6881)),Promise.resolve().then(r.bind(r,46411)),Promise.resolve().then(r.bind(r,26244)),Promise.resolve().then(r.bind(r,82778)),Promise.resolve().then(r.bind(r,56792)),Promise.resolve().then(r.t.bind(r,50310,23)),Promise.resolve().then(r.bind(r,7341)),Promise.resolve().then(r.bind(r,99710)),Promise.resolve().then(r.bind(r,95373)),Promise.resolve().then(r.bind(r,43102)),Promise.resolve().then(r.bind(r,6706)),Promise.resolve().then(r.bind(r,46577)),Promise.resolve().then(r.bind(r,96684)),Promise.resolve().then(r.bind(r,26052)),Promise.resolve().then(r.t.bind(r,98179,23)),Promise.resolve().then(r.t.bind(r,6842,23)),Promise.resolve().then(r.t.bind(r,80045,23)),Promise.resolve().then(r.bind(r,93352))},82780:(e,t,r)=>{"use strict";r.d(t,{Cf:()=>h,Es:()=>f,L3:()=>x,P3:()=>o,c7:()=>p,lG:()=>d,rr:()=>g,zM:()=>c});var a=r(99769),s=r(25677),n=r(50802),i=r(13049),l=r(60515);function o(e){return t=>{null==e||e(t),document.querySelector("[data-radix-select-viewport]")&&t.preventDefault()}}let d=n.bL,c=n.l9,u=e=>{let{...t}=e;return(0,a.jsx)(n.ZL,{...t})};u.displayName=n.ZL.displayName;let m=s.forwardRef((e,t)=>
1{let{className:r,...s}=e;return(0,a.jsx)(n.hJ,{ref:t,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...s})});m.displayName=n.hJ.displayName;let h=s.forwardRef((e,t)=>{let{className:r,children:s,onInteractOutside:d,onEscapeKeyDown:c,...h}=e;return(0,a.jsxs)(u,{children:[(0,a.jsx)(m,{}),(0,a.jsxs)(n.UC,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg [&>*]:min-w-0 translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-md md:w-full",r),...h,onInteractOutside:o(d),onEscapeKeyDown:o(c),children:[s,(0,a.jsxs)(n.bm,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground mt-2",children:[(0,a.jsx)(i.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});h.displayName=n.UC.displayName;let p=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};p.displayName="DialogHeader";let f=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};f.displayName="DialogFooter";let x=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.hE,{ref:t,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",r),...s})});x.displayName=n.hE.displayName;let g=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.VY,{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",r),...s})});g.displayName=n.VY.displayName},86352:(e,t,r)=>{"use strict";r.d(t,{BO:()=>b,Di:()=>c,PV:()=>p,UE:()=>u,W6:()=>f,_Q:()=>v,cW:()=>m,eC:()=>x,eU:()=>h,hJ:()=>g,oC:()=>o,z7:()=>l});var a=r(96719);r(9044);var s=r(58266),n=r(20832),i=r(94380),l=function(e){return e.REVIEWER="reviewer",e.PRIVATE_PROJECT_MEMBER="private_project_member",e.ANONYMOUS_USER="anonymous_user",e}({}),o=function(e){return e.VIEW_PROJECT="VIEW_PROJECT",e.MANAGE_PROJECT="MANAGE_PROJECT",e.MANAGE_MEMBERS="MANAGE_MEMBERS",e.CREATE_NOTE="CREATE_NOTE",e}({});let d={[s.z7.ADMIN]:{label:"Admin",description:"Can manage project, reviewers, proofs and notes",permissions:["VIEW_PROJECT","MANAGE_PROJECT","MANAGE_MEMBERS","CREATE_NOTE"]},[s.z7.MEMBER]:{label:"Member",description:"Can view and manage project resources",permissions:["VIEW_PROJECT","MANAGE_PROJECT","MANAGE_MEMBERS","CREATE_NOTE"]},private_project_member:{label:"Private Project Member",description:"Can view and manage project resources",permissions:["VIEW_PROJECT","MANAGE_PROJECT","MANAGE_MEMBERS","CREATE_NOTE"]},reviewer:{label:"Reviewer",description:"Can view and review project resources",permissions:["VIEW_PROJECT","CREATE_NOTE"]},anonymous_user:{label:"Anonymous User",description:"Can view project resources",permissions:["VIEW_PROJECT"]}},c=(e,t)=>{var r;return null!=(r=e.private_project)&&!!r.status&&(0,i.NB)(e.private_project.members,t)},u=e=>{var t;return null==(t=e.private_project)?void 0:t.members},m=e=>{var t,r,a;let s=[];return(null==(t=e.private_project)?void 0:t.status)?e.private_project.members.forEach(e=>{s.push(e.user)}):null==(a=e.team)||a.members.forEach(e=>{s.push(e.user)}),e.user&&s.push(e.user),null==(r=e.reviewers)||r.forEach(e=>{s.push(e.user)}),s},h=(e,t)=>(0,i.NB)(e.members,t),p=(e,t)=>{var r;return t._id===((null==(r=e.user)?void 0:r._id)||e.user)},f=e=>{let{project:t,team:r,user:a,permission:n}=e;if(t.user&&t.user._id===a._id)return d[s.z7.ADMIN].permissions.includes(n);let l=r&&(0,s._5)(r,a);if(l){var o;return l.role===s.z7.ADMIN?d[s.z7.ADMIN].permissions.includes(n):(null==(o=t.private_project)?void 0:o.status)?!!(0,i.NB)(t.private_project.members,a)&&d.private_project_member.permissions.includes(n):d[s.z7.MEMBER].permissions.includes(n)}return!!(0,i.NB)(t.members,a)&&d.reviewer.permissions.includes(n)},x=e=>{var t;let{projectId:r,user:s}=e,n=((null==s||null==(t=s.settings)?void 0:t.snoozed_projects)||[]).find(e=>{let{project:t}=e;return t===r});return!!n&&(!n.snoozed_until||(0,a.A)(new Date(n.snoozed_until),new Date))},g=(e,t)=>{var r;return!!(null==t||null==(r=t.settings)?void 0:r.favourite_projects)&&t.settings.favourite_projects.some(t=>t.project===e)},b=(e,t,r)=>{if(e.team&&"object"==typeof e.team)return e.team;if("string"==typeof e.team){let a=null==r?void 0:r.find(t=>t._id===e.team);return a||((null==t?void 0:t._id)===e.team?t:void 0)}},v=(e,t)=>{let r=e.team&&"object"==typeof e.team?e.team:t;if(r){var a;return(null==(a=r.subscription)?void 0:a.status)===-1||-1===(0,s.rr)(r).status}return!!e.user&&"object"==typeof e.user&&-1===(0,n.xL)(e.user).status}},87995:(e,t,r)=>{"use strict";r.d(t,{Bm:()=>a,Jb:()=>n,Sc:()=>l,ht:()=>i});let a="gv_attr",s=["gclid","wbraid","gbraid","utm_source","utm_medium","utm_campaign","referrer","landingPage","capturedAt"];function n(e){let t;if(!e)return null;try{t=JSON.parse(e)}catch(e){return null}if("object"!=typeof t||null===t||Array.isArray(t))return null;let r={};
1return s.forEach(e=>{let a=t[e];"string"==typeof a&&(r[e]=a)}),r}function i(e){let t=e.split(".");return t.length>=3?t.slice(2).join("."):null}function l(e){let t=e.split(".");return t.length<4?null:t.slice(2).join(".")}},88589:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>l,ZI:()=>c,k$:()=>d,m_:()=>o});var a=r(99769),s=r(25677),n=r(31293),i=r(60515);let l=e=>{let{children:t,delayDuration:r=100,...s}=e;return(0,a.jsx)(n.Kq,{delayDuration:r,...s,children:t})},o=n.bL,d=n.l9,c=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...l}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:t,sideOffset:s,className:(0,i.cn)("z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-sm text-background shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...l})})});c.displayName=n.UC.displayName},89983:(e,t,r)=>{"use strict";r.d(t,{a:()=>s});var a=r(25677);function s(){let[e,t]=a.useState(void 0);return a.useEffect(()=>{let e=window.matchMedia("(max-width: ".concat(767,"px)")),r=()=>{t(window.innerWidth<768)};return e.addEventListener("change",r),t(window.innerWidth<768),()=>e.removeEventListener("change",r)},[]),!!e}},91033:(e,t,r)=>{"use strict";r.d(t,{d:()=>S});var a=r(99769),s=r(25677),n=r(72898),i=r.n(n),l=r(76210),o=r(40881),d=r(46694),c=r(62501),u=r(99050),m=r(86240),h=r(42583),p=r(53390),f=r(12416),x=r(67564),g=r(18114),b=r(60515),v=r(50608),j=r(88445),y=r(96628),N=r(54695),w=r(88589),_=r(63427);let k={REVISION_LIMIT_REACHED:"revisionLimitReached",DESIGN_LIMIT_REACHED:"designLimitReached"},E={REVISION_LIMIT_REACHED:"revisionLimitReachedWithLimit",DESIGN_LIMIT_REACHED:"designLimitReachedWithLimit"};function C(e){if(!e||e<0)return"0 B";let t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),3),r=e/Math.pow(1024,t);return"".concat(0===t?Math.round(r):r.toFixed(1)," ").concat(["B","KB","MB","GB"][t])}function S(){let e=(0,f.c)("common.uploads"),[t,r]=s.useState(!0),[n,S]=s.useState((0,l.FJ)()),A=s.useRef(new Set),R=s.useRef(new Set),{toast:I}=(0,_.dj)(),F=s.useCallback((t,r)=>{if(t.errorCode){let r=t.errorLimit;if("number"==typeof r){let a=E[t.errorCode];if(a)return e(a,{limit:r})}let a=k[t.errorCode];if(a)return e(a)}return"string"==typeof t.error?t.error:e(r)},[e]);s.useEffect(()=>(0,l.gy)(()=>{let t=(0,l.FJ)();S([...t]),t.forEach(t=>{t.error&&!R.current.has(t.id)&&(R.current.add(t.id),I({title:e("failed"),description:F(t,"errorDefault"),variant:"destructive"}))}),t.forEach(e=>{if(e.done&&!A.current.has(e.id)){if(A.current.add(e.id),e.fileManager)return;let t=e.asset,r=e.asset.project;if(r.sections.length>0){let e;t.upload_as_new_revision&&t.upload_as_new_revision_to&&t.upload_as_new_revision_to.section?e=t.upload_as_new_revision_to.section:t.section&&(e=t.section),(0,g.MG)(r._id,e||"NO_SECTION")}(0,g.gr)(r._id),(0,g.zD)(r._id)}})}),[]),s.useEffect(()=>{let e=e=>{(0,l.Pd)().length>0&&e.preventDefault()};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[]);let M=n.length,P=n.filter(e=>e.done).length,T=n.filter(e=>e.error).length,O=P+T===M;return 0===n.length?null:(0,a.jsx)(w.Bc,{delayDuration:200,children:(0,a.jsxs)("section",{"aria-label":e("title"),className:"fixed bottom-4 right-4 z-50 w-[21.25rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3xs bg-sidebar px-xs py-2xs text-sidebar-foreground",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3xs",children:[(0,a.jsx)("h2",{className:"text-base font-bold leading-tight",children:e("title")}),(0,a.jsx)(i(),{href:"","data-elevio-article":"153",className:"flex size-4 items-center justify-center text-white",children:(0,a.jsx)(u.R,{weight:"bold",className:"size-4"})})]}),(0,a.jsx)("p",{className:"mt-[2px] text-sm text-sidebar-foreground
1/70",children:O&&T>0?e.rich("summaryFailed",{completed:P,failed:T,danger:e=>(0,a.jsx)("span",{className:"text-destructive",children:e})}):e("summaryProgress",{completed:P,total:M})})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center",children:[(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(y.$,{variant:"ghost",size:"sm",className:"size-7 p-0 text-white hover:bg-sidebar-accent hover:text-white",onClick:()=>r(!t),"aria-expanded":t,"aria-label":t?e("minimize"):e("expand"),children:t?(0,a.jsx)(m.H,{weight:"bold",className:"size-4"}):(0,a.jsx)(o.Z,{weight:"bold",className:"size-4"})})}),(0,a.jsx)(w.ZI,{children:t?e("minimize"):e("expand")})]}),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)(y.$,{variant:"ghost",size:"sm",className:"size-7 p-0 text-white hover:bg-sidebar-accent hover:text-white",onClick:l.lX,"aria-label":e("clearCompleted"),children:(0,a.jsx)(p.X,{weight:"bold",className:"size-4"})})}),(0,a.jsx)(w.ZI,{children:e("clearCompleted")})]})]})]}),t&&(0,a.jsx)(N.F,{className:"max-h-[22.25rem] [&_[data-radix-scroll-area-viewport]>div]:!block",children:(0,a.jsx)("ul",{className:"flex flex-col gap-3xs px-2xs pb-xs pt-2xs",children:n.map((t,r)=>{var s,n,l,o,u,m,p,f,g;let y=t.error?"failed":t.done?"done":t.saving?"saving":t.uploading||t.started?"uploading":"queued",N=!!t.fileManager,_=t.asset.name,E=null!=(o=t.progress)?o:0,S=null!=(m=null!=(u=t.totalBytes)?u:null==(s=t.asset.file)?void 0:s.size)?m:0,A=null!=(p=t.loaded)?p:0,R="uploading"===y||"saving"===y,I="saving"===y?100:E;return(0,a.jsxs)("li",{"aria-label":R?"".concat(_," â ").concat(E,"%"):void 0,className:(0,b.cn)("flex items-start gap-3xs rounded-md px-xs py-2xs","failed"===y&&"border border-destructive/30 bg-error-message-bg","failed"!==y&&!R&&"bg-muted","saving"===y&&"animate-pulse"),style:R?{backgroundImage:"linear-gradient(to right, var(--color-marker-blue-90) ".concat(I,"%, var(--color-muted) ").concat(I,"%)")}:void 0,children:[(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-sm border border-border bg-muted text-muted-foreground",children:N?(0,a.jsx)(d.Z,{className:"size-4"}):(0,a.jsx)(c.C,{className:"size-4"})})}),(0,a.jsx)(w.ZI,{children:N?e("kindFile"):e("kindProof")})]}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"truncate text-base font-medium leading-tight",title:_,children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:14;if(e.length<=t)return e;let a=e.lastIndexOf("."),s=a>0?e.slice(a):"",n=a>0?e.slice(0,a):e;if(n.length<=r)return e;let i=n.slice(-r),l=Math.max(4,t-i.length-s.length-1);return"".concat(n.slice(0,l),"â¦").concat(i).concat(s)}(_)}),(0,a.jsxs)("p",{className:"mt-[2px] flex min-w-0 items-center gap-1 text-sm text-muted-foreground",children:[(0,a.jsx)("span",{className:"truncate",children:null==(n=t.asset.project)?void 0:n.name}),(0,a.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),"queued"===y&&(0,a.jsx)("span",{className:"shrink-0",children:e("statusQueued")}),"uploading"===y&&(0,a.jsx)("span",{className:"shrink-0",children:e("statusTransferred",{transferred:C(A),total:C(S)})}),"saving"===y&&(0,a.jsx)("span",{className:"shrink-0 font-medium text-primary",children:e("saving")}),"done"===y&&(0,a.jsx)(i(),{href:N?function(e){let t=new URLSearchParams;e.folderId&&t.set(j._.folder,e.folderId),e.fileId&&t.set(j._.preview,e.fileId);let r="team"===e.scope?"/teams/".concat(e.scopeId,"/library"):"/projects/".concat(e.scopeId);return"".concat(r,"?").concat(t.toString())}(t.fileManager):(0,v.jT)(null==(l=t.asset.project)?void 0:l.team,t.asset.project._id,null!=(f=t.designId)?f:t.asset._id),className:"shrink-0 font-medium text-primary hover:underline",children:N?e("openFile"):e("openProof")}),"failed"===y&&(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-destructive",children:[e("statusFailed"),(0,a.jsxs)(w.m_,{children:[(0,a.jsx)(w.k$,{asChild:!0,children:(0,a.jsx)("span",{tabIndex:0,role:"button","aria-label":e("whyItFailed"),className:"inline-flex rounded-sm outline-hidden focu
1s-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",children:(0,a.jsx)(h.t,{className:"size-3.5"})})}),(0,a.jsx)(w.ZI,{className:"max-w-56",children:(0,a.jsxs)("p",{children:[F(t,"errorGeneric")," ",!(t.errorCode in k)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i(),{href:x.Qf,target:"_blank",className:"underline",children:e("contactSupport")}),e("contactSupportSuffix")]})]})})]})]})]})]})]},null!=(g=t.id)?g:r)})})})]})})}},93352:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>i});var a=r(99769),s=r(64449),n=r(63427);function i(){let{toasts:e}=(0,n.dj)();return(0,a.jsxs)(s.tE,{children:[e.map(function(e){let{id:t,title:r,description:n,action:i,...l}=e;return(0,a.jsxs)(s.y8,{...l,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[r&&(0,a.jsx)(s.Sb,{children:r}),n&&(0,a.jsx)(s.aD,{children:n})]}),i,(0,a.jsx)(s.eC,{})]},t)}),(0,a.jsx)(s.US,{})]})}},97661:(e,t,r)=>{"use strict";r.d(t,{E:()=>l});var a=r(99769);r(25677);var s=r(59615),n=r(60515);let i=(0,s.F)("inline-flex items-center rounded-lg border px-2.5 py-1 h-6.5 text-xs text-primary-foreground font-medium transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{primary:"border-transparent bg-marker-blue",default:"border-transparent bg-mid-gray text-foreground",secondary:"border-transparent bg-marker-blue-90 text-primary dark:bg-marker-blue-20 dark:text-marker-blue-90",danger:"border-transparent bg-underline-red",success:"border-transparent bg-grammar-green",warning:"border-transparent bg-mustard-yellow",outline:"text-foreground"}},defaultVariants:{variant:"primary"}});function l(e){let{className:t,variant:r,...s}=e;return(0,a.jsx)("div",{className:(0,n.cn)(i({variant:r}),t),...s})}},98219:(e,t,r)=>{"use strict";r.d(t,{$v:()=>g,EO:()=>h,Lt:()=>d,Rx:()=>b,Zr:()=>v,ck:()=>f,r7:()=>x,tv:()=>c,wd:()=>p});var a=r(99769),s=r(25677),n=r(78045),i=r(60515),l=r(96628),o=r(82780);let d=n.bL,c=n.l9,u=e=>{let{...t}=e;return(0,a.jsx)(n.ZL,{...t})};u.displayName=n.ZL.displayName;let m=s.forwardRef((e,t)=>{let{className:r,children:s,...l}=e;return(0,a.jsx)(n.hJ,{className:(0,i.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-xs data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...l,ref:t})});m.displayName=n.hJ.displayName;let h=s.forwardRef((e,t)=>{let{className:r,onEscapeKeyDown:s,...l}=e;return(0,a.jsxs)(u,{children:[(0,a.jsx)(m,{}),(0,a.jsx)(n.UC,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...l,onEscapeKeyDown:(0,o.P3)(s)})]})});h.displayName=n.UC.displayName;let p=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};p.displayName="AlertDialogHeader";let f=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};f.displayName="AlertDialogFooter";let x=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.hE,{ref:t,className:(0,i.cn)("text-lg font-semibold",r),...s})});x.displayName=n.hE.displayName;let g=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.VY,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",r),...s})});g.displayName=n.VY.displayName;let b=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.rc,{ref:t,className:(0,i.cn)((0,l.r)(),r),...s})});b.displayName=n.rc.displayName;let v=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.ZD,{ref:t,className:(0,i.cn)((0,l.r)({variant:"outline-solid"}),"mt-2 sm:mt-0",r),...s})});v.displayName=n.ZD.displayName},99710:(e,t,r)=>{"use strict";r.d(t,{IntercomProvider:()=>u});var a=r(25677),s=r(2471),n=r(52554),i=r(14448),l=r(26774),o=r(46577),d=r(87995),c=r(7341);let u=()=>{var e;
1let t=(0,s.usePathname)(),r=(0,s.useSearchParams)(),{config:u}=(0,c.U)(),m=(0,o.useAtomValue)(n.Me),h={};(null==u||null==(e=u.intercom)?void 0:e.hash)&&(h.user_hash=u.intercom.hash),r.forEach((e,t)=>{0===t.search(/utm_/)&&(h[t]=e)});let p=(0,d.Jb)((0,l.getCookie)(d.Bm));return(null==p?void 0:p.utm_source)&&(h.utm_source=p.utm_source),(null==p?void 0:p.utm_medium)&&(h.utm_medium=p.utm_medium),(null==p?void 0:p.utm_campaign)&&(h.utm_campaign=p.utm_campaign),(null==p?void 0:p.landingPage)&&(h.landing_page=p.landingPage),(null==m?void 0:m._id)&&(h.company={company_id:m._id,name:m.name}),(0,i.Hh)(),(0,i.zj)(h),a.useEffect(()=>{(0,i.yo)({hide_default_launcher:!0})},[t]),null}}},e=>{var t=t=>e(e.s=t);e.O(0,[33847,86483,64826,7909,27975,48547,41056,72898,6069,62331,37500,36286,4841,55695,57312,59766,79354,69642,70488,31293,60560,88246,7769,45585,33967,94597,84184,94731,39958,85632,20682,83051,80678,9044,18246,54779,88747,59449,21227,58798,41626,77358],()=>t(80253)),_N_E=e.O()}]);
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.