@libxai/board 1.5.44 → 1.5.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.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 id({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),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 dd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await ou(e,c,x);nu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let b=await lu(h),f=h.name.endsWith(".json")?"json":"csv",w=iu(b,f);d(w),w.success&&r&&r(w,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="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:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&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:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Qy=["URGENT","HIGH","MEDIUM","LOW"],Zy=[{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"}],ex=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),b=useCallback(C=>{a({search:C.target.value});},[a]),f=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),v=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.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"}),T&&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:[d&&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"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,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:f,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:C=>{let N=C.target.value;a({priorities:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Qy.map(C=>jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let N=C.target.value;a({assignees:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let N=C.target.value;a({labels:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(C=>jsx("option",{value:C,children:C},C))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Zy.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>y(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ex.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),T&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ud({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!l),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await i?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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 pd={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:"#2E94FF",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"}},md={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:"#2E94FF",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"}},gd={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"}},Qo={dark:pd,light:md,neutral:gd},ui="dark";var pi=createContext(void 0),cx="asakaa-theme";function Rp({children:e,defaultTheme:t=ui,storageKey:a=cx}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Qo[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${ux(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Qo};return jsx(pi.Provider,{value:n,children:e})}function Nn(){let e=useContext(pi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ux(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function fd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Nn();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Qo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Op(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:r("--theme-bg-card",ct[e].bgGrid),bgWeekend:r("--theme-bg-hover",ct[e].bgWeekend),border:r("--theme-border-primary",ct[e].border),borderLight:r("--theme-border-subtle",ct[e].borderLight),textPrimary:r("--theme-text-primary",ct[e].textPrimary),textSecondary:r("--theme-text-secondary",ct[e].textSecondary),textTertiary:r("--theme-text-tertiary",ct[e].textTertiary),accent:r("--theme-accent-primary",ct[e].accent),accentHover:r("--theme-accent-hover",ct[e].accentHover),accentLight:r("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ct[e].dependency),dependencyHover:r("--theme-border-secondary",ct[e].dependencyHover),criticalPath:r("--theme-error",ct[e].criticalPath),criticalPathLight:r("--theme-error",ct[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ct[e].today):e==="neutral"?r("--theme-text-primary",ct[e].today):r("--theme-error",ct[e].today),todayLight:e==="light"?r("--theme-accent-primary",ct[e].todayLight):e==="neutral"?r("--theme-text-primary",ct[e].todayLight):r("--theme-error",ct[e].todayLight),milestone:r("--theme-warning",ct[e].milestone),milestoneLight:r("--theme-warning",ct[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:r("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:r("--theme-success",ct[e].statusCompleted),hoverBg:r("--theme-bg-hover",ct[e].hoverBg),focusRing:r("--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 mi={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"}},$p={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"}},bd={en:mi,es:$p};function Hp(e){return bd[e]||bd.en}function hd(e,t){let a=Hp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Sn=createContext(mi);function Br(){return useContext(Sn)}function ds(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Yp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=useState(false),[l,m]=useState(null),d=useRef(null),p=useRef(null),g=Br(),y=ds(d,i,"right",176);if(useEffect(()=>{if(!i)return;let f=w=>{let v=w.target;d.current&&!d.current.contains(v)&&p.current&&!p.current.contains(v)&&c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(f=>f.handler),b=async(f,w)=>{if(w){m(f);try{await w();}catch(v){console.error(`Export ${f} failed:`,v);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(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-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.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:h.map((f,w)=>jsxs(motion.button,{onClick:()=>b(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.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:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.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"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})}),document.body)]})}function Up({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Br(),x=ds(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let T=C=>{let N=C.target;p.current&&!p.current.contains(N)&&g.current&&!g.current.contains(N)&&i(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[n]);let f=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(T=>T.handler),w=async(T,C)=>{if(C){l(T);try{await C();}catch(N){console.error(`Export ${T} failed:`,N);}finally{l(null),i(false);}}},v=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,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: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:[f.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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:f.map((T,C)=>jsxs(motion.button,{onClick:()=>w(T.id,T.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 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:C*.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:c===T.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"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),f.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"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:v,className:"w-full flex items-center gap-2.5 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:f.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ix({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Bx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Wp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Br(),l=ds(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:i,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:l.top,left:l.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:m.map((p,g)=>{let y=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function Gp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Br(),m=ds(i,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=b=>{let f=b.target;i.current&&!i.current.contains(f)&&c.current&&!c.current.contains(f)&&n(false);},h=b=>{b.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":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:l.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(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-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Rx({value:e,onChange:t,theme:a}){let r=Br(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Ox({theme:e,forecast:t}){let a=Br(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#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||(r?"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:a.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:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),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:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&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:h})]})]})]})}function $x({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),b=ds(y,p,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let C=N=>{let k=N.target;y.current&&!y.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);let w=h.toolbar.visibility==="Visibilidad",v=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],T=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:y,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&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:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:v.map((C,N)=>{let k=C.icon,L=C.disabled,O=C.tooltip;return jsxs(motion.button,{onClick:()=>!L&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:L?f?"rgba(255,255,255,0.3)":"#9CA3AF":f?"rgba(255,255,255,0.85)":"#111827",cursor:L?"not-allowed":"pointer"},whileHover:L?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:N*.03},title:O,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:L?f?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!L&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((C,N)=>{let k=l===C.value;return jsxs(motion.button,{onClick:()=>m(C.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(v.length+N)*.03},children:[jsx("span",{style:{color:k?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function gi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:f,onWbsLevelChange:w,maxWbsDepth:v=4,viewMode:T="execution",onViewModeChange:C,projectForecast:N,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportCSV:S,onExportJSON:J,onExportMSProject:R,showCriticalPath:$=true,onShowCriticalPathChange:M,showDependencies:q=true,onShowDependenciesChange:Z,highlightWeekends:Re=true,onHighlightWeekendsChange:I,showBaseline:K=false,onShowBaselineChange:be,onCopySnapshotLink:_e,hasDependencies:z=true}){let ae=Br(),Q=k||L||O||S||J||R,Me=!!e.glassToolbar,[we,Le]=useState(false),He=useRef(null);useEffect(()=>{we&&He.current&&He.current.focus();},[we]);let at=[{value:"day",label:ae.toolbar.day},{value:"week",label:ae.toolbar.week},{value:"month",label:ae.toolbar.month}],te=[{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(Me){let ce=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:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Qe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Le(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),we&&jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Le(false),onKeyDown:nt=>{nt.key==="Escape"&&Le(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),C&&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:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:ae.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?Qe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:T==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:ae.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Rx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),w&&jsx(Wp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsx(Gp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),jsx($x,{theme:e,showCriticalPath:$,onShowCriticalPathChange:M,showBaseline:K,onShowBaselineChange:be,highlightWeekends:Re,onHighlightWeekendsChange:I,showDependencies:q,onShowDependenciesChange:Z,rowDensity:i,onRowDensityChange:c,hasDependencies:z}),jsx(Up,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportMSProject:R,onCopySnapshotLink:_e}),m&&p&&jsxs(motion.button,{onClick:p,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(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||ae.toolbar.createTask})]})]})]}),N&&jsx(Ox,{theme:e,forecast:N})]})}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(Bx,{options:at,value:t,onChange:ce=>a(ce),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(Wp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Gp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),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}})]}),m&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||ae.toolbar.createTask})]}),(Q||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Up,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportMSProject:R,onCopySnapshotLink:_e}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Ix,{options:te,value:s,onChange:ce=>n(ce),theme:e})]})]})}function fi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Kt,{children:jsx(motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Mn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var da={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 tm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(w=>{g.current=w;},[]),x=useCallback(w=>{let v=[],T=C=>{for(let N of C)v.push(N),N.subtasks&&N.subtasks.length>0&&N.isExpanded&&T(N.subtasks);};return T(w),v},[]),h=useCallback(()=>{let w=x(e);for(let v of w)if(t.has(v.id))return v;return null},[e,t,x]),b=useCallback((w,v)=>{let T=x(e);if(T.length===0)return;let C=h();if(!C){a(T[0].id,false);return}let N=T.findIndex(O=>O.id===C.id);if(N===-1)return;let k=w==="up"?N-1:N+1;if(k<0||k>=T.length)return;let L=T[k];a(L.id,v);},[e,h,x,a]),f=useCallback(w=>{if(!p)return;let v=w.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){w.key==="Escape"&&(v.blur(),g.current=false);return}let N=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,k=Array.from(t),L=h();if(w.key==="ArrowUp"){w.preventDefault(),b("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),b("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&m(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){k.length>0&&(w.preventDefault(),n(k,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){k.length>0&&(w.preventDefault(),i(k));return}if(w.key==="Tab"&&w.shiftKey){k.length>0&&(w.preventDefault(),c(k));return}if(w.key==="Enter"&&!w.shiftKey&&!N){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!N){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&N){L&&(w.preventDefault(),d(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),l(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&N){k.length>0&&(w.preventDefault(),o(k));return}if(w.key==="d"&&N&&!w.shiftKey){k.length>0&&(w.preventDefault(),s(k));return}},[p,t,h,b,r,o,s,n,i,c,l,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[p,f]),{setIsEditing:y}}function rm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),b=p.slice(x,h+1);t(new Set(b)),r(d);},[a,o]),i=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function kd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?kd(t.subtasks):t.subtasks}))}function Fn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function bi(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=bi(a.subtasks,t);if(r)return r}}return null}function wd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=wd(a.subtasks,t);if(r)return r}return null}function Cd(e,t){if(t.length===0)return e;let a=Fn(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let b=n(h.subtasks,g);h.subtasks=b.tasks,y.push(...b.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return kd(d)}function Td(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=wd(a,r);if(!o)continue;let s=wd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return kd(a)}function Nd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Dd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function us(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function om(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function Sd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Sd(r.subtasks,t,a)}:r)}function Ed(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ed(a.subtasks,t)}:a)}function Md(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function nm(e,t,a,r){if(t===a)return e;let o=bi(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function yi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:f,onTaskCreate:w,onTaskRename:v,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:N,onTaskReparent:k,scrollContainerRef:L,showCriticalPath:O=false}){let S=useContext(Sn),[J,R]=useState(null),[$,M]=useState(null),[q,Z]=useState(""),Re=useRef(null),[I,K]=useState(null),[be,_e]=useState(0),[z,ae]=useState(0),[Q,Me]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Le]=useState(null),[He,at]=useState(null),[te,Qe]=useState(null),ce=useRef(0),nt=5,bt=useRef(false),[Bt,ke]=useState(null),[wt,it]=useState(false),je=useRef(null),[H,ie]=useState(null),[D,j]=useState(false),le=useRef(null);useEffect(()=>{function oe(fe){le.current&&!le.current.contains(fe.target)&&j(false);}if(D)return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[D]),useEffect(()=>{$&&Re.current&&(Re.current.focus(),Re.current.select());},[$]),useEffect(()=>{if(!I)return;let oe=A=>{let _=A.clientX-be,Y=z+_;p?.(I,Y);},fe=()=>{K(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[I,be,z,p]);let{selectedTaskIds:he,handleTaskClick:G,isTaskSelected:ee}=rm(),{setIsEditing:Ue}=tm({tasks:e,selectedTaskIds:he,onTaskSelect:(oe,fe)=>{let _=Fn(e).map(Y=>Y.id);G(oe,_,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:oe=>{let fe=Fn(e).find(A=>A.id===oe);fe&&pt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:oe=>{let fe=Fn(e).find(A=>A.id===oe);fe&&C&&C(fe);},enableKeyboard:true}),Te=(oe,fe=0,A="")=>{let _=[],Y=[...oe].sort((ue,Ne)=>(ue.position??0)-(Ne.position??0));for(let ue=0;ue<Y.length;ue++){let Ne=Y[ue],Xe=ue+1,ze=A?`${A}.${Xe}`:`${Xe}.0`;if(Ne.wbsCode=ze,_.push({task:Ne,level:fe}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Be=A?`${A}.${Xe}`:`${Xe}`;_.push(...Te(Ne.subtasks,fe+1,Be));}}return _},Ae=Te(e),Ee=48,qe=Math.max(Ae.length*a,600-Ee),yt=oe=>!oe.startDate||!oe.endDate?"-":`${Math.ceil((oe.endDate.getTime()-oe.startDate.getTime())/(1e3*60*60*24))}d`,pt=oe=>{M(oe.id),Z(oe.name),Ue(true);},tt=oe=>{q.trim()&&q!==e.find(fe=>fe.id===oe)?.name&&v?.(oe,q.trim()),M(null),Z(""),Ue(false);},ot=()=>{M(null),Z(""),Ue(false);},Ot=(oe,fe)=>{fe.stopPropagation(),T?.(oe.id);},$t=(oe,fe)=>{fe.preventDefault(),ce.current=fe.clientY,Le(oe),bt.current=false,it(false),ke({x:fe.clientX,y:fe.clientY});},kt=oe=>{if(!we||(Math.abs(oe.clientY-ce.current)>nt&&!bt.current&&(bt.current=true,it(true)),ke({x:oe.clientX,y:oe.clientY}),!bt.current))return;if(L?.current){let ue=L.current,Ne=ue.getBoundingClientRect(),Xe=60,ze=12;je.current&&(cancelAnimationFrame(je.current),je.current=null);let Be=oe.clientY-Ne.top,xt=Ne.bottom-oe.clientY;if(Be<Xe&&ue.scrollTop>0){let ft=Math.round(ze*(1-Be/Xe)),_t=()=>{ue.scrollTop-=ft,bt.current&&ue.scrollTop>0&&(je.current=requestAnimationFrame(_t));};je.current=requestAnimationFrame(_t);}else if(xt<Xe&&ue.scrollTop<ue.scrollHeight-ue.clientHeight){let ft=Math.round(ze*(1-xt/Xe)),_t=()=>{ue.scrollTop+=ft,bt.current&&ue.scrollTop<ue.scrollHeight-ue.clientHeight&&(je.current=requestAnimationFrame(_t));};je.current=requestAnimationFrame(_t);}}let A=document.querySelectorAll("[data-task-row]"),_=null,Y=null;A.forEach(ue=>{let Ne=ue.getBoundingClientRect(),Xe=ue.getAttribute("data-task-row");if(Xe&&Xe!==we&&oe.clientY>=Ne.top&&oe.clientY<=Ne.bottom){_=Xe;let ze=oe.clientY-Ne.top,Be=Ne.height;ze<Be*.25?Y="above":ze>Be*.75?Y="below":Y="child";}}),at(_),Qe(Y);},Ct=()=>{if(bt.current&&we&&He&&te){if(te==="child")k?.(we,He);else if(te==="above"||te==="below"){let oe=(Y,ue,Ne=null)=>{for(let Xe of Y){if(Xe.id===ue)return Ne;if(Xe.subtasks){let ze=oe(Xe.subtasks,ue,Xe.id);if(ze!==void 0)return ze}}},fe=oe(e,we,null),A=oe(e,He,null),_=(Y,ue,Ne,Xe)=>{let ze=Y.findIndex(ft=>ft.id===ue),Be=Xe?Y.findIndex(ft=>ft.id===Ne):-1,xt=te==="below"?ze+1:ze;return Xe&&Be!==-1&&Be<ze&&(xt-=1),Math.max(0,xt)};if(A===null){let ue=_(e,He,we,fe===null);k?.(we,null,ue);}else {let Y=Ae.find(ue=>ue.task.id===A)?.task;if(Y?.subtasks){let ue=fe===A,Ne=_(Y.subtasks,He,we,ue);k?.(we,A,Ne);}}}}je.current&&(cancelAnimationFrame(je.current),je.current=null),Le(null),at(null),Qe(null),ke(null),bt.current=false,it(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",kt),document.addEventListener("mouseup",Ct),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",kt),document.removeEventListener("mouseup",Ct),document.body.style.cursor="",document.body.style.userSelect="";}},[we,He,te]);let mt=(oe,fe,A)=>{let _=fe.subtasks&&fe.subtasks.length>0;switch(oe.id){case "name":let Y=$===fe.id,ue=J===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[k&&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:ue?1:.3},onMouseDown:U=>$t(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),Y?jsx("input",{ref:Re,type:"text",value:q,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?tt(fe.id):U.key==="Escape"&&ot();},onBlur:()=>tt(fe.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",lineHeight:"1.3"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),O&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),O&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ue&&!Y&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Ot(fe,U),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:U=>{U.stopPropagation(),pt(fe);},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 Xe=oe.id==="startDate"?"startDate":"endDate",ze=fe[Xe],Be=H?.taskId===fe.id&&H?.field===Xe,xt=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!_)if(Be)ie(null);else {let ne=U.currentTarget.getBoundingClientRect();ie({taskId:fe.id,field:Xe,month:ze?typeof ze=="string"?new Date(ze):ze:new Date,position:{top:ne.bottom+4,left:ne.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:xt(ze)}),_&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Be&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:H?.position.top,left:H?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,ne=new Date(U);ne.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let P=new Date(U);return P.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:P}].map((Ve,et)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ra=>ra.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ra=>ra.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Ve.date}),ie(null);},children:Ve.label},et))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),ie(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:()=>ie(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ie(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,ne)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=H?.month||new Date,ne=U.getFullYear(),Oe=U.getMonth(),P=new Date(ne,Oe,1).getDay(),me=new Date(ne,Oe+1,0).getDate(),Ve=new Date,et=[];for(let Ht=P-1;Ht>=0;Ht--)et.push({day:new Date(ne,Oe,-Ht).getDate(),date:new Date(ne,Oe-1,new Date(ne,Oe,-Ht).getDate()),isCurrentMonth:false});for(let Ht=1;Ht<=me;Ht++)et.push({day:Ht,date:new Date(ne,Oe,Ht),isCurrentMonth:true});let ra=42-et.length;for(let Ht=1;Ht<=ra;Ht++)et.push({day:Ht,date:new Date(ne,Oe+1,Ht),isCurrentMonth:false});return et.map((Ht,fa)=>{let Ua=Ht.date.toDateString()===Ve.toDateString(),pa=(ze?typeof ze=="string"?new Date(ze):ze:null)?.toDateString()===Ht.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:Ht.isCurrentMonth?pa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:pa?"#2E94FF":"transparent",boxShadow:Ua&&!pa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:Ht.date}),ie(null);},children:Ht.day},fa)})})()})]})]})]}),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:yt(fe)})});case "assignees":if(_)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 ft=r.filter(U=>fe.assignees?.some(ne=>ne.name===U.name||ne.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(jo,{assignedUsers:ft,availableUsers:r,onChange:U=>{let ne=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(fe.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(_){let U=fe.progress===100?"\u2713":fe.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Su,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let _t={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Zt=_t[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Vo,{priority:Zt,onChange:U=>{U&&g?.(fe.id,{priority:Ta[U]||"medium"});}})});default:return null}},At=oe=>[{id:"hide",label:"Hide Column",icon:da.Hide,onClick:()=>d(oe),disabled:oe==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:da.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:da.SortDesc,onClick:()=>{}}],We=oe=>oe.subtasks&&oe.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{T?.(oe.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{f?.([oe.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{N?N(oe.id,oe.name):b?.([oe.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{n?.(oe);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{T?.(oe.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{g?.(oe.id,{status:"todo",progress:0});},disabled:oe.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{g?.(oe.id,{status:"in-progress"});},disabled:oe.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{g?.(oe.id,{status:"completed",progress:100});},disabled:oe.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{f?.([oe.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{N?N(oe.id,oe.name):b?.([oe.id]);}}],Ie=m.filter(oe=>oe.visible),gt=Ie.reduce((oe,fe)=>oe+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:gt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ee}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ie.map((oe,fe)=>{let A=fe===Ie.length-1,_=oe.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${oe.width}px`,minWidth:`${oe.minWidth??(_?200:60)}px`,maxWidth:`${oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Y=>{Y.preventDefault(),Me({isOpen:true,x:Y.clientX,y:Y.clientY,type:"header",columnId:oe.id});},onMouseEnter:Y=>{Y.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Y=>{Y.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:oe.label,children:oe.label}),oe.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:I===oe.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Y=>{Y.preventDefault(),Y.stopPropagation(),K(oe.id),_e(Y.clientX),ae(oe.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:I===oe.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},oe.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(fi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>j(!D),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"})}),D&&jsxs("div",{ref:le,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:oe=>oe.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",style:{minHeight:qe},children:Ae.map(({task:oe,level:fe},A)=>{let _=ee(oe.id),Y=He===oe.id,ue=Y&&te==="above",Ne=Y&&te==="below",Xe=Y&&te==="child",ze={};return Xe&&(ze.backgroundColor=`${t.accent}15`,ze.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":oe.id,className:`flex items-center cursor-pointer group ${we===oe.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Xe?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:O?oe.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...ze},onMouseEnter:()=>R(oe.id),onMouseLeave:()=>R(null),onClick:Be=>{let ft=Fn(e).map(Zt=>Zt.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Be.metaKey:Be.ctrlKey;G(oe.id,ft,Ta,Be.shiftKey),s?.(oe);},onDoubleClick:Be=>{Be.stopPropagation(),n?.(oe);},onContextMenu:Be=>{Be.preventDefault(),Me({isOpen:true,x:Be.clientX,y:Be.clientY,type:"task",task:oe}),i?.(oe,Be);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[ue&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ie.map((Be,xt)=>{let ft=xt===Ie.length-1,_t=Be.id==="name";return jsx("div",{className:`px-4 flex items-center ${_t?"justify-start":"justify-center"}`,style:{width:`${Be.width}px`,minWidth:`${Be.minWidth??(_t?200:60)}px`,maxWidth:`${Be.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ft?"none":`1px solid ${J===oe.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:mt(Be,oe,_t?fe:0)},`${oe.id}-${Be.id}`)})]},oe.id)})}),jsx(Mn,{isOpen:Q.isOpen,x:Q.x,y:Q.y,items:Q.type==="header"&&Q.columnId?At(Q.columnId):Q.type==="task"&&Q.task?We(Q.task):[],onClose:()=>Me({...Q,isOpen:false}),theme:t}),wt&&Bt&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Bt.x+12,top:Bt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=Ae.find(fe=>fe.task.id===we)?.task;return oe?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:oe.name})}):null})()}),document.body)]})}function cm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,b]=useState(null),[f,w]=useState(0),[v,T]=useState(0),[C,N]=useState(null),[k,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:f,setDraggedSegmentStartX:w,segmentDragOffsetX:v,setSegmentDragOffsetX:T,hoveredSegmentIndex:C,setHoveredSegmentIndex:N,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,M)=>{r("none"),d(null),g(null),i($),l(M),T(0),b(null),w(0);}}}function wi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:f=true,readOnly:w=false}){let v=cm(t,r),T=useRef(null),C=useRef(false),N=useRef(null),k=useRef(null),{dragMode:L,setDragMode:O,dragOffset:S,setDragOffset:J,ghostX:R,setGhostX:$,ghostWidth:M,setGhostWidth:q,connectionLine:Z,setConnectionLine:Re,hoveredTaskId:I,setHoveredTaskId:K,activeZone:be,setActiveZone:_e,draggedSegmentIndex:z,setDraggedSegmentIndex:ae,draggedSegmentStartX:Q,setDraggedSegmentStartX:Me,segmentDragOffsetX:we,setSegmentDragOffsetX:Le,hoveredSegmentIndex:He,setHoveredSegmentIndex:at,isHovered:te,setIsHovered:Qe,isDragging:ce,isResizing:nt,isConnecting:bt,resetDragState:Bt}=v,ke=18,wt=!!o.executionBarBg,it=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",je=wt?3:6,H=e.subtasks&&e.subtasks.length>0,ie=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let _=new Date(e.endDate);return _.setHours(0,0,0,0),_<A})()&&e.progress<100,D=f&&e.isCriticalPath,j=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=f&&e.isCriticalPath||ie?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ue=w?"default":ce?bt?"crosshair":nt?"ew-resize":"grabbing":"grab",Te=w?"default":"ew-resize",Ee=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),qe=r<50,yt=r<40;useEffect(()=>{x&&(!te||ce||e.segments)&&x(null);},[te,ce,e.segments,x]);let pt=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),tt=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},ot=A=>Math.round(A/s)*s,Ot=A=>{let _=Math.round(A/s),Y=new Date(n);return Y.setDate(Y.getDate()+_),Y},$t=(A,_)=>{for(let Y of g){if(Y.id===e.id)continue;let ue=5;if(A>=Y.x-ue&&A<=Y.x+Y.width+ue&&_>=Y.y-ue&&_<=Y.y+Y.height+ue)return Y.id}return null},kt=useCallback((A,_,Y)=>{if(w)return;A.preventDefault(),A.stopPropagation();let ue=T.current?.ownerSVGElement;if(!ue)return;let Ne=ue.createSVGPoint();Ne.x=A.clientX,Ne.y=A.clientY;let Xe=Ne.matrixTransform(ue.getScreenCTM()?.inverse()),ze=Y!==void 0?Y:t,Be=_;if(!Be){let xt=Xe.x-ze;A.shiftKey?(Be="connect",Re({x:t+r,y:a+ke/2})):A.ctrlKey||A.metaKey?Be="move":A.altKey?Be=xt<r/2?"resize-start":"resize-end":yt?xt<r/2?Be="move":Be="resize-end":qe?xt<=Ee/2?Be="resize-start":xt>=r-Ee/2?Be="resize-end":Be="move":xt<=Ee?Be="resize-start":xt>=r-Ee?Be="resize-end":Be="move";}C.current=false,O(Be),Qe(false),_e(null),Be==="move"?J(Xe.x-ze):Be==="connect"?Re({x:t+r,y:a+ke/2}):J(0),$(ze),q(r);},[t,r,a,ke,w]),Ct=useCallback(A=>{let _=T.current?.ownerSVGElement;if(!_)return;let Y=_.closest(".gantt-timeline-scroll");if(!Y)return;let ue=Y.getBoundingClientRect(),Ne=60,Xe=15,ze=0;if(A.clientX<ue.left+Ne){let Be=ue.left+Ne-A.clientX;ze=-Math.min(Xe,Be/2);}else if(A.clientX>ue.right-Ne){let Be=A.clientX-(ue.right-Ne);ze=Math.min(Xe,Be/2);}return ze!==0&&(Y.scrollLeft+=ze),ze!==0},[]),mt=useCallback(A=>{if(L==="none")return;C.current=true,k.current=A;let _=T.current?.ownerSVGElement;if(!_)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=Ct(A);Ne&&!N.current?N.current=window.setInterval(()=>{k.current&&(Ct(k.current),mt(k.current));},16):!Ne&&N.current&&(window.clearInterval(N.current),N.current=null);}let Y=_.createSVGPoint();Y.x=A.clientX,Y.y=A.clientY;let ue=Y.matrixTransform(_.getScreenCTM()?.inverse());if(L==="connect"){Re({x:ue.x,y:ue.y});let Ne=$t(ue.x,ue.y);K(Ne);}else if(L==="move"){let Ne=ue.x-S,Xe=ot(Ne);$(Xe),q(r);let ze=Math.round((Xe-t)/s);if(y?.(e.id,ze,true),e.segments&&e.segments.length>0&&z!==null){let Be=Xe-Q;Le(Be);}}else if(L==="resize-start"){let Ne=ue.x,Xe=ot(Ne),ze=t+r-Xe;ze>=s&&($(Xe),q(ze));}else if(L==="resize-end"){let Ne=ue.x,ze=ot(Ne)-t;ze>=s&&q(ze);}},[L,t,r,s,S,e,ot,z,Q,$t,K,Re,$,q,Le,y,Ct]),At=useCallback(()=>{if(N.current&&(window.clearInterval(N.current),N.current=null),k.current=null,L!=="none"){if(L==="connect")I&&p&&p(e,I),Re(null),K(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),_,Y,ue=true;if(L==="move"){if(_=Ot(R),Y=new Date(_.getTime()+A),e.segments&&e.segments.length>0&&z!==null){let Ne=Math.round(we/s),Xe=e.segments.map((ft,_t)=>{if(_t===z){let Ta=new Date(ft.startDate),Zt=new Date(ft.endDate);return Ta.setDate(Ta.getDate()+Ne),Zt.setDate(Zt.getDate()+Ne),{startDate:Ta,endDate:Zt}}return ft}),ze=Xe.flatMap(ft=>[ft.startDate,ft.endDate]),Be=new Date(Math.min(...ze.map(ft=>ft.getTime()))),xt=new Date(Math.max(...ze.map(ft=>ft.getTime())));d?.({...e,segments:Xe},Be,xt),Bt(t,r);return}}else L==="resize-start"?(_=Ot(R),Y=e.endDate,_>Y&&(console.warn("Invalid date range: start date must be before or equal to end date"),ue=false)):L==="resize-end"?(_=e.startDate,Y=Ot(R+M),Y.setDate(Y.getDate()-1),Y<_&&(console.warn("Invalid date range: end date must be after or equal to start date"),ue=false)):ue=false;ue&&_&&Y&&(Y.getTime()<_.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,_,Y));}y?.(e.id,0,false),Bt(t,r);}},[L,R,M,e,d,I,p,t,r,s,Ot,we,z,Bt,y]);useEffect(()=>{if(L==="none")return;let A=Y=>{mt(Y);},_=()=>{At();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",_),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",_),N.current&&(window.clearInterval(N.current),N.current=null);}},[L,mt,At]);let We=ce&&!bt?R:t,Ie=ce&&!bt?M:r,gt=i.taskClass(e),oe=24,fe=f?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:T,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!ce&&!C.current&&c?.(e),C.current=false;},onDoubleClick:A=>{!ce&&!C.current&&(A.stopPropagation(),l?.(e));},onContextMenu:A=>{A.preventDefault(),m?.(e,A);},onMouseEnter:()=>!ce&&Qe(true),onMouseMove:A=>{x&&te&&!ce&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ke,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{ce||(Qe(false),_e(null));},children:[jsx("rect",{x:t,y:a,width:r+oe,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),te&&!ce&&!qe&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ee,height:ke,fill:be==="resize-start"?o.accent:"transparent",opacity:be==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-start"),onMouseDown:A=>kt(A,"resize-start")}),jsx("rect",{x:t+Ee,y:a,width:r-Ee*2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:A=>kt(A,"move")}),jsx("rect",{x:t+r-Ee,y:a,width:Ee,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:A=>kt(A,"resize-end")})]}),te&&!ce&&yt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:A=>kt(A,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:A=>kt(A,"resize-end")}),te&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ce&&!bt&&!e.segments&&jsx(motion.rect,{x:R,y:a,width:M,height:ke,rx:je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!ce&&(()=>{let A=e.baselineStartDate.getTime(),_=e.baselineEndDate.getTime(),Y=n.getTime(),ue=864e5,Ne=(A-Y)/ue,Xe=(_-A)/ue,ze=Ne*s,Be=Math.max(Xe*s,s),xt=We+Ie,ft=ze+Be,_t=e.endDate?.getTime()??0,Ta=Math.ceil((_t-_)/ue),Zt=Ta>0,U=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:ze,y:a,width:Be,height:ke,rx:je,fill:"none",stroke:it?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Zt&&xt>ft&&jsx("rect",{x:ft,y:a,width:xt-ft,height:ke,rx:0,fill:"#EF4444",opacity:.2}),Zt&&jsxs("text",{x:Math.max(xt,ft)+6,y:a+ke/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),U&&jsxs("text",{x:xt+6,y:a+ke/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&wt&&H&&(()=>{let _=a+(ke-8)/2,Y=4,ue=e.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Xe=e.startDate&&Ne>=e.startDate,ze=e.endDate&&(()=>{let Zt=new Date(e.endDate);return Zt.setHours(0,0,0,0),Ne>Zt})(),Be=e.startDate&&Ne<e.startDate,xt=1;if(Xe&&e.startDate&&e.endDate&&!Be){let Zt=new Date(e.startDate);Zt.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-Zt.getTime())/(1e3*60*60*24)),P=Math.min((Ne.getTime()-Zt.getTime())/(1e3*60*60*24),ne)/ne*100;xt=P>0?ue/P:1;}let ft;ue>=100?ft="#00E5CC":Be?ft="#4B5563":ze&&ue<100?ft="#EF4444":xt>=.95?ft="#22C55E":xt>=.8?ft="#F59E0B":ft="#EF4444";let _t=Math.max(ue/100*Ie,ue>0?Y*2:0),Ta=Ie>100&&ue>0;return jsxs("g",{"data-task-class":gt,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:We,y:_,width:Ie,height:8,rx:Y,fill:"rgba(255,255,255,0.10)"}),ue>0&&jsx("rect",{x:We,y:_,width:_t,height:8,rx:Y,fill:ft}),Ta&&jsxs("text",{x:We+_t+6,y:_+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(ue),"%"]})]})})(),!e.segments&&wt&&!H&&jsx(motion.rect,{x:We,y:a,width:Ie,height:ke,rx:je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":gt,initial:{opacity:0,scale:.95},animate:{opacity:ce&&!bt?.15:e.parentId?.6:1,scale:te&&!ce?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>kt(A),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!wt&&jsx(motion.rect,{x:We,y:a,width:Ie,height:ke,rx:je,fill:ee,"data-task-class":gt,initial:{opacity:0,scale:.95},animate:{opacity:ce&&!bt?.15:e.parentId?.6:te?.9:.8,scale:te&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:A=>kt(A),style:{cursor:H?"default":Ue,pointerEvents:"all"}}),wt&&(ie||D)&&!e.segments&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsx("rect",{x:We,y:a,width:Math.max(Ie*(e.progress/100),je*2),height:ke,rx:je,fill:ee,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let A=e.progress>0?Ie*(e.progress/100):0,_=We+A,Y=Ie-A,ue=e.progress===0?je:0,Ne=e.progress===0?We:_,Xe=e.progress===0?Ie:Y;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Xe,height:ke,rx:ue,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Xe,height:ke,rx:ue,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),wt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!ce&&(()=>{let A=We+Ie*(e.progress/100),_=8,Y=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:A,cy:a+ke/2,r:_,fill:Y?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:A,y:a+ke/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Y?.initials||Y?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,_)=>{let Y=(A.startDate.getTime()-n.getTime())/864e5*s,Ne=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Y+s,Xe=ce&&L==="move"&&z===_,ze=He===_,Be=Xe?Y+we:Y;return jsxs("g",{onMouseEnter:()=>!ce&&at(_),onMouseLeave:()=>!ce&&at(null),children:[jsx(motion.rect,{x:Be,y:a,width:Ne,height:ke,rx:je,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:ze?.9:.8,scale:ze&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xt=>{xt.stopPropagation(),ae(_),Me(Y),kt(xt,void 0,Y);},style:{cursor:Ue,pointerEvents:"all"}}),jsx("rect",{x:Be,y:a,width:Ne*(e.progress/100),height:ke,rx:je,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${_}`)}),j&&(ie||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!ie&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ie>60&&!e.segments&&!(wt&&H)&&(()=>{let A=i.taskLabel(e),_=typeof A=="string"?A:e.name,Y=_.length>Math.floor(Ie/8)?`${_.substring(0,Math.floor(Ie/8))}...`:_;return jsx("text",{x:We+8,y:a+ke/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:Y})})(),!ce&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(wt?jsxs("text",{x:We+Ie+6,y:a+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ie>100?jsxs("text",{x:We+Ie-12,y:a+ke/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&&Ie>80&&!ce&&!e.segments&&!(wt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:We+Ie-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:We+Ie-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||nt)&&!bt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:We-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-start"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"resize-start");}}),jsx(motion.rect,{x:We+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-start"||L==="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:We+Ie-14,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-end"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"resize-end");}}),jsx(motion.rect,{x:We+Ie-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:te&&!ce&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>_e("connect"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:be==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),bt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ke/2,x2:Z.x,y2:Z.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(te||ce)&&!bt&&!e.segments&&jsx(motion.rect,{x:We-1,y:a-1,width:Ie+2,height:ke+2,rx:je+1,fill:"none",stroke:ce?o.accent:wt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:wt?1:2,opacity:ce||wt?.6:.4,initial:{opacity:0},animate:{opacity:ce||wt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),nt&&jsxs(Fragment,{children:[jsx("line",{x1:R,y1:0,x2:R,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:R+M,y1:0,x2:R+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:te&&!ce&&!e.segments&&!x&&(()=>{let Y=a<100,ue=Y?a+ke+13:a-82-13,Ne=Y?`M ${We+Ie/2-6} ${a+ke+3} L ${We+Ie/2} ${a+ke+13} L ${We+Ie/2+6} ${a+ke+3}`:`M ${We+Ie/2-6} ${a-13} L ${We+Ie/2} ${a-3} L ${We+Ie/2+6} ${a-13}`,Xe=ue+22,ze=ue+40,Be=ue+55,xt=ue+70,ft=Y?ue+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Y?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Y?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:We+Ie/2-120,y:ue,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:We+Ie/2,y:Xe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:We+Ie/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:We+Ie/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pt(e.startDate)}),jsx("text",{x:We+Ie/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:We+Ie/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pt(e.endDate)}),jsx("text",{x:We+Ie/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:We+Ie/2+65,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:tt()}),jsx("text",{x:We+Ie/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:We+Ie/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:We+Ie/2-110,y:xt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:We+Ie/2-50,y:xt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_t=>_t.name).join(", ").substring(0,30),e.assignees.map(_t=>_t.name).join(", ").length>30?"...":""]})]}),!Y&&jsx("text",{x:We+Ie/2,y:ft,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:yt?"Left: move \u2022 Right: resize":qe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Fd=260,Pn=8,mm=16,Nv=-12;function gm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:f,mouseX:w,mouseY:v}=e,C=f.effortMinutes!=null||f.timeLoggedMinutes!=null||f.soldEffortMinutes!=null?155:105,N=w+mm,k=v+Nv-C;N+Fd>window.innerWidth-Pn&&(N=w-Fd-mm),N<Pn&&(N=Pn);let L=k<Pn;L&&(k=v+20),k+C>window.innerHeight-Pn&&(k=window.innerHeight-Pn-C),o({left:N,top:k,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=f=>f.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let f=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${f} d\xEDa${f!==1?"s":""}`:`${f} day${f!==1?"s":""}`},m=f=>{if(f==null||f===0)return "N/A";let w=Math.floor(f/60),v=f%60;return w===0?`${v}m`:v===0?`${w}h`:`${w}h ${v}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",b=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Fd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ki,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(ki,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsx(ki,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(ki,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(f=>f.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function id({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),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 dd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await ou(e,c,x);nu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let b=await lu(h),f=h.name.endsWith(".json")?"json":"csv",w=iu(b,f);d(w),w.success&&r&&r(w,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="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:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&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:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Qy=["URGENT","HIGH","MEDIUM","LOW"],Zy=[{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"}],ex=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),b=useCallback(C=>{a({search:C.target.value});},[a]),f=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),v=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.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"}),T&&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:[d&&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"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,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:f,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:C=>{let N=C.target.value;a({priorities:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Qy.map(C=>jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let N=C.target.value;a({assignees:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let N=C.target.value;a({labels:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(C=>jsx("option",{value:C,children:C},C))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Zy.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>y(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ex.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),T&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ud({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!l),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(async()=>await i?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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 pd={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:"#2E94FF",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"}},md={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:"#2E94FF",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"}},gd={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"}},Qo={dark:pd,light:md,neutral:gd},ui="dark";var pi=createContext(void 0),cx="asakaa-theme";function Rp({children:e,defaultTheme:t=ui,storageKey:a=cx}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Qo[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${ux(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Qo};return jsx(pi.Provider,{value:n,children:e})}function Nn(){let e=useContext(pi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ux(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function fd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Nn();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Qo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Op(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:r("--theme-bg-card",ct[e].bgGrid),bgWeekend:r("--theme-bg-hover",ct[e].bgWeekend),border:r("--theme-border-primary",ct[e].border),borderLight:r("--theme-border-subtle",ct[e].borderLight),textPrimary:r("--theme-text-primary",ct[e].textPrimary),textSecondary:r("--theme-text-secondary",ct[e].textSecondary),textTertiary:r("--theme-text-tertiary",ct[e].textTertiary),accent:r("--theme-accent-primary",ct[e].accent),accentHover:r("--theme-accent-hover",ct[e].accentHover),accentLight:r("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ct[e].dependency),dependencyHover:r("--theme-border-secondary",ct[e].dependencyHover),criticalPath:r("--theme-error",ct[e].criticalPath),criticalPathLight:r("--theme-error",ct[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ct[e].today):e==="neutral"?r("--theme-text-primary",ct[e].today):r("--theme-error",ct[e].today),todayLight:e==="light"?r("--theme-accent-primary",ct[e].todayLight):e==="neutral"?r("--theme-text-primary",ct[e].todayLight):r("--theme-error",ct[e].todayLight),milestone:r("--theme-warning",ct[e].milestone),milestoneLight:r("--theme-warning",ct[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:r("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:r("--theme-success",ct[e].statusCompleted),hoverBg:r("--theme-bg-hover",ct[e].hoverBg),focusRing:r("--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 mi={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"}},$p={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"}},bd={en:mi,es:$p};function Hp(e){return bd[e]||bd.en}function hd(e,t){let a=Hp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Sn=createContext(mi);function Br(){return useContext(Sn)}function ds(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Yp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=useState(false),[l,m]=useState(null),d=useRef(null),p=useRef(null),g=Br(),y=ds(d,i,"right",176);if(useEffect(()=>{if(!i)return;let f=w=>{let v=w.target;d.current&&!d.current.contains(v)&&p.current&&!p.current.contains(v)&&c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(f=>f.handler),b=async(f,w)=>{if(w){m(f);try{await w();}catch(v){console.error(`Export ${f} failed:`,v);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(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-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.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:h.map((f,w)=>jsxs(motion.button,{onClick:()=>b(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.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:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.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"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})}),document.body)]})}function Up({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Br(),x=ds(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let T=C=>{let N=C.target;p.current&&!p.current.contains(N)&&g.current&&!g.current.contains(N)&&i(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[n]);let f=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(T=>T.handler),w=async(T,C)=>{if(C){l(T);try{await C();}catch(N){console.error(`Export ${T} failed:`,N);}finally{l(null),i(false);}}},v=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,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: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:[f.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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:f.map((T,C)=>jsxs(motion.button,{onClick:()=>w(T.id,T.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 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:C*.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:c===T.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"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),f.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"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:v,className:"w-full flex items-center gap-2.5 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:f.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ix({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Bx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Wp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Br(),l=ds(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:i,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:l.top,left:l.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:m.map((p,g)=>{let y=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function Gp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Br(),m=ds(i,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=b=>{let f=b.target;i.current&&!i.current.contains(f)&&c.current&&!c.current.contains(f)&&n(false);},h=b=>{b.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":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:l.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(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-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Rx({value:e,onChange:t,theme:a}){let r=Br(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Ox({theme:e,forecast:t}){let a=Br(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#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||(r?"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:a.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:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),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:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"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:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&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:h})]})]})]})}function $x({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),b=ds(y,p,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let C=N=>{let k=N.target;y.current&&!y.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);let w=h.toolbar.visibility==="Visibilidad",v=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],T=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:y,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&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:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:v.map((C,N)=>{let k=C.icon,L=C.disabled,O=C.tooltip;return jsxs(motion.button,{onClick:()=>!L&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:L?f?"rgba(255,255,255,0.3)":"#9CA3AF":f?"rgba(255,255,255,0.85)":"#111827",cursor:L?"not-allowed":"pointer"},whileHover:L?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:N*.03},title:O,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:L?f?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!L&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((C,N)=>{let k=l===C.value;return jsxs(motion.button,{onClick:()=>m(C.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(v.length+N)*.03},children:[jsx("span",{style:{color:k?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function gi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:f,onWbsLevelChange:w,maxWbsDepth:v=4,viewMode:T="execution",onViewModeChange:C,projectForecast:N,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportCSV:S,onExportJSON:J,onExportMSProject:R,showCriticalPath:$=true,onShowCriticalPathChange:M,showDependencies:q=true,onShowDependenciesChange:Z,highlightWeekends:Re=true,onHighlightWeekendsChange:I,showBaseline:K=false,onShowBaselineChange:be,onCopySnapshotLink:_e,hasDependencies:z=true}){let ae=Br(),Q=k||L||O||S||J||R,Me=!!e.glassToolbar,[we,Le]=useState(false),He=useRef(null);useEffect(()=>{we&&He.current&&He.current.focus();},[we]);let at=[{value:"day",label:ae.toolbar.day},{value:"week",label:ae.toolbar.week},{value:"month",label:ae.toolbar.month}],te=[{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(Me){let ce=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:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Qe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Le(!we),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),we&&jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Le(false),onKeyDown:nt=>{nt.key==="Escape"&&Le(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),C&&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:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:ae.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?Qe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:T==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:ae.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Rx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),w&&jsx(Wp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsx(Gp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ce}}),jsx($x,{theme:e,showCriticalPath:$,onShowCriticalPathChange:M,showBaseline:K,onShowBaselineChange:be,highlightWeekends:Re,onHighlightWeekendsChange:I,showDependencies:q,onShowDependenciesChange:Z,rowDensity:i,onRowDensityChange:c,hasDependencies:z}),jsx(Up,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportMSProject:R,onCopySnapshotLink:_e}),m&&p&&jsxs(motion.button,{onClick:p,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(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||ae.toolbar.createTask})]})]})]}),N&&jsx(Ox,{theme:e,forecast:N})]})}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(Bx,{options:at,value:t,onChange:ce=>a(ce),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(Wp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Gp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),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}})]}),m&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||ae.toolbar.createTask})]}),(Q||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Up,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:O,onExportMSProject:R,onCopySnapshotLink:_e}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Ix,{options:te,value:s,onChange:ce=>n(ce),theme:e})]})]})}function fi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Kt,{children:jsx(motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Mn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var da={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 tm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(w=>{g.current=w;},[]),x=useCallback(w=>{let v=[],T=C=>{for(let N of C)v.push(N),N.subtasks&&N.subtasks.length>0&&N.isExpanded&&T(N.subtasks);};return T(w),v},[]),h=useCallback(()=>{let w=x(e);for(let v of w)if(t.has(v.id))return v;return null},[e,t,x]),b=useCallback((w,v)=>{let T=x(e);if(T.length===0)return;let C=h();if(!C){a(T[0].id,false);return}let N=T.findIndex(O=>O.id===C.id);if(N===-1)return;let k=w==="up"?N-1:N+1;if(k<0||k>=T.length)return;let L=T[k];a(L.id,v);},[e,h,x,a]),f=useCallback(w=>{if(!p)return;let v=w.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){w.key==="Escape"&&(v.blur(),g.current=false);return}let N=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,k=Array.from(t),L=h();if(w.key==="ArrowUp"){w.preventDefault(),b("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),b("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&m(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){k.length>0&&(w.preventDefault(),n(k,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){k.length>0&&(w.preventDefault(),i(k));return}if(w.key==="Tab"&&w.shiftKey){k.length>0&&(w.preventDefault(),c(k));return}if(w.key==="Enter"&&!w.shiftKey&&!N){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!N){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&N){L&&(w.preventDefault(),d(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),l(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&N){k.length>0&&(w.preventDefault(),o(k));return}if(w.key==="d"&&N&&!w.shiftKey){k.length>0&&(w.preventDefault(),s(k));return}},[p,t,h,b,r,o,s,n,i,c,l,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[p,f]),{setIsEditing:y}}function rm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),b=p.slice(x,h+1);t(new Set(b)),r(d);},[a,o]),i=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function kd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?kd(t.subtasks):t.subtasks}))}function Fn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function bi(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=bi(a.subtasks,t);if(r)return r}}return null}function wd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=wd(a.subtasks,t);if(r)return r}return null}function Cd(e,t){if(t.length===0)return e;let a=Fn(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let b=n(h.subtasks,g);h.subtasks=b.tasks,y.push(...b.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return kd(d)}function Td(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=wd(a,r);if(!o)continue;let s=wd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return kd(a)}function Nd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Dd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function us(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function om(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function Sd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Sd(r.subtasks,t,a)}:r)}function Ed(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ed(a.subtasks,t)}:a)}function Md(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function nm(e,t,a,r){if(t===a)return e;let o=bi(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function yi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:f,onTaskCreate:w,onTaskRename:v,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:N,onTaskReparent:k,scrollContainerRef:L,showCriticalPath:O=false}){let S=useContext(Sn),[J,R]=useState(null),[$,M]=useState(null),[q,Z]=useState(""),Re=useRef(null),[I,K]=useState(null),[be,_e]=useState(0),[z,ae]=useState(0),[Q,Me]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Le]=useState(null),[He,at]=useState(null),[te,Qe]=useState(null),ce=useRef(0),nt=5,bt=useRef(false),[Bt,ke]=useState(null),[wt,it]=useState(false),je=useRef(null),[H,ie]=useState(null),[D,j]=useState(false),le=useRef(null);useEffect(()=>{function oe(fe){le.current&&!le.current.contains(fe.target)&&j(false);}if(D)return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[D]),useEffect(()=>{$&&Re.current&&(Re.current.focus(),Re.current.select());},[$]),useEffect(()=>{if(!I)return;let oe=A=>{let _=A.clientX-be,Y=z+_;p?.(I,Y);},fe=()=>{K(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[I,be,z,p]);let{selectedTaskIds:he,handleTaskClick:G,isTaskSelected:ee}=rm(),{setIsEditing:Ue}=tm({tasks:e,selectedTaskIds:he,onTaskSelect:(oe,fe)=>{let _=Fn(e).map(Y=>Y.id);G(oe,_,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:oe=>{let fe=Fn(e).find(A=>A.id===oe);fe&&pt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:oe=>{let fe=Fn(e).find(A=>A.id===oe);fe&&C&&C(fe);},enableKeyboard:true}),Te=(oe,fe=0,A="")=>{let _=[],Y=[...oe].sort((ue,Ne)=>(ue.position??0)-(Ne.position??0));for(let ue=0;ue<Y.length;ue++){let Ne=Y[ue],Xe=ue+1,ze=A?`${A}.${Xe}`:`${Xe}.0`;if(Ne.wbsCode=ze,_.push({task:Ne,level:fe}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Be=A?`${A}.${Xe}`:`${Xe}`;_.push(...Te(Ne.subtasks,fe+1,Be));}}return _},Ae=Te(e),Ee=48,qe=Math.max(Ae.length*a,600-Ee),yt=oe=>!oe.startDate||!oe.endDate?"-":`${Math.ceil((oe.endDate.getTime()-oe.startDate.getTime())/(1e3*60*60*24))}d`,pt=oe=>{M(oe.id),Z(oe.name),Ue(true);},tt=oe=>{q.trim()&&q!==e.find(fe=>fe.id===oe)?.name&&v?.(oe,q.trim()),M(null),Z(""),Ue(false);},ot=()=>{M(null),Z(""),Ue(false);},Ot=(oe,fe)=>{fe.stopPropagation(),T?.(oe.id);},$t=(oe,fe)=>{fe.preventDefault(),ce.current=fe.clientY,Le(oe),bt.current=false,it(false),ke({x:fe.clientX,y:fe.clientY});},kt=oe=>{if(!we||(Math.abs(oe.clientY-ce.current)>nt&&!bt.current&&(bt.current=true,it(true)),ke({x:oe.clientX,y:oe.clientY}),!bt.current))return;if(L?.current){let ue=L.current,Ne=ue.getBoundingClientRect(),Xe=60,ze=12;je.current&&(cancelAnimationFrame(je.current),je.current=null);let Be=oe.clientY-Ne.top,xt=Ne.bottom-oe.clientY;if(Be<Xe&&ue.scrollTop>0){let ft=Math.round(ze*(1-Be/Xe)),_t=()=>{ue.scrollTop-=ft,bt.current&&ue.scrollTop>0&&(je.current=requestAnimationFrame(_t));};je.current=requestAnimationFrame(_t);}else if(xt<Xe&&ue.scrollTop<ue.scrollHeight-ue.clientHeight){let ft=Math.round(ze*(1-xt/Xe)),_t=()=>{ue.scrollTop+=ft,bt.current&&ue.scrollTop<ue.scrollHeight-ue.clientHeight&&(je.current=requestAnimationFrame(_t));};je.current=requestAnimationFrame(_t);}}let A=document.querySelectorAll("[data-task-row]"),_=null,Y=null;A.forEach(ue=>{let Ne=ue.getBoundingClientRect(),Xe=ue.getAttribute("data-task-row");if(Xe&&Xe!==we&&oe.clientY>=Ne.top&&oe.clientY<=Ne.bottom){_=Xe;let ze=oe.clientY-Ne.top,Be=Ne.height;ze<Be*.25?Y="above":ze>Be*.75?Y="below":Y="child";}}),at(_),Qe(Y);},Ct=()=>{if(bt.current&&we&&He&&te){if(te==="child")k?.(we,He);else if(te==="above"||te==="below"){let oe=(Y,ue,Ne=null)=>{for(let Xe of Y){if(Xe.id===ue)return Ne;if(Xe.subtasks){let ze=oe(Xe.subtasks,ue,Xe.id);if(ze!==void 0)return ze}}},fe=oe(e,we,null),A=oe(e,He,null),_=(Y,ue,Ne,Xe)=>{let ze=Y.findIndex(ft=>ft.id===ue),Be=Xe?Y.findIndex(ft=>ft.id===Ne):-1,xt=te==="below"?ze+1:ze;return Xe&&Be!==-1&&Be<ze&&(xt-=1),Math.max(0,xt)};if(A===null){let ue=_(e,He,we,fe===null);k?.(we,null,ue);}else {let Y=Ae.find(ue=>ue.task.id===A)?.task;if(Y?.subtasks){let ue=fe===A,Ne=_(Y.subtasks,He,we,ue);k?.(we,A,Ne);}}}}je.current&&(cancelAnimationFrame(je.current),je.current=null),Le(null),at(null),Qe(null),ke(null),bt.current=false,it(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",kt),document.addEventListener("mouseup",Ct),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",kt),document.removeEventListener("mouseup",Ct),document.body.style.cursor="",document.body.style.userSelect="";}},[we,He,te]);let mt=(oe,fe,A)=>{let _=fe.subtasks&&fe.subtasks.length>0;switch(oe.id){case "name":let Y=$===fe.id,ue=J===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[k&&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:ue?1:.3},onMouseDown:U=>$t(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),Y?jsx("input",{ref:Re,type:"text",value:q,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?tt(fe.id):U.key==="Escape"&&ot();},onBlur:()=>tt(fe.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"flex",alignItems:"baseline",gap:"6px",minWidth:0,color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",lineHeight:"1.3"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),O&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),O&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ue&&!Y&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Ot(fe,U),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:U=>{U.stopPropagation(),pt(fe);},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 Xe=oe.id==="startDate"?"startDate":"endDate",ze=fe[Xe],Be=H?.taskId===fe.id&&H?.field===Xe,xt=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!_)if(Be)ie(null);else {let ne=U.currentTarget.getBoundingClientRect();ie({taskId:fe.id,field:Xe,month:ze?typeof ze=="string"?new Date(ze):ze:new Date,position:{top:ne.bottom+4,left:ne.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:xt(ze)}),_&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Be&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:H?.position.top,left:H?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,ne=new Date(U);ne.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let P=new Date(U);return P.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:P}].map((Ve,et)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ra=>ra.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ra=>ra.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Ve.date}),ie(null);},children:Ve.label},et))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),ie(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:()=>ie(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ie(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,ne)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=H?.month||new Date,ne=U.getFullYear(),Oe=U.getMonth(),P=new Date(ne,Oe,1).getDay(),me=new Date(ne,Oe+1,0).getDate(),Ve=new Date,et=[];for(let Ht=P-1;Ht>=0;Ht--)et.push({day:new Date(ne,Oe,-Ht).getDate(),date:new Date(ne,Oe-1,new Date(ne,Oe,-Ht).getDate()),isCurrentMonth:false});for(let Ht=1;Ht<=me;Ht++)et.push({day:Ht,date:new Date(ne,Oe,Ht),isCurrentMonth:true});let ra=42-et.length;for(let Ht=1;Ht<=ra;Ht++)et.push({day:Ht,date:new Date(ne,Oe+1,Ht),isCurrentMonth:false});return et.map((Ht,fa)=>{let Ua=Ht.date.toDateString()===Ve.toDateString(),pa=(ze?typeof ze=="string"?new Date(ze):ze:null)?.toDateString()===Ht.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:Ht.isCurrentMonth?pa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:pa?"#2E94FF":"transparent",boxShadow:Ua&&!pa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:Ht.date}),ie(null);},children:Ht.day},fa)})})()})]})]})]}),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:yt(fe)})});case "assignees":if(_)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 ft=r.filter(U=>fe.assignees?.some(ne=>ne.name===U.name||ne.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(jo,{assignedUsers:ft,availableUsers:r,onChange:U=>{let ne=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(fe.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(_){let U=fe.progress===100?"\u2713":fe.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Su,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let _t={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Zt=_t[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Vo,{priority:Zt,onChange:U=>{U&&g?.(fe.id,{priority:Ta[U]||"medium"});}})});default:return null}},At=oe=>[{id:"hide",label:"Hide Column",icon:da.Hide,onClick:()=>d(oe),disabled:oe==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:da.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:da.SortDesc,onClick:()=>{}}],We=oe=>oe.subtasks&&oe.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{T?.(oe.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{f?.([oe.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{N?N(oe.id,oe.name):b?.([oe.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{n?.(oe);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{T?.(oe.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{g?.(oe.id,{status:"todo",progress:0});},disabled:oe.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{g?.(oe.id,{status:"in-progress"});},disabled:oe.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{g?.(oe.id,{status:"completed",progress:100});},disabled:oe.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{f?.([oe.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{N?N(oe.id,oe.name):b?.([oe.id]);}}],Ie=m.filter(oe=>oe.visible),gt=Ie.reduce((oe,fe)=>oe+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:gt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ee}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ie.map((oe,fe)=>{let A=fe===Ie.length-1,_=oe.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${oe.width}px`,minWidth:`${oe.minWidth??(_?200:60)}px`,maxWidth:`${oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Y=>{Y.preventDefault(),Me({isOpen:true,x:Y.clientX,y:Y.clientY,type:"header",columnId:oe.id});},onMouseEnter:Y=>{Y.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Y=>{Y.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:oe.label,children:oe.label}),oe.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:I===oe.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Y=>{Y.preventDefault(),Y.stopPropagation(),K(oe.id),_e(Y.clientX),ae(oe.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:I===oe.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},oe.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(fi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>j(!D),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"})}),D&&jsxs("div",{ref:le,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:oe=>oe.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",style:{minHeight:qe},children:Ae.map(({task:oe,level:fe},A)=>{let _=ee(oe.id),Y=He===oe.id,ue=Y&&te==="above",Ne=Y&&te==="below",Xe=Y&&te==="child",ze={};return Xe&&(ze.backgroundColor=`${t.accent}15`,ze.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":oe.id,className:`flex items-center cursor-pointer group ${we===oe.id?"opacity-50":""}`,style:{position:"relative",minHeight:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Xe?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:O?oe.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...ze},onMouseEnter:()=>R(oe.id),onMouseLeave:()=>R(null),onClick:Be=>{let ft=Fn(e).map(Zt=>Zt.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Be.metaKey:Be.ctrlKey;G(oe.id,ft,Ta,Be.shiftKey),s?.(oe);},onDoubleClick:Be=>{Be.stopPropagation(),n?.(oe);},onContextMenu:Be=>{Be.preventDefault(),Me({isOpen:true,x:Be.clientX,y:Be.clientY,type:"task",task:oe}),i?.(oe,Be);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[ue&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ie.map((Be,xt)=>{let ft=xt===Ie.length-1,_t=Be.id==="name";return jsx("div",{className:`px-4 flex items-center ${_t?"justify-start":"justify-center"}`,style:{width:`${Be.width}px`,minWidth:`${Be.minWidth??(_t?200:60)}px`,maxWidth:`${Be.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ft?"none":`1px solid ${J===oe.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:_t?"visible":"hidden"},children:mt(Be,oe,_t?fe:0)},`${oe.id}-${Be.id}`)})]},oe.id)})}),jsx(Mn,{isOpen:Q.isOpen,x:Q.x,y:Q.y,items:Q.type==="header"&&Q.columnId?At(Q.columnId):Q.type==="task"&&Q.task?We(Q.task):[],onClose:()=>Me({...Q,isOpen:false}),theme:t}),wt&&Bt&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Bt.x+12,top:Bt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=Ae.find(fe=>fe.task.id===we)?.task;return oe?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:oe.name})}):null})()}),document.body)]})}function cm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,b]=useState(null),[f,w]=useState(0),[v,T]=useState(0),[C,N]=useState(null),[k,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:f,setDraggedSegmentStartX:w,segmentDragOffsetX:v,setSegmentDragOffsetX:T,hoveredSegmentIndex:C,setHoveredSegmentIndex:N,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,M)=>{r("none"),d(null),g(null),i($),l(M),T(0),b(null),w(0);}}}function wi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:f=true,readOnly:w=false}){let v=cm(t,r),T=useRef(null),C=useRef(false),N=useRef(null),k=useRef(null),{dragMode:L,setDragMode:O,dragOffset:S,setDragOffset:J,ghostX:R,setGhostX:$,ghostWidth:M,setGhostWidth:q,connectionLine:Z,setConnectionLine:Re,hoveredTaskId:I,setHoveredTaskId:K,activeZone:be,setActiveZone:_e,draggedSegmentIndex:z,setDraggedSegmentIndex:ae,draggedSegmentStartX:Q,setDraggedSegmentStartX:Me,segmentDragOffsetX:we,setSegmentDragOffsetX:Le,hoveredSegmentIndex:He,setHoveredSegmentIndex:at,isHovered:te,setIsHovered:Qe,isDragging:ce,isResizing:nt,isConnecting:bt,resetDragState:Bt}=v,ke=18,wt=!!o.executionBarBg,it=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",je=wt?3:6,H=e.subtasks&&e.subtasks.length>0,ie=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let _=new Date(e.endDate);return _.setHours(0,0,0,0),_<A})()&&e.progress<100,D=f&&e.isCriticalPath,j=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=f&&e.isCriticalPath||ie?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ue=w?"default":ce?bt?"crosshair":nt?"ew-resize":"grabbing":"grab",Te=w?"default":"ew-resize",Ee=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),qe=r<50,yt=r<40;useEffect(()=>{x&&(!te||ce||e.segments)&&x(null);},[te,ce,e.segments,x]);let pt=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),tt=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},ot=A=>Math.round(A/s)*s,Ot=A=>{let _=Math.round(A/s),Y=new Date(n);return Y.setDate(Y.getDate()+_),Y},$t=(A,_)=>{for(let Y of g){if(Y.id===e.id)continue;let ue=5;if(A>=Y.x-ue&&A<=Y.x+Y.width+ue&&_>=Y.y-ue&&_<=Y.y+Y.height+ue)return Y.id}return null},kt=useCallback((A,_,Y)=>{if(w)return;A.preventDefault(),A.stopPropagation();let ue=T.current?.ownerSVGElement;if(!ue)return;let Ne=ue.createSVGPoint();Ne.x=A.clientX,Ne.y=A.clientY;let Xe=Ne.matrixTransform(ue.getScreenCTM()?.inverse()),ze=Y!==void 0?Y:t,Be=_;if(!Be){let xt=Xe.x-ze;A.shiftKey?(Be="connect",Re({x:t+r,y:a+ke/2})):A.ctrlKey||A.metaKey?Be="move":A.altKey?Be=xt<r/2?"resize-start":"resize-end":yt?xt<r/2?Be="move":Be="resize-end":qe?xt<=Ee/2?Be="resize-start":xt>=r-Ee/2?Be="resize-end":Be="move":xt<=Ee?Be="resize-start":xt>=r-Ee?Be="resize-end":Be="move";}C.current=false,O(Be),Qe(false),_e(null),Be==="move"?J(Xe.x-ze):Be==="connect"?Re({x:t+r,y:a+ke/2}):J(0),$(ze),q(r);},[t,r,a,ke,w]),Ct=useCallback(A=>{let _=T.current?.ownerSVGElement;if(!_)return;let Y=_.closest(".gantt-timeline-scroll");if(!Y)return;let ue=Y.getBoundingClientRect(),Ne=60,Xe=15,ze=0;if(A.clientX<ue.left+Ne){let Be=ue.left+Ne-A.clientX;ze=-Math.min(Xe,Be/2);}else if(A.clientX>ue.right-Ne){let Be=A.clientX-(ue.right-Ne);ze=Math.min(Xe,Be/2);}return ze!==0&&(Y.scrollLeft+=ze),ze!==0},[]),mt=useCallback(A=>{if(L==="none")return;C.current=true,k.current=A;let _=T.current?.ownerSVGElement;if(!_)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=Ct(A);Ne&&!N.current?N.current=window.setInterval(()=>{k.current&&(Ct(k.current),mt(k.current));},16):!Ne&&N.current&&(window.clearInterval(N.current),N.current=null);}let Y=_.createSVGPoint();Y.x=A.clientX,Y.y=A.clientY;let ue=Y.matrixTransform(_.getScreenCTM()?.inverse());if(L==="connect"){Re({x:ue.x,y:ue.y});let Ne=$t(ue.x,ue.y);K(Ne);}else if(L==="move"){let Ne=ue.x-S,Xe=ot(Ne);$(Xe),q(r);let ze=Math.round((Xe-t)/s);if(y?.(e.id,ze,true),e.segments&&e.segments.length>0&&z!==null){let Be=Xe-Q;Le(Be);}}else if(L==="resize-start"){let Ne=ue.x,Xe=ot(Ne),ze=t+r-Xe;ze>=s&&($(Xe),q(ze));}else if(L==="resize-end"){let Ne=ue.x,ze=ot(Ne)-t;ze>=s&&q(ze);}},[L,t,r,s,S,e,ot,z,Q,$t,K,Re,$,q,Le,y,Ct]),At=useCallback(()=>{if(N.current&&(window.clearInterval(N.current),N.current=null),k.current=null,L!=="none"){if(L==="connect")I&&p&&p(e,I),Re(null),K(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),_,Y,ue=true;if(L==="move"){if(_=Ot(R),Y=new Date(_.getTime()+A),e.segments&&e.segments.length>0&&z!==null){let Ne=Math.round(we/s),Xe=e.segments.map((ft,_t)=>{if(_t===z){let Ta=new Date(ft.startDate),Zt=new Date(ft.endDate);return Ta.setDate(Ta.getDate()+Ne),Zt.setDate(Zt.getDate()+Ne),{startDate:Ta,endDate:Zt}}return ft}),ze=Xe.flatMap(ft=>[ft.startDate,ft.endDate]),Be=new Date(Math.min(...ze.map(ft=>ft.getTime()))),xt=new Date(Math.max(...ze.map(ft=>ft.getTime())));d?.({...e,segments:Xe},Be,xt),Bt(t,r);return}}else L==="resize-start"?(_=Ot(R),Y=e.endDate,_>Y&&(console.warn("Invalid date range: start date must be before or equal to end date"),ue=false)):L==="resize-end"?(_=e.startDate,Y=Ot(R+M),Y.setDate(Y.getDate()-1),Y<_&&(console.warn("Invalid date range: end date must be after or equal to start date"),ue=false)):ue=false;ue&&_&&Y&&(Y.getTime()<_.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,_,Y));}y?.(e.id,0,false),Bt(t,r);}},[L,R,M,e,d,I,p,t,r,s,Ot,we,z,Bt,y]);useEffect(()=>{if(L==="none")return;let A=Y=>{mt(Y);},_=()=>{At();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",_),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",_),N.current&&(window.clearInterval(N.current),N.current=null);}},[L,mt,At]);let We=ce&&!bt?R:t,Ie=ce&&!bt?M:r,gt=i.taskClass(e),oe=24,fe=f?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:T,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!ce&&!C.current&&c?.(e),C.current=false;},onDoubleClick:A=>{!ce&&!C.current&&(A.stopPropagation(),l?.(e));},onContextMenu:A=>{A.preventDefault(),m?.(e,A);},onMouseEnter:()=>!ce&&Qe(true),onMouseMove:A=>{x&&te&&!ce&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ke,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{ce||(Qe(false),_e(null));},children:[jsx("rect",{x:t,y:a,width:r+oe,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),te&&!ce&&!qe&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ee,height:ke,fill:be==="resize-start"?o.accent:"transparent",opacity:be==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-start"),onMouseDown:A=>kt(A,"resize-start")}),jsx("rect",{x:t+Ee,y:a,width:r-Ee*2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:A=>kt(A,"move")}),jsx("rect",{x:t+r-Ee,y:a,width:Ee,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:A=>kt(A,"resize-end")})]}),te&&!ce&&yt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>_e("move"),onMouseDown:A=>kt(A,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>_e("resize-end"),onMouseDown:A=>kt(A,"resize-end")}),te&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ce&&!bt&&!e.segments&&jsx(motion.rect,{x:R,y:a,width:M,height:ke,rx:je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!ce&&(()=>{let A=e.baselineStartDate.getTime(),_=e.baselineEndDate.getTime(),Y=n.getTime(),ue=864e5,Ne=(A-Y)/ue,Xe=(_-A)/ue,ze=Ne*s,Be=Math.max(Xe*s,s),xt=We+Ie,ft=ze+Be,_t=e.endDate?.getTime()??0,Ta=Math.ceil((_t-_)/ue),Zt=Ta>0,U=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:ze,y:a,width:Be,height:ke,rx:je,fill:"none",stroke:it?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Zt&&xt>ft&&jsx("rect",{x:ft,y:a,width:xt-ft,height:ke,rx:0,fill:"#EF4444",opacity:.2}),Zt&&jsxs("text",{x:Math.max(xt,ft)+6,y:a+ke/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),U&&jsxs("text",{x:xt+6,y:a+ke/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&wt&&H&&(()=>{let _=a+(ke-8)/2,Y=4,ue=e.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Xe=e.startDate&&Ne>=e.startDate,ze=e.endDate&&(()=>{let Zt=new Date(e.endDate);return Zt.setHours(0,0,0,0),Ne>Zt})(),Be=e.startDate&&Ne<e.startDate,xt=1;if(Xe&&e.startDate&&e.endDate&&!Be){let Zt=new Date(e.startDate);Zt.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-Zt.getTime())/(1e3*60*60*24)),P=Math.min((Ne.getTime()-Zt.getTime())/(1e3*60*60*24),ne)/ne*100;xt=P>0?ue/P:1;}let ft;ue>=100?ft="#00E5CC":Be?ft="#4B5563":ze&&ue<100?ft="#EF4444":xt>=.95?ft="#22C55E":xt>=.8?ft="#F59E0B":ft="#EF4444";let _t=Math.max(ue/100*Ie,ue>0?Y*2:0),Ta=Ie>100&&ue>0;return jsxs("g",{"data-task-class":gt,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:We,y:_,width:Ie,height:8,rx:Y,fill:"rgba(255,255,255,0.10)"}),ue>0&&jsx("rect",{x:We,y:_,width:_t,height:8,rx:Y,fill:ft}),Ta&&jsxs("text",{x:We+_t+6,y:_+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(ue),"%"]})]})})(),!e.segments&&wt&&!H&&jsx(motion.rect,{x:We,y:a,width:Ie,height:ke,rx:je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":gt,initial:{opacity:0,scale:.95},animate:{opacity:ce&&!bt?.15:e.parentId?.6:1,scale:te&&!ce?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>kt(A),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!wt&&jsx(motion.rect,{x:We,y:a,width:Ie,height:ke,rx:je,fill:ee,"data-task-class":gt,initial:{opacity:0,scale:.95},animate:{opacity:ce&&!bt?.15:e.parentId?.6:te?.9:.8,scale:te&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:A=>kt(A),style:{cursor:H?"default":Ue,pointerEvents:"all"}}),wt&&(ie||D)&&!e.segments&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsx("rect",{x:We,y:a,width:Math.max(Ie*(e.progress/100),je*2),height:ke,rx:je,fill:ee,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let A=e.progress>0?Ie*(e.progress/100):0,_=We+A,Y=Ie-A,ue=e.progress===0?je:0,Ne=e.progress===0?We:_,Xe=e.progress===0?Ie:Y;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Xe,height:ke,rx:ue,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Xe,height:ke,rx:ue,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),wt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!ce&&(()=>{let A=We+Ie*(e.progress/100),_=8,Y=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:A,cy:a+ke/2,r:_,fill:Y?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:A,y:a+ke/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Y?.initials||Y?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,_)=>{let Y=(A.startDate.getTime()-n.getTime())/864e5*s,Ne=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Y+s,Xe=ce&&L==="move"&&z===_,ze=He===_,Be=Xe?Y+we:Y;return jsxs("g",{onMouseEnter:()=>!ce&&at(_),onMouseLeave:()=>!ce&&at(null),children:[jsx(motion.rect,{x:Be,y:a,width:Ne,height:ke,rx:je,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:ze?.9:.8,scale:ze&&!ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xt=>{xt.stopPropagation(),ae(_),Me(Y),kt(xt,void 0,Y);},style:{cursor:Ue,pointerEvents:"all"}}),jsx("rect",{x:Be,y:a,width:Ne*(e.progress/100),height:ke,rx:je,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${_}`)}),j&&(ie||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!ie&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsx("rect",{x:We,y:a,width:Ie,height:ke,rx:je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ie>60&&!e.segments&&!(wt&&H)&&(()=>{let A=i.taskLabel(e),_=typeof A=="string"?A:e.name,Y=_.length>Math.floor(Ie/8)?`${_.substring(0,Math.floor(Ie/8))}...`:_;return jsx("text",{x:We+8,y:a+ke/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:Y})})(),!ce&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(wt?jsxs("text",{x:We+Ie+6,y:a+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ie>100?jsxs("text",{x:We+Ie-12,y:a+ke/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&&Ie>80&&!ce&&!e.segments&&!(wt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:We+Ie-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:We+Ie-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||nt)&&!bt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:We-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-start"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"resize-start");}}),jsx(motion.rect,{x:We+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-start"||L==="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:We+Ie-14,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>_e("resize-end"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"resize-end");}}),jsx(motion.rect,{x:We+Ie-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:te&&!ce&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>_e("connect"),onMouseLeave:()=>_e(null),onMouseDown:A=>{A.stopPropagation(),kt(A,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:be==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),bt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ke/2,x2:Z.x,y2:Z.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(te||ce)&&!bt&&!e.segments&&jsx(motion.rect,{x:We-1,y:a-1,width:Ie+2,height:ke+2,rx:je+1,fill:"none",stroke:ce?o.accent:wt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:wt?1:2,opacity:ce||wt?.6:.4,initial:{opacity:0},animate:{opacity:ce||wt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),nt&&jsxs(Fragment,{children:[jsx("line",{x1:R,y1:0,x2:R,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:R+M,y1:0,x2:R+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:te&&!ce&&!e.segments&&!x&&(()=>{let Y=a<100,ue=Y?a+ke+13:a-82-13,Ne=Y?`M ${We+Ie/2-6} ${a+ke+3} L ${We+Ie/2} ${a+ke+13} L ${We+Ie/2+6} ${a+ke+3}`:`M ${We+Ie/2-6} ${a-13} L ${We+Ie/2} ${a-3} L ${We+Ie/2+6} ${a-13}`,Xe=ue+22,ze=ue+40,Be=ue+55,xt=ue+70,ft=Y?ue+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Y?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Y?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:We+Ie/2-120,y:ue,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:We+Ie/2,y:Xe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:We+Ie/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:We+Ie/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pt(e.startDate)}),jsx("text",{x:We+Ie/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:We+Ie/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pt(e.endDate)}),jsx("text",{x:We+Ie/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:We+Ie/2+65,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:tt()}),jsx("text",{x:We+Ie/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:We+Ie/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:We+Ie/2-110,y:xt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:We+Ie/2-50,y:xt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_t=>_t.name).join(", ").substring(0,30),e.assignees.map(_t=>_t.name).join(", ").length>30?"...":""]})]}),!Y&&jsx("text",{x:We+Ie/2,y:ft,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:yt?"Left: move \u2022 Right: resize":qe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Fd=260,Pn=8,mm=16,Nv=-12;function gm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:f,mouseX:w,mouseY:v}=e,C=f.effortMinutes!=null||f.timeLoggedMinutes!=null||f.soldEffortMinutes!=null?155:105,N=w+mm,k=v+Nv-C;N+Fd>window.innerWidth-Pn&&(N=w-Fd-mm),N<Pn&&(N=Pn);let L=k<Pn;L&&(k=v+20),k+C>window.innerHeight-Pn&&(k=window.innerHeight-Pn-C),o({left:N,top:k,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=f=>f.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let f=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${f} d\xEDa${f!==1?"s":""}`:`${f} day${f!==1?"s":""}`},m=f=>{if(f==null||f===0)return "N/A";let w=Math.floor(f/60),v=f%60;return w===0?`${v}m`:v===0?`${w}h`:`${w}h ${v}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",b=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Fd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ki,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(ki,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsx(ki,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(ki,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(f=>f.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|