@libxai/board 0.16.11 → 0.16.12
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _o({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ce.useRef(null);Ce.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:oe("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:oe("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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,u])=>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:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 Ho({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=Ce.useState("export"),[d,i]=Ce.useState("json"),[u,l]=Ce.useState(null),p=Ce.useRef(null);if(!t)return null;let m=async()=>{let x=n?.current||void 0,h=await ni(e,d,x);oi(h,d);},b=async x=>{let h=x.target.files?.[0];if(h){try{let g=await li(h),v=h.name.endsWith(".json")?"json":"csv",f=ii(g,v);l(f),f.success&&a&&a(f,g);}catch(g){l({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,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:()=>c("export"),className:oe("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:oe("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:[s==="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(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:oe("p-4 rounded-lg border-2 transition-all text-center",d===x?"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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:m,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"})]}),s==="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:p,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.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"})]})]}),u&&jsxRuntime.jsxs("div",{className:oe("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:oe("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Vm=["URGENT","HIGH","MEDIUM","LOW"],Km=[{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"}],jm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Vo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:c,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:p=false,groupBy:m="none",onGroupByChange:b}){let[x,h]=Ce.useState(true),g=Ce.useCallback(y=>{r({search:y.target.value});},[r]),v=Ce.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Ce.useCallback(y=>{a({by:y.target.value});},[a]),w=Ce.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=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 ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:x?"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"}),k&&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)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,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:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:y=>{let C=y.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Vm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let C=y.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let C=y.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:Km.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:y=>b(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ko({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:c,onExportGanttCSV:d}){let[i,u]=Ce.useState(false),l=Ce.useRef(null);Ce.useEffect(()=>{let m=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:oe("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.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:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await o?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await s?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await c?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(r),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 jo={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"}},Yo={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"}},qo={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"}},Hr={dark:jo,light:Yo,neutral:qo},En="dark";var Rn=Ce.createContext(void 0),af="asakaa-theme";function Pl({children:e,defaultTheme:t=En,storageKey:r=af}){let[a,n]=Ce.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=Ce.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);Ce.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,d=Hr[a];Object.entries(d.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${nf(u)}`,l);}),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(([u,l])=>{let p=d.colors[u];p&&c.style.setProperty(l,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Rn.Provider,{value:s,children:e})}function ca(){let e=Ce.useContext(Rn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function nf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ca();return e?jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",r),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(Hr).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:oe("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var ke={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",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:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function Il(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ke[e]||ke.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",ke[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ke[e].bgSecondary),bgGrid:a("--theme-bg-card",ke[e].bgGrid),bgWeekend:a("--theme-bg-hover",ke[e].bgWeekend),border:a("--theme-border-primary",ke[e].border),borderLight:a("--theme-border-subtle",ke[e].borderLight),textPrimary:a("--theme-text-primary",ke[e].textPrimary),textSecondary:a("--theme-text-secondary",ke[e].textSecondary),textTertiary:a("--theme-text-tertiary",ke[e].textTertiary),accent:a("--theme-accent-primary",ke[e].accent),accentHover:a("--theme-accent-hover",ke[e].accentHover),accentLight:a("--theme-accent-primary",ke[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ke[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ke[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ke[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ke[e].dependency),dependencyHover:a("--theme-border-secondary",ke[e].dependencyHover),criticalPath:a("--theme-error",ke[e].criticalPath),criticalPathLight:a("--theme-error",ke[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ke[e].today):e==="neutral"?a("--theme-text-primary",ke[e].today):a("--theme-error",ke[e].today),todayLight:e==="light"?a("--theme-accent-primary",ke[e].todayLight):e==="neutral"?a("--theme-text-primary",ke[e].todayLight):a("--theme-error",ke[e].todayLight),milestone:a("--theme-warning",ke[e].milestone),milestoneLight:a("--theme-warning",ke[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ke[e].statusTodo),statusInProgress:a("--theme-accent-primary",ke[e].statusInProgress),statusCompleted:a("--theme-success",ke[e].statusCompleted),hoverBg:a("--theme-bg-hover",ke[e].hoverBg),focusRing:a("--theme-accent-primary",ke[e].focusRing)}}var Pn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},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"}},Ml={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},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"}},Jo={en:Pn,es:Ml};function Al(e){return Jo[e]||Jo.en}function Zo(e,t){let r=Al(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var ua=Ce.createContext(Pn);function Ga(){return Ce.useContext(ua)}function wf({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,d]=Ce.useState(false),[i,u]=Ce.useState(null),l=Ce.useRef(null),p=Ga();if(Ce.useEffect(()=>{let h=g=>{l.current&&!l.current.contains(g.target)&&d(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||o||s))return null;let b=[{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:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(h=>h.handler),x=async(h,g)=>{if(g){u(h);try{await g();}catch(v){console.error(`Export ${h} failed:`,v);}finally{u(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#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:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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:b.map((h,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(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:g<b.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.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 Cf({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(o.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:s?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),o.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.label})]},o.value)})})}function Tf({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:o?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500},whileHover:{color:o?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function Df({theme:e,value:t,onChange:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ga();Ce.useEffect(()=>{let i=u=>{o.current&&!o.current.contains(u.target)&&n(false);};return a&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],d=c.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:o,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(!a),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:a?e.accentLight:e.bgSecondary,border:`1px solid ${a?e.accent:e.borderLight}`,color:a?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${s.toolbar.density||"Density"}: ${d}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&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:c.map((i,u)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(i.value),n(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:u<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function In({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:c,onRowDensityChange:d,showThemeSelector:i=true,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:p,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}){let f=Ga(),w=m||b||x||h||g||v,k=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],y=[{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(Tf,{options:k,value:t,onChange:C=>r(C),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:()=>n(Math.max(.5,a-.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(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.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(Df,{theme:e,value:c,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||f.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wf,{theme:e,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Cf,{options:y,value:o,onChange:C=>s(C),theme:e})]})]})}function Mn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({x:0,y:0}),c=Ce.useRef(null),d=Ce.useRef(null);Ce.useEffect(()=>{if(!a)return;let u=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!a&&d.current){let u=d.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function pa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Ce.useRef(null);return Ce.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},d=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),n());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},c.id))})})}):null}var nt={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 Vl({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:p=true}){let m=Ce.useRef(false),b=Ce.useCallback(f=>{m.current=f;},[]),x=Ce.useCallback(f=>{let w=[],k=y=>{for(let C of y)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(f),w},[]),h=Ce.useCallback(()=>{let f=x(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,x]),g=Ce.useCallback((f,w)=>{let k=x(e);if(k.length===0)return;let y=h();if(!y){r(k[0].id,false);return}let C=k.findIndex(R=>R.id===y.id);if(C===-1)return;let T=f==="up"?C-1:C+1;if(T<0||T>=k.length)return;let N=k[T];r(N.id,w);},[e,h,x,r]),v=Ce.useCallback(f=>{if(!p)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){f.key==="Escape"&&(w.blur(),m.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=Array.from(t),N=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(N&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!N.isExpanded||f.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){T.length>0&&(f.preventDefault(),s(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),d(T));return}if(f.key==="Enter"&&!f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"above"));return}if(f.key==="Enter"&&C){N&&(f.preventDefault(),l(N.id));return}if(f.key==="F2"){N&&(f.preventDefault(),i(N.id));return}if(f.key==="Delete"||f.key==="Backspace"&&C){T.length>0&&(f.preventDefault(),n(T));return}if(f.key==="d"&&C&&!f.shiftKey){T.length>0&&(f.preventDefault(),o(T));return}},[p,t,h,g,a,n,o,s,c,d,i,u,l]);return Ce.useEffect(()=>{if(p)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[p,v]),{setIsEditing:b}}function jl(){let[e,t]=Ce.useState(new Set),[r,a]=Ce.useState(null),n=Ce.useCallback(l=>{t(new Set([l])),a(l);},[]),o=Ce.useCallback(l=>{t(p=>{let m=new Set(p);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=Ce.useCallback((l,p)=>{if(!r){n(l);return}let m=p.indexOf(r),b=p.indexOf(l);if(m===-1||b===-1){n(l);return}let x=Math.min(m,b),h=Math.max(m,b),g=p.slice(x,h+1);t(new Set(g)),a(l);},[r,n]),c=Ce.useCallback((l,p,m,b)=>{b?s(l,p):m?o(l):n(l);},[n,o,s]),d=Ce.useCallback((l,p)=>{p?t(m=>{let b=new Set(m);return b.add(l),b}):n(l);},[n]),i=Ce.useCallback(()=>{t(new Set),a(null);},[]),u=Ce.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function ma(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let c={...a[s],parentId:n,level:o,position:s};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,o+1);}};return r(e),t}function ts(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ts(r.subtasks,t);if(a)return a}return null}function rs(e,t){if(t.length===0)return e;let r=ma(e),a=t[0],n=r.findIndex(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,p)=>{let m=[];return {tasks:l.filter(x=>{if(p.has(x.id))return m.push(x),false;if(x.subtasks){let h=s(x.subtasks,p);x.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,p,m)=>l.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...m],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,p,m)}:b),d=new Set(t),{tasks:i,removed:u}=s(e,d);return c(i,o.id,u)}function as(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ts(r,a);if(!n)continue;let o=ts(r,n.id),s=(i,u,l)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===u&&m.subtasks){let b=m.subtasks.findIndex(x=>x.id===l);if(b!==-1){let[x]=m.subtasks.splice(b,1);return x}}if(m.subtasks){let b=s(m.subtasks,u,l);if(b)return b}}return null},c=(i,u,l)=>{let p=i.findIndex(m=>m.id===u);if(p!==-1)return i.splice(p+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,u,l);return i},d=s(r,n.id,a);d&&(o&&o.subtasks?c(o.subtasks,n.id,d):c(r,n.id,d));}return r}function ns(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,d)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function An(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function os(e,t){let r=[...e];for(let a of t){let n=s=>{let c=s.findIndex(u=>u.id===a);if(c===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let d=s[c],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?o(d.subtasks):void 0};return s.splice(c+1,0,i),true},o=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Yl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},c=d=>{let i=d.findIndex(l=>l.id===t);if(i===-1){for(let l of d)if(l.subtasks&&c(l.subtasks))return true;return false}let u=r==="above"?i:i+1;return d.splice(u,0,s),true};return c(a),{tasks:a,newTask:s}}function ss(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ss(a.subtasks,t,r)}:a)}function is(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:is(r.subtasks,t)}:r)}function ls(e,t){let r=u=>{for(let l of u){if(l.id===t)return l;if(l.subtasks){let p=r(l.subtasks);if(p)return p}}return null},a=r(e),n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s=a?.startDate||n,c=a?.endDate||o,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(c),color:a?.color||"#3B82F6"},i=u=>u.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,d],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:d}}var Jl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Zl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ql({status:e="todo",onChange:t,className:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({top:0,left:0}),c=Ce.useRef(null),d=Ce.useRef(null);Ce.useEffect(()=>{if(a&&d.current){let p=d.current.getBoundingClientRect();s({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),Ce.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!d.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),Ce.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let i=p=>{t(p),n(false);},u=Jl[e],l=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${l}10`,boxShadow:`0 0 0 2px ${l}30 inset`},title:u.label,children:jsxRuntime.jsx(Zl,{icon:u.icon,color:l})}),a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(Jl).map(([p,m])=>jsxRuntime.jsxs("button",{onClick:()=>i(p),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:m.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zl,{icon:m.icon,color:m.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:m.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p))})]})})]})}function Ln({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:c,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:p,onTaskUpdate:m,onTaskIndent:b,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let C=Ce.useContext(ua),[T,N]=Ce.useState(null),[R,U]=Ce.useState(false),[H,M]=Ce.useState(null),[$,E]=Ce.useState(""),B=Ce.useRef(null),G=Ce.useRef(null),[O,F]=Ce.useState(null),[Q,Y]=Ce.useState(0),[pe,I]=Ce.useState(0),[le,se]=Ce.useState({isOpen:false,x:0,y:0,type:"header"});Ce.useEffect(()=>{function j(z){B.current&&!B.current.contains(z.target)&&U(false);}if(R)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[R]),Ce.useEffect(()=>{H&&G.current&&(G.current.focus(),G.current.select());},[H]),Ce.useEffect(()=>{if(!O)return;let j=Fe=>{let ze=Fe.clientX-Q,te=pe+ze;p?.(O,te);},z=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",z),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",z),document.body.style.cursor="",document.body.style.userSelect="";}},[O,Q,pe,p]);let{selectedTaskIds:bt,handleTaskClick:Ze,isTaskSelected:ar}=jl(),{setIsEditing:we}=Vl({tasks:e,selectedTaskIds:bt,onTaskSelect:(j,z)=>{let ze=ma(e).map(te=>te.id);Ze(j,ze,z||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:j=>{let z=ma(e).find(Fe=>Fe.id===j);z&&Lr(z);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:j=>{let z=ma(e).find(Fe=>Fe.id===j);z&&y&&y(z);},enableKeyboard:true}),mt=(j,z=0)=>{let Fe=[];for(let ze of j)Fe.push({task:ze,level:z}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Fe.push(...mt(ze.subtasks,z+1));return Fe},ft=mt(e),_t=48,pr=j=>!j.startDate||!j.endDate?"-":`${Math.ceil((j.endDate.getTime()-j.startDate.getTime())/(1e3*60*60*24))}d`,Lr=j=>{M(j.id),E(j.name),we(true);},ge=j=>{$.trim()&&$!==e.find(z=>z.id===j)?.name&&w?.(j,$.trim()),M(null),E(""),we(false);},Qe=()=>{M(null),E(""),we(false);},Wt=(j,z)=>{z.stopPropagation(),k?.(j.id);},Bt=(j,z,Fe)=>{switch(j.id){case "name":let ze=H===z.id,te=T===z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Fe*20}px`},children:[z.subtasks&&z.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),d?.(z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:z.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:z.color||"#3B82F6",opacity:z.parentId?.6:1,borderColor:z.isMilestone?t.accent:"transparent",borderWidth:z.isMilestone?"2px":"0px"},title:z.isMilestone?"Milestone":z.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:G,type:"text",value:$,onChange:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"?ge(z.id):q.key==="Escape"&&Qe();},onBlur:()=>ge(z.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:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Fe===0?"14px":Fe===1?"13px":"12px",fontWeight:z.isMilestone?600:z.subtasks&&z.subtasks.length>0?500:400,opacity:Fe===0?1:Fe===1?.95:.88},title:z.name,children:z.name}),te&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>Wt(z,q),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:q=>{q.stopPropagation(),Lr(z);},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 ce=z.startDate?typeof z.startDate=="string"?z.startDate:z.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ce||"",onChange:q=>{m?.(z.id,{startDate:q.target.value?new Date(q.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 nr=z.endDate?typeof z.endDate=="string"?z.endDate:z.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:nr||"",onChange:q=>{m?.(z.id,{endDate:q.target.value?new Date(q.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:pr(z)})});case "assignees":let Ot=a.filter(q=>z.assignees?.some(V=>V.name===q.name||V.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:Ot,availableUsers:a,onChange:q=>{let V=q.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));m?.(z.id,{assignees:V.length>0?V:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ql,{status:z.status||"todo",onChange:q=>{m?.(z.id,{status:q,progress:q==="completed"?100:z.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:`${z.progress}%`,backgroundColor:z.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:[z.progress,"%"]})]});default:return null}},Fr=j=>[{id:"hide",label:"Hide Column",icon:nt.Hide,onClick:()=>l(j),disabled:j==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:nt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:nt.SortDesc,onClick:()=>{}}],ne=j=>[{id:"edit",label:C?.contextMenu?.editTask||"Edit Task",icon:nt.Pencil,onClick:()=>{s?.(j);}},{id:"addSubtask",label:C?.contextMenu?.addSubtask||"Add Subtask",icon:nt.Add,onClick:()=>{k?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:C?.contextMenu?.markIncomplete||"Mark Incomplete",icon:nt.MarkIncomplete,onClick:()=>{m?.(j.id,{status:"todo",progress:0});},disabled:j.status==="todo"},{id:"setInProgress",label:C?.contextMenu?.setInProgress||"Set In Progress",icon:nt.SetInProgress,onClick:()=>{m?.(j.id,{status:"in-progress"});},disabled:j.status==="in-progress"},{id:"markComplete",label:C?.contextMenu?.markComplete||"Mark Complete",icon:nt.MarkComplete,onClick:()=>{m?.(j.id,{status:"completed",progress:100});},disabled:j.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:C?.contextMenu?.splitTask||"Split Task",icon:nt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:C?.contextMenu?.deleteTask||"Delete Task",icon:nt.Delete,onClick:()=>{g?.([j.id]);}}],me=u.filter(j=>j.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 border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${_t}px`,paddingLeft:"3px"},children:[me.map(j=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${j.id==="name"?"justify-start":"justify-center"}`,style:{width:`${j.width}px`,minWidth:`${j.width}px`,maxWidth:`${j.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:z=>{z.preventDefault(),se({isOpen:true,x:z.clientX,y:z.clientY,type:"header",columnId:j.id});},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:j.label}),j.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:O===j.id?t.accent:"transparent"},onMouseDown:z=>{z.preventDefault(),z.stopPropagation(),F(j.id),Y(z.clientX),I(j.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},j.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Mn,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>U(!R),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"}),R&&jsxRuntime.jsxs("div",{ref:B,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:j=>j.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:()=>U(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:ft.map(({task:j,level:z},Fe)=>{let ze=ar(j.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${r}px`,boxSizing:"border-box",borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Fe%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>N(j.id),onMouseLeave:()=>N(null),onClick:te=>{let nr=ma(e).map(V=>V.id),q=navigator.platform.toUpperCase().indexOf("MAC")>=0?te.metaKey:te.ctrlKey;Ze(j.id,nr,q,te.shiftKey),o?.(j);},onDoubleClick:te=>{te.stopPropagation(),s?.(j);},onContextMenu:te=>{te.preventDefault(),se({isOpen:true,x:te.clientX,y:te.clientY,type:"task",task:j}),c?.(j,te);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:me.map(te=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${te.id==="name"?"justify-start":"justify-center"}`,style:{width:`${te.width}px`,minWidth:`${te.width}px`,maxWidth:`${te.width}px`,borderColor:T===j.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Bt(te,j,te.id==="name"?z:0)},`${j.id}-${te.id}`))},j.id)})}),jsxRuntime.jsx(pa,{isOpen:le.isOpen,x:le.x,y:le.y,items:le.type==="header"&&le.columnId?Fr(le.columnId):le.type==="task"&&le.task?ne(le.task):[],onClose:()=>se({...le,isOpen:false}),theme:t})]})}function tc(e,t){let[r,a]=Ce.useState("none"),[n,o]=Ce.useState(0),[s,c]=Ce.useState(e),[d,i]=Ce.useState(t),[u,l]=Ce.useState(null),[p,m]=Ce.useState(null),[b,x]=Ce.useState(null),[h,g]=Ce.useState(null),[v,f]=Ce.useState(0),[w,k]=Ce.useState(0),[y,C]=Ce.useState(null),[T,N]=Ce.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:m,activeZone:b,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:($,E)=>{a("none"),l(null),m(null),c($),i(E),k(0),g(null),f(0);}}}function Fn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:b}){let x=tc(t,a),h=Ce.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:C,setGhostWidth:T,connectionLine:N,setConnectionLine:R,hoveredTaskId:U,setHoveredTaskId:H,activeZone:M,setActiveZone:$,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:G,setDraggedSegmentStartX:O,segmentDragOffsetX:F,setSegmentDragOffsetX:Q,hoveredSegmentIndex:Y,setHoveredSegmentIndex:pe,isHovered:I,setIsHovered:le,isDragging:se,isResizing:bt,isConnecting:Ze,resetDragState:ar}=x,we=32,mt=8,ft=e.endDate&&e.endDate<new Date&&e.progress<100,_t=e.isCriticalPath,pr=n.name==="neutral"||n.today==="#1C1917",ge=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),Qe=a<50,Wt=a<40,Bt=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fr=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},ne=V=>Math.round(V/o)*o,me=V=>{let ve=Math.round(V/o),D=new Date(s);return D.setDate(D.getDate()+ve),D},j=(V,ve)=>{for(let D of m){if(D.id===e.id)continue;let _=5;if(V>=D.x-_&&V<=D.x+D.width+_&&ve>=D.y-_&&ve<=D.y+D.height+_)return D.id}return null},z=Ce.useCallback((V,ve,D)=>{V.preventDefault(),V.stopPropagation();let _=h.current?.ownerSVGElement;if(!_)return;let de=_.createSVGPoint();de.x=V.clientX,de.y=V.clientY;let he=de.matrixTransform(_.getScreenCTM()?.inverse()),Ae=D!==void 0?D:t,$e=ve;if(!$e){let Nt=he.x-Ae;V.shiftKey?($e="connect",R({x:t+a,y:r+we/2})):V.ctrlKey||V.metaKey?$e="move":V.altKey?$e=Nt<a/2?"resize-start":"resize-end":Wt?Nt<a/2?$e="move":$e="resize-end":Qe?Nt<=ge/2?$e="resize-start":Nt>=a-ge/2?$e="resize-end":$e="move":Nt<=ge?$e="resize-start":Nt>=a-ge?$e="resize-end":$e="move";}v($e),le(false),$(null),$e==="move"?w(he.x-Ae):$e==="connect"?R({x:t+a,y:r+we/2}):w(0),y(Ae),T(a);},[t,a,r,we]),Fe=Ce.useCallback(V=>{if(g==="none")return;let ve=h.current?.ownerSVGElement;if(!ve)return;let D=ve.createSVGPoint();D.x=V.clientX,D.y=V.clientY;let _=D.matrixTransform(ve.getScreenCTM()?.inverse());if(g==="connect"){R({x:_.x,y:_.y});let de=j(_.x,_.y);H(de);}else if(g==="move"){let de=_.x-f,he=ne(de);y(he),T(a);let Ae=Math.round((he-t)/o);if(b?.(e.id,Ae,true),e.segments&&e.segments.length>0&&E!==null){let $e=he-G;Q($e);}}else if(g==="resize-start"){let de=_.x,he=ne(de),Ae=t+a-he;Ae>=o&&(y(he),T(Ae));}else if(g==="resize-end"){let de=_.x,Ae=ne(de)-t;Ae>=o&&T(Ae);}},[g,t,a,o,f,e,ne,E,G,j,H,R,y,T,Q,b]),ze=Ce.useCallback(()=>{if(g!=="none"){if(g==="connect")U&&p&&p(e,U),R(null),H(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),ve,D,_=true;if(g==="move"){if(ve=me(k),D=new Date(ve.getTime()+V),e.segments&&e.segments.length>0&&E!==null){let de=Math.round(F/o),he=e.segments.map((wt,eo)=>{if(eo===E){let ba=new Date(wt.startDate),ya=new Date(wt.endDate);return ba.setDate(ba.getDate()+de),ya.setDate(ya.getDate()+de),{startDate:ba,endDate:ya}}return wt}),Ae=he.flatMap(wt=>[wt.startDate,wt.endDate]),$e=new Date(Math.min(...Ae.map(wt=>wt.getTime()))),Nt=new Date(Math.max(...Ae.map(wt=>wt.getTime())));l?.({...e,segments:he},$e,Nt),ar(t,a);return}}else g==="resize-start"?(ve=me(k),D=e.endDate,ve>=D&&(console.warn("Invalid date range: start date must be before end date"),_=false)):g==="resize-end"?(ve=e.startDate,D=me(k+C),D<=ve&&(console.warn("Invalid date range: end date must be after start date"),_=false)):_=false;_&&ve&&D&&(D.getTime()-ve.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ve,D));}b?.(e.id,0,false),ar(t,a);}},[g,k,C,e,l,U,p,t,a,o,me,F,E,ar,b]);Ce.useEffect(()=>{if(g==="none")return;let V=D=>{Fe(D);},ve=()=>{ze();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",ve);}},[g,Fe,ze]);let te=se&&!Ze?k:t,ce=se&&!Ze?C:a,nr=c.taskTooltip(e),Ot=typeof nr=="string"?nr:"",q=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!se&&le(true),onMouseLeave:()=>{se||(le(false),$(null));},onClick:()=>!se&&d?.(e),onDoubleClick:V=>{se||(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),u?.(e,V);},children:[Ot&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:Ot}}),I&&!se&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ge,height:we,fill:M==="resize-start"?n.accent:"transparent",opacity:M==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:V=>z(V,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ge,y:r,width:a-ge*2,height:we,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:V=>z(V,"move")}),jsxRuntime.jsx("rect",{x:t+a-ge,y:r,width:ge,height:we,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:V=>z(V,"resize-end")})]}),I&&!se&&Wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:we,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:V=>z(V,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:we,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:V=>z(V,"resize-end")}),I&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+we-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:C,height:we,rx:mt,fill:n.accent,opacity:.5,stroke:n.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:te,y:r,width:ce,height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":q,initial:{opacity:0,scale:.95},animate:{opacity:se&&!Ze?.15:e.parentId?.6:I?.9:.8,scale:I&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>z(V),style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((V,ve)=>{let D=(V.startDate.getTime()-s.getTime())/864e5*o,de=(V.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-D+o,he=se&&g==="move"&&E===ve,Ae=Y===ve,$e=he?D+F:D;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!se&&pe(ve),onMouseLeave:()=>!se&&pe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:r,width:de,height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:Ae?.9:.8,scale:Ae&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Nt=>{Nt.stopPropagation(),B(ve),O(D),z(Nt,void 0,D);},style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:r,width:de*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),pr&&(ft||_t)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_t&&!ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce,height:we,rx:mt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce,height:we,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ce>60&&!e.segments&&(()=>{let V=c.taskLabel(e),ve=typeof V=="string"?V:e.name,D=ve.length>Math.floor(ce/8)?`${ve.substring(0,Math.floor(ce/8))}...`:ve;return jsxRuntime.jsx("text",{x:te+12,y:r+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:D})})(),ce>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ce-12,y:r+we/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&&ce>80&&!se&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ce-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ce-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(I||bt)&&!Ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Qe?te-15:te-10,y:r-5,width:Qe?25:20,height:we+10,fill:"transparent",onMouseDown:V=>z(V,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te-8:te-3,y:r+6,width:Qe?8:6,height:Qe?we-12:we-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="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:te+ce-10,y:r-5,width:Qe?25:20,height:we+10,fill:"transparent",onMouseDown:V=>z(V,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te+ce:te+ce-3,y:r+6,width:Qe?8:6,height:Qe?we-12:we-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&!se&&!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+a+8,cy:r+we/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:V=>{V.stopPropagation(),z(V,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+we/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ze&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+we/2,x2:N.x,y2:N.y,stroke:U?n.statusCompleted:n.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:U?8:6,fill:U?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(I||se)&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:r-2,width:ce+4,height:we+4,rx:mt+2,fill:"none",stroke:se?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+C,y1:0,x2:k+C,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&!se&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:te+ce/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${te+ce/2-6} ${r-13} L ${te+ce/2} ${r-3} L ${te+ce/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:te+ce/2,y:r-73,textAnchor:"middle",fill:n.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:te+ce/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ce/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.startDate)}),jsxRuntime.jsx("text",{x:te+ce/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ce/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.endDate)}),jsxRuntime.jsx("text",{x:te+ce/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ce/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fr()}),jsxRuntime.jsx("text",{x:te+ce/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ce/2+65,y:r-40,fill:n.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:te+ce/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ce/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(V=>V.name).join(", ").substring(0,30),e.assignees.map(V=>V.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:te+ce/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Wt?"Left: move \u2022 Right: resize":Qe?"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 On({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,c]=Ce.useState(false),d=r-e,i=a-t,u=e+d/2,l=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(i,d),b=r-p*Math.cos(m-Math.PI/6),x=a-p*Math.sin(m-Math.PI/6),h=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${b} ${x} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function $n({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Ce.useState(false),c=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:d(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var K={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,c=new Set,d=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=a.get(i)||[];for(let l of u){if(!s.has(l)&&d(l))return true;if(c.has(l))return true}}return c.delete(i),false};return d(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=K.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=K.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=K.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=K.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _o({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ce.useRef(null);Ce.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxRuntime.jsxs("div",{className:oe("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:oe("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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,u])=>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:u.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 Ho({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,c]=Ce.useState("export"),[d,i]=Ce.useState("json"),[u,l]=Ce.useState(null),p=Ce.useRef(null);if(!t)return null;let m=async()=>{let x=n?.current||void 0,h=await ni(e,d,x);oi(h,d);},b=async x=>{let h=x.target.files?.[0];if(h){try{let g=await li(h),v=h.name.endsWith(".json")?"json":"csv",f=ii(g,v);l(f),f.success&&a&&a(f,g);}catch(g){l({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,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:()=>c("export"),className:oe("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:oe("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:[s==="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(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:oe("p-4 rounded-lg border-2 transition-all text-center",d===x?"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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:m,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"})]}),s==="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:p,type:"file",accept:".json,.csv",onChange:b,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.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"})]})]}),u&&jsxRuntime.jsxs("div",{className:oe("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:oe("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Vm=["URGENT","HIGH","MEDIUM","LOW"],Km=[{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"}],jm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Vo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:c,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:p=false,groupBy:m="none",onGroupByChange:b}){let[x,h]=Ce.useState(true),g=Ce.useCallback(y=>{r({search:y.target.value});},[r]),v=Ce.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Ce.useCallback(y=>{a({by:y.target.value});},[a]),w=Ce.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=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 ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:x?"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"}),k&&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)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,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:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:y=>{let C=y.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Vm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let C=y.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),d.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let C=y.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:Km.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:m,onChange:y=>b(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:jm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ko({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:c,onExportGanttCSV:d}){let[i,u]=Ce.useState(false),l=Ce.useRef(null);Ce.useEffect(()=>{let m=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:oe("relative",a),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.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:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>p(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await o?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await s?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(async()=>await c?.()),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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:()=>p(r),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 jo={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"}},Yo={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"}},qo={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"}},Hr={dark:jo,light:Yo,neutral:qo},En="dark";var Rn=Ce.createContext(void 0),af="asakaa-theme";function Pl({children:e,defaultTheme:t=En,storageKey:r=af}){let[a,n]=Ce.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),o=Ce.useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);Ce.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,d=Hr[a];Object.entries(d.colors).forEach(([u,l])=>{l&&c.style.setProperty(`--theme-${nf(u)}`,l);}),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(([u,l])=>{let p=d.colors[u];p&&c.style.setProperty(l,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Hr};return jsxRuntime.jsx(Rn.Provider,{value:s,children:e})}function ca(){let e=Ce.useContext(Rn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function nf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ca();return e?jsxRuntime.jsxs("div",{className:oe("fixed inset-0 z-[9999] flex items-center justify-center",r),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(Hr).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:oe("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var ke={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",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:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function Il(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ke[e]||ke.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",ke[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ke[e].bgSecondary),bgGrid:a("--theme-bg-card",ke[e].bgGrid),bgWeekend:a("--theme-bg-hover",ke[e].bgWeekend),border:a("--theme-border-primary",ke[e].border),borderLight:a("--theme-border-subtle",ke[e].borderLight),textPrimary:a("--theme-text-primary",ke[e].textPrimary),textSecondary:a("--theme-text-secondary",ke[e].textSecondary),textTertiary:a("--theme-text-tertiary",ke[e].textTertiary),accent:a("--theme-accent-primary",ke[e].accent),accentHover:a("--theme-accent-hover",ke[e].accentHover),accentLight:a("--theme-accent-primary",ke[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ke[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ke[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ke[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ke[e].dependency),dependencyHover:a("--theme-border-secondary",ke[e].dependencyHover),criticalPath:a("--theme-error",ke[e].criticalPath),criticalPathLight:a("--theme-error",ke[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ke[e].today):e==="neutral"?a("--theme-text-primary",ke[e].today):a("--theme-error",ke[e].today),todayLight:e==="light"?a("--theme-accent-primary",ke[e].todayLight):e==="neutral"?a("--theme-text-primary",ke[e].todayLight):a("--theme-error",ke[e].todayLight),milestone:a("--theme-warning",ke[e].milestone),milestoneLight:a("--theme-warning",ke[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ke[e].statusTodo),statusInProgress:a("--theme-accent-primary",ke[e].statusInProgress),statusCompleted:a("--theme-success",ke[e].statusCompleted),hoverBg:a("--theme-bg-hover",ke[e].hoverBg),focusRing:a("--theme-accent-primary",ke[e].focusRing)}}var Pn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},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"}},Ml={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},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"}},Jo={en:Pn,es:Ml};function Al(e){return Jo[e]||Jo.en}function Zo(e,t){let r=Al(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var ua=Ce.createContext(Pn);function Ga(){return Ce.useContext(ua)}function wf({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[c,d]=Ce.useState(false),[i,u]=Ce.useState(null),l=Ce.useRef(null),p=Ga();if(Ce.useEffect(()=>{let h=g=>{l.current&&!l.current.contains(g.target)&&d(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||o||s))return null;let b=[{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:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(h=>h.handler),x=async(h,g)=>{if(g){u(h);try{await g();}catch(v){console.error(`Export ${h} failed:`,v);}finally{u(null),d(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#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:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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:b.map((h,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(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:g<b.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.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 Cf({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(o.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:s?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),o.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":a.textTertiary},children:o.label})]},o.value)})})}function Tf({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:o?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500},whileHover:{color:o?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function Df({theme:e,value:t,onChange:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ga();Ce.useEffect(()=>{let i=u=>{o.current&&!o.current.contains(u.target)&&n(false);};return a&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],d=c.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:o,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(!a),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:a?e.accentLight:e.bgSecondary,border:`1px solid ${a?e.accent:e.borderLight}`,color:a?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${s.toolbar.density||"Density"}: ${d}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&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:c.map((i,u)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(i.value),n(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:u<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function In({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:c,onRowDensityChange:d,showThemeSelector:i=true,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:p,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}){let f=Ga(),w=m||b||x||h||g||v,k=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],y=[{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(Tf,{options:k,value:t,onChange:C=>r(C),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:()=>n(Math.max(.5,a-.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(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.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(Df,{theme:e,value:c,onChange:d})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||f.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wf,{theme:e,onExportPNG:m,onExportPDF:b,onExportExcel:x,onExportCSV:h,onExportJSON:g,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Cf,{options:y,value:o,onChange:C=>s(C),theme:e})]})]})}function Mn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({x:0,y:0}),c=Ce.useRef(null),d=Ce.useRef(null);Ce.useEffect(()=>{if(!a)return;let u=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,onClick:()=>{if(!a&&d.current){let u=d.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function pa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Ce.useRef(null);return Ce.useEffect(()=>{if(!e)return;let c=i=>{s.current&&!s.current.contains(i.target)&&n();},d=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),n());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},c.id))})})}):null}var nt={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 Vl({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:c,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:p=true}){let m=Ce.useRef(false),b=Ce.useCallback(f=>{m.current=f;},[]),x=Ce.useCallback(f=>{let w=[],k=y=>{for(let C of y)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(f),w},[]),h=Ce.useCallback(()=>{let f=x(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,x]),g=Ce.useCallback((f,w)=>{let k=x(e);if(k.length===0)return;let y=h();if(!y){r(k[0].id,false);return}let C=k.findIndex(R=>R.id===y.id);if(C===-1)return;let T=f==="up"?C-1:C+1;if(T<0||T>=k.length)return;let N=k[T];r(N.id,w);},[e,h,x,r]),v=Ce.useCallback(f=>{if(!p)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){f.key==="Escape"&&(w.blur(),m.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=Array.from(t),N=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(N&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!N.isExpanded||f.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){T.length>0&&(f.preventDefault(),s(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),d(T));return}if(f.key==="Enter"&&!f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!C){N&&(f.preventDefault(),a(N.id,"above"));return}if(f.key==="Enter"&&C){N&&(f.preventDefault(),l(N.id));return}if(f.key==="F2"){N&&(f.preventDefault(),i(N.id));return}if(f.key==="Delete"||f.key==="Backspace"&&C){T.length>0&&(f.preventDefault(),n(T));return}if(f.key==="d"&&C&&!f.shiftKey){T.length>0&&(f.preventDefault(),o(T));return}},[p,t,h,g,a,n,o,s,c,d,i,u,l]);return Ce.useEffect(()=>{if(p)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[p,v]),{setIsEditing:b}}function jl(){let[e,t]=Ce.useState(new Set),[r,a]=Ce.useState(null),n=Ce.useCallback(l=>{t(new Set([l])),a(l);},[]),o=Ce.useCallback(l=>{t(p=>{let m=new Set(p);return m.has(l)?m.delete(l):m.add(l),m}),a(l);},[]),s=Ce.useCallback((l,p)=>{if(!r){n(l);return}let m=p.indexOf(r),b=p.indexOf(l);if(m===-1||b===-1){n(l);return}let x=Math.min(m,b),h=Math.max(m,b),g=p.slice(x,h+1);t(new Set(g)),a(l);},[r,n]),c=Ce.useCallback((l,p,m,b)=>{b?s(l,p):m?o(l):n(l);},[n,o,s]),d=Ce.useCallback((l,p)=>{p?t(m=>{let b=new Set(m);return b.add(l),b}):n(l);},[n]),i=Ce.useCallback(()=>{t(new Set),a(null);},[]),u=Ce.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:c,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function ma(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let c={...a[s],parentId:n,level:o,position:s};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,o+1);}};return r(e),t}function ts(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ts(r.subtasks,t);if(a)return a}return null}function rs(e,t){if(t.length===0)return e;let r=ma(e),a=t[0],n=r.findIndex(l=>l.id===a);if(n<=0)return e;let o=r[n-1],s=(l,p)=>{let m=[];return {tasks:l.filter(x=>{if(p.has(x.id))return m.push(x),false;if(x.subtasks){let h=s(x.subtasks,p);x.subtasks=h.tasks,m.push(...h.removed);}return true}),removed:m}},c=(l,p,m)=>l.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...m],isExpanded:true}:b.subtasks?{...b,subtasks:c(b.subtasks,p,m)}:b),d=new Set(t),{tasks:i,removed:u}=s(e,d);return c(i,o.id,u)}function as(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ts(r,a);if(!n)continue;let o=ts(r,n.id),s=(i,u,l)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===u&&m.subtasks){let b=m.subtasks.findIndex(x=>x.id===l);if(b!==-1){let[x]=m.subtasks.splice(b,1);return x}}if(m.subtasks){let b=s(m.subtasks,u,l);if(b)return b}}return null},c=(i,u,l)=>{let p=i.findIndex(m=>m.id===u);if(p!==-1)return i.splice(p+1,0,l),i;for(let m of i)m.subtasks&&c(m.subtasks,u,l);return i},d=s(r,n.id,a);d&&(o&&o.subtasks?c(o.subtasks,n.id,d):c(r,n.id,d));}return r}function ns(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,c,d)=>{let i=s.findIndex(l=>l.id===c);if(i===-1){for(let l of s)if(l.subtasks&&o(l.subtasks,c,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function An(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function os(e,t){let r=[...e];for(let a of t){let n=s=>{let c=s.findIndex(u=>u.id===a);if(c===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let d=s[c],i={...d,id:`${d.id}-copy-${Date.now()}`,name:`${d.name} (Copy)`,subtasks:d.subtasks?o(d.subtasks):void 0};return s.splice(c+1,0,i),true},o=s=>s.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?o(c.subtasks):void 0}));n(r);}return r}function Yl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},c=d=>{let i=d.findIndex(l=>l.id===t);if(i===-1){for(let l of d)if(l.subtasks&&c(l.subtasks))return true;return false}let u=r==="above"?i:i+1;return d.splice(u,0,s),true};return c(a),{tasks:a,newTask:s}}function ss(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ss(a.subtasks,t,r)}:a)}function is(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:is(r.subtasks,t)}:r)}function ls(e,t){let r=u=>{for(let l of u){if(l.id===t)return l;if(l.subtasks){let p=r(l.subtasks);if(p)return p}}return null},a=r(e),n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s=a?.startDate||n,c=a?.endDate||o,d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(c),color:a?.color||"#3B82F6"},i=u=>u.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,d],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:d}}var Jl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Zl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ql({status:e="todo",onChange:t,className:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({top:0,left:0}),c=Ce.useRef(null),d=Ce.useRef(null);Ce.useEffect(()=>{if(a&&d.current){let p=d.current.getBoundingClientRect();s({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[a]),Ce.useEffect(()=>{let p=m=>{c.current&&!c.current.contains(m.target)&&!d.current?.contains(m.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),Ce.useEffect(()=>{let p=m=>{m.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let i=p=>{t(p),n(false);},u=Jl[e],l=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${l}10`,boxShadow:`0 0 0 2px ${l}30 inset`},title:u.label,children:jsxRuntime.jsx(Zl,{icon:u.icon,color:l})}),a&&jsxRuntime.jsx(Ve,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(Jl).map(([p,m])=>jsxRuntime.jsxs("button",{onClick:()=>i(p),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:m.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Zl,{icon:m.icon,color:m.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:m.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p))})]})})]})}function Ln({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:c,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:p,onTaskUpdate:m,onTaskIndent:b,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let C=Ce.useContext(ua),[T,N]=Ce.useState(null),[R,U]=Ce.useState(false),[H,M]=Ce.useState(null),[$,E]=Ce.useState(""),B=Ce.useRef(null),G=Ce.useRef(null),[O,F]=Ce.useState(null),[Q,Y]=Ce.useState(0),[pe,I]=Ce.useState(0),[le,se]=Ce.useState({isOpen:false,x:0,y:0,type:"header"});Ce.useEffect(()=>{function j(z){B.current&&!B.current.contains(z.target)&&U(false);}if(R)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[R]),Ce.useEffect(()=>{H&&G.current&&(G.current.focus(),G.current.select());},[H]),Ce.useEffect(()=>{if(!O)return;let j=Fe=>{let ze=Fe.clientX-Q,te=pe+ze;p?.(O,te);},z=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",z),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",z),document.body.style.cursor="",document.body.style.userSelect="";}},[O,Q,pe,p]);let{selectedTaskIds:bt,handleTaskClick:Ze,isTaskSelected:ar}=jl(),{setIsEditing:we}=Vl({tasks:e,selectedTaskIds:bt,onTaskSelect:(j,z)=>{let ze=ma(e).map(te=>te.id);Ze(j,ze,z||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:j=>{let z=ma(e).find(Fe=>Fe.id===j);z&&Lr(z);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:j=>{let z=ma(e).find(Fe=>Fe.id===j);z&&y&&y(z);},enableKeyboard:true}),mt=(j,z=0)=>{let Fe=[];for(let ze of j)Fe.push({task:ze,level:z}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Fe.push(...mt(ze.subtasks,z+1));return Fe},ft=mt(e),_t=48,pr=j=>!j.startDate||!j.endDate?"-":`${Math.ceil((j.endDate.getTime()-j.startDate.getTime())/(1e3*60*60*24))}d`,Lr=j=>{M(j.id),E(j.name),we(true);},ge=j=>{$.trim()&&$!==e.find(z=>z.id===j)?.name&&w?.(j,$.trim()),M(null),E(""),we(false);},Qe=()=>{M(null),E(""),we(false);},Wt=(j,z)=>{z.stopPropagation(),k?.(j.id);},Bt=(j,z,Fe)=>{switch(j.id){case "name":let ze=H===z.id,te=T===z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Fe*20}px`},children:[z.subtasks&&z.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),d?.(z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:z.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:z.color||"#3B82F6",opacity:z.parentId?.6:1,borderColor:z.isMilestone?t.accent:"transparent",borderWidth:z.isMilestone?"2px":"0px"},title:z.isMilestone?"Milestone":z.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:G,type:"text",value:$,onChange:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"?ge(z.id):q.key==="Escape"&&Qe();},onBlur:()=>ge(z.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:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Fe===0?"14px":Fe===1?"13px":"12px",fontWeight:z.isMilestone?600:z.subtasks&&z.subtasks.length>0?500:400,opacity:Fe===0?1:Fe===1?.95:.88},title:z.name,children:z.name}),te&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>Wt(z,q),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:q=>{q.stopPropagation(),Lr(z);},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 ce=z.startDate?typeof z.startDate=="string"?z.startDate:z.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ce||"",onChange:q=>{m?.(z.id,{startDate:q.target.value?new Date(q.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 nr=z.endDate?typeof z.endDate=="string"?z.endDate:z.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:nr||"",onChange:q=>{m?.(z.id,{endDate:q.target.value?new Date(q.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:pr(z)})});case "assignees":let Ot=a.filter(q=>z.assignees?.some(V=>V.name===q.name||V.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:Ot,availableUsers:a,onChange:q=>{let V=q.map(ve=>({id:ve.id,name:ve.name,initials:ve.initials,color:ve.color}));m?.(z.id,{assignees:V.length>0?V:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Ql,{status:z.status||"todo",onChange:q=>{m?.(z.id,{status:q,progress:q==="completed"?100:z.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:`${z.progress}%`,backgroundColor:z.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:[z.progress,"%"]})]});default:return null}},Fr=j=>[{id:"hide",label:"Hide Column",icon:nt.Hide,onClick:()=>l(j),disabled:j==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:nt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:nt.SortDesc,onClick:()=>{}}],ne=j=>[{id:"edit",label:C?.contextMenu?.editTask||"Edit Task",icon:nt.Pencil,onClick:()=>{s?.(j);}},{id:"addSubtask",label:C?.contextMenu?.addSubtask||"Add Subtask",icon:nt.Add,onClick:()=>{k?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:C?.contextMenu?.markIncomplete||"Mark Incomplete",icon:nt.MarkIncomplete,onClick:()=>{m?.(j.id,{status:"todo",progress:0});},disabled:j.status==="todo"},{id:"setInProgress",label:C?.contextMenu?.setInProgress||"Set In Progress",icon:nt.SetInProgress,onClick:()=>{m?.(j.id,{status:"in-progress"});},disabled:j.status==="in-progress"},{id:"markComplete",label:C?.contextMenu?.markComplete||"Mark Complete",icon:nt.MarkComplete,onClick:()=>{m?.(j.id,{status:"completed",progress:100});},disabled:j.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:C?.contextMenu?.splitTask||"Split Task",icon:nt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:C?.contextMenu?.deleteTask||"Delete Task",icon:nt.Delete,onClick:()=>{g?.([j.id]);}}],me=u.filter(j=>j.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:`${_t}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[me.map(j=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${j.id==="name"?"justify-start":"justify-center"}`,style:{width:`${j.width}px`,minWidth:`${j.width}px`,maxWidth:`${j.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:z=>{z.preventDefault(),se({isOpen:true,x:z.clientX,y:z.clientY,type:"header",columnId:j.id});},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:j.label}),j.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:O===j.id?t.accent:"transparent"},onMouseDown:z=>{z.preventDefault(),z.stopPropagation(),F(j.id),Y(z.clientX),I(j.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},j.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(Mn,{columns:u,onToggleColumn:l,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>U(!R),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"}),R&&jsxRuntime.jsxs("div",{ref:B,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:j=>j.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:()=>U(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:ft.map(({task:j,level:z},Fe)=>{let ze=ar(j.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${r}px`,boxSizing:"border-box",borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Fe%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>N(j.id),onMouseLeave:()=>N(null),onClick:te=>{let nr=ma(e).map(V=>V.id),q=navigator.platform.toUpperCase().indexOf("MAC")>=0?te.metaKey:te.ctrlKey;Ze(j.id,nr,q,te.shiftKey),o?.(j);},onDoubleClick:te=>{te.stopPropagation(),s?.(j);},onContextMenu:te=>{te.preventDefault(),se({isOpen:true,x:te.clientX,y:te.clientY,type:"task",task:j}),c?.(j,te);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:me.map(te=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${te.id==="name"?"justify-start":"justify-center"}`,style:{width:`${te.width}px`,minWidth:`${te.width}px`,maxWidth:`${te.width}px`,borderColor:T===j.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Bt(te,j,te.id==="name"?z:0)},`${j.id}-${te.id}`))},j.id)})}),jsxRuntime.jsx(pa,{isOpen:le.isOpen,x:le.x,y:le.y,items:le.type==="header"&&le.columnId?Fr(le.columnId):le.type==="task"&&le.task?ne(le.task):[],onClose:()=>se({...le,isOpen:false}),theme:t})]})}function tc(e,t){let[r,a]=Ce.useState("none"),[n,o]=Ce.useState(0),[s,c]=Ce.useState(e),[d,i]=Ce.useState(t),[u,l]=Ce.useState(null),[p,m]=Ce.useState(null),[b,x]=Ce.useState(null),[h,g]=Ce.useState(null),[v,f]=Ce.useState(0),[w,k]=Ce.useState(0),[y,C]=Ce.useState(null),[T,N]=Ce.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:c,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:m,activeZone:b,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:($,E)=>{a("none"),l(null),m(null),c($),i(E),k(0),g(null),f(0);}}}function Fn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:b}){let x=tc(t,a),h=Ce.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:C,setGhostWidth:T,connectionLine:N,setConnectionLine:R,hoveredTaskId:U,setHoveredTaskId:H,activeZone:M,setActiveZone:$,draggedSegmentIndex:E,setDraggedSegmentIndex:B,draggedSegmentStartX:G,setDraggedSegmentStartX:O,segmentDragOffsetX:F,setSegmentDragOffsetX:Q,hoveredSegmentIndex:Y,setHoveredSegmentIndex:pe,isHovered:I,setIsHovered:le,isDragging:se,isResizing:bt,isConnecting:Ze,resetDragState:ar}=x,we=32,mt=8,ft=e.endDate&&e.endDate<new Date&&e.progress<100,_t=e.isCriticalPath,pr=n.name==="neutral"||n.today==="#1C1917",ge=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),Qe=a<50,Wt=a<40,Bt=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fr=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},ne=V=>Math.round(V/o)*o,me=V=>{let ve=Math.round(V/o),D=new Date(s);return D.setDate(D.getDate()+ve),D},j=(V,ve)=>{for(let D of m){if(D.id===e.id)continue;let _=5;if(V>=D.x-_&&V<=D.x+D.width+_&&ve>=D.y-_&&ve<=D.y+D.height+_)return D.id}return null},z=Ce.useCallback((V,ve,D)=>{V.preventDefault(),V.stopPropagation();let _=h.current?.ownerSVGElement;if(!_)return;let de=_.createSVGPoint();de.x=V.clientX,de.y=V.clientY;let he=de.matrixTransform(_.getScreenCTM()?.inverse()),Ae=D!==void 0?D:t,$e=ve;if(!$e){let Nt=he.x-Ae;V.shiftKey?($e="connect",R({x:t+a,y:r+we/2})):V.ctrlKey||V.metaKey?$e="move":V.altKey?$e=Nt<a/2?"resize-start":"resize-end":Wt?Nt<a/2?$e="move":$e="resize-end":Qe?Nt<=ge/2?$e="resize-start":Nt>=a-ge/2?$e="resize-end":$e="move":Nt<=ge?$e="resize-start":Nt>=a-ge?$e="resize-end":$e="move";}v($e),le(false),$(null),$e==="move"?w(he.x-Ae):$e==="connect"?R({x:t+a,y:r+we/2}):w(0),y(Ae),T(a);},[t,a,r,we]),Fe=Ce.useCallback(V=>{if(g==="none")return;let ve=h.current?.ownerSVGElement;if(!ve)return;let D=ve.createSVGPoint();D.x=V.clientX,D.y=V.clientY;let _=D.matrixTransform(ve.getScreenCTM()?.inverse());if(g==="connect"){R({x:_.x,y:_.y});let de=j(_.x,_.y);H(de);}else if(g==="move"){let de=_.x-f,he=ne(de);y(he),T(a);let Ae=Math.round((he-t)/o);if(b?.(e.id,Ae,true),e.segments&&e.segments.length>0&&E!==null){let $e=he-G;Q($e);}}else if(g==="resize-start"){let de=_.x,he=ne(de),Ae=t+a-he;Ae>=o&&(y(he),T(Ae));}else if(g==="resize-end"){let de=_.x,Ae=ne(de)-t;Ae>=o&&T(Ae);}},[g,t,a,o,f,e,ne,E,G,j,H,R,y,T,Q,b]),ze=Ce.useCallback(()=>{if(g!=="none"){if(g==="connect")U&&p&&p(e,U),R(null),H(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),ve,D,_=true;if(g==="move"){if(ve=me(k),D=new Date(ve.getTime()+V),e.segments&&e.segments.length>0&&E!==null){let de=Math.round(F/o),he=e.segments.map((wt,eo)=>{if(eo===E){let ba=new Date(wt.startDate),ya=new Date(wt.endDate);return ba.setDate(ba.getDate()+de),ya.setDate(ya.getDate()+de),{startDate:ba,endDate:ya}}return wt}),Ae=he.flatMap(wt=>[wt.startDate,wt.endDate]),$e=new Date(Math.min(...Ae.map(wt=>wt.getTime()))),Nt=new Date(Math.max(...Ae.map(wt=>wt.getTime())));l?.({...e,segments:he},$e,Nt),ar(t,a);return}}else g==="resize-start"?(ve=me(k),D=e.endDate,ve>=D&&(console.warn("Invalid date range: start date must be before end date"),_=false)):g==="resize-end"?(ve=e.startDate,D=me(k+C),D<=ve&&(console.warn("Invalid date range: end date must be after start date"),_=false)):_=false;_&&ve&&D&&(D.getTime()-ve.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,ve,D));}b?.(e.id,0,false),ar(t,a);}},[g,k,C,e,l,U,p,t,a,o,me,F,E,ar,b]);Ce.useEffect(()=>{if(g==="none")return;let V=D=>{Fe(D);},ve=()=>{ze();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",ve);}},[g,Fe,ze]);let te=se&&!Ze?k:t,ce=se&&!Ze?C:a,nr=c.taskTooltip(e),Ot=typeof nr=="string"?nr:"",q=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!se&&le(true),onMouseLeave:()=>{se||(le(false),$(null));},onClick:()=>!se&&d?.(e),onDoubleClick:V=>{se||(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),u?.(e,V);},children:[Ot&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:Ot}}),I&&!se&&!Qe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ge,height:we,fill:M==="resize-start"?n.accent:"transparent",opacity:M==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:V=>z(V,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ge,y:r,width:a-ge*2,height:we,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:V=>z(V,"move")}),jsxRuntime.jsx("rect",{x:t+a-ge,y:r,width:ge,height:we,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:V=>z(V,"resize-end")})]}),I&&!se&&Wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:we,fill:M==="move"?n.accent:"transparent",opacity:M==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:V=>z(V,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:we,fill:M==="resize-end"?n.accent:"transparent",opacity:M==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:V=>z(V,"resize-end")}),I&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+we-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),se&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:C,height:we,rx:mt,fill:n.accent,opacity:.5,stroke:n.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:te,y:r,width:ce,height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":q,initial:{opacity:0,scale:.95},animate:{opacity:se&&!Ze?.15:e.parentId?.6:I?.9:.8,scale:I&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>z(V),style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((V,ve)=>{let D=(V.startDate.getTime()-s.getTime())/864e5*o,de=(V.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-D+o,he=se&&g==="move"&&E===ve,Ae=Y===ve,$e=he?D+F:D;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!se&&pe(ve),onMouseLeave:()=>!se&&pe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:r,width:de,height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:Ae?.9:.8,scale:Ae&&!se?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Nt=>{Nt.stopPropagation(),B(ve),O(D),z(Nt,void 0,D);},style:{cursor:se?Ze?"crosshair":bt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:r,width:de*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||ft?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),pr&&(ft||_t)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_t&&!ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce,height:we,rx:mt,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ft&&jsxRuntime.jsx("rect",{x:te,y:r,width:ce,height:we,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ce>60&&!e.segments&&(()=>{let V=c.taskLabel(e),ve=typeof V=="string"?V:e.name,D=ve.length>Math.floor(ce/8)?`${ve.substring(0,Math.floor(ce/8))}...`:ve;return jsxRuntime.jsx("text",{x:te+12,y:r+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:D})})(),ce>100&&e.progress>0&&e.progress<100&&!se&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ce-12,y:r+we/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&&ce>80&&!se&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ce-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ce-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(I||bt)&&!Ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Qe?te-15:te-10,y:r-5,width:Qe?25:20,height:we+10,fill:"transparent",onMouseDown:V=>z(V,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te-8:te-3,y:r+6,width:Qe?8:6,height:Qe?we-12:we-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="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:te+ce-10,y:r-5,width:Qe?25:20,height:we+10,fill:"transparent",onMouseDown:V=>z(V,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe?te+ce:te+ce-3,y:r+6,width:Qe?8:6,height:Qe?we-12:we-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&!se&&!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+a+8,cy:r+we/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:V=>{V.stopPropagation(),z(V,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+we/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ze&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+we/2,x2:N.x,y2:N.y,stroke:U?n.statusCompleted:n.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:U?8:6,fill:U?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(I||se)&&!Ze&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:r-2,width:ce+4,height:we+4,rx:mt+2,fill:"none",stroke:se?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:se?.6:.4,initial:{opacity:0},animate:{opacity:se?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+C,y1:0,x2:k+C,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&!se&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:te+ce/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${te+ce/2-6} ${r-13} L ${te+ce/2} ${r-3} L ${te+ce/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:te+ce/2,y:r-73,textAnchor:"middle",fill:n.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:te+ce/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ce/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.startDate)}),jsxRuntime.jsx("text",{x:te+ce/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ce/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Bt(e.endDate)}),jsxRuntime.jsx("text",{x:te+ce/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ce/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fr()}),jsxRuntime.jsx("text",{x:te+ce/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ce/2+65,y:r-40,fill:n.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:te+ce/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ce/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(V=>V.name).join(", ").substring(0,30),e.assignees.map(V=>V.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:te+ce/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Wt?"Left: move \u2022 Right: resize":Qe?"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 On({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,c]=Ce.useState(false),d=r-e,i=a-t,u=e+d/2,l=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,p=6,m=Math.atan2(i,d),b=r-p*Math.cos(m-Math.PI/6),x=a-p*Math.sin(m-Math.PI/6),h=r-p*Math.cos(m+Math.PI/6),g=a-p*Math.sin(m+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${b} ${x} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function $n({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Ce.useState(false),c=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:d(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var K={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,c=new Set,d=i=>{if(!s.has(i)){s.add(i),c.add(i);let u=a.get(i)||[];for(let l of u){if(!s.has(l)&&d(l))return true;if(c.has(l))return true}}return c.delete(i),false};return d(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=K.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=K.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=K.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=K.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
46
46
|
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=K.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=K.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>K.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=K.findTaskById(e,t);return !r||!r.dependencies?[]:K.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>K.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>K.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=K.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>K.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=K.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=o.map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?K.formatDate(d.startDate):"N/A",d.endDate?K.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});a(n,{head:s,body:c,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}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=K.flattenTasks(e).map(d=>{let i=d.startDate&&d.endDate?K.calculateDuration(d.startDate,d.endDate):0;return {"Task ID":d.id,"Task Name":d.name,"Start Date":d.startDate?K.formatDate(d.startDate):"","End Date":d.endDate?K.formatDate(d.endDate):"","Duration (days)":i>0?i:"","Progress (%)":d.progress,Status:d.status||"",Assignees:d.assignees?.map(u=>u.name).join(", ")||"",Dependencies:d.dependencies?.join(", ")||"","Is Milestone":d.isMilestone?"Yes":"No","Parent ID":d.parentId||"",Level:d.level||0}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let c=r.utils.book_new();r.utils.book_append_sheet(c,o,"Gantt Tasks"),r.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=K.flattenTasks(e),n=new Map;a.forEach((p,m)=>{n.set(p.id,m+1);});let o=p=>p.toISOString().replace("Z",""),s=K.getEarliestStartDate(e)||new Date,c=K.getLatestEndDate(e)||new Date,d=a.map((p,m)=>{let b=n.get(p.id),x=p.startDate&&p.endDate?K.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(g=>n.has(g)).map(g=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${n.get(g)}</PredecessorUID>
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
</Calendars>
|
|
274
274
|
<Tasks>${d}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=K.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let b=t.find(x=>x.id===m);if(b){n(b);let x=a.get(m)?.ef||0;l=Math.max(l,x);}}let p=l+u;a.set(i.id,{es:l,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=o;if(l.length>0)for(let b of l){c(b);let x=s.get(b.id)?.ls||0;p=Math.min(p,x);}let m=p-u;s.set(i.id,{ls:m,lf:p});};r.forEach(c);let d=[];for(let i of r){let u=a.get(i.id),l=s.get(i.id);if(u&&l){let p=l.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let r=K.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let n=K.getDependentTasks(e,t);if(n.length===0){let c=K.getLatestEndDate(e);if(!c)return null;let d=K.calculateDuration(r.endDate,c);return Math.max(0,d)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,d)=>c-d)[0];if(!o)return null;let s=K.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=K.findTaskById(e,t);if(!a||!a.endDate)return e;let n=K.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let c=K.calculateDuration(s.startDate,s.endDate),d;r!==void 0?(d=new Date(s.startDate),d.setDate(d.getDate()+r)):(d=new Date(a.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,c),u=l=>l.map(p=>p.id===s.id?{...p,startDate:d,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=K.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,l=K.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(m,b,x=new Set)=>{if(x.has(m))return;x.add(m);let h=K.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let v=a.findIndex(U=>U.id===g.id);if(v===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,C=(f-i)/u*o,T=C+b*o,N=Math.max(k*o,o),R=c+v*s+12;d.push({taskId:g.id,taskName:g.name,originalX:C,previewX:T,width:N,y:R,rowIndex:v,daysDelta:b,color:g.color}),p(g.id,b,x);}};return p(t,r),d},splitTask:(e,t,r,a=3)=>{let n=K.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let d=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=u=>u.map(l=>l.id===n.id?{...l,endDate:c,segments:d}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function _n({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:l,onDependencyCreate:p,onDependencyDelete:m}){let[x,h]=Ce.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),v=a==="day"?60:a==="week"?20:8,f=g*v*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),G=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-G);let O=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-O.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},y=Ce.useCallback(E=>{let B=Math.round(E/(v*s)),G=new Date(n);return G.setDate(G.getDate()+B),G},[n,v,s]),C=Ce.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let G=E.currentTarget.ownerSVGElement;if(!G)return;let O=G.createSVGPoint();O.x=E.clientX,O.y=E.clientY;let F=O.matrixTransform(G.getScreenCTM()?.inverse()),Q=y(F.x),Y=new Date(Q);Y.setDate(Y.getDate()+1),l?.(B,Q,Y);},[y,l]),T=Ce.useMemo(()=>{let E=F=>F.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let Y=E(Q.subtasks),pe=Y.filter(I=>I.startDate&&I.endDate);if(pe.length>0){let I=pe.map(Ze=>Ze.startDate.getTime()),le=pe.map(Ze=>Ze.endDate.getTime()),se=new Date(Math.min(...I)),bt=new Date(Math.max(...le));return {...Q,subtasks:Y,startDate:Q.startDate||se,endDate:Q.endDate||bt}}return {...Q,subtasks:Y}}return Q}),B=(F,Q=[])=>{for(let Y of F)Q.push(Y),Y.subtasks&&Y.subtasks.length>0&&(Y.isExpanded===void 0||Y.isExpanded)&&B(Y.subtasks,Q);return Q},G=E(e);return B(G)},[e]),N=Ce.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),G=E.endDate.getTime(),O=n.getTime(),F=(B-O)/(1e3*60*60*24),Q=(G-B)/(1e3*60*60*24),Y=F*v*s,pe=Math.max(v*s,40),I=Math.max(Q*v*s,pe);return {x:Y,width:I}},[n,v,s]),R=Ce.useMemo(()=>T.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:G}=N(E),F=T.findIndex(Q=>Q.id===E.id)*r+12;return {id:E.id,x:B,y:F,width:G,height:32}}),[T,N]),U=Ce.useCallback((E,B,G)=>{if(!G||B===0){h([]);return}let O=K.calculateCascadePreview(e,E,B,T,n,v*s,r,48);h(O);},[e,T,n,v,s,r,48]),H=Ce.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let F=(B.getTime()-n.getTime())/864e5*v*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:F}),B.setDate(B.getDate()+1);else if(a==="week"){let Q=w(B);E.push({date:new Date(B),label:`Week ${Q}`,x:F}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:F}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,v,s]),M=Ce.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*v*s,[n,v,s]),$=Math.max(T.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,borderBottom:`1px solid ${t.border}`},children:jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:48,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(f,1e3),height:48,fill:t.bgGrid}),H.map((E,B)=>jsxRuntime.jsxs("g",{children:[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-${B}`)),M>=0&&M<=f&&jsxRuntime.jsx("circle",{cx:M,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:$,style:{display:"block",flexShrink:0},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(f,1e3),height:$,fill:t.bgPrimary}),H.map((E,B)=>{let G=H[B+1]?.x||f,O=k(E.date);return jsxRuntime.jsxs("g",{children:[O&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:G-E.x,height:T.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:T.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),M>=0&&M<=f&&jsxRuntime.jsx("line",{x1:M,y1:0,x2:M,y2:T.length*r,stroke:t.today,strokeWidth:2,opacity:1}),T.map((E,B)=>{let G=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:O=>C(O,E),onMouseEnter:O=>{O.currentTarget.setAttribute("fill",t.accentLight),O.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:O=>{O.currentTarget.setAttribute("fill","transparent"),O.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:M>0?M:100,y:B*r+r/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}`)}),T.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(G=>{let O=T.find(pe=>pe.id===G);if(!O||!O.startDate||!O.endDate)return null;let F=T.findIndex(pe=>pe.id===G),Q=N(O),Y=N(E);return jsxRuntime.jsx(On,{x1:Q.x+Q.width,y1:F*r+r/2,x2:Y.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,G)},`dep-${G}-${E.id}`)})),T.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:G,width:O}=N(E),F=B*r+12,Q=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx($n,{task:E,x:G+O/2,y:F+16,theme:t,onClick:d},E.id):Q?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:G,y:F,width:O,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:G,y1:F,x2:G+O,y2:F,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:F,x2:G,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G+O,y1:F,x2:G+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:F+32,x2:G+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),O>60&&jsxRuntime.jsx("text",{x:G+12,y:F+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(Fn,{task:E,x:G,y:F,width:O,theme:t,dayWidth:v*s,startDate:n,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:R,onDragMove:U},E.id)}),x.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 oc=[{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 sc({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:oc.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&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})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:oc.find(a=>a.value===e)?.name||"Personalizado"})]})}function Wn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:d="dark"}){let i=ke[d]||ke.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[p,m]=Ce.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,x]=Ce.useState({});Ce.useEffect(()=>{m(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let h=()=>{let f={};return p.name.trim()||(f.name="El nombre es requerido"),p.startDate&&p.endDate&&p.startDate>p.endDate&&(f.endDate="La fecha de fin debe ser posterior a la de inicio"),x(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!h())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},v=(f,w)=>{m(k=>{let y={...k,[f]:w};if(f==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?y.status="completed":C>0&&C<100&&k.status==="todo"?y.status="in-progress":C===0&&k.status==="in-progress"&&(y.status="todo");}return y}),b[f]&&x(k=>{let y={...k};return delete y[f],y});};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:i.bgPrimary,border:`1px solid ${i.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>v("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:f=>f.currentTarget.style.borderColor=i.accent,onBlur:f=>f.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),b.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"}),b.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:p.startDate?p.startDate.toISOString().split("T")[0]:"",onChange:f=>v("startDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:p.endDate?p.endDate.toISOString().split("T")[0]:"",onChange:f=>v("endDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone}),b.endDate&&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"}),b.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>v("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(sc,{value:p.color,onChange:f=>v("color",f),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:l,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981",backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.1)":p.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[p.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:p.progress,onChange:f=>v("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${p.progress}%`,backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.3)":p.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(f=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v("progress",f),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:p.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.borderLight}`},children:[f,"%"]},f))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:p.isMilestone,onChange:f=>v("isMilestone",f.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.target.checked?[...p.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(p.assignees||[]).filter(y=>y.name!==f.name);v("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(y=>y!==f.id);v("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=i.textPrimary,f.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=i.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:s,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:i.accent,color:"#FFFFFF"},onMouseEnter:f=>!s&&(f.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:f=>!s&&(f.currentTarget.style.backgroundColor=i.accent),children:s?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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Dg=['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"'],mc=()=>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"})]}),Sg=()=>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"})}),Ng=()=>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"})}),Eg=()=>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"})}),Rg=()=>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 Hn({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:s,onDependencyCreate:c,onDependencyDelete:d}){let[i,u]=Ce.useState(false),[l,p]=Ce.useState(false),[m,b]=Ce.useState([]),[x,h]=Ce.useState(""),[g,v]=Ce.useState(false),[f,w]=Ce.useState(true),k=Ce.useRef(null),y=Ce.useRef(null),C=Ce.useRef(null),{enabled:T=true,placeholder:N='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:U,suggestions:H=Dg,maxHistory:M=50}=r;Ce.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[m]),Ce.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,l]);let $=Ce.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&n?.(F.taskId,F.updates);break;case "create_task":F.newTask&&o?.(F.newTask);break;case "delete_task":F.taskId&&s?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&d?.(F.taskId,F.dependencyFrom);break}},[n,o,s,c,d]),E=Ce.useCallback(async F=>{if(!F.trim()||g)return;let Q={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};b(pe=>[...pe.slice(-(M-1)),Q]),h(""),w(false),v(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(pe=>[...pe,Y]);try{if(U){let pe=await U(F,e);b(I=>{let le=I.filter(bt=>!bt.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:pe.message,timestamp:new Date,command:pe};return [...le,se]}),$(pe);}else b(pe=>[...pe.filter(le=>!le.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(pe){b(I=>[...I.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${pe instanceof Error?pe.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[g,M,U,e,$]),B=F=>{F.preventDefault(),E(x);},G=F=>{h(F),k.current?.focus();};if(Ce.useEffect(()=>{let F=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),u(Y=>!Y),i||p(false)),Q.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[i]),!T)return null;let O={"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(Ve,{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 ${O[R]} 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:()=>u(true),children:[jsxRuntime.jsx(mc,{}),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:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${O[R]} 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(mc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Eg,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ng,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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:[m.length===0&&f&&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:H.slice(0,4).map((F,Q)=>jsxRuntime.jsx("button",{onClick:()=>G(F),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:F.length>30?F.slice(0,30)+"...":F},Q))})]}),m.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Rg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:B,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:k,type:"text",value:x,onChange:F=>h(F.target.value),placeholder:N,disabled:g,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:x.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:x.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Sg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function fc(e,t=50){let[r,a]=Ce.useState({past:[],present:e,future:[]}),n=Ce.useRef(false),o=Ce.useCallback((i,u=true)=>{a(l=>{let p=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:p};if(!u)return {...l,present:p};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),s=Ce.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=Ce.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),d=Ce.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:d}}function gc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Ce.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=c?s.metaKey:s.ctrlKey;if(d&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&d&&s.key==="y"){s.preventDefault(),t();return}if(c&&d&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var Ag={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let r=K.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hc(e){return {...Ag,...e}}var Og=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},yc=Ce.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:p=true,aiAssistant:m,locale:b="en",customTranslations:x,showCreateTaskButton:h=false,createTaskLabel:g,onCreateTask:v,onThemeChange:f,onTaskClick:w,onTaskDblClick:k,onTaskContextMenu:y,onTaskUpdate:C,onProgressChange:T,onTaskEdit:N,onTaskAddSubtask:R,onTaskMarkIncomplete:U,onTaskSetInProgress:H,onDependencyCreate:M,onDependencyDelete:$,onBeforeTaskAdd:E,onAfterTaskAdd:B,onBeforeTaskUpdate:G,onAfterTaskUpdate:O}=r,Q=Ce.useContext(Rn)?.theme,[Y,pe]=Ce.useState(Q||o||"dark"),[I,le]=Ce.useState(s),[se,bt]=Ce.useState(c),[Ze,ar]=Ce.useState(1),[we,mt]=Ce.useState(0),[ft,_t]=Ce.useState(false),[pr,Lr]=Ce.useState(null),[ge,Qe]=Ce.useState({isOpen:false,x:0,y:0,task:null}),[Wt,Bt]=Ce.useState(null);Ce.useEffect(()=>{Q&&Q!==Y&&pe(Q);},[Q]),Ce.useEffect(()=>{o&&o!==Y&&pe(o);},[o]);let Fr=Ce.useCallback(S=>{pe(S),f?.(S);},[f]),{state:ne,setState:me,undo:j,redo:z,canUndo:Fe,canRedo:ze,clearHistory:te}=fc(t,50);Ce.useEffect(()=>{me(t);},[t,me]),Ce.useEffect(()=>{a&&a(ne);},[ne,a]);let ce=Ce.useMemo(()=>Zo(b,x),[b,x]),nr=Ce.useCallback(S=>[{id:"name",label:S.columns.taskName,width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:S.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:S.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:S.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:S.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:S.columns.progress,width:120,visible:false,sortable:true}],[]),[Ot,q]=Ce.useState(()=>nr(ce));Ce.useEffect(()=>{q(S=>S.map(P=>({...P,label:ce.columns[P.id==="name"?"taskName":P.id]||P.label})));},[ce]);let V=Ce.useMemo(()=>Ot.filter(S=>S.visible).reduce((S,P)=>S+P.width,0)+60,[Ot]),ve=pr||V,D=Ce.useRef(null),_=Ce.useRef(null),de=Ce.useRef(null),he=Ce.useMemo(()=>Il(Y),[Y]),Ae=Ce.useMemo(()=>({theme:he,themeName:Y}),[he,Y]),$e=Ce.useMemo(()=>hc(l),[l]),Nt=Ce.useMemo(()=>{if(!p)return ne;let S=K.calculateCriticalPath(ne),P=W=>W.map(Z=>({...Z,isCriticalPath:S.includes(Z.id),subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(ne)},[ne,p]),wt=Og(se);gc({undo:j,redo:z,canUndo:Fe,canRedo:ze,enabled:true}),Ce.useImperativeHandle(n,()=>({getTask:S=>K.findTaskById(ne,S),addTask:(S,P)=>{me(W=>{if(!P)return [...W,{...S,level:0}];let Z=ae=>ae.map(ie=>ie.id===P?{...ie,subtasks:[...ie.subtasks||[],{...S,parentId:P,level:(ie.level||0)+1}],isExpanded:true}:ie.subtasks?{...ie,subtasks:Z(ie.subtasks)}:ie);return Z(W)});},updateTask:(S,P)=>{me(W=>{let Z=ae=>ae.map(ie=>ie.id===S?{...ie,...P}:ie.subtasks?{...ie,subtasks:Z(ie.subtasks)}:ie);return Z(W)});},deleteTask:S=>{me(P=>{let W=Z=>Z.filter(ae=>ae.id===S?false:(ae.subtasks&&(ae.subtasks=W(ae.subtasks)),true));return W(P)});},deleteTasks:S=>{me(P=>An(P,S));},duplicateTask:S=>{me(P=>os(P,[S]));},splitTask:(S,P,W=3)=>{me(Z=>K.splitTask(Z,S,P,W));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(S,P)=>!K.validateDependencies(ne,S,P),getAllTasks:()=>K.flattenTasks(ne),getTasksByStatus:S=>K.flattenTasks(ne).filter(P=>P.status===S),getTasksByParent:S=>S?K.findTaskById(ne,S)?.subtasks||[]:ne.filter(W=>!W.parentId),getCriticalPath:()=>K.flattenTasks(ne).filter(S=>S.isCriticalPath),indentTask:S=>{me(P=>rs(P,[S]));},outdentTask:S=>{me(P=>as(P,[S]));},moveTask:(S,P)=>{me(W=>ns(W,[S],P));},createSubtask:async S=>{let{tasks:P,newTask:W}=ls(ne,S);if(E){let Z=E({...W,parentId:S});if((Z instanceof Promise?await Z:Z)===false)return}me(P),B&&B({...W,parentId:S});},scrollToTask:S=>{let W=K.flattenTasks(ne).findIndex(Z=>Z.id===S);if(W!==-1&&D.current){let Z=W*wt;D.current.scrollTo({top:Z,behavior:"smooth"}),_.current&&_.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(S,P=2e3)=>{},expandTask:S=>{me(P=>{let W=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:true}:ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae);return W(P)});},collapseTask:S=>{me(P=>{let W=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:false}:ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae);return W(P)});},expandAll:()=>{me(S=>{let P=W=>W.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},collapseAll:()=>{me(S=>{let P=W=>W.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},undo:j,redo:z,canUndo:()=>Fe,canRedo:()=>ze,clearHistory:te,exportToPNG:async()=>{if(!de.current)throw new Error("Gantt container not found");let S=await vc__default.default(de.current,{backgroundColor:he.bgPrimary,scale:2});return new Promise((P,W)=>{S.toBlob(Z=>{Z?P(Z):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await K.exportToPDF(ne,S);},exportToExcel:async S=>{await K.exportToExcel(ne,S);},exportToJSON:()=>K.exportToJSON(ne),exportToCSV:()=>K.exportToCSV(ne),importFromJSON:S=>{let P=K.importFromJSON(S);me(P);},getTasks:()=>ne,refresh:()=>{me(S=>[...S]);},clearAll:()=>{me([]);}}),[ne,j,z,Fe,ze,te,he,wt]);let eo=Ce.useCallback(S=>{q(P=>P.map(W=>W.id===S?{...W,visible:!W.visible}:W));},[]),ba=Ce.useCallback((S,P)=>{q(W=>W.map(Z=>{if(Z.id!==S)return Z;let ae=Z.minWidth??100,ie=Z.maxWidth??800,et=Math.max(ae,Math.min(ie,P));return {...Z,width:et}}));},[]),ya=Ce.useCallback(S=>{me(P=>is(P,S)),r.onTaskToggleExpand?.(S);},[r]),Qr=Ce.useCallback((S,P)=>{if(G&&G(S,P)===false)return;let Z=K.findTaskById(ne,S)?.progress,ae=et=>et.map(gt=>gt.id===S?{...gt,...P}:gt.subtasks?{...gt,subtasks:ae(gt.subtasks)}:gt);me(ae(ne));let ie=K.findTaskById(ae(ne),S);ie&&(C?.(ie),O?.(ie),P.progress!==void 0&&Z!==void 0&&P.progress!==Z&&T?.(S,Z,P.progress));},[ne,C,G,O,T]),yd=Ce.useCallback(S=>{S.length!==0&&(me(P=>rs(P,S)),r.onTaskIndent?.(S[0]));},[r]),xd=Ce.useCallback(S=>{S.length!==0&&(me(P=>as(P,S)),r.onTaskOutdent?.(S[0]));},[r]),kd=Ce.useCallback((S,P)=>{S.length!==0&&(me(W=>ns(W,S,P)),r.onTaskMove?.(S[0],P));},[r]),Ys=Ce.useCallback(S=>{r.onMultiTaskDelete?r.onMultiTaskDelete(S):(me(P=>An(P,S)),S.forEach(P=>r.onTaskDelete?.(P)));},[r]),wd=Ce.useCallback(S=>{me(P=>os(P,S)),S.forEach(P=>r.onTaskDuplicate?.(P));},[r]),Cd=Ce.useCallback((S,P)=>{me(W=>{let{tasks:Z,newTask:ae}=Yl(W,S,P);return E&&E(ae)===false?W:(r.onTaskCreate?.(ae.parentId,ae.position||0),B?.(ae),Z)});},[r,E,B]),Td=Ce.useCallback((S,P)=>{me(W=>ss(W,S,P)),r.onTaskRename?.(S,P);},[r]),qs=Ce.useCallback(S=>{me(P=>{let{tasks:W}=ls(P,S);return r.onTaskCreate?.(S,0),W});},[r]),Dd=Ce.useCallback((S,P,W)=>{let Z=S.startDate?Math.round((P.getTime()-S.startDate.getTime())/864e5):0,ae=gt=>gt.map(Ht=>Ht.id===S.id?{...Ht,startDate:P,endDate:W,...S.segments&&{segments:S.segments}}:Ht.subtasks?{...Ht,subtasks:ae(Ht.subtasks)}:Ht),ie=ae(ne);ie=K.autoScheduleDependents(ie,S.id,Z),me(ie);let et={...S,startDate:P,endDate:W};C?.(et);},[ne,C]),Sd=Ce.useCallback((S,P)=>{y?.(S,P),Qe({isOpen:true,x:P.clientX,y:P.clientY,task:S});},[y]),Nd=Ce.useCallback((S,P)=>{let W=K.splitTask(ne,S.id,P);me(W),Qe({isOpen:false,x:0,y:0,task:null});},[ne]),Xs=Ce.useCallback(S=>{k?.(S),N||Bt(S);},[k,N]),Js=Ce.useCallback((S,P,W)=>{let Z=new Map,ae=Vt=>{Vt.forEach(mr=>{mr.dependencies&&Z.set(mr.id,mr.dependencies),mr.subtasks&&ae(mr.subtasks);});};ae(W);let ie=Z.get(P)||[];Z.set(P,[...ie,S]);let et=new Set,gt=new Set,Ht=Vt=>{if(!et.has(Vt)){et.add(Vt),gt.add(Vt);let mr=Z.get(Vt)||[];for(let xa of mr){if(!et.has(xa)&&Ht(xa))return true;if(gt.has(xa))return true}}return gt.delete(Vt),false};return Ht(P)},[]),Zs=Ce.useCallback((S,P)=>{if(Js(S.id,P,ne)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=r,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=K.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let b=t.find(x=>x.id===m);if(b){n(b);let x=a.get(m)?.ef||0;l=Math.max(l,x);}}let p=l+u;a.set(i.id,{es:l,ef:p});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,c=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?K.calculateDuration(i.startDate,i.endDate):0,l=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=o;if(l.length>0)for(let b of l){c(b);let x=s.get(b.id)?.ls||0;p=Math.min(p,x);}let m=p-u;s.set(i.id,{ls:m,lf:p});};r.forEach(c);let d=[];for(let i of r){let u=a.get(i.id),l=s.get(i.id);if(u&&l){let p=l.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateSlack:(e,t)=>{let r=K.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(K.calculateCriticalPath(e).includes(t))return 0;let n=K.getDependentTasks(e,t);if(n.length===0){let c=K.getLatestEndDate(e);if(!c)return null;let d=K.calculateDuration(r.endDate,c);return Math.max(0,d)}let o=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,d)=>c-d)[0];if(!o)return null;let s=K.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>K.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r)=>{let a=K.findTaskById(e,t);if(!a||!a.endDate)return e;let n=K.getDependentTasks(e,t);if(n.length===0)return e;let o=[...e];for(let s of n){if(!s.startDate||!s.endDate)continue;let c=K.calculateDuration(s.startDate,s.endDate),d;r!==void 0?(d=new Date(s.startDate),d.setDate(d.getDate()+r)):(d=new Date(a.endDate),d.setDate(d.getDate()+1));let i=K.calculateEndDate(d,c),u=l=>l.map(p=>p.id===s.id?{...p,startDate:d,endDate:i}:p.subtasks?{...p,subtasks:u(p.subtasks)}:p);o=u(o),o=K.autoScheduleDependents(o,s.id,r);}return o},calculateCascadePreview:(e,t,r,a,n,o,s,c)=>{if(r===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,l=K.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(m,b,x=new Set)=>{if(x.has(m))return;x.add(m);let h=K.getDependentTasks(e,m);for(let g of h){if(!g.startDate||!g.endDate)continue;let v=a.findIndex(U=>U.id===g.id);if(v===-1)continue;let f=g.startDate.getTime(),k=(g.endDate.getTime()-f)/u,C=(f-i)/u*o,T=C+b*o,N=Math.max(k*o,o),R=c+v*s+12;d.push({taskId:g.id,taskName:g.name,originalX:C,previewX:T,width:N,y:R,rowIndex:v,daysDelta:b,color:g.color}),p(g.id,b,x);}};return p(t,r),d},splitTask:(e,t,r,a=3)=>{let n=K.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let d=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:c}],i=u=>u.map(l=>l.id===n.id?{...l,endDate:c,segments:d}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function _n({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:c,onTaskClick:d,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:l,onDependencyCreate:p,onDependencyDelete:m}){let[x,h]=Ce.useState([]),g=Math.ceil((o.getTime()-n.getTime())/(1e3*60*60*24)),v=a==="day"?60:a==="week"?20:8,f=g*v*s,w=E=>{let B=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),G=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-G);let O=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-O.getTime())/864e5+1)/7)},k=E=>{let B=E.getDay();return B===0||B===6},y=Ce.useCallback(E=>{let B=Math.round(E/(v*s)),G=new Date(n);return G.setDate(G.getDate()+B),G},[n,v,s]),C=Ce.useCallback((E,B)=>{if(B.startDate&&B.endDate)return;let G=E.currentTarget.ownerSVGElement;if(!G)return;let O=G.createSVGPoint();O.x=E.clientX,O.y=E.clientY;let F=O.matrixTransform(G.getScreenCTM()?.inverse()),Q=y(F.x),Y=new Date(Q);Y.setDate(Y.getDate()+1),l?.(B,Q,Y);},[y,l]),T=Ce.useMemo(()=>{let E=F=>F.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let Y=E(Q.subtasks),pe=Y.filter(I=>I.startDate&&I.endDate);if(pe.length>0){let I=pe.map(Ze=>Ze.startDate.getTime()),le=pe.map(Ze=>Ze.endDate.getTime()),se=new Date(Math.min(...I)),bt=new Date(Math.max(...le));return {...Q,subtasks:Y,startDate:Q.startDate||se,endDate:Q.endDate||bt}}return {...Q,subtasks:Y}}return Q}),B=(F,Q=[])=>{for(let Y of F)Q.push(Y),Y.subtasks&&Y.subtasks.length>0&&(Y.isExpanded===void 0||Y.isExpanded)&&B(Y.subtasks,Q);return Q},G=E(e);return B(G)},[e]),N=Ce.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let B=E.startDate.getTime(),G=E.endDate.getTime(),O=n.getTime(),F=(B-O)/(1e3*60*60*24),Q=(G-B)/(1e3*60*60*24),Y=F*v*s,pe=Math.max(v*s,40),I=Math.max(Q*v*s,pe);return {x:Y,width:I}},[n,v,s]),R=Ce.useMemo(()=>T.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:B,width:G}=N(E),F=T.findIndex(Q=>Q.id===E.id)*r+12;return {id:E.id,x:B,y:F,width:G,height:32}}),[T,N]),U=Ce.useCallback((E,B,G)=>{if(!G||B===0){h([]);return}let O=K.calculateCascadePreview(e,E,B,T,n,v*s,r,48);h(O);},[e,T,n,v,s,r,48]),H=Ce.useMemo(()=>{let E=[],B=new Date(n);for(;B<=o;){let F=(B.getTime()-n.getTime())/864e5*v*s;if(a==="day")E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:F}),B.setDate(B.getDate()+1);else if(a==="week"){let Q=w(B);E.push({date:new Date(B),label:`Week ${Q}`,x:F}),B.setDate(B.getDate()+7);}else E.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:F}),B.setMonth(B.getMonth()+1);}return E},[n,o,a,v,s]),M=Ce.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*v*s,[n,v,s]),$=Math.max(T.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},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(f,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(f,1e3),height:48,fill:t.bgGrid}),H.map((E,B)=>jsxRuntime.jsxs("g",{children:[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-${B}`)),M>=0&&M<=f&&jsxRuntime.jsx("circle",{cx:M,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(f,1e3),height:$,style:{display:"block",flexShrink:0},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(f,1e3),height:$,fill:t.bgPrimary}),H.map((E,B)=>{let G=H[B+1]?.x||f,O=k(E.date);return jsxRuntime.jsxs("g",{children:[O&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:G-E.x,height:T.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:T.length*r,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),M>=0&&M<=f&&jsxRuntime.jsx("line",{x1:M,y1:0,x2:M,y2:T.length*r,stroke:t.today,strokeWidth:2,opacity:1}),T.map((E,B)=>{let G=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*r,width:f,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:O=>C(O,E),onMouseEnter:O=>{O.currentTarget.setAttribute("fill",t.accentLight),O.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:O=>{O.currentTarget.setAttribute("fill","transparent"),O.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:M>0?M:100,y:B*r+r/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}`)}),T.map((E,B)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(G=>{let O=T.find(pe=>pe.id===G);if(!O||!O.startDate||!O.endDate)return null;let F=T.findIndex(pe=>pe.id===G),Q=N(O),Y=N(E);return jsxRuntime.jsx(On,{x1:Q.x+Q.width,y1:F*r+r/2,x2:Y.x,y2:B*r+r/2,theme:t,onDelete:()=>m?.(E.id,G)},`dep-${G}-${E.id}`)})),T.map((E,B)=>{if(!E.startDate||!E.endDate)return null;let{x:G,width:O}=N(E),F=B*r+12,Q=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx($n,{task:E,x:G+O/2,y:F+16,theme:t,onClick:d},E.id):Q?jsxRuntime.jsxs("g",{onClick:()=>d?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:G,y:F,width:O,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:G,y1:F,x2:G+O,y2:F,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:F,x2:G,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G+O,y1:F,x2:G+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:G,y1:F+32,x2:G+O,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),O>60&&jsxRuntime.jsx("text",{x:G+12,y:F+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(Fn,{task:E,x:G,y:F,width:O,theme:t,dayWidth:v*s,startDate:n,templates:c,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:p,allTaskPositions:R,onDragMove:U},E.id)}),x.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 oc=[{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 sc({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:oc.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&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})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:oc.find(a=>a.value===e)?.name||"Personalizado"})]})}function Wn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:c=r?"edit":"create",theme:d="dark"}){let i=ke[d]||ke.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},l={color:i.textSecondary},[p,m]=Ce.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[b,x]=Ce.useState({});Ce.useEffect(()=>{m(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let h=()=>{let f={};return p.name.trim()||(f.name="El nombre es requerido"),p.startDate&&p.endDate&&p.startDate>p.endDate&&(f.endDate="La fecha de fin debe ser posterior a la de inicio"),x(f),Object.keys(f).length===0},g=async f=>{if(f.preventDefault(),!!h())try{await o(p),t();}catch(w){console.error("Error submitting task:",w);}},v=(f,w)=>{m(k=>{let y={...k,[f]:w};if(f==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?y.status="completed":C>0&&C<100&&k.status==="todo"?y.status="in-progress":C===0&&k.status==="in-progress"&&(y.status="todo");}return y}),b[f]&&x(k=>{let y={...k};return delete y[f],y});};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:i.bgPrimary,border:`1px solid ${i.border}`},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:l,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:p.name,onChange:f=>v("name",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:f=>f.currentTarget.style.borderColor=i.accent,onBlur:f=>f.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),b.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"}),b.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:p.startDate?p.startDate.toISOString().split("T")[0]:"",onChange:f=>v("startDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:p.endDate?p.endDate.toISOString().split("T")[0]:"",onChange:f=>v("endDate",f.target.value?new Date(f.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||p.isMilestone}),b.endDate&&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"}),b.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:p.status,onChange:f=>v("status",f.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(sc,{value:p.color,onChange:f=>v("color",f),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:l,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981",backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.1)":p.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[p.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:p.progress,onChange:f=>v("progress",parseInt(f.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:p.progress<30?"#EF4444":p.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${p.progress}%`,backgroundColor:p.progress<30?"rgba(239, 68, 68, 0.3)":p.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(f=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v("progress",f),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.bgSecondary,color:p.progress===f?"#FFFFFF":i.textSecondary,border:`1px solid ${p.progress===f?f<30?"#EF4444":f<70?"#F59E0B":"#10B981":i.borderLight}`},children:[f,"%"]},f))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:p.isMilestone,onChange:f=>v("isMilestone",f.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.assignees?.some(w=>w.name===f.name),onChange:w=>{let k=w.target.checked?[...p.assignees||[],{name:f.name,avatar:f.avatar,initials:f.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(p.assignees||[]).filter(y=>y.name!==f.name);v("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:f.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]})]},f.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:l,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(f=>f.id!==r?.id).map(f=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.dependencies?.includes(f.id),onChange:w=>{let k=w.target.checked?[...p.dependencies||[],f.id]:(p.dependencies||[]).filter(y=>y!==f.id);v("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:f.name})]},f.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:f=>{f.currentTarget.style.color=i.textPrimary,f.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:f=>{f.currentTarget.style.color=i.textSecondary,f.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:s,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:i.accent,color:"#FFFFFF"},onMouseEnter:f=>!s&&(f.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:f=>!s&&(f.currentTarget.style.backgroundColor=i.accent),children:s?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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Dg=['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"'],mc=()=>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"})]}),Sg=()=>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"})}),Ng=()=>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"})}),Eg=()=>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"})}),Rg=()=>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 Hn({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:o,onTaskDelete:s,onDependencyCreate:c,onDependencyDelete:d}){let[i,u]=Ce.useState(false),[l,p]=Ce.useState(false),[m,b]=Ce.useState([]),[x,h]=Ce.useState(""),[g,v]=Ce.useState(false),[f,w]=Ce.useState(true),k=Ce.useRef(null),y=Ce.useRef(null),C=Ce.useRef(null),{enabled:T=true,placeholder:N='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:U,suggestions:H=Dg,maxHistory:M=50}=r;Ce.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[m]),Ce.useEffect(()=>{i&&!l&&k.current&&setTimeout(()=>k.current?.focus(),100);},[i,l]);let $=Ce.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&n?.(F.taskId,F.updates);break;case "create_task":F.newTask&&o?.(F.newTask);break;case "delete_task":F.taskId&&s?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&d?.(F.taskId,F.dependencyFrom);break}},[n,o,s,c,d]),E=Ce.useCallback(async F=>{if(!F.trim()||g)return;let Q={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};b(pe=>[...pe.slice(-(M-1)),Q]),h(""),w(false),v(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(pe=>[...pe,Y]);try{if(U){let pe=await U(F,e);b(I=>{let le=I.filter(bt=>!bt.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:pe.message,timestamp:new Date,command:pe};return [...le,se]}),$(pe);}else b(pe=>[...pe.filter(le=>!le.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(pe){b(I=>[...I.filter(se=>!se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${pe instanceof Error?pe.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[g,M,U,e,$]),B=F=>{F.preventDefault(),E(x);},G=F=>{h(F),k.current?.focus();};if(Ce.useEffect(()=>{let F=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),u(Y=>!Y),i||p(false)),Q.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[i]),!T)return null;let O={"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(Ve,{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 ${O[R]} 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:()=>u(true),children:[jsxRuntime.jsx(mc,{}),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:C,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${O[R]} 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(mc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Eg,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ng,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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:[m.length===0&&f&&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:H.slice(0,4).map((F,Q)=>jsxRuntime.jsx("button",{onClick:()=>G(F),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:F.length>30?F.slice(0,30)+"...":F},Q))})]}),m.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Rg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:B,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:k,type:"text",value:x,onChange:F=>h(F.target.value),placeholder:N,disabled:g,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||g,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:x.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:x.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Sg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function fc(e,t=50){let[r,a]=Ce.useState({past:[],present:e,future:[]}),n=Ce.useRef(false),o=Ce.useCallback((i,u=true)=>{a(l=>{let p=typeof i=="function"?i(l.present):i;if(n.current)return {...l,present:p};if(!u)return {...l,present:p};let m=[...l.past,l.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),s=Ce.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),c=Ce.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),d=Ce.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:d}}function gc({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){Ce.useEffect(()=>{if(!n)return;let o=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=c?s.metaKey:s.ctrlKey;if(d&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!c&&d&&s.key==="y"){s.preventDefault(),t();return}if(c&&d&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var Ag={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${K.formatDate(e.startDate)} - ${K.formatDate(e.endDate)}`);let r=K.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,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=>K.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hc(e){return {...Ag,...e}}var Og=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},yc=Ce.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:c="comfortable",showThemeSelector:d=true,showExportButton:i=true,availableUsers:u=[],templates:l,enableAutoCriticalPath:p=true,aiAssistant:m,locale:b="en",customTranslations:x,showCreateTaskButton:h=false,createTaskLabel:g,onCreateTask:v,onThemeChange:f,onTaskClick:w,onTaskDblClick:k,onTaskContextMenu:y,onTaskUpdate:C,onProgressChange:T,onTaskEdit:N,onTaskAddSubtask:R,onTaskMarkIncomplete:U,onTaskSetInProgress:H,onDependencyCreate:M,onDependencyDelete:$,onBeforeTaskAdd:E,onAfterTaskAdd:B,onBeforeTaskUpdate:G,onAfterTaskUpdate:O}=r,Q=Ce.useContext(Rn)?.theme,[Y,pe]=Ce.useState(Q||o||"dark"),[I,le]=Ce.useState(s),[se,bt]=Ce.useState(c),[Ze,ar]=Ce.useState(1),[we,mt]=Ce.useState(0),[ft,_t]=Ce.useState(false),[pr,Lr]=Ce.useState(null),[ge,Qe]=Ce.useState({isOpen:false,x:0,y:0,task:null}),[Wt,Bt]=Ce.useState(null);Ce.useEffect(()=>{Q&&Q!==Y&&pe(Q);},[Q]),Ce.useEffect(()=>{o&&o!==Y&&pe(o);},[o]);let Fr=Ce.useCallback(S=>{pe(S),f?.(S);},[f]),{state:ne,setState:me,undo:j,redo:z,canUndo:Fe,canRedo:ze,clearHistory:te}=fc(t,50);Ce.useEffect(()=>{me(t);},[t,me]),Ce.useEffect(()=>{a&&a(ne);},[ne,a]);let ce=Ce.useMemo(()=>Zo(b,x),[b,x]),nr=Ce.useCallback(S=>[{id:"name",label:S.columns.taskName,width:320,minWidth:180,maxWidth:800,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:S.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:S.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:S.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:S.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:S.columns.progress,width:120,visible:false,sortable:true}],[]),[Ot,q]=Ce.useState(()=>nr(ce));Ce.useEffect(()=>{q(S=>S.map(P=>({...P,label:ce.columns[P.id==="name"?"taskName":P.id]||P.label})));},[ce]);let V=Ce.useMemo(()=>Ot.filter(S=>S.visible).reduce((S,P)=>S+P.width,0)+60,[Ot]),ve=pr||V,D=Ce.useRef(null),_=Ce.useRef(null),de=Ce.useRef(null),he=Ce.useMemo(()=>Il(Y),[Y]),Ae=Ce.useMemo(()=>({theme:he,themeName:Y}),[he,Y]),$e=Ce.useMemo(()=>hc(l),[l]),Nt=Ce.useMemo(()=>{if(!p)return ne;let S=K.calculateCriticalPath(ne),P=W=>W.map(Z=>({...Z,isCriticalPath:S.includes(Z.id),subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(ne)},[ne,p]),wt=Og(se);gc({undo:j,redo:z,canUndo:Fe,canRedo:ze,enabled:true}),Ce.useImperativeHandle(n,()=>({getTask:S=>K.findTaskById(ne,S),addTask:(S,P)=>{me(W=>{if(!P)return [...W,{...S,level:0}];let Z=ae=>ae.map(ie=>ie.id===P?{...ie,subtasks:[...ie.subtasks||[],{...S,parentId:P,level:(ie.level||0)+1}],isExpanded:true}:ie.subtasks?{...ie,subtasks:Z(ie.subtasks)}:ie);return Z(W)});},updateTask:(S,P)=>{me(W=>{let Z=ae=>ae.map(ie=>ie.id===S?{...ie,...P}:ie.subtasks?{...ie,subtasks:Z(ie.subtasks)}:ie);return Z(W)});},deleteTask:S=>{me(P=>{let W=Z=>Z.filter(ae=>ae.id===S?false:(ae.subtasks&&(ae.subtasks=W(ae.subtasks)),true));return W(P)});},deleteTasks:S=>{me(P=>An(P,S));},duplicateTask:S=>{me(P=>os(P,[S]));},splitTask:(S,P,W=3)=>{me(Z=>K.splitTask(Z,S,P,W));},calculateEndDate:K.calculateEndDate,calculateDuration:K.calculateDuration,validateDependency:(S,P)=>!K.validateDependencies(ne,S,P),getAllTasks:()=>K.flattenTasks(ne),getTasksByStatus:S=>K.flattenTasks(ne).filter(P=>P.status===S),getTasksByParent:S=>S?K.findTaskById(ne,S)?.subtasks||[]:ne.filter(W=>!W.parentId),getCriticalPath:()=>K.flattenTasks(ne).filter(S=>S.isCriticalPath),indentTask:S=>{me(P=>rs(P,[S]));},outdentTask:S=>{me(P=>as(P,[S]));},moveTask:(S,P)=>{me(W=>ns(W,[S],P));},createSubtask:async S=>{let{tasks:P,newTask:W}=ls(ne,S);if(E){let Z=E({...W,parentId:S});if((Z instanceof Promise?await Z:Z)===false)return}me(P),B&&B({...W,parentId:S});},scrollToTask:S=>{let W=K.flattenTasks(ne).findIndex(Z=>Z.id===S);if(W!==-1&&D.current){let Z=W*wt;D.current.scrollTo({top:Z,behavior:"smooth"}),_.current&&_.current.scrollTo({top:Z,behavior:"smooth"});}},highlightTask:(S,P=2e3)=>{},expandTask:S=>{me(P=>{let W=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:true}:ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae);return W(P)});},collapseTask:S=>{me(P=>{let W=Z=>Z.map(ae=>ae.id===S?{...ae,isExpanded:false}:ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae);return W(P)});},expandAll:()=>{me(S=>{let P=W=>W.map(Z=>({...Z,isExpanded:true,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},collapseAll:()=>{me(S=>{let P=W=>W.map(Z=>({...Z,isExpanded:false,subtasks:Z.subtasks?P(Z.subtasks):void 0}));return P(S)});},undo:j,redo:z,canUndo:()=>Fe,canRedo:()=>ze,clearHistory:te,exportToPNG:async()=>{if(!de.current)throw new Error("Gantt container not found");let S=await vc__default.default(de.current,{backgroundColor:he.bgPrimary,scale:2});return new Promise((P,W)=>{S.toBlob(Z=>{Z?P(Z):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await K.exportToPDF(ne,S);},exportToExcel:async S=>{await K.exportToExcel(ne,S);},exportToJSON:()=>K.exportToJSON(ne),exportToCSV:()=>K.exportToCSV(ne),importFromJSON:S=>{let P=K.importFromJSON(S);me(P);},getTasks:()=>ne,refresh:()=>{me(S=>[...S]);},clearAll:()=>{me([]);}}),[ne,j,z,Fe,ze,te,he,wt]);let eo=Ce.useCallback(S=>{q(P=>P.map(W=>W.id===S?{...W,visible:!W.visible}:W));},[]),ba=Ce.useCallback((S,P)=>{q(W=>W.map(Z=>{if(Z.id!==S)return Z;let ae=Z.minWidth??100,ie=Z.maxWidth??800,et=Math.max(ae,Math.min(ie,P));return {...Z,width:et}}));},[]),ya=Ce.useCallback(S=>{me(P=>is(P,S)),r.onTaskToggleExpand?.(S);},[r]),Qr=Ce.useCallback((S,P)=>{if(G&&G(S,P)===false)return;let Z=K.findTaskById(ne,S)?.progress,ae=et=>et.map(gt=>gt.id===S?{...gt,...P}:gt.subtasks?{...gt,subtasks:ae(gt.subtasks)}:gt);me(ae(ne));let ie=K.findTaskById(ae(ne),S);ie&&(C?.(ie),O?.(ie),P.progress!==void 0&&Z!==void 0&&P.progress!==Z&&T?.(S,Z,P.progress));},[ne,C,G,O,T]),yd=Ce.useCallback(S=>{S.length!==0&&(me(P=>rs(P,S)),r.onTaskIndent?.(S[0]));},[r]),xd=Ce.useCallback(S=>{S.length!==0&&(me(P=>as(P,S)),r.onTaskOutdent?.(S[0]));},[r]),kd=Ce.useCallback((S,P)=>{S.length!==0&&(me(W=>ns(W,S,P)),r.onTaskMove?.(S[0],P));},[r]),Ys=Ce.useCallback(S=>{r.onMultiTaskDelete?r.onMultiTaskDelete(S):(me(P=>An(P,S)),S.forEach(P=>r.onTaskDelete?.(P)));},[r]),wd=Ce.useCallback(S=>{me(P=>os(P,S)),S.forEach(P=>r.onTaskDuplicate?.(P));},[r]),Cd=Ce.useCallback((S,P)=>{me(W=>{let{tasks:Z,newTask:ae}=Yl(W,S,P);return E&&E(ae)===false?W:(r.onTaskCreate?.(ae.parentId,ae.position||0),B?.(ae),Z)});},[r,E,B]),Td=Ce.useCallback((S,P)=>{me(W=>ss(W,S,P)),r.onTaskRename?.(S,P);},[r]),qs=Ce.useCallback(S=>{me(P=>{let{tasks:W}=ls(P,S);return r.onTaskCreate?.(S,0),W});},[r]),Dd=Ce.useCallback((S,P,W)=>{let Z=S.startDate?Math.round((P.getTime()-S.startDate.getTime())/864e5):0,ae=gt=>gt.map(Ht=>Ht.id===S.id?{...Ht,startDate:P,endDate:W,...S.segments&&{segments:S.segments}}:Ht.subtasks?{...Ht,subtasks:ae(Ht.subtasks)}:Ht),ie=ae(ne);ie=K.autoScheduleDependents(ie,S.id,Z),me(ie);let et={...S,startDate:P,endDate:W};C?.(et);},[ne,C]),Sd=Ce.useCallback((S,P)=>{y?.(S,P),Qe({isOpen:true,x:P.clientX,y:P.clientY,task:S});},[y]),Nd=Ce.useCallback((S,P)=>{let W=K.splitTask(ne,S.id,P);me(W),Qe({isOpen:false,x:0,y:0,task:null});},[ne]),Xs=Ce.useCallback(S=>{k?.(S),N||Bt(S);},[k,N]),Js=Ce.useCallback((S,P,W)=>{let Z=new Map,ae=Vt=>{Vt.forEach(mr=>{mr.dependencies&&Z.set(mr.id,mr.dependencies),mr.subtasks&&ae(mr.subtasks);});};ae(W);let ie=Z.get(P)||[];Z.set(P,[...ie,S]);let et=new Set,gt=new Set,Ht=Vt=>{if(!et.has(Vt)){et.add(Vt),gt.add(Vt);let mr=Z.get(Vt)||[];for(let xa of mr){if(!et.has(xa)&&Ht(xa))return true;if(gt.has(xa))return true}}return gt.delete(Vt),false};return Ht(P)},[]),Zs=Ce.useCallback((S,P)=>{if(Js(S.id,P,ne)){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
278
|
Task dependencies must flow in one direction only.`);return}let W=Z=>Z.map(ae=>{if(ae.id===P){let ie=ae.dependencies||[];if(!ie.includes(S.id))return {...ae,dependencies:[...ie,S.id]}}return ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae});me(W(ne)),M?.(S.id,P);},[ne,M,Js]),Qs=Ce.useCallback((S,P)=>{let W=Z=>Z.map(ae=>{if(ae.id===S&&ae.dependencies){let ie=ae.dependencies.filter(et=>et!==P);return {...ae,dependencies:ie}}return ae.subtasks?{...ae,subtasks:W(ae.subtasks)}:ae});me(W(ne)),$?.(S,P);},[ne,$]),{startDate:Ed,endDate:Rd}=Ce.useMemo(()=>{let S=ne.filter(ie=>ie.startDate&&ie.endDate);if(S.length===0){let ie=new Date,et=new Date(ie);et.setDate(et.getDate()-30);let gt=new Date(ie);return gt.setDate(gt.getDate()+60),{startDate:et,endDate:gt}}let P=S.flatMap(ie=>[ie.startDate,ie.endDate]).filter(ie=>ie!==void 0),W=new Date(Math.min(...P.map(ie=>ie.getTime()))),Z=new Date(Math.max(...P.map(ie=>ie.getTime()))),ae=I==="day"?7:I==="week"?14:30;return W.setDate(W.getDate()-ae),Z.setDate(Z.getDate()+ae),{startDate:W,endDate:Z}},[ne,I]),Pd=Ce.useCallback(async()=>{if(!de.current)return;let S=await vc__default.default(de.current,{backgroundColor:he.bgPrimary,scale:2}),P=document.createElement("a");P.download="gantt-chart.png",P.href=S.toDataURL("image/png"),P.click();},[he]),Id=Ce.useCallback(async()=>{await K.exportToPDF(ne);},[ne]),Md=Ce.useCallback(async()=>{await K.exportToExcel(ne);},[ne]),Ad=Ce.useCallback(()=>{let S=K.exportToCSV(ne),P=new Blob([S],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(P),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[ne]),Ld=Ce.useCallback(()=>{let S=K.exportToJSON(ne),P=new Blob([S],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(P),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[ne]),Fd=Ce.useCallback(()=>{K.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Bd=S=>{S.preventDefault(),_t(true);};return Ce.useEffect(()=>{let S=_.current,P=D.current;if(!S||!P)return;let W=P.querySelector(".gantt-taskgrid-content"),Z=()=>{let et=S.scrollTop;mt(et),W&&(W.style.transform=`translateY(-${et}px)`);},ae=et=>{if(ft&&P){let Ht=P.parentElement?.getBoundingClientRect()?.left||0,Vt=et.clientX-Ht,mr=200,xa=Math.min(window.innerWidth-300,800);Vt>=mr&&Vt<=xa&&Lr(Vt);}},ie=()=>{_t(false);};return S.addEventListener("scroll",Z),document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ie),()=>{S.removeEventListener("scroll",Z),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",ie);}},[ft]),jsxRuntime.jsx(ua.Provider,{value:ce,children:jsxRuntime.jsx(yo.Provider,{value:Ae,children:jsxRuntime.jsxs("div",{ref:de,className:"flex flex-col h-full w-full",style:{backgroundColor:he.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(In,{theme:he,timeScale:I,onTimeScaleChange:le,zoom:Ze,onZoomChange:ar,currentTheme:Y,onThemeChange:Fr,rowDensity:se,onRowDensityChange:bt,showThemeSelector:d,showCreateTaskButton:h,createTaskLabel:g,onCreateTask:v,onExportPNG:i?Pd:void 0,onExportPDF:i?Id:void 0,onExportExcel:i?Md:void 0,onExportCSV:i?Ad:void 0,onExportJSON:i?Ld:void 0,onExportMSProject:i?Fd:void 0}),jsxRuntime.jsxs("div",{ref:D,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ve,overflow:"hidden",borderRight:`1px solid ${ft?he.accent:he.border}`},children:jsxRuntime.jsx(Ln,{tasks:Nt,theme:he,rowHeight:wt,availableUsers:u,templates:$e,onTaskClick:w,onTaskDblClick:Xs,onTaskContextMenu:y,onTaskToggle:ya,scrollTop:we,columns:Ot,onToggleColumn:eo,onColumnResize:ba,onTaskUpdate:Qr,onTaskIndent:yd,onTaskOutdent:xd,onTaskMove:kd,onMultiTaskDelete:Ys,onTaskDuplicate:wd,onTaskCreate:Cd,onTaskRename:Td,onCreateSubtask:qs,onOpenTaskModal:w?S=>w(S):void 0})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Bd}),jsxRuntime.jsx("div",{ref:_,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(_n,{tasks:Nt,theme:he,rowHeight:wt,timeScale:I,startDate:Ed,endDate:Rd,zoom:Ze,templates:$e,onTaskClick:w,onTaskDblClick:Xs,onTaskContextMenu:Sd,onTaskDateChange:Dd,onDependencyCreate:Zs,onDependencyDelete:Qs})})]}),ge.task&&jsxRuntime.jsx(pa,{isOpen:ge.isOpen,x:ge.x,y:ge.y,theme:he,onClose:()=>Qe({isOpen:false,x:0,y:0,task:null}),items:[{id:"edit",label:ce.contextMenu?.editTask||"Edit Task",icon:nt.Pencil,onClick:()=>{ge.task&&(N?N(ge.task):Bt(ge.task));}},{id:"addSubtask",label:ce.contextMenu?.addSubtask||"Add Subtask",icon:nt.Add,onClick:()=>{ge.task&&(R?R(ge.task):qs(ge.task.id));}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ce.contextMenu?.markIncomplete||"Mark Incomplete",icon:nt.MarkIncomplete,onClick:()=>{ge.task&&(U?U(ge.task):Qr(ge.task.id,{status:"todo",progress:0}));},disabled:ge.task?.status==="todo"},{id:"setInProgress",label:ce.contextMenu?.setInProgress||"Set In Progress",icon:nt.SetInProgress,onClick:()=>{ge.task&&(H?H(ge.task):Qr(ge.task.id,{status:"in-progress"}));},disabled:ge.task?.status==="in-progress"},{id:"markComplete",label:ce.contextMenu?.markComplete||"Mark Complete",icon:nt.MarkComplete,onClick:()=>{ge.task&&Qr(ge.task.id,{status:"completed",progress:100});},disabled:ge.task?.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ce.contextMenu?.splitTask||"Split Task",icon:nt.Split,onClick:()=>{if(!ge.task?.startDate||!ge.task?.endDate){console.warn("Cannot split task without dates");return}let S=ge.task.startDate.getTime(),P=ge.task.endDate.getTime(),W=S+(P-S)/2,Z=new Date(W);Nd(ge.task,Z);},disabled:!ge.task?.startDate||!ge.task?.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ce.contextMenu?.deleteTask||"Delete Task",icon:nt.Delete,onClick:()=>{ge.task&&Ys([ge.task.id]);}}]}),Wt&&jsxRuntime.jsx(Wn,{isOpen:true,onClose:()=>Bt(null),task:Wt,onSubmit:S=>{Qr(Wt.id,S),Bt(null);},mode:"edit",theme:Y}),m?.enabled&&jsxRuntime.jsx(Hn,{tasks:ne,theme:he,config:m,onTasksUpdate:me,onTaskUpdate:Qr,onTaskCreate:S=>{me(P=>[...P,S]);},onTaskDelete:S=>{me(P=>An(P,[S]));},onDependencyCreate:(S,P)=>{let W=K.findTaskById(ne,S);W&&Zs(W,P);},onDependencyDelete:Qs})]})})})});var xc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|