@libxai/board 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -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 Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxs("div",{className:p("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:p("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(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(l=>jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[c,i]=useState("json"),[u,l]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:p("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:()=>d("export"),className:p("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:()=>d("import"),className:p("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(b=>jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxs("button",{onClick:()=>m.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"})]})]}),u&&jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Fy=["URGENT","HIGH","MEDIUM","LOW"],Py=[{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"}],My=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),h=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),y=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"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:b?"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"}),k&&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)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,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:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Fy.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 D=C.target.value;a({assignees:D==="all"?[]:[D]});},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))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.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:Py.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:My.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=useState(false),l=useRef(null);useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxs("div",{className:p("relative",r),ref:l,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>m(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:()=>m(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:()=>m(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:()=>m(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>m(()=>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:()=>m(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:()=>m(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 ql={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"}},Xl={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"}},Jl={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"}},Mo={dark:ql,light:Xl,neutral:Jl},_s="dark";var js=createContext(void 0),Uy="asakaa-theme";function kp({children:e,defaultTheme:t=_s,storageKey:a=Uy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Mo[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Wy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Mo};return jsx(js.Provider,{value:n,children:e})}function nn(){let e=useContext(js);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxs("div",{className:p("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(Mo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:p("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 Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing),...tt[e].dotGrid&&{dotGrid:tt[e].dotGrid},...tt[e].glassHeader&&{glassHeader:tt[e].glassHeader},...tt[e].glassToolbar&&{glassToolbar:tt[e].glassToolbar},...tt[e].forecastHud&&{forecastHud:tt[e].forecastHud},...tt[e].neonRedGlow&&{neonRedGlow:tt[e].neonRedGlow},...tt[e].executionBarBg&&{executionBarBg:tt[e].executionBarBg}}}var Ks={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"}},Tp={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"}},Zl={en:Ks,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=createContext(Ks);function Nr(){return useContext(ln)}function Xs(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(),d=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[c,i]=useState(null),[u,l]=useState(false),m=useRef(null),g=useRef(null),x=Nr(),b=Xs(m,n,"right"),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let k=C=>{let D=C.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(D){console.error(`Export ${k} failed:`,D);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!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:x.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:b.top,left:b.left-224,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxs(motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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===k.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"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?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:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function gx({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 fx({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 Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),c=Nr(),i=Xs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=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"}: ${l}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?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:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),c=useRef(null),i=Nr(),u=Xs(d,s,"left");useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{value:"all",label:i.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:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#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:i.toolbar.filter||"Filters"}),m&&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:u.top,left:u.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:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?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"}):x.icon;return jsxs(motion.button,{onClick:()=>{a(x.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:b?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:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function bx({value:e,onChange:t,theme:a}){let r=Nr(),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 d=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:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?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 hx({theme:e,forecast:t}){let a=Nr(),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,d=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},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<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&&d&&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:d})]})]}),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:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.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}),b&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function yx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=useState(false),g=useRef(null),x=useRef(null),b=Nr(),v=Xs(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:l&&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:v.top,left:v.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:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxs(motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 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:k*.03},children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.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:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxs(motion.button,{onClick:()=>u(y.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:(h.length+k)*.03},children:[jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Js({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:D,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportCSV:S,onExportJSON:R,onExportMSProject:$,showCriticalPath:de=true,onShowCriticalPathChange:F,showDependencies:X=true,onShowDependenciesChange:xe,highlightWeekends:_e=true,onHighlightWeekendsChange:M,showBaseline:W=false,onShowBaselineChange:re,onCopySnapshotLink:ke}){let O=Nr(),q=T||L||B||S||R||$,J=!!e.glassToolbar,[pe,Be]=useState(false),ze=useRef(null);useEffect(()=>{pe&&ze.current&&ze.current.focus();},[pe]);let it=[{value:"day",label:O.toolbar.day},{value:"week",label:O.toolbar.week},{value:"month",label:O.toolbar.month}],nt=[{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"})}],oe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(J){let ct=oe?"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:oe?"#1A1A1A":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:pe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Be(!pe),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"})}),pe&&jsx("input",{ref:ze,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:()=>Be(false),onKeyDown:Re=>{Re.key==="Escape"&&Be(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:oe?"#000000":e.bgSecondary,border:`1px solid ${oe?"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:k==="execution"?oe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:O.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?oe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:O.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),jsx(yx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:F,showBaseline:W,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:M,showDependencies:X,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),u&&m&&jsxs(motion.button,{onClick:m,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 ${oe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${oe?"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:l||O.toolbar.createTask})]})]})]}),D&&jsx(hx,{theme:e,forecast:D})]})}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(fx,{options:it,value:t,onChange:ct=>a(ct),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(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,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:l||O.toolbar.createTask})]}),(q||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(gx,{options:nt,value:s,onChange:ct=>n(ct),theme:e})]})]})}function Qs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.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(At,{children:jsx(motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u: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:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Vt={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 Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=useRef(false),x=useCallback(w=>{g.current=w;},[]),b=useCallback(w=>{let y=[],k=C=>{for(let D of C)y.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(w),y},[]),v=useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let D=k.findIndex(B=>B.id===C.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=k.length)return;let L=k[T];a(L.id,y);},[e,v,b,a]),h=useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),L=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("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)&&u(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),l(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),i(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Zs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Zs(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Gn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(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"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=Zs(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function fr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=fr(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{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((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ti({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:L}){let B=useContext(ln),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(""),xe=useRef(null),[_e,M]=useState(null),[W,re]=useState(0),[ke,O]=useState(0),[q,J]=useState({isOpen:false,x:0,y:0,type:"header"}),[pe,Be]=useState(null),[ze,it]=useState(null),[nt,oe]=useState(null),ct=useRef(0),Re=5,yt=useRef(false),[ft,pt]=useState(null),[Te,Xe]=useState(false),ot=useRef(null),[Qe,H]=useState(null),[se,N]=useState(false),Y=useRef(null);useEffect(()=>{function V(me){Y.current&&!Y.current.contains(me.target)&&N(false);}if(se)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[se]),useEffect(()=>{$&&xe.current&&(xe.current.focus(),xe.current.select());},[$]),useEffect(()=>{if(!_e)return;let V=Z=>{let A=Z.clientX-W,j=ke+A;m?.(_e,j);},me=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,W,ke,m]);let{selectedTaskIds:ie,handleTaskClick:he,isTaskSelected:_}=Hp(),{setIsEditing:ee}=Op({tasks:e,selectedTaskIds:ie,onTaskSelect:(V,me)=>{let A=pn(e).map(j=>j.id);he(V,A,me||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:V=>{let me=pn(e).find(Z=>Z.id===V);me&&lt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:V=>{let me=pn(e).find(Z=>Z.id===V);me&&C&&C(me);},enableKeyboard:true}),Ve=(V,me=0,Z="")=>{let A=[],j=[...V].sort((ae,Ne)=>(ae.position??0)-(Ne.position??0));for(let ae=0;ae<j.length;ae++){let Ne=j[ae],Pe=ae+1,Ye=Z?`${Z}.${Pe}`:`${Pe}.0`;if(Ne.wbsCode=Ye,A.push({task:Ne,level:me}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Oe=Z?`${Z}.${Pe}`:`${Pe}`;A.push(...Ve(Ne.subtasks,me+1,Oe));}}return A},ve=Ve(e),Ue=48,Se=Math.max(ve.length*a,600-Ue),He=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,lt=V=>{de(V.id),X(V.name),ee(true);},st=V=>{F.trim()&&F!==e.find(me=>me.id===V)?.name&&y?.(V,F.trim()),de(null),X(""),ee(false);},dt=()=>{de(null),X(""),ee(false);},mt=(V,me)=>{me.stopPropagation(),k?.(V.id);},It=(V,me)=>{me.preventDefault(),ct.current=me.clientY,Be(V),yt.current=false,Xe(false),pt({x:me.clientX,y:me.clientY});},z=V=>{if(!pe||(Math.abs(V.clientY-ct.current)>Re&&!yt.current&&(yt.current=true,Xe(true)),pt({x:V.clientX,y:V.clientY}),!yt.current))return;if(L?.current){let ae=L.current,Ne=ae.getBoundingClientRect(),Pe=60,Ye=12;ot.current&&(cancelAnimationFrame(ot.current),ot.current=null);let Oe=V.clientY-Ne.top,Dt=Ne.bottom-V.clientY;if(Oe<Pe&&ae.scrollTop>0){let gt=Math.round(Ye*(1-Oe/Pe)),Ut=()=>{ae.scrollTop-=gt,yt.current&&ae.scrollTop>0&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}else if(Dt<Pe&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let gt=Math.round(Ye*(1-Dt/Pe)),Ut=()=>{ae.scrollTop+=gt,yt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}}let Z=document.querySelectorAll("[data-task-row]"),A=null,j=null;Z.forEach(ae=>{let Ne=ae.getBoundingClientRect(),Pe=ae.getAttribute("data-task-row");if(Pe&&Pe!==pe&&V.clientY>=Ne.top&&V.clientY<=Ne.bottom){A=Pe;let Ye=V.clientY-Ne.top,Oe=Ne.height;Ye<Oe*.25?j="above":Ye>Oe*.75?j="below":j="child";}}),it(A),oe(j);},fe=()=>{if(yt.current&&pe&&ze&&nt){if(nt==="child")T?.(pe,ze);else if(nt==="above"||nt==="below"){let V=(j,ae,Ne=null)=>{for(let Pe of j){if(Pe.id===ae)return Ne;if(Pe.subtasks){let Ye=V(Pe.subtasks,ae,Pe.id);if(Ye!==void 0)return Ye}}},me=V(e,pe,null),Z=V(e,ze,null),A=(j,ae,Ne,Pe)=>{let Ye=j.findIndex(gt=>gt.id===ae),Oe=Pe?j.findIndex(gt=>gt.id===Ne):-1,Dt=nt==="below"?Ye+1:Ye;return Pe&&Oe!==-1&&Oe<Ye&&(Dt-=1),Math.max(0,Dt)};if(Z===null){let ae=A(e,ze,pe,me===null);T?.(pe,null,ae);}else {let j=ve.find(ae=>ae.task.id===Z)?.task;if(j?.subtasks){let ae=me===Z,Ne=A(j.subtasks,ze,pe,ae);T?.(pe,Z,Ne);}}}}ot.current&&(cancelAnimationFrame(ot.current),ot.current=null),Be(null),it(null),oe(null),pt(null),yt.current=false,Xe(false);};useEffect(()=>{if(pe)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,ze,nt]);let Ce=(V,me,Z)=>{let A=me.subtasks&&me.subtasks.length>0;switch(V.id){case "name":let j=$===me.id,ae=S===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[T&&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:ae?1:.3},onMouseDown:Le=>It(me.id,Le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:Le=>{Le.stopPropagation(),c?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.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"}),j?jsx("input",{ref:xe,type:"text",value:F,onChange:Le=>X(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"?st(me.id):Le.key==="Escape"&&dt();},onBlur:()=>st(me.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:Le=>Le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name})]}),ae&&!j&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Le=>Le.stopPropagation(),children:[jsx("button",{onClick:Le=>mt(me,Le),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:Le=>{Le.stopPropagation(),lt(me);},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 Pe=V.id==="startDate"?"startDate":"endDate",Ye=me[Pe],Oe=Qe?.taskId===me.id&&Qe?.field===Pe,Dt=Le=>Le?(typeof Le=="string"?new Date(Le):Le).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Le=>Le.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:A?.5:1,cursor:A?"default":"pointer"},title:A?"Auto-calculated from subtasks":void 0,onClick:Le=>{if(!A)if(Oe)H(null);else {let U=Le.currentTarget.getBoundingClientRect();H({taskId:me.id,field:Pe,month:Ye?typeof Ye=="string"?new Date(Ye):Ye:new Date,position:{top:U.bottom+4,left:U.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Dt(Ye)}),A&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(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:Qe?.position.top,left:Qe?.position.left},onClick:Le=>Le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Le=new Date,U=new Date(Le);U.setDate(Le.getDate()+1);let we=new Date(Le);we.setDate(Le.getDate()+7);let Ot=new Date(Le);return Ot.setDate(Le.getDate()+14),[{label:"Hoy",date:Le},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:Ot}].map((ce,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Je=>Je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Je=>Je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:ce.date}),H(null);},children:ce.label},$e))})(),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:Le=>Le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:void 0}),H(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:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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:Qe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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((Le,U)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Le},U))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Le=Qe?.month||new Date,U=Le.getFullYear(),we=Le.getMonth(),Ot=new Date(U,we,1).getDay(),P=new Date(U,we+1,0).getDate(),ce=new Date,$e=[];for(let xt=Ot-1;xt>=0;xt--)$e.push({day:new Date(U,we,-xt).getDate(),date:new Date(U,we-1,new Date(U,we,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=P;xt++)$e.push({day:xt,date:new Date(U,we,xt),isCurrentMonth:true});let Je=42-$e.length;for(let xt=1;xt<=Je;xt++)$e.push({day:xt,date:new Date(U,we+1,xt),isCurrentMonth:false});return $e.map((xt,za)=>{let ta=xt.date.toDateString()===ce.toDateString(),na=(Ye?typeof Ye=="string"?new Date(Ye):Ye:null)?.toDateString()===xt.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:xt.isCurrentMonth?na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:na?"#2E94FF":"transparent",boxShadow:ta&&!na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Pe]:xt.date}),H(null);},children:xt.day},za)})})()})]})]})]}),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:He(me)})});case "assignees":if(A)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 gt=r.filter(Le=>me.assignees?.some(U=>U.name===Le.name||U.initials===Le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(No,{assignedUsers:gt,availableUsers:r,onChange:Le=>{let U=Le.map(we=>({id:we.id,name:we.name,initials:we.initials,color:we.color}));g?.(me.id,{assignees:U.length>0?U:void 0});}})});case "status":if(A){let Le=me.progress===100?"\u2713":me.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:Le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(mu,{status:me.status||"todo",onChange:Le=>{g?.(me.id,{status:Le,progress:Le==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:A?.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:`${me.progress}%`,backgroundColor:me.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:[me.progress,"%"]})]});case "priority":let Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ya=Ut[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Co,{priority:ya,onChange:Le=>{Le&&g?.(me.id,{priority:Ta[Le]||"medium"});}})});default:return null}},Ke=V=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],qe=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}],ge=u.filter(V=>V.visible),te=ge.reduce((V,me)=>V+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:te},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ge.map((V,me)=>{let Z=me===ge.length-1,A=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(A?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Z?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:j=>{j.preventDefault(),J({isOpen:true,x:j.clientX,y:j.clientY,type:"header",columnId:V.id});},onMouseEnter:j=>{j.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:j=>{j.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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:j=>{j.preventDefault(),j.stopPropagation(),M(V.id),re(j.clientX),O(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.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(Qs,{columns:u,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>N(!se),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"})}),se&&jsxs("div",{ref:Y,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:V=>V.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:()=>N(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:Se},children:ve.map(({task:V,level:me},Z)=>{let A=_(V.id),j=ze===V.id,ae=j&&nt==="above",Ne=j&&nt==="below",Pe=j&&nt==="child",Ye={};return Pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${pe===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:A?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:A?t.accentLight:Pe?`${t.accent}15`:Z%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>R(V.id),onMouseLeave:()=>R(null),onClick:Oe=>{let gt=pn(e).map(ya=>ya.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;he(V.id,gt,Ta,Oe.shiftKey),s?.(V);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(V);},onContextMenu:Oe=>{Oe.preventDefault(),J({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:V}),d?.(V,Oe);},whileHover:{backgroundColor:A?t.accentLight:t.hoverBg},children:[ae&&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}}),ge.map((Oe,Dt)=>{let gt=Dt===ge.length-1,Ut=Oe.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(Ut?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${S===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ce(Oe,V,Ut?me:0)},`${V.id}-${Oe.id}`)})]},V.id)})}),jsx(un,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ke(q.columnId):q.type==="task"&&q.task?qe(q.task):[],onClose:()=>J({...q,isOpen:false}),theme:t}),Te&&ft&&pe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ft.x+12,top:ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=ve.find(me=>me.task.id===pe)?.task;return V?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:V.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[c,i]=useState(t),[u,l]=useState(null),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(0),[y,k]=useState(0),[C,D]=useState(null),[T,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,F)=>{r("none"),l(null),g(null),d(de),i(F),k(0),f(null),w(0);}}}function oi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=useRef(null),C=useRef(false),D=useRef(null),T=useRef(null),{dragMode:L,setDragMode:B,dragOffset:S,setDragOffset:R,ghostX:$,setGhostX:de,ghostWidth:F,setGhostWidth:X,connectionLine:xe,setConnectionLine:_e,hoveredTaskId:M,setHoveredTaskId:W,activeZone:re,setActiveZone:ke,draggedSegmentIndex:O,setDraggedSegmentIndex:q,draggedSegmentStartX:J,setDraggedSegmentStartX:pe,segmentDragOffsetX:Be,setSegmentDragOffsetX:ze,hoveredSegmentIndex:it,setHoveredSegmentIndex:nt,isHovered:oe,setIsHovered:ct,isDragging:Re,isResizing:yt,isConnecting:ft,resetDragState:pt}=y,Te=18,Xe=!!o.executionBarBg,ot=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=Xe?3:6,H=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let A=new Date(e.endDate);return A.setHours(0,0,0,0),A<Z})()&&e.progress<100,N=h&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=h&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ve=w?"default":Re?ft?"crosshair":yt?"ew-resize":"grabbing":"grab",ve=w?"default":"ew-resize",Se=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),He=r<50,lt=r<40;useEffect(()=>{b&&(!oe||Re||e.segments)&&b(null);},[oe,Re,e.segments,b]);let st=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),dt=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},mt=Z=>Math.round(Z/s)*s,It=Z=>{let A=Math.round(Z/s),j=new Date(n);return j.setDate(j.getDate()+A),j},z=(Z,A)=>{for(let j of g){if(j.id===e.id)continue;let ae=5;if(Z>=j.x-ae&&Z<=j.x+j.width+ae&&A>=j.y-ae&&A<=j.y+j.height+ae)return j.id}return null},fe=useCallback((Z,A,j)=>{if(w)return;Z.preventDefault(),Z.stopPropagation();let ae=k.current?.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=Z.clientX,Ne.y=Z.clientY;let Pe=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),Ye=j!==void 0?j:t,Oe=A;if(!Oe){let Dt=Pe.x-Ye;Z.shiftKey?(Oe="connect",_e({x:t+r,y:a+Te/2})):Z.ctrlKey||Z.metaKey?Oe="move":Z.altKey?Oe=Dt<r/2?"resize-start":"resize-end":lt?Dt<r/2?Oe="move":Oe="resize-end":He?Dt<=Se/2?Oe="resize-start":Dt>=r-Se/2?Oe="resize-end":Oe="move":Dt<=Se?Oe="resize-start":Dt>=r-Se?Oe="resize-end":Oe="move";}C.current=false,B(Oe),ct(false),ke(null),Oe==="move"?R(Pe.x-Ye):Oe==="connect"?_e({x:t+r,y:a+Te/2}):R(0),de(Ye),X(r);},[t,r,a,Te,w]),Ce=useCallback(Z=>{let A=k.current?.ownerSVGElement;if(!A)return;let j=A.closest(".gantt-timeline-scroll");if(!j)return;let ae=j.getBoundingClientRect(),Ne=60,Pe=15,Ye=0;if(Z.clientX<ae.left+Ne){let Oe=ae.left+Ne-Z.clientX;Ye=-Math.min(Pe,Oe/2);}else if(Z.clientX>ae.right-Ne){let Oe=Z.clientX-(ae.right-Ne);Ye=Math.min(Pe,Oe/2);}return Ye!==0&&(j.scrollLeft+=Ye),Ye!==0},[]),Ke=useCallback(Z=>{if(L==="none")return;C.current=true,T.current=Z;let A=k.current?.ownerSVGElement;if(!A)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=Ce(Z);Ne&&!D.current?D.current=window.setInterval(()=>{T.current&&(Ce(T.current),Ke(T.current));},16):!Ne&&D.current&&(window.clearInterval(D.current),D.current=null);}let j=A.createSVGPoint();j.x=Z.clientX,j.y=Z.clientY;let ae=j.matrixTransform(A.getScreenCTM()?.inverse());if(L==="connect"){_e({x:ae.x,y:ae.y});let Ne=z(ae.x,ae.y);W(Ne);}else if(L==="move"){let Ne=ae.x-S,Pe=mt(Ne);de(Pe),X(r);let Ye=Math.round((Pe-t)/s);if(x?.(e.id,Ye,true),e.segments&&e.segments.length>0&&O!==null){let Oe=Pe-J;ze(Oe);}}else if(L==="resize-start"){let Ne=ae.x,Pe=mt(Ne),Ye=t+r-Pe;Ye>=s&&(de(Pe),X(Ye));}else if(L==="resize-end"){let Ne=ae.x,Ye=mt(Ne)-t;Ye>=s&&X(Ye);}},[L,t,r,s,S,e,mt,O,J,z,W,_e,de,X,ze,x,Ce]),qe=useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,L!=="none"){if(L==="connect")M&&m&&m(e,M),_e(null),W(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),A,j,ae=true;if(L==="move"){if(A=It($),j=new Date(A.getTime()+Z),e.segments&&e.segments.length>0&&O!==null){let Ne=Math.round(Be/s),Pe=e.segments.map((gt,Ut)=>{if(Ut===O){let Ta=new Date(gt.startDate),ya=new Date(gt.endDate);return Ta.setDate(Ta.getDate()+Ne),ya.setDate(ya.getDate()+Ne),{startDate:Ta,endDate:ya}}return gt}),Ye=Pe.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ye.map(gt=>gt.getTime()))),Dt=new Date(Math.max(...Ye.map(gt=>gt.getTime())));l?.({...e,segments:Pe},Oe,Dt),pt(t,r);return}}else L==="resize-start"?(A=It($),j=e.endDate,A>j&&(console.warn("Invalid date range: start date must be before or equal to end date"),ae=false)):L==="resize-end"?(A=e.startDate,j=It($+F),j.setDate(j.getDate()-1),j<A&&(console.warn("Invalid date range: end date must be after or equal to start date"),ae=false)):ae=false;ae&&A&&j&&(j.getTime()<A.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,A,j));}x?.(e.id,0,false),pt(t,r);}},[L,$,F,e,l,M,m,t,r,s,It,Be,O,pt,x]);useEffect(()=>{if(L==="none")return;let Z=j=>{Ke(j);},A=()=>{qe();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",A),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,Ke,qe]);let ge=Re&&!ft?$:t,te=Re&&!ft?F:r,V=d.taskClass(e);return jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Re&&!C.current&&c?.(e),C.current=false;},onDoubleClick:Z=>{!Re&&!C.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!Re&&ct(true),onMouseMove:Z=>{b&&oe&&!Re&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{Re||(ct(false),ke(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),oe&&!Re&&!He&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Se,height:Te,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-start"),onMouseDown:Z=>fe(Z,"resize-start")}),jsx("rect",{x:t+Se,y:a,width:r-Se*2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r-Se,y:a,width:Se,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")})]}),oe&&!Re&&lt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")}),oe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!ft&&!e.segments&&jsx(motion.rect,{x:$,y:a,width:F,height:Te,rx:Qe,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let Z=e.baselineStartDate.getTime(),A=e.baselineEndDate.getTime(),j=n.getTime(),ae=864e5,Ne=(Z-j)/ae,Pe=(A-Z)/ae,Ye=Ne*s,Oe=Math.max(Pe*s,s),Dt=ge+te,gt=Ye+Oe,Ut=e.endDate?.getTime()??0,Ta=Math.ceil((Ut-A)/ae),ya=Ta>0,Le=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:Ye,y:a,width:Oe,height:Te,rx:Qe,fill:"none",stroke:ot?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ya&&Dt>gt&&jsx("rect",{x:gt,y:a,width:Dt-gt,height:Te,rx:0,fill:"#EF4444",opacity:.2}),ya&&jsxs("text",{x:Math.max(Dt,gt)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),Le&&jsxs("text",{x:Dt+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&Xe&&H&&(()=>{let A=a+(Te-6)/2,j=14,ae=a+(Te-j)/2,Ne=2;return jsxs("g",{"data-task-class":V,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:ge,y:A,width:te,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:ge,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:ge+te-Ne,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Xe&&!H&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:1,scale:oe&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>fe(Z),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!Xe&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:ee,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:oe?.9:.8,scale:oe&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:Z=>fe(Z),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),Xe&&(se||N)&&!e.segments&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,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&&(Xe&&H?null:jsx("rect",{x:ge,y:a,width:Math.max(te*(e.progress/100),Qe*2),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let Z=e.progress>0?te*(e.progress/100):0,A=ge+Z,j=te-Z,ae=e.progress===0?Qe:0,Ne=e.progress===0?ge:A,Pe=e.progress===0?te:j;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),Xe&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Re&&(()=>{let Z=ge+te*(e.progress/100),A=8,j=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:Z,cy:a+Te/2,r:A,fill:j?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:Z,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:j?.initials||j?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((Z,A)=>{let j=(Z.startDate.getTime()-n.getTime())/864e5*s,Ne=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-j+s,Pe=Re&&L==="move"&&O===A,Ye=it===A,Oe=Pe?j+Be:j;return jsxs("g",{onMouseEnter:()=>!Re&&nt(A),onMouseLeave:()=>!Re&&nt(null),children:[jsx(motion.rect,{x:Oe,y:a,width:Ne,height:Te,rx:Qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ye?.9:.8,scale:Ye&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),q(A),pe(j),fe(Dt,void 0,j);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Oe,y:a,width:Ne*(e.progress/100),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${A}`)}),Y&&(se||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&te>60&&!e.segments&&!(Xe&&H)&&(()=>{let Z=d.taskLabel(e),A=typeof Z=="string"?Z:e.name,j=A.length>Math.floor(te/8)?`${A.substring(0,Math.floor(te/8))}...`:A;return jsx("text",{x:ge+8,y:a+Te/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:j})})(),!Re&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(Xe?jsxs("text",{x:ge+te+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):te>100?jsxs("text",{x:ge+te-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&te>80&&!Re&&!e.segments&&!(Xe&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(oe||yt)&&!ft&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:ge-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-start"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-start");}}),jsx(motion.rect,{x:ge+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="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:ge+te-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-end"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-end");}}),jsx(motion.rect,{x:ge+te-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="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:oe&&!Re&&!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+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ke("connect"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ft&&xe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(oe||Re)&&!ft&&!e.segments&&jsx(motion.rect,{x:ge-1,y:a-1,width:te+2,height:Te+2,rx:Qe+1,fill:"none",stroke:Re?o.accent:Xe?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Xe?1:2,opacity:Re||Xe?.6:.4,initial:{opacity:0},animate:{opacity:Re||Xe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),yt&&jsxs(Fragment,{children:[jsx("line",{x1:$,y1:0,x2:$,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:$+F,y1:0,x2:$+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&!b&&(()=>{let j=a<100,ae=j?a+Te+13:a-82-13,Ne=j?`M ${ge+te/2-6} ${a+Te+3} L ${ge+te/2} ${a+Te+13} L ${ge+te/2+6} ${a+Te+3}`:`M ${ge+te/2-6} ${a-13} L ${ge+te/2} ${a-3} L ${ge+te/2+6} ${a-13}`,Pe=ae+22,Ye=ae+40,Oe=ae+55,Dt=ae+70,gt=j?ae+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:j?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:j?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:ge+te/2-120,y:ae,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:ge+te/2,y:Pe,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:ge+te/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:ge+te/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:ge+te/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:ge+te/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:ge+te/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:ge+te/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt()}),jsx("text",{x:ge+te/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:ge+te/2+65,y:Oe,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:ge+te/2-110,y:Dt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:ge+te/2-50,y:Dt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!j&&jsx("text",{x:ge+te/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":He?"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 ud=260,mn=8,qp=16,nv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,D=w+qp,T=y+nv-C;D+ud>window.innerWidth-mn&&(D=w-ud-qp),D<mn&&(D=mn);let L=T<mn;L&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:D,top:T,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${v}`,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(ni,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsx(ni,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:l},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxs("div",{className:p("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:p("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(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(l=>jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[c,i]=useState("json"),[u,l]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:p("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:()=>d("export"),className:p("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:()=>d("import"),className:p("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(b=>jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxs("button",{onClick:()=>m.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"})]})]}),u&&jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Fy=["URGENT","HIGH","MEDIUM","LOW"],Py=[{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"}],My=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),h=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),y=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"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:b?"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"}),k&&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)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,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:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Fy.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 D=C.target.value;a({assignees:D==="all"?[]:[D]});},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))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.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:Py.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:My.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=useState(false),l=useRef(null);useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxs("div",{className:p("relative",r),ref:l,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>m(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:()=>m(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:()=>m(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:()=>m(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>m(()=>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:()=>m(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:()=>m(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 ql={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"}},Xl={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"}},Jl={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"}},Mo={dark:ql,light:Xl,neutral:Jl},_s="dark";var js=createContext(void 0),Uy="asakaa-theme";function kp({children:e,defaultTheme:t=_s,storageKey:a=Uy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Mo[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Wy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Mo};return jsx(js.Provider,{value:n,children:e})}function nn(){let e=useContext(js);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxs("div",{className:p("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(Mo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:p("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 Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing),...tt[e].dotGrid&&{dotGrid:tt[e].dotGrid},...tt[e].glassHeader&&{glassHeader:tt[e].glassHeader},...tt[e].glassToolbar&&{glassToolbar:tt[e].glassToolbar},...tt[e].forecastHud&&{forecastHud:tt[e].forecastHud},...tt[e].neonRedGlow&&{neonRedGlow:tt[e].neonRedGlow},...tt[e].executionBarBg&&{executionBarBg:tt[e].executionBarBg}}}var Ks={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"}},Tp={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"}},Zl={en:Ks,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=createContext(Ks);function Nr(){return useContext(ln)}function Xs(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(),d=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[c,i]=useState(null),[u,l]=useState(false),m=useRef(null),g=useRef(null),x=Nr(),b=Xs(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let k=C=>{let D=C.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(D){console.error(`Export ${k} failed:`,D);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!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:x.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:b.top,left:b.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxs(motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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===k.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"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?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:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function gx({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 fx({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 Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),c=Nr(),i=Xs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=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"}: ${l}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?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:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),c=useRef(null),i=Nr(),u=Xs(d,s,"left");useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{value:"all",label:i.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:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#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:i.toolbar.filter||"Filters"}),m&&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:u.top,left:u.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:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?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"}):x.icon;return jsxs(motion.button,{onClick:()=>{a(x.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:b?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:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function bx({value:e,onChange:t,theme:a}){let r=Nr(),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 d=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:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?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 hx({theme:e,forecast:t}){let a=Nr(),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,d=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},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<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&&d&&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:d})]})]}),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:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.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}),b&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function yx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=useState(false),g=useRef(null),x=useRef(null),b=Nr(),v=Xs(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:l&&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:v.top,left:v.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:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxs(motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 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:k*.03},children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.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:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxs(motion.button,{onClick:()=>u(y.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:(h.length+k)*.03},children:[jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Js({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:D,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportCSV:S,onExportJSON:R,onExportMSProject:$,showCriticalPath:de=true,onShowCriticalPathChange:F,showDependencies:X=true,onShowDependenciesChange:xe,highlightWeekends:_e=true,onHighlightWeekendsChange:M,showBaseline:W=false,onShowBaselineChange:re,onCopySnapshotLink:ke}){let O=Nr(),q=T||L||B||S||R||$,J=!!e.glassToolbar,[pe,Be]=useState(false),ze=useRef(null);useEffect(()=>{pe&&ze.current&&ze.current.focus();},[pe]);let it=[{value:"day",label:O.toolbar.day},{value:"week",label:O.toolbar.week},{value:"month",label:O.toolbar.month}],nt=[{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"})}],oe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(J){let ct=oe?"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:oe?"#1A1A1A":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:pe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Be(!pe),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"})}),pe&&jsx("input",{ref:ze,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:()=>Be(false),onKeyDown:Re=>{Re.key==="Escape"&&Be(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:oe?"#000000":e.bgSecondary,border:`1px solid ${oe?"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:k==="execution"?oe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:O.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?oe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:O.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),jsx(yx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:F,showBaseline:W,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:M,showDependencies:X,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),u&&m&&jsxs(motion.button,{onClick:m,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 ${oe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${oe?"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:l||O.toolbar.createTask})]})]})]}),D&&jsx(hx,{theme:e,forecast:D})]})}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(fx,{options:it,value:t,onChange:ct=>a(ct),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(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,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:l||O.toolbar.createTask})]}),(q||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(gx,{options:nt,value:s,onChange:ct=>n(ct),theme:e})]})]})}function Qs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.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(At,{children:jsx(motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},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"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u: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:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Vt={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 Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=useRef(false),x=useCallback(w=>{g.current=w;},[]),b=useCallback(w=>{let y=[],k=C=>{for(let D of C)y.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(w),y},[]),v=useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let D=k.findIndex(B=>B.id===C.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=k.length)return;let L=k[T];a(L.id,y);},[e,v,b,a]),h=useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),L=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("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)&&u(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),l(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),i(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Zs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Zs(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Gn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(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"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=Zs(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function fr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=fr(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{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((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ti({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:L}){let B=useContext(ln),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(""),xe=useRef(null),[_e,M]=useState(null),[W,re]=useState(0),[ke,O]=useState(0),[q,J]=useState({isOpen:false,x:0,y:0,type:"header"}),[pe,Be]=useState(null),[ze,it]=useState(null),[nt,oe]=useState(null),ct=useRef(0),Re=5,yt=useRef(false),[ft,pt]=useState(null),[Te,Xe]=useState(false),ot=useRef(null),[Qe,H]=useState(null),[se,N]=useState(false),Y=useRef(null);useEffect(()=>{function V(me){Y.current&&!Y.current.contains(me.target)&&N(false);}if(se)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[se]),useEffect(()=>{$&&xe.current&&(xe.current.focus(),xe.current.select());},[$]),useEffect(()=>{if(!_e)return;let V=Z=>{let A=Z.clientX-W,j=ke+A;m?.(_e,j);},me=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,W,ke,m]);let{selectedTaskIds:ie,handleTaskClick:he,isTaskSelected:_}=Hp(),{setIsEditing:ee}=Op({tasks:e,selectedTaskIds:ie,onTaskSelect:(V,me)=>{let A=pn(e).map(j=>j.id);he(V,A,me||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:V=>{let me=pn(e).find(Z=>Z.id===V);me&&lt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:V=>{let me=pn(e).find(Z=>Z.id===V);me&&C&&C(me);},enableKeyboard:true}),Ve=(V,me=0,Z="")=>{let A=[],j=[...V].sort((ae,Ne)=>(ae.position??0)-(Ne.position??0));for(let ae=0;ae<j.length;ae++){let Ne=j[ae],Pe=ae+1,Ye=Z?`${Z}.${Pe}`:`${Pe}.0`;if(Ne.wbsCode=Ye,A.push({task:Ne,level:me}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Oe=Z?`${Z}.${Pe}`:`${Pe}`;A.push(...Ve(Ne.subtasks,me+1,Oe));}}return A},ve=Ve(e),Ue=48,Se=Math.max(ve.length*a,600-Ue),He=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,lt=V=>{de(V.id),X(V.name),ee(true);},st=V=>{F.trim()&&F!==e.find(me=>me.id===V)?.name&&y?.(V,F.trim()),de(null),X(""),ee(false);},dt=()=>{de(null),X(""),ee(false);},mt=(V,me)=>{me.stopPropagation(),k?.(V.id);},It=(V,me)=>{me.preventDefault(),ct.current=me.clientY,Be(V),yt.current=false,Xe(false),pt({x:me.clientX,y:me.clientY});},z=V=>{if(!pe||(Math.abs(V.clientY-ct.current)>Re&&!yt.current&&(yt.current=true,Xe(true)),pt({x:V.clientX,y:V.clientY}),!yt.current))return;if(L?.current){let ae=L.current,Ne=ae.getBoundingClientRect(),Pe=60,Ye=12;ot.current&&(cancelAnimationFrame(ot.current),ot.current=null);let Oe=V.clientY-Ne.top,Dt=Ne.bottom-V.clientY;if(Oe<Pe&&ae.scrollTop>0){let gt=Math.round(Ye*(1-Oe/Pe)),Ut=()=>{ae.scrollTop-=gt,yt.current&&ae.scrollTop>0&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}else if(Dt<Pe&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let gt=Math.round(Ye*(1-Dt/Pe)),Ut=()=>{ae.scrollTop+=gt,yt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}}let Z=document.querySelectorAll("[data-task-row]"),A=null,j=null;Z.forEach(ae=>{let Ne=ae.getBoundingClientRect(),Pe=ae.getAttribute("data-task-row");if(Pe&&Pe!==pe&&V.clientY>=Ne.top&&V.clientY<=Ne.bottom){A=Pe;let Ye=V.clientY-Ne.top,Oe=Ne.height;Ye<Oe*.25?j="above":Ye>Oe*.75?j="below":j="child";}}),it(A),oe(j);},fe=()=>{if(yt.current&&pe&&ze&&nt){if(nt==="child")T?.(pe,ze);else if(nt==="above"||nt==="below"){let V=(j,ae,Ne=null)=>{for(let Pe of j){if(Pe.id===ae)return Ne;if(Pe.subtasks){let Ye=V(Pe.subtasks,ae,Pe.id);if(Ye!==void 0)return Ye}}},me=V(e,pe,null),Z=V(e,ze,null),A=(j,ae,Ne,Pe)=>{let Ye=j.findIndex(gt=>gt.id===ae),Oe=Pe?j.findIndex(gt=>gt.id===Ne):-1,Dt=nt==="below"?Ye+1:Ye;return Pe&&Oe!==-1&&Oe<Ye&&(Dt-=1),Math.max(0,Dt)};if(Z===null){let ae=A(e,ze,pe,me===null);T?.(pe,null,ae);}else {let j=ve.find(ae=>ae.task.id===Z)?.task;if(j?.subtasks){let ae=me===Z,Ne=A(j.subtasks,ze,pe,ae);T?.(pe,Z,Ne);}}}}ot.current&&(cancelAnimationFrame(ot.current),ot.current=null),Be(null),it(null),oe(null),pt(null),yt.current=false,Xe(false);};useEffect(()=>{if(pe)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,ze,nt]);let Ce=(V,me,Z)=>{let A=me.subtasks&&me.subtasks.length>0;switch(V.id){case "name":let j=$===me.id,ae=S===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[T&&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:ae?1:.3},onMouseDown:Le=>It(me.id,Le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:Le=>{Le.stopPropagation(),c?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.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"}),j?jsx("input",{ref:xe,type:"text",value:F,onChange:Le=>X(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"?st(me.id):Le.key==="Escape"&&dt();},onBlur:()=>st(me.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:Le=>Le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name})]}),ae&&!j&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Le=>Le.stopPropagation(),children:[jsx("button",{onClick:Le=>mt(me,Le),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:Le=>{Le.stopPropagation(),lt(me);},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 Pe=V.id==="startDate"?"startDate":"endDate",Ye=me[Pe],Oe=Qe?.taskId===me.id&&Qe?.field===Pe,Dt=Le=>Le?(typeof Le=="string"?new Date(Le):Le).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Le=>Le.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:A?.5:1,cursor:A?"default":"pointer"},title:A?"Auto-calculated from subtasks":void 0,onClick:Le=>{if(!A)if(Oe)H(null);else {let U=Le.currentTarget.getBoundingClientRect();H({taskId:me.id,field:Pe,month:Ye?typeof Ye=="string"?new Date(Ye):Ye:new Date,position:{top:U.bottom+4,left:U.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Dt(Ye)}),A&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(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:Qe?.position.top,left:Qe?.position.left},onClick:Le=>Le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Le=new Date,U=new Date(Le);U.setDate(Le.getDate()+1);let we=new Date(Le);we.setDate(Le.getDate()+7);let Ot=new Date(Le);return Ot.setDate(Le.getDate()+14),[{label:"Hoy",date:Le},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:Ot}].map((ce,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Je=>Je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Je=>Je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:ce.date}),H(null);},children:ce.label},$e))})(),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:Le=>Le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:void 0}),H(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:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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:Qe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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((Le,U)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Le},U))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Le=Qe?.month||new Date,U=Le.getFullYear(),we=Le.getMonth(),Ot=new Date(U,we,1).getDay(),P=new Date(U,we+1,0).getDate(),ce=new Date,$e=[];for(let xt=Ot-1;xt>=0;xt--)$e.push({day:new Date(U,we,-xt).getDate(),date:new Date(U,we-1,new Date(U,we,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=P;xt++)$e.push({day:xt,date:new Date(U,we,xt),isCurrentMonth:true});let Je=42-$e.length;for(let xt=1;xt<=Je;xt++)$e.push({day:xt,date:new Date(U,we+1,xt),isCurrentMonth:false});return $e.map((xt,za)=>{let ta=xt.date.toDateString()===ce.toDateString(),na=(Ye?typeof Ye=="string"?new Date(Ye):Ye:null)?.toDateString()===xt.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:xt.isCurrentMonth?na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:na?"#2E94FF":"transparent",boxShadow:ta&&!na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Pe]:xt.date}),H(null);},children:xt.day},za)})})()})]})]})]}),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:He(me)})});case "assignees":if(A)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 gt=r.filter(Le=>me.assignees?.some(U=>U.name===Le.name||U.initials===Le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(No,{assignedUsers:gt,availableUsers:r,onChange:Le=>{let U=Le.map(we=>({id:we.id,name:we.name,initials:we.initials,color:we.color}));g?.(me.id,{assignees:U.length>0?U:void 0});}})});case "status":if(A){let Le=me.progress===100?"\u2713":me.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:Le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(mu,{status:me.status||"todo",onChange:Le=>{g?.(me.id,{status:Le,progress:Le==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:A?.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:`${me.progress}%`,backgroundColor:me.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:[me.progress,"%"]})]});case "priority":let Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ya=Ut[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Co,{priority:ya,onChange:Le=>{Le&&g?.(me.id,{priority:Ta[Le]||"medium"});}})});default:return null}},Ke=V=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],qe=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}],ge=u.filter(V=>V.visible),te=ge.reduce((V,me)=>V+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:te},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ge.map((V,me)=>{let Z=me===ge.length-1,A=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(A?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Z?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:j=>{j.preventDefault(),J({isOpen:true,x:j.clientX,y:j.clientY,type:"header",columnId:V.id});},onMouseEnter:j=>{j.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:j=>{j.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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:j=>{j.preventDefault(),j.stopPropagation(),M(V.id),re(j.clientX),O(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.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(Qs,{columns:u,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>N(!se),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"})}),se&&jsxs("div",{ref:Y,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:V=>V.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:()=>N(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:Se},children:ve.map(({task:V,level:me},Z)=>{let A=_(V.id),j=ze===V.id,ae=j&&nt==="above",Ne=j&&nt==="below",Pe=j&&nt==="child",Ye={};return Pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${pe===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:A?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:A?t.accentLight:Pe?`${t.accent}15`:Z%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>R(V.id),onMouseLeave:()=>R(null),onClick:Oe=>{let gt=pn(e).map(ya=>ya.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;he(V.id,gt,Ta,Oe.shiftKey),s?.(V);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(V);},onContextMenu:Oe=>{Oe.preventDefault(),J({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:V}),d?.(V,Oe);},whileHover:{backgroundColor:A?t.accentLight:t.hoverBg},children:[ae&&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}}),ge.map((Oe,Dt)=>{let gt=Dt===ge.length-1,Ut=Oe.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(Ut?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${S===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ce(Oe,V,Ut?me:0)},`${V.id}-${Oe.id}`)})]},V.id)})}),jsx(un,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ke(q.columnId):q.type==="task"&&q.task?qe(q.task):[],onClose:()=>J({...q,isOpen:false}),theme:t}),Te&&ft&&pe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ft.x+12,top:ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=ve.find(me=>me.task.id===pe)?.task;return V?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:V.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[c,i]=useState(t),[u,l]=useState(null),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(0),[y,k]=useState(0),[C,D]=useState(null),[T,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,F)=>{r("none"),l(null),g(null),d(de),i(F),k(0),f(null),w(0);}}}function oi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=useRef(null),C=useRef(false),D=useRef(null),T=useRef(null),{dragMode:L,setDragMode:B,dragOffset:S,setDragOffset:R,ghostX:$,setGhostX:de,ghostWidth:F,setGhostWidth:X,connectionLine:xe,setConnectionLine:_e,hoveredTaskId:M,setHoveredTaskId:W,activeZone:re,setActiveZone:ke,draggedSegmentIndex:O,setDraggedSegmentIndex:q,draggedSegmentStartX:J,setDraggedSegmentStartX:pe,segmentDragOffsetX:Be,setSegmentDragOffsetX:ze,hoveredSegmentIndex:it,setHoveredSegmentIndex:nt,isHovered:oe,setIsHovered:ct,isDragging:Re,isResizing:yt,isConnecting:ft,resetDragState:pt}=y,Te=18,Xe=!!o.executionBarBg,ot=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=Xe?3:6,H=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let A=new Date(e.endDate);return A.setHours(0,0,0,0),A<Z})()&&e.progress<100,N=h&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=h&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ve=w?"default":Re?ft?"crosshair":yt?"ew-resize":"grabbing":"grab",ve=w?"default":"ew-resize",Se=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),He=r<50,lt=r<40;useEffect(()=>{b&&(!oe||Re||e.segments)&&b(null);},[oe,Re,e.segments,b]);let st=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),dt=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},mt=Z=>Math.round(Z/s)*s,It=Z=>{let A=Math.round(Z/s),j=new Date(n);return j.setDate(j.getDate()+A),j},z=(Z,A)=>{for(let j of g){if(j.id===e.id)continue;let ae=5;if(Z>=j.x-ae&&Z<=j.x+j.width+ae&&A>=j.y-ae&&A<=j.y+j.height+ae)return j.id}return null},fe=useCallback((Z,A,j)=>{if(w)return;Z.preventDefault(),Z.stopPropagation();let ae=k.current?.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=Z.clientX,Ne.y=Z.clientY;let Pe=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),Ye=j!==void 0?j:t,Oe=A;if(!Oe){let Dt=Pe.x-Ye;Z.shiftKey?(Oe="connect",_e({x:t+r,y:a+Te/2})):Z.ctrlKey||Z.metaKey?Oe="move":Z.altKey?Oe=Dt<r/2?"resize-start":"resize-end":lt?Dt<r/2?Oe="move":Oe="resize-end":He?Dt<=Se/2?Oe="resize-start":Dt>=r-Se/2?Oe="resize-end":Oe="move":Dt<=Se?Oe="resize-start":Dt>=r-Se?Oe="resize-end":Oe="move";}C.current=false,B(Oe),ct(false),ke(null),Oe==="move"?R(Pe.x-Ye):Oe==="connect"?_e({x:t+r,y:a+Te/2}):R(0),de(Ye),X(r);},[t,r,a,Te,w]),Ce=useCallback(Z=>{let A=k.current?.ownerSVGElement;if(!A)return;let j=A.closest(".gantt-timeline-scroll");if(!j)return;let ae=j.getBoundingClientRect(),Ne=60,Pe=15,Ye=0;if(Z.clientX<ae.left+Ne){let Oe=ae.left+Ne-Z.clientX;Ye=-Math.min(Pe,Oe/2);}else if(Z.clientX>ae.right-Ne){let Oe=Z.clientX-(ae.right-Ne);Ye=Math.min(Pe,Oe/2);}return Ye!==0&&(j.scrollLeft+=Ye),Ye!==0},[]),Ke=useCallback(Z=>{if(L==="none")return;C.current=true,T.current=Z;let A=k.current?.ownerSVGElement;if(!A)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=Ce(Z);Ne&&!D.current?D.current=window.setInterval(()=>{T.current&&(Ce(T.current),Ke(T.current));},16):!Ne&&D.current&&(window.clearInterval(D.current),D.current=null);}let j=A.createSVGPoint();j.x=Z.clientX,j.y=Z.clientY;let ae=j.matrixTransform(A.getScreenCTM()?.inverse());if(L==="connect"){_e({x:ae.x,y:ae.y});let Ne=z(ae.x,ae.y);W(Ne);}else if(L==="move"){let Ne=ae.x-S,Pe=mt(Ne);de(Pe),X(r);let Ye=Math.round((Pe-t)/s);if(x?.(e.id,Ye,true),e.segments&&e.segments.length>0&&O!==null){let Oe=Pe-J;ze(Oe);}}else if(L==="resize-start"){let Ne=ae.x,Pe=mt(Ne),Ye=t+r-Pe;Ye>=s&&(de(Pe),X(Ye));}else if(L==="resize-end"){let Ne=ae.x,Ye=mt(Ne)-t;Ye>=s&&X(Ye);}},[L,t,r,s,S,e,mt,O,J,z,W,_e,de,X,ze,x,Ce]),qe=useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,L!=="none"){if(L==="connect")M&&m&&m(e,M),_e(null),W(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),A,j,ae=true;if(L==="move"){if(A=It($),j=new Date(A.getTime()+Z),e.segments&&e.segments.length>0&&O!==null){let Ne=Math.round(Be/s),Pe=e.segments.map((gt,Ut)=>{if(Ut===O){let Ta=new Date(gt.startDate),ya=new Date(gt.endDate);return Ta.setDate(Ta.getDate()+Ne),ya.setDate(ya.getDate()+Ne),{startDate:Ta,endDate:ya}}return gt}),Ye=Pe.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ye.map(gt=>gt.getTime()))),Dt=new Date(Math.max(...Ye.map(gt=>gt.getTime())));l?.({...e,segments:Pe},Oe,Dt),pt(t,r);return}}else L==="resize-start"?(A=It($),j=e.endDate,A>j&&(console.warn("Invalid date range: start date must be before or equal to end date"),ae=false)):L==="resize-end"?(A=e.startDate,j=It($+F),j.setDate(j.getDate()-1),j<A&&(console.warn("Invalid date range: end date must be after or equal to start date"),ae=false)):ae=false;ae&&A&&j&&(j.getTime()<A.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,A,j));}x?.(e.id,0,false),pt(t,r);}},[L,$,F,e,l,M,m,t,r,s,It,Be,O,pt,x]);useEffect(()=>{if(L==="none")return;let Z=j=>{Ke(j);},A=()=>{qe();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",A),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,Ke,qe]);let ge=Re&&!ft?$:t,te=Re&&!ft?F:r,V=d.taskClass(e);return jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Re&&!C.current&&c?.(e),C.current=false;},onDoubleClick:Z=>{!Re&&!C.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!Re&&ct(true),onMouseMove:Z=>{b&&oe&&!Re&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{Re||(ct(false),ke(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),oe&&!Re&&!He&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Se,height:Te,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-start"),onMouseDown:Z=>fe(Z,"resize-start")}),jsx("rect",{x:t+Se,y:a,width:r-Se*2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r-Se,y:a,width:Se,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")})]}),oe&&!Re&&lt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")}),oe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!ft&&!e.segments&&jsx(motion.rect,{x:$,y:a,width:F,height:Te,rx:Qe,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let Z=e.baselineStartDate.getTime(),A=e.baselineEndDate.getTime(),j=n.getTime(),ae=864e5,Ne=(Z-j)/ae,Pe=(A-Z)/ae,Ye=Ne*s,Oe=Math.max(Pe*s,s),Dt=ge+te,gt=Ye+Oe,Ut=e.endDate?.getTime()??0,Ta=Math.ceil((Ut-A)/ae),ya=Ta>0,Le=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:Ye,y:a,width:Oe,height:Te,rx:Qe,fill:"none",stroke:ot?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ya&&Dt>gt&&jsx("rect",{x:gt,y:a,width:Dt-gt,height:Te,rx:0,fill:"#EF4444",opacity:.2}),ya&&jsxs("text",{x:Math.max(Dt,gt)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),Le&&jsxs("text",{x:Dt+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&Xe&&H&&(()=>{let A=a+(Te-6)/2,j=14,ae=a+(Te-j)/2,Ne=2;return jsxs("g",{"data-task-class":V,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:ge,y:A,width:te,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:ge,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:ge+te-Ne,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Xe&&!H&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:1,scale:oe&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>fe(Z),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!Xe&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:ee,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:oe?.9:.8,scale:oe&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:Z=>fe(Z),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),Xe&&(se||N)&&!e.segments&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,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&&(Xe&&H?null:jsx("rect",{x:ge,y:a,width:Math.max(te*(e.progress/100),Qe*2),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let Z=e.progress>0?te*(e.progress/100):0,A=ge+Z,j=te-Z,ae=e.progress===0?Qe:0,Ne=e.progress===0?ge:A,Pe=e.progress===0?te:j;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),Xe&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Re&&(()=>{let Z=ge+te*(e.progress/100),A=8,j=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:Z,cy:a+Te/2,r:A,fill:j?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:Z,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:j?.initials||j?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((Z,A)=>{let j=(Z.startDate.getTime()-n.getTime())/864e5*s,Ne=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-j+s,Pe=Re&&L==="move"&&O===A,Ye=it===A,Oe=Pe?j+Be:j;return jsxs("g",{onMouseEnter:()=>!Re&&nt(A),onMouseLeave:()=>!Re&&nt(null),children:[jsx(motion.rect,{x:Oe,y:a,width:Ne,height:Te,rx:Qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ye?.9:.8,scale:Ye&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),q(A),pe(j),fe(Dt,void 0,j);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Oe,y:a,width:Ne*(e.progress/100),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${A}`)}),Y&&(se||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&te>60&&!e.segments&&!(Xe&&H)&&(()=>{let Z=d.taskLabel(e),A=typeof Z=="string"?Z:e.name,j=A.length>Math.floor(te/8)?`${A.substring(0,Math.floor(te/8))}...`:A;return jsx("text",{x:ge+8,y:a+Te/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:j})})(),!Re&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(Xe?jsxs("text",{x:ge+te+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):te>100?jsxs("text",{x:ge+te-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&te>80&&!Re&&!e.segments&&!(Xe&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(oe||yt)&&!ft&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:ge-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-start"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-start");}}),jsx(motion.rect,{x:ge+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="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:ge+te-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-end"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-end");}}),jsx(motion.rect,{x:ge+te-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="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:oe&&!Re&&!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+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ke("connect"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ft&&xe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(oe||Re)&&!ft&&!e.segments&&jsx(motion.rect,{x:ge-1,y:a-1,width:te+2,height:Te+2,rx:Qe+1,fill:"none",stroke:Re?o.accent:Xe?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Xe?1:2,opacity:Re||Xe?.6:.4,initial:{opacity:0},animate:{opacity:Re||Xe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),yt&&jsxs(Fragment,{children:[jsx("line",{x1:$,y1:0,x2:$,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:$+F,y1:0,x2:$+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&!b&&(()=>{let j=a<100,ae=j?a+Te+13:a-82-13,Ne=j?`M ${ge+te/2-6} ${a+Te+3} L ${ge+te/2} ${a+Te+13} L ${ge+te/2+6} ${a+Te+3}`:`M ${ge+te/2-6} ${a-13} L ${ge+te/2} ${a-3} L ${ge+te/2+6} ${a-13}`,Pe=ae+22,Ye=ae+40,Oe=ae+55,Dt=ae+70,gt=j?ae+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:j?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:j?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:ge+te/2-120,y:ae,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:ge+te/2,y:Pe,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:ge+te/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:ge+te/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:ge+te/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:ge+te/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:ge+te/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:ge+te/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt()}),jsx("text",{x:ge+te/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:ge+te/2+65,y:Oe,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:ge+te/2-110,y:Dt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:ge+te/2-50,y:Dt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!j&&jsx("text",{x:ge+te/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":He?"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 ud=260,mn=8,qp=16,nv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,D=w+qp,T=y+nv-C;D+ud>window.innerWidth-mn&&(D=w-ud-qp),D<mn&&(D=mn);let L=T<mn;L&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:D,top:T,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${v}`,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(ni,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsx(ni,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:l},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(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); }