@libxai/board 0.17.433 → 0.17.435
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function bi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,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(m).map(([i,c])=>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:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 yi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),u=react.useRef(null);if(!t)return null;let b=async()=>{let C=o?.current||void 0,g=await rd(e,m,C);od(g,m);},y=async C=>{let g=C.target.files?.[0];if(g){try{let v=await id(g),h=g.name.endsWith(".json")?"json":"csv",p=sd(v,h);l(p),p.success&&r&&r(p,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="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:[n==="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(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:f("p-4 rounded-lg border-2 transition-all text-center",m===C?"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:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),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:b,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"})]}),n==="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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.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"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((C,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},g))})]})]})]})]})]})}var Eb=["URGENT","HIGH","MEDIUM","LOW"],Pb=[{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"}],Mb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:u=false,groupBy:b="none",onGroupByChange:y}){let[C,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),p=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:C?"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"}),x&&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)"]})]}),!C&&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:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Eb.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:p,className:"filter-bar__select filter-bar__select--sm",children:Pb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Mb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let u=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(async()=>await 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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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 ki={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"}},wi={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"}},Ci={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"}},eo={dark:ki,light:wi,neutral:Ci},An="dark";var Ln=react.createContext(void 0),Ub="asakaa-theme";function Cc({children:e,defaultTheme:t=An,storageKey:a=Ub}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${Hb(c)}`,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(([c,l])=>{let u=m.colors[c];u&&d.style.setProperty(l,u);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(Ln.Provider,{value:n,children:e})}function wo(){let e=react.useContext(Ln);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ti({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(eo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&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"})})]},s))})]})]}):null}function Tc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var In={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},Nc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},Ni={en:In,es:Nc};function Dc(e){return Ni[e]||Ni.en}function Di(e,t){let a=Dc(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var To=react.createContext(In);function Lr(){return react.useContext(To)}function lh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),u=Lr();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),C=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#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:u.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&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:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(g.id,g.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:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.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===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function dh({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function ch({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function mh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.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:c*.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 ph({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Lr();react.useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let b=C=>{d.current&&!d.current.contains(C.target)&&n(false);},y=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u=>{u.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(u=>{let b=t===u.value&&!r,y=()=>u.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(u.value),o&&o(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:u.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},u.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all");},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:u,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:C=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Lr(),w=v||h||p||k||x||D,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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(ch,{options:A,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mh,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ph,{theme:e,value:b,onChange:y,hideCompleted:C,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(dh,{options:I,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,u=8,b=window.innerWidth,y=window.innerHeight,C=t,g=a;t+c+u>b&&(C=t-c,C<u&&(C=u)),a+l+u>y&&(g=y-l-u,g<u&&(g=u)),m({x:C,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},l=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},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?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.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:s.textTertiary}})]})]},c.id))})})})}var Lt={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 Bc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:u=true}){let b=react.useRef(false),y=react.useCallback(p=>{b.current=p;},[]),C=react.useCallback(p=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),k},[]),g=react.useCallback(()=>{let p=C(e);for(let k of p)if(t.has(k.id))return k;return null},[e,t,C]),v=react.useCallback((p,k)=>{let x=C(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(I=>I.id===D.id);if(T===-1)return;let w=p==="up"?T-1:T+1;if(w<0||w>=x.length)return;let A=x[w];a(A.id,k);},[e,g,C,a]),h=react.useCallback(p=>{if(!u)return;let k=p.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){p.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,w=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){w.length>0&&(p.preventDefault(),n(w,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){w.length>0&&(p.preventDefault(),d(w));return}if(p.key==="Tab"&&p.shiftKey){w.length>0&&(p.preventDefault(),m(w));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),l(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){w.length>0&&(p.preventDefault(),o(w));return}if(p.key==="d"&&T&&!p.shiftKey){w.length>0&&(p.preventDefault(),s(w));return}},[u,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Oc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(u=>{let b=new Set(u);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,u)=>{if(!a){o(l);return}let b=u.indexOf(a),y=u.indexOf(l);if(b===-1||y===-1){o(l);return}let C=Math.min(b,y),g=Math.max(b,y),v=u.slice(C,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,u,b,y)=>{y?n(l,u):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,u)=>{u?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function $c(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=$c(a.subtasks,t);if(r)return r}}return null}function Li(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Li(a.subtasks,t);if(r)return r}return null}function Ii(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,u)=>{let b=[];return {tasks:l.filter(C=>{if(u.has(C.id))return b.push(C),false;if(C.subtasks){let g=n(C.subtasks,u);C.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,u,b)=>l.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,u,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Bi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Li(a,r);if(!o)continue;let s=Li(a,o.id),n=(i,c,l)=>{for(let u=0;u<i.length;u++){let b=i[u];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(C=>C.id===l);if(y!==-1){let[C]=b.subtasks.splice(y,1);return C}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let u=i.findIndex(b=>b.id===c);if(u!==-1)return i.splice(u+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function Ri(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Oi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function $i(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function zc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function zi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:zi(r.subtasks,t,a)}:r)}function Ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ui(a.subtasks,t)}:a)}function Hi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let u=a(l.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let u=l.subtasks||[];return {...l,subtasks:[...u,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function Uc(e,t,a,r){if(t===a)return e;let o=$c(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,u=[...c];return u.splice(l,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function Un({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:u,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:C,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let A=react.useContext(To),[I,N]=react.useState(null),[H,U]=react.useState(null),[j,ce]=react.useState(""),ee=react.useRef(null),[te,me]=react.useState(null),[pe,Ae]=react.useState(0),[F,R]=react.useState(0),[S,B]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[_,ae]=react.useState(null),[ne,de]=react.useState(null),[Me,Z]=react.useState(null),Ye=react.useRef(0),Te=5,Ke=react.useRef(false),[Tt,Et]=react.useState(null),[Ze,vt]=react.useState(false),[bt,Gt]=react.useState(null),[ue,L]=react.useState(false),se=react.useRef(null);react.useEffect(()=>{function O(V){se.current&&!se.current.contains(V.target)&&L(false);}if(ue)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[ue]),react.useEffect(()=>{H&&ee.current&&(ee.current.focus(),ee.current.select());},[H]),react.useEffect(()=>{if(!te)return;let O=xe=>{let Ie=xe.clientX-pe,Fe=F+Ie;u?.(te,Fe);},V=()=>{me(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",V),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",V),document.body.style.cursor="",document.body.style.userSelect="";}},[te,pe,F,u]);let{selectedTaskIds:ge,handleTaskClick:$e,isTaskSelected:X}=Oc(),{setIsEditing:Be}=Bc({tasks:e,selectedTaskIds:ge,onTaskSelect:(O,V)=>{let Ie=Do(e).map(Fe=>Fe.id);$e(O,Ie,V||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:O=>{let V=Do(e).find(xe=>xe.id===O);V&&We(V);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:O=>{let V=Do(e).find(xe=>xe.id===O);V&&D&&D(V);},enableKeyboard:true}),G=(O,V=0)=>{let xe=[];for(let Ie of O)xe.push({task:Ie,level:V}),Ie.subtasks&&Ie.subtasks.length>0&&Ie.isExpanded&&xe.push(...G(Ie.subtasks,V+1));return xe},Y=G(e),He=48,Re=Math.max(Y.length*a,600-He),je=O=>!O.startDate||!O.endDate?"-":`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))}d`,We=O=>{U(O.id),ce(O.name),Be(true);},le=O=>{j.trim()&&j!==e.find(V=>V.id===O)?.name&&k?.(O,j.trim()),U(null),ce(""),Be(false);},Le=()=>{U(null),ce(""),Be(false);},Q=(O,V)=>{V.stopPropagation(),x?.(O.id);},_e=(O,V)=>{V.preventDefault(),Ye.current=V.clientY,ae(O),Ke.current=false,vt(false),Et({x:V.clientX,y:V.clientY});},Na=O=>{if(!_||(Math.abs(O.clientY-Ye.current)>Te&&!Ke.current&&(Ke.current=true,vt(true)),Et({x:O.clientX,y:O.clientY}),!Ke.current))return;let xe=document.querySelectorAll("[data-task-row]"),Ie=null,Fe=null;xe.forEach($=>{let re=$.getBoundingClientRect(),ze=$.getAttribute("data-task-row");if(ze&&ze!==_&&O.clientY>=re.top&&O.clientY<=re.bottom){Ie=ze;let xt=O.clientY-re.top,st=re.height;xt<st*.25?Fe="above":xt>st*.75?Fe="below":Fe="child";}}),de(Ie),Z(Fe);},fe=()=>{if(Ke.current&&_&&ne&&Me){if(Me==="child")w?.(_,ne);else if(Me==="above"||Me==="below"){let O=(Ie,Fe,$=null)=>{for(let re of Ie){if(re.id===Fe)return $;if(re.subtasks){let ze=O(re.subtasks,Fe,re.id);if(ze!==void 0)return ze}}},V=O(e,ne,null),xe=(Ie,Fe)=>{let $=Ie.findIndex(re=>re.id===Fe);return Me==="below"?$+1:$};if(V===null){let Ie=xe(e,ne);w?.(_,null,Ie);}else {let Ie=Y.find(Fe=>Fe.task.id===V)?.task;if(Ie?.subtasks){let Fe=xe(Ie.subtasks,ne);w?.(_,V,Fe);}}}}ae(null),de(null),Z(null),Et(null),Ke.current=false,vt(false);};react.useEffect(()=>{if(_)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[_,ne,Me]);let Ve=(O,V,xe)=>{switch(O.id){case "name":let Ie=H===V.id,Fe=I===V.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${xe*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Fe?1:.3},onMouseDown:ye=>_e(V.id,ye),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),V.subtasks&&V.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ye=>{ye.stopPropagation(),m?.(V.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:V.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:V.color||"#3B82F6",opacity:V.parentId?.6:1,borderColor:V.isMilestone?t.accent:"transparent",borderWidth:V.isMilestone?"2px":"0px"},title:V.isMilestone?"Milestone":V.parentId?"Subtask":"Task"})}),Ie?jsxRuntime.jsx("input",{ref:ee,type:"text",value:j,onChange:ye=>ce(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"?le(V.id):ye.key==="Escape"&&Le();},onBlur:()=>le(V.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:ye=>ye.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:V.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:V.parentId?"13px":"14px",fontWeight:V.isMilestone?600:V.parentId?400:600,letterSpacing:V.parentId?"0":"-0.01em"},title:V.name,children:V.name}),Fe&&!Ie&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ye=>Q(V,ye),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:ye=>{ye.stopPropagation(),We(V);},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":case "endDate":let re=O.id==="startDate"?"startDate":"endDate",ze=V[re],xt=bt?.taskId===V.id&&bt?.field===re,st=ye=>ye?(typeof ye=="string"?new Date(ye):ye).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:ye=>{if(xt)Gt(null);else {let kt=ye.currentTarget.getBoundingClientRect();Gt({taskId:V.id,field:re,month:ze?typeof ze=="string"?new Date(ze):ze:new Date,position:{top:kt.bottom+4,left:kt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:st(ze)})]}),xt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Gt(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:bt?.position.top,left:bt?.position.left},onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ye=new Date,kt=new Date(ye);kt.setDate(ye.getDate()+1);let tt=new Date(ye);tt.setDate(ye.getDate()+7);let co=new Date(ye);return co.setDate(ye.getDate()+14),[{label:"Hoy",date:ye},{label:"Ma\xF1ana",date:kt},{label:"Pr\xF3xima semana",date:tt},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[re]:vr.date}),Gt(null);},children:vr.label},Qa))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[re]:void 0}),Gt(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:bt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ye,kt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ye},kt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ye=bt?.month||new Date,kt=ye.getFullYear(),tt=ye.getMonth(),co=new Date(kt,tt,1).getDay(),Lo=new Date(kt,tt+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(kt,tt,-_t).getDate(),date:new Date(kt,tt-1,new Date(kt,tt,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Lo;_t++)Qa.push({day:_t,date:new Date(kt,tt,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(kt,tt+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Io=(ze?typeof ze=="string"?new Date(ze):ze:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:ks&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(V.id,{[re]:_t.date}),Gt(null);},children:_t.day},xs)})})()})]})]})]}),document.body)]});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:je(V)})});case "assignees":let Hr=r.filter(ye=>V.assignees?.some(kt=>kt.name===ye.name||kt.initials===ye.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:Hr,availableUsers:r,onChange:ye=>{let kt=ye.map(tt=>({id:tt.id,name:tt.name,initials:tt.initials,color:tt.color}));b?.(V.id,{assignees:kt.length>0?kt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(Dd,{status:V.status||"todo",onChange:ye=>{b?.(V.id,{status:ye,progress:ye==="completed"?100:V.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:`${V.progress}%`,backgroundColor:V.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:[V.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},La=hr[V.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:La,onChange:ye=>{ye&&b?.(V.id,{priority:yr[ye]||"medium"});}})});default:return null}},Oe=O=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>l(O),disabled:O==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],P=O=>O.subtasks&&O.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(O);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{b?.(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{b?.(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{b?.(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}],J=c.filter(O=>O.visible),ve=J.reduce((O,V)=>O+V.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ve},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${He}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:J.map((O,V)=>{let xe=V===J.length-1,Ie=O.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ie?"":"justify-center"}`,style:{width:`${O.width}px`,minWidth:`${O.minWidth??(Ie?200:60)}px`,maxWidth:`${O.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:xe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Fe=>{Fe.preventDefault(),B({isOpen:true,x:Fe.clientX,y:Fe.clientY,type:"header",columnId:O.id});},onMouseEnter:Fe=>{Fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Fe=>{Fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:O.label,children:O.label}),O.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:te===O.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Fe=>{Fe.preventDefault(),Fe.stopPropagation(),me(O.id),Ae(Fe.clientX),R(O.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},O.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>L(!ue),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),ue&&jsxRuntime.jsxs("div",{ref:se,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:O=>O.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:()=>L(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",style:{minHeight:Re},children:Y.map(({task:O,level:V},xe)=>{let Ie=X(O.id),Fe=ne===O.id,$=Fe&&Me==="above",re=Fe&&Me==="below",ze=Fe&&Me==="child",xt={};return ze&&(xt.backgroundColor=`${t.accent}15`,xt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":O.id,className:`flex items-center cursor-pointer group ${_===O.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ie?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ie?t.accentLight:ze?`${t.accent}15`:xe%2===0?t.bgPrimary:t.bgGrid,...xt},onMouseEnter:()=>N(O.id),onMouseLeave:()=>N(null),onClick:st=>{let hr=Do(e).map(ye=>ye.id),La=navigator.platform.toUpperCase().indexOf("MAC")>=0?st.metaKey:st.ctrlKey;$e(O.id,hr,La,st.shiftKey),s?.(O);},onDoubleClick:st=>{st.stopPropagation(),n?.(O);},onContextMenu:st=>{st.preventDefault(),B({isOpen:true,x:st.clientX,y:st.clientY,type:"task",task:O}),d?.(O,st);},whileHover:{backgroundColor:Ie?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),re&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J.map((st,Hr)=>{let hr=Hr===J.length-1,yr=st.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${st.width}px`,minWidth:`${st.minWidth??(yr?200:60)}px`,maxWidth:`${st.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${I===O.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(st,O,yr?V:0)},`${O.id}-${st.id}`)})]},O.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?P(S.task):[],onClose:()=>B({...S,isOpen:false}),theme:t}),Ze&&Tt&&_&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let O=Y.find(V=>V.task.id===_)?.task;return O?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:O.name})}):null})()}),document.body)]})}function Vc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[w,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:u,setHoveredTaskId:b,activeZone:y,setActiveZone:C,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ce)=>{r("none"),l(null),b(null),d(j),i(ce),x(0),v(null),p(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:u,allTaskPositions:b=[],onDragMove:y,onHoverChange:C}){let g=Vc(t,r),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:A,ghostWidth:I,setGhostWidth:N,connectionLine:H,setConnectionLine:U,hoveredTaskId:j,setHoveredTaskId:ce,activeZone:ee,setActiveZone:te,draggedSegmentIndex:me,setDraggedSegmentIndex:pe,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:B,setHoveredSegmentIndex:_,isHovered:ae,setIsHovered:ne,isDragging:de,isResizing:Me,isConnecting:Z,resetDragState:Ye}=g,Te=32,Ke=8,Tt=e.endDate&&e.endDate<new Date&&e.progress<100,Et=e.isCriticalPath,Ze=o.name==="neutral"||o.today==="#1C1917",vt=e.status==="completed"||e.progress===100,bt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ue=e.isCriticalPath||Tt?"#DC2626":e.color?e.color:e.priority&&bt[e.priority]?bt[e.priority]:o.taskBarPrimary,se=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),ge=r<50,$e=r<40;react.useEffect(()=>{if(C)if(ae&&!de&&!e.segments){let fe=a<100;C({task:e,x:t,y:a,width:r,height:Te,showBelow:fe});}else C(null);},[ae,de,e,t,a,r,Te,C]);let X=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},G=fe=>Math.round(fe/s)*s,Y=fe=>{let Ve=Math.round(fe/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ve),Oe},He=(fe,Ve)=>{for(let Oe of b){if(Oe.id===e.id)continue;let P=5;if(fe>=Oe.x-P&&fe<=Oe.x+Oe.width+P&&Ve>=Oe.y-P&&Ve<=Oe.y+Oe.height+P)return Oe.id}return null},Re=react.useCallback((fe,Ve,Oe)=>{fe.preventDefault(),fe.stopPropagation();let P=v.current?.ownerSVGElement;if(!P)return;let J=P.createSVGPoint();J.x=fe.clientX,J.y=fe.clientY;let ve=J.matrixTransform(P.getScreenCTM()?.inverse()),O=Oe!==void 0?Oe:t,V=Ve;if(!V){let xe=ve.x-O;fe.shiftKey?(V="connect",U({x:t+r,y:a+Te/2})):fe.ctrlKey||fe.metaKey?V="move":fe.altKey?V=xe<r/2?"resize-start":"resize-end":$e?xe<r/2?V="move":V="resize-end":ge?xe<=se/2?V="resize-start":xe>=r-se/2?V="resize-end":V="move":xe<=se?V="resize-start":xe>=r-se?V="resize-end":V="move";}x(V),ne(false),te(null),V==="move"?T(ve.x-O):V==="connect"?U({x:t+r,y:a+Te/2}):T(0),A(O),N(r);},[t,r,a,Te]),je=react.useCallback(fe=>{let Ve=v.current?.ownerSVGElement;if(!Ve)return;let Oe=Ve.closest(".gantt-timeline-scroll");if(!Oe)return;let P=Oe.getBoundingClientRect(),J=60,ve=15,O=0;if(fe.clientX<P.left+J){let V=P.left+J-fe.clientX;O=-Math.min(ve,V/2);}else if(fe.clientX>P.right-J){let V=fe.clientX-(P.right-J);O=Math.min(ve,V/2);}return O!==0&&(Oe.scrollLeft+=O),O!==0},[]),We=react.useCallback(fe=>{if(k==="none")return;p.current=fe;let Ve=v.current?.ownerSVGElement;if(!Ve)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let J=je(fe);J&&!h.current?h.current=window.setInterval(()=>{p.current&&(je(p.current),We(p.current));},16):!J&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=Ve.createSVGPoint();Oe.x=fe.clientX,Oe.y=fe.clientY;let P=Oe.matrixTransform(Ve.getScreenCTM()?.inverse());if(k==="connect"){U({x:P.x,y:P.y});let J=He(P.x,P.y);ce(J);}else if(k==="move"){let J=P.x-D,ve=G(J);A(ve),N(r);let O=Math.round((ve-t)/s);if(y?.(e.id,O,true),e.segments&&e.segments.length>0&&me!==null){let V=ve-Ae;S(V);}}else if(k==="resize-start"){let J=P.x,ve=G(J),O=t+r-ve;O>=s&&(A(ve),N(O));}else if(k==="resize-end"){let J=P.x,O=G(J)-t;O>=s&&N(O);}},[k,t,r,s,D,e,G,me,Ae,He,ce,U,A,N,S,y,je]),le=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,k!=="none"){if(k==="connect")j&&u&&u(e,j),U(null),ce(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),Ve,Oe,P=true;if(k==="move"){if(Ve=Y(w),Oe=new Date(Ve.getTime()+fe),e.segments&&e.segments.length>0&&me!==null){let J=Math.round(R/s),ve=e.segments.map((Ie,Fe)=>{if(Fe===me){let $=new Date(Ie.startDate),re=new Date(Ie.endDate);return $.setDate($.getDate()+J),re.setDate(re.getDate()+J),{startDate:$,endDate:re}}return Ie}),O=ve.flatMap(Ie=>[Ie.startDate,Ie.endDate]),V=new Date(Math.min(...O.map(Ie=>Ie.getTime()))),xe=new Date(Math.max(...O.map(Ie=>Ie.getTime())));l?.({...e,segments:ve},V,xe),Ye(t,r);return}}else k==="resize-start"?(Ve=Y(w),Oe=e.endDate,Ve>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),P=false)):k==="resize-end"?(Ve=e.startDate,Oe=Y(w+I),Oe<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),P=false)):P=false;P&&Ve&&Oe&&(Oe.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ve,Oe));}y?.(e.id,0,false),Ye(t,r);}},[k,w,I,e,l,j,u,t,r,s,Y,R,me,Ye,y]);react.useEffect(()=>{if(k==="none")return;let fe=Oe=>{We(Oe);},Ve=()=>{le();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Ve),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,We,le]);let Le=de&&!Z?w:t,Q=de&&!Z?I:r,_e=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!de&&m?.(e),onDoubleClick:fe=>{de||(fe.stopPropagation(),i?.(e));},onContextMenu:fe=>{fe.preventDefault(),c?.(e,fe);},onMouseEnter:()=>!de&&ne(true),onMouseLeave:()=>{de||(ne(false),te(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!de&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:se,height:Te,fill:ee==="resize-start"?o.accent:"transparent",opacity:ee==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:fe=>Re(fe,"resize-start")}),jsxRuntime.jsx("rect",{x:t+se,y:a,width:r-se*2,height:Te,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:fe=>Re(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r-se,y:a,width:se,height:Te,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:fe=>Re(fe,"resize-end")})]}),ae&&!de&&$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:fe=>Re(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:fe=>Re(fe,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),de&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:I,height:Te,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:ue,"data-task-class":_e,initial:{opacity:0,scale:.95},animate:{opacity:de&&!Z?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>Re(fe),style:{cursor:de?Z?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q*(e.progress/100),height:Te,rx:Ke,fill:ue,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,Ve)=>{let Oe=(fe.startDate.getTime()-n.getTime())/864e5*s,J=(fe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,ve=de&&k==="move"&&me===Ve,O=B===Ve,V=ve?Oe+R:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!de&&_(Ve),onMouseLeave:()=>!de&&_(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:V,y:a,width:J,height:Te,rx:Ke,fill:ue,initial:{opacity:0,scale:.95},animate:{opacity:ve||e.parentId?.6:O?.9:.8,scale:O&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xe=>{xe.stopPropagation(),pe(Ve),F(Oe),Re(xe,void 0,Oe);},style:{cursor:de?Z?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:V,y:a,width:J*(e.progress/100),height:Te,rx:Ke,fill:ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Ze&&(Tt||Et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Et&&!Tt&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Tt&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Q>60&&!e.segments&&(()=>{let fe=d.taskLabel(e),Ve=typeof fe=="string"?fe:e.name,Oe=Ve.length>Math.floor(Q/8)?`${Ve.substring(0,Math.floor(Q/8))}...`:Ve;return jsxRuntime.jsx("text",{x:Le+12,y:a+Te/2,dominantBaseline:"middle",fill:vt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:vt?"line-through":"none"},children:Oe})})(),Q>100&&e.progress>0&&e.progress<100&&!de&&!e.segments&&jsxRuntime.jsxs("text",{x:Le+Q-12,y:a+Te/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&&Q>80&&!de&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Le+Q-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Le+Q-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||Me)&&!Z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Le-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Le+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:ee==="resize-start"||k==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Le+Q-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Le+Q-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:ee==="resize-end"||k==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!de&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ee==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Z&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Te/2,x2:H.x,y2:H.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||de)&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Le-2,y:a-2,width:Q+4,height:Te+4,rx:Ke+2,fill:"none",stroke:de?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:de?.6:.4,initial:{opacity:0},animate:{opacity:de?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+I,y1:0,x2:w+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!de&&!e.segments&&!C&&(()=>{let Oe=a<100,P=Oe?a+Te+13:a-82-13,J=Oe?`M ${Le+Q/2-6} ${a+Te+3} L ${Le+Q/2} ${a+Te+13} L ${Le+Q/2+6} ${a+Te+3}`:`M ${Le+Q/2-6} ${a-13} L ${Le+Q/2} ${a-3} L ${Le+Q/2+6} ${a-13}`,ve=P+22,O=P+40,V=P+55,xe=P+70,Ie=Oe?P+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:J,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Le+Q/2-120,y:P,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Le+Q/2,y:ve,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Le+Q/2-110,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Le+Q/2-70,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.startDate)}),jsxRuntime.jsx("text",{x:Le+Q/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Le+Q/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.endDate)}),jsxRuntime.jsx("text",{x:Le+Q/2+10,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Le+Q/2+65,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:Le+Q/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Le+Q/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Le+Q/2-110,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Le+Q/2-50,y:xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Fe=>Fe.name).join(", ").substring(0,30),e.assignees.map(Fe=>Fe.name).join(", ").length>30?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:Le+Q/2,y:Ie,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:$e?"Left: move \u2022 Right: resize":ge?"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 Yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,u=c+22,b=c+40,y=c+55,C=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:u,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=react.useState(false),[c,l]=react.useState(null),u=r-t,b=u>0,y=Math.abs(u)<5,g=5,v=20,h=!y&&a<=e,p,k;if(y)if(k=(e+a)/2,n==="squared")p=`M ${e} ${t} L ${a} ${r}`;else {let ee=Math.min(Math.abs(a-e)/3,30);p=`M ${e} ${t} C ${e+ee} ${t}, ${a-ee} ${r}, ${a} ${r}`;}else if(k=a-v,h){let te=e+15,me=a-v,pe=b?t+20:t-20;k=me,n==="squared"?p=`M ${e} ${t} L ${te} ${t} L ${te} ${pe} L ${me} ${pe} L ${me} ${r} L ${a} ${r}`:b?p=`M ${e} ${t} L ${te-g} ${t} Q ${te} ${t} ${te} ${t+g} L ${te} ${pe-g} Q ${te} ${pe} ${te-g} ${pe} L ${me+g} ${pe} Q ${me} ${pe} ${me} ${pe+g} L ${me} ${r-g} Q ${me} ${r} ${me+g} ${r} L ${a} ${r}`:p=`M ${e} ${t} L ${te-g} ${t} Q ${te} ${t} ${te} ${t-g} L ${te} ${pe+g} Q ${te} ${pe} ${te-g} ${pe} L ${me+g} ${pe} Q ${me} ${pe} ${me} ${pe-g} L ${me} ${r+g} Q ${me} ${r} ${me+g} ${r} L ${a} ${r}`;}else n==="squared"?p=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`:b?p=`M ${e} ${t} L ${k-g} ${t} Q ${k} ${t} ${k} ${t+g} L ${k} ${r-g} Q ${k} ${r} ${k+g} ${r} L ${a} ${r}`:p=`M ${e} ${t} L ${k-g} ${t} Q ${k} ${t} ${k} ${t-g} L ${k} ${r+g} Q ${k} ${r} ${k+g} ${r} L ${a} ${r}`;let x=5,D=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,w=o.dependencyHover||T,A="#f87171",I="rgba(248, 113, 113, 0.15)",N=k,H=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),H=t;else if(h){let ee=e+15,te=a-v,me=b?t+20:t-20,pe=[[e,t,ee,t],[ee,t,ee,me],[ee,me,te,me],[te,me,te,r],[te,r,a,r]],Ae=1/0,F={x:N,y:H};for(let R of pe){let S=U(c.x,c.y,R[0],R[1],R[2],R[3]),B=Math.hypot(c.x-S.x,c.y-S.y);B<Ae&&(Ae=B,F=S);}N=F.x,H=F.y;}else {let ee=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],te=1/0,me={x:N,y:H};for(let pe of ee){let Ae=U(c.x,c.y,pe[0],pe[1],pe[2],pe[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<te&&(te=F,me=Ae);}N=me.x,H=me.y;}function U(ee,te,me,pe,Ae,F){let R=Ae-me,S=F-pe,B=R*R+S*S;if(B===0)return {x:me,y:pe};let _=((ee-me)*R+(te-pe)*S)/B;return _=Math.max(0,Math.min(1,_)),{x:me+_*R,y:pe+_*S}}let j=ee=>{let te=ee.currentTarget.ownerSVGElement;if(!te)return;let me=te.getBoundingClientRect();l({x:ee.clientX-me.left,y:ee.clientY-me.top});},ce=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ce,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:p,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:p,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ce,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:p,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ke={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ke.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ke.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ke.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ke.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function bi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,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(m).map(([i,c])=>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:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 yi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),u=react.useRef(null);if(!t)return null;let b=async()=>{let C=o?.current||void 0,g=await rd(e,m,C);od(g,m);},y=async C=>{let g=C.target.files?.[0];if(g){try{let v=await id(g),h=g.name.endsWith(".json")?"json":"csv",p=sd(v,h);l(p),p.success&&r&&r(p,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>d("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>d("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="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:[n==="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(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:f("p-4 rounded-lg border-2 transition-all text-center",m===C?"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:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),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:b,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"})]}),n==="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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.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"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((C,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},g))})]})]})]})]})]})}var Eb=["URGENT","HIGH","MEDIUM","LOW"],Pb=[{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"}],Mb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:u=false,groupBy:b="none",onGroupByChange:y}){let[C,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),p=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:C?"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"}),x&&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)"]})]}),!C&&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:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Eb.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:p,className:"filter-bar__select filter-bar__select--sm",children:Pb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Mb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let u=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(async()=>await 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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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 ki={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"}},wi={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"}},Ci={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"}},eo={dark:ki,light:wi,neutral:Ci},An="dark";var Ln=react.createContext(void 0),Ub="asakaa-theme";function Cc({children:e,defaultTheme:t=An,storageKey:a=Ub}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${Hb(c)}`,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(([c,l])=>{let u=m.colors[c];u&&d.style.setProperty(l,u);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(Ln.Provider,{value:n,children:e})}function wo(){let e=react.useContext(Ln);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ti({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(eo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&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"})})]},s))})]})]}):null}function Tc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var In={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},Nc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},Ni={en:In,es:Nc};function Dc(e){return Ni[e]||Ni.en}function Di(e,t){let a=Dc(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var To=react.createContext(In);function Lr(){return react.useContext(To)}function lh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),u=Lr();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),C=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#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:u.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&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:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(g.id,g.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:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.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===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function dh({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function ch({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function mh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.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:c*.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 ph({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Lr();react.useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let b=C=>{d.current&&!d.current.contains(C.target)&&n(false);},y=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u=>{u.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(u=>{let b=t===u.value&&!r,y=()=>u.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(u.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:u.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},u.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:u,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:C=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Lr(),w=v||h||p||k||x||D,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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(ch,{options:A,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mh,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ph,{theme:e,value:b,onChange:y,hideCompleted:C,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(dh,{options:I,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,u=8,b=window.innerWidth,y=window.innerHeight,C=t,g=a;t+c+u>b&&(C=t-c,C<u&&(C=u)),a+l+u>y&&(g=y-l-u,g<u&&(g=u)),m({x:C,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},l=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},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?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.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:s.textTertiary}})]})]},c.id))})})})}var Lt={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 Bc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:u=true}){let b=react.useRef(false),y=react.useCallback(p=>{b.current=p;},[]),C=react.useCallback(p=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),k},[]),g=react.useCallback(()=>{let p=C(e);for(let k of p)if(t.has(k.id))return k;return null},[e,t,C]),v=react.useCallback((p,k)=>{let x=C(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(I=>I.id===D.id);if(T===-1)return;let w=p==="up"?T-1:T+1;if(w<0||w>=x.length)return;let A=x[w];a(A.id,k);},[e,g,C,a]),h=react.useCallback(p=>{if(!u)return;let k=p.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){p.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,w=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){w.length>0&&(p.preventDefault(),n(w,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){w.length>0&&(p.preventDefault(),d(w));return}if(p.key==="Tab"&&p.shiftKey){w.length>0&&(p.preventDefault(),m(w));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),l(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){w.length>0&&(p.preventDefault(),o(w));return}if(p.key==="d"&&T&&!p.shiftKey){w.length>0&&(p.preventDefault(),s(w));return}},[u,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Oc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(u=>{let b=new Set(u);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,u)=>{if(!a){o(l);return}let b=u.indexOf(a),y=u.indexOf(l);if(b===-1||y===-1){o(l);return}let C=Math.min(b,y),g=Math.max(b,y),v=u.slice(C,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,u,b,y)=>{y?n(l,u):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,u)=>{u?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function $c(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=$c(a.subtasks,t);if(r)return r}}return null}function Li(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Li(a.subtasks,t);if(r)return r}return null}function Ii(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,u)=>{let b=[];return {tasks:l.filter(C=>{if(u.has(C.id))return b.push(C),false;if(C.subtasks){let g=n(C.subtasks,u);C.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,u,b)=>l.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,u,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Bi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Li(a,r);if(!o)continue;let s=Li(a,o.id),n=(i,c,l)=>{for(let u=0;u<i.length;u++){let b=i[u];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(C=>C.id===l);if(y!==-1){let[C]=b.subtasks.splice(y,1);return C}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let u=i.findIndex(b=>b.id===c);if(u!==-1)return i.splice(u+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function Ri(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Oi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function $i(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function zc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function zi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:zi(r.subtasks,t,a)}:r)}function Ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ui(a.subtasks,t)}:a)}function Hi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let u=a(l.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let u=l.subtasks||[];return {...l,subtasks:[...u,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function Uc(e,t,a,r){if(t===a)return e;let o=$c(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,u=[...c];return u.splice(l,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function Un({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:u,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:C,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let A=react.useContext(To),[I,N]=react.useState(null),[H,U]=react.useState(null),[j,ce]=react.useState(""),ee=react.useRef(null),[te,me]=react.useState(null),[pe,Ae]=react.useState(0),[F,R]=react.useState(0),[S,B]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[_,ae]=react.useState(null),[ne,de]=react.useState(null),[Me,Z]=react.useState(null),Ye=react.useRef(0),Te=5,Ke=react.useRef(false),[Tt,Et]=react.useState(null),[Ze,vt]=react.useState(false),[bt,Gt]=react.useState(null),[ue,L]=react.useState(false),se=react.useRef(null);react.useEffect(()=>{function O(V){se.current&&!se.current.contains(V.target)&&L(false);}if(ue)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[ue]),react.useEffect(()=>{H&&ee.current&&(ee.current.focus(),ee.current.select());},[H]),react.useEffect(()=>{if(!te)return;let O=xe=>{let Ie=xe.clientX-pe,Fe=F+Ie;u?.(te,Fe);},V=()=>{me(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",V),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",V),document.body.style.cursor="",document.body.style.userSelect="";}},[te,pe,F,u]);let{selectedTaskIds:ge,handleTaskClick:$e,isTaskSelected:X}=Oc(),{setIsEditing:Be}=Bc({tasks:e,selectedTaskIds:ge,onTaskSelect:(O,V)=>{let Ie=Do(e).map(Fe=>Fe.id);$e(O,Ie,V||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:O=>{let V=Do(e).find(xe=>xe.id===O);V&&We(V);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:O=>{let V=Do(e).find(xe=>xe.id===O);V&&D&&D(V);},enableKeyboard:true}),G=(O,V=0)=>{let xe=[];for(let Ie of O)xe.push({task:Ie,level:V}),Ie.subtasks&&Ie.subtasks.length>0&&Ie.isExpanded&&xe.push(...G(Ie.subtasks,V+1));return xe},Y=G(e),He=48,Re=Math.max(Y.length*a,600-He),je=O=>!O.startDate||!O.endDate?"-":`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))}d`,We=O=>{U(O.id),ce(O.name),Be(true);},le=O=>{j.trim()&&j!==e.find(V=>V.id===O)?.name&&k?.(O,j.trim()),U(null),ce(""),Be(false);},Le=()=>{U(null),ce(""),Be(false);},Q=(O,V)=>{V.stopPropagation(),x?.(O.id);},_e=(O,V)=>{V.preventDefault(),Ye.current=V.clientY,ae(O),Ke.current=false,vt(false),Et({x:V.clientX,y:V.clientY});},Na=O=>{if(!_||(Math.abs(O.clientY-Ye.current)>Te&&!Ke.current&&(Ke.current=true,vt(true)),Et({x:O.clientX,y:O.clientY}),!Ke.current))return;let xe=document.querySelectorAll("[data-task-row]"),Ie=null,Fe=null;xe.forEach($=>{let re=$.getBoundingClientRect(),ze=$.getAttribute("data-task-row");if(ze&&ze!==_&&O.clientY>=re.top&&O.clientY<=re.bottom){Ie=ze;let xt=O.clientY-re.top,st=re.height;xt<st*.25?Fe="above":xt>st*.75?Fe="below":Fe="child";}}),de(Ie),Z(Fe);},fe=()=>{if(Ke.current&&_&&ne&&Me){if(Me==="child")w?.(_,ne);else if(Me==="above"||Me==="below"){let O=(Ie,Fe,$=null)=>{for(let re of Ie){if(re.id===Fe)return $;if(re.subtasks){let ze=O(re.subtasks,Fe,re.id);if(ze!==void 0)return ze}}},V=O(e,ne,null),xe=(Ie,Fe)=>{let $=Ie.findIndex(re=>re.id===Fe);return Me==="below"?$+1:$};if(V===null){let Ie=xe(e,ne);w?.(_,null,Ie);}else {let Ie=Y.find(Fe=>Fe.task.id===V)?.task;if(Ie?.subtasks){let Fe=xe(Ie.subtasks,ne);w?.(_,V,Fe);}}}}ae(null),de(null),Z(null),Et(null),Ke.current=false,vt(false);};react.useEffect(()=>{if(_)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[_,ne,Me]);let Ve=(O,V,xe)=>{switch(O.id){case "name":let Ie=H===V.id,Fe=I===V.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${xe*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Fe?1:.3},onMouseDown:ye=>_e(V.id,ye),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),V.subtasks&&V.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ye=>{ye.stopPropagation(),m?.(V.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:V.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:V.color||"#3B82F6",opacity:V.parentId?.6:1,borderColor:V.isMilestone?t.accent:"transparent",borderWidth:V.isMilestone?"2px":"0px"},title:V.isMilestone?"Milestone":V.parentId?"Subtask":"Task"})}),Ie?jsxRuntime.jsx("input",{ref:ee,type:"text",value:j,onChange:ye=>ce(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"?le(V.id):ye.key==="Escape"&&Le();},onBlur:()=>le(V.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:ye=>ye.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:V.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:V.parentId?"13px":"14px",fontWeight:V.isMilestone?600:V.parentId?400:600,letterSpacing:V.parentId?"0":"-0.01em"},title:V.name,children:V.name}),Fe&&!Ie&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ye=>Q(V,ye),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:ye=>{ye.stopPropagation(),We(V);},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":case "endDate":let re=O.id==="startDate"?"startDate":"endDate",ze=V[re],xt=bt?.taskId===V.id&&bt?.field===re,st=ye=>ye?(typeof ye=="string"?new Date(ye):ye).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:ye=>{if(xt)Gt(null);else {let kt=ye.currentTarget.getBoundingClientRect();Gt({taskId:V.id,field:re,month:ze?typeof ze=="string"?new Date(ze):ze:new Date,position:{top:kt.bottom+4,left:kt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:st(ze)})]}),xt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Gt(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:bt?.position.top,left:bt?.position.left},onClick:ye=>ye.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ye=new Date,kt=new Date(ye);kt.setDate(ye.getDate()+1);let tt=new Date(ye);tt.setDate(ye.getDate()+7);let co=new Date(ye);return co.setDate(ye.getDate()+14),[{label:"Hoy",date:ye},{label:"Ma\xF1ana",date:kt},{label:"Pr\xF3xima semana",date:tt},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[re]:vr.date}),Gt(null);},children:vr.label},Qa))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[re]:void 0}),Gt(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:bt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ye,kt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ye},kt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ye=bt?.month||new Date,kt=ye.getFullYear(),tt=ye.getMonth(),co=new Date(kt,tt,1).getDay(),Lo=new Date(kt,tt+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(kt,tt,-_t).getDate(),date:new Date(kt,tt-1,new Date(kt,tt,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Lo;_t++)Qa.push({day:_t,date:new Date(kt,tt,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(kt,tt+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Io=(ze?typeof ze=="string"?new Date(ze):ze:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:ks&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(V.id,{[re]:_t.date}),Gt(null);},children:_t.day},xs)})})()})]})]})]}),document.body)]});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:je(V)})});case "assignees":let Hr=r.filter(ye=>V.assignees?.some(kt=>kt.name===ye.name||kt.initials===ye.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:Hr,availableUsers:r,onChange:ye=>{let kt=ye.map(tt=>({id:tt.id,name:tt.name,initials:tt.initials,color:tt.color}));b?.(V.id,{assignees:kt.length>0?kt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(Dd,{status:V.status||"todo",onChange:ye=>{b?.(V.id,{status:ye,progress:ye==="completed"?100:V.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:`${V.progress}%`,backgroundColor:V.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:[V.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},La=hr[V.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:La,onChange:ye=>{ye&&b?.(V.id,{priority:yr[ye]||"medium"});}})});default:return null}},Oe=O=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>l(O),disabled:O==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],P=O=>O.subtasks&&O.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(O);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{b?.(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{b?.(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{b?.(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}],J=c.filter(O=>O.visible),ve=J.reduce((O,V)=>O+V.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ve},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${He}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:J.map((O,V)=>{let xe=V===J.length-1,Ie=O.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ie?"":"justify-center"}`,style:{width:`${O.width}px`,minWidth:`${O.minWidth??(Ie?200:60)}px`,maxWidth:`${O.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:xe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Fe=>{Fe.preventDefault(),B({isOpen:true,x:Fe.clientX,y:Fe.clientY,type:"header",columnId:O.id});},onMouseEnter:Fe=>{Fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Fe=>{Fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:O.label,children:O.label}),O.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:te===O.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Fe=>{Fe.preventDefault(),Fe.stopPropagation(),me(O.id),Ae(Fe.clientX),R(O.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},O.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>L(!ue),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),ue&&jsxRuntime.jsxs("div",{ref:se,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:O=>O.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:()=>L(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",style:{minHeight:Re},children:Y.map(({task:O,level:V},xe)=>{let Ie=X(O.id),Fe=ne===O.id,$=Fe&&Me==="above",re=Fe&&Me==="below",ze=Fe&&Me==="child",xt={};return ze&&(xt.backgroundColor=`${t.accent}15`,xt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":O.id,className:`flex items-center cursor-pointer group ${_===O.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ie?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ie?t.accentLight:ze?`${t.accent}15`:xe%2===0?t.bgPrimary:t.bgGrid,...xt},onMouseEnter:()=>N(O.id),onMouseLeave:()=>N(null),onClick:st=>{let hr=Do(e).map(ye=>ye.id),La=navigator.platform.toUpperCase().indexOf("MAC")>=0?st.metaKey:st.ctrlKey;$e(O.id,hr,La,st.shiftKey),s?.(O);},onDoubleClick:st=>{st.stopPropagation(),n?.(O);},onContextMenu:st=>{st.preventDefault(),B({isOpen:true,x:st.clientX,y:st.clientY,type:"task",task:O}),d?.(O,st);},whileHover:{backgroundColor:Ie?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),re&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J.map((st,Hr)=>{let hr=Hr===J.length-1,yr=st.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${st.width}px`,minWidth:`${st.minWidth??(yr?200:60)}px`,maxWidth:`${st.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${I===O.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(st,O,yr?V:0)},`${O.id}-${st.id}`)})]},O.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?P(S.task):[],onClose:()=>B({...S,isOpen:false}),theme:t}),Ze&&Tt&&_&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let O=Y.find(V=>V.task.id===_)?.task;return O?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:O.name})}):null})()}),document.body)]})}function Vc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[w,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:u,setHoveredTaskId:b,activeZone:y,setActiveZone:C,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ce)=>{r("none"),l(null),b(null),d(j),i(ce),x(0),v(null),p(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:u,allTaskPositions:b=[],onDragMove:y,onHoverChange:C}){let g=Vc(t,r),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:A,ghostWidth:I,setGhostWidth:N,connectionLine:H,setConnectionLine:U,hoveredTaskId:j,setHoveredTaskId:ce,activeZone:ee,setActiveZone:te,draggedSegmentIndex:me,setDraggedSegmentIndex:pe,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:B,setHoveredSegmentIndex:_,isHovered:ae,setIsHovered:ne,isDragging:de,isResizing:Me,isConnecting:Z,resetDragState:Ye}=g,Te=32,Ke=8,Tt=e.endDate&&e.endDate<new Date&&e.progress<100,Et=e.isCriticalPath,Ze=o.name==="neutral"||o.today==="#1C1917",vt=e.status==="completed"||e.progress===100,bt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ue=e.isCriticalPath||Tt?"#DC2626":e.color?e.color:e.priority&&bt[e.priority]?bt[e.priority]:o.taskBarPrimary,se=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),ge=r<50,$e=r<40;react.useEffect(()=>{if(C)if(ae&&!de&&!e.segments){let fe=a<100;C({task:e,x:t,y:a,width:r,height:Te,showBelow:fe});}else C(null);},[ae,de,e,t,a,r,Te,C]);let X=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},G=fe=>Math.round(fe/s)*s,Y=fe=>{let Ve=Math.round(fe/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ve),Oe},He=(fe,Ve)=>{for(let Oe of b){if(Oe.id===e.id)continue;let P=5;if(fe>=Oe.x-P&&fe<=Oe.x+Oe.width+P&&Ve>=Oe.y-P&&Ve<=Oe.y+Oe.height+P)return Oe.id}return null},Re=react.useCallback((fe,Ve,Oe)=>{fe.preventDefault(),fe.stopPropagation();let P=v.current?.ownerSVGElement;if(!P)return;let J=P.createSVGPoint();J.x=fe.clientX,J.y=fe.clientY;let ve=J.matrixTransform(P.getScreenCTM()?.inverse()),O=Oe!==void 0?Oe:t,V=Ve;if(!V){let xe=ve.x-O;fe.shiftKey?(V="connect",U({x:t+r,y:a+Te/2})):fe.ctrlKey||fe.metaKey?V="move":fe.altKey?V=xe<r/2?"resize-start":"resize-end":$e?xe<r/2?V="move":V="resize-end":ge?xe<=se/2?V="resize-start":xe>=r-se/2?V="resize-end":V="move":xe<=se?V="resize-start":xe>=r-se?V="resize-end":V="move";}x(V),ne(false),te(null),V==="move"?T(ve.x-O):V==="connect"?U({x:t+r,y:a+Te/2}):T(0),A(O),N(r);},[t,r,a,Te]),je=react.useCallback(fe=>{let Ve=v.current?.ownerSVGElement;if(!Ve)return;let Oe=Ve.closest(".gantt-timeline-scroll");if(!Oe)return;let P=Oe.getBoundingClientRect(),J=60,ve=15,O=0;if(fe.clientX<P.left+J){let V=P.left+J-fe.clientX;O=-Math.min(ve,V/2);}else if(fe.clientX>P.right-J){let V=fe.clientX-(P.right-J);O=Math.min(ve,V/2);}return O!==0&&(Oe.scrollLeft+=O),O!==0},[]),We=react.useCallback(fe=>{if(k==="none")return;p.current=fe;let Ve=v.current?.ownerSVGElement;if(!Ve)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let J=je(fe);J&&!h.current?h.current=window.setInterval(()=>{p.current&&(je(p.current),We(p.current));},16):!J&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=Ve.createSVGPoint();Oe.x=fe.clientX,Oe.y=fe.clientY;let P=Oe.matrixTransform(Ve.getScreenCTM()?.inverse());if(k==="connect"){U({x:P.x,y:P.y});let J=He(P.x,P.y);ce(J);}else if(k==="move"){let J=P.x-D,ve=G(J);A(ve),N(r);let O=Math.round((ve-t)/s);if(y?.(e.id,O,true),e.segments&&e.segments.length>0&&me!==null){let V=ve-Ae;S(V);}}else if(k==="resize-start"){let J=P.x,ve=G(J),O=t+r-ve;O>=s&&(A(ve),N(O));}else if(k==="resize-end"){let J=P.x,O=G(J)-t;O>=s&&N(O);}},[k,t,r,s,D,e,G,me,Ae,He,ce,U,A,N,S,y,je]),le=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,k!=="none"){if(k==="connect")j&&u&&u(e,j),U(null),ce(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),Ve,Oe,P=true;if(k==="move"){if(Ve=Y(w),Oe=new Date(Ve.getTime()+fe),e.segments&&e.segments.length>0&&me!==null){let J=Math.round(R/s),ve=e.segments.map((Ie,Fe)=>{if(Fe===me){let $=new Date(Ie.startDate),re=new Date(Ie.endDate);return $.setDate($.getDate()+J),re.setDate(re.getDate()+J),{startDate:$,endDate:re}}return Ie}),O=ve.flatMap(Ie=>[Ie.startDate,Ie.endDate]),V=new Date(Math.min(...O.map(Ie=>Ie.getTime()))),xe=new Date(Math.max(...O.map(Ie=>Ie.getTime())));l?.({...e,segments:ve},V,xe),Ye(t,r);return}}else k==="resize-start"?(Ve=Y(w),Oe=e.endDate,Ve>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),P=false)):k==="resize-end"?(Ve=e.startDate,Oe=Y(w+I),Oe<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),P=false)):P=false;P&&Ve&&Oe&&(Oe.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ve,Oe));}y?.(e.id,0,false),Ye(t,r);}},[k,w,I,e,l,j,u,t,r,s,Y,R,me,Ye,y]);react.useEffect(()=>{if(k==="none")return;let fe=Oe=>{We(Oe);},Ve=()=>{le();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Ve),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,We,le]);let Le=de&&!Z?w:t,Q=de&&!Z?I:r,_e=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!de&&m?.(e),onDoubleClick:fe=>{de||(fe.stopPropagation(),i?.(e));},onContextMenu:fe=>{fe.preventDefault(),c?.(e,fe);},onMouseEnter:()=>!de&&ne(true),onMouseLeave:()=>{de||(ne(false),te(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!de&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:se,height:Te,fill:ee==="resize-start"?o.accent:"transparent",opacity:ee==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:fe=>Re(fe,"resize-start")}),jsxRuntime.jsx("rect",{x:t+se,y:a,width:r-se*2,height:Te,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:fe=>Re(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r-se,y:a,width:se,height:Te,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:fe=>Re(fe,"resize-end")})]}),ae&&!de&&$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:ee==="move"?o.accent:"transparent",opacity:ee==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:fe=>Re(fe,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:ee==="resize-end"?o.accent:"transparent",opacity:ee==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:fe=>Re(fe,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),de&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:I,height:Te,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:ue,"data-task-class":_e,initial:{opacity:0,scale:.95},animate:{opacity:de&&!Z?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>Re(fe),style:{cursor:de?Z?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q*(e.progress/100),height:Te,rx:Ke,fill:ue,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,Ve)=>{let Oe=(fe.startDate.getTime()-n.getTime())/864e5*s,J=(fe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,ve=de&&k==="move"&&me===Ve,O=B===Ve,V=ve?Oe+R:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!de&&_(Ve),onMouseLeave:()=>!de&&_(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:V,y:a,width:J,height:Te,rx:Ke,fill:ue,initial:{opacity:0,scale:.95},animate:{opacity:ve||e.parentId?.6:O?.9:.8,scale:O&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xe=>{xe.stopPropagation(),pe(Ve),F(Oe),Re(xe,void 0,Oe);},style:{cursor:de?Z?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:V,y:a,width:J*(e.progress/100),height:Te,rx:Ke,fill:ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Ze&&(Tt||Et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Et&&!Tt&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Tt&&jsxRuntime.jsx("rect",{x:Le,y:a,width:Q,height:Te,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Q>60&&!e.segments&&(()=>{let fe=d.taskLabel(e),Ve=typeof fe=="string"?fe:e.name,Oe=Ve.length>Math.floor(Q/8)?`${Ve.substring(0,Math.floor(Q/8))}...`:Ve;return jsxRuntime.jsx("text",{x:Le+12,y:a+Te/2,dominantBaseline:"middle",fill:vt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:vt?"line-through":"none"},children:Oe})})(),Q>100&&e.progress>0&&e.progress<100&&!de&&!e.segments&&jsxRuntime.jsxs("text",{x:Le+Q-12,y:a+Te/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&&Q>80&&!de&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Le+Q-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Le+Q-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||Me)&&!Z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Le-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Le+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:ee==="resize-start"||k==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Le+Q-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Le+Q-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:ee==="resize-end"||k==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!de&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:fe=>{fe.stopPropagation(),Re(fe,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ee==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Z&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Te/2,x2:H.x,y2:H.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||de)&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Le-2,y:a-2,width:Q+4,height:Te+4,rx:Ke+2,fill:"none",stroke:de?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:de?.6:.4,initial:{opacity:0},animate:{opacity:de?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+I,y1:0,x2:w+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!de&&!e.segments&&!C&&(()=>{let Oe=a<100,P=Oe?a+Te+13:a-82-13,J=Oe?`M ${Le+Q/2-6} ${a+Te+3} L ${Le+Q/2} ${a+Te+13} L ${Le+Q/2+6} ${a+Te+3}`:`M ${Le+Q/2-6} ${a-13} L ${Le+Q/2} ${a-3} L ${Le+Q/2+6} ${a-13}`,ve=P+22,O=P+40,V=P+55,xe=P+70,Ie=Oe?P+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:J,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Le+Q/2-120,y:P,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Le+Q/2,y:ve,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Le+Q/2-110,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Le+Q/2-70,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.startDate)}),jsxRuntime.jsx("text",{x:Le+Q/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Le+Q/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.endDate)}),jsxRuntime.jsx("text",{x:Le+Q/2+10,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Le+Q/2+65,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:Le+Q/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Le+Q/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Le+Q/2-110,y:xe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Le+Q/2-50,y:xe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Fe=>Fe.name).join(", ").substring(0,30),e.assignees.map(Fe=>Fe.name).join(", ").length>30?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:Le+Q/2,y:Ie,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:$e?"Left: move \u2022 Right: resize":ge?"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 Yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,u=c+22,b=c+40,y=c+55,C=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:u,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=react.useState(false),[c,l]=react.useState(null),u=r-t,b=u>0,y=Math.abs(u)<5,g=5,v=20,h=!y&&a<=e,p,k;if(y)if(k=(e+a)/2,n==="squared")p=`M ${e} ${t} L ${a} ${r}`;else {let ee=Math.min(Math.abs(a-e)/3,30);p=`M ${e} ${t} C ${e+ee} ${t}, ${a-ee} ${r}, ${a} ${r}`;}else if(k=a-v,h){let te=e+15,me=a-v,pe=b?t+20:t-20;k=me,n==="squared"?p=`M ${e} ${t} L ${te} ${t} L ${te} ${pe} L ${me} ${pe} L ${me} ${r} L ${a} ${r}`:b?p=`M ${e} ${t} L ${te-g} ${t} Q ${te} ${t} ${te} ${t+g} L ${te} ${pe-g} Q ${te} ${pe} ${te-g} ${pe} L ${me+g} ${pe} Q ${me} ${pe} ${me} ${pe+g} L ${me} ${r-g} Q ${me} ${r} ${me+g} ${r} L ${a} ${r}`:p=`M ${e} ${t} L ${te-g} ${t} Q ${te} ${t} ${te} ${t-g} L ${te} ${pe+g} Q ${te} ${pe} ${te-g} ${pe} L ${me+g} ${pe} Q ${me} ${pe} ${me} ${pe-g} L ${me} ${r+g} Q ${me} ${r} ${me+g} ${r} L ${a} ${r}`;}else n==="squared"?p=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`:b?p=`M ${e} ${t} L ${k-g} ${t} Q ${k} ${t} ${k} ${t+g} L ${k} ${r-g} Q ${k} ${r} ${k+g} ${r} L ${a} ${r}`:p=`M ${e} ${t} L ${k-g} ${t} Q ${k} ${t} ${k} ${t-g} L ${k} ${r+g} Q ${k} ${r} ${k+g} ${r} L ${a} ${r}`;let x=5,D=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,w=o.dependencyHover||T,A="#f87171",I="rgba(248, 113, 113, 0.15)",N=k,H=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),H=t;else if(h){let ee=e+15,te=a-v,me=b?t+20:t-20,pe=[[e,t,ee,t],[ee,t,ee,me],[ee,me,te,me],[te,me,te,r],[te,r,a,r]],Ae=1/0,F={x:N,y:H};for(let R of pe){let S=U(c.x,c.y,R[0],R[1],R[2],R[3]),B=Math.hypot(c.x-S.x,c.y-S.y);B<Ae&&(Ae=B,F=S);}N=F.x,H=F.y;}else {let ee=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],te=1/0,me={x:N,y:H};for(let pe of ee){let Ae=U(c.x,c.y,pe[0],pe[1],pe[2],pe[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<te&&(te=F,me=Ae);}N=me.x,H=me.y;}function U(ee,te,me,pe,Ae,F){let R=Ae-me,S=F-pe,B=R*R+S*S;if(B===0)return {x:me,y:pe};let _=((ee-me)*R+(te-pe)*S)/B;return _=Math.max(0,Math.min(1,_)),{x:me+_*R,y:pe+_*S}}let j=ee=>{let te=ee.currentTarget.ownerSVGElement;if(!te)return;let me=te.getBoundingClientRect();l({x:ee.clientX-me.left,y:ee.clientY-me.top});},ce=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ce,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:p,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:p,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ce,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:p,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:m?w:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ee=>{ee.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ke={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ke.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ke.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ke.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ke.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
112
|
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ke.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=ke.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>ke.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ke.findTaskById(e,t);return !a||!a.dependencies?[]:ke.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ke.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ke.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ke.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ke.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ke.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(m=>{let i=m.startDate&&m.endDate?ke.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ke.formatDate(m.startDate):"N/A",m.endDate?ke.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:d,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ke.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?ke.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ke.formatDate(m.startDate):"","End Date":m.endDate?ke.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let d=a.utils.book_new();a.utils.book_append_sheet(d,s,"Gantt Tasks"),a.writeFile(d,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ke.flattenTasks(e),o=new Map;r.forEach((u,b)=>{o.set(u.id,b+1);});let s=u=>u.toISOString().replace("Z",""),n=ke.getEarliestStartDate(e)||new Date,d=ke.getLatestEndDate(e)||new Date,m=r.map((u,b)=>{let y=o.get(u.id),C=u.startDate&&u.endDate?ke.calculateDuration(u.startDate,u.endDate):0,g=(u.dependencies||[]).filter(v=>o.has(v)).map(v=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
114
|
<PredecessorUID>${o.get(v)}</PredecessorUID>
|