@libxai/board 0.17.71 → 0.17.73

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 CHANGED
@@ -42,7 +42,7 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Pn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function i(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},d=e.reduce((i,p)=>{let s=p.category||"Other";return i[s]||(i[s]=[]),i[s].push(p),i},{});return jsxRuntime.jsxs("div",{className:L("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:L("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(d).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:s.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:s.name}),s.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:s.description})]})]},s.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function In({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,m]=react.useState("export"),[d,i]=react.useState("json"),[p,s]=react.useState(null),c=react.useRef(null);if(!t)return null;let u=async()=>{let w=o?.current||void 0,h=await ti(e,d,w);ai(h,d);},k=async w=>{let h=w.target.files?.[0];if(h){try{let y=await ni(h),f=h.name.endsWith(".json")?"json":"csv",g=oi(y,f);s(g),g.success&&r&&r(g,y);}catch(y){s({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}c.current&&(c.current.value="");}};return jsxRuntime.jsxs("div",{className:L("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:L("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:L("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:L("p-4 rounded-lg border-2 transition-all text-center",d===w?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:c,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>c.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((w,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},h))})]})]})]})]})]})}var Ap=["URGENT","HIGH","MEDIUM","LOW"],Lp=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Fp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function An({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:m,availableUsers:d=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:s=true,compact:c=false,groupBy:u="none",onGroupByChange:k}){let[w,h]=react.useState(true),y=react.useCallback(b=>{a({search:b.target.value});},[a]),f=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),g=react.useCallback(b=>{r({by:b.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${c?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[s&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let x=b.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ap.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let x=b.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let x=b.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:Lp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>k(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ln({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:m,onExportGanttCSV:d}){let[i,p]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let u=k=>{s.current&&!s.current.contains(k.target)&&p(false);};return i&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[i]);let c=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:L("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>c(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>c(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>c(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>c(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Fn={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bn={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Rn={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Ka={dark:Fn,light:Bn,neutral:Rn},mo="dark";var po=react.createContext(void 0),_p="asakaa-theme";function rl({children:e,defaultTheme:t=mo,storageKey:a=_p}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,d=Ka[r];Object.entries(d.colors).forEach(([p,s])=>{s&&m.style.setProperty(`--theme-${Vp(p)}`,s);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,s])=>{let c=d.colors[p];c&&m.style.setProperty(s,c);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:Ka};return jsxRuntime.jsx(po.Provider,{value:l,children:e})}function pr(){let e=react.useContext(po);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Vp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function On({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=pr();return e?jsxRuntime.jsxs("div",{className:L("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ka).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:L("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},n))})]})]}):null}var Pe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function ol(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Pe[e]||Pe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Pe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Pe[e].bgSecondary),bgGrid:r("--theme-bg-card",Pe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Pe[e].bgWeekend),border:r("--theme-border-primary",Pe[e].border),borderLight:r("--theme-border-subtle",Pe[e].borderLight),textPrimary:r("--theme-text-primary",Pe[e].textPrimary),textSecondary:r("--theme-text-secondary",Pe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Pe[e].textTertiary),accent:r("--theme-accent-primary",Pe[e].accent),accentHover:r("--theme-accent-hover",Pe[e].accentHover),accentLight:r("--theme-accent-primary",Pe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Pe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Pe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Pe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Pe[e].dependency),dependencyHover:r("--theme-border-secondary",Pe[e].dependencyHover),criticalPath:r("--theme-error",Pe[e].criticalPath),criticalPathLight:r("--theme-error",Pe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Pe[e].today):e==="neutral"?r("--theme-text-primary",Pe[e].today):r("--theme-error",Pe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Pe[e].todayLight):e==="neutral"?r("--theme-text-primary",Pe[e].todayLight):r("--theme-error",Pe[e].todayLight),milestone:r("--theme-warning",Pe[e].milestone),milestoneLight:r("--theme-warning",Pe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Pe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Pe[e].statusInProgress),statusCompleted:r("--theme-success",Pe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Pe[e].hoverBg),focusRing:r("--theme-accent-primary",Pe[e].focusRing)}}var uo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},nl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Gn={en:uo,es:nl};function sl(e){return Gn[e]||Gn.en}function zn(e,t){let a=sl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var gr=react.createContext(uo);function Br(){return react.useContext(gr)}function lu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[m,d]=react.useState(false),[i,p]=react.useState(null),s=react.useRef(null),c=Br();if(react.useEffect(()=>{let h=y=>{s.current&&!s.current.contains(y.target)&&d(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||n||l))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(h=>h.handler),w=async(h,y)=>{if(y){p(h);try{await y();}catch(f){console.error(`Export ${h} failed:`,f);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:c.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:k.map((h,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<k.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function du({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(n=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function cu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function mu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Br();react.useEffect(()=>{let i=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],d=m.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${d}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,p)=>{let s=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:s?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:s?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:s?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},children:i.label}),s&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function go({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:m,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:s,onCreateTask:c,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}){let g=Br(),T=u||k||w||h||y||f,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],b=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(cu,{options:N,value:t,onChange:x=>a(x),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mu,{theme:e,value:m,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:c,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:s||g.toolbar.createTask})]}),(T||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lu,{theme:e,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(du,{options:b,value:n,onChange:x=>l(x),theme:e})]})]})}function fo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=s=>{m.current&&!m.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let p=d.current.getBoundingClientRect();l({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function fr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[m,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,s=r.length*36+8,c=8,u=window.innerWidth,k=window.innerHeight,w=t,h=a;t+p+c>u&&(w=t-p,w<c&&(w=c)),a+s+c>k&&(h=k-s-c,h<c&&(h=c)),d({x:w,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=c=>{l.current&&!l.current.contains(c.target)&&o();},s=c=>{c.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(n.bgSecondary),border:`1px solid ${n.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:s=>{p.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var Xe={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:m,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:s,enableKeyboard:c=true}){let u=react.useRef(false),k=react.useCallback(g=>{u.current=g;},[]),w=react.useCallback(g=>{let T=[],N=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&N(x.subtasks);};return N(g),T},[]),h=react.useCallback(()=>{let g=w(e);for(let T of g)if(t.has(T.id))return T;return null},[e,t,w]),y=react.useCallback((g,T)=>{let N=w(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let x=N.findIndex(C=>C.id===b.id);if(x===-1)return;let v=g==="up"?x-1:x+1;if(v<0||v>=N.length)return;let S=N[v];a(S.id,T);},[e,h,w,a]),f=react.useCallback(g=>{if(!c)return;let T=g.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){g.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,v=Array.from(t),S=h();if(g.key==="ArrowUp"){g.preventDefault(),y("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),y("down",g.shiftKey);return}if(S&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!S.isExpanded||g.key==="ArrowLeft"&&S.isExpanded)&&p(S.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){v.length>0&&(g.preventDefault(),l(v,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){v.length>0&&(g.preventDefault(),m(v));return}if(g.key==="Tab"&&g.shiftKey){v.length>0&&(g.preventDefault(),d(v));return}if(g.key==="Enter"&&!g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"above"));return}if(g.key==="Enter"&&x){S&&(g.preventDefault(),s(S.id));return}if(g.key==="F2"){S&&(g.preventDefault(),i(S.id));return}if(g.key==="Delete"||g.key==="Backspace"&&x){v.length>0&&(g.preventDefault(),o(v));return}if(g.key==="d"&&x&&!g.shiftKey){v.length>0&&(g.preventDefault(),n(v));return}},[c,t,h,y,r,o,n,l,m,d,i,p,s]);return react.useEffect(()=>{if(c)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[c,f]),{setIsEditing:k}}function kl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(s=>{t(new Set([s])),r(s);},[]),n=react.useCallback(s=>{t(c=>{let u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u}),r(s);},[]),l=react.useCallback((s,c)=>{if(!a){o(s);return}let u=c.indexOf(a),k=c.indexOf(s);if(u===-1||k===-1){o(s);return}let w=Math.min(u,k),h=Math.max(u,k),y=c.slice(w,h+1);t(new Set(y)),r(s);},[a,o]),m=react.useCallback((s,c,u,k)=>{k?l(s,c):u?n(s):o(s);},[o,n,l]),d=react.useCallback((s,c)=>{c?t(u=>{let k=new Set(u);return k.add(s),k}):o(s);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:p}}function br(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:n,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function wl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=wl(a.subtasks,t);if(r)return r}}return null}function Wn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Wn(a.subtasks,t);if(r)return r}return null}function Hn(e,t){if(t.length===0)return e;let a=br(e),r=t[0],o=a.findIndex(s=>s.id===r);if(o<=0)return e;let n=a[o-1],l=(s,c)=>{let u=[];return {tasks:s.filter(w=>{if(c.has(w.id))return u.push(w),false;if(w.subtasks){let h=l(w.subtasks,c);w.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},m=(s,c,u)=>s.map(k=>k.id===c?{...k,subtasks:[...k.subtasks||[],...u],isExpanded:true}:k.subtasks?{...k,subtasks:m(k.subtasks,c,u)}:k),d=new Set(t),{tasks:i,removed:p}=l(e,d);return m(i,n.id,p)}function _n(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Wn(a,r);if(!o)continue;let n=Wn(a,o.id),l=(i,p,s)=>{for(let c=0;c<i.length;c++){let u=i[c];if(u.id===p&&u.subtasks){let k=u.subtasks.findIndex(w=>w.id===s);if(k!==-1){let[w]=u.subtasks.splice(k,1);return w}}if(u.subtasks){let k=l(u.subtasks,p,s);if(k)return k}}return null},m=(i,p,s)=>{let c=i.findIndex(u=>u.id===p);if(c!==-1)return i.splice(c+1,0,s),i;for(let u of i)u.subtasks&&m(u.subtasks,p,s);return i},d=l(a,o.id,r);d&&(n&&n.subtasks?m(n.subtasks,o.id,d):m(a,o.id,d));}return a}function Vn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,m,d)=>{let i=l.findIndex(s=>s.id===m);if(i===-1){for(let s of l)if(s.subtasks&&n(s.subtasks,m,d))return true;return false}let p=d==="up"?i-1:i+1;return p<0||p>=l.length?false:([l[i],l[p]]=[l[p],l[i]],true)};return n(r,o,a),r}function jn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function Kn(e,t){let a=[...e];for(let r of t){let o=l=>{let m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let d=l[m],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?n(d.subtasks):void 0};return l.splice(m+1,0,i),true},n=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function Cl(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},m=d=>{let i=d.findIndex(s=>s.id===t);if(i===-1){for(let s of d)if(s.subtasks&&m(s.subtasks))return true;return false}let p=a==="above"?i:i+1;return d.splice(p,0,l),true};return m(r),{tasks:r,newTask:l}}function Yn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Yn(r.subtasks,t,a)}:r)}function qn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:qn(a.subtasks,t)}:a)}function Xn(e,t){let a=p=>{for(let s of p){if(s.id===t)return s;if(s.subtasks){let c=a(s.subtasks);if(c)return c}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,m=r?.endDate||n,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(s=>{if(s.id===t){let c=s.subtasks||[];return {...s,subtasks:[...c,d],isExpanded:true}}return s.subtasks?{...s,subtasks:i(s.subtasks)}:s});return {tasks:i(e),newTask:d}}function Tl(e,t,a,r){if(t===a)return e;let o=wl(e,t);if(!o)return e;if(a){let m=(d,i)=>{if(!d.subtasks)return false;for(let p of d.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let n=m=>m.filter(d=>d.id!==t).map(d=>d.subtasks&&d.subtasks.length>0?{...d,subtasks:n(d.subtasks)}:d),l=n(e);if(a===null){let m=r!==void 0?r:l.length;l.splice(m,0,{...o,parentId:void 0});}else {let m=d=>d.map(i=>{if(i.id===a){let p=i.subtasks||[],s=r!==void 0?r:p.length,c=[...p];return c.splice(s,0,{...o,parentId:a}),{...i,subtasks:c,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});l=m(l);}return l}function vo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:d,scrollTop:i,columns:p,onToggleColumn:s,onColumnResize:c,onTaskUpdate:u,onTaskIndent:k,onTaskOutdent:w,onTaskMove:h,onMultiTaskDelete:y,onTaskDuplicate:f,onTaskCreate:g,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:v}){let S=react.useContext(gr),[C,A]=react.useState(null),[z,P]=react.useState(false),[W,E]=react.useState(null),[$,V]=react.useState(""),re=react.useRef(null),se=react.useRef(null),[Y,R]=react.useState(null),[O,M]=react.useState(0),[ge,te]=react.useState(0),[Fe,Re]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[tt,ve]=react.useState(null),[at,Bt]=react.useState(null),[xt,xa]=react.useState(null),Xt=react.useRef(0),ua=5,jt=react.useRef(false);react.useEffect(()=>{function B(H){re.current&&!re.current.contains(H.target)&&P(false);}if(z)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[z]),react.useEffect(()=>{W&&se.current&&(se.current.focus(),se.current.select());},[W]),react.useEffect(()=>{if(!Y)return;let B=me=>{let le=me.clientX-O,K=ge+le;c?.(Y,K);},H=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,O,ge,c]);let{selectedTaskIds:Et,handleTaskClick:Jt,isTaskSelected:ht}=kl(),{setIsEditing:je}=yl({tasks:e,selectedTaskIds:Et,onTaskSelect:(B,H)=>{let le=br(e).map(K=>K.id);Jt(B,le,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:B=>{let H=br(e).find(me=>me.id===B);H&&be(H);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:B=>{let H=br(e).find(me=>me.id===B);H&&b&&b(H);},enableKeyboard:true}),Ut=(B,H=0)=>{let me=[];for(let le of B)me.push({task:le,level:H}),le.subtasks&&le.subtasks.length>0&&le.isExpanded&&me.push(...Ut(le.subtasks,H+1));return me},It=Ut(e),Sa=48,ie=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,be=B=>{E(B.id),V(B.name),je(true);},Zt=B=>{$.trim()&&$!==e.find(H=>H.id===B)?.name&&T?.(B,$.trim()),E(null),V(""),je(false);},kt=()=>{E(null),V(""),je(false);},Qt=(B,H)=>{H.stopPropagation(),N?.(B.id);},ga=(B,H)=>{H.preventDefault(),Xt.current=H.clientY,ve(B),jt.current=false;},ke=B=>{if(!tt||(Math.abs(B.clientY-Xt.current)>ua&&(jt.current=true),!jt.current))return;let me=document.querySelectorAll("[data-task-row]"),le=null,K=null;me.forEach(we=>{let ee=we.getBoundingClientRect(),I=we.getAttribute("data-task-row");if(I&&I!==tt&&B.clientY>=ee.top&&B.clientY<=ee.bottom){le=I;let X=B.clientY-ee.top,Ce=ee.height;X<Ce*.25?K="above":X>Ce*.75?K="below":K="child";}}),Bt(le),xa(K);},ye=()=>{if(jt.current&&tt&&at&&xt){if(xt==="child")v?.(tt,at);else if(xt==="above"||xt==="below"){let B=(le,K,we=null)=>{for(let ee of le){if(ee.id===K)return we;if(ee.subtasks){let I=B(ee.subtasks,K,ee.id);if(I!==void 0)return I}}},H=B(e,at,null),me=(le,K)=>{let we=le.findIndex(ee=>ee.id===K);return xt==="below"?we+1:we};if(H===null){let le=me(e,at);v?.(tt,null,le);}else {let le=It.find(K=>K.task.id===H)?.task;if(le?.subtasks){let K=me(le.subtasks,at);v?.(tt,H,K);}}}}ve(null),Bt(null),xa(null),jt.current=false;};react.useEffect(()=>{if(tt)return document.addEventListener("mousemove",ke),document.addEventListener("mouseup",ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",ye),document.body.style.cursor="",document.body.style.userSelect="";}},[tt,at,xt]);let Ea=(B,H,me)=>{switch(B.id){case "name":let le=W===H.id,K=C===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:K?1:.3},onMouseDown:ce=>ga(H.id,ce),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),d?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),le?jsxRuntime.jsx("input",{ref:se,type:"text",value:$,onChange:ce=>V(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"?Zt(H.id):ce.key==="Escape"&&kt();},onBlur:()=>Zt(H.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ce=>ce.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.subtasks&&H.subtasks.length>0?t.textPrimary:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.subtasks&&H.subtasks.length>0?"14px":"13px",fontWeight:H.isMilestone||H.subtasks&&H.subtasks.length>0?600:400,letterSpacing:H.subtasks&&H.subtasks.length>0?"-0.01em":"0"},title:H.name,children:H.name}),K&&!le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ce=>ce.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ce=>Qt(H,ce),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),be(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let we=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:we||"",onChange:ce=>{u?.(H.id,{startDate:ce.target.value?new Date(ce.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let ee=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ee||"",onChange:ce=>{u?.(H.id,{endDate:ce.target.value?new Date(ce.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ie(H)})});case "assignees":let I=r.filter(ce=>H.assignees?.some(za=>za.name===ce.name||za.initials===ce.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ha,{assignedUsers:I,availableUsers:r,onChange:ce=>{let za=ce.map(ar=>({id:ar.id,name:ar.name,initials:ar.initials,color:ar.color}));u?.(H.id,{assignees:za.length>0?za:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ti,{status:H.status||"todo",onChange:ce=>{u?.(H.id,{status:ce,progress:ce==="completed"?100:H.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.progress}%`,backgroundColor:H.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[H.progress,"%"]})]});case "priority":let X={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ce={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},lt=X[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx($a,{priority:lt,onChange:ce=>{ce&&u?.(H.id,{priority:Ce[ce]||"medium"});}})});default:return null}},j=B=>[{id:"hide",label:"Hide Column",icon:Xe.Hide,onClick:()=>s(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Xe.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Xe.SortDesc,onClick:()=>{}}],Se=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{l?.(B);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{u?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{u?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{u?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}],de=p.filter(B=>B.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[de.map((B,H)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B.id==="name"?"justify-start":"justify-center"}`,style:{width:`${B.width}px`,minWidth:`${B.minWidth??60}px`,maxWidth:`${B.maxWidth??2e3}px`,borderRight:H<de.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",flexShrink:0,overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),Re({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:B.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},title:B.label,children:B.label}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Y===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),R(B.id),M(me.clientX),te(B.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},B.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",style:{backgroundColor:t.bgGrid,flexShrink:0,minWidth:"60px",borderLeft:`1px solid ${t.borderLight}`},children:[jsxRuntime.jsx(fo,{columns:p,onToggleColumn:s,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>P(!z),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),z&&jsxRuntime.jsxs("div",{ref:re,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:It.map(({task:B,level:H},me)=>{let le=ht(B.id),K=at===B.id,we={};return K&&xt&&(xt==="above"?(we.borderTopWidth="2px",we.borderTopStyle="solid",we.borderTopColor=t.accent):xt==="below"?(we.borderBottomWidth="2px",we.borderBottomStyle="solid",we.borderBottomColor=t.accent):xt==="child"&&(we.backgroundColor=t.accentLight,we.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${tt===B.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:le||K&&xt==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...we},onMouseEnter:()=>A(B.id),onMouseLeave:()=>A(null),onClick:ee=>{let X=br(e).map(ce=>ce.id),lt=navigator.platform.toUpperCase().indexOf("MAC")>=0?ee.metaKey:ee.ctrlKey;Jt(B.id,X,lt,ee.shiftKey),n?.(B);},onDoubleClick:ee=>{ee.stopPropagation(),l?.(B);},onContextMenu:ee=>{ee.preventDefault(),Re({isOpen:true,x:ee.clientX,y:ee.clientY,type:"task",task:B}),m?.(B,ee);},whileHover:{backgroundColor:le?t.accentLight:t.hoverBg},children:de.map((ee,I)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ee.id==="name"?"justify-start":"justify-center"} ${I<de.length-1?"border-r":""}`,style:{width:`${ee.width}px`,minWidth:`${ee.minWidth??60}px`,maxWidth:`${ee.maxWidth??2e3}px`,borderColor:C===B.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",flexShrink:0,overflow:"hidden"},children:Ea(ee,B,ee.id==="name"?H:0)},`${B.id}-${ee.id}`))},B.id)})}),jsxRuntime.jsx(fr,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,items:Fe.type==="header"&&Fe.columnId?j(Fe.columnId):Fe.type==="task"&&Fe.task?Se(Fe.task):[],onClose:()=>Re({...Fe,isOpen:false}),theme:t})]})}function Nl(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,m]=react.useState(e),[d,i]=react.useState(t),[p,s]=react.useState(null),[c,u]=react.useState(null),[k,w]=react.useState(null),[h,y]=react.useState(null),[f,g]=react.useState(0),[T,N]=react.useState(0),[b,x]=react.useState(null),[v,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:m,ghostWidth:d,setGhostWidth:i,connectionLine:p,setConnectionLine:s,hoveredTaskId:c,setHoveredTaskId:u,activeZone:k,setActiveZone:w,draggedSegmentIndex:h,setDraggedSegmentIndex:y,draggedSegmentStartX:f,setDraggedSegmentStartX:g,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:v,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(W,E)=>{r("none"),s(null),u(null),m(W),i(E),N(0),y(null),g(0);}}}function yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:u=[],onDragMove:k}){let w=Nl(t,r),h=react.useRef(null),{dragMode:y,setDragMode:f,dragOffset:g,setDragOffset:T,ghostX:N,setGhostX:b,ghostWidth:x,setGhostWidth:v,connectionLine:S,setConnectionLine:C,hoveredTaskId:A,setHoveredTaskId:z,activeZone:P,setActiveZone:W,draggedSegmentIndex:E,setDraggedSegmentIndex:$,draggedSegmentStartX:V,setDraggedSegmentStartX:re,segmentDragOffsetX:se,setSegmentDragOffsetX:Y,hoveredSegmentIndex:R,setHoveredSegmentIndex:O,isHovered:M,setIsHovered:ge,isDragging:te,isResizing:Fe,isConnecting:Re,resetDragState:tt}=w,ve=32,at=8,Bt=e.endDate&&e.endDate<new Date&&e.progress<100,xt=e.isCriticalPath,xa=o.name==="neutral"||o.today==="#1C1917",Xt=e.status==="completed"||e.progress===100,ua={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Et=e.isCriticalPath||Bt?"#DC2626":e.color?e.color:e.priority&&ua[e.priority]?ua[e.priority]:o.taskBarPrimary,ht=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),je=r<50,Ut=r<40,It=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Sa=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},ie=j=>Math.round(j/n)*n,be=j=>{let Se=Math.round(j/n),de=new Date(l);return de.setDate(de.getDate()+Se),de},Zt=(j,Se)=>{for(let de of u){if(de.id===e.id)continue;let B=5;if(j>=de.x-B&&j<=de.x+de.width+B&&Se>=de.y-B&&Se<=de.y+de.height+B)return de.id}return null},kt=react.useCallback((j,Se,de)=>{j.preventDefault(),j.stopPropagation();let B=h.current?.ownerSVGElement;if(!B)return;let H=B.createSVGPoint();H.x=j.clientX,H.y=j.clientY;let me=H.matrixTransform(B.getScreenCTM()?.inverse()),le=de!==void 0?de:t,K=Se;if(!K){let we=me.x-le;j.shiftKey?(K="connect",C({x:t+r,y:a+ve/2})):j.ctrlKey||j.metaKey?K="move":j.altKey?K=we<r/2?"resize-start":"resize-end":Ut?we<r/2?K="move":K="resize-end":je?we<=ht/2?K="resize-start":we>=r-ht/2?K="resize-end":K="move":we<=ht?K="resize-start":we>=r-ht?K="resize-end":K="move";}f(K),ge(false),W(null),K==="move"?T(me.x-le):K==="connect"?C({x:t+r,y:a+ve/2}):T(0),b(le),v(r);},[t,r,a,ve]),Qt=react.useCallback(j=>{if(y==="none")return;let Se=h.current?.ownerSVGElement;if(!Se)return;let de=Se.createSVGPoint();de.x=j.clientX,de.y=j.clientY;let B=de.matrixTransform(Se.getScreenCTM()?.inverse());if(y==="connect"){C({x:B.x,y:B.y});let H=Zt(B.x,B.y);z(H);}else if(y==="move"){let H=B.x-g,me=ie(H);b(me),v(r);let le=Math.round((me-t)/n);if(k?.(e.id,le,true),e.segments&&e.segments.length>0&&E!==null){let K=me-V;Y(K);}}else if(y==="resize-start"){let H=B.x,me=ie(H),le=t+r-me;le>=n&&(b(me),v(le));}else if(y==="resize-end"){let H=B.x,le=ie(H)-t;le>=n&&v(le);}},[y,t,r,n,g,e,ie,E,V,Zt,z,C,b,v,Y,k]),ga=react.useCallback(()=>{if(y!=="none"){if(y==="connect")A&&c&&c(e,A),C(null),z(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Se,de,B=true;if(y==="move"){if(Se=be(N),de=new Date(Se.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let H=Math.round(se/n),me=e.segments.map((ee,I)=>{if(I===E){let X=new Date(ee.startDate),Ce=new Date(ee.endDate);return X.setDate(X.getDate()+H),Ce.setDate(Ce.getDate()+H),{startDate:X,endDate:Ce}}return ee}),le=me.flatMap(ee=>[ee.startDate,ee.endDate]),K=new Date(Math.min(...le.map(ee=>ee.getTime()))),we=new Date(Math.max(...le.map(ee=>ee.getTime())));s?.({...e,segments:me},K,we),tt(t,r);return}}else y==="resize-start"?(Se=be(N),de=e.endDate,Se>=de&&(console.warn("Invalid date range: start date must be before end date"),B=false)):y==="resize-end"?(Se=e.startDate,de=be(N+x),de<=Se&&(console.warn("Invalid date range: end date must be after start date"),B=false)):B=false;B&&Se&&de&&(de.getTime()-Se.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):s?.(e,Se,de));}k?.(e.id,0,false),tt(t,r);}},[y,N,x,e,s,A,c,t,r,n,be,se,E,tt,k]);react.useEffect(()=>{if(y==="none")return;let j=de=>{Qt(de);},Se=()=>{ga();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Se),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Se);}},[y,Qt,ga]);let ke=te&&!Re?N:t,ye=te&&!Re?x:r,Ea=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!te&&ge(true),onMouseLeave:()=>{te||(ge(false),W(null));},onClick:()=>!te&&d?.(e),onDoubleClick:j=>{te||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),p?.(e,j);},children:[M&&!te&&!je&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ht,height:ve,fill:P==="resize-start"?o.accent:"transparent",opacity:P==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-start"),onMouseDown:j=>kt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ht,y:a,width:r-ht*2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-ht,y:a,width:ht,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")})]}),M&&!te&&Ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),te&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:x,height:ve,rx:at,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke,y:a,width:ye,height:ve,rx:at,fill:Et,"data-task-class":Ea,initial:{opacity:0,scale:.95},animate:{opacity:te&&!Re?.15:e.parentId?.6:M?.9:.8,scale:M&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>kt(j),style:{cursor:te?Re?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,Se)=>{let de=(j.startDate.getTime()-l.getTime())/864e5*n,H=(j.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-de+n,me=te&&y==="move"&&E===Se,le=R===Se,K=me?de+se:de;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!te&&O(Se),onMouseLeave:()=>!te&&O(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:H,height:ve,rx:at,fill:Et,initial:{opacity:0,scale:.95},animate:{opacity:me||e.parentId?.6:le?.9:.8,scale:le&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:we=>{we.stopPropagation(),$(Se),re(de),kt(we,void 0,de);},style:{cursor:te?Re?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:H*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Se}`)}),xa&&(Bt||xt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xt&&!Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ye>60&&!e.segments&&(()=>{let j=m.taskLabel(e),Se=typeof j=="string"?j:e.name,de=Se.length>Math.floor(ye/8)?`${Se.substring(0,Math.floor(ye/8))}...`:Se;return jsxRuntime.jsx("text",{x:ke+12,y:a+ve/2,dominantBaseline:"middle",fill:Xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Xt?"line-through":"none"},children:de})})(),ye>100&&e.progress>0&&e.progress<100&&!te&&!e.segments&&jsxRuntime.jsxs("text",{x:ke+ye-12,y:a+ve/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ye>80&&!te&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||Fe)&&!Re&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:je?ke-15:ke-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke-8:ke-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ke+ye-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke+ye:ke+ye-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ve/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:j=>{j.stopPropagation(),kt(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ve/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Re&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:S.x,y2:S.y,stroke:A?o.statusCompleted:o.accent,strokeWidth:A?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:A?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:S.x,cy:S.y,r:A?8:6,fill:A?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),A&&jsxRuntime.jsx(framerMotion.motion.text,{x:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(M||te)&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke-2,y:a-2,width:ye+4,height:ve+4,rx:at+2,fill:"none",stroke:te?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:te?.6:.4,initial:{opacity:0},animate:{opacity:te?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+x,y1:0,x2:N+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!e.segments&&(()=>{let de=a<100,B=de?a+ve+13:a-82-13,H=de?`M ${ke+ye/2-6} ${a+ve+3} L ${ke+ye/2} ${a+ve+13} L ${ke+ye/2+6} ${a+ve+3}`:`M ${ke+ye/2-6} ${a-13} L ${ke+ye/2} ${a-3} L ${ke+ye/2+6} ${a-13}`,me=B+22,le=B+40,K=B+55,we=B+70,ee=de?B+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:de?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:de?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:H,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ke+ye/2-120,y:B,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:ke+ye/2,y:me,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:ke+ye/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.startDate)}),jsxRuntime.jsx("text",{x:ke+ye/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.endDate)}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ke+ye/2+65,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Sa()}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ke+ye/2+65,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ke+ye/2-110,y:we,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ke+ye/2-50,y:we,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(I=>I.name).join(", ").substring(0,30),e.assignees.map(I=>I.name).join(", ").length>30?"...":""]})]}),!de&&jsxRuntime.jsx("text",{x:ke+ye/2,y:ee,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ut?"Left: move \u2022 Right: resize":je?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function ko({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,m]=react.useState(false),d=a-e,i=r-t,p=e+d/2,s=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,c=6,u=Math.atan2(i,d),k=a-c*Math.cos(u-Math.PI/6),w=r-c*Math.sin(u-Math.PI/6),h=a-c*Math.cos(u+Math.PI/6),y=r-c*Math.sin(u+Math.PI/6),f=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:s,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${k} ${w} M ${a} ${r} L ${h} ${y}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:g=>{g.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Co({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),m=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:d(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var q={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,m=new Set,d=i=>{if(!l.has(i)){l.add(i),m.add(i);let p=r.get(i)||[];for(let s of p){if(!l.has(s)&&d(s))return true;if(m.has(s))return true}}return m.delete(i),false};return d(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=q.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=q.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=q.findTaskById(e,o);if(n)a.unshift(n),o=n.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=q.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(n.join(","));}),r.join(`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Pn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function i(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},d=e.reduce((i,p)=>{let s=p.category||"Other";return i[s]||(i[s]=[]),i[s].push(p),i},{});return jsxRuntime.jsxs("div",{className:L("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:L("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(d).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:s.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:s.name}),s.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:s.description})]})]},s.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function In({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,m]=react.useState("export"),[d,i]=react.useState("json"),[p,s]=react.useState(null),c=react.useRef(null);if(!t)return null;let u=async()=>{let w=o?.current||void 0,h=await ti(e,d,w);ai(h,d);},k=async w=>{let h=w.target.files?.[0];if(h){try{let y=await ni(h),f=h.name.endsWith(".json")?"json":"csv",g=oi(y,f);s(g),g.success&&r&&r(g,y);}catch(y){s({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}c.current&&(c.current.value="");}};return jsxRuntime.jsxs("div",{className:L("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:L("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:L("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:L("p-4 rounded-lg border-2 transition-all text-center",d===w?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:c,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>c.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:L("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:L("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((w,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},h))})]})]})]})]})]})}var Ap=["URGENT","HIGH","MEDIUM","LOW"],Lp=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Fp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function An({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:m,availableUsers:d=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:s=true,compact:c=false,groupBy:u="none",onGroupByChange:k}){let[w,h]=react.useState(true),y=react.useCallback(b=>{a({search:b.target.value});},[a]),f=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),g=react.useCallback(b=>{r({by:b.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${c?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[s&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let x=b.target.value;a({priorities:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ap.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let x=b.target.value;a({assignees:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let x=b.target.value;a({labels:x==="all"?[]:[x]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:Lp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:b=>k(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ln({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:m,onExportGanttCSV:d}){let[i,p]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let u=k=>{s.current&&!s.current.contains(k.target)&&p(false);};return i&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[i]);let c=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:L("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>c(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>c(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>c(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>c(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>c(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Fn={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bn={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Rn={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Ka={dark:Fn,light:Bn,neutral:Rn},mo="dark";var po=react.createContext(void 0),_p="asakaa-theme";function rl({children:e,defaultTheme:t=mo,storageKey:a=_p}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,d=Ka[r];Object.entries(d.colors).forEach(([p,s])=>{s&&m.style.setProperty(`--theme-${Vp(p)}`,s);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,s])=>{let c=d.colors[p];c&&m.style.setProperty(s,c);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:Ka};return jsxRuntime.jsx(po.Provider,{value:l,children:e})}function pr(){let e=react.useContext(po);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Vp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function On({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=pr();return e?jsxRuntime.jsxs("div",{className:L("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ka).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:L("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},n))})]})]}):null}var Pe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function ol(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Pe[e]||Pe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Pe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Pe[e].bgSecondary),bgGrid:r("--theme-bg-card",Pe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Pe[e].bgWeekend),border:r("--theme-border-primary",Pe[e].border),borderLight:r("--theme-border-subtle",Pe[e].borderLight),textPrimary:r("--theme-text-primary",Pe[e].textPrimary),textSecondary:r("--theme-text-secondary",Pe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Pe[e].textTertiary),accent:r("--theme-accent-primary",Pe[e].accent),accentHover:r("--theme-accent-hover",Pe[e].accentHover),accentLight:r("--theme-accent-primary",Pe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Pe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Pe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Pe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Pe[e].dependency),dependencyHover:r("--theme-border-secondary",Pe[e].dependencyHover),criticalPath:r("--theme-error",Pe[e].criticalPath),criticalPathLight:r("--theme-error",Pe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Pe[e].today):e==="neutral"?r("--theme-text-primary",Pe[e].today):r("--theme-error",Pe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Pe[e].todayLight):e==="neutral"?r("--theme-text-primary",Pe[e].todayLight):r("--theme-error",Pe[e].todayLight),milestone:r("--theme-warning",Pe[e].milestone),milestoneLight:r("--theme-warning",Pe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Pe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Pe[e].statusInProgress),statusCompleted:r("--theme-success",Pe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Pe[e].hoverBg),focusRing:r("--theme-accent-primary",Pe[e].focusRing)}}var uo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},nl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Gn={en:uo,es:nl};function sl(e){return Gn[e]||Gn.en}function zn(e,t){let a=sl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var gr=react.createContext(uo);function Br(){return react.useContext(gr)}function lu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[m,d]=react.useState(false),[i,p]=react.useState(null),s=react.useRef(null),c=Br();if(react.useEffect(()=>{let h=y=>{s.current&&!s.current.contains(y.target)&&d(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||n||l))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(h=>h.handler),w=async(h,y)=>{if(y){p(h);try{await y();}catch(f){console.error(`Export ${h} failed:`,f);}finally{p(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:c.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:k.map((h,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<k.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function du({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(n=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function cu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function mu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Br();react.useEffect(()=>{let i=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],d=m.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${d}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,p)=>{let s=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:s?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:s?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:s?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},children:i.label}),s&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function go({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:m,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:s,onCreateTask:c,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}){let g=Br(),T=u||k||w||h||y||f,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],b=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(cu,{options:N,value:t,onChange:x=>a(x),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mu,{theme:e,value:m,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:c,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:s||g.toolbar.createTask})]}),(T||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lu,{theme:e,onExportPNG:u,onExportPDF:k,onExportExcel:w,onExportCSV:h,onExportJSON:y,onExportMSProject:f}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(du,{options:b,value:n,onChange:x=>l(x),theme:e})]})]})}function fo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=s=>{m.current&&!m.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let p=d.current.getBoundingClientRect();l({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Oe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function fr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[m,d]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,s=r.length*36+8,c=8,u=window.innerWidth,k=window.innerHeight,w=t,h=a;t+p+c>u&&(w=t-p,w<c&&(w=c)),a+s+c>k&&(h=k-s-c,h<c&&(h=c)),d({x:w,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=c=>{l.current&&!l.current.contains(c.target)&&o();},s=c=>{c.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(n.bgSecondary),border:`1px solid ${n.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:s=>{p.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var Xe={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:m,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:s,enableKeyboard:c=true}){let u=react.useRef(false),k=react.useCallback(g=>{u.current=g;},[]),w=react.useCallback(g=>{let T=[],N=b=>{for(let x of b)T.push(x),x.subtasks&&x.subtasks.length>0&&x.isExpanded&&N(x.subtasks);};return N(g),T},[]),h=react.useCallback(()=>{let g=w(e);for(let T of g)if(t.has(T.id))return T;return null},[e,t,w]),y=react.useCallback((g,T)=>{let N=w(e);if(N.length===0)return;let b=h();if(!b){a(N[0].id,false);return}let x=N.findIndex(C=>C.id===b.id);if(x===-1)return;let v=g==="up"?x-1:x+1;if(v<0||v>=N.length)return;let S=N[v];a(S.id,T);},[e,h,w,a]),f=react.useCallback(g=>{if(!c)return;let T=g.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||u.current){g.key==="Escape"&&(T.blur(),u.current=false);return}let x=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,v=Array.from(t),S=h();if(g.key==="ArrowUp"){g.preventDefault(),y("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),y("down",g.shiftKey);return}if(S&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!S.isExpanded||g.key==="ArrowLeft"&&S.isExpanded)&&p(S.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){v.length>0&&(g.preventDefault(),l(v,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){v.length>0&&(g.preventDefault(),m(v));return}if(g.key==="Tab"&&g.shiftKey){v.length>0&&(g.preventDefault(),d(v));return}if(g.key==="Enter"&&!g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!x){S&&(g.preventDefault(),r(S.id,"above"));return}if(g.key==="Enter"&&x){S&&(g.preventDefault(),s(S.id));return}if(g.key==="F2"){S&&(g.preventDefault(),i(S.id));return}if(g.key==="Delete"||g.key==="Backspace"&&x){v.length>0&&(g.preventDefault(),o(v));return}if(g.key==="d"&&x&&!g.shiftKey){v.length>0&&(g.preventDefault(),n(v));return}},[c,t,h,y,r,o,n,l,m,d,i,p,s]);return react.useEffect(()=>{if(c)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[c,f]),{setIsEditing:k}}function kl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(s=>{t(new Set([s])),r(s);},[]),n=react.useCallback(s=>{t(c=>{let u=new Set(c);return u.has(s)?u.delete(s):u.add(s),u}),r(s);},[]),l=react.useCallback((s,c)=>{if(!a){o(s);return}let u=c.indexOf(a),k=c.indexOf(s);if(u===-1||k===-1){o(s);return}let w=Math.min(u,k),h=Math.max(u,k),y=c.slice(w,h+1);t(new Set(y)),r(s);},[a,o]),m=react.useCallback((s,c,u,k)=>{k?l(s,c):u?n(s):o(s);},[o,n,l]),d=react.useCallback((s,c)=>{c?t(u=>{let k=new Set(u);return k.add(s),k}):o(s);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:p}}function br(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:n,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function wl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=wl(a.subtasks,t);if(r)return r}}return null}function Wn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Wn(a.subtasks,t);if(r)return r}return null}function Hn(e,t){if(t.length===0)return e;let a=br(e),r=t[0],o=a.findIndex(s=>s.id===r);if(o<=0)return e;let n=a[o-1],l=(s,c)=>{let u=[];return {tasks:s.filter(w=>{if(c.has(w.id))return u.push(w),false;if(w.subtasks){let h=l(w.subtasks,c);w.subtasks=h.tasks,u.push(...h.removed);}return true}),removed:u}},m=(s,c,u)=>s.map(k=>k.id===c?{...k,subtasks:[...k.subtasks||[],...u],isExpanded:true}:k.subtasks?{...k,subtasks:m(k.subtasks,c,u)}:k),d=new Set(t),{tasks:i,removed:p}=l(e,d);return m(i,n.id,p)}function _n(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Wn(a,r);if(!o)continue;let n=Wn(a,o.id),l=(i,p,s)=>{for(let c=0;c<i.length;c++){let u=i[c];if(u.id===p&&u.subtasks){let k=u.subtasks.findIndex(w=>w.id===s);if(k!==-1){let[w]=u.subtasks.splice(k,1);return w}}if(u.subtasks){let k=l(u.subtasks,p,s);if(k)return k}}return null},m=(i,p,s)=>{let c=i.findIndex(u=>u.id===p);if(c!==-1)return i.splice(c+1,0,s),i;for(let u of i)u.subtasks&&m(u.subtasks,p,s);return i},d=l(a,o.id,r);d&&(n&&n.subtasks?m(n.subtasks,o.id,d):m(a,o.id,d));}return a}function Vn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,m,d)=>{let i=l.findIndex(s=>s.id===m);if(i===-1){for(let s of l)if(s.subtasks&&n(s.subtasks,m,d))return true;return false}let p=d==="up"?i-1:i+1;return p<0||p>=l.length?false:([l[i],l[p]]=[l[p],l[i]],true)};return n(r,o,a),r}function jn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function Kn(e,t){let a=[...e];for(let r of t){let o=l=>{let m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let d=l[m],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?n(d.subtasks):void 0};return l.splice(m+1,0,i),true},n=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function Cl(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},m=d=>{let i=d.findIndex(s=>s.id===t);if(i===-1){for(let s of d)if(s.subtasks&&m(s.subtasks))return true;return false}let p=a==="above"?i:i+1;return d.splice(p,0,l),true};return m(r),{tasks:r,newTask:l}}function Yn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Yn(r.subtasks,t,a)}:r)}function qn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:qn(a.subtasks,t)}:a)}function Xn(e,t){let a=p=>{for(let s of p){if(s.id===t)return s;if(s.subtasks){let c=a(s.subtasks);if(c)return c}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,m=r?.endDate||n,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(s=>{if(s.id===t){let c=s.subtasks||[];return {...s,subtasks:[...c,d],isExpanded:true}}return s.subtasks?{...s,subtasks:i(s.subtasks)}:s});return {tasks:i(e),newTask:d}}function Tl(e,t,a,r){if(t===a)return e;let o=wl(e,t);if(!o)return e;if(a){let m=(d,i)=>{if(!d.subtasks)return false;for(let p of d.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let n=m=>m.filter(d=>d.id!==t).map(d=>d.subtasks&&d.subtasks.length>0?{...d,subtasks:n(d.subtasks)}:d),l=n(e);if(a===null){let m=r!==void 0?r:l.length;l.splice(m,0,{...o,parentId:void 0});}else {let m=d=>d.map(i=>{if(i.id===a){let p=i.subtasks||[],s=r!==void 0?r:p.length,c=[...p];return c.splice(s,0,{...o,parentId:a}),{...i,subtasks:c,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});l=m(l);}return l}function vo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:d,scrollTop:i,columns:p,onToggleColumn:s,onColumnResize:c,onTaskUpdate:u,onTaskIndent:k,onTaskOutdent:w,onTaskMove:h,onMultiTaskDelete:y,onTaskDuplicate:f,onTaskCreate:g,onTaskRename:T,onCreateSubtask:N,onOpenTaskModal:b,onDeleteRequest:x,onTaskReparent:v}){let S=react.useContext(gr),[C,A]=react.useState(null),[z,P]=react.useState(false),[W,E]=react.useState(null),[$,V]=react.useState(""),re=react.useRef(null),se=react.useRef(null),[Y,R]=react.useState(null),[O,M]=react.useState(0),[ge,te]=react.useState(0),[Fe,Re]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[tt,ve]=react.useState(null),[at,Bt]=react.useState(null),[xt,xa]=react.useState(null),Xt=react.useRef(0),ua=5,jt=react.useRef(false);react.useEffect(()=>{function B(H){re.current&&!re.current.contains(H.target)&&P(false);}if(z)return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[z]),react.useEffect(()=>{W&&se.current&&(se.current.focus(),se.current.select());},[W]),react.useEffect(()=>{if(!Y)return;let B=me=>{let le=me.clientX-O,K=ge+le;c?.(Y,K);},H=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",B),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,O,ge,c]);let{selectedTaskIds:Et,handleTaskClick:Jt,isTaskSelected:ht}=kl(),{setIsEditing:je}=yl({tasks:e,selectedTaskIds:Et,onTaskSelect:(B,H)=>{let le=br(e).map(K=>K.id);Jt(B,le,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:B=>{let H=br(e).find(me=>me.id===B);H&&be(H);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:B=>{let H=br(e).find(me=>me.id===B);H&&b&&b(H);},enableKeyboard:true}),Ut=(B,H=0)=>{let me=[];for(let le of B)me.push({task:le,level:H}),le.subtasks&&le.subtasks.length>0&&le.isExpanded&&me.push(...Ut(le.subtasks,H+1));return me},It=Ut(e),Sa=48,ie=B=>!B.startDate||!B.endDate?"-":`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))}d`,be=B=>{E(B.id),V(B.name),je(true);},Zt=B=>{$.trim()&&$!==e.find(H=>H.id===B)?.name&&T?.(B,$.trim()),E(null),V(""),je(false);},kt=()=>{E(null),V(""),je(false);},Qt=(B,H)=>{H.stopPropagation(),N?.(B.id);},ga=(B,H)=>{H.preventDefault(),Xt.current=H.clientY,ve(B),jt.current=false;},ke=B=>{if(!tt||(Math.abs(B.clientY-Xt.current)>ua&&(jt.current=true),!jt.current))return;let me=document.querySelectorAll("[data-task-row]"),le=null,K=null;me.forEach(we=>{let ee=we.getBoundingClientRect(),I=we.getAttribute("data-task-row");if(I&&I!==tt&&B.clientY>=ee.top&&B.clientY<=ee.bottom){le=I;let X=B.clientY-ee.top,Ce=ee.height;X<Ce*.25?K="above":X>Ce*.75?K="below":K="child";}}),Bt(le),xa(K);},ye=()=>{if(jt.current&&tt&&at&&xt){if(xt==="child")v?.(tt,at);else if(xt==="above"||xt==="below"){let B=(le,K,we=null)=>{for(let ee of le){if(ee.id===K)return we;if(ee.subtasks){let I=B(ee.subtasks,K,ee.id);if(I!==void 0)return I}}},H=B(e,at,null),me=(le,K)=>{let we=le.findIndex(ee=>ee.id===K);return xt==="below"?we+1:we};if(H===null){let le=me(e,at);v?.(tt,null,le);}else {let le=It.find(K=>K.task.id===H)?.task;if(le?.subtasks){let K=me(le.subtasks,at);v?.(tt,H,K);}}}}ve(null),Bt(null),xa(null),jt.current=false;};react.useEffect(()=>{if(tt)return document.addEventListener("mousemove",ke),document.addEventListener("mouseup",ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",ye),document.body.style.cursor="",document.body.style.userSelect="";}},[tt,at,xt]);let Ea=(B,H,me)=>{switch(B.id){case "name":let le=W===H.id,K=C===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${me*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:K?1:.3},onMouseDown:ce=>ga(H.id,ce),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),d?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),le?jsxRuntime.jsx("input",{ref:se,type:"text",value:$,onChange:ce=>V(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"?Zt(H.id):ce.key==="Escape"&&kt();},onBlur:()=>Zt(H.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ce=>ce.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),K&&!le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ce=>ce.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ce=>Qt(H,ce),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),be(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let we=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:we||"",onChange:ce=>{u?.(H.id,{startDate:ce.target.value?new Date(ce.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let ee=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ee||"",onChange:ce=>{u?.(H.id,{endDate:ce.target.value?new Date(ce.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ie(H)})});case "assignees":let I=r.filter(ce=>H.assignees?.some(za=>za.name===ce.name||za.initials===ce.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ha,{assignedUsers:I,availableUsers:r,onChange:ce=>{let za=ce.map(ar=>({id:ar.id,name:ar.name,initials:ar.initials,color:ar.color}));u?.(H.id,{assignees:za.length>0?za:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Ti,{status:H.status||"todo",onChange:ce=>{u?.(H.id,{status:ce,progress:ce==="completed"?100:H.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.progress}%`,backgroundColor:H.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[H.progress,"%"]})]});case "priority":let X={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ce={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},lt=X[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx($a,{priority:lt,onChange:ce=>{ce&&u?.(H.id,{priority:Ce[ce]||"medium"});}})});default:return null}},j=B=>[{id:"hide",label:"Hide Column",icon:Xe.Hide,onClick:()=>s(B),disabled:B==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Xe.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Xe.SortDesc,onClick:()=>{}}],Se=B=>B.subtasks&&B.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{l?.(B);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{N?.(B.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{u?.(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{u?.(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{u?.(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{x?x(B.id,B.name):y?.([B.id]);}}],de=p.filter(B=>B.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[de.map((B,H)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B.id==="name"?"justify-start":"justify-center"}`,style:{width:`${B.width}px`,minWidth:`${B.minWidth??60}px`,maxWidth:`${B.maxWidth??2e3}px`,borderRight:H<de.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box",flexShrink:0,overflow:"hidden"},onContextMenu:me=>{me.preventDefault(),Re({isOpen:true,x:me.clientX,y:me.clientY,type:"header",columnId:B.id});},onMouseEnter:me=>{me.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:me=>{me.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},title:B.label,children:B.label}),B.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Y===B.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:me=>{me.preventDefault(),me.stopPropagation(),R(B.id),M(me.clientX),te(B.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},B.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",style:{backgroundColor:t.bgGrid,flexShrink:0,minWidth:"60px",borderLeft:`1px solid ${t.borderLight}`},children:[jsxRuntime.jsx(fo,{columns:p,onToggleColumn:s,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>P(!z),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),z&&jsxRuntime.jsxs("div",{ref:re,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:It.map(({task:B,level:H},me)=>{let le=ht(B.id),K=at===B.id,we={};return K&&xt&&(xt==="above"?(we.borderTopWidth="2px",we.borderTopStyle="solid",we.borderTopColor=t.accent):xt==="below"?(we.borderBottomWidth="2px",we.borderBottomStyle="solid",we.borderBottomColor=t.accent):xt==="child"&&(we.backgroundColor=t.accentLight,we.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":B.id,className:`flex items-center cursor-pointer group ${tt===B.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:le||K&&xt==="child"?t.accentLight:me%2===0?t.bgPrimary:t.bgGrid,...we},onMouseEnter:()=>A(B.id),onMouseLeave:()=>A(null),onClick:ee=>{let X=br(e).map(ce=>ce.id),lt=navigator.platform.toUpperCase().indexOf("MAC")>=0?ee.metaKey:ee.ctrlKey;Jt(B.id,X,lt,ee.shiftKey),n?.(B);},onDoubleClick:ee=>{ee.stopPropagation(),l?.(B);},onContextMenu:ee=>{ee.preventDefault(),Re({isOpen:true,x:ee.clientX,y:ee.clientY,type:"task",task:B}),m?.(B,ee);},whileHover:{backgroundColor:le?t.accentLight:t.hoverBg},children:de.map((ee,I)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ee.id==="name"?"justify-start":"justify-center"} ${I<de.length-1?"border-r":""}`,style:{width:`${ee.width}px`,minWidth:`${ee.minWidth??60}px`,maxWidth:`${ee.maxWidth??2e3}px`,borderColor:C===B.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box",flexShrink:0,overflow:"hidden"},children:Ea(ee,B,ee.id==="name"?H:0)},`${B.id}-${ee.id}`))},B.id)})}),jsxRuntime.jsx(fr,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,items:Fe.type==="header"&&Fe.columnId?j(Fe.columnId):Fe.type==="task"&&Fe.task?Se(Fe.task):[],onClose:()=>Re({...Fe,isOpen:false}),theme:t})]})}function Nl(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,m]=react.useState(e),[d,i]=react.useState(t),[p,s]=react.useState(null),[c,u]=react.useState(null),[k,w]=react.useState(null),[h,y]=react.useState(null),[f,g]=react.useState(0),[T,N]=react.useState(0),[b,x]=react.useState(null),[v,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:m,ghostWidth:d,setGhostWidth:i,connectionLine:p,setConnectionLine:s,hoveredTaskId:c,setHoveredTaskId:u,activeZone:k,setActiveZone:w,draggedSegmentIndex:h,setDraggedSegmentIndex:y,draggedSegmentStartX:f,setDraggedSegmentStartX:g,segmentDragOffsetX:T,setSegmentDragOffsetX:N,hoveredSegmentIndex:b,setHoveredSegmentIndex:x,isHovered:v,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(W,E)=>{r("none"),s(null),u(null),m(W),i(E),N(0),y(null),g(0);}}}function yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:u=[],onDragMove:k}){let w=Nl(t,r),h=react.useRef(null),{dragMode:y,setDragMode:f,dragOffset:g,setDragOffset:T,ghostX:N,setGhostX:b,ghostWidth:x,setGhostWidth:v,connectionLine:S,setConnectionLine:C,hoveredTaskId:A,setHoveredTaskId:z,activeZone:P,setActiveZone:W,draggedSegmentIndex:E,setDraggedSegmentIndex:$,draggedSegmentStartX:V,setDraggedSegmentStartX:re,segmentDragOffsetX:se,setSegmentDragOffsetX:Y,hoveredSegmentIndex:R,setHoveredSegmentIndex:O,isHovered:M,setIsHovered:ge,isDragging:te,isResizing:Fe,isConnecting:Re,resetDragState:tt}=w,ve=32,at=8,Bt=e.endDate&&e.endDate<new Date&&e.progress<100,xt=e.isCriticalPath,xa=o.name==="neutral"||o.today==="#1C1917",Xt=e.status==="completed"||e.progress===100,ua={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Et=e.isCriticalPath||Bt?"#DC2626":e.color?e.color:e.priority&&ua[e.priority]?ua[e.priority]:o.taskBarPrimary,ht=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),je=r<50,Ut=r<40,It=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Sa=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},ie=j=>Math.round(j/n)*n,be=j=>{let Se=Math.round(j/n),de=new Date(l);return de.setDate(de.getDate()+Se),de},Zt=(j,Se)=>{for(let de of u){if(de.id===e.id)continue;let B=5;if(j>=de.x-B&&j<=de.x+de.width+B&&Se>=de.y-B&&Se<=de.y+de.height+B)return de.id}return null},kt=react.useCallback((j,Se,de)=>{j.preventDefault(),j.stopPropagation();let B=h.current?.ownerSVGElement;if(!B)return;let H=B.createSVGPoint();H.x=j.clientX,H.y=j.clientY;let me=H.matrixTransform(B.getScreenCTM()?.inverse()),le=de!==void 0?de:t,K=Se;if(!K){let we=me.x-le;j.shiftKey?(K="connect",C({x:t+r,y:a+ve/2})):j.ctrlKey||j.metaKey?K="move":j.altKey?K=we<r/2?"resize-start":"resize-end":Ut?we<r/2?K="move":K="resize-end":je?we<=ht/2?K="resize-start":we>=r-ht/2?K="resize-end":K="move":we<=ht?K="resize-start":we>=r-ht?K="resize-end":K="move";}f(K),ge(false),W(null),K==="move"?T(me.x-le):K==="connect"?C({x:t+r,y:a+ve/2}):T(0),b(le),v(r);},[t,r,a,ve]),Qt=react.useCallback(j=>{if(y==="none")return;let Se=h.current?.ownerSVGElement;if(!Se)return;let de=Se.createSVGPoint();de.x=j.clientX,de.y=j.clientY;let B=de.matrixTransform(Se.getScreenCTM()?.inverse());if(y==="connect"){C({x:B.x,y:B.y});let H=Zt(B.x,B.y);z(H);}else if(y==="move"){let H=B.x-g,me=ie(H);b(me),v(r);let le=Math.round((me-t)/n);if(k?.(e.id,le,true),e.segments&&e.segments.length>0&&E!==null){let K=me-V;Y(K);}}else if(y==="resize-start"){let H=B.x,me=ie(H),le=t+r-me;le>=n&&(b(me),v(le));}else if(y==="resize-end"){let H=B.x,le=ie(H)-t;le>=n&&v(le);}},[y,t,r,n,g,e,ie,E,V,Zt,z,C,b,v,Y,k]),ga=react.useCallback(()=>{if(y!=="none"){if(y==="connect")A&&c&&c(e,A),C(null),z(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),Se,de,B=true;if(y==="move"){if(Se=be(N),de=new Date(Se.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let H=Math.round(se/n),me=e.segments.map((ee,I)=>{if(I===E){let X=new Date(ee.startDate),Ce=new Date(ee.endDate);return X.setDate(X.getDate()+H),Ce.setDate(Ce.getDate()+H),{startDate:X,endDate:Ce}}return ee}),le=me.flatMap(ee=>[ee.startDate,ee.endDate]),K=new Date(Math.min(...le.map(ee=>ee.getTime()))),we=new Date(Math.max(...le.map(ee=>ee.getTime())));s?.({...e,segments:me},K,we),tt(t,r);return}}else y==="resize-start"?(Se=be(N),de=e.endDate,Se>=de&&(console.warn("Invalid date range: start date must be before end date"),B=false)):y==="resize-end"?(Se=e.startDate,de=be(N+x),de<=Se&&(console.warn("Invalid date range: end date must be after start date"),B=false)):B=false;B&&Se&&de&&(de.getTime()-Se.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):s?.(e,Se,de));}k?.(e.id,0,false),tt(t,r);}},[y,N,x,e,s,A,c,t,r,n,be,se,E,tt,k]);react.useEffect(()=>{if(y==="none")return;let j=de=>{Qt(de);},Se=()=>{ga();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",Se),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",Se);}},[y,Qt,ga]);let ke=te&&!Re?N:t,ye=te&&!Re?x:r,Ea=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!te&&ge(true),onMouseLeave:()=>{te||(ge(false),W(null));},onClick:()=>!te&&d?.(e),onDoubleClick:j=>{te||(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),p?.(e,j);},children:[M&&!te&&!je&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ht,height:ve,fill:P==="resize-start"?o.accent:"transparent",opacity:P==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-start"),onMouseDown:j=>kt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ht,y:a,width:r-ht*2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-ht,y:a,width:ht,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")})]}),M&&!te&&Ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:P==="move"?o.accent:"transparent",opacity:P==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>W("move"),onMouseDown:j=>kt(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:P==="resize-end"?o.accent:"transparent",opacity:P==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>W("resize-end"),onMouseDown:j=>kt(j,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),te&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:x,height:ve,rx:at,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke,y:a,width:ye,height:ve,rx:at,fill:Et,"data-task-class":Ea,initial:{opacity:0,scale:.95},animate:{opacity:te&&!Re?.15:e.parentId?.6:M?.9:.8,scale:M&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>kt(j),style:{cursor:te?Re?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,Se)=>{let de=(j.startDate.getTime()-l.getTime())/864e5*n,H=(j.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-de+n,me=te&&y==="move"&&E===Se,le=R===Se,K=me?de+se:de;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!te&&O(Se),onMouseLeave:()=>!te&&O(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:H,height:ve,rx:at,fill:Et,initial:{opacity:0,scale:.95},animate:{opacity:me||e.parentId?.6:le?.9:.8,scale:le&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:we=>{we.stopPropagation(),$(Se),re(de),kt(we,void 0,de);},style:{cursor:te?Re?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:H*(e.progress/100),height:ve,rx:at,fill:Et,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Se}`)}),xa&&(Bt||xt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xt&&!Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Bt&&jsxRuntime.jsx("rect",{x:ke,y:a,width:ye,height:ve,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ye>60&&!e.segments&&(()=>{let j=m.taskLabel(e),Se=typeof j=="string"?j:e.name,de=Se.length>Math.floor(ye/8)?`${Se.substring(0,Math.floor(ye/8))}...`:Se;return jsxRuntime.jsx("text",{x:ke+12,y:a+ve/2,dominantBaseline:"middle",fill:Xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Xt?"line-through":"none"},children:de})})(),ye>100&&e.progress>0&&e.progress<100&&!te&&!e.segments&&jsxRuntime.jsxs("text",{x:ke+ye-12,y:a+ve/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ye>80&&!te&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ke+ye-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||Fe)&&!Re&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:je?ke-15:ke-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke-8:ke-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ke+ye-10,y:a-5,width:je?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>kt(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je?ke+ye:ke+ye-3,y:a+6,width:je?8:6,height:je?ve-12:ve-16,rx:3,fill:y==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ve/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:j=>{j.stopPropagation(),kt(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ve/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Re&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:S.x,y2:S.y,stroke:A?o.statusCompleted:o.accent,strokeWidth:A?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:A?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:S.x,cy:S.y,r:A?8:6,fill:A?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),A&&jsxRuntime.jsx(framerMotion.motion.text,{x:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(M||te)&&!Re&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ke-2,y:a-2,width:ye+4,height:ve+4,rx:at+2,fill:"none",stroke:te?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:te?.6:.4,initial:{opacity:0},animate:{opacity:te?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+x,y1:0,x2:N+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!te&&!e.segments&&(()=>{let de=a<100,B=de?a+ve+13:a-82-13,H=de?`M ${ke+ye/2-6} ${a+ve+3} L ${ke+ye/2} ${a+ve+13} L ${ke+ye/2+6} ${a+ve+3}`:`M ${ke+ye/2-6} ${a-13} L ${ke+ye/2} ${a-3} L ${ke+ye/2+6} ${a-13}`,me=B+22,le=B+40,K=B+55,we=B+70,ee=de?B+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:de?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:de?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:H,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ke+ye/2-120,y:B,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:ke+ye/2,y:me,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:ke+ye/2-110,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.startDate)}),jsxRuntime.jsx("text",{x:ke+ye/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ke+ye/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.endDate)}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ke+ye/2+65,y:le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Sa()}),jsxRuntime.jsx("text",{x:ke+ye/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ke+ye/2+65,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ke+ye/2-110,y:we,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ke+ye/2-50,y:we,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(I=>I.name).join(", ").substring(0,30),e.assignees.map(I=>I.name).join(", ").length>30?"...":""]})]}),!de&&jsxRuntime.jsx("text",{x:ke+ye/2,y:ee,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ut?"Left: move \u2022 Right: resize":je?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function ko({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,m]=react.useState(false),d=a-e,i=r-t,p=e+d/2,s=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,c=6,u=Math.atan2(i,d),k=a-c*Math.cos(u-Math.PI/6),w=r-c*Math.sin(u-Math.PI/6),h=a-c*Math.cos(u+Math.PI/6),y=r-c*Math.sin(u+Math.PI/6),f=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:s,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${k} ${w} M ${a} ${r} L ${h} ${y}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:g=>{g.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Co({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),m=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:d(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var q={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,m=new Set,d=i=>{if(!l.has(i)){l.add(i),m.add(i);let p=r.get(i)||[];for(let s of p){if(!l.has(s)&&d(s))return true;if(m.has(s))return true}}return m.delete(i),false};return d(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=q.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=q.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=q.findTaskById(e,o);if(n)a.unshift(n),o=n.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=q.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(n.join(","));}),r.join(`
46
46
  `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=q.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=q.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>q.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=q.findTaskById(e,t);return !a||!a.dependencies?[]:q.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>q.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>q.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=q.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>q.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,n=q.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],m=n.map(d=>{let i=d.startDate&&d.endDate?q.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?q.formatDate(d.startDate):"N/A",d.endDate?q.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(o,{head:l,body:m,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=q.flattenTasks(e).map(d=>{let i=d.startDate&&d.endDate?q.calculateDuration(d.startDate,d.endDate):0;return {"Task ID":d.id,"Task Name":d.name,"Start Date":d.startDate?q.formatDate(d.startDate):"","End Date":d.endDate?q.formatDate(d.endDate):"","Duration (days)":i>0?i:"","Progress (%)":d.progress,Status:d.status||"",Assignees:d.assignees?.map(p=>p.name).join(", ")||"",Dependencies:d.dependencies?.join(", ")||"","Is Milestone":d.isMilestone?"Yes":"No","Parent ID":d.parentId||"",Level:d.level||0}}),n=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=l;let m=a.utils.book_new();a.utils.book_append_sheet(m,n,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=q.flattenTasks(e),o=new Map;r.forEach((c,u)=>{o.set(c.id,u+1);});let n=c=>c.toISOString().replace("Z",""),l=q.getEarliestStartDate(e)||new Date,m=q.getLatestEndDate(e)||new Date,d=r.map((c,u)=>{let k=o.get(c.id),w=c.startDate&&c.endDate?q.calculateDuration(c.startDate,c.endDate):0,h=(c.dependencies||[]).filter(y=>o.has(y)).map(y=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${o.get(y)}</PredecessorUID>
@@ -273,9 +273,9 @@
273
273
  </Calendars>
274
274
  <Tasks>${d}
275
275
  </Tasks>
276
- </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(p),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=q.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=0;if(i.dependencies&&i.dependencies.length>0)for(let u of i.dependencies){let k=t.find(w=>w.id===u);if(k){o(k);let w=r.get(u)?.ef||0;s=Math.max(s,w);}}let c=s+p;r.set(i.id,{es:s,ef:c});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),l=new Map,m=i=>{if(l.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),c=n;if(s.length>0)for(let k of s){m(k);let w=l.get(k.id)?.ls||0;c=Math.min(c,w);}let u=c-p;l.set(i.id,{ls:u,lf:c});};a.forEach(m);let d=[];for(let i of a){let p=r.get(i.id),s=l.get(i.id);if(p&&s){let c=s.ls-p.es;Math.abs(c)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let a=q.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(q.calculateCriticalPath(e).includes(t))return 0;let o=q.getDependentTasks(e,t);if(o.length===0){let m=q.getLatestEndDate(e);if(!m)return null;let d=q.calculateDuration(a.endDate,m);return Math.max(0,d)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,d)=>m-d)[0];if(!n)return null;let l=q.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>q.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=q.findTaskById(e,t);if(!r||!r.endDate)return e;let o=q.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=q.calculateDuration(l.startDate,l.endDate),d;a!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+a)):(d=new Date(r.endDate),d.setDate(d.getDate()+1));let i=q.calculateEndDate(d,m),p=s=>s.map(c=>c.id===l.id?{...c,startDate:d,endDate:i}:c.subtasks?{...c,subtasks:p(c.subtasks)}:c);n=p(n),n=q.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,m)=>{if(a===0)return [];let d=[],i=o.getTime(),p=1e3*60*60*24,s=q.findTaskById(e,t);if(!s||!s.endDate)return [];let c=(u,k,w=new Set)=>{if(w.has(u))return;w.add(u);let h=q.getDependentTasks(e,u);for(let y of h){if(!y.startDate||!y.endDate)continue;let f=r.findIndex(A=>A.id===y.id);if(f===-1)continue;let g=y.startDate.getTime(),N=(y.endDate.getTime()-g)/p,x=(g-i)/p*n,v=x+k*n,S=Math.max(N*n,n),C=m+f*l+12;d.push({taskId:y.id,taskName:y.name,originalX:x,previewX:v,width:S,y:C,rowIndex:f,daysDelta:k,color:y.color}),c(y.id,k,w);}};return c(t,a),d},splitTask:(e,t,a,r=3)=>{let o=q.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let n=new Date(a);n.setDate(n.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let d=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:m}],i=p=>p.map(s=>s.id===o.id?{...s,endDate:m,segments:d}:s.subtasks?{...s,subtasks:i(s.subtasks)}:s);return i(e)}};function Do({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:m,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:p,onTaskDateChange:s,onDependencyCreate:c,onDependencyDelete:u}){let[w,h]=react.useState([]),y=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),f=r==="day"?60:r==="week"?20:8,g=y*f*l,T=E=>{let $=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),V=$.getUTCDay()||7;$.setUTCDate($.getUTCDate()+4-V);let re=new Date(Date.UTC($.getUTCFullYear(),0,1));return Math.ceil((($.getTime()-re.getTime())/864e5+1)/7)},N=E=>{let $=E.getDay();return $===0||$===6},b=react.useCallback(E=>{let $=Math.round(E/(f*l)),V=new Date(o);return V.setDate(V.getDate()+$),V},[o,f,l]),x=react.useCallback((E,$)=>{if($.startDate&&$.endDate)return;let V=E.currentTarget.ownerSVGElement;if(!V)return;let re=V.createSVGPoint();re.x=E.clientX,re.y=E.clientY;let se=re.matrixTransform(V.getScreenCTM()?.inverse()),Y=b(se.x),R=new Date(Y);R.setDate(R.getDate()+1),s?.($,Y,R);},[b,s]),v=react.useMemo(()=>{let E=se=>se.map(Y=>{if(Y.subtasks&&Y.subtasks.length>0){let R=E(Y.subtasks),O=R.filter(M=>M.startDate&&M.endDate);if(O.length>0){let M=O.map(Re=>Re.startDate.getTime()),ge=O.map(Re=>Re.endDate.getTime()),te=new Date(Math.min(...M)),Fe=new Date(Math.max(...ge));return {...Y,subtasks:R,startDate:te,endDate:Fe}}return {...Y,subtasks:R}}return Y}),$=(se,Y=[])=>{for(let R of se)Y.push(R),R.subtasks&&R.subtasks.length>0&&(R.isExpanded===void 0||R.isExpanded)&&$(R.subtasks,Y);return Y},V=E(e);return $(V)},[e]),S=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let $=E.startDate.getTime(),V=E.endDate.getTime(),re=o.getTime(),se=($-re)/(1e3*60*60*24),Y=(V-$)/(1e3*60*60*24),R=se*f*l,O=Math.max(f*l,40),M=Math.max(Y*f*l,O);return {x:R,width:M}},[o,f,l]),C=react.useMemo(()=>v.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:$,width:V}=S(E),se=v.findIndex(Y=>Y.id===E.id)*a+12;return {id:E.id,x:$,y:se,width:V,height:32}}),[v,S]),A=react.useCallback((E,$,V)=>{if(!V||$===0){h([]);return}let re=q.calculateCascadePreview(e,E,$,v,o,f*l,a,48);h(re);},[e,v,o,f,l,a,48]),z=react.useMemo(()=>{let E=[],$=new Date(o);for(;$<=n;){let se=($.getTime()-o.getTime())/864e5*f*l;if(r==="day")E.push({date:new Date($),label:$.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:se}),$.setDate($.getDate()+1);else if(r==="week"){let Y=T($);E.push({date:new Date($),label:`Week ${Y}`,x:se}),$.setDate($.getDate()+7);}else E.push({date:new Date($),label:$.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:se}),$.setMonth($.getMonth()+1);}return E},[o,n,r,f,l]),P=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*f*l,[o,f,l]),W=Math.max(v.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:48,fill:t.bgGrid}),z.map((E,$)=>jsxRuntime.jsxs("g",{children:[$>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${$}`)),P>=0&&P<=g&&jsxRuntime.jsx("circle",{cx:P,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:W,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:W,fill:t.bgPrimary}),z.map((E,$)=>{let V=z[$+1]?.x||g,re=N(E.date);return jsxRuntime.jsxs("g",{children:[re&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:V-E.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),$>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},$)}),P>=0&&P<=g&&jsxRuntime.jsx("line",{x1:P,y1:0,x2:P,y2:v.length*a,stroke:t.today,strokeWidth:2,opacity:1}),v.map((E,$)=>{let V=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:$%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:re=>x(re,E),onMouseEnter:re=>{re.currentTarget.setAttribute("fill",t.accentLight),re.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:re=>{re.currentTarget.setAttribute("fill","transparent"),re.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:P>0?P:100,y:$*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),v.map((E,$)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(V=>{let re=v.find(O=>O.id===V);if(!re||!re.startDate||!re.endDate)return null;let se=v.findIndex(O=>O.id===V),Y=S(re),R=S(E);return jsxRuntime.jsx(ko,{x1:Y.x+Y.width,y1:se*a+a/2,x2:R.x,y2:$*a+a/2,theme:t,onDelete:()=>u?.(E.id,V)},`dep-${V}-${E.id}`)})),v.map((E,$)=>{if(!E.startDate||!E.endDate)return null;let{x:V,width:re}=S(E),se=$*a+12,Y=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Co,{task:E,x:V+re/2,y:se+16,theme:t,onClick:d},E.id):Y?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),onContextMenu:R=>{R.preventDefault(),R.stopPropagation(),p?.(E,R);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:V,y:se,width:re,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V+re,y2:se,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V+re,y1:se,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se+32,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),re>60&&jsxRuntime.jsx("text",{x:V+12,y:se+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(yo,{task:E,x:V,y:se,width:re,theme:t,dayWidth:f*l,startDate:o,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:C,onDragMove:A},E.id)}),w.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`))]})]})}var Pl=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Ml({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Pl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:Pl.find(r=>r.value===e)?.name||"Personalizado"})]})}var Fl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function So({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:m=a?"edit":"create",theme:d="dark",customStatuses:i=[]}){let p=[...Fl,...i.filter(x=>!Fl.some(v=>v.id===x.id))],s=Pe[d]||Pe.dark,[c,u]=react.useState(false),k={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},w={color:s.textSecondary},[h,y]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[f,g]=react.useState({});react.useEffect(()=>{a?(y({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&u(true)):(y({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return h.name.trim()||(x.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),g(x),Object.keys(x).length===0},N=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(v){console.error("Error submitting task:",v);}},b=(x,v)=>{y(S=>{let C={...S,[x]:v};if(x==="progress"){let A=typeof v=="number"?v:parseInt(v,10);A===100&&S.status!=="completed"?C.status="completed":A>0&&A<100&&S.status==="todo"?C.status="in-progress":A===0&&S.status!=="todo"&&(C.status="todo");}return C}),f[x]&&g(S=>{let C={...S};return delete C[x],C});};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 bg-black/50 z-50",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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:s.bgPrimary,border:`1px solid ${s.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:m==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:N,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:w,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:x=>b("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:k,onFocus:x=>x.currentTarget.style.borderColor=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l,autoFocus:true}),f.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),f.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:w,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:s.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:x=>b("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l||h.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:s.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:x=>b("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l||h.isMilestone})]})]}),f.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),f.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:w,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(v=>v.name===x.name),onChange:v=>{let S=v.target.checked?[...h.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(h.assignees||[]).filter(C=>C.name!==x.name);b("assignees",S);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:s.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:x=>b("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l,children:p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:x=>b("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:w,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:x=>b("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:l})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",x),disabled:l,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":s.bgSecondary,color:h.progress===x?"#FFFFFF":s.textTertiary,border:`1px solid ${h.progress===x?"transparent":s.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ml,{value:h.color,onChange:x=>b("color",x),disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:s.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:x=>b("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:k,onFocus:x=>x.currentTarget.style.borderColor=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!c),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:s.textSecondary,backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=s.bgSecondary,children:[c?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:s.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:h.isMilestone,onChange:x=>b("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(x.id),onChange:v=>{let S=v.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",S);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=s.textPrimary,x.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=s.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:N,disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:s.accent,color:"#FFFFFF"},onMouseEnter:x=>!l&&(x.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:x=>!l&&(x.currentTarget.style.backgroundColor=s.accent),children:l?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var bg=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Rl=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),hg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),vg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),xg=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Eo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:m,onDependencyDelete:d}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,k]=react.useState([]),[w,h]=react.useState(""),[y,f]=react.useState(false),[g,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:v=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:A,suggestions:z=bg,maxHistory:P=50,persistHistory:W}=a,E=W?.storageKey||"gantt-ai-history",$=W?.maxMessages??5;react.useEffect(()=>{if(W?.enabled)try{let O=localStorage.getItem(E);if(O){let ge=JSON.parse(O).map(te=>({...te,timestamp:new Date(te.timestamp)}));k(ge.slice(-$));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[W?.enabled,E,$]),react.useEffect(()=>{if(W?.enabled&&u.length>0)try{let O=u.filter(M=>!M.isLoading).slice(-$);localStorage.setItem(E,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,W?.enabled,E,$]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{i&&!s&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,s]);let V=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&n?.(O.newTask);break;case "delete_task":O.taskId&&l?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&d?.(O.taskId,O.dependencyFrom);break}},[o,n,l,m,d]),re=react.useCallback(async O=>{if(!O.trim()||y)return;let M={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};k(te=>[...te.slice(-(P-1)),M]),h(""),T(false),f(true);let ge={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(te=>[...te,ge]);try{if(A){let te=await A(O,e);k(Fe=>{let Re=Fe.filter(ve=>!ve.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:te.message,timestamp:new Date,command:te};return [...Re,tt]}),V(te);}else k(te=>[...te.filter(Re=>!Re.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(te){k(Fe=>[...Fe.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${te instanceof Error?te.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[y,P,A,e,V]),se=O=>{O.preventDefault(),re(w);},Y=O=>{h(O),N.current?.focus();};if(react.useEffect(()=>{let O=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(ge=>!ge),i||c(false)),M.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=ge=>{let te=ge.target;x.current&&!x.current.contains(te)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",O);}},[i]),!v)return null;let R={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Oe,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${R[C]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(Rl,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:s?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${R[C]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Rl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>c(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(yg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(vg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:z.slice(0,4).map((O,M)=>jsxRuntime.jsx("button",{onClick:()=>Y(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},M))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(xg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:se,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:w,onChange:O=>h(O.target.value),placeholder:S,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(hg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ol(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((i,p=true)=>{r(s=>{let c=typeof i=="function"?i(s.present):i;if(o.current)return {...s,present:c};if(!p)return {...s,present:c};let u=[...s.past,s.present];return u.length>t&&u.shift(),{past:u,present:c,future:[]}});},[t]),l=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],s=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:s,present:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],s=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:s}});},[]),d=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Gl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=m?l.metaKey:l.ctrlKey;if(d&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&d&&l.key==="y"){l.preventDefault(),t();return}if(m&&d&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Tg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${q.formatDate(e.startDate)} - ${q.formatDate(e.endDate)}`);let a=q.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=>q.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function zl(e){return {...Tg,...e}}var Ig=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Wl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:m="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:p=[],templates:s,enableAutoCriticalPath:c=true,aiAssistant:u,locale:k="en",customTranslations:w,showCreateTaskButton:h=false,createTaskLabel:y,onCreateTask:f,onThemeChange:g,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:v,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:A,onTaskSetInProgress:z,onDependencyCreate:P,onDependencyDelete:W,onBeforeTaskAdd:E,onAfterTaskAdd:$,onBeforeTaskUpdate:V,onAfterTaskUpdate:re,onBeforeTaskDelete:se,onAfterTaskDelete:Y}=a,O=react.useContext(po)?.theme,[M,ge]=react.useState(O||n||"dark"),[te,Fe]=react.useState(l),[Re,tt]=react.useState(m),[ve,at]=react.useState(1),[Bt,xt]=react.useState(0),[xa,Xt]=react.useState(false),[ua,jt]=react.useState(null),[Et,Jt]=react.useState({isOpen:false,x:0,y:0,task:null}),[ht,je]=react.useState(null),[Ut,It]=react.useState(null);react.useEffect(()=>{O&&O!==M&&ge(O);},[O]),react.useEffect(()=>{n&&n!==M&&ge(n);},[n]);let Sa=react.useCallback(D=>{ge(D),g?.(D);},[g]),{state:ie,setState:be,undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,clearHistory:ke}=Ol(t,50);react.useEffect(()=>{be(t);},[t,be]);let ye=react.useRef(t),Ea=react.useRef(true);react.useEffect(()=>{if(Ea.current){Ea.current=false,ye.current=ie;return}if(!r)return;let D=JSON.stringify(ye.current),F=JSON.stringify(ie);D!==F&&(ye.current=ie,r(ie));},[ie,r]);let j=react.useMemo(()=>zn(k,w),[k,w]),Se=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[de,B]=react.useState(()=>Se(j));react.useEffect(()=>{B(D=>D.map(F=>({...F,label:j.columns[F.id==="name"?"taskName":F.id]||F.label})));},[j]);let H=react.useMemo(()=>de.filter(D=>D.visible).reduce((D,F)=>D+F.width,0)+60,[de]),me=ua||H,le=react.useRef(null),K=react.useRef(null),we=react.useRef(null),ee=react.useMemo(()=>ol(M),[M]),I=react.useMemo(()=>({theme:ee,themeName:M}),[ee,M]),X=react.useMemo(()=>zl(s),[s]),Ce=react.useMemo(()=>{if(!c)return ie;let D=q.calculateCriticalPath(ie),F=_=>_.map(J=>({...J,isCriticalPath:D.includes(J.id),subtasks:J.subtasks?F(J.subtasks):void 0}));return F(ie)},[ie,c]),lt=Ig(Re);Gl({undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>q.findTaskById(ie,D),addTask:(D,F)=>{be(_=>{if(!F)return [..._,{...D,level:0}];let J=oe=>oe.map(pe=>pe.id===F?{...pe,subtasks:[...pe.subtasks||[],{...D,parentId:F,level:(pe.level||0)+1}],isExpanded:true}:pe.subtasks?{...pe,subtasks:J(pe.subtasks)}:pe);return J(_)});},updateTask:(D,F)=>{be(_=>{let J=oe=>oe.map(pe=>pe.id===D?{...pe,...F}:pe.subtasks?{...pe,subtasks:J(pe.subtasks)}:pe);return J(_)});},deleteTask:D=>{be(F=>{let _=J=>J.filter(oe=>oe.id===D?false:(oe.subtasks&&(oe.subtasks=_(oe.subtasks)),true));return _(F)});},deleteTasks:D=>{be(F=>jn(F,D));},duplicateTask:D=>{be(F=>Kn(F,[D]));},splitTask:(D,F,_=3)=>{be(J=>q.splitTask(J,D,F,_));},calculateEndDate:q.calculateEndDate,calculateDuration:q.calculateDuration,validateDependency:(D,F)=>!q.validateDependencies(ie,D,F),getAllTasks:()=>q.flattenTasks(ie),getTasksByStatus:D=>q.flattenTasks(ie).filter(F=>F.status===D),getTasksByParent:D=>D?q.findTaskById(ie,D)?.subtasks||[]:ie.filter(_=>!_.parentId),getCriticalPath:()=>q.flattenTasks(ie).filter(D=>D.isCriticalPath),indentTask:D=>{be(F=>Hn(F,[D]));},outdentTask:D=>{be(F=>_n(F,[D]));},moveTask:(D,F)=>{be(_=>Vn(_,[D],F));},createSubtask:async D=>{let{tasks:F,newTask:_}=Xn(ie,D);if(E){let J=E({..._,parentId:D});if((J instanceof Promise?await J:J)===false)return}be(F),$&&$({..._,parentId:D});},scrollToTask:D=>{let _=q.flattenTasks(ie).findIndex(J=>J.id===D);if(_!==-1&&le.current){let J=_*lt;le.current.scrollTo({top:J,behavior:"smooth"}),K.current&&K.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(D,F=2e3)=>{},expandTask:D=>{be(F=>{let _=J=>J.map(oe=>oe.id===D?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},collapseTask:D=>{be(F=>{let _=J=>J.map(oe=>oe.id===D?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},expandAll:()=>{be(D=>{let F=_=>_.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?F(J.subtasks):void 0}));return F(D)});},collapseAll:()=>{be(D=>{let F=_=>_.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?F(J.subtasks):void 0}));return F(D)});},undo:Zt,redo:kt,canUndo:()=>Qt,canRedo:()=>ga,clearHistory:ke,exportToPNG:async()=>{if(!we.current)throw new Error("Gantt container not found");let D=await $l__default.default(we.current,{backgroundColor:ee.bgPrimary,scale:2});return new Promise((F,_)=>{D.toBlob(J=>{J?F(J):_(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await q.exportToPDF(ie,D);},exportToExcel:async D=>{await q.exportToExcel(ie,D);},exportToJSON:()=>q.exportToJSON(ie),exportToCSV:()=>q.exportToCSV(ie),importFromJSON:D=>{let F=q.importFromJSON(D);be(F);},getTasks:()=>ie,refresh:()=>{be(D=>[...D]);},clearAll:()=>{be([]);}}),[ie,Zt,kt,Qt,ga,ke,ee,lt]);let ce=react.useCallback(D=>{B(F=>F.map(_=>_.id===D?{..._,visible:!_.visible}:_));},[]),za=react.useCallback((D,F)=>{B(_=>_.map(J=>{if(J.id!==D)return J;let oe=J.minWidth??100,pe=J.maxWidth??800,mt=Math.max(oe,Math.min(pe,F));return {...J,width:mt}}));},[]),ar=react.useCallback(D=>{be(F=>qn(F,D)),a.onTaskToggleExpand?.(D);},[a]),rr=react.useCallback((D,F)=>{if(V&&V(D,F)===false)return;let J=q.findTaskById(ie,D)?.progress,oe=mt=>mt.map(Dt=>Dt.id===D?{...Dt,...F}:Dt.subtasks?{...Dt,subtasks:oe(Dt.subtasks)}:Dt);be(oe(ie));let pe=q.findTaskById(oe(ie),D);pe&&(x?.(pe),re?.(pe),F.progress!==void 0&&J!==void 0&&F.progress!==J&&v?.(D,J,F.progress));},[ie,x,V,re,v]),ec=react.useCallback(D=>{D.length!==0&&(be(F=>Hn(F,D)),a.onTaskIndent?.(D[0]));},[a]),tc=react.useCallback(D=>{D.length!==0&&(be(F=>_n(F,D)),a.onTaskOutdent?.(D[0]));},[a]),ac=react.useCallback((D,F,_)=>{be(J=>Tl(J,D,F,_)),a.onTaskReparent?.(D,F,_);},[a]),rc=react.useCallback((D,F)=>{D.length!==0&&(be(_=>Vn(_,D,F)),a.onTaskMove?.(D[0],F));},[a]),jo=react.useCallback(async D=>{let F=[];for(let _ of D)se&&await Promise.resolve(se(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(be(_=>jn(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),Y&&F.forEach(_=>Y(_)));},[a,se,Y]),oc=react.useCallback(D=>{be(F=>Kn(F,D)),D.forEach(F=>a.onTaskDuplicate?.(F));},[a]),nc=react.useCallback((D,F)=>{be(_=>{let{tasks:J,newTask:oe}=Cl(_,D,F);return E&&E(oe)===false?_:(a.onTaskCreate?.(oe.parentId,oe.position||0),$?.(oe),J)});},[a,E,$]),sc=react.useCallback((D,F)=>{be(_=>Yn(_,D,F)),a.onTaskRename?.(D,F);},[a]),Ko=react.useCallback(D=>{be(F=>{let{tasks:_}=Xn(F,D);return a.onTaskCreate?.(D,0),_});},[a]),ic=react.useCallback((D,F,_)=>{let J=D.startDate?Math.round((F.getTime()-D.startDate.getTime())/864e5):0,oe=Dt=>Dt.map(ea=>ea.id===D.id?{...ea,startDate:F,endDate:_,...D.segments&&{segments:D.segments}}:ea.subtasks?{...ea,subtasks:oe(ea.subtasks)}:ea),pe=oe(ie);pe=q.autoScheduleDependents(pe,D.id,J),be(pe);let mt={...D,startDate:F,endDate:_};x?.(mt);},[ie,x]),lc=react.useCallback((D,F)=>{b?.(D,F),Jt({isOpen:true,x:F.clientX,y:F.clientY,task:D});},[b]),dc=react.useCallback((D,F)=>{let _=q.splitTask(ie,D.id,F);be(_),Jt({isOpen:false,x:0,y:0,task:null});},[ie]),Ks=react.useCallback(D=>{N?.(D),S||je(D);},[N,S]),Ys=react.useCallback((D,F,_)=>{let J=new Map,oe=ta=>{ta.forEach(ka=>{ka.dependencies&&J.set(ka.id,ka.dependencies),ka.subtasks&&oe(ka.subtasks);});};oe(_);let pe=J.get(F)||[];J.set(F,[...pe,D]);let mt=new Set,Dt=new Set,ea=ta=>{if(!mt.has(ta)){mt.add(ta),Dt.add(ta);let ka=J.get(ta)||[];for(let wr of ka){if(!mt.has(wr)&&ea(wr))return true;if(Dt.has(wr))return true}}return Dt.delete(ta),false};return ea(F)},[]),qs=react.useCallback((D,F)=>{if(Ys(D.id,F,ie)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(p),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=q.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=0;if(i.dependencies&&i.dependencies.length>0)for(let u of i.dependencies){let k=t.find(w=>w.id===u);if(k){o(k);let w=r.get(u)?.ef||0;s=Math.max(s,w);}}let c=s+p;r.set(i.id,{es:s,ef:c});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(i=>i.ef)),l=new Map,m=i=>{if(l.has(i.id))return;let p=i.startDate&&i.endDate?q.calculateDuration(i.startDate,i.endDate):0,s=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),c=n;if(s.length>0)for(let k of s){m(k);let w=l.get(k.id)?.ls||0;c=Math.min(c,w);}let u=c-p;l.set(i.id,{ls:u,lf:c});};a.forEach(m);let d=[];for(let i of a){let p=r.get(i.id),s=l.get(i.id);if(p&&s){let c=s.ls-p.es;Math.abs(c)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let a=q.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(q.calculateCriticalPath(e).includes(t))return 0;let o=q.getDependentTasks(e,t);if(o.length===0){let m=q.getLatestEndDate(e);if(!m)return null;let d=q.calculateDuration(a.endDate,m);return Math.max(0,d)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,d)=>m-d)[0];if(!n)return null;let l=q.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>q.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=q.findTaskById(e,t);if(!r||!r.endDate)return e;let o=q.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=q.calculateDuration(l.startDate,l.endDate),d;a!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+a)):(d=new Date(r.endDate),d.setDate(d.getDate()+1));let i=q.calculateEndDate(d,m),p=s=>s.map(c=>c.id===l.id?{...c,startDate:d,endDate:i}:c.subtasks?{...c,subtasks:p(c.subtasks)}:c);n=p(n),n=q.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,m)=>{if(a===0)return [];let d=[],i=o.getTime(),p=1e3*60*60*24,s=q.findTaskById(e,t);if(!s||!s.endDate)return [];let c=(u,k,w=new Set)=>{if(w.has(u))return;w.add(u);let h=q.getDependentTasks(e,u);for(let y of h){if(!y.startDate||!y.endDate)continue;let f=r.findIndex(A=>A.id===y.id);if(f===-1)continue;let g=y.startDate.getTime(),N=(y.endDate.getTime()-g)/p,x=(g-i)/p*n,v=x+k*n,S=Math.max(N*n,n),C=m+f*l+12;d.push({taskId:y.id,taskName:y.name,originalX:x,previewX:v,width:S,y:C,rowIndex:f,daysDelta:k,color:y.color}),c(y.id,k,w);}};return c(t,a),d},splitTask:(e,t,a,r=3)=>{let o=q.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let n=new Date(a);n.setDate(n.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let d=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:m}],i=p=>p.map(s=>s.id===o.id?{...s,endDate:m,segments:d}:s.subtasks?{...s,subtasks:i(s.subtasks)}:s);return i(e)}};function Do({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:m,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:p,onTaskDateChange:s,onDependencyCreate:c,onDependencyDelete:u}){let[w,h]=react.useState([]),y=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),f=r==="day"?60:r==="week"?20:8,g=y*f*l,T=E=>{let $=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),V=$.getUTCDay()||7;$.setUTCDate($.getUTCDate()+4-V);let re=new Date(Date.UTC($.getUTCFullYear(),0,1));return Math.ceil((($.getTime()-re.getTime())/864e5+1)/7)},N=E=>{let $=E.getDay();return $===0||$===6},b=react.useCallback(E=>{let $=Math.round(E/(f*l)),V=new Date(o);return V.setDate(V.getDate()+$),V},[o,f,l]),x=react.useCallback((E,$)=>{if($.startDate&&$.endDate)return;let V=E.currentTarget.ownerSVGElement;if(!V)return;let re=V.createSVGPoint();re.x=E.clientX,re.y=E.clientY;let se=re.matrixTransform(V.getScreenCTM()?.inverse()),Y=b(se.x),R=new Date(Y);R.setDate(R.getDate()+1),s?.($,Y,R);},[b,s]),v=react.useMemo(()=>{let E=se=>se.map(Y=>{if(Y.subtasks&&Y.subtasks.length>0){let R=E(Y.subtasks),O=R.filter(M=>M.startDate&&M.endDate);if(O.length>0){let M=O.map(Re=>Re.startDate.getTime()),ge=O.map(Re=>Re.endDate.getTime()),te=new Date(Math.min(...M)),Fe=new Date(Math.max(...ge));return {...Y,subtasks:R,startDate:te,endDate:Fe}}return {...Y,subtasks:R}}return Y}),$=(se,Y=[])=>{for(let R of se)Y.push(R),R.subtasks&&R.subtasks.length>0&&(R.isExpanded===void 0||R.isExpanded)&&$(R.subtasks,Y);return Y},V=E(e);return $(V)},[e]),S=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let $=E.startDate.getTime(),V=E.endDate.getTime(),re=o.getTime(),se=($-re)/(1e3*60*60*24),Y=(V-$)/(1e3*60*60*24),R=se*f*l,O=Math.max(f*l,40),M=Math.max(Y*f*l,O);return {x:R,width:M}},[o,f,l]),C=react.useMemo(()=>v.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:$,width:V}=S(E),se=v.findIndex(Y=>Y.id===E.id)*a+12;return {id:E.id,x:$,y:se,width:V,height:32}}),[v,S]),A=react.useCallback((E,$,V)=>{if(!V||$===0){h([]);return}let re=q.calculateCascadePreview(e,E,$,v,o,f*l,a,48);h(re);},[e,v,o,f,l,a,48]),z=react.useMemo(()=>{let E=[],$=new Date(o);for(;$<=n;){let se=($.getTime()-o.getTime())/864e5*f*l;if(r==="day")E.push({date:new Date($),label:$.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:se}),$.setDate($.getDate()+1);else if(r==="week"){let Y=T($);E.push({date:new Date($),label:`Week ${Y}`,x:se}),$.setDate($.getDate()+7);}else E.push({date:new Date($),label:$.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:se}),$.setMonth($.getMonth()+1);}return E},[o,n,r,f,l]),P=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*f*l,[o,f,l]),W=Math.max(v.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:48,fill:t.bgGrid}),z.map((E,$)=>jsxRuntime.jsxs("g",{children:[$>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${$}`)),P>=0&&P<=g&&jsxRuntime.jsx("circle",{cx:P,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:W,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:W,fill:t.bgPrimary}),z.map((E,$)=>{let V=z[$+1]?.x||g,re=N(E.date);return jsxRuntime.jsxs("g",{children:[re&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:V-E.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),$>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},$)}),P>=0&&P<=g&&jsxRuntime.jsx("line",{x1:P,y1:0,x2:P,y2:v.length*a,stroke:t.today,strokeWidth:2,opacity:1}),v.map((E,$)=>{let V=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:$%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:g,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:re=>x(re,E),onMouseEnter:re=>{re.currentTarget.setAttribute("fill",t.accentLight),re.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:re=>{re.currentTarget.setAttribute("fill","transparent"),re.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:P>0?P:100,y:$*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),v.map((E,$)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(V=>{let re=v.find(O=>O.id===V);if(!re||!re.startDate||!re.endDate)return null;let se=v.findIndex(O=>O.id===V),Y=S(re),R=S(E);return jsxRuntime.jsx(ko,{x1:Y.x+Y.width,y1:se*a+a/2,x2:R.x,y2:$*a+a/2,theme:t,onDelete:()=>u?.(E.id,V)},`dep-${V}-${E.id}`)})),v.map((E,$)=>{if(!E.startDate||!E.endDate)return null;let{x:V,width:re}=S(E),se=$*a+12,Y=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Co,{task:E,x:V+re/2,y:se+16,theme:t,onClick:d},E.id):Y?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),onContextMenu:R=>{R.preventDefault(),R.stopPropagation(),p?.(E,R);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:V,y:se,width:re,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V+re,y2:se,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se,x2:V,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V+re,y1:se,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:se+32,x2:V+re,y2:se+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),re>60&&jsxRuntime.jsx("text",{x:V+12,y:se+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(yo,{task:E,x:V,y:se,width:re,theme:t,dayWidth:f*l,startDate:o,templates:m,onClick:d,onDoubleClick:i,onContextMenu:p,onDateChange:s,onDependencyCreate:c,allTaskPositions:C,onDragMove:A},E.id)}),w.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`))]})]})}var Pl=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Ml({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Pl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:Pl.find(r=>r.value===e)?.name||"Personalizado"})]})}var Fl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function So({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:m=a?"edit":"create",theme:d="dark",customStatuses:i=[]}){let p=[...Fl,...i.filter(x=>!Fl.some(v=>v.id===x.id))],s=Pe[d]||Pe.dark,[c,u]=react.useState(false),k={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},w={color:s.textSecondary},[h,y]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[f,g]=react.useState({});react.useEffect(()=>{a?(y({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&u(true)):(y({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),u(false));},[a,e]);let T=()=>{let x={};return h.name.trim()||(x.name="El nombre es requerido"),h.startDate&&h.endDate&&h.startDate>h.endDate&&(x.endDate="La fecha de fin debe ser posterior a la de inicio"),g(x),Object.keys(x).length===0},N=async x=>{if(x.preventDefault(),!!T())try{await n(h),t();}catch(v){console.error("Error submitting task:",v);}},b=(x,v)=>{y(S=>{let C={...S,[x]:v};if(x==="progress"){let A=typeof v=="number"?v:parseInt(v,10);A===100&&S.status!=="completed"?C.status="completed":A>0&&A<100&&S.status==="todo"?C.status="in-progress":A===0&&S.status!=="todo"&&(C.status="todo");}return C}),f[x]&&g(S=>{let C={...S};return delete C[x],C});};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 bg-black/50 z-50",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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:s.bgPrimary,border:`1px solid ${s.border}`},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:m==="create"?"Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:N,className:"p-6 space-y-5 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1.5",style:w,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:h.name,onChange:x=>b("name",x.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:k,onFocus:x=>x.currentTarget.style.borderColor=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l,autoFocus:true}),f.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),f.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium flex items-center gap-2",style:w,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fechas"]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:s.textTertiary},children:"Inicio"}),jsxRuntime.jsx("input",{type:"date",value:h.startDate?h.startDate.toISOString().split("T")[0]:"",onChange:x=>b("startDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l||h.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"text-xs block mb-1",style:{color:s.textTertiary},children:"Fin"}),jsxRuntime.jsx("input",{type:"date",value:h.endDate?h.endDate.toISOString().split("T")[0]:"",onChange:x=>b("endDate",x.target.value?new Date(x.target.value):void 0),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l||h.isMilestone})]})]}),f.endDate&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),f.endDate]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1.5 flex items-center gap-2",style:w,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),o.length>0?jsxRuntime.jsx("div",{className:"space-y-1 max-h-[88px] overflow-y-auto p-2 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.assignees?.some(v=>v.name===x.name),onChange:v=>{let S=v.target.checked?[...h.assignees||[],{id:x.id,name:x.name,avatar:x.avatar,initials:x.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(h.assignees||[]).filter(C=>C.name!==x.name);b("assignees",S);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold flex-shrink-0",style:{backgroundColor:s.accent},children:x.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:x.name})]},x.id))}):jsxRuntime.jsx("div",{className:"p-3 rounded-lg text-sm text-center",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textTertiary},children:"No hay usuarios disponibles"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),"Estado"]}),jsxRuntime.jsx("select",{value:h.status,onChange:x=>b("status",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l,children:p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.title},x.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:h.priority||"medium",onChange:x=>b("priority",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent text-sm",style:k,disabled:l,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center justify-between",style:w,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-1.5 py-0.5 rounded text-xs",style:{color:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981",backgroundColor:h.progress<30?"rgba(239, 68, 68, 0.1)":h.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[h.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress,onChange:x=>b("progress",parseInt(x.target.value)),className:"flex-1 h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:h.progress<30?"#EF4444":h.progress<70?"#F59E0B":"#10B981"},disabled:l})}),jsxRuntime.jsx("div",{className:"flex gap-1 mt-1.5",children:[0,50,100].map(x=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>b("progress",x),disabled:l,className:"flex-1 px-1 py-0.5 text-xs font-medium rounded transition-all",style:{backgroundColor:h.progress===x?x<30?"#EF4444":x<70?"#F59E0B":"#10B981":s.bgSecondary,color:h.progress===x?"#FFFFFF":s.textTertiary,border:`1px solid ${h.progress===x?"transparent":s.borderLight}`},children:[x,"%"]},x))})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-2 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"}),"Color"]}),jsxRuntime.jsx(Ml,{value:h.color,onChange:x=>b("color",x),disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),"Descripci\xF3n",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:s.textTertiary},children:"(opcional)"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:x=>b("description",x.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none text-sm",style:k,onFocus:x=>x.currentTarget.style.borderColor=s.accent,onBlur:x=>x.currentTarget.style.borderColor=s.borderLight,placeholder:"Describe los detalles de la tarea...",rows:2,disabled:l})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>u(!c),className:"flex items-center gap-2 text-sm font-medium w-full py-2 px-3 rounded-lg transition-colors",style:{color:s.textSecondary,backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},onMouseEnter:x=>x.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:x=>x.currentTarget.style.backgroundColor=s.bgSecondary,children:[c?jsxRuntime.jsx(lucideReact.ChevronUp,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),"Opciones avanzadas",jsxRuntime.jsx("span",{className:"text-xs font-normal",style:{color:s.textTertiary},children:"(hito, dependencias)"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-4 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:h.isMilestone,onChange:x=>b("isMilestone",x.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-xs font-medium mb-1.5 flex items-center gap-1.5",style:w,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-28 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:r.filter(x=>x.id!==a?.id).map(x=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer p-1.5 rounded text-sm",onMouseEnter:v=>v.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:h.dependencies?.includes(x.id),onChange:v=>{let S=v.target.checked?[...h.dependencies||[],x.id]:(h.dependencies||[]).filter(C=>C!==x.id);b("dependencies",S);},className:"w-4 h-4 rounded flex-shrink-0",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("span",{className:"truncate",style:{color:s.textPrimary},children:x.name})]},x.id))})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:x=>{x.currentTarget.style.color=s.textPrimary,x.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:x=>{x.currentTarget.style.color=s.textSecondary,x.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:N,disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:s.accent,color:"#FFFFFF"},onMouseEnter:x=>!l&&(x.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:x=>!l&&(x.currentTarget.style.backgroundColor=s.accent),children:l?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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var bg=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Rl=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),hg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),vg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),xg=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Eo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:m,onDependencyDelete:d}){let[i,p]=react.useState(false),[s,c]=react.useState(false),[u,k]=react.useState([]),[w,h]=react.useState(""),[y,f]=react.useState(false),[g,T]=react.useState(true),N=react.useRef(null),b=react.useRef(null),x=react.useRef(null),{enabled:v=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:C="bottom-right",onCommand:A,suggestions:z=bg,maxHistory:P=50,persistHistory:W}=a,E=W?.storageKey||"gantt-ai-history",$=W?.maxMessages??5;react.useEffect(()=>{if(W?.enabled)try{let O=localStorage.getItem(E);if(O){let ge=JSON.parse(O).map(te=>({...te,timestamp:new Date(te.timestamp)}));k(ge.slice(-$));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[W?.enabled,E,$]),react.useEffect(()=>{if(W?.enabled&&u.length>0)try{let O=u.filter(M=>!M.isLoading).slice(-$);localStorage.setItem(E,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,W?.enabled,E,$]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{i&&!s&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,s]);let V=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&n?.(O.newTask);break;case "delete_task":O.taskId&&l?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&d?.(O.taskId,O.dependencyFrom);break}},[o,n,l,m,d]),re=react.useCallback(async O=>{if(!O.trim()||y)return;let M={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};k(te=>[...te.slice(-(P-1)),M]),h(""),T(false),f(true);let ge={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(te=>[...te,ge]);try{if(A){let te=await A(O,e);k(Fe=>{let Re=Fe.filter(ve=>!ve.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:te.message,timestamp:new Date,command:te};return [...Re,tt]}),V(te);}else k(te=>[...te.filter(Re=>!Re.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(te){k(Fe=>[...Fe.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${te instanceof Error?te.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[y,P,A,e,V]),se=O=>{O.preventDefault(),re(w);},Y=O=>{h(O),N.current?.focus();};if(react.useEffect(()=>{let O=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(ge=>!ge),i||c(false)),M.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=ge=>{let te=ge.target;x.current&&!x.current.contains(te)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",O);}},[i]),!v)return null;let R={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Oe,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${R[C]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(Rl,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:s?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${R[C]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Rl,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>c(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(yg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(vg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:z.slice(0,4).map((O,M)=>jsxRuntime.jsx("button",{onClick:()=>Y(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},M))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(xg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:se,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,type:"text",value:w,onChange:O=>h(O.target.value),placeholder:S,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(hg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ol(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((i,p=true)=>{r(s=>{let c=typeof i=="function"?i(s.present):i;if(o.current)return {...s,present:c};if(!p)return {...s,present:c};let u=[...s.past,s.present];return u.length>t&&u.shift(),{past:u,present:c,future:[]}});},[t]),l=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],s=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:s,present:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],s=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:s}});},[]),d=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Gl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=m?l.metaKey:l.ctrlKey;if(d&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&d&&l.key==="y"){l.preventDefault(),t();return}if(m&&d&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Tg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${q.formatDate(e.startDate)} - ${q.formatDate(e.endDate)}`);let a=q.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=>q.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function zl(e){return {...Tg,...e}}var Ig=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Wl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:m="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:p=[],templates:s,enableAutoCriticalPath:c=true,aiAssistant:u,locale:k="en",customTranslations:w,showCreateTaskButton:h=false,createTaskLabel:y,onCreateTask:f,onThemeChange:g,onTaskClick:T,onTaskDblClick:N,onTaskContextMenu:b,onTaskUpdate:x,onProgressChange:v,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:A,onTaskSetInProgress:z,onDependencyCreate:P,onDependencyDelete:W,onBeforeTaskAdd:E,onAfterTaskAdd:$,onBeforeTaskUpdate:V,onAfterTaskUpdate:re,onBeforeTaskDelete:se,onAfterTaskDelete:Y}=a,O=react.useContext(po)?.theme,[M,ge]=react.useState(O||n||"dark"),[te,Fe]=react.useState(l),[Re,tt]=react.useState(m),[ve,at]=react.useState(1),[Bt,xt]=react.useState(0),[xa,Xt]=react.useState(false),[ua,jt]=react.useState(null),[Et,Jt]=react.useState({isOpen:false,x:0,y:0,task:null}),[ht,je]=react.useState(null),[Ut,It]=react.useState(null);react.useEffect(()=>{O&&O!==M&&ge(O);},[O]),react.useEffect(()=>{n&&n!==M&&ge(n);},[n]);let Sa=react.useCallback(D=>{ge(D),g?.(D);},[g]),{state:ie,setState:be,undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,clearHistory:ke}=Ol(t,50);react.useEffect(()=>{be(t);},[t,be]);let ye=react.useRef(t),Ea=react.useRef(true);react.useEffect(()=>{if(Ea.current){Ea.current=false,ye.current=ie;return}if(!r)return;let D=JSON.stringify(ye.current),F=JSON.stringify(ie);D!==F&&(ye.current=ie,r(ie));},[ie,r]);let j=react.useMemo(()=>zn(k,w),[k,w]),Se=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[de,B]=react.useState(()=>Se(j));react.useEffect(()=>{B(D=>D.map(F=>({...F,label:j.columns[F.id==="name"?"taskName":F.id]||F.label})));},[j]);let H=react.useMemo(()=>de.filter(D=>D.visible).reduce((D,F)=>D+F.width,0)+60,[de]),me=Math.max(280,ua||H),le=react.useRef(null),K=react.useRef(null),we=react.useRef(null),ee=react.useMemo(()=>ol(M),[M]),I=react.useMemo(()=>({theme:ee,themeName:M}),[ee,M]),X=react.useMemo(()=>zl(s),[s]),Ce=react.useMemo(()=>{if(!c)return ie;let D=q.calculateCriticalPath(ie),F=_=>_.map(J=>({...J,isCriticalPath:D.includes(J.id),subtasks:J.subtasks?F(J.subtasks):void 0}));return F(ie)},[ie,c]),lt=Ig(Re);Gl({undo:Zt,redo:kt,canUndo:Qt,canRedo:ga,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>q.findTaskById(ie,D),addTask:(D,F)=>{be(_=>{if(!F)return [..._,{...D,level:0}];let J=oe=>oe.map(pe=>pe.id===F?{...pe,subtasks:[...pe.subtasks||[],{...D,parentId:F,level:(pe.level||0)+1}],isExpanded:true}:pe.subtasks?{...pe,subtasks:J(pe.subtasks)}:pe);return J(_)});},updateTask:(D,F)=>{be(_=>{let J=oe=>oe.map(pe=>pe.id===D?{...pe,...F}:pe.subtasks?{...pe,subtasks:J(pe.subtasks)}:pe);return J(_)});},deleteTask:D=>{be(F=>{let _=J=>J.filter(oe=>oe.id===D?false:(oe.subtasks&&(oe.subtasks=_(oe.subtasks)),true));return _(F)});},deleteTasks:D=>{be(F=>jn(F,D));},duplicateTask:D=>{be(F=>Kn(F,[D]));},splitTask:(D,F,_=3)=>{be(J=>q.splitTask(J,D,F,_));},calculateEndDate:q.calculateEndDate,calculateDuration:q.calculateDuration,validateDependency:(D,F)=>!q.validateDependencies(ie,D,F),getAllTasks:()=>q.flattenTasks(ie),getTasksByStatus:D=>q.flattenTasks(ie).filter(F=>F.status===D),getTasksByParent:D=>D?q.findTaskById(ie,D)?.subtasks||[]:ie.filter(_=>!_.parentId),getCriticalPath:()=>q.flattenTasks(ie).filter(D=>D.isCriticalPath),indentTask:D=>{be(F=>Hn(F,[D]));},outdentTask:D=>{be(F=>_n(F,[D]));},moveTask:(D,F)=>{be(_=>Vn(_,[D],F));},createSubtask:async D=>{let{tasks:F,newTask:_}=Xn(ie,D);if(E){let J=E({..._,parentId:D});if((J instanceof Promise?await J:J)===false)return}be(F),$&&$({..._,parentId:D});},scrollToTask:D=>{let _=q.flattenTasks(ie).findIndex(J=>J.id===D);if(_!==-1&&le.current){let J=_*lt;le.current.scrollTo({top:J,behavior:"smooth"}),K.current&&K.current.scrollTo({top:J,behavior:"smooth"});}},highlightTask:(D,F=2e3)=>{},expandTask:D=>{be(F=>{let _=J=>J.map(oe=>oe.id===D?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},collapseTask:D=>{be(F=>{let _=J=>J.map(oe=>oe.id===D?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe);return _(F)});},expandAll:()=>{be(D=>{let F=_=>_.map(J=>({...J,isExpanded:true,subtasks:J.subtasks?F(J.subtasks):void 0}));return F(D)});},collapseAll:()=>{be(D=>{let F=_=>_.map(J=>({...J,isExpanded:false,subtasks:J.subtasks?F(J.subtasks):void 0}));return F(D)});},undo:Zt,redo:kt,canUndo:()=>Qt,canRedo:()=>ga,clearHistory:ke,exportToPNG:async()=>{if(!we.current)throw new Error("Gantt container not found");let D=await $l__default.default(we.current,{backgroundColor:ee.bgPrimary,scale:2});return new Promise((F,_)=>{D.toBlob(J=>{J?F(J):_(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await q.exportToPDF(ie,D);},exportToExcel:async D=>{await q.exportToExcel(ie,D);},exportToJSON:()=>q.exportToJSON(ie),exportToCSV:()=>q.exportToCSV(ie),importFromJSON:D=>{let F=q.importFromJSON(D);be(F);},getTasks:()=>ie,refresh:()=>{be(D=>[...D]);},clearAll:()=>{be([]);}}),[ie,Zt,kt,Qt,ga,ke,ee,lt]);let ce=react.useCallback(D=>{B(F=>F.map(_=>_.id===D?{..._,visible:!_.visible}:_));},[]),za=react.useCallback((D,F)=>{B(_=>_.map(J=>{if(J.id!==D)return J;let oe=J.minWidth??100,pe=J.maxWidth??800,mt=Math.max(oe,Math.min(pe,F));return {...J,width:mt}}));},[]),ar=react.useCallback(D=>{be(F=>qn(F,D)),a.onTaskToggleExpand?.(D);},[a]),rr=react.useCallback((D,F)=>{if(V&&V(D,F)===false)return;let J=q.findTaskById(ie,D)?.progress,oe=mt=>mt.map(Dt=>Dt.id===D?{...Dt,...F}:Dt.subtasks?{...Dt,subtasks:oe(Dt.subtasks)}:Dt);be(oe(ie));let pe=q.findTaskById(oe(ie),D);pe&&(x?.(pe),re?.(pe),F.progress!==void 0&&J!==void 0&&F.progress!==J&&v?.(D,J,F.progress));},[ie,x,V,re,v]),ec=react.useCallback(D=>{D.length!==0&&(be(F=>Hn(F,D)),a.onTaskIndent?.(D[0]));},[a]),tc=react.useCallback(D=>{D.length!==0&&(be(F=>_n(F,D)),a.onTaskOutdent?.(D[0]));},[a]),ac=react.useCallback((D,F,_)=>{be(J=>Tl(J,D,F,_)),a.onTaskReparent?.(D,F,_);},[a]),rc=react.useCallback((D,F)=>{D.length!==0&&(be(_=>Vn(_,D,F)),a.onTaskMove?.(D[0],F));},[a]),jo=react.useCallback(async D=>{let F=[];for(let _ of D)se&&await Promise.resolve(se(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(be(_=>jn(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),Y&&F.forEach(_=>Y(_)));},[a,se,Y]),oc=react.useCallback(D=>{be(F=>Kn(F,D)),D.forEach(F=>a.onTaskDuplicate?.(F));},[a]),nc=react.useCallback((D,F)=>{be(_=>{let{tasks:J,newTask:oe}=Cl(_,D,F);return E&&E(oe)===false?_:(a.onTaskCreate?.(oe.parentId,oe.position||0),$?.(oe),J)});},[a,E,$]),sc=react.useCallback((D,F)=>{be(_=>Yn(_,D,F)),a.onTaskRename?.(D,F);},[a]),Ko=react.useCallback(D=>{be(F=>{let{tasks:_}=Xn(F,D);return a.onTaskCreate?.(D,0),_});},[a]),ic=react.useCallback((D,F,_)=>{let J=D.startDate?Math.round((F.getTime()-D.startDate.getTime())/864e5):0,oe=Dt=>Dt.map(ea=>ea.id===D.id?{...ea,startDate:F,endDate:_,...D.segments&&{segments:D.segments}}:ea.subtasks?{...ea,subtasks:oe(ea.subtasks)}:ea),pe=oe(ie);pe=q.autoScheduleDependents(pe,D.id,J),be(pe);let mt={...D,startDate:F,endDate:_};x?.(mt);},[ie,x]),lc=react.useCallback((D,F)=>{b?.(D,F),Jt({isOpen:true,x:F.clientX,y:F.clientY,task:D});},[b]),dc=react.useCallback((D,F)=>{let _=q.splitTask(ie,D.id,F);be(_),Jt({isOpen:false,x:0,y:0,task:null});},[ie]),Ks=react.useCallback(D=>{N?.(D),S||je(D);},[N,S]),Ys=react.useCallback((D,F,_)=>{let J=new Map,oe=ta=>{ta.forEach(ka=>{ka.dependencies&&J.set(ka.id,ka.dependencies),ka.subtasks&&oe(ka.subtasks);});};oe(_);let pe=J.get(F)||[];J.set(F,[...pe,D]);let mt=new Set,Dt=new Set,ea=ta=>{if(!mt.has(ta)){mt.add(ta),Dt.add(ta);let ka=J.get(ta)||[];for(let wr of ka){if(!mt.has(wr)&&ea(wr))return true;if(Dt.has(wr))return true}}return Dt.delete(ta),false};return ea(F)},[]),qs=react.useCallback((D,F)=>{if(Ys(D.id,F,ie)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
277
277
 
278
- Task dependencies must flow in one direction only.`);return}let _=J=>J.map(oe=>{if(oe.id===F){let pe=oe.dependencies||[];if(!pe.includes(D.id))return {...oe,dependencies:[...pe,D.id]}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),P?.(D.id,F);},[ie,P,Ys]),Xs=react.useCallback((D,F)=>{let _=J=>J.map(oe=>{if(oe.id===D&&oe.dependencies){let pe=oe.dependencies.filter(mt=>mt!==F);return {...oe,dependencies:pe}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),W?.(D,F);},[ie,W]),{startDate:cc,endDate:mc}=react.useMemo(()=>{let D=ie.filter(pe=>pe.startDate&&pe.endDate);if(D.length===0){let pe=new Date,mt=new Date(pe);mt.setDate(mt.getDate()-30);let Dt=new Date(pe);return Dt.setDate(Dt.getDate()+60),{startDate:mt,endDate:Dt}}let F=D.flatMap(pe=>[pe.startDate,pe.endDate]).filter(pe=>pe!==void 0),_=new Date(Math.min(...F.map(pe=>pe.getTime()))),J=new Date(Math.max(...F.map(pe=>pe.getTime()))),oe=te==="day"?7:te==="week"?14:30;return _.setDate(_.getDate()-oe),J.setDate(J.getDate()+oe),{startDate:_,endDate:J}},[ie,te]),pc=react.useCallback(async()=>{if(!we.current)return;let D=await $l__default.default(we.current,{backgroundColor:ee.bgPrimary,scale:2}),F=document.createElement("a");F.download="gantt-chart.png",F.href=D.toDataURL("image/png"),F.click();},[ee]),uc=react.useCallback(async()=>{await q.exportToPDF(ie);},[ie]),gc=react.useCallback(async()=>{await q.exportToExcel(ie);},[ie]),fc=react.useCallback(()=>{let D=q.exportToCSV(ie),F=new Blob([D],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[ie]),bc=react.useCallback(()=>{let D=q.exportToJSON(ie),F=new Blob([D],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[ie]),hc=react.useCallback(()=>{q.exportToMSProject(ie,"Gantt Project","project.xml");},[ie]),vc=D=>{D.preventDefault(),Xt(true);};return react.useEffect(()=>{let D=K.current,F=le.current;if(!D||!F)return;let _=F.querySelector(".gantt-taskgrid-content"),J=()=>{let mt=D.scrollTop;xt(mt),_&&(_.style.transform=`translateY(-${mt}px)`);},oe=mt=>{if(xa&&F){let ea=F.parentElement?.getBoundingClientRect()?.left||0,ta=mt.clientX-ea,ka=200,wr=Math.min(window.innerWidth-300,800);ta>=ka&&ta<=wr&&jt(ta);}},pe=()=>{Xt(false);};return D.addEventListener("scroll",J),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",pe),()=>{D.removeEventListener("scroll",J),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",pe);}},[xa]),jsxRuntime.jsx(gr.Provider,{value:j,children:jsxRuntime.jsx(Zo.Provider,{value:I,children:jsxRuntime.jsxs("div",{ref:we,className:"flex flex-col h-full w-full",style:{backgroundColor:ee.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(go,{theme:ee,timeScale:te,onTimeScaleChange:Fe,zoom:ve,onZoomChange:at,currentTheme:M,onThemeChange:Sa,rowDensity:Re,onRowDensityChange:tt,showThemeSelector:d,showCreateTaskButton:h,createTaskLabel:y,onCreateTask:f,onExportPNG:i?pc:void 0,onExportPDF:i?uc:void 0,onExportExcel:i?gc:void 0,onExportCSV:i?fc:void 0,onExportJSON:i?bc:void 0,onExportMSProject:i?hc:void 0}),jsxRuntime.jsxs("div",{ref:le,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:me,overflow:"hidden"},children:jsxRuntime.jsx(vo,{tasks:Ce,theme:ee,rowHeight:lt,availableUsers:p,templates:X,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:b,onTaskToggle:ar,scrollTop:Bt,columns:de,onToggleColumn:ce,onColumnResize:za,onTaskUpdate:rr,onTaskIndent:ec,onTaskOutdent:tc,onTaskMove:rc,onMultiTaskDelete:jo,onTaskDuplicate:oc,onTaskCreate:nc,onTaskRename:sc,onCreateSubtask:Ko,onOpenTaskModal:T?D=>T(D):void 0,onDeleteRequest:(D,F)=>It({taskId:D,taskName:F}),onTaskReparent:ac})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:vc}),jsxRuntime.jsx("div",{ref:K,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Do,{tasks:Ce,theme:ee,rowHeight:lt,timeScale:te,startDate:cc,endDate:mc,zoom:ve,templates:X,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:lc,onTaskDateChange:ic,onDependencyCreate:qs,onDependencyDelete:Xs})})]}),Et.task&&jsxRuntime.jsx(fr,{isOpen:Et.isOpen,x:Et.x,y:Et.y,theme:ee,onClose:()=>Jt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=Et.task;return D?D.subtasks&&D.subtasks.length>0?[{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[{id:"edit",label:j.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{S?S(D):je(D);}},{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:j.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{A?A(D):rr(D.id,{status:"todo",progress:0});},disabled:D.status==="todo"},{id:"setInProgress",label:j.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{z?z(D):rr(D.id,{status:"in-progress"});},disabled:D.status==="in-progress"},{id:"markComplete",label:j.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{rr(D.id,{status:"completed",progress:100});},disabled:D.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:j.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{if(!D.startDate||!D.endDate){console.warn("Cannot split task without dates");return}let _=D.startDate.getTime(),J=D.endDate.getTime(),oe=_+(J-_)/2,pe=new Date(oe);dc(D,pe);},disabled:!D.startDate||!D.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[]})()}),ht&&jsxRuntime.jsx(So,{isOpen:true,onClose:()=>je(null),task:ht,onSubmit:D=>{rr(ht.id,D),je(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ut&&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:()=>It(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:D=>D.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ee.bgSecondary,border:`1px solid ${ee.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ee.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:ee.textPrimary,fontFamily:"Inter, sans-serif"},children:[j.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ee.textSecondary,fontFamily:"Inter, sans-serif"},children:k==="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:ee.textSecondary,fontFamily:"Inter, sans-serif"},children:[k==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ee.textPrimary},children:['"',Ut.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ee.bgPrimary,borderTop:`1px solid ${ee.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>It(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ee.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=ee.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:k==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{jo([Ut.taskId]),It(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:D=>{D.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),k==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Eo,{tasks:ie,theme:ee,config:u,onTasksUpdate:be,onTaskUpdate:rr,onTaskCreate:D=>{be(F=>[...F,D]);},onTaskDelete:D=>{jo([D]);},onDependencyCreate:(D,F)=>{let _=q.findTaskById(ie,D);_&&qs(_,F);},onDependencyDelete:Xs})]})})})});var Hl=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
278
+ Task dependencies must flow in one direction only.`);return}let _=J=>J.map(oe=>{if(oe.id===F){let pe=oe.dependencies||[];if(!pe.includes(D.id))return {...oe,dependencies:[...pe,D.id]}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),P?.(D.id,F);},[ie,P,Ys]),Xs=react.useCallback((D,F)=>{let _=J=>J.map(oe=>{if(oe.id===D&&oe.dependencies){let pe=oe.dependencies.filter(mt=>mt!==F);return {...oe,dependencies:pe}}return oe.subtasks?{...oe,subtasks:_(oe.subtasks)}:oe});be(_(ie)),W?.(D,F);},[ie,W]),{startDate:cc,endDate:mc}=react.useMemo(()=>{let D=ie.filter(pe=>pe.startDate&&pe.endDate);if(D.length===0){let pe=new Date,mt=new Date(pe);mt.setDate(mt.getDate()-30);let Dt=new Date(pe);return Dt.setDate(Dt.getDate()+60),{startDate:mt,endDate:Dt}}let F=D.flatMap(pe=>[pe.startDate,pe.endDate]).filter(pe=>pe!==void 0),_=new Date(Math.min(...F.map(pe=>pe.getTime()))),J=new Date(Math.max(...F.map(pe=>pe.getTime()))),oe=te==="day"?7:te==="week"?14:30;return _.setDate(_.getDate()-oe),J.setDate(J.getDate()+oe),{startDate:_,endDate:J}},[ie,te]),pc=react.useCallback(async()=>{if(!we.current)return;let D=await $l__default.default(we.current,{backgroundColor:ee.bgPrimary,scale:2}),F=document.createElement("a");F.download="gantt-chart.png",F.href=D.toDataURL("image/png"),F.click();},[ee]),uc=react.useCallback(async()=>{await q.exportToPDF(ie);},[ie]),gc=react.useCallback(async()=>{await q.exportToExcel(ie);},[ie]),fc=react.useCallback(()=>{let D=q.exportToCSV(ie),F=new Blob([D],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[ie]),bc=react.useCallback(()=>{let D=q.exportToJSON(ie),F=new Blob([D],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[ie]),hc=react.useCallback(()=>{q.exportToMSProject(ie,"Gantt Project","project.xml");},[ie]),vc=D=>{D.preventDefault(),Xt(true);};return react.useEffect(()=>{let D=K.current,F=le.current;if(!D||!F)return;let _=F.querySelector(".gantt-taskgrid-content"),J=()=>{let mt=D.scrollTop;xt(mt),_&&(_.style.transform=`translateY(-${mt}px)`);},oe=mt=>{if(xa&&F){let ea=F.parentElement?.getBoundingClientRect()?.left||0,ta=mt.clientX-ea,ka=280,wr=Math.min(window.innerWidth-300,800);ta>=ka&&ta<=wr&&jt(ta);}},pe=()=>{Xt(false);};return D.addEventListener("scroll",J),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",pe),()=>{D.removeEventListener("scroll",J),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",pe);}},[xa]),jsxRuntime.jsx(gr.Provider,{value:j,children:jsxRuntime.jsx(Zo.Provider,{value:I,children:jsxRuntime.jsxs("div",{ref:we,className:"flex flex-col h-full w-full",style:{backgroundColor:ee.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(go,{theme:ee,timeScale:te,onTimeScaleChange:Fe,zoom:ve,onZoomChange:at,currentTheme:M,onThemeChange:Sa,rowDensity:Re,onRowDensityChange:tt,showThemeSelector:d,showCreateTaskButton:h,createTaskLabel:y,onCreateTask:f,onExportPNG:i?pc:void 0,onExportPDF:i?uc:void 0,onExportExcel:i?gc:void 0,onExportCSV:i?fc:void 0,onExportJSON:i?bc:void 0,onExportMSProject:i?hc:void 0}),jsxRuntime.jsxs("div",{ref:le,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:me,overflow:"hidden"},children:jsxRuntime.jsx(vo,{tasks:Ce,theme:ee,rowHeight:lt,availableUsers:p,templates:X,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:b,onTaskToggle:ar,scrollTop:Bt,columns:de,onToggleColumn:ce,onColumnResize:za,onTaskUpdate:rr,onTaskIndent:ec,onTaskOutdent:tc,onTaskMove:rc,onMultiTaskDelete:jo,onTaskDuplicate:oc,onTaskCreate:nc,onTaskRename:sc,onCreateSubtask:Ko,onOpenTaskModal:T?D=>T(D):void 0,onDeleteRequest:(D,F)=>It({taskId:D,taskName:F}),onTaskReparent:ac})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:vc}),jsxRuntime.jsx("div",{ref:K,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Do,{tasks:Ce,theme:ee,rowHeight:lt,timeScale:te,startDate:cc,endDate:mc,zoom:ve,templates:X,onTaskClick:T,onTaskDblClick:Ks,onTaskContextMenu:lc,onTaskDateChange:ic,onDependencyCreate:qs,onDependencyDelete:Xs})})]}),Et.task&&jsxRuntime.jsx(fr,{isOpen:Et.isOpen,x:Et.x,y:Et.y,theme:ee,onClose:()=>Jt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=Et.task;return D?D.subtasks&&D.subtasks.length>0?[{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[{id:"edit",label:j.contextMenu?.editTask||"Edit Task",icon:Xe.Pencil,onClick:()=>{S?S(D):je(D);}},{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Xe.Add,onClick:()=>{C?C(D):Ko(D.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:j.contextMenu?.markIncomplete||"Mark Incomplete",icon:Xe.MarkIncomplete,onClick:()=>{A?A(D):rr(D.id,{status:"todo",progress:0});},disabled:D.status==="todo"},{id:"setInProgress",label:j.contextMenu?.setInProgress||"Set In Progress",icon:Xe.SetInProgress,onClick:()=>{z?z(D):rr(D.id,{status:"in-progress"});},disabled:D.status==="in-progress"},{id:"markComplete",label:j.contextMenu?.markComplete||"Mark Complete",icon:Xe.MarkComplete,onClick:()=>{rr(D.id,{status:"completed",progress:100});},disabled:D.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:j.contextMenu?.splitTask||"Split Task",icon:Xe.Split,onClick:()=>{if(!D.startDate||!D.endDate){console.warn("Cannot split task without dates");return}let _=D.startDate.getTime(),J=D.endDate.getTime(),oe=_+(J-_)/2,pe=new Date(oe);dc(D,pe);},disabled:!D.startDate||!D.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Xe.Delete,onClick:()=>{It({taskId:D.id,taskName:D.name});}}]:[]})()}),ht&&jsxRuntime.jsx(So,{isOpen:true,onClose:()=>je(null),task:ht,onSubmit:D=>{rr(ht.id,D),je(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ut&&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:()=>It(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:D=>D.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ee.bgSecondary,border:`1px solid ${ee.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ee.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:ee.textPrimary,fontFamily:"Inter, sans-serif"},children:[j.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ee.textSecondary,fontFamily:"Inter, sans-serif"},children:k==="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:ee.textSecondary,fontFamily:"Inter, sans-serif"},children:[k==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ee.textPrimary},children:['"',Ut.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ee.bgPrimary,borderTop:`1px solid ${ee.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>It(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ee.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=ee.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:k==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{jo([Ut.taskId]),It(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:D=>{D.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),k==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Eo,{tasks:ie,theme:ee,config:u,onTasksUpdate:be,onTaskUpdate:rr,onTaskCreate:D=>{be(F=>[...F,D]);},onTaskDelete:D=>{jo([D]);},onDependencyCreate:(D,F)=>{let _=q.findTaskById(ie,D);_&&qs(_,F);},onDependencyDelete:Xs})]})})})});var Hl=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
279
 
280
280
  AVAILABLE COMMANDS:
281
281
  1. move_task - Move a task to a different date