@libxai/board 0.17.155 → 0.17.156

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.js CHANGED
@@ -42,7 +42,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ns({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),d=useRef(null);useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let l=m.category||"Other";return n[l]||(n[l]=[]),n[l].push(m),n},{});return jsxs("div",{className:w("relative inline-block",a),children:[jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:w("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[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:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([n,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsx("div",{children:m.map(l=>jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function is({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=useState("export"),[p,n]=useState("json"),[m,l]=useState(null),i=useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Ii(e,p,f);Li(y,p);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Ri(y),b=y.name.endsWith(".json")?"json":"csv",g=Bi(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),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"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[d==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxs("button",{onClick:()=>n(f),className:w("p-4 rounded-lg border-2 transition-all text-center",p===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),d==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>i.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:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var au=["URGENT","HIGH","MEDIUM","LOW"],ru=[{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"}],ou=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ls({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=useState(true),x=useCallback(h=>{a({search:h.target.value});},[a]),b=useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=useCallback(h=>{r({by:h.target.value});},[r]),k=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&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)"]})]}),!f&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let E=h.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),au.map(h=>jsx("option",{value:h,children:h},h))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let E=h.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(h=>jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let E=h.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsx("option",{value:h,children:h},h))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:ru.map(h=>jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ou.map(h=>jsx("option",{value:h.value,children:h.label},h.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ds({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=useState(false),l=useRef(null);useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxs("div",{className:w("relative",r),ref:l,children:[jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),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"})]}),jsx("span",{children:"Config"})]}),n&&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"?jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),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"]}),jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var cs={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"}},ps={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"}},ms={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"}},gr={dark:cs,light:ps,neutral:ms},Uo="dark";var Wo=createContext(void 0),gu="asakaa-theme";function Fl({children:e,defaultTheme:t=Uo,storageKey:a=gu}){let[r,o]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=gr[r];Object.entries(p.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${fu(m)}`,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(([m,l])=>{let i=p.colors[m];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:gr};return jsx(Wo.Provider,{value:d,children:e})}function Br(){let e=useContext(Wo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function fu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function us({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Br();return e?jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),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"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(gr).map(([s,d])=>jsxs("button",{onClick:()=>{o(s),t();},className:w("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:[jsx("div",{className:"text-3xl",children:d.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),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&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var _e={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function Bl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return _e[e]||_e.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",_e[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",_e[e].bgSecondary),bgGrid:r("--theme-bg-card",_e[e].bgGrid),bgWeekend:r("--theme-bg-hover",_e[e].bgWeekend),border:r("--theme-border-primary",_e[e].border),borderLight:r("--theme-border-subtle",_e[e].borderLight),textPrimary:r("--theme-text-primary",_e[e].textPrimary),textSecondary:r("--theme-text-secondary",_e[e].textSecondary),textTertiary:r("--theme-text-tertiary",_e[e].textTertiary),accent:r("--theme-accent-primary",_e[e].accent),accentHover:r("--theme-accent-hover",_e[e].accentHover),accentLight:r("--theme-accent-primary",_e[e].accentLight),taskBarPrimary:r("--theme-accent-primary",_e[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",_e[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",_e[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",_e[e].dependency),dependencyHover:r("--theme-border-secondary",_e[e].dependencyHover),criticalPath:r("--theme-error",_e[e].criticalPath),criticalPathLight:r("--theme-error",_e[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",_e[e].today):e==="neutral"?r("--theme-text-primary",_e[e].today):r("--theme-error",_e[e].today),todayLight:e==="light"?r("--theme-accent-primary",_e[e].todayLight):e==="neutral"?r("--theme-text-primary",_e[e].todayLight):r("--theme-error",_e[e].todayLight),milestone:r("--theme-warning",_e[e].milestone),milestoneLight:r("--theme-warning",_e[e].milestoneLight),statusTodo:r("--theme-text-tertiary",_e[e].statusTodo),statusInProgress:r("--theme-accent-primary",_e[e].statusInProgress),statusCompleted:r("--theme-success",_e[e].statusCompleted),hoverBg:r("--theme-bg-hover",_e[e].hoverBg),focusRing:r("--theme-accent-primary",_e[e].focusRing)}}var Go={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Rl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},gs={en:Go,es:Rl};function Ol(e){return gs[e]||gs.en}function fs(e,t){let a=Ol(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 Or=createContext(Go);function oo(){return useContext(Or)}function Iu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,p]=useState(false),[n,m]=useState(null),l=useRef(null),i=oo();if(useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){m(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{m(null),p(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:i.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:c&&jsx(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:jsx("div",{className:"py-1",children:v.map((y,x)=>jsxs(motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Lu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let d=t===s.value;return jsxs(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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&jsx(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&&jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Fu({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(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:[jsx("span",{children:o.label}),s&&jsx(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 Bu({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),d=oo();useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(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:`${d.toolbar.density||"Density"}: ${p}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(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:jsx("div",{className:"py-1",children:c.map((n,m)=>{let l=t===n.value;return jsxs(motion.button,{onClick:()=>{a(n.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:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ho({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=oo(),k=u||v||f||y||x||b,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Fu,{options:N,value:t,onChange:E=>a(E),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(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:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),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),"%"]}),jsx(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:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bu,{theme:e,value:c,onChange:p})]}),jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:i,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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:l||g.toolbar.createTask})]}),(k||n)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Iu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsx(Lu,{options:h,value:s,onChange:E=>d(E),theme:e})]})]})}function _o({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,d]=useState({x:0,y:0}),c=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();d({x:m.left,y:m.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:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Qe,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[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"}),n.map(m=>jsxs("button",{onClick:()=>{t(m.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:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function $r({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=useRef(null),[c,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),p({x:f,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(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,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(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:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var gt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Xl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:i=true}){let u=useRef(false),v=useCallback(g=>{u.current=g;},[]),f=useCallback(g=>{let k=[],N=h=>{for(let E of h)k.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&N(E.subtasks);};return N(g),k},[]),y=useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),x=useCallback((g,k)=>{let N=f(e);if(N.length===0)return;let h=y();if(!h){a(N[0].id,false);return}let E=N.findIndex(T=>T.id===h.id);if(E===-1)return;let C=g==="up"?E-1:E+1;if(C<0||C>=N.length)return;let F=N[C];a(F.id,k);},[e,y,f,a]),b=useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){g.key==="Escape"&&(k.blur(),u.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),F=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(F&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!F.isExpanded||g.key==="ArrowLeft"&&F.isExpanded)&&m(F.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),d(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"above"));return}if(g.key==="Enter"&&E){F&&(g.preventDefault(),l(F.id));return}if(g.key==="F2"){F&&(g.preventDefault(),n(F.id));return}if(g.key==="Delete"||g.key==="Backspace"&&E){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&E&&!g.shiftKey){C.length>0&&(g.preventDefault(),s(C));return}},[i,t,y,x,r,o,s,d,c,p,n,m,l]);return useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Zl(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),p=useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function zr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Ql(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ql(a.subtasks,t);if(r)return r}}return null}function ys(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ys(a.subtasks,t);if(r)return r}return null}function vs(e,t){if(t.length===0)return e;let a=zr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function xs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ys(a,r);if(!o)continue;let s=ys(a,o.id),d=(n,m,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,m,l);if(v)return v}}return null},c=(n,m,l)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,m,l);return n},p=d(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function ks(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=d.length?false:([d[n],d[m]]=[d[m],d[n]],true)};return s(r,o,a),r}function ws(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 Cs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(m=>m.id===r);if(c===-1){for(let m of d)if(m.subtasks&&o(m.subtasks))return true;return false}let p=d[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function ed(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(l=>l.id===t);if(n===-1){for(let l of p)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,d),true};return c(r),{tasks:r,newTask:d}}function Ts(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ts(r.subtasks,t,a)}:r)}function Ds(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ds(a.subtasks,t)}:a)}function Ns(e,t){let a=m=>{for(let l of m){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,p],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:p}}function td(e,t,a,r){if(t===a)return e;let o=Ql(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],l=r!==void 0?r:m.length,i=[...m];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Ko({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:N,onOpenTaskModal:h,onDeleteRequest:E,onTaskReparent:C}){let F=useContext(Or),[T,$]=useState(null),[W,L]=useState(false),[G,ee]=useState(null),[he,ye]=useState(""),Me=useRef(null),V=useRef(null),[B,I]=useState(null),[R,M]=useState(0),[Y,K]=useState(0),[q,Ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Ue]=useState(null),[P,te]=useState(null),[fe,Ie]=useState(null),Oe=useRef(0),Ke=5,ot=useRef(false),[Se,St]=useState(null),[Ze,Je]=useState(false),[Ye,it]=useState(null);useEffect(()=>{function U(D){Me.current&&!Me.current.contains(D.target)&&L(false);}if(W)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[W]),useEffect(()=>{G&&V.current&&(V.current.focus(),V.current.select());},[G]),useEffect(()=>{if(!B)return;let U=X=>{let pe=X.clientX-R,Ne=Y+pe;i?.(B,Ne);},D=()=>{I(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",D),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",D),document.body.style.cursor="",document.body.style.userSelect="";}},[B,R,Y,i]);let{selectedTaskIds:$t,handleTaskClick:xe,isTaskSelected:O}=Zl(),{setIsEditing:Ce}=Xl({tasks:e,selectedTaskIds:$t,onTaskSelect:(U,D)=>{let pe=zr(e).map(Ne=>Ne.id);xe(U,pe,D||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:U=>{let D=zr(e).find(X=>X.id===U);D&&Q(D);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:U=>{let D=zr(e).find(X=>X.id===U);D&&h&&h(D);},enableKeyboard:true}),Ve=(U,D=0)=>{let X=[];for(let pe of U)X.push({task:pe,level:D}),pe.subtasks&&pe.subtasks.length>0&&pe.isExpanded&&X.push(...Ve(pe.subtasks,D+1));return X},He=Ve(e),xt=48,J=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Q=U=>{ee(U.id),ye(U.name),Ce(true);},ke=U=>{he.trim()&&he!==e.find(D=>D.id===U)?.name&&k?.(U,he.trim()),ee(null),ye(""),Ce(false);},ge=()=>{ee(null),ye(""),Ce(false);},ae=(U,D)=>{D.stopPropagation(),N?.(U.id);},De=(U,D)=>{D.preventDefault(),Oe.current=D.clientY,Ue(U),ot.current=false,Je(false),St({x:D.clientX,y:D.clientY});},me=U=>{if(!we||(Math.abs(U.clientY-Oe.current)>Ke&&!ot.current&&(ot.current=true,Je(true)),St({x:U.clientX,y:U.clientY}),!ot.current))return;let X=document.querySelectorAll("[data-task-row]"),pe=null,Ne=null;X.forEach(At=>{let Et=At.getBoundingClientRect(),It=At.getAttribute("data-task-row");if(It&&It!==we&&U.clientY>=Et.top&&U.clientY<=Et.bottom){pe=It;let Jt=U.clientY-Et.top,bt=Et.height;Jt<bt*.25?Ne="above":Jt>bt*.75?Ne="below":Ne="child";}}),te(pe),Ie(Ne);},Te=()=>{if(ot.current&&we&&P&&fe){if(fe==="child")C?.(we,P);else if(fe==="above"||fe==="below"){let U=(pe,Ne,At=null)=>{for(let Et of pe){if(Et.id===Ne)return At;if(Et.subtasks){let It=U(Et.subtasks,Ne,Et.id);if(It!==void 0)return It}}},D=U(e,P,null),X=(pe,Ne)=>{let At=pe.findIndex(Et=>Et.id===Ne);return fe==="below"?At+1:At};if(D===null){let pe=X(e,P);C?.(we,null,pe);}else {let pe=He.find(Ne=>Ne.task.id===D)?.task;if(pe?.subtasks){let Ne=X(pe.subtasks,P);C?.(we,D,Ne);}}}}Ue(null),te(null),Ie(null),St(null),ot.current=false,Je(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",me),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[we,P,fe]);let ue=(U,D,X)=>{switch(U.id){case "name":let pe=G===D.id,Ne=T===D.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${X*20}px`},children:[C&&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:Ne?1:.3},onMouseDown:ie=>De(D.id,ie),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),D.subtasks&&D.subtasks.length>0?jsx("button",{onClick:ie=>{ie.stopPropagation(),p?.(D.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:D.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(D.subtasks&&D.subtasks.length>0)&&jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:D.color||"#3B82F6",opacity:D.parentId?.6:1,borderColor:D.isMilestone?t.accent:"transparent",borderWidth:D.isMilestone?"2px":"0px"},title:D.isMilestone?"Milestone":D.parentId?"Subtask":"Task"}),pe?jsx("input",{ref:V,type:"text",value:he,onChange:ie=>ye(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ke(D.id):ie.key==="Escape"&&ge();},onBlur:()=>ke(D.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:ie=>ie.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:D.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:D.parentId?"13px":"14px",fontWeight:D.isMilestone?600:D.parentId?400:600,letterSpacing:D.parentId?"0":"-0.01em"},title:D.name,children:D.name}),Ne&&!pe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsx("button",{onClick:ie=>ae(D,ie),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:ie=>{ie.stopPropagation(),Q(D);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Et=U.id==="startDate"?"startDate":"endDate",It=D[Et],Jt=Ye?.taskId===D.id&&Ye?.field===Et,bt=ie=>ie?(typeof ie=="string"?new Date(ie):ie).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ie=>ie.stopPropagation(),children:[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:ie=>{if(Jt)it(null);else {let ht=ie.currentTarget.getBoundingClientRect();it({taskId:D.id,field:Et,month:It?typeof It=="string"?new Date(It):It:new Date,position:{top:ht.bottom+4,left:ht.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:bt(It)})]}),Jt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>it(null)}),jsxs(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:Ye?.position.top,left:Ye?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,ht=new Date(ie);ht.setDate(ie.getDate()+1);let Yt=new Date(ie);Yt.setDate(ie.getDate()+7);let Va=new Date(ie);return Va.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:ht},{label:"Pr\xF3xima semana",date:Yt},{label:"2 semanas",date:Va}].map((Nr,Ba)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ja=>ja.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ja=>ja.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:Nr.date}),it(null);},children:Nr.label},Ba))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:void 0}),it(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ye?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ie,ht)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},ht))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ye?.month||new Date,ht=ie.getFullYear(),Yt=ie.getMonth(),Va=new Date(ht,Yt,1).getDay(),wo=new Date(ht,Yt+1,0).getDate(),Nr=new Date,Ba=[];for(let kt=Va-1;kt>=0;kt--)Ba.push({day:new Date(ht,Yt,-kt).getDate(),date:new Date(ht,Yt-1,new Date(ht,Yt,-kt).getDate()),isCurrentMonth:false});for(let kt=1;kt<=wo;kt++)Ba.push({day:kt,date:new Date(ht,Yt,kt),isCurrentMonth:true});let ja=42-Ba.length;for(let kt=1;kt<=ja;kt++)Ba.push({day:kt,date:new Date(ht,Yt+1,kt),isCurrentMonth:false});return Ba.map((kt,Co)=>{let To=kt.date.toDateString()===Nr.toDateString(),Vr=(It?typeof It=="string"?new Date(It):It:null)?.toDateString()===kt.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:kt.isCurrentMonth?Vr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Vr?"#3B82F6":"transparent",boxShadow:To&&!Vr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(D.id,{[Et]:kt.date}),it(null);},children:kt.day},Co)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:J(D)})});case "assignees":let Dr=r.filter(ie=>D.assignees?.some(ht=>ht.name===ie.name||ht.initials===ie.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(cr,{assignedUsers:Dr,availableUsers:r,onChange:ie=>{let ht=ie.map(Yt=>({id:Yt.id,name:Yt.name,initials:Yt.initials,color:Yt.color}));u?.(D.id,{assignees:ht.length>0?ht:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(tl,{status:D.status||"todo",onChange:ie=>{u?.(D.id,{status:ie,progress:ie==="completed"?100:D.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${D.progress}%`,backgroundColor:D.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[D.progress,"%"]})]});case "priority":let or={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},_a={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},nr=or[D.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(lr,{priority:nr,onChange:ie=>{ie&&u?.(D.id,{priority:_a[ie]||"medium"});}})});default:return null}},Ae=U=>[{id:"hide",label:"Hide Column",icon:gt.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:gt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:gt.SortDesc,onClick:()=>{}}],ce=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:gt.Pencil,onClick:()=>{d?.(U);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:F?.contextMenu?.markIncomplete||"Mark Incomplete",icon:gt.MarkIncomplete,onClick:()=>{u?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:F?.contextMenu?.setInProgress||"Set In Progress",icon:gt.SetInProgress,onClick:()=>{u?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:F?.contextMenu?.markComplete||"Mark Complete",icon:gt.MarkComplete,onClick:()=>{u?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:gt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}],Le=m.filter(U=>U.visible);return jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${xt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Le.map((U,D)=>{let X=D===Le.length-1,pe=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${pe?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(pe?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:X?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ne=>{Ne.preventDefault(),Ee({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"header",columnId:U.id});},onMouseEnter:Ne=>{Ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ne=>{Ne.currentTarget.style.backgroundColor="transparent";},children:[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:pe?"70px":"0"},title:U.label,children:U.label}),pe&&jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsx(_o,{columns:m,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>L(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})})]}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),I(U.id),M(Ne.clientX),K(U.width);},title:"Drag to resize column",children: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"}})})]},U.id)}),W&&jsxs("div",{ref:Me,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:U=>U.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>L(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",children:He.map(({task:U,level:D},X)=>{let pe=O(U.id),Ne=P===U.id,At=Ne&&fe==="above",Et=Ne&&fe==="below",It=Ne&&fe==="child",Jt={};return It&&(Jt.backgroundColor=`${t.accent}15`,Jt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${we===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe?t.accentLight:It?`${t.accent}15`:X%2===0?t.bgPrimary:t.bgGrid,...Jt},onMouseEnter:()=>$(U.id),onMouseLeave:()=>$(null),onClick:bt=>{let or=zr(e).map(ie=>ie.id),nr=navigator.platform.toUpperCase().indexOf("MAC")>=0?bt.metaKey:bt.ctrlKey;xe(U.id,or,nr,bt.shiftKey),s?.(U);},onDoubleClick:bt=>{bt.stopPropagation(),d?.(U);},onContextMenu:bt=>{bt.preventDefault(),Ee({isOpen:true,x:bt.clientX,y:bt.clientY,type:"task",task:U}),c?.(U,bt);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:[At&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Et&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((bt,Dr)=>{let or=Dr===Le.length-1,_a=bt.id==="name";return jsx("div",{className:`px-4 flex items-center ${_a?"justify-start":"justify-center"}`,style:{width:`${bt.width}px`,minWidth:`${bt.minWidth??(_a?200:60)}px`,maxWidth:`${bt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:or?"none":`1px solid ${T===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ue(bt,U,_a?D:0)},`${U.id}-${bt.id}`)})]},U.id)})}),jsx($r,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ae(q.columnId):q.type==="task"&&q.task?ce(q.task):[],onClose:()=>Ee({...q,isOpen:false}),theme:t}),Ze&&Se&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Se.x+12,top:Se.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=He.find(D=>D.task.id===we)?.task;return U?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:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:U.name})}):null})()}),document.body)]})}function sd(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[d,c]=useState(e),[p,n]=useState(t),[m,l]=useState(null),[i,u]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(0),[k,N]=useState(0),[h,E]=useState(null),[C,F]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:N,hoveredSegmentIndex:h,setHoveredSegmentIndex:E,isHovered:C,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,ee)=>{r("none"),l(null),u(null),c(G),n(ee),N(0),x(null),g(0);}}}function Yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=sd(t,r),x=useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:N,ghostX:h,setGhostX:E,ghostWidth:C,setGhostWidth:F,connectionLine:T,setConnectionLine:$,hoveredTaskId:W,setHoveredTaskId:L,activeZone:G,setActiveZone:ee,draggedSegmentIndex:he,setDraggedSegmentIndex:ye,draggedSegmentStartX:Me,setDraggedSegmentStartX:V,segmentDragOffsetX:B,setSegmentDragOffsetX:I,hoveredSegmentIndex:R,setHoveredSegmentIndex:M,isHovered:Y,setIsHovered:K,isDragging:q,isResizing:Ee,isConnecting:we,resetDragState:Ue}=y,P=32,te=8,fe=e.endDate&&e.endDate<new Date&&e.progress<100,Ie=e.isCriticalPath,Oe=o.name==="neutral"||o.today==="#1C1917",Ke=e.status==="completed"||e.progress===100,ot={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||fe?"#DC2626":e.color?e.color:e.priority&&ot[e.priority]?ot[e.priority]:o.taskBarPrimary,Je=(ae=>ae>=80?20:ae>=60?15:ae>=50?12:10)(r),Ye=r<50,it=r<40;useEffect(()=>{if(f)if(Y&&!q&&!e.segments){let ae=a<100;f({task:e,x:t,y:a,width:r,height:P,showBelow:ae});}else f(null);},[Y,q,e,t,a,r,P,f]);let $t=ae=>ae.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),xe=()=>{let ae=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ae} day${ae!==1?"s":""}`},O=ae=>Math.round(ae/s)*s,Ce=ae=>{let De=Math.round(ae/s),me=new Date(d);return me.setDate(me.getDate()+De),me},Ve=(ae,De)=>{for(let me of u){if(me.id===e.id)continue;let Te=5;if(ae>=me.x-Te&&ae<=me.x+me.width+Te&&De>=me.y-Te&&De<=me.y+me.height+Te)return me.id}return null},He=useCallback((ae,De,me)=>{ae.preventDefault(),ae.stopPropagation();let Te=x.current?.ownerSVGElement;if(!Te)return;let ue=Te.createSVGPoint();ue.x=ae.clientX,ue.y=ae.clientY;let Ae=ue.matrixTransform(Te.getScreenCTM()?.inverse()),ce=me!==void 0?me:t,Le=De;if(!Le){let U=Ae.x-ce;ae.shiftKey?(Le="connect",$({x:t+r,y:a+P/2})):ae.ctrlKey||ae.metaKey?Le="move":ae.altKey?Le=U<r/2?"resize-start":"resize-end":it?U<r/2?Le="move":Le="resize-end":Ye?U<=Je/2?Le="resize-start":U>=r-Je/2?Le="resize-end":Le="move":U<=Je?Le="resize-start":U>=r-Je?Le="resize-end":Le="move";}g(Le),K(false),ee(null),Le==="move"?N(Ae.x-ce):Le==="connect"?$({x:t+r,y:a+P/2}):N(0),E(ce),F(r);},[t,r,a,P]),xt=useCallback(ae=>{if(b==="none")return;let De=x.current?.ownerSVGElement;if(!De)return;let me=De.createSVGPoint();me.x=ae.clientX,me.y=ae.clientY;let Te=me.matrixTransform(De.getScreenCTM()?.inverse());if(b==="connect"){$({x:Te.x,y:Te.y});let ue=Ve(Te.x,Te.y);L(ue);}else if(b==="move"){let ue=Te.x-k,Ae=O(ue);E(Ae),F(r);let ce=Math.round((Ae-t)/s);if(v?.(e.id,ce,true),e.segments&&e.segments.length>0&&he!==null){let Le=Ae-Me;I(Le);}}else if(b==="resize-start"){let ue=Te.x,Ae=O(ue),ce=t+r-Ae;ce>=s&&(E(Ae),F(ce));}else if(b==="resize-end"){let ue=Te.x,ce=O(ue)-t;ce>=s&&F(ce);}},[b,t,r,s,k,e,O,he,Me,Ve,L,$,E,F,I,v]),J=useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),$(null),L(null);else {let ae=e.endDate.getTime()-e.startDate.getTime(),De,me,Te=true;if(b==="move"){if(De=Ce(h),me=new Date(De.getTime()+ae),e.segments&&e.segments.length>0&&he!==null){let ue=Math.round(B/s),Ae=e.segments.map((D,X)=>{if(X===he){let pe=new Date(D.startDate),Ne=new Date(D.endDate);return pe.setDate(pe.getDate()+ue),Ne.setDate(Ne.getDate()+ue),{startDate:pe,endDate:Ne}}return D}),ce=Ae.flatMap(D=>[D.startDate,D.endDate]),Le=new Date(Math.min(...ce.map(D=>D.getTime()))),U=new Date(Math.max(...ce.map(D=>D.getTime())));l?.({...e,segments:Ae},Le,U),Ue(t,r);return}}else b==="resize-start"?(De=Ce(h),me=e.endDate,De>=me&&(console.warn("Invalid date range: start date must be before end date"),Te=false)):b==="resize-end"?(De=e.startDate,me=Ce(h+C),me<=De&&(console.warn("Invalid date range: end date must be after start date"),Te=false)):Te=false;Te&&De&&me&&(me.getTime()-De.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,De,me));}v?.(e.id,0,false),Ue(t,r);}},[b,h,C,e,l,W,i,t,r,s,Ce,B,he,Ue,v]);useEffect(()=>{if(b==="none")return;let ae=me=>{xt(me);},De=()=>{J();};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",De);}},[b,xt,J]);let Q=q&&!we?h:t,ke=q&&!we?C:r,ge=c.taskClass(e);return jsxs("g",{ref:x,onMouseEnter:()=>!q&&K(true),onMouseLeave:()=>{q||(K(false),ee(null));},onClick:()=>!q&&p?.(e),onDoubleClick:ae=>{q||(ae.stopPropagation(),n?.(e));},onContextMenu:ae=>{ae.preventDefault(),m?.(e,ae);},children:[Y&&!q&&!Ye&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Je,height:P,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-start"),onMouseDown:ae=>He(ae,"resize-start")}),jsx("rect",{x:t+Je,y:a,width:r-Je*2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r-Je,y:a,width:Je,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")})]}),Y&&!q&&it&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")}),Y&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+P-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!we&&!e.segments&&jsx(motion.rect,{x:h,y:a,width:C,height:P,rx:te,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&&jsx(motion.rect,{x:Q,y:a,width:ke,height:P,rx:te,fill:St,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:q&&!we?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ae=>He(ae),style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Q,y:a,width:ke*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ae,De)=>{let me=(ae.startDate.getTime()-d.getTime())/864e5*s,ue=(ae.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-me+s,Ae=q&&b==="move"&&he===De,ce=R===De,Le=Ae?me+B:me;return jsxs("g",{onMouseEnter:()=>!q&&M(De),onMouseLeave:()=>!q&&M(null),children:[jsx(motion.rect,{x:Le,y:a,width:ue,height:P,rx:te,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:ce?.9:.8,scale:ce&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),ye(De),V(me),He(U,void 0,me);},style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Le,y:a,width:ue*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),Oe&&(fe||Ie)&&!e.segments&&jsxs(Fragment,{children:[Ie&&!fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ke>60&&!e.segments&&(()=>{let ae=c.taskLabel(e),De=typeof ae=="string"?ae:e.name,me=De.length>Math.floor(ke/8)?`${De.substring(0,Math.floor(ke/8))}...`:De;return jsx("text",{x:Q+12,y:a+P/2,dominantBaseline:"middle",fill:Ke?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ke?"line-through":"none"},children:me})})(),ke>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxs("text",{x:Q+ke-12,y:a+P/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&&ke>80&&!q&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Y||Ee)&&!we&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Ye?Q-15:Q-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q-8:Q-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Q+ke-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q+ke:Q+ke-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+P/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ae=>{ae.stopPropagation(),He(ae,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+P/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),we&&T&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+P/2,x2:T.x,y2:T.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:T.x,cy:T.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsx(motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Y||q)&&!we&&!e.segments&&jsx(motion.rect,{x:Q-2,y:a-2,width:ke+4,height:P+4,rx:te+2,fill:"none",stroke:q?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:q?.6:.4,initial:{opacity:0},animate:{opacity:q?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ee&&jsxs(Fragment,{children:[jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:h+C,y1:0,x2:h+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&!f&&(()=>{let me=a<100,Te=me?a+P+13:a-82-13,ue=me?`M ${Q+ke/2-6} ${a+P+3} L ${Q+ke/2} ${a+P+13} L ${Q+ke/2+6} ${a+P+3}`:`M ${Q+ke/2-6} ${a-13} L ${Q+ke/2} ${a-3} L ${Q+ke/2+6} ${a-13}`,Ae=Te+22,ce=Te+40,Le=Te+55,U=Te+70,D=me?Te+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:me?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:me?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ue,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Q+ke/2-120,y:Te,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))"}),jsx("text",{x:Q+ke/2,y:Ae,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}),jsx("text",{x:Q+ke/2-110,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Q+ke/2-70,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsx("text",{x:Q+ke/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Q+ke/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsx("text",{x:Q+ke/2+10,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Q+ke/2+65,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xe()}),jsx("text",{x:Q+ke/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Q+ke/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Q+ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Q+ke/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(X=>X.name).join(", ").substring(0,30),e.assignees.map(X=>X.name).join(", ").length>30?"...":""]})]}),!me&&jsx("text",{x:Q+ke/2,y:D,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:it?"Left: move \u2022 Right: resize":Ye?"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 dd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,p=82,n=13,m=c?o+d+n:o-p-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,f=m+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{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 jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:i,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}),jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:f,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 Jo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,p]=useState(false),n=a-e,m=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]);let k=!s&&!d;return jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d:i,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeDasharray:"6 4",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?.9:.35,strokeWidth:c?2:1.5,strokeDasharray:c?"0 0":"6 4"},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2},strokeDasharray:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?.9:.35,scale:c?1.1:1,strokeWidth:c?2:1.5},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:2.5,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.4:1,opacity:c&&d?0:c?.9:.35},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!d&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:N=>{N.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Qo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[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))"}),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}),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})`}),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}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),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 se={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=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,p=n=>{if(!d.has(n)){d.add(n),c.add(n);let m=r.get(n)||[];for(let l of m){if(!d.has(l)&&p(l))return true;if(c.has(l))return true}}return c.delete(n),false};return p(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=se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=se.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=se.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(`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ns({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),d=useRef(null);useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let l=m.category||"Other";return n[l]||(n[l]=[]),n[l].push(m),n},{});return jsxs("div",{className:w("relative inline-block",a),children:[jsxs("button",{ref:d,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:w("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&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:[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:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([n,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsx("div",{children:m.map(l=>jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function is({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=useState("export"),[p,n]=useState("json"),[m,l]=useState(null),i=useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Ii(e,p,f);Li(y,p);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Ri(y),b=y.name.endsWith(".json")?"json":"csv",g=Bi(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),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"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[d==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxs("button",{onClick:()=>n(f),className:w("p-4 rounded-lg border-2 transition-all text-center",p===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),d==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>i.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:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var au=["URGENT","HIGH","MEDIUM","LOW"],ru=[{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"}],ou=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ls({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=useState(true),x=useCallback(h=>{a({search:h.target.value});},[a]),b=useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=useCallback(h=>{r({by:h.target.value});},[r]),k=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&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)"]})]}),!f&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let E=h.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),au.map(h=>jsx("option",{value:h,children:h},h))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let E=h.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(h=>jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let E=h.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsx("option",{value:h,children:h},h))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:ru.map(h=>jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ou.map(h=>jsx("option",{value:h.value,children:h.label},h.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ds({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=useState(false),l=useRef(null);useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxs("div",{className:w("relative",r),ref:l,children:[jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),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"})]}),jsx("span",{children:"Config"})]}),n&&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"?jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),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"]}),jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var cs={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"}},ps={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"}},ms={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"}},gr={dark:cs,light:ps,neutral:ms},Uo="dark";var Wo=createContext(void 0),gu="asakaa-theme";function Fl({children:e,defaultTheme:t=Uo,storageKey:a=gu}){let[r,o]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=gr[r];Object.entries(p.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${fu(m)}`,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(([m,l])=>{let i=p.colors[m];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:gr};return jsx(Wo.Provider,{value:d,children:e})}function Br(){let e=useContext(Wo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function fu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function us({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Br();return e?jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),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"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(gr).map(([s,d])=>jsxs("button",{onClick:()=>{o(s),t();},className:w("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:[jsx("div",{className:"text-3xl",children:d.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),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&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var _e={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function Bl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return _e[e]||_e.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",_e[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",_e[e].bgSecondary),bgGrid:r("--theme-bg-card",_e[e].bgGrid),bgWeekend:r("--theme-bg-hover",_e[e].bgWeekend),border:r("--theme-border-primary",_e[e].border),borderLight:r("--theme-border-subtle",_e[e].borderLight),textPrimary:r("--theme-text-primary",_e[e].textPrimary),textSecondary:r("--theme-text-secondary",_e[e].textSecondary),textTertiary:r("--theme-text-tertiary",_e[e].textTertiary),accent:r("--theme-accent-primary",_e[e].accent),accentHover:r("--theme-accent-hover",_e[e].accentHover),accentLight:r("--theme-accent-primary",_e[e].accentLight),taskBarPrimary:r("--theme-accent-primary",_e[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",_e[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",_e[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",_e[e].dependency),dependencyHover:r("--theme-border-secondary",_e[e].dependencyHover),criticalPath:r("--theme-error",_e[e].criticalPath),criticalPathLight:r("--theme-error",_e[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",_e[e].today):e==="neutral"?r("--theme-text-primary",_e[e].today):r("--theme-error",_e[e].today),todayLight:e==="light"?r("--theme-accent-primary",_e[e].todayLight):e==="neutral"?r("--theme-text-primary",_e[e].todayLight):r("--theme-error",_e[e].todayLight),milestone:r("--theme-warning",_e[e].milestone),milestoneLight:r("--theme-warning",_e[e].milestoneLight),statusTodo:r("--theme-text-tertiary",_e[e].statusTodo),statusInProgress:r("--theme-accent-primary",_e[e].statusInProgress),statusCompleted:r("--theme-success",_e[e].statusCompleted),hoverBg:r("--theme-bg-hover",_e[e].hoverBg),focusRing:r("--theme-accent-primary",_e[e].focusRing)}}var Go={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Rl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},gs={en:Go,es:Rl};function Ol(e){return gs[e]||gs.en}function fs(e,t){let a=Ol(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 Or=createContext(Go);function oo(){return useContext(Or)}function Iu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,p]=useState(false),[n,m]=useState(null),l=useRef(null),i=oo();if(useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){m(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{m(null),p(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:i.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:c&&jsx(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:jsx("div",{className:"py-1",children:v.map((y,x)=>jsxs(motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Lu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let d=t===s.value;return jsxs(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:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&jsx(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&&jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Fu({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(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:[jsx("span",{children:o.label}),s&&jsx(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 Bu({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),d=oo();useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(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:`${d.toolbar.density||"Density"}: ${p}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(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:jsx("div",{className:"py-1",children:c.map((n,m)=>{let l=t===n.value;return jsxs(motion.button,{onClick:()=>{a(n.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:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ho({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=oo(),k=u||v||f||y||x||b,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Fu,{options:N,value:t,onChange:E=>a(E),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(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:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),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),"%"]}),jsx(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:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bu,{theme:e,value:c,onChange:p})]}),jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:i,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:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:l||g.toolbar.createTask})]}),(k||n)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Iu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsx(Lu,{options:h,value:s,onChange:E=>d(E),theme:e})]})]})}function _o({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,d]=useState({x:0,y:0}),c=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();d({x:m.left,y:m.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:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Qe,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[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"}),n.map(m=>jsxs("button",{onClick:()=>{t(m.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:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function $r({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=useRef(null),[c,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),p({x:f,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(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,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(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:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var gt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Xl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:i=true}){let u=useRef(false),v=useCallback(g=>{u.current=g;},[]),f=useCallback(g=>{let k=[],N=h=>{for(let E of h)k.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&N(E.subtasks);};return N(g),k},[]),y=useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),x=useCallback((g,k)=>{let N=f(e);if(N.length===0)return;let h=y();if(!h){a(N[0].id,false);return}let E=N.findIndex(T=>T.id===h.id);if(E===-1)return;let C=g==="up"?E-1:E+1;if(C<0||C>=N.length)return;let F=N[C];a(F.id,k);},[e,y,f,a]),b=useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){g.key==="Escape"&&(k.blur(),u.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),F=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(F&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!F.isExpanded||g.key==="ArrowLeft"&&F.isExpanded)&&m(F.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),d(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"above"));return}if(g.key==="Enter"&&E){F&&(g.preventDefault(),l(F.id));return}if(g.key==="F2"){F&&(g.preventDefault(),n(F.id));return}if(g.key==="Delete"||g.key==="Backspace"&&E){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&E&&!g.shiftKey){C.length>0&&(g.preventDefault(),s(C));return}},[i,t,y,x,r,o,s,d,c,p,n,m,l]);return useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Zl(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),p=useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function zr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Ql(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ql(a.subtasks,t);if(r)return r}}return null}function ys(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ys(a.subtasks,t);if(r)return r}return null}function vs(e,t){if(t.length===0)return e;let a=zr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function xs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ys(a,r);if(!o)continue;let s=ys(a,o.id),d=(n,m,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,m,l);if(v)return v}}return null},c=(n,m,l)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,m,l);return n},p=d(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function ks(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=d.length?false:([d[n],d[m]]=[d[m],d[n]],true)};return s(r,o,a),r}function ws(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 Cs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(m=>m.id===r);if(c===-1){for(let m of d)if(m.subtasks&&o(m.subtasks))return true;return false}let p=d[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function ed(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(l=>l.id===t);if(n===-1){for(let l of p)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,d),true};return c(r),{tasks:r,newTask:d}}function Ts(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ts(r.subtasks,t,a)}:r)}function Ds(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ds(a.subtasks,t)}:a)}function Ns(e,t){let a=m=>{for(let l of m){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,p],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:p}}function td(e,t,a,r){if(t===a)return e;let o=Ql(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],l=r!==void 0?r:m.length,i=[...m];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Ko({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:N,onOpenTaskModal:h,onDeleteRequest:E,onTaskReparent:C}){let F=useContext(Or),[T,$]=useState(null),[W,L]=useState(false),[G,ee]=useState(null),[he,ye]=useState(""),Me=useRef(null),V=useRef(null),[B,I]=useState(null),[R,M]=useState(0),[Y,K]=useState(0),[q,Ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Ue]=useState(null),[P,te]=useState(null),[fe,Ie]=useState(null),Oe=useRef(0),Ke=5,ot=useRef(false),[Se,St]=useState(null),[Ze,Je]=useState(false),[Ye,it]=useState(null);useEffect(()=>{function U(D){Me.current&&!Me.current.contains(D.target)&&L(false);}if(W)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[W]),useEffect(()=>{G&&V.current&&(V.current.focus(),V.current.select());},[G]),useEffect(()=>{if(!B)return;let U=X=>{let pe=X.clientX-R,Ne=Y+pe;i?.(B,Ne);},D=()=>{I(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",D),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",D),document.body.style.cursor="",document.body.style.userSelect="";}},[B,R,Y,i]);let{selectedTaskIds:$t,handleTaskClick:xe,isTaskSelected:O}=Zl(),{setIsEditing:Ce}=Xl({tasks:e,selectedTaskIds:$t,onTaskSelect:(U,D)=>{let pe=zr(e).map(Ne=>Ne.id);xe(U,pe,D||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:U=>{let D=zr(e).find(X=>X.id===U);D&&Q(D);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:U=>{let D=zr(e).find(X=>X.id===U);D&&h&&h(D);},enableKeyboard:true}),Ve=(U,D=0)=>{let X=[];for(let pe of U)X.push({task:pe,level:D}),pe.subtasks&&pe.subtasks.length>0&&pe.isExpanded&&X.push(...Ve(pe.subtasks,D+1));return X},He=Ve(e),xt=48,J=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Q=U=>{ee(U.id),ye(U.name),Ce(true);},ke=U=>{he.trim()&&he!==e.find(D=>D.id===U)?.name&&k?.(U,he.trim()),ee(null),ye(""),Ce(false);},ge=()=>{ee(null),ye(""),Ce(false);},ae=(U,D)=>{D.stopPropagation(),N?.(U.id);},De=(U,D)=>{D.preventDefault(),Oe.current=D.clientY,Ue(U),ot.current=false,Je(false),St({x:D.clientX,y:D.clientY});},me=U=>{if(!we||(Math.abs(U.clientY-Oe.current)>Ke&&!ot.current&&(ot.current=true,Je(true)),St({x:U.clientX,y:U.clientY}),!ot.current))return;let X=document.querySelectorAll("[data-task-row]"),pe=null,Ne=null;X.forEach(At=>{let Et=At.getBoundingClientRect(),It=At.getAttribute("data-task-row");if(It&&It!==we&&U.clientY>=Et.top&&U.clientY<=Et.bottom){pe=It;let Jt=U.clientY-Et.top,bt=Et.height;Jt<bt*.25?Ne="above":Jt>bt*.75?Ne="below":Ne="child";}}),te(pe),Ie(Ne);},Te=()=>{if(ot.current&&we&&P&&fe){if(fe==="child")C?.(we,P);else if(fe==="above"||fe==="below"){let U=(pe,Ne,At=null)=>{for(let Et of pe){if(Et.id===Ne)return At;if(Et.subtasks){let It=U(Et.subtasks,Ne,Et.id);if(It!==void 0)return It}}},D=U(e,P,null),X=(pe,Ne)=>{let At=pe.findIndex(Et=>Et.id===Ne);return fe==="below"?At+1:At};if(D===null){let pe=X(e,P);C?.(we,null,pe);}else {let pe=He.find(Ne=>Ne.task.id===D)?.task;if(pe?.subtasks){let Ne=X(pe.subtasks,P);C?.(we,D,Ne);}}}}Ue(null),te(null),Ie(null),St(null),ot.current=false,Je(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",me),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[we,P,fe]);let ue=(U,D,X)=>{switch(U.id){case "name":let pe=G===D.id,Ne=T===D.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${X*20}px`},children:[C&&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:Ne?1:.3},onMouseDown:ie=>De(D.id,ie),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),D.subtasks&&D.subtasks.length>0?jsx("button",{onClick:ie=>{ie.stopPropagation(),p?.(D.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:D.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(D.subtasks&&D.subtasks.length>0)&&jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:D.color||"#3B82F6",opacity:D.parentId?.6:1,borderColor:D.isMilestone?t.accent:"transparent",borderWidth:D.isMilestone?"2px":"0px"},title:D.isMilestone?"Milestone":D.parentId?"Subtask":"Task"}),pe?jsx("input",{ref:V,type:"text",value:he,onChange:ie=>ye(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ke(D.id):ie.key==="Escape"&&ge();},onBlur:()=>ke(D.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:ie=>ie.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:D.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:D.parentId?"13px":"14px",fontWeight:D.isMilestone?600:D.parentId?400:600,letterSpacing:D.parentId?"0":"-0.01em"},title:D.name,children:D.name}),Ne&&!pe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsx("button",{onClick:ie=>ae(D,ie),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:ie=>{ie.stopPropagation(),Q(D);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Et=U.id==="startDate"?"startDate":"endDate",It=D[Et],Jt=Ye?.taskId===D.id&&Ye?.field===Et,bt=ie=>ie?(typeof ie=="string"?new Date(ie):ie).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ie=>ie.stopPropagation(),children:[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:ie=>{if(Jt)it(null);else {let ht=ie.currentTarget.getBoundingClientRect();it({taskId:D.id,field:Et,month:It?typeof It=="string"?new Date(It):It:new Date,position:{top:ht.bottom+4,left:ht.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:bt(It)})]}),Jt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>it(null)}),jsxs(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:Ye?.position.top,left:Ye?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,ht=new Date(ie);ht.setDate(ie.getDate()+1);let Yt=new Date(ie);Yt.setDate(ie.getDate()+7);let Va=new Date(ie);return Va.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:ht},{label:"Pr\xF3xima semana",date:Yt},{label:"2 semanas",date:Va}].map((Nr,Ba)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ja=>ja.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ja=>ja.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:Nr.date}),it(null);},children:Nr.label},Ba))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:void 0}),it(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ye?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ie,ht)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},ht))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ye?.month||new Date,ht=ie.getFullYear(),Yt=ie.getMonth(),Va=new Date(ht,Yt,1).getDay(),wo=new Date(ht,Yt+1,0).getDate(),Nr=new Date,Ba=[];for(let kt=Va-1;kt>=0;kt--)Ba.push({day:new Date(ht,Yt,-kt).getDate(),date:new Date(ht,Yt-1,new Date(ht,Yt,-kt).getDate()),isCurrentMonth:false});for(let kt=1;kt<=wo;kt++)Ba.push({day:kt,date:new Date(ht,Yt,kt),isCurrentMonth:true});let ja=42-Ba.length;for(let kt=1;kt<=ja;kt++)Ba.push({day:kt,date:new Date(ht,Yt+1,kt),isCurrentMonth:false});return Ba.map((kt,Co)=>{let To=kt.date.toDateString()===Nr.toDateString(),Vr=(It?typeof It=="string"?new Date(It):It:null)?.toDateString()===kt.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:kt.isCurrentMonth?Vr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Vr?"#3B82F6":"transparent",boxShadow:To&&!Vr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(D.id,{[Et]:kt.date}),it(null);},children:kt.day},Co)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:J(D)})});case "assignees":let Dr=r.filter(ie=>D.assignees?.some(ht=>ht.name===ie.name||ht.initials===ie.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(cr,{assignedUsers:Dr,availableUsers:r,onChange:ie=>{let ht=ie.map(Yt=>({id:Yt.id,name:Yt.name,initials:Yt.initials,color:Yt.color}));u?.(D.id,{assignees:ht.length>0?ht:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(tl,{status:D.status||"todo",onChange:ie=>{u?.(D.id,{status:ie,progress:ie==="completed"?100:D.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${D.progress}%`,backgroundColor:D.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[D.progress,"%"]})]});case "priority":let or={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},_a={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},nr=or[D.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(lr,{priority:nr,onChange:ie=>{ie&&u?.(D.id,{priority:_a[ie]||"medium"});}})});default:return null}},Ae=U=>[{id:"hide",label:"Hide Column",icon:gt.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:gt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:gt.SortDesc,onClick:()=>{}}],ce=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:gt.Pencil,onClick:()=>{d?.(U);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:F?.contextMenu?.markIncomplete||"Mark Incomplete",icon:gt.MarkIncomplete,onClick:()=>{u?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:F?.contextMenu?.setInProgress||"Set In Progress",icon:gt.SetInProgress,onClick:()=>{u?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:F?.contextMenu?.markComplete||"Mark Complete",icon:gt.MarkComplete,onClick:()=>{u?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:gt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}],Le=m.filter(U=>U.visible);return jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${xt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Le.map((U,D)=>{let X=D===Le.length-1,pe=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${pe?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(pe?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:X?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ne=>{Ne.preventDefault(),Ee({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"header",columnId:U.id});},onMouseEnter:Ne=>{Ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ne=>{Ne.currentTarget.style.backgroundColor="transparent";},children:[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:pe?"70px":"0"},title:U.label,children:U.label}),pe&&jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsx(_o,{columns:m,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>L(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})})]}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),I(U.id),M(Ne.clientX),K(U.width);},title:"Drag to resize column",children: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"}})})]},U.id)}),W&&jsxs("div",{ref:Me,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:U=>U.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>L(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",children:He.map(({task:U,level:D},X)=>{let pe=O(U.id),Ne=P===U.id,At=Ne&&fe==="above",Et=Ne&&fe==="below",It=Ne&&fe==="child",Jt={};return It&&(Jt.backgroundColor=`${t.accent}15`,Jt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${we===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe?t.accentLight:It?`${t.accent}15`:X%2===0?t.bgPrimary:t.bgGrid,...Jt},onMouseEnter:()=>$(U.id),onMouseLeave:()=>$(null),onClick:bt=>{let or=zr(e).map(ie=>ie.id),nr=navigator.platform.toUpperCase().indexOf("MAC")>=0?bt.metaKey:bt.ctrlKey;xe(U.id,or,nr,bt.shiftKey),s?.(U);},onDoubleClick:bt=>{bt.stopPropagation(),d?.(U);},onContextMenu:bt=>{bt.preventDefault(),Ee({isOpen:true,x:bt.clientX,y:bt.clientY,type:"task",task:U}),c?.(U,bt);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:[At&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Et&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((bt,Dr)=>{let or=Dr===Le.length-1,_a=bt.id==="name";return jsx("div",{className:`px-4 flex items-center ${_a?"justify-start":"justify-center"}`,style:{width:`${bt.width}px`,minWidth:`${bt.minWidth??(_a?200:60)}px`,maxWidth:`${bt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:or?"none":`1px solid ${T===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ue(bt,U,_a?D:0)},`${U.id}-${bt.id}`)})]},U.id)})}),jsx($r,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ae(q.columnId):q.type==="task"&&q.task?ce(q.task):[],onClose:()=>Ee({...q,isOpen:false}),theme:t}),Ze&&Se&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Se.x+12,top:Se.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=He.find(D=>D.task.id===we)?.task;return U?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:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:U.name})}):null})()}),document.body)]})}function sd(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[d,c]=useState(e),[p,n]=useState(t),[m,l]=useState(null),[i,u]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(0),[k,N]=useState(0),[h,E]=useState(null),[C,F]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:N,hoveredSegmentIndex:h,setHoveredSegmentIndex:E,isHovered:C,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,ee)=>{r("none"),l(null),u(null),c(G),n(ee),N(0),x(null),g(0);}}}function Yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=sd(t,r),x=useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:N,ghostX:h,setGhostX:E,ghostWidth:C,setGhostWidth:F,connectionLine:T,setConnectionLine:$,hoveredTaskId:W,setHoveredTaskId:L,activeZone:G,setActiveZone:ee,draggedSegmentIndex:he,setDraggedSegmentIndex:ye,draggedSegmentStartX:Me,setDraggedSegmentStartX:V,segmentDragOffsetX:B,setSegmentDragOffsetX:I,hoveredSegmentIndex:R,setHoveredSegmentIndex:M,isHovered:Y,setIsHovered:K,isDragging:q,isResizing:Ee,isConnecting:we,resetDragState:Ue}=y,P=32,te=8,fe=e.endDate&&e.endDate<new Date&&e.progress<100,Ie=e.isCriticalPath,Oe=o.name==="neutral"||o.today==="#1C1917",Ke=e.status==="completed"||e.progress===100,ot={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||fe?"#DC2626":e.color?e.color:e.priority&&ot[e.priority]?ot[e.priority]:o.taskBarPrimary,Je=(ae=>ae>=80?20:ae>=60?15:ae>=50?12:10)(r),Ye=r<50,it=r<40;useEffect(()=>{if(f)if(Y&&!q&&!e.segments){let ae=a<100;f({task:e,x:t,y:a,width:r,height:P,showBelow:ae});}else f(null);},[Y,q,e,t,a,r,P,f]);let $t=ae=>ae.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),xe=()=>{let ae=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ae} day${ae!==1?"s":""}`},O=ae=>Math.round(ae/s)*s,Ce=ae=>{let De=Math.round(ae/s),me=new Date(d);return me.setDate(me.getDate()+De),me},Ve=(ae,De)=>{for(let me of u){if(me.id===e.id)continue;let Te=5;if(ae>=me.x-Te&&ae<=me.x+me.width+Te&&De>=me.y-Te&&De<=me.y+me.height+Te)return me.id}return null},He=useCallback((ae,De,me)=>{ae.preventDefault(),ae.stopPropagation();let Te=x.current?.ownerSVGElement;if(!Te)return;let ue=Te.createSVGPoint();ue.x=ae.clientX,ue.y=ae.clientY;let Ae=ue.matrixTransform(Te.getScreenCTM()?.inverse()),ce=me!==void 0?me:t,Le=De;if(!Le){let U=Ae.x-ce;ae.shiftKey?(Le="connect",$({x:t+r,y:a+P/2})):ae.ctrlKey||ae.metaKey?Le="move":ae.altKey?Le=U<r/2?"resize-start":"resize-end":it?U<r/2?Le="move":Le="resize-end":Ye?U<=Je/2?Le="resize-start":U>=r-Je/2?Le="resize-end":Le="move":U<=Je?Le="resize-start":U>=r-Je?Le="resize-end":Le="move";}g(Le),K(false),ee(null),Le==="move"?N(Ae.x-ce):Le==="connect"?$({x:t+r,y:a+P/2}):N(0),E(ce),F(r);},[t,r,a,P]),xt=useCallback(ae=>{if(b==="none")return;let De=x.current?.ownerSVGElement;if(!De)return;let me=De.createSVGPoint();me.x=ae.clientX,me.y=ae.clientY;let Te=me.matrixTransform(De.getScreenCTM()?.inverse());if(b==="connect"){$({x:Te.x,y:Te.y});let ue=Ve(Te.x,Te.y);L(ue);}else if(b==="move"){let ue=Te.x-k,Ae=O(ue);E(Ae),F(r);let ce=Math.round((Ae-t)/s);if(v?.(e.id,ce,true),e.segments&&e.segments.length>0&&he!==null){let Le=Ae-Me;I(Le);}}else if(b==="resize-start"){let ue=Te.x,Ae=O(ue),ce=t+r-Ae;ce>=s&&(E(Ae),F(ce));}else if(b==="resize-end"){let ue=Te.x,ce=O(ue)-t;ce>=s&&F(ce);}},[b,t,r,s,k,e,O,he,Me,Ve,L,$,E,F,I,v]),J=useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),$(null),L(null);else {let ae=e.endDate.getTime()-e.startDate.getTime(),De,me,Te=true;if(b==="move"){if(De=Ce(h),me=new Date(De.getTime()+ae),e.segments&&e.segments.length>0&&he!==null){let ue=Math.round(B/s),Ae=e.segments.map((D,X)=>{if(X===he){let pe=new Date(D.startDate),Ne=new Date(D.endDate);return pe.setDate(pe.getDate()+ue),Ne.setDate(Ne.getDate()+ue),{startDate:pe,endDate:Ne}}return D}),ce=Ae.flatMap(D=>[D.startDate,D.endDate]),Le=new Date(Math.min(...ce.map(D=>D.getTime()))),U=new Date(Math.max(...ce.map(D=>D.getTime())));l?.({...e,segments:Ae},Le,U),Ue(t,r);return}}else b==="resize-start"?(De=Ce(h),me=e.endDate,De>=me&&(console.warn("Invalid date range: start date must be before end date"),Te=false)):b==="resize-end"?(De=e.startDate,me=Ce(h+C),me<=De&&(console.warn("Invalid date range: end date must be after start date"),Te=false)):Te=false;Te&&De&&me&&(me.getTime()-De.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,De,me));}v?.(e.id,0,false),Ue(t,r);}},[b,h,C,e,l,W,i,t,r,s,Ce,B,he,Ue,v]);useEffect(()=>{if(b==="none")return;let ae=me=>{xt(me);},De=()=>{J();};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",De);}},[b,xt,J]);let Q=q&&!we?h:t,ke=q&&!we?C:r,ge=c.taskClass(e);return jsxs("g",{ref:x,onMouseEnter:()=>!q&&K(true),onMouseLeave:()=>{q||(K(false),ee(null));},onClick:()=>!q&&p?.(e),onDoubleClick:ae=>{q||(ae.stopPropagation(),n?.(e));},onContextMenu:ae=>{ae.preventDefault(),m?.(e,ae);},children:[Y&&!q&&!Ye&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Je,height:P,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-start"),onMouseDown:ae=>He(ae,"resize-start")}),jsx("rect",{x:t+Je,y:a,width:r-Je*2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r-Je,y:a,width:Je,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")})]}),Y&&!q&&it&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")}),Y&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+P-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!we&&!e.segments&&jsx(motion.rect,{x:h,y:a,width:C,height:P,rx:te,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&&jsx(motion.rect,{x:Q,y:a,width:ke,height:P,rx:te,fill:St,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:q&&!we?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ae=>He(ae),style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Q,y:a,width:ke*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ae,De)=>{let me=(ae.startDate.getTime()-d.getTime())/864e5*s,ue=(ae.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-me+s,Ae=q&&b==="move"&&he===De,ce=R===De,Le=Ae?me+B:me;return jsxs("g",{onMouseEnter:()=>!q&&M(De),onMouseLeave:()=>!q&&M(null),children:[jsx(motion.rect,{x:Le,y:a,width:ue,height:P,rx:te,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:ce?.9:.8,scale:ce&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),ye(De),V(me),He(U,void 0,me);},style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Le,y:a,width:ue*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),Oe&&(fe||Ie)&&!e.segments&&jsxs(Fragment,{children:[Ie&&!fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ke>60&&!e.segments&&(()=>{let ae=c.taskLabel(e),De=typeof ae=="string"?ae:e.name,me=De.length>Math.floor(ke/8)?`${De.substring(0,Math.floor(ke/8))}...`:De;return jsx("text",{x:Q+12,y:a+P/2,dominantBaseline:"middle",fill:Ke?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ke?"line-through":"none"},children:me})})(),ke>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxs("text",{x:Q+ke-12,y:a+P/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&&ke>80&&!q&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Y||Ee)&&!we&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Ye?Q-15:Q-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q-8:Q-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Q+ke-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q+ke:Q+ke-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+P/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ae=>{ae.stopPropagation(),He(ae,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+P/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),we&&T&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+P/2,x2:T.x,y2:T.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:T.x,cy:T.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsx(motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Y||q)&&!we&&!e.segments&&jsx(motion.rect,{x:Q-2,y:a-2,width:ke+4,height:P+4,rx:te+2,fill:"none",stroke:q?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:q?.6:.4,initial:{opacity:0},animate:{opacity:q?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ee&&jsxs(Fragment,{children:[jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:h+C,y1:0,x2:h+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&!f&&(()=>{let me=a<100,Te=me?a+P+13:a-82-13,ue=me?`M ${Q+ke/2-6} ${a+P+3} L ${Q+ke/2} ${a+P+13} L ${Q+ke/2+6} ${a+P+3}`:`M ${Q+ke/2-6} ${a-13} L ${Q+ke/2} ${a-3} L ${Q+ke/2+6} ${a-13}`,Ae=Te+22,ce=Te+40,Le=Te+55,U=Te+70,D=me?Te+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:me?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:me?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ue,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Q+ke/2-120,y:Te,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))"}),jsx("text",{x:Q+ke/2,y:Ae,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}),jsx("text",{x:Q+ke/2-110,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Q+ke/2-70,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsx("text",{x:Q+ke/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Q+ke/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsx("text",{x:Q+ke/2+10,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Q+ke/2+65,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xe()}),jsx("text",{x:Q+ke/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Q+ke/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Q+ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Q+ke/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(X=>X.name).join(", ").substring(0,30),e.assignees.map(X=>X.name).join(", ").length>30?"...":""]})]}),!me&&jsx("text",{x:Q+ke/2,y:D,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:it?"Left: move \u2022 Right: resize":Ye?"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 dd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,p=82,n=13,m=c?o+d+n:o-p-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,f=m+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{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 jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:i,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}),jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:f,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 Jo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,p]=useState(false),n=a-e,m=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]);let k=!s&&!d;return jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d:i,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeDasharray:"6 4",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?.9:.55,strokeWidth:c?2:1.5,strokeDasharray:c?"0 0":"6 4"},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2},strokeDasharray:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?.9:.55,scale:c?1.1:1,strokeWidth:c?2:1.5},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:2.5,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.4:1,opacity:c&&d?0:c?.9:.55},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!d&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:N=>{N.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Qo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[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))"}),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}),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})`}),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}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),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 se={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=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,p=n=>{if(!d.has(n)){d.add(n),c.add(n);let m=r.get(n)||[];for(let l of m){if(!d.has(l)&&p(l))return true;if(c.has(l))return true}}return c.delete(n),false};return p(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=se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=se.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=se.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(`
46
46
  `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=se.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=se.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)=>se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=se.findTaskById(e,t);return !a||!a.dependencies?[]:se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>se.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=se.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=>se.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=se.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 d=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?se.formatDate(p.startDate):"N/A",p.endDate?se.formatDate(p.endDate):"N/A",n>0?`${n} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:d,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=se.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?se.formatDate(p.startDate):"","End Date":p.endDate?se.formatDate(p.endDate):"","Duration (days)":n>0?n:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(m=>m.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),d=[{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"]=d;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=se.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),d=se.getEarliestStartDate(e)||new Date,c=se.getLatestEndDate(e)||new Date,p=r.map((i,u)=>{let v=o.get(i.id),f=i.startDate&&i.endDate?se.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${o.get(x)}</PredecessorUID>