import{l as p,d as y,aK as v,j as t,aT as F,aU as N,G as A,N as B,al as G,ae as D,aV as R,ap as P,aW as w,r as o,aX as H,aY as L,aZ as M,a as U,P as z,a_ as Q,aS as V,p as K,aL as W,a$ as q,S as u,H as I,b0 as O,b1 as X,B as Y,C as Z,b2 as _,b as $}from"./index-DTC0Ed21.js";import{T as J}from"./TasksSearchInput-CjnnmYfA.js";import{P as ss,G as ts}from"./index-Ckr8pn3D.js";import{S as es}from"./Sprints-DugkuosL.js";import{u as as}from"./useTasksData-Vq9uamq9.js";import{H as b}from"./tasks-ClycqzjK.js";import{G as S}from"./Grid-Vs4zvCUU.js";import"./IconChevronLeft-DwnMQlxZ.js";import"./modifiers.esm-C4X3-xc2.js";import"./IconUser-Bh9n--nN.js";import"./IconGripVertical-A4WphpSm.js";import"./useSprintDnd-Bl1igyj5.js";import"./useDnd-BDrl7hC3.js";import"./tasks-R9G1-k7v.js";import"./use-resize-observer-B2T5TxF-.js";import"./useTaskTypesData-DEDxUwkB.js";import"./Accordion-BmslGzqa.js";import"./get-base-value-JqT_q0U7.js";const rs=({project:s})=>{const{t:e}=p(),{taskKey:a}=y(i=>i.taskModalSlice),{data:n}=v(a);return t.jsx(b,{children:t.jsxs("title",{children:[n?n.Title:s.Name," | ",e("appName."+F)]})})},ns=({folder:s})=>{const e=N("light",{getInitialValueInEffect:!0})==="light";return t.jsx(A,{children:t.jsx(B,{fullWidth:!0,justify:"left",leftSection:t.jsx(D,{variant:"filled",radius:"sm",size:20,color:s.Color||"gray",children:t.jsx(R,{size:14})}),variant:"default",size:"md",fw:"normal",c:e?"black":"white",children:t.jsx(G,{children:s.Name})})})},j=()=>{const{t:s}=p();return t.jsxs(t.Fragment,{children:[t.jsx(b,{children:t.jsxs("title",{children:["404 | ",s("appName."+F)]})}),t.jsx(P,{title:s("404.title"),description:s("404.description",{entity:s("404.entities.page")}),illustration:"404",buttons:[{buttonText:s("404.goHome"),handleClick:()=>w.navigate("/")}]})]})},is=o.memo(({project:s})=>{const{t:e}=p(),a=H(s.rootProjectId||s.Id),n=o.useMemo(()=>{const i=[];return a.folders.create&&s.pathById.length<3&&i.push({buttonText:e("nodata.noFoldersSprints.action",{context:"folder"}),handleClick:()=>L(s)}),a.sprints.create&&i.push({buttonText:e("nodata.noFoldersSprints.action",{context:"sprint"}),handleClick:()=>M(s)}),i},[a.folders.create,a.sprints.create,s,e]);return t.jsx(P,{illustration:"emptyFolder",title:s.isFolder?e("nodata.emptyFolder"):e("nodata.emptyProject"),description:s.pathById.length<3?e("nodata.noFoldersSprints.description",{context:"both"}):e("nodata.noFoldersSprints.description",{context:"sprint"}),buttons:n})}),os=({projectId:s})=>{const{project:e,isFetching:a}=U(s);return a?t.jsx(z,{h:"calc(100vh - 81px)"}):e?t.jsx(ls,{project:e}):t.jsx(j,{})},ls=({project:s})=>{const e=Q(),a=y(r=>{var g;return(g=r.settingsSlice.projects[s.Id])==null?void 0:g.performerIds})||[],n=(s==null?void 0:s.Children)||[],i=(s==null?void 0:s.Sprints)||[],k=n.length>0||i.length>0;V.useGetByIdQuery({ids:(s==null?void 0:s.UserIds)||[]}),K.useGetAvailableStatusesQuery({entityType:(s==null?void 0:s.statusesEntityType)||0,entityIds:[(s==null?void 0:s.statusesEntityId)||0]},{skip:!s});const[l,h]=W(""),m=s.Id,{groupedBySprint:C,error:T,isError:E,isLoading:d,isFetching:c,refetch:x}=as({projectId:m,performerIds:a,search:l}),f=o.useRef([]);return o.useEffect(()=>{const r=s.Sprints||[];q(f.current,r)||(f.current=r,!d&&!c&&x())},[s.Sprints,d,c,x]),o.useEffect(()=>{l.length&&h("")},[m]),t.jsxs(t.Fragment,{children:[t.jsx(rs,{project:s}),t.jsxs(u,{gap:"lg",flex:1,children:[t.jsxs(I,{justify:"space-between",gap:16,align:"flex-start",children:[t.jsxs(I,{flex:1,style:{gap:"16px 24px"},children:[t.jsx(J,{value:l,onChange:h,loading:c}),t.jsx(ss,{selected:a,onSelect:r=>e(O({projectId:s.Id,performerIds:r})),projectId:s.rootProjectId})]}),t.jsx(ts,{})]}),t.jsx(u,{flex:1,gap:0,children:k?t.jsxs(u,{children:[!!n.length&&t.jsx(S,{overflow:"hidden",children:n.map(r=>t.jsx(S.Col,{span:"auto",children:t.jsx(X,{to:Y(Z.folder,{folderId:r.Id}),children:t.jsx(ns,{folder:r})})},r.Id))}),t.jsx(es,{sprints:i,groupedBySprint:C,error:T,isError:E,isLoading:d})]}):t.jsx(is,{project:s})})]})]})},Ts=()=>{const s=_("folderId");return s?t.jsx($,{projectId:s,children:t.jsx(os,{projectId:s})}):t.jsx(j,{})};export{Ts as default};
