import{O as y,j as e,A as b,I as N,r as m,G as w,bp as v,ag as F,cX as E,cY as G,cZ as B,c_ as V,c$ as $,d0 as A,b as _,an as R,aj as x,d1 as H,b_ as q,a2 as I,d2 as O,d3 as L,d4 as P,S as f,d5 as X,d6 as C,d7 as Y,d8 as K,q as M,D as U,d9 as W,da as Z,db as J,dc as Q,dd as ee,ce as te,de as k,n as se}from"./index-n-59FgrC.js";import{I as re}from"./IconChevronLeft-CyT72r93.js";import{I as ne}from"./IconGripVertical-Ce_4nROx.js";import{a as ae,I as ie}from"./IconUser-BvK8eLe8.js";import{r as oe}from"./modifiers.esm-V6KF7boE.js";/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const ce=[["path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]],le=y("outline","adjustments-horizontal","AdjustmentsHorizontal",ce);/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const de=[["path",{d:"M5 14h14l-4.5 -4.5l4.5 -4.5h-14v16",key:"svg-0"}]],ue=y("outline","flag-3","Flag3",de);/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const he=[["path",{d:"M5 9l14 0",key:"svg-0"}],["path",{d:"M5 15l14 0",key:"svg-1"}],["path",{d:"M11 4l-4 16",key:"svg-2"}],["path",{d:"M17 4l-4 16",key:"svg-3"}]],pe=y("outline","hash","Hash",he),ge=t=>e.jsx(b,{size:"sm",variant:"subtle",color:"gray.5",c:"light-dark(var(--mantine-color-dark-5), var(--mantine-color-dark-0))",...t,children:e.jsx(re,{})}),me=t=>e.jsx(b,{size:"sm",variant:"subtle",color:"gray.5",c:"light-dark(var(--mantine-color-dark-5), var(--mantine-color-dark-0))",...t,children:e.jsx(N,{})}),xe="_menuItem_1igh0_1",fe="_field_1igh0_15",je="_icon_1igh0_23",ke="_label_1igh0_24",ve="_grip_1igh0_30",ye="_switchInput_1igh0_50",be="_switchTrack_1igh0_50",we="_switchThumb_1igh0_55",g={menuItem:xe,field:fe,icon:je,label:ke,switch:"_switch_1igh0_25",grip:ve,switchInput:ye,switchTrack:be,switchThumb:we},S=m.forwardRef(({id:t,icon:s,label:i,value:r,disabled:a,keepOrder:c,gripProps:l,onChange:n,...o},u)=>e.jsxs(w,{ref:u,className:g.field,gap:8,"data-disabled":a,...o,children:[r&&e.jsx(v,{variant:"transparent",size:"sm",className:g.grip,"data-keep-order":c,...l,children:e.jsx(ne,{})}),e.jsx(v,{variant:"transparent",size:"sm",className:g.icon,children:s}),e.jsx(F,{className:g.label,children:i}),e.jsx(E,{className:g.switch,classNames:{input:g.switchInput,track:g.switchTrack,thumb:g.switchThumb},size:"xs",checked:r,disabled:a,onChange:h=>n==null?void 0:n(t,h.currentTarget.checked)})]})),_e=()=>{const{active:t}=G();return t!=null&&t.data.current?e.jsx(B,{children:e.jsx(V,{children:e.jsx(S,{...t.data.current})})}):null},Se=({onChange:t,...s})=>{const{attributes:{tabIndex:i,...r},listeners:a,setNodeRef:c,transform:l,transition:n,isDragging:o}=$({id:s.id,data:s});return e.jsx(S,{ref:c,style:{transform:A.Transform.toString(l),transition:n,opacity:o?.5:1},gripProps:{...r,...a},onChange:t,...s})},Ie=()=>{const{t}=_(),{generic:s,attributes:i,isKanban:r,onChange:a}=R({skipAttributesCheck:!0}),[c,l]=m.useState([]);m.useEffect(()=>{const u=Object.entries(Te[r?"kanban":"list"]).map(([d,p])=>({...p,id:d,label:t(`sprintViewSettings.fields.${d}`),icon:Ce[d]}));u.push(...x(i,"Order").map(d=>({id:String(d.Id),label:d.Name,value:!1,icon:H[d.ValueType]})));const j=u.map((d,p)=>({...d,order:p})).map(d=>{const p=s[d.id];return p?{...d,order:p.order,value:p.display}:d});l(x(j,"order"))},[i,s,r,t]);const n=m.useCallback(o=>{l(u=>{const h=typeof o=="function"?o(u):o;return q(h,u)?u:(a(h.reduce((j,{id:d,order:p,value:z})=>({...j,[d]:{order:p,display:z}}),{})),x(h,"order"))})},[a]);return[c,n]},Ce={type:e.jsx(P,{}),code:e.jsx(pe,{}),name:e.jsx(L,{}),status:e.jsx(O,{}),priority:e.jsx(ue,{}),performer:e.jsx(ae,{}),startDate:e.jsx(I,{}),dueDate:e.jsx(I,{})},Te={list:{type:{value:!0,keepOrder:!0},code:{value:!0,keepOrder:!0},name:{value:!0,disabled:!0,keepOrder:!0},status:{value:!0},priority:{value:!0},performer:{value:!0},startDate:{value:!1},dueDate:{value:!1}},kanban:{name:{value:!0,disabled:!0,keepOrder:!0},type:{value:!0,keepOrder:!0},code:{value:!0,keepOrder:!0},priority:{value:!0,keepOrder:!0},performer:{value:!0,keepOrder:!0},startDate:{value:!1,keepOrder:!0},dueDate:{value:!0,keepOrder:!0}}},De="_container_uh8u4_1",Oe={container:De},Me=()=>{const{t}=_(),[s,i]=Ie(),r=m.useCallback((a,c)=>{const l=ze(s,{from:a,to:c});i(l)},[s,i]);return e.jsxs(f,{className:Oe.container,mr:-10,children:[e.jsx(T,{title:t("sprintViewSettings.fieldGroups.visible"),fields:s.filter(a=>a.value),onChange:i,onOrder:r}),e.jsx(T,{title:t("sprintViewSettings.fieldGroups.hidden"),fields:s.filter(a=>!a.value),onChange:i})]})},T=({title:t,fields:s,onChange:i,onOrder:r})=>{const a=X(C(K,Ne),C(Y,Fe)),c=m.useCallback((n,o)=>{i(u=>u.map(h=>h.id===n?{...h,value:o}:h))},[i]),l=m.useCallback(n=>{n.over&&(r==null||r(String(n.active.id),String(n.over.id)))},[r]);return s.length?e.jsxs(f,{gap:4,children:[e.jsx(M,{fz:12,c:"gray.6",mb:4,children:t}),e.jsxs(U,{sensors:a,onDragEnd:l,modifiers:[oe],collisionDetection:W,children:[e.jsx(Z,{items:s,strategy:J,children:s.map(n=>{const o=n.keepOrder?S:Se;return e.jsx(o,{...n,onChange:c},n.id)})}),e.jsx(_e,{})]})]}):null},ze=(t,{from:s,to:i})=>{const r=x(t,"order"),a=r.findIndex(n=>n.id===s),c=r.findIndex(n=>n.id===i),l=r[a];return r.splice(a,1),r.splice(c,0,l),r.map((n,o)=>({...n,order:o}))},Ne={activationConstraint:{distance:10}},Fe={activationConstraint:{delay:150,tolerance:5}},Ee=({icon:t,label:s,onClick:i})=>e.jsxs(w,{gap:8,className:g.menuItem,onClick:i,children:[e.jsx(v,{variant:"transparent",size:"sm",c:"inherit",children:t}),e.jsx(M,{fz:14,flex:1,children:s})]}),qe=()=>{const{t}=_(),s=Q(),{handleDownload:i}=ee({sprint:s??void 0}),[r,a]=m.useState(s?"root":"fields"),[c,{toggle:l,close:n}]=te(!1,{onClose:()=>{s&&setTimeout(()=>a("root"),100)}});return e.jsxs(k,{opened:c,onChange:l,width:300,floatingStrategy:"fixed",middlewares:Be,children:[e.jsx(k.Target,{children:e.jsx(b,{variant:"default",size:"lg","aria-label":"Settings",onClick:l,children:e.jsx(le,{style:{width:"50%",height:"50%"},stroke:1.5})})}),e.jsx(k.Dropdown,{children:e.jsxs(f,{gap:16,h:"100%",children:[e.jsxs(w,{justify:"space-between",children:[s&&r!=="root"&&e.jsx(ge,{onClick:()=>a("root")}),e.jsx(se,{order:3,fz:16,fw:500,children:t(`sprintViewSettings.tabs.${r}`)}),e.jsx(me,{onClick:n})]}),r==="root"&&e.jsx(f,{gap:0,children:["fields","export"].map(o=>e.jsx(Ee,{icon:Ge[o],label:t(`sprintViewSettings.tabs.${o}`),onClick:()=>{o==="export"?(i(),n()):a(o)}},o))}),r==="fields"&&e.jsx(Me,{})]})})]})},Ge={fields:e.jsx(O,{}),export:e.jsx(ie,{})},D=t=>{const r=t.y+t.height+8;return Math.max(65,r)},Be={shift:{padding:0,crossAxis:!0,limiter:{fn:({x:t,rects:s})=>({x:t,y:D(s.reference)})}},size:{apply:async({elements:t,platform:s,strategy:i,rects:r})=>{const a=await s.getClippingRect({element:t.floating,boundary:"clippingAncestors",rootBoundary:"viewport",strategy:i}),c=D(r.reference);Object.assign(t.floating.style,{height:`${a.height-c}px`})}}};export{qe as G,ue as I,le as a};
