@libxai/board 1.5.27 → 1.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
}
|
|
366
366
|
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${yt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:nt,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsxRuntime.jsx(sm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:z},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>p(L=>!L),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:L=>{L.currentTarget.style.background=q,L.currentTarget.style.color=S;},onMouseLeave:L=>{L.currentTarget.style.background="transparent",L.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Tv,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:L=>{L.currentTarget.style.background=q,L.currentTarget.style.color=S;},onMouseLeave:L=>{L.currentTarget.style.background="transparent",L.currentTarget.style.color=ne;},children:jsxRuntime.jsx(Cv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((L,G)=>jsxRuntime.jsx("button",{onClick:()=>le(L),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:re,border:`1px solid ${W}`},onMouseEnter:de=>{de.currentTarget.style.borderColor=Ue,de.currentTarget.style.color="#2E94FF";},onMouseLeave:de=>{de.currentTarget.style.borderColor=W,de.currentTarget.style.color=re;},children:L.length>30?L.slice(0,30)+"...":L},G))})]}),g.map(L=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${L.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${L.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:L.role==="user"?Ne:Fe,color:L.role==="user"?"#2E94FF":lt,border:L.role==="user"?`1px solid ${ze}`:`1px solid ${Ke}`},children:[L.isLoading?jsxRuntime.jsx(Nv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content}),L.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:L.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:L.command.success?"#10B981":"#EF4444",border:`1px solid ${L.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[L.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:L.command.type.replace(/_/g," ")})]})]})},L.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:L=>{if(I&&Ee.length>0){L.preventDefault();return}M(L);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&Ee.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Lt,border:`1px solid ${We}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:Ee.map((L,G)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ve(L),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===P?pt:"transparent",color:ie},onMouseEnter:()=>te(G),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:A,border:`1px solid ${K}`,color:"#2E94FF"},children:L.name.split(" ").map(de=>de[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:L.name}),L.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:be},children:L.email})]})]},L.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${Ze}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:b,onChange:L=>Ye(L.target.value),onKeyDown:L=>{Oe(L);},placeholder:Re,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:zt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Ct:"transparent",color:b.trim()?"#2E94FF":wt,border:b.trim()?`1px solid ${ht}`:"1px solid transparent"},children:jsxRuntime.jsx(kv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function im(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Fv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Pe.formatDate(e.startDate)} - ${Pe.formatDate(e.endDate)}`);let a=Pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dm(e){return {...Fv,...e}}var Ov=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},pm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:h,persistFilter:b,clearFiltersKey:x,aiAssistant:f,locale:y="en",customTranslations:w,showCreateTaskButton:v=false,createTaskLabel:T,onCreateTask:C,taskFilter:D,onTaskFilterChange:k,toolbarRightContent:I,showBaseline:$,viewMode:P,onViewModeChange:te,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:J,onTaskContextMenu:ee,onTaskUpdate:Re,onDependentTasksScheduled:B,onProgressChange:Y,onTaskEdit:ye,onTaskAddSubtask:Ge,onTaskMarkIncomplete:U,onTaskSetInProgress:oe,onDependencyCreate:Z,onDependencyDelete:Se,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:He,onAfterTaskUpdate:et,onBeforeTaskDelete:ae,onAfterTaskDelete:Xe,permissions:pe,onCopySnapshotLink:at}=a,Pt=react.useContext(ti)?.theme,[Ce,yt]=react.useState(Pt||s||"dark"),[nt,Je]=react.useState(n),[z,ne]=react.useState(i),[S,q]=react.useState(1),[ce,Te]=react.useState("all"),[W,re]=react.useState(P||"execution"),Ue=P??W,Ne=react.useCallback(E=>{re(E),te?.(E);},[te]),ze=$??Ue==="oracle",[Fe,Ke]=react.useState(a.showCriticalPath!==false),[lt,ut]=react.useState(a.showDependencies!==false),[st,Ze]=react.useState(a.highlightWeekends!==false),zt=react.useCallback(E=>{Ke(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),Ct=react.useCallback(E=>{ut(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),ht=react.useCallback(E=>{Ze(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(nt);},[nt]),react.useEffect(()=>{a.onZoomChange?.(S);},[S]);let wt=react.useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let rt=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Lt,We]=react.useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(E);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Be=D??Lt,pt=k??We,[ie,be]=react.useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(E);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=rt();if(E)try{let R={taskFilter:Be,hideCompleted:ie};localStorage.setItem(E,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,ie,rt]);let A=react.useRef(x);react.useEffect(()=>{if(A.current!==x&&x!==void 0){We("all"),be(false);let E=rt();if(E)try{localStorage.removeItem(E);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}A.current=x;},[x,rt]);let[K,X]=react.useState(0),[me,Ee]=react.useState(false),[Ye,Ve]=react.useState(null),[Oe,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,M]=react.useState(null),[le,fe]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==Ce&&yt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==Ce&&yt(s);},[s]);let L=react.useCallback(E=>{yt(E),H?.(E);},[H]),{state:G,setState:de,undo:N,redo:j,canUndo:xe,canRedo:Le,clearHistory:Qe}=im(t,50),tt=react.useMemo(()=>{let E=(R,_=0)=>{let Q=_;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,E(ve.subtasks,_+1)));return Q};return E(G)+1},[G]),xt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Rt=react.useRef(new Map),na=react.useRef(false);if(!na.current&&h){na.current=true;let E=typeof h=="string"?h:"gantt-expanded-tasks";try{let R=localStorage.getItem(E);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Rt.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ot=react.useCallback(()=>{let E=xt();if(E)try{let R=Array.from(Rt.current.entries());localStorage.setItem(E,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[xt]),_a=react.useRef(0),cr=react.useRef(G);react.useEffect(()=>{cr.current=G;},[G]);let Ka=react.useRef(false),Pn=react.useCallback(E=>{Te(E),_a.current+=1,de(R=>{let _=(ve,Me=0)=>ve.map(kt=>{let ot=E==="all"||Me<E-1;return kt.subtasks?.length&&Rt.current.set(kt.id,ot),{...kt,isExpanded:ot,subtasks:kt.subtasks?_(kt.subtasks,Me+1):void 0}}),Q=_(R);return Ot(),Q});},[de,Ot]);react.useEffect(()=>{if(_a.current>0){_a.current-=1;return}let E=_=>{let Q=new Map;for(let ve of _){let Me=ve.id;Q.get(Me)||Q.set(Me,ve);}return Array.from(Q.values())},R=_=>_.map(Q=>{let ve=Rt.current.get(Q.id),Me=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Me.subtasks?.length){let kt=E(Me.subtasks);return {...Me,subtasks:R(kt)}}return Me});if(Rt.current.size>0)de(vr(R(t)));else {let _=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:E(_(ve.subtasks))}:ve);de(vr(_(t)));}},[t,de]);let vs=react.useRef(t),Pc=react.useRef(true);react.useEffect(()=>{if(Pc.current){Pc.current=false,vs.current=G;return}if(Ka.current){Ka.current=false,vs.current=G;return}if(!r)return;let E=JSON.stringify(vs.current),R=JSON.stringify(G);E!==R&&(vs.current=G,r(G));},[G,r]);let Ya=react.useMemo(()=>dd(y,w),[y,w]),G0=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[qo,Qi]=react.useState(()=>G0(Ya));react.useEffect(()=>{Qi(E=>E.map(R=>({...R,label:Ya.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ya]);let ws=react.useMemo(()=>qo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[qo]),Ac=react.useRef(qo.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=qo.filter(Q=>Q.visible),R=E.map(Q=>Q.id).join(","),_=Ac.current;if(R!==_){let Q=E.some(Me=>Me.id!=="name"),ve=_.includes(",");Q?!ve&&Q&&Ve(null):Ve(null),Ac.current=R;}},[qo]);let Lc=60,Ic=.6,_0=react.useMemo(()=>{let R=ws+Lc,_=typeof window<"u"?window.innerWidth*Ic:800,Q=Math.max(R,_);return Ye!==null?Math.max(200,Math.min(Ye,Q)):Math.max(200,R)},[Ye,ws]),no=react.useRef(null),ks=react.useRef(null),Or=react.useRef(null),An=react.useRef(null),ra=react.useMemo(()=>Mp(Ce),[Ce]),j0=react.useMemo(()=>({theme:ra,themeName:Ce}),[ra,Ce]),Bc=react.useMemo(()=>dm(p),[p]),Zi=react.useMemo(()=>{if(!g)return G;let E=Pe.calculateCriticalPathFull(G),R=_=>_.map(Q=>{let ve=E.get(Q.id),Me=Q.subtasks?R(Q.subtasks):void 0,kt=Me?.some(ma=>ma.isCriticalPath||ma.subtasks&&ma.subtasks.some(Ut=>Ut.isCriticalPath))||false,ot=ve?ve.isCritical:kt;return {...Q,isCriticalPath:ot,cpmData:ve||void 0,subtasks:Me}});return R(G)},[G,g]),K0=react.useMemo(()=>Pe.flattenTasks(G).some(R=>R.dependencies&&R.dependencies.length>0),[G]),Rc=react.useMemo(()=>{if(Be==="all"&&!ie)return Zi;let E=R=>{let _=[];for(let Q of R){let ve=Q.subtasks?.length?E(Q.subtasks):void 0,Me=false;if(ie)Me=Q.progress<100;else switch(Be){case "all":Me=true;break;case "incomplete":Me=Q.progress<100;break;case "in_progress":Me=Q.progress>0&&Q.progress<100;break;case "completed":Me=Q.progress===100;break}(Me||ve&&ve.length>0)&&_.push({...Q,subtasks:ve});}return _};return E(Zi)},[Zi,Be,ie]),Cs=Ov(z);lm({undo:N,redo:j,canUndo:xe,canRedo:Le,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>Pe.findTaskById(G,E),addTask:(E,R)=>{de(_=>{if(!R)return [..._,{...E,level:0}];let Q=ve=>ve.map(Me=>Me.id===R?{...Me,subtasks:[...Me.subtasks||[],{...E,parentId:R,level:(Me.level||0)+1}],isExpanded:true}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},updateTask:(E,R)=>{de(_=>{let Q=ve=>ve.map(Me=>Me.id===E?{...Me,...R}:Me.subtasks?{...Me,subtasks:Q(Me.subtasks)}:Me);return Q(_)});},deleteTask:E=>{de(R=>{let _=Q=>Q.filter(ve=>ve.id===E?false:(ve.subtasks&&(ve.subtasks=_(ve.subtasks)),true));return _(R)});},deleteTasks:E=>{de(R=>bd(R,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let R=Pe.findTaskById(G,E);R&&a.onTaskDuplicate(R);}else de(R=>Jn(R,[E]).tasks);},splitTask:(E,R,_=3)=>{de(Q=>Pe.splitTask(Q,E,R,_));},calculateEndDate:Pe.calculateEndDate,calculateDuration:Pe.calculateDuration,validateDependency:(E,R)=>!Pe.validateDependencies(G,E,R),getAllTasks:()=>Pe.flattenTasks(G),getTasksByStatus:E=>Pe.flattenTasks(G).filter(R=>R.status===E),getTasksByParent:E=>E?Pe.findTaskById(G,E)?.subtasks||[]:G.filter(_=>!_.parentId),getCriticalPath:()=>Pe.flattenTasks(G).filter(E=>E.isCriticalPath),indentTask:E=>{de(R=>vr(md(R,[E])));},outdentTask:E=>{de(R=>vr(gd(R,[E])));},moveTask:(E,R)=>{de(_=>fd(_,[E],R));},createSubtask:async E=>{let{tasks:R,newTask:_}=xd(G,E);if(ke){let Q=ke({..._,parentId:E});if((Q instanceof Promise?await Q:Q)===false)return}de(vr(R)),Ie&&Ie({..._,parentId:E});},scrollToTask:E=>{let _=Pe.flattenTasks(G).findIndex(Q=>Q.id===E);if(_!==-1&&no.current){let Q=_*Cs;no.current.scrollTo({top:Q,behavior:"smooth"}),Or.current&&Or.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(E,R=2e3)=>{},expandTask:E=>{de(R=>{let _=Q=>Q.map(ve=>ve.id===E?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},collapseTask:E=>{de(R=>{let _=Q=>Q.map(ve=>ve.id===E?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},expandAll:()=>{de(E=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(E)});},collapseAll:()=>{de(E=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(E)});},collapseToLevel:E=>{Pn(E);},undo:N,redo:j,canUndo:()=>xe,canRedo:()=>Le,clearHistory:Qe,exportToPNG:async()=>{if(!An.current||!no.current||!Or.current)throw new Error("Gantt container not found");let E=An.current,R=no.current,_=ks.current||R.querySelector(".gantt-grid-scroll"),Q=Or.current,ve=_?.scrollTop||0,Me=Q.scrollTop,kt=E.style.overflow,ot=E.style.height,ma=R.style.overflow;try{let Ut=_?.querySelector(".gantt-taskgrid-content"),ea=Q.querySelector("svg"),ja=Ut?.scrollHeight||_?.scrollHeight||600,ur=ea?.getBoundingClientRect().height||Q.scrollHeight,Fo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ja,ur)+20;_&&(_.scrollTop=0),Q.scrollTop=0,E.style.overflow="visible",E.style.height=`${Fo}px`,R.style.overflow="visible",await new Promise(en=>setTimeout(en,100));let $r=await htmlToImage.toPng(E,{backgroundColor:ra.bgPrimary,pixelRatio:2,filter:en=>{if(!(en instanceof Element))return !0;let Ts=window.getComputedStyle(en),In=parseInt(Ts.zIndex,10);return (isNaN(In)||In<50)&&Ts.position!=="fixed"}});return await(await fetch($r)).blob()}finally{E.style.overflow=kt,E.style.height=ot,R.style.overflow=ma,_&&(_.scrollTop=ve),Q.scrollTop=Me;}},exportToPDF:async E=>{await Pe.exportToPDF(G,E);},exportToExcel:async E=>{await Pe.exportToExcel(G,E,{rateMap:a.rateMap,defaultRate:a.defaultRate});},exportToJSON:()=>Pe.exportToJSON(G),exportToCSV:()=>Pe.exportToCSV(G),importFromJSON:E=>{let R=Pe.importFromJSON(E);de(R);},getTasks:()=>G,refresh:()=>{de(E=>[...E]);},clearAll:()=>{de([]);}}),[G,N,j,xe,Le,Qe,ra,Cs]);let Y0=react.useCallback(E=>{Qi(R=>R.map(_=>_.id===E?{..._,visible:!_.visible}:_));},[]),q0=react.useCallback((E,R)=>{Qi(_=>_.map(Q=>{if(Q.id!==E)return Q;let ve=Q.minWidth??100,Me=Q.maxWidth??800,kt=Math.max(ve,Math.min(Me,R));return {...Q,width:kt}}));},[]),X0=react.useCallback(E=>{de(R=>{let _=yd(R,E),Q=ve=>{for(let Me of ve){if(Me.id===E){Rt.current.set(E,Me.isExpanded??true);return}Me.subtasks?.length&&Q(Me.subtasks);}};return Q(_),Ot(),_}),a.onTaskToggleExpand?.(E);},[a,Ot]),Xo=react.useCallback((E,R)=>{if(He&&He(E,R)===false)return;let Q=Pe.findTaskById(G,E)?.progress,ve=kt=>kt.map(ot=>ot.id===E?{...ot,...R}:ot.subtasks?{...ot,subtasks:ve(ot.subtasks)}:ot);de(ve(G));let Me=Pe.findTaskById(ve(G),E);Me&&(Re?.(Me),et?.(Me),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&Y?.(E,Q,R.progress));},[G,Re,He,et,Y]),J0=react.useCallback(E=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(R=>vr(md(R,E))),a.onTaskIndent?.(E[0]));},[a]),Q0=react.useCallback(E=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(R=>vr(gd(R,E))),a.onTaskOutdent?.(E[0]));},[a]),Z0=react.useCallback((E,R,_)=>{_a.current+=1,Ka.current=true,de(Q=>vr(Yp(Q,E,R,_))),a.onTaskReparent?.(E,R,_);},[a]),ef=react.useCallback((E,R)=>{E.length!==0&&(_a.current+=1,Ka.current=true,de(_=>fd(_,E,R)),a.onTaskMove?.(E[0],R));},[a]),el=react.useCallback(async E=>{let R=[];for(let _ of E)ae&&await Promise.resolve(ae(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(de(_=>vr(bd(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),Xe&&R.forEach(_=>Xe(_)));},[a,ae,Xe]),tf=react.useCallback(E=>{a.onTaskDuplicate?E.forEach(R=>{let _=Pe.findTaskById(G,R);_&&a.onTaskDuplicate(_);}):de(R=>Jn(R,E).tasks);},[a,G]),af=react.useCallback((E,R)=>{de(_=>{let{tasks:Q,newTask:ve}=Kp(_,E,R);return ke&&ke(ve)===false?_:(a.onTaskCreate?.(ve.parentId,ve.position||0),Ie?.(ve),Q)});},[a,ke,Ie]),rf=react.useCallback((E,R)=>{de(_=>hd(_,E,R)),a.onTaskRename?.(E,R);},[a]),tl=react.useCallback(E=>{let{onTaskAddSubtask:R}=a;if(R){let _=li(G,E);if(_){R(_);return}}de(_=>{let{tasks:Q}=xd(_,E);return a.onTaskCreate?.(E,0),Q});},[a,G]),of=react.useCallback((E,R,_)=>{let Q=!E.startDate&&!E.endDate,ve=E.startDate?Math.round((R.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Me=Ut=>Ut.map(ea=>ea.id===E.id?{...ea,startDate:R,endDate:_,...E.segments&&{segments:E.segments}}:ea.subtasks?{...ea,subtasks:Me(ea.subtasks)}:ea),kt=Me(G),ot=kt;kt=Pe.autoScheduleDependents(kt,E.id,ve),kt=vr(kt),de(kt);let ma={...E,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(E,R,_):Re?.(ma),B&&ve!==0){let Ut=Pe.flattenTasks(ot),ea=Pe.flattenTasks(kt),ja=[];for(let ur of ea){if(ur.id===E.id)continue;let so=Ut.find($r=>$r.id===ur.id);if(!so)continue;let Zo=ur.startDate?.getTime()!==so.startDate?.getTime(),Fo=ur.endDate?.getTime()!==so.endDate?.getTime();(Zo||Fo)&&ja.push(ur);}ja.length>0&&B(ja);}},[G,Re,B,a]),nf=react.useCallback((E,R)=>{ee?.(E,R),bt({isOpen:true,x:R.clientX,y:R.clientY,task:E});},[ee]),sf=react.useCallback((E,R)=>{let _=Pe.splitTask(G,E.id,R);de(_),bt({isOpen:false,x:0,y:0,task:null});},[G]),Oc=react.useCallback(E=>{let R=Pe.findTaskById(G,E.id)||E;J?.(R),ye||M(R);},[G,J,ye]),$c=react.useCallback((E,R,_)=>{let Q=new Map,ve=Ut=>{Ut.forEach(ea=>{ea.dependencies&&Q.set(ea.id,ea.dependencies),ea.subtasks&&ve(ea.subtasks);});};ve(_);let Me=Q.get(R)||[];Q.set(R,[...Me,E]);let kt=new Set,ot=new Set,ma=Ut=>{if(!kt.has(Ut)){kt.add(Ut),ot.add(Ut);let ea=Q.get(Ut)||[];for(let ja of ea){if(!kt.has(ja)&&ma(ja))return true;if(ot.has(ja))return true}}return ot.delete(Ut),false};return ma(R)},[]),Hc=react.useCallback((E,R)=>{if($c(E.id,R,cr.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let _=Q=>Q.map(ve=>{if(ve.id===R){let Me=ve.dependencies||[];if(!Me.includes(E.id))return {...ve,dependencies:[...Me,E.id]}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Z?.(E.id,R);},[Z,$c]),zc=react.useCallback((E,R)=>{let _=Q=>Q.map(ve=>{if(ve.id===E&&ve.dependencies){let Me=ve.dependencies.filter(kt=>kt!==R);return {...ve,dependencies:Me}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Se?.(E,R);},[Se]),{startDate:Jo,endDate:al}=react.useMemo(()=>{let E=G.filter(Me=>Me.startDate&&Me.endDate);if(E.length===0){let Me=new Date,kt=new Date(Me);kt.setDate(kt.getDate()-30);let ot=new Date(Me);return ot.setDate(ot.getDate()+60),{startDate:kt,endDate:ot}}let R=E.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),_=new Date(Math.min(...R.map(Me=>Me.getTime()))),Q=new Date(Math.max(...R.map(Me=>Me.getTime()))),ve=nt==="day"?7:nt==="week"?14:30;return _.setDate(_.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:_,endDate:Q}},[G,nt]);react.useEffect(()=>{wt.current?.(Jo,al);},[Jo,al]);let lf=react.useCallback(async()=>{if(!An.current||!no.current||!Or.current)return;await new Promise(Fo=>setTimeout(Fo,200));let E=An.current,R=no.current,_=ks.current||R.querySelector(".gantt-grid-scroll"),Q=Or.current,ve=_?.scrollTop||0,Me=_?.scrollLeft||0,kt=Q.scrollTop,ot=Q.scrollLeft,ma=E.style.overflow,Ut=E.style.height,ea=_?.style.overflow||"",ja=Q.style.overflow,ur=R.style.overflow,so=E.style.width,Zo=Q.style.width;try{let Fo=_?.querySelector(".gantt-taskgrid-content"),$r=Q.querySelector("svg"),ol=$r?.getAttribute("height")?parseInt($r.getAttribute("height"),10):$r?.getBoundingClientRect().height||0,en=Fo?.scrollHeight||_?.scrollHeight||600,Ts=Math.max(ol,Q.scrollHeight),In=$r?.getAttribute("width")?parseInt($r.getAttribute("width"),10):$r?.getBoundingClientRect().width||Q.scrollWidth,bf=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,nl=Math.max(en,Ts,ol),Vc=bf+nl+50,Gc=(_?.offsetWidth||R.offsetWidth||300)+In+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Vc}px`,E.style.width=`${Gc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${nl+50}px`),Q.style.overflow="visible",Q.style.height=`${nl+50}px`,Q.style.width=`${In+10}px`,await new Promise(Ns=>setTimeout(Ns,150));let hf=await htmlToImage.toPng(E,{backgroundColor:ra.bgPrimary,pixelRatio:2,width:Gc,height:Vc,skipFonts:!1,filter:Ns=>{if(!(Ns instanceof Element))return !0;let _c=window.getComputedStyle(Ns),jc=parseInt(_c.zIndex,10);return !(!isNaN(jc)&&jc>=50||_c.position==="fixed")}}),sl=document.createElement("a");sl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,sl.href=hf,sl.click();}finally{E.style.overflow=ma,E.style.height=Ut,E.style.width=so,R.style.overflow=ur,_&&(_.style.overflow=ea,_.style.height="",_.scrollTop=ve,_.scrollLeft=Me),Q.style.overflow=ja,Q.style.height="",Q.style.width=Zo,Q.scrollTop=kt,Q.scrollLeft=ot;}},[ra]),df=react.useCallback(async()=>{await Pe.exportToPDF(G);},[G]),cf=react.useCallback(async()=>{let E=new Date,R=ve=>String(ve).padStart(2,"0"),_=`${E.getFullYear()}-${R(E.getMonth()+1)}-${R(E.getDate())}_${R(E.getHours())}${R(E.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(G,`${Q}_${_}.xlsx`,{rateMap:a.rateMap,defaultRate:a.defaultRate});},[G,m]),uf=react.useCallback(()=>{let E=Pe.exportToCSV(G),R=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[G]),pf=react.useCallback(()=>{let E=Pe.exportToJSON(G),R=new Blob([E],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[G]),mf=react.useCallback(()=>{Pe.exportToMSProject(G,"Gantt Project","project.xml");},[G]),gf=E=>{E.preventDefault(),Ee(true);},Qo=react.useRef(false),[rl,Uc]=react.useState(false),Ln=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Or.current,R=no.current?.querySelector(".gantt-grid-scroll");if(!E||!R)return;let _=()=>{if(Qo.current)return;Qo.current=true;let ot=E.scrollTop;X(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},Q=()=>{if(Qo.current)return;Qo.current=true;let ot=R.scrollTop;X(ot),E.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},ve=ot=>{if(me&&R){let Ut=R.parentElement?.getBoundingClientRect()?.left||0,ea=ot.clientX-Ut,ja=200,ur=ws+Lc,so=window.innerWidth*Ic,Zo=Math.max(ur,so);ea>=ja&&ea<=Zo&&Ve(ea);}if(rl&&E){let ma=ot.clientX-Ln.current.x,Ut=ot.clientY-Ln.current.y;E.scrollLeft=Ln.current.scrollLeft-ma,E.scrollTop=Ln.current.scrollTop-Ut;}},Me=()=>{Ee(false),Uc(false);},kt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(Uc(true),Ln.current={x:ot.clientX,y:ot.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ot.preventDefault());};return E.addEventListener("scroll",_),R.addEventListener("scroll",Q),E.addEventListener("mousedown",kt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Me),()=>{E.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),E.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Me);}},[me,rl,ws]);let Wc=react.useRef(false),ff=react.useRef(null);return react.useLayoutEffect(()=>{if(Wc.current||G.length===0||!Or.current)return;Wc.current=true,ff.current=Jo;let E=Or.current,R=new Date,_=nt==="day"?60:nt==="week"?20:8,Q=(R.getTime()-Jo.getTime())/(1e3*60*60*24),ve=E.clientWidth,kt=Q*_*S-ve/2;Q>=0&&ve>0&&(E.scrollLeft=Math.max(0,kt));},[G.length,Jo,nt,S]),jsxRuntime.jsx(gn.Provider,{value:Ya,children:jsxRuntime.jsx(ul.Provider,{value:j0,children:jsxRuntime.jsxs("div",{ref:An,className:"flex flex-col h-full w-full",style:{backgroundColor:ra.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ra.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ra.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(si,{theme:ra,timeScale:nt,onTimeScaleChange:Je,zoom:S,onZoomChange:q,currentTheme:Ce,onThemeChange:L,rowDensity:z,onRowDensityChange:ne,showThemeSelector:c,showCreateTaskButton:v&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:C,taskFilter:Be,onTaskFilterChange:pt,hideCompleted:ie,onHideCompletedChange:be,toolbarRightContent:I,wbsLevel:ce,onWbsLevelChange:Pn,maxWbsDepth:tt,viewMode:Ue,onViewModeChange:Ne,projectForecast:O,onExportPNG:l?lf:void 0,onExportPDF:l?df:void 0,onExportExcel:l?cf:void 0,onExportCSV:l?uf:void 0,onExportJSON:l?pf:void 0,onExportMSProject:l?mf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:zt,showDependencies:lt,onShowDependenciesChange:Ct,highlightWeekends:st,onHighlightWeekendsChange:ht,showBaseline:ze,onShowBaselineChange:E=>{E&&Ue!=="oracle"&&Ne("oracle"),!E&&Ue==="oracle"&&Ne("execution");},onCopySnapshotLink:at,hasDependencies:K0})}),jsxRuntime.jsxs("div",{ref:no,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ks,className:"gantt-grid-scroll flex-shrink-0",style:{width:_0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ci,{tasks:Rc,theme:ra,rowHeight:Cs,availableUsers:d,templates:Bc,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:ee,onTaskToggle:X0,scrollTop:K,columns:qo,onToggleColumn:Y0,onColumnResize:q0,onTaskUpdate:Xo,onTaskIndent:J0,onTaskOutdent:Q0,onTaskMove:ef,onMultiTaskDelete:el,onTaskDuplicate:tf,onTaskCreate:af,onTaskRename:rf,onCreateSubtask:tl,onOpenTaskModal:F?E=>F(E):void 0,onDeleteRequest:(E,R)=>fe({taskId:E,taskName:R}),onTaskReparent:Z0,scrollContainerRef:ks})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ra.border,zIndex:15},onMouseDown:gf}),jsxRuntime.jsx("div",{ref:Or,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:rl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(vi,{tasks:Rc,theme:ra,rowHeight:Cs,timeScale:nt,startDate:Jo,endDate:al,zoom:S,locale:y,templates:Bc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:nf,onTaskDateChange:of,onDependencyCreate:Hc,onDependencyDelete:zc,showBaseline:ze,showCriticalPath:Fe,showDependencies:lt,highlightWeekends:st,canEditTask:pe?.canEditTask})})]}),Oe.task&&jsxRuntime.jsx(hn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:ra,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Oe.task;if(!E)return [];let R=Pe.findTaskById(G,E.id)||E,_=R.subtasks&&R.subtasks.length>0,Q=pe?.canCreateTask!==false,ve=pe?.canDeleteTask!==false;if(_){let Ut=[],ea=pe?.canDuplicateTask!==false;return Q&&Ut.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ea&&Ut.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(ja=>Jn(ja,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),ve&&(Ut.length>0&&Ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ut.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),Ut}let Me=pe?.canUpdateTask!==false,kt=pe?.canDuplicateTask!==false,ot=[];return Me&&ot.push({id:"edit",label:Ya.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{ye?ye(R):M(R);}}),Q&&ot.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ot.length>0&&Me&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(ot.push({id:"markIncomplete",label:Ya.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{U?U(R):Xo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ya.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{oe?oe(R):Xo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ya.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{Xo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Me&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&ot.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(Ut=>Jn(Ut,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Me&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ya.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{let Ut=R.startDate.getTime(),ea=R.endDate.getTime(),ja=Ut+(ea-Ut)/2,ur=new Date(ja);sf(R,ur);}}),ve&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(Jr,{task:gt,isOpen:!!gt,onClose:()=>M(null),onTaskUpdate:E=>{gt&&(Xo(gt.id,E),M(null));},theme:Ce==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>fe(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ra.bgSecondary,border:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ra.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:ra.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ya.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ra.textPrimary},children:['"',le.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ra.bgPrimary,borderTop:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=ra.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{el([le.taskId]),fe(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ci,{tasks:G,theme:ra,config:f,onTasksUpdate:de,onTaskUpdate:Xo,onTaskCreate:E=>{de(R=>[...R,E]);},onTaskDelete:E=>{el([E]);},onDependencyCreate:(E,R)=>{let _=Pe.findTaskById(G,E);_&&Hc(_,R);},onDependencyDelete:zc})]})})})});function Yv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function qv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var kd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Cd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function bm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:b}){let x=[...kd,...l.filter(S=>!kd.some(q=>q.id===S.id))],f=dt[c]||dt.dark,[y,w]=react.useState(false),[v,T]=react.useState(false),[C,D]=react.useState(false),[k,I]=react.useState(false),[$,P]=react.useState({top:0,left:0}),[te,O]=react.useState(null),[H,F]=react.useState(new Date),[J,ee]=react.useState({top:0,left:0}),[Re,B]=react.useState(false),[Y,ye]=react.useState([]),[Ge,U]=react.useState(false),[oe,Z]=react.useState(""),Se=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[ae,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),B(false),ye([]));},[a,e,b]),react.useEffect(()=>{let S=q=>{Se.current&&!Se.current.contains(q.target)&&w(false),ke.current&&!ke.current.contains(q.target)&&T(false),Ie.current&&!Ie.current.contains(q.target)&&D(false),He.current&&!He.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let mt=()=>{let S={};return ae.name.trim()||(S.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),at(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!mt())try{let q=i==="create"&&Y.length>0?{...ae,pendingFiles:Y}:ae;await s(q),ye([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{Xe(ce=>{let Te={...ce,[S]:q};if(S==="status"){let W=q;W==="todo"?Te.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Te.progress=50):W==="completed"||W==="closed"?Te.progress=100:(W==="in-review"||W==="review")&&(Te.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Te.status="completed":W>0&&W<100&&ce.status==="todo"?Te.status="in-progress":W===0&&ce.status!=="todo"&&(Te.status="todo");}return Te}),pe[S]&&at(ce=>{let Te={...ce};return delete Te[S],Te});},yt=x.find(S=>S.id===ae.status)??kd[0],nt=Cd.find(S=>S.id===ae.priority)??Cd[1],Je=Bo.find(S=>S.value===ae.color)??Bo[0],z=c==="dark",ne={backgroundColor:z?"#141414":f.bgSecondary,border:`1px solid ${z?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:z?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,WebkitBackdropFilter:z?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:yt.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsxRuntime.jsx("span",{style:{color:yt.color},children:yt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:x.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ae.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&T(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsxRuntime.jsx("span",{children:nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Cd.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",S.id),T(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ae.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ae.assignees?.some(ce=>ce.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ae.assignees||[]).filter(Te=>Te.name!==S.name):[...ae.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)I(false);else {if(He.current){let S=He.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;P({top:W,left:S.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Je.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Bo.slice(0,18).map(S=>{let q=ae.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ce("color",S.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(uo,{selectedTags:ae.tags||[],availableTags:m,onChange:S=>Ce("tags",S),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="start")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;ee({top:W,left:S.left});}O("start"),F(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="end")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;ee({top:W,left:S.left});}O("end"),F(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${z?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ce=new Date(S);ce.setDate(S.getDate()+7);let Te=new Date(S);return Te.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Te}].map((re,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{te==="start"?(Ce("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Ce("endDate",re.date),O("end")):(Ce("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Ce("startDate",re.date),O(null));},children:re.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ce=new Date(S,q,1).getDay(),Te=new Date(S,q+1,0).getDate(),W=new Date,re=[];for(let Ne=ce-1;Ne>=0;Ne--)re.push({day:new Date(S,q,-Ne).getDate(),date:new Date(S,q-1,new Date(S,q,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)re.push({day:Ne,date:new Date(S,q,Ne),isCurrentMonth:true});let Ue=42-re.length;for(let Ne=1;Ne<=Ue;Ne++)re.push({day:Ne,date:new Date(S,q+1,Ne),isCurrentMonth:false});return re.map((Ne,ze)=>{let Fe=Ne.date.toDateString()===W.toDateString(),Ke=ae.startDate?.toDateString()===Ne.date.toDateString(),lt=ae.endDate?.toDateString()===Ne.date.toDateString(),ut=ae.startDate&&ae.endDate&&Ne.date>=ae.startDate&&Ne.date<=ae.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ke||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:lt?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ke&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{te==="start"?(Ce("startDate",Ne.date),ae.endDate&&Ne.date>ae.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ae.startDate&&Ne.date<ae.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},ze)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Yv(ae.effortMinutes):"",onChange:S=>{let q=qv(S.target.value);Ce("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?Y.length>0&&`(${Y.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(Vr,{cardId:"pending",attachments:Y.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ye(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ye(ce=>ce.filter((Te,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Vr,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),i==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[Y.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(S=>{let q=r.find(ce=>ce.id===S);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ae.dependencies||[]).filter(Te=>Te!==S);Ce("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!Ge),Z("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),Z("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:S=>Z(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>oe===""||S.name.toLowerCase().includes(oe.toLowerCase())).map(S=>{let q=ae.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ae.dependencies||[],Te;q?Te=ce.filter(W=>W!==S.id):Te=[...ce,S.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var hm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let _=Q=>Q.map(ve=>{if(ve.id===R){let Me=ve.dependencies||[];if(!Me.includes(E.id))return {...ve,dependencies:[...Me,E.id]}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Z?.(E.id,R);},[Z,$c]),zc=react.useCallback((E,R)=>{let _=Q=>Q.map(ve=>{if(ve.id===E&&ve.dependencies){let Me=ve.dependencies.filter(kt=>kt!==R);return {...ve,dependencies:Me}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,de(Q=>_(Q)),Se?.(E,R);},[Se]),{startDate:Jo,endDate:al}=react.useMemo(()=>{let E=G.filter(Me=>Me.startDate&&Me.endDate);if(E.length===0){let Me=new Date,kt=new Date(Me);kt.setDate(kt.getDate()-30);let ot=new Date(Me);return ot.setDate(ot.getDate()+60),{startDate:kt,endDate:ot}}let R=E.flatMap(Me=>[Me.startDate,Me.endDate]).filter(Me=>Me!==void 0),_=new Date(Math.min(...R.map(Me=>Me.getTime()))),Q=new Date(Math.max(...R.map(Me=>Me.getTime()))),ve=nt==="day"?7:nt==="week"?14:30;return _.setDate(_.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:_,endDate:Q}},[G,nt]);react.useEffect(()=>{wt.current?.(Jo,al);},[Jo,al]);let lf=react.useCallback(async()=>{if(!An.current||!no.current||!Or.current)return;await new Promise(Fo=>setTimeout(Fo,200));let E=An.current,R=no.current,_=ks.current||R.querySelector(".gantt-grid-scroll"),Q=Or.current,ve=_?.scrollTop||0,Me=_?.scrollLeft||0,kt=Q.scrollTop,ot=Q.scrollLeft,ma=E.style.overflow,Ut=E.style.height,ea=_?.style.overflow||"",ja=Q.style.overflow,ur=R.style.overflow,so=E.style.width,Zo=Q.style.width;try{let Fo=_?.querySelector(".gantt-taskgrid-content"),$r=Q.querySelector("svg"),ol=$r?.getAttribute("height")?parseInt($r.getAttribute("height"),10):$r?.getBoundingClientRect().height||0,en=Fo?.scrollHeight||_?.scrollHeight||600,Ts=Math.max(ol,Q.scrollHeight),In=$r?.getAttribute("width")?parseInt($r.getAttribute("width"),10):$r?.getBoundingClientRect().width||Q.scrollWidth,bf=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,nl=Math.max(en,Ts,ol),Vc=bf+nl+50,Gc=(_?.offsetWidth||R.offsetWidth||300)+In+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Vc}px`,E.style.width=`${Gc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${nl+50}px`),Q.style.overflow="visible",Q.style.height=`${nl+50}px`,Q.style.width=`${In+10}px`,await new Promise(Ns=>setTimeout(Ns,150));let hf=await htmlToImage.toPng(E,{backgroundColor:ra.bgPrimary,pixelRatio:2,width:Gc,height:Vc,skipFonts:!1,filter:Ns=>{if(!(Ns instanceof Element))return !0;let _c=window.getComputedStyle(Ns),jc=parseInt(_c.zIndex,10);return !(!isNaN(jc)&&jc>=50||_c.position==="fixed")}}),sl=document.createElement("a");sl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,sl.href=hf,sl.click();}finally{E.style.overflow=ma,E.style.height=Ut,E.style.width=so,R.style.overflow=ur,_&&(_.style.overflow=ea,_.style.height="",_.scrollTop=ve,_.scrollLeft=Me),Q.style.overflow=ja,Q.style.height="",Q.style.width=Zo,Q.scrollTop=kt,Q.scrollLeft=ot;}},[ra]),df=react.useCallback(async()=>{await Pe.exportToPDF(G);},[G]),cf=react.useCallback(async()=>{let E=new Date,R=ve=>String(ve).padStart(2,"0"),_=`${E.getFullYear()}-${R(E.getMonth()+1)}-${R(E.getDate())}_${R(E.getHours())}${R(E.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Pe.exportToExcel(G,`${Q}_${_}.xlsx`,{rateMap:a.rateMap,defaultRate:a.defaultRate});},[G,m,a.rateMap,a.defaultRate]),uf=react.useCallback(()=>{let E=Pe.exportToCSV(G),R=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[G]),pf=react.useCallback(()=>{let E=Pe.exportToJSON(G),R=new Blob([E],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[G]),mf=react.useCallback(()=>{Pe.exportToMSProject(G,"Gantt Project","project.xml");},[G]),gf=E=>{E.preventDefault(),Ee(true);},Qo=react.useRef(false),[rl,Uc]=react.useState(false),Ln=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Or.current,R=no.current?.querySelector(".gantt-grid-scroll");if(!E||!R)return;let _=()=>{if(Qo.current)return;Qo.current=true;let ot=E.scrollTop;X(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},Q=()=>{if(Qo.current)return;Qo.current=true;let ot=R.scrollTop;X(ot),E.scrollTop=ot,requestAnimationFrame(()=>{Qo.current=false;});},ve=ot=>{if(me&&R){let Ut=R.parentElement?.getBoundingClientRect()?.left||0,ea=ot.clientX-Ut,ja=200,ur=ws+Lc,so=window.innerWidth*Ic,Zo=Math.max(ur,so);ea>=ja&&ea<=Zo&&Ve(ea);}if(rl&&E){let ma=ot.clientX-Ln.current.x,Ut=ot.clientY-Ln.current.y;E.scrollLeft=Ln.current.scrollLeft-ma,E.scrollTop=Ln.current.scrollTop-Ut;}},Me=()=>{Ee(false),Uc(false);},kt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(Uc(true),Ln.current={x:ot.clientX,y:ot.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ot.preventDefault());};return E.addEventListener("scroll",_),R.addEventListener("scroll",Q),E.addEventListener("mousedown",kt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Me),()=>{E.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),E.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Me);}},[me,rl,ws]);let Wc=react.useRef(false),ff=react.useRef(null);return react.useLayoutEffect(()=>{if(Wc.current||G.length===0||!Or.current)return;Wc.current=true,ff.current=Jo;let E=Or.current,R=new Date,_=nt==="day"?60:nt==="week"?20:8,Q=(R.getTime()-Jo.getTime())/(1e3*60*60*24),ve=E.clientWidth,kt=Q*_*S-ve/2;Q>=0&&ve>0&&(E.scrollLeft=Math.max(0,kt));},[G.length,Jo,nt,S]),jsxRuntime.jsx(gn.Provider,{value:Ya,children:jsxRuntime.jsx(ul.Provider,{value:j0,children:jsxRuntime.jsxs("div",{ref:An,className:"flex flex-col h-full w-full",style:{backgroundColor:ra.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ra.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ra.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(si,{theme:ra,timeScale:nt,onTimeScaleChange:Je,zoom:S,onZoomChange:q,currentTheme:Ce,onThemeChange:L,rowDensity:z,onRowDensityChange:ne,showThemeSelector:c,showCreateTaskButton:v&&pe?.canCreateTask!==false&&!pe?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:C,taskFilter:Be,onTaskFilterChange:pt,hideCompleted:ie,onHideCompletedChange:be,toolbarRightContent:I,wbsLevel:ce,onWbsLevelChange:Pn,maxWbsDepth:tt,viewMode:Ue,onViewModeChange:Ne,projectForecast:O,onExportPNG:l?lf:void 0,onExportPDF:l?df:void 0,onExportExcel:l?cf:void 0,onExportCSV:l?uf:void 0,onExportJSON:l?pf:void 0,onExportMSProject:l?mf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:zt,showDependencies:lt,onShowDependenciesChange:Ct,highlightWeekends:st,onHighlightWeekendsChange:ht,showBaseline:ze,onShowBaselineChange:E=>{E&&Ue!=="oracle"&&Ne("oracle"),!E&&Ue==="oracle"&&Ne("execution");},onCopySnapshotLink:at,hasDependencies:K0})}),jsxRuntime.jsxs("div",{ref:no,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ks,className:"gantt-grid-scroll flex-shrink-0",style:{width:_0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ci,{tasks:Rc,theme:ra,rowHeight:Cs,availableUsers:d,templates:Bc,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:ee,onTaskToggle:X0,scrollTop:K,columns:qo,onToggleColumn:Y0,onColumnResize:q0,onTaskUpdate:Xo,onTaskIndent:J0,onTaskOutdent:Q0,onTaskMove:ef,onMultiTaskDelete:el,onTaskDuplicate:tf,onTaskCreate:af,onTaskRename:rf,onCreateSubtask:tl,onOpenTaskModal:F?E=>F(E):void 0,onDeleteRequest:(E,R)=>fe({taskId:E,taskName:R}),onTaskReparent:Z0,scrollContainerRef:ks})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ra.border,zIndex:15},onMouseDown:gf}),jsxRuntime.jsx("div",{ref:Or,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:rl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(vi,{tasks:Rc,theme:ra,rowHeight:Cs,timeScale:nt,startDate:Jo,endDate:al,zoom:S,locale:y,templates:Bc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Oc,onTaskContextMenu:nf,onTaskDateChange:of,onDependencyCreate:Hc,onDependencyDelete:zc,showBaseline:ze,showCriticalPath:Fe,showDependencies:lt,highlightWeekends:st,canEditTask:pe?.canEditTask})})]}),Oe.task&&jsxRuntime.jsx(hn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:ra,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Oe.task;if(!E)return [];let R=Pe.findTaskById(G,E.id)||E,_=R.subtasks&&R.subtasks.length>0,Q=pe?.canCreateTask!==false,ve=pe?.canDeleteTask!==false;if(_){let Ut=[],ea=pe?.canDuplicateTask!==false;return Q&&Ut.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ea&&Ut.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(ja=>Jn(ja,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),ve&&(Ut.length>0&&Ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ut.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),Ut}let Me=pe?.canUpdateTask!==false,kt=pe?.canDuplicateTask!==false,ot=[];return Me&&ot.push({id:"edit",label:Ya.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{ye?ye(R):M(R);}}),Q&&ot.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ot.length>0&&Me&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Me&&(ot.push({id:"markIncomplete",label:Ya.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{U?U(R):Xo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ya.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{oe?oe(R):Xo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ya.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{Xo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Me&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&ot.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):de(Ut=>Jn(Ut,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Me&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ya.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{let Ut=R.startDate.getTime(),ea=R.endDate.getTime(),ja=Ut+(ea-Ut)/2,ur=new Date(ja);sf(R,ur);}}),ve&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(Jr,{task:gt,isOpen:!!gt,onClose:()=>M(null),onTaskUpdate:E=>{gt&&(Xo(gt.id,E),M(null));},theme:Ce==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>fe(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ra.bgSecondary,border:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ra.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:ra.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ya.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ra.textPrimary},children:['"',le.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ra.bgPrimary,borderTop:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=ra.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{el([le.taskId]),fe(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ci,{tasks:G,theme:ra,config:f,onTasksUpdate:de,onTaskUpdate:Xo,onTaskCreate:E=>{de(R=>[...R,E]);},onTaskDelete:E=>{el([E]);},onDependencyCreate:(E,R)=>{let _=Pe.findTaskById(G,E);_&&Hc(_,R);},onDependencyDelete:zc})]})})})});function Yv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function qv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var kd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Cd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function bm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:b}){let x=[...kd,...l.filter(S=>!kd.some(q=>q.id===S.id))],f=dt[c]||dt.dark,[y,w]=react.useState(false),[v,T]=react.useState(false),[C,D]=react.useState(false),[k,I]=react.useState(false),[$,P]=react.useState({top:0,left:0}),[te,O]=react.useState(null),[H,F]=react.useState(new Date),[J,ee]=react.useState({top:0,left:0}),[Re,B]=react.useState(false),[Y,ye]=react.useState([]),[Ge,U]=react.useState(false),[oe,Z]=react.useState(""),Se=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[ae,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[pe,at]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),B(false),ye([]));},[a,e,b]),react.useEffect(()=>{let S=q=>{Se.current&&!Se.current.contains(q.target)&&w(false),ke.current&&!ke.current.contains(q.target)&&T(false),Ie.current&&!Ie.current.contains(q.target)&&D(false),He.current&&!He.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let mt=()=>{let S={};return ae.name.trim()||(S.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),at(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!mt())try{let q=i==="create"&&Y.length>0?{...ae,pendingFiles:Y}:ae;await s(q),ye([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{Xe(ce=>{let Te={...ce,[S]:q};if(S==="status"){let W=q;W==="todo"?Te.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Te.progress=50):W==="completed"||W==="closed"?Te.progress=100:(W==="in-review"||W==="review")&&(Te.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Te.status="completed":W>0&&W<100&&ce.status==="todo"?Te.status="in-progress":W===0&&ce.status!=="todo"&&(Te.status="todo");}return Te}),pe[S]&&at(ce=>{let Te={...ce};return delete Te[S],Te});},yt=x.find(S=>S.id===ae.status)??kd[0],nt=Cd.find(S=>S.id===ae.priority)??Cd[1],Je=Bo.find(S=>S.value===ae.color)??Bo[0],z=c==="dark",ne={backgroundColor:z?"#141414":f.bgSecondary,border:`1px solid ${z?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:z?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,WebkitBackdropFilter:z?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:yt.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsxRuntime.jsx("span",{style:{color:yt.color},children:yt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:x.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ae.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&T(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsxRuntime.jsx("span",{children:nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Cd.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",S.id),T(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ae.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ae.assignees?.some(ce=>ce.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ae.assignees||[]).filter(Te=>Te.name!==S.name):[...ae.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)I(false);else {if(He.current){let S=He.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;P({top:W,left:S.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Je.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Bo.slice(0,18).map(S=>{let q=ae.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ce("color",S.value),I(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(uo,{selectedTags:ae.tags||[],availableTags:m,onChange:S=>Ce("tags",S),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="start")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;ee({top:W,left:S.left});}O("start"),F(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="end")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ce=320,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;ee({top:W,left:S.left});}O("end"),F(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${z?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ce=new Date(S);ce.setDate(S.getDate()+7);let Te=new Date(S);return Te.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Te}].map((re,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{te==="start"?(Ce("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Ce("endDate",re.date),O("end")):(Ce("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Ce("startDate",re.date),O(null));},children:re.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ce=new Date(S,q,1).getDay(),Te=new Date(S,q+1,0).getDate(),W=new Date,re=[];for(let Ne=ce-1;Ne>=0;Ne--)re.push({day:new Date(S,q,-Ne).getDate(),date:new Date(S,q-1,new Date(S,q,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)re.push({day:Ne,date:new Date(S,q,Ne),isCurrentMonth:true});let Ue=42-re.length;for(let Ne=1;Ne<=Ue;Ne++)re.push({day:Ne,date:new Date(S,q+1,Ne),isCurrentMonth:false});return re.map((Ne,ze)=>{let Fe=Ne.date.toDateString()===W.toDateString(),Ke=ae.startDate?.toDateString()===Ne.date.toDateString(),lt=ae.endDate?.toDateString()===Ne.date.toDateString(),ut=ae.startDate&&ae.endDate&&Ne.date>=ae.startDate&&Ne.date<=ae.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ke||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:lt?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ke&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{te==="start"?(Ce("startDate",Ne.date),ae.endDate&&Ne.date>ae.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ae.startDate&&Ne.date<ae.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},ze)})})()})]})]})]})})]}),pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Yv(ae.effortMinutes):"",onChange:S=>{let q=qv(S.target.value);Ce("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?Y.length>0&&`(${Y.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(Vr,{cardId:"pending",attachments:Y.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ye(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ye(ce=>ce.filter((Te,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Vr,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),i==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[Y.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(S=>{let q=r.find(ce=>ce.id===S);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ae.dependencies||[]).filter(Te=>Te!==S);Ce("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!Ge),Z("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),Z("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:S=>Z(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>oe===""||S.name.toLowerCase().includes(oe.toLowerCase())).map(S=>{let q=ae.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ae.dependencies||[],Te;q?Te=ce.filter(W=>W!==S.id):Te=[...ce,S.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var hm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|