@libxai/board 1.9.21 → 1.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -122,7 +122,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function $c({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"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"})})]}),a&&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(l).map(([i,d])=>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:i})}),jsx("div",{children:d.map(m=>jsxs("button",{onClick:()=>c(m),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),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 Hc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=useState("export"),[l,i]=useState("json"),[d,m]=useState(null),u=useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,y=await Au(e,l,x);Iu(y,l);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await $u(y),h=y.name.endsWith(".json")?"json":"csv",v=Bu(b,h);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxs("div",{className:g("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:r}),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:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="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(x=>jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:p,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),d&&jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Mx=["URGENT","HIGH","MEDIUM","LOW"],Px=[{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"}],Fx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,y]=useState(true),b=useCallback(M=>{r({search:M.target.value});},[r]),h=useCallback(M=>{r({dateFilter:M.target.value});},[r]),v=useCallback(M=>{a({by:M.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),C=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 ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children: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"}),C&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[m&&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"}),o&&jsx("button",{onClick:o,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:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,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:M=>{let F=M.target.value;r({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Mx.map(M=>jsx("option",{value:M,children:M},M))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let F=M.target.value;r({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),l.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let F=M.target.value;r({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsx("option",{value:M,children:M},M))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:Px.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:p,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=useState(false),m=useRef(null);useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxs("div",{className:g("relative",a),ref:m,children:[jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,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"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>u(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 zc={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:"#00E5CC",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"}},Gc={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:"#00E5CC",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"}},Vc={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"}},So={dark:zc,light:Gc,neutral:Vc},Vi="dark";var ji=createContext(void 0),Wx="asakaa-theme";function dm({children:e,defaultTheme:t=Vi,storageKey:r=Wx}){let[a,n]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=So[a];Object.entries(l.colors).forEach(([d,m])=>{m&&c.style.setProperty(`--theme-${zx(d)}`,m);}),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(([d,m])=>{let u=l.colors[d];u&&c.style.setProperty(m,u);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:So};return jsx(ji.Provider,{value:o,children:e})}function es(){let e=useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function jc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=es();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),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(So).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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"]})]}),a===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 ct={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},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:"#78716C",dependencyHover:"#A8A29E",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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function um(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},pm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},_c={en:_i,es:pm};function mm(e){return _c[e]||_c.en}function Kc(e,t){let r=mm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var rs=createContext(_i);function qa(){return useContext(rs)}function Gs(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function km({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=useState(false),[i,d]=useState(null),m=useRef(null),u=useRef(null),p=qa(),f=Gs(m,c,"right",176);if(useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{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:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{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:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] 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:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:u,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:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function fm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=useState(false),[l,i]=useState(null),[d,m]=useState(false),u=useRef(null),p=useRef(null),f=qa(),x=Gs(u,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=M=>{let F=M.target;u.current&&!u.current.contains(F)&&p.current&&!p.current.contains(F)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,M)=>{if(M){i(C);try{await M();}catch(F){console.error(`Export ${C} failed:`,F);}finally{i(null),c(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>c(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:p,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((C,M)=>jsxs(motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:l===C.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function dv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function uv({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function bm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),c=useRef(null),l=qa(),i=Gs(o,n,"left");useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&c.current&&!c.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:c,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxs(motion.button,{onClick:()=>{r(u.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:p<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function hm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),c=useRef(null),l=useRef(null),i=qa(),d=Gs(c,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),l._cleanup&&l._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:c,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:l,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,y=()=>f.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function pv({value:e,onChange:t,theme:r}){let a=qa(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function mv({theme:e,forecast:t}){let r=qa(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace"},children:c})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function gv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=useState(false),f=useRef(null),x=useRef(null),y=qa(),b=Gs(f,u,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!u)return;let M=F=>{let k=F.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&p(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:c,onChange:l}],C=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:u&&jsxs(motion.div,{ref:x,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,F)=>{let k=M.icon,N=M.disabled,P=M.tooltip;return jsxs(motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?h?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((M,F)=>{let k=i===M.value;return jsxs(motion.button,{onClick:()=>d(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:M,projectForecast:F,hideForecastHud:k,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportCSV:K,onExportJSON:H,onExportMSProject:ee,showCriticalPath:A=true,onShowCriticalPathChange:Ee,showDependencies:O=true,onShowDependenciesChange:U,highlightWeekends:R=true,onHighlightWeekendsChange:Ae,showBaseline:Je=false,onShowBaselineChange:$e,onCopySnapshotLink:J,hasDependencies:De=true}){let oe=qa(),Ue=N||P||D||K||H||ee,Ne=!!e.glassToolbar,Me=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],Re=[{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"})}],Qe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ne){let ie=Qe?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:M&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Qe?"#000000":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>M("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>M("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Qe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(pv,{value:t,onChange:r,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),jsx(gv,{theme:e,showCriticalPath:A,onShowCriticalPathChange:Ee,showBaseline:Je,onShowBaselineChange:$e,highlightWeekends:R,onHighlightWeekendsChange:Ae,showDependencies:O,onShowDependenciesChange:U,rowDensity:c,onRowDensityChange:l,hasDependencies:De}),jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),d&&u&&jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Qe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||oe.toolbar.createTask})]})]})]}),F&&!k&&jsx(mv,{theme:e,forecast:F})]})}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(uv,{options:Me,value:t,onChange:ie=>r(ie),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:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||oe.toolbar.createTask})]}),(Ue||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(dv,{options:Re,value:s,onChange:ie=>o(ie),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!a)return;let d=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(nr,{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:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:d.label}),d.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function os({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[c,l]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,y=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(y=f-m-u,y<u&&(y=u)),l({x,y});},[e,t,r,a.length]),useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d: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:o,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:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.map(d=>jsxs("div",{children:[d.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={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"}),Duplicate:jsx(Copy,{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 Mm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=useRef(false),f=useCallback(v=>{p.current=v;},[]),x=useCallback(v=>{let w=[],C=M=>{for(let F of M)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&C(F.subtasks);};return C(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let M=y();if(!M){r(C[0].id,false);return}let F=C.findIndex(P=>P.id===M.id);if(F===-1)return;let k=v==="up"?F-1:F+1;if(k<0||k>=C.length)return;let N=C[k];r(N.id,w);},[e,y,x,r]),h=useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),N=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(N&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!N.isExpanded||v.key==="ArrowLeft"&&N.isExpanded)&&d(N.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"above"));return}if(v.key==="Enter"&&F){N&&(v.preventDefault(),m(N.id));return}if(v.key==="F2"){N&&(v.preventDefault(),i(N.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&F&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[u,t,y,b,a,n,s,o,c,l,i,d,m]);return useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:f}}function Fm(e){let[t,r]=useState(new Set),[a,n]=useState(null);useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=useCallback(u=>{r(new Set([u])),n(u);},[]),o=useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),c=useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let y=Math.min(f,x),b=Math.max(f,x),h=p.slice(y,b+1);r(new Set(h)),n(u);},[a,s]),l=useCallback((u,p,f,x)=>{x?c(u,p):f?o(u):s(u);},[s,o,c]),i=useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=useCallback(()=>{r(new Set),n(null);},[]),m=useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:c,handleTaskClick:l,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function Qc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Qc(t.subtasks):t.subtasks}))}function Mo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ss(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ss(r.subtasks,t);if(a)return a}}return null}function Jc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Jc(r.subtasks,t);if(a)return a}return null}function Zc(e,t){if(t.length===0)return e;let r=Mo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(y=>{if(p.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,p);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},c=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,f)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),m=c(i,s.id,d);return Qc(m)}function ed(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Jc(r,a);if(!n)continue;let s=Jc(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},c=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&c(p.subtasks,d,m);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Qc(r)}function td(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(m=>m.id===c);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function rd(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=l=>{let i=l.findIndex(p=>p.id===n);if(i===-1){for(let p of l)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=l[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return l.splice(i+1,0,u),u},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Lm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},c=l=>{let i=l.findIndex(m=>m.id===t);if(i===-1){for(let m of l)if(m.subtasks&&c(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function ad(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ad(a.subtasks,t,r)}:a)}function nd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:nd(r.subtasks,t)}:r)}function od(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=l(p.subtasks);if(f>=0)return f}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Am(e,t,r,a){if(t===r)return e;let n=ss(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ya(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ya(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:c,onTaskDblClick:l,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:y,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:M,onTaskRename:F,onCreateSubtask:k,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:D,allTasks:K,scrollContainerRef:H,showCriticalPath:ee=false}){let A=useContext(rs),[Ee,O]=useState(null),[U,R]=useState(null),[Ae,Je]=useState(""),$e=useRef(null),[J,De]=useState(null),[oe,Ue]=useState(0),[Ne,Me]=useState(0),[Re,Qe]=useState({isOpen:false,x:0,y:0,type:"header"}),[ie,et]=useState(null),[Ve,Oe]=useState(null),[ut,pt]=useState(null),Ge=useRef(0),Pe=5,ot=useRef(false),[$t,Be]=useState(null),[st,L]=useState(false),X=useRef(null),[B,Y]=useState(null),[re,he]=useState(null),[qe,j]=useState(false),ye=useRef(null);useEffect(()=>{function ce(ue){ye.current&&!ye.current.contains(ue.target)&&j(false);}if(qe)return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[qe]),useEffect(()=>{U&&$e.current&&($e.current.focus(),$e.current.select());},[U]),useEffect(()=>{if(!J)return;let ce=mt=>{let V=mt.clientX-oe,fe=Ne+V;f?.(J,fe);},ue=()=>{De(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ce),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[J,oe,Ne,f]);let{selectedTaskIds:Fe,handleTaskClick:Ie,isTaskSelected:Ct}=Fm(c),{setIsEditing:Ze}=Mm({tasks:e,selectedTaskIds:Fe,onTaskSelect:(ce,ue)=>{let V=Mo(e).map(fe=>fe.id);Ie(ce,V,ue||false,false),o?.(ce);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&_r(ue);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&N&&N(ue);},enableKeyboard:true}),Tt=(ce,ue=0,mt="")=>{let V=[],fe=[...ce].sort((Q,$)=>(Q.position??0)-($.position??0));for(let Q=0;Q<fe.length;Q++){let $=fe[Q],te=Q+1,xe=mt?`${mt}.${te}`:`${te}.0`,T=$.wbsCode||xe;if($.wbsCode=T,V.push({task:$,level:ue}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(mt?`${mt}.${te}`:`${te}`);V.push(...Tt($.subtasks,ue+1,pe));}}return V},ft=Tt(e),zt=48,rr=Math.max(ft.length*r,600-zt),da=(ce,ue)=>ue==="assignees"?ce.assignees:ue==="startDate"?ce.startDate:ce.endDate,Vt=(ce,ue,mt,V)=>{ce.preventDefault(),ce.stopPropagation(),Y({sourceTaskId:ue,column:mt,sourceIndex:V,targetIndex:V}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=ce.currentTarget.closest("[data-grid-body]"),Q=ve=>{let it=fe?.getBoundingClientRect().top??0,ae=Math.floor((ve-it)/r);return ae=Math.max(0,Math.min(ft.length-1,ae)),ae<V&&(ae=V),ae},$=ce.clientY,te=H?.current??null,xe=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},T=()=>{let ve=Q($);Y(it=>it&&{...it,targetIndex:ve});},W=()=>{if(xe(),!te)return;let ve=te.getBoundingClientRect(),it=60,ae=12,lt=$-ve.top,bt=ve.bottom-$;if(bt<it&&te.scrollTop<te.scrollHeight-te.clientHeight){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,bt)/it))),br=()=>{te.scrollTop+=Mt,T(),te.scrollTop<te.scrollHeight-te.clientHeight&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}else if(lt<it&&te.scrollTop>0){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,lt)/it))),br=()=>{te.scrollTop-=Mt,T(),te.scrollTop>0&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}},pe=ve=>{$=ve.clientY,T(),W();},_=ve=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",_),xe(),document.body.style.cursor="",document.body.style.userSelect="",Y(null);let it=Q(ve.clientY),ae=ft.find(ha=>ha.task.id===ue)?.task;if(!ae)return;let lt=da(ae,mt),bt=Math.min(V,it),Mt=Math.max(V,it),br=[];for(let ha=bt;ha<=Mt;ha++){if(ha===V)continue;let Mr=ft[ha]?.task;!Mr||Mr.subtasks&&Mr.subtasks.length>0||br.push(Mr.id);}br.length!==0&&y?.(br,mt,lt);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",_);},gr=ce=>{if(!B)return false;let ue=Math.min(B.sourceIndex,B.targetIndex),mt=Math.max(B.sourceIndex,B.targetIndex);return ce>=ue&&ce<=mt},Bt=ce=>!ce.startDate||!ce.endDate?"-":`${Math.ceil((ce.endDate.getTime()-ce.startDate.getTime())/(1e3*60*60*24))}d`,_r=ce=>{R(ce.id),Je(ce.name),Ze(true);},jt=ce=>{Ae.trim()&&Ae!==e.find(ue=>ue.id===ce)?.name&&F?.(ce,Ae.trim()),R(null),Je(""),Ze(false);},Qt=()=>{R(null),Je(""),Ze(false);},zr=(ce,ue)=>{ue.stopPropagation(),k?.(ce.id);},ua=(ce,ue)=>{ue.preventDefault(),Ge.current=ue.clientY,et(ce),ot.current=false,L(false),Be({x:ue.clientX,y:ue.clientY});},rt=ce=>{if(!ie||(Math.abs(ce.clientY-Ge.current)>Pe&&!ot.current&&(ot.current=true,L(true)),Be({x:ce.clientX,y:ce.clientY}),!ot.current))return;if(H?.current){let Q=H.current,$=Q.getBoundingClientRect(),te=60,xe=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let T=ce.clientY-$.top,W=$.bottom-ce.clientY;if(T<te&&Q.scrollTop>0){let pe=Math.round(xe*(1-T/te)),_=()=>{Q.scrollTop-=pe,ot.current&&Q.scrollTop>0&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}else if(W<te&&Q.scrollTop<Q.scrollHeight-Q.clientHeight){let pe=Math.round(xe*(1-W/te)),_=()=>{Q.scrollTop+=pe,ot.current&&Q.scrollTop<Q.scrollHeight-Q.clientHeight&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}}let mt=document.querySelectorAll("[data-task-row]"),V=null,fe=null;mt.forEach(Q=>{let $=Q.getBoundingClientRect(),te=Q.getAttribute("data-task-row");if(te&&te!==ie&&ce.clientY>=$.top&&ce.clientY<=$.bottom){V=te;let xe=ce.clientY-$.top,T=$.height;xe<T*.25?fe="above":xe>T*.75?fe="below":fe="child";}}),Oe(V),pt(fe);},Ke=()=>{if(ot.current&&ie&&Ve&&ut){if(ut==="child")D?.(ie,Ve);else if(ut==="above"||ut==="below"){let ce=(Q,$,te=null)=>{for(let xe of Q){if(xe.id===$)return te;if(xe.subtasks){let T=ce(xe.subtasks,$,xe.id);if(T!==void 0)return T}}},ue=K&&K.length>0?K:e,mt=ce(ue,ie,null),V=ce(ue,Ve,null),fe=(Q,$,te,xe)=>{let T=Q.findIndex(_=>_.id===$),W=xe?Q.findIndex(_=>_.id===te):-1,pe=ut==="below"?T+1:T;return xe&&W!==-1&&W<T&&(pe-=1),Math.max(0,pe)};if(V===null){let $=fe(ue,Ve,ie,mt===null);D?.(ie,null,$);}else {let Q=ss(ue,V);if(Q?.subtasks){let $=mt===V,te=fe(Q.subtasks,Ve,ie,$);D?.(ie,V,te);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),et(null),Oe(null),pt(null),Be(null),ot.current=false,L(false);};useEffect(()=>{if(ie)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ve,ut]);let ba=(ce,ue,mt)=>{let V=ue.subtasks&&ue.subtasks.length>0;switch(ce.id){case "name":let fe=U===ue.id,Q=Ee===ue.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${mt*20}px`},children:[D&&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:Q?1:.3},onMouseDown:ae=>ua(ue.id,ae),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsx("button",{onClick:ae=>{ae.stopPropagation(),d?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.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"}),fe?jsx("input",{ref:$e,type:"text",value:Ae,onChange:ae=>Je(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?jt(ue.id):ae.key==="Escape"&&Qt();},onBlur:()=>jt(ue.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:ae=>ae.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),ee&&ue.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ee&&ue.cpmData&&jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),Q&&!fe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ae=>ae.stopPropagation(),children:[jsx("button",{onClick:ae=>zr(ue,ae),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:ae=>{ae.stopPropagation(),_r(ue);},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 te=ce.id==="startDate"?"startDate":"endDate",xe=ue[te],T=re?.taskId===ue.id&&re?.field===te,W=ae=>ae?(typeof ae=="string"?new Date(ae):ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ae=>ae.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,opacity:V?.5:1,cursor:V?"default":"pointer"},title:V?"Auto-calculated from subtasks":void 0,onClick:ae=>{if(!V)if(T)he(null);else {let lt=ae.currentTarget.getBoundingClientRect();he({taskId:ue.id,field:te,month:xe?typeof xe=="string"?new Date(xe):xe:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(xe)}),V&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),T&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(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:re?.position.top,left:re?.position.left},onClick:ae=>ae.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ae=new Date,lt=new Date(ae);lt.setDate(ae.getDate()+1);let bt=new Date(ae);bt.setDate(ae.getDate()+7);let Mt=new Date(ae);return Mt.setDate(ae.getDate()+14),[{label:"Hoy",date:ae},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Mt}].map((ha,Mr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:tn=>tn.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:tn=>tn.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:ha.date}),he(null);},children:ha.label},Mr))})(),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:ae=>ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:void 0}),he(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:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.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:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.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((ae,lt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ae},lt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=re?.month||new Date,lt=ae.getFullYear(),bt=ae.getMonth(),Mt=new Date(lt,bt,1).getDay(),br=new Date(lt,bt+1,0).getDate(),ha=new Date,Mr=[];for(let lr=Mt-1;lr>=0;lr--)Mr.push({day:new Date(lt,bt,-lr).getDate(),date:new Date(lt,bt-1,new Date(lt,bt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=br;lr++)Mr.push({day:lr,date:new Date(lt,bt,lr),isCurrentMonth:true});let tn=42-Mr.length;for(let lr=1;lr<=tn;lr++)Mr.push({day:lr,date:new Date(lt,bt+1,lr),isCurrentMonth:false});return Mr.map((lr,Ra)=>{let Ho=lr.date.toDateString()===ha.toDateString(),_n=(xe?typeof xe=="string"?new Date(xe):xe:null)?.toDateString()===lr.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:lr.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:Ho&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(ue.id,{[te]:lr.date}),he(null);},children:lr.day},Ra)})})()})]})]})]}),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:Bt(ue)})});case "assignees":if(V)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let pe=a.filter(ae=>ue.assignees?.some(lt=>lt.id?lt.id===ae.id:lt.name===ae.name||lt.initials===ae.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(ko,{assignedUsers:pe,availableUsers:a,onChange:ae=>{let lt=ae.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));x?.(ue.id,{assignees:lt});}})});case "status":if(V){let ae=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ae})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(rp,{status:ue.status||"todo",onChange:ae=>{x?.(ue.id,{status:ae,progress:ae==="completed"?100:ue.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:V?.6:1},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:`${ue.progress}%`,backgroundColor:ue.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:[ue.progress,"%"]})]});case "priority":let _={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ve={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},it=_[ue.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(vo,{priority:it,onChange:ae=>{ae&&x?.(ue.id,{priority:ve[ae]||"medium"});}})});default:return null}},ir=ce=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(ce),disabled:ce==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],Qr=ce=>{let ue=ce.subtasks&&ce.subtasks.length>0,mt=Mo(e),V=Fe.size>1&&Fe.has(ce.id),fe=V?mt.filter(T=>Fe.has(T.id)):[ce],Q=fe.map(T=>T.id),$=fe.filter(T=>!(T.subtasks&&T.subtasks.length>0)),te=V?` (${Q.length})`:"",xe=()=>{P?P(Q,ce.name):w?.(Q);};return ue?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{l?.(ce);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(A?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:tr.MarkIncomplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(T=>T.status==="todo")},{id:"setInProgress",label:(A?.contextMenu?.setInProgress||"Set In Progress")+te,icon:tr.SetInProgress,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"in-progress"}));},disabled:$.length===0||$.every(T=>T.status==="in-progress")},{id:"markComplete",label:(A?.contextMenu?.markComplete||"Mark Complete")+te,icon:tr.MarkComplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(T=>T.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]},fr=u.filter(ce=>ce.visible),Ca=fr.reduce((ce,ue)=>ce+ue.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ca},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${zt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:fr.map((ce,ue)=>{let mt=ue===fr.length-1,V=ce.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${V?"":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(V?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:V&&fr.length===1?1:0,flexGrow:V&&fr.length===1?1:0,borderRight:mt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Qe({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:ce.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.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:"0"},title:ce.label,children:ce.label}),ce.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===ce.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),De(ce.id),Ue(fe.clientX),Me(ce.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===ce.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ce.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(qi,{columns:u,onToggleColumn:p,theme:t}),jsx("button",{onClick:()=>j(!qe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),qe&&jsxs("div",{ref:ye,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:ce=>ce.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:()=>j(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","data-grid-body":true,style:{minHeight:rr},children:ft.map(({task:ce,level:ue},mt)=>{let V=Ct(ce.id),fe=gr(mt),Q=Ve===ce.id,$=Q&&ut==="above",te=Q&&ut==="below",xe=Q&&ut==="child",T={};return xe&&(T.backgroundColor=`${t.accent}15`,T.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ce.id,className:`flex items-center cursor-pointer group ${ie===ce.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:V?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:V?t.accentLight:xe?`${t.accent}15`:mt%2===0?t.bgPrimary:t.bgGrid,opacity:ee?ce.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...T},onMouseEnter:()=>O(ce.id),onMouseLeave:()=>O(null),onClick:W=>{let _=Mo(e).map(ae=>ae.id),it=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;Ie(ce.id,_,it,W.shiftKey),o?.(ce.id),!it&&!W.shiftKey&&s?.(ce);},onDoubleClick:W=>{W.stopPropagation(),l?.(ce);},onContextMenu:W=>{W.preventDefault(),Qe({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:ce}),i?.(ce,W);},whileHover:{backgroundColor:V?t.accentLight:t.hoverBg},children:[$&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),fr.map((W,pe)=>{let _=pe===fr.length-1,ve=W.id==="name",it=!!(ce.subtasks&&ce.subtasks.length>0),ae=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!ae&&!it&&Ee===ce.id&&!B,Mt=fe&&!!B&&B.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${ve?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(ve?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:ve&&fr.length===1?1:0,flexGrow:ve&&fr.length===1?1:0,borderRight:_?"none":`1px solid ${Ee===ce.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Mt?`${t.accent}22`:void 0,boxShadow:Mt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ba(W,ce,ve?ue:0),bt&&ae&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:br=>Vt(br,ce.id,ae,mt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ce.id}-${W.id}`)})]},ce.id)})}),jsx(os,{isOpen:Re.isOpen,x:Re.x,y:Re.y,items:Re.type==="header"&&Re.columnId?ir(Re.columnId):Re.type==="task"&&Re.task?Qr(Re.task):[],onClose:()=>Qe({...Re,isOpen:false}),theme:t}),st&&$t&&ie&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:$t.x+12,top:$t.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=ft.find(ue=>ue.task.id===ie)?.task;return ce?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:ce.name})}):null})()}),document.body)]})}function Om(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,c]=useState(e),[l,i]=useState(t),[d,m]=useState(null),[u,p]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,C]=useState(0),[M,F]=useState(null),[k,N]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:M,setHoveredSegmentIndex:F,isHovered:k,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ee,A)=>{a("none"),m(null),p(null),c(ee),i(A),C(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let C=Om(t,a),M=useRef(null),F=useRef(false),k=useRef(null),N=useRef(null),{dragMode:P,setDragMode:D,dragOffset:K,setDragOffset:H,ghostX:ee,setGhostX:A,ghostWidth:Ee,setGhostWidth:O,connectionLine:U,setConnectionLine:R,hoveredTaskId:Ae,setHoveredTaskId:Je,activeZone:$e,setActiveZone:J,draggedSegmentIndex:De,setDraggedSegmentIndex:oe,draggedSegmentStartX:Ue,setDraggedSegmentStartX:Ne,segmentDragOffsetX:Me,setSegmentDragOffsetX:Re,hoveredSegmentIndex:Qe,setHoveredSegmentIndex:ie,isHovered:et,setIsHovered:Ve,isDragging:Oe,isResizing:ut,isConnecting:pt,resetDragState:Ge}=C,Pe=18,ot=!!n.executionBarBg,$t=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Be=ot?3:6,st=e.subtasks&&e.subtasks.length>0,L=useRef(null),[X,B]=(()=>{let V=useRef(null),[,fe]=useState(0);return [V.current,Q=>{V.current=Q,fe($=>$+1);}]})(),Y=!!w&&!v&&!st&&!e.segments&&!!e.startDate&&!!e.endDate,re=e.endDate&&(()=>{let V=new Date;V.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<V})()&&e.progress<100,he=h&&e.isCriticalPath,qe=n.name==="neutral"||n.today==="#1C1917",j=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ie=h&&e.isCriticalPath||re?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:n.taskBarPrimary,Ct=v?"default":Oe?pt?"crosshair":ut?"ew-resize":"grabbing":"grab",Ze=v?"default":"ew-resize",ft=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),zt=a<50,rr=a<40;useEffect(()=>{x&&(!et||Oe||e.segments)&&x(null);},[et,Oe,e.segments,x]);let da=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Vt=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},gr=V=>Math.round(V/s)*s,Bt=V=>{let fe=Math.round(V/s),Q=new Date(o);return Q.setDate(Q.getDate()+fe),Q},_r=(V,fe)=>{for(let Q of p){if(Q.id===e.id)continue;let $=5;if(V>=Q.x-$&&V<=Q.x+Q.width+$&&fe>=Q.y-$&&fe<=Q.y+Q.height+$)return Q.id}return null},jt=useCallback((V,fe,Q)=>{if(v)return;V.preventDefault(),V.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let te=$.createSVGPoint();te.x=V.clientX,te.y=V.clientY;let xe=te.matrixTransform($.getScreenCTM()?.inverse()),T=Q!==void 0?Q:t,W=fe;if(!W){let pe=xe.x-T;V.shiftKey?(W="connect",R({x:t+a,y:r+Pe/2})):V.ctrlKey||V.metaKey?W="move":V.altKey?W=pe<a/2?"resize-start":"resize-end":rr?pe<a/2?W="move":W="resize-end":zt?pe<=ft/2?W="resize-start":pe>=a-ft/2?W="resize-end":W="move":pe<=ft?W="resize-start":pe>=a-ft?W="resize-end":W="move";}F.current=false,D(W),Ve(false),J(null),W==="move"?H(xe.x-T):W==="connect"?R({x:t+a,y:r+Pe/2}):H(0),A(T),O(a);},[t,a,r,Pe,v]),Qt=useCallback(V=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let Q=fe.closest(".gantt-timeline-scroll");if(!Q)return;let $=Q.getBoundingClientRect(),te=60,xe=15,T=0;if(V.clientX<$.left+te){let W=$.left+te-V.clientX;T=-Math.min(xe,W/2);}else if(V.clientX>$.right-te){let W=V.clientX-($.right-te);T=Math.min(xe,W/2);}return T!==0&&(Q.scrollLeft+=T),T!==0},[]),zr=useCallback(V=>{if(P==="none")return;F.current=true,N.current=V;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let te=Qt(V);te&&!k.current?k.current=window.setInterval(()=>{N.current&&(Qt(N.current),zr(N.current));},16):!te&&k.current&&(window.clearInterval(k.current),k.current=null);}let Q=fe.createSVGPoint();Q.x=V.clientX,Q.y=V.clientY;let $=Q.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){R({x:$.x,y:$.y});let te=_r($.x,$.y);Je(te);}else if(P==="move"){let te=$.x-K,xe=gr(te);A(xe),O(a);let T=Math.round((xe-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&De!==null){let W=xe-Ue;Re(W);}}else if(P==="resize-start"){let te=$.x,xe=gr(te),T=t+a-xe;T>=s&&(A(xe),O(T));}else if(P==="resize-end"){let te=$.x,T=gr(te)-t;T>=s&&O(T);}},[P,t,a,s,K,e,gr,De,Ue,_r,Je,R,A,O,Re,f,Qt]),ua=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),N.current=null,P!=="none"){if(P==="connect")Ae&&u&&u(e,Ae),R(null),Je(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),fe,Q,$=true;if(P==="move"){if(fe=Bt(ee),Q=new Date(fe.getTime()+V),e.segments&&e.segments.length>0&&De!==null){let te=Math.round(Me/s),xe=e.segments.map((_,ve)=>{if(ve===De){let it=new Date(_.startDate),ae=new Date(_.endDate);return it.setDate(it.getDate()+te),ae.setDate(ae.getDate()+te),{startDate:it,endDate:ae}}return _}),T=xe.flatMap(_=>[_.startDate,_.endDate]),W=new Date(Math.min(...T.map(_=>_.getTime()))),pe=new Date(Math.max(...T.map(_=>_.getTime())));m?.({...e,segments:xe},W,pe),Ge(t,a);return}}else P==="resize-start"?(fe=Bt(ee),Q=e.endDate,fe>Q&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(fe=e.startDate,Q=Bt(ee+Ee),Q.setDate(Q.getDate()-1),Q<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&Q&&(Q.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,Q));}f?.(e.id,0,false),Ge(t,a);}},[P,ee,Ee,e,m,Ae,u,t,a,s,Bt,Me,De,Ge,f]);useEffect(()=>{if(P==="none")return;let V=Q=>{zr(Q);},fe=()=>{ua();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",fe),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,zr,ua]);let rt=Oe&&!pt?ee:t,Ke=Oe&&!pt?Ee:a,ba=c.taskClass(e),ir=24,Qr=h?e.isCriticalPath?1:.25:1,fr=useCallback(V=>{if(!Y)return;V.stopPropagation(),V.preventDefault();let Q=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:Q,initialPct:e.progress||0},V.currentTarget.setPointerCapture(V.pointerId),B(e.progress||0);},[Y,e.progress,B]),Ca=useCallback(V=>{let fe=L.current;if(!fe)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let te=(V.clientX-$.left)/$.width,xe=Math.round(Math.max(0,Math.min(1,te))*100);V.shiftKey&&(xe=Math.round(xe/25)*25),B(xe);},[B]),ce=useCallback(V=>{let fe=L.current;if(!fe)return;V.stopPropagation(),V.preventDefault();try{V.currentTarget.releasePointerCapture(V.pointerId);}catch{}let Q=X;L.current=null,B(null),Q!=null&&Q!==fe.initialPct&&w&&w(e,Q);},[X,w,e,B]),ue=useCallback(V=>{V.stopPropagation(),V.preventDefault();},[]),mt=X??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:Qr,transition:"opacity 300ms ease"},onClick:()=>{!Oe&&!F.current&&l?.(e),F.current=false;},onDoubleClick:V=>{!Oe&&!F.current&&(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),d?.(e,V);},onMouseEnter:()=>!Oe&&Ve(true),onMouseMove:V=>{x&&et&&!Oe&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Pe,showBelow:false,mouseX:V.clientX,mouseY:V.clientY});},onMouseLeave:()=>{Oe||(Ve(false),J(null));},children:[jsx("rect",{x:t,y:r,width:a+ir,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),et&&!Oe&&!zt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:ft,height:Pe,fill:$e==="resize-start"?n.accent:"transparent",opacity:$e==="resize-start"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:V=>jt(V,"resize-start")}),jsx("rect",{x:t+ft,y:r,width:a-ft*2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsx("rect",{x:t+a-ft,y:r,width:ft,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")})]}),et&&!Oe&&rr&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.2:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")}),et&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Pe-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Oe&&!pt&&!e.segments&&jsx(motion.rect,{x:ee,y:r,width:Ee,height:Pe,rx:Be,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Oe&&(()=>{let V=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),Q=o.getTime(),$=864e5,te=(V-Q)/$,xe=(fe-V)/$,T=te*s,W=Math.max(xe*s,s),pe=rt+Ke,_=T+W,ve=e.endDate?.getTime()??0,it=Math.ceil((ve-fe)/$),ae=it>0,lt=it<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:T,y:r,width:W,height:Pe,rx:Be,fill:"none",stroke:$t?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ae&&pe>_&&jsx("rect",{x:_,y:r,width:pe-_,height:Pe,rx:0,fill:"#EF4444",opacity:.2}),ae&&jsxs("text",{x:Math.max(pe,_)+6,y:r+Pe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",it,"d"]}),lt&&jsxs("text",{x:pe+6,y:r+Pe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[it,"d"]})]})})(),!e.segments&&ot&&st&&(()=>{let fe=r+(Pe-8)/2,Q=4,$=e.progress||0,te=new Date;te.setHours(0,0,0,0);let xe=e.startDate&&te>=e.startDate,T=e.endDate&&(()=>{let ae=new Date(e.endDate);return ae.setHours(0,0,0,0),te>ae})(),W=e.startDate&&te<e.startDate,pe=1;if(xe&&e.startDate&&e.endDate&&!W){let ae=new Date(e.startDate);ae.setHours(0,0,0,0);let lt=new Date(e.endDate);lt.setHours(0,0,0,0);let bt=Math.max(1,(lt.getTime()-ae.getTime())/(1e3*60*60*24)),br=Math.min((te.getTime()-ae.getTime())/(1e3*60*60*24),bt)/bt*100;pe=br>0?$/br:1;}let _;$>=100?_="#00E5CC":W?_="#4B5563":T&&$<100?_="#EF4444":pe>=.95?_="#22C55E":pe>=.8?_="#F59E0B":_="#EF4444";let ve=Math.max($/100*Ke,$>0?Q*2:0),it=Ke>100&&$>0;return jsxs("g",{"data-task-class":ba,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:rt,y:fe,width:Ke,height:8,rx:Q,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:rt,y:fe,width:ve,height:8,rx:Q,fill:_}),it&&jsxs("text",{x:rt+ve+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round($),"%"]})]})})(),!e.segments&&ot&&!st&&jsx(motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ba,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:1,scale:et&&!Oe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>jt(V),style:{cursor:Ct,pointerEvents:"all"}}),!e.segments&&!ot&&jsx(motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:Ie,"data-task-class":ba,initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:et?.9:.8,scale:et&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st?void 0:V=>jt(V),style:{cursor:st?"default":Ct,pointerEvents:"all"}}),ot&&(re||he)&&!e.segments&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&mt>0&&!st&&jsx("rect",{x:rt,y:r,width:Math.max(Ke*(mt/100),Be*2),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!st&&e.progress<100&&(()=>{let V=e.progress>0?Ke*(e.progress/100):0,fe=rt+V,Q=Ke-V,$=e.progress===0?Be:0,te=e.progress===0?rt:fe,xe=e.progress===0?Ke:Q;return jsxs(Fragment,{children:[jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"none",stroke:Ie,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ot&&!e.segments&&e.progress>0&&e.progress<100&&!st&&!Oe&&X===null&&(()=>{let V=rt+Ke*(e.progress/100),fe=8,Q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:V,cy:r+Pe/2,r:fe,fill:Q?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:V,y:r+Pe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Q?.initials||Q?.name?.charAt(0)?.toUpperCase()||""})]})})(),Y&&!Oe&&Ke>=40&&(X!==null||mt<88)&&(()=>{let V=rt+Ke*(mt/100),fe=r+Pe/2,Q=X!==null,$=Q?7:et?6:5,te=Q||et?1:.35,xe=rt+Ke-V,T=Math.max(4,Math.min(12,xe-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:V-W,y:fe-12,width:W+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:fr,onPointerMove:Ca,onPointerUp:ce,onPointerCancel:ce,onClick:ue,onDoubleClick:ue,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{cx:V,cy:fe,r:$,fill:"#FFFFFF",stroke:Ie,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:Q?`drop-shadow(0 0 4px ${Ie})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Q&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:V-20,y:fe-28,width:40,height:18,rx:4,fill:$t?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ie,strokeWidth:1}),jsxs("text",{x:V,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:$t?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((V,fe)=>{let Q=(V.startDate.getTime()-o.getTime())/864e5*s,te=(V.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Q+s,xe=Oe&&P==="move"&&De===fe,T=Qe===fe,W=xe?Q+Me:Q;return jsxs("g",{onMouseEnter:()=>!Oe&&ie(fe),onMouseLeave:()=>!Oe&&ie(null),children:[jsx(motion.rect,{x:W,y:r,width:te,height:Pe,rx:Be,fill:Ie,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:T?.9:.8,scale:T&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),oe(fe),Ne(Q),jt(pe,void 0,Q);},style:{cursor:Ct,pointerEvents:"all"}}),jsx("rect",{x:W,y:r,width:te*(e.progress/100),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),qe&&(re||he)&&!e.segments&&jsxs(Fragment,{children:[he&&!re&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),re&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ke>60&&!e.segments&&!(ot&&st)&&(()=>{let V=c.taskLabel(e),fe=typeof V=="string"?V:e.name,Q=fe.length>Math.floor(Ke/8)?`${fe.substring(0,Math.floor(Ke/8))}...`:fe;return jsx("text",{x:rt+8,y:r+Pe/2,dominantBaseline:"middle",fill:j?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:j?"line-through":"none"},children:Q})})(),!Oe&&!e.segments&&!st&&e.progress>0&&e.progress<100&&(ot?jsxs("text",{x:rt+Ke+6,y:r+Pe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ke>100?jsxs("text",{x:rt+Ke-12,y:r+Pe/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,"%"]}):null),e.status&&Ke>80&&!Oe&&!e.segments&&!(ot&&st)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(et||ut)&&!pt&&!e.segments&&!st&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:rt-2,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-start"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-start");}}),jsx(motion.rect,{x:rt+4,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:rt+Ke-14,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-end"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-end");}}),jsx(motion.rect,{x:rt+Ke-7,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:et&&!Oe&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>J("connect"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Pe/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:$e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&U&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Pe/2,x2:U.x,y2:U.y,stroke:Ae?n.statusCompleted:n.accent,strokeWidth:Ae?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Ae?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:U.x,cy:U.y,r:Ae?8:6,fill:Ae?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Ae&&jsx(motion.text,{x:U.x+15,y:U.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:U.x+10},animate:{opacity:1,x:U.x+15},transition:{duration:.2},children:"Connect"})]}),(et||Oe)&&!pt&&!e.segments&&jsx(motion.rect,{x:rt-1,y:r-1,width:Ke+2,height:Pe+2,rx:Be+1,fill:"none",stroke:Oe?n.accent:ot?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ot?1:2,opacity:Oe||ot?.6:.4,initial:{opacity:0},animate:{opacity:Oe||ot?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ut&&jsxs(Fragment,{children:[jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ee+Ee,y1:0,x2:ee+Ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:et&&!Oe&&!e.segments&&!x&&(()=>{let Q=r<100,$=Q?r+Pe+13:r-82-13,te=Q?`M ${rt+Ke/2-6} ${r+Pe+3} L ${rt+Ke/2} ${r+Pe+13} L ${rt+Ke/2+6} ${r+Pe+3}`:`M ${rt+Ke/2-6} ${r-13} L ${rt+Ke/2} ${r-3} L ${rt+Ke/2+6} ${r-13}`,xe=$+22,T=$+40,W=$+55,pe=$+70,_=Q?$+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:Q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:rt+Ke/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:rt+Ke/2,y:xe,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:rt+Ke/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:rt+Ke/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.startDate)}),jsx("text",{x:rt+Ke/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:rt+Ke/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.endDate)}),jsx("text",{x:rt+Ke/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:rt+Ke/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt()}),jsx("text",{x:rt+Ke/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:rt+Ke/2+65,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:rt+Ke/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:rt+Ke/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ve=>ve.name).join(", ").substring(0,30),e.assignees.map(ve=>ve.name).join(", ").length>30?"...":""]})]}),!Q&&jsx("text",{x:rt+Ke/2,y:_,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rr?"Left: move \u2022 Right: resize":zt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var sd=260,ls=8,Wm=16,aw=-12;function zm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,M=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,k=(M?155:105)+(F?28:0),N=w+Wm,P=C+aw-k;N+sd>window.innerWidth-ls&&(N=w-sd-Wm),N<ls&&(N=ls);let D=P<ls;D&&(P=C+20),P+k>window.innerHeight-ls&&(P=window.innerHeight-ls-k),s({left:N,top:P,showBelow:D});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=k.getTime();){let P=F.getDay();v[P]&&!w.has(C(F))&&M++,F.setDate(F.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:sd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.duration,value:d(),labelColor:u,valueColor:p}),jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:u},children:[l.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:u},children:[l.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),c&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function $c({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"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"})})]}),a&&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(l).map(([i,d])=>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:i})}),jsx("div",{children:d.map(m=>jsxs("button",{onClick:()=>c(m),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),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 Hc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=useState("export"),[l,i]=useState("json"),[d,m]=useState(null),u=useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,y=await Au(e,l,x);Iu(y,l);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await $u(y),h=y.name.endsWith(".json")?"json":"csv",v=Bu(b,h);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxs("div",{className:g("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:r}),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:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="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(x=>jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:p,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),d&&jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Mx=["URGENT","HIGH","MEDIUM","LOW"],Px=[{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"}],Fx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,y]=useState(true),b=useCallback(M=>{r({search:M.target.value});},[r]),h=useCallback(M=>{r({dateFilter:M.target.value});},[r]),v=useCallback(M=>{a({by:M.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),C=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 ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children: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"}),C&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[m&&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"}),o&&jsx("button",{onClick:o,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:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,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:M=>{let F=M.target.value;r({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Mx.map(M=>jsx("option",{value:M,children:M},M))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let F=M.target.value;r({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),l.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let F=M.target.value;r({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsx("option",{value:M,children:M},M))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:Px.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:p,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=useState(false),m=useRef(null);useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxs("div",{className:g("relative",a),ref:m,children:[jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,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"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>u(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 zc={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:"#00E5CC",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"}},Gc={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:"#00E5CC",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"}},Vc={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"}},So={dark:zc,light:Gc,neutral:Vc},Vi="dark";var ji=createContext(void 0),Wx="asakaa-theme";function dm({children:e,defaultTheme:t=Vi,storageKey:r=Wx}){let[a,n]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=So[a];Object.entries(l.colors).forEach(([d,m])=>{m&&c.style.setProperty(`--theme-${zx(d)}`,m);}),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(([d,m])=>{let u=l.colors[d];u&&c.style.setProperty(m,u);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:So};return jsx(ji.Provider,{value:o,children:e})}function es(){let e=useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function jc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=es();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),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(So).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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"]})]}),a===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 ct={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},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:"#78716C",dependencyHover:"#A8A29E",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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function um(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},pm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},_c={en:_i,es:pm};function mm(e){return _c[e]||_c.en}function Kc(e,t){let r=mm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var rs=createContext(_i);function qa(){return useContext(rs)}function Gs(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function km({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=useState(false),[i,d]=useState(null),m=useRef(null),u=useRef(null),p=qa(),f=Gs(m,c,"right",176);if(useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{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:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{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:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] 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:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:u,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:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function fm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=useState(false),[l,i]=useState(null),[d,m]=useState(false),u=useRef(null),p=useRef(null),f=qa(),x=Gs(u,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=M=>{let F=M.target;u.current&&!u.current.contains(F)&&p.current&&!p.current.contains(F)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,M)=>{if(M){i(C);try{await M();}catch(F){console.error(`Export ${C} failed:`,F);}finally{i(null),c(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>c(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:p,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((C,M)=>jsxs(motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:l===C.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function dv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function uv({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function bm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),c=useRef(null),l=qa(),i=Gs(o,n,"left");useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&c.current&&!c.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:c,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxs(motion.button,{onClick:()=>{r(u.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:p<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function hm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),c=useRef(null),l=useRef(null),i=qa(),d=Gs(c,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),l._cleanup&&l._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:c,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:l,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,y=()=>f.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function pv({value:e,onChange:t,theme:r}){let a=qa(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function mv({theme:e,forecast:t}){let r=qa(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:c})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function gv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=useState(false),f=useRef(null),x=useRef(null),y=qa(),b=Gs(f,u,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!u)return;let M=F=>{let k=F.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&p(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:c,onChange:l}],C=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:u&&jsxs(motion.div,{ref:x,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,F)=>{let k=M.icon,N=M.disabled,P=M.tooltip;return jsxs(motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?h?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((M,F)=>{let k=i===M.value;return jsxs(motion.button,{onClick:()=>d(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:M,projectForecast:F,hideForecastHud:k,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportCSV:K,onExportJSON:H,onExportMSProject:ee,showCriticalPath:A=true,onShowCriticalPathChange:Ee,showDependencies:O=true,onShowDependenciesChange:U,highlightWeekends:R=true,onHighlightWeekendsChange:Ae,showBaseline:Je=false,onShowBaselineChange:$e,onCopySnapshotLink:J,hasDependencies:De=true}){let oe=qa(),Ue=N||P||D||K||H||ee,Ne=!!e.glassToolbar,Me=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],Re=[{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"})}],Qe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ne){let ie=Qe?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:M&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Qe?"#000000":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>M("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>M("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Qe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(pv,{value:t,onChange:r,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ie}}),jsx(gv,{theme:e,showCriticalPath:A,onShowCriticalPathChange:Ee,showBaseline:Je,onShowBaselineChange:$e,highlightWeekends:R,onHighlightWeekendsChange:Ae,showDependencies:O,onShowDependenciesChange:U,rowDensity:c,onRowDensityChange:l,hasDependencies:De}),jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),d&&u&&jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Qe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||oe.toolbar.createTask})]})]})]}),F&&!k&&jsx(mv,{theme:e,forecast:F})]})}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(uv,{options:Me,value:t,onChange:ie=>r(ie),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:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(hm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||oe.toolbar.createTask})]}),(Ue||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(fm,{theme:e,onExportPNG:N,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(dv,{options:Re,value:s,onChange:ie=>o(ie),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!a)return;let d=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(nr,{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:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:d.label}),d.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function os({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[c,l]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,y=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(y=f-m-u,y<u&&(y=u)),l({x,y});},[e,t,r,a.length]),useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d: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:o,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:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.map(d=>jsxs("div",{children:[d.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={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"}),Duplicate:jsx(Copy,{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 Mm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=useRef(false),f=useCallback(v=>{p.current=v;},[]),x=useCallback(v=>{let w=[],C=M=>{for(let F of M)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&C(F.subtasks);};return C(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let M=y();if(!M){r(C[0].id,false);return}let F=C.findIndex(P=>P.id===M.id);if(F===-1)return;let k=v==="up"?F-1:F+1;if(k<0||k>=C.length)return;let N=C[k];r(N.id,w);},[e,y,x,r]),h=useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),N=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(N&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!N.isExpanded||v.key==="ArrowLeft"&&N.isExpanded)&&d(N.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){N&&(v.preventDefault(),a(N.id,"above"));return}if(v.key==="Enter"&&F){N&&(v.preventDefault(),m(N.id));return}if(v.key==="F2"){N&&(v.preventDefault(),i(N.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&F&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[u,t,y,b,a,n,s,o,c,l,i,d,m]);return useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:f}}function Fm(e){let[t,r]=useState(new Set),[a,n]=useState(null);useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=useCallback(u=>{r(new Set([u])),n(u);},[]),o=useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),c=useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let y=Math.min(f,x),b=Math.max(f,x),h=p.slice(y,b+1);r(new Set(h)),n(u);},[a,s]),l=useCallback((u,p,f,x)=>{x?c(u,p):f?o(u):s(u);},[s,o,c]),i=useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=useCallback(()=>{r(new Set),n(null);},[]),m=useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:c,handleTaskClick:l,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function Qc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Qc(t.subtasks):t.subtasks}))}function Mo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ss(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ss(r.subtasks,t);if(a)return a}}return null}function Jc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Jc(r.subtasks,t);if(a)return a}return null}function Zc(e,t){if(t.length===0)return e;let r=Mo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(y=>{if(p.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,p);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},c=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,f)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),m=c(i,s.id,d);return Qc(m)}function ed(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Jc(r,a);if(!n)continue;let s=Jc(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},c=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&c(p.subtasks,d,m);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Qc(r)}function td(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(m=>m.id===c);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function rd(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=l=>{let i=l.findIndex(p=>p.id===n);if(i===-1){for(let p of l)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=l[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return l.splice(i+1,0,u),u},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Lm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},c=l=>{let i=l.findIndex(m=>m.id===t);if(i===-1){for(let m of l)if(m.subtasks&&c(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function ad(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ad(a.subtasks,t,r)}:a)}function nd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:nd(r.subtasks,t)}:r)}function od(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=l(p.subtasks);if(f>=0)return f}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Am(e,t,r,a){if(t===r)return e;let n=ss(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ya(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ya(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:c,onTaskDblClick:l,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:y,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:M,onTaskRename:F,onCreateSubtask:k,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:D,allTasks:K,scrollContainerRef:H,showCriticalPath:ee=false}){let A=useContext(rs),[Ee,O]=useState(null),[U,R]=useState(null),[Ae,Je]=useState(""),$e=useRef(null),[J,De]=useState(null),[oe,Ue]=useState(0),[Ne,Me]=useState(0),[Re,Qe]=useState({isOpen:false,x:0,y:0,type:"header"}),[ie,et]=useState(null),[Ve,Oe]=useState(null),[ut,pt]=useState(null),Ge=useRef(0),Pe=5,ot=useRef(false),[$t,Be]=useState(null),[st,L]=useState(false),X=useRef(null),[B,Y]=useState(null),[re,he]=useState(null),[qe,j]=useState(false),ye=useRef(null);useEffect(()=>{function ce(ue){ye.current&&!ye.current.contains(ue.target)&&j(false);}if(qe)return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[qe]),useEffect(()=>{U&&$e.current&&($e.current.focus(),$e.current.select());},[U]),useEffect(()=>{if(!J)return;let ce=mt=>{let V=mt.clientX-oe,fe=Ne+V;f?.(J,fe);},ue=()=>{De(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ce),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[J,oe,Ne,f]);let{selectedTaskIds:Fe,handleTaskClick:Ie,isTaskSelected:Ct}=Fm(c),{setIsEditing:Ze}=Mm({tasks:e,selectedTaskIds:Fe,onTaskSelect:(ce,ue)=>{let V=Mo(e).map(fe=>fe.id);Ie(ce,V,ue||false,false),o?.(ce);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&_r(ue);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ce=>{let ue=Mo(e).find(mt=>mt.id===ce);ue&&N&&N(ue);},enableKeyboard:true}),Tt=(ce,ue=0,mt="")=>{let V=[],fe=[...ce].sort((Q,$)=>(Q.position??0)-($.position??0));for(let Q=0;Q<fe.length;Q++){let $=fe[Q],te=Q+1,xe=mt?`${mt}.${te}`:`${te}.0`,T=$.wbsCode||xe;if($.wbsCode=T,V.push({task:$,level:ue}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(mt?`${mt}.${te}`:`${te}`);V.push(...Tt($.subtasks,ue+1,pe));}}return V},ft=Tt(e),zt=48,rr=Math.max(ft.length*r,600-zt),da=(ce,ue)=>ue==="assignees"?ce.assignees:ue==="startDate"?ce.startDate:ce.endDate,Vt=(ce,ue,mt,V)=>{ce.preventDefault(),ce.stopPropagation(),Y({sourceTaskId:ue,column:mt,sourceIndex:V,targetIndex:V}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=ce.currentTarget.closest("[data-grid-body]"),Q=ve=>{let it=fe?.getBoundingClientRect().top??0,ae=Math.floor((ve-it)/r);return ae=Math.max(0,Math.min(ft.length-1,ae)),ae<V&&(ae=V),ae},$=ce.clientY,te=H?.current??null,xe=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},T=()=>{let ve=Q($);Y(it=>it&&{...it,targetIndex:ve});},W=()=>{if(xe(),!te)return;let ve=te.getBoundingClientRect(),it=60,ae=12,lt=$-ve.top,bt=ve.bottom-$;if(bt<it&&te.scrollTop<te.scrollHeight-te.clientHeight){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,bt)/it))),br=()=>{te.scrollTop+=Mt,T(),te.scrollTop<te.scrollHeight-te.clientHeight&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}else if(lt<it&&te.scrollTop>0){let Mt=Math.max(1,Math.round(ae*(1-Math.max(0,lt)/it))),br=()=>{te.scrollTop-=Mt,T(),te.scrollTop>0&&(X.current=requestAnimationFrame(br));};X.current=requestAnimationFrame(br);}},pe=ve=>{$=ve.clientY,T(),W();},_=ve=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",_),xe(),document.body.style.cursor="",document.body.style.userSelect="",Y(null);let it=Q(ve.clientY),ae=ft.find(ha=>ha.task.id===ue)?.task;if(!ae)return;let lt=da(ae,mt),bt=Math.min(V,it),Mt=Math.max(V,it),br=[];for(let ha=bt;ha<=Mt;ha++){if(ha===V)continue;let Mr=ft[ha]?.task;!Mr||Mr.subtasks&&Mr.subtasks.length>0||br.push(Mr.id);}br.length!==0&&y?.(br,mt,lt);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",_);},gr=ce=>{if(!B)return false;let ue=Math.min(B.sourceIndex,B.targetIndex),mt=Math.max(B.sourceIndex,B.targetIndex);return ce>=ue&&ce<=mt},Bt=ce=>!ce.startDate||!ce.endDate?"-":`${Math.ceil((ce.endDate.getTime()-ce.startDate.getTime())/(1e3*60*60*24))}d`,_r=ce=>{R(ce.id),Je(ce.name),Ze(true);},jt=ce=>{Ae.trim()&&Ae!==e.find(ue=>ue.id===ce)?.name&&F?.(ce,Ae.trim()),R(null),Je(""),Ze(false);},Qt=()=>{R(null),Je(""),Ze(false);},zr=(ce,ue)=>{ue.stopPropagation(),k?.(ce.id);},ua=(ce,ue)=>{ue.preventDefault(),Ge.current=ue.clientY,et(ce),ot.current=false,L(false),Be({x:ue.clientX,y:ue.clientY});},rt=ce=>{if(!ie||(Math.abs(ce.clientY-Ge.current)>Pe&&!ot.current&&(ot.current=true,L(true)),Be({x:ce.clientX,y:ce.clientY}),!ot.current))return;if(H?.current){let Q=H.current,$=Q.getBoundingClientRect(),te=60,xe=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let T=ce.clientY-$.top,W=$.bottom-ce.clientY;if(T<te&&Q.scrollTop>0){let pe=Math.round(xe*(1-T/te)),_=()=>{Q.scrollTop-=pe,ot.current&&Q.scrollTop>0&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}else if(W<te&&Q.scrollTop<Q.scrollHeight-Q.clientHeight){let pe=Math.round(xe*(1-W/te)),_=()=>{Q.scrollTop+=pe,ot.current&&Q.scrollTop<Q.scrollHeight-Q.clientHeight&&(X.current=requestAnimationFrame(_));};X.current=requestAnimationFrame(_);}}let mt=document.querySelectorAll("[data-task-row]"),V=null,fe=null;mt.forEach(Q=>{let $=Q.getBoundingClientRect(),te=Q.getAttribute("data-task-row");if(te&&te!==ie&&ce.clientY>=$.top&&ce.clientY<=$.bottom){V=te;let xe=ce.clientY-$.top,T=$.height;xe<T*.25?fe="above":xe>T*.75?fe="below":fe="child";}}),Oe(V),pt(fe);},Ke=()=>{if(ot.current&&ie&&Ve&&ut){if(ut==="child")D?.(ie,Ve);else if(ut==="above"||ut==="below"){let ce=(Q,$,te=null)=>{for(let xe of Q){if(xe.id===$)return te;if(xe.subtasks){let T=ce(xe.subtasks,$,xe.id);if(T!==void 0)return T}}},ue=K&&K.length>0?K:e,mt=ce(ue,ie,null),V=ce(ue,Ve,null),fe=(Q,$,te,xe)=>{let T=Q.findIndex(_=>_.id===$),W=xe?Q.findIndex(_=>_.id===te):-1,pe=ut==="below"?T+1:T;return xe&&W!==-1&&W<T&&(pe-=1),Math.max(0,pe)};if(V===null){let $=fe(ue,Ve,ie,mt===null);D?.(ie,null,$);}else {let Q=ss(ue,V);if(Q?.subtasks){let $=mt===V,te=fe(Q.subtasks,Ve,ie,$);D?.(ie,V,te);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),et(null),Oe(null),pt(null),Be(null),ot.current=false,L(false);};useEffect(()=>{if(ie)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ve,ut]);let ba=(ce,ue,mt)=>{let V=ue.subtasks&&ue.subtasks.length>0;switch(ce.id){case "name":let fe=U===ue.id,Q=Ee===ue.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${mt*20}px`},children:[D&&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:Q?1:.3},onMouseDown:ae=>ua(ue.id,ae),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsx("button",{onClick:ae=>{ae.stopPropagation(),d?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.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"}),fe?jsx("input",{ref:$e,type:"text",value:Ae,onChange:ae=>Je(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?jt(ue.id):ae.key==="Escape"&&Qt();},onBlur:()=>jt(ue.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:ae=>ae.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),ee&&ue.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ee&&ue.cpmData&&jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),Q&&!fe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ae=>ae.stopPropagation(),children:[jsx("button",{onClick:ae=>zr(ue,ae),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:ae=>{ae.stopPropagation(),_r(ue);},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 te=ce.id==="startDate"?"startDate":"endDate",xe=ue[te],T=re?.taskId===ue.id&&re?.field===te,W=ae=>ae?(typeof ae=="string"?new Date(ae):ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ae=>ae.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,opacity:V?.5:1,cursor:V?"default":"pointer"},title:V?"Auto-calculated from subtasks":void 0,onClick:ae=>{if(!V)if(T)he(null);else {let lt=ae.currentTarget.getBoundingClientRect();he({taskId:ue.id,field:te,month:xe?typeof xe=="string"?new Date(xe):xe:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(xe)}),V&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),T&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(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:re?.position.top,left:re?.position.left},onClick:ae=>ae.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ae=new Date,lt=new Date(ae);lt.setDate(ae.getDate()+1);let bt=new Date(ae);bt.setDate(ae.getDate()+7);let Mt=new Date(ae);return Mt.setDate(ae.getDate()+14),[{label:"Hoy",date:ae},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Mt}].map((ha,Mr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:tn=>tn.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:tn=>tn.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:ha.date}),he(null);},children:ha.label},Mr))})(),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:ae=>ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[te]:void 0}),he(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:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.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:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.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((ae,lt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ae},lt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=re?.month||new Date,lt=ae.getFullYear(),bt=ae.getMonth(),Mt=new Date(lt,bt,1).getDay(),br=new Date(lt,bt+1,0).getDate(),ha=new Date,Mr=[];for(let lr=Mt-1;lr>=0;lr--)Mr.push({day:new Date(lt,bt,-lr).getDate(),date:new Date(lt,bt-1,new Date(lt,bt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=br;lr++)Mr.push({day:lr,date:new Date(lt,bt,lr),isCurrentMonth:true});let tn=42-Mr.length;for(let lr=1;lr<=tn;lr++)Mr.push({day:lr,date:new Date(lt,bt+1,lr),isCurrentMonth:false});return Mr.map((lr,Ra)=>{let Ho=lr.date.toDateString()===ha.toDateString(),_n=(xe?typeof xe=="string"?new Date(xe):xe:null)?.toDateString()===lr.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:lr.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:Ho&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(ue.id,{[te]:lr.date}),he(null);},children:lr.day},Ra)})})()})]})]})]}),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:Bt(ue)})});case "assignees":if(V)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let pe=a.filter(ae=>ue.assignees?.some(lt=>lt.id?lt.id===ae.id:lt.name===ae.name||lt.initials===ae.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(ko,{assignedUsers:pe,availableUsers:a,onChange:ae=>{let lt=ae.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));x?.(ue.id,{assignees:lt});}})});case "status":if(V){let ae=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ae})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(rp,{status:ue.status||"todo",onChange:ae=>{x?.(ue.id,{status:ae,progress:ae==="completed"?100:ue.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:V?.6:1},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:`${ue.progress}%`,backgroundColor:ue.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:[ue.progress,"%"]})]});case "priority":let _={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ve={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},it=_[ue.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsx(vo,{priority:it,onChange:ae=>{ae&&x?.(ue.id,{priority:ve[ae]||"medium"});}})});default:return null}},ir=ce=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(ce),disabled:ce==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],Qr=ce=>{let ue=ce.subtasks&&ce.subtasks.length>0,mt=Mo(e),V=Fe.size>1&&Fe.has(ce.id),fe=V?mt.filter(T=>Fe.has(T.id)):[ce],Q=fe.map(T=>T.id),$=fe.filter(T=>!(T.subtasks&&T.subtasks.length>0)),te=V?` (${Q.length})`:"",xe=()=>{P?P(Q,ce.name):w?.(Q);};return ue?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{l?.(ce);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{k?.(ce.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(A?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:tr.MarkIncomplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(T=>T.status==="todo")},{id:"setInProgress",label:(A?.contextMenu?.setInProgress||"Set In Progress")+te,icon:tr.SetInProgress,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"in-progress"}));},disabled:$.length===0||$.every(T=>T.status==="in-progress")},{id:"markComplete",label:(A?.contextMenu?.markComplete||"Mark Complete")+te,icon:tr.MarkComplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(T=>T.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(A?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{C?.(Q);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(A?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:xe}]},fr=u.filter(ce=>ce.visible),Ca=fr.reduce((ce,ue)=>ce+ue.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ca},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${zt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:fr.map((ce,ue)=>{let mt=ue===fr.length-1,V=ce.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${V?"":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(V?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:V&&fr.length===1?1:0,flexGrow:V&&fr.length===1?1:0,borderRight:mt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Qe({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:ce.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.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:"0"},title:ce.label,children:ce.label}),ce.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===ce.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),De(ce.id),Ue(fe.clientX),Me(ce.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===ce.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ce.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(qi,{columns:u,onToggleColumn:p,theme:t}),jsx("button",{onClick:()=>j(!qe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),qe&&jsxs("div",{ref:ye,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:ce=>ce.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:()=>j(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","data-grid-body":true,style:{minHeight:rr},children:ft.map(({task:ce,level:ue},mt)=>{let V=Ct(ce.id),fe=gr(mt),Q=Ve===ce.id,$=Q&&ut==="above",te=Q&&ut==="below",xe=Q&&ut==="child",T={};return xe&&(T.backgroundColor=`${t.accent}15`,T.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ce.id,className:`flex items-center cursor-pointer group ${ie===ce.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:V?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:V?t.accentLight:xe?`${t.accent}15`:mt%2===0?t.bgPrimary:t.bgGrid,opacity:ee?ce.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...T},onMouseEnter:()=>O(ce.id),onMouseLeave:()=>O(null),onClick:W=>{let _=Mo(e).map(ae=>ae.id),it=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;Ie(ce.id,_,it,W.shiftKey),o?.(ce.id),!it&&!W.shiftKey&&s?.(ce);},onDoubleClick:W=>{W.stopPropagation(),l?.(ce);},onContextMenu:W=>{W.preventDefault(),Qe({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:ce}),i?.(ce,W);},whileHover:{backgroundColor:V?t.accentLight:t.hoverBg},children:[$&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),fr.map((W,pe)=>{let _=pe===fr.length-1,ve=W.id==="name",it=!!(ce.subtasks&&ce.subtasks.length>0),ae=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!ae&&!it&&Ee===ce.id&&!B,Mt=fe&&!!B&&B.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${ve?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(ve?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:ve&&fr.length===1?1:0,flexGrow:ve&&fr.length===1?1:0,borderRight:_?"none":`1px solid ${Ee===ce.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Mt?`${t.accent}22`:void 0,boxShadow:Mt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ba(W,ce,ve?ue:0),bt&&ae&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:br=>Vt(br,ce.id,ae,mt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ce.id}-${W.id}`)})]},ce.id)})}),jsx(os,{isOpen:Re.isOpen,x:Re.x,y:Re.y,items:Re.type==="header"&&Re.columnId?ir(Re.columnId):Re.type==="task"&&Re.task?Qr(Re.task):[],onClose:()=>Qe({...Re,isOpen:false}),theme:t}),st&&$t&&ie&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:$t.x+12,top:$t.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=ft.find(ue=>ue.task.id===ie)?.task;return ce?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:ce.name})}):null})()}),document.body)]})}function Om(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,c]=useState(e),[l,i]=useState(t),[d,m]=useState(null),[u,p]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,C]=useState(0),[M,F]=useState(null),[k,N]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:M,setHoveredSegmentIndex:F,isHovered:k,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ee,A)=>{a("none"),m(null),p(null),c(ee),i(A),C(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let C=Om(t,a),M=useRef(null),F=useRef(false),k=useRef(null),N=useRef(null),{dragMode:P,setDragMode:D,dragOffset:K,setDragOffset:H,ghostX:ee,setGhostX:A,ghostWidth:Ee,setGhostWidth:O,connectionLine:U,setConnectionLine:R,hoveredTaskId:Ae,setHoveredTaskId:Je,activeZone:$e,setActiveZone:J,draggedSegmentIndex:De,setDraggedSegmentIndex:oe,draggedSegmentStartX:Ue,setDraggedSegmentStartX:Ne,segmentDragOffsetX:Me,setSegmentDragOffsetX:Re,hoveredSegmentIndex:Qe,setHoveredSegmentIndex:ie,isHovered:et,setIsHovered:Ve,isDragging:Oe,isResizing:ut,isConnecting:pt,resetDragState:Ge}=C,Pe=18,ot=!!n.executionBarBg,$t=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Be=ot?3:6,st=e.subtasks&&e.subtasks.length>0,L=useRef(null),[X,B]=(()=>{let V=useRef(null),[,fe]=useState(0);return [V.current,Q=>{V.current=Q,fe($=>$+1);}]})(),Y=!!w&&!v&&!st&&!e.segments&&!!e.startDate&&!!e.endDate,re=e.endDate&&(()=>{let V=new Date;V.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<V})()&&e.progress<100,he=h&&e.isCriticalPath,qe=n.name==="neutral"||n.today==="#1C1917",j=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ie=h&&e.isCriticalPath||re?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:n.taskBarPrimary,Ct=v?"default":Oe?pt?"crosshair":ut?"ew-resize":"grabbing":"grab",Ze=v?"default":"ew-resize",ft=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),zt=a<50,rr=a<40;useEffect(()=>{x&&(!et||Oe||e.segments)&&x(null);},[et,Oe,e.segments,x]);let da=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Vt=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},gr=V=>Math.round(V/s)*s,Bt=V=>{let fe=Math.round(V/s),Q=new Date(o);return Q.setDate(Q.getDate()+fe),Q},_r=(V,fe)=>{for(let Q of p){if(Q.id===e.id)continue;let $=5;if(V>=Q.x-$&&V<=Q.x+Q.width+$&&fe>=Q.y-$&&fe<=Q.y+Q.height+$)return Q.id}return null},jt=useCallback((V,fe,Q)=>{if(v)return;V.preventDefault(),V.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let te=$.createSVGPoint();te.x=V.clientX,te.y=V.clientY;let xe=te.matrixTransform($.getScreenCTM()?.inverse()),T=Q!==void 0?Q:t,W=fe;if(!W){let pe=xe.x-T;V.shiftKey?(W="connect",R({x:t+a,y:r+Pe/2})):V.ctrlKey||V.metaKey?W="move":V.altKey?W=pe<a/2?"resize-start":"resize-end":rr?pe<a/2?W="move":W="resize-end":zt?pe<=ft/2?W="resize-start":pe>=a-ft/2?W="resize-end":W="move":pe<=ft?W="resize-start":pe>=a-ft?W="resize-end":W="move";}F.current=false,D(W),Ve(false),J(null),W==="move"?H(xe.x-T):W==="connect"?R({x:t+a,y:r+Pe/2}):H(0),A(T),O(a);},[t,a,r,Pe,v]),Qt=useCallback(V=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let Q=fe.closest(".gantt-timeline-scroll");if(!Q)return;let $=Q.getBoundingClientRect(),te=60,xe=15,T=0;if(V.clientX<$.left+te){let W=$.left+te-V.clientX;T=-Math.min(xe,W/2);}else if(V.clientX>$.right-te){let W=V.clientX-($.right-te);T=Math.min(xe,W/2);}return T!==0&&(Q.scrollLeft+=T),T!==0},[]),zr=useCallback(V=>{if(P==="none")return;F.current=true,N.current=V;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let te=Qt(V);te&&!k.current?k.current=window.setInterval(()=>{N.current&&(Qt(N.current),zr(N.current));},16):!te&&k.current&&(window.clearInterval(k.current),k.current=null);}let Q=fe.createSVGPoint();Q.x=V.clientX,Q.y=V.clientY;let $=Q.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){R({x:$.x,y:$.y});let te=_r($.x,$.y);Je(te);}else if(P==="move"){let te=$.x-K,xe=gr(te);A(xe),O(a);let T=Math.round((xe-t)/s);if(f?.(e.id,T,true),e.segments&&e.segments.length>0&&De!==null){let W=xe-Ue;Re(W);}}else if(P==="resize-start"){let te=$.x,xe=gr(te),T=t+a-xe;T>=s&&(A(xe),O(T));}else if(P==="resize-end"){let te=$.x,T=gr(te)-t;T>=s&&O(T);}},[P,t,a,s,K,e,gr,De,Ue,_r,Je,R,A,O,Re,f,Qt]),ua=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),N.current=null,P!=="none"){if(P==="connect")Ae&&u&&u(e,Ae),R(null),Je(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),fe,Q,$=true;if(P==="move"){if(fe=Bt(ee),Q=new Date(fe.getTime()+V),e.segments&&e.segments.length>0&&De!==null){let te=Math.round(Me/s),xe=e.segments.map((_,ve)=>{if(ve===De){let it=new Date(_.startDate),ae=new Date(_.endDate);return it.setDate(it.getDate()+te),ae.setDate(ae.getDate()+te),{startDate:it,endDate:ae}}return _}),T=xe.flatMap(_=>[_.startDate,_.endDate]),W=new Date(Math.min(...T.map(_=>_.getTime()))),pe=new Date(Math.max(...T.map(_=>_.getTime())));m?.({...e,segments:xe},W,pe),Ge(t,a);return}}else P==="resize-start"?(fe=Bt(ee),Q=e.endDate,fe>Q&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(fe=e.startDate,Q=Bt(ee+Ee),Q.setDate(Q.getDate()-1),Q<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&Q&&(Q.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,Q));}f?.(e.id,0,false),Ge(t,a);}},[P,ee,Ee,e,m,Ae,u,t,a,s,Bt,Me,De,Ge,f]);useEffect(()=>{if(P==="none")return;let V=Q=>{zr(Q);},fe=()=>{ua();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",fe),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,zr,ua]);let rt=Oe&&!pt?ee:t,Ke=Oe&&!pt?Ee:a,ba=c.taskClass(e),ir=24,Qr=h?e.isCriticalPath?1:.25:1,fr=useCallback(V=>{if(!Y)return;V.stopPropagation(),V.preventDefault();let Q=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:Q,initialPct:e.progress||0},V.currentTarget.setPointerCapture(V.pointerId),B(e.progress||0);},[Y,e.progress,B]),Ca=useCallback(V=>{let fe=L.current;if(!fe)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let te=(V.clientX-$.left)/$.width,xe=Math.round(Math.max(0,Math.min(1,te))*100);V.shiftKey&&(xe=Math.round(xe/25)*25),B(xe);},[B]),ce=useCallback(V=>{let fe=L.current;if(!fe)return;V.stopPropagation(),V.preventDefault();try{V.currentTarget.releasePointerCapture(V.pointerId);}catch{}let Q=X;L.current=null,B(null),Q!=null&&Q!==fe.initialPct&&w&&w(e,Q);},[X,w,e,B]),ue=useCallback(V=>{V.stopPropagation(),V.preventDefault();},[]),mt=X??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:Qr,transition:"opacity 300ms ease"},onClick:()=>{!Oe&&!F.current&&l?.(e),F.current=false;},onDoubleClick:V=>{!Oe&&!F.current&&(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),d?.(e,V);},onMouseEnter:()=>!Oe&&Ve(true),onMouseMove:V=>{x&&et&&!Oe&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Pe,showBelow:false,mouseX:V.clientX,mouseY:V.clientY});},onMouseLeave:()=>{Oe||(Ve(false),J(null));},children:[jsx("rect",{x:t,y:r,width:a+ir,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),et&&!Oe&&!zt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:ft,height:Pe,fill:$e==="resize-start"?n.accent:"transparent",opacity:$e==="resize-start"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:V=>jt(V,"resize-start")}),jsx("rect",{x:t+ft,y:r,width:a-ft*2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsx("rect",{x:t+a-ft,y:r,width:ft,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.15:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")})]}),et&&!Oe&&rr&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Pe,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:V=>jt(V,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Pe,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.2:0,style:{cursor:Ze,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:V=>jt(V,"resize-end")}),et&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Pe-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Oe&&!pt&&!e.segments&&jsx(motion.rect,{x:ee,y:r,width:Ee,height:Pe,rx:Be,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Oe&&(()=>{let V=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),Q=o.getTime(),$=864e5,te=(V-Q)/$,xe=(fe-V)/$,T=te*s,W=Math.max(xe*s,s),pe=rt+Ke,_=T+W,ve=e.endDate?.getTime()??0,it=Math.ceil((ve-fe)/$),ae=it>0,lt=it<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:T,y:r,width:W,height:Pe,rx:Be,fill:"none",stroke:$t?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ae&&pe>_&&jsx("rect",{x:_,y:r,width:pe-_,height:Pe,rx:0,fill:"#EF4444",opacity:.2}),ae&&jsxs("text",{x:Math.max(pe,_)+6,y:r+Pe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",it,"d"]}),lt&&jsxs("text",{x:pe+6,y:r+Pe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[it,"d"]})]})})(),!e.segments&&ot&&st&&(()=>{let fe=r+(Pe-8)/2,Q=4,$=e.progress||0,te=new Date;te.setHours(0,0,0,0);let xe=e.startDate&&te>=e.startDate,T=e.endDate&&(()=>{let ae=new Date(e.endDate);return ae.setHours(0,0,0,0),te>ae})(),W=e.startDate&&te<e.startDate,pe=1;if(xe&&e.startDate&&e.endDate&&!W){let ae=new Date(e.startDate);ae.setHours(0,0,0,0);let lt=new Date(e.endDate);lt.setHours(0,0,0,0);let bt=Math.max(1,(lt.getTime()-ae.getTime())/(1e3*60*60*24)),br=Math.min((te.getTime()-ae.getTime())/(1e3*60*60*24),bt)/bt*100;pe=br>0?$/br:1;}let _;$>=100?_="#00E5CC":W?_="#4B5563":T&&$<100?_="#EF4444":pe>=.95?_="#22C55E":pe>=.8?_="#F59E0B":_="#EF4444";let ve=Math.max($/100*Ke,$>0?Q*2:0),it=Ke>100&&$>0;return jsxs("g",{"data-task-class":ba,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:rt,y:fe,width:Ke,height:8,rx:Q,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:rt,y:fe,width:ve,height:8,rx:Q,fill:_}),it&&jsxs("text",{x:rt+ve+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round($),"%"]})]})})(),!e.segments&&ot&&!st&&jsx(motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ba,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:1,scale:et&&!Oe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>jt(V),style:{cursor:Ct,pointerEvents:"all"}}),!e.segments&&!ot&&jsx(motion.rect,{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:Ie,"data-task-class":ba,initial:{opacity:0,scale:.95},animate:{opacity:Oe&&!pt?.15:e.parentId?.6:et?.9:.8,scale:et&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st?void 0:V=>jt(V),style:{cursor:st?"default":Ct,pointerEvents:"all"}}),ot&&(re||he)&&!e.segments&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&mt>0&&!st&&jsx("rect",{x:rt,y:r,width:Math.max(Ke*(mt/100),Be*2),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!st&&e.progress<100&&(()=>{let V=e.progress>0?Ke*(e.progress/100):0,fe=rt+V,Q=Ke-V,$=e.progress===0?Be:0,te=e.progress===0?rt:fe,xe=e.progress===0?Ke:Q;return jsxs(Fragment,{children:[jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:te,y:r,width:xe,height:Pe,rx:$,fill:"none",stroke:Ie,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ot&&!e.segments&&e.progress>0&&e.progress<100&&!st&&!Oe&&X===null&&(()=>{let V=rt+Ke*(e.progress/100),fe=8,Q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:V,cy:r+Pe/2,r:fe,fill:Q?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:V,y:r+Pe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Q?.initials||Q?.name?.charAt(0)?.toUpperCase()||""})]})})(),Y&&!Oe&&Ke>=40&&(X!==null||mt<88)&&(()=>{let V=rt+Ke*(mt/100),fe=r+Pe/2,Q=X!==null,$=Q?7:et?6:5,te=Q||et?1:.35,xe=rt+Ke-V,T=Math.max(4,Math.min(12,xe-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:V-W,y:fe-12,width:W+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:fr,onPointerMove:Ca,onPointerUp:ce,onPointerCancel:ce,onClick:ue,onDoubleClick:ue,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{cx:V,cy:fe,r:$,fill:"#FFFFFF",stroke:Ie,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:Q?`drop-shadow(0 0 4px ${Ie})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Q&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:V-20,y:fe-28,width:40,height:18,rx:4,fill:$t?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ie,strokeWidth:1}),jsxs("text",{x:V,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:$t?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((V,fe)=>{let Q=(V.startDate.getTime()-o.getTime())/864e5*s,te=(V.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Q+s,xe=Oe&&P==="move"&&De===fe,T=Qe===fe,W=xe?Q+Me:Q;return jsxs("g",{onMouseEnter:()=>!Oe&&ie(fe),onMouseLeave:()=>!Oe&&ie(null),children:[jsx(motion.rect,{x:W,y:r,width:te,height:Pe,rx:Be,fill:Ie,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:T?.9:.8,scale:T&&!Oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),oe(fe),Ne(Q),jt(pe,void 0,Q);},style:{cursor:Ct,pointerEvents:"all"}}),jsx("rect",{x:W,y:r,width:te*(e.progress/100),height:Pe,rx:Be,fill:Ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),qe&&(re||he)&&!e.segments&&jsxs(Fragment,{children:[he&&!re&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),re&&jsx("rect",{x:rt,y:r,width:Ke,height:Pe,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ke>60&&!e.segments&&!(ot&&st)&&(()=>{let V=c.taskLabel(e),fe=typeof V=="string"?V:e.name,Q=fe.length>Math.floor(Ke/8)?`${fe.substring(0,Math.floor(Ke/8))}...`:fe;return jsx("text",{x:rt+8,y:r+Pe/2,dominantBaseline:"middle",fill:j?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:j?"line-through":"none"},children:Q})})(),!Oe&&!e.segments&&!st&&e.progress>0&&e.progress<100&&(ot?jsxs("text",{x:rt+Ke+6,y:r+Pe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ke>100?jsxs("text",{x:rt+Ke-12,y:r+Pe/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,"%"]}):null),e.status&&Ke>80&&!Oe&&!e.segments&&!(ot&&st)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:rt+Ke-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(et||ut)&&!pt&&!e.segments&&!st&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:rt-2,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-start"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-start");}}),jsx(motion.rect,{x:rt+4,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:rt+Ke-14,y:r,width:16,height:Pe,fill:"transparent",style:{cursor:Ze},onMouseEnter:()=>J("resize-end"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"resize-end");}}),jsx(motion.rect,{x:rt+Ke-7,y:r+8,width:3,height:Pe-16,rx:1.5,fill:$e==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:et&&!Oe&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>J("connect"),onMouseLeave:()=>J(null),onMouseDown:V=>{V.stopPropagation(),jt(V,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Pe/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:$e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&U&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Pe/2,x2:U.x,y2:U.y,stroke:Ae?n.statusCompleted:n.accent,strokeWidth:Ae?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Ae?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:U.x,cy:U.y,r:Ae?8:6,fill:Ae?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Ae&&jsx(motion.text,{x:U.x+15,y:U.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:U.x+10},animate:{opacity:1,x:U.x+15},transition:{duration:.2},children:"Connect"})]}),(et||Oe)&&!pt&&!e.segments&&jsx(motion.rect,{x:rt-1,y:r-1,width:Ke+2,height:Pe+2,rx:Be+1,fill:"none",stroke:Oe?n.accent:ot?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ot?1:2,opacity:Oe||ot?.6:.4,initial:{opacity:0},animate:{opacity:Oe||ot?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ut&&jsxs(Fragment,{children:[jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ee+Ee,y1:0,x2:ee+Ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:et&&!Oe&&!e.segments&&!x&&(()=>{let Q=r<100,$=Q?r+Pe+13:r-82-13,te=Q?`M ${rt+Ke/2-6} ${r+Pe+3} L ${rt+Ke/2} ${r+Pe+13} L ${rt+Ke/2+6} ${r+Pe+3}`:`M ${rt+Ke/2-6} ${r-13} L ${rt+Ke/2} ${r-3} L ${rt+Ke/2+6} ${r-13}`,xe=$+22,T=$+40,W=$+55,pe=$+70,_=Q?$+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:Q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:rt+Ke/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:rt+Ke/2,y:xe,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:rt+Ke/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:rt+Ke/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.startDate)}),jsx("text",{x:rt+Ke/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:rt+Ke/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.endDate)}),jsx("text",{x:rt+Ke/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:rt+Ke/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Vt()}),jsx("text",{x:rt+Ke/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:rt+Ke/2+65,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:rt+Ke/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:rt+Ke/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ve=>ve.name).join(", ").substring(0,30),e.assignees.map(ve=>ve.name).join(", ").length>30?"...":""]})]}),!Q&&jsx("text",{x:rt+Ke/2,y:_,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rr?"Left: move \u2022 Right: resize":zt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var sd=260,ls=8,Wm=16,aw=-12;function zm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,M=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,k=(M?155:105)+(F?28:0),N=w+Wm,P=C+aw-k;N+sd>window.innerWidth-ls&&(N=w-sd-Wm),N<ls&&(N=ls);let D=P<ls;D&&(P=C+20),P+k>window.innerHeight-ls&&(P=window.innerHeight-ls-k),s({left:N,top:P,showBelow:D});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=k.getTime();){let P=F.getDay();v[P]&&!w.has(C(F))&&M++,F.setDate(F.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:sd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.duration,value:d(),labelColor:u,valueColor:p}),jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:u},children:[l.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:u},children:[l.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),c&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|